hof 21.0.0-instrumentation-beta.0 → 21.0.1-axios-beta

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.
Files changed (106) hide show
  1. package/.github/workflows/automate-publish.yml +1 -1
  2. package/.github/workflows/automate-tag.yml +4 -4
  3. package/.nyc_output/4fc007c9-d6c8-4614-89ce-04c7d6ce9fe5.json +1 -0
  4. package/.nyc_output/processinfo/4fc007c9-d6c8-4614-89ce-04c7d6ce9fe5.json +1 -0
  5. package/.nyc_output/processinfo/index.json +1 -1
  6. package/README.md +340 -256
  7. package/build/tasks/sass/index.js +3 -1
  8. package/build/tasks/watch/index.js +1 -1
  9. package/components/combine-and-loop-fields/Readme.md +42 -0
  10. package/components/combine-and-loop-fields/index.js +156 -0
  11. package/components/date/index.js +3 -1
  12. package/components/date/templates/date.html +15 -12
  13. package/components/homeoffice-countries/index.js +22 -0
  14. package/components/index.js +2 -0
  15. package/components/notify/notify.js +2 -2
  16. package/components/summary/index.js +3 -2
  17. package/config/builder-defaults.js +3 -1
  18. package/config/component-defaults.js +13 -0
  19. package/controller/controller.js +57 -1
  20. package/controller/formatting/formatters.js +12 -0
  21. package/controller/validation/index.js +2 -1
  22. package/controller/validation/validators.js +4 -0
  23. package/frontend/govuk-template/build/config.js +2 -2
  24. package/frontend/govuk-template/build/govuk_template.html +104 -0
  25. package/frontend/govuk-template/build/index.js +2 -2
  26. package/frontend/govuk-template/index.js +4 -4
  27. package/frontend/template-mixins/mixins/template-mixins.js +39 -11
  28. package/frontend/template-mixins/partials/forms/checkbox-group.html +47 -0
  29. package/frontend/template-mixins/partials/forms/checkbox.html +4 -4
  30. package/frontend/template-mixins/partials/forms/input-submit.html +1 -1
  31. package/frontend/template-mixins/partials/forms/input-text-date.html +37 -0
  32. package/frontend/template-mixins/partials/forms/input-text-group.html +15 -10
  33. package/frontend/template-mixins/partials/forms/option-group.html +42 -26
  34. package/frontend/template-mixins/partials/forms/select.html +10 -5
  35. package/frontend/template-mixins/partials/forms/textarea-group.html +37 -23
  36. package/frontend/template-mixins/partials/mixins/panel.html +3 -4
  37. package/frontend/template-partials/views/accessibility.html +4 -4
  38. package/frontend/template-partials/views/cookies.html +1 -1
  39. package/frontend/template-partials/views/layout.html +24 -17
  40. package/frontend/template-partials/views/partials/back.html +1 -1
  41. package/frontend/template-partials/views/partials/bullet-list.html +1 -1
  42. package/frontend/template-partials/views/partials/confirmation-alert.html +4 -3
  43. package/frontend/template-partials/views/partials/continue.html +1 -1
  44. package/frontend/template-partials/views/partials/cookie-banner.html +27 -24
  45. package/frontend/template-partials/views/partials/cookie-settings-radio.html +6 -6
  46. package/frontend/template-partials/views/partials/external-link.html +1 -1
  47. package/frontend/template-partials/views/partials/form.html +2 -1
  48. package/frontend/template-partials/views/partials/maincontent-left.html +4 -4
  49. package/frontend/template-partials/views/partials/navigation.html +7 -6
  50. package/frontend/template-partials/views/partials/session-cookies-table.html +6 -6
  51. package/frontend/template-partials/views/partials/summary-table-row.html +2 -2
  52. package/frontend/template-partials/views/partials/table.html +7 -7
  53. package/frontend/template-partials/views/partials/validation-list.html +2 -2
  54. package/frontend/template-partials/views/partials/validation-summary.html +14 -13
  55. package/frontend/template-partials/views/partials/warn.html +7 -0
  56. package/frontend/template-partials/views/session-timeout.html +3 -2
  57. package/frontend/themes/gov-uk/client-js/cookieSettings.js +1 -1
  58. package/frontend/themes/gov-uk/client-js/govuk-cookies.js +121 -0
  59. package/frontend/themes/gov-uk/client-js/index.js +6 -1
  60. package/frontend/themes/gov-uk/client-js/skip-to-main.js +19 -0
  61. package/frontend/themes/gov-uk/styles/_cookie-banner.scss +51 -1
  62. package/frontend/themes/gov-uk/styles/govuk.scss +4 -0
  63. package/frontend/themes/gov-uk/styles/modules/_validation.scss +5 -5
  64. package/frontend/toolkit/assets/javascript/character-count.js +4 -4
  65. package/frontend/toolkit/assets/javascript/progressive-reveal.js +3 -1
  66. package/frontend/toolkit/assets/javascript/validation.js +5 -1
  67. package/frontend/toolkit/assets/stylesheets/modules/_validation.scss +3 -3
  68. package/index.js +15 -2
  69. package/lib/ga-tag.js +1 -1
  70. package/lib/settings.js +18 -2
  71. package/middleware/errors.js +2 -3
  72. package/middleware/not-found.js +0 -3
  73. package/middleware/rate-limiter.js +1 -0
  74. package/model/apis/html-to-pdf-converter.js +9 -8
  75. package/model/index.js +27 -28
  76. package/package.json +16 -14
  77. package/sandbox/README.md +3 -3
  78. package/sandbox/apps/sandbox/fields.js +33 -11
  79. package/sandbox/apps/sandbox/index.js +4 -0
  80. package/sandbox/apps/sandbox/sections/summary-data-sections.js +3 -0
  81. package/sandbox/apps/sandbox/translations/en/default.json +224 -0
  82. package/sandbox/apps/sandbox/translations/src/en/fields.json +11 -4
  83. package/sandbox/apps/sandbox/translations/src/en/journey.json +4 -1
  84. package/sandbox/apps/sandbox/translations/src/en/pages.json +7 -25
  85. package/sandbox/apps/sandbox/translations/src/en/validation.json +5 -1
  86. package/sandbox/assets/js/index.js +1 -1
  87. package/sandbox/assets/scss/app.scss +16 -16
  88. package/sandbox/package.json +6 -1
  89. package/sandbox/public/css/app.css +2793 -0
  90. package/sandbox/public/images/icons/icon-caret-left.png +0 -0
  91. package/sandbox/public/images/icons/icon-complete.png +0 -0
  92. package/sandbox/public/images/icons/icon-cross-remove-sign.png +0 -0
  93. package/sandbox/public/js/bundle.js +32888 -0
  94. package/sandbox/server.js +2 -1
  95. package/sandbox/yarn.lock +243 -1
  96. package/wizard/index.js +0 -13
  97. package/wizard/middleware/check-progress.js +36 -1
  98. package/.nyc_output/4d5a4574-78fc-4fcb-9412-3658f6ce33ff.json +0 -1
  99. package/.nyc_output/processinfo/4d5a4574-78fc-4fcb-9412-3658f6ce33ff.json +0 -1
  100. package/frontend/govuk-template/govuk_template.html +0 -109
  101. package/frontend/themes/gov-uk/views/partials/form.html +0 -9
  102. package/frontend/themes/gov-uk/views/partials/forms/option-group.html +0 -28
  103. package/frontend/themes/gov-uk/views/partials/mixins/panel.html +0 -3
  104. package/frontend/themes/gov-uk/views/partials/validation-summary.html +0 -24
  105. package/middleware/monitor.js +0 -20
  106. package/sandbox/apps/sandbox/views/confirmation.html +0 -15
