oro-sdk 3.16.0 → 3.19.0

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.
@@ -435,7 +435,7 @@ function _asyncToGenerator(fn) {
435
435
  }
436
436
 
437
437
  function _extends() {
438
- _extends = Object.assign || function (target) {
438
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
439
439
  for (var i = 1; i < arguments.length; i++) {
440
440
  var source = arguments[i];
441
441
 
@@ -448,7 +448,6 @@ function _extends() {
448
448
 
449
449
  return target;
450
450
  };
451
-
452
451
  return _extends.apply(this, arguments);
453
452
  }
454
453
 
@@ -478,18 +477,17 @@ function _inheritsLoose(subClass, superClass) {
478
477
  }
479
478
 
480
479
  function _getPrototypeOf(o) {
481
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
480
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
482
481
  return o.__proto__ || Object.getPrototypeOf(o);
483
482
  };
484
483
  return _getPrototypeOf(o);
485
484
  }
486
485
 
487
486
  function _setPrototypeOf(o, p) {
488
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
487
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
489
488
  o.__proto__ = p;
490
489
  return o;
491
490
  };
492
-
493
491
  return _setPrototypeOf(o, p);
494
492
  }
495
493
 
@@ -508,7 +506,7 @@ function _isNativeReflectConstruct() {
508
506
 
509
507
  function _construct(Parent, args, Class) {
510
508
  if (_isNativeReflectConstruct()) {
511
- _construct = Reflect.construct;
509
+ _construct = Reflect.construct.bind();
512
510
  } else {
513
511
  _construct = function _construct(Parent, args, Class) {
514
512
  var a = [null];
@@ -623,7 +621,7 @@ var personalMetaToPrefix = (_personalMetaToPrefix = {}, _personalMetaToPrefix[Me
623
621
  */
624
622
 
625
623
  function identificationToPersonalInformations(data, category) {
626
- var _data$;
624
+ var _data;
627
625
 
628
626
  var prefix = personalMetaToPrefix[category];
629
627
  return {
@@ -633,7 +631,7 @@ function identificationToPersonalInformations(data, category) {
633
631
  name: data[prefix + "Name"],
634
632
  phone: data[prefix + "Phone"],
635
633
  zip: data[prefix + "Zip"],
636
- hid: (_data$ = data[prefix + "HID"]) != null ? _data$ : data[prefix + "ID"],
634
+ hid: (_data = data[prefix + "HID"]) != null ? _data : data[prefix + "ID"],
637
635
  pharmacy: data[prefix + "Pharmacy"],
638
636
  address: data[prefix + "Address"]
639
637
  };
@@ -1621,7 +1619,7 @@ function getOrCreatePatientLockbox(_x10) {
1621
1619
 
1622
1620
  function _getOrCreatePatientLockbox() {
1623
1621
  _getOrCreatePatientLockbox = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(oroClient) {
1624
- var grants;
1622
+ var grants, lockboxResponse, tokens;
1625
1623
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1626
1624
  while (1) {
1627
1625
  switch (_context6.prev = _context6.next) {
@@ -1648,9 +1646,26 @@ function _getOrCreatePatientLockbox() {
1648
1646
  });
1649
1647
 
1650
1648
  case 10:
1651
- return _context6.abrupt("return", _context6.sent.lockboxUuid);
1649
+ lockboxResponse = _context6.sent;
1650
+ _context6.next = 13;
1651
+ return oroClient.guardClient.authRefresh();
1652
1652
 
1653
- case 11:
1653
+ case 13:
1654
+ tokens = _context6.sent;
1655
+ _context6.next = 16;
1656
+ return oroClient.guardClient.setTokens({
1657
+ accessToken: tokens.accessToken,
1658
+ refreshToken: tokens.refreshToken
1659
+ });
1660
+
1661
+ case 16:
1662
+ _context6.next = 18;
1663
+ return oroClient.guardClient.whoAmI(true);
1664
+
1665
+ case 18:
1666
+ return _context6.abrupt("return", lockboxResponse.lockboxUuid);
1667
+
1668
+ case 19:
1654
1669
  case "end":
1655
1670
  return _context6.stop();
1656
1671
  }
@@ -3239,54 +3254,62 @@ var OroClient = /*#__PURE__*/function () {
3239
3254
  case 7:
3240
3255
  currentAccountRole = _context20.sent;
3241
3256
 
3257
+ if (!(currentAccountRole.length === 1 && currentAccountRole[0] === OtherRoleType.User)) {
3258
+ _context20.next = 10;
3259
+ break;
3260
+ }
3261
+
3262
+ return _context20.abrupt("return", []);
3263
+
3264
+ case 10:
3242
3265
  if (![OtherRoleType.Patient, OtherRoleType.User].every(function (requiredRole) {
3243
3266
  return currentAccountRole.includes(requiredRole);
3244
3267
  })) {
3245
- _context20.next = 24;
3268
+ _context20.next = 26;
3246
3269
  break;
3247
3270
  }
3248
3271
 
3249
3272
  if (!filter) {
3250
- _context20.next = 15;
3273
+ _context20.next = 17;
3251
3274
  break;
3252
3275
  }
3253
3276
 
3254
- _context20.next = 12;
3277
+ _context20.next = 14;
3255
3278
  return filterGrantsWithLockboxMetadata(this, filter);
3256
3279
 
3257
- case 12:
3280
+ case 14:
3258
3281
  encryptedGrants = _context20.sent;
3259
- _context20.next = 18;
3282
+ _context20.next = 20;
3260
3283
  break;
3261
3284
 
3262
- case 15:
3263
- _context20.next = 17;
3285
+ case 17:
3286
+ _context20.next = 19;
3264
3287
  return this.vaultClient.grantsGet();
3265
3288
 
3266
- case 17:
3289
+ case 19:
3267
3290
  encryptedGrants = _context20.sent.grants;
3268
3291
 
3269
- case 18:
3270
- _context20.next = 20;
3292
+ case 20:
3293
+ _context20.next = 22;
3271
3294
  return decryptGrants(encryptedGrants, this.rsa);
3272
3295
 
3273
- case 20:
3296
+ case 22:
3274
3297
  decryptedGrants = _context20.sent;
3275
3298
  // sets the cached grant
3276
3299
  this.cachedMetadataGrants[filterString] = decryptedGrants;
3277
3300
  console.info('[sdk:grant] Found grant for patient');
3278
3301
  return _context20.abrupt("return", decryptedGrants);
3279
3302
 
3280
- case 24:
3303
+ case 26:
3281
3304
  if (filter) {
3282
- _context20.next = 26;
3305
+ _context20.next = 28;
3283
3306
  break;
3284
3307
  }
3285
3308
 
3286
3309
  throw MissingGrantFilter;
3287
3310
 
3288
- case 26:
3289
- _context20.next = 28;
3311
+ case 28:
3312
+ _context20.next = 30;
3290
3313
  return this.vaultClient.vaultIndexGet([IndexKey.ConsultationLockbox], [filter.consultationId]).then(function (res) {
3291
3314
  return res[IndexKey.ConsultationLockbox];
3292
3315
  })["catch"](function (e) {
@@ -3294,12 +3317,12 @@ var OroClient = /*#__PURE__*/function () {
3294
3317
  return [];
3295
3318
  });
3296
3319
 
3297
- case 28:
3320
+ case 30:
3298
3321
  grantsByConsultLockbox = _context20.sent;
3299
3322
  decryptedConsults = decryptConsultLockboxGrants(grantsByConsultLockbox != null ? grantsByConsultLockbox : [], this.rsa);
3300
3323
 
3301
3324
  if (!(decryptedConsults.length > 0)) {
3302
- _context20.next = 34;
3325
+ _context20.next = 36;
3303
3326
  break;
3304
3327
  }
3305
3328
 
@@ -3307,10 +3330,10 @@ var OroClient = /*#__PURE__*/function () {
3307
3330
  this.cachedMetadataGrants[filterString] = decryptedConsults;
3308
3331
  return _context20.abrupt("return", this.cachedMetadataGrants[filterString]);
3309
3332
 
3310
- case 34:
3333
+ case 36:
3311
3334
  return _context20.abrupt("return", []);
3312
3335
 
3313
- case 35:
3336
+ case 37:
3314
3337
  case "end":
3315
3338
  return _context20.stop();
3316
3339
  }