hmrc-frontend 5.24.0 → 5.26.0

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/hmrc/all.js CHANGED
@@ -6,17 +6,14 @@
6
6
 
7
7
  function ownKeys(object, enumerableOnly) {
8
8
  var keys = Object.keys(object);
9
-
10
9
  if (Object.getOwnPropertySymbols) {
11
10
  var symbols = Object.getOwnPropertySymbols(object);
12
11
  enumerableOnly && (symbols = symbols.filter(function (sym) {
13
12
  return Object.getOwnPropertyDescriptor(object, sym).enumerable;
14
13
  })), keys.push.apply(keys, symbols);
15
14
  }
16
-
17
15
  return keys;
18
16
  }
19
-
20
17
  function _objectSpread2(target) {
21
18
  for (var i = 1; i < arguments.length; i++) {
22
19
  var source = null != arguments[i] ? arguments[i] : {};
@@ -26,10 +23,8 @@
26
23
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
27
24
  });
28
25
  }
29
-
30
26
  return target;
31
27
  }
32
-
33
28
  function _typeof(obj) {
34
29
  "@babel/helpers - typeof";
35
30
 
@@ -39,23 +34,20 @@
39
34
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
40
35
  }, _typeof(obj);
41
36
  }
42
-
43
37
  function _classCallCheck(instance, Constructor) {
44
38
  if (!(instance instanceof Constructor)) {
45
39
  throw new TypeError("Cannot call a class as a function");
46
40
  }
47
41
  }
48
-
49
42
  function _defineProperties(target, props) {
50
43
  for (var i = 0; i < props.length; i++) {
51
44
  var descriptor = props[i];
52
45
  descriptor.enumerable = descriptor.enumerable || false;
53
46
  descriptor.configurable = true;
54
47
  if ("value" in descriptor) descriptor.writable = true;
55
- Object.defineProperty(target, descriptor.key, descriptor);
48
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
56
49
  }
57
50
  }
58
-
59
51
  function _createClass(Constructor, protoProps, staticProps) {
60
52
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
61
53
  if (staticProps) _defineProperties(Constructor, staticProps);
@@ -64,8 +56,8 @@
64
56
  });
65
57
  return Constructor;
66
58
  }
