hof 21.0.20-axios-beta → 22.0.0-timeout-warning-beta.1

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 (33) hide show
  1. package/.nyc_output/39337dba-f075-4b5c-ad46-31665a16d443.json +1 -0
  2. package/.nyc_output/processinfo/39337dba-f075-4b5c-ad46-31665a16d443.json +1 -0
  3. package/.nyc_output/processinfo/index.json +1 -1
  4. package/CHANGELOG.md +16 -0
  5. package/codeReviewChecklist.md +22 -0
  6. package/config/hof-defaults.js +11 -2
  7. package/frontend/govuk-template/build/govuk_template.html +3 -4
  8. package/frontend/govuk-template/govuk_template_generated.html +3 -4
  9. package/frontend/template-mixins/mixins/template-mixins.js +1 -0
  10. package/frontend/template-mixins/partials/forms/checkbox.html +5 -0
  11. package/frontend/template-mixins/partials/forms/input-text-group.html +1 -1
  12. package/frontend/template-mixins/partials/forms/select.html +6 -6
  13. package/frontend/template-mixins/partials/forms/textarea-group.html +1 -1
  14. package/frontend/template-partials/views/partials/head.html +8 -10
  15. package/frontend/template-partials/views/partials/page.html +1 -0
  16. package/frontend/template-partials/views/partials/session-timeout-warning.html +17 -0
  17. package/frontend/themes/gov-uk/client-js/index.js +2 -0
  18. package/frontend/themes/gov-uk/client-js/session-timeout-dialog.js +345 -0
  19. package/frontend/themes/gov-uk/styles/_session-timeout-dialog.scss +209 -0
  20. package/frontend/themes/gov-uk/styles/govuk.scss +1 -0
  21. package/index.js +8 -4
  22. package/lib/ga-tag.js +22 -13
  23. package/model/index.js +28 -29
  24. package/package.json +6 -7
  25. package/pull_request.md +16 -0
  26. package/sandbox/apps/sandbox/index.js +1 -0
  27. package/sandbox/package.json +1 -1
  28. package/sandbox/public/css/app.css +251 -6
  29. package/sandbox/public/js/bundle.js +37430 -26196
  30. package/sandbox/yarn.lock +14 -9
  31. package/.nyc_output/9651d42a-59d8-48e6-949c-655d9fa6db21.json +0 -1
  32. package/.nyc_output/processinfo/9651d42a-59d8-48e6-949c-655d9fa6db21.json +0 -1
  33. package/model/apis/axios-settings.js +0 -9
package/model/index.js CHANGED
@@ -2,12 +2,10 @@
2
2
  'use strict';
3
3
 
4
4
  const _ = require('lodash');
5
- const axios = require('axios').default;
5
+ const request = require('request');
6
6
  const url = require('url');
7
7
  const EventEmitter = require('events').EventEmitter;
8
8
 
9
- const axiosSetting = require('./apis/axios-settings');
10
-
11
9
  const REFERENCE = /^\$ref:/;
12
10
 
13
11
  function timeDiff(from, to, d) {
@@ -29,7 +27,7 @@ module.exports = class Model extends EventEmitter {
29
27
  this.set(attributes, {
30
28
  silent: true
31
29
  });
32
- this._request = axios;
30
+ this._request = request;
33
31
  }
34
32
 
35
33
  save(options, callback) {
@@ -49,6 +47,7 @@ module.exports = class Model extends EventEmitter {
49
47
  'Content-Type': 'application/json',
50
48
  'Content-Length': Buffer.byteLength(data)
51
49
  }, reqConf.headers || {});
50
+
52
51
  return this.request(reqConf, data, callback);
53
52
  });
54
53
  }
