hof 21.1.1 → 21.2.0-postcode-lookup-beta
Sign up to get free protection for your applications and to get access to all the features.
- package/.nyc_output/ceb540e1-f717-439d-a812-314eccd5fb69.json +1 -0
- package/.nyc_output/processinfo/ceb540e1-f717-439d-a812-314eccd5fb69.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/.vscode/settings.json +2 -0
- package/components/index.js +1 -0
- package/components/postcode-lookup/defaults.js +31 -0
- package/components/postcode-lookup/index.js +373 -0
- package/components/postcode-lookup/postcode-lookup.js +37 -0
- package/components/postcode-lookup/templates/address-lookup.html +30 -0
- package/components/postcode-lookup/templates/address.html +27 -0
- package/components/postcode-lookup/templates/postcode-search-problem.html +7 -0
- package/components/postcode-lookup/templates/postcode.html +13 -0
- package/config/hof-defaults.js +0 -1
- package/controller/validation/validators.js +5 -0
- package/frontend/govuk-template/govuk_template_generated.html +102 -0
- package/index.js +0 -2
- package/package.json +2 -1
- package/sandbox/apps/sandbox/translations/en/default.json +220 -0
- package/sandbox/public/css/app.css +9397 -0
- package/sandbox/public/images/icons/icon-caret-left.png +0 -0
- package/sandbox/public/images/icons/icon-complete.png +0 -0
- package/sandbox/public/images/icons/icon-cross-remove-sign.png +0 -0
- package/sandbox/public/js/bundle.js +35664 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"parent":null,"pid":94733,"argv":["/Users/muhammedislam/.nvm/versions/node/v18.19.0/bin/node","/Users/muhammedislam/hof/node_modules/.bin/_mocha","test/**/*.spec.js","sandbox/test/**/*.spec.js"],"execArgv":[],"cwd":"/Users/muhammedislam/hof","time":1726519054139,"ppid":94731,"coverageFilename":"/Users/muhammedislam/hof/.nyc_output/ceb540e1-f717-439d-a812-314eccd5fb69.json","externalId":"","uuid":"ceb540e1-f717-439d-a812-314eccd5fb69","files":["/Users/muhammedislam/hof/model/index.js","/Users/muhammedislam/hof/model/apis/axios-settings.js","/Users/muhammedislam/hof/components/index.js","/Users/muhammedislam/hof/components/address-lookup/index.js","/Users/muhammedislam/hof/components/address-lookup/default-model.js","/Users/muhammedislam/hof/components/address-lookup/defaults.js","/Users/muhammedislam/hof/components/postcode-lookup/index.js","/Users/muhammedislam/hof/components/postcode-lookup/defaults.js","/Users/muhammedislam/hof/components/postcode-lookup/postcode-lookup.js","/Users/muhammedislam/hof/components/clear-session/index.js","/Users/muhammedislam/hof/components/combine-and-loop-fields/index.js","/Users/muhammedislam/hof/components/date/index.js","/Users/muhammedislam/hof/components/date/fields.js","/Users/muhammedislam/hof/components/emailer/index.js","/Users/muhammedislam/hof/components/emailer/email-service.js","/Users/muhammedislam/hof/components/emailer/emailer.js","/Users/muhammedislam/hof/components/emailer/transports/index.js","/Users/muhammedislam/hof/components/emailer/transports/smtp.js","/Users/muhammedislam/hof/components/emailer/transports/ses.js","/Users/muhammedislam/hof/components/emailer/transports/stub.js","/Users/muhammedislam/hof/components/emailer/transports/debug.js","/Users/muhammedislam/hof/components/homeoffice-countries/index.js","/Users/muhammedislam/hof/config/component-defaults.js","/Users/muhammedislam/hof/components/notify/index.js","/Users/muhammedislam/hof/components/notify/notify.js","/Users/muhammedislam/hof/components/summary/index.js","/Users/muhammedislam/hof/config/rate-limits.js","/Users/muhammedislam/hof/middleware/rate-limiter.js","/Users/muhammedislam/hof/config/hof-defaults.js","/Users/muhammedislam/hof/utilities/reqres/index.js","/Users/muhammedislam/hof/controller/base-controller.js","/Users/muhammedislam/hof/controller/formatting/index.js","/Users/muhammedislam/hof/controller/validation/index.js","/Users/muhammedislam/hof/controller/validation/validators.js","/Users/muhammedislam/hof/controller/validation/email.js","/Users/muhammedislam/hof/controller/validation-error.js","/Users/muhammedislam/hof/utilities/index.js","/Users/muhammedislam/hof/utilities/autofill/index.js","/Users/muhammedislam/hof/utilities/autofill/inputs.js","/Users/muhammedislam/hof/utilities/test-data/index.js","/Users/muhammedislam/hof/utilities/countries.js","/Users/muhammedislam/hof/utilities/helpers/index.js","/Users/muhammedislam/hof/config/sanitisation-rules.js","/Users/muhammedislam/hof/controller/formatting/formatters.js","/Users/muhammedislam/hof/controller/index.js","/Users/muhammedislam/hof/controller/behaviour-session.js","/Users/muhammedislam/hof/controller/behaviour-hooks.js","/Users/muhammedislam/hof/controller/controller.js","/Users/muhammedislam/hof/sandbox/apps/sandbox/behaviours/country-select.js","/Users/muhammedislam/hof/frontend/template-mixins/mixins/index.js","/Users/muhammedislam/hof/frontend/template-mixins/mixins/template-mixins.js","/Users/muhammedislam/hof/frontend/template-mixins/mixins/render.js","/Users/muhammedislam/hof/frontend/template-mixins/mixins/helpers.js","/Users/muhammedislam/hof/index.js","/Users/muhammedislam/hof/frontend/index.js","/Users/muhammedislam/hof/frontend/govuk-template/index.js","/Users/muhammedislam/hof/frontend/govuk-template/build/index.js","/Users/muhammedislam/hof/frontend/govuk-template/build/config.js","/Users/muhammedislam/hof/frontend/template-partials/index.js","/Users/muhammedislam/hof/frontend/template-partials/translations/index.js","/Users/muhammedislam/hof/frontend/themes/index.js","/Users/muhammedislam/hof/frontend/themes/gov-uk/index.js","/Users/muhammedislam/hof/frontend/toolkit/index.js","/Users/muhammedislam/hof/frontend/toolkit/assets/javascript/helpers.js","/Users/muhammedislam/hof/frontend/toolkit/assets/javascript/form-focus.js","/Users/muhammedislam/hof/frontend/toolkit/assets/javascript/progressive-reveal.js","/Users/muhammedislam/hof/frontend/toolkit/assets/javascript/validation.js","/Users/muhammedislam/hof/frontend/toolkit/assets/javascript/character-count.js","/Users/muhammedislam/hof/middleware/index.js","/Users/muhammedislam/hof/middleware/cookies.js","/Users/muhammedislam/hof/middleware/errors.js","/Users/muhammedislam/hof/middleware/not-found.js","/Users/muhammedislam/hof/middleware/deep-translate.js","/Users/muhammedislam/hof/lib/markdown.js","/Users/muhammedislam/hof/lib/router.js","/Users/muhammedislam/hof/wizard/index.js","/Users/muhammedislam/hof/wizard/behaviours/index.js","/Users/muhammedislam/hof/wizard/behaviours/complete.js","/Users/muhammedislam/hof/wizard/util/constants.js","/Users/muhammedislam/hof/lib/helpers.js","/Users/muhammedislam/hof/lib/health.js","/Users/muhammedislam/hof/lib/serve-static.js","/Users/muhammedislam/hof/lib/ga-tag.js","/Users/muhammedislam/hof/lib/deindex.js","/Users/muhammedislam/hof/lib/sessions.js","/Users/muhammedislam/hof/lib/settings.js","/Users/muhammedislam/hof/lib/logger.js","/Users/muhammedislam/hof/build/index.js","/Users/muhammedislam/hof/config/builder-defaults.js","/Users/muhammedislam/hof/transpiler/index.js","/Users/muhammedislam/hof/transpiler/lib/compile.js","/Users/muhammedislam/hof/transpiler/lib/build.js","/Users/muhammedislam/hof/transpiler/lib/expand-dirs.js","/Users/muhammedislam/hof/transpiler/lib/aggregate.js","/Users/muhammedislam/hof/transpiler/lib/write-files.js","/Users/muhammedislam/hof/model/apis/index.js","/Users/muhammedislam/hof/model/apis/html-to-pdf-converter.js","/Users/muhammedislam/hof/wizard/model.js","/Users/muhammedislam/hof/wizard/middleware/back-links.js","/Users/muhammedislam/hof/wizard/util/helpers.js","/Users/muhammedislam/hof/wizard/middleware/check-complete.js","/Users/muhammedislam/hof/wizard/middleware/check-progress.js","/Users/muhammedislam/hof/wizard/middleware/check-session.js","/Users/muhammedislam/hof/wizard/middleware/csrf.js","/Users/muhammedislam/hof/sandbox/test/_unit/example_app/sections/summary-data-sections.spec.js","/Users/muhammedislam/hof/sandbox/apps/sandbox/sections/summary-data-sections.js","/Users/muhammedislam/hof/sandbox/apps/sandbox/lib/staticAppealStages.js","/Users/muhammedislam/hof/sandbox/apps/sandbox/fields.js","/Users/muhammedislam/hof/sandbox/test/helpers/utilities.js","/Users/muhammedislam/hof/sandbox/apps/sandbox/behaviours/international-number.js","/Users/muhammedislam/hof/lib/encryption.js","/Users/muhammedislam/hof/wizard/middleware/session.js","/Users/muhammedislam/hof/wizard/middleware/session-model.js"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"processes":{"ceb540e1-f717-439d-a812-314eccd5fb69":{"parent":null,"children":[]}},"files":{"/Users/muhammedislam/hof/model/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/model/apis/axios-settings.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/address-lookup/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/address-lookup/default-model.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/address-lookup/defaults.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/postcode-lookup/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/postcode-lookup/defaults.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/postcode-lookup/postcode-lookup.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/clear-session/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/combine-and-loop-fields/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/date/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/date/fields.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/emailer/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/emailer/email-service.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/emailer/emailer.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/emailer/transports/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/emailer/transports/smtp.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/emailer/transports/ses.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/emailer/transports/stub.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/emailer/transports/debug.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/homeoffice-countries/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/config/component-defaults.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/notify/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/notify/notify.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/components/summary/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/config/rate-limits.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/middleware/rate-limiter.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/config/hof-defaults.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/utilities/reqres/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/controller/base-controller.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/controller/formatting/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/controller/validation/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/controller/validation/validators.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/controller/validation/email.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/controller/validation-error.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/utilities/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/utilities/autofill/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/utilities/autofill/inputs.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/utilities/test-data/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/utilities/countries.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/utilities/helpers/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/config/sanitisation-rules.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/controller/formatting/formatters.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/controller/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/controller/behaviour-session.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/controller/behaviour-hooks.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/controller/controller.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/sandbox/apps/sandbox/behaviours/country-select.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/template-mixins/mixins/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/template-mixins/mixins/template-mixins.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/template-mixins/mixins/render.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/template-mixins/mixins/helpers.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/govuk-template/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/govuk-template/build/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/govuk-template/build/config.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/template-partials/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/template-partials/translations/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/themes/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/themes/gov-uk/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/toolkit/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/toolkit/assets/javascript/helpers.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/toolkit/assets/javascript/form-focus.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/toolkit/assets/javascript/progressive-reveal.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/toolkit/assets/javascript/validation.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/frontend/toolkit/assets/javascript/character-count.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/middleware/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/middleware/cookies.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/middleware/errors.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/middleware/not-found.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/middleware/deep-translate.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/lib/markdown.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/lib/router.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/wizard/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/wizard/behaviours/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/wizard/behaviours/complete.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/wizard/util/constants.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/lib/helpers.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/lib/health.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/lib/serve-static.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/lib/ga-tag.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/lib/deindex.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/lib/sessions.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/lib/settings.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/lib/logger.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/build/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/config/builder-defaults.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/transpiler/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/transpiler/lib/compile.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/transpiler/lib/build.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/transpiler/lib/expand-dirs.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/transpiler/lib/aggregate.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/transpiler/lib/write-files.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/model/apis/index.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/model/apis/html-to-pdf-converter.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/wizard/model.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/wizard/middleware/back-links.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/wizard/util/helpers.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/wizard/middleware/check-complete.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/wizard/middleware/check-progress.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/wizard/middleware/check-session.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/wizard/middleware/csrf.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/sandbox/test/_unit/example_app/sections/summary-data-sections.spec.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/sandbox/apps/sandbox/sections/summary-data-sections.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/sandbox/apps/sandbox/lib/staticAppealStages.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/sandbox/apps/sandbox/fields.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/sandbox/test/helpers/utilities.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/sandbox/apps/sandbox/behaviours/international-number.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/lib/encryption.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/wizard/middleware/session.js":["ceb540e1-f717-439d-a812-314eccd5fb69"],"/Users/muhammedislam/hof/wizard/middleware/session-model.js":["ceb540e1-f717-439d-a812-314eccd5fb69"]},"externalIds":{}}
|
package/components/index.js
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
/* eslint max-len: 0, no-process-env: 0 */
|
2
|
+
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
module.exports = {
|
6
|
+
CANT_FIND: 'I cannot find the correct address',
|
7
|
+
CHANGE: 'Change postcode',
|
8
|
+
SEARCH_BY_POSTCODE: 'Search address by postcode',
|
9
|
+
POSTCODE_HEADING: 'What is your UK postcode?',
|
10
|
+
POSTCODE_LABEL: 'Postcode',
|
11
|
+
POSTCODE_HINT: 'Enter a full UK postcode, for example AA3 1AB',
|
12
|
+
ADDRESS_LOOKUP_HEADING: 'Select the main applicant’s address',
|
13
|
+
MANUAL_ADDRESS_HEADING: 'Enter the main applicant’s address',
|
14
|
+
MANUAL_ADDRESS_PARAGRAPH: 'This must match the applicant’s address in Home Office records.',
|
15
|
+
SEARCH_ERROR_HEADING: 'Sorry, there is a problem with the postcode search',
|
16
|
+
SELECT_LABEL: 'Select the address',
|
17
|
+
ADDRESS_LINE_1_LABEL: 'Address line 1',
|
18
|
+
ADDRESS_LINE_2_LABEL: 'Address line 2 (optional)',
|
19
|
+
TOWN_OR_CITY_LABEL: 'Town or city',
|
20
|
+
POSTCODE_MANUAL_LABEL: 'Postcode',
|
21
|
+
POSTCODE_ERROR: {
|
22
|
+
'error-heading': 'Sorry, there is a problem with the postcode search',
|
23
|
+
'lookup-problem-title': 'Address lookup problem - GOV.UK'
|
24
|
+
},
|
25
|
+
NO_ADDRESS_HEADING: 'No address found',
|
26
|
+
ENTER_MANUALLY: 'Enter address manually',
|
27
|
+
ADDRESS_LOOKUP_SEARCH_TITLE: 'Postcode lookup search - GOV.UK',
|
28
|
+
ADDRESS_LOOKUP_TITLE: 'Address lookup - GOV.UK',
|
29
|
+
ADDRESS_DETAILS_TITLE: 'Address details - GOV.UK',
|
30
|
+
ADDRESS_LOOKUP_PROBLEM_TITLE: 'Address lookup problem - GOV.UK'
|
31
|
+
};
|
@@ -0,0 +1,373 @@
|
|
1
|
+
/* eslint-disable func-names */
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
const path = require('path');
|
5
|
+
const querystring = require('querystring');
|
6
|
+
const _ = require('lodash');
|
7
|
+
const { createLogger, format, transports } = require('winston');
|
8
|
+
const { combine, timestamp, json } = format;
|
9
|
+
|
10
|
+
const defaults = require('./defaults');
|
11
|
+
|
12
|
+
const PostcodeLookup = require('./postcode-lookup');
|
13
|
+
|
14
|
+
const logger = createLogger({
|
15
|
+
format: combine(timestamp(), json()),
|
16
|
+
transports: [new transports.Console({level: 'info', handleExceptions: true})]
|
17
|
+
});
|
18
|
+
|
19
|
+
const conditionalTranslate = (key, customFormTranslation) => {
|
20
|
+
let result = customFormTranslation(key);
|
21
|
+
if (result === key) {
|
22
|
+
result = null;
|
23
|
+
}
|
24
|
+
return result;
|
25
|
+
};
|
26
|
+
|
27
|
+
const getFields = (fieldPrefix, customFormTranslation, requiredValidate, req) => ({
|
28
|
+
[`${fieldPrefix}-postcode`]: {
|
29
|
+
label: conditionalTranslate(`fields.${fieldPrefix}-postcode.label`, customFormTranslation) ||
|
30
|
+
defaults.POSTCODE_LABEL,
|
31
|
+
labelClassName: 'visuallyhidden',
|
32
|
+
hint: conditionalTranslate(`fields.${fieldPrefix}-postcode.hint`, customFormTranslation) || defaults.POSTCODE_HINT,
|
33
|
+
mixin: 'input-text',
|
34
|
+
validate: requiredValidate ? ['required', 'postcodeValidation'] : 'postcodeValidation',
|
35
|
+
formatter: 'uppercase',
|
36
|
+
className: ['govuk-input', 'govuk-input--width-10']
|
37
|
+
},
|
38
|
+
[`${fieldPrefix}-select`]: {
|
39
|
+
label: conditionalTranslate(`fields.${fieldPrefix}-select.label`, customFormTranslation) || defaults.SELECT_LABEL,
|
40
|
+
mixin: 'radio-group',
|
41
|
+
validate: 'required',
|
42
|
+
options: req.sessionModel.get('addressesOptions')
|
43
|
+
},
|
44
|
+
[fieldPrefix]: {
|
45
|
+
label: conditionalTranslate(`fields.${fieldPrefix}.label`, customFormTranslation) || defaults.ADDRESS_LINE_1_LABEL,
|
46
|
+
mixin: 'input-text',
|
47
|
+
validate: 'required',
|
48
|
+
labelClassName: 'bold'
|
49
|
+
},
|
50
|
+
[`${fieldPrefix}-address-line-2`]: {
|
51
|
+
label: conditionalTranslate(`fields.${fieldPrefix}-address-line-2.label`, customFormTranslation) ||
|
52
|
+
defaults.ADDRESS_LINE_2_LABEL,
|
53
|
+
mixin: 'input-text',
|
54
|
+
'ignore-defaults': true,
|
55
|
+
labelClassName: 'bold'
|
56
|
+
},
|
57
|
+
[`${fieldPrefix}-town-or-city`]: {
|
58
|
+
label: conditionalTranslate(`fields${fieldPrefix}-town-or-city.label`, customFormTranslation) ||
|
59
|
+
defaults.TOWN_OR_CITY_LABEL,
|
60
|
+
mixin: 'input-text',
|
61
|
+
validate: 'required',
|
62
|
+
'ignore-defaults': true,
|
63
|
+
labelClassName: 'bold'
|
64
|
+
},
|
65
|
+
[`${fieldPrefix}-postcode-manual`]: {
|
66
|
+
label: conditionalTranslate(`fields.${fieldPrefix}-postcode-manual.label`, customFormTranslation) ||
|
67
|
+
defaults.POSTCODE_MANUAL_LABEL,
|
68
|
+
mixin: 'input-text',
|
69
|
+
validate: requiredValidate ? ['required', 'postcodeValidation'] : 'postcodeValidation',
|
70
|
+
formatter: 'uppercase',
|
71
|
+
className: ['govuk-input', 'govuk-input--width-10'],
|
72
|
+
labelClassName: 'bold'
|
73
|
+
}
|
74
|
+
});
|
75
|
+
|
76
|
+
const getConfig = fieldNamePrefix => ({
|
77
|
+
postcode: {
|
78
|
+
fields: [`${fieldNamePrefix}-postcode`],
|
79
|
+
template: 'postcode'
|
80
|
+
},
|
81
|
+
lookup: {
|
82
|
+
fields: [`${fieldNamePrefix}-select`],
|
83
|
+
template: 'address-lookup'
|
84
|
+
},
|
85
|
+
manual: {
|
86
|
+
fields: [`${fieldNamePrefix}`, `${fieldNamePrefix}-address-line-2`, `${fieldNamePrefix}-town-or-city`,
|
87
|
+
`${fieldNamePrefix}-postcode-manual`],
|
88
|
+
template: 'address'
|
89
|
+
},
|
90
|
+
postcodeSearchIssue: {
|
91
|
+
fields: [],
|
92
|
+
template: 'postcode-search-problem'
|
93
|
+
}
|
94
|
+
});
|
95
|
+
|
96
|
+
module.exports = config => {
|
97
|
+
let postcode = '';
|
98
|
+
let apiKey;
|
99
|
+
let apiURL;
|
100
|
+
let required;
|
101
|
+
let addressFieldNamePrefix;
|
102
|
+
|
103
|
+
if (config !== undefined) {
|
104
|
+
apiKey = config.apiKey;
|
105
|
+
apiURL = config.apiURL;
|
106
|
+
required = config.required;
|
107
|
+
addressFieldNamePrefix = config.addressFieldNamePrefix;
|
108
|
+
}
|
109
|
+
|
110
|
+
return superclass => class extends superclass {
|
111
|
+
configure(req, res, callback) {
|
112
|
+
req.query.step = req.query.step || 'postcode';
|
113
|
+
const subSteps = getConfig(addressFieldNamePrefix);
|
114
|
+
const step = subSteps[req.query.step];
|
115
|
+
_.merge(req.form.options, {
|
116
|
+
subSteps,
|
117
|
+
addressKey: addressFieldNamePrefix,
|
118
|
+
fields: _.pick(getFields(addressFieldNamePrefix, req.translate, required, req), step.fields),
|
119
|
+
apiError: null
|
120
|
+
});
|
121
|
+
if (step.template) {
|
122
|
+
req.form.options.template = path.resolve(__dirname, `./templates/${step.template}.html`);
|
123
|
+
}
|
124
|
+
super.configure(req, res, callback);
|
125
|
+
}
|
126
|
+
|
127
|
+
getNextStep(req, res, callback) {
|
128
|
+
const step = super.getNextStep(req, res, callback);
|
129
|
+
|
130
|
+
if (req.query.step === 'postcode' && req.form.values[`${addressFieldNamePrefix}-postcode`]) {
|
131
|
+
let nextSubStep = '';
|
132
|
+
// Go to manual entry page with pre-populated fields
|
133
|
+
nextSubStep = req.sessionModel.get(`${addressFieldNamePrefix}-addresses`) ? 'lookup' : 'address';
|
134
|
+
const qs = querystring.stringify(_.merge({}, req.query, {
|
135
|
+
step: nextSubStep
|
136
|
+
}));
|
137
|
+
return `?${qs}`;
|
138
|
+
} else if (req.query.step === 'lookup' && req.sessionModel.get(`${addressFieldNamePrefix}-select`) !== '') {
|
139
|
+
req.form.values[`${addressFieldNamePrefix}-select`] =
|
140
|
+
req.form.options.fields[`${addressFieldNamePrefix}-select`].apiAddress;
|
141
|
+
let nextSubStep = '';
|
142
|
+
nextSubStep = 'manual';
|
143
|
+
req.query.step = 'manual';
|
144
|
+
req.form.values.address = '';
|
145
|
+
const qs = querystring.stringify(_.merge({}, req.query, {
|
146
|
+
step: nextSubStep
|
147
|
+
}));
|
148
|
+
return `?${qs}`;
|
149
|
+
}
|
150
|
+
return step;
|
151
|
+
}
|
152
|
+
|
153
|
+
constructAddressLineValues(addressAttributes) {
|
154
|
+
const addressLines = {
|
155
|
+
addressLine1: '',
|
156
|
+
addressLine2: ''
|
157
|
+
};
|
158
|
+
|
159
|
+
if (addressAttributes.ORGANISATION_NAME !== undefined && addressAttributes.BUILDING_NAME !== undefined &&
|
160
|
+
addressAttributes.BUILDING_NUMBER !== undefined) {
|
161
|
+
addressLines.addressLine1 = addressAttributes.ORGANISATION_NAME + ', ' + addressAttributes.BUILDING_NAME;
|
162
|
+
addressLines.addressLine2 = addressAttributes.BUILDING_NUMBER + ' ' + addressAttributes.THOROUGHFARE_NAME;
|
163
|
+
} else if (addressAttributes.ORGANISATION_NAME !== undefined && addressAttributes.BUILDING_NAME !== undefined) {
|
164
|
+
addressLines.addressLine1 = addressAttributes.ORGANISATION_NAME + ', ' + addressAttributes.BUILDING_NAME;
|
165
|
+
addressLines.addressLine2 = addressAttributes.THOROUGHFARE_NAME;
|
166
|
+
} else if (addressAttributes.ORGANISATION_NAME !== undefined && addressAttributes.BUILDING_NUMBER !== undefined) {
|
167
|
+
addressLines.addressLine1 = addressAttributes.ORGANISATION_NAME;
|
168
|
+
addressLines.addressLine2 = addressAttributes.BUILDING_NUMBER + ' ' + addressAttributes.THOROUGHFARE_NAME;
|
169
|
+
} else if (addressAttributes.SUB_BUILDING_NAME !== undefined && addressAttributes.BUILDING_NUMBER !== undefined &&
|
170
|
+
addressAttributes.THOROUGHFARE_NAME !== undefined) {
|
171
|
+
addressLines.addressLine1 = addressAttributes.SUB_BUILDING_NAME + ', ' + addressAttributes.BUILDING_NUMBER +
|
172
|
+
' ' + addressAttributes.THOROUGHFARE_NAME;
|
173
|
+
} else if (addressAttributes.BUILDING_NAME !== undefined && addressAttributes.THOROUGHFARE_NAME !== undefined) {
|
174
|
+
addressLines.addressLine1 = addressAttributes.BUILDING_NAME + ' ' + addressAttributes.THOROUGHFARE_NAME;
|
175
|
+
} else {
|
176
|
+
addressLines.addressLine1 = addressAttributes.BUILDING_NUMBER + ' ' + addressAttributes.THOROUGHFARE_NAME;
|
177
|
+
}
|
178
|
+
|
179
|
+
return addressLines;
|
180
|
+
}
|
181
|
+
|
182
|
+
buildAddressOptions(req, addresses) {
|
183
|
+
req.sessionModel.set('addressesOptions', addresses.map(obj => {
|
184
|
+
const addressLines = this.constructAddressLineValues(obj);
|
185
|
+
const addressValue = obj.ADDRESS;
|
186
|
+
const townOrCity = obj.POST_TOWN;
|
187
|
+
// Get element ID to be used in determining if radio button is checked in the saveValues section
|
188
|
+
const radioButtonId = `${addressFieldNamePrefix}-select-${obj.ADDRESS}`;
|
189
|
+
return {
|
190
|
+
elementId: radioButtonId,
|
191
|
+
label: addressValue,
|
192
|
+
value: addressValue,
|
193
|
+
addressLine1: addressLines.addressLine1,
|
194
|
+
addressLine2: addressLines.addressLine2,
|
195
|
+
townOrCity: townOrCity
|
196
|
+
};
|
197
|
+
}));
|
198
|
+
}
|
199
|
+
|
200
|
+
createRadioGroupField(req, addresses) {
|
201
|
+
req.form.options.fields[`${addressFieldNamePrefix}-select`] = {
|
202
|
+
mixin: 'radio-group',
|
203
|
+
legend: {
|
204
|
+
className: 'visuallyhidden'
|
205
|
+
},
|
206
|
+
className: 'govuk-radios--inline',
|
207
|
+
validate: ['required'],
|
208
|
+
options: req.sessionModel.get('addressesOptions')
|
209
|
+
};
|
210
|
+
req.sessionModel.set('addressCount', addresses.length);
|
211
|
+
}
|
212
|
+
|
213
|
+
getValues(req, res, callback) {
|
214
|
+
if (req.query.step === 'lookup') {
|
215
|
+
const addresses = req.sessionModel.get(`${addressFieldNamePrefix}-addresses`);
|
216
|
+
this.buildAddressOptions(req, addresses);
|
217
|
+
this.createRadioGroupField(req, addresses);
|
218
|
+
}
|
219
|
+
super.getValues(req, res, callback);
|
220
|
+
}
|
221
|
+
|
222
|
+
locals(req, res, callback) {
|
223
|
+
const isManualStep = req.query.step === 'manual';
|
224
|
+
const locals = super.locals(req, res, callback);
|
225
|
+
const sessionPostcode = req.sessionModel.get(`${addressFieldNamePrefix}-postcode`);
|
226
|
+
const section = this.options.route.replace(/^\//, '');
|
227
|
+
const editLink = conditionalTranslate('pages.address-lookup.edit', req.translate) || defaults.CHANGE;
|
228
|
+
const searchByPostcodeLink = conditionalTranslate('pages.address.searchByPostcode', req.translate) ||
|
229
|
+
defaults.SEARCH_BY_POSTCODE;
|
230
|
+
const cantFind = conditionalTranslate('pages.address-lookup.cantfind', req.translate) || defaults.CANT_FIND;
|
231
|
+
|
232
|
+
if (isManualStep) {
|
233
|
+
req.form.values['postcode-manual'] = sessionPostcode;
|
234
|
+
}
|
235
|
+
|
236
|
+
let addressCount = '';
|
237
|
+
if (req.sessionModel.get('addressCount') === 1) {
|
238
|
+
addressCount = '1 address for ';
|
239
|
+
} else {
|
240
|
+
addressCount = req.sessionModel.get('addressCount') + ' addresses for ';
|
241
|
+
}
|
242
|
+
|
243
|
+
return _.merge({}, locals, {
|
244
|
+
enterManually: conditionalTranslate('pages.address.lookup.enter-manually', req.translate) ||
|
245
|
+
defaults.ENTER_MANUALLY,
|
246
|
+
postcodeHeading: conditionalTranslate('pages.postcode.postcode-heading', req.translate) ||
|
247
|
+
defaults.POSTCODE_HEADING,
|
248
|
+
addressLookupHeading: conditionalTranslate('pages.address-lookup.address-lookup-heading', req.translate) ||
|
249
|
+
defaults.ADDRESS_LOOKUP_HEADING,
|
250
|
+
manualAddressHeading: conditionalTranslate('pages.address-lookup.manual-address-heading', req.translate) ||
|
251
|
+
defaults.MANUAL_ADDRESS_HEADING,
|
252
|
+
manualAddressParagraph: conditionalTranslate('pages.address-lookup.manual-address-paragraph', req.translate) ||
|
253
|
+
defaults.MANUAL_ADDRESS_PARAGRAPH,
|
254
|
+
searchErrorHeading: conditionalTranslate('pages.postcode-search-problem.searchErrorHeading', req.translate) ||
|
255
|
+
defaults.POSTCODE_ERROR['error-heading'],
|
256
|
+
postcodeEntered: sessionPostcode,
|
257
|
+
addressesExist: (req.sessionModel.get(`${addressFieldNamePrefix}-addresses`) !== undefined &&
|
258
|
+
req.sessionModel.get(`${addressFieldNamePrefix}-addresses`).length > 0) ? true : false,
|
259
|
+
noAddressHeading: conditionalTranslate('pages.postcode-search-problem.noAddressHeading', req.translate) ||
|
260
|
+
defaults.NO_ADDRESS_HEADING,
|
261
|
+
addressCount: addressCount,
|
262
|
+
postcodeSearchTitle: conditionalTranslate('pages.postcode-search.title', req.translate) ||
|
263
|
+
defaults.ADDRESS_LOOKUP_SEARCH_TITLE,
|
264
|
+
addressLookupTitle: conditionalTranslate('pages.address-lookup.title', req.translate) ||
|
265
|
+
defaults.ADDRESS_LOOKUP_TITLE,
|
266
|
+
addressDetailsTitle: conditionalTranslate('pages.address-details.title', req.translate) ||
|
267
|
+
defaults.ADDRESS_DETAILS_TITLE,
|
268
|
+
lookupProblemTitle: conditionalTranslate('pages.address-lookup-problem.title', req.translate) ||
|
269
|
+
defaults.POSTCODE_ERROR['lookup-problem-title'],
|
270
|
+
route: this.options.route,
|
271
|
+
editLink,
|
272
|
+
cantFind,
|
273
|
+
searchByPostcodeLink,
|
274
|
+
section
|
275
|
+
});
|
276
|
+
}
|
277
|
+
|
278
|
+
async postcode(req, res, callback) {
|
279
|
+
// Clear the value stored in the addresses radio button group
|
280
|
+
req.sessionModel.set(`${addressFieldNamePrefix}-select`, '');
|
281
|
+
// Call OS Places API to return list of addresses by postcode
|
282
|
+
const enteredPostcode = req.form.values[`${addressFieldNamePrefix}-postcode`];
|
283
|
+
|
284
|
+
await PostcodeLookup(enteredPostcode, apiURL, apiKey)
|
285
|
+
.then(function (response) {
|
286
|
+
if(response.data) {
|
287
|
+
const addressList = [];
|
288
|
+
_.forOwn(response.data.results, function (value) {
|
289
|
+
addressList.push(value.DPA);
|
290
|
+
});
|
291
|
+
|
292
|
+
req.sessionModel.set(`${addressFieldNamePrefix}-addresses`, addressList);
|
293
|
+
return callback();
|
294
|
+
}
|
295
|
+
throw new Error('Unexpected postcode response data structure');
|
296
|
+
}).catch(error => {
|
297
|
+
return callback(error);
|
298
|
+
});
|
299
|
+
}
|
300
|
+
|
301
|
+
setupRadioButton(req, addresses) {
|
302
|
+
req.form.options.fields[`${addressFieldNamePrefix}-addresses`] = {
|
303
|
+
mixin: 'radio-group',
|
304
|
+
isPageHeading: true,
|
305
|
+
validate: ['required'],
|
306
|
+
options: addresses.map(obj => {
|
307
|
+
const addressValue = obj.ADDRESS;
|
308
|
+
return {
|
309
|
+
label: addressValue,
|
310
|
+
value: addressValue
|
311
|
+
};
|
312
|
+
})
|
313
|
+
};
|
314
|
+
}
|
315
|
+
|
316
|
+
clearAddressFieldValues(req) {
|
317
|
+
req.form.values[`${addressFieldNamePrefix}`] = '';
|
318
|
+
req.form.values[`${addressFieldNamePrefix}-address-line-2`] = '';
|
319
|
+
req.form.values[`${addressFieldNamePrefix}-town-or-city`] = '';
|
320
|
+
req.form.values[`${addressFieldNamePrefix}-postcode-manual`] = '';
|
321
|
+
}
|
322
|
+
|
323
|
+
setFieldValuesInManualEntryPage(req) {
|
324
|
+
const addressResult = req.form.options.fields[`${addressFieldNamePrefix}-select`].options.filter(obj => {
|
325
|
+
return obj.value === req.form.values[`${addressFieldNamePrefix}-select`].replace(/[!?<>{}]/g, '');
|
326
|
+
});
|
327
|
+
const addressLine1 = addressResult[0].addressLine1;
|
328
|
+
const addressLine2 = addressResult[0].addressLine2;
|
329
|
+
const townOrCity = addressResult[0].townOrCity;
|
330
|
+
req.form.values[`${addressFieldNamePrefix}`] = addressLine1;
|
331
|
+
req.form.values[`${addressFieldNamePrefix}-address-line-2`] = addressLine2;
|
332
|
+
req.form.values[`${addressFieldNamePrefix}-town-or-city`] = townOrCity;
|
333
|
+
req.form.values[`${addressFieldNamePrefix}-postcode-manual`] = postcode;
|
334
|
+
req.sessionModel.set('lookup-postcode', postcode);
|
335
|
+
req.sessionModel.set('lookup-address-line-1', addressLine1);
|
336
|
+
req.sessionModel.set('lookup-address-line-2', addressLine2);
|
337
|
+
req.sessionModel.set('lookup-town-or-city', townOrCity);
|
338
|
+
|
339
|
+
req.form.values[`${addressFieldNamePrefix}-select`] =
|
340
|
+
req.form.options.fields[`${addressFieldNamePrefix}-select`].apiAddress;
|
341
|
+
}
|
342
|
+
|
343
|
+
saveValues(req, res, callback) {
|
344
|
+
const step = req.query.step;
|
345
|
+
if (step === 'postcode') {
|
346
|
+
postcode = req.form.values[`${addressFieldNamePrefix}-postcode`];
|
347
|
+
this.clearAddressFieldValues(req);
|
348
|
+
return this.postcode(req, res, err => {
|
349
|
+
if (err) {
|
350
|
+
logger.log({
|
351
|
+
level: 'info',
|
352
|
+
message: `Error returned by postcode API: ${err}`
|
353
|
+
});
|
354
|
+
req.sessionModel.set('addresses', []);
|
355
|
+
return res.redirect(req.baseUrl + '/postcode?step=postcodeSearchIssue');
|
356
|
+
}
|
357
|
+
return super.saveValues(req, res, callback);
|
358
|
+
});
|
359
|
+
} else if (step === 'lookup') {
|
360
|
+
this.setFieldValuesInManualEntryPage(req);
|
361
|
+
}
|
362
|
+
return super.saveValues(req, res, callback);
|
363
|
+
}
|
364
|
+
|
365
|
+
getBackLink(req, res) {
|
366
|
+
let backLink = super.getBackLink(req, res);
|
367
|
+
if (_.includes(['manual', 'address', 'lookup'], req.query.step)) {
|
368
|
+
backLink = req.baseUrl + req.path;
|
369
|
+
}
|
370
|
+
return backLink;
|
371
|
+
}
|
372
|
+
};
|
373
|
+
};
|
@@ -0,0 +1,37 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
const axios = require('axios');
|
4
|
+
|
5
|
+
const getAddresses = async (enteredPostcode, apiURL, apiKey) => {
|
6
|
+
try {
|
7
|
+
let addressesResult;
|
8
|
+
if (process.env.NODE_ENV === 'test') {
|
9
|
+
if (enteredPostcode === '') {
|
10
|
+
addressesResult = {};
|
11
|
+
} else {
|
12
|
+
addressesResult = {
|
13
|
+
data: {
|
14
|
+
results: [
|
15
|
+
{
|
16
|
+
DPA: {
|
17
|
+
ADDRESS: 'abc',
|
18
|
+
NUMBER: '1',
|
19
|
+
STREET_NAME: 'Test Lane',
|
20
|
+
TOWN: 'LONDON',
|
21
|
+
POSTCODE: 'ABC 123'
|
22
|
+
}
|
23
|
+
}
|
24
|
+
]
|
25
|
+
}
|
26
|
+
};
|
27
|
+
}
|
28
|
+
return addressesResult;
|
29
|
+
}
|
30
|
+
addressesResult = await axios.get(apiURL + '?postcode=' + enteredPostcode + '&key=' + apiKey);
|
31
|
+
return addressesResult;
|
32
|
+
} catch (err) {
|
33
|
+
throw err;
|
34
|
+
}
|
35
|
+
};
|
36
|
+
|
37
|
+
module.exports = getAddresses;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
{{<partials-page}}
|
2
|
+
{{$pageTitle}}{{addressLookupTitle}}{{/pageTitle}}
|
3
|
+
{{$page-content}}
|
4
|
+
{{#addressesExist}}
|
5
|
+
<h1 class="govuk-heading-l">{{addressLookupHeading}}</h1>
|
6
|
+
{{/addressesExist}}
|
7
|
+
{{^addressesExist}}
|
8
|
+
<h1 class="govuk-heading-l">{{noAddressHeading}}</h1>
|
9
|
+
{{/addressesExist}}
|
10
|
+
<div id="addressCountSection">
|
11
|
+
<label>{{addressCount}}</label>
|
12
|
+
<strong><span class="postcode">{{postcodeEntered}}</span></strong>
|
13
|
+
<span class="changePostcodeButton">
|
14
|
+
<a class="change-postcode govuk-button govuk-button--secondary" href="{{#qs}}step=postcode{{/qs}}">{{editLink}}</a>
|
15
|
+
</span>
|
16
|
+
</div>
|
17
|
+
{{#fields}}
|
18
|
+
{{#renderField}}{{/renderField}}
|
19
|
+
{{/fields}}
|
20
|
+
{{#addressesExist}}
|
21
|
+
{{#input-submit}}continue{{/input-submit}}
|
22
|
+
{{/addressesExist}}
|
23
|
+
{{#addressesExist}}
|
24
|
+
<p><span class="link"><a class="cant-find" href="{{#qs}}step=manual{{/qs}}">{{cantFind}}</a></span></p>
|
25
|
+
{{/addressesExist}}
|
26
|
+
{{^addressesExist}}
|
27
|
+
<p><span class="link"><a href="{{#qs}}step=manual{{/qs}}">{{enterManually}}</a></span></p>
|
28
|
+
{{/addressesExist}}
|
29
|
+
{{/page-content}}
|
30
|
+
{{/partials-page}}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
{{<partials-page}}
|
2
|
+
{{$pageTitle}}{{addressDetailsTitle}}{{/pageTitle}}
|
3
|
+
{{$page-content}}
|
4
|
+
{{#postcode}}
|
5
|
+
<p class="govuk-body">
|
6
|
+
<label>{{postcodeEntered}}</label>
|
7
|
+
<strong><span class="postcode">{{postcode}}</span></strong>
|
8
|
+
<strong><span class="link"><a class="change-postcode" href="{{#qs}}step=postcode{{/qs}}">{{editLink}}</a></span></strong>
|
9
|
+
</p>
|
10
|
+
{{/postcode}}
|
11
|
+
{{#postcodeError}}
|
12
|
+
<div class="alert-info">
|
13
|
+
<span class="info-message">
|
14
|
+
{{postcodeError}}
|
15
|
+
</span>
|
16
|
+
</div>
|
17
|
+
{{/postcodeError}}
|
18
|
+
<h1 class="govuk-heading-l">{{manualAddressHeading}}</h1>
|
19
|
+
<p class="govuk-body">{{manualAddressParagraph}}</p>
|
20
|
+
{{#fields}}
|
21
|
+
{{#renderField}}{{/renderField}}
|
22
|
+
{{/fields}}
|
23
|
+
{{#input-submit}}continue{{/input-submit}}
|
24
|
+
<br />
|
25
|
+
<span class="link"><a class="change-postcode" href="{{#qs}}step=postcode{{/qs}}">{{searchByPostcodeLink}}</a></span>
|
26
|
+
{{/page-content}}
|
27
|
+
{{/partials-page}}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{{<partials-page}}
|
2
|
+
{{$pageTitle}}{{lookupProblemTitle}}{{/pageTitle}}
|
3
|
+
{{$page-content}}
|
4
|
+
<h1 class="govuk-heading-l">{{searchErrorHeading}}</h1>
|
5
|
+
<p><span class="link"><a class="govuk-button" href="{{#qs}}step=manual{{/qs}}">{{enterManually}}</a></span></p>
|
6
|
+
{{/page-content}}
|
7
|
+
{{/partials-page}}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{{<partials-page}}
|
2
|
+
{{$pageTitle}}{{postcodeSearchTitle}}{{/pageTitle}}
|
3
|
+
{{$page-content}}
|
4
|
+
<h1 class="govuk-heading-l">{{postcodeHeading}}</h1>
|
5
|
+
{{#fields}}
|
6
|
+
{{#hint}}
|
7
|
+
<span id="{{key}}-hint" class="govuk-hint">{{hint}}</span>
|
8
|
+
{{/hint}}
|
9
|
+
{{#renderField}}{{/renderField}}{{#input-submit}}find-address{{/input-submit}}
|
10
|
+
{{/fields}}
|
11
|
+
<p><span class="link"><a href="{{#qs}}step=manual{{/qs}}">{{enterManually}}</a></span></p>
|
12
|
+
{{/page-content}}
|
13
|
+
{{/partials-page}}
|
package/config/hof-defaults.js
CHANGED
@@ -30,7 +30,6 @@ const defaults = {
|
|
30
30
|
return convertPage(page);
|
31
31
|
}
|
32
32
|
},
|
33
|
-
deIndexForm: process.env.DEINDEX_FORM || 'false',
|
34
33
|
gaCrossDomainTrackingTagId: process.env.GDS_CROSS_DOMAIN_GA_TAG,
|
35
34
|
loglevel: process.env.LOG_LEVEL || 'info',
|
36
35
|
ignoreMiddlewareLogs: ['/healthz'],
|
@@ -176,6 +176,11 @@ module.exports = Validators = {
|
|
176
176
|
postcode(value) {
|
177
177
|
// eslint-disable-next-line max-len
|
178
178
|
return value === '' || Validators.regex(value, /^(([GIR] ?0[A]{2})|((([A-Z][0-9]{1,2})|(([A-Z][A-HJ-Y][0-9]{1,2})|(([A-Z][0-9][A-Z])|([A-Z][A-HJ-Y][0-9]?[A-Z])))) ?[0-9][A-Z]{2}))$/i);
|
179
|
+
},
|
180
|
+
|
181
|
+
postcodeValidation(value) {
|
182
|
+
// eslint-disable-next-line max-len
|
183
|
+
return Validators.regex(value, /^(([GIRgir] ?[ ]*0[ ]*[Aa]{2}[ ]*)|((([A-Za-z][ ]*[0-9]{1,2}[ ]*)|(([A-Za-z][ ]*[A-Ha-hJ-Yj-y][ ]*[0-9][ ]*[0-9]?)[ ]*|(([A-Za-z][ ]*[0-9][ ]*[A-Za-z][ ]*)|([A-Za-z][ ]*[A-Ha-hJ-Yj-y][ ]*[0-9]?[ ]*[A-Za-z][ ]*))))[-,. ]?[ ]*[0-9][ ]*[A-Za-z][ ]*[A-Za-z][ ]*))$/);
|
179
184
|
}
|
180
185
|
|
181
186
|
};
|