67
-
68
59
  function _defineProperty(obj, key, value) {
60
+ key = _toPropertyKey(key);
69
61
  if (key in obj) {
70
62
  Object.defineProperty(obj, key, {
71
63
  value: value,
@@ -76,9 +68,22 @@
76
68
  } else {
77
69
  obj[key] = value;
78
70
  }
79
-
80
71
  return obj;
81
72
  }
73
+ function _toPrimitive(input, hint) {
74
+ if (typeof input !== "object" || input === null) return input;
75
+ var prim = input[Symbol.toPrimitive];
76
+ if (prim !== undefined) {
77
+ var res = prim.call(input, hint || "default");
78
+ if (typeof res !== "object") return res;
79
+ throw new TypeError("@@toPrimitive must return a primitive value.");
80
+ }
81
+ return (hint === "string" ? String : Number)(input);
82
+ }
83
+ function _toPropertyKey(arg) {
84
+ var key = _toPrimitive(arg, "string");
85
+ return typeof key === "symbol" ? key : String(key);
86
+ }
82
87
 
83
88
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
84
89
 
@@ -93,7 +98,8 @@
93
98
 
94
99
  (function (undefined) {
95
100
  // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Object/defineProperty/detect.js
96
- var detect = // In IE8, defineProperty could only act on DOM elements, so full support
101
+ var detect =
102
+ // In IE8, defineProperty could only act on DOM elements, so full support
97
103
  // for the feature requires the ability to set a property on an arbitrary object
98
104
  'defineProperty' in Object && function () {
99
105
  try {
@@ -106,73 +112,63 @@
106
112
  return false;
107
113
  }
108
114
  }();
115
+ if (detect) return;
109
116
 
110
- if (detect) return; // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.defineProperty&flags=always
111
-
117
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.defineProperty&flags=always
112
118
  (function (nativeDefineProperty) {
113
119
  var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');
114
120
  var ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine';
115
121
  var ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value';
116
-
117
122
  Object.defineProperty = function defineProperty(object, property, descriptor) {
118
123
  // Where native support exists, assume it
119
124
  if (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) {
120
125
  return nativeDefineProperty(object, property, descriptor);
121
126
  }
122
-
123
127
  if (object === null || !(object instanceof Object || typeof object === 'object')) {
124
128
  throw new TypeError('Object.defineProperty called on non-object');
125
129
  }
126
-
127
130
  if (!(descriptor instanceof Object)) {
128
131
  throw new TypeError('Property description must be an object');
129
132
  }
130
-
131
133
  var propertyString = String(property);
132
134
  var hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor;
133
135
  var getterType = 'get' in descriptor && typeof descriptor.get;
134
- var setterType = 'set' in descriptor && typeof descriptor.set; // handle descriptor.get
136
+ var setterType = 'set' in descriptor && typeof descriptor.set;
135
137
 
138
+ // handle descriptor.get
136
139
  if (getterType) {
137
140
  if (getterType !== 'function') {
138
141
  throw new TypeError('Getter must be a function');
139
142
  }
140
-
141
143
  if (!supportsAccessors) {
142
144
  throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
143
145
  }
144
-
145
146
  if (hasValueOrWritable) {
146
147
  throw new TypeError(ERR_VALUE_ACCESSORS);
147
148
  }
148
-
149
149
  Object.__defineGetter__.call(object, propertyString, descriptor.get);
150
150
  } else {
151
151
  object[propertyString] = descriptor.value;
152
- } // handle descriptor.set
153
-
152
+ }
154
153
 
154
+ // handle descriptor.set
155
155
  if (setterType) {
156
156
  if (setterType !== 'function') {
157
157
  throw new TypeError('Setter must be a function');
158
158
  }
159
-
160
159
  if (!supportsAccessors) {
161
160
  throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
162
161
  }
163
-
164
162
  if (hasValueOrWritable) {
165
163
  throw new TypeError(ERR_VALUE_ACCESSORS);
166
164
  }
167
-
168
165
  Object.__defineSetter__.call(object, propertyString, descriptor.set);
169
- } // OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above
170
-
166
+ }
171
167
 
168
+ // OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above
172
169
  if ('value' in descriptor) {
173
170
  object[propertyString] = descriptor.value;
174
171
  }
175
-
176
172
  return object;
177
173
  };
178
174
  })(Object.defineProperty);
@@ -187,7 +183,8 @@
187
183
 
188
184
  (function (undefined) {
189
185
  // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Object/defineProperty/detect.js
190
- var detect = // In IE8, defineProperty could only act on DOM elements, so full support
186
+ var detect =
187
+ // In IE8, defineProperty could only act on DOM elements, so full support
191
188
  // for the feature requires the ability to set a property on an arbitrary object
192
189
  'defineProperty' in Object && function () {
193
190
  try {
@@ -200,73 +197,63 @@
200
197
  return false;
201
198
  }
202
199
  }();
200
+ if (detect) return;
203
201
 
204
- if (detect) return; // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.defineProperty&flags=always
205
-
202
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.defineProperty&flags=always
206
203
  (function (nativeDefineProperty) {
207
204
  var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');
208
205
  var ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine';
209
206
  var ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value';
210
-
211
207
  Object.defineProperty = function defineProperty(object, property, descriptor) {
212
208
  // Where native support exists, assume it
213
209
  if (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) {
214
210
  return nativeDefineProperty(object, property, descriptor);
215
211
  }
216
-
217
212
  if (object === null || !(object instanceof Object || typeof object === 'object')) {
218
213
  throw new TypeError('Object.defineProperty called on non-object');
219
214
  }
220
-
221
215
  if (!(descriptor instanceof Object)) {
222
216
  throw new TypeError('Property description must be an object');
223
217
  }
224
-
225
218
  var propertyString = String(property);
226
219
  var hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor;
227
220
  var getterType = 'get' in descriptor && typeof descriptor.get;
228
- var setterType = 'set' in descriptor && typeof descriptor.set; // handle descriptor.get
221
+ var setterType = 'set' in descriptor && typeof descriptor.set;
229
222
 
223
+ // handle descriptor.get
230
224
  if (getterType) {
231
225
  if (getterType !== 'function') {
232
226
  throw new TypeError('Getter must be a function');
233
227
  }
234
-
235
228
  if (!supportsAccessors) {
236
229
  throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
237
230
  }
238
-
239
231
  if (hasValueOrWritable) {
240
232
  throw new TypeError(ERR_VALUE_ACCESSORS);
241
233
  }
242
-
243
234
  Object.__defineGetter__.call(object, propertyString, descriptor.get);
244
235
  } else {
245
236
  object[propertyString] = descriptor.value;
246
- } // handle descriptor.set
247
-
237
+ }
248
238
 
239
+ // handle descriptor.set
249
240
  if (setterType) {
250
241
  if (setterType !== 'function') {
251
242
  throw new TypeError('Setter must be a function');
252
243
  }
253
-
254
244
  if (!supportsAccessors) {
255
245
  throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
256
246
  }
257
-
258
247
  if (hasValueOrWritable) {
259
248
  throw new TypeError(ERR_VALUE_ACCESSORS);
260
249
  }
261
-
262
250
  Object.__defineSetter__.call(object, propertyString, descriptor.set);
263
- } // OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above
264
-
251
+ }
265
252
 
253
+ // OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above
266
254
  if ('value' in descriptor) {
267
255
  object[propertyString] = descriptor.value;
268
256
  }
269
-
270
257
  return object;
271
258
  };
272
259
  })(Object.defineProperty);
@@ -274,8 +261,9 @@
274
261
  (function (undefined) {
275
262
  // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Function/prototype/bind/detect.js
276
263
  var detect = ('bind' in Function.prototype);
277
- if (detect) return; // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Function.prototype.bind&flags=always
264
+ if (detect) return;
278
265
 
266
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Function.prototype.bind&flags=always
279
267
  Object.defineProperty(Function.prototype, 'bind', {
280
268
  value: function bind(that) {
281
269
  // .length is 1
@@ -284,54 +272,46 @@
284
272
  var $Object = Object;
285
273
  var ObjectPrototype = $Object.prototype;
286
274
  var ArrayPrototype = $Array.prototype;
287
-
288
275
  var Empty = function Empty() {};
289
-
290
276
  var to_string = ObjectPrototype.toString;
291
277
  var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
292
- var isCallable;
293
- /* inlined from https://npmjs.com/is-callable */
294
-
278
+ var isCallable; /* inlined from https://npmjs.com/is-callable */
295
279
  var fnToStr = Function.prototype.toString,
296
- tryFunctionObject = function tryFunctionObject(value) {
297
- try {
298
- fnToStr.call(value);
299
- return true;
300
- } catch (e) {
301
- return false;
302
- }
303
- },
304
- fnClass = '[object Function]',
305
- genClass = '[object GeneratorFunction]';
306
-
280
+ tryFunctionObject = function tryFunctionObject(value) {
281
+ try {
282
+ fnToStr.call(value);
283
+ return true;
284
+ } catch (e) {
285
+ return false;
286
+ }
287
+ },
288
+ fnClass = '[object Function]',
289
+ genClass = '[object GeneratorFunction]';
307
290
  isCallable = function isCallable(value) {
308
291
  if (typeof value !== 'function') {
309
292
  return false;
310
293
  }
311
-
312
294
  if (hasToStringTag) {
313
295
  return tryFunctionObject(value);
314
296
  }
315
-
316
297
  var strClass = to_string.call(value);
317
298
  return strClass === fnClass || strClass === genClass;
318
299
  };
319
-
320
300
  var array_slice = ArrayPrototype.slice;
321
301
  var array_concat = ArrayPrototype.concat;
322
302
  var array_push = ArrayPrototype.push;
323
- var max = Math.max; // /add necessary es5-shim utilities
324
- // 1. Let Target be the this value.
325
-
326
- var target = this; // 2. If IsCallable(Target) is false, throw a TypeError exception.
303
+ var max = Math.max;
304
+ // /add necessary es5-shim utilities
327
305
 
306
+ // 1. Let Target be the this value.
307
+ var target = this;
308
+ // 2. If IsCallable(Target) is false, throw a TypeError exception.
328
309
  if (!isCallable(target)) {
329
310
  throw new TypeError('Function.prototype.bind called on incompatible ' + target);
330
- } // 3. Let A be a new (possibly empty) internal list of all of the
311
+ }
312
+ // 3. Let A be a new (possibly empty) internal list of all of the
331
313
  // argument values provided after thisArg (arg1, arg2 etc), in order.
332
314
  // XXX slicedArgs will stand in for "A" if used
333
-
334
-
335
315
  var args = array_slice.call(arguments, 1); // for normal call
336
316
  // 4. Let F be a new native ECMAScript object.
337
317
  // 11. Set the [[Prototype]] internal property of F to the standard
@@ -342,9 +322,7 @@
342
322
  // 15.3.4.5.2.
343
323
  // 14. Set the [[HasInstance]] internal property of F as described in
344
324
  // 15.3.4.5.3.
345
-
346
325
  var bound;
347
-
348
326
  var binder = function () {
349
327
  if (this instanceof bound) {
350
328
  // 15.3.4.5.2 [[Construct]]
@@ -362,12 +340,11 @@
362
340
  // values as the list ExtraArgs in the same order.
363
341
  // 5. Return the result of calling the [[Construct]] internal
364
342
  // method of target providing args as the arguments.
365
- var result = target.apply(this, array_concat.call(args, array_slice.call(arguments)));
366
343
 
344
+ var result = target.apply(this, array_concat.call(args, array_slice.call(arguments)));
367
345
  if ($Object(result) === result) {
368
346
  return result;
369
347
  }
370
-
371
348
  return this;
372
349
  } else {
373
350
  // 15.3.4.5.1 [[Call]]
@@ -387,40 +364,44 @@
387
364
  // 5. Return the result of calling the [[Call]] internal method
388
365
  // of target providing boundThis as the this value and
389
366
  // providing args as the arguments.
367
+
390
368
  // equiv: target.call(this, ...boundArgs, ...args)
391
369
  return target.apply(that, array_concat.call(args, array_slice.call(arguments)));
392
370
  }
393
- }; // 15. If the [[Class]] internal property of Target is "Function", then
371
+ };
372
+
373
+ // 15. If the [[Class]] internal property of Target is "Function", then
394
374
  // a. Let L be the length property of Target minus the length of A.
395
375
  // b. Set the length own property of F to either 0 or L, whichever is
396
376
  // larger.
397
377
  // 16. Else set the length own property of F to 0.
398
378
 
379
+ var boundLength = max(0, target.length - args.length);
399
380
 
400
- var boundLength = max(0, target.length - args.length); // 17. Set the attributes of the length own property of F to the values
381
+ // 17. Set the attributes of the length own property of F to the values
401
382
  // specified in 15.3.5.1.
402
-
403
383
  var boundArgs = [];
404
-
405
384
  for (var i = 0; i < boundLength; i++) {
406
385
  array_push.call(boundArgs, '$' + i);
407
- } // XXX Build a dynamic function with desired amount of arguments is the only
386
+ }
387
+
388
+ // XXX Build a dynamic function with desired amount of arguments is the only
408
389
  // way to set the length property of a function.
409
390
  // In environments where Content Security Policies enabled (Chrome extensions,
410
391
  // for ex.) all use of eval or Function costructor throws an exception.
411
392
  // However in all of these environments Function.prototype.bind exists
412
393
  // and so this code will never be executed.
413
-
414
-
415
394
  bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder);
416
-
417
395
  if (target.prototype) {
418
396
  Empty.prototype = target.prototype;
419
- bound.prototype = new Empty(); // Clean up dangling references.
420
-
397
+ bound.prototype = new Empty();
398
+ // Clean up dangling references.
421
399
  Empty.prototype = null;
422
- } // TODO
400
+ }
401
+
402
+ // TODO
423
403
  // 18. Set the [[Extensible]] internal property of F to true.
404
+
424
405
  // TODO
425
406
  // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
426
407
  // 20. Call the [[DefineOwnProperty]] internal method of F with
@@ -431,14 +412,14 @@
431
412
  // arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
432
413
  // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
433
414
  // and false.
415
+
434
416
  // TODO
435
417
  // NOTE Function objects created using Function.prototype.bind do not
436
418
  // have a prototype property or the [[Code]], [[FormalParameters]], and
437
419
  // [[Scope]] internal properties.
438
420
  // XXX can't delete prototype in pure-js.
439
- // 22. Return F.
440
-
441
421
 
422
+ // 22. Return F.
442
423
  return bound;
443
424
  }
444
425
  });
@@ -457,9 +438,9 @@
457
438
  return false;
458
439
  }
459
440
  }();
441
+ if (detect) return;
460
442
 
