govuk_publishing_components 35.14.0 → 35.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (19) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +15 -5
  3. data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +4 -5
  4. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +327 -321
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +6 -0
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak.scss +6 -0
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +1 -1
  8. data/app/views/govuk_publishing_components/components/_attachment.html.erb +2 -1
  9. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +30 -2
  10. data/app/views/govuk_publishing_components/components/_devolved_nations.html.erb +15 -1
  11. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +2 -2
  12. data/app/views/govuk_publishing_components/components/docs/cards.yml +2 -2
  13. data/app/views/govuk_publishing_components/components/docs/cookie_banner.yml +5 -0
  14. data/app/views/govuk_publishing_components/components/docs/devolved_nations.yml +16 -0
  15. data/app/views/govuk_publishing_components/components/layout_for_public/_account-layout.html.erb +1 -0
  16. data/config/locales/en.yml +2 -2
  17. data/lib/govuk_publishing_components/presenters/devolved_nations_helper.rb +16 -4
  18. data/lib/govuk_publishing_components/version.rb +1 -1
  19. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbe4c3f60d3220a9d2b715392ba0bdd2f6bce4f92153fff876e8a0b608361161
4
- data.tar.gz: 94bd59d7a23b8e3cec4882814d7fb0140f81f0bd53bc23f0e475700ba8c489f8
3
+ metadata.gz: 5edbe2c7a347d6bc8069704f3434dc4c41de45b3286f7640893f7ff8f62c25a8
4
+ data.tar.gz: d17f853fdf1a5598b808a69fdec621da35aa8662bc911d5c951715cc53bfb6a0
5
5
  SHA512:
6
- metadata.gz: 47f46ab14ccabebf2a3a3c0da9bc03f9b8207d1e54b6a0c4eb8830eb87b5ce200dd606fd2de50c3804d61f222518c560b046ff77b0de87e635a84a653d77d758
7
- data.tar.gz: c51c0a0407bfa84b24ba4d5dfb281f9c31657f1b18e5afe687198c401dbb0f05dc795d7c27ecdf9fbbfe8413cc82a18f28016d77f3d4248351780e0731a61e55
6
+ metadata.gz: 0f5f8a3a9706d98e11ce756987eb9dc442dce2c3701eeb2dbfe8ff2ad48c6c48d27c0c8f056b9e3f851d53d4c6cfb1712c042f9699a658fad94618d679b6c974
7
+ data.tar.gz: fc1469502870ba2a479cde17f7d8edc652270a3ce98efd2aa6128797634e484bf6448cb54712f4c12c116a4f9275d345cb39ffdf13901bde137fc80321769657
@@ -17,7 +17,7 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
17
17
  location: this.getLocation(),
18
18
  /* If the init() function receives a referrer parameter, this indicates that it has been called as a part of an AJAX request and
19
19
  this.getReferrer() will not return the correct value. Therefore we need to rely on the referrer parameter. */
20
- referrer: referrer ? this.PIIRemover.stripPIIWithOverride(referrer, true, true) : this.getReferrer(),
20
+ referrer: this.getReferrer(referrer),
21
21
  title: this.getTitle(),
22
22
  status_code: this.getStatusCode(),
23
23
 
@@ -55,7 +55,9 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
55
55
  between fresh page loads and dynamic page updates. */
56
56
  dynamic: referrer ? 'true' : 'false',
57
57
  emergency_banner: document.querySelector('[data-ga4-emergency-banner]') ? 'true' : undefined,
58
- phase_banner: this.getElementAttribute('data-ga4-phase-banner') || undefined
58
+ phase_banner: this.getElementAttribute('data-ga4-phase-banner') || undefined,
59
+ devolved_nations_banner: this.getElementAttribute('data-ga4-devolved-nations-banner') || undefined,
60
+ cookie_banner: document.querySelector('[data-ga4-cookie-banner]') ? 'true' : undefined
59
61
  }
60
62
  }
61
63
  window.GOVUK.analyticsGa4.core.sendData(data)
@@ -63,11 +65,19 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
63
65
  },
64
66
 
65
67
  getLocation: function () {
66
- return this.PIIRemover.stripPII(document.location.href)
68
+ return this.PIIRemover.stripPII(this.stripGaParam(document.location.href))
67
69
  },
68
70
 
69
- getReferrer: function () {
70
- return this.PIIRemover.stripPIIWithOverride(document.referrer, true, true)
71
+ getReferrer: function (referrer) {
72
+ referrer = this.stripGaParam(referrer || document.referrer)
73
+ return this.PIIRemover.stripPIIWithOverride(referrer, true, true)
74
+ },
75
+
76
+ // remove GA parameters of the form _ga=2320.021-012302 or _gl=02.10320.01230-123
77
+ stripGaParam: function (str) {
78
+ str = str.replace(/(_ga=[0-9.-]+)/g, '_ga=[id]')
79
+ str = str.replace(/(_gl=[0-9.-]+)/g, '_gl=[id]')
80
+ return str
71
81
  },
72
82
 
73
83
  getTitle: function () {
@@ -4,7 +4,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
4
4
  (function (Modules) {
5
5
  function CookieBanner ($module) {
6
6
  this.$module = $module
7
- this.$module.cookieBanner = document.querySelector('.gem-c-cookie-banner')
8
7
  this.$module.cookieBannerConfirmationMessage = this.$module.querySelector('.gem-c-cookie-banner__confirmation')
9
8
  this.$module.cookieBannerConfirmationMessageText = this.$module.querySelector('.gem-c-cookie-banner__confirmation-message')
10
9
  }
@@ -100,16 +99,16 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
100
99
  }
101
100
 
102
101
  CookieBanner.prototype.showConfirmationMessage = function () {
103
- this.$cookieBannerHeader = document.querySelector('.govuk-cookie-banner__heading')
102
+ this.$cookieBannerHeader = this.$module.querySelector('.govuk-cookie-banner__heading')
104
103
  this.$cookieBannerHeader.hidden = true
105
104
 
106
- this.$cookieBannerMainContent = document.querySelector('.gem-c-cookie-banner__content')
105
+ this.$cookieBannerMainContent = this.$module.querySelector('.gem-c-cookie-banner__content')
107
106
  this.$cookieBannerMainContent.hidden = true
108
107
 
109
- this.$cookieBannerConfirmationButtons = document.querySelector('.js-confirmation-buttons')
108
+ this.$cookieBannerConfirmationButtons = this.$module.querySelector('.js-confirmation-buttons')
110
109
  this.$cookieBannerConfirmationButtons.hidden = true
111
110
 
112
- this.$cookieBannerHideButton = document.querySelector('.js-hide-button')
111
+ this.$cookieBannerHideButton = this.$module.querySelector('.js-hide-button')
113
112
  this.$cookieBannerHideButton.hidden = false
114
113
  }
115
114