Skip to content

Commit 1d01c81

Browse files
committed
Release 2.4.0
1 parent 84f10f3 commit 1d01c81

File tree

6 files changed

+29
-7
lines changed

6 files changed

+29
-7
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## [v2.4.0](https://github.com/uphold/uphold-sdk-javascript/releases/tag/v2.4.0) (2020-02-21)
4+
- Add scope and otp header to storage [\#30](https://github.com/uphold/uphold-sdk-javascript/pull/30) ([asoraiamartins](https://github.com/asoraiamartins))
5+
- Update favicon and logo on `README` [\#27](https://github.com/uphold/uphold-sdk-javascript/pull/27) ([7patricia](https://github.com/7patricia))
6+
- Fixing dependency vulnerabilities [\#26](https://github.com/uphold/uphold-sdk-javascript/pull/26) ([ryanml](https://github.com/ryanml))
7+
- Update `babel-plugin-istanbul` to version 5.1.4 [\#24](https://github.com/uphold/uphold-sdk-javascript/pull/24) ([SandroMachado](https://github.com/SandroMachado))
8+
- bump lodash.merge [\#25](https://github.com/uphold/uphold-sdk-javascript/pull/25) ([evq](https://github.com/evq))
9+
- Update ESLint to version 6.0.1 [\#23](https://github.com/uphold/uphold-sdk-javascript/pull/23) ([SandroMachado](https://github.com/SandroMachado))
10+
- Bump `Request` to version 2.88.0 [\#21](https://github.com/uphold/uphold-sdk-javascript/pull/21) ([SandroMachado](https://github.com/SandroMachado))
11+
- Update travis node versions [\#22](https://github.com/uphold/uphold-sdk-javascript/pull/22) ([SandroMachado](https://github.com/SandroMachado))
12+
313
## [v2.3.0](https://github.com/uphold/uphold-sdk-javascript/releases/tag/v2.3.0) (2018-05-22)
414
- Add origin to create card transaction [\#17](https://github.com/uphold/uphold-sdk-javascript/pull/17) ([pgom](https://github.com/pgom))
515

dist/browser/uphold-sdk-javascript.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core/errors/otp-required.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ exports.OTPRequiredError = undefined;
77

88
var _base = require('./base');
99

10+
var _lodash = require('lodash');
11+
1012
class OTPRequiredError extends _base.BaseError {
1113
static hasError() {
1214
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -17,7 +19,7 @@ class OTPRequiredError extends _base.BaseError {
1719
return false;
1820
}
1921

20-
return headers['otp-token'].toUpperCase() === 'REQUIRED';
22+
return (0, _lodash.includes)(['OPTIONAL', 'REQUIRED'], headers['otp-token'].toUpperCase());
2123
}
2224

2325
constructor() {

dist/core/sdk.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ var _services = require('./services');
1616

1717
var _utils = require('./utils');
1818

19+
var _lodash = require('lodash');
20+
1921
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
2022

2123
class SDK {
@@ -36,7 +38,9 @@ class SDK {
3638
accessTokenKey: 'uphold.access_token',
3739
baseUrl: 'https://api.uphold.com',
3840
itemsPerPage: 10,
41+
otpTokenStatus: 'uphold.otp_token_status',
3942
refreshTokenKey: 'uphold.refresh_token',
43+
scope: 'uphold.scope',
4044
version: 'v0'
4145
};
4246

@@ -142,9 +146,14 @@ class SDK {
142146
}
143147

144148
setToken(token) {
149+
let headers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
150+
145151
return this.storage.setItem(this.options.accessTokenKey, token.access_token).then(() => {
152+
this.storage.setItem(this.options.scope, (0, _lodash.get)(token, 'scope', ''));
153+
this.storage.setItem(this.options.otpTokenStatus, (0, _lodash.get)(headers, 'otp-token', ''));
154+
146155
if (token.refresh_token) {
147-
return this.storage.setItem(this.options.refreshTokenKey, token.refresh_token);
156+
this.storage.setItem(this.options.refreshTokenKey, token.refresh_token);
148157
}
149158
}).then(() => token);
150159
}
@@ -155,8 +164,9 @@ class SDK {
155164
url = _ref.url;
156165

157166
return this.client.request(url, 'post', body, headers).then((_ref2) => {
158-
let body = _ref2.body;
159-
return this.setToken(body);
167+
let body = _ref2.body,
168+
headers = _ref2.headers;
169+
return this.setToken(body, headers);
160170
});
161171
}
162172

dist/core/utils/request-helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function normalizeURI(uri) {
4747

4848
function buildUrl(uri, baseUrl, version, queryParams) {
4949
// Check if the `uri` is actually an url.
50-
if (new RegExp(/^http(s?)\:\/\//).test(uri)) {
50+
if (new RegExp(/^http(s?):\/\//).test(uri)) {
5151
return uri;
5252
}
5353

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@uphold/uphold-sdk-javascript",
3-
"version": "2.3.0",
3+
"version": "2.4.0",
44
"description": "Uphold SDK for JavasScript",
55
"keywords": [
66
"api",

0 commit comments

Comments
 (0)