461
- if (detect) return; // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.getOwnPropertyDescriptor&flags=always
462
-
443
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.getOwnPropertyDescriptor&flags=always
463
444
  (function () {
464
445
  var call = Function.prototype.call;
465
446
  var prototypeOfObject = Object.prototype;
@@ -467,61 +448,58 @@
467
448
  var lookupGetter;
468
449
  var lookupSetter;
469
450
  var supportsAccessors;
470
-
471
451
  if (supportsAccessors = owns(prototypeOfObject, "__defineGetter__")) {
472
452
  lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
473
453
  lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
474
454
  }
475
-
476
455
  function doesGetOwnPropertyDescriptorWork(object) {
477
456
  try {
478
457
  object.sentinel = 0;
479
458
  return Object.getOwnPropertyDescriptor(object, "sentinel").value === 0;
480
- } catch (exception) {// returns falsy
459
+ } catch (exception) {
460
+ // returns falsy
481
461
  }
482
- } // check whether getOwnPropertyDescriptor works if it's given. Otherwise,
462
+ }
463
+ // check whether getOwnPropertyDescriptor works if it's given. Otherwise,
483
464
  // shim partially.
484
-
485
-
486
465
  if (Object.defineProperty) {
487
466
  var getOwnPropertyDescriptorWorksOnObject = doesGetOwnPropertyDescriptorWork({});
488
467
  var getOwnPropertyDescriptorWorksOnDom = typeof document == "undefined" || doesGetOwnPropertyDescriptorWork(document.createElement("div"));
489
-
490
468
  if (!getOwnPropertyDescriptorWorksOnDom || !getOwnPropertyDescriptorWorksOnObject) {
491
469
  var getOwnPropertyDescriptorFallback = Object.getOwnPropertyDescriptor;
492
470
  }
493
471
  }
494
-
495
472
  if (!Object.getOwnPropertyDescriptor || getOwnPropertyDescriptorFallback) {
496
473
  var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a non-object: ";
497
-
498
474
  Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
499
475
  if (_typeof(object) != "object" && typeof object != "function" || object === null) {
500
476
  throw new TypeError(ERR_NON_OBJECT + object);
501
- } // make a valiant attempt to use the real getOwnPropertyDescriptor
502
- // for I8's DOM elements.
503
-
477
+ }
504
478
 
479
+ // make a valiant attempt to use the real getOwnPropertyDescriptor
480
+ // for I8's DOM elements.
505
481
  if (getOwnPropertyDescriptorFallback) {
506
482
  try {
507
483
  return getOwnPropertyDescriptorFallback.call(Object, object, property);
508
- } catch (exception) {// try the shim if the real one doesn't work
484
+ } catch (exception) {
485
+ // try the shim if the real one doesn't work
509
486
  }
510
- } // If object does not owns property return undefined immediately.
511
-
487
+ }
512
488
 
489
+ // If object does not owns property return undefined immediately.
513
490
  if (!owns(object, property)) {
514
491
  return;
515
- } // If object has a property then it's for sure both `enumerable` and
516
- // `configurable`.
517
-
492
+ }
518
493
 
494
+ // If object has a property then it's for sure both `enumerable` and
495
+ // `configurable`.
519
496
  var descriptor = {
520
497
  enumerable: true,
521
498
  configurable: true
522
- }; // If JS engine supports accessor properties then property may be a
523
- // getter or setter.
499
+ };
524
500
 
501
+ // If JS engine supports accessor properties then property may be a
502
+ // getter or setter.
525
503
  if (supportsAccessors) {
526
504
  // Unfortunately `__lookupGetter__` will return a getter even
527
505
  // if object has own non getter property along with a same named
@@ -531,27 +509,25 @@
531
509
  var prototype = object.__proto__;
532
510
  object.__proto__ = prototypeOfObject;
533
511
  var getter = lookupGetter(object, property);
534
- var setter = lookupSetter(object, property); // Once we have getter and setter we can put values back.
512
+ var setter = lookupSetter(object, property);
535
513
 
514
+ // Once we have getter and setter we can put values back.
536
515
  object.__proto__ = prototype;
537
-
538
516
  if (getter || setter) {
539
517
  if (getter) {
540
518
  descriptor.get = getter;
541
519
  }
542
-
543
520
  if (setter) {
544
521
  descriptor.set = setter;
545
- } // If it was accessor property we're done and return here
522
+ }
523
+ // If it was accessor property we're done and return here
546
524
  // in order to avoid adding `value` to the descriptor.
547
-
548
-
549
525
  return descriptor;
550
526
  }
551
- } // If we got this far we know that object has an own property that is
552
- // not an accessor so we set it as a value and return descriptor.
553
-
527
+ }
554
528
 
529
+ // If we got this far we know that object has an own property that is
530
+ // not an accessor so we set it as a value and return descriptor.
555
531
  descriptor.value = object[property];
556
532
  descriptor.writable = true;
557
533
  return descriptor;
