govuk_publishing_components 24.10.0 → 24.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics/pii.js +1 -1
  3. data/app/assets/javascripts/govuk_publishing_components/analytics/scroll-tracker.js +6 -248
  4. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +1 -1
  5. data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +1 -0
  6. data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +142 -104
  7. data/app/assets/javascripts/govuk_publishing_components/components/reorderable-list.js +1 -1
  8. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +2 -2
  9. data/app/assets/javascripts/govuk_publishing_components/lib/trigger-event.js +18 -0
  10. data/app/assets/stylesheets/govuk_publishing_components/_all_components_print.scss +0 -11
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak.scss +1 -0
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +15 -18
  13. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_advisory.scss +27 -24
  14. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +1 -1
  15. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +1 -0
  16. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_call-to-action.scss +1 -0
  17. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +1 -0
  18. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_contact.scss +1 -0
  19. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_example.scss +1 -0
  20. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_footnotes.scss +1 -0
  21. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_form-download.scss +19 -16
  22. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_fraction.scss +1 -0
  23. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_highlight-answer.scss +30 -27
  24. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_images.scss +1 -0
  25. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_information-callout.scss +1 -0
  26. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_legislative-list.scss +1 -0
  27. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_place.scss +26 -21
  28. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_stat-headline.scss +1 -0
  29. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_steps.scss +19 -16
  30. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_summary.scss +21 -18
  31. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_tables.scss +1 -0
  32. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +1 -0
  33. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss +1 -0
  34. data/app/assets/stylesheets/govuk_publishing_components/components/print/_attachment.scss +2 -3
  35. data/app/assets/stylesheets/govuk_publishing_components/components/print/_back-link.scss +2 -3
  36. data/app/assets/stylesheets/govuk_publishing_components/components/print/_button.scss +0 -4
  37. data/app/assets/stylesheets/govuk_publishing_components/components/print/_feedback.scss +2 -3
  38. data/app/assets/stylesheets/govuk_publishing_components/components/print/_layout-footer.scss +2 -6
  39. data/app/assets/stylesheets/govuk_publishing_components/components/print/_layout-header.scss +2 -3
  40. data/app/assets/stylesheets/govuk_publishing_components/components/print/_metadata.scss +2 -6
  41. data/app/assets/stylesheets/govuk_publishing_components/components/print/_search.scss +2 -3
  42. data/app/assets/stylesheets/govuk_publishing_components/components/print/_share-links.scss +2 -3
  43. data/app/assets/stylesheets/govuk_publishing_components/components/print/_skip-link.scss +2 -3
  44. data/app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav-header.scss +0 -4
  45. data/app/assets/stylesheets/govuk_publishing_components/components/print/_subscription-links.scss +2 -3
  46. data/app/assets/stylesheets/govuk_publishing_components/components/print/_translation-nav.scss +2 -3
  47. data/app/views/govuk_publishing_components/components/_attachment.html.erb +1 -1
  48. data/app/views/govuk_publishing_components/components/_back_link.html.erb +1 -1
  49. data/app/views/govuk_publishing_components/components/_button.html.erb +1 -1
  50. data/app/views/govuk_publishing_components/components/_feedback.html.erb +1 -1
  51. data/app/views/govuk_publishing_components/components/_government_navigation.html.erb +7 -7
  52. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +5 -3
  53. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +1 -1
  54. data/app/views/govuk_publishing_components/components/_machine_readable_metadata.html.erb +1 -1
  55. data/app/views/govuk_publishing_components/components/_metadata.html.erb +9 -8
  56. data/app/views/govuk_publishing_components/components/_phase_banner.html.erb +1 -5
  57. data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +1 -1
  58. data/app/views/govuk_publishing_components/components/_print_link.html.erb +1 -1
  59. data/app/views/govuk_publishing_components/components/_radio.html.erb +6 -11
  60. data/app/views/govuk_publishing_components/components/_search.html.erb +1 -1
  61. data/app/views/govuk_publishing_components/components/_share_links.html.erb +1 -1
  62. data/app/views/govuk_publishing_components/components/_skip_link.html.erb +1 -1
  63. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +6 -6
  64. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +1 -1
  65. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +2 -2
  66. data/app/views/govuk_publishing_components/components/_success_alert.html.erb +1 -1
  67. data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +1 -1
  68. data/app/views/govuk_publishing_components/components/docs/feedback.yml +2 -0
  69. data/app/views/govuk_publishing_components/components/docs/phase_banner.yml +2 -2
  70. data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +2 -2
  71. data/app/views/govuk_publishing_components/components/metadata/_sentence.html.erb +4 -4
  72. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +2 -2
  73. data/config/locales/ar.yml +123 -0
  74. data/config/locales/az.yml +123 -0
  75. data/config/locales/be.yml +123 -0
  76. data/config/locales/bg.yml +123 -0
  77. data/config/locales/bn.yml +123 -0
  78. data/config/locales/cs.yml +123 -0
  79. data/config/locales/cy.yml +115 -6
  80. data/config/locales/da.yml +123 -0
  81. data/config/locales/de.yml +123 -0
  82. data/config/locales/dr.yml +123 -0
  83. data/config/locales/el.yml +123 -0
  84. data/config/locales/en.yml +111 -103
  85. data/config/locales/es-419.yml +123 -0
  86. data/config/locales/es.yml +123 -0
  87. data/config/locales/et.yml +120 -0
  88. data/config/locales/fa.yml +123 -0
  89. data/config/locales/fi.yml +123 -0
  90. data/config/locales/fr.yml +120 -0
  91. data/config/locales/gd.yml +123 -0
  92. data/config/locales/gu.yml +123 -0
  93. data/config/locales/he.yml +123 -0
  94. data/config/locales/hi.yml +123 -0
  95. data/config/locales/hr.yml +123 -0
  96. data/config/locales/hu.yml +123 -0
  97. data/config/locales/hy.yml +123 -0
  98. data/config/locales/id.yml +123 -0
  99. data/config/locales/is.yml +123 -0
  100. data/config/locales/it.yml +123 -0
  101. data/config/locales/ja.yml +123 -0
  102. data/config/locales/ka.yml +123 -0
  103. data/config/locales/kk.yml +123 -0
  104. data/config/locales/ko.yml +123 -0
  105. data/config/locales/lt.yml +123 -0
  106. data/config/locales/lv.yml +123 -0
  107. data/config/locales/ms.yml +123 -0
  108. data/config/locales/mt.yml +123 -0
  109. data/config/locales/nl.yml +123 -0
  110. data/config/locales/no.yml +124 -1
  111. data/config/locales/pa-pk.yml +123 -0
  112. data/config/locales/pa.yml +123 -0
  113. data/config/locales/pl.yml +123 -0
  114. data/config/locales/ps.yml +123 -0
  115. data/config/locales/pt.yml +123 -0
  116. data/config/locales/ro.yml +123 -0
  117. data/config/locales/ru.yml +123 -0
  118. data/config/locales/si.yml +123 -0
  119. data/config/locales/sk.yml +123 -0
  120. data/config/locales/sl.yml +123 -0
  121. data/config/locales/so.yml +123 -0
  122. data/config/locales/sq.yml +123 -0
  123. data/config/locales/sr.yml +123 -0
  124. data/config/locales/sv.yml +123 -0
  125. data/config/locales/sw.yml +123 -0
  126. data/config/locales/ta.yml +123 -0
  127. data/config/locales/th.yml +123 -0
  128. data/config/locales/tk.yml +123 -0
  129. data/config/locales/tr.yml +123 -0
  130. data/config/locales/uk.yml +123 -0
  131. data/config/locales/ur.yml +123 -0
  132. data/config/locales/uz.yml +123 -0
  133. data/config/locales/vi.yml +123 -0
  134. data/config/locales/zh-hk.yml +123 -0
  135. data/config/locales/zh-tw.yml +123 -0
  136. data/config/locales/zh.yml +123 -0
  137. data/lib/govuk_publishing_components/presenters/breadcrumb_selector.rb +5 -0
  138. data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_taxons.rb +1 -2
  139. data/lib/govuk_publishing_components/presenters/content_item.rb +4 -0
  140. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +4 -0
  141. data/lib/govuk_publishing_components/presenters/machine_readable/page.rb +4 -0
  142. data/lib/govuk_publishing_components/version.rb +1 -1
  143. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +7 -16
  144. data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +4 -15
  145. data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +1 -1
  146. data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +3 -3
  147. data/node_modules/govuk-frontend/govuk/components/cookie-banner/README.md +15 -0
  148. data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +40 -22
  149. data/node_modules/govuk-frontend/govuk/components/cookie-banner/macro-options.json +6 -6
  150. data/node_modules/govuk-frontend/govuk/components/cookie-banner/template.njk +15 -5
  151. data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +2 -2
  152. data/node_modules/govuk-frontend/govuk/components/details/_index.scss +5 -1
  153. data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +13 -14
  154. data/node_modules/govuk-frontend/govuk/components/file-upload/macro-options.json +1 -1
  155. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +14 -19
  156. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +39 -21
  157. data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +1 -1
  158. data/node_modules/govuk-frontend/govuk/components/phase-banner/_index.scss +1 -1
  159. data/node_modules/govuk-frontend/govuk/components/radios/macro-options.json +3 -3
  160. data/node_modules/govuk-frontend/govuk/components/select/macro-options.json +1 -1
  161. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +1 -1
  162. data/node_modules/govuk-frontend/govuk/components/tabs/_index.scss +1 -6
  163. data/node_modules/govuk-frontend/govuk/components/textarea/macro-options.json +1 -1
  164. data/node_modules/govuk-frontend/govuk/components/warning-text/_index.scss +10 -0
  165. data/node_modules/govuk-frontend/govuk/core/_links.scss +8 -0
  166. data/node_modules/govuk-frontend/govuk/helpers/_links.scss +153 -38
  167. data/node_modules/govuk-frontend/govuk/settings/_all.scss +2 -0
  168. data/node_modules/govuk-frontend/govuk/settings/_links.scss +62 -0
  169. data/node_modules/govuk-frontend/package.json +1 -1
  170. metadata +20 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da7ab3cbd89ef8a20000b0a9d6ffad43c92532e787106e6821cccd7c8d9f90b2
