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