@@ -568,11 +544,13 @@
568
544
  (function (undefined) {
569
545
  // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Document/detect.js
570
546
  var detect = ("Document" in this);
571
- if (detect) return; // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Document&flags=always
547
+ if (detect) return;
572
548
 
549
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Document&flags=always
573
550
  if (typeof WorkerGlobalScope === "undefined" && typeof importScripts !== "function") {
574
551
  if (this.HTMLDocument) {
575
552
  // IE8
553
+
576
554
  // HTMLDocument is an extension of Document. If the browser has HTMLDocument but not Document, the former will suffice as an alias for the latter.
577
555
  this.Document = this.HTMLDocument;
578
556
  } else {
@@ -593,11 +571,13 @@
593
571
  (function (undefined) {
594
572
  // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Document/detect.js
595
573
  var detect = ("Document" in this);
596
- if (detect) return; // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Document&flags=always
574
+ if (detect) return;
597
575
 
576
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Document&flags=always
598
577
  if (typeof WorkerGlobalScope === "undefined" && typeof importScripts !== "function") {
599
578
  if (this.HTMLDocument) {
600
579
  // IE8
580
+
601
581
  // HTMLDocument is an extension of Document. If the browser has HTMLDocument but not Document, the former will suffice as an alias for the latter.
602
582
  this.Document = this.HTMLDocument;
603
583
  } else {
@@ -610,60 +590,58 @@
610
590
  (function (undefined) {
611
591
  // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Element/detect.js
612
592
  var detect = 'Element' in this && 'HTMLElement' in this;
613
- if (detect) return; // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element&flags=always
593
+ if (detect) return;
614
594
 
595
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element&flags=always
615
596
  (function () {
616
597
  // IE8
617
598
  if (window.Element && !window.HTMLElement) {
618
599
  window.HTMLElement = window.Element;
619
600
  return;
620
- } // create Element constructor
621
-
601
+ }
622
602
 
623
- window.Element = window.HTMLElement = new Function('return function Element() {}')(); // generate sandboxed iframe
603
+ // create Element constructor
604
+ window.Element = window.HTMLElement = new Function('return function Element() {}')();
624
605
 
606
+ // generate sandboxed iframe
625
607
  var vbody = document.appendChild(document.createElement('body'));
626
- var frame = vbody.appendChild(document.createElement('iframe')); // use sandboxed iframe to replicate Element functionality
608
+ var frame = vbody.appendChild(document.createElement('iframe'));
627
609
 
610
+ // use sandboxed iframe to replicate Element functionality
628
611
  var frameDocument = frame.contentWindow.document;
629
612
  var prototype = Element.prototype = frameDocument.appendChild(frameDocument.createElement('*'));
630
- var cache = {}; // polyfill Element.prototype on an element
613
+ var cache = {};
631
614
 
615
+ // polyfill Element.prototype on an element
632
616
  var shiv = function (element, deep) {
633
617
  var childNodes = element.childNodes || [],
634
- index = -1,
635
- key,
636
- value,
637
- childNode;
638
-
618
+ index = -1,
619
+ key,
620
+ value,
621
+ childNode;
639
622
  if (element.nodeType === 1 && element.constructor !== Element) {
640
623
  element.constructor = Element;
641
-
642
624
  for (key in cache) {
643
625
  value = cache[key];
644
626
  element[key] = value;
645
627
  }
646
628
  }
647
-
648
629
  while (childNode = deep && childNodes[++index]) {
649
630
  shiv(childNode, deep);
650
631
  }
651
-
652
632
  return element;
653
633
  };
654
-
655
634
  var elements = document.getElementsByTagName('*');
656
635
  var nativeCreateElement = document.createElement;
657
636
  var interval;
658
637
  var loopLimit = 100;
659
638
  prototype.attachEvent('onpropertychange', function (event) {
660
639
  var propertyName = event.propertyName,
661
- nonValue = !cache.hasOwnProperty(propertyName),
662
- newValue = prototype[propertyName],
663
- oldValue = cache[propertyName],
664
- index = -1,
665
- element;
666
-
640
+ nonValue = !cache.hasOwnProperty(propertyName),
641
+ newValue = prototype[propertyName],
642
+ oldValue = cache[propertyName],
643
+ index = -1,
644
+ element;
667
645
  while (element = elements[++index]) {
668
646
  if (element.nodeType === 1) {
669
647
  if (nonValue || element[propertyName] === oldValue) {
@@ -671,43 +649,38 @@
671
649
  }
672
650
  }
673
651
  }
674
-
675
652
  cache[propertyName] = newValue;
676
653
  });
677
654
  prototype.constructor = Element;
678
-
679
655
  if (!prototype.hasAttribute) {
680
656
  // <Element>.hasAttribute
681
657
  prototype.hasAttribute = function hasAttribute(name) {
682
658
  return this.getAttribute(name) !== null;
683
659
  };
684
- } // Apply Element prototype to the pre-existing DOM as soon as the body element appears.
685
-
660
+ }
686
661
 
662
+ // Apply Element prototype to the pre-existing DOM as soon as the body element appears.
687
663
  function bodyCheck() {
688
664
  if (!loopLimit--) clearTimeout(interval);
689
-
690
665
  if (document.body && !document.body.prototype && /(complete|interactive)/.test(document.readyState)) {
691
666
  shiv(document, true);
692
667
  if (interval && document.body.prototype) clearTimeout(interval);
693
668
  return !!document.body.prototype;
694
669
  }
695
-
696
670
  return false;
697
671
  }
698
-
699
672
  if (!bodyCheck()) {
700
673
  document.onreadystatechange = bodyCheck;
701
674
  interval = setInterval(bodyCheck, 25);
702
- } // Apply to any new elements created after load
703
-
675
+ }
704
676
 
677
+ // Apply to any new elements created after load
705
678
  document.createElement = function createElement(nodeName) {
706
679
  var element = nativeCreateElement(String(nodeName).toLowerCase());
707
680
  return shiv(element);
708
- }; // remove sandboxed iframe
709
-
681
+ };
710
682
 
683
+ // remove sandboxed iframe
711
684
  document.removeChild(vbody);
712
685
  })();
713
686
  }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof commonjsGlobal && commonjsGlobal || {});
@@ -717,51 +690,44 @@
717
690
  (function (undefined) {
718
691
  // Detection from https://github.com/Financial-Times/polyfill-library/blob/master/polyfills/document/querySelector/detect.js
719
692
  var detect = 'document' in this && 'querySelector' in this.document;
720
- if (detect) return; // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Event&flags=always
693
+ if (detect) return;
721
694
 
695
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Event&flags=always
722
696
  (function () {
723
697
  var head = document.getElementsByTagName('head')[0];
724
-
725
698
  function getElementsByQuery(node, selector, one) {
726
699
  var generator = document.createElement('div'),
727
- id = 'qsa' + String(Math.random()).slice(3),
728
- style,
729
- elements;
700
+ id = 'qsa' + String(Math.random()).slice(3),
701
+ style,
702
+ elements;
730
703
  generator.innerHTML = 'x<style>' + selector + '{qsa:' + id + ';}';
731
704
  style = head.appendChild(generator.lastChild);
732
705
  elements = getElements(node, selector, one, id);
733
706
  head.removeChild(style);
734
707
  return one ? elements[0] : elements;
735
708
  }
736
-
737
709
  function getElements(node, selector, one, id) {
738
710
  var validNode = /1|9/.test(node.nodeType),
739
- childNodes = node.childNodes,
740
- elements = [],
741
- index = -1,
742
- childNode;
743
-
711
+ childNodes = node.childNodes,
712
+ elements = [],
713
+ index = -1,
714
+ childNode;
744
715
  if (validNode && node.currentStyle && node.currentStyle.qsa === id) {
745
716
  if (elements.push(node) && one) {
746
717
  return elements;
747
718
  }
748
719
  }
749
-
750
720
  while (childNode = childNodes[++index]) {
751
721
  elements = elements.concat(getElements(childNode, selector, one, id));
752
-
753
722
  if (one && elements.length) {
754
723
  return elements;
755
724
  }
756
725
  }
757
-
758
726
  return elements;
759
727
  }
760
-
761
728
  Document.prototype.querySelector = Element.prototype.querySelector = function querySelectorAll(selector) {
762
729
  return getElementsByQuery(this, selector, true);
763
730
  };
764
-
765
731
  Document.prototype.querySelectorAll = Element.prototype.querySelectorAll = function querySelectorAll(selector) {
766
732
  return getElementsByQuery(this, selector, false);
767
733
  };
@@ -774,22 +740,19 @@
774
740
  if (!document.documentElement.dataset) {
775
741
  return false;
776
742
  }
777
-
778
743
  var el = document.createElement('div');
779
744
  el.setAttribute("data-a-b", "c");
780
745
  return el.dataset && el.dataset.aB == "c";
781
- })(); // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element.prototype.dataset&flags=always
782
-
746
+ })();
783
747
 
748
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element.prototype.dataset&flags=always
784
749
  Object.defineProperty(Element.prototype, 'dataset', {
785
750
  get: function get() {
786
751
  var element = this;
787
752
  var attributes = this.attributes;
788
753
  var map = {};
789
-
790
754
  for (var i = 0; i < attributes.length; i++) {
791
755
  var attribute = attributes[i];
792
-
793
756
  if (attribute && attribute.name && /^data-\w[\w\-]*$/.test(attribute.name)) {
794
757
  var name = attribute.name;
795
758
  var value = attribute.value;
@@ -813,7 +776,6 @@
813
776
  });
814
777
  }
815
778
  }
816
-
817
779
  return map;
818
780
  }
819
781
  });
@@ -823,23 +785,20 @@
823
785
  // be triggered. The function will be called after it stops being called for
824
786
  // N milliseconds. If `immediate` is passed, trigger the function on the
825
787
  // leading edge, instead of the trailing.
788
+
826
789
  // eslint-disable-next-line import/prefer-default-export
827
790
  function debounce(func, wait, immediate) {
828
791
  var _this = this;
829
-
830
792
  var timeout;
831
793
  return function () {
832
794
  for (var _len = arguments.length, theParams = new Array(_len), _key = 0; _key < _len; _key++) {
833
795
  theParams[_key] = arguments[_key];
834
796
  }
835
-
836
797
  var context = _this;
837
-
838
798
  var later = function later() {
839
799
  timeout = null;
840
800
  if (!immediate) func.apply(context, theParams);
841
801
  };
842
-
843
802
  var callNow = immediate && !timeout;
844
803
  clearTimeout(timeout);
845
804
  timeout = setTimeout(later, wait);
@@ -860,14 +819,12 @@
860
819
  var windowInsideBreakpoint = (windowWidth || window.innerWidth) >= breakpoints[curr];
861
820
  return windowInsideBreakpoint ? curr : acc;
862
821
  };
863
-
864
822
  return Object.keys(breakpoints).reduce(reducer);
865
823
  }
866
824
 
867
825
  var isSmall = function isSmall(element) {
868
826
  return element.innerWidth <= 768;
869
827
  };
870
-
871
828
  function AccountMenu($module) {
872
829
  this.$module = document.querySelector($module);
873
830
  this.$moduleBottomMargin = this.$module.style.marginBottom;
@@ -875,27 +832,22 @@
875
832
  this.$showNavLinkMobile = this.$module.querySelector('.hmrc-account-menu__link--menu');
876
833
  this.$currentBreakpoint = getCurrentBreakpoint();
877
834
  }
878
-
879
835
  AccountMenu.prototype.init = function init() {
880
836
  this.setup();
881
837
  this.$showNavLinkMobile.addEventListener('click', this.eventHandlers.showNavLinkMobileClick.bind(this));
882
838
  window.addEventListener('resize', debounce(this.reinstantiate.bind(this)));
883
839
  };
884
-
885
840
  AccountMenu.prototype.reinstantiate = function reinstantiate(resizeEvent) {
886
841
  var newBreakpoint = getCurrentBreakpoint(resizeEvent.target.innerWidth);
887
842
  var hasCrossedBreakpoint = this.$currentBreakpoint !== newBreakpoint;
888
-
889
843
  if (hasCrossedBreakpoint) {
890
844
  this.$currentBreakpoint = newBreakpoint;
891
845
  this.setup();
892
846
  }
893
847
  };
894
-
895
848
  AccountMenu.prototype.eventHandlers = {
896
849
  showNavLinkMobileClick: function showNavLinkMobileClick(event) {
897
850
  event.preventDefault();
898
-
899
851
  if (isSmall(window)) {
900
852
  if (this.$mainNav.classList.contains('main-nav-is-open')) {
901
853
  this.hideMainNavMobile(event.currentTarget);
@@ -905,7 +857,6 @@
905
857
  }
906
858
  }
907
859
  };
908
-
909
860
  AccountMenu.prototype.setup = function setup() {
910
861
  if (isSmall(window)) {
911
862
  this.$module.classList.add('is-smaller');
@@ -921,7 +872,6 @@
921
872
  this.$showNavLinkMobile.classList.add('js-hidden');
922
873
  }
923
874
  };
924
-
925
875
  AccountMenu.prototype.showMainNavMobile = function showMainNavMobile() {
926
876
  // TODO: shall we add main-nav-is-open to `nav`????
927
877
  this.$mainNav.classList.remove('js-hidden');
@@ -930,11 +880,9 @@
930
880
  this.$showNavLinkMobile.setAttribute('aria-expanded', 'true');
931
881
  this.$showNavLinkMobile.classList.add('hmrc-account-home--account--is-open');
932
882
  };
933
-
934
883
  AccountMenu.prototype.hideMainNavMobile = function hideMainNavMobile(element) {
935
884
  this.$mainNav.classList.remove('main-nav-is-open');
936
885
  this.$mainNav.setAttribute('aria-expanded', 'false');
937
-
938
886
  if (element.classList.contains('hmrc-account-menu__link--menu')) {
939
887
  this.$mainNav.classList.add('js-hidden');
940
888
  this.$showNavLinkMobile.setAttribute('aria-expanded', 'false');
@@ -947,23 +895,21 @@
947
895
  this.window = window;
948
896
  this.document = document;
949
897
  }
950
-
951
898
  BackLinkHelper.prototype.init = function init() {
952
899
  var _this = this;
953
-
954
900
  // do nothing if History API is absent
955
901
  if (this.window.history) {
956
902
  // store referrer value to cater for IE
957
- var docReferrer = this.document.referrer; // prevent resubmit warning
903
+ var docReferrer = this.document.referrer;
958
904
 
905
+ // prevent resubmit warning
959
906
  if (this.window.history.replaceState && typeof this.window.history.replaceState === 'function') {
960
907
  this.window.history.replaceState(null, null, this.window.location.href);
961
- } // handle 'Back' click, dependent upon presence of referrer & no host change
962
-
908
+ }
963
909
 
910
+ // handle 'Back' click, dependent upon presence of referrer & no host change
964
911
  this.$module.addEventListener('click', function (event) {
965
912
  event.preventDefault();
966
-
967
913
  if (_this.window.history.back && typeof _this.window.history.back === 'function') {
968
914
  if (docReferrer !== '' && docReferrer.indexOf(_this.window.location.host) !== -1) {
969
915
  _this.window.history.back();
@@ -976,24 +922,22 @@
976
922
  (function (undefined) {
977
923
  // Detection from https://github.com/Financial-Times/polyfill-library/blob/987630a085e29226da16b5dc542042c687560191/polyfills/Array/prototype/forEach/detect.js
978
924
  var detect = ('forEach' in Array.prototype);
979
- if (detect) return; // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Array.prototype.forEach&flags=always
925
+ if (detect) return;
980
926
 
927
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Array.prototype.forEach&flags=always
981
928
  (function () {
982
929
  Array.prototype.forEach = function forEach(callback) {
983
930
  if (this === undefined || this === null) {
984
931
  throw new TypeError(this + " is not an object");
985
932
  }
986
-
987
933
  if (typeof callback !== "function") {
988
934
  throw new TypeError(callback + " is not a function");
989
935
  }
990
-
991
936
  var object = Object(this),
992
- scope = arguments[1],
993
- arraylike = object instanceof String ? object.split("") : object,
994
- length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0,
995
- index = -1;
996
-
937
+ scope = arguments[1],
938
+ arraylike = object instanceof String ? object.split("") : object,
939
+ length = Math.max(Math.min(arraylike.length, 9007199254740991), 0) || 0,
940
+ index = -1;
997
941
  while (++index < length) {
998
942
  if (index in arraylike) {
999
943
  callback.call(scope, arraylike[index], index, object);
@@ -1015,11 +959,12 @@
1015
959
  return false;
1016
960
  }
1017
961
  }();
962
+ if (detect) return;
1018
963
 
1019
- if (detect) return; // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.assign&flags=always
1020
-
964
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.assign&flags=always
1021
965
  Object.keys = function () {
1022
966
 
967
+ // modified from https://github.com/es-shims/object-keys
1023
968
  var has = Object.prototype.hasOwnProperty;
1024
969
  var toStr = Object.prototype.toString;
1025
970
  var isEnumerable = Object.prototype.propertyIsEnumerable;
@@ -1028,12 +973,10 @@
1028
973
  }, "toString");
1029
974
  var hasProtoEnumBug = isEnumerable.call(function () {}, "prototype");
1030
975
  var dontEnums = ["toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor"];
1031
-
1032
976
  var equalsConstructorPrototype = function equalsConstructorPrototype(o) {
1033
977
  var ctor = o.constructor;
1034
978
  return ctor && ctor.prototype === o;
1035
979
  };
1036
-
1037
980
  var excludedKeys = {
1038
981
  $console: true,
1039
982
  $external: true,
@@ -1056,13 +999,11 @@
1056
999
  $webkitStorageInfo: true,
1057
1000
  $window: true
1058
1001
  };
1059
-
1060
1002
  var hasAutomationEqualityBug = function () {
1061
1003
  /* global window */
1062
1004
  if (typeof window === "undefined") {
1063
1005
  return false;
1064
1006
  }
1065
-
1066
1007
  for (var k in window) {
1067
1008
  try {
1068
1009
  if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && _typeof(window[k]) === 'object') {
@@ -1076,52 +1017,41 @@
1076
1017
  return true;
1077
1018
  }
1078
1019
  }
1079
-
1080
1020
  return false;
1081
1021
  }();
1082
-
1083
1022
  var equalsConstructorPrototypeIfNotBuggy = function equalsConstructorPrototypeIfNotBuggy(o) {
1084
1023
  /* global window */
1085
1024
  if (typeof window === "undefined" || !hasAutomationEqualityBug) {
1086
1025
  return equalsConstructorPrototype(o);
1087
1026
  }
1088
-
1089
1027
  try {
1090
1028
  return equalsConstructorPrototype(o);
1091
1029
  } catch (e) {
1092
1030
  return false;
1093
1031
  }
1094
1032
  };
1095
-
1096
1033
  function isArgumentsObject(value) {
1097
1034
  var str = toStr.call(value);
1098
1035
  var isArgs = str === "[object Arguments]";
1099
-
1100
1036
  if (!isArgs) {
1101
1037
  isArgs = str !== "[object Array]" && value !== null && _typeof(value) === "object" && typeof value.length === "number" && value.length >= 0 && toStr.call(value.callee) === "[object Function]";
1102
1038
  }
1103
-
1104
1039
  return isArgs;
1105
1040
  }
1106
-
1107
1041
  return function keys(object) {
1108
1042
  var isFunction = toStr.call(object) === "[object Function]";
1109
1043
  var isArguments = isArgumentsObject(object);
1110
1044
  var isString = toStr.call(object) === "[object String]";
1111
1045
  var theKeys = [];
1112
-
1113
1046
  if (object === undefined || object === null) {
1114
1047
  throw new TypeError("Cannot convert undefined or null to object");
1115
1048
  }
1116
-
1117
1049
  var skipProto = hasProtoEnumBug && isFunction;
1118
-
1119
1050
  if (isString && object.length > 0 && !has.call(object, 0)) {
1120
1051
  for (var i = 0; i < object.length; ++i) {
1121
1052
  theKeys.push(String(i));
1122
1053
  }
1123
1054
  }
1124
-
1125
1055
  if (isArguments && object.length > 0) {
1126
1056
  for (var j = 0; j < object.length; ++j) {
1127
1057
  theKeys.push(String(j));
@@ -1133,17 +1063,14 @@
1133
1063
  }
1134
1064
  }
1135
1065
  }
1136
-
1137
1066
  if (hasDontEnumBug) {
1138
1067
  var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
1139
-
1140
1068
  for (var k = 0; k < dontEnums.length; ++k) {
1141
1069
  if (!(skipConstructor && dontEnums[k] === "constructor") && has.call(object, dontEnums[k])) {
1142
1070
  theKeys.push(dontEnums[k]);
1143
1071
  }
1144
1072
  }
1145
1073
  }
1146
-
1147
1074
  return theKeys;
1148
1075
  };
1149
1076
  }();
@@ -1152,73 +1079,73 @@
1152
1079
  (function (undefined) {
1153
1080
  // Detection from https://github.com/Financial-Times/polyfill-library/blob/987630a085e29226da16b5dc542042c687560191/polyfills/Object/assign/detect.js
1154
1081
  var detect = ('assign' in Object);
1155
- if (detect) return; // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.assign&flags=always
1082
+ if (detect) return;
1156
1083
 
1084
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.assign&flags=always
1157
1085
  (function () {
1158
1086
  // 7.1.13 ToObject ( argument )
1159
1087
  function toObject(argument) {
1160
1088
  if (argument === null || argument === undefined) {
1161
1089
  throw new TypeError('Cannot call method on ' + argument);
1162
1090
  }
1163
-
1164
1091
  return Object(argument);
1165
1092
  }
1166
-
1167
1093
  Object.defineProperty(Object, 'assign', {
1168
1094
  enumerable: false,
1169
1095
  configurable: true,
1170
1096
  writable: true,
1171
1097
  value: function assign(target, source) {
1172
1098
  // eslint-disable-line no-unused-vars
1099
+
1173
1100
  // 1. Let to be ? ToObject(target).
1174
- var to = toObject(target); // 2. If only one argument was passed, return to.
1101
+ var to = toObject(target);
1175
1102
 
1103
+ // 2. If only one argument was passed, return to.
1176
1104
  if (arguments.length === 1) {
1177
1105
  return to;
1178
- } // 3. Let sources be the List of argument values starting with the second argument
1179
-
1106
+ }
1180
1107
 
1181
- var sources = Array.prototype.slice.call(arguments, 1); // 4. For each element nextSource of sources, in ascending index order, do
1108
+ // 3. Let sources be the List of argument values starting with the second argument
1109
+ var sources = Array.prototype.slice.call(arguments, 1);
1182
1110
 
1111
+ // 4. For each element nextSource of sources, in ascending index order, do
1183
1112
  var index1;
1184
1113
  var index2;
1185
1114
  var keys;
1186
1115
  var from;
1187
-
1188
1116
  for (index1 = 0; index1 < sources.length; index1++) {
1189
- var nextSource = sources[index1]; // 4a. If nextSource is undefined or null, let keys be a new empty List.
1190
-
1117
+ var nextSource = sources[index1];
1118
+ // 4a. If nextSource is undefined or null, let keys be a new empty List.
1191
1119
  if (nextSource === undefined || nextSource === null) {
1192
- keys = []; // 4b. Else,
1120
+ keys = [];
1121
+ // 4b. Else,
1193
1122
  } else {
1194
1123
  // 4bi. Let from be ! ToObject(nextSource).
1195
- from = toObject(nextSource); // 4bii. Let keys be ? from.[[OwnPropertyKeys]]().
1196
-
1124
+ from = toObject(nextSource);
1125
+ // 4bii. Let keys be ? from.[[OwnPropertyKeys]]().
1197
1126
  /*
1198
1127
  This step in our polyfill is not complying with the specification.
1199
1128
  [[OwnPropertyKeys]] is meant to return ALL keys, including non-enumerable and symbols.
1200
1129
  TODO: When we have Reflect.ownKeys, use that instead as it is the userland equivalent of [[OwnPropertyKeys]].
1201
1130
  */
1202
-
1203
1131
  keys = Object.keys(from);
1204
- } // 4c. For each element nextKey of keys in List order, do
1205
-
1132
+ }
1206
1133
 
1134
+ // 4c. For each element nextKey of keys in List order, do
1207
1135
  for (index2 = 0; index2 < keys.length; index2++) {
1208
- var nextKey = keys[index2]; // 4ci. Let desc be ? from.[[GetOwnProperty]](nextKey).
1209
-
1210
- var desc = Object.getOwnPropertyDescriptor(from, nextKey); // 4cii. If desc is not undefined and desc.[[Enumerable]] is true, then
1211
-
1136
+ var nextKey = keys[index2];
1137
+ // 4ci. Let desc be ? from.[[GetOwnProperty]](nextKey).
1138
+ var desc = Object.getOwnPropertyDescriptor(from, nextKey);
1139
+ // 4cii. If desc is not undefined and desc.[[Enumerable]] is true, then
1212
1140
  if (desc !== undefined && desc.enumerable) {
1213
1141
  // 4cii1. Let propValue be ? Get(from, nextKey).
1214
- var propValue = from[nextKey]; // 4cii2. Perform ? Set(to, nextKey, propValue, true).
1215
-
1142
+ var propValue = from[nextKey];
1143
+ // 4cii2. Perform ? Set(to, nextKey, propValue, true).
1216
1144
  to[nextKey] = propValue;
1217
1145
  }
1218
1146
  }
1219
- } // 5. Return to.
1220
-
1221
-
1147
+ }
1148
+ // 5. Return to.
1222
1149
  return to;
1223
1150
  }
1224
1151
  });
@@ -1228,8 +1155,9 @@
1228
1155
  (function (undefined) {
1229
1156
  // Detection from https://github.com/Financial-Times/polyfill-library/blob/987630a085e29226da16b5dc542042c687560191/polyfills/Date/now/detect.js
1230
1157
  var detect = 'Date' in this && 'now' in this.Date && 'getTime' in this.Date.prototype;
1231
- if (detect) return; // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Array.prototype.forEach&flags=always
1158
+ if (detect) return;
1232
1159
 
1160
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Array.prototype.forEach&flags=always
1233
1161
  Date.now = function now() {
1234
1162
  return new Date().getTime();
1235
1163
  };
@@ -1245,15 +1173,14 @@
1245
1173
  if (window.NodeList.prototype.forEach) {
1246
1174
  return nodes.forEach(callback);
1247
1175
  }
1248
-
1249
1176
  for (var i = 0; i < nodes.length; i += 1) {
1250
1177
  callback.call(window, nodes[i], i, nodes);
1251
1178
  }
1252
- } // eslint-disable-next-line import/prefer-default-export
1179
+ }
1253
1180
 
1254
1181
  /* global ActiveXObject */
1255
1182
  var _console = console,
1256
- warn = _console.warn;
1183
+ warn = _console.warn;
1257
1184
  var utils = {
1258
1185
  generateDomElementFromString: function generateDomElementFromString(str) {
1259
1186
  var abc = document.createElement('div');
@@ -1282,7 +1209,6 @@
1282
1209
  },
1283
1210
  removeElement: function removeElement($elem) {
1284
1211
  var parent = $elem.parentNode;
1285
-
1286
1212
  if (parent) {
1287
1213
  parent.removeChild($elem);
1288
1214
  } else {
@@ -1292,11 +1218,9 @@
1292
1218
  ajaxGet: function ajaxGet(url, success) {
1293
1219
  var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
1294
1220
  xhr.open('GET', url);
1295
-
1296
1221
  xhr.onreadystatechange = function () {
1297
1222
  if (xhr.readyState > 3 && xhr.status === 200) success(xhr.responseText);
1298
1223
  };
1299
-
1300
1224
  xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
1301
1225
  xhr.send();
1302
1226
  return xhr;
@@ -1310,25 +1234,21 @@
1310
1234
  var resetElementsFunctionList = [];
1311
1235
  var closeCallbacks = [];
1312
1236
  $dialog.appendChild($preparedElementToDisplay);
1313
-
1314
1237
  if (!utils.hasClass('html', 'noScroll')) {
1315
1238
  utils.addClass('html', 'noScroll');
1316
1239
  resetElementsFunctionList.push(function () {
1317
1240
  utils.removeClass('html', 'noScroll');
1318
1241
  });
1319
1242
  }
1320
-
1321
1243
  document.body.appendChild($dialog);
1322
1244
  document.body.appendChild($overlay);
1323
1245
  resetElementsFunctionList.push(function () {
1324
1246
  utils.removeElement($dialog);
1325
1247
  utils.removeElement($overlay);
1326
1248
  });
1327
-
1328
1249
  var setupFocusHandlerAndFocusDialog = function setupFocusHandlerAndFocusDialog() {
1329
1250
  function keepFocus(event) {
1330
1251
  var modalFocus = document.getElementById('hmrc-timeout-dialog');
1331
-
1332
1252
  if (modalFocus) {
1333
1253
  if (event.target !== modalFocus && !modalFocus.contains(event.target)) {
1334
1254
  event.stopPropagation();
@@ -1336,7 +1256,6 @@
1336
1256
  }
1337
1257
  }
1338
1258
  }
1339
-
1340
1259
  var elemToFocusOnReset = document.activeElement;
1341
1260
  $dialog.focus();
1342
1261
  document.addEventListener('focus', keepFocus, true);
@@ -1344,54 +1263,46 @@
1344
1263
  document.removeEventListener('focus', keepFocus);
1345
1264
  elemToFocusOnReset.focus();
1346
1265
  });
1347
- }; // disable the non-dialog page to prevent confusion for VoiceOver users
1348
-
1266
+ };
1349
1267
 
1268
+ // disable the non-dialog page to prevent confusion for VoiceOver users
1350
1269
  var selectors = ['#skiplink-container', 'body > header', '#global-cookie-message', 'main[role=main]', 'body > footer', 'body > .govuk-skip-link', '.cbanner-govuk-cookie-banner', 'body > .govuk-width-container'];
1351
1270
  var elements = document.querySelectorAll(selectors.join(', '));
1352
-
1353
1271
  var close = function close() {
1354
1272
  while (resetElementsFunctionList.length > 0) {
1355
1273
  var fn = resetElementsFunctionList.shift();
1356
1274
  fn();
1357
1275
  }
1358
1276
  };
1359
-
1360
1277
  var closeAndInform = function closeAndInform() {
1361
1278
  closeCallbacks.forEach(function (fn) {
1362
1279
  fn();
1363
1280
  });
1364
1281
  close();
1365
1282
  };
1366
-
1367
1283
  var setupKeydownHandler = function setupKeydownHandler() {
1368
1284
  function keydownListener(e) {
1369
1285
  if (e.keyCode === 27) {
1370
1286
  closeAndInform();
1371
1287
  }
1372
1288
  }
1373
-
1374
1289
  document.addEventListener('keydown', keydownListener);
1375
1290
  resetElementsFunctionList.push(function () {
1376
1291
  document.removeEventListener('keydown', keydownListener);
1377
1292
  });
1378
1293
  };
1379
-
1380
1294
  var preventMobileScrollWhileAllowingPinchZoom = function preventMobileScrollWhileAllowingPinchZoom() {
1381
1295
  var handleTouch = function handleTouch(e) {
1382
1296
  var touches = e.touches || e.changedTouches || [];
1383
-
1384
1297
  if (touches.length === 1) {
1385
1298
  e.preventDefault();
1386
1299
  }
1387
1300
  };
1388
-
1389
1301
  document.addEventListener('touchmove', handleTouch, true);
1390
1302
  resetElementsFunctionList.push(function () {
1391
1303
  document.removeEventListener('touchmove', handleTouch, true);
1392
1304
  });
1393
1305
  };
1394
-
1395
1306
  nodeListForEach(elements, function ($elem) {
1396
1307
  var value = $elem.getAttribute('aria-hidden');
1397
1308
  $elem.setAttribute('aria-hidden', 'true');
@@ -1402,8 +1313,9 @@
1402
1313
  $elem.removeAttribute('aria-hidden');
1403
1314
  }
1404
1315
  });
1405
- }); //
1316
+ });
1406
1317
 
1318
+ //
1407
1319
  setupFocusHandlerAndFocusDialog();
1408
1320
  setupKeydownHandler();
1409
1321
  preventMobileScrollWhileAllowingPinchZoom();
@@ -1423,7 +1335,6 @@
1423
1335
  }
1424
1336
  };
1425
1337
  }
1426
-
1427
1338
  var dialog = {
1428
1339
  displayDialog: displayDialog
1429
1340
  };
@@ -1434,41 +1345,36 @@
1434
1345
  };
1435
1346
 
1436
1347
  function ValidateInput() {}
1437
-
1438
1348
  ValidateInput["int"] = function (stringToValidate) {
1439
1349
  var parsedInt = parseInt(stringToValidate, 10);
1440
1350
  return Number.isNaN(parsedInt) ? undefined : parsedInt;
1441
1351
  };
1442
-
1443
1352
  ValidateInput.string = function (stringToValidate) {
1444
1353
  return typeof stringToValidate === 'string' ? stringToValidate : undefined;
1445
1354
  };
1446
-
1447
1355
  ValidateInput["boolean"] = function (stringToValidate) {
1448
1356
  return String(stringToValidate).toLowerCase() === 'true';
1449
1357
  };
1450
1358
 
1451
1359
  function RedirectHelper() {}
1452
-
1453
1360
  RedirectHelper.redirectToUrl = function (url) {
1454
1361
  // This exists to make redirects more testable
1455
1362
  window.location.href = url;
1456
1363
  };
1457
1364
 
1365
+ // TODO: rewrite this to follow govuk-frontend prototype module pattern
1366
+
1458
1367
  function TimeoutDialog($module, $sessionActivityService) {
1459
1368
  var options = {};
1460
1369
  var settings = {};
1461
1370
  var cleanupFunctions = [];
1462
1371
  var currentTimer;
1463
1372
  var sessionActivityService = $sessionActivityService;
1464
-
1465
1373
  function init() {
1466
1374
  var validate = ValidateInput;
1467
-
1468
1375
  function lookupData(key) {
1469
1376
  return ($module.attributes.getNamedItem(key) || {}).value;
1470
1377
  }
1471
-
1472
1378
  var localisedDefaults = validate.string(lookupData('data-language')) === 'cy' ? {
1473
1379
  title: 'Rydych ar fin cael eich allgofnodi',
1474
1380
  message: 'Er eich diogelwch, byddwn yn eich allgofnodi cyn pen',
@@ -1504,19 +1410,18 @@
1504
1410
  keepAliveButtonText: validate.string(lookupData('data-keep-alive-button-text')),
1505
1411
  signOutButtonText: validate.string(lookupData('data-sign-out-button-text')),
1506
1412
  synchroniseTabs: validate["boolean"](lookupData('data-synchronise-tabs') || false)
1507
- }; // Default timeoutUrl to signOutUrl if not set
1413
+ };
1508
1414
 
1415
+ // Default timeoutUrl to signOutUrl if not set
1509
1416
  options.timeoutUrl = options.timeoutUrl || options.signOutUrl;
1510
1417
  validateInput(options);
1511
1418
  settings = mergeOptionsWithDefaults(options, localisedDefaults);
1512
1419
  setupDialogTimer();
1513
1420
  listenForSessionActivityAndResetDialogTimer();
1514
1421
  }
1515
-
1516
1422
  var broadcastSessionActivity = function broadcastSessionActivity() {
1517
1423
  sessionActivityService.logActivity();
1518
1424
  };
1519
-
1520
1425
  var listenForSessionActivityAndResetDialogTimer = function listenForSessionActivityAndResetDialogTimer() {
1521
1426
  if (settings.synchroniseTabs) {
1522
1427
  sessionActivityService.onActivity(function (event) {
@@ -1526,7 +1431,6 @@
1526
1431
  });
1527
1432
  }
1528
1433
  };
1529
-
1530
1434
  var validateInput = function validateInput(config) {
1531
1435
  var requiredConfig = ['timeout', 'countdown', 'keepAliveUrl', 'signOutUrl'];
1532
1436
  var missingRequiredConfig = [];
@@ -1535,27 +1439,22 @@
1535
1439
  missingRequiredConfig.push("data-".concat(item.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()));
1536
1440
  }
1537
1441
  });
1538
-
1539
1442
  if (missingRequiredConfig.length > 0) {
1540
1443
  throw new Error("Missing config item(s): [".concat(missingRequiredConfig.join(', '), "]"));
1541
1444
  }
1542
1445
  };
1543
-
1544
1446
  var mergeOptionsWithDefaults = function mergeOptionsWithDefaults(theOptions, localisedDefaults) {
1545
1447
  var clone = _objectSpread2({}, theOptions);
1546
-
1547
1448
  Object.keys(localisedDefaults).forEach(function (key) {
1548
1449
  if (_typeof(clone[key]) === 'object') {
1549
1450
  clone[key] = mergeOptionsWithDefaults(theOptions[key], localisedDefaults[key]);
1550
1451
  }
1551
-
1552
1452
  if (clone[key] === undefined || clone[key] === '') {
1553
1453
  clone[key] = localisedDefaults[key];
1554
1454
  }
1555
1455
  });
1556
1456
  return clone;
1557
1457
  };
1558
-
1559
1458
  var setupDialogTimer = function setupDialogTimer() {
1560
1459
  var timeOfLastActivity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getDateNow();
1561
1460
  var signoutTime = timeOfLastActivity + settings.timeout * 1000;
@@ -1566,39 +1465,32 @@
1566
1465
  }, secondsUntilTimeoutDialog * 1000 - delta);
