govuk_publishing_components 17.0.0 → 17.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed1bcff194d6bc6a10597abb3bbe2124905ccc3ce57325fb6821428a5bab6146
4
- data.tar.gz: 12ebe47472df27104c8b895c8b6508438aa1beefebe93ace51973406090a92ed
3
+ metadata.gz: fdff9dda5418e5d8d7f623c9fc4b3b94a295a82596b321152c6864c947bab8a4
4
+ data.tar.gz: 1c8f0eb15da82343cebf689fd158b5a1279772353778798d5dc888958f1db7d3
5
5
  SHA512:
6
- metadata.gz: eddef82c2d0e79b00a3f67b51f4ad965b0c8a706fe9ea2494f528f5ca67e7ef36bb674f2c5ff07d9dff70f14438771eba2efe5a47e69eef4384bd15c37fb752e
7
- data.tar.gz: c8df18bbdaad629df80e26201428186515fd1f9b93d8b28c47bc9ea7adb1d68b9e2a1b1ff4bb89a422a3d9d6dafb12340a94631f0989b9ea36c963c8888f0c87
6
+ metadata.gz: 7e8000957b8665357cb95acab25a73187e89b6d1afe747be4964ad975806858eed0543dcbdf14618aa49c2eecad8ed8f4e02f2c56c675e59c733fe204d48d4dd
7
+ data.tar.gz: 317bd5e756d44f0819566ace557a744835cd95f654d11770f4e339ad22cef530fbe6e173eeed34d1b3b6c1bb3bfea22fcdf42291dfe31fff192ed1cd2040d0ba
@@ -42,6 +42,14 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
42
42
  this.$acceptCookiesLink.addEventListener('click', this.$module.setCookieConsent)
43
43
  }
44
44
 
45
+ // Force the new cookie banner to show if we don't think the user has seen it before
46
+ // This involves resetting the seen_cookie_message cookie, which may be set to true if they've seen the old cookie banner
47
+ if (!window.GOVUK.cookie('cookie_policy')) {
48
+ if (window.GOVUK.cookie('seen_cookie_message') === 'true') {
49
+ window.GOVUK.cookie('seen_cookie_message', false)
50
+ }
51
+ }
52
+
45
53
  this.showNewCookieMessage()
46
54
  }
47
55
 
@@ -59,16 +67,16 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
59
67
  // Hide the cookie banner on the cookie settings page, to avoid circular journeys
60
68
  if (newCookieBanner && window.location.pathname === '/help/cookies') {
61
69
  this.$module.style.display = 'none'
62
- }
63
-
64
- var shouldHaveCookieMessage = (this.$module && window.GOVUK.cookie('seen_cookie_message') !== 'true')
70
+ } else {
71
+ var shouldHaveCookieMessage = (this.$module && window.GOVUK.cookie('seen_cookie_message') !== 'true')
65
72
 
66
- if (shouldHaveCookieMessage) {
67
- this.$module.style.display = 'block'
73
+ if (shouldHaveCookieMessage) {
74
+ this.$module.style.display = 'block'
68
75
 
69
- // Set the default consent cookie if it isn't already present
70
- if (!window.GOVUK.cookie('cookie_policy')) {
71
- window.GOVUK.setDefaultConsentCookie()
76
+ // Set the default consent cookie if it isn't already present
77
+ if (!window.GOVUK.cookie('cookie_policy')) {
78
+ window.GOVUK.setDefaultConsentCookie()
79
+ }
72
80
  }
73
81
  }
74
82
  }
@@ -74,17 +74,6 @@
74
74
  window.GOVUK.setCookie('cookie_policy', JSON.stringify(approvedConsent))
75
75
  }
76
76
 
