hof 22.0.0-timeout-warning-beta.4 → 22.0.0-timeout-warning-beta.6
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.
- package/CHANGELOG.md +6 -0
- package/config/hof-defaults.js +2 -2
- package/frontend/template-partials/views/partials/session-timeout-warning.html +1 -0
- package/frontend/themes/gov-uk/client-js/session-timeout-dialog.js +11 -14
- package/frontend/themes/gov-uk/styles/_session-timeout-dialog.scss +1 -1
- package/package.json +1 -1
- package/sandbox/public/css/app.css +8 -8
- package/sandbox/public/js/bundle.js +11 -13
    
        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
         | 
    
        package/config/hof-defaults.js
    CHANGED
    
    | @@ -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 ||  | 
| 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,7 +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 ||  | 
| 50 | 
            +
              sessionTimeOutWarning: process.env.SESSION_TIMEOUT_WARNING || 60
         | 
| 51 51 | 
             
            };
         | 
| 52 52 |  | 
| 53 53 | 
             
            module.exports = Object.assign({}, defaults, rateLimits);
         | 
| @@ -13,5 +13,6 @@ data-url-redirect="/session-timeout" class="modal-dialog dialog" role="dialog" | |
| 13 13 | 
             
                <div class="modal-dialog__inner__block">
         | 
| 14 14 | 
             
                  <button class="govuk-button dialog-button modal-dialog__inner__button js-dialog-close" id="timeout-continue-button">Stay on this page</button>
         | 
| 15 15 | 
             
                </div>
         | 
| 16 | 
            +
                <a href="/" class="govuk-link dialog-exit-link" role="button">Leave this form</a>
         | 
| 16 17 | 
             
              </div>
         | 
| 17 18 | 
             
            </dialog>
         | 
