diff --git a/Gruntfile.js b/Gruntfile.js index af7545789..4a8634dfc 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -128,7 +128,7 @@ module.exports = function (grunt) { dist: { src: ['public/javascripts/application.js', 'node_modules/promise-polyfill/dist/polyfill.min.js', - 'node_modules/govuk-frontend/govuk/all.js', + 'node_modules/govuk-frontend/dist/govuk/all.bundle.js', 'app/assets/javascripts/modules/*.js'], dest: 'public/javascripts/application.js' } diff --git a/app/assets/javascripts/browsered/helpers.js b/app/assets/javascripts/browsered/helpers.js index 80b7e1f9d..88b3e12c0 100644 --- a/app/assets/javascripts/browsered/helpers.js +++ b/app/assets/javascripts/browsered/helpers.js @@ -25,7 +25,7 @@ const initialiseAddressCountryAutocomplete = () => { const toggleButton = (button) => { if (button) { - button[button.getAttribute('disabled') ? 'removeAttribute' : 'setAttribute']('disabled', 'disabled') + button[button.hasAttribute('disabled') ? 'removeAttribute' : 'setAttribute']('disabled', 'disabled') } } diff --git a/app/assets/javascripts/browsered/web-payments/helpers.js b/app/assets/javascripts/browsered/web-payments/helpers.js index 96672e742..6f5fbd8cf 100644 --- a/app/assets/javascripts/browsered/web-payments/helpers.js +++ b/app/assets/javascripts/browsered/web-payments/helpers.js @@ -24,7 +24,7 @@ const clearErrorSummary = () => { const toggleWaiting = (paymentMethodSubmitId) => { const button = document.getElementById(paymentMethodSubmitId) - button[button.getAttribute('disabled') ? 'removeAttribute' : 'setAttribute']('disabled', 'disabled') + button[button.hasAttribute('disabled') ? 'removeAttribute' : 'setAttribute']('disabled', 'disabled') document.getElementById('spinner').classList.toggle('hidden') } diff --git a/app/assets/javascripts/modules/analytics-track-click.js b/app/assets/javascripts/modules/analytics-track-click.js deleted file mode 100644 index d38219866..000000000 --- a/app/assets/javascripts/modules/analytics-track-click.js +++ /dev/null @@ -1,21 +0,0 @@ -var analyticsTrackConfirmClick = function(){ - "use strict"; - - var init = function(analyticsId, type, paymentProvider, amount, hitPage) { - var confirm = document.getElementById('confirm'); - confirm.addEventListener('click', function(){ - ga('send', { - hitType: 'pageview', - page: hitPage, - 'dimension1': analyticsId, - 'dimension2': type, - 'dimension3': paymentProvider, - 'metric1': amount - }); - }, false); - }; - - return { - init: init - }; -}; diff --git a/app/assets/javascripts/modules/cookie-banner.js b/app/assets/javascripts/modules/cookie-banner.js deleted file mode 100644 index 90f65c7c2..000000000 --- a/app/assets/javascripts/modules/cookie-banner.js +++ /dev/null @@ -1,70 +0,0 @@ -; (function () { - 'use strict' - var root = this - if (typeof root.GOVUK === 'undefined') { root.GOVUK = {} } - - /* - Cookie methods - ============== - Usage: - Setting a cookie: - GOVUK.cookie('hobnob', 'tasty', { days: 30 }); - Reading a cookie: - GOVUK.cookie('hobnob'); - Deleting a cookie: - GOVUK.cookie('hobnob', null); - */ - root.GOVUK.cookie = function (name, value, options) { - if (typeof value !== 'undefined') { - if (value === false || value === null) { - return root.GOVUK.setCookie(name, '', { days: -1 }) - } else { - return root.GOVUK.setCookie(name, value, options) - } - } else { - return root.GOVUK.getCookie(name) - } - } - root.GOVUK.setCookie = function (name, value, options) { - if (typeof options === 'undefined') { - options = {} - } - var cookieString = name + '=' + value + '; path=/' - if (options.days) { - var date = new Date() - date.setTime(date.getTime() + (options.days * 24 * 60 * 60 * 1000)) - cookieString = cookieString + '; expires=' + date.toGMTString() - } - if (document.location.protocol === 'https:') { - cookieString = cookieString + '; Secure' - } - document.cookie = cookieString - } - root.GOVUK.getCookie = function (name) { - var nameEQ = name + '=' - var cookies = document.cookie.split(';') - for (var i = 0, len = cookies.length; i < len; i++) { - var cookie = cookies[i] - while (cookie.charAt(0) === ' ') { - cookie = cookie.substring(1, cookie.length) - } - if (cookie.indexOf(nameEQ) === 0) { - return decodeURIComponent(cookie.substring(nameEQ.length)) - } - } - return null - } - root.GOVUK.addCookieMessage = function () { - var message = document.querySelector('.js-cookie-banner') - var hasCookieMessage = (message && root.GOVUK.cookie('seen_cookie_message') === null) - - if (hasCookieMessage) { - message.style.display = 'block' - root.GOVUK.cookie('seen_cookie_message', 'yes', { days: 28 }) - } - } - // add cookie message - if (root.GOVUK && root.GOVUK.addCookieMessage) { - root.GOVUK.addCookieMessage() - } -}).call(this) diff --git a/app/assets/javascripts/modules/form-card-type.js b/app/assets/javascripts/modules/form-card-type.js index bc95c340f..4314d13d5 100644 --- a/app/assets/javascripts/modules/form-card-type.js +++ b/app/assets/javascripts/modules/form-card-type.js @@ -1,4 +1,4 @@ -var showCardType = function() { +window.showCardType = function() { var form = document.getElementById('card-details') var acceptedCards = form.querySelector('.accepted-cards') var cardInput = form.querySelector('#card-no') diff --git a/app/assets/sass/application.scss b/app/assets/sass/application.scss index e10f98d92..2a3328460 100644 --- a/app/assets/sass/application.scss +++ b/app/assets/sass/application.scss @@ -1,11 +1,10 @@ -@import "govuk-frontend/govuk/all"; +@import "govuk-frontend/dist/govuk/all"; @import "govuk-country-and-territory-autocomplete/location-autocomplete"; @import "modules/3ds"; @import "modules/accepted-cards"; @import "modules/accessible-autocomplete"; @import "modules/button-reset"; -@import "modules/cookie-message"; @import "modules/cvc"; @import "modules/expiry-date-separator"; @import "modules/input-confirm"; diff --git a/app/assets/sass/modules/cookie-message.scss b/app/assets/sass/modules/cookie-message.scss deleted file mode 100644 index 49b861b9e..000000000 --- a/app/assets/sass/modules/cookie-message.scss +++ /dev/null @@ -1,20 +0,0 @@ -.cookie-banner { - box-sizing: border-box; - width: 100%; - - padding-top: govuk-spacing(3); - padding-right: govuk-spacing(3); - padding-bottom: govuk-spacing(3); - padding-left: govuk-spacing(3); - background-color: lighten(desaturate(govuk-colour("light-blue"), 8.46), 42.55); - - display: none; - - p { - margin: 0; - } - - @include govuk-media-query($media-type: print) { - display: none !important; - } -} diff --git a/app/middleware/csp.js b/app/middleware/csp.js index c9018bd90..709a36ce9 100644 --- a/app/middleware/csp.js +++ b/app/middleware/csp.js @@ -12,7 +12,7 @@ const allowUnsafeEvalScripts = process.env.CSP_ALLOW_UNSAFE_EVAL_SCRIPTS === 'tr const frontendUrl = process.env.FRONTEND_URL || '' // Script responsible for setting 'js-enabled' class, extends GOV.UK frontend `layout` which we have no control over // and never changes -const govUkFrontendLayoutJsEnabledScriptHash = '\'sha256-+6WnXIl4mbFTCARd8N3COQmT3bJJmo32N8q8ZSQAIcU=\'' +const govUkFrontendLayoutJsEnabledScriptHash = '\'sha256-GUQ5ad8JK5KmEWmROf3LZd9ge94daqNvd8xy9YS1iDw=\'' const CSP_NONE = ['\'none\''] const CSP_SELF = ['\'self\''] @@ -66,7 +66,7 @@ const cardDetailsCSP = helmet({ formAction: [formActionCardDetails], fontSrc: CSP_SELF, frameAncestors: CSP_SELF, - manifestSrc: CSP_NONE, + manifestSrc: CSP_SELF, mediaSrc: CSP_NONE, objectSrc: CSP_NONE, baseUri: CSP_NONE diff --git a/app/views/includes/cookie-message.njk b/app/views/includes/cookie-message.njk deleted file mode 100644 index 9aa44469a..000000000 --- a/app/views/includes/cookie-message.njk +++ /dev/null @@ -1,5 +0,0 @@ -
diff --git a/app/views/includes/custom.njk b/app/views/includes/custom.njk index 23aeb3527..00379837b 100644 --- a/app/views/includes/custom.njk +++ b/app/views/includes/custom.njk @@ -8,7 +8,7 @@