4
- data.tar.gz: 1362df93036bb10322e881d5136a0303be0d96a745541afc122ad79949d36820
3
+ metadata.gz: c60eaa696257b6a3bc80e9f004c07f02b42f748ede671940f3a1222dcb1f1b89
4
+ data.tar.gz: 88b4053cc90488b1e7330f52e38c321b8e9bb091b7f3db4bb5e7d3ee7c58850a
5
5
  SHA512:
6
- metadata.gz: a50d991265471b7c0025b59f50c2a51f4599c6fc5e629ad8c0f64158af0570812224938e08ad36193587b46c03a8bf37200def0167d47537868d1a9b31839305
7
- data.tar.gz: a3104340ed6d431791b48ebf1fc9c8b2d89563c608cbe050082efdafc68a949d13bf5f198be9c39b7ad7b1e1d2b18de1556a9f21c9a9c89e65c1b52db02942ba
6
+ metadata.gz: 23dba26a8354b8375b34185c471d5b49e17e298dc9fb80cbb2438d04958660b84cbae7f680fee5305c71e032e8e952ab3ecc45a8570aed28d1e9f5333984b39c
7
+ data.tar.gz: '09a94bbb2a4fb93959172c80e12284f93b08ffb61da1657276e26cd743ce4cad6531f0461a2f3f63d3c15a5a4bc6bbf91c51b9cba7ac7992163406ba8f4a4fe3'
@@ -5,7 +5,7 @@
5
5
 
6
6
  var GOVUK = global.GOVUK || {}
7
7
  var EMAIL_PATTERN = /[^\s=/?&]+(?:@|%40)[^\s=/?&]+/g
8
- var POSTCODE_PATTERN = /[A-PR-UWYZ][A-HJ-Z]?[0-9][0-9A-HJKMNPR-Y]?(?:[\s+]|%20)*[0-9](?!refund)[ABD-HJLNPQ-Z]{2,3}/gi
8
+ var POSTCODE_PATTERN = /\b[A-PR-UWYZ][A-HJ-Z]?[0-9][0-9A-HJKMNPR-Y]?(?:[\s+]|%20)*[0-9](?!refund)[ABD-HJLNPQ-Z]{2,3}\b/gi
9
9
  var DATE_PATTERN = /\d{4}(-?)\d{2}(-?)\d{2}/g
10
10
  var ESCAPE_REGEX_PATTERN = /[|\\{}()[\]^$+*?.]/g
11
11
 
@@ -13,20 +13,6 @@
13
13
  ['Percent', 80],
14
14
  ['Percent', 100]
15
15
  ],
