hof 22.7.0-service-paused-beta.7 → 22.7.0-service-paused-beta.9

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.
@@ -4,14 +4,11 @@
4
4
  {{/journeyHeader}}
5
5
 
6
6
  {{$propositionHeader}}
7
- {{> partials-navigation}}
7
+ {{> partials-navigation}}
8
8
  {{/propositionHeader}}
9
9
 
10
- {{$header}}
11
- {{title}}
12
- {{/header}}
13
10
  {{$content}}
14
- <h1 class="govuk-heading-l">{{{title}}}</h1>
11
+ <h1 class="govuk-heading-l">{{title}}</h1>
15
12
  <p class="govuk-body">{{message}}</p>
16
13
  <p class="govuk-body">{{answers-saved}}</p>
17
14
  {{#contact}}
@@ -2,7 +2,6 @@
2
2
  'use strict';
3
3
 
4
4
  const rateLimitsConfig = require('../config/rate-limits');
5
- const hofDefaultsConfig = require('../config/hof-defaults');
6
5
 
7
6
  const errorTitle = code => `${code}_ERROR`;
8
7
  const errorMsg = code => `There is a ${code}_ERROR`;
@@ -56,21 +55,6 @@ const getContent = (err, translate) => {
56
55
  content.postTimeToWait = (translate && translate('errors.submission-rate-limit.post-time-to-wait'));
57
56
  }
58
57
 
59
- // if (hofDefaultsConfig.servicePaused === true || hofDefaultsConfig.servicePaused === 'true') {
60
- // console.log('hello')
61
- // // if(err.code === 'SERVICE_PAUSED'){
62
- // err.status = 503;
63
- // err.template = 'service-paused';
64
- // err.title = (translate && translate('errors.service-paused.title'));
65
- // err.message = (translate && translate('errors.service-paused.message'));
66
- // err['answers-saved'] = (translate && translate('errors.service-paused.answers-saved'));
67
- // err.contact = (translate && translate('errors.service-paused.contact'));
68
- // content.title = (translate && translate('errors.service-paused.title'));
69
- // content.message = (translate && translate('errors.service-paused.message'));
70
- // content['answers-saved'] = (translate && translate('errors.service-paused.answers-saved'));
71
- // content.contact = (translate && translate('errors.service-paused.contact'));
72
- // }
73
-
74
58
  err.code = err.code || 'UNKNOWN';
75
59
  err.status = err.status || 500;
76
60
 
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const config = require('../config/hof-defaults');
4
3
  const getTranslations = translate => {
5
4
  const translations = {
5
+ serviceName: translate('journey.serviceName') || translate('journey.header'),
6
6
  title: 'Sorry, this service is unavailable',
7
7
  message: 'This service is temporarily unavailable',
8
8
  'answers-saved': 'Your answers have not been saved'
@@ -42,6 +42,7 @@ module.exports = options => {
42
42
  logger.warn(`Service paused.`);
43
43
  }
44
44
  res.status(503).render('service-paused', {
45
+ serviceName: translations.serviceName,
45
46
  title: translations.title,
46
47
  message: translations.message,
47
48
  '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.7",
4
+ "version": "22.7.0-service-paused-beta.9",
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
  }
package/sandbox/server.js CHANGED
@@ -9,8 +9,7 @@ bootstrap({
9
9
  require('./apps/sandbox')
10
10
  ],
11
11
  behaviours: [
12
- require('../').components.sessionTimeoutWarning,
13
- // require('../').components.servicePaused,
12
+ require('../').components.sessionTimeoutWarning
14
13
  ],
15
14
  rateLimits: {
16
15
  requests: {
@@ -1,26 +0,0 @@
1
- # Service Paused Behaviour
2
-
3
- ## What this does
4
- 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.
5
-
6
- ## Implementation
7
- - Add the behaviour to the hof-settings.json file of the service
8
- - Set the `SERVICE_PAUSED` env to `true`
9
-
10
- ## Page Content Customisation
11
- There is default text for this page. Default text can be overridden by setting the `message` and `answers-saved` properties in the pages.json 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 pages.json:
12
-
13
- ```json
14
- "message": {
15
- "message": "This service will be unavailble for a week."
16
- },
17
- "answers-saved": {
18
- "message": "Your information has not been saved."
19
- },
20
- "contact": {
21
- "message": "You can contact test@test.com for more information"
22
- },
23
- "alternative": {
24
- "message": "You can access the www.test.com website instead"
25
- },
26
- ```
@@ -1,47 +0,0 @@
1
- // /**
2
- // *
3
- // * @fileOverview
4
- // * Provides custom behavior for rendering a service down template when a service needs to be temporarily paused. This includes
5
- // * - Redirecting the user to a 'service down' page
6
- // * - Setting custom content and titles on the service down page.
7
- // *
8
- // * @module servicePausedBehaviour
9
- // * @requires ../../config/hof-defaults
10
- // * @param {Class} superclass - The class to be extended.
11
- // * @returns {Class} - The extended class with service down handling functionality.
12
- // */
13
-
14
- // 'use strict';
15
-
16
- // const config = require('../../config/hof-defaults');
17
- // const logger = require('../../lib/logger')(config);
18
-
19
- // module.exports = superclass => class extends superclass {
20
- // getValues(req, res, callback) {
21
- // return super.getValues(req, res, (err, values) => {
22
- // if (err) {
23
- // logger.error(`Error getting values: ${err}`);
24
- // return callback(err, values);
25
- // }
26
- // if (config.servicePaused === true || config.servicePaused === 'true') {
27
- // logger.info(`Service is paused. Redirecting...`);
28
- // return res.redirect('/service-paused');
29
- // }
30
- // return callback(null, values);
31
- // });
32
- // }
33
- // locals(req, res) {
34
- // // set default service unavailable message
35
- // const superLocals = super.locals(req, res);
36
- // if (config.servicePaused === true || config.servicePaused === 'true') {
37
- // superLocals.header = req.translate('pages.service-paused.header');
38
- // superLocals.title = req.translate('pages.service-paused.title');
39
- // superLocals.message = req.translate('pages.service-paused.message');
40
- // superLocals['answers-saved'] = req.translate('pages.service-paused.answers-saved');
41
- // superLocals.contact = req.translate('pages.service-paused.contact');
42
- // superLocals.alternative = req.translate('pages.service-paused.alternative');
43
- // return superLocals;
44
- // }
45
- // return superLocals;
46
- // }
47
- // };