| @@ -115,7 +115,6 @@ window.GOVUK.sessionDialog = { | |
| 115 115 | 
             
                let chunk;
         | 
| 116 116 | 
             
                let ints;
         | 
| 117 117 | 
             
                let i;
         | 
| 118 | 
            -
                let word;
         | 
| 119 118 | 
             
                let words = 'and';
         | 
| 120 119 |  | 
| 121 120 | 
             
                if (parseInt(string, 10) === 0) {
         | 
| @@ -159,24 +158,24 @@ window.GOVUK.sessionDialog = { | |
| 159 158 | 
             
                      ints[0] += 10;
         | 
| 160 159 | 
             
                    }
         | 
| 161 160 |  | 
| 162 | 
            -
                    /* Add scale word if chunk  | 
| 163 | 
            -
                    if ( | 
| 164 | 
            -
                      words.push( | 
| 161 | 
            +
                    /* Add scale word if chunk array item exists */
         | 
| 162 | 
            +
                    if (scales[i]) {
         | 
| 163 | 
            +
                      words.push(scales[i]);
         | 
| 165 164 | 
             
                    }
         | 
| 166 165 |  | 
| 167 166 | 
             
                    /* Add unit word if array item exists */
         | 
| 168 | 
            -
                    if ( | 
| 169 | 
            -
                      words.push( | 
| 167 | 
            +
                    if (units[ints[0]]) {
         | 
| 168 | 
            +
                      words.push(units[ints[0]]);
         | 
| 170 169 | 
             
                    }
         | 
| 171 170 |  | 
| 172 171 | 
             
                    /* Add tens word if array item exists */
         | 
| 173 | 
            -
                    if ( | 
| 174 | 
            -
                      words.push( | 
| 172 | 
            +
                    if (tens[ints[1]]) {
         | 
| 173 | 
            +
                      words.push(tens[ints[1]]);
         | 
| 175 174 | 
             
                    }
         | 
| 176 175 |  | 
| 177 176 | 
             
                    /* Add hundreds word if array item exists */
         | 
| 178 | 
            -
                    if ( | 
| 179 | 
            -
                      words.push( | 
| 177 | 
            +
                    if (units[ints[2]]) {
         | 
| 178 | 
            +
                      words.push(units[ints[2]] + ' hundred');
         | 
| 180 179 | 
             
                    }
         | 
| 181 180 | 
             
                  }
         | 
| 182 181 | 
             
                }
         | 
| @@ -238,8 +237,6 @@ window.GOVUK.sessionDialog = { | |
| 238 237 | 
             
                  if (!timerExpired) {
         | 
| 239 238 | 
             
                    const minutesLeft = parseInt(secondsUntilSessionTimeout / 60, 10);
         | 
| 240 239 | 
             
                    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 240 |  | 
| 244 241 | 
             
                    // Below string will get read out by screen readers every time
         | 
| 245 242 | 
             
                    // the timeout refreshes.
         | 
| @@ -247,8 +244,8 @@ window.GOVUK.sessionDialog = { | |
| 247 244 | 
             
                    // first time the time out opens
         | 
| 248 245 | 
             
                    const countdownText = window.GOVUK.sessionDialog.countdownText(minutesLeft, secondsLeft);
         | 
| 249 246 | 
             
                    const text = window.GOVUK.sessionDialog.warningTextPrefix + '<strong>' + countdownText + '</strong>' + window.GOVUK.sessionDialog.warningTextSuffix;
         | 
| 250 | 
            -
                    const countdownAtText = window.GOVUK.sessionDialog.countdownAtText( | 
| 251 | 
            -
                    const atText = window.GOVUK.sessionDialog.warningTextPrefix + countdownAtText + window.GOVUK.sessionDialog.warningTextSuffix + ' | 
| 247 | 
            +
                    const countdownAtText = window.GOVUK.sessionDialog.countdownAtText(minutesLeft, secondsLeft);
         | 
| 248 | 
            +
                    const atText = window.GOVUK.sessionDialog.warningTextPrefix + countdownAtText + window.GOVUK.sessionDialog.warningTextSuffix + ' ' + window.GOVUK.sessionDialog.warningText;
         | 
| 252 249 | 
             
                    const extraText = '\n' + window.GOVUK.sessionDialog.warningTextExtra;
         | 
| 253 250 |  | 
| 254 251 | 
             
                    $timer.html(text + ' ' + extraText);
         | 
    
        package/package.json
    CHANGED
    
    
| @@ -9351,7 +9351,7 @@ dialog[open] + .backdrop, dialog[open]::backdrop { | |
| 9351 9351 | 
             
              font-family: "ntatabularnumbers", "nta", Arial, sans-serif;
         | 
| 9352 9352 | 
             
            }
         | 
| 9353 9353 |  | 
| 9354 | 
            -
            .dialog- | 
| 9354 | 
            +
            .dialog-exit-link {
         | 
| 9355 9355 | 
             
              font-family: "GDS Transport", arial, sans-serif;
         | 
| 9356 9356 | 
             
              -webkit-font-smoothing: antialiased;
         | 
| 9357 9357 | 
             
              -moz-osx-font-smoothing: grayscale;
         | 
| @@ -9363,25 +9363,25 @@ dialog[open] + .backdrop, dialog[open]::backdrop { | |
| 9363 9363 | 
             
              margin: 5px;
         | 
| 9364 9364 | 
             
            }
         | 
| 9365 9365 | 
             
            @media print {
         | 
| 9366 | 
            -
              .dialog- | 
| 9366 | 
            +
              .dialog-exit-link {
         | 
| 9367 9367 | 
             
                font-family: sans-serif;
         | 
| 9368 9368 | 
             
              }
         | 
| 9369 9369 | 
             
            }
         | 
| 9370 9370 | 
             
            @media (min-width: 40.0625em) {
         | 
| 9371 | 
            -
              .dialog- | 
| 9371 | 
            +
              .dialog-exit-link {
         | 
| 9372 9372 | 
             
                font-size: 24px;
         | 
| 9373 9373 | 
             
                font-size: 1.5rem;
         | 
| 9374 9374 | 
             
                line-height: 1.25;
         | 
| 9375 9375 | 
             
              }
         | 
| 9376 9376 | 
             
            }
         | 
| 9377 9377 | 
             
            @media print {
         | 
| 9378 | 
            -
              .dialog- | 
| 9378 | 
            +
              .dialog-exit-link {
         | 
| 9379 9379 | 
             
                font-size: 18pt;
         | 
| 9380 9380 | 
             
                line-height: 1.15;
         | 
| 9381 9381 | 
             
              }
         | 
| 9382 9382 | 
             
            }
         | 
| 9383 9383 | 
             
            @media (min-width: 40.0625em) {
         | 
| 9384 | 
            -
              .dialog- | 
| 9384 | 
            +
              .dialog-exit-link {
         | 
| 9385 9385 | 
             
                font-family: "GDS Transport", arial, sans-serif;
         | 
| 9386 9386 | 
             
                -webkit-font-smoothing: antialiased;
         | 
| 9387 9387 | 
             
                -moz-osx-font-smoothing: grayscale;
         | 
| @@ -9396,19 +9396,19 @@ dialog[open] + .backdrop, dialog[open]::backdrop { | |
| 9396 9396 | 
             
              }
         | 
| 9397 9397 | 
             
            }
         | 
| 9398 9398 | 
             
            @media print and (min-width: 40.0625em) {
         | 
| 9399 | 
            -
              .dialog- | 
| 9399 | 
            +
              .dialog-exit-link {
         | 
| 9400 9400 | 
             
                font-family: sans-serif;
         | 
| 9401 9401 | 
             
              }
         | 
| 9402 9402 | 
             
            }
         | 
| 9403 9403 | 
             
            @media (min-width: 40.0625em) and (min-width: 40.0625em) {
         | 
| 9404 | 
            -
              .dialog- | 
| 9404 | 
            +
              .dialog-exit-link {
         | 
| 9405 9405 | 
             
                font-size: 19px;
         | 
| 9406 9406 | 
             
                font-size: 1.1875rem;
         | 
| 9407 9407 | 
             
                line-height: 1.3157894737;
         | 
| 9408 9408 | 
             
              }
         | 
| 9409 9409 | 
             
            }
         | 
| 9410 9410 | 
             
            @media print and (min-width: 40.0625em) {
         | 
| 9411 | 
            -
              .dialog- | 
| 9411 | 
            +
              .dialog-exit-link {
         | 
| 9412 9412 | 
             
                font-size: 14pt;
         | 
| 9413 9413 | 
             
                line-height: 1.15;
         | 
| 9414 9414 | 
             
              }
         | 
| @@ -459,24 +459,24 @@ window.GOVUK.sessionDialog = { | |
| 459 459 | 
             
                      ints[0] += 10;
         | 
| 460 460 | 
             
                    }
         | 
| 461 461 |  | 
| 462 | 
            -
                    /* Add scale word if chunk  | 
| 463 | 
            -
                    if ( | 
| 464 | 
            -
                      words.push( | 
| 462 | 
            +
                    /* Add scale word if chunk array item exists */
         | 
| 463 | 
            +
                    if (scales[i]) {
         | 
| 464 | 
            +
                      words.push(scales[i]);
         | 
| 465 465 | 
             
                    }
         | 
| 466 466 |  | 
| 467 467 | 
             
                    /* Add unit word if array item exists */
         | 
| 468 | 
            -
                    if ( | 
| 469 | 
            -
                      words.push( | 
| 468 | 
            +
                    if (units[ints[0]]) {
         | 
| 469 | 
            +
                      words.push(units[ints[0]]);
         | 
| 470 470 | 
             
                    }
         | 
| 471 471 |  | 
| 472 472 | 
             
                    /* Add tens word if array item exists */
         | 
| 473 | 
            -
                    if ( | 
| 474 | 
            -
                      words.push( | 
| 473 | 
            +
                    if (word = tens[ints[1]]) {
         | 
| 474 | 
            +
                      words.push(tens[ints[1]]);
         | 
| 475 475 | 
             
                    }
         | 
| 476 476 |  | 
| 477 477 | 
             
                    /* Add hundreds word if array item exists */
         | 
| 478 | 
            -
                    if ( | 
| 479 | 
            -
                      words.push( | 
| 478 | 
            +
                    if (units[ints[2]]) {
         | 
| 479 | 
            +
                      words.push(units[ints[2]] + ' hundred');
         | 
| 480 480 | 
             
                    }
         | 
| 481 481 | 
             
                  }
         | 
| 482 482 | 
             
                }
         | 
| @@ -538,8 +538,6 @@ window.GOVUK.sessionDialog = { | |
| 538 538 | 
             
                  if (!timerExpired) {
         | 
| 539 539 | 
             
                    const minutesLeft = parseInt(secondsUntilSessionTimeout / 60, 10);
         | 
| 540 540 | 
             
                    const secondsLeft = parseInt(secondsUntilSessionTimeout % 60, 10);
         | 
| 541 | 
            -
                    const atMinutesText = window.GOVUK.sessionDialog.timeToWords(minutesLeft, 'minute');
         | 
| 542 | 
            -
                    const atSecondsText = window.GOVUK.sessionDialog.timeToWords(secondsLeft, 'second');
         | 
| 543 541 |  | 
| 544 542 | 
             
                    // Below string will get read out by screen readers every time
         | 
| 545 543 | 
             
                    // the timeout refreshes.
         | 
| @@ -547,8 +545,8 @@ window.GOVUK.sessionDialog = { | |
| 547 545 | 
             
                    // first time the time out opens
         | 
| 548 546 | 
             
                    const countdownText = window.GOVUK.sessionDialog.countdownText(minutesLeft, secondsLeft);
         | 
| 549 547 | 
             
                    const text = window.GOVUK.sessionDialog.warningTextPrefix + '<strong>' + countdownText + '</strong>' + window.GOVUK.sessionDialog.warningTextSuffix;
         | 
| 550 | 
            -
                    const countdownAtText = window.GOVUK.sessionDialog.countdownAtText( | 
| 551 | 
            -
                    const atText = window.GOVUK.sessionDialog.warningTextPrefix + countdownAtText + window.GOVUK.sessionDialog.warningTextSuffix + ' | 
| 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;
         | 
| 552 550 | 
             
                    const extraText = '\n' + window.GOVUK.sessionDialog.warningTextExtra;
         | 
| 553 551 |  | 
| 554 552 | 
             
                    $timer.html(text + ' ' + extraText);
         |