package/index.js CHANGED
@@ -78,8 +78,16 @@ const getContentSecurityPolicy = (config, res) => {
78
78
  styleSrc: ['www.googletagmanager.com', 'fonts.googleapis.com', 'tagmanager.google.com'],
79
79
  fontSrc: ['fonts.gstatic.com '],
80
80
  scriptSrc: ['www.google-analytics.com', 'ssl.google-analytics.com'],
81
- imgSrc: ['www.google-analytics.com', 'ssl.gstatic.com'],
82
- connectSrc: ['https://www.google-analytics.com', 'https://region1.google-analytics.com']
81
+ imgSrc: [
82
+ 'www.google-analytics.com',
83
+ 'ssl.gstatic.com',
84
+ 'www.google.co.uk/ads/ga-audiences'
85
+ ],
86
+ connectSrc: [
87
+ 'https://www.google-analytics.com',
88
+ 'https://region1.google-analytics.com',
89
+ 'https://region1.analytics.google.com'
90
+ ]
83
91
  };
84
92
 
85
93
  if (config.gaTagId) {
@@ -120,6 +128,8 @@ const getContentSecurityPolicy = (config, res) => {
120
128
  * @param options.getTerms {boolean} Optional boolean - whether to mount the /terms endpoint
121
129
  * @param options.getCookies {boolean} Optional boolean - whether to mount the /cookies endpoint
122
130
  * @param options.noCache {boolean} Optional boolean - whether to disable caching
131
+ * @param options.getAccessibilityStatement {boolean} Optional boolean - whether to mount the
132
+ * /accessibility-statement endpoint
123
133
  *
124
134
  * @returns {object} A new HOF application using the configuration supplied in options
125
135
  */
@@ -209,6 +219,9 @@ function bootstrap(options) {
209
219
  app.use(hofMiddleware.rateLimiter(config, 'requests'));
210
220
  }
211
221
 
222
+ // Set up routing so <YOUR-SITE-URL>/assets are served from /node_modules/govuk-frontend/govuk/assets
223
+ app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/govuk/assets')));
224
+
212
225
  if (config.getAccessibility === true) {
213
226
  deprecate(
214
227
  '`getAccessibility` option is deprecated and may be removed in future versions.',
package/lib/ga-tag.js CHANGED
@@ -45,7 +45,7 @@ module.exports = (app, config) => {
45
45
  const gaCrossDomainTrackingTagId = config.gaCrossDomainTrackingTagId;
46
46
  const routes = config.routes;
47
47
 
48
- if (gaTagId) {
48
+ if (gaTagId || ga4TagId) {
49
49
  const pageMap = setupPageMap(routes);
50
50
 
51
51
  app.use((req, res, next) => {
package/lib/settings.js CHANGED
@@ -7,7 +7,22 @@ const hoganExpressStrict = require('hogan-express-strict');
7
7
  const expressPartialTemplates = require('express-partial-templates');
8
8
  const bodyParser = require('body-parser');
9
9
 
10
- module.exports = (app, config) => {
10
+ const dirExists = dir => {
11
+ try {
12
+ if (fs.existsSync(dir)) {
13
+ return true;
14
+ }
15
+ return false;
16
+ } catch(err) {
17
+ throw new Error(`${err}: Cannot check if the directory path exists`);
18
+ }
19
+ };
20
+
21
+ const filterEmptyViews = views => {
22
+ return views.filter(view => dirExists(view));
23
+ };
24
+
25
+ module.exports = async (app, config) => {
11
26
  const viewEngine = config.viewEngine || 'html';
12
27
 
13
28
  app.use((req, res, next) => {
@@ -17,7 +32,8 @@ module.exports = (app, config) => {
17
32
 
18
33
  app.use(config.theme());
19
34
 
20
- const viewPaths = [].concat(config.theme.views);
35
+ const filteredViews = filterEmptyViews(config.theme.views);
36
+ const viewPaths = [].concat(filteredViews);
21
37
  app.set('view engine', viewEngine);
22
38
  app.enable('view cache');
23
39
 
@@ -2,7 +2,6 @@
2
2
  'use strict';
3
3
 
4
4
  const rateLimitsConfig = require('../config/rate-limits');
5
- const monitor = require('./monitor');
6
5
 
7
6
  const errorTitle = code => `${code}_ERROR`;
8
7
  const errorMsg = code => `There is a ${code}_ERROR`;
@@ -13,6 +12,8 @@ const getContent = (err, translate) => {
13
12
  if (err.code === 'SESSION_TIMEOUT') {
14
13
  err.status = 401;
15
14
  err.template = 'session-timeout';
15
+ err.title = (translate && translate('errors.session.title'));
16
+ err.message = (translate && translate('errors.session.message'));
16
17
  content.title = (translate && translate('errors.session.title'));
17
18
  content.message = (translate && translate('errors.session.message'));
18
19
  }
@@ -90,8 +91,6 @@ module.exports = options => {
90
91
  baseUrl: returnBaseUrl(req.path)
91
92
  };
92
93
 
93
- monitor(req, res, err.status);
94
-
95
94
  if (logger && logger.error) {
96
95
  logger.error(err.message || err.error, err);
97
96
  }
@@ -1,5 +1,4 @@
1
1
  'use strict';
2
- const monitor = require('./monitor');
3
2
 
4
3
  const getTranslations = translate => {
5
4
  const translations = {
@@ -27,8 +26,6 @@ module.exports = options => {
27
26
  logger.warn(`Cannot find: ${req.url}`);
28
27
  }
29
28
 
30
- monitor(req, res, '404');
31
-
32
29
  res.status(404).render('404', {
33
30
  title: translations.title,
34
31
  description: translations.description,
@@ -4,6 +4,7 @@ const redis = require('redis');
4
4
  const config = require('./../config/hof-defaults');
5
5
 
6
6
  module.exports = (options, rateLimitType) => {
7
+ // eslint-disable-next-line no-console
7
8
  const logger = options.logger || { log: (func, msg) => console[func](msg) };
8
9
  const rateLimits = options.rateLimits[rateLimitType];
9
10
  const timestampName = `${rateLimitType}TimeStamp`;
@@ -17,17 +17,18 @@ module.exports = class PDFModel extends Model {
17
17
  }
18
18
 
19
19
  handleResponse(response, callback) {
20
- if (isPdf(Buffer.from(response.body))) {
21
- return this.parseResponse(response.statusCode, response.body, callback);
20
+ if (isPdf(Buffer.from(response.data))) {
21
+ return this.parseResponse(response.status, response.data, callback);
22
22
  }
23
23
  const err = new Error();
24
- if (parseInt(response.statusCode, 10) === 400) {
25
- err.title = response.body.code;
26
- err.message = response.body.message;
24
+
25
+ if (parseInt(response.status, 10) === 400) {
26
+ err.title = response.status;
27
+ err.message = response.statusText;
27
28
  } else {
28
- err.body = response.body;
29
+ err.body = response.data;
29
30
  }
30
- err.status = response.statusCode;
31
- return callback(err, null, response.statusCode);
31
+ err.status = response.status;
32
+ return callback(err, null, response.status);
32
33
  }
33
34
  };
package/model/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  const _ = require('lodash');
5
- const request = require('request');
5
+ const axios = require('axios').default;
6
6
  const url = require('url');
7
7
  const EventEmitter = require('events').EventEmitter;
8
8
 
@@ -27,7 +27,7 @@ module.exports = class Model extends EventEmitter {
27
27
  this.set(attributes, {
28
28
  silent: true
29
29
  });
30
- this._request = request;
30
+ this._request = axios;
31
31
  }
32
32
 
33
33
  save(options, callback) {
@@ -47,7 +47,6 @@ module.exports = class Model extends EventEmitter {
47
47
  'Content-Type': 'application/json',
48
48
  'Content-Length': Buffer.byteLength(data)
49
49
  }, reqConf.headers || {});
50
-
51
50
  return this.request(reqConf, data, callback);
52
51
  });
53
52
  }
@@ -91,25 +90,26 @@ module.exports = class Model extends EventEmitter {
91
90
  callback = body;
92
91
  body = undefined;
93
92
  }
94
-
95
93
  let settings = Object.assign({}, originalSettings);
96
94
  settings.timeout = settings.timeout || this.options.timeout;
97
- settings.uri = settings.uri || settings.url || url.format(settings);
98
- settings.body = settings.body || body || settings.data;
99
-
100
- settings = _.omit(settings, urlKeys, 'data', 'url');
95
+ settings.url = settings.uri || settings.url || url.format(settings);
96
+ settings.data = settings.body || body || settings.data;
97
+ settings = _.omit(settings, urlKeys);
101
98
  this.emit('sync', originalSettings);
102
99
 
103
100
  const promise = Promise.resolve().then(() => this.auth()).then(authData => {
104
- settings.auth = authData;
105
- if (typeof settings.auth === 'string') {
106
- const auth = settings.auth.split(':');
107
- settings.auth = {
101
+ let authVal = authData;
102
+ if (typeof authVal === 'string') {
103
+ const auth = authVal.split(':');
104
+ authVal = {
108
105
  user: auth.shift(),
109
106
  pass: auth.join(':'),
110
107
  sendImmediately: true
111
108
  };
112
109
  }
110
+ if(authVal) {
111
+ settings.headers = Object.assign({}, settings.headers, {Authorization: `Bearer ${authVal.bearer}`});
112
+ }
113
113
  })
114
114
  .then(() => {
115
115
  const startTime = process.hrtime();
@@ -124,7 +124,6 @@ module.exports = class Model extends EventEmitter {
124
124
 
125
125
  const endTime = process.hrtime();
126
126
  const responseTime = timeDiff(startTime, endTime);
127
-
128
127
  if (err) {
129
128
  this.emit('fail', err, data, originalSettings, statusCode, responseTime);
130
129
  } else {
@@ -137,22 +136,22 @@ module.exports = class Model extends EventEmitter {
137
136
  }
138
137
  };
139
138
 
140
- this._request(settings, (err, response) => {
141
- if (err) {
139
+ this._request(settings)
140
+ .then(response => {
141
+ return this.handleResponse(response, (error, data, status) => {
142
+ if (error) {
143
+ error.headers = response.headers;
144
+ }
145
+ _callback(error, data, status);
146
+ });
147
+ }).catch(err => {
142
148
  if (err.code === 'ETIMEDOUT' || err.code === 'ESOCKETTIMEDOUT') {
143
149
  err.message = 'Connection timed out';
144
150
  err.status = 504;
145
151
  }
146
- err.status = err.status || (response && response.statusCode) || 503;
152
+ err.status = err.status || 503;
147
153
  return _callback(err, null, err.status);
148
- }
149
- return this.handleResponse(response, (error, data, status) => {
150
- if (error) {
151
- error.headers = response.headers;
152
- }
153
- _callback(error, data, status);
154
154
  });
155
- });
156
155
  });
157
156
  });
158
157
 
@@ -165,13 +164,13 @@ module.exports = class Model extends EventEmitter {
165
164
  handleResponse(response, callback) {
166
165
  let data = {};
167
166
  try {
168
- data = JSON.parse(response.body || '{}');
167
+ data = typeof response.data === 'object' ? response.data : JSON.parse(response.data || '{}');
169
168
  } catch (err) {
170
- err.status = response.statusCode;
171
- err.body = response.body;
172
- return callback(err, null, response.statusCode);
169
+ err.status = response.status;
170
+ err.body = response.data;
171
+ return callback(err, null, response.status);
173
172
  }
174
- return this.parseResponse(response.statusCode, data, callback);
173
+ return this.parseResponse(response.status, data, callback);
175
174
  }
176
175
 
177
176
  parseResponse(statusCode, data, callback) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hof",
3
3
  "description": "A bootstrap for HOF projects",
4
- "version": "21.0.0-instrumentation-beta.0",
4
+ "version": "21.0.1-axios-beta",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
@@ -23,19 +23,21 @@
23
23
  "scripts": {
24
24
  "test": "yarn run unit && yarn run test:cookie-banner && yarn run test:functional && yarn run test:client && yarn run test:lint",
25
25
  "unit": "LOG_LEVEL=error nyc _mocha \"test/**/*.spec.js\" \"sandbox/test/**/*.spec.js\"",
26
- "unit:nocov": "LOG_LEVEL=error mocha",
26
+ "unit:nocov": "LOG_LEVEL=error mocha \"test/**/*.spec.js\" \"sandbox/test/**/*.spec.js\"",
27
27
  "test:lint": "eslint . --config ./node_modules/eslint-config-hof/default.js",
28
- "test:functional": "funkie mocha ./test/functional-tests --exit",
28
+ "test:functional": "funkie mocha ./test/functional-tests --timeout 20000 --exit",
29
29
  "test:client": "karma start test/frontend/toolkit/karma.conf.js",
30
30
  "test:cookie-banner": "jest test/frontend/jest",
31
31
  "test:acceptance": "TAGS=\"${TAGS:=@feature}\" yarn run test:cucumber",
32
32
  "test:acceptance_browser": "ACCEPTANCE_WITH_BROWSER=true TAGS=\"${TAGS:=@feature}\" yarn run test:cucumber",
33
33
  "test:cucumber": "cucumber-js -f @cucumber/pretty-formatter \"sandbox/test/_features/**/*.feature\" --require sandbox/test/_features/test.setup.js --require \"sandbox/test/_features/step_definitions/**/*.js\" --tags $TAGS",
34
34
  "ci": "travis-conditions",
35
- "postversion": "git push && git push --tags"
35
+ "postversion": "git push && git push --tags",
36
+ "test-single":"mocha"
36
37
  },
37
38
  "dependencies": {
38
39
  "aliasify": "^2.1.0",
40
+ "axios": "^1.5.1",
39
41
  "bluebird": "^3.7.2",
40
42
  "body-parser": "^1.15.1",
41
43
  "browserify": "^17.0.0",
@@ -45,7 +47,7 @@
45
47
  "connect-redis": "^5.2.0",
46
48
  "cookie-parser": "^1.4.6",
47
49
  "cp": "^0.2.0",
48
- "csrf": "^3.0.2",
50
+ "csrf": "^3.1.0",
49
51
  "debug": "^4.3.1",
50
52
  "deprecate": "^1.0.0",
51
53
  "dotenv": "^4.0.0",
@@ -57,6 +59,7 @@
57
59
  "findup": "^0.1.5",
58
60
  "glob": "^7.2.0",
59
61
  "govuk-elements-sass": "^3.1.3",
62
+ "govuk-frontend": "3.14",
60
63
  "govuk_template_mustache": "^0.26.0",
61
64
  "helmet": "^3.22.0",
62
65
  "hogan-express-strict": "^0.5.4",
@@ -68,27 +71,26 @@
68
71
  "libphonenumber-js": "^1.9.37",
69
72
  "lodash": "^4.17.21",
70
73
  "markdown-it": "^12.3.2",
71
- "minimatch": "^3.0.3",
74
+ "minimatch": "^3.0.7",
72
75
  "minimist": "^1.2.6",
73
76
  "mixwith": "^0.1.1",
74
77
  "moment": "^2.29.4",
75
78
  "morgan": "^1.10.0",
76
- "mustache": "^2.3.0",
79
+ "mustache": "^4.2.0",
77
80
  "nodemailer": "^6.6.3",
78
- "nodemailer-ses-transport": "^1.5.0",
81
+ "nodemailer-ses-transport": "^1.5.1",
79
82
  "nodemailer-smtp-transport": "^2.7.4",
80
83
  "nodemailer-stub-transport": "^1.1.0",
81
- "notifications-node-client": "^5.1.1",
82
- "prom-client": "^14.0.1",
84
+ "notifications-node-client": "^6.0.0",
83
85
  "redis": "^3.1.2",
84
86
  "reqres": "^3.0.1",
85
- "request": "^2.79.0",
86
87
  "rimraf": "^3.0.2",
87
- "sass": "^1.35.2",
88
+ "sass": "^1.56.2",
88
89
  "serve-static": "^1.14.1",
89
90
  "uglify-js": "^3.14.3",
90
- "underscore": "^1.12.1",
91
+ "underscore": "^1.13.6",
91
92
  "urijs": "^1.19.11",
93
+ "uuid": "^8.3.2",
92
94
  "winston": "^3.7.2"
93
95
  },
94
96
  "devDependencies": {
@@ -134,7 +136,7 @@
134
136
  "reporter": "spec",
135
137
  "require": "test/common.js",
136
138
  "recursive": "true",
137
- "timeout": "6000",
139
+ "timeout": "9000",
138
140
  "exit": "true"
139
141
  },
140
142
  "resolutions": {
package/sandbox/README.md CHANGED
@@ -45,10 +45,10 @@ Install the dependencies
45
45
  yarn
46
46
  ```
47
47
 
48
- Move into the example folder
48
+ Move into the sandbox folder
49
49
 
50
50
  ```bash
51
- cd example
51
+ cd sandbox
52
52
  ```
53
53
 
54
54
  Install any example app specific dependencies
@@ -63,4 +63,4 @@ Run in development mode
63
63
  yarn start:dev
64
64
  ```
65
65
 
66
- go to http://localhost:8080/
66
+ go to http://localhost:8082/
@@ -8,16 +8,23 @@ module.exports = {
8
8
  'landing-page-radio': {
9
9
  mixin: 'radio-group',
10
10
  validate: ['required'],
11
- legend: {
12
- className: 'visuallyhidden'
13
- },
11
+ isPageHeading: true,
12
+ // Design system says to avoid in-line unless it's two options,
13
+ // so just added as an example below but by default it isn't
14
+ className: ['govuk-radios--inline'],
14
15
  options: ['basic-form', 'complex-form', 'build-your-own-form']
15
16
  },
16
17
  name: {
17
18
  validate: ['required', 'notUrl', { type: 'maxlength', arguments: 200 }],
18
19
  },
19
- dateOfBirth: dateComponent('dateOfBirth', {
20
- validate: ['required', 'before', { type: 'after', arguments: ['1900'] }]
20
+ 'dateOfBirth': dateComponent('dateOfBirth', {
21
+ mixin: 'input-date',
22
+ isPageHeading: 'true',
23
+ validate: [
24
+ 'required',
25
+ 'date',
26
+ { type: 'after', arguments: ['1900'] }
27
+ ]
21
28
  }),
22
29
  building: {
23
30
  validate: ['required', 'notUrl', { type: 'maxlength', arguments: 100 }]
@@ -37,6 +44,7 @@ module.exports = {
37
44
  formatter: ['removespaces', 'uppercase']
38
45
  },
39
46
  incomeTypes: {
47
+ isPageHeading: 'true',
40
48
  mixin: 'checkbox-group',
41
49
  labelClassName: 'visuallyhidden',
42
50
  validate: ['required'],
@@ -49,11 +57,9 @@ module.exports = {
49
57
  ]
50
58
  },
51
59
  countryOfHearing: {
60
+ isPageHeading: 'true',
52
61
  mixin: 'radio-group',
53
62
  validate: ['required'],
54
- legend: {
55
- className: 'visuallyhidden'
56
- },
57
63
  options: [
58
64
  'englandAndWales',
59
65
  'scotland',
@@ -72,6 +78,7 @@ module.exports = {
72
78
  },
73
79
  countrySelect: {
74
80
  mixin: 'select',
81
+ isPageHeading: 'true',
75
82
  className: ['typeahead'],
76
83
  options:[''].concat(require('homeoffice-countries').allCountries),
77
84
  legend: {
@@ -81,14 +88,29 @@ module.exports = {
81
88
  },
82
89
  complaintDetails: {
83
90
  mixin: 'textarea',
84
- labelClassName: 'visuallyhidden',
85
91
  // we want to ignore default formatters as we want
86
92
  // to preserve white space
87
93
  'ignore-defaults': true,
88
94
  // apply the other default formatters
89
95
  formatter: ['trim', 'hyphens'],
96
+ isPageHeading: 'true',
90
97
  // attributes here are passed to the field element
91
- validate: ['required', { type: 'maxlength', arguments: 5000 }],
98
+ validate: ['required', { type: 'maxlength', arguments: 10 }],
99
+ attributes: [{
100
+ attribute: 'rows',
101
+ value: 8
102
+ }]
103
+ },
104
+ whatHappened: {
105
+ mixin: 'textarea',
106
+ // we want to ignore default formatters as we want
107
+ // to preserve white space
108
+ 'ignore-defaults': true,
109
+ // apply the other default formatters
110
+ formatter: ['trim', 'hyphens'],
111
+ isPageHeading: 'true',
112
+ // attributes here are passed to the field element
113
+ validate: ['required', { type: 'maxword', arguments: 10 }],
92
114
  attributes: [{
93
115
  attribute: 'rows',
94
116
  value: 8
@@ -96,7 +118,7 @@ module.exports = {
96
118
  },
97
119
  appealStages: {
98
120
  mixin: 'select',
99
- labelClassName: 'visuallyhidden',
121
+ isPageHeading: 'true',
100
122
  validate: ['required'],
101
123
  options: [{
102
124
  value: '',
@@ -66,6 +66,10 @@ module.exports = {
66
66
  },
67
67
  '/text-input-area': {
68
68
  fields: ['complaintDetails'],
69
+ next: '/word-count'
70
+ },
71
+ '/word-count': {
72
+ fields: ['whatHappened'],
69
73
  next: '/select'
70
74
  },
71
75
  '/select':{
@@ -36,5 +36,8 @@ module.exports = {
36
36
  ],
37
37
  complaintDetails: [
38
38
  'complaintDetails'
39
+ ],
40
+ whatHappened: [
41
+ 'whatHappened'
39
42
  ]
40
43
  };