@stormid/cookie-banner
Advanced tools
Comparing version 1.0.0-alpha.13 to 1.0.0-alpha.14
@@ -1,2 +0,2 @@ | ||
var e=["click","keydown"],n=[13,32],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},r={ec:"CookiePrefsWidget",ea:"Displays",cm5:1},a={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={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 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 v(){return(v=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}).apply(this,arguments)}var y=function(e,n){return n},h=function(e,n){return Object.assign({},e,{consent:Object.assign({},e.consent,n)})},k=function(e,n){return Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,n)})})},x=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(k,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},{}))}},w=function(e){e.settings.necessary.forEach(function(n){return n(e)})},j=function(e){return Object.keys(e).filter(function(n){return e[n]}).join(",")},_=function(){try{var e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},O=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)}(v({},e.persistentMeasurementParams,n,e.settings.debug?{}:{z:_()}),t))},N=function(r){return function(a){if(!a.settings.hideBannerOnFormPage||!document.querySelector("."+a.settings.classNames.formContainer)){document.body.firstElementChild.insertAdjacentHTML("beforebegin",a.settings.bannerTemplate(a.settings)),a.settings.tid&&O(a,t);var o=document.querySelector("."+a.settings.classNames.banner),l=document.querySelector("."+a.settings.classNames.acceptBtn),u=document.querySelector("."+a.settings.classNames.optionsBtn);e.forEach(function(e){l.addEventListener(e,function(e){(function(e){return!!e.keyCode&&!~n.indexOf(e.keyCode)||e.which&&3===e.which})(e)||r.update(h,Object.keys(a.settings.types).reduce(function(e,n){return e[n]=1,e},{}),[c,x(r),S(o),B(r,!1),function(e){e.settings.tid&&O(e,v({},s,{cd2:j(r.getState().consent)}))}])}),a.settings.tid&&u.addEventListener(e,function(e){return O(a,i)})})}}},S=function(e){return function(){return e&&e.parentNode&&e.parentNode.removeChild(e)}},B=function(e,n){return void 0===n&&(n=!0),function(t){var 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&&O(t,r);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(h,m(),[o,c,x(e),S(l),q(u),function(e){if(e.settings.tid){var n=j(e.consent);O(e,v({},a,{cd2:""===n?"None":n,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}}])})}}},q=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 n,t=(n={},{update:function(e,t,s){n=e(n,t),s&&s.forEach(function(e){return e(n)})},getState:function(){return n}}),s=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);return[!0,t.cid,t.consent]}catch(e){return[!1,f(),{}]}}(e),i=s[0];return t.update(y,{settings:e,persistentMeasurementParams:!!e.tid&&(r=s[1],a=e.tid,{tid:a,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:s[2]},[w,x(t),i?u:N(t),B(t)]),{getState:t.getState}}var r,a}(Object.assign({},b,e,{types:Object.keys(e.types).reduce(l(e),b.types)}))}; | ||
var e=["click","keydown"],n=[13,32],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},r={ec:"CookiePrefsWidget",ea:"Displays",cm5:1},a={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={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 v(){return(v=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}).apply(this,arguments)}var y=function(e,n){return n},h=function(e,n){return Object.assign({},e,{consent:Object.assign({},e.consent,n)})},k=function(e,n){return Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,n)})})},x=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(k,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},{}))}},w=function(e){e.settings.necessary.forEach(function(n){return n(e)})},j=function(e){return Object.keys(e).filter(function(n){return e[n]}).join(",")},_=function(){try{var e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},O=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)}(v({},e.persistentMeasurementParams,n,e.settings.debug?{}:{z:_()}),t))},N=function(r){return function(a){if(!a.settings.hideBannerOnFormPage||!document.querySelector("."+a.settings.classNames.formContainer)){document.body.firstElementChild.insertAdjacentHTML("beforebegin",a.settings.bannerTemplate(a.settings)),a.settings.tid&&O(a,t);var o=document.querySelector("."+a.settings.classNames.banner),l=[].slice.call(document.querySelectorAll("."+a.settings.classNames.acceptBtn)),u=document.querySelector("."+a.settings.classNames.optionsBtn);e.forEach(function(e){l.forEach(function(t){t.addEventListener(e,function(e){(function(e){return!!e.keyCode&&!~n.indexOf(e.keyCode)||e.which&&3===e.which})(e)||r.update(h,Object.keys(a.settings.types).reduce(function(e,n){return e[n]=1,e},{}),[c,x(r),S(o),B(r,!1),function(e){e.settings.tid&&O(e,v({},s,{cd2:j(r.getState().consent)}))}])})}),u&&a.settings.tid&&u.addEventListener(e,function(e){return O(a,i)})})}}},S=function(e){return function(){return e&&e.parentNode&&e.parentNode.removeChild(e)}},B=function(e,n){return void 0===n&&(n=!0),function(t){var 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&&O(t,r);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(h,m(),[o,c,x(e),S(l),q(u),function(e){if(e.settings.tid){var n=j(e.consent);O(e,v({},a,{cd2:""===n?"None":n,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}}])})}}},q=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 n,t=(n={},{update:function(e,t,s){n=e(n,t),s&&s.forEach(function(e){return e(n)})},getState:function(){return n}}),s=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.cid,i=t.consent;return[void 0!==s&&void 0!==i,s||f(),i||{}]}catch(e){return[!1,f(),{}]}}(e),i=s[0];return t.update(y,{settings:e,persistentMeasurementParams:!!e.tid&&(r=s[1],a=e.tid,{tid:a,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:s[2]},[w,x(t),i?u:N(t),B(t)]),{getState:t.getState}}var r,a}(Object.assign({},b,e,{types:Object.keys(e.types).reduce(l(e),b.types)}))}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
const e=["click","keydown"],t=[13,32],s={ec:"Banner",ea:"Displays",cm1:1},n={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,s)=>(t[s]=t[s]?Object.assign({},t[s],{fns:t[s].fns.concat(e.types[s].fns)}):e.types[s],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)});var y={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 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 f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}const v=(e,t)=>t,h=(e,t)=>Object.assign({},e,{consent:Object.assign({},e.consent,t)}),k=(e,t)=>Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,t)})}),x=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(k,Object.keys(t.settings.types).reduce((e,s)=>(e[s]=Object.assign({},t.settings.types[s],{executed:t.settings.types[s].executed||t.consent[s]&&Boolean(t.consent[s])}),e),{}))},w=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"}),j=e=>Object.keys(e).filter(t=>e[t]).join(","),_=()=>{try{const e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},O=(e,t,s="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,s)=>(null!==e[s]&&t.push(`${s}=${encodeURIComponent(e[s])}`),t),[]).join("&"))(e)}`)(f({},e.persistentMeasurementParams,t,e.settings.debug?{}:{z:_()}),s)),N=i=>r=>{if(r.settings.hideBannerOnFormPage&&document.querySelector(`.${r.settings.classNames.formContainer}`))return;document.body.firstElementChild.insertAdjacentHTML("beforebegin",r.settings.bannerTemplate(r.settings)),r.settings.tid&&O(r,s);const o=document.querySelector(`.${r.settings.classNames.banner}`),l=document.querySelector(`.${r.settings.classNames.acceptBtn}`),d=document.querySelector(`.${r.settings.classNames.optionsBtn}`);e.forEach(e=>{l.addEventListener(e,e=>{(e=>!!e.keyCode&&!~t.indexOf(e.keyCode)||e.which&&3===e.which)(e)||i.update(h,Object.keys(r.settings.types).reduce((e,t)=>(e[t]=1,e),{}),[c,x(i),S(o),B(i,!1),e=>{e.settings.tid&&O(e,f({},n,{cd2:j(i.getState().consent)}))}])}),r.settings.tid&&d.addEventListener(e,e=>O(r,a))})},S=e=>()=>e&&e.parentNode&&e.parentNode.removeChild(e),B=(e,t=!0)=>s=>{const n=document.querySelector(`.${s.settings.classNames.formContainer}`);if(!n)return;n.innerHTML=s.settings.formTemplate((e=>Object.keys(e.consent).length>0?e:Object.assign({},e,{consent:Object.keys(e.settings.types).reduce((t,s)=>(e.settings.types[s].suggested&&(t[s]=1),t),{})}))(s)),s.settings.tid&&t&&O(s,i);const a=document.querySelector(`.${s.settings.classNames.form}`),l=document.querySelector(`.${s.settings.classNames.banner}`),d=document.querySelector(`.${s.settings.classNames.submitBtn}`),p=[].slice.call(document.querySelectorAll(`.${s.settings.classNames.field}`)).reduce((e,t)=>{const s=t.getAttribute("name").replace("privacy-","");return e[s]?e[s].push(t):e[s]=[t],e},{}),g=()=>Object.keys(p).reduce((e,t)=>{const s=p[t].reduce(m,"");return s&&(e[t]=parseInt(s,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(h,g(),[o,c,x(e),S(l),q(d),e=>{if(!e.settings.tid)return;const t=j(e.consent);O(e,f({},r,{cd2:""===t?"None":t,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}])})},q=e=>t=>{e.insertAdjacentHTML("afterend",t.settings.messageTemplate(t)),e.setAttribute("disabled","disabled"),window.setTimeout(()=>{e.parentNode.removeChild(e.nextElementSibling),e.removeAttribute("disabled")},3e3)};export default 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 t=(()=>{let e={};return{update:(t,s,n)=>{e=t(e,s),n&&n.forEach(t=>t(e))},getState:()=>e}})(),[s,n,a]=(e=>{try{const t=(e=>{const t=document.cookie.split("; ");for(let s=0;s<=t.length;s++){if(!t[s])return!1;const[n,a]=t[s].split("=");if(n===e.name)return window.atob(a)}return!1})(e);if(!t)return[!1,b(),{}];const{cid:s,consent:n}=JSON.parse(t);return[!0,s,n]}catch(e){return[!1,b(),{}]}})(e);return t.update(v,{settings:e,persistentMeasurementParams:!!e.tid&&$(n,e.tid),consent:a},[w,x(t),s?d:N(t),B(t)]),{getState:t.getState}})(Object.assign({},y,e,{types:Object.keys(e.types).reduce(l(e),y.types)})); | ||
const e=["click","keydown"],t=[13,32],s={ec:"Banner",ea:"Displays",cm1:1},n={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,s)=>(t[s]=t[s]?Object.assign({},t[s],{fns:t[s].fns.concat(e.types[s].fns)}):e.types[s],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)});var y={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 f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}const v=(e,t)=>t,h=(e,t)=>Object.assign({},e,{consent:Object.assign({},e.consent,t)}),k=(e,t)=>Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,t)})}),x=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(k,Object.keys(t.settings.types).reduce((e,s)=>(e[s]=Object.assign({},t.settings.types[s],{executed:t.settings.types[s].executed||t.consent[s]&&Boolean(t.consent[s])}),e),{}))},w=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"}),j=e=>Object.keys(e).filter(t=>e[t]).join(","),_=()=>{try{const e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},O=(e,t,s="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,s)=>(null!==e[s]&&t.push(`${s}=${encodeURIComponent(e[s])}`),t),[]).join("&"))(e)}`)(f({},e.persistentMeasurementParams,t,e.settings.debug?{}:{z:_()}),s)),N=i=>r=>{if(r.settings.hideBannerOnFormPage&&document.querySelector(`.${r.settings.classNames.formContainer}`))return;document.body.firstElementChild.insertAdjacentHTML("beforebegin",r.settings.bannerTemplate(r.settings)),r.settings.tid&&O(r,s);const o=document.querySelector(`.${r.settings.classNames.banner}`),l=[].slice.call(document.querySelectorAll(`.${r.settings.classNames.acceptBtn}`)),d=document.querySelector(`.${r.settings.classNames.optionsBtn}`);e.forEach(e=>{l.forEach(s=>{s.addEventListener(e,e=>{(e=>!!e.keyCode&&!~t.indexOf(e.keyCode)||e.which&&3===e.which)(e)||i.update(h,Object.keys(r.settings.types).reduce((e,t)=>(e[t]=1,e),{}),[c,x(i),S(o),B(i,!1),e=>{e.settings.tid&&O(e,f({},n,{cd2:j(i.getState().consent)}))}])})}),d&&r.settings.tid&&d.addEventListener(e,e=>O(r,a))})},S=e=>()=>e&&e.parentNode&&e.parentNode.removeChild(e),B=(e,t=!0)=>s=>{const n=document.querySelector(`.${s.settings.classNames.formContainer}`);if(!n)return;n.innerHTML=s.settings.formTemplate((e=>Object.keys(e.consent).length>0?e:Object.assign({},e,{consent:Object.keys(e.settings.types).reduce((t,s)=>(e.settings.types[s].suggested&&(t[s]=1),t),{})}))(s)),s.settings.tid&&t&&O(s,i);const a=document.querySelector(`.${s.settings.classNames.form}`),l=document.querySelector(`.${s.settings.classNames.banner}`),d=document.querySelector(`.${s.settings.classNames.submitBtn}`),p=[].slice.call(document.querySelectorAll(`.${s.settings.classNames.field}`)).reduce((e,t)=>{const s=t.getAttribute("name").replace("privacy-","");return e[s]?e[s].push(t):e[s]=[t],e},{}),g=()=>Object.keys(p).reduce((e,t)=>{const s=p[t].reduce(m,"");return s&&(e[t]=parseInt(s,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(h,g(),[o,c,x(e),S(l),q(d),e=>{if(!e.settings.tid)return;const t=j(e.consent);O(e,f({},r,{cd2:""===t?"None":t,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}])})},q=e=>t=>{e.insertAdjacentHTML("afterend",t.settings.messageTemplate(t)),e.setAttribute("disabled","disabled"),window.setTimeout(()=>{e.parentNode.removeChild(e.nextElementSibling),e.removeAttribute("disabled")},3e3)};export default 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 t=(()=>{let e={};return{update:(t,s,n)=>{e=t(e,s),n&&n.forEach(t=>t(e))},getState:()=>e}})(),[s,n,a]=(e=>{try{const t=(e=>{const t=document.cookie.split("; ");for(let s=0;s<=t.length;s++){if(!t[s])return!1;const[n,a]=t[s].split("=");if(n===e.name)return window.atob(a)}return!1})(e);if(!t)return[!1,b(),{}];const{cid:s,consent:n}=JSON.parse(t);return[void 0!==s&&void 0!==n,s||b(),n||{}]}catch(e){return[!1,b(),{}]}})(e);return t.update(v,{settings:e,persistentMeasurementParams:!!e.tid&&$(n,e.tid),consent:a},[w,x(t),s?d:N(t),B(t)]),{getState:t.getState}})(Object.assign({},y,e,{types:Object.keys(e.types).reduce(l(e),y.types)})); | ||
//# 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=["click","keydown"],n=[13,32],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},r={ec:"CookiePrefsWidget",ea:"Displays",cm5:1},a={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("|"),f="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("|"),g=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={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===f.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 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 v(){return(v=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}).apply(this,arguments)}var y=function(e,n){return n},h=function(e,n){return Object.assign({},e,{consent:Object.assign({},e.consent,n)})},k=function(e,n){return Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,n)})})},x=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(k,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},{}))}},w=function(e){e.settings.necessary.forEach(function(n){return n(e)})},j=function(e){return Object.keys(e).filter(function(n){return e[n]}).join(",")},_=function(){try{var e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},O=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)}(v({},e.persistentMeasurementParams,n,e.settings.debug?{}:{z:_()}),t))},N=function(r){return function(a){if(!a.settings.hideBannerOnFormPage||!document.querySelector("."+a.settings.classNames.formContainer)){document.body.firstElementChild.insertAdjacentHTML("beforebegin",a.settings.bannerTemplate(a.settings)),a.settings.tid&&O(a,t);var o=document.querySelector("."+a.settings.classNames.banner),l=document.querySelector("."+a.settings.classNames.acceptBtn),u=document.querySelector("."+a.settings.classNames.optionsBtn);e.forEach(function(e){l.addEventListener(e,function(e){(function(e){return!!e.keyCode&&!~n.indexOf(e.keyCode)||e.which&&3===e.which})(e)||r.update(h,Object.keys(a.settings.types).reduce(function(e,n){return e[n]=1,e},{}),[c,x(r),S(o),B(r,!1),function(e){e.settings.tid&&O(e,v({},s,{cd2:j(r.getState().consent)}))}])}),a.settings.tid&&u.addEventListener(e,function(e){return O(a,i)})})}}},S=function(e){return function(){return e&&e.parentNode&&e.parentNode.removeChild(e)}},B=function(e,n){return void 0===n&&(n=!0),function(t){var 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&&O(t,r);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(h,m(),[o,c,x(e),S(l),T(u),function(e){if(e.settings.tid){var n=j(e.consent);O(e,v({},a,{cd2:""===n?"None":n,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}}])})}}},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)}};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 n,t=(n={},{update:function(e,t,s){n=e(n,t),s&&s.forEach(function(e){return e(n)})},getState:function(){return n}}),s=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,g(),{}];var t=JSON.parse(n);return[!0,t.cid,t.consent]}catch(e){return[!1,g(),{}]}}(e),i=s[0];return t.update(y,{settings:e,persistentMeasurementParams:!!e.tid&&(r=s[1],a=e.tid,{tid:a,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:s[2]},[w,x(t),i?u:N(t),B(t)]),{getState:t.getState}}var r,a}(Object.assign({},b,e,{types:Object.keys(e.types).reduce(l(e),b.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=["click","keydown"],n=[13,32],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},r={ec:"CookiePrefsWidget",ea:"Displays",cm5:1},a={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("|"),f="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("|"),g=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={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===f.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 v(){return(v=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}).apply(this,arguments)}var y=function(e,n){return n},h=function(e,n){return Object.assign({},e,{consent:Object.assign({},e.consent,n)})},k=function(e,n){return Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,n)})})},x=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(k,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},{}))}},w=function(e){e.settings.necessary.forEach(function(n){return n(e)})},j=function(e){return Object.keys(e).filter(function(n){return e[n]}).join(",")},_=function(){try{var e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},O=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)}(v({},e.persistentMeasurementParams,n,e.settings.debug?{}:{z:_()}),t))},N=function(r){return function(a){if(!a.settings.hideBannerOnFormPage||!document.querySelector("."+a.settings.classNames.formContainer)){document.body.firstElementChild.insertAdjacentHTML("beforebegin",a.settings.bannerTemplate(a.settings)),a.settings.tid&&O(a,t);var o=document.querySelector("."+a.settings.classNames.banner),l=[].slice.call(document.querySelectorAll("."+a.settings.classNames.acceptBtn)),u=document.querySelector("."+a.settings.classNames.optionsBtn);e.forEach(function(e){l.forEach(function(t){t.addEventListener(e,function(e){(function(e){return!!e.keyCode&&!~n.indexOf(e.keyCode)||e.which&&3===e.which})(e)||r.update(h,Object.keys(a.settings.types).reduce(function(e,n){return e[n]=1,e},{}),[c,x(r),S(o),B(r,!1),function(e){e.settings.tid&&O(e,v({},s,{cd2:j(r.getState().consent)}))}])})}),u&&a.settings.tid&&u.addEventListener(e,function(e){return O(a,i)})})}}},S=function(e){return function(){return e&&e.parentNode&&e.parentNode.removeChild(e)}},B=function(e,n){return void 0===n&&(n=!0),function(t){var 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&&O(t,r);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(h,m(),[o,c,x(e),S(l),T(u),function(e){if(e.settings.tid){var n=j(e.consent);O(e,v({},a,{cd2:""===n?"None":n,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}}])})}}},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)}};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 n,t=(n={},{update:function(e,t,s){n=e(n,t),s&&s.forEach(function(e){return e(n)})},getState:function(){return n}}),s=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,g(),{}];var t=JSON.parse(n),s=t.cid,i=t.consent;return[void 0!==s&&void 0!==i,s||g(),i||{}]}catch(e){return[!1,g(),{}]}}(e),i=s[0];return t.update(y,{settings:e,persistentMeasurementParams:!!e.tid&&(r=s[1],a=e.tid,{tid:a,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:s[2]},[w,x(t),i?u:N(t),B(t)]),{getState:t.getState}}var r,a}(Object.assign({},b,e,{types:Object.keys(e.types).reduce(l(e),b.types)}))}}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@stormid/cookie-banner", | ||
"version": "1.0.0-alpha.13", | ||
"version": "1.0.0-alpha.14", | ||
"description": "GDPR compliant cookie banner", | ||
@@ -31,3 +31,3 @@ "author": "stormid", | ||
}, | ||
"gitHead": "0f99af70aa7ab5aac2252012dfc1eee5db29807e" | ||
"gitHead": "4924f6405897e535c45e9797eb0c930ba834eb56" | ||
} |
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
207325
193