hof 22.10.1 → 22.11.0-frontend-v4-beta.1

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.
@@ -1,22 +1,22 @@
1
- /* eslint-disable max-len, no-var, vars-on-top, no-undef */
1
+ /* eslint-disable max-len, no-undef */
2
2
  'use strict';
3
3
 
4
4
  // TODO: update package.json(s)
5
5
 
6
6
  function hideFallbackContent(containerId) {
7
- var container = document.getElementById(containerId);
7
+ const container = document.getElementById(containerId);
8
8
  if (container === null) return;
9
- var fallbackContent = container.getElementsByClassName('js-disabled');
10
- for (var i = 0; i < fallbackContent.length; i++) {
9
+ const fallbackContent = container.getElementsByClassName('js-disabled');
10
+ for (let i = 0; i < fallbackContent.length; i++) {
11
11
  fallbackContent[i].style.display = 'none';
12
12
  }
13
13
  }
14
14
 
15
15
  function showInteractiveContent(containerId) {
16
- var container = document.getElementById(containerId);
16
+ const container = document.getElementById(containerId);
17
17
  if (container === null) return;
18
- var interactiveContent = container.getElementsByClassName('js-enabled');
19
- for (var i = 0; i < interactiveContent.length; i++) {
18
+ const interactiveContent = container.getElementsByClassName('js-enabled');
19
+ for (let i = 0; i < interactiveContent.length; i++) {
20
20
  interactiveContent[i].style.display = 'block';
21
21
  }
22
22
  }
@@ -34,41 +34,53 @@ function setCookiePreferences(preferences) {
34
34
  function showCookieBannerSubmitted() {
35
35
  document.getElementById('cookie-banner-info').style.display = 'none';
36
36
  document.getElementById('cookie-banner-actions').style.display = 'none';
37
- var cookieBannerSubmitted = document.getElementById('cookie-banner-submitted');
37
+ let cookieBannerSubmitted;
38
+ const cookieBannerDiv = document.getElementById('cookie-banner-submitted-accepted');
39
+ if (cookieBannerDiv.dataset.acceptCookies === 'true') {
40
+ cookieBannerSubmitted = document.getElementById('cookie-banner-submitted-accepted');
41
+ } else {
42
+ cookieBannerSubmitted = document.getElementById('cookie-banner-submitted-rejected');
43
+ }
38
44
  cookieBannerSubmitted.style.display = 'block';
39
45
  cookieBannerSubmitted.focus();
40
46
  }
41
47
 
48
+ function hideCookieBanner() {
49
+ document.getElementById('cookie-banner').style.display = 'none';
50
+ }
51
+
42
52
  function initialiseBannerButtons() {
53
+ const acceptedCookieBannerDiv = document.getElementById('cookie-banner-submitted-accepted');
43
54
  document.getElementById('accept-cookies-button').addEventListener('click', function () {
44
- setCookiePreferences({essential: true, usage: true});
55
+ setCookiePreferences({ essential: true, usage: true });
45
56
  showCookieBannerSubmitted();
46
57
  sessionStorage.setItem('reloading', 'true');
47
58
  window.location = document.URL;
48
59
  });
49
60
 
50
61
  document.getElementById('reject-cookies-button').addEventListener('click', function () {
51
- setCookiePreferences({essential: true, usage: false});
62
+ setCookiePreferences({ essential: true, usage: false });
63
+ acceptedCookieBannerDiv.dataset.acceptCookies = 'false';
52
64
  showCookieBannerSubmitted();
53
65
  });
54
66
 
55
- document.getElementById('hide-cookie-banner').addEventListener('click', function () {
56
- document.getElementById('cookie-banner').style.display = 'none';
57
- });
67
+ document.getElementById('hide-accept-cookie-banner').addEventListener('click', hideCookieBanner);
68
+
69
+ document.getElementById('hide-reject-cookie-banner').addEventListener('click', hideCookieBanner);
58
70
  }
59
71
 
60
72
  function initialiseCookieBanner() {
61
- var preferences = GOVUK.cookie('cookie_preferences');
73
+ const preferences = GOVUK.cookie('cookie_preferences');
62
74
 
63
75
  if (preferences !== null) {
64
76
  return;
65
77
  }
66
78
 
67
79
  // the default cookie message container from hof-govuk-template
68
- var bannerContainer = document.getElementById('global-cookie-message');
80
+ const bannerContainer = document.getElementById('global-cookie-message');
69
81
 
70
82
  // the cookie banner that will replace the container's default content if using google analytics
71
- var cookieBanner = document.getElementById('cookie-banner');
83
+ const cookieBanner = document.getElementById('cookie-banner');
72
84
 
73
85
  if (bannerContainer !== null && cookieBanner !== null) {
74
86
  hideFallbackContent('global-cookie-message');
@@ -82,8 +94,8 @@ function handleSaveSettings(e) {
82
94
  e.preventDefault();
83
95
  setCookiePreferences({ essential: true, usage: document.getElementById('radio-1').checked });
84
96
 
85
- var cookieNotification = document.getElementById('cookie-notification');
86
- var cookieBanner = document.getElementById('cookie-banner');
97
+ const cookieNotification = document.getElementById('cookie-notification');
98
+ const cookieBanner = document.getElementById('cookie-banner');
87
99
 
88
100
  if (cookieBanner !== null) {
89
101
  cookieBanner.style.display = 'none';
@@ -96,8 +108,8 @@ function handleSaveSettings(e) {
96
108
  }
97
109
 
98
110
  function initialiseFormControls() {
99
- var preferences = JSON.parse(GOVUK.cookie('cookie_preferences'));
100
- var usage;
111
+ const preferences = JSON.parse(GOVUK.cookie('cookie_preferences'));
112
+ let usage;
101
113
 
102
114
  if (preferences !== null && preferences.usage !== undefined && typeof preferences.usage === 'boolean') {
103
115
  usage = preferences.usage;
@@ -111,7 +123,7 @@ function initialiseFormControls() {
111
123
  }
112
124
 
113
125
  function initialiseCookiePage() {
114
- var shouldDisplayCookieControls = document.getElementById('cookie-settings') !== null;
126
+ const shouldDisplayCookieControls = document.getElementById('cookie-settings') !== null;
115
127
 
116
128
  if (shouldDisplayCookieControls) {
117
129
  hideFallbackContent('cookie-settings');
@@ -122,12 +134,12 @@ function initialiseCookiePage() {
122
134
 
123
135
  function onLoad() {
124
136
  window.onload = function () {
125
- var reloading = sessionStorage.getItem('reloading');
137
+ const reloading = sessionStorage.getItem('reloading');
126
138
  if (reloading) {
127
139
  sessionStorage.removeItem('reloading');
128
140
 
129
- var bannerContainer = document.getElementById('global-cookie-message');
130
- var cookieBanner = document.getElementById('cookie-banner');
141
+ const bannerContainer = document.getElementById('global-cookie-message');
142
+ const cookieBanner = document.getElementById('cookie-banner');
131
143
 
132
144
  if (bannerContainer !== null && cookieBanner !== null) {
133
145
  bannerContainer.style.display = 'block';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hof",
3
3
  "description": "A bootstrap for HOF projects",
4
- "version": "22.10.1",
4
+ "version": "22.11.0-frontend-v4-beta.1",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
@@ -60,7 +60,7 @@
60
60
  "findup": "^0.1.5",
61
61
  "glob": "^7.2.0",
62
62
  "govuk-elements-sass": "^3.1.3",
63
- "govuk-frontend": "3.15",
63
+ "govuk-frontend": "4.10.1",
64
64
  "govuk_template_mustache": "^0.26.0",
65
65
  "helmet": "^3.22.0",
66
66
  "hogan-express-strict": "^0.5.4",
@@ -0,0 +1,245 @@
1
+ {
2
+ "errors": {
3
+ "service-unavailable": {
4
+ "contact": "You can email for more information"
5
+ }
6
+ },
7
+ "exit": {
8
+ "header": "You have left this form",
9
+ "title": "You have left this form"
10
+ },
11
+ "fields": {
12
+ "landing-page-radio": {
13
+ "legend": "Which form would you like to explore?",
14
+ "hint": "Choose one of the options below and press continue.",
15
+ "options": {
16
+ "basic-form": {
17
+ "label": "Basic form"
18
+ },
19
+ "complex-form": {
20
+ "label": "Complex form"
21
+ },
22
+ "build-your-own-form": {
23
+ "label": "Build your own form"
24
+ }
25
+ }
26
+ },
27
+ "name": {
28
+ "label": "Full name"
29
+ },
30
+ "dateOfBirth": {
31
+ "legend": "What is your date of birth?",
32
+ "hint": "For example, 31 10 1990"
33
+ },
34
+ "building": {
35
+ "label": "Building and street"
36
+ },
37
+ "street": {
38
+ "label": "Address line 2"
39
+ },
40
+ "townOrCity": {
41
+ "label": "Town or city"
42
+ },
43
+ "postcode": {
44
+ "label": "Postcode"
45
+ },
46
+ "incomeTypes": {
47
+ "label": "Sources of income",
48
+ "legend": "Select the options where you receive income from",
49
+ "hint": "Select all options that apply to you.",
50
+ "options": {
51
+ "salary": {
52
+ "label": "Salary"
53
+ },
54
+ "universal_credit": {
55
+ "label": "Universal Credit"
56
+ },
57
+ "child_benefit": {
58
+ "label": "Child Benefit"
59
+ },
60
+ "housing_benefit": {
61
+ "label": "Housing Benefit"
62
+ },
63
+ "other": {
64
+ "label": "Other"
65
+ }
66
+ }
67
+ },
68
+ "countryOfHearing": {
69
+ "legend": "What country was the appeal lodged?",
70
+ "options": {
71
+ "englandAndWales": {
72
+ "label": "England and Wales"
73
+ },
74
+ "scotland": {
75
+ "label": "Scotland"
76
+ },
77
+ "northernIreland": {
78
+ "label": "Northern Ireland"
79
+ }
80
+ }
81
+ },
82
+ "email": {
83
+ "label": "Email address"
84
+ },
85
+ "phone": {
86
+ "label": "Phone number",
87
+ "hint": "International phone numbers require the international dialling code, for example +33235066182"
88
+ },
89
+ "int-phone-number": {
90
+ "legend": "International phone number"
91
+ },
92
+ "complaintDetails": {
93
+ "label": "Complaint details",
94
+ "hint": "Briefly summarise your complaint. Include anything that can help our investigation."
95
+ },
96
+ "whatHappened": {
97
+ "label": "What happened",
98
+ "hint": "Briefly summarise what happened."
99
+ },
100
+ "countrySelect": {
101
+ "label": "Which country are you based in?",
102
+ "hint": "Start to type the country name and options will appear"
103
+ },
104
+ "appealStages": {
105
+ "label": "Appeal stage",
106
+ "hint": "Choose an appeal stage from the drop down menu",
107
+ "options": {
108
+ "null": "Select..."
109
+ }
110
+ }
111
+ },
112
+ "journey": {
113
+ "header": "HOF Bootstrap Sandbox Form",
114
+ "serviceName": "HOF Bootstrap Sandbox Form",
115
+ "confirmation": {
116
+ "details": "Your reference number <br><strong>HDJ2123F</strong>"
117
+ }
118
+ },
119
+ "pages": {
120
+ "landing-page": {
121
+ "header": "Landing page"
122
+ },
123
+ "build-your-own-form": {
124
+ "title": "Build your own form",
125
+ "subheader": "Access the build your own form guidance link"
126
+ },
127
+ "address": {
128
+ "header": "What is your address in the UK?",
129
+ "intro": "If you have no fixed address, enter an address where we can contact you."
130
+ },
131
+ "name": {
132
+ "header": "What is your full name?"
133
+ },
134
+ "email": {
135
+ "header": "Enter your email address"
136
+ },
137
+ "phone-number": {
138
+ "header": "Enter your phone number"
139
+ },
140
+ "confirm": {
141
+ "header": "Check your answers before submitting your application.",
142
+ "sections": {
143
+ "applicantsDetails": {
144
+ "header": "Applicant's details"
145
+ },
146
+ "address": {
147
+ "header": "Address"
148
+ },
149
+ "income": {
150
+ "header": "Income"
151
+ },
152
+ "appealDetails": {
153
+ "header": "Appeal details"
154
+ },
155
+ "countrySelect": {
156
+ "header": "Country of residence"
157
+ },
158
+ "contactDetails": {
159
+ "header": "Contact details"
160
+ },
161
+ "complaintDetails": {
162
+ "header": "Complaint details"
163
+ },
164
+ "whatHappened": {
165
+ "header": "What happened"
166
+ }
167
+ }
168
+ },
169
+ "confirmation": {
170
+ "title": "Application sent",
171
+ "alert": "Application sent",
172
+ "subheader": "What happens next",
173
+ "content": "We’ll contact you with the decision of your application or if we need more information from you."
174
+ },
175
+ "exit": {
176
+ "message": "We have cleared your information to keep it secure. Your information has not been saved."
177
+ },
178
+ "session-timeout-warning": {
179
+ "dialog-title": "{{^showSaveAndExit}}Your application will close soon{{/showSaveAndExit}}{{#showSaveAndExit}}You will be signed out soon{{/showSaveAndExit}}",
180
+ "dialog-text": "{{^showSaveAndExit}}If that happens, your progress will not be saved.{{/showSaveAndExit}}{{#showSaveAndExit}}Any answers you have saved will not be affected, but your progress on this page will not be saved.{{/showSaveAndExit}}",
181
+ "timeout-continue-button": "{{^showSaveAndExit}}Stay on this page{{/showSaveAndExit}}{{#showSaveAndExit}}Stay signed in{{/showSaveAndExit}}",
182
+ "dialog-exit-link": "{{^showSaveAndExit}}Exit this form{{/showSaveAndExit}}{{#showSaveAndExit}}Sign out{{/showSaveAndExit}}"
183
+ },
184
+ "save-and-exit": {
185
+ "header": "You have been signed out",
186
+ "paragraph-1": "Your form doesn't appear to have been worked on for 30 minutes so we closed it for security.",
187
+ "paragraph-2": "Any answers you saved have not been affected.",
188
+ "paragraph-3": "You can sign back in to your application at any time by returning to the <a href='/' class='govuk-link'>start page</a>."
189
+ }
190
+ },
191
+ "validation": {
192
+ "landing-page-radio": {
193
+ "required": "Select an option below and press continue"
194
+ },
195
+ "name": {
196
+ "default": "Enter your full name"
197
+ },
198
+ "dateOfBirth": {
199
+ "default": "Enter your date of birth in the correct format; for example, 31 10 1990",
200
+ "after": "Enter a date after 1 1 1900",
201
+ "before": "Enter a date that is in the past"
202
+ },
203
+ "building": {
204
+ "default": "Enter details of your building and street"
205
+ },
206
+ "townOrCity": {
207
+ "default": "Enter a town or city",
208
+ "regex": "Enter a town or city without including digits"
209
+ },
210
+ "postcode": {
211
+ "default": "Enter your postcode"
212
+ },
213
+ "incomeTypes": {
214
+ "default": "Select all options that apply to you."
215
+ },
216
+ "countryOfHearing": {
217
+ "default": "Select where the appeal hearing is to be held"
218
+ },
219
+ "countrySelect": {
220
+ "default": "Enter a valid country of residence",
221
+ "required": "Enter your country of residence"
222
+ },
223
+ "email": {
224
+ "default": "Enter your email address in the correct format"
225
+ },
226
+ "phone": {
227
+ "default": "Enter your phone number"
228
+ },
229
+ "int-phone-number": {
230
+ "required": "Enter an international phone number",
231
+ "internationalPhoneNumber": "Enter a valid international phone number"
232
+ },
233
+ "complaintDetails": {
234
+ "default": "Enter details about why you are making a complaint",
235
+ "maxlength": "Keep to the {{maxlength}} character limit"
236
+ },
237
+ "whatHappened": {
238
+ "default": "Enter details about what happened",
239
+ "maxword": "Keep to the {{maxword}} word limit"
240
+ },
241
+ "appealStages": {
242
+ "required": "Select an appeal stage from the list"
243
+ }
244
+ }
245
+ }
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "author": "",
17
17
  "dependencies": {
18
- "govuk-frontend": "3.14",
18
+ "govuk-frontend": "4.10.1",
19
19
  "jquery": "^3.7.1",
20
20
  "sass": "^1.53.0",
21
21
  "typeahead-aria": "^1.0.4"