@govuk-pay/pay-js-commons 3.2.0 → 3.3.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.
@@ -10,3 +10,8 @@ updates:
10
10
  - dependencies
11
11
  - govuk-pay
12
12
  - javascript
13
+ - package-ecosystem: "github-actions"
14
+ directory: "/"
15
+ schedule:
16
+ interval: "daily"
17
+ time: "03:00"
@@ -16,13 +16,13 @@ jobs:
16
16
 
17
17
  steps:
18
18
  - name: Checkout
19
- uses: actions/checkout@v2
19
+ uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
20
20
  - name: Setup
21
- uses: actions/setup-node@v2
21
+ uses: actions/setup-node@aa759c6c94d3800c55b8601f21ba4b2371704cb7
22
22
  with:
23
- node-version: 12.22.1
23
+ node-version: 12.22.4
24
24
  - name: Cache NPM packages
25
- uses: actions/cache@v2
25
+ uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353
26
26
  with:
27
27
  path: ~/.npm
28
28
  key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
@@ -0,0 +1,7 @@
1
+ repos:
2
+ - repo: https://github.com/Yelp/detect-secrets
3
+ rev: f6027a0521e044ba46e54611cabd787b7a88d1a9
4
+ hooks:
5
+ - id: detect-secrets
6
+ args: ['--baseline', '.secrets.baseline']
7
+ exclude: package.lock.json
package/.secrets.baseline CHANGED
@@ -1,19 +1,15 @@
1
1
  {
2
- "exclude": {
3
- "files": "package-lock.json",
4
- "lines": null
5
- },
6
- "generated_at": "2020-10-07T09:00:53Z",
2
+ "version": "1.1.0",
7
3
  "plugins_used": [
8
4
  {
9
- "name": "AWSKeyDetector"
5
+ "name": "ArtifactoryDetector"
10
6
  },
11
7
  {
12
- "name": "ArtifactoryDetector"
8
+ "name": "AWSKeyDetector"
13
9
  },
14
10
  {
15
- "base64_limit": 4.5,
16
- "name": "Base64HighEntropyString"
11
+ "name": "Base64HighEntropyString",
12
+ "limit": 4.5
17
13
  },
18
14
  {
19
15
  "name": "BasicAuthDetector"
@@ -22,8 +18,8 @@
22
18
  "name": "CloudantDetector"
23
19
  },
24
20
  {
25
- "hex_limit": 3,
26
- "name": "HexHighEntropyString"
21
+ "name": "HexHighEntropyString",
22
+ "limit": 3
27
23
  },
28
24
  {
29
25
  "name": "IbmCloudIamDetector"
@@ -35,8 +31,8 @@
35
31
  "name": "JwtTokenDetector"
36
32
  },
37
33
  {
38
- "keyword_exclude": null,
39
- "name": "KeywordDetector"
34
+ "name": "KeywordDetector",
35
+ "keyword_exclude": ""
40
36
  },
41
37
  {
42
38
  "name": "MailchimpDetector"
@@ -57,10 +53,71 @@
57
53
  "name": "TwilioKeyDetector"
58
54
  }
59
55
  ],
60
- "results": {},
61
- "version": "0.13.1",
62
- "word_list": {
63
- "file": null,
64
- "hash": null
65
- }
56
+ "filters_used": [
57
+ {
58
+ "path": "detect_secrets.filters.allowlist.is_line_allowlisted"
59
+ },
60
+ {
61
+ "path": "detect_secrets.filters.common.is_baseline_file",
62
+ "filename": ".secrets.baseline"
63
+ },
64
+ {
65
+ "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
66
+ "min_level": 2
67
+ },
68
+ {
69
+ "path": "detect_secrets.filters.heuristic.is_indirect_reference"
70
+ },
71
+ {
72
+ "path": "detect_secrets.filters.heuristic.is_likely_id_string"
73
+ },
74
+ {
75
+ "path": "detect_secrets.filters.heuristic.is_lock_file"
76
+ },
77
+ {
78
+ "path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
79
+ },
80
+ {
81
+ "path": "detect_secrets.filters.heuristic.is_potential_uuid"
82
+ },
83
+ {
84
+ "path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
85
+ },
86
+ {
87
+ "path": "detect_secrets.filters.heuristic.is_sequential_string"
88
+ },
89
+ {
90
+ "path": "detect_secrets.filters.heuristic.is_swagger_file"
91
+ },
92
+ {
93
+ "path": "detect_secrets.filters.heuristic.is_templated_secret"
94
+ },
95
+ {
96
+ "path": "detect_secrets.filters.regex.should_exclude_file",
97
+ "pattern": [
98
+ "package-lock.json"
99
+ ]
100
+ }
101
+ ],
102
+ "results": {
103
+ ".pre-commit-config.yaml": [
104
+ {
105
+ "type": "Hex High Entropy String",
106
+ "filename": ".pre-commit-config.yaml",
107
+ "hashed_secret": "d8371c23f86b4df4be2854848f6f28f13d7582f5",
108
+ "is_verified": false,
109
+ "line_number": 3
110
+ }
111
+ ],
112
+ "src/utils/field-validation-checks.js": [
113
+ {
114
+ "type": "Secret Keyword",
115
+ "filename": "src/utils/field-validation-checks.js",
116
+ "hashed_secret": "5bb4b8e78cff9ca47061adfd961e2b26c46e7fa5",
117
+ "is_verified": false,
118
+ "line_number": 20
119
+ }
120
+ ]
121
+ },
122
+ "generated_at": "2021-08-13T16:00:04Z"
66
123
  }
