@ons/design-system 46.1.1 → 46.1.4

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.
package/js/timeout.js CHANGED
@@ -51,14 +51,8 @@ export default class Timeout {
51
51
  async startUiCountdown() {
52
52
  this.clearTimers();
53
53
  this.countdownStarted = true;
54
-
55
- if (this.enableTimeoutReset) {
56
- this.shouldRestartCheck = setInterval(async () => {
57
- await this.hasExpiryTimeResetInAnotherTab();
58
- }, 20000);
59
- }
60
-
61
54
  let milliseconds = this.convertTimeToMilliSeconds(this.expiryTime);
55
+
62
56
  let seconds = milliseconds / 1000;
63
57
  let timers = this.timers;
64
58
  let $this = this;
@@ -83,13 +77,9 @@ export default class Timeout {
83
77
  ($this.endWithFullStop ? '.' : '');
84
78
 
85
79
  if (timerExpired) {
86
- const shouldExpire = this.enableTimeoutReset ? await $this.hasExpiryTimeResetInAnotherTab() : true;
87
-
88
- if (shouldExpire) {
89
- $this.countdown.innerHTML = '<span class="ons-u-fw-b">' + $this.countdownExpiredText + '</span>';
90
- $this.accessibleCountdown.innerHTML = $this.countdownExpiredText;
91
- setTimeout($this.redirect.bind($this), 2000);
92
- }
80
+ $this.countdown.innerHTML = '<span class="ons-u-fw-b">' + $this.countdownExpiredText + '</span>';
81
+ $this.accessibleCountdown.innerHTML = $this.countdownExpiredText;
82
+ setTimeout($this.redirect.bind($this), 2000);
93
83
  } else {
94
84
  seconds--;
95
85
  $this.expiryTimeInMilliseconds = seconds * 1000;
@@ -111,24 +101,10 @@ export default class Timeout {
111
101
  })();
112
102
  }
113
103
 
114
- async hasExpiryTimeResetInAnotherTab() {
115
- const checkExpiryTime = await this.getExpiryTime();
116
-
117
- if (checkExpiryTime != this.expiryTime) {
118
- this.expiryTime = checkExpiryTime;
119
- this.expiryTimeInMilliseconds = this.convertTimeToMilliSeconds(checkExpiryTime);
120
- this.restartTimeout(this.expiryTimeInMilliseconds);
121
- } else {
122
- return true;
123
- }
124
- }
125
-
126
104
  async restartTimeout(timeInMilliSeconds) {
127
105
  this.clearTimers();
128
- clearInterval(this.shouldRestartCheck);
129
106
  this.countdownStarted = false;
130
-
131
- if (timeInMilliSeconds) {
107
+ if (timeInMilliSeconds !== false) {
132
108
  this.expiryTimeInMilliseconds = timeInMilliSeconds;
133
109
  } else {
134
110
  const createNewExpiryTime = await this.setNewExpiryTime();
@@ -138,10 +114,10 @@ export default class Timeout {
138
114
  }
139
115
 
140
116
  async handleWindowFocus() {
141
- this.expiryTime = await this.getExpiryTime();
142
117
  this.clearTimers();
143
- clearInterval(this.shouldRestartCheck);
144
- this.startUiCountdown();
118
+ if (this.countdownStarted) {
119
+ this.startUiCountdown();
120
+ }
145
121
  }
146
122
 
147
123
  async setNewExpiryTime() {
@@ -22,7 +22,7 @@
22
22
  {# Production #}
23
23
  {% set cdn_url = (pageConfig.cdn.url if pageConfig.cdn is defined and pageConfig.cdn and pageConfig.cdn.url is defined and pageConfig.cdn.url) or "https://cdn.ons.gov.uk/sdc/design-system" %}
24
24
  {% set slash = "" if cdn_url | last == "/" else "/" %}
25
- {% set assetsURL = cdn_url + slash + ((pageConfig.cdn.version if pageConfig.cdn is defined and pageConfig.cdn and pageConfig.cdn.version is defined and pageConfig.cdn.version) or release_version) %}
25
+ {% set assetsURL = cdn_url + slash + ((pageConfig.cdn.version if pageConfig.cdn is defined and pageConfig.cdn and pageConfig.cdn.version is defined and pageConfig.cdn.version) or release_version) %}
26
26
  {% elif pageInfo is defined and pageInfo and pageInfo.version is defined and pageInfo.version %}
27
27
  {# Prototype kits #}
28
28
  {% set assetsURL = "/" + pageInfo.version %}
package/package.json CHANGED
@@ -1,13 +1,11 @@
1
1
  {
2
2
  "name": "@ons/design-system",
3
3
  "description": "ONS Design System built CSS, JS, and Nunjucks templates",
4
- "version": "46.1.1",
4
+ "version": "46.1.4",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
7
7
  "author": {
8
- "name": "Ben Meyrick",
9
- "email": "bameyrick@gmail.com",
10
- "url": "https://github.com/bameyrick"
8
+ "name": "ONS Digital"
11
9
  },
12
10
  "scripts": {
13
11
  "start": "gulp start",
@@ -80,8 +78,8 @@
80
78
  "chai": "^4.3.4",
81
79
  "chai-as-promised": "^7.1.1",
82
80
  "chai-spies": "^1.0.0",
83
- "codecov": "3.7.2",
84
- "core-js": "^3.15.2",
81
+ "codecov": "^3.8.3",
82
+ "core-js": "^3.21.1",
85
83
  "cssnano": "^4.1.11",
86
84
  "dialog-polyfill": "^0.5.6",
87
85
  "eslint": "^5.9.0",
@@ -121,7 +119,7 @@
121
119
  "karma-mocha-reporter": "^2.2.5",
122
120
  "lighthouse": "^7.5.0",
123
121
  "lint-staged": "^8.1.0",
124
- "lodash": "^4.17.11",
122
+ "lodash": "^4.17.21",
125
123
  "marked": "^2.1.3",
126
124
  "mdn-polyfills": "^5.14.0",
127
125
  "minimist": "^1.2.5",