@@ -95,23 +94,22 @@ module.exports = class Model extends EventEmitter {
95
94
 
96
95
  let settings = Object.assign({}, originalSettings);
97
96
  settings.timeout = settings.timeout || this.options.timeout;
98
- settings = axiosSetting(settings, body);
99
- settings = _.omit(settings, urlKeys);
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');
100
101
  this.emit('sync', originalSettings);
101
102
 
102
103
  const promise = Promise.resolve().then(() => this.auth()).then(authData => {
103
- let authVal = authData;
104
- if (typeof authVal === 'string') {
105
- const auth = authVal.split(':');
106
- authVal = {
104
+ settings.auth = authData;
105
+ if (typeof settings.auth === 'string') {
106
+ const auth = settings.auth.split(':');
107
+ settings.auth = {
107
108
  user: auth.shift(),
108
109
  pass: auth.join(':'),
109
110
  sendImmediately: true
110
111
  };
111
112
  }
112
- if(authVal) {
113
- settings.headers = Object.assign({}, settings.headers, {Authorization: `Bearer ${authVal.bearer}`});
114
- }
115
113
  })
116
114
  .then(() => {
117
115
  const startTime = process.hrtime();
@@ -126,6 +124,7 @@ module.exports = class Model extends EventEmitter {
126
124
 
127
125
  const endTime = process.hrtime();
128
126
  const responseTime = timeDiff(startTime, endTime);
127
+
129
128
  if (err) {
130
129
  this.emit('fail', err, data, originalSettings, statusCode, responseTime);
131
130
  } else {
@@ -137,23 +136,23 @@ module.exports = class Model extends EventEmitter {
137
136
  resolve(data);
138
137
  }
139
138
  };
140
- console.log('settings ::', settings);
141
- this._request(settings)
142
- .then(response => {
143
- return this.handleResponse(response, (error, data, status) => {
144
- if (error) {
145
- error.headers = response.headers;
146
- }
147
- _callback(error, data, status);
148
- });
149
- }).catch(err => {
139
+
140
+ this._request(settings, (err, response) => {
141
+ if (err) {
150
142
  if (err.code === 'ETIMEDOUT' || err.code === 'ESOCKETTIMEDOUT') {
151
143
  err.message = 'Connection timed out';
152
144
  err.status = 504;
153
145
  }
154
- err.status = err.status || 503;
146
+ err.status = err.status || (response && response.statusCode) || 503;
155
147
  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);
156
154
  });
155
+ });
157
156
  });
158
157
  });
159
158
 
@@ -166,13 +165,13 @@ module.exports = class Model extends EventEmitter {
166
165
  handleResponse(response, callback) {
167
166
  let data = {};
168
167
  try {
169
- data = typeof response.data === 'object' ? response.data : JSON.parse(response.data || '{}');
168
+ data = JSON.parse(response.body || '{}');
170
169
  } catch (err) {
171
- err.status = response.status;
172
- err.body = response.data;
173
- return callback(err, null, response.status);
170
+ err.status = response.statusCode;
171
+ err.body = response.body;
172
+ return callback(err, null, response.statusCode);
174
173
  }
175
- return this.parseResponse(response.status, data, callback);
174
+ return this.parseResponse(response.statusCode, data, callback);
176
175
  }
177
176
 
178
177
  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.20-axios-beta",
4
+ "version": "22.0.0-timeout-warning-beta.1",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
@@ -32,12 +32,10 @@
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",
36
- "test-single": "mocha"
35
+ "postversion": "git push && git push --tags"
37
36
  },
38
37
  "dependencies": {
39
38
  "aliasify": "^2.1.0",
40
- "axios": "^1.5.1",
41
39
  "bluebird": "^3.7.2",
42
40
  "body-parser": "^1.15.1",
43
41
  "browserify": "^17.0.0",
@@ -50,6 +48,7 @@
50
48
  "csrf": "^3.1.0",
51
49
  "debug": "^4.3.1",
52
50
  "deprecate": "^1.0.0",
51
+ "dialog-polyfill": "^0.5.6",
53
52
  "dotenv": "^4.0.0",
54
53
  "duplexify": "^3.5.0",
55
54
  "express": "^4.17.1",
@@ -59,7 +58,7 @@
59
58
  "findup": "^0.1.5",
60
59
  "glob": "^7.2.0",
61
60
  "govuk-elements-sass": "^3.1.3",
62
- "govuk-frontend": "3.14",
61
+ "govuk-frontend": "3.15",
63
62
  "govuk_template_mustache": "^0.26.0",
64
63
  "helmet": "^3.22.0",
65
64
  "hogan-express-strict": "^0.5.4",
@@ -68,7 +67,7 @@
68
67
  "i18n-future": "^2.0.0",
69
68
  "i18n-lookup": "^0.1.0",
70
69
  "is-pdf": "^1.0.0",
71
- "libphonenumber-js": "^1.9.37",
70
+ "libphonenumber-js": "^1.9.44",
72
71
  "lodash": "^4.17.21",
73
72
  "markdown-it": "^12.3.2",
74
73
  "minimatch": "^3.0.7",
@@ -82,9 +81,9 @@
82
81
  "nodemailer-smtp-transport": "^2.7.4",
83
82
  "nodemailer-stub-transport": "^1.1.0",
84
83
  "notifications-node-client": "^6.0.0",
85
- "object-mapper": "^6.2.0",
86
84
  "redis": "^3.1.2",
87
85
  "reqres": "^3.0.1",
86
+ "request": "^2.79.0",
88
87
  "rimraf": "^3.0.2",
89
88
  "sass": "^1.56.2",
90
89
  "serve-static": "^1.14.1",
@@ -0,0 +1,16 @@
1
+ ## What?
2
+ ## Why?
3
+ ## How?
4
+ ## Testing?
5
+ ## Screenshots (optional)
6
+ ## Anything Else? (optional)
7
+ ## Check list
8
+
9
+ - [ ] I have reviewed my own pull request for linting issues (e.g. adding new lines)
10
+ - [ ] I have written tests (if relevant)
11
+ - [ ] I have created a JIRA number for my branch
12
+ - [ ] I have created a JIRA number for my commit
13
+ - [ ] I have followed the chris beams method for my commit https://cbea.ms/git-commit/
14
+ here is an [example commit](https://github.com/UKHomeOfficeForms/hof/commit/810959f391187c7c4af6db262bcd143b50093a6e)
15
+ - [ ] Ensure drone builds are green especially tests
16
+ - [ ] I will squash the commits before merging
@@ -91,5 +91,6 @@ module.exports = {
91
91
  ],
92
92
  next: '/confirm'
93
93
  },
94
+ '/session-timeout': {}
94
95
  }
95
96
  };
@@ -16,7 +16,7 @@
16
16
  "author": "",
17
17
  "dependencies": {
18
18
  "govuk-frontend": "3.14",
19
- "jquery": "^3.6.0",
19
+ "jquery": "^3.7.1",
20
20
  "sass": "^1.53.0",
21
21
  "typeahead-aria": "^1.0.4"
22
22
  },
@@ -5627,6 +5627,11 @@ input[type=number] {
5627
5627
  vertical-align: top;
5628
5628
  }
5629
5629
 
5630
+ .govuk-header__logotype-crown[width="32"] {
5631
+ top: -3px;
5632
+ margin-right: 2px;
5633
+ }
5634
+
5630
5635
  .govuk-header__logotype-crown-fallback-image {
5631
5636
  width: 36px;
5632
5637
  height: 32px;
@@ -5634,6 +5639,11 @@ input[type=number] {
5634
5639
  vertical-align: bottom;
5635
5640
  }
5636
5641
 
5642
+ .govuk-header__logotype-crown-fallback-image[width="32"] {
5643
+ width: 32px;
5644
+ height: 30px;
5645
+ }
5646
+
5637
5647
  .govuk-header__product-name {
5638
5648
  font-family: "GDS Transport", arial, sans-serif;
5639
5649
  -webkit-font-smoothing: antialiased;
@@ -6675,8 +6685,6 @@ input[type=number] {
6675
6685
  .js-enabled .govuk-tabs__tab:hover {
6676
6686
  color: rgba(11, 12, 12, 0.99);
6677
6687
  }
6678
- }
6679
- @media (min-width: 40.0625em) {
6680
6688
  .js-enabled .govuk-tabs__tab:active, .js-enabled .govuk-tabs__tab:focus {
6681
6689
  color: #0b0c0c;
6682
6690
  }
@@ -6695,8 +6703,6 @@ input[type=number] {
6695
6703
  bottom: 0;
6696
6704
  left: 0;
6697
6705
  }
6698
- }
6699
- @media (min-width: 40.0625em) {
6700
6706
  .js-enabled .govuk-tabs__panel {
6701
6707
  margin-bottom: 0;
6702
6708
  padding: 30px 20px;
@@ -6713,8 +6719,6 @@ input[type=number] {
6713
6719
  .js-enabled .govuk-tabs__panel > :last-child {
6714
6720
  margin-bottom: 0;
6715
6721
  }
6716
- }
6717
- @media (min-width: 40.0625em) {
6718
6722
  .js-enabled .govuk-tabs__panel--hidden {
6719
6723
  display: none;
6720
6724
  }
@@ -9169,6 +9173,247 @@ dl {
9169
9173
  padding-bottom: 0;
9170
9174
  }
9171
9175
 
9176
+ .modal-dialog {
9177
+ display: none;
9178
+ }
9179
+
9180
+ .modal-dialog--no-js-persistent {
9181
+ display: inline-block;
9182
+ }
9183
+
9184
+ .js-enabled .modal-dialog--no-js-persistent {
9185
+ display: none;
9186
+ }
9187
+ .js-enabled .modal-dialog--no-js-persistent[open], .js-enabled .modal-dialog--no-js-persistent .dialog-button {
9188
+ display: inline-block;
9189
+ }
9190
+ .js-enabled .modal-dialog[open] {
9191
+ display: inline-block;
9192
+ }
9193
+
9194
+ .modal-dialog[open] {
9195
+ overflow-x: hidden;
9196
+ overflow-y: auto;
9197
+ max-height: 90vh;
9198
+ padding: 0;
9199
+ margin-bottom: 0;
9200
+ margin-top: 0;
9201
+ position: fixed;
9202
+ top: 50% !important;
9203
+ -webkit-transform: translate(0, -50%);
9204
+ -ms-transform: translate(0, -50%);
9205
+ transform: translate(0, -50%);
9206
+ }
9207
+
9208
+ @media (min-width: 641px) {
9209
+ .modal-dialog[open] {
9210
+ padding: 0;
9211
+ }
9212
+ }
9213
+ .modal-dialog__inner {
9214
+ padding: 20px;
9215
+ }
9216
+
9217
+ @media (min-width: 641px) {
9218
+ .modal-dialog__inner {
9219
+ padding: 30px;
9220
+ }
9221
+ }
9222
+ .modal-dialog__inner__text {
9223
+ font-family: "nta", Arial, sans-serif;
9224
+ font-weight: 400;
9225
+ text-transform: none;
9226
+ font-size: 16px;
9227
+ line-height: 1.25;
9228
+ padding-top: 2px;
9229
+ padding-bottom: 8px;
9230
+ margin-bottom: 20px;
9231
+ }
9232
+
9233
+ @media (min-width: 641px) {
9234
+ .modal-dialog__inner__text {
9235
+ font-size: 19px;
9236
+ line-height: 1.31579;
9237
+ }
9238
+ }
9239
+ @media (min-width: 641px) {
9240
+ .modal-dialog__inner__text {
9241
+ padding-top: 0;
9242
+ padding-bottom: 5px;
9243
+ }
9244
+ }
9245
+ .modal-dialog__inner__button {
9246
+ font-size: 19px;
9247
+ margin-top: 10px;
9248
+ }
9249
+
9250
+ .modal-dialog__inner__link {
9251
+ font-family: "nta", Arial, sans-serif;
9252
+ font-weight: 400;
9253
+ text-transform: none;
9254
+ font-size: 16px;
9255
+ line-height: 1.25;
9256
+ padding-top: 2px;
9257
+ padding-bottom: 8px;
9258
+ background: none;
9259
+ border: none;
9260
+ vertical-align: middle;
9261
+ margin-top: 20px;
9262
+ }
9263
+ .modal-dialog__inner__link:hover {
9264
+ cursor: pointer;
9265
+ }
9266
+
9267
+ @media (min-width: 641px) {
9268
+ .modal-dialog__inner__link {
9269
+ font-size: 19px;
9270
+ line-height: 1.31579;
9271
+ }
9272
+ }
9273
+ @media (min-width: 641px) {
9274
+ .modal-dialog__inner__link {
9275
+ padding-top: 0;
9276
+ padding-bottom: 5px;
9277
+ }
9278
+ }
9279
+ @media (max-width: 640px) {
9280
+ .modal-dialog__inner__link {
9281
+ text-align: center;
9282
+ display: block;
9283
+ margin-top: 25px;
9284
+ }
9285
+ }
9286
+ @media (min-width: 641px) {
9287
+ .modal-dialog__inner__link {
9288
+ position: absolute;
9289
+ top: 50%;
9290
+ transform: translateY(-50%);
9291
+ padding: 0;
9292
+ margin: 0 0 0 30px;
9293
+ }
9294
+ }
9295
+ .modal-dialog__inner__block {
9296
+ position: relative;
9297
+ }
9298
+
9299
+ .modal-dialog #dialog-title {
9300
+ margin-top: 0;
9301
+ }
9302
+
9303
+ .dialog-is-open {
9304
+ overflow: hidden;
9305
+ }
9306
+
9307
+ dialog {
9308
+ left: 0;
9309
+ right: 0;
9310
+ width: -moz-fit-content;
9311
+ width: -webkit-fit-content;
9312
+ width: fit-content;
9313
+ height: -moz-fit-content;
9314
+ height: -webkit-fit-content;
9315
+ height: fit-content;
9316
+ margin: auto;
9317
+ border: solid;
9318
+ padding: 1em;
9319
+ background: white;
9320
+ color: black;
9321
+ display: none;
9322
+ border: 5px solid black;
9323
+ }
9324
+ dialog + .backdrop {
9325
+ position: fixed;
9326
+ top: 0;
9327
+ right: 0;
9328
+ bottom: 0;
9329
+ left: 0;
9330
+ background: rgba(0, 0, 0, 0.8);
9331
+ }
9332
+ dialog[open] {
9333
+ display: block;
9334
+ box-sizing: border-box;
9335
+ margin: 0 auto;
9336
+ padding: 15px;
9337
+ width: 90%;
9338
+ }
9339
+ dialog[open] + .backdrop, dialog[open]::backdrop {
9340
+ background: rgba(0, 0, 0, 0.8);
9341
+ }
9342
+
9343
+ @media (min-width: 641px) {
9344
+ dialog[open] {
9345
+ padding: 30px;
9346
+ margin: 30px auto;
9347
+ max-width: 500px;
9348
+ }
9349
+ }
9350
+ .tabular-numbers {
9351
+ font-family: "ntatabularnumbers", "nta", Arial, sans-serif;
9352
+ }
9353
+
9354
+ .dialog-sign-out-link {
9355
+ font-family: "GDS Transport", arial, sans-serif;
9356
+ -webkit-font-smoothing: antialiased;
9357
+ -moz-osx-font-smoothing: grayscale;
9358
+ font-weight: 400;
9359
+ font-size: 18px;
9360
+ font-size: 1.125rem;
9361
+ line-height: 1.1111111111;
9362
+ display: inline-block;
9363
+ margin: 5px;
9364
+ }
9365
+ @media print {
9366
+ .dialog-sign-out-link {
9367
+ font-family: sans-serif;
9368
+ }
9369
+ }
9370
+ @media (min-width: 40.0625em) {
9371
+ .dialog-sign-out-link {
9372
+ font-size: 24px;
9373
+ font-size: 1.5rem;
9374
+ line-height: 1.25;
9375
+ }
9376
+ }
9377
+ @media print {
9378
+ .dialog-sign-out-link {
9379
+ font-size: 18pt;
9380
+ line-height: 1.15;
9381
+ }
9382
+ }
9383
+ @media (min-width: 40.0625em) {
9384
+ .dialog-sign-out-link {
9385
+ font-family: "GDS Transport", arial, sans-serif;
9386
+ -webkit-font-smoothing: antialiased;
9387
+ -moz-osx-font-smoothing: grayscale;
9388
+ font-weight: 400;
9389
+ font-size: 16px;
9390
+ font-size: 1rem;
9391
+ line-height: 1.25;
9392
+ position: relative;
9393
+ top: 2px;
9394
+ padding: 0.526315em 0.789473em 0.263157em;
9395
+ line-height: 1.5;
9396
+ }
9397
+ }
9398
+ @media print and (min-width: 40.0625em) {
9399
+ .dialog-sign-out-link {
9400
+ font-family: sans-serif;
9401
+ }
9402
+ }
9403
+ @media (min-width: 40.0625em) and (min-width: 40.0625em) {
9404
+ .dialog-sign-out-link {
9405
+ font-size: 19px;
9406
+ font-size: 1.1875rem;
9407
+ line-height: 1.3157894737;
9408
+ }
9409
+ }
9410
+ @media print and (min-width: 40.0625em) {
9411
+ .dialog-sign-out-link {
9412
+ font-size: 14pt;
9413
+ line-height: 1.15;
9414
+ }
9415
+ }
9416
+
9172
9417
  .validation-summary {
9173
9418
  padding-left: 11px;
9174
9419
  padding-right: 15px;