govuk_publishing_components 36.0.1 → 36.0.3
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 +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +14 -2
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-form-tracker.js +1 -2
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +7 -1
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +2 -3
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +1 -1
- data/lib/govuk_publishing_components/presenters/attachment_helper.rb +1 -0
- data/lib/govuk_publishing_components/presenters/meta_tags.rb +5 -6
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/sortablejs/README.md +2 -2
- data/node_modules/sortablejs/Sortable.js +599 -1028
- data/node_modules/sortablejs/Sortable.min.js +2 -2
- data/node_modules/sortablejs/modular/sortable.complete.esm.js +599 -1028
- data/node_modules/sortablejs/modular/sortable.core.esm.js +599 -1029
- data/node_modules/sortablejs/modular/sortable.esm.js +599 -1028
- data/node_modules/sortablejs/package.json +56 -56
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fca7a5f4a2f77be1b86157531a3f2884b70ebde62cea12c194bad2b29886d121
|
4
|
+
data.tar.gz: 9e59cd6485f898e8f86f1b2f21022bca130c5d471d2a87afd498be029811a265
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00cb71df653b04a54fd700ab26efedde9852421def70e5e4c5e40b8ac3b90828e926aa9311dd526a0c2f2e417ed6dff0d70cd6197beaad702ffd311ac2e05a31
|
7
|
+
data.tar.gz: e34e2387ad6ef7903892a12090be73aa46c1307749fde8b38338afb7bcda5cd0f987eb675737012dc6f72b715643f14a16d2795a3593ea8671d04a81761eb8a3
|
@@ -275,6 +275,19 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
|
|
275
275
|
return url
|
276
276
|
}
|
277
277
|
return this.getPathname() + url
|
278
|
+
},
|
279
|
+
|
280
|
+
standardiseSearchTerm: function (searchTerm) {
|
281
|
+
if (!searchTerm) {
|
282
|
+
return undefined // Prevents conversion of undefined to a string by this function.
|
283
|
+
}
|
284
|
+
|
285
|
+
var PIIRemover = new window.GOVUK.analyticsGa4.PIIRemover()
|
286
|
+
searchTerm = searchTerm.replace(/\++|(%2B)+/gm, ' ') // Turn + characters or unicode + characters (%2B) into a space.
|
287
|
+
searchTerm = window.GOVUK.analyticsGa4.core.trackFunctions.removeLinesAndExtraSpaces(searchTerm)
|
288
|
+
searchTerm = PIIRemover.stripPIIWithOverride(searchTerm, true, true)
|
289
|
+
searchTerm = searchTerm.toLowerCase()
|
290
|
+
return searchTerm
|
278
291
|
}
|
279
292
|
},
|
280
293
|
|
@@ -313,12 +326,11 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
|
|
313
326
|
var isSearchResult = element.getAttribute('data-ga4-search-query')
|
314
327
|
|
315
328
|
var ecommerceSchema = new window.GOVUK.analyticsGa4.Schemas().ecommerceSchema()
|
316
|
-
var PIIRemover = new window.GOVUK.analyticsGa4.PIIRemover()
|
317
329
|
var DEFAULT_LIST_TITLE = 'Smart answer results'
|
318
330
|
|
319
331
|
if (isSearchResult) {
|
320
332
|
// Limiting to 100 characters to avoid noise from extra long search queries and to stop the size of the payload going over 8k limit.
|
321
|
-
var searchQuery =
|
333
|
+
var searchQuery = window.GOVUK.analyticsGa4.core.trackFunctions.standardiseSearchTerm(element.getAttribute('data-ga4-search-query')).substring(0, 100)
|
322
334
|
var variant = element.getAttribute('data-ga4-ecommerce-variant')
|
323
335
|
DEFAULT_LIST_TITLE = 'Site search results'
|
324
336
|
}
|
@@ -47,8 +47,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
47
47
|
data.text = data.text || this.combineGivenAnswers(formData) || this.useFallbackValue
|
48
48
|
|
49
49
|
if (data.action === 'search' && data.text) {
|
50
|
-
data.text = data.text
|
51
|
-
data.text = window.GOVUK.analyticsGa4.core.trackFunctions.removeLinesAndExtraSpaces(data.text)
|
50
|
+
data.text = window.GOVUK.analyticsGa4.core.trackFunctions.standardiseSearchTerm(data.text)
|
52
51
|
}
|
53
52
|
window.GOVUK.analyticsGa4.core.applySchemaAndSendData(data, 'event_data')
|
54
53
|
}
|
@@ -85,7 +85,13 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
85
85
|
if (!data.text && (element.querySelector('img') || element.querySelector('svg') || element.tagName === 'IMG' || element.closest('svg'))) {
|
86
86
|
data.text = 'image'
|
87
87
|
}
|
88
|
-
|
88
|
+
try {
|
89
|
+
var url = data.url || this.findLink(event.target).getAttribute('href')
|
90
|
+
} catch (e) {
|
91
|
+
// no href found, so abort
|
92
|
+
return
|
93
|
+
}
|
94
|
+
|
89
95
|
data.url = trackFunctions.removeCrossDomainParams(url)
|
90
96
|
data.url = trackFunctions.applyRedactionIfRequired(this.PIIRemover, element, data.url)
|
91
97
|
data.url = trackFunctions.appendPathToAnchorLinks(data.url)
|
@@ -86,9 +86,8 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
86
86
|
}
|
87
87
|
|
88
88
|
searchTerm = searchTerm[0].replace('keywords=', '')
|
89
|
-
searchTerm =
|
90
|
-
|
91
|
-
searchTerm = this.PIIRemover.stripPIIWithOverride(searchTerm, true, true)
|
89
|
+
searchTerm = window.GOVUK.analyticsGa4.core.trackFunctions.standardiseSearchTerm(searchTerm)
|
90
|
+
|
92
91
|
return searchTerm
|
93
92
|
},
|
94
93
|
|
data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js
CHANGED
@@ -116,7 +116,7 @@
|
|
116
116
|
// https://github.com/alphagov/govuk_publishing_components/pull/908#discussion_r302913995
|
117
117
|
var videoTitle = options.title
|
118
118
|
event.target.getIframe().title = videoTitle + ' (video)'
|
119
|
-
if (window.GOVUK.analyticsGa4.analyticsModules.VideoTracker) {
|
119
|
+
if (window.GOVUK.analyticsGa4.analyticsModules && window.GOVUK.analyticsGa4.analyticsModules.VideoTracker) {
|
120
120
|
window.GOVUK.analyticsGa4.analyticsModules.VideoTracker.configureVideo(event)
|
121
121
|
}
|
122
122
|
},
|
@@ -105,6 +105,7 @@ module GovukPublishingComponents
|
|
105
105
|
{ content_type: "application/vnd.openxmlformats-officedocument.presentationml.presentation", name: "MS PowerPoint Presentation" }.freeze, # pptx
|
106
106
|
{ content_type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", name: "MS Excel Spreadsheet", spreadsheet: true }.freeze, # xlsx
|
107
107
|
{ content_type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", name: "MS Word Document", document: true }.freeze, # docx
|
108
|
+
{ content_type: "application/zip", abbr: "ZIP", name: "Zip archive" }.freeze,
|
108
109
|
{ content_type: "application/xml", abbr: "XML", name: "XML Document" }.freeze,
|
109
110
|
{ content_type: "image/gif", abbr: "GIF", name: "Graphics Interchange Format" }.freeze,
|
110
111
|
{ content_type: "image/jpeg", name: "JPEG" }.freeze,
|
@@ -92,13 +92,12 @@ module GovukPublishingComponents
|
|
92
92
|
def add_ga4_political_tags(meta_tags)
|
93
93
|
government = content_item.dig(:links, :government, 0)
|
94
94
|
|
95
|
-
# political: true/false is in a different place to current: true/false, which is why we have 'details' and 'government
|
95
|
+
# political: true/false is in a different place to current: true/false, which is why we have 'details' and 'government.dig(:details)'
|
96
96
|
if government && details[:political]
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
meta_tags["govuk:ga4-publishing-government"] = government_title
|
97
|
+
current_government = government.dig(:details, :current)
|
98
|
+
unless current_government
|
99
|
+
meta_tags["govuk:ga4-political-status"] = "historic"
|
100
|
+
meta_tags["govuk:ga4-publishing-government"] = government[:title] if government[:title]
|
102
101
|
end
|
103
102
|
end
|
104
103
|
|
@@ -54,12 +54,12 @@ Demo: http://sortablejs.github.io/Sortable/
|
|
54
54
|
|
55
55
|
Install with NPM:
|
56
56
|
```bash
|
57
|
-
|
57
|
+
npm install sortablejs --save
|
58
58
|
```
|
59
59
|
|
60
60
|
Install with Bower:
|
61
61
|
```bash
|
62
|
-
|
62
|
+
bower install --save sortablejs
|
63
63
|
```
|
64
64
|
|
65
65
|
Import into your project:
|