@@ -1,167 +1,151 @@
1
1
  (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
- /*!
3
- * JavaScript Cookie v2.2.1
4
- * https://github.com/js-cookie/js-cookie
5
- *
6
- * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
7
- * Released under the MIT license
8
- */
9
- ;(function (factory) {
10
- var registeredInModuleLoader;
11
- if (typeof define === 'function' && define.amd) {
12
- define(factory);
13
- registeredInModuleLoader = true;
14
- }
15
- if (typeof exports === 'object') {
16
- module.exports = factory();
17
- registeredInModuleLoader = true;
18
- }
19
- if (!registeredInModuleLoader) {
20
- var OldCookies = window.Cookies;
21
- var api = window.Cookies = factory();
22
- api.noConflict = function () {
23
- window.Cookies = OldCookies;
24
- return api;
25
- };
26
- }
27
- }(function () {
28
- function extend () {
29
- var i = 0;
30
- var result = {};
31
- for (; i < arguments.length; i++) {
32
- var attributes = arguments[ i ];
33
- for (var key in attributes) {
34
- result[key] = attributes[key];
35
- }
36
- }
37
- return result;
38
- }
39
-
40
- function decode (s) {
41
- return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
42
- }
43
-
44
- function init (converter) {
45
- function api() {}
46
-
47
- function set (key, value, attributes) {
48
- if (typeof document === 'undefined') {
49
- return;
50
- }
51
-
52
- attributes = extend({
53
- path: '/'
54
- }, api.defaults, attributes);
55
-
56
- if (typeof attributes.expires === 'number') {
57
- attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);
58
- }
59
-
60
- // We're using "expires" because "max-age" is not supported by IE
61
- attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
62
-
63
- try {
64
- var result = JSON.stringify(value);
65
- if (/^[\{\[]/.test(result)) {
66
- value = result;
67
- }
68
- } catch (e) {}
69
-
70
- value = converter.write ?
71
- converter.write(value, key) :
72
- encodeURIComponent(String(value))
73
- .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
74
-
75
- key = encodeURIComponent(String(key))
76
- .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)
77
- .replace(/[\(\)]/g, escape);
78
-
79
- var stringifiedAttributes = '';
80
- for (var attributeName in attributes) {
81
- if (!attributes[attributeName]) {
82
- continue;
83
- }
84
- stringifiedAttributes += '; ' + attributeName;
85
- if (attributes[attributeName] === true) {
86
- continue;
87
- }
88
-
89
- // Considers RFC 6265 section 5.2:
90
- // ...
91
- // 3. If the remaining unparsed-attributes contains a %x3B (";")
92
- // character:
93
- // Consume the characters of the unparsed-attributes up to,
94
- // not including, the first %x3B (";") character.
95
- // ...
96
- stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
97
- }
98
-
99
- return (document.cookie = key + '=' + value + stringifiedAttributes);
100
- }
101
-
102
- function get (key, json) {
103
- if (typeof document === 'undefined') {
104
- return;
105
- }
106
-
107
- var jar = {};
108
- // To prevent the for loop in the first place assign an empty array
109
- // in case there are no cookies at all.
110
- var cookies = document.cookie ? document.cookie.split('; ') : [];
111
- var i = 0;
112
-
113
- for (; i < cookies.length; i++) {
114
- var parts = cookies[i].split('=');
115
- var cookie = parts.slice(1).join('=');
116
-
117
- if (!json && cookie.charAt(0) === '"') {
118
- cookie = cookie.slice(1, -1);
119
- }
120
-
121
- try {
122
- var name = decode(parts[0]);
123
- cookie = (converter.read || converter)(cookie, name) ||
124
- decode(cookie);
125
-
126
- if (json) {
127
- try {
128
- cookie = JSON.parse(cookie);
129
- } catch (e) {}
130
- }
131
-
132
- jar[name] = cookie;
133
-
134
- if (key === name) {
135
- break;
136
- }
137
- } catch (e) {}
138
- }
139
-
140
- return key ? jar[key] : jar;
141
- }
142
-
143
- api.set = set;
144
- api.get = function (key) {
145
- return get(key, false /* read as raw */);
146
- };
147
- api.getJSON = function (key) {
148
- return get(key, true /* read as json */);
149
- };
150
- api.remove = function (key, attributes) {
151
- set(key, '', extend(attributes, {
152
- expires: -1
153
- }));
154
- };
155
-
156
- api.defaults = {};
157
-
158
- api.withConverter = init;
159
-
160
- return api;
161
- }
162
-
163
- return init(function () {});
164
- }));
2
+ /*! js-cookie v3.0.1 | MIT */
3
+ ;
4
+ (function (global, factory) {
5
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
6
+ typeof define === 'function' && define.amd ? define(factory) :
7
+ (global = global || self, (function () {
8
+ var current = global.Cookies;
9
+ var exports = global.Cookies = factory();
10
+ exports.noConflict = function () { global.Cookies = current; return exports; };
11
+ }()));
12
+ }(this, (function () { 'use strict';
13
+
14
+ /* eslint-disable no-var */
15
+ function assign (target) {
16
+ for (var i = 1; i < arguments.length; i++) {
17
+ var source = arguments[i];
18
+ for (var key in source) {
19
+ target[key] = source[key];
20
+ }
21
+ }
22
+ return target
23
+ }
24
+ /* eslint-enable no-var */
25
+
26
+ /* eslint-disable no-var */
27
+ var defaultConverter = {
28
+ read: function (value) {
29
+ if (value[0] === '"') {
30
+ value = value.slice(1, -1);
31
+ }
32
+ return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
33
+ },
34
+ write: function (value) {
35
+ return encodeURIComponent(value).replace(
36
+ /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
37
+ decodeURIComponent
38
+ )
39
+ }
40
+ };
41
+ /* eslint-enable no-var */
42
+
43
+ /* eslint-disable no-var */
44
+
45
+ function init (converter, defaultAttributes) {
46
+ function set (key, value, attributes) {
47
+ if (typeof document === 'undefined') {
48
+ return
49
+ }
50
+
51
+ attributes = assign({}, defaultAttributes, attributes);
52
+
53
+ if (typeof attributes.expires === 'number') {
54
+ attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
55
+ }
56
+ if (attributes.expires) {
57
+ attributes.expires = attributes.expires.toUTCString();
58
+ }
59
+
60
+ key = encodeURIComponent(key)
61
+ .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
62
+ .replace(/[()]/g, escape);
63
+
64
+ var stringifiedAttributes = '';
65
+ for (var attributeName in attributes) {
66
+ if (!attributes[attributeName]) {
67
+ continue
68
+ }
69
+
70
+ stringifiedAttributes += '; ' + attributeName;
71
+
72
+ if (attributes[attributeName] === true) {
73
+ continue
74
+ }
75
+
76
+ // Considers RFC 6265 section 5.2:
77
+ // ...
78
+ // 3. If the remaining unparsed-attributes contains a %x3B (";")
79
+ // character:
80
+ // Consume the characters of the unparsed-attributes up to,
81
+ // not including, the first %x3B (";") character.
82
+ // ...
83
+ stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
84
+ }
85
+
86
+ return (document.cookie =
87
+ key + '=' + converter.write(value, key) + stringifiedAttributes)
88
+ }
89
+
90
+ function get (key) {
91
+ if (typeof document === 'undefined' || (arguments.length && !key)) {
92
+ return
93
+ }
94
+
95
+ // To prevent the for loop in the first place assign an empty array
96
+ // in case there are no cookies at all.
97
+ var cookies = document.cookie ? document.cookie.split('; ') : [];
98
+ var jar = {};
99
+ for (var i = 0; i < cookies.length; i++) {
100
+ var parts = cookies[i].split('=');
101
+ var value = parts.slice(1).join('=');
102
+
103
+ try {
104
+ var foundKey = decodeURIComponent(parts[0]);
105
+ jar[foundKey] = converter.read(value, foundKey);
106
+
107
+ if (key === foundKey) {
108
+ break
109
+ }
110
+ } catch (e) {}
111
+ }
112
+
113
+ return key ? jar[key] : jar
114
+ }
115
+
116
+ return Object.create(
117
+ {
118
+ set: set,
119
+ get: get,
120
+ remove: function (key, attributes) {
121
+ set(
122
+ key,
123
+ '',
124
+ assign({}, attributes, {
125
+ expires: -1
126
+ })
127
+ );
128
+ },
129
+ withAttributes: function (attributes) {
130
+ return init(this.converter, assign({}, this.attributes, attributes))
131
+ },
132
+ withConverter: function (converter) {
133
+ return init(assign({}, this.converter, converter), this.attributes)
134
+ }
135
+ },
136
+ {
137
+ attributes: { value: Object.freeze(defaultAttributes) },
138
+ converter: { value: Object.freeze(converter) }
139
+ }
140
+ )
141
+ }
142
+
143
+ var api = init(defaultConverter, { path: '/' });
144
+ /* eslint-enable no-var */
145
+
146
+ return api;
147
+
148
+ })));
165
149
 
166
150
  },{}],2:[function(require,module,exports){
167
151
  "use strict";
@@ -10,5 +10,14 @@ module.exports = {
10
10
  MIN_KEY_LENGTH: 1,
11
11
  MAX_KEY_LENGTH: 30,
12
12
  MAX_VALUE_LENGTH: 100
13
+ },
14
+ webhooks: {
15
+ humanReadableSubscriptions: {
16
+ /*
17
+ Keys match those defined here:
18
+ https://github.com/alphagov/pay-webhooks/blob/main/src/main/java/uk/gov/pay/webhooks/eventtype/EventTypeName.java
19
+ */
20
+ CARD_PAYMENT_CAPTURED: 'Payment captured'
21
+ }
13
22
  }
14
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@govuk-pay/pay-js-commons",
3
- "version": "3.2.0",
3
+ "version": "3.3.1",
4
4
  "description": "Reusable js scripts for GOV.UK Pay Node.js projects",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -116,8 +116,8 @@
116
116
  "eslint-plugin-promise": "^5.1.0",
117
117
  "husky": "^7.0.0",
118
118
  "jest": "^27.0.1",
119
- "js-cookie": "^2.2.1",
120
- "jsdom": "^16.0.0",
119
+ "js-cookie": "^3.0.0",
120
+ "jsdom": "^18.0.0",
121
121
  "jsdom-global": "^3.0.2",
122
122
  "karma": "^6.0.0",
123
123
  "karma-browserify": "^8.0.0",
@@ -126,11 +126,12 @@
126
126
  "karma-mocha-reporter": "^2.2.5",
127
127
  "karma-source-map-support": "^1.2.0",
128
128
  "lint-staged": "^11.0.0",
129
- "mocha": "^8.0.1",
130
- "sinon": "^11.0.0",
129
+ "mocha": "^9.1.0",
130
+ "sinon": "^12.0.0",
131
+ "standard": "^16.0.3",
131
132
  "uglify-js": "^3.6.0",
132
- "watchify": "^3.11.0",
133
- "xo": "^0.41.0"
133
+ "watchify": "^4.0.0",
134
+ "xo": "^0.46.0"
134
135
  },
135
136
  "directories": {
136
137
  "lib": "lib"
@@ -139,8 +140,7 @@
139
140
  "lodash": "4.17.21",
140
141
  "moment-timezone": "0.5.33",
141
142
  "rfc822-validate": "1.0.0",
142
- "slugify": "1.5.3",
143
- "standard": "^16.0.3",
143
+ "slugify": "1.6.2",
144
144
  "winston": "3.3.3"
145
145
  }
146
146
  }