16
- '/government/publications/coronavirus-outbreak-faqs-what-you-can-and-cant-do/coronavirus-outbreak-faqs-what-you-can-and-cant-do': [
17
- ['Percent', 20],
18
- ['Percent', 40],
19
- ['Percent', 60],
20
- ['Percent', 80],
21
- ['Percent', 100]
22
- ],
23
- '/government/publications/coronavirus-covid-19-online-education-resources/coronavirus-covid-19-list-of-online-education-resources-for-home-education': [
24
- ['Percent', 20],
25
- ['Percent', 40],
26
- ['Percent', 60],
27
- ['Percent', 80],
28
- ['Percent', 100]
29
- ],
30
16
  '/guidance/coronavirus-covid-19-information-for-the-public': [
31
17
  ['Percent', 20],
32
18
  ['Percent', 40],
@@ -34,28 +20,6 @@
34
20
  ['Percent', 80],
35
21
  ['Percent', 100]
36
22
  ],
37
- '/guidance/saving-for-retirement-if-youre-aged-16-to-50': [
38
- ['Heading', 'Keep track of your State Pension'],
39
- ['Heading', 'Consider ways to improve your State Pension'],
40
- ['Heading', 'Personal and stakeholder pensions']
41
- ],
42
- '/guidance/planning-for-retirement-if-youre-aged-50-or-over': [
43
- ['Heading', 'Find out your State Pension age'],
44
- ['Heading', 'Consider ways to improve your State Pension'],
45
- ['Heading', 'Workplace, personal and stakeholder pensions'],
46
- ['Heading', 'Personal and stakeholder pensions']
47
- ],
48
- '/guidance/retirement-planning-for-current-pensioners': [
49
- ['Heading', 'If you reached State Pension age before 6 April 2016'],
50
- ['Heading', 'Other ways to increase your income in retirement'],
51
- ['Heading', 'Further support in retirement'],
52
- ['Heading', 'Winter Fuel Payments']
53
- ],
54
- '/government/collections/disability-confident-campaign': [
55
- ['Heading', 'Become a Disability Confident employer'],
56
- ['Heading', 'Aims and objectives'],
57
- ['Heading', 'Inclusive communication']
58
- ],
59
23
  '/government/publications/the-essential-trustee-what-you-need-to-know-cc3/the-essential-trustee-what-you-need-to-know-what-you-need-to-do': [
60
24
  ['Heading', '1. About this guidance'],
61
25
  ['Heading', '2. Trustees’ duties at a glance'],
@@ -77,11 +41,6 @@
77
41
  ['Heading', 'When you can claim Universal Credit'],
78
42
  ['Heading', 'More detailed advice']
79
43
  ],
80
- '/openingupwork': [
81
- ['Heading', 'How Universal Credit makes work pay'],
82
- ['Heading', 'When you can claim Universal Credit'],
83
- ['Heading', 'Help and advice']
84
- ],
85
44
  '/government/publications/spring-budget-2017-documents/spring-budget-2017': [
86
45
  ['Heading', '1. Executive summary'],
87
46
  ['Heading', '2. Economic context and public finances'],
@@ -92,12 +51,6 @@
92
51
  ['Heading', '7. Annex A: Financing'],
93
52
  ['Heading', '8. Annex B: Office for Budget Responsibility\'s Economic and fiscal outlook']
94
53
  ],
95
- '/guidance/living-in-the-eu-prepare-for-brexit': [
96
- ['Heading', 'Travelling in the EU']
97
- ],
98
- '/guidance/driving-in-the-eu-after-brexit-driving-licence-exchange': [
99
- ['Heading', 'Belgium']
100
- ],
101
54
  '/settled-status-eu-citizens-families': [
102
55
  ['Heading', 'When you can apply']
103
56
  ],
@@ -110,21 +63,6 @@
110
63
  '/guidance/foreign-travel-insurance': [
111
64
  ['Heading', 'What your travel insurance policy should cover']
112
65
  ],