1567
1466
  cleanupFunctions.push(function () {
1568
1467
  window.clearTimeout(timeout);
1569
-
1570
1468
  if (currentTimer) {
1571
1469
  window.clearTimeout(currentTimer);
1572
1470
  }
1573
1471
  });
1574
1472
  };
1575
-
1576
1473
  var wrapLink = function wrapLink($elem) {
1577
1474
  var $wrapper = document.createElement('div');
1578
1475
  $wrapper.classList.add('hmrc-timeout-dialog__link-wrapper');
1579
1476
  $wrapper.appendChild($elem);
1580
1477
  return $wrapper;
1581
1478
  };
1582
-
1583
1479
  var setupDialog = function setupDialog(signoutTime) {
1584
1480
  var $element = utils.generateDomElementFromString('<div>');
1585
-
1586
1481
  if (settings.title) {
1587
1482
  var $tmp = utils.generateDomElementFromStringAndAppendText('<h1 id="hmrc-timeout-heading" class="govuk-heading-m push--top">', settings.title);
1588
1483
  $element.appendChild($tmp);
1589
1484
  }
1590
-
1591
1485
  var $countdownElement = utils.generateDomElementFromString('<span id="hmrc-timeout-countdown" class="hmrc-timeout-dialog__countdown">');
1592
1486
  var $audibleMessage = utils.generateDomElementFromString('<p id="hmrc-timeout-message" class="govuk-visually-hidden screenreader-content" aria-live="assertive">');
1593
1487
  var $visualMessge = utils.generateDomElementFromStringAndAppendText('<p class="govuk-body hmrc-timeout-dialog__message" aria-hidden="true">', settings.message);
1594
1488
  $visualMessge.appendChild(document.createTextNode(' '));
1595
1489
  $visualMessge.appendChild($countdownElement);
1596
1490
  $visualMessge.appendChild(document.createTextNode('.'));
1597
-
1598
1491
  if (settings.messageSuffix) {
1599
1492
  $visualMessge.appendChild(document.createTextNode(" ".concat(settings.messageSuffix)));
1600
1493
  }
1601
-
1602
1494
  var $staySignedInButton = utils.generateDomElementFromStringAndAppendText('<button id="hmrc-timeout-keep-signin-btn" class="govuk-button">', settings.keepAliveButtonText);
1603
1495
  var $signOutButton = utils.generateDomElementFromStringAndAppendText('<a id="hmrc-timeout-sign-out-link" class="govuk-link hmrc-timeout-dialog__link">', settings.signOutButtonText);
1604
1496
  $staySignedInButton.addEventListener('click', keepAliveAndClose);
@@ -1615,124 +1507,97 @@
1615
1507
  });
