\r\n \r\n ${text}\r\n
\r\n \r\n ${ btnPositive(btnYesText) }\r\n ${ btnNegative(btnNoText) }\r\n ${ btnGoBack(btnBackText) }\r\n ${ caliBtnNegative(btnConfirmOptOut) }\r\n
\r\n ${ btnClose(useCloseBtn) }\r\n \r\n `;\r\n};\r\n\r\nexport default bannerTemplate;\r\n","import './polyfill';\r\nimport bannerTemplate from './banner-template';\r\n\r\nconst defaultConfig = {\r\n text: 'using cookies?',\r\n btnYesText: null,\r\n btnNoText: null,\r\n btnConfirmOptOut: null,\r\n btnBackText: null,\r\n cookieKey: 'tracking_consent',\r\n cookieSettings: ';path=/;max-age=31536000',\r\n bannerContainer: document.body,\r\n onConsentGiven: null, \r\n caliConsentText: null\r\n};\r\n\r\nconst getConfig = (cfg) => cfg ? Object.assign({}, defaultConfig, cfg || {}) : null;\r\nconst getCookieYesState = cfg => `${ cfg.cookieKey }=yes${ cfg.cookieSettings }`;\r\nconst getCookieNoState = cfg => `${ cfg.cookieKey }=no${ cfg.cookieSettings }`;\r\n\r\nfunction onUserAccept(config) {\r\n document.cookie = getCookieYesState(config)\r\n hideTrackingConsentBanner();\r\n config.onConsentGiven();\r\n \r\n}\r\n\r\nfunction onUserRefuse(config) {\r\n document.cookie = getCookieNoState(config);\r\n hideTrackingConsentBanner();\r\n}\r\n\r\nfunction getTrackingCookie(config) {\r\n let cookie = document.cookie.split(';')\r\n .filter(item => item.trim().indexOf(config.cookieKey) === 0);\r\n return cookie.length ? cookie[0].trim() : null;\r\n}\r\n\r\nfunction registerConsentPanelListeners(config) {\r\n document.querySelector('.tracking-consent-banner').addEventListener('click', e => {\r\n if (e.target.classList.contains('consent-btn-positive')) {\r\n onUserAccept(config);\r\n // renderCaliConsent(config);\r\n } else if (e.target.classList.contains('consent-btn-negative')) {\r\n // onUserRefuse(config);\r\n renderCaliConsent(config);\r\n } else if (e.target.classList.contains('close-btn')) {\r\n hideTrackingConsentBanner();\r\n } else if (e.target.classList.contains('consent-btn-back')){\r\n // re-render original text\r\n goBack(config)\r\n } else if (e.target.classList.contains('consent-btn-confirm')){\r\n // set the cookie \r\n onUserRefuse(config)\r\n }\r\n\r\n });\r\n}\r\n\r\nfunction showTrackingConsentBanner(config) {\r\n const tpl = document.createElement('template');\r\n tpl.innerHTML = bannerTemplate(config);\r\n config.bannerContainer.insertBefore(tpl.content, config.bannerContainer.firstChild);\r\n registerConsentPanelListeners(config);\r\n}\r\n\r\nfunction hideTrackingConsentBanner() {\r\n const banner = document.querySelector('.tracking-consent-banner');\r\n banner.parentNode.removeChild(banner);\r\n}\r\n\r\nfunction renderCaliConsent(config){\r\n document.querySelector('#consent-message').innerHTML = config.caliConsentText;\r\n hideGdprButtons();\r\n showCaliButtons();\r\n\r\n}\r\n\r\nfunction goBack(config){\r\n document.querySelector('#consent-message').innerHTML = config.text;\r\n showGdprButtons();\r\n hideCaliButtons();\r\n \r\n}\r\n\r\n//Visibility controllers\r\nfunction hideGdprButtons(){\r\n document.querySelector('.consent-btn-positive').classList.add('hidden');\r\n document.querySelector('.consent-btn-positive').setAttribute(\"aria-hidden\", \"true\");\r\n document.querySelector('.consent-btn-negative').classList.add('hidden');\r\n document.querySelector('.consent-btn-negative').setAttribute(\"aria-hidden\", \"true\");\r\n\r\n}\r\nfunction showGdprButtons(){\r\n document.querySelector('.consent-btn-positive').classList.remove('hidden');\r\n document.querySelector('.consent-btn-positive').setAttribute(\"aria-hidden\", \"false\");\r\n document.querySelector('.consent-btn-negative').classList.remove('hidden');\r\n document.querySelector('.consent-btn-negative').setAttribute(\"aria-hidden\", \"false\");\r\n\r\n}\r\n\r\nfunction hideCaliButtons(){\r\n document.querySelector('.consent-btn-back').classList.add('hidden');\r\n document.querySelector('.consent-btn-back').setAttribute(\"aria-hidden\", \"true\");\r\n document.querySelector('.consent-btn-confirm').classList.add('hidden');\r\n document.querySelector('.consent-btn-confirm').setAttribute(\"aria-hidden\", \"true\");\r\n}\r\nfunction showCaliButtons(){\r\n document.querySelector('.consent-btn-back').classList.remove('hidden');\r\n document.querySelector('.consent-btn-back').setAttribute(\"aria-hidden\", \"false\");\r\n document.querySelector('.consent-btn-confirm').classList.remove('hidden');\r\n document.querySelector('.consent-btn-confirm').setAttribute(\"aria-hidden\", \"false\");\r\n}\r\n\r\n// function initAnalytics() {\r\n// window.dataLayer = window.dataLayer || [];\r\n// function gtag() {\r\n// window.dataLayer.push(arguments);\r\n// }\r\n// gtag('js', new Date());\r\n// gtag('config', 'UA-61002187-3');\r\n// }\r\n\r\n// function initGTM() {\r\n// /*eslint-disable */\r\n// (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\r\n// new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\r\n// j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\r\n// 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\r\n// })(window,document,'script','dataLayer','GTM-TM54HGV');\r\n// /*eslint-enable */\r\n// }\r\n\r\nfunction initDoNotSellInformationUI(config) {\r\n const form = document.getElementById('do-not-sell-info-form');\r\n if (!form) return;\r\n const cb = form.querySelector('#do-not-sell-info-cb');\r\n const submitBtn = form.querySelector('#do-not-sell-info-submit');\r\n const validation = form.querySelector('#do-not-sell-info-validation');\r\n const confirmation = document.querySelector('#do-not-sell-info-confirmation');\r\n const continueBtn = confirmation.querySelector('#do-not-sell-info-continue');\r\n\r\n submitBtn.addEventListener('click', e => {\r\n e.preventDefault();\r\n validation.style.display = cb.checked ? 'none' : 'block';\r\n if(cb.checked) {\r\n document.cookie = getCookieNoState(config);\r\n form.style.display = 'none';\r\n confirmation.style.display = 'block';\r\n }\r\n });\r\n\r\n continueBtn.addEventListener('click', () => history.back());\r\n}\r\n\r\nfunction init(cfg) {\r\n const config = getConfig(cfg);\r\n\r\n if(!config) {\r\n return;\r\n }\r\n\r\n const cookie = getTrackingCookie(config);\r\n\r\n if (!cookie && typeof config.onConsentGiven === 'function') {\r\n showTrackingConsentBanner(config);\r\n }\r\n\r\n if (cookie === `${ config.cookieKey }=yes`) {\r\n config.onConsentGiven();\r\n }\r\n\r\n initDoNotSellInformationUI(config);\r\n}\r\n\r\nwindow.PFS = window.PFS || {};\r\nwindow.PFS.components = window.PFS.components || {};\r\nwindow.PFS.components.trackingConsentBanner = { init };\r\n\r\nexport default { init };\r\n","if (typeof Object.assign !== 'function') {\r\n // Must be writable: true, enumerable: false, configurable: true\r\n Object.defineProperty(Object, \"assign\", {\r\n value: function assign(target, varArgs) { // .length of function is 2\r\n 'use strict';\r\n if (target === null || target === undefined) {\r\n throw new TypeError('Cannot convert undefined or null to object');\r\n }\r\n\r\n var to = Object(target);\r\n\r\n for (var index = 1; index < arguments.length; index++) {\r\n var nextSource = arguments[index];\r\n\r\n if (nextSource !== null && nextSource !== undefined) { \r\n for (var nextKey in nextSource) {\r\n // Avoid bugs when hasOwnProperty is shadowed\r\n if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {\r\n to[nextKey] = nextSource[nextKey];\r\n }\r\n }\r\n }\r\n }\r\n return to;\r\n },\r\n writable: true,\r\n configurable: true\r\n });\r\n}\r\n","import template from './template';\r\nimport assign from './assign';\r\n","/* eslint-disable */\r\n/**\r\n * @license\r\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\r\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\r\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\r\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\r\n * Code distributed by Google as part of the polymer project is also\r\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\r\n */\r\n\r\n// minimal template polyfill\r\n(function() {\r\n 'use strict';\r\n\r\n var needsTemplate = (typeof HTMLTemplateElement === 'undefined');\r\n var brokenDocFragment = !(document.createDocumentFragment().cloneNode() instanceof DocumentFragment);\r\n var needsDocFrag = false;\r\n\r\n // NOTE: Replace DocumentFragment to work around IE11 bug that\r\n // causes children of a document fragment modified while\r\n // there is a mutation observer to not have a parentNode, or\r\n // have a broken parentNode (!?!)\r\n if (/Trident/.test(navigator.userAgent)) {\r\n (function() {\r\n\r\n needsDocFrag = true;\r\n\r\n var origCloneNode = Node.prototype.cloneNode;\r\n Node.prototype.cloneNode = function cloneNode(deep) {\r\n var newDom = origCloneNode.call(this, deep);\r\n if (this instanceof DocumentFragment) {\r\n newDom.__proto__ = DocumentFragment.prototype;\r\n }\r\n return newDom;\r\n };\r\n\r\n // IE's DocumentFragment querySelector code doesn't work when\r\n // called on an element instance\r\n DocumentFragment.prototype.querySelectorAll = HTMLElement.prototype.querySelectorAll;\r\n DocumentFragment.prototype.querySelector = HTMLElement.prototype.querySelector;\r\n\r\n Object.defineProperties(DocumentFragment.prototype, {\r\n 'nodeType': {\r\n get: function () {\r\n return Node.DOCUMENT_FRAGMENT_NODE;\r\n },\r\n configurable: true\r\n },\r\n\r\n 'localName': {\r\n get: function () {\r\n return undefined;\r\n },\r\n configurable: true\r\n },\r\n\r\n 'nodeName': {\r\n get: function () {\r\n return '#document-fragment';\r\n },\r\n configurable: true\r\n }\r\n });\r\n\r\n var origInsertBefore = Node.prototype.insertBefore;\r\n function insertBefore(newNode, refNode) {\r\n if (newNode instanceof DocumentFragment) {\r\n var child;\r\n while ((child = newNode.firstChild)) {\r\n origInsertBefore.call(this, child, refNode);\r\n }\r\n } else {\r\n origInsertBefore.call(this, newNode, refNode);\r\n }\r\n return newNode;\r\n }\r\n Node.prototype.insertBefore = insertBefore;\r\n\r\n var origAppendChild = Node.prototype.appendChild;\r\n Node.prototype.appendChild = function appendChild(child) {\r\n if (child instanceof DocumentFragment) {\r\n insertBefore.call(this, child, null);\r\n } else {\r\n origAppendChild.call(this, child);\r\n }\r\n return child;\r\n };\r\n\r\n var origRemoveChild = Node.prototype.removeChild;\r\n var origReplaceChild = Node.prototype.replaceChild;\r\n Node.prototype.replaceChild = function replaceChild(newChild, oldChild) {\r\n if (newChild instanceof DocumentFragment) {\r\n insertBefore.call(this, newChild, oldChild);\r\n origRemoveChild.call(this, oldChild);\r\n } else {\r\n origReplaceChild.call(this, newChild, oldChild);\r\n }\r\n return oldChild;\r\n };\r\n\r\n Document.prototype.createDocumentFragment = function createDocumentFragment() {\r\n var frag = this.createElement('df');\r\n frag.__proto__ = DocumentFragment.prototype;\r\n return frag;\r\n };\r\n\r\n var origImportNode = Document.prototype.importNode;\r\n Document.prototype.importNode = function importNode(impNode, deep) {\r\n deep = deep || false;\r\n var newNode = origImportNode.call(this, impNode, deep);\r\n if (impNode instanceof DocumentFragment) {\r\n newNode.__proto__ = DocumentFragment.prototype;\r\n }\r\n return newNode;\r\n };\r\n })();\r\n }\r\n\r\n // NOTE: we rely on this cloneNode not causing element upgrade.\r\n // This means this polyfill must load before the CE polyfill and\r\n // this would need to be re-worked if a browser supports native CE\r\n // but not