@@ -0,0 +1,74 @@
1
+ $govuk-font-family: -apple-system,BlinkMacSystemFont,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif; // Override font as so not to use New Transport
2
+ @import "application";
3
+
4
+ // CUSTOM BRANDING
5
+ // Use the variables below to control the style
6
+ // Make sure banner colours meet minimum colour contrast levels
7
+
8
+ $custom-banner-colour: #005EB8;
9
+ $custom-banner-border-colour: #ffffff;
10
+ $custom-text-colour: #ffffff;
11
+ $logo-image-height: 2em;
12
+
13
+ .custom-branding {
14
+ @if $logo-image-height != null {
15
+ .custom-branding-image {
16
+ max-height: $logo-image-height;
17
+
18
+ @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
19
+ width: 100%;
20
+ }
21
+ }
22
+ }
23
+
24
+ .govuk-header {
25
+ background-color: $custom-banner-colour;
26
+ }
27
+
28
+ .govuk-header__link--homepage {
29
+ border: none;
30
+ }
31
+
32
+ .govuk-header__link {
33
+ &:link,
34
+ &:visited {
35
+ color: $custom-text-colour;
36
+ }
37
+ }
38
+
39
+ .govuk-header__link--service-name {
40
+ color: $custom-text-colour;
41
+ }
42
+
43
+ .govuk-header__container {
44
+ border-bottom-color: $custom-banner-border-colour;
45
+ }
46
+
47
+ @include govuk-media-query($from: 48em) {
48
+ .govuk-header__content {
49
+ width: 66%;
50
+ vertical-align: bottom;
51
+ margin-bottom: 7px;
52
+ }
53
+ .govuk-header__link--service-name {
54
+ padding-top: 15px;
55
+ float: right;
56
+ }
57
+ }
58
+
59
+ @include govuk-media-query($until: 48em) {
60
+ .govuk-header__content {
61
+ width: 99%;
62
+ text-align: center;
63
+ }
64
+ .govuk-header__link--service-name {
65
+ padding-top: 5px;
66
+ float: none;
67
+ }
68
+ }
69
+
70
+ .govuk-button {
71
+ padding: 7px 15px 6px;
72
+ padding: .368421053em .842105263em .315789474em;
73
+ }
74
+ }
@@ -0,0 +1,55 @@
1
+ $govuk-font-family: -apple-system,BlinkMacSystemFont,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif; // Override font as so not to use New Transport
2
+ @import "application";
3
+
4
+ // CUSTOM BRANDING
5
+ // Use the variables below to control the style
6
+ // Make sure banner colours meet minimum colour contrast levels
7
+
8
+ $custom-banner-colour: #238b4f;
9
+ $custom-banner-border-colour: #007046;
10
+ $custom-text-colour: #ffffff;
11
+ $logo-image-height: 2em;
12
+
13
+ .custom-branding {
14
+ @if $logo-image-height != null {
15
+ .custom-branding-image {
16
+ max-height: $logo-image-height;
17
+
18
+ @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
19
+ width: 100%;
20
+ }
21
+ }
22
+ }
23
+
24
+ .govuk-header {
25
+ background-color: $custom-banner-colour;
26
+ }
27
+
28
+ .govuk-header__link{
29
+ &:link,
30
+ &:visited {
31
+ color: $custom-text-colour;
32
+ }
33
+ }
34
+
35
+ .govuk-header__link--service-name {
36
+ color: $custom-text-colour;
37
+ }
38
+
39
+ .govuk-header__container {
40
+ border-bottom-color: $custom-banner-border-colour;
41
+ }
42
+
43
+ @include govuk-media-query($from: tablet) {
44
+ .govuk-header__content {
45
+ width: 66%;
46
+ vertical-align: bottom;
47
+ margin-bottom: 7px;
48
+ }
49
+ }
50
+
51
+ .govuk-button {
52
+ padding: 7px 15px 6px;
53
+ padding: .368421053em .842105263em .315789474em;
54
+ }
55
+ }