1616
1508
  dialogControl.addCloseHandler(keepAliveAndClose);
1617
1509
  dialogControl.setAriaLabelledBy('hmrc-timeout-heading hmrc-timeout-message');
1618
-
1619
1510
  var getMillisecondsRemaining = function getMillisecondsRemaining() {
1620
1511
  return signoutTime - getDateNow();
1621
1512
  };
1622
-
1623
1513
  var getSecondsRemaining = function getSecondsRemaining() {
1624
1514
  return Math.round(getMillisecondsRemaining() / 1000);
1625
1515
  };
1626
-
1627
1516
  var getHumanText = function getHumanText(counter) {
1628
1517
  var minutes;
1629
1518
  var visibleMessage;
1630
-
1631
1519
  if (counter < 60) {
1632
1520
  visibleMessage = "".concat(counter, " ").concat(settings.properties[counter !== 1 ? 'seconds' : 'second']);
1633
1521
  } else {
1634
1522
  minutes = Math.ceil(counter / 60);
1635
1523
  visibleMessage = "".concat(minutes, " ").concat(settings.properties[minutes === 1 ? 'minute' : 'minutes']);
1636
1524
  }
1637
-
1638
1525
  return visibleMessage;
1639
1526
  };
1640
-
1641
1527
  var getAudibleHumanText = function getAudibleHumanText(counter) {
1642
1528
  var humanText = getHumanText(roundSecondsUp(counter));
1643
1529
  var messageParts = [settings.message, ' ', humanText, '.'];
1644
-
1645
1530
  if (settings.messageSuffix) {
1646
1531
  messageParts.push(' ');
1647
1532
  messageParts.push(settings.messageSuffix);
1648
1533
  }
1649
-
1650
1534
  return messageParts.join('');
1651
1535
  };
