hof 22.0.0-timeout-warning-beta.3 → 22.0.0-timeout-warning-beta.5

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 2024, Version 22.0.0, @Rhodine-orleans-lindsay
2
+ * Adds session timeout warning
3
+ * Fixes accessibility issues
4
+ * Sandbox area for testing hof changes
5
+ * Updates patch and minor dependency versions
6
+
1
7
  ## 2024-07-22, Version 21.0.0 (Stable), @Rhodine-orleans-lindsay
2
8
  * Replaces deprecated request module with axios
3
9
  - refactors the hof model and apis to use axios instead of request
@@ -38,7 +38,7 @@ const defaults = {
38
38
  host: process.env.REDIS_HOST || '127.0.0.1'
39
39
  },
40
40
  session: {
41
- ttl: process.env.SESSION_TTL || 1800,
41
+ ttl: process.env.SESSION_TTL || 61,
42
42
  secret: process.env.SESSION_SECRET || 'changethis',
43
43
  name: process.env.SESSION_NAME || 'hod.sid',
44
44
  sanitiseInputs: false
@@ -47,8 +47,7 @@ const defaults = {
47
47
  pdfConverter: process.env.PDF_CONVERTER_URL
48
48
  },
49
49
  serveStatic: process.env.SERVE_STATIC_FILES !== 'false',
50
- sessionTimeOutWarning: process.env.SESSION_TIMEOUT_WARNING || 300,
51
- finalSessionTimeOutWarning: process.env.FINAL_SESSION_TIMEOUT_WARNING
50
+ sessionTimeOutWarning: process.env.SESSION_TIMEOUT_WARNING || 60
52
51
  };
53
52
 
54
53
  module.exports = Object.assign({}, defaults, rateLimits);
@@ -159,24 +159,24 @@ window.GOVUK.sessionDialog = {
159
159
  ints[0] += 10;
160
160
  }
161
161
 
