wealthica-sdk-js 0.0.14 → 0.0.16
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/README.md +6 -5
- package/dist/wealthica.es5.js +23 -7
- package/dist/wealthica.js +23 -7
- package/dist/wealthica.min.js +1 -1
- package/dist/wealthica.min.js.map +1 -1
- package/lib/wealthica.js +23 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -218,7 +218,6 @@ const wealthica = Wealthica.init({
|
|
|
218
218
|
clientId: 'YOUR_CLIENT_ID',
|
|
219
219
|
secret: 'YOUR_CLIENT_SECRET',
|
|
220
220
|
redirectURI: 'YOUR_REDIRECT_URI',
|
|
221
|
-
origin: 'YOUR_SITE_ORIGIN',
|
|
222
221
|
});
|
|
223
222
|
|
|
224
223
|
const user1 = wealthica.login('USER_ID_1');
|
|
@@ -228,18 +227,19 @@ const user2 = wealthica.login('USER_ID_2');
|
|
|
228
227
|
const { url: url2, token } = await user2.getConnectData();
|
|
229
228
|
```
|
|
230
229
|
|
|
231
|
-
#### user.connect({ provider, providers, institutionId, lang, theme, providersPerLine, features })
|
|
230
|
+
#### user.connect({ provider, providers, institutionId, lang, theme, providersPerLine, features, origin })
|
|
232
231
|
|
|
233
232
|
This method starts the Wealthica Connect process inside your webpage/app for user to connect their institution.
|
|
234
233
|
|
|
235
234
|
Connection response are provided via callbacks.
|
|
236
235
|
|
|
237
|
-
This method accepts the same parameters as `user.getConnectData()` except for `redirectURI
|
|
236
|
+
This method accepts the same parameters as `user.getConnectData()` except for `redirectURI` and `state`
|
|
238
237
|
|
|
239
238
|
```javascript
|
|
240
239
|
user.connect({
|
|
241
240
|
// additional options
|
|
242
|
-
}).onConnection(institution => {
|
|
241
|
+
}).onConnection((institution, data) => {
|
|
242
|
+
console.log('provider', data.provider);
|
|
243
243
|
// Send the institution to your server
|
|
244
244
|
sendToServer('/some-route', institution);
|
|
245
245
|
}).onError(error => {
|
|
@@ -258,7 +258,8 @@ Connection response are provided via callbacks.
|
|
|
258
258
|
```javascript
|
|
259
259
|
user.reconnect('INSTITUTION_ID', {
|
|
260
260
|
// additional options
|
|
261
|
-
}).onConnection(institution => {
|
|
261
|
+
}).onConnection(((institution, data) => {
|
|
262
|
+
console.log('provider', data.provider);
|
|
262
263
|
// Send the institution to your server
|
|
263
264
|
sendToServer('/some-route', institution);
|
|
264
265
|
}).onError(error => {
|
package/dist/wealthica.es5.js
CHANGED
|
@@ -6313,14 +6313,14 @@ var API = /*#__PURE__*/function () {
|
|
|
6313
6313
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6314
6314
|
if (!this.isBrowser) throw new Error('Only supported in Browser.');
|
|
6315
6315
|
_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
|
|
6316
|
-
var provider, providers, providerGroups, institutionId, lang, theme, providersPerLine, features, connectionType, _yield$_this$getConne, url, token;
|
|
6316
|
+
var provider, providers, providerGroups, institutionId, lang, theme, providersPerLine, features, connectionType, origin, _yield$_this$getConne, url, token;
|
|
6317
6317
|
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
6318
6318
|
while (1) {
|
|
6319
6319
|
switch (_context5.prev = _context5.next) {
|
|
6320
6320
|
case 0:
|
|
6321
6321
|
_context5.prev = 0;
|
|
6322
6322
|
_this._widgetOpened = true;
|
|
6323
|
-
provider = options.provider, providers = options.providers, providerGroups = options.providerGroups, institutionId = options.institutionId, lang = options.lang, theme = options.theme, providersPerLine = options.providersPerLine, features = options.features, connectionType = options.connectionType;
|
|
6323
|
+
provider = options.provider, providers = options.providers, providerGroups = options.providerGroups, institutionId = options.institutionId, lang = options.lang, theme = options.theme, providersPerLine = options.providersPerLine, features = options.features, connectionType = options.connectionType, origin = options.origin;
|
|
6324
6324
|
_context5.next = 5;
|
|
6325
6325
|
return _this.getConnectData({
|
|
6326
6326
|
provider: provider,
|
|
@@ -6330,7 +6330,8 @@ var API = /*#__PURE__*/function () {
|
|
|
6330
6330
|
lang: lang,
|
|
6331
6331
|
theme: theme,
|
|
6332
6332
|
providersPerLine: providersPerLine,
|
|
6333
|
-
features: features
|
|
6333
|
+
features: features,
|
|
6334
|
+
origin: origin
|
|
6334
6335
|
});
|
|
6335
6336
|
case 5:
|
|
6336
6337
|
_yield$_this$getConne = _context5.sent;
|
|
@@ -6390,13 +6391,18 @@ var API = /*#__PURE__*/function () {
|
|
|
6390
6391
|
case 'success':
|
|
6391
6392
|
{
|
|
6392
6393
|
// Connection success
|
|
6393
|
-
this._triggerCallback(CALLBACK_CONNECTION,
|
|
6394
|
+
this._triggerCallback(CALLBACK_CONNECTION, {
|
|
6395
|
+
institution: result.institution,
|
|
6396
|
+
provider: result.provider
|
|
6397
|
+
});
|
|
6394
6398
|
break;
|
|
6395
6399
|
}
|
|
6396
6400
|
case 'error':
|
|
6397
6401
|
{
|
|
6398
6402
|
// Connection error
|
|
6399
|
-
this._triggerCallback(CALLBACK_ERROR,
|
|
6403
|
+
this._triggerCallback(CALLBACK_ERROR, {
|
|
6404
|
+
error: result.error
|
|
6405
|
+
});
|
|
6400
6406
|
break;
|
|
6401
6407
|
}
|
|
6402
6408
|
case 'close':
|
|
@@ -6469,11 +6475,21 @@ var API = /*#__PURE__*/function () {
|
|
|
6469
6475
|
var payload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6470
6476
|
// onConnection and onError callbacks are only triggered once per widget session.
|
|
6471
6477
|
if ([CALLBACK_CONNECTION, CALLBACK_ERROR].includes(callback)) {
|
|
6472
|
-
// Mark widget as inactive so it's cleaned up by the doneWatcher.
|
|
6478
|
+
// Mark widget as inactive, so it's cleaned up by the doneWatcher.
|
|
6473
6479
|
this._widgetActive = false;
|
|
6480
|
+
var additionalData = null;
|
|
6474
6481
|
if (this._widgetOpened) {
|
|
6475
6482
|
this._widgetOpened = false;
|
|
6476
|
-
if (
|
|
6483
|
+
if (callback === CALLBACK_CONNECTION) {
|
|
6484
|
+
additionalData = {
|
|
6485
|
+
// Institution type passed only on success,
|
|
6486
|
+
// on error it appears in error object, so we don't need to duplicate it
|
|
6487
|
+
provider: payload.provider
|
|
6488
|
+
};
|
|
6489
|
+
}
|
|
6490
|
+
if (this[callback]) {
|
|
6491
|
+
this[callback](payload.institution || payload.error, additionalData);
|
|
6492
|
+
}
|
|
6477
6493
|
}
|
|
6478
6494
|
return;
|
|
6479
6495
|
}
|
package/dist/wealthica.js
CHANGED
|
@@ -6303,14 +6303,14 @@ var API = /*#__PURE__*/function () {
|
|
|
6303
6303
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6304
6304
|
if (!this.isBrowser) throw new Error('Only supported in Browser.');
|
|
6305
6305
|
_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
|
|
6306
|
-
var provider, providers, providerGroups, institutionId, lang, theme, providersPerLine, features, connectionType, _yield$_this$getConne, url, token;
|
|
6306
|
+
var provider, providers, providerGroups, institutionId, lang, theme, providersPerLine, features, connectionType, origin, _yield$_this$getConne, url, token;
|
|
6307
6307
|
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
6308
6308
|
while (1) {
|
|
6309
6309
|
switch (_context5.prev = _context5.next) {
|
|
6310
6310
|
case 0:
|
|
6311
6311
|
_context5.prev = 0;
|
|
6312
6312
|
_this._widgetOpened = true;
|
|
6313
|
-
provider = options.provider, providers = options.providers, providerGroups = options.providerGroups, institutionId = options.institutionId, lang = options.lang, theme = options.theme, providersPerLine = options.providersPerLine, features = options.features, connectionType = options.connectionType;
|
|
6313
|
+
provider = options.provider, providers = options.providers, providerGroups = options.providerGroups, institutionId = options.institutionId, lang = options.lang, theme = options.theme, providersPerLine = options.providersPerLine, features = options.features, connectionType = options.connectionType, origin = options.origin;
|
|
6314
6314
|
_context5.next = 5;
|
|
6315
6315
|
return _this.getConnectData({
|
|
6316
6316
|
provider: provider,
|
|
@@ -6320,7 +6320,8 @@ var API = /*#__PURE__*/function () {
|
|
|
6320
6320
|
lang: lang,
|
|
6321
6321
|
theme: theme,
|
|
6322
6322
|
providersPerLine: providersPerLine,
|
|
6323
|
-
features: features
|
|
6323
|
+
features: features,
|
|
6324
|
+
origin: origin
|
|
6324
6325
|
});
|
|
6325
6326
|
case 5:
|
|
6326
6327
|
_yield$_this$getConne = _context5.sent;
|
|
@@ -6380,13 +6381,18 @@ var API = /*#__PURE__*/function () {
|
|
|
6380
6381
|
case 'success':
|
|
6381
6382
|
{
|
|
6382
6383
|
// Connection success
|
|
6383
|
-
this._triggerCallback(CALLBACK_CONNECTION,
|
|
6384
|
+
this._triggerCallback(CALLBACK_CONNECTION, {
|
|
6385
|
+
institution: result.institution,
|
|
6386
|
+
provider: result.provider
|
|
6387
|
+
});
|
|
6384
6388
|
break;
|
|
6385
6389
|
}
|
|
6386
6390
|
case 'error':
|
|
6387
6391
|
{
|
|
6388
6392
|
// Connection error
|
|
6389
|
-
this._triggerCallback(CALLBACK_ERROR,
|
|
6393
|
+
this._triggerCallback(CALLBACK_ERROR, {
|
|
6394
|
+
error: result.error
|
|
6395
|
+
});
|
|
6390
6396
|
break;
|
|
6391
6397
|
}
|
|
6392
6398
|
case 'close':
|
|
@@ -6459,11 +6465,21 @@ var API = /*#__PURE__*/function () {
|
|
|
6459
6465
|
var payload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6460
6466
|
// onConnection and onError callbacks are only triggered once per widget session.
|
|
6461
6467
|
if ([CALLBACK_CONNECTION, CALLBACK_ERROR].includes(callback)) {
|
|
6462
|
-
// Mark widget as inactive so it's cleaned up by the doneWatcher.
|
|
6468
|
+
// Mark widget as inactive, so it's cleaned up by the doneWatcher.
|
|
6463
6469
|
this._widgetActive = false;
|
|
6470
|
+
var additionalData = null;
|
|
6464
6471
|
if (this._widgetOpened) {
|
|
6465
6472
|
this._widgetOpened = false;
|
|
6466
|
-
if (
|
|
6473
|
+
if (callback === CALLBACK_CONNECTION) {
|
|
6474
|
+
additionalData = {
|
|
6475
|
+
// Institution type passed only on success,
|
|
6476
|
+
// on error it appears in error object, so we don't need to duplicate it
|
|
6477
|
+
provider: payload.provider
|
|
6478
|
+
};
|
|
6479
|
+
}
|
|
6480
|
+
if (this[callback]) {
|
|
6481
|
+
this[callback](payload.institution || payload.error, additionalData);
|
|
6482
|
+
}
|
|
6467
6483
|
}
|
|
6468
6484
|
return;
|
|
6469
6485
|
}
|