113
- '/guidance/passport-rules-for-travel-to-europe-after-brexit': [
114
- ['Heading', 'List of countries affected']
115
- ],
116
- '/visit-europe-brexit': [
117
- ['Heading', 'Travel']
118
- ],
119
- '/guidance/uk-nationals-in-the-eu-benefits-and-pensions-in-a-no-deal-scenario': [
120
- ['Heading', 'Pensions and benefits paid by an EEA state or Switzerland']
121
- ],
122
- '/guidance/uk-students-in-the-eu-continuing-your-studies': [
123
- ['Heading', 'Check whether you’ll get financial help']
124
- ],
125
- '/government/publications/cross-border-maintenance-cases-after-brexit-guidance-for-public/cross-border-maintenance-cases-after-brexit': [
126
- ['Heading', '2. New cases after Brexit']
127
- ],
128
66
  '/guidance/social-security-contributions-for-uk-and-eu-workers-if-the-uk-leaves-the-eu-with-no-deal': [
129
67
  ['Heading', 'UK employers'],
130
68
  ['Heading', 'UK employees and self-employed']
@@ -132,57 +70,18 @@
132
70
  '/guidance/student-finance-arrangements-in-a-no-deal-scenario': [
133
71
  ['Heading', 'Other overseas study placements']
134
72
  ],
135
- '/guidance/advice-for-british-nationals-travelling-and-living-in-europe': [
136
- ['Heading', 'Travelling to the UK']
137
- ],
138
73
  '/guidance/living-in-france': [
139
74
  ['Heading', 'Passports and travel']
140
75
  ],
141
76
  '/family-permit': [
142
77
  ['Heading', 'EEA family permit']
143
78
  ],
144
- '/guidance/european-temporary-leave-to-remain-in-the-uk': [
145
- ['Heading', 'Applying for European temporary leave to remain']
146
- ],
147
- '/guidance/visiting-the-uk-after-brexit': [
148
- ['Heading', 'If the UK leaves the EU without a deal']
149
- ],
150
79
  '/guidance/healthcare-for-eu-and-efta-citizens-visiting-the-uk': [
151
80
  ['Heading', 'Travel insurance']
152
81
  ],
153
- '/guidance/qualified-teacher-status-qts': [
154
- ['Heading', 'Teachers recognised in the EEA or Switzerland']
155
- ],
156
82
  '/guidance/driving-in-the-eu-after-brexit': [
157
83
  ['Heading', 'GB stickers and number plates']
158
84
  ],
159
- '/visit-europe-brexit#travel': [
160
- ['Heading', 'Compensation if your travel is disrupted']
161
- ],
162
- '/apply-for-a-uk-residence-card': [
163
- ['Heading', 'Fees']
164
- ],
165
- '/guidance/studying-in-the-european-union-after-brexit': [
166
- ['Heading', 'Applying for Erasmus+']
167
- ],
168
- '/settled-status-eu-citizens-families/not-EU-EEA-Swiss-citizen': [
169
- ['Heading', 'If you’re a family member of an EU, EEA or Swiss citizen']
170
- ],
171
- '/guidance/get-your-eea-qualification-recognised-in-the-uk-after-brexit': [
172
- ['Heading', 'Professionals already working in the UK']
173
- ],
174
- '/guidance/visiting-the-uk-after-brexit#if-your-vehicle-is-not-insured-in-the-uk': [
175
- ['Heading', 'If your vehicle is not insured in the UK']
176
- ],
177
- '/guidance/uk-residents-visiting-the-eueea-and-switzerland-healthcare': [
178
- ['Heading', 'European Health Insurance Cards (EHIC)']
179
- ],
180
- '/guidance/pet-travel-to-europe-after-brexit': [
181
- ['Heading', 'Pet travel if there’s a no-deal Brexit']
182
- ],
183
- '/guidance/driving-in-the-eu-after-brexit-international-driving-permits': [
184
- ['Heading', 'Check which type of IDP you need']
185
- ],
186
85
  '/guidance/driving-in-the-eu-after-brexit#insurance-for-your-vehicle-caravan-or-trailer': [
187
86
  ['Heading', 'Trailer registration']
188
87
  ],
@@ -192,99 +91,27 @@
192
91
  '/get-a-passport-urgently': [
193
92
  ['Heading', 'Ways to apply']
194
93
  ],
195
- '/guidance/mobile-roaming-after-eu-exit': [
196
- ['Heading', 'If you live in Northern Ireland']
197
- ],
198
- '/government/publications/mobile-roaming-after-eu-exit/mobile-roaming-if-theres-no-brexit-deal': [
199
- ['Heading', '1.2 If there’s no deal']
200
- ],
201
94
  '/driving-abroad/international-driving-permit': [
202
95
  ['Heading', 'Check which IDP you need']
203
96
  ],
204
- '/vehicle-insurance/driving-abroad': [
205
- ['Heading', 'Driving in other countries']
206
- ],
207
97
  '/guidance/driving-in-the-eu-after-brexit#gb-stickers-and-number-plates': [
208
98
  ['Heading', 'GB stickers and number plates']
209
99
  ],
210
- '/guidance/importing-and-exporting-plants-and-plant-products-if-theres-no-withdrawal-deal': [
211
- ['Heading', 'Movement of wood packaging material']
212
- ],
213
- '/guidance/egg-marketing-standards-if-theres-a-no-deal-brexit': [
214
- ['Heading', 'Customs checks']
215
- ],
216
- '/guidance/hatching-eggs-and-chicks-marketing-standards-when-the-uk-leaves-the-eu': [
217
- ['Heading', 'Customs checks']
218
- ],
219
- '/guidance/poultry-meat-marketing-standards-when-the-uk-leaves-the-eu': [
220
- ['Heading', 'Marketing standards checks']
221
- ],
222
- '/guidance/plant-variety-rights-and-marketing-plant-reproductive-material-if-the-uk-leaves-the-eu-without-a-deal': [
223
- ['Heading', 'Rules for applying for plant variety rights if there’s a no deal Brexit']
224
- ],
225
- '/guidance/exporting-animals-animal-products-fish-and-fishery-products-if-the-uk-leaves-the-eu-with-no-deal': [
226
- ['Heading', 'Exports to non-EU countries (third countries) from the UK']
227
- ],
228
- '/guidance/the-farming-sector-and-preparing-for-eu-exit': [
229
- ['Heading', 'Farm and rural payments: Basic Payment Scheme and Rural Development Programme for England']
230
- ],
231
- '/guidance/protecting-food-and-drink-names-if-theres-no-brexit-deal': [
232
- ['Heading', 'New product applications']
233
- ],
234
- '/guidance/trading-and-labelling-organic-food-if-theres-no-brexit-deal': [
235
- ['Heading', 'Exporting organic food to the EU']
236
- ],
237
- '/guidance/hops-and-hops-products-marketing-standards-if-the-uk-leaves-the-eu-without-a-deal': [
238
- ['Heading', 'How to apply for an EU Attestation of Equivalence']
239
- ],
240
100
  '/guidance/guidance-for-suppliers-of-cattle-sheep-and-goat-ear-tags': [
241
101
  ['Heading', 'Tagging information for livestock keepers']
242
102
  ],
243
- '/government/publications/meeting-climate-change-requirements-if-theres-no-brexit-deal/meeting-climate-change-requirements-if-theres-no-brexit-deal': [
244
- ['Heading', 'Summary of actions']
245
- ],
246
- '/guidance/food-labelling-changes-after-brexit': [
247
- ['Heading', 'Goods sold in the UK']
248
- ],
249
- '/guidance/export-horses-and-ponies-special-rules': [
250
- ['Heading', 'Moving equines to the EU in a no-deal Brexit']
251
- ],
252
- '/guidance/trading-and-moving-endangered-species-protected-by-cites-if-theres-no-withdrawal-deal': [
253
- ['Heading', 'Trading with the EU']
254
- ],
255
103
  '/guidance/wine-trade-regulations': [
256
104
  ['Heading', 'Rules for transporting wine into the UK']
257
105
  ],
258
- '/guidance/the-food-and-drink-sector-and-preparing-for-eu-exit': [
259
- ['Heading', 'Importing and exporting']
260
- ],
261
- '/guidance/exporting-and-importing-fish-if-theres-no-brexit-deal': [
262
- ['Heading', 'Send fish to an EU border control post']
263
- ],
264
- '/guidance/the-fisheries-sector-and-preparing-for-eu-exit': [
265
- ['Heading', 'Licensing arrangements']
266
- ],
267
- '/guidance/import-fish-after-a-no-deal-brexit': [
268
- ['Heading', 'Direct landings into the UK']
269
- ],
270
106
  '/guidance/the-chemicals-sector-and-preparing-for-eu-exit': [
271
107
  ['Heading', 'Energy and climate']
272
108
  ],
273
- '/government/publications/trading-electricity-if-theres-no-brexit-deal/trading-electricity-if-theres-no-brexit-deal': [
274
- ['Heading', 'Summary of actions']
275
- ],
276
109
  '/guidance/how-to-move-goods-between-or-through-common-transit-countries-including-the-eu': [
277
110
  ['Heading', 'Start moving your goods']
278
111
  ],
279
112
  '/guidance/ecmt-international-road-haulage-permits': [
280
113
  ['Heading', 'Apply for permits']
281
114
  ],
282
- '/guidance/transporting-goods-between-the-uk-and-eu-in-a-no-deal-brexit-guidance-for-hauliers': [
283
- ['Heading', 'Cross-border responsibilities when moving goods']
284
- ],
285
- '/guidance/carry-out-international-road-haulage-after-brexit': [
286
- ['Heading', 'Vehicle and trailer insurance']
287
- ],
288
115
  '/guidance/prepare-to-drive-in-the-eu-after-brexit-lorry-and-goods-vehicle-drivers': [
289
116
  ['Heading', 'Driver CPC for lorry drivers']
290
117
  ],
@@ -294,45 +121,18 @@
294
121
  '/guidance/vehicle-type-approval-if-theres-no-brexit-deal': [
295
122
  ['Heading', 'Existing vehicle and component type-approvals']
296
123
  ],
297
- '/guidance/hauliers-and-commercial-drivers-you-will-need-new-documents-to-transport-goods-into-the-eu-after-brexit': [
298
- ['Heading', 'Driver documents']
299
- ],
300
- '/guidance/how-to-move-goods-through-roro-locations-in-a-no-deal-brexit-eu-to-uk-and-uk-to-eu': [
301
- ['Heading', 'EU to UK: pre-journey from EU to the UK']
302
- ],
303
124
  '/guidance/the-retail-sector-and-preparing-for-eu-exit': [
304
125
  ['Heading', 'Importing and exporting']
305
126
  ],
306
127
  '/guidance/the-consumer-goods-sector-and-preparing-for-eu-exit': [
307
128
  ['Heading', 'Importing and exporting']
308
129
  ],
309
- '/guidance/textile-labelling-after-brexit': [
310
- ['Heading', 'Labelling requirements']
311
- ],
312
- '/guidance/footwear-labelling-after-brexit': [
313
- ['Heading', 'Labelling requirements']
314
- ],
315
130
  '/government/publications/banking-insurance-and-other-financial-services-if-theres-no-brexit-deal/banking-insurance-and-other-financial-services-if-theres-no-brexit-deal-information-for-financial-services-institutions': [
316
131
  ['Heading', '3. Action taken by the UK']
317
132
  ],
318
- '/government/publications/eu-lawyers-in-the-uk-after-a-no-deal-brexit/eu-lawyers-in-the-uk-after-a-no-deal-brexit': [
319
- ['Heading', 'Lawyers with EU, Norway, Iceland or Liechtenstein qualifications and professional titles']
320
- ],
321
133
  '/government/publications/further-guidance-note-on-the-regulation-of-medicines-medical-devices-and-clinical-trials-if-theres-no-brexit-deal/further-guidance-note-on-the-regulation-of-medicines-medical-devices-and-clinical-trials-if-theres-no-brexit-deal': [
322
134
  ['Heading', '1.4 Orphan medicines']
323
135
  ],
324
- '/guidance/accounting-if-theres-no-brexit-deal': [
325
- ['Heading', 'UK public companies with an EEA listing']
326
- ],
327
- '/guidance/broadcasting-and-video-on-demand-if-theres-no-brexit-deal': [
328
- ['Heading', 'Get local legal advice about your video on-demand services']
329
- ],
330
- '/guidance/changes-to-copyright-law-after-brexit': [
331
- ['Heading', 'Artist’s resale right']
332
- ],
333
- '/guidance/changes-to-eu-and-international-designs-and-trade-mark-protection-after-brexit': [
334
- ['Heading', 'Registered design']
335
- ],
336
136
  '/guidance/check-temporary-rates-of-customs-duty-on-imports-after-eu-exit': [
337
137
  ['Heading', 'Tariff-rate quotas (TRQ)']
338
138
  ],
@@ -342,60 +142,15 @@
342
142
  '/guidance/european-and-domestic-funding-after-brexit': [
343
143
  ['Heading', 'What you need to do']
344
144
  ],
345
- '/guidance/exhaustion-of-ip-rights-and-parallel-trade-after-brexit': [
346
- ['Heading', 'Actions for IP rights holders']
347
- ],
348
- '/guidance/exporting-nuclear-related-items-after-brexit': [
349
- ['Heading', 'Exporting dual-use items']
350
- ],
351
145
  '/guidance/guidance-on-substantial-amendments-to-a-clinical-trial-if-the-uk-leaves-the-eu-with-no-deal': [
352
146
  ['Heading', 'Investigational medicinal product (IMP) certification and importation']
353
147
  ],
354
- '/guidance/importing-and-exporting-waste-if-theres-no-brexit-deal': [
355
- ['Heading', 'Rules after the UK leaves the EU']
356
- ],
357
- '/guidance/merger-review-and-anti-competitive-activity-after-brexit': [
358
- ['Heading', 'Mergers']
359
- ],
360
- '/guidance/nis-regulations-what-uk-digital-service-providers-operating-in-the-eu-should-do-after-brexit': [
361
- ['Heading', 'How RDSPs are regulated in the UK']
362
- ],
363
- '/guidance/placing-manufactured-goods-on-the-eu-internal-market-if-theres-no-deal': [
364
- ['Heading', 'Appointing an authorised representative or responsible person in the EU']
365
- ],
366
- '/guidance/prepare-to-import-relevant-nuclear-materials-from-the-eu-after-brexit-licensing-requirements': [
367
- ['Heading', 'More information']
368
- ],
369
- '/guidance/prepare-to-use-the-ukca-mark-after-brexit': [
370
- ['Heading', 'Check whether you will need to use the new UKCA marking']
371
- ],
372
- '/guidance/prepare-to-work-and-operate-in-the-european-aviation-sector-after-brexit': [
373
- ['Heading', 'Requirements for aviation businesses operating in Europe after the UK leaves the EU']
374
- ],
375
- '/guidance/public-sector-procurement-after-a-no-deal-brexit': [
376
- ['Heading', 'What will change for contracting authorities and entities']
377
- ],
378
- '/guidance/satellites-and-space-programmes-after-brexit': [
379
- ['Heading', 'Copernicus']
380
- ],
381
- '/guidance/shipping-radioactive-waste-and-spent-fuel-after-brexit': [
382
- ['Heading', 'After Brexit']
383
- ],
384
- '/guidance/trading-timber-imports-and-exports-if-theres-no-brexit-deal': [
385
- ['Heading', 'Importing timber for the UK market']
386
- ],
387
- '/guidance/what-you-need-to-move-goods-between-or-through-common-transit-countries-including-the-eu': [
388
- ['Heading', 'Getting a guarantee']
389
- ],
390
148
  '/taking-goods-out-uk-temporarily/get-an-ata-carnet': [
391
149
  ['Heading', 'Using an ATA Carnet']
392
150
  ],
393
151
  '/wood-packaging-import-export': [
394
152
  ['Heading', 'Export solid wood packaging']
395
153
  ],
396
- '/government/publications/vat-for-businesses-if-theres-no-brexit-deal/vat-for-businesses-if-theres-no-brexit-deal': [
397
- ['Heading', 'UK businesses importing goods from the EU']
398
- ],
399
154
  '/guidance/answers-to-the-most-common-topics-asked-about-by-the-public-for-the-coronavirus-press-conference': [
400
155
  ['Percent', 20],
401
156
  ['Percent', 40],
@@ -403,9 +158,6 @@
403
158
  ['Percent', 80],
404
159
  ['Percent', 100]
405
160
  ],
406
- '/eubusiness': [
407
- ['Heading', 'Additional help and support']
408
- ],
409
161
  '/coronavirus': [
410
162
  ['Percent', 20],
411
163
  ['Percent', 40],
@@ -440,6 +192,12 @@
440
192
  ['Percent', 60],
441
193
  ['Percent', 80],
442
194
  ['Percent', 100]
195
+ ],
196
+ '/next-steps-for-your-business/results': [
197
+ ['Heading', 'Things you need to do next'],
198
+ ['Heading', 'Rules to follow'],
199
+ ['Heading', 'Good to know'],
200
+ ['Heading', 'Change your answers']
443
201
  ]
444
202
  }
