wealthica-sdk-js 0.0.6 → 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 CHANGED
@@ -4,9 +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
9
+
7
10
  ## v0.0.6
8
11
  - React Native Example
9
12
 
10
-
11
- [Unreleased]: https://github.com/wealthica/wealthica-sdk-js/compare/v0.0.6...HEAD
12
- [Unreleased]: https://github.com/wealthica/wealthica-sdk-js/compare/v0.0.6...v0.0.5
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().onConnection(institution => {
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').onConnection(institution => {
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,10 +432,22 @@ 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
434
450
  git push && git push --tags
435
451
  # wait until merged then
436
-
452
+ npm publish
437
453
  ```
@@ -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
- _this.widget = window.open('', _this.iframe.name);
6336
- _this.form = appendWealthicaForm({
6337
- url: url,
6338
- token: token,
6339
- iframe: _this.iframe
6340
- });
6341
- _this.form.submit();
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 = 21;
6353
+ _context5.next = 19;
6347
6354
  break;
6348
- case 18:
6349
- _context5.prev = 18;
6355
+ case 16:
6356
+ _context5.prev = 16;
6350
6357
  _context5.t0 = _context5["catch"](0);
6351
6358
  _this._closeWidgetWithError(500, 'Connection refused');
6352
- case 21:
6359
+ case 19:
6353
6360
  case "end":
6354
6361
  return _context5.stop();
6355
6362
  }
6356
6363
  }
6357
- }, _callee5, null, [[0, 18]]);
6364
+ }, _callee5, null, [[0, 16]]);
6358
6365
  }))();
6359
6366
  }
6360
6367
  }, {
package/dist/wealthica.js CHANGED
@@ -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
- _this.widget = window.open('', _this.iframe.name);
6326
- _this.form = appendWealthicaForm({
6327
- url: url,
6328
- token: token,
6329
- iframe: _this.iframe
6330
- });
6331
- _this.form.submit();
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 = 21;
6343
+ _context5.next = 19;
6337
6344
  break;
6338
- case 18:
6339
- _context5.prev = 18;
6345
+ case 16:
6346
+ _context5.prev = 16;
6340
6347
  _context5.t0 = _context5["catch"](0);
6341
6348
  _this._closeWidgetWithError(500, 'Connection refused');
6342
- case 21:
6349
+ case 19:
6343
6350
  case "end":
6344
6351
  return _context5.stop();
6345
6352
  }
6346
6353
  }
6347
- }, _callee5, null, [[0, 18]]);
6354
+ }, _callee5, null, [[0, 16]]);
6348
6355
  }))();
6349
6356
  }
6350
6357
  }, {