hof 22.7.0-service-paused-beta.6 → 22.7.0-service-paused-beta.8

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 CHANGED
@@ -1,9 +1,9 @@
1
1
  ## 2025-05-14, Version 22.7.0 (Stable), @Rhodine-orleans-lindsay
2
2
  ### Added
3
3
  - Service paused funtionality that allows for services to redirect to a 'Service Unavailable' when there is a need to pause a service.
4
- - Includes service paused component
5
- - default service paused html view
6
- - Flag to set service paused config to true or false in order to run component
4
+ - Adds 'service paused' error middleware
5
+ - Includes default service paused html view
6
+ - Includes flag to set service paused config to true or false in order to enable page
7
7
  ### Security
8
8
  - Updates patch and minor dependencies
9
9
 
package/README.md CHANGED
@@ -805,7 +805,7 @@ const pdfData = await pdfModel.save();
805
805
 
806
806
  # HOF Middleware
807
807
 
808
- A collection of commonly used HOF middleware, exports `cookies`, `notFound`, and `errors` on `middleware`
808
+ A collection of commonly used HOF middleware, exports `cookies`, `notFound`, `servicePaused` and `errors` on `middleware`
809
809
 
810
810
  ## Arranging the middleware in your app
811
811
 
@@ -844,6 +844,26 @@ You can also provide an array of healthcheck URLs with `healthcheckUrls`,
844
844
  should you not want to throw a Cookies required error when requesting the app with specific URLs.
845
845
  Kubernetes healthcheck URLs are provided as defaults if no overrides are supplied.
846
846
 
847
+ ## Service Unavailable (Service Paused)
848
+ Allows a service to be paused when required and then resumed. It ensures that anyone using the service that lands on any part of the form is diverted to a "Service Unavailable" page which will communicate to the user that the service is not available at this time.
849
+
850
+ ### Usage
851
+ - Set the `SERVICE_PAUSED` env to `true` in your service.
852
+
853
+ ### Page Content Customisation
854
+ There is default text for this page. Default text can be overridden by setting the `message` and `answers-saved` properties in the `errors.json` file of the service. Note that information relating to who to contact and alternatives to using the form is optional and so there is no default text for these unless the properties `contact` and `alternative` are set in errors.json:
855
+
856
+ ```json
857
+ {
858
+ "service-paused" : {
859
+ "message": "This service will be unavailble for a week.",
860
+ "answers-saved": "Your answers have not been saved.",
861
+ "contact": "You can contact test@test.com for more information",
862
+ "alternative": "You can access the www.test.com website instead"
863
+ }
864
+ }
865
+ ```
866
+
847
867
  ## Not found (404)
848
868
 
849
869
  Expects there to be a view called 404 in your configured `/views` directory
@@ -1,9 +1,14 @@
1
1
  {{<layout}}
2
- {{$header}}
3
- {{title}}
4
- {{/header}}
2
+ {{$journeyHeader}}
3
+ {{#t}}journey.header{{/t}}
4
+ {{/journeyHeader}}
5
+
6
+ {{$propositionHeader}}
7
+ {{> partials-navigation}}
8
+ {{/propositionHeader}}
9
+
5
10
  {{$content}}
6
- <h1 class="govuk-heading-l">{{{title}}}</h1>
11
+ <h1 class="govuk-heading-l">{{title}}</h1>
7
12
  <p class="govuk-body">{{message}}</p>
8
13
  <p class="govuk-body">{{answers-saved}}</p>
9
14
  {{#contact}}
@@ -3,6 +3,7 @@
3
3
  const config = require('../config/hof-defaults');
4
4
  const getTranslations = translate => {
5
5
  const translations = {
6
+ serviceName: translate('journey.serviceName') || translate('journey.header'),
6
7
  title: 'Sorry, this service is unavailable',
7
8
  message: 'This service is temporarily unavailable',
8
9
  'answers-saved': 'Your answers have not been saved'
@@ -42,6 +43,7 @@ module.exports = options => {
42
43
  logger.warn(`Service paused.`);
43
44
  }
44
45
  res.status(503).render('service-paused', {
46
+ serviceName: translations.serviceName,
45
47
  title: translations.title,
46
48
  message: translations.message,
47
49
  'answers-saved': translations['answers-saved'],
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.7.0-service-paused-beta.6",
4
+ "version": "22.7.0-service-paused-beta.8",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
@@ -111,6 +111,7 @@
111
111
  },
112
112
  "journey": {
113
113
  "header": "HOF Bootstrap Sandbox Form",
114
+ "serviceName": "HOF Bootstrap Sandbox Form",
114
115
  "confirmation": {
115
116
  "details": "Your reference number <br><strong>HDJ2123F</strong>"
116
117
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "header": "HOF Bootstrap Sandbox Form",
3
+ "serviceName": "HOF Bootstrap Sandbox Form",
3
4
  "confirmation": {
4
5
  "details": "Your reference number <br><strong>HDJ2123F</strong>"
5
6
  }