445
203
 
@@ -47,7 +47,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
47
47
  this.initSectionHeaders()
48
48
 
49
49
  // Feature flag for anchor tag navigation used on manuals
50
- if (this.$module.getAttribute('data-anchor-navigation')) {
50
+ if (this.$module.getAttribute('data-anchor-navigation') === 'true') {
51
51
  this.openByAnchorOnLoad()
52
52
  this.addEventListenersForAnchors()
53
53
  }
@@ -88,6 +88,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
88
88
  if (window.GOVUK.globalBarInit) {
89
89
  window.GOVUK.globalBarInit.init()
90
90
  }
91
+ window.GOVUK.triggerEvent(window, 'cookie-consent')
91
92
  }
92
93
 
93
94
  CookieBanner.prototype.rejectCookieConsent = function () {
@@ -1,5 +1,4 @@
1
- /* eslint-env jquery */
2
-
1
+ /* global XMLHttpRequest, FormData */
3
2
  window.GOVUK = window.GOVUK || {}
4
3
  window.GOVUK.Modules = window.GOVUK.Modules || {};
5
4
 
@@ -11,53 +10,56 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
11
10
  this.element = $element[0]
12
11
  this.somethingIsWrongForm = this.element.querySelector('#something-is-wrong')
13
12
  this.surveyForm = this.element.querySelector('#page-is-not-useful')
14
- this.$prompt = $element.find('.js-prompt')
15
- this.$fields = $element.find('.gem-c-feedback__form-field')
16
- this.$forms = $element.find('.js-feedback-form')
17
- this.$toggleForms = $element.find('.js-toggle-form')
18
- this.$closeForms = $element.find('.js-close-form')
13
+ this.prompt = this.element.querySelector('.js-prompt')
14
+ this.forms = this.element.querySelectorAll('.js-feedback-form')
15
+ this.toggleForms = this.element.querySelectorAll('.js-toggle-form')
16
+ this.closeForms = this.element.querySelectorAll('.js-close-form')
19
17
  this.activeForm = false
20
- this.$activeForm = false
21
- this.$pageIsUsefulButton = $element.find('.js-page-is-useful')
22
- this.$pageIsNotUsefulButton = $element.find('.js-page-is-not-useful')
23
- this.$somethingIsWrongButton = $element.find('.js-something-is-wrong')
24
- this.$promptQuestions = $element.find('.js-prompt-questions')
25
- this.$promptSuccessMessage = $element.find('.js-prompt-success')
26
- this.$somethingIsWrongForm = $(this.somethingIsWrongForm)
27
- this.$surveyForm = $(this.surveyForm)
28
- this.$surveyWrapper = $element.find('#survey-wrapper')
29
-
30
- var that = this
18
+ this.pageIsUsefulButton = this.element.querySelector('.js-page-is-useful')
19
+ this.pageIsNotUsefulButton = this.element.querySelector('.js-page-is-not-useful')
20
+ this.somethingIsWrongButton = this.element.querySelector('.js-something-is-wrong')
21
+ this.promptQuestions = this.element.querySelectorAll('.js-prompt-questions')
22
+ this.promptSuccessMessage = this.element.querySelector('.js-prompt-success')
23
+ this.surveyWrapper = this.element.querySelector('#survey-wrapper')
24
+
25
+ var thisModule = this
31
26
  var jshiddenClass = 'js-hidden'
32
27
 
33
28
  setInitialAriaAttributes()
34
29
  setHiddenValues()
35
30
 
36
- this.$toggleForms.on('click', function (e) {
37
- e.preventDefault()
38
- toggleForm($(e.target).attr('aria-controls'))
39
- trackEvent(getTrackEventParams($(this)))
40
- updateAriaAttributes($(this))
41
- })
31
+ for (var j = 0; j < this.toggleForms.length; j++) {
32
+ this.toggleForms[j].addEventListener('click', function (e) {
33
+ e.preventDefault()
34
+ var el = e.target
35
+ toggleForm(el.getAttribute('aria-controls'))
36
+ trackEvent(getTrackEventParams(el))
37
+ updateAriaAttributes(el)
38
+ })
39
+ }
42
40
 
43
- this.$closeForms.on('click', function (e) {
44
- e.preventDefault()
45
- toggleForm($(e.target).attr('aria-controls'))
46
- trackEvent(getTrackEventParams($(this)))
47
- setInitialAriaAttributes()
48
- revealInitialPrompt()
49
- var refocusClass = '.js-' + $(e.target).attr('aria-controls')
50
- $element.find(refocusClass).focus()
51
- })
41
+ for (var i = 0; i < this.closeForms.length; i++) {
42
+ this.closeForms[i].addEventListener('click', function (e) {
43
+ e.preventDefault()
44
+ var el = e.target
45
+ var formToToggle = el.getAttribute('aria-controls')
46
+ toggleForm(formToToggle)
47
+ trackEvent(getTrackEventParams(el))
48
+ setInitialAriaAttributes()
49
+ revealInitialPrompt()
50
+ var refocusClass = '.js-' + formToToggle
51
+ thisModule.element.querySelector(refocusClass).focus()
52
+ })
53
+ }
52
54
 
53
- this.$pageIsUsefulButton.on('click', function (e) {
55
+ this.pageIsUsefulButton.addEventListener('click', function (e) {
54
56
  e.preventDefault()
55
- trackEvent(getTrackEventParams(that.$pageIsUsefulButton))
57
+ trackEvent(getTrackEventParams(thisModule.pageIsUsefulButton))
56
58
  showFormSuccess()
57
59
  revealInitialPrompt()
58
60
  })
59
61
 
60
- this.$pageIsNotUsefulButton.on('click', function (e) {
62
+ this.pageIsNotUsefulButton.addEventListener('click', function (e) {
61
63
  var gaClientId
62
64
  var dummyGaClientId = '111111111.1111111111'
63
65
  if (window.GOVUK.cookie('_ga') === null || window.GOVUK.cookie('_ga') === '') {
@@ -68,95 +70,129 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
68
70
  setHiddenValuesNotUsefulForm(gaClientId)
69
71
  })
70
72
 
71
- $element.find('form').on('submit', function (e) {
72
- e.preventDefault()
73
- var $form = $(this)
74
- $.ajax({
75
- type: 'POST',
76
- url: $form.attr('action'),
77
- dataType: 'json',
78
- data: $form.serialize(),
79
- beforeSend: disableSubmitFormButton($form),
80
- timeout: 6000
81
- }).done(function (xhr) {
82
- trackEvent(getTrackEventParams($form))
83
- showFormSuccess(xhr.message)
84
- revealInitialPrompt()
85
- setInitialAriaAttributes()
86
- that.$activeForm.toggleClass(jshiddenClass)
87
- }).fail(function (xhr) {
88
- showError(xhr)
89
- enableSubmitFormButton($form)
90
- })
91
- })
73
+ // much of the JS needed to support sending the form contents via this script is
74
+ // unsupported by IE, even IE11. This check causes IE to not intercept form submits
75
+ // and let them happen normally, which is handled already by the backend
76
+ if (typeof window.URLSearchParams === 'function') {
77
+ for (var f = 0; f < this.forms.length; f++) {
78
+ this.forms[f].addEventListener('submit', function (e) {
79
+ e.preventDefault()
80
+ var $form = e.target
81
+ var xhr = new XMLHttpRequest()
82
+ var url = $form.getAttribute('action')
83
+ var params = new FormData($form)
84
+ params = new URLSearchParams(params).toString()
85
+
86
+ xhr.open('POST', url, true)
87
+ xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
88
+
89
+ xhr.onreadystatechange = function () {
90
+ if (xhr.readyState === 4 && xhr.status === 200) {
91
+ trackEvent(getTrackEventParams($form))
92
+ showFormSuccess(xhr.message)
93
+ revealInitialPrompt()
94
+ setInitialAriaAttributes()
95
+ thisModule.activeForm.classList.toggle(jshiddenClass)
96
+ } else {
97
+ showError(xhr)
98
+ enableSubmitFormButton($form)
99
+ }
100
+ }
101
+
102
+ disableSubmitFormButton($form)
103
+ xhr.send(params)
104
+ })
105
+ }
106
+ }
92
107
 
93
108
  function disableSubmitFormButton ($form) {
94
- $form.find('input[type="submit"]').prop('disabled', true)
109
+ var formButton = $form.querySelector('[type="submit"]')
110
+ formButton.setAttribute('disabled', true)
95
111
  }
96
112
 
97
113
  function enableSubmitFormButton ($form) {
98
- $form.find('input[type="submit"]').removeAttr('disabled')
114
+ var formButton = $form.querySelector('[type="submit"]')
115
+ formButton.removeAttribute('disabled')
99
116
  }
100
117
 
101
118
  function setInitialAriaAttributes () {
102
- that.$forms.attr('aria-hidden', true)
103
- that.$pageIsNotUsefulButton.attr('aria-expanded', false)
104
- that.$somethingIsWrongButton.attr('aria-expanded', false)
119
+ for (var i = 0; i < thisModule.forms.length; i++) {
120
+ thisModule.forms[i].setAttribute('aria-hidden', true)
121
+ }
122
+ thisModule.pageIsNotUsefulButton.setAttribute('aria-expanded', false)
123
+ thisModule.somethingIsWrongButton.setAttribute('aria-expanded', false)
105
124
  }
106
125
 
107
126
  function setHiddenValues () {
108
- that.$somethingIsWrongForm.append('<input type="hidden" name="javascript_enabled" value="true"/>')
109
- that.$somethingIsWrongForm.append($('<input type="hidden" name="referrer">').val(document.referrer || 'unknown'))
110
- that.somethingIsWrongForm.invalidInfoError = [
111
- '<h2>',
112
- ' Sorry, we’re unable to send your message as you haven’t given us any information.',
113
- '</h2>',
114
- '<p>Please tell us what you were doing or what went wrong</p>'
127
+ var javascriptEnabled = document.createElement('input')
128
+ javascriptEnabled.setAttribute('type', 'hidden')
129
+ javascriptEnabled.setAttribute('name', 'javascript_enabled')
130
+ javascriptEnabled.setAttribute('value', true)
131
+ thisModule.somethingIsWrongForm.appendChild(javascriptEnabled)
132
+
133
+ var referrer = document.createElement('input')
134
+ referrer.setAttribute('type', 'hidden')
135
+ referrer.setAttribute('name', 'referrer')
136
+ referrer.setAttribute('value', document.referrer || 'unknown')
137
+ thisModule.somethingIsWrongForm.appendChild(referrer)
138
+ thisModule.somethingIsWrongForm.invalidInfoError = [
139
+ '<h2>Sorry, we’re unable to send your message as you haven’t given us any information.</h2>',
140
+ ' <p>Please tell us what you were doing or what went wrong</p>'
115
141
  ].join('')
116
142
  }
117
143
 
118
144
  function setHiddenValuesNotUsefulForm (gaClientId) {
119
145
  var currentPathName = window.location.pathname.replace(/[^\s=?&]+(?:@|%40)[^\s=?&]+/, '[email]')
120
146
  var finalPathName = encodeURI(currentPathName)
121
- that.surveyForm.invalidInfoError = [
122
- '<h2>',
123
- ' Sorry, we’re unable to send your message as you haven’t given us a valid email address. ',
124
- '</h2>',
125
- '<p>Enter an email address in the correct format, like name@example.com</p>'
147
+ thisModule.surveyForm.invalidInfoError = [
148
+ '<h2>Sorry, we’re unable to send your message as you haven’t given us a valid email address.</h2>',
149
+ ' <p>Enter an email address in the correct format, like name@example.com</p>'
126
150
  ].join('')
127
151
  if (document.querySelectorAll('[name="email_survey_signup[ga_client_id]"]').length === 0) {
128
- that.$surveyForm.append($('<input name="email_survey_signup[ga_client_id]" type="hidden">').val(gaClientId || '0'))
152
+ var hiddenInput = document.createElement('input')
153
+ hiddenInput.setAttribute('type', 'hidden')
154
+ hiddenInput.setAttribute('name', 'email_survey_signup[ga_client_id]')
155
+ hiddenInput.setAttribute('value', gaClientId || '0')
156
+ thisModule.surveyForm.appendChild(hiddenInput)
129
157
  }
130
158
 
131
159
  if (document.querySelectorAll('.gem-c-feedback__email-link#take-survey').length === 0) {
132
- that.$surveyWrapper.append('<a href="https://www.smartsurvey.co.uk/s/gov-uk-banner/?c=' + finalPathName + '&amp;gcl=' + gaClientId + '" class="gem-c-feedback__email-link govuk-link" id="take-survey" target="_blank" rel="noopener noreferrer">Don’t have an email address?</a>')
160
+ var takeSurvey = document.createElement('a')
161
+ takeSurvey.setAttribute('href', 'https://www.smartsurvey.co.uk/s/gov-uk-banner/?c=' + finalPathName + '&amp;gcl=' + gaClientId)
162
+ takeSurvey.setAttribute('class', 'gem-c-feedback__email-link govuk-link')
163
+ takeSurvey.setAttribute('id', 'take-survey')
164
+ takeSurvey.setAttribute('target', '_blank')
165
+ takeSurvey.setAttribute('rel', 'noopener noreferrer')
166
+ takeSurvey.innerHTML = 'Don’t have an email address?'
167
+ thisModule.surveyWrapper.appendChild(takeSurvey)
133
168
  }
134
169
  }
135
170
 
136
171
  function updateAriaAttributes (linkClicked) {
137
- linkClicked.attr('aria-expanded', true)
138
- $('#' + linkClicked.attr('aria-controls')).attr('aria-hidden', false)
172
+ linkClicked.setAttribute('aria-expanded', true)
173
+ var controls = linkClicked.getAttribute('aria-controls')
174
+ var ariaControls = document.querySelector('#' + controls)
175
+ ariaControls.setAttribute('aria-hidden', false)
139
176
  }
140
177
 
141
178
  function toggleForm (formId) {
142
- that.activeForm = that.element.querySelector('#' + formId)
143
- that.$activeForm = $(that.activeForm)
144
- that.$activeForm.toggleClass(jshiddenClass)
145
- that.$prompt.toggleClass(jshiddenClass)
179
+ thisModule.activeForm = thisModule.element.querySelector('#' + formId)
180
+ thisModule.activeForm.classList.toggle(jshiddenClass)
181
+ thisModule.prompt.classList.toggle(jshiddenClass)
146
182
 
147
- var formIsVisible = !that.$activeForm.hasClass(jshiddenClass)
183
+ var formIsVisible = !thisModule.activeForm.classList.contains(jshiddenClass)
148
184
 
149
185
  if (formIsVisible) {
150
- that.$activeForm.find('.gem-c-input').first().focus()
186
+ thisModule.activeForm.querySelector('.gem-c-input').focus()
151
187
  } else {
152
- that.$activeForm = false
188
+ thisModule.activeForm = false
153
189
  }
154
190
  }
155
191
 
156
192
  function getTrackEventParams ($node) {
157
193
  return {
158
- category: $node.data('track-category'),
159
- action: $node.data('track-action')
194
+ category: $node.getAttribute('data-track-category'),
195
+ action: $node.getAttribute('data-track-action')
160
196
  }
161
197
  }
162
198
 
@@ -168,40 +204,42 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
168
204
 
169
205
  function showError (error) {
170
206
  var genericError = [
171
- '<h2>',
172
- ' Sorry, we’re unable to receive your message right now. ',
173
- '</h2>',
174
- '<p>If the problem persists, we have other ways for you to provide',
207
+ '<h2>Sorry, we’re unable to receive your message right now.</h2>',
208
+ ' <p>If the problem persists, we have other ways for you to provide',
175
209
  ' feedback on the <a href="/contact/govuk">contact page</a>.</p>'
176
210
  ].join('')
177
211
  // if the response is not a 404 or 500, show the error message if it exists
178
212
  // otherwise show the generic message
179
- if (typeof (error.responseJSON) !== 'undefined') {
180
- error = typeof (error.responseJSON.message) === 'undefined' ? genericError : error.responseJSON.message
181
-
182
- if (error === 'email survey sign up failure') {
213
+ if ('response' in error) {
214
+ if (typeof error.response === 'object' && error.response !== null) {
215
+ error = error.response.message === 'email survey sign up failure' ? genericError : error.response.message
216
+ } else {
183
217
  error = genericError
184
218
  }
185
219
  } else if (error.status === 422) {
186
220
  // there's clobbering by nginx on all 422 requests, which is why the response returns a rendered html page instead of the expected JSON
187
- // this is a temporary workaround to ensure that are are displaying relevant error messages to the users
188
- error = that.activeForm.invalidInfoError || genericError
221
+ // this is a temporary workaround to ensure that we are displaying relevant error messages to the users
222
+ error = thisModule.activeForm.invalidInfoError || genericError
189
223
  } else {
190
- // for all other, show generic error
191
224
  error = genericError
192
225
  }
193
- var $errors = that.$activeForm.find('.js-errors')
194
- $errors.html(error).removeClass(jshiddenClass).focus()
226
+ var $errors = thisModule.activeForm.querySelector('.js-errors')
227
+ $errors.innerHTML = error
228
+ $errors.classList.remove(jshiddenClass)
229
+ $errors.focus()
195
230
  }
196
231
 
197
232
  function showFormSuccess () {
198
- that.$promptQuestions.addClass(jshiddenClass)
199
- that.$promptSuccessMessage.removeClass(jshiddenClass).focus()
233
+ for (var i = 0; i < thisModule.promptQuestions.length; i++) {
234
+ thisModule.promptQuestions[i].classList.add(jshiddenClass)
235
+ }
236
+ thisModule.promptSuccessMessage.classList.remove(jshiddenClass)
237
+ thisModule.promptSuccessMessage.focus()
200
238
  }
201
239
 
202
240
  function revealInitialPrompt () {
203
- that.$prompt.removeClass(jshiddenClass)
204
- that.$prompt.focus()
241
+ thisModule.prompt.classList.remove(jshiddenClass)
242
+ thisModule.prompt.focus()
205
243
  }
206
244
  }
207
245
  }