@stormid/cookie-banner
Advanced tools
Comparing version 1.0.0-alpha.23 to 1.0.0-alpha.24
@@ -1,2 +0,2 @@ | ||
var e=["button","a"],n=["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex="-1"])'],t={ec:"Banner",ea:"Displays",cm1:1},s={ec:"Save preferences",ea:"Banner",cm2:1,cm3:1},i={ec:"Banner",ea:"Clicks",el:"Edit preferences",cm4:1},a={ec:"CookiePrefsWidget",ea:"Displays",cm5:1},r={ec:"Save preferences",ea:"CookiePrefs"},c=function(e){document.cookie=[e.settings.name+"="+btoa(JSON.stringify({consent:e.consent,cid:e.persistentMeasurementParams.cid}))+";","expires="+new Date((new Date).getTime()+24*e.settings.expiry*60*60*1e3).toGMTString()+";",e.settings.path?"path="+e.settings.path+";":"",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")},o=function(e){document.cookie.split("; ").map(function(e){return{name:e.split("=")[0],value:e.split("=")[1],expiry:"Thu, 01 Jan 1970 00:00:01 GMT"}}).map(function(e){return function(n){return document.cookie=[n.name+"="+n.value+";","expires="+n.expiry+";","path="+e.settings.path+";",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")}}(e))},l=function(e){return function(n,t){return n[t]=n[t]?Object.assign({},n[t],{fns:n[t].fns.concat(e.types[t].fns)}):e.types[t],n}},u=function(){},d=function(e){return/radio|checkbox/i.test(e.type)},p=function(e,n){return!d(n)&&function(e){return null!=e.value&&e.value.length>0}(n)&&(e=n.value),d(n)&&n.checked&&(Array.isArray(e)?e.push(n.value):e=[n.value]),e},m="ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|be|bf|bg|bh|bi|bj|bm|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|cl|cm|cn|co|cr|cu|cv|cw|cx|cz|de|dj|dk|dm|do|dz|ec|ee|eg|es|et|eu|fi|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|im|in|io|iq|ir|is|it|je|jo|jp|kg|ki|km|kn|kp|kr|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|na|nc|ne|nf|ng|nl|no|nr|nu|nz|om|pa|pe|pf|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|yt".split("|"),g="netlify|azurewebsites|com|edu|gov|net|mil|org|nom|sch|caa|res|off|gob|int|tur|ip6|uri|urn|asn|act|nsw|qld|tas|vic|pro|biz|adm|adv|agr|arq|art|ato|bio|bmd|cim|cng|cnt|ecn|eco|emp|eng|esp|etc|eti|far|fnd|fot|fst|g12|ggf|imb|ind|inf|jor|jus|leg|lel|mat|med|mus|not|ntr|odo|ppg|psc|psi|qsl|rec|slg|srv|teo|tmp|trd|vet|zlg|web|ltd|sld|pol|fin|k12|lib|pri|aip|fie|eun|sci|prd|cci|pvt|mod|idv|rel|sex|gen|nic|abr|bas|cal|cam|emr|fvg|laz|lig|lom|mar|mol|pmn|pug|sar|sic|taa|tos|umb|vao|vda|ven|mie|北海道|和歌山|神奈川|鹿児島|ass|rep|tra|per|ngo|soc|grp|plc|its|air|and|bus|can|ddr|jfk|mad|nrw|nyc|ski|spy|tcm|ulm|usa|war|fhs|vgs|dep|eid|fet|fla|flå|gol|hof|hol|sel|vik|cri|iwi|ing|abo|fam|gok|gon|gop|gos|aid|atm|gsm|sos|elk|waw|est|aca|bar|cpa|jur|law|sec|plo|www|bir|cbg|jar|khv|msk|nov|nsk|ptz|rnd|spb|stv|tom|tsk|udm|vrn|cmw|kms|nkz|snz|pub|fhv|red|ens|nat|rns|rnu|bbs|tel|bel|kep|nhs|dni|fed|isa|nsn|gub|e12|tec|орг|обр|упр|alt|nis|jpn|mex|ath|iki|nid|gda|inc".split("|"),f=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})},b=function(e,n){return function(){var t=new CustomEvent(e,{bubbles:!0,detail:{getState:n.getState}});window.document.dispatchEvent(t)}},v={name:".CookiePreferences",path:"/",domain:"localhost"===window.location.hostname?"":"."+function(e){for(var n=(e=e.replace(/^www\./,"")).split(".");n.length>3;)n.shift();return 3===n.length&&-1===g.indexOf(n[1])&&-1===m.indexOf(n[2])&&n.shift(),n.join(".")}(window.location.hostname),secure:!0,samesite:"strict",expiry:365,types:{},necessary:[],policyURL:"/cookie-policy/#preferences",classNames:{banner:"privacy-banner",acceptBtn:"privacy-banner__accept",submitBtn:"privacy-banner__submit",optionsBtn:"privacy-banner__options",field:"privacy-banner__field",form:"privacy-banner__form",fieldset:"privacy-banner__fieldset",legend:"privacy-banner__legend",formContainer:"privacy-banner__form-container",formMessage:"privacy-banner__form-msg",title:"privacy-banner__form-title",description:"privacy-banner__form-description"},hideBannerOnFormPage:!0,savedMessage:"Your settings have been saved.",bannerTemplate:function(e){return'<section role="dialog" aria-live="polite" aria-label="Your privacy" class="'+e.classNames.banner+'">\n <div class="privacy-content">\n <div class="wrap">\n \x3c!--googleoff: all--\x3e\n <div class="privacy-banner__title">Cookies</div>\n <p>We use cookies to improve your experience on our site and show you personalised advertising.</p>\n <p>Find out more from our <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="/privacy-policy">privacy policy</a> and <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">cookie policy</a>.</p>\n <button type="button" class="btn btn--primary '+e.classNames.acceptBtn+'">Accept and close</button>\n <a class="privacy-banner__link '+e.classNames.optionsBtn+'" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">Your options</a>\n \x3c!--googleon: all--\x3e\n </div>\n </div>\n </section>'},messageTemplate:function(e){return'<div class="'+e.settings.classNames.formMessage+'" aria-role="alert">'+e.settings.savedMessage+"</div>"},formTemplate:function(e){return'<form id="preferences" class="'+e.settings.classNames.form+'" novalidate>\n '+Object.keys(e.settings.types).map(function(n){return'<fieldset class="'+e.settings.classNames.fieldset+'">\n <legend class="'+e.settings.classNames.legend+'">\n <span class="'+e.settings.classNames.title+'">'+e.settings.types[n].title+'</span>\n <span class="'+e.settings.classNames.description+'">'+e.settings.types[n].description+'</span>\n </legend>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+n.split(" ")[0].replace(" ","-")+'"\n value="1"\n '+(1===e.consent[n]?"checked":"")+'>\n <span class="privacy-banner__label-text">I am OK with this</span>\n <span class="privacy-banner__label-description">'+e.settings.types[n].labels.yes+'</span>\n </label> \n </div>\n </div>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+n.split(" ")[0].replace(" ","-")+'"\n value="0"\n '+(0===e.consent[n]?"checked":"")+'>\n <span class="privacy-banner__label-text">No thank you</span>\n <span class="privacy-banner__label-description">'+e.settings.types[n].labels.no+"</span>\n </label> \n </div>\n </div>\n </fieldset>"}).join("")+'\n <button class="'+e.settings.classNames.submitBtn+'"'+(Object.keys(e.consent).length!==Object.keys(e.settings.types).length?" disabled":"")+">Save my settings</button>\n </form>"}};function y(){return y=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},y.apply(this,arguments)}var h=function(e,n){return n},k=function(e,n){return Object.assign({},e,{bannerOpen:n})},w=function(e,n){return Object.assign({},e,{consent:Object.assign({},e.consent,n)})},x=function(e,n){return Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,n)})})},j=function(e){return function(n){Object.keys(n.consent).forEach(function(e){n.settings.types[e]&&!0!==n.settings.types[e].executed&&n.consent[e]&&Boolean(n.consent[e])&&n.settings.types[e].fns.forEach(function(e){return e(n)})}),e.update(x,Object.keys(n.settings.types).reduce(function(e,t){return e[t]=Object.assign({},n.settings.types[t],{executed:n.settings.types[t].executed||n.consent[t]&&Boolean(n.consent[t])}),e},{}))}},_=function(e){e.settings.necessary.forEach(function(n){return n(e)})},O=function(e){return Object.keys(e).filter(function(n){return e[n]}).join(",")},S=function(){try{var e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},N=function(e,n,t){return void 0===t&&(t="collect"),function(e){if(!navigator.sendBeacon){var n=document.createElement("img");return n.width=1,n.height=1,n.src=e,n}navigator.sendBeacon(e)}(function(e,n){return"https://www.google-analytics.com/"+n+"?"+function(e){return Object.keys(e).reduce(function(n,t){return null!==e[t]&&n.push(t+"="+encodeURIComponent(e[t])),n},[]).join("&")}(e)}(y({},e.persistentMeasurementParams,n,e.settings.debug?{}:{z:S()}),t))},B=function(e){return function(){var n=e.getState();n.bannerOpen||n.settings.hideBannerOnFormPage&&document.querySelector("."+n.settings.classNames.formContainer)||(document.body.firstElementChild.insertAdjacentHTML("beforebegin",n.settings.bannerTemplate(n.settings)),n.settings.tid&&N(n,t),e.update(k,!0,[b("banner.show",e)]))}},q=function(n){return function(){var t=n.getState(),a=document.querySelector("."+t.settings.classNames.banner);if(a){var r=function(n){return e.map(function(e){return e+"."+n}).join(", ")},o=[].slice.call(document.querySelectorAll(r(t.settings.classNames.acceptBtn))),l=document.querySelector(r(t.settings.classNames.optionsBtn));o.forEach(function(e){o?e.addEventListener("click",function(e){n.update(w,Object.keys(t.settings.types).reduce(function(e,n){return e[n]=1,e},{}),[c,j(n),E(n,a),A(n,!1),b("banner.consent",n),function(e){e.settings.tid&&N(e,y({},s,{cd2:O(n.getState().consent)}))}])}):console.warn("Banner accept element must be a Button or Anchor. No trigger event added.")}),l&&t.settings.tid?l.addEventListener("click",function(e){return N(t,i)}):console.warn("No trigger added for options element. Check that the element is a Button or Anchor and that your tid is set.")}}},E=function(e,n){return function(){n&&n.parentNode&&(n.parentNode.removeChild(n),e.update(k,!1,[b("banner.hide",e)]))}},A=function(e,n){return void 0===n&&(n=!0),function(){var t=e.getState(),s=document.querySelector("."+t.settings.classNames.formContainer);if(s){s.innerHTML=t.settings.formTemplate(function(e){return Object.keys(e.consent).length>0?e:Object.assign({},e,{consent:Object.keys(e.settings.types).reduce(function(n,t){return e.settings.types[t].suggested&&(n[t]=1),n},{})})}(t)),t.settings.tid&&n&&N(t,a);var i=document.querySelector("."+t.settings.classNames.form),l=document.querySelector("."+t.settings.classNames.banner),u=document.querySelector("."+t.settings.classNames.submitBtn),d=[].slice.call(document.querySelectorAll("."+t.settings.classNames.field)).reduce(function(e,n){var t=n.getAttribute("name").replace("privacy-","");return e[t]?e[t].push(n):e[t]=[n],e},{}),m=function(){return Object.keys(d).reduce(function(e,n){var t=d[n].reduce(p,"");return t&&(e[n]=parseInt(t,10)),e},{})};u.hasAttribute("disabled")&&i.addEventListener("change",function e(n){Object.keys(m()).length===Object.keys(d).length&&(u.removeAttribute("disabled"),i.removeEventListener("change",e))}),i.addEventListener("submit",function(n){n.preventDefault(),e.update(w,m(),[o,c,j(e),E(e,l),b("banner.consent",e),T(u),function(e){if(e.settings.tid){var n=O(e.consent);N(e,y({},r,{cd2:""===n?"None":n,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}}])}),window.location.hash.substring(1)===i.id&&window.scrollTo(0,i.getBoundingClientRect().top+window.scrollY)}}},T=function(e){return function(n){e.insertAdjacentHTML("afterend",n.settings.messageTemplate(n)),e.setAttribute("disabled","disabled"),window.setTimeout(function(){e.parentNode.removeChild(e.nextElementSibling),e.removeAttribute("disabled")},3e3)}};module.exports=function(e){return function(e){if(function(){try{document.cookie="cookietest=1";var e=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(e){return!1}}()){var t,s=(t={},{update:function(e,n,s){t=e(t,n),s&&s.forEach(function(e){return e(t)})},getState:function(){return t}});e.tid||console.warn("The tid setting is missing. A tid is required for banner measurements.");var i=function(e){try{var n=function(e){for(var n=document.cookie.split("; "),t=0;t<=n.length;t++){if(!n[t])return!1;var s=n[t].split("=");if(s[0]===e.name)return window.atob(s[1])}return!1}(e);if(!n)return[!1,f(),{}];var t=JSON.parse(n),s=t.consent;return[void 0!==s,t.cid||f(),s||{}]}catch(e){return[!1,f(),{}]}}(e),a=i[0];return s.update(h,{settings:e,bannerOpen:!1,persistentMeasurementParams:!!e.tid&&(r=i[1],c=e.tid,{tid:c,v:1,t:"event",ds:"cookiebanner",dh:location.hostname,uip:"0.0.0.0",sr:window.screen?window.screen.width+"x"+window.screen.height:null,vp:document.documentElement.clientWidth+"x"+document.documentElement.clientHeight,cid:r,cd1:r,cd3:location.hostname,cd4:"consentAPI"}),consent:i[2]},[_,j(s),a?u:B(s),A(s),q(s)]),{getState:s.getState,showBanner:function(e){(function(e){return function(t){if(B(e)(),e.getState().bannerOpen){A(e)();var s,i=(s=document.body.firstElementChild,[].slice.call(s.querySelectorAll(n.join(","))));i.length>0&&i[0].focus(),t&&t.call&&t(e.getState())}}})(s)(e),q(s)()},renderForm:A(s)}}var r,c}(Object.assign({},v,e,{types:Object.keys(e.types).reduce(l(e),v.types)}))}; | ||
var e=["button","a"],n=["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex="-1"])'],t={ec:"Banner",ea:"Displays",cm1:1},s={ec:"Save preferences",ea:"Banner",cm2:1,cm3:1},i={ec:"Banner",ea:"Clicks",el:"Edit preferences",cm4:1},a={ec:"CookiePrefsWidget",ea:"Displays",cm5:1},r={ec:"Save preferences",ea:"CookiePrefs"},c=function(e){document.cookie=[e.settings.name+"="+btoa(JSON.stringify({consent:e.consent,cid:e.persistentMeasurementParams.cid}))+";","expires="+new Date((new Date).getTime()+24*e.settings.expiry*60*60*1e3).toGMTString()+";",e.settings.path?"path="+e.settings.path+";":"",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")},o=function(e){document.cookie.split("; ").map(function(e){return{name:e.split("=")[0],value:e.split("=")[1],expiry:"Thu, 01 Jan 1970 00:00:01 GMT"}}).map(function(e){return function(n){return document.cookie=[n.name+"="+n.value+";","expires="+n.expiry+";","path="+e.settings.path+";",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")}}(e))},l=function(e){return function(n,t){return n[t]=n[t]?Object.assign({},n[t],{fns:n[t].fns.concat(e.types[t].fns)}):e.types[t],n}},u=function(){},d=function(e){return/radio|checkbox/i.test(e.type)},m=function(e,n){return!d(n)&&function(e){return null!=e.value&&e.value.length>0}(n)&&(e=n.value),d(n)&&n.checked&&(Array.isArray(e)?e.push(n.value):e=[n.value]),e},p="ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|be|bf|bg|bh|bi|bj|bm|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|cl|cm|cn|co|cr|cu|cv|cw|cx|cz|de|dj|dk|dm|do|dz|ec|ee|eg|es|et|eu|fi|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|im|in|io|iq|ir|is|it|je|jo|jp|kg|ki|km|kn|kp|kr|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|na|nc|ne|nf|ng|nl|no|nr|nu|nz|om|pa|pe|pf|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|yt".split("|"),g="netlify|azurewebsites|com|edu|gov|net|mil|org|nom|sch|caa|res|off|gob|int|tur|ip6|uri|urn|asn|act|nsw|qld|tas|vic|pro|biz|adm|adv|agr|arq|art|ato|bio|bmd|cim|cng|cnt|ecn|eco|emp|eng|esp|etc|eti|far|fnd|fot|fst|g12|ggf|imb|ind|inf|jor|jus|leg|lel|mat|med|mus|not|ntr|odo|ppg|psc|psi|qsl|rec|slg|srv|teo|tmp|trd|vet|zlg|web|ltd|sld|pol|fin|k12|lib|pri|aip|fie|eun|sci|prd|cci|pvt|mod|idv|rel|sex|gen|nic|abr|bas|cal|cam|emr|fvg|laz|lig|lom|mar|mol|pmn|pug|sar|sic|taa|tos|umb|vao|vda|ven|mie|北海道|和歌山|神奈川|鹿児島|ass|rep|tra|per|ngo|soc|grp|plc|its|air|and|bus|can|ddr|jfk|mad|nrw|nyc|ski|spy|tcm|ulm|usa|war|fhs|vgs|dep|eid|fet|fla|flå|gol|hof|hol|sel|vik|cri|iwi|ing|abo|fam|gok|gon|gop|gos|aid|atm|gsm|sos|elk|waw|est|aca|bar|cpa|jur|law|sec|plo|www|bir|cbg|jar|khv|msk|nov|nsk|ptz|rnd|spb|stv|tom|tsk|udm|vrn|cmw|kms|nkz|snz|pub|fhv|red|ens|nat|rns|rnu|bbs|tel|bel|kep|nhs|dni|fed|isa|nsn|gub|e12|tec|орг|обр|упр|alt|nis|jpn|mex|ath|iki|nid|gda|inc".split("|"),f=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})},b=function(e,n){return function(){var t=new CustomEvent(e,{bubbles:!0,detail:{getState:n.getState}});window.document.dispatchEvent(t)}},v={name:".CookiePreferences",path:"/",domain:"localhost"===window.location.hostname?"":"."+function(e){for(var n=(e=e.replace(/^www\./,"")).split(".");n.length>3;)n.shift();return 3===n.length&&-1===g.indexOf(n[1])&&-1===p.indexOf(n[2])&&n.shift(),n.join(".")}(window.location.hostname),secure:!0,samesite:"strict",expiry:365,types:{},necessary:[],policyURL:"/cookie-policy/#preferences",classNames:{banner:"privacy-banner",acceptBtn:"privacy-banner__accept",submitBtn:"privacy-banner__submit",optionsBtn:"privacy-banner__options",field:"privacy-banner__field",form:"privacy-banner__form",fieldset:"privacy-banner__fieldset",legend:"privacy-banner__legend",formContainer:"privacy-banner__form-container",formMessage:"privacy-banner__form-msg",formAnnouncement:"privacy-banner__form-announcement",title:"privacy-banner__form-title",description:"privacy-banner__form-description"},hideBannerOnFormPage:!0,savedMessage:"Your settings have been saved.",bannerTemplate:function(e){return'<section role="dialog" aria-live="polite" aria-label="Your privacy" class="'+e.classNames.banner+'">\n <div class="privacy-content">\n <div class="wrap">\n \x3c!--googleoff: all--\x3e\n <div class="privacy-banner__title">Cookies</div>\n <p>We use cookies to improve your experience on our site and show you personalised advertising.</p>\n <p>Find out more from our <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="/privacy-policy">privacy policy</a> and <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">cookie policy</a>.</p>\n <button type="button" class="btn btn--primary '+e.classNames.acceptBtn+'">Accept and close</button>\n <a class="privacy-banner__link '+e.classNames.optionsBtn+'" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">Your options</a>\n \x3c!--googleon: all--\x3e\n </div>\n </div>\n </section>'},messageTemplate:function(e){return'<div class="'+e.settings.classNames.formMessage+'" aria-hidden="true">'+e.settings.savedMessage+"</div>"},formTemplate:function(e){return'<form id="preferences" class="'+e.settings.classNames.form+'" novalidate>\n '+Object.keys(e.settings.types).map(function(n){return'<fieldset class="'+e.settings.classNames.fieldset+'">\n <legend class="'+e.settings.classNames.legend+'">\n <span class="'+e.settings.classNames.title+'">'+e.settings.types[n].title+'</span>\n <span class="'+e.settings.classNames.description+'">'+e.settings.types[n].description+'</span>\n </legend>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+n.split(" ")[0].replace(" ","-")+'"\n value="1"\n '+(1===e.consent[n]?"checked":"")+'>\n <span class="privacy-banner__label-text">I am OK with this</span>\n <span class="privacy-banner__label-description">'+e.settings.types[n].labels.yes+'</span>\n </label> \n </div>\n </div>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+n.split(" ")[0].replace(" ","-")+'"\n value="0"\n '+(0===e.consent[n]?"checked":"")+'>\n <span class="privacy-banner__label-text">No thank you</span>\n <span class="privacy-banner__label-description">'+e.settings.types[n].labels.no+"</span>\n </label> \n </div>\n </div>\n </fieldset>"}).join("")+'\n <button class="'+e.settings.classNames.submitBtn+'"'+(Object.keys(e.consent).length!==Object.keys(e.settings.types).length?" disabled":"")+">Save my settings</button>\n </form>"}};function y(){return y=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},y.apply(this,arguments)}var h=function(e,n){return n},w=function(e,n){return Object.assign({},e,{bannerOpen:n})},k=function(e,n){return Object.assign({},e,{consent:Object.assign({},e.consent,n)})},x=function(e,n){return Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,n)})})},j=function(e){return function(n){Object.keys(n.consent).forEach(function(e){n.settings.types[e]&&!0!==n.settings.types[e].executed&&n.consent[e]&&Boolean(n.consent[e])&&n.settings.types[e].fns.forEach(function(e){return e(n)})}),e.update(x,Object.keys(n.settings.types).reduce(function(e,t){return e[t]=Object.assign({},n.settings.types[t],{executed:n.settings.types[t].executed||n.consent[t]&&Boolean(n.consent[t])}),e},{}))}},_=function(e){e.settings.necessary.forEach(function(n){return n(e)})},O=function(e){return Object.keys(e).filter(function(n){return e[n]}).join(",")},N=function(){try{var e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},S=function(e,n,t){return void 0===t&&(t="collect"),function(e){if(!navigator.sendBeacon){var n=document.createElement("img");return n.width=1,n.height=1,n.src=e,n}navigator.sendBeacon(e)}(function(e,n){return"https://www.google-analytics.com/"+n+"?"+function(e){return Object.keys(e).reduce(function(n,t){return null!==e[t]&&n.push(t+"="+encodeURIComponent(e[t])),n},[]).join("&")}(e)}(y({},e.persistentMeasurementParams,n,e.settings.debug?{}:{z:N()}),t))},B=function(e){return function(){var n=e.getState();n.bannerOpen||n.settings.hideBannerOnFormPage&&document.querySelector("."+n.settings.classNames.formContainer)||(document.body.firstElementChild.insertAdjacentHTML("beforebegin",n.settings.bannerTemplate(n.settings)),n.settings.tid&&S(n,t),e.update(w,!0,[b("banner.show",e)]))}},A=function(n){return function(){var t=n.getState(),a=document.querySelector("."+t.settings.classNames.banner);if(a){var r=function(n){return e.map(function(e){return e+"."+n}).join(", ")},o=[].slice.call(document.querySelectorAll(r(t.settings.classNames.acceptBtn))),l=document.querySelector(r(t.settings.classNames.optionsBtn));o.forEach(function(e){o?e.addEventListener("click",function(e){n.update(k,Object.keys(t.settings.types).reduce(function(e,n){return e[n]=1,e},{}),[c,j(n),q(n,a),E(n,!1),b("banner.consent",n),function(e){e.settings.tid&&S(e,y({},s,{cd2:O(n.getState().consent)}))}])}):console.warn("Banner accept element must be a Button or Anchor. No trigger event added.")}),l&&t.settings.tid?l.addEventListener("click",function(e){return S(t,i)}):console.warn("No trigger added for options element. Check that the element is a Button or Anchor and that your tid is set.")}}},q=function(e,n){return function(){n&&n.parentNode&&(n.parentNode.removeChild(n),e.update(w,!1,[b("banner.hide",e)]))}},E=function(e,n){return void 0===n&&(n=!0),function(){var t=e.getState(),s=document.querySelector("."+t.settings.classNames.formContainer);if(s){s.innerHTML=t.settings.formTemplate(function(e){return Object.keys(e.consent).length>0?e:Object.assign({},e,{consent:Object.keys(e.settings.types).reduce(function(n,t){return e.settings.types[t].suggested&&(n[t]=1),n},{})})}(t)),t.settings.tid&&n&&S(t,a);var i=document.querySelector("."+t.settings.classNames.form),l=document.querySelector("."+t.settings.classNames.banner),u=document.querySelector("."+t.settings.classNames.submitBtn),d=[].slice.call(document.querySelectorAll("."+t.settings.classNames.field)).reduce(function(e,n){var t=n.getAttribute("name").replace("privacy-","");return e[t]?e[t].push(n):e[t]=[n],e},{}),p=document.querySelector("."+t.settings.classNames.formAnnouncement)||document.body.appendChild(Object.assign(document.createElement("div"),{className:t.settings.classNames.formAnnouncement,role:"alert"})),g=function(){return Object.keys(d).reduce(function(e,n){var t=d[n].reduce(m,"");return t&&(e[n]=parseInt(t,10)),e},{})};u.hasAttribute("disabled")&&i.addEventListener("change",function e(n){Object.keys(g()).length===Object.keys(d).length&&(u.removeAttribute("disabled"),i.removeEventListener("change",e))}),i.addEventListener("submit",function(n){n.preventDefault(),e.update(k,g(),[o,c,j(e),q(e,l),b("banner.consent",e),C(u),T(p),function(e){if(e.settings.tid){var n=O(e.consent);S(e,y({},r,{cd2:""===n?"None":n,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}}])}),window.location.hash.substring(1)===i.id&&window.scrollTo(0,i.getBoundingClientRect().top+window.scrollY)}}},C=function(e){return function(n){e.insertAdjacentHTML("afterend",n.settings.messageTemplate(n)),e.setAttribute("disabled","disabled"),window.setTimeout(function(){e.parentNode.removeChild(e.nextElementSibling),e.removeAttribute("disabled")},3e3)}},T=function(e){return function(n){e.textContent=n.settings.savedMessage,window.setTimeout(function(){e.textContent=""},3e3)}};module.exports=function(e){return function(e){if(function(){try{document.cookie="cookietest=1";var e=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(e){return!1}}()){var t,s=(t={},{update:function(e,n,s){t=e(t,n),s&&s.forEach(function(e){return e(t)})},getState:function(){return t}});e.tid||console.warn("The tid setting is missing. A tid is required for banner measurements.");var i=function(e){try{var n=function(e){for(var n=document.cookie.split("; "),t=0;t<=n.length;t++){if(!n[t])return!1;var s=n[t].split("=");if(s[0]===e.name)return window.atob(s[1])}return!1}(e);if(!n)return[!1,f(),{}];var t=JSON.parse(n),s=t.consent;return[void 0!==s,t.cid||f(),s||{}]}catch(e){return[!1,f(),{}]}}(e),a=i[0];return s.update(h,{settings:e,bannerOpen:!1,persistentMeasurementParams:!!e.tid&&(r=i[1],c=e.tid,{tid:c,v:1,t:"event",ds:"cookiebanner",dh:location.hostname,uip:"0.0.0.0",sr:window.screen?window.screen.width+"x"+window.screen.height:null,vp:document.documentElement.clientWidth+"x"+document.documentElement.clientHeight,cid:r,cd1:r,cd3:location.hostname,cd4:"consentAPI"}),consent:i[2]},[_,j(s),a?u:B(s),E(s),A(s)]),{getState:s.getState,showBanner:function(e){(function(e){return function(t){if(B(e)(),e.getState().bannerOpen){E(e)();var s,i=(s=document.body.firstElementChild,[].slice.call(s.querySelectorAll(n.join(","))));i.length>0&&i[0].focus(),t&&t.call&&t(e.getState())}}})(s)(e),A(s)()},renderForm:E(s)}}var r,c}(Object.assign({},v,e,{types:Object.keys(e.types).reduce(l(e),v.types)}))}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
const e=["button","a"],t=["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex="-1"])'],n={ec:"Banner",ea:"Displays",cm1:1},s={ec:"Save preferences",ea:"Banner",cm2:1,cm3:1},a={ec:"Banner",ea:"Clicks",el:"Edit preferences",cm4:1},i={ec:"CookiePrefsWidget",ea:"Displays",cm5:1},r={ec:"Save preferences",ea:"CookiePrefs"},c=e=>{document.cookie=[`${e.settings.name}=${btoa(JSON.stringify({consent:e.consent,cid:e.persistentMeasurementParams.cid}))};`,`expires=${new Date((new Date).getTime()+24*e.settings.expiry*60*60*1e3).toGMTString()};`,e.settings.path?`path=${e.settings.path};`:"",e.settings.domain?`domain=${e.settings.domain};`:"",e.settings.samesite?`SameSite=${e.settings.samesite};`:"",e.settings.secure?"secure":""].join("")},o=e=>{document.cookie.split("; ").map(e=>({name:e.split("=")[0],value:e.split("=")[1],expiry:"Thu, 01 Jan 1970 00:00:01 GMT"})).map((e=>t=>document.cookie=[`${t.name}=${t.value};`,`expires=${t.expiry};`,`path=${e.settings.path};`,e.settings.domain?`domain=${e.settings.domain};`:"",e.settings.samesite?`SameSite=${e.settings.samesite};`:"",e.settings.secure?"secure":""].join(""))(e))},l=e=>(t,n)=>(t[n]=t[n]?Object.assign({},t[n],{fns:t[n].fns.concat(e.types[n].fns)}):e.types[n],t),d=()=>{},p=e=>/radio|checkbox/i.test(e.type),m=(e,t)=>(!p(t)&&(e=>null!=e.value&&e.value.length>0)(t)&&(e=t.value),p(t)&&t.checked&&(Array.isArray(e)?e.push(t.value):e=[t.value]),e),g="ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|be|bf|bg|bh|bi|bj|bm|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|cl|cm|cn|co|cr|cu|cv|cw|cx|cz|de|dj|dk|dm|do|dz|ec|ee|eg|es|et|eu|fi|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|im|in|io|iq|ir|is|it|je|jo|jp|kg|ki|km|kn|kp|kr|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|na|nc|ne|nf|ng|nl|no|nr|nu|nz|om|pa|pe|pf|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|yt".split("|"),u="netlify|azurewebsites|com|edu|gov|net|mil|org|nom|sch|caa|res|off|gob|int|tur|ip6|uri|urn|asn|act|nsw|qld|tas|vic|pro|biz|adm|adv|agr|arq|art|ato|bio|bmd|cim|cng|cnt|ecn|eco|emp|eng|esp|etc|eti|far|fnd|fot|fst|g12|ggf|imb|ind|inf|jor|jus|leg|lel|mat|med|mus|not|ntr|odo|ppg|psc|psi|qsl|rec|slg|srv|teo|tmp|trd|vet|zlg|web|ltd|sld|pol|fin|k12|lib|pri|aip|fie|eun|sci|prd|cci|pvt|mod|idv|rel|sex|gen|nic|abr|bas|cal|cam|emr|fvg|laz|lig|lom|mar|mol|pmn|pug|sar|sic|taa|tos|umb|vao|vda|ven|mie|北海道|和歌山|神奈川|鹿児島|ass|rep|tra|per|ngo|soc|grp|plc|its|air|and|bus|can|ddr|jfk|mad|nrw|nyc|ski|spy|tcm|ulm|usa|war|fhs|vgs|dep|eid|fet|fla|flå|gol|hof|hol|sel|vik|cri|iwi|ing|abo|fam|gok|gon|gop|gos|aid|atm|gsm|sos|elk|waw|est|aca|bar|cpa|jur|law|sec|plo|www|bir|cbg|jar|khv|msk|nov|nsk|ptz|rnd|spb|stv|tom|tsk|udm|vrn|cmw|kms|nkz|snz|pub|fhv|red|ens|nat|rns|rnu|bbs|tel|bel|kep|nhs|dni|fed|isa|nsn|gub|e12|tec|орг|обр|упр|alt|nis|jpn|mex|ath|iki|nid|gda|inc".split("|"),b=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),y=(e,t)=>()=>{const n=new CustomEvent(e,{bubbles:!0,detail:{getState:t.getState}});window.document.dispatchEvent(n)};var f={name:".CookiePreferences",path:"/",domain:"localhost"===window.location.hostname?"":`.${(e=>{let t=(e=e.replace(/^www\./,"")).split(".");for(;t.length>3;)t.shift();return 3===t.length&&-1===u.indexOf(t[1])&&-1===g.indexOf(t[2])&&t.shift(),t.join(".")})(window.location.hostname)}`,secure:!0,samesite:"strict",expiry:365,types:{},necessary:[],policyURL:"/cookie-policy/#preferences",classNames:{banner:"privacy-banner",acceptBtn:"privacy-banner__accept",submitBtn:"privacy-banner__submit",optionsBtn:"privacy-banner__options",field:"privacy-banner__field",form:"privacy-banner__form",fieldset:"privacy-banner__fieldset",legend:"privacy-banner__legend",formContainer:"privacy-banner__form-container",formMessage:"privacy-banner__form-msg",title:"privacy-banner__form-title",description:"privacy-banner__form-description"},hideBannerOnFormPage:!0,savedMessage:"Your settings have been saved.",bannerTemplate:e=>`<section role="dialog" aria-live="polite" aria-label="Your privacy" class="${e.classNames.banner}">\n <div class="privacy-content">\n <div class="wrap">\n \x3c!--googleoff: all--\x3e\n <div class="privacy-banner__title">Cookies</div>\n <p>We use cookies to improve your experience on our site and show you personalised advertising.</p>\n <p>Find out more from our <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="/privacy-policy">privacy policy</a> and <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="${e.policyURL}">cookie policy</a>.</p>\n <button type="button" class="btn btn--primary ${e.classNames.acceptBtn}">Accept and close</button>\n <a class="privacy-banner__link ${e.classNames.optionsBtn}" rel="noopener noreferrer nofollow" href="${e.policyURL}">Your options</a>\n \x3c!--googleon: all--\x3e\n </div>\n </div>\n </section>`,messageTemplate:e=>`<div class="${e.settings.classNames.formMessage}" aria-role="alert">${e.settings.savedMessage}</div>`,formTemplate:e=>`<form id="preferences" class="${e.settings.classNames.form}" novalidate>\n ${Object.keys(e.settings.types).map(t=>`<fieldset class="${e.settings.classNames.fieldset}">\n <legend class="${e.settings.classNames.legend}">\n <span class="${e.settings.classNames.title}">${e.settings.types[t].title}</span>\n <span class="${e.settings.classNames.description}">${e.settings.types[t].description}</span>\n </legend>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="${e.settings.classNames.field}"\n type="radio"\n name="privacy-${t.split(" ")[0].replace(" ","-")}"\n value="1"\n ${1===e.consent[t]?"checked":""}>\n <span class="privacy-banner__label-text">I am OK with this</span>\n <span class="privacy-banner__label-description">${e.settings.types[t].labels.yes}</span>\n </label> \n </div>\n </div>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="${e.settings.classNames.field}"\n type="radio"\n name="privacy-${t.split(" ")[0].replace(" ","-")}"\n value="0"\n ${0===e.consent[t]?"checked":""}>\n <span class="privacy-banner__label-text">No thank you</span>\n <span class="privacy-banner__label-description">${e.settings.types[t].labels.no}</span>\n </label> \n </div>\n </div>\n </fieldset>`).join("")}\n <button class="${e.settings.classNames.submitBtn}"${Object.keys(e.consent).length!==Object.keys(e.settings.types).length?" disabled":""}>Save my settings</button>\n </form>`};function v(){return v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},v.apply(this,arguments)}const h=(e,t)=>t,k=(e,t)=>Object.assign({},e,{bannerOpen:t}),w=(e,t)=>Object.assign({},e,{consent:Object.assign({},e.consent,t)}),x=(e,t)=>Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,t)})}),$=e=>t=>{Object.keys(t.consent).forEach(e=>{t.settings.types[e]&&!0!==t.settings.types[e].executed&&t.consent[e]&&Boolean(t.consent[e])&&t.settings.types[e].fns.forEach(e=>e(t))}),e.update(x,Object.keys(t.settings.types).reduce((e,n)=>(e[n]=Object.assign({},t.settings.types[n],{executed:t.settings.types[n].executed||t.consent[n]&&Boolean(t.consent[n])}),e),{}))},j=e=>{e.settings.necessary.forEach(t=>t(e))},_=(e,t)=>({tid:t,v:1,t:"event",ds:"cookiebanner",dh:location.hostname,uip:"0.0.0.0",sr:window.screen?`${window.screen.width}x${window.screen.height}`:null,vp:`${document.documentElement.clientWidth}x${document.documentElement.clientHeight}`,cid:e,cd1:e,cd3:location.hostname,cd4:"consentAPI"}),O=e=>Object.keys(e).filter(t=>e[t]).join(","),S=()=>{try{const e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},N=(e,t,n="collect")=>(e=>{if(navigator.sendBeacon)return void navigator.sendBeacon(e);const t=document.createElement("img");return t.width=1,t.height=1,t.src=e,t})(((e,t)=>`https://www.google-analytics.com/${t}?${(e=>Object.keys(e).reduce((t,n)=>(null!==e[n]&&t.push(`${n}=${encodeURIComponent(e[n])}`),t),[]).join("&"))(e)}`)(v({},e.persistentMeasurementParams,t,e.settings.debug?{}:{z:S()}),n)),B=e=>()=>{const t=e.getState();t.bannerOpen||t.settings.hideBannerOnFormPage&&document.querySelector(`.${t.settings.classNames.formContainer}`)||(document.body.firstElementChild.insertAdjacentHTML("beforebegin",t.settings.bannerTemplate(t.settings)),t.settings.tid&&N(t,n),e.update(k,!0,[y("banner.show",e)]))},q=t=>()=>{const n=t.getState(),i=document.querySelector(`.${n.settings.classNames.banner}`);if(!i)return;const r=t=>e.map(e=>`${e}.${t}`).join(", "),o=[].slice.call(document.querySelectorAll(r(n.settings.classNames.acceptBtn))),l=document.querySelector(r(n.settings.classNames.optionsBtn));o.forEach(e=>{o?e.addEventListener("click",e=>{t.update(w,Object.keys(n.settings.types).reduce((e,t)=>(e[t]=1,e),{}),[c,$(t),E(t,i),A(t,!1),y("banner.consent",t),e=>{e.settings.tid&&N(e,v({},s,{cd2:O(t.getState().consent)}))}])}):console.warn("Banner accept element must be a Button or Anchor. No trigger event added.")}),l&&n.settings.tid?l.addEventListener("click",e=>N(n,a)):console.warn("No trigger added for options element. Check that the element is a Button or Anchor and that your tid is set.")},E=(e,t)=>()=>{t&&t.parentNode&&(t.parentNode.removeChild(t),e.update(k,!1,[y("banner.hide",e)]))},A=(e,t=!0)=>()=>{const n=e.getState(),s=document.querySelector(`.${n.settings.classNames.formContainer}`);if(!s)return;s.innerHTML=n.settings.formTemplate((e=>Object.keys(e.consent).length>0?e:Object.assign({},e,{consent:Object.keys(e.settings.types).reduce((t,n)=>(e.settings.types[n].suggested&&(t[n]=1),t),{})}))(n)),n.settings.tid&&t&&N(n,i);const a=document.querySelector(`.${n.settings.classNames.form}`),l=document.querySelector(`.${n.settings.classNames.banner}`),d=document.querySelector(`.${n.settings.classNames.submitBtn}`),p=[].slice.call(document.querySelectorAll(`.${n.settings.classNames.field}`)).reduce((e,t)=>{const n=t.getAttribute("name").replace("privacy-","");return e[n]?e[n].push(t):e[n]=[t],e},{}),g=()=>Object.keys(p).reduce((e,t)=>{const n=p[t].reduce(m,"");return n&&(e[t]=parseInt(n,10)),e},{}),u=e=>{Object.keys(g()).length===Object.keys(p).length&&(d.removeAttribute("disabled"),a.removeEventListener("change",u))};d.hasAttribute("disabled")&&a.addEventListener("change",u),a.addEventListener("submit",t=>{t.preventDefault(),e.update(w,g(),[o,c,$(e),E(e,l),y("banner.consent",e),T(d),e=>{if(!e.settings.tid)return;const t=O(e.consent);N(e,v({},r,{cd2:""===t?"None":t,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}])}),window.location.hash.substring(1)===a.id&&window.scrollTo(0,a.getBoundingClientRect().top+window.scrollY)},T=e=>t=>{e.insertAdjacentHTML("afterend",t.settings.messageTemplate(t)),e.setAttribute("disabled","disabled"),window.setTimeout(()=>{e.parentNode.removeChild(e.nextElementSibling),e.removeAttribute("disabled")},3e3)};var z=e=>(e=>{if(!(()=>{try{document.cookie="cookietest=1";const e=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(e){return!1}})())return;const n=(()=>{let e={};return{update:(t,n,s)=>{e=t(e,n),s&&s.forEach(t=>t(e))},getState:()=>e}})();e.tid||console.warn("The tid setting is missing. A tid is required for banner measurements.");const[s,a,i]=(e=>{try{const t=(e=>{const t=document.cookie.split("; ");for(let n=0;n<=t.length;n++){if(!t[n])return!1;const[s,a]=t[n].split("=");if(s===e.name)return window.atob(a)}return!1})(e);if(!t)return[!1,b(),{}];const{cid:n,consent:s}=JSON.parse(t);return[void 0!==s,n||b(),s||{}]}catch(e){return[!1,b(),{}]}})(e);return n.update(h,{settings:e,bannerOpen:!1,persistentMeasurementParams:!!e.tid&&_(a,e.tid),consent:i},[j,$(n),s?d:B(n),A(n),q(n)]),{getState:n.getState,showBanner(e){(e=>n=>{B(e)();const{bannerOpen:s}=e.getState();if(!s)return;A(e)();const a=(i=document.body.firstElementChild,[].slice.call(i.querySelectorAll(t.join(","))));var i;a.length>0&&a[0].focus(),n&&n.call&&n(e.getState())})(n)(e),q(n)()},renderForm:A(n)}})(Object.assign({},f,e,{types:Object.keys(e.types).reduce(l(e),f.types)}));export{z as default}; | ||
const e=["button","a"],t=["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex="-1"])'],n={ec:"Banner",ea:"Displays",cm1:1},s={ec:"Save preferences",ea:"Banner",cm2:1,cm3:1},a={ec:"Banner",ea:"Clicks",el:"Edit preferences",cm4:1},i={ec:"CookiePrefsWidget",ea:"Displays",cm5:1},r={ec:"Save preferences",ea:"CookiePrefs"},c=e=>{document.cookie=[`${e.settings.name}=${btoa(JSON.stringify({consent:e.consent,cid:e.persistentMeasurementParams.cid}))};`,`expires=${new Date((new Date).getTime()+24*e.settings.expiry*60*60*1e3).toGMTString()};`,e.settings.path?`path=${e.settings.path};`:"",e.settings.domain?`domain=${e.settings.domain};`:"",e.settings.samesite?`SameSite=${e.settings.samesite};`:"",e.settings.secure?"secure":""].join("")},o=e=>{document.cookie.split("; ").map(e=>({name:e.split("=")[0],value:e.split("=")[1],expiry:"Thu, 01 Jan 1970 00:00:01 GMT"})).map((e=>t=>document.cookie=[`${t.name}=${t.value};`,`expires=${t.expiry};`,`path=${e.settings.path};`,e.settings.domain?`domain=${e.settings.domain};`:"",e.settings.samesite?`SameSite=${e.settings.samesite};`:"",e.settings.secure?"secure":""].join(""))(e))},l=e=>(t,n)=>(t[n]=t[n]?Object.assign({},t[n],{fns:t[n].fns.concat(e.types[n].fns)}):e.types[n],t),d=()=>{},m=e=>/radio|checkbox/i.test(e.type),p=(e,t)=>(!m(t)&&(e=>null!=e.value&&e.value.length>0)(t)&&(e=t.value),m(t)&&t.checked&&(Array.isArray(e)?e.push(t.value):e=[t.value]),e),g="ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|be|bf|bg|bh|bi|bj|bm|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|cl|cm|cn|co|cr|cu|cv|cw|cx|cz|de|dj|dk|dm|do|dz|ec|ee|eg|es|et|eu|fi|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|im|in|io|iq|ir|is|it|je|jo|jp|kg|ki|km|kn|kp|kr|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|na|nc|ne|nf|ng|nl|no|nr|nu|nz|om|pa|pe|pf|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|yt".split("|"),u="netlify|azurewebsites|com|edu|gov|net|mil|org|nom|sch|caa|res|off|gob|int|tur|ip6|uri|urn|asn|act|nsw|qld|tas|vic|pro|biz|adm|adv|agr|arq|art|ato|bio|bmd|cim|cng|cnt|ecn|eco|emp|eng|esp|etc|eti|far|fnd|fot|fst|g12|ggf|imb|ind|inf|jor|jus|leg|lel|mat|med|mus|not|ntr|odo|ppg|psc|psi|qsl|rec|slg|srv|teo|tmp|trd|vet|zlg|web|ltd|sld|pol|fin|k12|lib|pri|aip|fie|eun|sci|prd|cci|pvt|mod|idv|rel|sex|gen|nic|abr|bas|cal|cam|emr|fvg|laz|lig|lom|mar|mol|pmn|pug|sar|sic|taa|tos|umb|vao|vda|ven|mie|北海道|和歌山|神奈川|鹿児島|ass|rep|tra|per|ngo|soc|grp|plc|its|air|and|bus|can|ddr|jfk|mad|nrw|nyc|ski|spy|tcm|ulm|usa|war|fhs|vgs|dep|eid|fet|fla|flå|gol|hof|hol|sel|vik|cri|iwi|ing|abo|fam|gok|gon|gop|gos|aid|atm|gsm|sos|elk|waw|est|aca|bar|cpa|jur|law|sec|plo|www|bir|cbg|jar|khv|msk|nov|nsk|ptz|rnd|spb|stv|tom|tsk|udm|vrn|cmw|kms|nkz|snz|pub|fhv|red|ens|nat|rns|rnu|bbs|tel|bel|kep|nhs|dni|fed|isa|nsn|gub|e12|tec|орг|обр|упр|alt|nis|jpn|mex|ath|iki|nid|gda|inc".split("|"),b=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),y=(e,t)=>()=>{const n=new CustomEvent(e,{bubbles:!0,detail:{getState:t.getState}});window.document.dispatchEvent(n)};var f={name:".CookiePreferences",path:"/",domain:"localhost"===window.location.hostname?"":`.${(e=>{let t=(e=e.replace(/^www\./,"")).split(".");for(;t.length>3;)t.shift();return 3===t.length&&-1===u.indexOf(t[1])&&-1===g.indexOf(t[2])&&t.shift(),t.join(".")})(window.location.hostname)}`,secure:!0,samesite:"strict",expiry:365,types:{},necessary:[],policyURL:"/cookie-policy/#preferences",classNames:{banner:"privacy-banner",acceptBtn:"privacy-banner__accept",submitBtn:"privacy-banner__submit",optionsBtn:"privacy-banner__options",field:"privacy-banner__field",form:"privacy-banner__form",fieldset:"privacy-banner__fieldset",legend:"privacy-banner__legend",formContainer:"privacy-banner__form-container",formMessage:"privacy-banner__form-msg",formAnnouncement:"privacy-banner__form-announcement",title:"privacy-banner__form-title",description:"privacy-banner__form-description"},hideBannerOnFormPage:!0,savedMessage:"Your settings have been saved.",bannerTemplate:e=>`<section role="dialog" aria-live="polite" aria-label="Your privacy" class="${e.classNames.banner}">\n <div class="privacy-content">\n <div class="wrap">\n \x3c!--googleoff: all--\x3e\n <div class="privacy-banner__title">Cookies</div>\n <p>We use cookies to improve your experience on our site and show you personalised advertising.</p>\n <p>Find out more from our <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="/privacy-policy">privacy policy</a> and <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="${e.policyURL}">cookie policy</a>.</p>\n <button type="button" class="btn btn--primary ${e.classNames.acceptBtn}">Accept and close</button>\n <a class="privacy-banner__link ${e.classNames.optionsBtn}" rel="noopener noreferrer nofollow" href="${e.policyURL}">Your options</a>\n \x3c!--googleon: all--\x3e\n </div>\n </div>\n </section>`,messageTemplate:e=>`<div class="${e.settings.classNames.formMessage}" aria-hidden="true">${e.settings.savedMessage}</div>`,formTemplate:e=>`<form id="preferences" class="${e.settings.classNames.form}" novalidate>\n ${Object.keys(e.settings.types).map(t=>`<fieldset class="${e.settings.classNames.fieldset}">\n <legend class="${e.settings.classNames.legend}">\n <span class="${e.settings.classNames.title}">${e.settings.types[t].title}</span>\n <span class="${e.settings.classNames.description}">${e.settings.types[t].description}</span>\n </legend>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="${e.settings.classNames.field}"\n type="radio"\n name="privacy-${t.split(" ")[0].replace(" ","-")}"\n value="1"\n ${1===e.consent[t]?"checked":""}>\n <span class="privacy-banner__label-text">I am OK with this</span>\n <span class="privacy-banner__label-description">${e.settings.types[t].labels.yes}</span>\n </label> \n </div>\n </div>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="${e.settings.classNames.field}"\n type="radio"\n name="privacy-${t.split(" ")[0].replace(" ","-")}"\n value="0"\n ${0===e.consent[t]?"checked":""}>\n <span class="privacy-banner__label-text">No thank you</span>\n <span class="privacy-banner__label-description">${e.settings.types[t].labels.no}</span>\n </label> \n </div>\n </div>\n </fieldset>`).join("")}\n <button class="${e.settings.classNames.submitBtn}"${Object.keys(e.consent).length!==Object.keys(e.settings.types).length?" disabled":""}>Save my settings</button>\n </form>`};function v(){return v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},v.apply(this,arguments)}const h=(e,t)=>t,w=(e,t)=>Object.assign({},e,{bannerOpen:t}),k=(e,t)=>Object.assign({},e,{consent:Object.assign({},e.consent,t)}),x=(e,t)=>Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,t)})}),$=e=>t=>{Object.keys(t.consent).forEach(e=>{t.settings.types[e]&&!0!==t.settings.types[e].executed&&t.consent[e]&&Boolean(t.consent[e])&&t.settings.types[e].fns.forEach(e=>e(t))}),e.update(x,Object.keys(t.settings.types).reduce((e,n)=>(e[n]=Object.assign({},t.settings.types[n],{executed:t.settings.types[n].executed||t.consent[n]&&Boolean(t.consent[n])}),e),{}))},j=e=>{e.settings.necessary.forEach(t=>t(e))},_=(e,t)=>({tid:t,v:1,t:"event",ds:"cookiebanner",dh:location.hostname,uip:"0.0.0.0",sr:window.screen?`${window.screen.width}x${window.screen.height}`:null,vp:`${document.documentElement.clientWidth}x${document.documentElement.clientHeight}`,cid:e,cd1:e,cd3:location.hostname,cd4:"consentAPI"}),O=e=>Object.keys(e).filter(t=>e[t]).join(","),N=()=>{try{const e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},S=(e,t,n="collect")=>(e=>{if(navigator.sendBeacon)return void navigator.sendBeacon(e);const t=document.createElement("img");return t.width=1,t.height=1,t.src=e,t})(((e,t)=>`https://www.google-analytics.com/${t}?${(e=>Object.keys(e).reduce((t,n)=>(null!==e[n]&&t.push(`${n}=${encodeURIComponent(e[n])}`),t),[]).join("&"))(e)}`)(v({},e.persistentMeasurementParams,t,e.settings.debug?{}:{z:N()}),n)),B=e=>()=>{const t=e.getState();t.bannerOpen||t.settings.hideBannerOnFormPage&&document.querySelector(`.${t.settings.classNames.formContainer}`)||(document.body.firstElementChild.insertAdjacentHTML("beforebegin",t.settings.bannerTemplate(t.settings)),t.settings.tid&&S(t,n),e.update(w,!0,[y("banner.show",e)]))},A=t=>()=>{const n=t.getState(),i=document.querySelector(`.${n.settings.classNames.banner}`);if(!i)return;const r=t=>e.map(e=>`${e}.${t}`).join(", "),o=[].slice.call(document.querySelectorAll(r(n.settings.classNames.acceptBtn))),l=document.querySelector(r(n.settings.classNames.optionsBtn));o.forEach(e=>{o?e.addEventListener("click",e=>{t.update(k,Object.keys(n.settings.types).reduce((e,t)=>(e[t]=1,e),{}),[c,$(t),q(t,i),E(t,!1),y("banner.consent",t),e=>{e.settings.tid&&S(e,v({},s,{cd2:O(t.getState().consent)}))}])}):console.warn("Banner accept element must be a Button or Anchor. No trigger event added.")}),l&&n.settings.tid?l.addEventListener("click",e=>S(n,a)):console.warn("No trigger added for options element. Check that the element is a Button or Anchor and that your tid is set.")},q=(e,t)=>()=>{t&&t.parentNode&&(t.parentNode.removeChild(t),e.update(w,!1,[y("banner.hide",e)]))},E=(e,t=!0)=>()=>{const n=e.getState(),s=document.querySelector(`.${n.settings.classNames.formContainer}`);if(!s)return;s.innerHTML=n.settings.formTemplate((e=>Object.keys(e.consent).length>0?e:Object.assign({},e,{consent:Object.keys(e.settings.types).reduce((t,n)=>(e.settings.types[n].suggested&&(t[n]=1),t),{})}))(n)),n.settings.tid&&t&&S(n,i);const a=document.querySelector(`.${n.settings.classNames.form}`),l=document.querySelector(`.${n.settings.classNames.banner}`),d=document.querySelector(`.${n.settings.classNames.submitBtn}`),m=[].slice.call(document.querySelectorAll(`.${n.settings.classNames.field}`)).reduce((e,t)=>{const n=t.getAttribute("name").replace("privacy-","");return e[n]?e[n].push(t):e[n]=[t],e},{}),g=document.querySelector(`.${n.settings.classNames.formAnnouncement}`)||document.body.appendChild(Object.assign(document.createElement("div"),{className:n.settings.classNames.formAnnouncement,role:"alert"})),u=()=>Object.keys(m).reduce((e,t)=>{const n=m[t].reduce(p,"");return n&&(e[t]=parseInt(n,10)),e},{}),b=e=>{Object.keys(u()).length===Object.keys(m).length&&(d.removeAttribute("disabled"),a.removeEventListener("change",b))};d.hasAttribute("disabled")&&a.addEventListener("change",b),a.addEventListener("submit",t=>{t.preventDefault(),e.update(k,u(),[o,c,$(e),q(e,l),y("banner.consent",e),C(d),T(g),e=>{if(!e.settings.tid)return;const t=O(e.consent);S(e,v({},r,{cd2:""===t?"None":t,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}])}),window.location.hash.substring(1)===a.id&&window.scrollTo(0,a.getBoundingClientRect().top+window.scrollY)},C=e=>t=>{e.insertAdjacentHTML("afterend",t.settings.messageTemplate(t)),e.setAttribute("disabled","disabled"),window.setTimeout(()=>{e.parentNode.removeChild(e.nextElementSibling),e.removeAttribute("disabled")},3e3)},T=e=>t=>{e.textContent=t.settings.savedMessage,window.setTimeout(()=>{e.textContent=""},3e3)};var z=e=>(e=>{if(!(()=>{try{document.cookie="cookietest=1";const e=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(e){return!1}})())return;const n=(()=>{let e={};return{update:(t,n,s)=>{e=t(e,n),s&&s.forEach(t=>t(e))},getState:()=>e}})();e.tid||console.warn("The tid setting is missing. A tid is required for banner measurements.");const[s,a,i]=(e=>{try{const t=(e=>{const t=document.cookie.split("; ");for(let n=0;n<=t.length;n++){if(!t[n])return!1;const[s,a]=t[n].split("=");if(s===e.name)return window.atob(a)}return!1})(e);if(!t)return[!1,b(),{}];const{cid:n,consent:s}=JSON.parse(t);return[void 0!==s,n||b(),s||{}]}catch(e){return[!1,b(),{}]}})(e);return n.update(h,{settings:e,bannerOpen:!1,persistentMeasurementParams:!!e.tid&&_(a,e.tid),consent:i},[j,$(n),s?d:B(n),E(n),A(n)]),{getState:n.getState,showBanner(e){(e=>n=>{B(e)();const{bannerOpen:s}=e.getState();if(!s)return;E(e)();const a=(i=document.body.firstElementChild,[].slice.call(i.querySelectorAll(t.join(","))));var i;a.length>0&&a[0].focus(),n&&n.call&&n(e.getState())})(n)(e),A(n)()},renderForm:E(n)}})(Object.assign({},f,e,{types:Object.keys(e.types).reduce(l(e),f.types)}));export{z as default}; | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e||self).CookieBanner=n()}(this,function(){var e=["button","a"],n=["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex="-1"])'],t={ec:"Banner",ea:"Displays",cm1:1},s={ec:"Save preferences",ea:"Banner",cm2:1,cm3:1},i={ec:"Banner",ea:"Clicks",el:"Edit preferences",cm4:1},a={ec:"CookiePrefsWidget",ea:"Displays",cm5:1},r={ec:"Save preferences",ea:"CookiePrefs"},o="banner.consent",c=function(e){document.cookie=[e.settings.name+"="+btoa(JSON.stringify({consent:e.consent,cid:e.persistentMeasurementParams.cid}))+";","expires="+new Date((new Date).getTime()+24*e.settings.expiry*60*60*1e3).toGMTString()+";",e.settings.path?"path="+e.settings.path+";":"",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")},l=function(e){document.cookie.split("; ").map(function(e){return{name:e.split("=")[0],value:e.split("=")[1],expiry:"Thu, 01 Jan 1970 00:00:01 GMT"}}).map(function(e){return function(n){return document.cookie=[n.name+"="+n.value+";","expires="+n.expiry+";","path="+e.settings.path+";",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")}}(e))},u=function(e){return function(n,t){return n[t]=n[t]?Object.assign({},n[t],{fns:n[t].fns.concat(e.types[t].fns)}):e.types[t],n}},d=function(){},p=function(e){return/radio|checkbox/i.test(e.type)},m=function(e,n){return!p(n)&&function(e){return null!=e.value&&e.value.length>0}(n)&&(e=n.value),p(n)&&n.checked&&(Array.isArray(e)?e.push(n.value):e=[n.value]),e},f="ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|be|bf|bg|bh|bi|bj|bm|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|cl|cm|cn|co|cr|cu|cv|cw|cx|cz|de|dj|dk|dm|do|dz|ec|ee|eg|es|et|eu|fi|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|im|in|io|iq|ir|is|it|je|jo|jp|kg|ki|km|kn|kp|kr|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|na|nc|ne|nf|ng|nl|no|nr|nu|nz|om|pa|pe|pf|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|yt".split("|"),g="netlify|azurewebsites|com|edu|gov|net|mil|org|nom|sch|caa|res|off|gob|int|tur|ip6|uri|urn|asn|act|nsw|qld|tas|vic|pro|biz|adm|adv|agr|arq|art|ato|bio|bmd|cim|cng|cnt|ecn|eco|emp|eng|esp|etc|eti|far|fnd|fot|fst|g12|ggf|imb|ind|inf|jor|jus|leg|lel|mat|med|mus|not|ntr|odo|ppg|psc|psi|qsl|rec|slg|srv|teo|tmp|trd|vet|zlg|web|ltd|sld|pol|fin|k12|lib|pri|aip|fie|eun|sci|prd|cci|pvt|mod|idv|rel|sex|gen|nic|abr|bas|cal|cam|emr|fvg|laz|lig|lom|mar|mol|pmn|pug|sar|sic|taa|tos|umb|vao|vda|ven|mie|北海道|和歌山|神奈川|鹿児島|ass|rep|tra|per|ngo|soc|grp|plc|its|air|and|bus|can|ddr|jfk|mad|nrw|nyc|ski|spy|tcm|ulm|usa|war|fhs|vgs|dep|eid|fet|fla|flå|gol|hof|hol|sel|vik|cri|iwi|ing|abo|fam|gok|gon|gop|gos|aid|atm|gsm|sos|elk|waw|est|aca|bar|cpa|jur|law|sec|plo|www|bir|cbg|jar|khv|msk|nov|nsk|ptz|rnd|spb|stv|tom|tsk|udm|vrn|cmw|kms|nkz|snz|pub|fhv|red|ens|nat|rns|rnu|bbs|tel|bel|kep|nhs|dni|fed|isa|nsn|gub|e12|tec|орг|обр|упр|alt|nis|jpn|mex|ath|iki|nid|gda|inc".split("|"),b=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})},v=function(e,n){return function(){var t=new CustomEvent(e,{bubbles:!0,detail:{getState:n.getState}});window.document.dispatchEvent(t)}},y={name:".CookiePreferences",path:"/",domain:"localhost"===window.location.hostname?"":"."+function(e){for(var n=(e=e.replace(/^www\./,"")).split(".");n.length>3;)n.shift();return 3===n.length&&-1===g.indexOf(n[1])&&-1===f.indexOf(n[2])&&n.shift(),n.join(".")}(window.location.hostname),secure:!0,samesite:"strict",expiry:365,types:{},necessary:[],policyURL:"/cookie-policy/#preferences",classNames:{banner:"privacy-banner",acceptBtn:"privacy-banner__accept",submitBtn:"privacy-banner__submit",optionsBtn:"privacy-banner__options",field:"privacy-banner__field",form:"privacy-banner__form",fieldset:"privacy-banner__fieldset",legend:"privacy-banner__legend",formContainer:"privacy-banner__form-container",formMessage:"privacy-banner__form-msg",title:"privacy-banner__form-title",description:"privacy-banner__form-description"},hideBannerOnFormPage:!0,savedMessage:"Your settings have been saved.",bannerTemplate:function(e){return'<section role="dialog" aria-live="polite" aria-label="Your privacy" class="'+e.classNames.banner+'">\n <div class="privacy-content">\n <div class="wrap">\n \x3c!--googleoff: all--\x3e\n <div class="privacy-banner__title">Cookies</div>\n <p>We use cookies to improve your experience on our site and show you personalised advertising.</p>\n <p>Find out more from our <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="/privacy-policy">privacy policy</a> and <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">cookie policy</a>.</p>\n <button type="button" class="btn btn--primary '+e.classNames.acceptBtn+'">Accept and close</button>\n <a class="privacy-banner__link '+e.classNames.optionsBtn+'" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">Your options</a>\n \x3c!--googleon: all--\x3e\n </div>\n </div>\n </section>'},messageTemplate:function(e){return'<div class="'+e.settings.classNames.formMessage+'" aria-role="alert">'+e.settings.savedMessage+"</div>"},formTemplate:function(e){return'<form id="preferences" class="'+e.settings.classNames.form+'" novalidate>\n '+Object.keys(e.settings.types).map(function(n){return'<fieldset class="'+e.settings.classNames.fieldset+'">\n <legend class="'+e.settings.classNames.legend+'">\n <span class="'+e.settings.classNames.title+'">'+e.settings.types[n].title+'</span>\n <span class="'+e.settings.classNames.description+'">'+e.settings.types[n].description+'</span>\n </legend>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+n.split(" ")[0].replace(" ","-")+'"\n value="1"\n '+(1===e.consent[n]?"checked":"")+'>\n <span class="privacy-banner__label-text">I am OK with this</span>\n <span class="privacy-banner__label-description">'+e.settings.types[n].labels.yes+'</span>\n </label> \n </div>\n </div>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+n.split(" ")[0].replace(" ","-")+'"\n value="0"\n '+(0===e.consent[n]?"checked":"")+'>\n <span class="privacy-banner__label-text">No thank you</span>\n <span class="privacy-banner__label-description">'+e.settings.types[n].labels.no+"</span>\n </label> \n </div>\n </div>\n </fieldset>"}).join("")+'\n <button class="'+e.settings.classNames.submitBtn+'"'+(Object.keys(e.consent).length!==Object.keys(e.settings.types).length?" disabled":"")+">Save my settings</button>\n </form>"}};function h(){return h=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},h.apply(this,arguments)}var k=function(e,n){return n},w=function(e,n){return Object.assign({},e,{bannerOpen:n})},x=function(e,n){return Object.assign({},e,{consent:Object.assign({},e.consent,n)})},j=function(e,n){return Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,n)})})},_=function(e){return function(n){Object.keys(n.consent).forEach(function(e){n.settings.types[e]&&!0!==n.settings.types[e].executed&&n.consent[e]&&Boolean(n.consent[e])&&n.settings.types[e].fns.forEach(function(e){return e(n)})}),e.update(j,Object.keys(n.settings.types).reduce(function(e,t){return e[t]=Object.assign({},n.settings.types[t],{executed:n.settings.types[t].executed||n.consent[t]&&Boolean(n.consent[t])}),e},{}))}},O=function(e){e.settings.necessary.forEach(function(n){return n(e)})},S=function(e){return Object.keys(e).filter(function(n){return e[n]}).join(",")},N=function(){try{var e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},B=function(e,n,t){return void 0===t&&(t="collect"),function(e){if(!navigator.sendBeacon){var n=document.createElement("img");return n.width=1,n.height=1,n.src=e,n}navigator.sendBeacon(e)}(function(e,n){return"https://www.google-analytics.com/"+n+"?"+function(e){return Object.keys(e).reduce(function(n,t){return null!==e[t]&&n.push(t+"="+encodeURIComponent(e[t])),n},[]).join("&")}(e)}(h({},e.persistentMeasurementParams,n,e.settings.debug?{}:{z:N()}),t))},T=function(e){return function(){var n=e.getState();n.bannerOpen||n.settings.hideBannerOnFormPage&&document.querySelector("."+n.settings.classNames.formContainer)||(document.body.firstElementChild.insertAdjacentHTML("beforebegin",n.settings.bannerTemplate(n.settings)),n.settings.tid&&B(n,t),e.update(w,!0,[v("banner.show",e)]))}},q=function(n){return function(){var t=n.getState(),a=document.querySelector("."+t.settings.classNames.banner);if(a){var r=function(n){return e.map(function(e){return e+"."+n}).join(", ")},l=[].slice.call(document.querySelectorAll(r(t.settings.classNames.acceptBtn))),u=document.querySelector(r(t.settings.classNames.optionsBtn));l.forEach(function(e){l?e.addEventListener("click",function(e){n.update(x,Object.keys(t.settings.types).reduce(function(e,n){return e[n]=1,e},{}),[c,_(n),E(n,a),A(n,!1),v(o,n),function(e){e.settings.tid&&B(e,h({},s,{cd2:S(n.getState().consent)}))}])}):console.warn("Banner accept element must be a Button or Anchor. No trigger event added.")}),u&&t.settings.tid?u.addEventListener("click",function(e){return B(t,i)}):console.warn("No trigger added for options element. Check that the element is a Button or Anchor and that your tid is set.")}}},E=function(e,n){return function(){n&&n.parentNode&&(n.parentNode.removeChild(n),e.update(w,!1,[v("banner.hide",e)]))}},A=function(e,n){return void 0===n&&(n=!0),function(){var t=e.getState(),s=document.querySelector("."+t.settings.classNames.formContainer);if(s){s.innerHTML=t.settings.formTemplate(function(e){return Object.keys(e.consent).length>0?e:Object.assign({},e,{consent:Object.keys(e.settings.types).reduce(function(n,t){return e.settings.types[t].suggested&&(n[t]=1),n},{})})}(t)),t.settings.tid&&n&&B(t,a);var i=document.querySelector("."+t.settings.classNames.form),u=document.querySelector("."+t.settings.classNames.banner),d=document.querySelector("."+t.settings.classNames.submitBtn),p=[].slice.call(document.querySelectorAll("."+t.settings.classNames.field)).reduce(function(e,n){var t=n.getAttribute("name").replace("privacy-","");return e[t]?e[t].push(n):e[t]=[n],e},{}),f=function(){return Object.keys(p).reduce(function(e,n){var t=p[n].reduce(m,"");return t&&(e[n]=parseInt(t,10)),e},{})};d.hasAttribute("disabled")&&i.addEventListener("change",function e(n){Object.keys(f()).length===Object.keys(p).length&&(d.removeAttribute("disabled"),i.removeEventListener("change",e))}),i.addEventListener("submit",function(n){n.preventDefault(),e.update(x,f(),[l,c,_(e),E(e,u),v(o,e),z(d),function(e){if(e.settings.tid){var n=S(e.consent);B(e,h({},r,{cd2:""===n?"None":n,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}}])}),window.location.hash.substring(1)===i.id&&window.scrollTo(0,i.getBoundingClientRect().top+window.scrollY)}}},z=function(e){return function(n){e.insertAdjacentHTML("afterend",n.settings.messageTemplate(n)),e.setAttribute("disabled","disabled"),window.setTimeout(function(){e.parentNode.removeChild(e.nextElementSibling),e.removeAttribute("disabled")},3e3)}};return function(e){return function(e){if(function(){try{document.cookie="cookietest=1";var e=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(e){return!1}}()){var t,s=(t={},{update:function(e,n,s){t=e(t,n),s&&s.forEach(function(e){return e(t)})},getState:function(){return t}});e.tid||console.warn("The tid setting is missing. A tid is required for banner measurements.");var i=function(e){try{var n=function(e){for(var n=document.cookie.split("; "),t=0;t<=n.length;t++){if(!n[t])return!1;var s=n[t].split("=");if(s[0]===e.name)return window.atob(s[1])}return!1}(e);if(!n)return[!1,b(),{}];var t=JSON.parse(n),s=t.consent;return[void 0!==s,t.cid||b(),s||{}]}catch(e){return[!1,b(),{}]}}(e),a=i[0];return s.update(k,{settings:e,bannerOpen:!1,persistentMeasurementParams:!!e.tid&&(r=i[1],o=e.tid,{tid:o,v:1,t:"event",ds:"cookiebanner",dh:location.hostname,uip:"0.0.0.0",sr:window.screen?window.screen.width+"x"+window.screen.height:null,vp:document.documentElement.clientWidth+"x"+document.documentElement.clientHeight,cid:r,cd1:r,cd3:location.hostname,cd4:"consentAPI"}),consent:i[2]},[O,_(s),a?d:T(s),A(s),q(s)]),{getState:s.getState,showBanner:function(e){(function(e){return function(t){if(T(e)(),e.getState().bannerOpen){A(e)();var s,i=(s=document.body.firstElementChild,[].slice.call(s.querySelectorAll(n.join(","))));i.length>0&&i[0].focus(),t&&t.call&&t(e.getState())}}})(s)(e),q(s)()},renderForm:A(s)}}var r,o}(Object.assign({},y,e,{types:Object.keys(e.types).reduce(u(e),y.types)}))}}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e||self).CookieBanner=n()}(this,function(){var e=["button","a"],n=["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex="-1"])'],t={ec:"Banner",ea:"Displays",cm1:1},s={ec:"Save preferences",ea:"Banner",cm2:1,cm3:1},i={ec:"Banner",ea:"Clicks",el:"Edit preferences",cm4:1},a={ec:"CookiePrefsWidget",ea:"Displays",cm5:1},r={ec:"Save preferences",ea:"CookiePrefs"},o="banner.consent",c=function(e){document.cookie=[e.settings.name+"="+btoa(JSON.stringify({consent:e.consent,cid:e.persistentMeasurementParams.cid}))+";","expires="+new Date((new Date).getTime()+24*e.settings.expiry*60*60*1e3).toGMTString()+";",e.settings.path?"path="+e.settings.path+";":"",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")},l=function(e){document.cookie.split("; ").map(function(e){return{name:e.split("=")[0],value:e.split("=")[1],expiry:"Thu, 01 Jan 1970 00:00:01 GMT"}}).map(function(e){return function(n){return document.cookie=[n.name+"="+n.value+";","expires="+n.expiry+";","path="+e.settings.path+";",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")}}(e))},u=function(e){return function(n,t){return n[t]=n[t]?Object.assign({},n[t],{fns:n[t].fns.concat(e.types[t].fns)}):e.types[t],n}},d=function(){},p=function(e){return/radio|checkbox/i.test(e.type)},m=function(e,n){return!p(n)&&function(e){return null!=e.value&&e.value.length>0}(n)&&(e=n.value),p(n)&&n.checked&&(Array.isArray(e)?e.push(n.value):e=[n.value]),e},f="ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|be|bf|bg|bh|bi|bj|bm|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|cl|cm|cn|co|cr|cu|cv|cw|cx|cz|de|dj|dk|dm|do|dz|ec|ee|eg|es|et|eu|fi|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|im|in|io|iq|ir|is|it|je|jo|jp|kg|ki|km|kn|kp|kr|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|na|nc|ne|nf|ng|nl|no|nr|nu|nz|om|pa|pe|pf|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|yt".split("|"),g="netlify|azurewebsites|com|edu|gov|net|mil|org|nom|sch|caa|res|off|gob|int|tur|ip6|uri|urn|asn|act|nsw|qld|tas|vic|pro|biz|adm|adv|agr|arq|art|ato|bio|bmd|cim|cng|cnt|ecn|eco|emp|eng|esp|etc|eti|far|fnd|fot|fst|g12|ggf|imb|ind|inf|jor|jus|leg|lel|mat|med|mus|not|ntr|odo|ppg|psc|psi|qsl|rec|slg|srv|teo|tmp|trd|vet|zlg|web|ltd|sld|pol|fin|k12|lib|pri|aip|fie|eun|sci|prd|cci|pvt|mod|idv|rel|sex|gen|nic|abr|bas|cal|cam|emr|fvg|laz|lig|lom|mar|mol|pmn|pug|sar|sic|taa|tos|umb|vao|vda|ven|mie|北海道|和歌山|神奈川|鹿児島|ass|rep|tra|per|ngo|soc|grp|plc|its|air|and|bus|can|ddr|jfk|mad|nrw|nyc|ski|spy|tcm|ulm|usa|war|fhs|vgs|dep|eid|fet|fla|flå|gol|hof|hol|sel|vik|cri|iwi|ing|abo|fam|gok|gon|gop|gos|aid|atm|gsm|sos|elk|waw|est|aca|bar|cpa|jur|law|sec|plo|www|bir|cbg|jar|khv|msk|nov|nsk|ptz|rnd|spb|stv|tom|tsk|udm|vrn|cmw|kms|nkz|snz|pub|fhv|red|ens|nat|rns|rnu|bbs|tel|bel|kep|nhs|dni|fed|isa|nsn|gub|e12|tec|орг|обр|упр|alt|nis|jpn|mex|ath|iki|nid|gda|inc".split("|"),b=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})},v=function(e,n){return function(){var t=new CustomEvent(e,{bubbles:!0,detail:{getState:n.getState}});window.document.dispatchEvent(t)}},y={name:".CookiePreferences",path:"/",domain:"localhost"===window.location.hostname?"":"."+function(e){for(var n=(e=e.replace(/^www\./,"")).split(".");n.length>3;)n.shift();return 3===n.length&&-1===g.indexOf(n[1])&&-1===f.indexOf(n[2])&&n.shift(),n.join(".")}(window.location.hostname),secure:!0,samesite:"strict",expiry:365,types:{},necessary:[],policyURL:"/cookie-policy/#preferences",classNames:{banner:"privacy-banner",acceptBtn:"privacy-banner__accept",submitBtn:"privacy-banner__submit",optionsBtn:"privacy-banner__options",field:"privacy-banner__field",form:"privacy-banner__form",fieldset:"privacy-banner__fieldset",legend:"privacy-banner__legend",formContainer:"privacy-banner__form-container",formMessage:"privacy-banner__form-msg",formAnnouncement:"privacy-banner__form-announcement",title:"privacy-banner__form-title",description:"privacy-banner__form-description"},hideBannerOnFormPage:!0,savedMessage:"Your settings have been saved.",bannerTemplate:function(e){return'<section role="dialog" aria-live="polite" aria-label="Your privacy" class="'+e.classNames.banner+'">\n <div class="privacy-content">\n <div class="wrap">\n \x3c!--googleoff: all--\x3e\n <div class="privacy-banner__title">Cookies</div>\n <p>We use cookies to improve your experience on our site and show you personalised advertising.</p>\n <p>Find out more from our <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="/privacy-policy">privacy policy</a> and <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">cookie policy</a>.</p>\n <button type="button" class="btn btn--primary '+e.classNames.acceptBtn+'">Accept and close</button>\n <a class="privacy-banner__link '+e.classNames.optionsBtn+'" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">Your options</a>\n \x3c!--googleon: all--\x3e\n </div>\n </div>\n </section>'},messageTemplate:function(e){return'<div class="'+e.settings.classNames.formMessage+'" aria-hidden="true">'+e.settings.savedMessage+"</div>"},formTemplate:function(e){return'<form id="preferences" class="'+e.settings.classNames.form+'" novalidate>\n '+Object.keys(e.settings.types).map(function(n){return'<fieldset class="'+e.settings.classNames.fieldset+'">\n <legend class="'+e.settings.classNames.legend+'">\n <span class="'+e.settings.classNames.title+'">'+e.settings.types[n].title+'</span>\n <span class="'+e.settings.classNames.description+'">'+e.settings.types[n].description+'</span>\n </legend>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+n.split(" ")[0].replace(" ","-")+'"\n value="1"\n '+(1===e.consent[n]?"checked":"")+'>\n <span class="privacy-banner__label-text">I am OK with this</span>\n <span class="privacy-banner__label-description">'+e.settings.types[n].labels.yes+'</span>\n </label> \n </div>\n </div>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+n.split(" ")[0].replace(" ","-")+'"\n value="0"\n '+(0===e.consent[n]?"checked":"")+'>\n <span class="privacy-banner__label-text">No thank you</span>\n <span class="privacy-banner__label-description">'+e.settings.types[n].labels.no+"</span>\n </label> \n </div>\n </div>\n </fieldset>"}).join("")+'\n <button class="'+e.settings.classNames.submitBtn+'"'+(Object.keys(e.consent).length!==Object.keys(e.settings.types).length?" disabled":"")+">Save my settings</button>\n </form>"}};function h(){return h=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},h.apply(this,arguments)}var k=function(e,n){return n},w=function(e,n){return Object.assign({},e,{bannerOpen:n})},x=function(e,n){return Object.assign({},e,{consent:Object.assign({},e.consent,n)})},j=function(e,n){return Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,n)})})},_=function(e){return function(n){Object.keys(n.consent).forEach(function(e){n.settings.types[e]&&!0!==n.settings.types[e].executed&&n.consent[e]&&Boolean(n.consent[e])&&n.settings.types[e].fns.forEach(function(e){return e(n)})}),e.update(j,Object.keys(n.settings.types).reduce(function(e,t){return e[t]=Object.assign({},n.settings.types[t],{executed:n.settings.types[t].executed||n.consent[t]&&Boolean(n.consent[t])}),e},{}))}},O=function(e){e.settings.necessary.forEach(function(n){return n(e)})},N=function(e){return Object.keys(e).filter(function(n){return e[n]}).join(",")},S=function(){try{var e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},B=function(e,n,t){return void 0===t&&(t="collect"),function(e){if(!navigator.sendBeacon){var n=document.createElement("img");return n.width=1,n.height=1,n.src=e,n}navigator.sendBeacon(e)}(function(e,n){return"https://www.google-analytics.com/"+n+"?"+function(e){return Object.keys(e).reduce(function(n,t){return null!==e[t]&&n.push(t+"="+encodeURIComponent(e[t])),n},[]).join("&")}(e)}(h({},e.persistentMeasurementParams,n,e.settings.debug?{}:{z:S()}),t))},A=function(e){return function(){var n=e.getState();n.bannerOpen||n.settings.hideBannerOnFormPage&&document.querySelector("."+n.settings.classNames.formContainer)||(document.body.firstElementChild.insertAdjacentHTML("beforebegin",n.settings.bannerTemplate(n.settings)),n.settings.tid&&B(n,t),e.update(w,!0,[v("banner.show",e)]))}},T=function(n){return function(){var t=n.getState(),a=document.querySelector("."+t.settings.classNames.banner);if(a){var r=function(n){return e.map(function(e){return e+"."+n}).join(", ")},l=[].slice.call(document.querySelectorAll(r(t.settings.classNames.acceptBtn))),u=document.querySelector(r(t.settings.classNames.optionsBtn));l.forEach(function(e){l?e.addEventListener("click",function(e){n.update(x,Object.keys(t.settings.types).reduce(function(e,n){return e[n]=1,e},{}),[c,_(n),q(n,a),C(n,!1),v(o,n),function(e){e.settings.tid&&B(e,h({},s,{cd2:N(n.getState().consent)}))}])}):console.warn("Banner accept element must be a Button or Anchor. No trigger event added.")}),u&&t.settings.tid?u.addEventListener("click",function(e){return B(t,i)}):console.warn("No trigger added for options element. Check that the element is a Button or Anchor and that your tid is set.")}}},q=function(e,n){return function(){n&&n.parentNode&&(n.parentNode.removeChild(n),e.update(w,!1,[v("banner.hide",e)]))}},C=function(e,n){return void 0===n&&(n=!0),function(){var t=e.getState(),s=document.querySelector("."+t.settings.classNames.formContainer);if(s){s.innerHTML=t.settings.formTemplate(function(e){return Object.keys(e.consent).length>0?e:Object.assign({},e,{consent:Object.keys(e.settings.types).reduce(function(n,t){return e.settings.types[t].suggested&&(n[t]=1),n},{})})}(t)),t.settings.tid&&n&&B(t,a);var i=document.querySelector("."+t.settings.classNames.form),u=document.querySelector("."+t.settings.classNames.banner),d=document.querySelector("."+t.settings.classNames.submitBtn),p=[].slice.call(document.querySelectorAll("."+t.settings.classNames.field)).reduce(function(e,n){var t=n.getAttribute("name").replace("privacy-","");return e[t]?e[t].push(n):e[t]=[n],e},{}),f=document.querySelector("."+t.settings.classNames.formAnnouncement)||document.body.appendChild(Object.assign(document.createElement("div"),{className:t.settings.classNames.formAnnouncement,role:"alert"})),g=function(){return Object.keys(p).reduce(function(e,n){var t=p[n].reduce(m,"");return t&&(e[n]=parseInt(t,10)),e},{})};d.hasAttribute("disabled")&&i.addEventListener("change",function e(n){Object.keys(g()).length===Object.keys(p).length&&(d.removeAttribute("disabled"),i.removeEventListener("change",e))}),i.addEventListener("submit",function(n){n.preventDefault(),e.update(x,g(),[l,c,_(e),q(e,u),v(o,e),E(d),z(f),function(e){if(e.settings.tid){var n=N(e.consent);B(e,h({},r,{cd2:""===n?"None":n,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}}])}),window.location.hash.substring(1)===i.id&&window.scrollTo(0,i.getBoundingClientRect().top+window.scrollY)}}},E=function(e){return function(n){e.insertAdjacentHTML("afterend",n.settings.messageTemplate(n)),e.setAttribute("disabled","disabled"),window.setTimeout(function(){e.parentNode.removeChild(e.nextElementSibling),e.removeAttribute("disabled")},3e3)}},z=function(e){return function(n){e.textContent=n.settings.savedMessage,window.setTimeout(function(){e.textContent=""},3e3)}};return function(e){return function(e){if(function(){try{document.cookie="cookietest=1";var e=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(e){return!1}}()){var t,s=(t={},{update:function(e,n,s){t=e(t,n),s&&s.forEach(function(e){return e(t)})},getState:function(){return t}});e.tid||console.warn("The tid setting is missing. A tid is required for banner measurements.");var i=function(e){try{var n=function(e){for(var n=document.cookie.split("; "),t=0;t<=n.length;t++){if(!n[t])return!1;var s=n[t].split("=");if(s[0]===e.name)return window.atob(s[1])}return!1}(e);if(!n)return[!1,b(),{}];var t=JSON.parse(n),s=t.consent;return[void 0!==s,t.cid||b(),s||{}]}catch(e){return[!1,b(),{}]}}(e),a=i[0];return s.update(k,{settings:e,bannerOpen:!1,persistentMeasurementParams:!!e.tid&&(r=i[1],o=e.tid,{tid:o,v:1,t:"event",ds:"cookiebanner",dh:location.hostname,uip:"0.0.0.0",sr:window.screen?window.screen.width+"x"+window.screen.height:null,vp:document.documentElement.clientWidth+"x"+document.documentElement.clientHeight,cid:r,cd1:r,cd3:location.hostname,cd4:"consentAPI"}),consent:i[2]},[O,_(s),a?d:A(s),C(s),T(s)]),{getState:s.getState,showBanner:function(e){(function(e){return function(t){if(A(e)(),e.getState().bannerOpen){C(e)();var s,i=(s=document.body.firstElementChild,[].slice.call(s.querySelectorAll(n.join(","))));i.length>0&&i[0].focus(),t&&t.call&&t(e.getState())}}})(s)(e),T(s)()},renderForm:C(s)}}var r,o}(Object.assign({},y,e,{types:Object.keys(e.types).reduce(u(e),y.types)}))}}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@stormid/cookie-banner", | ||
"version": "1.0.0-alpha.23", | ||
"version": "1.0.0-alpha.24", | ||
"description": "GDPR compliant cookie banner", | ||
@@ -31,3 +31,3 @@ "author": "stormid", | ||
}, | ||
"gitHead": "98d7999731e2860f1935b4cc60bdb2eb49fcab44" | ||
"gitHead": "de5b858f4c059878dfc80345a98a96ff327ab8d9" | ||
} |
@@ -18,3 +18,5 @@ # Cookie banner | ||
A page containing a cookie consent form should include a visually hidden live region (role=alert) with a particular className (classNames.formAnnouncement), default: 'privacy-banner__form-announcement'. | ||
Install the package | ||
@@ -91,2 +93,3 @@ ``` | ||
formMessage: 'privacy-banner__form-msg', | ||
formAnnouncement: 'privacy-banner__form-announcement', //screen reader announcement | ||
title: 'privacy-banner__form-title', | ||
@@ -93,0 +96,0 @@ description: 'privacy-banner__form-description' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
234483
217
196