govuk_publishing_components 35.21.0 → 35.21.1

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: 3bc95850fa0d38a7b0783eed1d3e5b1fd846c9b11c8ae5562d8fa8f7111696f4
4
- data.tar.gz: edafc5b87bd54a90cce6cfe616589eddb820eb6dc3d0d4d0e8f17953ad51a74f
3
+ metadata.gz: 7d50686dad9cdda4ba4f752558bea505240bbf6114d87adb622f0c5979311fc6
4
+ data.tar.gz: d742933a7c501d815ffcde551a5b2fddad3c67cd7e6e24efae03bf6273df1408
5
5
  SHA512:
6
- metadata.gz: 576b4d036af878138116870dcf1045cf91cdb9ba31a9f68b1b8571fac840f7728d177f9d3293c83e921a3f93a5a3110b19e681568367706ca89280dc995abe8d
7
- data.tar.gz: bf87713f8b29033d63800bd4851bbca0778968a4318432b828a907a60e83a85da966307394ef77c43b3bb715ee14a23ebe81b9984303bf11a1fe5e1b2f5550f1
6
+ metadata.gz: d0364bb2803a05e97bc0e52596dd6a952e2697dea2584d2a8e40b2d65abf132c190259dd7b1934f437c3ac70fed9eed2c2b72130f3a4f68b1ff0f3cfeeee21bc
7
+ data.tar.gz: 13829c743b74ddb4d384803b760dfc24d3d89fffe15427740d14c0b2e35352a985da5e43b63a98ca55930d253b655bfd33ba6a5fd336d0d1638dbec768aa5231
@@ -281,7 +281,7 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
281
281
  },
282
282
 
283
283
  getIndex: function (element, startPosition) {
284
- var index = element.getAttribute('data-ecommerce-index')
284
+ var index = element.getAttribute('data-ga4-ecommerce-index')
285
285
 
286
286
  if (!index) {
287
287
  return null
@@ -307,7 +307,7 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
307
307
  var element = data.element
308
308
  var resultsId = data.resultsId
309
309
  var isClickEvent = data.event !== undefined
310
- var isSearchResult = element.getAttribute('data-search-query')
310
+ var isSearchResult = element.getAttribute('data-ga4-search-query')
311
311
 
312
312
  var ecommerceSchema = new window.GOVUK.analyticsGa4.Schemas().ecommerceSchema()
313
313
  var PIIRemover = new window.GOVUK.analyticsGa4.PIIRemover()
@@ -315,14 +315,14 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
315
315
 
316
316
  if (isSearchResult) {
317
317
  // Limiting to 100 characters to avoid noise from extra long search queries and to stop the size of the payload going over 8k limit.
318
- var searchQuery = PIIRemover.stripPII(element.getAttribute('data-search-query')).substring(0, 100).toLowerCase()
319
- var variant = element.getAttribute('data-ecommerce-variant')
318
+ var searchQuery = PIIRemover.stripPII(element.getAttribute('data-ga4-search-query')).substring(0, 100).toLowerCase()
319
+ var variant = element.getAttribute('data-ga4-ecommerce-variant')
320
320
  DEFAULT_LIST_TITLE = 'Site search results'
321
321
  }
322
322
 
323
323
  var items = element.querySelectorAll('[data-ga4-ecommerce-path]')
324
- var listTitle = element.getAttribute('data-list-title') || DEFAULT_LIST_TITLE
325
- var startPosition = parseInt(element.getAttribute('data-ecommerce-start-index'), 10)
324
+ var listTitle = element.getAttribute('data-ga4-list-title') || DEFAULT_LIST_TITLE
325
+ var startPosition = parseInt(element.getAttribute('data-ga4-ecommerce-start-index'), 10)
326
326
 
327
327
  ecommerceSchema.event = 'search_results'
328
328
  ecommerceSchema.search_results.event_name = isClickEvent ? 'select_item' : 'view_item_list'
@@ -353,10 +353,10 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
353
353
  var item = items[i]
354
354
  var path = item.getAttribute('data-ga4-ecommerce-path')
355
355
 
356
- // If the element does not have a data-ecommerce-index attribute, we set one so that we can use it later when setting the index property
356
+ // If the element does not have a data-ga4-ecommerce-index attribute, we set one so that we can use it later when setting the index property
357
357
  // on the ecommerce object.
358
- if (!item.getAttribute('data-ecommerce-index')) {
359
- item.setAttribute('data-ecommerce-index', i + 1)
358
+ if (!item.getAttribute('data-ga4-ecommerce-index')) {
359
+ item.setAttribute('data-ga4-ecommerce-index', i + 1)
360
360
  }
361
361
 
362
362
  ecommerceSchema.search_results.ecommerce.items.push({
@@ -24,13 +24,13 @@ module GovukPublishingComponents
24
24
 
25
25
  def wrap_numbers_with_spans(content_item_link)
26
26
  content_item_text = strip_tags(content_item_link) # just the text of the link
27
-
27
+ content_item_text_stripped = content_item_text.strip # strip trailing spaces for the regex. Keep original content_item_text for the string replacement.
28
28
  # Must start with a number
29
29
  # Number must be between 1 and 999 (ie not 2014)
30
30
  # Must be followed by a space
31
31
  # May contain a period `1.`
32
32
  # May be a decimal `1.2`
33
- number = /^\d{1,3}(\.?|\.\d{1,2})(?=\s)/.match(content_item_text)
33
+ number = /^\d{1,3}(\.?|\.\d{1,2})(?=\s)/.match(content_item_text_stripped)
34
34
 
35
35
  if number
36
36
  words = content_item_text.sub(number.to_s, "").strip # remove the number from the text
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "35.21.0".freeze
2
+ VERSION = "35.21.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 35.21.0
4
+ version: 35.21.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-26 00:00:00.000000000 Z
11
+ date: 2023-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config