162
- /* Add scale word if chunk is not zero and array item exists */
163
- if ((word === scales[i])) {
164
- words.push(word);
162
+ /* Add scale word if chunk array item exists */
163
+ if (scales[i]) {
164
+ words.push(scales[i]);
165
165
  }
166
166
 
167
167
  /* Add unit word if array item exists */
168
- if ((word === units[ints[0]])) {
169
- words.push(word);
168
+ if (units[ints[0]]) {
169
+ words.push(units[ints[0]]);
170
170
  }
171
171
 
172
172
  /* Add tens word if array item exists */
173
- if ((word === tens[ints[1]])) {
174
- words.push(word);
173
+ if (word = tens[ints[1]]) {
174
+ words.push(tens[ints[1]]);
175
175
  }
176
176
 
177
177
  /* Add hundreds word if array item exists */
178
- if ((word === units[ints[2]])) {
179
- words.push(word + ' hundred');
178
+ if (units[ints[2]]) {
179
+ words.push(units[ints[2]] + ' hundred');
180
180
  }
181
181
  }
182
182
  }
@@ -233,13 +233,11 @@ window.GOVUK.sessionDialog = {
233
233
 
234
234
  (function countdown() {
235
235
  const secondsUntilSessionTimeout = window.GOVUK.sessionDialog.secondsUntilSessionTimeout();
236
- const timerExpired = secondsUntilSessionTimeout <= window.GOVUK.sessionDialog.secondsFinalWarning;
236
+ const timerExpired = secondsUntilSessionTimeout <= 0;
237
237
 
238
238
  if (!timerExpired) {
239
239
  const minutesLeft = parseInt(secondsUntilSessionTimeout / 60, 10);
240
240
  const secondsLeft = parseInt(secondsUntilSessionTimeout % 60, 10);
241
- const atMinutesText = window.GOVUK.sessionDialog.timeToWords(minutesLeft, 'minute');
242
- const atSecondsText = window.GOVUK.sessionDialog.timeToWords(secondsLeft, 'second');
243
241
 
244
242
  // Below string will get read out by screen readers every time
245
243
  // the timeout refreshes.
@@ -247,8 +245,8 @@ window.GOVUK.sessionDialog = {
247
245
  // first time the time out opens
248
246
  const countdownText = window.GOVUK.sessionDialog.countdownText(minutesLeft, secondsLeft);
249
247
  const text = window.GOVUK.sessionDialog.warningTextPrefix + '<strong>' + countdownText + '</strong>' + window.GOVUK.sessionDialog.warningTextSuffix;
250
- const countdownAtText = window.GOVUK.sessionDialog.countdownAtText(atMinutesText, atSecondsText);
251
- const atText = window.GOVUK.sessionDialog.warningTextPrefix + countdownAtText + window.GOVUK.sessionDialog.warningTextSuffix + 'bgbhj ' + window.GOVUK.sessionDialog.warningText;
248
+ const countdownAtText = window.GOVUK.sessionDialog.countdownAtText(minutesLeft, secondsLeft);
249
+ const atText = window.GOVUK.sessionDialog.warningTextPrefix + countdownAtText + window.GOVUK.sessionDialog.warningTextSuffix + ' ' + window.GOVUK.sessionDialog.warningText;
252
250
  const extraText = '\n' + window.GOVUK.sessionDialog.warningTextExtra;
253
251
 
254
252
  $timer.html(text + ' ' + extraText);
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.0.0-timeout-warning-beta.3",
4
+ "version": "22.0.0-timeout-warning-beta.5",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
@@ -358,7 +358,6 @@ window.GOVUK.sessionDialog = {
358
358
  window.GOVUK.sessionDialog.makePageContentInert();
359
359
  window.GOVUK.sessionDialog.el.showModal();
360
360
  window.GOVUK.sessionDialog.el.open = true;
361
- console.log(window.GOVUK.sessionDialog.el)
362
361
  }
363
362
  },
364
363
 
@@ -367,7 +366,6 @@ window.GOVUK.sessionDialog = {
367
366
  $('html, body').removeClass(window.GOVUK.sessionDialog.dialogIsOpenClass);
368
367
  window.GOVUK.sessionDialog.el.close();
369
368
  window.GOVUK.sessionDialog.el.open = false;
370
- console.log(window.GOVUK.sessionDialog.el)
371
369
  window.GOVUK.sessionDialog.setFocusOnLastFocusedEl();
372
370
  window.GOVUK.sessionDialog.removeInertFromPageContent();
373
371
  window.GOVUK.sessionDialog.refreshSession();
@@ -461,24 +459,24 @@ window.GOVUK.sessionDialog = {
461
459
  ints[0] += 10;
462
460
  }
463
461
 
464
- /* Add scale word if chunk is not zero and array item exists */
465
- if ((word === scales[i])) {
466
- words.push(word);
462
+ /* Add scale word if chunk array item exists */
463
+ if (scales[i]) {
464
+ words.push(scales[i]);
467
465
  }
468
466
 
469
467
  /* Add unit word if array item exists */
470
- if ((word === units[ints[0]])) {
471
- words.push(word);
468
+ if (units[ints[0]]) {
469
+ words.push(units[ints[0]]);
472
470
  }
473
471
 
474
472
  /* Add tens word if array item exists */
475
- if ((word === tens[ints[1]])) {
476
- words.push(word);
473
+ if (word = tens[ints[1]]) {
474
+ words.push(tens[ints[1]]);
477
475
  }
478
476
 
479
477
  /* Add hundreds word if array item exists */
480
- if ((word === units[ints[2]])) {
481
- words.push(word + ' hundred');
478
+ if (units[ints[2]]) {
479
+ words.push(units[ints[2]] + ' hundred');
482
480
  }
483
481
  }
484
482
  }
@@ -535,13 +533,11 @@ window.GOVUK.sessionDialog = {
535
533
 
536
534
  (function countdown() {
537
535
  const secondsUntilSessionTimeout = window.GOVUK.sessionDialog.secondsUntilSessionTimeout();
538
- const timerExpired = secondsUntilSessionTimeout <= window.GOVUK.sessionDialog.secondsFinalWarning;
536
+ const timerExpired = secondsUntilSessionTimeout <= 0;
539
537
 
540
538
  if (!timerExpired) {
541
539
  const minutesLeft = parseInt(secondsUntilSessionTimeout / 60, 10);
542
540
  const secondsLeft = parseInt(secondsUntilSessionTimeout % 60, 10);
543
- const atMinutesText = window.GOVUK.sessionDialog.timeToWords(minutesLeft, 'minute');
544
- const atSecondsText = window.GOVUK.sessionDialog.timeToWords(secondsLeft, 'second');
545
541
 
546
542
  // Below string will get read out by screen readers every time
547
543
  // the timeout refreshes.
@@ -549,8 +545,8 @@ window.GOVUK.sessionDialog = {
549
545
  // first time the time out opens
550
546
  const countdownText = window.GOVUK.sessionDialog.countdownText(minutesLeft, secondsLeft);
551
547
  const text = window.GOVUK.sessionDialog.warningTextPrefix + '<strong>' + countdownText + '</strong>' + window.GOVUK.sessionDialog.warningTextSuffix;
552
- const countdownAtText = window.GOVUK.sessionDialog.countdownAtText(atMinutesText, atSecondsText);
553
- const atText = window.GOVUK.sessionDialog.warningTextPrefix + countdownAtText + window.GOVUK.sessionDialog.warningTextSuffix + 'bgbhj ' + window.GOVUK.sessionDialog.warningText;
548
+ const countdownAtText = window.GOVUK.sessionDialog.countdownAtText(minutesLeft, secondsLeft);
549
+ const atText = window.GOVUK.sessionDialog.warningTextPrefix + countdownAtText + window.GOVUK.sessionDialog.warningTextSuffix + ' ' + window.GOVUK.sessionDialog.warningText;
554
550
  const extraText = '\n' + window.GOVUK.sessionDialog.warningTextExtra;
555
551
 
556
552
  $timer.html(text + ' ' + extraText);