wealthica-sdk-js 0.0.5 → 0.0.7
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/CHANGELOG.md +8 -1
- package/README.md +18 -2
- package/dist/wealthica.d.ts +5 -4
- package/dist/wealthica.es5.d.ts +5 -4
- package/dist/wealthica.es5.js +26 -19
- package/dist/wealthica.js +26 -19
- package/dist/wealthica.min.d.ts +5 -4
- package/dist/wealthica.min.js +6 -6
- package/dist/wealthica.min.js.map +1 -1
- package/lib/wealthica.d.ts +5 -4
- package/lib/wealthica.js +26 -19
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,5 +4,12 @@ All notable changes to the Wealthica Connect SDK across versions will be documen
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.0.7]
|
|
8
|
+
- Add support of connectionType: 'GET' for connect and reconnect methods for local development
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
## v0.0.6
|
|
11
|
+
- React Native Example
|
|
12
|
+
|
|
13
|
+
[Unreleased]: https://github.com/wealthica/wealthica-sdk-js/compare/v0.0.7...HEAD
|
|
14
|
+
[0.0.7]: https://github.com/wealthica/wealthica-sdk-js/compare/v0.0.7...v0.0.6
|
|
15
|
+
[0.0.6]: https://github.com/wealthica/wealthica-sdk-js/compare/v0.0.6...v0.0.5
|
package/README.md
CHANGED
|
@@ -236,7 +236,9 @@ Connection response are provided via callbacks.
|
|
|
236
236
|
This method accepts the same parameters as `user.getConnectData()` except for `redirectURI`, `origin` and `state`
|
|
237
237
|
|
|
238
238
|
```javascript
|
|
239
|
-
user.connect(
|
|
239
|
+
user.connect({
|
|
240
|
+
// additional options
|
|
241
|
+
}).onConnection(institution => {
|
|
240
242
|
// Send the institution to your server
|
|
241
243
|
sendToServer('/some-route', institution);
|
|
242
244
|
}).onError(error => {
|
|
@@ -253,7 +255,9 @@ This method starts the Wealthica Connect process to re-connect an existing insti
|
|
|
253
255
|
Connection response are provided via callbacks.
|
|
254
256
|
|
|
255
257
|
```javascript
|
|
256
|
-
user.reconnect('INSTITUTION_ID'
|
|
258
|
+
user.reconnect('INSTITUTION_ID', {
|
|
259
|
+
// additional options
|
|
260
|
+
}).onConnection(institution => {
|
|
257
261
|
// Send the institution to your server
|
|
258
262
|
sendToServer('/some-route', institution);
|
|
259
263
|
}).onError(error => {
|
|
@@ -428,6 +432,18 @@ yarn build
|
|
|
428
432
|
yarn test
|
|
429
433
|
```
|
|
430
434
|
|
|
435
|
+
### Use GET method in Connect URL instead of POST
|
|
436
|
+
|
|
437
|
+
Pass additional flag `connectionType: 'GET'` to use GET method in Connect URL instead of POST:
|
|
438
|
+
|
|
439
|
+
```
|
|
440
|
+
connect({ connectionType: 'GET' })
|
|
441
|
+
reconnect(accountId, { connectionType: 'GET' })
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
That's useful for developing Connect URL when vite local server used.
|
|
445
|
+
Token exposed in URL when GET method used what is not secure so this feature should be used only for development goals.
|
|
446
|
+
|
|
431
447
|
### Release
|
|
432
448
|
```
|
|
433
449
|
npm version patch # or minor/major
|
package/dist/wealthica.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ declare var Wealthica: {
|
|
|
9
9
|
interface APIInterface {
|
|
10
10
|
constructor(config: APIConfig)
|
|
11
11
|
__init(): APIInterface
|
|
12
|
-
login(loginName
|
|
12
|
+
login(loginName?: string): APIUserInterface
|
|
13
13
|
getToken(options: TokenOptions): Promise<string>
|
|
14
14
|
fetchToken(): Promise<string>
|
|
15
15
|
authApi: ApisauceInstance
|
|
@@ -64,16 +64,17 @@ interface TransactionsInterface {
|
|
|
64
64
|
|
|
65
65
|
type APIConfig = {
|
|
66
66
|
clientId: string;
|
|
67
|
-
secret
|
|
67
|
+
secret?: string;
|
|
68
68
|
baseURL?: string;
|
|
69
69
|
connectURL?: string;
|
|
70
70
|
redirectURI?: string;
|
|
71
71
|
loginName?: string | null;
|
|
72
|
-
authEndpoint?: string
|
|
72
|
+
authEndpoint?: string;
|
|
73
73
|
auth?: {
|
|
74
74
|
headers?: object;
|
|
75
75
|
params?: object;
|
|
76
|
-
}
|
|
76
|
+
},
|
|
77
|
+
authorizer?(callback: Function): void | Promise<void>;
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
type TokenOptions = {
|
package/dist/wealthica.es5.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ declare var Wealthica: {
|
|
|
9
9
|
interface APIInterface {
|
|
10
10
|
constructor(config: APIConfig)
|
|
11
11
|
__init(): APIInterface
|
|
12
|
-
login(loginName
|
|
12
|
+
login(loginName?: string): APIUserInterface
|
|
13
13
|
getToken(options: TokenOptions): Promise<string>
|
|
14
14
|
fetchToken(): Promise<string>
|
|
15
15
|
authApi: ApisauceInstance
|
|
@@ -64,16 +64,17 @@ interface TransactionsInterface {
|
|
|
64
64
|
|
|
65
65
|
type APIConfig = {
|
|
66
66
|
clientId: string;
|
|
67
|
-
secret
|
|
67
|
+
secret?: string;
|
|
68
68
|
baseURL?: string;
|
|
69
69
|
connectURL?: string;
|
|
70
70
|
redirectURI?: string;
|
|
71
71
|
loginName?: string | null;
|
|
72
|
-
authEndpoint?: string
|
|
72
|
+
authEndpoint?: string;
|
|
73
73
|
auth?: {
|
|
74
74
|
headers?: object;
|
|
75
75
|
params?: object;
|
|
76
|
-
}
|
|
76
|
+
},
|
|
77
|
+
authorizer?(callback: Function): void | Promise<void>;
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
type TokenOptions = {
|
package/dist/wealthica.es5.js
CHANGED
|
@@ -5982,10 +5982,10 @@ var API = /*#__PURE__*/function () {
|
|
|
5982
5982
|
if (!clientId || typeof clientId !== 'string') {
|
|
5983
5983
|
throw new Error('Please provide a valid Wealthica clientId.');
|
|
5984
5984
|
}
|
|
5985
|
-
if (this.
|
|
5985
|
+
if (!this.isClient && (!secret || typeof secret !== 'string')) {
|
|
5986
5986
|
throw new Error('Please provide a valid Wealthica secret.');
|
|
5987
5987
|
}
|
|
5988
|
-
if (this.
|
|
5988
|
+
if (this.isClient) {
|
|
5989
5989
|
var auth = config.auth || {};
|
|
5990
5990
|
this.config.authEndpoint = this.config.authEndpoint || '/wealthica/auth';
|
|
5991
5991
|
this.config.auth = {
|
|
@@ -6020,7 +6020,7 @@ var API = /*#__PURE__*/function () {
|
|
|
6020
6020
|
}, {
|
|
6021
6021
|
key: "login",
|
|
6022
6022
|
value: function login(loginName) {
|
|
6023
|
-
if (this.
|
|
6023
|
+
if (!this.isClient && (!loginName || typeof loginName !== 'string')) {
|
|
6024
6024
|
throw new Error('Please provide a valid loginName.');
|
|
6025
6025
|
}
|
|
6026
6026
|
var baseURL = this.config.baseURL;
|
|
@@ -6273,12 +6273,13 @@ var API = /*#__PURE__*/function () {
|
|
|
6273
6273
|
}, {
|
|
6274
6274
|
key: "reconnect",
|
|
6275
6275
|
value: function reconnect(institutionId) {
|
|
6276
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6276
6277
|
if (!institutionId || typeof institutionId !== 'string') {
|
|
6277
6278
|
throw new Error('Please provide a valid institutionId.');
|
|
6278
6279
|
}
|
|
6279
|
-
this._connect({
|
|
6280
|
+
this._connect(_objectSpread({
|
|
6280
6281
|
institutionId: institutionId
|
|
6281
|
-
});
|
|
6282
|
+
}, options));
|
|
6282
6283
|
return this; // return the instance so we can chain the callbacks
|
|
6283
6284
|
}
|
|
6284
6285
|
}, {
|
|
@@ -6309,14 +6310,14 @@ var API = /*#__PURE__*/function () {
|
|
|
6309
6310
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6310
6311
|
if (!this.isBrowser) throw new Error('Only supported in Browser.');
|
|
6311
6312
|
_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
|
|
6312
|
-
var provider, providers, institutionId, lang, theme, providersPerLine, features, _yield$_this$getConne, url, token;
|
|
6313
|
+
var provider, providers, institutionId, lang, theme, providersPerLine, features, connectionType, _yield$_this$getConne, url, token;
|
|
6313
6314
|
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
6314
6315
|
while (1) {
|
|
6315
6316
|
switch (_context5.prev = _context5.next) {
|
|
6316
6317
|
case 0:
|
|
6317
6318
|
_context5.prev = 0;
|
|
6318
6319
|
_this._widgetOpened = true;
|
|
6319
|
-
provider = options.provider, providers = options.providers, institutionId = options.institutionId, lang = options.lang, theme = options.theme, providersPerLine = options.providersPerLine, features = options.features;
|
|
6320
|
+
provider = options.provider, providers = options.providers, institutionId = options.institutionId, lang = options.lang, theme = options.theme, providersPerLine = options.providersPerLine, features = options.features, connectionType = options.connectionType;
|
|
6320
6321
|
_context5.next = 5;
|
|
6321
6322
|
return _this.getConnectData({
|
|
6322
6323
|
provider: provider,
|
|
@@ -6332,29 +6333,35 @@ var API = /*#__PURE__*/function () {
|
|
|
6332
6333
|
url = _yield$_this$getConne.url;
|
|
6333
6334
|
token = _yield$_this$getConne.token;
|
|
6334
6335
|
_this.iframe = appendWealthicaIframe();
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6336
|
+
|
|
6337
|
+
// GET is only for dev because it's not secure
|
|
6338
|
+
if (connectionType === 'GET') {
|
|
6339
|
+
_this.widget = window.open("".concat(url, "&token=").concat(token), _this.iframe.name);
|
|
6340
|
+
} else {
|
|
6341
|
+
_this.widget = window.open('', _this.iframe.name);
|
|
6342
|
+
_this.form = appendWealthicaForm({
|
|
6343
|
+
url: url,
|
|
6344
|
+
token: token,
|
|
6345
|
+
iframe: _this.iframe
|
|
6346
|
+
});
|
|
6347
|
+
_this.form.submit();
|
|
6348
|
+
}
|
|
6342
6349
|
_this.widget.focus();
|
|
6343
6350
|
_this._widgetActive = true;
|
|
6344
6351
|
_this._addListeners();
|
|
6345
6352
|
_this._addWatchers();
|
|
6346
|
-
_context5.next =
|
|
6353
|
+
_context5.next = 19;
|
|
6347
6354
|
break;
|
|
6348
|
-
case
|
|
6349
|
-
_context5.prev =
|
|
6355
|
+
case 16:
|
|
6356
|
+
_context5.prev = 16;
|
|
6350
6357
|
_context5.t0 = _context5["catch"](0);
|
|
6351
6358
|
_this._closeWidgetWithError(500, 'Connection refused');
|
|
6352
|
-
case
|
|
6359
|
+
case 19:
|
|
6353
6360
|
case "end":
|
|
6354
6361
|
return _context5.stop();
|
|
6355
6362
|
}
|
|
6356
6363
|
}
|
|
6357
|
-
}, _callee5, null, [[0,
|
|
6364
|
+
}, _callee5, null, [[0, 16]]);
|
|
6358
6365
|
}))();
|
|
6359
6366
|
}
|
|
6360
6367
|
}, {
|
package/dist/wealthica.js
CHANGED
|
@@ -5972,10 +5972,10 @@ var API = /*#__PURE__*/function () {
|
|
|
5972
5972
|
if (!clientId || typeof clientId !== 'string') {
|
|
5973
5973
|
throw new Error('Please provide a valid Wealthica clientId.');
|
|
5974
5974
|
}
|
|
5975
|
-
if (this.
|
|
5975
|
+
if (!this.isClient && (!secret || typeof secret !== 'string')) {
|
|
5976
5976
|
throw new Error('Please provide a valid Wealthica secret.');
|
|
5977
5977
|
}
|
|
5978
|
-
if (this.
|
|
5978
|
+
if (this.isClient) {
|
|
5979
5979
|
var auth = config.auth || {};
|
|
5980
5980
|
this.config.authEndpoint = this.config.authEndpoint || '/wealthica/auth';
|
|
5981
5981
|
this.config.auth = {
|
|
@@ -6010,7 +6010,7 @@ var API = /*#__PURE__*/function () {
|
|
|
6010
6010
|
}, {
|
|
6011
6011
|
key: "login",
|
|
6012
6012
|
value: function login(loginName) {
|
|
6013
|
-
if (this.
|
|
6013
|
+
if (!this.isClient && (!loginName || typeof loginName !== 'string')) {
|
|
6014
6014
|
throw new Error('Please provide a valid loginName.');
|
|
6015
6015
|
}
|
|
6016
6016
|
var baseURL = this.config.baseURL;
|
|
@@ -6263,12 +6263,13 @@ var API = /*#__PURE__*/function () {
|
|
|
6263
6263
|
}, {
|
|
6264
6264
|
key: "reconnect",
|
|
6265
6265
|
value: function reconnect(institutionId) {
|
|
6266
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6266
6267
|
if (!institutionId || typeof institutionId !== 'string') {
|
|
6267
6268
|
throw new Error('Please provide a valid institutionId.');
|
|
6268
6269
|
}
|
|
6269
|
-
this._connect({
|
|
6270
|
+
this._connect(_objectSpread({
|
|
6270
6271
|
institutionId: institutionId
|
|
6271
|
-
});
|
|
6272
|
+
}, options));
|
|
6272
6273
|
return this; // return the instance so we can chain the callbacks
|
|
6273
6274
|
}
|
|
6274
6275
|
}, {
|
|
@@ -6299,14 +6300,14 @@ var API = /*#__PURE__*/function () {
|
|
|
6299
6300
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6300
6301
|
if (!this.isBrowser) throw new Error('Only supported in Browser.');
|
|
6301
6302
|
_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
|
|
6302
|
-
var provider, providers, institutionId, lang, theme, providersPerLine, features, _yield$_this$getConne, url, token;
|
|
6303
|
+
var provider, providers, institutionId, lang, theme, providersPerLine, features, connectionType, _yield$_this$getConne, url, token;
|
|
6303
6304
|
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
6304
6305
|
while (1) {
|
|
6305
6306
|
switch (_context5.prev = _context5.next) {
|
|
6306
6307
|
case 0:
|
|
6307
6308
|
_context5.prev = 0;
|
|
6308
6309
|
_this._widgetOpened = true;
|
|
6309
|
-
provider = options.provider, providers = options.providers, institutionId = options.institutionId, lang = options.lang, theme = options.theme, providersPerLine = options.providersPerLine, features = options.features;
|
|
6310
|
+
provider = options.provider, providers = options.providers, institutionId = options.institutionId, lang = options.lang, theme = options.theme, providersPerLine = options.providersPerLine, features = options.features, connectionType = options.connectionType;
|
|
6310
6311
|
_context5.next = 5;
|
|
6311
6312
|
return _this.getConnectData({
|
|
6312
6313
|
provider: provider,
|
|
@@ -6322,29 +6323,35 @@ var API = /*#__PURE__*/function () {
|
|
|
6322
6323
|
url = _yield$_this$getConne.url;
|
|
6323
6324
|
token = _yield$_this$getConne.token;
|
|
6324
6325
|
_this.iframe = appendWealthicaIframe();
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6326
|
+
|
|
6327
|
+
// GET is only for dev because it's not secure
|
|
6328
|
+
if (connectionType === 'GET') {
|
|
6329
|
+
_this.widget = window.open("".concat(url, "&token=").concat(token), _this.iframe.name);
|
|
6330
|
+
} else {
|
|
6331
|
+
_this.widget = window.open('', _this.iframe.name);
|
|
6332
|
+
_this.form = appendWealthicaForm({
|
|
6333
|
+
url: url,
|
|
6334
|
+
token: token,
|
|
6335
|
+
iframe: _this.iframe
|
|
6336
|
+
});
|
|
6337
|
+
_this.form.submit();
|
|
6338
|
+
}
|
|
6332
6339
|
_this.widget.focus();
|
|
6333
6340
|
_this._widgetActive = true;
|
|
6334
6341
|
_this._addListeners();
|
|
6335
6342
|
_this._addWatchers();
|
|
6336
|
-
_context5.next =
|
|
6343
|
+
_context5.next = 19;
|
|
6337
6344
|
break;
|
|
6338
|
-
case
|
|
6339
|
-
_context5.prev =
|
|
6345
|
+
case 16:
|
|
6346
|
+
_context5.prev = 16;
|
|
6340
6347
|
_context5.t0 = _context5["catch"](0);
|
|
6341
6348
|
_this._closeWidgetWithError(500, 'Connection refused');
|
|
6342
|
-
case
|
|
6349
|
+
case 19:
|
|
6343
6350
|
case "end":
|
|
6344
6351
|
return _context5.stop();
|
|
6345
6352
|
}
|
|
6346
6353
|
}
|
|
6347
|
-
}, _callee5, null, [[0,
|
|
6354
|
+
}, _callee5, null, [[0, 16]]);
|
|
6348
6355
|
}))();
|
|
6349
6356
|
}
|
|
6350
6357
|
}, {
|
package/dist/wealthica.min.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ declare var Wealthica: {
|
|
|
9
9
|
interface APIInterface {
|
|
10
10
|
constructor(config: APIConfig)
|
|
11
11
|
__init(): APIInterface
|
|
12
|
-
login(loginName
|
|
12
|
+
login(loginName?: string): APIUserInterface
|
|
13
13
|
getToken(options: TokenOptions): Promise<string>
|
|
14
14
|
fetchToken(): Promise<string>
|
|
15
15
|
authApi: ApisauceInstance
|
|
@@ -64,16 +64,17 @@ interface TransactionsInterface {
|
|
|
64
64
|
|
|
65
65
|
type APIConfig = {
|
|
66
66
|
clientId: string;
|
|
67
|
-
secret
|
|
67
|
+
secret?: string;
|
|
68
68
|
baseURL?: string;
|
|
69
69
|
connectURL?: string;
|
|
70
70
|
redirectURI?: string;
|
|
71
71
|
loginName?: string | null;
|
|
72
|
-
authEndpoint?: string
|
|
72
|
+
authEndpoint?: string;
|
|
73
73
|
auth?: {
|
|
74
74
|
headers?: object;
|
|
75
75
|
params?: object;
|
|
76
|
-
}
|
|
76
|
+
},
|
|
77
|
+
authorizer?(callback: Function): void | Promise<void>;
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
type TokenOptions = {
|