1652
-
1653
1536
  var roundSecondsUp = function roundSecondsUp(counter) {
1654
1537
  if (counter > 60) {
1655
1538
  return counter;
1656
1539
  }
1657
-
1658
1540
  if (counter < 20) {
1659
1541
  return 20;
1660
1542
  }
1661
-
1662
1543
  return Math.ceil(counter / 20) * 20;
1663
1544
  };
1664
-
1665
1545
  var updateTextIfChanged = function updateTextIfChanged($elem, text) {
1666
1546
  if ($elem.innerText !== text) {
1667
1547
  // eslint-disable-next-line no-param-reassign
1668
1548
  $elem.innerText = text;
1669
1549
  }
1670
1550
  };
1671
-
1672
1551
  var updateCountdown = function updateCountdown(counter) {
1673
1552
  var visibleMessage = getHumanText(counter);
1674
1553
  var audibleHumanText = getAudibleHumanText(counter);
1675
1554
  updateTextIfChanged($countdownElement, visibleMessage);
1676
1555
  updateTextIfChanged($audibleMessage, audibleHumanText);
1677
1556
  };
1678
-
1679
1557
  var getNextTimeout = function getNextTimeout() {
1680
1558
  var remaining = getMillisecondsRemaining();
1681
1559
  var roundedRemaining = Math.floor(getMillisecondsRemaining() / 1000) * 1000;
1682
-
1683
1560
  if (roundedRemaining <= 60000) {
1684
1561
  return remaining - roundedRemaining || 1000;
1685
1562
  }
1686
-
1687
1563
  return remaining - (roundedRemaining - (roundedRemaining % 60000 || 60000));
1688
1564
  };
