hof 22.9.0-beta → 22.9.0-beta.v2

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 (313) hide show
  1. package/package.json +1 -1
  2. package/hof-22.9.0.tgz +0 -0
  3. package/package/.eslintignore +0 -1
  4. package/package/CHANGELOG.md +0 -232
  5. package/package/LICENSE +0 -21
  6. package/package/README.md +0 -1887
  7. package/package/bin/hof-build +0 -10
  8. package/package/bin/hof-transpiler +0 -12
  9. package/package/build/helpers/importer.js +0 -29
  10. package/package/build/helpers/local.js +0 -35
  11. package/package/build/helpers/resolver/import.js +0 -32
  12. package/package/build/helpers/resolver/nearest-package-root.js +0 -33
  13. package/package/build/helpers/resolver/package.js +0 -29
  14. package/package/build/helpers/resolver.js +0 -16
  15. package/package/build/index.js +0 -49
  16. package/package/build/lib/env.js +0 -36
  17. package/package/build/lib/mkdir.js +0 -9
  18. package/package/build/lib/run.js +0 -17
  19. package/package/build/lib/spawn.js +0 -18
  20. package/package/build/tasks/browserify/compress.js +0 -15
  21. package/package/build/tasks/browserify/index.js +0 -48
  22. package/package/build/tasks/build/index.js +0 -6
  23. package/package/build/tasks/images/index.js +0 -27
  24. package/package/build/tasks/index.js +0 -8
  25. package/package/build/tasks/sass/index.js +0 -67
  26. package/package/build/tasks/translate/index.js +0 -20
  27. package/package/build/tasks/watch/index.js +0 -161
  28. package/package/components/address-lookup/default-model.js +0 -76
  29. package/package/components/address-lookup/defaults.js +0 -25
  30. package/package/components/address-lookup/index.js +0 -251
  31. package/package/components/address-lookup/templates/address-lookup.html +0 -14
  32. package/package/components/address-lookup/templates/address.html +0 -22
  33. package/package/components/address-lookup/templates/postcode.html +0 -9
  34. package/package/components/clear-session/Readme.md +0 -46
  35. package/package/components/clear-session/index.js +0 -26
  36. package/package/components/combine-and-loop-fields/Readme.md +0 -42
  37. package/package/components/combine-and-loop-fields/index.js +0 -156
  38. package/package/components/date/fields.js +0 -16
  39. package/package/components/date/index.js +0 -172
  40. package/package/components/date/templates/date.html +0 -20
  41. package/package/components/emailer/assets/images/govuk_logotype_email.png +0 -0
  42. package/package/components/emailer/assets/images/ho_crest_27px.png +0 -0
  43. package/package/components/emailer/assets/images/spacer.gif +0 -0
  44. package/package/components/emailer/email-service.js +0 -51
  45. package/package/components/emailer/emailer.js +0 -53
  46. package/package/components/emailer/index.js +0 -74
  47. package/package/components/emailer/transports/debug.js +0 -74
  48. package/package/components/emailer/transports/index.js +0 -8
  49. package/package/components/emailer/transports/ses.js +0 -36
  50. package/package/components/emailer/transports/smtp.js +0 -26
  51. package/package/components/emailer/transports/stub.js +0 -5
  52. package/package/components/emailer/views/layout.html +0 -63
  53. package/package/components/homeoffice-countries/index.js +0 -22
  54. package/package/components/index.js +0 -13
  55. package/package/components/notify/index.js +0 -62
  56. package/package/components/notify/notify.js +0 -51
  57. package/package/components/session-timeout-warning/index.js +0 -67
  58. package/package/components/summary/index.js +0 -237
  59. package/package/config/builder-defaults.js +0 -45
  60. package/package/config/component-defaults.js +0 -13
  61. package/package/config/hof-defaults.js +0 -65
  62. package/package/config/rate-limits.js +0 -20
  63. package/package/config/sanitisation-rules.js +0 -32
  64. package/package/controller/base-controller.js +0 -296
  65. package/package/controller/behaviour-hooks.js +0 -51
  66. package/package/controller/behaviour-session.js +0 -64
  67. package/package/controller/controller.js +0 -258
  68. package/package/controller/deprecate-error.js +0 -10
  69. package/package/controller/formatting/formatters.js +0 -70
  70. package/package/controller/formatting/index.js +0 -32
  71. package/package/controller/index.js +0 -17
  72. package/package/controller/validation/email.js +0 -30
  73. package/package/controller/validation/index.js +0 -101
  74. package/package/controller/validation/validators.js +0 -181
  75. package/package/controller/validation-error.js +0 -14
  76. package/package/frontend/govuk-template/build/config.js +0 -24
  77. package/package/frontend/govuk-template/build/govuk_template.html +0 -102
  78. package/package/frontend/govuk-template/build/index.js +0 -23
  79. package/package/frontend/govuk-template/govuk_template_generated.html +0 -102
  80. package/package/frontend/govuk-template/index.js +0 -29
  81. package/package/frontend/index.js +0 -9
  82. package/package/frontend/template-mixins/mixins/helpers.js +0 -103
  83. package/package/frontend/template-mixins/mixins/index.js +0 -37
  84. package/package/frontend/template-mixins/mixins/render.js +0 -12
  85. package/package/frontend/template-mixins/mixins/template-mixins.js +0 -520
  86. package/package/frontend/template-mixins/partials/forms/checkbox-group.html +0 -47
  87. package/package/frontend/template-mixins/partials/forms/checkbox.html +0 -16
  88. package/package/frontend/template-mixins/partials/forms/input-submit.html +0 -1
  89. package/package/frontend/template-mixins/partials/forms/input-text-date.html +0 -37
  90. package/package/frontend/template-mixins/partials/forms/input-text-group.html +0 -45
  91. package/package/frontend/template-mixins/partials/forms/option-group.html +0 -43
  92. package/package/frontend/template-mixins/partials/forms/select.html +0 -17
  93. package/package/frontend/template-mixins/partials/forms/textarea-group.html +0 -37
  94. package/package/frontend/template-mixins/partials/mixins/panel.html +0 -4
  95. package/package/frontend/template-partials/index.js +0 -9
  96. package/package/frontend/template-partials/translations/index.js +0 -26
  97. package/package/frontend/template-partials/translations/src/cy/base.json +0 -4
  98. package/package/frontend/template-partials/translations/src/cy/buttons.json +0 -6
  99. package/package/frontend/template-partials/translations/src/cy/cookies.json +0 -104
  100. package/package/frontend/template-partials/translations/src/cy/errorlist.json +0 -6
  101. package/package/frontend/template-partials/translations/src/cy/errors.json +0 -18
  102. package/package/frontend/template-partials/translations/src/cy/terms.json +0 -28
  103. package/package/frontend/template-partials/translations/src/en/accessibility.json +0 -43
  104. package/package/frontend/template-partials/translations/src/en/base.json +0 -5
  105. package/package/frontend/template-partials/translations/src/en/buttons.json +0 -10
  106. package/package/frontend/template-partials/translations/src/en/cookies.json +0 -116
  107. package/package/frontend/template-partials/translations/src/en/errorlist.json +0 -7
  108. package/package/frontend/template-partials/translations/src/en/errors.json +0 -35
  109. package/package/frontend/template-partials/translations/src/en/exit.json +0 -5
  110. package/package/frontend/template-partials/translations/src/en/fields.json +0 -5
  111. package/package/frontend/template-partials/translations/src/en/journey.json +0 -6
  112. package/package/frontend/template-partials/translations/src/en/save-and-exit.json +0 -4
  113. package/package/frontend/template-partials/translations/src/en/terms.json +0 -28
  114. package/package/frontend/template-partials/views/404.html +0 -9
  115. package/package/frontend/template-partials/views/accessibility.html +0 -55
  116. package/package/frontend/template-partials/views/confirm.html +0 -8
  117. package/package/frontend/template-partials/views/confirmation.html +0 -19
  118. package/package/frontend/template-partials/views/content/en/what-happens-next.md +0 -0
  119. package/package/frontend/template-partials/views/cookie-error.html +0 -1
  120. package/package/frontend/template-partials/views/cookies.html +0 -84
  121. package/package/frontend/template-partials/views/email/data-row.html +0 -4
  122. package/package/frontend/template-partials/views/email/formatted.html +0 -12
  123. package/package/frontend/template-partials/views/email/layout.html +0 -63
  124. package/package/frontend/template-partials/views/email/raw.html +0 -11
  125. package/package/frontend/template-partials/views/email/section-row.html +0 -3
  126. package/package/frontend/template-partials/views/error.html +0 -20
  127. package/package/frontend/template-partials/views/exit.html +0 -9
  128. package/package/frontend/template-partials/views/feedback-submitted.html +0 -11
  129. package/package/frontend/template-partials/views/layout.html +0 -55
  130. package/package/frontend/template-partials/views/partials/analytics-table.html +0 -25
  131. package/package/frontend/template-partials/views/partials/back.html +0 -5
  132. package/package/frontend/template-partials/views/partials/bullet-list.html +0 -7
  133. package/package/frontend/template-partials/views/partials/confirmation-alert.html +0 -6
  134. package/package/frontend/template-partials/views/partials/continue.html +0 -5
  135. package/package/frontend/template-partials/views/partials/cookie-banner.html +0 -29
  136. package/package/frontend/template-partials/views/partials/cookie-notification.html +0 -4
  137. package/package/frontend/template-partials/views/partials/cookie-settings-button.html +0 -1
  138. package/package/frontend/template-partials/views/partials/cookie-settings-radio.html +0 -8
  139. package/package/frontend/template-partials/views/partials/details-summary.html +0 -8
  140. package/package/frontend/template-partials/views/partials/external-link.html +0 -1
  141. package/package/frontend/template-partials/views/partials/form.html +0 -10
  142. package/package/frontend/template-partials/views/partials/gatag.html +0 -60
  143. package/package/frontend/template-partials/views/partials/head.html +0 -31
  144. package/package/frontend/template-partials/views/partials/heading.html +0 -11
  145. package/package/frontend/template-partials/views/partials/items-table.html +0 -32
  146. package/package/frontend/template-partials/views/partials/maincontent-left.html +0 -10
  147. package/package/frontend/template-partials/views/partials/navigation.html +0 -8
  148. package/package/frontend/template-partials/views/partials/page.html +0 -23
  149. package/package/frontend/template-partials/views/partials/panel-indent.html +0 -3
  150. package/package/frontend/template-partials/views/partials/session-cookies-table.html +0 -28
  151. package/package/frontend/template-partials/views/partials/session-timeout-warning.html +0 -38
  152. package/package/frontend/template-partials/views/partials/summary-table-row.html +0 -14
  153. package/package/frontend/template-partials/views/partials/summary-table.html +0 -8
  154. package/package/frontend/template-partials/views/partials/table.html +0 -18
  155. package/package/frontend/template-partials/views/partials/validation-list.html +0 -3
  156. package/package/frontend/template-partials/views/partials/validation-summary.html +0 -25
  157. package/package/frontend/template-partials/views/partials/warn.html +0 -7
  158. package/package/frontend/template-partials/views/rate-limit-error.html +0 -10
  159. package/package/frontend/template-partials/views/save-and-exit.html +0 -17
  160. package/package/frontend/template-partials/views/service-unavailable.html +0 -13
  161. package/package/frontend/template-partials/views/session-timeout.html +0 -7
  162. package/package/frontend/template-partials/views/step.html +0 -14
  163. package/package/frontend/template-partials/views/terms.html +0 -26
  164. package/package/frontend/themes/gov-uk/client-js/cookieSettings.js +0 -145
  165. package/package/frontend/themes/gov-uk/client-js/govuk-cookies.js +0 -121
  166. package/package/frontend/themes/gov-uk/client-js/index.js +0 -27
  167. package/package/frontend/themes/gov-uk/client-js/session-timeout-dialog.js +0 -348
  168. package/package/frontend/themes/gov-uk/client-js/skip-to-main.js +0 -19
  169. package/package/frontend/themes/gov-uk/index.js +0 -9
  170. package/package/frontend/themes/gov-uk/styles/_base.scss +0 -17
  171. package/package/frontend/themes/gov-uk/styles/_check_your_answers.scss +0 -155
  172. package/package/frontend/themes/gov-uk/styles/_cookie-banner.scss +0 -111
  173. package/package/frontend/themes/gov-uk/styles/_cookie-settings.scss +0 -33
  174. package/package/frontend/themes/gov-uk/styles/_govuk_frontend_toolkit.scss +0 -23
  175. package/package/frontend/themes/gov-uk/styles/_helpers.scss +0 -5
  176. package/package/frontend/themes/gov-uk/styles/_layout.scss +0 -125
  177. package/package/frontend/themes/gov-uk/styles/_panel-indent.scss +0 -27
  178. package/package/frontend/themes/gov-uk/styles/_pdf.scss +0 -42
  179. package/package/frontend/themes/gov-uk/styles/_session-timeout-dialog.scss +0 -121
  180. package/package/frontend/themes/gov-uk/styles/_typography.scss +0 -27
  181. package/package/frontend/themes/gov-uk/styles/_variables.scss +0 -11
  182. package/package/frontend/themes/gov-uk/styles/govuk.scss +0 -43
  183. package/package/frontend/themes/gov-uk/styles/mixins.scss +0 -16
  184. package/package/frontend/themes/gov-uk/styles/modules/_alerts.scss +0 -73
  185. package/package/frontend/themes/gov-uk/styles/modules/_buttons.scss +0 -5
  186. package/package/frontend/themes/gov-uk/styles/modules/_character-count.scss +0 -8
  187. package/package/frontend/themes/gov-uk/styles/modules/_confirm-page.scss +0 -20
  188. package/package/frontend/themes/gov-uk/styles/modules/_lists.scss +0 -5
  189. package/package/frontend/themes/gov-uk/styles/modules/_progressive-reveal.scss +0 -17
  190. package/package/frontend/themes/gov-uk/styles/modules/_validation.scss +0 -51
  191. package/package/frontend/themes/index.js +0 -5
  192. package/package/frontend/toolkit/assets/images/passports/new-window-link-blue.png +0 -0
  193. package/package/frontend/toolkit/assets/images/passports/new-window-link.png +0 -0
  194. package/package/frontend/toolkit/assets/images/spinner.gif +0 -0
  195. package/package/frontend/toolkit/assets/javascript/character-count.js +0 -99
  196. package/package/frontend/toolkit/assets/javascript/form-focus.js +0 -101
  197. package/package/frontend/toolkit/assets/javascript/helpers.js +0 -177
  198. package/package/frontend/toolkit/assets/javascript/progressive-reveal.js +0 -72
  199. package/package/frontend/toolkit/assets/javascript/validation.js +0 -71
  200. package/package/frontend/toolkit/assets/javascript/vendor/details.polyfill.js +0 -189
  201. package/package/frontend/toolkit/assets/javascript/vendor/indexof.polyfill.js +0 -39
  202. package/package/frontend/toolkit/assets/javascript/vendor/safari-cachebuster.js +0 -6
  203. package/package/frontend/toolkit/assets/stylesheets/_base.scss +0 -17
  204. package/package/frontend/toolkit/assets/stylesheets/_helpers.scss +0 -5
  205. package/package/frontend/toolkit/assets/stylesheets/_layout.scss +0 -118
  206. package/package/frontend/toolkit/assets/stylesheets/_typography.scss +0 -27
  207. package/package/frontend/toolkit/assets/stylesheets/_variables.scss +0 -11
  208. package/package/frontend/toolkit/assets/stylesheets/app.scss +0 -30
  209. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_buttons.scss +0 -47
  210. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_details.scss +0 -38
  211. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_elements-typography.scss +0 -175
  212. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_forms.scss +0 -167
  213. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_helpers.scss +0 -39
  214. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_layout.scss +0 -67
  215. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_lists.scss +0 -40
  216. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_panels.scss +0 -29
  217. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_reset.scss +0 -33
  218. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_tables.scss +0 -33
  219. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/forms/_form-block-labels.scss +0 -63
  220. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/forms/_form-date.scss +0 -39
  221. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/forms/_form-validation.scss +0 -63
  222. package/package/frontend/toolkit/assets/stylesheets/mixins.scss +0 -16
  223. package/package/frontend/toolkit/assets/stylesheets/modules/_alerts.scss +0 -73
  224. package/package/frontend/toolkit/assets/stylesheets/modules/_buttons.scss +0 -5
  225. package/package/frontend/toolkit/assets/stylesheets/modules/_confirm-page.scss +0 -20
  226. package/package/frontend/toolkit/assets/stylesheets/modules/_lists.scss +0 -5
  227. package/package/frontend/toolkit/assets/stylesheets/modules/_progressive-reveal.scss +0 -17
  228. package/package/frontend/toolkit/assets/stylesheets/modules/_validation.scss +0 -51
  229. package/package/frontend/toolkit/index.js +0 -10
  230. package/package/index.js +0 -351
  231. package/package/lib/deindex.js +0 -18
  232. package/package/lib/encryption.js +0 -23
  233. package/package/lib/ga-tag.js +0 -89
  234. package/package/lib/health.js +0 -26
  235. package/package/lib/helpers.js +0 -66
  236. package/package/lib/logger.js +0 -65
  237. package/package/lib/markdown.js +0 -46
  238. package/package/lib/router.js +0 -111
  239. package/package/lib/serve-static.js +0 -12
  240. package/package/lib/sessions.js +0 -82
  241. package/package/lib/settings.js +0 -74
  242. package/package/lib/which.js +0 -28
  243. package/package/middleware/cookies.js +0 -43
  244. package/package/middleware/deep-translate.js +0 -32
  245. package/package/middleware/errors.js +0 -119
  246. package/package/middleware/index.js +0 -10
  247. package/package/middleware/not-found.js +0 -38
  248. package/package/middleware/rate-limiter.js +0 -98
  249. package/package/middleware/service-unavailable.js +0 -64
  250. package/package/model/apis/axios-settings.js +0 -21
  251. package/package/model/apis/html-to-pdf-converter.js +0 -35
  252. package/package/model/apis/index.js +0 -5
  253. package/package/model/index.js +0 -348
  254. package/package/package.json +0 -147
  255. package/package/sandbox/README.md +0 -66
  256. package/package/sandbox/apps/sandbox/behaviours/clear-session.js +0 -8
  257. package/package/sandbox/apps/sandbox/behaviours/country-select.js +0 -10
  258. package/package/sandbox/apps/sandbox/behaviours/international-number.js +0 -22
  259. package/package/sandbox/apps/sandbox/fields.js +0 -128
  260. package/package/sandbox/apps/sandbox/index.js +0 -99
  261. package/package/sandbox/apps/sandbox/lib/staticAppealStages.js +0 -189
  262. package/package/sandbox/apps/sandbox/sections/summary-data-sections.js +0 -43
  263. package/package/sandbox/apps/sandbox/translations/src/en/errors.json +0 -5
  264. package/package/sandbox/apps/sandbox/translations/src/en/exit.json +0 -4
  265. package/package/sandbox/apps/sandbox/translations/src/en/fields.json +0 -101
  266. package/package/sandbox/apps/sandbox/translations/src/en/journey.json +0 -7
  267. package/package/sandbox/apps/sandbox/translations/src/en/pages.json +0 -72
  268. package/package/sandbox/apps/sandbox/translations/src/en/validation.json +0 -54
  269. package/package/sandbox/apps/sandbox/views/form-guidance-link.html +0 -8
  270. package/package/sandbox/apps/sandbox/views/save-and-exit.html +0 -19
  271. package/package/sandbox/assets/images/icons/icon-caret-left.png +0 -0
  272. package/package/sandbox/assets/images/icons/icon-complete.png +0 -0
  273. package/package/sandbox/assets/images/icons/icon-cross-remove-sign.png +0 -0
  274. package/package/sandbox/assets/js/index.js +0 -70
  275. package/package/sandbox/assets/scss/app.scss +0 -27
  276. package/package/sandbox/codecept.conf.js +0 -15
  277. package/package/sandbox/config.js +0 -17
  278. package/package/sandbox/package.json +0 -26
  279. package/package/sandbox/server.js +0 -23
  280. package/package/sandbox/yarn.lock +0 -262
  281. package/package/transpiler/index.js +0 -2
  282. package/package/transpiler/lib/aggregate.js +0 -32
  283. package/package/transpiler/lib/build.js +0 -15
  284. package/package/transpiler/lib/compile.js +0 -12
  285. package/package/transpiler/lib/expand-dirs.js +0 -14
  286. package/package/transpiler/lib/write-files.js +0 -24
  287. package/package/utilities/autofill/index.js +0 -189
  288. package/package/utilities/autofill/inputs.js +0 -60
  289. package/package/utilities/countries.js +0 -12
  290. package/package/utilities/helpers/index.js +0 -189
  291. package/package/utilities/index.js +0 -9
  292. package/package/utilities/reqres/index.js +0 -18
  293. package/package/utilities/test-data/data/domain.json +0 -7
  294. package/package/utilities/test-data/data/firstname.json +0 -16
  295. package/package/utilities/test-data/data/lastname.json +0 -10
  296. package/package/utilities/test-data/data/postcode.json +0 -12
  297. package/package/utilities/test-data/data/streetname.json +0 -8
  298. package/package/utilities/test-data/data/streetsuffix.json +0 -7
  299. package/package/utilities/test-data/data/town.json +0 -9
  300. package/package/utilities/test-data/index.js +0 -67
  301. package/package/wizard/behaviours/complete.js +0 -20
  302. package/package/wizard/behaviours/index.js +0 -5
  303. package/package/wizard/index.js +0 -124
  304. package/package/wizard/middleware/back-links.js +0 -68
  305. package/package/wizard/middleware/check-complete.js +0 -13
  306. package/package/wizard/middleware/check-progress.js +0 -139
  307. package/package/wizard/middleware/check-session.js +0 -17
  308. package/package/wizard/middleware/csrf.js +0 -47
  309. package/package/wizard/middleware/session-model.js +0 -11
  310. package/package/wizard/middleware/session.js +0 -9
  311. package/package/wizard/model.js +0 -29
  312. package/package/wizard/util/constants.js +0 -5
  313. package/package/wizard/util/helpers.js +0 -19
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- const smtp = require('nodemailer');
4
-
5
- module.exports = options => {
6
- if (!options.host) {
7
- throw new Error('Required option `host` not found');
8
- }
9
- if (!options.port) {
10
- throw new Error('Required option `port` not found');
11
- }
12
-
13
- const opts = {
14
- host: options.host,
15
- port: options.port
16
- };
17
-
18
- opts.ignoreTLS = options.ignoreTLS === true;
19
- opts.secure = options.secure !== false;
20
-
21
- if (options.auth && options.auth.user && options.auth.pass) {
22
- opts.auth = options.auth;
23
- }
24
-
25
- return smtp(opts);
26
- };
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- const stub = require('nodemailer-stub-transport');
4
-
5
- module.exports = () => stub();
@@ -1,63 +0,0 @@
1
- <!doctype html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
5
- <meta content="utf-8" http-equiv="encoding" />
6
- <!-- Use title if it's in the page YAML frontmatter -->
7
- <title>{{subject}}</title>
8
- </head>
9
-
10
- <body style="font-family: Helvetica, Arial, sans-serif;font-size: 16px;margin: 0;color:#0b0c0c">
11
- <table width="100%" cellpadding="0" cellspacing="0" border="0">
12
- <tr>
13
- <td width="100%" height="53px" bgcolor="#0b0c0c">
14
- <table width="580" cellpadding="0" cellspacing="0" border="0" align="center">
15
- <tr>
16
- <td width="100%" bgcolor="#0b0c0c" valign="middle">
17
- <img width="152" height="31" src="cid:govuk_logotype_email" alt="GOV.UK" border="0" />
18
- </td>
19
- </tr>
20
- </table>
21
- </td>
22
- </tr>
23
- </table>
24
- <table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF">
25
- <tr>
26
- <td width="100%">
27
- <table width="580" cellpadding="0" cellspacing="0" border="0" align="center">
28
- <tr>
29
- <td width="100%" class="header" style="padding-top: 10px;" colspan="2">
30
- <table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF">
31
- <tr>
32
- <td width="6" style="border-left: 2px solid #009390;"><img src="cid:spacer_image" alt="" width="6px" height="26px" style="display: block;" /></td>
33
- <td width="27" height="50"><img src="cid:ho_crest_27px" alt="Home Office Logo" style="width: 27px; height: 50px; display:block;" /></td>
34
- <td width="7"><img src="cid:spacer_image" alt="" width="7px" height="26px" style="display: block;" /></td>
35
- <td style="font-family: Helvetica, Arial, sans-serif;">
36
- <h2 class="organisation-logo" style="font-size: 18px; line-height: 20px; font-weight: 300; margin: 0"><span>UK Home Office</span></h2>
37
- </td>
38
- </tr>
39
- </table>
40
- </td>
41
- </tr>
42
- <tr>
43
- <td style="font-family: Helvetica, Arial, sans-serif;">
44
- <p style="font-weight: 700;font-size: 16px;line-height: 1 ;margin: 10px 0 10px 0;">&nbsp;</p>
45
- </td>
46
- </tr>
47
- <tr>
48
- <td style="font-family: Helvetica, Arial, sans-serif;">
49
- <p style="font-size: 19px; font-weight: bold; color: #000; line-height: 1.32; margin: 0 0 10px 0;">
50
- {{subject}}
51
- <p>
52
- <div style="margin: 0 0 20px 0;">
53
- {{{body}}}
54
- </div>
55
- </td>
56
- </tr>
57
- </table>
58
- </td>
59
- <td width="25%">&nbsp;</td>
60
- </tr>
61
- </table>
62
- </body>
63
- </html>
@@ -1,22 +0,0 @@
1
-
2
- const _ = require('lodash');
3
- const componentDefaults = require('../../config/component-defaults');
4
-
5
- module.exports = superclass => class extends superclass {
6
- configure(req, res, next) {
7
- const homeOfficeCountries = [''].concat(require('homeoffice-countries').allCountries);
8
-
9
- const nationalityFields = componentDefaults.homeOfficeCountries;
10
-
11
- nationalityFields.forEach(field => {
12
- if (_.get(req, `form.options.fields[${field}].options`)) {
13
- req.form.options.fields[field].options = homeOfficeCountries.map(country => {
14
- const labelString = country !== '' ? country : 'Please select a country';
15
- return { label: labelString, value: country };
16
- });
17
- }
18
- });
19
-
20
- next();
21
- }
22
- };
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- addressLookup: require('./address-lookup'),
5
- clearSession: require('./clear-session'),
6
- combineAndLoopFields: require('./combine-and-loop-fields'),
7
- date: require('./date'),
8
- emailer: require('./emailer'),
9
- homeOfficeCountries: require('./homeoffice-countries'),
10
- notify: require('./notify'),
11
- summary: require('./summary'),
12
- sessionTimeoutWarning: require('./session-timeout-warning')
13
- };
@@ -1,62 +0,0 @@
1
- 'use strict';
2
-
3
- const Notify = require('./notify');
4
- const Hogan = require('hogan.js');
5
- const fs = require('fs');
6
-
7
- module.exports = config => {
8
- const notify = new Notify(config);
9
- config.parse = config.parse || (data => data);
10
-
11
- if (!config.recipient) {
12
- throw new Error('Email recipient must be defined');
13
- }
14
- if (typeof config.template !== 'string') {
15
- throw new Error('Email template must be defined');
16
- }
17
-
18
- return superclass => class NotifyBehaviour extends superclass {
19
- successHandler(req, res, next) {
20
- Promise.resolve()
21
- .then(() => {
22
- return new Promise((resolve, reject) => {
23
- fs.readFile(config.template, (err, template) => err ? reject(err) : resolve(template.toString('utf8')));
24
- });
25
- })
26
- .then(template => {
27
- const data = config.parse(req.sessionModel.toJSON(), req.translate);
28
- return Hogan.compile(template).render(data);
29
- })
30
- .then(body => {
31
- const settings = { body };
32
-
33
- if (typeof config.recipient === 'function') {
34
- settings.recipient = config.recipient(req.sessionModel.toJSON());
35
- } else {
36
- settings.recipient = req.sessionModel.get(config.recipient) || config.recipient;
37
- }
38
- if (typeof settings.recipient !== 'string' || !settings.recipient.includes('@')) {
39
- throw new Error('hof-behaviour-emailer: invalid recipient');
40
- }
41
- if (typeof config.subject === 'function') {
42
- settings.subject = config.subject(req.sessionModel.toJSON(), req.translate);
43
- } else {
44
- settings.subject = config.subject;
45
- }
46
- if (config.attachment && config.attachment !== undefined) {
47
- settings.attachment = config.attachment(req.sessionModel.toJSON(), req.translate);
48
- }
49
-
50
- return settings;
51
- })
52
- .then(settings => {
53
- return notify.send(settings);
54
- })
55
- .then(() => {
56
- super.successHandler(req, res, next);
57
- }, next);
58
- }
59
- };
60
- };
61
-
62
- module.exports.Notify = Notify;
@@ -1,51 +0,0 @@
1
- 'use strict';
2
-
3
- const NotifyClient = require('notifications-node-client').NotifyClient;
4
- const { v4: uuidv4 } = require('uuid');
5
- const config = require('../../config/hof-defaults');
6
- const logger = require('../../lib/logger');
7
-
8
- module.exports = class Notify {
9
- constructor(opts) {
10
- const options = opts || {};
11
- this.options = options;
12
- this.logger = logger(config);
13
- this.notifyClient = new NotifyClient(options.notifyApiKey);
14
- this.notifyTemplate = options.notifyTemplate;
15
- }
16
-
17
- async sendEmail(templateId, recipient, personalisation) {
18
- const reference = uuidv4();
19
-
20
- try {
21
- await this.notifyClient.sendEmail(templateId, recipient, {
22
- personalisation: personalisation,
23
- reference });
24
- this.logger.log('info', 'Email sent');
25
- } catch (error) {
26
- this.logger.log('error', error.response ? error.response.data : error.message);
27
- throw new Error(error.response ? error.response.data : error.message);
28
- }
29
- }
30
-
31
- async send(email) {
32
- let personalisation = {
33
- 'email-subject': email.subject,
34
- 'email-body': email.body
35
- };
36
-
37
- if (email.attachment && email.attachment !== undefined) {
38
- personalisation = Object.assign({'email-attachment':
39
- this.notifyClient.prepareUpload(email.attachment)}, personalisation);
40
- }
41
-
42
- try {
43
- await this.sendEmail(this.notifyTemplate, email.recipient, personalisation);
44
- } catch (error) {
45
- this.logger.log('error', error.response ? error.response.data : error.message);
46
- throw new Error(error.response ? error.response.data : error.message);
47
- }
48
- }
49
- };
50
-
51
- module.exports.NotifyClient = NotifyClient;
@@ -1,67 +0,0 @@
1
- /**
2
- *
3
- * @fileOverview
4
- * Provides custom behavior for handling session timeout warnings and exit actions. This includes
5
- * - Resetting the session if the user exits due to a session timeout.
6
- * - Customizing the session timeout warning dialog content.
7
- * - Setting custom content and titles on the exit page.
8
- *
9
- * @module SessionTimeoutWarningBehavior
10
- * @requires ../../config/hof-defaults
11
- * @param {Class} superclass - The class to be extended.
12
- * @returns {Class} - The extended class with session timeout handling functionality.
13
- */
14
-
15
- 'use strict';
16
- const config = require('../../config/hof-defaults');
17
- const logger = require('../../lib/logger')(config);
18
-
19
- module.exports = superclass => class extends superclass {
20
- configure(req, res, next) {
21
- try {
22
- // Reset the session if the user chooses to exit on session timeout warning
23
- if (req.form.options.route === '/exit') {
24
- req.sessionModel.reset();
25
- logger.log('info', 'Session has been reset on exit');
26
- }
27
- return super.configure(req, res, next);
28
- } catch (error) {
29
- logger.error('Error during session reset:', error);
30
- return next(error); // Pass the error to the next middleware for centralised handling
31
- }
32
- }
33
-
34
- locals(req, res) {
35
- // set the custom session dialog message
36
- const superLocals = super.locals(req, res);
37
- if (res.locals.sessionTimeoutWarningContent === true) {
38
- superLocals.dialogTitle = true;
39
- superLocals.dialogText = true;
40
- superLocals.timeoutContinueButton = true;
41
- superLocals.dialogExitLink = true;
42
- }
43
-
44
- // set the content on /exit page
45
- if (req.form.options.route === '/exit' && config.exitFormContent === true) {
46
- superLocals.exitFormContent = true;
47
- return superLocals;
48
- } else if (req.form.options.route === '/exit' && config.exitFormContent === false) {
49
- superLocals.header = req.translate('exit.header');
50
- superLocals.title = req.translate('exit.title');
51
- superLocals.message = req.translate('exit.message');
52
- return superLocals;
53
- }
54
-
55
- // set the content on /save-and-exit page
56
- if (req.form.options.route === '/save-and-exit' && config.saveExitFormContent === true) {
57
- superLocals.saveExitFormContent = true;
58
- return superLocals;
59
- } else if (req.form.options.route === '/save-and-exit' && config.saveExitFormContent === false) {
60
- superLocals.header = req.translate('save-and-exit.header');
61
- superLocals.title = req.translate('save-and-exit.title');
62
- superLocals.message = req.translate('save-and-exit.message');
63
- return superLocals;
64
- }
65
- return superLocals;
66
- }
67
- };
@@ -1,237 +0,0 @@
1
-
2
- 'use strict';
3
-
4
- const config = require('../../config/rate-limits');
5
- const rateLimiter = require('../../middleware/rate-limiter');
6
-
7
- const concat = (x, y) => x.concat(y);
8
- const flatMap = (f, xs) => xs.map(f).reduce(concat, []);
9
-
10
- module.exports = SuperClass => class extends SuperClass {
11
- getSectionSettings(settings) {
12
- if (settings.sections) {
13
- return settings.sections;
14
- }
15
- return Object.keys(settings.steps).reduce((map, key) => {
16
- const fields = settings.steps[key].fields;
17
- if (fields) {
18
- map[key.replace(/^\//, '')] = fields;
19
- }
20
- return map;
21
- }, {});
22
- }
23
-
24
- getRowsForSummarySections(req) {
25
- const settings = req.form.options;
26
- const sections = this.getSectionSettings(settings);
27
- return Object.keys(sections)
28
- .map(section => {
29
- const fieldsInSection = sections[section].steps || sections[section];
30
- const omitFromPdf = sections[section].omitFromPdf || false;
31
-
32
- return {
33
- section: req.translate([
34
- `pages.confirm.sections.${section}.header`,
35
- `pages.${section}.header`
36
- ]),
37
- fields: this.getFieldsForRow(fieldsInSection, req),
38
- omitFromPdf
39
- };
40
- })
41
- .filter(section => section.fields.length);
42
- }
43
-
44
- getFieldsForRow(section, req) {
45
- const fieldsSpecifications = section || [];
46
- let populatedFields =
47
- fieldsSpecifications.map(fieldSpec => {
48
- let fieldData = {};
49
- const multipleRows = fieldSpec.multipleRowsFromAggregate;
50
- const useOriginalValue = fieldSpec.useOriginalValue;
51
-
52
- if (typeof fieldSpec === 'string' || multipleRows) {
53
- fieldData = this.getFieldData(fieldSpec, req, useOriginalValue);
54
- } else if (this.dependencySatisfied(fieldSpec, req)) {
55
- fieldData = Object.assign(this.getFieldData(fieldSpec.field, req, useOriginalValue), fieldSpec);
56
- }
57
-
58
- if (!multipleRows) {
59
- fieldData.value = fieldSpec.derivation ?
60
- this.runCombinerForDerivedField(fieldSpec, req) : fieldData.value;
61
- fieldData.value = (typeof fieldSpec.parse === 'function') ?
62
- fieldSpec.parse(fieldData.value, req) : fieldData.value;
63
- }
64
-
65
- return fieldData;
66
- }).filter(f => f.value || Array.isArray(f));
67
-
68
- populatedFields = flatMap(populatedField => {
69
- if (populatedField.value && populatedField.value.aggregatedValues) {
70
- return this.expandAggregatedFields(populatedField, req);
71
- }
72
- return populatedField;
73
- }, populatedFields);
74
-
75
- return populatedFields;
76
- }
77
-
78
- runCombinerForDerivedField(fieldSpec, req) {
79
- const obj = Object.assign(this.getFieldData(fieldSpec.field, req), fieldSpec);
80
-
81
- const values = fieldSpec.derivation.fromFields
82
- .map(field => req.sessionModel.get(field)).filter(field => field && field.length > 0);
83
- if (values.length > 0) {
84
- obj.value = fieldSpec.derivation.combiner(values);
85
- }
86
-
87
- return obj.value;
88
- }
89
-
90
- dependencySatisfied(fieldSpec, req) {
91
- if (fieldSpec.dependsOn) {
92
- const dependencyValue = req.sessionModel.get(fieldSpec.dependsOn);
93
- if (!dependencyValue || dependencyValue === 'no') {
94
- return false;
95
- }
96
- }
97
- return true;
98
- }
99
-
100
- expandAggregatedFields(obj, req) {
101
- return flatMap((element, index) => {
102
- const fields = flatMap(inner => {
103
- const changeField = inner.changeField || inner.field;
104
- const changeLink = `${req.baseUrl}${obj.step}/edit/${index}/${changeField}?returnToSummary=true`;
105
-
106
- return Object.assign({}, inner, {
107
- changeLinkDescription: this.translateChangeLink(inner.field, req),
108
- value: inner.parsed || inner.value,
109
- label: this.translateLabel(inner.field, req),
110
- changeLink,
111
- index
112
- });
113
- }, element.fields);
114
-
115
- if (obj.addElementSeparators && index < obj.value.aggregatedValues.length - 1) {
116
- fields.push({ label: '', value: 'separator', changeLink: '', isSeparator: true });
117
- }
118
-
119
- return fields;
120
- }, obj.value.aggregatedValues);
121
- }
122
-
123
- getStepForField(key, steps) {
124
- const keyName = Array.isArray(key) ? key[0] : key;
125
- return Object.keys(steps).filter(step => steps[step].fields && steps[step].fields.indexOf(keyName) > -1)[0];
126
- }
127
-
128
-
129
- translateLabel(key, req) {
130
- return req.translate([
131
- `pages.confirm.fields.${key}.label`,
132
- `fields.${key}.label`,
133
- `fields.${key}.legend`
134
- ]);
135
- }
136
-
137
- translateChangeLink(key, req) {
138
- return req.translate([`fields.${key}.changeLinkDescription`,
139
- `pages.confirm.fields.${key}.label`,
140
- `fields.${key}.summary`,
141
- `fields.${key}.label`,
142
- `fields.${key}.legend`]);
143
- }
144
-
145
-
146
- translateCheckBoxOptions(key, value, req) {
147
- if (Array.isArray(value)) {
148
- return value.map(val => this.translateCheckBoxOptions(key, val, req));
149
- }
150
-
151
- return req.translate(`fields[${key}].options.[${value}]`);
152
- }
153
-
154
- getFieldData(key, req, useOriginalValue) {
155
- if (this.isCheckbox(key, req)) {
156
- return this.parseCheckBoxField(key, req, useOriginalValue);
157
- }
158
-
159
- return key.multipleRowsFromAggregate ?
160
- this.parseMultipleFields(key, req) :
161
- this.parseSingleField(key, req);
162
- }
163
-
164
- isCheckbox(key, req) {
165
- return req.sessionModel.get(key) && req.form.options.fieldsConfig[key] &&
166
- (req.form.options.fieldsConfig[key].mixin === 'checkbox-group' ||
167
- req.form.options.fieldsConfig[key].mixin === 'radio-group');
168
- }
169
-
170
- parseCheckBoxField(key, req, useOriginalValue) {
171
- let value = req.sessionModel.get(key);
172
- const step = this.getStepForField(key, req.form.options.steps);
173
- const changeLink = `${req.baseUrl}${step}/edit#${key}-${value}`;
174
- value = useOriginalValue ? value : this.translateCheckBoxOptions(key, value, req);
175
-
176
- return {
177
- changeLinkDescription: this.translateChangeLink(key, req),
178
- label: this.translateLabel(key, req),
179
- value,
180
- step,
181
- field: key,
182
- changeLink
183
- };
184
- }
185
-
186
- parseMultipleFields(key, req) {
187
- const multipleRows = key.multipleRowsFromAggregate;
188
- const labelCategory = multipleRows.labelCategory;
189
- const valueCategory = multipleRows.valueCategory;
190
- const translationValue = multipleRows.valueTranslation || multipleRows.valueCategory;
191
-
192
- return req.sessionModel.get(key.field).map(input => {
193
- return {
194
- field: key.field,
195
- step: key.step,
196
- changeLinkDescription: this.translateChangeLink(key.field, req),
197
- label: input[labelCategory],
198
- value: [].concat(input[valueCategory])
199
- .map(category => req.translate(`fields.${translationValue}.options.${category}.label`))
200
- .join('\n')
201
- };
202
- }).filter(f => f.value);
203
- }
204
-
205
- parseSingleField(key, req) {
206
- return {
207
- changeLinkDescription: this.translateChangeLink(key, req),
208
- label: this.translateLabel(key, req),
209
- value: req.sessionModel.get(key),
210
- step: this.getStepForField(key, req.form.options.steps),
211
- field: key
212
- };
213
- }
214
-
215
- locals(req, res) {
216
- req.sessionModel.unset('returnToSummary');
217
- const rows = this.getRowsForSummarySections(req);
218
- return Object.assign({}, super.locals(req, res), {
219
- rows
220
- });
221
- }
222
-
223
- validate(req, res, next) {
224
- if (!config.rateLimits.submissions.active) {
225
- return super.validate(req, res, next);
226
- }
227
- // how do we stop this ballsing up our tests??????
228
- const options = Object.assign({}, config, { logger: req });
229
-
230
- return rateLimiter(options, 'submissions')(req, res, err => {
231
- if (err) {
232
- return next(err);
233
- }
234
- return super.validate(req, res, next);
235
- });
236
- }
237
- };
@@ -1,45 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- browserify: {
5
- src: 'assets/js/index.js',
6
- out: 'public/js/bundle.js',
7
- match: 'assets/js/**/*.js',
8
- restart: false,
9
- compress: false,
10
- debug: false
11
- },
12
- sass: {
13
- src: 'assets/scss/app.scss',
14
- out: 'public/css/app.css',
15
- match: 'assets/scss/**/*.scss',
16
- restart: false,
17
- quietDeps: false,
18
- outputStyle: 'expanded',
19
- sourceMaps: false
20
- },
21
- translate: {
22
- src: 'apps/**/translations/src',
23
- match: 'apps/**/translations/src/**/*.json',
24
- shared: 'apps/common/translations/src'
25
- },
26
- images: {
27
- src: 'assets/images',
28
- out: 'public',
29
- match: 'assets/images/**/*',
30
- restart: false
31
- },
32
- server: {
33
- cmd: 'npm start',
34
- extensions: ['.js', '.json', '.html', '.md']
35
- },
36
- watch: {
37
- restart: 'rs',
38
- ignore: [
39
- '*.log',
40
- '.git',
41
- 'coverage',
42
- 'public'
43
- ]
44
- }
45
- };
@@ -1,13 +0,0 @@
1
-
2
- module.exports = {
3
- homeOfficeCountries: [
4
- 'nationality',
5
- 'former-nationality',
6
- 'dual-nationality',
7
- 'nominated-nationality',
8
- 'nationality-error',
9
- 'country',
10
- 'country-of-birth',
11
- 'someone-else-nationality'
12
- ]
13
- };
@@ -1,65 +0,0 @@
1
- 'use strict';
2
- /* eslint no-process-env: "off" */
3
- const rateLimits = require('./rate-limits');
4
- const Helper = require('../utilities/helpers');
5
- const parseBoolean = Helper.getEnvBoolean;
6
-
7
- const defaults = {
8
- appName: process.env.APP_NAME || 'HOF Application',
9
- htmlLang: 'en',
10
- root: process.cwd(),
11
- translations: 'translations',
12
- start: true,
13
- csp: {
14
- disabled: parseBoolean(process.env.DISABLE_CSP, false, 'DISABLE_CSP')
15
- },
16
- getCookies: true,
17
- getTerms: true,
18
- getAccessibility: false,
19
- sessionTimeoutWarningContent: false,
20
- exitFormContent: false,
21
- saveExitFormContent: false,
22
- viewEngine: 'html',
23
- protocol: process.env.PROTOCOL || 'http',
24
- noCache: process.env.NO_CACHE || false,
25
- host: process.env.HOST || '0.0.0.0',
26
- port: process.env.PORT || '8080',
27
- env: process.env.NODE_ENV || 'development',
28
- gaTagId: process.env.GA_TAG,
29
- ga4TagId: process.env.GA_4_TAG,
30
- showCookiesBanner: parseBoolean(
31
- process.env.SHOW_COOKIES_BANNER,
32
- Boolean(process.env.GA_TAG || process.env.GA_4_TAG),
33
- 'SHOW_COOKIES_BANNER'
34
- ),
35
- // added to allow support for multiple HOF forms using GTM to customize how they track page views
36
- gtm: {
37
- tagId: process.env.GTM_TAG || false,
38
- config: {},
39
- composePageName: function (page, convertPage) {
40
- return convertPage(page);
41
- }
42
- },
43
- deIndexForm: process.env.DEINDEX_FORM || 'false',
44
- gaCrossDomainTrackingTagId: process.env.GDS_CROSS_DOMAIN_GA_TAG,
45
- loglevel: process.env.LOG_LEVEL || 'info',
46
- ignoreMiddlewareLogs: ['/healthz'],
47
- redis: {
48
- port: process.env.REDIS_PORT || '6379',
49
- host: process.env.REDIS_HOST || '127.0.0.1'
50
- },
51
- session: {
52
- ttl: process.env.SESSION_TTL || 1800,
53
- secret: process.env.SESSION_SECRET || 'changethis',
54
- name: process.env.SESSION_NAME || 'hod.sid',
55
- sanitiseInputs: false
56
- },
57
- apis: {
58
- pdfConverter: process.env.PDF_CONVERTER_URL
59
- },
60
- serveStatic: process.env.SERVE_STATIC_FILES !== 'false',
61
- sessionTimeOutWarning: process.env.SESSION_TIMEOUT_WARNING || 300,
62
- serviceUnavailable: parseBoolean(process.env.SERVICE_UNAVAILABLE, false, 'SERVICE_UNAVAILABLE')
63
- };
64
-
65
- module.exports = Object.assign({}, defaults, rateLimits);