oro-sdk 3.16.0 → 3.19.0

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