1689
-
1690
1565
  var runUpdate = function runUpdate() {
1691
1566
  var counter = getSecondsRemaining();
1692
1567
  updateCountdown(counter);
1693
-
1694
1568
  if (counter <= 0) {
1695
1569
  timeout();
1696
1570
  }
1697
-
1698
1571
  currentTimer = window.setTimeout(runUpdate, getNextTimeout());
1699
1572
  };
1700
-
1701
1573
  runUpdate();
1702
1574
  };
1703
-
1704
1575
  var keepAliveAndClose = function keepAliveAndClose() {
1705
1576
  cleanup();
1706
1577
  setupDialogTimer();
1707
1578
  utils.ajaxGet(settings.keepAliveUrl, function () {});
1708
1579
  broadcastSessionActivity();
1709
1580
  };
1710
-
1711
1581
  var getDateNow = function getDateNow() {
1712
1582
  return Date.now();
1713
1583
  };
1714
-
1715
1584
  var signOut = function signOut() {
1716
1585
  RedirectHelper.redirectToUrl(settings.signOutUrl);
1717
1586
  };
1718
-
1719
1587
  var timeout = function timeout() {
1720
1588
  RedirectHelper.redirectToUrl(settings.timeoutUrl);
1721
1589
  };
1722
-
1723
1590
  var cleanup = function cleanup() {
1724
1591
  while (cleanupFunctions.length > 0) {
1725
1592
  var fn = cleanupFunctions.shift();
1726
1593
  fn();
1727
1594
  }
1728
1595
  };
1729
-
1730
1596
  return {
1731
1597
  init: init,
1732
1598
  cleanup: cleanup
1733
1599
  };
1734
1600
  }
1735
-
1736
1601
  TimeoutDialog.dialog = dialog;
1737
1602
  TimeoutDialog.redirectHelper = RedirectHelper;
1738
1603
  TimeoutDialog.utils = utils;
@@ -1741,36 +1606,29 @@
1741
1606
  var setCookie = function setCookie(name, value) {
1742
1607
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1743
1608
  var cookieString = "".concat(name, "=").concat(value, "; path=/");
1744
-
1745
1609
  if (options.days) {
1746
1610
  var date = new Date();
1747
1611
  date.setTime(date.getTime() + options.days * 24 * 60 * 60 * 1000);
1748
1612
  cookieString = "".concat(cookieString, "; expires=").concat(date.toGMTString());
1749
1613
  }
1750
-
1751
1614
  if (window.location.protocol === 'https:') {
1752
1615
  cookieString += '; Secure';
1753
1616
  }
1754
-
1755
1617
  document.cookie = cookieString;
1756
1618
  return cookieString;
1757
1619
  };
1758
1620
  var getCookie = function getCookie(name) {
1759
1621
  var nameEQ = "".concat(name, "=");
1760
1622
  var cookies = document.cookie.split(';');
1761
-
1762
1623
  for (var i = 0, len = cookies.length; i < len; i += 1) {
1763
1624
  var cookie = cookies[i];
1764
-
1765
1625
  while (cookie.charAt(0) === ' ') {
1766
1626
  cookie = cookie.substring(1, cookie.length);
1767
1627
  }
1768
-
1769
1628
  if (cookie.indexOf(nameEQ) === 0) {
1770
1629
  return decodeURIComponent(cookie.substring(nameEQ.length));
1771
1630
  }
1772
1631
  }
1773
-
1774
1632
  return null;
1775
1633
  };
1776
1634
 
@@ -1780,16 +1638,13 @@
1780
1638
  this.cookieName = 'mdtpurr';
1781
1639
  this.cookieExpiryDays = 28;
1782
1640
  }
1783
-
1784
1641
  UserResearchBanner.prototype.init = function init() {
1785
1642
  var cookieData = getCookie(this.cookieName);
1786
-
1787
1643
  if (cookieData == null) {
1788
1644
  this.$module.classList.add('hmrc-user-research-banner--show');
1789
1645
  this.$closeLink.addEventListener('click', this.eventHandlers.noThanksClick.bind(this));
1790
1646
  }
1791
1647
  };
1792
-
1793
1648
  UserResearchBanner.prototype.eventHandlers = {
1794
1649
  noThanksClick: function noThanksClick(event) {
1795
1650
  event.preventDefault();
@@ -1803,10 +1658,8 @@
1803
1658
  var SessionActivityService = /*#__PURE__*/function () {
1804
1659
  function SessionActivityService(BrowserBroadcastChannel) {
1805
1660
  _classCallCheck(this, SessionActivityService);
1806
-
1807
1661
  this.activityChannel = BrowserBroadcastChannel && new BrowserBroadcastChannel('session-activity');
1808
1662
  }
1809
-
1810
1663
  _createClass(SessionActivityService, [{
1811
1664
  key: "logActivity",
1812
1665
  value: function logActivity() {
@@ -1827,37 +1680,29 @@
1827
1680
  }
1828
1681
  }
1829
1682
  }]);
1830
-
1831
1683
  return SessionActivityService;
1832
1684
  }();
1833
1685
 
1834
1686
  function initAll() {
1835
1687
  var $AccountMenuSelector = '[data-module="hmrc-account-menu"]';
1836
-
1837
1688
  if (document.querySelector($AccountMenuSelector)) {
1838
1689
  new AccountMenu($AccountMenuSelector).init();
1839
1690
  }
1840
-
1841
1691
  var sessionActivityService = new SessionActivityService(window.BroadcastChannel);
1842
1692
  sessionActivityService.logActivity();
1843
1693
  var $TimeoutDialog = document.querySelector('meta[name="hmrc-timeout-dialog"]');
1844
-
1845
1694
  if ($TimeoutDialog) {
1846
1695
  new TimeoutDialog($TimeoutDialog, sessionActivityService).init();
1847
1696
  }
1848
-
1849
1697
  var $UserResearchBanner = document.querySelector('[data-module="hmrc-user-research-banner"]');
1850
-
1851
1698
  if ($UserResearchBanner) {
1852
1699
  new UserResearchBanner($UserResearchBanner).init();
1853
1700
  }
1854
-
1855
1701
  var $BackLinks = document.querySelectorAll('[data-module="hmrc-back-link"]');
1856
1702
  nodeListForEach($BackLinks, function ($BackLink) {
1857
1703
  new BackLinkHelper($BackLink, window, document).init();
1858
1704
  });
1859
1705
  }
1860
-
1861
1706
  var all = {
1862
1707
  initAll: initAll,
1863
1708
  AccountMenu: AccountMenu,