77
- window.GOVUK.denyAllCookieTypes = function () {
78
- var deniedConsent = {
79
- 'essential': false,
80
- 'settings': false,
81
- 'usage': false,
82
- 'campaigns': false
83
- }
84
-
85
- window.GOVUK.setCookie('cookie_policy', JSON.stringify(deniedConsent))
86
- }
87
-
88
77
  window.GOVUK.getConsentCookie = function () {
89
78
  var consentCookie = window.GOVUK.cookie('cookie_policy')
90
79
  var consentCookieObj
@@ -115,6 +104,19 @@
115
104
 
116
105
  for (var cookieType in options) {
117
106
  cookieConsent[cookieType] = options[cookieType]
107
+
108
+ // Delete cookies of that type if consent being set to false
109
+ if (!options[cookieType]) {
110
+ for (var cookie in COOKIE_CATEGORIES) {
111
+ if (COOKIE_CATEGORIES[cookie] === cookieType) {
112
+ window.GOVUK.cookie(cookie, null)
113
+
114
+ if (window.GOVUK.cookie(cookie)) {
115
+ document.cookie = cookie + '=;expires=' + new Date() + ';domain=.' + window.location.hostname + ';path=/'
116
+ }
117
+ }
118
+ }
119
+ }
118
120
  }
119
121
 
120
122
  window.GOVUK.setCookie('cookie_policy', JSON.stringify(cookieConsent))
@@ -140,6 +142,8 @@
140
142
  }
141
143
 
142
144
  window.GOVUK.checkConsentCookie = function (cookieName, cookieValue) {
145
+ var currentConsentCookie = window.GOVUK.getConsentCookie()
146
+
143
147
  // If we're setting the consent cookie OR deleting a cookie, allow by default
144
148
  if (cookieName === 'cookie_policy' || (cookieValue === null || cookieValue === false)) {
145
149
  return true
@@ -150,6 +154,11 @@
150
154
  return window.GOVUK.checkConsentCookieCategory('essential')
151
155
  }
152
156
 
157
+ // If the consent cookie doesn't exist, set the default consent cookie
158
+ if (!currentConsentCookie && COOKIE_CATEGORIES[cookieName]) {
159
+ return true
160
+ }
161
+
153
162
  if (COOKIE_CATEGORIES[cookieName]) {
154
163
  var cookieCategory = COOKIE_CATEGORIES[cookieName]
155
164
 
@@ -47,12 +47,9 @@
47
47
  <% if new_cookie_banner %>
48
48
  <div class="gem-c-cookie-banner__confirmation govuk-width-container">
49
49
  <p class="gem-c-cookie-banner__confirmation-message">
50
- You&#8217;ve accepted all cookies. You can
51
- <a class="govuk-link" href="/help/cookies" data-module="track-click" data-track-category="cookieBanner" data-track-action="Cookie banner settings clicked from confirmation">
52
- change your cookie settings
53
- </a> at any time.
50
+ You&#8217;ve accepted all cookies. You can <a class="govuk-link" href="/help/cookies" data-module="track-click" data-track-category="cookieBanner" data-track-action="Cookie banner settings clicked from confirmation">change your cookie settings</a> at any time.
54
51
  </p>
55
- <button class="gem-c-cookie-banner__hide-button" data-hide-cookie-banner="true">Hide</button>
52
+ <button class="gem-c-cookie-banner__hide-button" data-hide-cookie-banner="true" data-module="track-click" data-track-category="cookieBanner" data-track-action="Hide cookie banner">Hide</button>
56
53
  </div>
57
54
  <% end %>
58
55
  </div>
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '17.0.0'.freeze
2
+ VERSION = '17.1.0'.freeze
3
3
  end
@@ -49,7 +49,7 @@
49
49
  "/"
50
50
  ],
51
51
  "_resolved": "git://github.com/alphagov/accessible-autocomplete.git#3523dd9fffc70cbd9f6f555f75863c33a709f49e",
52
- "_shasum": "c879cd6aa8ca0a320815c4e756ff62f40fb22e92",
52
+ "_shasum": "bf4c71ceba91fbe87d23ae3cd32a3085e265b83f",
53
53
  "_shrinkwrap": null,
54
54
  "_spec": "accessible-autocomplete@git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
55
55
  "_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 17.0.0
4
+ version: 17.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev