storm-cookie-banner
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -5,7 +5,11 @@ import CookieBanner from '../src'; | ||
// Set up our document body | ||
document.body.innerHTML = `<div class="cookie-banner__update"></div>`; | ||
document.body.innerHTML = `<div class="preferences-banner__update"></div>`; | ||
CookieBanner.init({ | ||
secure: false, | ||
types: { | ||
'test': { | ||
fns: [] | ||
}, | ||
'performance': { | ||
fns: [] | ||
} | ||
@@ -16,14 +20,13 @@ } | ||
describe(`Rendering the banner`, () => { | ||
beforeAll(init); | ||
it('It should render the cookie banner', async () => { | ||
expect(document.querySelector('.cookie-banner')).not.toBeNull(); | ||
expect(document.querySelector('.preferences-banner')).not.toBeNull(); | ||
}); | ||
it('It should render each type option and the default necessary and preference types as checkboxes', async () => { | ||
const fields = Array.from(document.querySelectorAll('.cookie-banner__field')); | ||
const fields = Array.from(document.querySelectorAll('.preferences-banner__field')); | ||
expect(fields.length).toEqual(3); | ||
expect(fields.map(field => field.value)).toEqual([ 'necessary', 'preference', 'test' ]); | ||
expect(fields.map(field => field.value)).toEqual([ 'necessary', 'test', 'performance' ]); | ||
}); | ||
@@ -34,17 +37,17 @@ | ||
describe(`Accessibility`, () => { | ||
beforeAll(init); | ||
it('The cookie banner should be a dialog', async () => { | ||
expect(document.querySelector('.cookie-banner').getAttribute('role')).toEqual('dialog'); | ||
expect(document.querySelector('.preferences-banner').getAttribute('role')).toEqual('dialog'); | ||
}); | ||
it('The cookie banner should have be polite aria live region', async () => { | ||
expect(document.querySelector('.cookie-banner').getAttribute('aria-live')).toEqual('polite'); | ||
expect(document.querySelector('.preferences-banner').getAttribute('aria-live')).toEqual('polite'); | ||
}); | ||
it('The cookie banner should have an aria label', async () => { | ||
expect(document.querySelector('.cookie-banner').getAttribute('aria-label')).toBeDefined(); | ||
expect(document.querySelector('.preferences-banner').getAttribute('aria-label')).toBeDefined(); | ||
}); | ||
it('The cookie banner should be described by an element', async () => { | ||
expect(document.getElementById(document.querySelector('.cookie-banner').getAttribute('aria-describedby'))).not.toBeNull(); | ||
expect(document.getElementById(document.querySelector('.preferences-banner').getAttribute('aria-describedby'))).not.toBeNull(); | ||
}); | ||
@@ -55,18 +58,19 @@ | ||
describe(`Set consent cookies`, () => { | ||
beforeAll(init); | ||
it('Sets a cookie based on consent form', async () => { | ||
for (const field of document.querySelectorAll('.cookie-banner__field')){ | ||
for (const field of document.querySelectorAll('.preferences-banner__field')){ | ||
field.checked = true; | ||
} | ||
document.querySelector('.cookie-banner__btn').click(); | ||
expect(document.cookie).toEqual(`CookiePreferences={"necessary":true,"preference":true,"test":true}`); | ||
document.querySelector('.preferences-banner__btn').click(); | ||
expect(document.cookie).toEqual(`CookiePreferences={"necessary":true,"test":true,"performance":true}`); | ||
}); | ||
it('Hides the cookie banner', async () => { | ||
expect(document.querySelector('.cookie-banner')).toBeNull(); | ||
expect(document.querySelector('.preferences-banner')).toBeNull(); | ||
}); | ||
it('Renders the update cookie preferences button', async () => { | ||
expect(document.querySelector('.cookie-banner__update-btn')).not.toBeNull(); | ||
expect(document.querySelector('.preferences-banner__update-btn')).not.toBeNull(); | ||
}); | ||
@@ -77,21 +81,22 @@ | ||
describe(`Update consent cookies`, () => { | ||
beforeAll(init); | ||
it('Show cookie banner to update consent', async () => { | ||
document.querySelector('.cookie-banner__update-btn').click(); | ||
expect(document.querySelector('.cookie-banner__update-btn')).not.toBeNull(); | ||
document.querySelector('.preferences-banner__update-btn').click(); | ||
expect(document.querySelector('.preferences-banner')).not.toBeNull(); | ||
}); | ||
it('Updates a cookie based on consent form', async () => { | ||
for (const field of document.querySelectorAll('.cookie-banner__field')){ | ||
for (const field of document.querySelectorAll('.preferences-banner__field')){ | ||
field.checked = (field.value !== 'test'); | ||
} | ||
document.querySelector('.cookie-banner__btn').click(); | ||
document.querySelector('.preferences-banner__btn').click(); | ||
expect(document.cookie).toEqual(`CookiePreferences={"necessary":true,"preference":true,"test":false}`); | ||
expect(document.cookie).toEqual(`CookiePreferences={"necessary":true,"test":false,"performance":true}`); | ||
}); | ||
it('Hides the cookie banner', async () => { | ||
expect(document.querySelector('.cookie-banner')).toBeNull(); | ||
expect(document.querySelector('.preferences-banner')).toBeNull(); | ||
}); | ||
}); |
/** | ||
* @name storm-cookie-banner: | ||
* @version 0.1.0: Mon, 06 Aug 2018 09:52:15 GMT | ||
* @version 0.2.1: Thu, 11 Oct 2018 08:01:48 GMT | ||
* @author stormid | ||
@@ -5,0 +5,0 @@ * @license MIT |
@@ -1,5 +0,12 @@ | ||
export const apply = state => { | ||
Object.keys(state.consent).forEach(key => { | ||
state.consent[key] && state.settings.types[key].fns.forEach(fn => fn(state)); | ||
export const apply = (perf = 'add') => state => { | ||
//;_; needs proper enum | ||
const appliedState = perf === 'add' | ||
? Object.assign({}, state, { consent: Object.assign({}, state.consent, { performance: true }) }) | ||
: perf === 'remove' | ||
? Object.assign({}, state, { consent: Object.assign({}, state.consent, { performance: false })}) | ||
: state; | ||
Object.keys(appliedState.consent).forEach(key => { | ||
(appliedState.consent[key] && appliedState.settings.types[key]) && appliedState.settings.types[key].fns.forEach(fn => fn(appliedState)); | ||
}); | ||
}; |
@@ -6,5 +6,5 @@ export const TRIGGER_EVENTS = window.PointerEvent ? ['pointerup', 'keydown'] : ['ontouchstart' in window ? 'touchstart' : 'click', 'keydown' ]; | ||
export const CLASSNAME = { | ||
BANNER: 'cookie-banner', | ||
FIELD: 'cookie-banner__field', | ||
BTN: 'cookie-banner__btn' | ||
BANNER: 'preferences-banner', | ||
FIELD: 'preferences-banner__field', | ||
BTN: 'preferences-banner__btn' | ||
}; | ||
@@ -11,0 +11,0 @@ |
@@ -7,3 +7,3 @@ import { writeCookie } from './utils'; | ||
domain: '', | ||
secure: '', | ||
secure: true, | ||
expiry: 365, | ||
@@ -15,16 +15,11 @@ types: { | ||
fns: [] | ||
}, | ||
'preference': { | ||
checked: true, | ||
fns: [ | ||
model => { document.cookie = writeCookie(model); } | ||
] | ||
} | ||
}, | ||
policyURL: '/cookie-policy', | ||
classNames: { | ||
banner: 'cookie-banner', | ||
btn: 'cookie-banner__btn', | ||
field: 'cookie-banner__field', | ||
updateBtnContainer: 'cookie-banner__update', | ||
updateBtn: 'cookie-banner__update-btn' | ||
banner: 'preferences-banner', | ||
btn: 'preferences-banner__btn', | ||
field: 'preferences-banner__field', | ||
updateBtnContainer: 'preferences-banner__update', | ||
updateBtn: 'preferences-banner__update-btn' | ||
}, | ||
@@ -35,21 +30,27 @@ updateBtnTemplate(model){ | ||
bannerTemplate(model){ | ||
return `<section role="dialog" aria-live="polite" aria-label="Cookie consent" aria-describedby="cookie-banner__desc" class="${model.classNames.banner}"> | ||
<!--googleoff: all--> | ||
<div class="small-12" id="cookie-banner__desc"> | ||
<h1 class="cookie-banner__heading">This website uses cookies.</h1> | ||
<p class="cookie-banner__text gamma">We use cookies to analyse our traffic and to provide social media features. You can choose which categories | ||
of cookies you consent to, or accept our recommended settings. | ||
<a class="cookie-banner__link" rel="noopener noreferrer nofollow" href="/cookies/">Find out more</a> about the cookies we use before you consent.</p> | ||
<ul class="cookie-banner__list lister push--bottom large-10"> | ||
${Object.keys(model.types).map(type => `<li class="cookie-banner__list-item"> | ||
<input id="cookie-banner__${type.split(' ')[0].replace(' ', '-')}" class="${model.classNames.field}" value="${type}" type="checkbox"${model.types[type].checked ? ` checked` : ''}${model.types[type].disabled ? ` disabled` : ''}> | ||
<label class="cookie-banner__label gamma" for="cookie-banner__${type.split(' ')[0].replace(' ', '-')}">${type.substr(0, 1).toUpperCase()}${type.substr(1)} cookies</label> | ||
</li>`).join('')} | ||
</ul> | ||
return `<section role="dialog" aria-live="polite" aria-label="Cookie consent" aria-describedby="preferences-banner__desc" class="${model.classNames.banner}"> | ||
<div class="preferences-content"> | ||
<div class="wrap"> | ||
<div class="row"> | ||
<!--googleoff: all--> | ||
<div id="preferences-banner__desc"> | ||
<div class="preferences-banner__heading">This website uses cookies.</div> | ||
<p class="preferences-banner__text">We use cookies to analyse our traffic and to provide social media features. You can choose which categories of cookies you consent to, or accept our recommended settings. | ||
<a class="preferences-banner__link" rel="noopener noreferrer nofollow" href="${model.policyURL}"> Find out more about the cookies we use.</a></p> | ||
<ul class="preferences-banner__list"> | ||
${Object.keys(model.types).map(type => `<li class="preferences-banner__list-item"> | ||
<input id="preferences-banner__${type.split(' ')[0].replace(' ', '-')}" class="${model.classNames.field}" value="${type}" type="checkbox"${model.types[type].checked ? ` checked` : ''}${model.types[type].disabled ? ` disabled` : ''}> | ||
<label class="preferences-banner__label" for="preferences-banner__${type.split(' ')[0].replace(' ', '-')}"> | ||
${type.substr(0, 1).toUpperCase()}${type.substr(1)} cookies | ||
</label> | ||
</li>`).join('')} | ||
</ul> | ||
</div> | ||
<button class="${model.classNames.btn}">OK</button> | ||
<!--googleon: all--> | ||
</div> | ||
</div> | ||
</div> | ||
<button class="${model.classNames.btn}">Continue</button> | ||
<!--googleon: all--> | ||
</section>`; | ||
}, | ||
consent: {} | ||
} | ||
}; |
@@ -9,6 +9,13 @@ import { cookiesEnabled, readCookie } from './utils'; | ||
if(!cookiesEnabled()) return; | ||
const Store = CreateStore(); | ||
const cookies = readCookie(settings); | ||
Store.update(initialState, { settings, consent: cookies ? JSON.parse(cookies.value) : {} }, !cookies ? [initBanner(Store)] : [ apply, initUpdateBtn(Store)]); | ||
Store.update( | ||
initialState, | ||
{ | ||
settings, | ||
consent: cookies ? JSON.parse(cookies.value) : {} | ||
}, | ||
[apply(!cookies ? 'add' : 'remain'), cookies ? initUpdateBtn(Store) : initBanner(Store)] | ||
); | ||
}; |
@@ -1,2 +0,2 @@ | ||
import { composeUpdateUIModel, shouldExecute } from './utils'; | ||
import { composeUpdateUIModel, shouldExecute, writeCookie } from './utils'; | ||
import { TRIGGER_EVENTS } from './constants'; | ||
@@ -15,3 +15,23 @@ import { apply } from './consent'; | ||
if(!shouldExecute(e)) return; | ||
Store.update(setConsent, { consent: fields.reduce((acc, field) => { return acc[field.value] = field.checked, acc }, {}) }, [apply, initUpdateBtn(Store), () => { banner.parentNode.removeChild(banner); }]); | ||
const consent = fields.reduce((acc, field) => { return acc[field.value] = field.checked, acc }, {}); | ||
Store.update( | ||
setConsent, | ||
{ consent }, | ||
!consent.performance | ||
? [ | ||
writeCookie, | ||
() => { | ||
window.setTimeout(() => location.reload(), 60); | ||
} | ||
] | ||
: [ | ||
writeCookie, | ||
apply(state.consent.performance ? 'remain' : 'remove'), | ||
() => { | ||
banner.parentNode.removeChild(banner); | ||
initUpdateBtn(Store)(state) | ||
} | ||
] | ||
); | ||
}); | ||
@@ -22,14 +42,22 @@ }); | ||
export const initUpdateBtn = Store => state => { | ||
console.log('init btn'); | ||
const updateBtnContainer = document.querySelector(`.${state.settings.classNames.updateBtnContainer}`); | ||
console.log('Attemping to render...'); | ||
if(!updateBtnContainer) return; | ||
const updateBtn = document.querySelector(`.${state.settings.classNames.updateBtn}`); | ||
if(updateBtn) return updateBtn.removeAttribute('disabled'); | ||
updateBtnContainer.innerHTML = state.settings.updateBtnTemplate(state.settings); | ||
if(updateBtn) updateBtn.removeAttribute('disabled'); | ||
else updateBtnContainer.innerHTML = state.settings.updateBtnTemplate(state.settings); | ||
const handler = e => { | ||
if(!shouldExecute(e)) return; | ||
Store.update(updateConsent, {}, [ initBanner(Store), () => { | ||
e.target.setAttribute('disabled', 'disabled'); | ||
TRIGGER_EVENTS.forEach(ev => { | ||
e.target.removeEventListener(ev, handler); | ||
}); | ||
}]); | ||
}; | ||
TRIGGER_EVENTS.forEach(ev => { | ||
document.querySelector(`.${state.settings.classNames.updateBtn}`).addEventListener(ev, e => { | ||
if(!shouldExecute(e)) return; | ||
Store.update(updateConsent, {}, [ initBanner(Store), () => { e.target.setAttribute('disabled', 'disabled'); }]); | ||
}); | ||
document.querySelector(`.${state.settings.classNames.updateBtn}`).addEventListener(ev, handler); | ||
}); | ||
}; |
@@ -16,8 +16,8 @@ import { TRIGGER_KEYCODES } from './constants'; | ||
export const writeCookie = state => [ | ||
`${state.settings.name}=${JSON.stringify(state.consent)};`, | ||
export const writeCookie = state => document.cookie = [ | ||
`${state.settings.name}=${JSON.stringify(Object.assign({}, state.consent, { intent: state.intent }))};`, | ||
`expires=${(new Date(new Date().getTime() + (state.settings.expiry*24*60*60*1000))).toGMTString()};`, | ||
`path=${state.settings.path};`, | ||
state.settings.domain ? `domain=${state.settings.domain}` : '', | ||
state.settings.secure ? `secure=${state.settings.secure}` : '' | ||
state.settings.secure ? `secure` : '' | ||
].join(''); | ||
@@ -30,10 +30,2 @@ | ||
export const GTMLoad = code => { | ||
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | ||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | ||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | ||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | ||
})(window,document,'script','dataLayer', code); | ||
} | ||
export const composeUpdateUIModel = state => { | ||
@@ -40,0 +32,0 @@ return Object.assign({}, state.settings, { |
/** | ||
* @name storm-cookie-banner: | ||
* @version 0.1.0: Mon, 06 Aug 2018 09:52:15 GMT | ||
* @version 0.2.1: Thu, 11 Oct 2018 08:01:49 GMT | ||
* @author stormid | ||
@@ -43,3 +43,3 @@ * @license MIT | ||
var writeCookie = function writeCookie(state) { | ||
return [state.settings.name + '=' + JSON.stringify(state.consent) + ';', 'expires=' + new Date(new Date().getTime() + state.settings.expiry * 24 * 60 * 60 * 1000).toGMTString() + ';', 'path=' + state.settings.path + ';', state.settings.domain ? 'domain=' + state.settings.domain : '', state.settings.secure ? 'secure=' + state.settings.secure : ''].join(''); | ||
return document.cookie = [state.settings.name + '=' + JSON.stringify(Object.assign({}, state.consent, { intent: state.intent })) + ';', 'expires=' + new Date(new Date().getTime() + state.settings.expiry * 24 * 60 * 60 * 1000).toGMTString() + ';', 'path=' + state.settings.path + ';', state.settings.domain ? 'domain=' + state.settings.domain : '', state.settings.secure ? 'secure' : ''].join(''); | ||
}; | ||
@@ -77,3 +77,3 @@ | ||
domain: '', | ||
secure: '', | ||
secure: true, | ||
expiry: 365, | ||
@@ -85,16 +85,11 @@ types: { | ||
fns: [] | ||
}, | ||
'preference': { | ||
checked: true, | ||
fns: [function (model) { | ||
document.cookie = writeCookie(model); | ||
}] | ||
} | ||
}, | ||
policyURL: '/cookie-policy', | ||
classNames: { | ||
banner: 'cookie-banner', | ||
btn: 'cookie-banner__btn', | ||
field: 'cookie-banner__field', | ||
updateBtnContainer: 'cookie-banner__update', | ||
updateBtn: 'cookie-banner__update-btn' | ||
banner: 'preferences-banner', | ||
btn: 'preferences-banner__btn', | ||
field: 'preferences-banner__field', | ||
updateBtnContainer: 'preferences-banner__update', | ||
updateBtn: 'preferences-banner__update-btn' | ||
}, | ||
@@ -105,16 +100,20 @@ updateBtnTemplate: function updateBtnTemplate(model) { | ||
bannerTemplate: function bannerTemplate(model) { | ||
return '<section role="dialog" aria-live="polite" aria-label="Cookie consent" aria-describedby="cookie-banner__desc" class="' + model.classNames.banner + '">\n\t\t\t<!--googleoff: all-->\n\t\t\t<div class="small-12" id="cookie-banner__desc">\n\t\t\t\t<h1 class="cookie-banner__heading">This website uses cookies.</h1>\n\t\t\t\t<p class="cookie-banner__text gamma">We use cookies to analyse our traffic and to provide social media features. You can choose which categories\n\t\t\t\tof cookies you consent to, or accept our recommended settings.\n\t\t\t\t<a class="cookie-banner__link" rel="noopener noreferrer nofollow" href="/cookies/">Find out more</a> about the cookies we use before you consent.</p>\n\t\t\t\t<ul class="cookie-banner__list lister push--bottom large-10">\n\t\t\t\t\t' + Object.keys(model.types).map(function (type) { | ||
return '<li class="cookie-banner__list-item">\n\t\t\t\t\t\t<input id="cookie-banner__' + type.split(' ')[0].replace(' ', '-') + '" class="' + model.classNames.field + '" value="' + type + '" type="checkbox"' + (model.types[type].checked ? ' checked' : '') + (model.types[type].disabled ? ' disabled' : '') + '> \n\t\t\t\t\t\t<label class="cookie-banner__label gamma" for="cookie-banner__' + type.split(' ')[0].replace(' ', '-') + '">' + type.substr(0, 1).toUpperCase() + type.substr(1) + ' cookies</label>\n\t\t\t\t\t</li>'; | ||
}).join('') + '\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t\t<button class="' + model.classNames.btn + '">Continue</button>\n\t\t\t<!--googleon: all-->\n\t\t</section>'; | ||
}, | ||
consent: {} | ||
return '<section role="dialog" aria-live="polite" aria-label="Cookie consent" aria-describedby="preferences-banner__desc" class="' + model.classNames.banner + '">\n\t\t\t<div class="preferences-content">\n\t\t\t\t<div class="wrap">\n\t\t\t\t\t<div class="row">\n\t\t\t\t\t\t<!--googleoff: all-->\n\t\t\t\t\t\t<div id="preferences-banner__desc">\n\t\t\t\t\t\t\t<div class="preferences-banner__heading">This website uses cookies.</div>\n\t\t\t\t\t\t\t<p class="preferences-banner__text">We use cookies to analyse our traffic and to provide social media features. You can choose which categories of cookies you consent to, or accept our recommended settings.\n\t\t\t\t\t\t\t<a class="preferences-banner__link" rel="noopener noreferrer nofollow" href="' + model.policyURL + '"> Find out more about the cookies we use.</a></p>\n\t\t\t\t\t\t\t<ul class="preferences-banner__list">\n\t\t\t\t\t\t\t\t' + Object.keys(model.types).map(function (type) { | ||
return '<li class="preferences-banner__list-item">\n\t\t\t\t\t\t\t\t\t<input id="preferences-banner__' + type.split(' ')[0].replace(' ', '-') + '" class="' + model.classNames.field + '" value="' + type + '" type="checkbox"' + (model.types[type].checked ? ' checked' : '') + (model.types[type].disabled ? ' disabled' : '') + '>\n\t\t\t\t\t\t\t\t\t<label class="preferences-banner__label" for="preferences-banner__' + type.split(' ')[0].replace(' ', '-') + '">\n\t\t\t\t\t\t\t\t\t\t' + type.substr(0, 1).toUpperCase() + type.substr(1) + ' cookies\n\t\t\t\t\t\t\t\t\t</label> \n\t\t\t\t\t\t\t\t</li>'; | ||
}).join('') + '\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<button class="' + model.classNames.btn + '">OK</button>\n\t\t\t\t\t\t<!--googleon: all-->\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</section>'; | ||
} | ||
}; | ||
var apply = function apply(state) { | ||
Object.keys(state.consent).forEach(function (key) { | ||
state.consent[key] && state.settings.types[key].fns.forEach(function (fn) { | ||
return fn(state); | ||
var apply = function apply() { | ||
var perf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'add'; | ||
return function (state) { | ||
//;_; needs proper enum | ||
var appliedState = perf === 'add' ? Object.assign({}, state, { consent: Object.assign({}, state.consent, { performance: true }) }) : perf === 'remove' ? Object.assign({}, state, { consent: Object.assign({}, state.consent, { performance: false }) }) : state; | ||
Object.keys(appliedState.consent).forEach(function (key) { | ||
appliedState.consent[key] && appliedState.settings.types[key] && appliedState.settings.types[key].fns.forEach(function (fn) { | ||
return fn(appliedState); | ||
}); | ||
}); | ||
}); | ||
}; | ||
}; | ||
@@ -142,6 +141,13 @@ | ||
if (!shouldExecute(e)) return; | ||
Store.update(setConsent, { consent: fields.reduce(function (acc, field) { | ||
return acc[field.value] = field.checked, acc; | ||
}, {}) }, [apply, initUpdateBtn(Store), function () { | ||
var consent = fields.reduce(function (acc, field) { | ||
return acc[field.value] = field.checked, acc; | ||
}, {}); | ||
Store.update(setConsent, { consent: consent }, !consent.performance ? [writeCookie, function () { | ||
window.setTimeout(function () { | ||
return location.reload(); | ||
}, 60); | ||
}] : [writeCookie, apply(state.consent.performance ? 'remain' : 'remove'), function () { | ||
banner.parentNode.removeChild(banner); | ||
initUpdateBtn(Store)(state); | ||
}]); | ||
@@ -155,15 +161,20 @@ }); | ||
return function (state) { | ||
console.log('init btn'); | ||
var updateBtnContainer = document.querySelector('.' + state.settings.classNames.updateBtnContainer); | ||
console.log('Attemping to render...'); | ||
if (!updateBtnContainer) return; | ||
var updateBtn = document.querySelector('.' + state.settings.classNames.updateBtn); | ||
if (updateBtn) return updateBtn.removeAttribute('disabled'); | ||
updateBtnContainer.innerHTML = state.settings.updateBtnTemplate(state.settings); | ||
if (updateBtn) updateBtn.removeAttribute('disabled');else updateBtnContainer.innerHTML = state.settings.updateBtnTemplate(state.settings); | ||
var handler = function handler(e) { | ||
if (!shouldExecute(e)) return; | ||
Store.update(updateConsent, {}, [initBanner(Store), function () { | ||
e.target.setAttribute('disabled', 'disabled'); | ||
TRIGGER_EVENTS.forEach(function (ev) { | ||
e.target.removeEventListener(ev, handler); | ||
}); | ||
}]); | ||
}; | ||
TRIGGER_EVENTS.forEach(function (ev) { | ||
document.querySelector('.' + state.settings.classNames.updateBtn).addEventListener(ev, function (e) { | ||
if (!shouldExecute(e)) return; | ||
Store.update(updateConsent, {}, [initBanner(Store), function () { | ||
e.target.setAttribute('disabled', 'disabled'); | ||
}]); | ||
}); | ||
document.querySelector('.' + state.settings.classNames.updateBtn).addEventListener(ev, handler); | ||
}); | ||
@@ -197,3 +208,6 @@ }; | ||
var cookies = readCookie(settings); | ||
Store.update(initialState, { settings: settings, consent: cookies ? JSON.parse(cookies.value) : {} }, !cookies ? [initBanner(Store)] : [apply, initUpdateBtn(Store)]); | ||
Store.update(initialState, { | ||
settings: settings, | ||
consent: cookies ? JSON.parse(cookies.value) : {} | ||
}, [apply(!cookies ? 'add' : 'remain'), cookies ? initUpdateBtn(Store) : initBanner(Store)]); | ||
}; | ||
@@ -200,0 +214,0 @@ |
@@ -20,8 +20,2 @@ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
}, | ||
'preference': { | ||
checked: true, | ||
fns: [function () { | ||
console.log('Preference fn'); | ||
}] | ||
}, | ||
'performance': { | ||
@@ -79,3 +73,3 @@ checked: true, | ||
},{"./lib":6,"./lib/defaults":5}],3:[function(require,module,exports){ | ||
"use strict"; | ||
'use strict'; | ||
@@ -85,8 +79,14 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
var apply = exports.apply = function apply(state) { | ||
Object.keys(state.consent).forEach(function (key) { | ||
state.consent[key] && state.settings.types[key].fns.forEach(function (fn) { | ||
return fn(state); | ||
var apply = exports.apply = function apply() { | ||
var perf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'add'; | ||
return function (state) { | ||
//;_; needs proper enum | ||
var appliedState = perf === 'add' ? Object.assign({}, state, { consent: Object.assign({}, state.consent, { performance: true }) }) : perf === 'remove' ? Object.assign({}, state, { consent: Object.assign({}, state.consent, { performance: false }) }) : state; | ||
Object.keys(appliedState.consent).forEach(function (key) { | ||
appliedState.consent[key] && appliedState.settings.types[key] && appliedState.settings.types[key].fns.forEach(function (fn) { | ||
return fn(appliedState); | ||
}); | ||
}); | ||
}); | ||
}; | ||
}; | ||
@@ -105,5 +105,5 @@ | ||
var CLASSNAME = exports.CLASSNAME = { | ||
BANNER: 'cookie-banner', | ||
FIELD: 'cookie-banner__field', | ||
BTN: 'cookie-banner__btn' | ||
BANNER: 'preferences-banner', | ||
FIELD: 'preferences-banner__field', | ||
BTN: 'preferences-banner__btn' | ||
}; | ||
@@ -129,3 +129,3 @@ | ||
domain: '', | ||
secure: '', | ||
secure: true, | ||
expiry: 365, | ||
@@ -137,16 +137,11 @@ types: { | ||
fns: [] | ||
}, | ||
'preference': { | ||
checked: true, | ||
fns: [function (model) { | ||
document.cookie = (0, _utils.writeCookie)(model); | ||
}] | ||
} | ||
}, | ||
policyURL: '/cookie-policy', | ||
classNames: { | ||
banner: 'cookie-banner', | ||
btn: 'cookie-banner__btn', | ||
field: 'cookie-banner__field', | ||
updateBtnContainer: 'cookie-banner__update', | ||
updateBtn: 'cookie-banner__update-btn' | ||
banner: 'preferences-banner', | ||
btn: 'preferences-banner__btn', | ||
field: 'preferences-banner__field', | ||
updateBtnContainer: 'preferences-banner__update', | ||
updateBtn: 'preferences-banner__update-btn' | ||
}, | ||
@@ -157,8 +152,6 @@ updateBtnTemplate: function updateBtnTemplate(model) { | ||
bannerTemplate: function bannerTemplate(model) { | ||
return '<section role="dialog" aria-live="polite" aria-label="Cookie consent" aria-describedby="cookie-banner__desc" class="' + model.classNames.banner + '">\n\t\t\t<!--googleoff: all-->\n\t\t\t<div class="small-12" id="cookie-banner__desc">\n\t\t\t\t<h1 class="cookie-banner__heading">This website uses cookies.</h1>\n\t\t\t\t<p class="cookie-banner__text gamma">We use cookies to analyse our traffic and to provide social media features. You can choose which categories\n\t\t\t\tof cookies you consent to, or accept our recommended settings.\n\t\t\t\t<a class="cookie-banner__link" rel="noopener noreferrer nofollow" href="/cookies/">Find out more</a> about the cookies we use before you consent.</p>\n\t\t\t\t<ul class="cookie-banner__list lister push--bottom large-10">\n\t\t\t\t\t' + Object.keys(model.types).map(function (type) { | ||
return '<li class="cookie-banner__list-item">\n\t\t\t\t\t\t<input id="cookie-banner__' + type.split(' ')[0].replace(' ', '-') + '" class="' + model.classNames.field + '" value="' + type + '" type="checkbox"' + (model.types[type].checked ? ' checked' : '') + (model.types[type].disabled ? ' disabled' : '') + '> \n\t\t\t\t\t\t<label class="cookie-banner__label gamma" for="cookie-banner__' + type.split(' ')[0].replace(' ', '-') + '">' + type.substr(0, 1).toUpperCase() + type.substr(1) + ' cookies</label>\n\t\t\t\t\t</li>'; | ||
}).join('') + '\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t\t<button class="' + model.classNames.btn + '">Continue</button>\n\t\t\t<!--googleon: all-->\n\t\t</section>'; | ||
}, | ||
consent: {} | ||
return '<section role="dialog" aria-live="polite" aria-label="Cookie consent" aria-describedby="preferences-banner__desc" class="' + model.classNames.banner + '">\n\t\t\t<div class="preferences-content">\n\t\t\t\t<div class="wrap">\n\t\t\t\t\t<div class="row">\n\t\t\t\t\t\t<!--googleoff: all-->\n\t\t\t\t\t\t<div id="preferences-banner__desc">\n\t\t\t\t\t\t\t<div class="preferences-banner__heading">This website uses cookies.</div>\n\t\t\t\t\t\t\t<p class="preferences-banner__text">We use cookies to analyse our traffic and to provide social media features. You can choose which categories of cookies you consent to, or accept our recommended settings.\n\t\t\t\t\t\t\t<a class="preferences-banner__link" rel="noopener noreferrer nofollow" href="' + model.policyURL + '"> Find out more about the cookies we use.</a></p>\n\t\t\t\t\t\t\t<ul class="preferences-banner__list">\n\t\t\t\t\t\t\t\t' + Object.keys(model.types).map(function (type) { | ||
return '<li class="preferences-banner__list-item">\n\t\t\t\t\t\t\t\t\t<input id="preferences-banner__' + type.split(' ')[0].replace(' ', '-') + '" class="' + model.classNames.field + '" value="' + type + '" type="checkbox"' + (model.types[type].checked ? ' checked' : '') + (model.types[type].disabled ? ' disabled' : '') + '>\n\t\t\t\t\t\t\t\t\t<label class="preferences-banner__label" for="preferences-banner__' + type.split(' ')[0].replace(' ', '-') + '">\n\t\t\t\t\t\t\t\t\t\t' + type.substr(0, 1).toUpperCase() + type.substr(1) + ' cookies\n\t\t\t\t\t\t\t\t\t</label> \n\t\t\t\t\t\t\t\t</li>'; | ||
}).join('') + '\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<button class="' + model.classNames.btn + '">OK</button>\n\t\t\t\t\t\t<!--googleon: all-->\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</section>'; | ||
} | ||
}; | ||
@@ -194,3 +187,6 @@ | ||
var cookies = (0, _utils.readCookie)(settings); | ||
Store.update(_reducers.initialState, { settings: settings, consent: cookies ? JSON.parse(cookies.value) : {} }, !cookies ? [(0, _ui.initBanner)(Store)] : [_consent.apply, (0, _ui.initUpdateBtn)(Store)]); | ||
Store.update(_reducers.initialState, { | ||
settings: settings, | ||
consent: cookies ? JSON.parse(cookies.value) : {} | ||
}, [(0, _consent.apply)(!cookies ? 'add' : 'remain'), cookies ? (0, _ui.initUpdateBtn)(Store) : (0, _ui.initBanner)(Store)]); | ||
}; | ||
@@ -266,6 +262,13 @@ | ||
if (!(0, _utils.shouldExecute)(e)) return; | ||
Store.update(_reducers.setConsent, { consent: fields.reduce(function (acc, field) { | ||
return acc[field.value] = field.checked, acc; | ||
}, {}) }, [_consent.apply, initUpdateBtn(Store), function () { | ||
var consent = fields.reduce(function (acc, field) { | ||
return acc[field.value] = field.checked, acc; | ||
}, {}); | ||
Store.update(_reducers.setConsent, { consent: consent }, !consent.performance ? [_utils.writeCookie, function () { | ||
window.setTimeout(function () { | ||
return location.reload(); | ||
}, 60); | ||
}] : [_utils.writeCookie, (0, _consent.apply)(state.consent.performance ? 'remain' : 'remove'), function () { | ||
banner.parentNode.removeChild(banner); | ||
initUpdateBtn(Store)(state); | ||
}]); | ||
@@ -279,15 +282,20 @@ }); | ||
return function (state) { | ||
console.log('init btn'); | ||
var updateBtnContainer = document.querySelector('.' + state.settings.classNames.updateBtnContainer); | ||
console.log('Attemping to render...'); | ||
if (!updateBtnContainer) return; | ||
var updateBtn = document.querySelector('.' + state.settings.classNames.updateBtn); | ||
if (updateBtn) return updateBtn.removeAttribute('disabled'); | ||
updateBtnContainer.innerHTML = state.settings.updateBtnTemplate(state.settings); | ||
if (updateBtn) updateBtn.removeAttribute('disabled');else updateBtnContainer.innerHTML = state.settings.updateBtnTemplate(state.settings); | ||
var handler = function handler(e) { | ||
if (!(0, _utils.shouldExecute)(e)) return; | ||
Store.update(_reducers.updateConsent, {}, [initBanner(Store), function () { | ||
e.target.setAttribute('disabled', 'disabled'); | ||
_constants.TRIGGER_EVENTS.forEach(function (ev) { | ||
e.target.removeEventListener(ev, handler); | ||
}); | ||
}]); | ||
}; | ||
_constants.TRIGGER_EVENTS.forEach(function (ev) { | ||
document.querySelector('.' + state.settings.classNames.updateBtn).addEventListener(ev, function (e) { | ||
if (!(0, _utils.shouldExecute)(e)) return; | ||
Store.update(_reducers.updateConsent, {}, [initBanner(Store), function () { | ||
e.target.setAttribute('disabled', 'disabled'); | ||
}]); | ||
}); | ||
document.querySelector('.' + state.settings.classNames.updateBtn).addEventListener(ev, handler); | ||
}); | ||
@@ -303,3 +311,3 @@ }; | ||
}); | ||
exports.shouldExecute = exports.composeUpdateUIModel = exports.GTMLoad = exports.readCookie = exports.writeCookie = exports.cookiesEnabled = undefined; | ||
exports.shouldExecute = exports.composeUpdateUIModel = exports.readCookie = exports.writeCookie = exports.cookiesEnabled = undefined; | ||
@@ -321,3 +329,3 @@ var _constants = require('./constants'); | ||
var writeCookie = exports.writeCookie = function writeCookie(state) { | ||
return [state.settings.name + '=' + JSON.stringify(state.consent) + ';', 'expires=' + new Date(new Date().getTime() + state.settings.expiry * 24 * 60 * 60 * 1000).toGMTString() + ';', 'path=' + state.settings.path + ';', state.settings.domain ? 'domain=' + state.settings.domain : '', state.settings.secure ? 'secure=' + state.settings.secure : ''].join(''); | ||
return document.cookie = [state.settings.name + '=' + JSON.stringify(Object.assign({}, state.consent, { intent: state.intent })) + ';', 'expires=' + new Date(new Date().getTime() + state.settings.expiry * 24 * 60 * 60 * 1000).toGMTString() + ';', 'path=' + state.settings.path + ';', state.settings.domain ? 'domain=' + state.settings.domain : '', state.settings.secure ? 'secure' : ''].join(''); | ||
}; | ||
@@ -334,10 +342,2 @@ | ||
var GTMLoad = exports.GTMLoad = function GTMLoad(code) { | ||
(function (w, d, s, l, i) { | ||
w[l] = w[l] || [];w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });var f = d.getElementsByTagName(s)[0], | ||
j = d.createElement(s), | ||
dl = l != 'dataLayer' ? '&l=' + l : '';j.async = true;j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;f.parentNode.insertBefore(j, f); | ||
})(window, document, 'script', 'dataLayer', code); | ||
}; | ||
var composeUpdateUIModel = exports.composeUpdateUIModel = function composeUpdateUIModel(state) { | ||
@@ -361,2 +361,2 @@ return Object.assign({}, state.settings, { | ||
},{"./constants":4}]},{},[1]) | ||
//# sourceMapping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OiBbXG4gICAgICAgICAgICAgICAgICAgICgpID0+IHsgY29uc29sZS5sb2coJ05lY2Vzc2FyeSBmbicpOyB9LFxuICAgICAgICAgICAgICAgIF1cbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAncHJlZmVyZW5jZSc6IHtcbiAgICAgICAgICAgICAgICBjaGVja2VkOiB0cnVlLFxuICAgICAgICAgICAgICAgIGZuczogW1xuICAgICAgICAgICAgICAgICAgICAoKSA9PiB7IGNvbnNvbGUubG9nKCdQcmVmZXJlbmNlIGZuJyk7IH0sXG4gICAgICAgICAgICAgICAgXVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICdwZXJmb3JtYW5jZSc6IHtcbiAgICAgICAgICAgICAgICBjaGVja2VkOiB0cnVlLFxuICAgICAgICAgICAgICAgIGZuczogW1xuICAgICAgICAgICAgICAgICAgICAoKSA9PiB7IGNvbnNvbGUubG9nKCdQZXJmb3JtYW5jZSBmbicpOyB9XG4gICAgICAgICAgICAgICAgXVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICdhZHZlcnRpc2luZyBhbmQgbWFya2V0aW5nJzoge1xuICAgICAgICAgICAgICAgIGNoZWNrZWQ6IGZhbHNlLFxuICAgICAgICAgICAgICAgIGZuczogW1xuICAgICAgICAgICAgICAgICAgICAoKSA9PiB7IGNvbnNvbGUubG9nKCdBZHZlcnRpc2luZyBhbmQgbWFya2V0aW5nIGZuJyk7IH1cbiAgICAgICAgICAgICAgICBdXG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9KTtcbn0pOyIsImltcG9ydCBkZWZhdWx0cyBmcm9tICcuL2xpYi9kZWZhdWx0cyc7XG5pbXBvcnQgZmFjdG9yeSBmcm9tICcuL2xpYic7XG5cbmV4cG9ydCBkZWZhdWx0IHtcbiAgICBpbml0OiBvcHRzID0+IGZhY3RvcnkoT2JqZWN0LmFzc2lnbih7fSwgZGVmYXVsdHMsIG9wdHMsIHtcbiAgICAgICAgdHlwZXM6IE9i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Tt2YXIgYT1uZXcgRXJyb3IoXCJDYW5ub3QgZmluZCBtb2R1bGUgJ1wiK2krXCInXCIpO3Rocm93IGEuY29kZT1cIk1PRFVMRV9OT1RfRk9VTkRcIixhfXZhciBwPW5baV09e2V4cG9ydHM6e319O2VbaV1bMF0uY2FsbChwLmV4cG9ydHMsZnVuY3Rpb24ocil7dmFyIG49ZVtpXVsxXVtyXTtyZXR1cm4gbyhufHxyKX0scCxwLmV4cG9ydHMscixlLG4sdCl9cmV0dXJuIG5baV0uZXhwb3J0c31mb3IodmFyIHU9XCJmdW5jdGlvblwiPT10eXBlb2YgcmVxdWlyZSYmcmVxdWlyZSxpPTA7aTx0Lmxlbmd0aDtpKyspbyh0W2ldKTtyZXR1cm4gb31yZXR1cm4gcn0pKCkiLCJpbXBvcnQgQ29va2llQmFubmVyIGZyb20gJy4uLy4uL3NyYyc7XG4gICAgXG53aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcignRE9NQ29udGVudExvYWRlZCcsICgpID0+IHtcbiAgICBDb29raWVCYW5uZXIuaW5pdCh7XG4gICAgICAgIHR5cGVzOiB7XG4gICAgICAgICAgICAnbmVjZXNzYXJ5Jzoge1xuICAgICAgICAgICAgICAgIGZuczogW1xuICAgICAgICAgICAgICAgICAgICAoKSA9PiB7IGNvbnNvbGUubG9nKCdOZWNlc3NhcnkgZm4nKTsgfSxcbiAgICAgICAgICAgICAgICBdXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgJ3BlcmZvcm1hbmNlJzoge1xuICAgICAgICAgICAgICAgIGNoZWNrZWQ6IHRydWUsXG4gICAgICAgICAgICAgICAgZm5zOiBbXG4gICAgICAgICAgICAgICAgICAgICgpID0+IHsgY29uc29sZS5sb2coJ1BlcmZvcm1hbmNlIGZuJyk7IH1cbiAgICAgICAgICAgICAgICBdXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgJ2FkdmVydGlzaW5nIGFuZCBtYXJrZXRpbmcnOiB7XG4gICAgICAgICAgICAgICAgY2hlY2tlZDogZmFsc2UsXG4gICAgICAgICAgICAgICAgZm5zOiBbXG4gICAgICAgICAgICAgICAgICAgICgpID0+IHsgY29uc29sZS5sb2coJ0FkdmVydGlzaW5nIGFuZCBtYXJrZXRpbmcgZm4nKTsgfVxuICAgICAgICAgICAgICAgIF1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH0pO1xufSk7IiwiaW1wb3J0IGRlZmF1bHRzIGZyb20gJy4vbGliL2RlZmF1bHRzJztcbmltcG9ydCBmYWN0b3J5IGZyb20gJy4vbGliJztcblxuZXhwb3J0IGRlZmF1bHQge1xuICAgIGluaXQ6IG9wdHMgPT4gZmFjdG9yeShPYmplY3QuYXNzaWduKHt9LCBkZWZhdWx0cywgb3B0cywge1xuICAgICAgICB0eXBlczogT2JqZWN0LmtleXMob3B0cy50eXBlcykucmVkdWNlKChhY2MsIGN1cnIpID0+IHtcbiAgICAgICAgICAgIGlmKGFjY1tjdXJyXSkge1xuICAgICAgICAgICAgICAgIGFjY1tjdXJyXSA9IE9iamVjdC5hc3NpZ24oe30sIGFjY1tjdXJyXSwge1xuICAgICAgICAgICAgICAgICAgICBmbnM6IGFjY1tjdXJyXS5mbnMuY29uY2F0KG9wdHMudHlwZXNbY3Vycl0uZm5zKSxcbiAgICAgICAgICAgICAgICAgICAgY2hlY2tlZDogb3B0cy50eXBlc1tjdXJyXS5jaGVja2VkICE9PSB1bmRlZmluZWQgPyBvcHRzLnR5cGVzW2N1cnJdLmNoZWNrZWQgOiBkZWZhdWx0cy50eXBlc1tjdXJyXS5jaGVja2VkICE9PSB1bmRlZmluZWQgPyBkZWZhdWx0cy50eXBlc1tjdXJyXS5jaGVja2VkIDogZmFsc2VcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0gIGVsc2UgYWNjW2N1cnJdID0gb3B0cy50eXBlc1tjdXJyXTtcbiAgICAgICAgICAgIHJldHVybiBhY2M7XG4gICAgICAgIH0sIGRlZmF1bHRzLn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AgICAgICAgICAgIHNldENvbnNlbnQsXG4gICAgICAgICAgICAgICAgeyBjb25zZW50IH0sXG4gICAgICAgICAgICAgICAgIWNvbnNlbnQucGVyZm9ybWFuY2UgXG4gICAgICAgICAgICAgICAgPyBbIFxuICAgICAgICAgICAgICAgICAgICB3cml0ZUNvb2tpZSxcbiAgICAgICAgICAgICAgICAgICAgKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LnNldFRpbWVvdXQoKCkgPT4gbG9jYXRpb24ucmVsb2FkKCksIDYwKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIF1cbiAgICAgICAgICAgICAgICA6IFtcbiAgICAgICAgICAgICAgICAgICAgd3JpdGVDb29raWUsXG4gICAgICAgICAgICAgICAgICAgIGFwcGx5KHN0YXRlLmNvbnNlbnQucGVyZm9ybWFuY2UgPyAncmVtYWluJyA6ICdyZW1vdmUnKSxcbiAgICAgICAgICAgICAgICAgICAgKCkgPT4geyBcbiAgICAgICAgICAgICAgICAgICAgICAgIGJhbm5lci5wYXJlbnROb2RlLnJlbW92ZUNoaWxkKGJhbm5lcik7XG4gICAgICAgICAgICAgICAgICAgICAgICBpbml0VXBkYXRlQnRuKFN0b3JlKShzdGF0ZSlcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIF1cbiAgICAgICAgICAgICk7XG4gICAgICAgIH0pO1xuICAgIH0pO1xufTtcblxuZXhwb3J0IGNvbnN0IGluaXRVcGRhdGVCdG4gPSBTdG9yZSA9PiBzdGF0ZSA9PiB7XG4gICAgY29uc29sZS5sb2coJ2luaXQgYnRuJyk7XG4gICAgY29uc3QgdXBkYXRlQnRuQ29udGFpbmVyID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcihgLiR7c3RhdGUuc2V0dGluZ3MuY2xhc3NOYW1lcy51cGRhdGVCdG5Db250YWluZXJ9YCk7XG4gICAgY29uc29sZS5sb2coJ0F0dGVtcGluZyB0byByZ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kRXhlY3V0ZSA9IGUgPT4gKCEhZS5rZXlDb2RlICYmICFUUklHR0VSX0tFWUNPREVTLmluY2x1ZGVzKGUua2V5Q29kZSkpIHx8ICEoZS53aGljaCA9PT0gMyB8fCBlLmJ1dHRvbiA9PT0gMik7Il19 |
@@ -11,8 +11,2 @@ import CookieBanner from '../../src'; | ||
}, | ||
'preference': { | ||
checked: true, | ||
fns: [ | ||
() => { console.log('Preference fn'); }, | ||
] | ||
}, | ||
'performance': { | ||
@@ -19,0 +13,0 @@ checked: true, |
@@ -149,3 +149,4 @@ var gulp = require('gulp'), | ||
server: ['example'], | ||
tunnel: false | ||
tunnel: false, | ||
https: true | ||
}); | ||
@@ -152,0 +153,0 @@ |
{ | ||
"name": "storm-cookie-banner", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "", | ||
@@ -18,5 +18,4 @@ "author": "stormid", | ||
"stormid", | ||
"map", | ||
"azure", | ||
"leaflet", | ||
"cookies", | ||
"gdpr", | ||
"component" | ||
@@ -23,0 +22,0 @@ ], |
@@ -1,5 +0,12 @@ | ||
export const apply = state => { | ||
Object.keys(state.consent).forEach(key => { | ||
state.consent[key] && state.settings.types[key].fns.forEach(fn => fn(state)); | ||
export const apply = (perf = 'add') => state => { | ||
//;_; needs proper enum | ||
const appliedState = perf === 'add' | ||
? Object.assign({}, state, { consent: Object.assign({}, state.consent, { performance: true }) }) | ||
: perf === 'remove' | ||
? Object.assign({}, state, { consent: Object.assign({}, state.consent, { performance: false })}) | ||
: state; | ||
Object.keys(appliedState.consent).forEach(key => { | ||
(appliedState.consent[key] && appliedState.settings.types[key]) && appliedState.settings.types[key].fns.forEach(fn => fn(appliedState)); | ||
}); | ||
}; |
@@ -6,5 +6,5 @@ export const TRIGGER_EVENTS = window.PointerEvent ? ['pointerup', 'keydown'] : ['ontouchstart' in window ? 'touchstart' : 'click', 'keydown' ]; | ||
export const CLASSNAME = { | ||
BANNER: 'cookie-banner', | ||
FIELD: 'cookie-banner__field', | ||
BTN: 'cookie-banner__btn' | ||
BANNER: 'preferences-banner', | ||
FIELD: 'preferences-banner__field', | ||
BTN: 'preferences-banner__btn' | ||
}; | ||
@@ -11,0 +11,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { writeCookie, GTMLoad } from './utils'; | ||
import { writeCookie } from './utils'; | ||
@@ -7,3 +7,3 @@ export default { | ||
domain: '', | ||
secure: '', | ||
secure: true, | ||
expiry: 365, | ||
@@ -15,16 +15,11 @@ types: { | ||
fns: [] | ||
}, | ||
'preference': { | ||
checked: true, | ||
fns: [ | ||
model => { document.cookie = writeCookie(model); } | ||
] | ||
} | ||
}, | ||
policyURL: '/cookie-policy', | ||
classNames: { | ||
banner: 'cookie-banner', | ||
btn: 'cookie-banner__btn', | ||
field: 'cookie-banner__field', | ||
updateBtnContainer: 'cookie-banner__update', | ||
updateBtn: 'cookie-banner__update-btn' | ||
banner: 'preferences-banner', | ||
btn: 'preferences-banner__btn', | ||
field: 'preferences-banner__field', | ||
updateBtnContainer: 'preferences-banner__update', | ||
updateBtn: 'preferences-banner__update-btn' | ||
}, | ||
@@ -35,21 +30,27 @@ updateBtnTemplate(model){ | ||
bannerTemplate(model){ | ||
return `<section role="dialog" aria-live="polite" aria-label="Cookie consent" aria-describedby="cookie-banner__desc" class="${model.classNames.banner}"> | ||
<!--googleoff: all--> | ||
<div class="small-12" id="cookie-banner__desc"> | ||
<h1 class="cookie-banner__heading">This website uses cookies.</h1> | ||
<p class="cookie-banner__text gamma">We use cookies to analyse our traffic and to provide social media features. You can choose which categories | ||
of cookies you consent to, or accept our recommended settings. | ||
<a class="cookie-banner__link" rel="noopener noreferrer nofollow" href="/cookies/">Find out more</a> about the cookies we use before you consent.</p> | ||
<ul class="cookie-banner__list lister push--bottom large-10"> | ||
${Object.keys(model.types).map(type => `<li class="cookie-banner__list-item"> | ||
<input id="cookie-banner__${type.split(' ')[0].replace(' ', '-')}" class="${model.classNames.field}" value="${type}" type="checkbox"${model.types[type].checked ? ` checked` : ''}${model.types[type].disabled ? ` disabled` : ''}> | ||
<label class="cookie-banner__label gamma" for="cookie-banner__${type.split(' ')[0].replace(' ', '-')}">${type.substr(0, 1).toUpperCase()}${type.substr(1)} cookies</label> | ||
</li>`).join('')} | ||
</ul> | ||
return `<section role="dialog" aria-live="polite" aria-label="Cookie consent" aria-describedby="preferences-banner__desc" class="${model.classNames.banner}"> | ||
<div class="preferences-content"> | ||
<div class="wrap"> | ||
<div class="row"> | ||
<!--googleoff: all--> | ||
<div id="preferences-banner__desc"> | ||
<div class="preferences-banner__heading">This website uses cookies.</div> | ||
<p class="preferences-banner__text">We use cookies to analyse our traffic and to provide social media features. You can choose which categories of cookies you consent to, or accept our recommended settings. | ||
<a class="preferences-banner__link" rel="noopener noreferrer nofollow" href="${model.policyURL}"> Find out more about the cookies we use.</a></p> | ||
<ul class="preferences-banner__list"> | ||
${Object.keys(model.types).map(type => `<li class="preferences-banner__list-item"> | ||
<input id="preferences-banner__${type.split(' ')[0].replace(' ', '-')}" class="${model.classNames.field}" value="${type}" type="checkbox"${model.types[type].checked ? ` checked` : ''}${model.types[type].disabled ? ` disabled` : ''}> | ||
<label class="preferences-banner__label" for="preferences-banner__${type.split(' ')[0].replace(' ', '-')}"> | ||
${type.substr(0, 1).toUpperCase()}${type.substr(1)} cookies | ||
</label> | ||
</li>`).join('')} | ||
</ul> | ||
</div> | ||
<button class="${model.classNames.btn}">OK</button> | ||
<!--googleon: all--> | ||
</div> | ||
</div> | ||
</div> | ||
<button class="${model.classNames.btn}">Continue</button> | ||
<!--googleon: all--> | ||
</section>`; | ||
}, | ||
consent: {} | ||
} | ||
}; |
@@ -9,6 +9,13 @@ import { cookiesEnabled, readCookie } from './utils'; | ||
if(!cookiesEnabled()) return; | ||
const Store = CreateStore(); | ||
const cookies = readCookie(settings); | ||
Store.update(initialState, { settings, consent: cookies ? JSON.parse(cookies.value) : {} }, !cookies ? [initBanner(Store)] : [ apply, initUpdateBtn(Store)]); | ||
Store.update( | ||
initialState, | ||
{ | ||
settings, | ||
consent: cookies ? JSON.parse(cookies.value) : {} | ||
}, | ||
[apply(!cookies ? 'add' : 'remain'), cookies ? initUpdateBtn(Store) : initBanner(Store)] | ||
); | ||
}; |
@@ -1,2 +0,2 @@ | ||
import { composeUpdateUIModel, shouldExecute } from './utils'; | ||
import { composeUpdateUIModel, shouldExecute, writeCookie } from './utils'; | ||
import { TRIGGER_EVENTS } from './constants'; | ||
@@ -15,3 +15,23 @@ import { apply } from './consent'; | ||
if(!shouldExecute(e)) return; | ||
Store.update(setConsent, { consent: fields.reduce((acc, field) => { return acc[field.value] = field.checked, acc }, {}) }, [apply, initUpdateBtn(Store), () => { banner.parentNode.removeChild(banner); }]); | ||
const consent = fields.reduce((acc, field) => { return acc[field.value] = field.checked, acc }, {}); | ||
Store.update( | ||
setConsent, | ||
{ consent }, | ||
!consent.performance | ||
? [ | ||
writeCookie, | ||
() => { | ||
window.setTimeout(() => location.reload(), 60); | ||
} | ||
] | ||
: [ | ||
writeCookie, | ||
apply(state.consent.performance ? 'remain' : 'remove'), | ||
() => { | ||
banner.parentNode.removeChild(banner); | ||
initUpdateBtn(Store)(state) | ||
} | ||
] | ||
); | ||
}); | ||
@@ -25,11 +45,17 @@ }); | ||
const updateBtn = document.querySelector(`.${state.settings.classNames.updateBtn}`); | ||
if(updateBtn) return updateBtn.removeAttribute('disabled'); | ||
updateBtnContainer.innerHTML = state.settings.updateBtnTemplate(state.settings); | ||
if(updateBtn) updateBtn.removeAttribute('disabled'); | ||
else updateBtnContainer.innerHTML = state.settings.updateBtnTemplate(state.settings); | ||
const handler = e => { | ||
if(!shouldExecute(e)) return; | ||
Store.update(updateConsent, {}, [ initBanner(Store), () => { | ||
e.target.setAttribute('disabled', 'disabled'); | ||
TRIGGER_EVENTS.forEach(ev => { | ||
e.target.removeEventListener(ev, handler); | ||
}); | ||
}]); | ||
}; | ||
TRIGGER_EVENTS.forEach(ev => { | ||
document.querySelector(`.${state.settings.classNames.updateBtn}`).addEventListener(ev, e => { | ||
if(!shouldExecute(e)) return; | ||
Store.update(updateConsent, {}, [ initBanner(Store), () => { e.target.setAttribute('disabled', 'disabled'); }]); | ||
}); | ||
document.querySelector(`.${state.settings.classNames.updateBtn}`).addEventListener(ev, handler); | ||
}); | ||
}; |
@@ -16,8 +16,8 @@ import { TRIGGER_KEYCODES } from './constants'; | ||
export const writeCookie = state => [ | ||
`${state.settings.name}=${JSON.stringify(state.consent)};`, | ||
export const writeCookie = state => document.cookie = [ | ||
`${state.settings.name}=${JSON.stringify(Object.assign({}, state.consent, { intent: state.intent }))};`, | ||
`expires=${(new Date(new Date().getTime() + (state.settings.expiry*24*60*60*1000))).toGMTString()};`, | ||
`path=${state.settings.path};`, | ||
state.settings.domain ? `domain=${state.settings.domain}` : '', | ||
state.settings.secure ? `secure=${state.settings.secure}` : '' | ||
state.settings.secure ? `secure` : '' | ||
].join(''); | ||
@@ -30,10 +30,2 @@ | ||
// export const GTMLoad = code => () => { | ||
// (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | ||
// new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | ||
// j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | ||
// 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | ||
// })(window,document,'script','dataLayer', code); | ||
// } | ||
export const composeUpdateUIModel = state => { | ||
@@ -40,0 +32,0 @@ return Object.assign({}, state.settings, { |
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
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
97428
1311