govuk_publishing_components 21.15.2 → 21.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8315a827c7e0bb201abdb8f6c0f0ce808ab0531c80113a7b6eab67426788cd8d
4
- data.tar.gz: 912061103bd7142d52ba5fde79bde3ecf5c25b7761fecf1455890241155fdfe5
3
+ metadata.gz: 06c37091574f949ad8140b3d67416f86d27c2b30051a22b5677e9741db034275
4
+ data.tar.gz: a4341467f69fc573e80513a05dd7cb7ea6664712dc88e88e6f8832407f738a00
5
5
  SHA512:
6
- metadata.gz: cba3df16d2d460a621ccb9d7186e69c8f77733a89c34ca5f61ec2c8c267ee3ccb394e48d5665a6c72f4e7b522e7028830fe66fbb87a544aaa3bd6bf7c34b68cb
7
- data.tar.gz: b519951ca60b5cdbe529f7cbb3115fa904a3f2604dad344aa5edad78d18a7d8644d40d62fe3d278a5a13bedd35163f5cffad86f77b0c534863ca6133e8bf330a
6
+ metadata.gz: 92e2283dbb3527522729b82d2030955805c70ad29f2270aff0dbb663cb8d2b7a3107ea08b8de8f749a543b46e4b58d20ba4846380fb0d004b8d55b27672df07c
7
+ data.tar.gz: b6d85184eef98c6582c794e7726ae4289a1bbd0ac3382958d039c84364a9aedb4ea39101a6c0c078a93afcdf2d40fd627ab970aaa177df8bde9d9adcdd691075
@@ -42,6 +42,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
42
42
  if (!window.GOVUK.cookie('cookies_policy')) {
43
43
  window.GOVUK.setDefaultConsentCookie()
44
44
  }
45
+
46
+ window.GOVUK.deleteUnconsentedCookies()
45
47
  } else {
46
48
  this.$module.style.display = 'none'
47
49
  }
@@ -111,13 +111,7 @@
111
111
  if (!options[cookieType]) {
112
112
  for (var cookie in COOKIE_CATEGORIES) {
113
113
  if (COOKIE_CATEGORIES[cookie] === cookieType) {
114
- window.GOVUK.cookie(cookie, null)
115
-
116
- if (window.GOVUK.cookie(cookie)) {
117
- // We need to handle deleting cookies on the domain and the .domain
118
- document.cookie = cookie + '=;expires=' + new Date() + ';'
119
- document.cookie = cookie + '=;expires=' + new Date() + ';domain=' + window.location.hostname + ';path=/'
120
- }
114
+ window.GOVUK.deleteCookie(cookie)
121
115
  }
122
116
  }
123
117
  }
@@ -198,4 +192,29 @@
198
192
  }
199
193
  return null
200
194
  }
195
+
196
+ window.GOVUK.deleteCookie = function (cookie) {
197
+ window.GOVUK.cookie(cookie, null)
198
+
199
+ if (window.GOVUK.cookie(cookie)) {
200
+ // We need to handle deleting cookies on the domain and the .domain
201
+ document.cookie = cookie + '=;expires=' + new Date() + ';'
202
+ document.cookie = cookie + '=;expires=' + new Date() + ';domain=' + window.location.hostname + ';path=/'
203
+ }
204
+ }
205
+
206
+ window.GOVUK.deleteUnconsentedCookies = function () {
207
+ var currentConsent = window.GOVUK.getConsentCookie()
208
+
209
+ for (var cookieType in currentConsent) {
210
+ // Delete cookies of that type if consent being set to false
211
+ if (!currentConsent[cookieType]) {
212
+ for (var cookie in COOKIE_CATEGORIES) {
213
+ if (COOKIE_CATEGORIES[cookie] === cookieType) {
214
+ window.GOVUK.deleteCookie(cookie)
215
+ }
216
+ }
217
+ }
218
+ }
219
+ }
201
220
  }(window))
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '21.15.2'.freeze
2
+ VERSION = '21.16.0'.freeze
3
3
  end
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: 21.15.2
4
+ version: 21.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev