oro-sdk 5.3.5 → 5.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,20 +6,16 @@ export { oroToolbox as OroToolboxNamespace };
6
6
  import { getMany } from 'idb-keyval';
7
7
 
8
8
  function _regeneratorRuntime() {
9
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
10
-
11
9
  _regeneratorRuntime = function () {
12
10
  return exports;
13
11
  };
14
-
15
12
  var exports = {},
16
- Op = Object.prototype,
17
- hasOwn = Op.hasOwnProperty,
18
- $Symbol = "function" == typeof Symbol ? Symbol : {},
19
- iteratorSymbol = $Symbol.iterator || "@@iterator",
20
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
21
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
22
-
13
+ Op = Object.prototype,
14
+ hasOwn = Op.hasOwnProperty,
15
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
16
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
17
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
18
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
23
19
  function define(obj, key, value) {
24
20
  return Object.defineProperty(obj, key, {
25
21
  value: value,
@@ -28,7 +24,6 @@ function _regeneratorRuntime() {
28
24
  writable: !0
29
25
  }), obj[key];
30
26
  }
31
-
32
27
  try {
33
28
  define({}, "");
34
29
  } catch (err) {
@@ -36,40 +31,33 @@ function _regeneratorRuntime() {
36
31
  return obj[key] = value;
37
32
  };
38
33
  }
39
-
40
34
  function wrap(innerFn, outerFn, self, tryLocsList) {
41
35
  var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
42
- generator = Object.create(protoGenerator.prototype),
43
- context = new Context(tryLocsList || []);
36
+ generator = Object.create(protoGenerator.prototype),
37
+ context = new Context(tryLocsList || []);
44
38
  return generator._invoke = function (innerFn, self, context) {
45
39
  var state = "suspendedStart";
46
40
  return function (method, arg) {
47
41
  if ("executing" === state) throw new Error("Generator is already running");
48
-
49
42
  if ("completed" === state) {
50
43
  if ("throw" === method) throw arg;
51
44
  return doneResult();
52
45
  }
53
-
54
46
  for (context.method = method, context.arg = arg;;) {
55
47
  var delegate = context.delegate;
56
-
57
48
  if (delegate) {
58
49
  var delegateResult = maybeInvokeDelegate(delegate, context);
59
-
60
50
  if (delegateResult) {
61
51
  if (delegateResult === ContinueSentinel) continue;
62
52
  return delegateResult;
63
53
  }
64
54
  }
65
-
66
55
  if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
67
56
  if ("suspendedStart" === state) throw state = "completed", context.arg;
68
57
  context.dispatchException(context.arg);
69
58
  } else "return" === context.method && context.abrupt("return", context.arg);
70
59
  state = "executing";
71
60
  var record = tryCatch(innerFn, self, context);
72
-
73
61
  if ("normal" === record.type) {
74
62
  if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
75
63
  return {
@@ -77,13 +65,11 @@ function _regeneratorRuntime() {
77
65
  done: context.done
78
66
  };
79
67
  }
80
-
81
68
  "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
82
69
  }
83
70
  };
84
71
  }(innerFn, self, context), generator;
85
72
  }
86
-
87
73
  function tryCatch(fn, obj, arg) {
88
74
  try {
89
75
  return {
@@ -97,25 +83,19 @@ function _regeneratorRuntime() {
97
83
  };
98
84
  }
99
85
  }
100
-
101
86
  exports.wrap = wrap;
102
87
  var ContinueSentinel = {};
103
-
104
88
  function Generator() {}
105
-
106
89
  function GeneratorFunction() {}
107
-
108
90
  function GeneratorFunctionPrototype() {}
109
-
110
91
  var IteratorPrototype = {};
111
92
  define(IteratorPrototype, iteratorSymbol, function () {
112
93
  return this;
113
94
  });
114
95
  var getProto = Object.getPrototypeOf,
115
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
96
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
116
97
  NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
117
98
  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
118
-
119
99
  function defineIteratorMethods(prototype) {
120
100
  ["next", "throw", "return"].forEach(function (method) {
121
101
  define(prototype, method, function (arg) {
@@ -123,14 +103,12 @@ function _regeneratorRuntime() {
123
103
  });
124
104
  });
125
105
  }
126
-
127
106
  function AsyncIterator(generator, PromiseImpl) {
128
107
  function invoke(method, arg, resolve, reject) {
129
108
  var record = tryCatch(generator[method], generator, arg);
130
-
131
109
  if ("throw" !== record.type) {
132
110
  var result = record.arg,
133
- value = result.value;
111
+ value = result.value;
134
112
  return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
135
113
  invoke("next", value, resolve, reject);
136
114
  }, function (err) {
@@ -141,89 +119,71 @@ function _regeneratorRuntime() {
141
119
  return invoke("throw", error, resolve, reject);
142
120
  });
143
121
  }
144
-
145
122
  reject(record.arg);
146
123
  }
147
-
148
124
  var previousPromise;
149
-
150
125
  this._invoke = function (method, arg) {
151
126
  function callInvokeWithMethodAndArg() {
152
127
  return new PromiseImpl(function (resolve, reject) {
153
128
  invoke(method, arg, resolve, reject);
154
129
  });
155
130
  }
156
-
157
131
  return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
158
132
  };
159
133
  }
160
-
161
134
  function maybeInvokeDelegate(delegate, context) {
162
135
  var method = delegate.iterator[context.method];
163
-
164
136
  if (undefined === method) {
165
137
  if (context.delegate = null, "throw" === context.method) {
166
138
  if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
167
139
  context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
168
140
  }
169
-
170
141
  return ContinueSentinel;
171
142
  }
172
-
173
143
  var record = tryCatch(method, delegate.iterator, context.arg);
174
144
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
175
145
  var info = record.arg;
176
146
  return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
177
147
  }
178
-
179
148
  function pushTryEntry(locs) {
180
149
  var entry = {
181
150
  tryLoc: locs[0]
182
151
  };
183
152
  1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
184
153
  }
185
-
186
154
  function resetTryEntry(entry) {
187
155
  var record = entry.completion || {};
188
156
  record.type = "normal", delete record.arg, entry.completion = record;
189
157
  }
190
-
191
158
  function Context(tryLocsList) {
192
159
  this.tryEntries = [{
193
160
  tryLoc: "root"
194
161
  }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
195
162
  }
196
-
197
163
  function values(iterable) {
198
164
  if (iterable) {
199
165
  var iteratorMethod = iterable[iteratorSymbol];
200
166
  if (iteratorMethod) return iteratorMethod.call(iterable);
201
167
  if ("function" == typeof iterable.next) return iterable;
202
-
203
168
  if (!isNaN(iterable.length)) {
204
169
  var i = -1,
205
- next = function next() {
206
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
207
-
208
- return next.value = undefined, next.done = !0, next;
209
- };
210
-
170
+ next = function next() {
171
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
172
+ return next.value = undefined, next.done = !0, next;
173
+ };
211
174
  return next.next = next;
212
175
  }
213
176
  }
214
-
215
177
  return {
216
178
  next: doneResult
217
179
  };
218
180
  }
219
-
220
181
  function doneResult() {
221
182
  return {
222
183
  value: undefined,
223
184
  done: !0
224
185
  };
225
186
  }
226
-
227
187
  return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
228
188
  var ctor = "function" == typeof genFun && genFun.constructor;
229
189
  return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
@@ -247,15 +207,12 @@ function _regeneratorRuntime() {
247
207
  return "[object Generator]";
248
208
  }), exports.keys = function (object) {
249
209
  var keys = [];
250
-
251
210
  for (var key in object) keys.push(key);
252
-
253
211
  return keys.reverse(), function next() {
254
212
  for (; keys.length;) {
255
213
  var key = keys.pop();
256
214
  if (key in object) return next.value = key, next.done = !1, next;
257
215
  }
258
-
259
216
  return next.done = !0, next;
260
217
  };
261
218
  }, exports.values = values, Context.prototype = {
@@ -272,20 +229,16 @@ function _regeneratorRuntime() {
272
229
  dispatchException: function (exception) {
273
230
  if (this.done) throw exception;
274
231
  var context = this;
275
-
276
232
  function handle(loc, caught) {
277
233
  return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
278
234
  }
279
-
280
235
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
281
236
  var entry = this.tryEntries[i],
282
- record = entry.completion;
237
+ record = entry.completion;
283
238
  if ("root" === entry.tryLoc) return handle("end");
284
-
285
239
  if (entry.tryLoc <= this.prev) {
286
240
  var hasCatch = hasOwn.call(entry, "catchLoc"),
287
- hasFinally = hasOwn.call(entry, "finallyLoc");
288
-
241
+ hasFinally = hasOwn.call(entry, "finallyLoc");
289
242
  if (hasCatch && hasFinally) {
290
243
  if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
291
244
  if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
@@ -301,13 +254,11 @@ function _regeneratorRuntime() {
301
254
  abrupt: function (type, arg) {
302
255
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
303
256
  var entry = this.tryEntries[i];
304
-
305
257
  if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
306
258
  var finallyEntry = entry;
307
259
  break;
308
260
  }
309
261
  }
310
-
311
262
  finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
312
263
  var record = finallyEntry ? finallyEntry.completion : {};
313
264
  return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
@@ -325,19 +276,15 @@ function _regeneratorRuntime() {
325
276
  catch: function (tryLoc) {
326
277
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
327
278
  var entry = this.tryEntries[i];
328
-
329
279
  if (entry.tryLoc === tryLoc) {
330
280
  var record = entry.completion;
331
-
332
281
  if ("throw" === record.type) {
333
282
  var thrown = record.arg;
334
283
  resetTryEntry(entry);
335
284
  }
336
-
337
285
  return thrown;
338
286
  }
339
287
  }
340
-
341
288
  throw new Error("illegal catch attempt");
342
289
  },
343
290
  delegateYield: function (iterable, resultName, nextLoc) {
@@ -349,55 +296,47 @@ function _regeneratorRuntime() {
349
296
  }
350
297
  }, exports;
351
298
  }
352
-
353
299
  function _wrapRegExp() {
354
300
  _wrapRegExp = function (re, groups) {
355
301
  return new BabelRegExp(re, void 0, groups);
356
302
  };
357
-
358
303
  var _super = RegExp.prototype,
359
- _groups = new WeakMap();
360
-
304
+ _groups = new WeakMap();
361
305
  function BabelRegExp(re, flags, groups) {
362
306
  var _this = new RegExp(re, flags);
363
-
364
307
  return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype);
365
308
  }
366
-
367
309
  function buildGroups(result, re) {
368
310
  var g = _groups.get(re);
369
-
370
311
  return Object.keys(g).reduce(function (groups, name) {
371
- return groups[name] = result[g[name]], groups;
312
+ var i = g[name];
313
+ if ("number" == typeof i) groups[name] = result[i];else {
314
+ for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;
315
+ groups[name] = result[i[k]];
316
+ }
317
+ return groups;
372
318
  }, Object.create(null));
373
319
  }
374
-
375
320
  return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {
376
321
  var result = _super.exec.call(this, str);
377
-
378
322
  return result && (result.groups = buildGroups(result, this)), result;
379
323
  }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
380
324
  if ("string" == typeof substitution) {
381
325
  var groups = _groups.get(this);
382
-
383
326
  return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
384
327
  return "$" + groups[name];
385
328
  }));
386
329
  }
387
-
388
330
  if ("function" == typeof substitution) {
389
331
  var _this = this;
390
-
391
332
  return _super[Symbol.replace].call(this, str, function () {
392
333
  var args = arguments;
393
334
  return "object" != typeof args[args.length - 1] && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);
394
335
  });
395
336
  }
396
-
397
337
  return _super[Symbol.replace].call(this, str, substitution);
398
338
  }, _wrapRegExp.apply(this, arguments);
399
339
  }
400
-
401
340
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
402
341
  try {
403
342
  var info = gen[key](arg);
@@ -406,57 +345,46 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
406
345
  reject(error);
407
346
  return;
408
347
  }
409
-
410
348
  if (info.done) {
411
349
  resolve(value);
412
350
  } else {
413
351
  Promise.resolve(value).then(_next, _throw);
414
352
  }
415
353
  }
416
-
417
354
  function _asyncToGenerator(fn) {
418
355
  return function () {
419
356
  var self = this,
420
- args = arguments;
357
+ args = arguments;
421
358
  return new Promise(function (resolve, reject) {
422
359
  var gen = fn.apply(self, args);
423
-
424
360
  function _next(value) {
425
361
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
426
362
  }
427
-
428
363
  function _throw(err) {
429
364
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
430
365
  }
431
-
432
366
  _next(undefined);
433
367
  });
434
368
  };
435
369
  }
436
-
437
370
  function _extends() {
438
- _extends = Object.assign || function (target) {
371
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
439
372
  for (var i = 1; i < arguments.length; i++) {
440
373
  var source = arguments[i];
441
-
442
374
  for (var key in source) {
443
375
  if (Object.prototype.hasOwnProperty.call(source, key)) {
444
376
  target[key] = source[key];
445
377
  }
446
378
  }
447
379
  }
448
-
449
380
  return target;
450
381
  };
451
-
452
382
  return _extends.apply(this, arguments);
453
383
  }
454
-
455
384
  function _inherits(subClass, superClass) {
456
385
  if (typeof superClass !== "function" && superClass !== null) {
457
386
  throw new TypeError("Super expression must either be null or a function");
458
387
  }
459
-
460
388
  subClass.prototype = Object.create(superClass && superClass.prototype, {
461
389
  constructor: {
462
390
  value: subClass,
@@ -469,35 +397,28 @@ function _inherits(subClass, superClass) {
469
397
  });
470
398
  if (superClass) _setPrototypeOf(subClass, superClass);
471
399
  }
472
-
473
400
  function _inheritsLoose(subClass, superClass) {
474
401
  subClass.prototype = Object.create(superClass.prototype);
475
402
  subClass.prototype.constructor = subClass;
476
-
477
403
  _setPrototypeOf(subClass, superClass);
478
404
  }
479
-
480
405
  function _getPrototypeOf(o) {
481
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
406
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
482
407
  return o.__proto__ || Object.getPrototypeOf(o);
483
408
  };
484
409
  return _getPrototypeOf(o);
485
410
  }
486
-
487
411
  function _setPrototypeOf(o, p) {
488
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
412
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
489
413
  o.__proto__ = p;
490
414
  return o;
491
415
  };
492
-
493
416
  return _setPrototypeOf(o, p);
494
417
  }
495
-
496
418
  function _isNativeReflectConstruct() {
497
419
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
498
420
  if (Reflect.construct.sham) return false;
499
421
  if (typeof Proxy === "function") return true;
500
-
501
422
  try {
502
423
  Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
503
424
  return true;
@@ -505,10 +426,9 @@ function _isNativeReflectConstruct() {
505
426
  return false;
506
427
  }
507
428
  }
508
-
509
429
  function _construct(Parent, args, Class) {
510
430
  if (_isNativeReflectConstruct()) {
511
- _construct = Reflect.construct;
431
+ _construct = Reflect.construct.bind();
512
432
  } else {
513
433
  _construct = function _construct(Parent, args, Class) {
514
434
  var a = [null];
@@ -519,34 +439,25 @@ function _construct(Parent, args, Class) {
519
439
  return instance;
520
440
  };
521
441
  }
522
-
523
442
  return _construct.apply(null, arguments);
524
443
  }
525
-
526
444
  function _isNativeFunction(fn) {
527
445
  return Function.toString.call(fn).indexOf("[native code]") !== -1;
528
446
  }
529
-
530
447
  function _wrapNativeSuper(Class) {
531
448
  var _cache = typeof Map === "function" ? new Map() : undefined;
532
-
533
449
  _wrapNativeSuper = function _wrapNativeSuper(Class) {
534
450
  if (Class === null || !_isNativeFunction(Class)) return Class;
535
-
536
451
  if (typeof Class !== "function") {
537
452
  throw new TypeError("Super expression must either be null or a function");
538
453
  }
539
-
540
454
  if (typeof _cache !== "undefined") {
541
455
  if (_cache.has(Class)) return _cache.get(Class);
542
-
543
456
  _cache.set(Class, Wrapper);
544
457
  }
545
-
546
458
  function Wrapper() {
547
459
  return _construct(Class, arguments, _getPrototypeOf(this).constructor);
548
460
  }
549
-
550
461
  Wrapper.prototype = Object.create(Class.prototype, {
551
462
  constructor: {
552
463
  value: Wrapper,
@@ -557,25 +468,20 @@ function _wrapNativeSuper(Class) {
557
468
  });
558
469
  return _setPrototypeOf(Wrapper, Class);
559
470
  };
560
-
561
471
  return _wrapNativeSuper(Class);
562
472
  }
563
-
564
473
  function _objectWithoutPropertiesLoose(source, excluded) {
565
474
  if (source == null) return {};
566
475
  var target = {};
567
476
  var sourceKeys = Object.keys(source);
568
477
  var key, i;
569
-
570
478
  for (i = 0; i < sourceKeys.length; i++) {
571
479
  key = sourceKeys[i];
572
480
  if (excluded.indexOf(key) >= 0) continue;
573
481
  target[key] = source[key];
574
482
  }
575
-
576
483
  return target;
577
484
  }
578
-
579
485
  function _unsupportedIterableToArray(o, minLen) {
580
486
  if (!o) return;
581
487
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -584,19 +490,14 @@ function _unsupportedIterableToArray(o, minLen) {
584
490
  if (n === "Map" || n === "Set") return Array.from(o);
585
491
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
586
492
  }
587
-
588
493
  function _arrayLikeToArray(arr, len) {
589
494
  if (len == null || len > arr.length) len = arr.length;
590
-
591
495
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
592
-
593
496
  return arr2;
594
497
  }
595
-
596
498
  function _createForOfIteratorHelperLoose(o, allowArrayLike) {
597
499
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
598
500
  if (it) return (it = it.call(o)).next.bind(it);
599
-
600
501
  if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
601
502
  if (it) o = it;
602
503
  var i = 0;
@@ -610,7 +511,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
610
511
  };
611
512
  };
612
513
  }
613
-
614
514
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
615
515
  }
616
516
 
@@ -621,10 +521,8 @@ var personalMetaToPrefix = (_personalMetaToPrefix = {}, _personalMetaToPrefix[Me
621
521
  * @param data extracted from WorkflowData
622
522
  * @returns PersonalInformations of a patient
623
523
  */
624
-
625
524
  function identificationToPersonalInformations(data, category) {
626
- var _data$;
627
-
525
+ var _data;
628
526
  var prefix = personalMetaToPrefix[category];
629
527
  return {
630
528
  birthday: data[prefix + "Birthday"],
@@ -633,7 +531,7 @@ function identificationToPersonalInformations(data, category) {
633
531
  name: data[prefix + "Name"],
634
532
  phone: data[prefix + "Phone"],
635
533
  zip: data[prefix + "Zip"],
636
- hid: (_data$ = data[prefix + "HID"]) != null ? _data$ : data[prefix + "ID"],
534
+ hid: (_data = data[prefix + "HID"]) != null ? _data : data[prefix + "ID"],
637
535
  pharmacy: data[prefix + "Pharmacy"],
638
536
  address: data[prefix + "Address"]
639
537
  };
@@ -642,7 +540,7 @@ function toActualObject(data) {
642
540
  var ret = {};
643
541
  Object.entries(data.fields).forEach(function (_ref) {
644
542
  var key = _ref[0],
645
- field = _ref[1];
543
+ field = _ref[1];
646
544
  ret[key] = field.displayedAnswer ? field.displayedAnswer : field.answer;
647
545
  });
648
546
  return ret;
@@ -653,18 +551,15 @@ function toActualObject(data) {
653
551
  * @param data the PopulatedWorkflowData
654
552
  * @returns an updated PopulatedWorkflowData
655
553
  */
656
-
657
554
  function updatePersonalIntoPopulatedWorkflowData(infos, data, category) {
658
555
  var prefix = personalMetaToPrefix[category];
659
556
  var ret = JSON.parse(JSON.stringify(data)); // deep copy PopulatedWorkflowData
660
-
661
557
  if (infos.birthday && ret.fields[prefix + "Birthday"]) ret.fields[prefix + "Birthday"].answer = infos.birthday;
662
558
  if (infos.firstname && ret.fields[prefix + "Firstname"]) ret.fields[prefix + "Firstname"].answer = infos.firstname;
663
559
  if (infos.gender && ret.fields[prefix + "Gender"]) ret.fields[prefix + "Gender"].answer = infos.gender;
664
560
  if (infos.name && ret.fields[prefix + "Name"]) ret.fields[prefix + "Name"].answer = infos.name;
665
561
  if (infos.phone && ret.fields[prefix + "Phone"]) ret.fields[prefix + "Phone"].answer = infos.phone;
666
562
  if (infos.zip && ret.fields[prefix + "Zip"]) ret.fields[prefix + "Zip"].answer = infos.zip;
667
-
668
563
  if (infos.hid) {
669
564
  if (ret.fields[prefix + "HID"]) {
670
565
  ret.fields[prefix + "HID"].answer = infos.hid;
@@ -679,7 +574,6 @@ function updatePersonalIntoPopulatedWorkflowData(infos, data, category) {
679
574
  };
680
575
  }
681
576
  }
682
-
683
577
  return ret;
684
578
  }
685
579
  /**
@@ -687,12 +581,10 @@ function updatePersonalIntoPopulatedWorkflowData(infos, data, category) {
687
581
  * @param answers answers from the WorkflowData
688
582
  * @returns an ISO 3166 alpha-2 code or undefined
689
583
  */
690
-
691
584
  function extractISOLocalityForConsult(answers) {
692
585
  if (!answers) {
693
586
  return undefined;
694
587
  }
695
-
696
588
  var arrAnswersWithLocality = answers.flatMap(function (currentAnswerPage) {
697
589
  var arrCountryFields = Object.keys(currentAnswerPage).filter(function (workflowFieldName) {
698
590
  return workflowFieldName.indexOf('Country') !== -1;
@@ -702,8 +594,8 @@ function extractISOLocalityForConsult(answers) {
702
594
  }).flat();
703
595
  var arrConsultLocalFields = Object.keys(currentAnswerPage).filter(function (workflowFieldName) {
704
596
  return workflowFieldName.indexOf('Locality') !== -1;
705
- }).flat(); //returning the actual selected values, skipping if their IDs are more complex than a string
706
-
597
+ }).flat();
598
+ //returning the actual selected values, skipping if their IDs are more complex than a string
707
599
  return [].concat(arrCountryFields.map(function (currentFieldName) {
708
600
  return typeof currentAnswerPage[currentFieldName] === 'string' ? currentAnswerPage[currentFieldName] : undefined;
709
601
  }), arrProvinceFields.map(function (currentFieldName) {
@@ -717,43 +609,34 @@ function extractISOLocalityForConsult(answers) {
717
609
  var arrSelectedLocality = arrAnswersWithLocality.filter(function (currentSelectedLocality) {
718
610
  return currentSelectedLocality.startsWith('isoLocalityConsult');
719
611
  });
720
-
721
612
  if (!arrSelectedLocality || arrSelectedLocality.length === 0) {
722
613
  console.log('no locality found in ' + arrSelectedLocality);
723
614
  return undefined;
724
- } //to allow enforcing of an order, we will allow the following pattern in the isoLocalityConsult field name
615
+ }
616
+ //to allow enforcing of an order, we will allow the following pattern in the isoLocalityConsult field name
725
617
  // isoLocalityConsult-QC-CA and isoLocalityConsult_1-QC-CA
726
618
  // or generally: isoLocalityConsult-<isoValue> or isoLocalityConsult_<priority>-<isoValue>
727
-
728
-
729
619
  var allowedLocalityPatterns = /*#__PURE__*/_wrapRegExp(/isoLocalityConsult(?:_(\d*))?\x2D([a-zA-Z0-9]{2}\x2D[a-zA-Z0-9]{1,3})/, {
730
620
  indexPriority: 1,
731
621
  isoValue: 2
732
622
  });
733
-
734
623
  var finalLocality = arrSelectedLocality.reduce(function (finalLocality, currentSelectedLocality) {
735
624
  var extractedSelected = allowedLocalityPatterns.exec(currentSelectedLocality);
736
-
737
625
  var _ref2 = extractedSelected != null ? extractedSelected : [],
738
- indexSelectedPriority = _ref2[1],
739
- isoSelectedValue = _ref2[2];
740
-
626
+ indexSelectedPriority = _ref2[1],
627
+ isoSelectedValue = _ref2[2];
741
628
  if (!finalLocality) {
742
629
  return isoSelectedValue;
743
630
  }
744
-
745
631
  var extractedFinal = allowedLocalityPatterns.exec(finalLocality);
746
-
747
632
  var _ref3 = extractedFinal != null ? extractedFinal : [],
748
- indexFinalPriority = _ref3[1],
749
- isoFinalValue = _ref3[2]; //we only keep the old value if there's priority used
633
+ indexFinalPriority = _ref3[1],
634
+ isoFinalValue = _ref3[2];
635
+ //we only keep the old value if there's priority used
750
636
  // and the new value is of lower priority
751
-
752
-
753
637
  if (!indexSelectedPriority || indexFinalPriority && indexFinalPriority > indexSelectedPriority) {
754
638
  return isoFinalValue;
755
639
  }
756
-
757
640
  return isoSelectedValue;
758
641
  }, undefined);
759
642
  console.log('Picking locality ' + finalLocality);
@@ -766,65 +649,51 @@ function sessionStorePrivateKeyName(id) {
766
649
 
767
650
  var IncompleteAuthentication = /*#__PURE__*/function (_Error) {
768
651
  _inheritsLoose(IncompleteAuthentication, _Error);
769
-
770
652
  function IncompleteAuthentication() {
771
653
  return _Error.apply(this, arguments) || this;
772
654
  }
773
-
774
655
  return IncompleteAuthentication;
775
656
  }( /*#__PURE__*/_wrapNativeSuper(Error));
776
657
  var MissingGrant = /*#__PURE__*/function (_Error2) {
777
658
  _inheritsLoose(MissingGrant, _Error2);
778
-
779
659
  function MissingGrant() {
780
660
  return _Error2.apply(this, arguments) || this;
781
661
  }
782
-
783
662
  return MissingGrant;
784
663
  }( /*#__PURE__*/_wrapNativeSuper(Error));
785
664
  var MissingGrantFilter = /*#__PURE__*/function (_Error3) {
786
665
  _inheritsLoose(MissingGrantFilter, _Error3);
787
-
788
666
  function MissingGrantFilter() {
789
667
  return _Error3.apply(this, arguments) || this;
790
668
  }
791
-
792
669
  return MissingGrantFilter;
793
670
  }( /*#__PURE__*/_wrapNativeSuper(Error));
794
671
  var MissingLockbox = /*#__PURE__*/function (_Error4) {
795
672
  _inheritsLoose(MissingLockbox, _Error4);
796
-
797
673
  function MissingLockbox() {
798
674
  return _Error4.apply(this, arguments) || this;
799
675
  }
800
-
801
676
  return MissingLockbox;
802
677
  }( /*#__PURE__*/_wrapNativeSuper(Error));
803
678
  var MissingLockboxOwner = /*#__PURE__*/function (_Error5) {
804
679
  _inheritsLoose(MissingLockboxOwner, _Error5);
805
-
806
680
  function MissingLockboxOwner() {
807
681
  return _Error5.apply(this, arguments) || this;
808
682
  }
809
-
810
683
  return MissingLockboxOwner;
811
684
  }( /*#__PURE__*/_wrapNativeSuper(Error));
812
685
  var AssociatedLockboxNotFound = /*#__PURE__*/function (_Error6) {
813
686
  _inheritsLoose(AssociatedLockboxNotFound, _Error6);
814
-
815
687
  function AssociatedLockboxNotFound() {
816
688
  return _Error6.apply(this, arguments) || this;
817
689
  }
818
-
819
690
  return AssociatedLockboxNotFound;
820
691
  }( /*#__PURE__*/_wrapNativeSuper(Error));
821
692
  var WorkflowAnswersMissingError = /*#__PURE__*/function (_Error7) {
822
693
  _inheritsLoose(WorkflowAnswersMissingError, _Error7);
823
-
824
694
  function WorkflowAnswersMissingError() {
825
695
  return _Error7.apply(this, arguments) || this;
826
696
  }
827
-
828
697
  return WorkflowAnswersMissingError;
829
698
  }( /*#__PURE__*/_wrapNativeSuper(Error));
830
699
 
@@ -840,7 +709,6 @@ function filterTriggeredAnsweredWithKind(_x, _x2) {
840
709
  * @param category
841
710
  * @returns An array of record key, value pairs
842
711
  */
843
-
844
712
  function _filterTriggeredAnsweredWithKind() {
845
713
  _filterTriggeredAnsweredWithKind = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(workflowData, kind) {
846
714
  var flattenedAnswers, triggeredQuestionsWithKind, samePageAnswers, res;
@@ -852,13 +720,10 @@ function _filterTriggeredAnsweredWithKind() {
852
720
  _context.next = 2;
853
721
  break;
854
722
  }
855
-
856
723
  throw WorkflowAnswersMissingError;
857
-
858
724
  case 2:
859
725
  // Flattens the list of answered questions
860
726
  flattenedAnswers = flattenSelectedAnswers(workflowData.selectedAnswers); // Generates a list of applicable questions
861
-
862
727
  triggeredQuestionsWithKind = Object.fromEntries(workflowData.pages.map(function (a) {
863
728
  return Object.entries(a.questions).filter(function (_ref) {
864
729
  var question = _ref[1];
@@ -872,7 +737,6 @@ function _filterTriggeredAnsweredWithKind() {
872
737
  return samePageAnswers[questionFieldName];
873
738
  });
874
739
  return _context.abrupt("return", res);
875
-
876
740
  case 7:
877
741
  case "end":
878
742
  return _context.stop();
@@ -882,11 +746,9 @@ function _filterTriggeredAnsweredWithKind() {
882
746
  }));
883
747
  return _filterTriggeredAnsweredWithKind.apply(this, arguments);
884
748
  }
885
-
886
749
  function getWorkflowDataByCategory(_x3, _x4) {
887
750
  return _getWorkflowDataByCategory.apply(this, arguments);
888
751
  }
889
-
890
752
  function _getWorkflowDataByCategory() {
891
753
  _getWorkflowDataByCategory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(workflowData, category) {
892
754
  var flattenedAnswers, triggeredQuestions, fields;
@@ -898,13 +760,10 @@ function _getWorkflowDataByCategory() {
898
760
  _context2.next = 2;
899
761
  break;
900
762
  }
901
-
902
763
  throw WorkflowAnswersMissingError;
903
-
904
764
  case 2:
905
765
  // Flattens the list of answered questions
906
766
  flattenedAnswers = flattenSelectedAnswers(workflowData.selectedAnswers); // Generates a list of applicable questions
907
-
908
767
  triggeredQuestions = Object.fromEntries(workflowData.pages.map(function (a) {
909
768
  return Object.entries(a.questions).filter(function (_ref2) {
910
769
  var question = _ref2[1];
@@ -912,7 +771,6 @@ function _getWorkflowDataByCategory() {
912
771
  });
913
772
  }).flat());
914
773
  fields = {}; // Generates the answers of the specified category and adds the appropriate values if any are missing
915
-
916
774
  return _context2.abrupt("return", Promise.all(workflowData.selectedAnswers.map(function (e) {
917
775
  return Object.entries(e);
918
776
  }).flat().filter(function (_ref3) {
@@ -920,7 +778,7 @@ function _getWorkflowDataByCategory() {
920
778
  return triggeredQuestions[k] && triggeredQuestions[k]['metaCategory'] === category;
921
779
  }).map(function (_ref4) {
922
780
  var k = _ref4[0],
923
- v = _ref4[1];
781
+ v = _ref4[1];
924
782
  return populateWorkflowField(triggeredQuestions[k], v).then(function (populatedValue) {
925
783
  fields[k] = populatedValue;
926
784
  });
@@ -936,7 +794,6 @@ function _getWorkflowDataByCategory() {
936
794
  console.error("Error while extracting " + category + " data from workflow", err);
937
795
  throw err;
938
796
  }));
939
-
940
797
  case 6:
941
798
  case "end":
942
799
  return _context2.stop();
@@ -946,7 +803,6 @@ function _getWorkflowDataByCategory() {
946
803
  }));
947
804
  return _getWorkflowDataByCategory.apply(this, arguments);
948
805
  }
949
-
950
806
  function getImagesFromIndexDb(_x5) {
951
807
  return _getImagesFromIndexDb.apply(this, arguments);
952
808
  }
@@ -959,7 +815,6 @@ function getImagesFromIndexDb(_x5) {
959
815
  * @param answerValue
960
816
  * @returns
961
817
  */
962
-
963
818
  function _getImagesFromIndexDb() {
964
819
  _getImagesFromIndexDb = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(answer) {
965
820
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
@@ -969,13 +824,10 @@ function _getImagesFromIndexDb() {
969
824
  _context3.next = 2;
970
825
  return getMany(answer.map(function (v) {
971
826
  var _v$id;
972
-
973
827
  return (_v$id = v.id) != null ? _v$id : v;
974
828
  }));
975
-
976
829
  case 2:
977
830
  return _context3.abrupt("return", _context3.sent);
978
-
979
831
  case 3:
980
832
  case "end":
981
833
  return _context3.stop();
@@ -985,7 +837,6 @@ function _getImagesFromIndexDb() {
985
837
  }));
986
838
  return _getImagesFromIndexDb.apply(this, arguments);
987
839
  }
988
-
989
840
  function populateWorkflowField(_x6, _x7) {
990
841
  return _populateWorkflowField.apply(this, arguments);
991
842
  }
@@ -1035,8 +886,6 @@ function populateWorkflowField(_x6, _x7) {
1035
886
  * @returns `true` if triggers are verified against ansers. Otherwise, returns `false`.
1036
887
  * @throws an Error if triggers typing is wrong
1037
888
  */
1038
-
1039
-
1040
889
  function _populateWorkflowField() {
1041
890
  _populateWorkflowField = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(question, answerValue) {
1042
891
  var answer, displayedAnswer;
@@ -1048,61 +897,50 @@ function _populateWorkflowField() {
1048
897
  _context4.t0 = question.kind;
1049
898
  _context4.next = _context4.t0 === 'text-select-group' ? 4 : _context4.t0 === 'radio' ? 7 : _context4.t0 === 'radio-card' ? 7 : _context4.t0 === 'select' ? 7 : _context4.t0 === 'multiple' ? 10 : _context4.t0 === 'checkbox-group' ? 10 : _context4.t0 === 'images' ? 13 : 17;
1050
899
  break;
1051
-
1052
900
  case 4:
1053
901
  if (question.answers) {
1054
902
  displayedAnswer = answerValue[0] + " " + question.answers[answerValue[1]].text;
1055
903
  }
1056
-
1057
904
  answer = answerValue;
1058
905
  return _context4.abrupt("break", 18);
1059
-
1060
906
  case 7:
1061
907
  if (question.answers) {
1062
908
  displayedAnswer = question.answers[answerValue].text;
1063
909
  }
1064
-
1065
910
  answer = answerValue;
1066
911
  return _context4.abrupt("break", 18);
1067
-
1068
912
  case 10:
1069
913
  displayedAnswer = answerValue.map(function (value) {
1070
914
  if (question.answers) {
1071
915
  return question.answers[value].text;
1072
916
  }
1073
-
1074
917
  throw new WorkflowAnswersMissingError();
1075
918
  });
1076
919
  answer = answerValue;
1077
920
  return _context4.abrupt("break", 18);
1078
-
1079
921
  case 13:
1080
922
  _context4.next = 15;
1081
923
  return getImagesFromIndexDb(answerValue).then(function (images) {
1082
924
  return images.map(function (image) {
1083
925
  var name = image.name,
1084
- imageData = image.imageData;
926
+ imageData = image.imageData;
1085
927
  return {
1086
928
  name: name,
1087
929
  imageData: imageData
1088
930
  };
1089
931
  });
1090
932
  });
1091
-
1092
933
  case 15:
1093
934
  answer = _context4.sent;
1094
935
  return _context4.abrupt("break", 18);
1095
-
1096
936
  case 17:
1097
937
  answer = answerValue;
1098
-
1099
938
  case 18:
1100
939
  return _context4.abrupt("return", Promise.resolve({
1101
940
  answer: answer,
1102
941
  displayedAnswer: displayedAnswer,
1103
942
  kind: question.kind
1104
943
  }));
1105
-
1106
944
  case 19:
1107
945
  case "end":
1108
946
  return _context4.stop();
@@ -1112,13 +950,11 @@ function _populateWorkflowField() {
1112
950
  }));
1113
951
  return _populateWorkflowField.apply(this, arguments);
1114
952
  }
1115
-
1116
953
  function isTriggered(triggers, answers) {
1117
954
  // is triggers contained in answers
1118
955
  if (typeof triggers === 'string') {
1119
956
  return answers.includes(triggers);
1120
957
  }
1121
-
1122
958
  if (Array.isArray(triggers)) {
1123
959
  // rule combination kind: rule1 OR (rule2 AND rule3)
1124
960
  if (Array.isArray(triggers[0])) {
@@ -1134,17 +970,14 @@ function isTriggered(triggers, answers) {
1134
970
  });
1135
971
  }
1136
972
  }
1137
-
1138
973
  throw Error('[isTriggered] triggers is not typed well');
1139
974
  }
1140
975
  function flattenSelectedAnswers(answers) {
1141
976
  var linearAnswers = [];
1142
-
1143
977
  for (var _iterator = _createForOfIteratorHelperLoose(answers), _step; !(_step = _iterator()).done;) {
1144
978
  var answer = _step.value;
1145
979
  linearAnswers.push.apply(linearAnswers, Object.values(answer));
1146
980
  }
1147
-
1148
981
  return linearAnswers.flat(1);
1149
982
  }
1150
983
  /**
@@ -1153,43 +986,34 @@ function flattenSelectedAnswers(answers) {
1153
986
  * @param useDefault use workflow default values or not (this is used to avoid having unset values to appear in summaries)
1154
987
  * @returns a valid selectedAnswers structure
1155
988
  */
1156
-
1157
989
  function getInitialisedSelectedAnswers(workflow, useDefault) {
1158
990
  if (useDefault === void 0) {
1159
991
  useDefault = true;
1160
992
  }
1161
-
1162
993
  return workflow.pages.map(function (page) {
1163
994
  var ret = {};
1164
-
1165
995
  for (var _i = 0, _Object$entries = Object.entries(page.questions); _i < _Object$entries.length; _i++) {
1166
996
  var _Object$entries$_i = _Object$entries[_i],
1167
- id = _Object$entries$_i[0],
1168
- question = _Object$entries$_i[1];
1169
-
997
+ id = _Object$entries$_i[0],
998
+ question = _Object$entries$_i[1];
1170
999
  if (question.kind === 'body-parts') {
1171
1000
  ret[id] = useDefault ? [] : undefined;
1172
1001
  } else {
1173
1002
  ret[id] = useDefault && question.defaultValue ? question.defaultValue : undefined;
1174
1003
  }
1175
1004
  }
1176
-
1177
1005
  return ret;
1178
1006
  });
1179
1007
  }
1180
1008
  function fillWorkflowFromPopulatedWorkflow(workflow, populatedWorkflow) {
1181
1009
  var filledWorkflow = JSON.parse(JSON.stringify(workflow));
1182
-
1183
1010
  if (!filledWorkflow.selectedAnswers) {
1184
1011
  filledWorkflow.selectedAnswers = getInitialisedSelectedAnswers(filledWorkflow, false);
1185
1012
  }
1186
-
1187
1013
  filledWorkflow.pages.forEach(function (page, pageIdx) {
1188
-
1189
1014
  for (var _i2 = 0, _Object$entries2 = Object.entries(page.questions); _i2 < _Object$entries2.length; _i2++) {
1190
1015
  var _Object$entries2$_i = _Object$entries2[_i2],
1191
- id = _Object$entries2$_i[0];
1192
-
1016
+ id = _Object$entries2$_i[0];
1193
1017
  if (populatedWorkflow.fields[id]) {
1194
1018
  if (filledWorkflow.selectedAnswers) filledWorkflow.selectedAnswers[pageIdx][id] = populatedWorkflow.fields[id].answer;
1195
1019
  }
@@ -1207,7 +1031,6 @@ function fillWorkflowFromPopulatedWorkflow(workflow, populatedWorkflow) {
1207
1031
  function getOrCreatePatientConsultationUuid(_x, _x2) {
1208
1032
  return _getOrCreatePatientConsultationUuid.apply(this, arguments);
1209
1033
  }
1210
-
1211
1034
  function _getOrCreatePatientConsultationUuid() {
1212
1035
  _getOrCreatePatientConsultationUuid = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(consult, oroClient) {
1213
1036
  var payment;
@@ -1217,30 +1040,24 @@ function _getOrCreatePatientConsultationUuid() {
1217
1040
  case 0:
1218
1041
  _context.next = 2;
1219
1042
  return oroClient.practiceClient.practiceGetPayment(consult.uuidPractice, consult.idStripeInvoiceOrPaymentIntent);
1220
-
1221
1043
  case 2:
1222
1044
  payment = _context.sent;
1223
-
1224
1045
  if (!(payment && payment.uuidConsult)) {
1225
1046
  _context.next = 7;
1226
1047
  break;
1227
1048
  }
1228
-
1229
1049
  return _context.abrupt("return", oroClient.consultClient.getConsultByUUID(payment.uuidConsult)["catch"](function (err) {
1230
1050
  console.error('Error while retrieving consult', err);
1231
1051
  throw err;
1232
1052
  }));
1233
-
1234
1053
  case 7:
1235
1054
  _context.next = 9;
1236
1055
  return oroClient.consultClient.consultCreate(consult)["catch"](function (err) {
1237
1056
  console.error('Error while creating consult', err);
1238
1057
  throw err;
1239
1058
  });
1240
-
1241
1059
  case 9:
1242
1060
  return _context.abrupt("return", _context.sent);
1243
-
1244
1061
  case 10:
1245
1062
  case "end":
1246
1063
  return _context.stop();
@@ -1274,7 +1091,6 @@ var MAX_RETRIES = 15;
1274
1091
  * @param onProgress callback that is called whenever a new step of patient registration is executed. Note: progress ranges from 0 to 1, and descriptionKey is a description of the progress as a key so the app would use it to translate the description
1275
1092
  * @returns the successful registration
1276
1093
  */
1277
-
1278
1094
  function registerPatient(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
1279
1095
  return _registerPatient.apply(this, arguments);
1280
1096
  }
@@ -1283,11 +1099,9 @@ function registerPatient(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
1283
1099
  * @param oroClient
1284
1100
  * @returns the lockbox Uuid
1285
1101
  */
1286
-
1287
1102
  function _registerPatient() {
1288
1103
  _registerPatient = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(patientUuid, consultRequest, workflow, oroClient, masterKey, recoveryQA, indexSearch, onProgress) {
1289
1104
  var consult, lockboxUuid, practitionerAdmin, retry, identity, errorsThrown, stepsTotalNum, currentStep, _ret;
1290
-
1291
1105
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1292
1106
  while (1) {
1293
1107
  switch (_context4.prev = _context4.next) {
@@ -1295,7 +1109,6 @@ function _registerPatient() {
1295
1109
  if (indexSearch === void 0) {
1296
1110
  indexSearch = true;
1297
1111
  }
1298
-
1299
1112
  consult = undefined;
1300
1113
  lockboxUuid = undefined;
1301
1114
  practitionerAdmin = undefined;
@@ -1303,100 +1116,80 @@ function _registerPatient() {
1303
1116
  identity = undefined;
1304
1117
  errorsThrown = [];
1305
1118
  stepsTotalNum = 9;
1306
-
1307
1119
  case 8:
1308
1120
  if (!(retry > 0)) {
1309
1121
  _context4.next = 24;
1310
1122
  break;
1311
1123
  }
1312
-
1313
1124
  _context4.prev = 9;
1314
1125
  return _context4.delegateYield( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
1315
1126
  var _consultIndex, _identity, _identity2;
1316
-
1317
1127
  var practitioners, grantPromises, consultIndex, consultIndexPromises;
1318
1128
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1319
1129
  while (1) {
1320
1130
  switch (_context3.prev = _context3.next) {
1321
1131
  case 0:
1322
1132
  currentStep = 0;
1323
- if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'retrieve_practitioners'); // Wait a bit each retry (we also want the first one to wait)
1324
-
1133
+ if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'retrieve_practitioners');
1134
+ // Wait a bit each retry (we also want the first one to wait)
1325
1135
  _context3.next = 4;
1326
1136
  return new Promise(function (resolve) {
1327
1137
  return setTimeout(resolve, 2000);
1328
1138
  });
1329
-
1330
1139
  case 4:
1331
1140
  if (practitionerAdmin) {
1332
1141
  _context3.next = 8;
1333
1142
  break;
1334
1143
  }
1335
-
1336
1144
  _context3.next = 7;
1337
1145
  return oroClient.practiceClient.practiceGetFromUuid(consultRequest.uuidPractice);
1338
-
1339
1146
  case 7:
1340
1147
  practitionerAdmin = _context3.sent.uuidAdmin;
1341
-
1342
1148
  case 8:
1343
1149
  _context3.next = 10;
1344
1150
  return oroClient.practiceClient.practiceGetPractitioners(consultRequest.uuidPractice)["catch"](function (err) {
1345
1151
  console.log("Error retrieving practitioners", err);
1346
1152
  return [];
1347
1153
  });
1348
-
1349
1154
  case 10:
1350
1155
  practitioners = _context3.sent;
1351
1156
  // Creating consult
1352
1157
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'create_consult');
1353
-
1354
1158
  if (consult) {
1355
1159
  _context3.next = 16;
1356
1160
  break;
1357
1161
  }
1358
-
1359
1162
  _context3.next = 15;
1360
1163
  return getOrCreatePatientConsultationUuid(consultRequest, oroClient);
1361
-
1362
1164
  case 15:
1363
1165
  consult = _context3.sent;
1364
-
1365
1166
  case 16:
1366
1167
  // Creating lockbox
1367
1168
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'create_lockbox');
1368
-
1369
1169
  if (lockboxUuid) {
1370
1170
  _context3.next = 21;
1371
1171
  break;
1372
1172
  }
1373
-
1374
1173
  _context3.next = 20;
1375
1174
  return getOrCreatePatientLockbox(oroClient);
1376
-
1377
1175
  case 20:
1378
1176
  lockboxUuid = _context3.sent;
1379
-
1380
1177
  case 21:
1381
1178
  if (identity) {
1382
1179
  _context3.next = 25;
1383
1180
  break;
1384
1181
  }
1385
-
1386
1182
  _context3.next = 24;
1387
1183
  return oroClient.guardClient.identityGet(patientUuid);
1388
-
1389
1184
  case 24:
1390
1185
  identity = _context3.sent;
1391
-
1392
1186
  case 25:
1393
1187
  _context3.next = 27;
1394
1188
  return oroClient.grantLockbox(practitionerAdmin, lockboxUuid)["catch"](function (err) {
1395
- console.error("Error while granting lockbox to practitioner admin " + practitionerAdmin, err); // if we cannot grant to the admin, then the registration will fail
1396
-
1189
+ console.error("Error while granting lockbox to practitioner admin " + practitionerAdmin, err);
1190
+ // if we cannot grant to the admin, then the registration will fail
1397
1191
  errorsThrown.push(err);
1398
1192
  });
1399
-
1400
1193
  case 27:
1401
1194
  // Patient Grant to practice
1402
1195
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'grant_patient');
@@ -1409,12 +1202,11 @@ function _registerPatient() {
1409
1202
  switch (_context.prev = _context.next) {
1410
1203
  case 0:
1411
1204
  return _context.abrupt("return", oroClient.grantLockbox(practitioner.uuid, lockboxUuid)["catch"](function (err) {
1412
- console.error("Error while granting lockbox to practitioner", err); // Acceptable to continue as admin has already been granted, but we should still retry until the last retry remains
1413
-
1205
+ console.error("Error while granting lockbox to practitioner", err);
1206
+ // Acceptable to continue as admin has already been granted, but we should still retry until the last retry remains
1414
1207
  if (retry <= 1) return;
1415
1208
  errorsThrown.push(err);
1416
1209
  }));
1417
-
1418
1210
  case 1:
1419
1211
  case "end":
1420
1212
  return _context.stop();
@@ -1422,7 +1214,6 @@ function _registerPatient() {
1422
1214
  }
1423
1215
  }, _callee);
1424
1216
  }));
1425
-
1426
1217
  return function (_x29) {
1427
1218
  return _ref.apply(this, arguments);
1428
1219
  };
@@ -1434,7 +1225,6 @@ function _registerPatient() {
1434
1225
  },
1435
1226
  consultationId: consult.uuid
1436
1227
  }], _consultIndex); // the index will identify in which lockbox a consultation resides
1437
-
1438
1228
  consultIndexPromises = practitioners.map( /*#__PURE__*/function () {
1439
1229
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(practitioner) {
1440
1230
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -1442,11 +1232,10 @@ function _registerPatient() {
1442
1232
  switch (_context2.prev = _context2.next) {
1443
1233
  case 0:
1444
1234
  return _context2.abrupt("return", oroClient.vaultIndexAdd(consultIndex, practitioner.uuid)["catch"](function (err) {
1445
- console.error("[SDK: registration] Error while adding to the practitioner's index " + practitioner.uuid, err); // Acceptable to continue as the index can be rebuilt, but we should still retry until the last retry remains
1446
-
1235
+ console.error("[SDK: registration] Error while adding to the practitioner's index " + practitioner.uuid, err);
1236
+ // Acceptable to continue as the index can be rebuilt, but we should still retry until the last retry remains
1447
1237
  if (retry <= 1) return;else errorsThrown.push(err);
1448
1238
  }));
1449
-
1450
1239
  case 1:
1451
1240
  case "end":
1452
1241
  return _context2.stop();
@@ -1454,7 +1243,6 @@ function _registerPatient() {
1454
1243
  }
1455
1244
  }, _callee2);
1456
1245
  }));
1457
-
1458
1246
  return function (_x30) {
1459
1247
  return _ref2.apply(this, arguments);
1460
1248
  };
@@ -1465,11 +1253,10 @@ function _registerPatient() {
1465
1253
  currentStep: currentStep,
1466
1254
  stepsTotalNum: stepsTotalNum
1467
1255
  } : undefined)["catch"](function (err) {
1468
- console.error('[SDK: registration] Some errors happened during image upload', err); // Acceptable to continue as images can be requested during the consultation, but we should still retry until the last retry remains
1469
-
1256
+ console.error('[SDK: registration] Some errors happened during image upload', err);
1257
+ // Acceptable to continue as images can be requested during the consultation, but we should still retry until the last retry remains
1470
1258
  if (retry <= 1) return;else errorsThrown.push(err);
1471
1259
  });
1472
-
1473
1260
  case 33:
1474
1261
  ++currentStep;
1475
1262
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'store_patient_data');
@@ -1478,92 +1265,73 @@ function _registerPatient() {
1478
1265
  console.error('[SDK: registration] Some errors happened during patient data upload', err);
1479
1266
  errorsThrown.push(err);
1480
1267
  });
1481
-
1482
1268
  case 37:
1483
1269
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'set_masterkey');
1484
-
1485
1270
  if (!(masterKey && !((_identity = identity) != null && _identity.recoveryMasterKey))) {
1486
1271
  _context3.next = 44;
1487
1272
  break;
1488
1273
  }
1489
-
1490
1274
  _context3.next = 41;
1491
1275
  return oroClient.updateMasterKey(patientUuid, masterKey, lockboxUuid)["catch"](function (err) {
1492
- console.error("[SDK: registration] Error while updating master key", err); /// it's acceptable to continue registration (return old identity)
1493
-
1276
+ console.error("[SDK: registration] Error while updating master key", err);
1277
+ /// it's acceptable to continue registration (return old identity)
1494
1278
  if (retry <= 1) return;
1495
1279
  errorsThrown.push(err);
1496
1280
  return identity;
1497
1281
  });
1498
-
1499
1282
  case 41:
1500
1283
  identity = _context3.sent;
1501
1284
  _context3.next = 45;
1502
1285
  break;
1503
-
1504
1286
  case 44:
1505
1287
  // we did not set the master key so we do not return it
1506
1288
  masterKey = undefined;
1507
-
1508
1289
  case 45:
1509
1290
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'set_security_questions');
1510
-
1511
1291
  if (!(recoveryQA && !((_identity2 = identity) != null && _identity2.recoverySecurityQuestions))) {
1512
1292
  _context3.next = 50;
1513
1293
  break;
1514
1294
  }
1515
-
1516
1295
  _context3.next = 49;
1517
1296
  return oroClient.updateSecurityQuestions(patientUuid, recoveryQA.recoverySecurityQuestions, recoveryQA.recoverySecurityAnswers, 2)["catch"](function (err) {
1518
- console.error("[SDK: registration] Error while updating security questions", err); /// it's acceptable to continue registration (return old identity)
1519
-
1297
+ console.error("[SDK: registration] Error while updating security questions", err);
1298
+ /// it's acceptable to continue registration (return old identity)
1520
1299
  if (retry <= 1) return;
1521
1300
  errorsThrown.push(err);
1522
1301
  return identity;
1523
1302
  });
1524
-
1525
1303
  case 49:
1526
1304
  identity = _context3.sent;
1527
-
1528
1305
  case 50:
1529
1306
  _context3.next = 52;
1530
1307
  return Promise.all([].concat(grantPromises, consultIndexPromises));
1531
-
1532
1308
  case 52:
1533
1309
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'search_indexing');
1534
-
1535
1310
  if (!indexSearch) {
1536
1311
  _context3.next = 56;
1537
1312
  break;
1538
1313
  }
1539
-
1540
1314
  _context3.next = 56;
1541
1315
  return buildConsultSearchIndex(consult, workflow, oroClient)["catch"](function (err) {
1542
1316
  console.error('[SDK: registration] personal information not found or another error occured during search indexing', err);
1543
1317
  if (retry <= 1) return; // this statement is to avoid failing the registration due to the failure in search indexing the consult, this practically implements a soft retry
1544
-
1545
1318
  errorsThrown.push(err);
1546
1319
  });
1547
-
1548
1320
  case 56:
1549
1321
  if (!(errorsThrown.length > 0)) {
1550
1322
  _context3.next = 58;
1551
1323
  break;
1552
1324
  }
1553
-
1554
1325
  throw errorsThrown;
1555
-
1556
1326
  case 58:
1557
1327
  _context3.next = 60;
1558
1328
  return oroClient.consultClient.updateConsultByUUID(consult.uuid, {
1559
1329
  statusMedical: MedicalStatus.New
1560
1330
  });
1561
-
1562
1331
  case 60:
1563
1332
  // if we got through the complete flow, the registration succeeded
1564
1333
  if (onProgress) onProgress(currentStep++ / stepsTotalNum, 'success');
1565
1334
  return _context3.abrupt("return", "break");
1566
-
1567
1335
  case 62:
1568
1336
  case "end":
1569
1337
  return _context3.stop();
@@ -1571,54 +1339,43 @@ function _registerPatient() {
1571
1339
  }
1572
1340
  }, _callee3);
1573
1341
  })(), "t0", 11);
1574
-
1575
1342
  case 11:
1576
1343
  _ret = _context4.t0;
1577
-
1578
1344
  if (!(_ret === "break")) {
1579
1345
  _context4.next = 14;
1580
1346
  break;
1581
1347
  }
1582
-
1583
1348
  return _context4.abrupt("break", 24);
1584
-
1585
1349
  case 14:
1586
1350
  _context4.next = 21;
1587
1351
  break;
1588
-
1589
1352
  case 16:
1590
1353
  _context4.prev = 16;
1591
1354
  _context4.t1 = _context4["catch"](9);
1592
1355
  console.error("[SDK] Error occured during registration: " + _context4.t1 + ", retrying... Retries remaining: " + retry);
1593
1356
  errorsThrown = [];
1594
1357
  return _context4.abrupt("continue", 21);
1595
-
1596
1358
  case 21:
1597
1359
  retry--;
1598
1360
  _context4.next = 8;
1599
1361
  break;
1600
-
1601
1362
  case 24:
1602
1363
  if (!(retry <= 0)) {
1603
1364
  _context4.next = 27;
1604
1365
  break;
1605
1366
  }
1606
-
1607
1367
  console.error('[SDK] registration failed: MAX_RETRIES reached');
1608
1368
  throw 'RegistrationFailed';
1609
-
1610
1369
  case 27:
1611
1370
  console.log('Successfully Registered');
1612
1371
  _context4.next = 30;
1613
1372
  return oroClient.cleanIndex();
1614
-
1615
1373
  case 30:
1616
1374
  return _context4.abrupt("return", {
1617
1375
  masterKey: masterKey,
1618
1376
  consultationId: consult.uuid,
1619
1377
  lockboxUuid: lockboxUuid
1620
1378
  });
1621
-
1622
1379
  case 31:
1623
1380
  case "end":
1624
1381
  return _context4.stop();
@@ -1628,7 +1385,6 @@ function _registerPatient() {
1628
1385
  }));
1629
1386
  return _registerPatient.apply(this, arguments);
1630
1387
  }
1631
-
1632
1388
  function getOrCreatePatientLockbox(_x9) {
1633
1389
  return _getOrCreatePatientLockbox.apply(this, arguments);
1634
1390
  }
@@ -1641,8 +1397,6 @@ function getOrCreatePatientLockbox(_x9) {
1641
1397
  * @param oroClient an oroClient instance
1642
1398
  * @returns
1643
1399
  */
1644
-
1645
-
1646
1400
  function _getOrCreatePatientLockbox() {
1647
1401
  _getOrCreatePatientLockbox = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(oroClient) {
1648
1402
  var grants, lockboxResponse, tokens;
@@ -1652,30 +1406,24 @@ function _getOrCreatePatientLockbox() {
1652
1406
  case 0:
1653
1407
  _context5.next = 2;
1654
1408
  return oroClient.getGrants();
1655
-
1656
1409
  case 2:
1657
1410
  grants = _context5.sent;
1658
-
1659
1411
  if (!(grants.length > 0)) {
1660
1412
  _context5.next = 8;
1661
1413
  break;
1662
1414
  }
1663
-
1664
1415
  console.log('The grant has already been created, skipping lockbox create step');
1665
1416
  return _context5.abrupt("return", grants[0].lockboxUuid);
1666
-
1667
1417
  case 8:
1668
1418
  _context5.next = 10;
1669
1419
  return oroClient.vaultClient.lockboxCreate()["catch"](function (err) {
1670
1420
  console.error('Error while creating lockbox', err);
1671
1421
  throw err;
1672
1422
  });
1673
-
1674
1423
  case 10:
1675
1424
  lockboxResponse = _context5.sent;
1676
1425
  _context5.next = 13;
1677
1426
  return oroClient.guardClient.authRefresh();
1678
-
1679
1427
  case 13:
1680
1428
  tokens = _context5.sent;
1681
1429
  _context5.next = 16;
@@ -1683,14 +1431,11 @@ function _getOrCreatePatientLockbox() {
1683
1431
  accessToken: tokens.accessToken,
1684
1432
  refreshToken: tokens.refreshToken
1685
1433
  });
1686
-
1687
1434
  case 16:
1688
1435
  _context5.next = 18;
1689
1436
  return oroClient.guardClient.whoAmI(true);
1690
-
1691
1437
  case 18:
1692
1438
  return _context5.abrupt("return", lockboxResponse.lockboxUuid);
1693
-
1694
1439
  case 19:
1695
1440
  case "end":
1696
1441
  return _context5.stop();
@@ -1700,18 +1445,17 @@ function _getOrCreatePatientLockbox() {
1700
1445
  }));
1701
1446
  return _getOrCreatePatientLockbox.apply(this, arguments);
1702
1447
  }
1703
-
1704
1448
  function storePatientData(_x10, _x11, _x12, _x13, _x14) {
1705
1449
  return _storePatientData.apply(this, arguments);
1706
1450
  }
1707
-
1708
1451
  function _storePatientData() {
1709
1452
  _storePatientData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(consultationId, isoLanguage, lockboxUuid, workflow, oroClient) {
1710
1453
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1711
1454
  while (1) {
1712
1455
  switch (_context6.prev = _context6.next) {
1713
1456
  case 0:
1714
- return _context6.abrupt("return", Promise.all([// Storing Raw data first
1457
+ return _context6.abrupt("return", Promise.all([
1458
+ // Storing Raw data first
1715
1459
  oroClient.getOrInsertJsonData(lockboxUuid, workflow, {
1716
1460
  category: MetadataCategory.Raw,
1717
1461
  contentType: 'application/json',
@@ -1740,7 +1484,6 @@ function _storePatientData() {
1740
1484
  }, {})]).then(function (dataUuids) {
1741
1485
  return dataUuids.flat();
1742
1486
  }));
1743
-
1744
1487
  case 1:
1745
1488
  case "end":
1746
1489
  return _context6.stop();
@@ -1750,7 +1493,6 @@ function _storePatientData() {
1750
1493
  }));
1751
1494
  return _storePatientData.apply(this, arguments);
1752
1495
  }
1753
-
1754
1496
  function storeImageAliases(_x15, _x16, _x17, _x18, _x19) {
1755
1497
  return _storeImageAliases.apply(this, arguments);
1756
1498
  }
@@ -1763,8 +1505,6 @@ function storeImageAliases(_x15, _x16, _x17, _x18, _x19) {
1763
1505
  * @param category
1764
1506
  * @returns The data uuid
1765
1507
  */
1766
-
1767
-
1768
1508
  function _storeImageAliases() {
1769
1509
  _storeImageAliases = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(consultationId, lockboxUuid, workflow, oroClient, progress) {
1770
1510
  var images, nonNullImages, storedImagesNum, totalImagesNum, promises;
@@ -1775,22 +1515,18 @@ function _storeImageAliases() {
1775
1515
  _context7.t0 = getImagesFromIndexDb;
1776
1516
  _context7.next = 3;
1777
1517
  return filterTriggeredAnsweredWithKind(workflow, 'images-alias');
1778
-
1779
1518
  case 3:
1780
1519
  _context7.t1 = _context7.sent.flat();
1781
1520
  _context7.next = 6;
1782
1521
  return (0, _context7.t0)(_context7.t1);
1783
-
1784
1522
  case 6:
1785
1523
  images = _context7.sent;
1786
1524
  nonNullImages = images.filter(function (img) {
1787
1525
  return !!img;
1788
1526
  });
1789
-
1790
1527
  if (images.length !== nonNullImages.length) {
1791
1528
  console.error('[SDK] Some images have not been found, they have been skipped.');
1792
1529
  }
1793
-
1794
1530
  storedImagesNum = 0;
1795
1531
  totalImagesNum = nonNullImages.length;
1796
1532
  if (progress) progress.onProgress(progress.currentStep / progress.stepsTotalNum, 'store_images', {
@@ -1815,7 +1551,6 @@ function _storeImageAliases() {
1815
1551
  });
1816
1552
  });
1817
1553
  return _context7.abrupt("return", Promise.all(promises));
1818
-
1819
1554
  case 14:
1820
1555
  case "end":
1821
1556
  return _context7.stop();
@@ -1825,7 +1560,6 @@ function _storeImageAliases() {
1825
1560
  }));
1826
1561
  return _storeImageAliases.apply(this, arguments);
1827
1562
  }
1828
-
1829
1563
  function extractAndStorePersonalWorkflowData(_x20, _x21, _x22, _x23, _x24) {
1830
1564
  return _extractAndStorePersonalWorkflowData.apply(this, arguments);
1831
1565
  }
@@ -1833,7 +1567,6 @@ function extractAndStorePersonalWorkflowData(_x20, _x21, _x22, _x23, _x24) {
1833
1567
  * Given workflow data, it populates it with Personal, ChildPersonal, and OtherPersonal workflow data
1834
1568
  * @param workflow
1835
1569
  */
1836
-
1837
1570
  function _extractAndStorePersonalWorkflowData() {
1838
1571
  _extractAndStorePersonalWorkflowData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(workflow, lockboxUuid, consultationId, category, oroClient) {
1839
1572
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
@@ -1848,7 +1581,6 @@ function _extractAndStorePersonalWorkflowData() {
1848
1581
  consultationIds: [consultationId]
1849
1582
  }, {});
1850
1583
  }));
1851
-
1852
1584
  case 1:
1853
1585
  case "end":
1854
1586
  return _context8.stop();
@@ -1858,7 +1590,6 @@ function _extractAndStorePersonalWorkflowData() {
1858
1590
  }));
1859
1591
  return _extractAndStorePersonalWorkflowData.apply(this, arguments);
1860
1592
  }
1861
-
1862
1593
  function extractPersonalInfoFromWorkflowData(_x25) {
1863
1594
  return _extractPersonalInfoFromWorkflowData.apply(this, arguments);
1864
1595
  }
@@ -1868,7 +1599,6 @@ function extractPersonalInfoFromWorkflowData(_x25) {
1868
1599
  * @param workflow the workflow data
1869
1600
  * @param oroClient
1870
1601
  */
1871
-
1872
1602
  function _extractPersonalInfoFromWorkflowData() {
1873
1603
  _extractPersonalInfoFromWorkflowData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(workflow) {
1874
1604
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
@@ -1877,15 +1607,14 @@ function _extractPersonalInfoFromWorkflowData() {
1877
1607
  case 0:
1878
1608
  return _context9.abrupt("return", Promise.all([getWorkflowDataByCategory(workflow, MetadataCategory.Personal), getWorkflowDataByCategory(workflow, MetadataCategory.ChildPersonal), getWorkflowDataByCategory(workflow, MetadataCategory.OtherPersonal)]).then(function (_ref3) {
1879
1609
  var personalInfoPopulatedWfData = _ref3[0],
1880
- childPersonalInfoPopulatedWfData = _ref3[1],
1881
- otherPersonalInfoPopulatedWfData = _ref3[2];
1610
+ childPersonalInfoPopulatedWfData = _ref3[1],
1611
+ otherPersonalInfoPopulatedWfData = _ref3[2];
1882
1612
  return {
1883
1613
  personalInfoPopulatedWfData: personalInfoPopulatedWfData,
1884
1614
  childPersonalInfoPopulatedWfData: childPersonalInfoPopulatedWfData,
1885
1615
  otherPersonalInfoPopulatedWfData: otherPersonalInfoPopulatedWfData
1886
1616
  };
1887
1617
  }));
1888
-
1889
1618
  case 1:
1890
1619
  case "end":
1891
1620
  return _context9.stop();
@@ -1895,15 +1624,12 @@ function _extractPersonalInfoFromWorkflowData() {
1895
1624
  }));
1896
1625
  return _extractPersonalInfoFromWorkflowData.apply(this, arguments);
1897
1626
  }
1898
-
1899
1627
  function buildConsultSearchIndex(_x26, _x27, _x28) {
1900
1628
  return _buildConsultSearchIndex.apply(this, arguments);
1901
1629
  }
1902
-
1903
1630
  function _buildConsultSearchIndex() {
1904
1631
  _buildConsultSearchIndex = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(consult, workflow, oroClient) {
1905
1632
  var terms, _yield$extractPersona, personalInfoPopulatedWfData, childPersonalInfoPopulatedWfData, otherPersonalInfoPopulatedWfData, personalInfo, childPersonalInfo, otherPersonalInfo;
1906
-
1907
1633
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1908
1634
  while (1) {
1909
1635
  switch (_context10.prev = _context10.next) {
@@ -1914,7 +1640,6 @@ function _buildConsultSearchIndex() {
1914
1640
  }];
1915
1641
  _context10.next = 3;
1916
1642
  return extractPersonalInfoFromWorkflowData(workflow);
1917
-
1918
1643
  case 3:
1919
1644
  _yield$extractPersona = _context10.sent;
1920
1645
  personalInfoPopulatedWfData = _yield$extractPersona.personalInfoPopulatedWfData;
@@ -1930,7 +1655,6 @@ function _buildConsultSearchIndex() {
1930
1655
  kind: 'last-name',
1931
1656
  value: personalInfo.name
1932
1657
  });
1933
-
1934
1658
  if (childPersonalInfo.firstname && childPersonalInfo.name) {
1935
1659
  terms.push({
1936
1660
  kind: 'first-name',
@@ -1940,7 +1664,6 @@ function _buildConsultSearchIndex() {
1940
1664
  value: childPersonalInfo.name
1941
1665
  });
1942
1666
  }
1943
-
1944
1667
  if (otherPersonalInfo.firstname && otherPersonalInfo.name) {
1945
1668
  terms.push({
1946
1669
  kind: 'first-name',
@@ -1950,10 +1673,8 @@ function _buildConsultSearchIndex() {
1950
1673
  value: otherPersonalInfo.name
1951
1674
  });
1952
1675
  }
1953
-
1954
1676
  _context10.next = 15;
1955
1677
  return oroClient.searchClient.index(consult.uuid, terms);
1956
-
1957
1678
  case 15:
1958
1679
  case "end":
1959
1680
  return _context10.stop();
@@ -1972,7 +1693,6 @@ function _buildConsultSearchIndex() {
1972
1693
  * @param rsaKey: the rsa key used to decrypt the encrypted grants
1973
1694
  * @returns an array of grants
1974
1695
  */
1975
-
1976
1696
  function decryptGrants(encryptedGrants, rsaKey) {
1977
1697
  return encryptedGrants.map(function (grant) {
1978
1698
  if (grant.encryptedLockbox && !grant.lockboxUuid) {
@@ -1982,7 +1702,6 @@ function decryptGrants(encryptedGrants, rsaKey) {
1982
1702
  console.error('[sdk:index] The grant could not be decrypted or was not a valid UUID: ', e);
1983
1703
  }
1984
1704
  }
1985
-
1986
1705
  return grant;
1987
1706
  }).filter(function (grant) {
1988
1707
  return grant.lockboxUuid;
@@ -1996,7 +1715,6 @@ function decryptGrants(encryptedGrants, rsaKey) {
1996
1715
  * @param rsaKey: the rsa key used to decrypt the encrypted entries
1997
1716
  * @returns an array of grants
1998
1717
  */
1999
-
2000
1718
  function decryptConsultLockboxGrants(encryptedConsultLockboxes, rsaKey) {
2001
1719
  return encryptedConsultLockboxes.map(function (encryptedConsultLockboxes) {
2002
1720
  try {
@@ -2024,10 +1742,8 @@ var MAX_RETRIES$1 = 15;
2024
1742
  * @param pharmacy
2025
1743
  * @returns a workflow
2026
1744
  */
2027
-
2028
1745
  function getRefillAnswersAsWorkflow(isTreatmentWorking, hasSideEffects, deliveryAddress, pharmacy) {
2029
1746
  var _ref, _ref2, _selectedAnswers$push, _selectedAnswers$push2;
2030
-
2031
1747
  var selectedAnswers = [(_ref = {}, _ref['isTreatmentWorking'] = isTreatmentWorking, _ref), (_ref2 = {}, _ref2['hasSideEffects'] = hasSideEffects, _ref2)];
2032
1748
  if (deliveryAddress) selectedAnswers.push((_selectedAnswers$push = {}, _selectedAnswers$push['deliveryAddress'] = deliveryAddress, _selectedAnswers$push));
2033
1749
  if (pharmacy) selectedAnswers.push((_selectedAnswers$push2 = {}, _selectedAnswers$push2['pharmacy'] = JSON.stringify(pharmacy), _selectedAnswers$push2));
@@ -2109,11 +1825,9 @@ function getRefillAnswersAsWorkflow(isTreatmentWorking, hasSideEffects, delivery
2109
1825
  * @param populatedRefillWorkflow the refill workflow data
2110
1826
  * @param oroClient
2111
1827
  */
2112
-
2113
1828
  function createRefill(_x, _x2, _x3) {
2114
1829
  return _createRefill.apply(this, arguments);
2115
1830
  }
2116
-
2117
1831
  function _createRefill() {
2118
1832
  _createRefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(consultRequest, populatedRefillWorkflow, oroClient) {
2119
1833
  var retry, errorsThrown, newConsult, lockboxUuid;
@@ -2123,38 +1837,29 @@ function _createRefill() {
2123
1837
  case 0:
2124
1838
  retry = MAX_RETRIES$1;
2125
1839
  errorsThrown = [];
2126
-
2127
1840
  case 2:
2128
1841
  if (!(retry > 0)) {
2129
1842
  _context.next = 28;
2130
1843
  break;
2131
1844
  }
2132
-
2133
1845
  _context.prev = 3;
2134
-
2135
1846
  if (newConsult) {
2136
1847
  _context.next = 8;
2137
1848
  break;
2138
1849
  }
2139
-
2140
1850
  _context.next = 7;
2141
1851
  return getOrCreatePatientConsultationUuid(consultRequest, oroClient);
2142
-
2143
1852
  case 7:
2144
1853
  newConsult = _context.sent;
2145
-
2146
1854
  case 8:
2147
1855
  if (lockboxUuid) {
2148
1856
  _context.next = 12;
2149
1857
  break;
2150
1858
  }
2151
-
2152
1859
  _context.next = 11;
2153
1860
  return oroClient.getGrants();
2154
-
2155
1861
  case 11:
2156
1862
  lockboxUuid = _context.sent[0].lockboxUuid;
2157
-
2158
1863
  case 12:
2159
1864
  _context.next = 14;
2160
1865
  return oroClient.getOrInsertJsonData(lockboxUuid, populatedRefillWorkflow, {
@@ -2167,37 +1872,30 @@ function _createRefill() {
2167
1872
  console.error('[SDK: prescription refill] Some errors happened during refill data upload', err);
2168
1873
  errorsThrown.push(err);
2169
1874
  });
2170
-
2171
1875
  case 14:
2172
1876
  if (!(errorsThrown.length > 0)) {
2173
1877
  _context.next = 16;
2174
1878
  break;
2175
1879
  }
2176
-
2177
1880
  throw errorsThrown;
2178
-
2179
1881
  case 16:
2180
1882
  _context.next = 18;
2181
1883
  return oroClient.consultClient.updateConsultByUUID(newConsult.uuid, {
2182
1884
  statusMedical: MedicalStatus.New
2183
1885
  });
2184
-
2185
1886
  case 18:
2186
1887
  _context.next = 25;
2187
1888
  break;
2188
-
2189
1889
  case 20:
2190
1890
  _context.prev = 20;
2191
1891
  _context.t0 = _context["catch"](3);
2192
1892
  console.error("[SDK] Error occured during refill: " + _context.t0 + ", retrying... Retries remaining: " + retry);
2193
1893
  errorsThrown = [];
2194
1894
  return _context.abrupt("continue", 25);
2195
-
2196
1895
  case 25:
2197
1896
  retry--;
2198
1897
  _context.next = 2;
2199
1898
  break;
2200
-
2201
1899
  case 28:
2202
1900
  case "end":
2203
1901
  return _context.stop();
@@ -2215,52 +1913,42 @@ function _createRefill() {
2215
1913
  * @param filter: the consult uuid
2216
1914
  * @returns the grants containing the consult uuid
2217
1915
  */
2218
-
2219
1916
  function filterGrantsWithLockboxMetadata(_x, _x2) {
2220
1917
  return _filterGrantsWithLockboxMetadata.apply(this, arguments);
2221
1918
  }
2222
-
2223
1919
  function _filterGrantsWithLockboxMetadata() {
2224
1920
  _filterGrantsWithLockboxMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(oroClient, filter) {
2225
1921
  var grants, filteredGrants, _iterator, _step, grant, consultationIdExistsInMetadata;
2226
-
2227
1922
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2228
1923
  while (1) {
2229
1924
  switch (_context.prev = _context.next) {
2230
1925
  case 0:
2231
1926
  _context.next = 2;
2232
1927
  return oroClient.getGrants();
2233
-
2234
1928
  case 2:
2235
1929
  grants = _context.sent;
2236
1930
  filteredGrants = [];
2237
1931
  _iterator = _createForOfIteratorHelperLoose(grants);
2238
-
2239
1932
  case 5:
2240
1933
  if ((_step = _iterator()).done) {
2241
1934
  _context.next = 13;
2242
1935
  break;
2243
1936
  }
2244
-
2245
1937
  grant = _step.value;
2246
1938
  _context.next = 9;
2247
1939
  return oroClient.vaultClient.lockboxMetadataGet(grant.lockboxUuid, ['consultationId'], [], {
2248
1940
  category: MetadataCategory.Consultation,
2249
1941
  consultationId: filter.consultationId
2250
1942
  });
2251
-
2252
1943
  case 9:
2253
1944
  consultationIdExistsInMetadata = _context.sent;
2254
1945
  // If there are entries in the metadata, it means that the consult exists in the lockbox
2255
1946
  if (consultationIdExistsInMetadata[0].length >= 0) filteredGrants.push(grant);
2256
-
2257
1947
  case 11:
2258
1948
  _context.next = 5;
2259
1949
  break;
2260
-
2261
1950
  case 13:
2262
1951
  return _context.abrupt("return", filteredGrants);
2263
-
2264
1952
  case 14:
2265
1953
  case "end":
2266
1954
  return _context.stop();
@@ -2290,10 +1978,7 @@ var OroClient = /*#__PURE__*/function () {
2290
1978
  /**
2291
1979
  * clears the vaultIndex and cached metadata grants
2292
1980
  */
2293
-
2294
-
2295
1981
  var _proto = OroClient.prototype;
2296
-
2297
1982
  _proto.cleanIndex =
2298
1983
  /*#__PURE__*/
2299
1984
  function () {
@@ -2304,7 +1989,6 @@ var OroClient = /*#__PURE__*/function () {
2304
1989
  case 0:
2305
1990
  this.cachedMetadataGrants = {};
2306
1991
  this.cachedManifest = {};
2307
-
2308
1992
  case 2:
2309
1993
  case "end":
2310
1994
  return _context.stop();
@@ -2312,11 +1996,9 @@ var OroClient = /*#__PURE__*/function () {
2312
1996
  }
2313
1997
  }, _callee, this);
2314
1998
  }));
2315
-
2316
1999
  function cleanIndex() {
2317
2000
  return _cleanIndex.apply(this, arguments);
2318
2001
  }
2319
-
2320
2002
  return cleanIndex;
2321
2003
  }()
2322
2004
  /**
@@ -2331,7 +2013,6 @@ var OroClient = /*#__PURE__*/function () {
2331
2013
  * @returns
2332
2014
  */
2333
2015
  ;
2334
-
2335
2016
  _proto.signUp =
2336
2017
  /*#__PURE__*/
2337
2018
  function () {
@@ -2360,18 +2041,14 @@ var OroClient = /*#__PURE__*/function () {
2360
2041
  };
2361
2042
  _context2.next = 9;
2362
2043
  return this.guardClient.identityCreate(signupRequest);
2363
-
2364
2044
  case 9:
2365
2045
  identity = _context2.sent;
2366
-
2367
2046
  if (identity.recoveryLogin) {
2368
2047
  //Ensure we can recover from a page reload
2369
2048
  symetricEncryptor = this.toolbox.CryptoChaCha.fromPassphrase(identity.recoveryLogin);
2370
2049
  sessionStorage.setItem(sessionStorePrivateKeyName(identity.id), symetricEncryptor.bytesEncryptToBase64Payload(privateKey));
2371
2050
  }
2372
-
2373
2051
  return _context2.abrupt("return", identity);
2374
-
2375
2052
  case 12:
2376
2053
  case "end":
2377
2054
  return _context2.stop();
@@ -2379,11 +2056,9 @@ var OroClient = /*#__PURE__*/function () {
2379
2056
  }
2380
2057
  }, _callee2, this);
2381
2058
  }));
2382
-
2383
2059
  function signUp(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
2384
2060
  return _signUp.apply(this, arguments);
2385
2061
  }
2386
-
2387
2062
  return signUp;
2388
2063
  }()
2389
2064
  /**
@@ -2392,7 +2067,6 @@ var OroClient = /*#__PURE__*/function () {
2392
2067
  * @returns The identity related to confirmedEmail
2393
2068
  */
2394
2069
  ;
2395
-
2396
2070
  _proto.confirmEmail =
2397
2071
  /*#__PURE__*/
2398
2072
  function () {
@@ -2407,13 +2081,11 @@ var OroClient = /*#__PURE__*/function () {
2407
2081
  });
2408
2082
  _context3.next = 3;
2409
2083
  return this.guardClient.whoAmI();
2410
-
2411
2084
  case 3:
2412
2085
  claims = _context3.sent;
2413
2086
  return _context3.abrupt("return", this.guardClient.identityUpdate(claims.sub, {
2414
2087
  emailConfirmed: true
2415
2088
  }));
2416
-
2417
2089
  case 5:
2418
2090
  case "end":
2419
2091
  return _context3.stop();
@@ -2421,11 +2093,9 @@ var OroClient = /*#__PURE__*/function () {
2421
2093
  }
2422
2094
  }, _callee3, this);
2423
2095
  }));
2424
-
2425
2096
  function confirmEmail(_x8) {
2426
2097
  return _confirmEmail.apply(this, arguments);
2427
2098
  }
2428
-
2429
2099
  return confirmEmail;
2430
2100
  }()
2431
2101
  /**
@@ -2439,7 +2109,6 @@ var OroClient = /*#__PURE__*/function () {
2439
2109
  * @returns the user identity
2440
2110
  */
2441
2111
  ;
2442
-
2443
2112
  _proto.signIn =
2444
2113
  /*#__PURE__*/
2445
2114
  function () {
@@ -2458,23 +2127,18 @@ var OroClient = /*#__PURE__*/function () {
2458
2127
  };
2459
2128
  _context4.next = 4;
2460
2129
  return this.guardClient.authToken(tokenRequest);
2461
-
2462
2130
  case 4:
2463
2131
  _context4.next = 6;
2464
2132
  return this.guardClient.whoAmI();
2465
-
2466
2133
  case 6:
2467
2134
  userUuid = _context4.sent.sub;
2468
2135
  _context4.next = 9;
2469
2136
  return this.recoverPrivateKeyFromPassword(userUuid, password);
2470
-
2471
2137
  case 9:
2472
2138
  _context4.next = 11;
2473
2139
  return this.guardClient.identityGet(userUuid);
2474
-
2475
2140
  case 11:
2476
2141
  return _context4.abrupt("return", _context4.sent);
2477
-
2478
2142
  case 12:
2479
2143
  case "end":
2480
2144
  return _context4.stop();
@@ -2482,11 +2146,9 @@ var OroClient = /*#__PURE__*/function () {
2482
2146
  }
2483
2147
  }, _callee4, this);
2484
2148
  }));
2485
-
2486
2149
  function signIn(_x9, _x10, _x11, _x12) {
2487
2150
  return _signIn.apply(this, arguments);
2488
2151
  }
2489
-
2490
2152
  return signIn;
2491
2153
  }()
2492
2154
  /**
@@ -2494,7 +2156,6 @@ var OroClient = /*#__PURE__*/function () {
2494
2156
  * the private key in scope
2495
2157
  */
2496
2158
  ;
2497
-
2498
2159
  _proto.resumeSession =
2499
2160
  /*#__PURE__*/
2500
2161
  function () {
@@ -2506,28 +2167,22 @@ var OroClient = /*#__PURE__*/function () {
2506
2167
  case 0:
2507
2168
  _context5.next = 2;
2508
2169
  return this.guardClient.whoAmI();
2509
-
2510
2170
  case 2:
2511
2171
  id = _context5.sent.sub;
2512
2172
  recoveryPayload = sessionStorage.getItem(sessionStorePrivateKeyName(id));
2513
2173
  _context5.next = 6;
2514
2174
  return this.guardClient.identityGet(id);
2515
-
2516
2175
  case 6:
2517
2176
  recoveryKey = _context5.sent.recoveryLogin;
2518
-
2519
2177
  if (!(!recoveryKey || !recoveryPayload)) {
2520
2178
  _context5.next = 9;
2521
2179
  break;
2522
2180
  }
2523
-
2524
2181
  throw IncompleteAuthentication;
2525
-
2526
2182
  case 9:
2527
2183
  symmetricDecryptor = this.toolbox.CryptoChaCha.fromPassphrase(recoveryKey);
2528
2184
  privateKey = symmetricDecryptor.base64PayloadDecryptToBytes(recoveryPayload);
2529
2185
  this.rsa = this.toolbox.CryptoRSA.fromKey(privateKey);
2530
-
2531
2186
  case 12:
2532
2187
  case "end":
2533
2188
  return _context5.stop();
@@ -2535,11 +2190,9 @@ var OroClient = /*#__PURE__*/function () {
2535
2190
  }
2536
2191
  }, _callee5, this);
2537
2192
  }));
2538
-
2539
2193
  function resumeSession() {
2540
2194
  return _resumeSession.apply(this, arguments);
2541
2195
  }
2542
-
2543
2196
  return resumeSession;
2544
2197
  }()
2545
2198
  /**
@@ -2550,16 +2203,13 @@ var OroClient = /*#__PURE__*/function () {
2550
2203
  * @calls authenticationCallback if rsa is not set
2551
2204
  */
2552
2205
  ;
2553
-
2554
2206
  _proto.localEncryptToJsonPayload = function localEncryptToJsonPayload(value) {
2555
2207
  if (!this.rsa) {
2556
2208
  if (this.authenticationCallback) {
2557
2209
  this.authenticationCallback(new IncompleteAuthentication());
2558
2210
  }
2559
-
2560
2211
  throw new IncompleteAuthentication();
2561
2212
  }
2562
-
2563
2213
  var chaChaKey = new this.toolbox.CryptoChaCha();
2564
2214
  var encryptedData = chaChaKey.jsonEncryptToBase64Payload(value);
2565
2215
  var encryptedKey = this.toolbox.encodeToBase64(this.rsa.encryptToBytes(chaChaKey.key()));
@@ -2574,30 +2224,23 @@ var OroClient = /*#__PURE__*/function () {
2574
2224
  * @returns a decrypted Object
2575
2225
  * @throws IncompleteAuthentication if rsa is not set
2576
2226
  * @calls authenticationCallback if rsa is not set
2577
- */
2578
- ;
2579
-
2227
+ */;
2580
2228
  _proto.localDecryptJsonPayload = function localDecryptJsonPayload(_ref) {
2581
2229
  var encryptedKey = _ref.encryptedKey,
2582
- encryptedData = _ref.encryptedData;
2583
-
2230
+ encryptedData = _ref.encryptedData;
2584
2231
  if (!this.rsa) {
2585
2232
  if (this.authenticationCallback) {
2586
2233
  this.authenticationCallback(new IncompleteAuthentication());
2587
2234
  }
2588
-
2589
2235
  throw new IncompleteAuthentication();
2590
2236
  }
2591
-
2592
2237
  var chaChaKey = this.rsa.base64DecryptToBytes(encryptedKey);
2593
2238
  var decryptedData = this.toolbox.CryptoChaCha.fromKey(chaChaKey).base64PayloadDecryptToJson(encryptedData);
2594
2239
  return decryptedData;
2595
2240
  }
2596
2241
  /**
2597
2242
  * Effectively kills your "session"
2598
- */
2599
- ;
2600
-
2243
+ */;
2601
2244
  _proto.signOut =
2602
2245
  /*#__PURE__*/
2603
2246
  function () {
@@ -2614,7 +2257,6 @@ var OroClient = /*#__PURE__*/function () {
2614
2257
  });
2615
2258
  _context6.next = 5;
2616
2259
  return this.guardClient.authLogout();
2617
-
2618
2260
  case 5:
2619
2261
  case "end":
2620
2262
  return _context6.stop();
@@ -2622,11 +2264,9 @@ var OroClient = /*#__PURE__*/function () {
2622
2264
  }
2623
2265
  }, _callee6, this);
2624
2266
  }));
2625
-
2626
2267
  function signOut() {
2627
2268
  return _signOut.apply(this, arguments);
2628
2269
  }
2629
-
2630
2270
  return signOut;
2631
2271
  }()
2632
2272
  /**
@@ -2649,7 +2289,6 @@ var OroClient = /*#__PURE__*/function () {
2649
2289
  * @returns
2650
2290
  */
2651
2291
  ;
2652
-
2653
2292
  _proto.registerPatient =
2654
2293
  /*#__PURE__*/
2655
2294
  function () {
@@ -2661,17 +2300,13 @@ var OroClient = /*#__PURE__*/function () {
2661
2300
  if (indexSearch === void 0) {
2662
2301
  indexSearch = true;
2663
2302
  }
2664
-
2665
2303
  if (this.rsa) {
2666
2304
  _context7.next = 3;
2667
2305
  break;
2668
2306
  }
2669
-
2670
2307
  throw IncompleteAuthentication;
2671
-
2672
2308
  case 3:
2673
2309
  return _context7.abrupt("return", registerPatient(patientUuid, consult, workflow, this, this.toolbox.uuid(), recoveryQA, indexSearch, onProgress));
2674
-
2675
2310
  case 4:
2676
2311
  case "end":
2677
2312
  return _context7.stop();
@@ -2679,11 +2314,9 @@ var OroClient = /*#__PURE__*/function () {
2679
2314
  }
2680
2315
  }, _callee7, this);
2681
2316
  }));
2682
-
2683
2317
  function registerPatient$1(_x13, _x14, _x15, _x16, _x17, _x18) {
2684
2318
  return _registerPatient2.apply(this, arguments);
2685
2319
  }
2686
-
2687
2320
  return registerPatient$1;
2688
2321
  }()
2689
2322
  /**
@@ -2697,7 +2330,6 @@ var OroClient = /*#__PURE__*/function () {
2697
2330
  * @returns
2698
2331
  */
2699
2332
  ;
2700
-
2701
2333
  _proto.createRefill =
2702
2334
  /*#__PURE__*/
2703
2335
  function () {
@@ -2710,12 +2342,9 @@ var OroClient = /*#__PURE__*/function () {
2710
2342
  _context8.next = 2;
2711
2343
  break;
2712
2344
  }
2713
-
2714
2345
  throw IncompleteAuthentication;
2715
-
2716
2346
  case 2:
2717
2347
  return _context8.abrupt("return", createRefill(consult, populatedRefillWorkflow, this));
2718
-
2719
2348
  case 3:
2720
2349
  case "end":
2721
2350
  return _context8.stop();
@@ -2723,11 +2352,9 @@ var OroClient = /*#__PURE__*/function () {
2723
2352
  }
2724
2353
  }, _callee8, this);
2725
2354
  }));
2726
-
2727
2355
  function createRefill$1(_x19, _x20) {
2728
2356
  return _createRefill2.apply(this, arguments);
2729
2357
  }
2730
-
2731
2358
  return createRefill$1;
2732
2359
  }()
2733
2360
  /**
@@ -2735,14 +2362,12 @@ var OroClient = /*#__PURE__*/function () {
2735
2362
  * Then updates the index for the current user with the lockbox consult relationship
2736
2363
  */
2737
2364
  ;
2738
-
2739
2365
  _proto.forceUpdateIndexEntries =
2740
2366
  /*#__PURE__*/
2741
2367
  function () {
2742
2368
  var _forceUpdateIndexEntries = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
2743
2369
  var _this = this,
2744
- _this$vaultIndexAdd;
2745
-
2370
+ _this$vaultIndexAdd;
2746
2371
  var grants, indexConsultLockbox;
2747
2372
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
2748
2373
  while (1) {
@@ -2750,7 +2375,6 @@ var OroClient = /*#__PURE__*/function () {
2750
2375
  case 0:
2751
2376
  _context10.next = 2;
2752
2377
  return this.getGrants();
2753
-
2754
2378
  case 2:
2755
2379
  grants = _context10.sent;
2756
2380
  _context10.next = 5;
@@ -2780,10 +2404,8 @@ var OroClient = /*#__PURE__*/function () {
2780
2404
  })["catch"](function () {
2781
2405
  return [];
2782
2406
  });
2783
-
2784
2407
  case 2:
2785
2408
  return _context9.abrupt("return", _context9.sent);
2786
-
2787
2409
  case 3:
2788
2410
  case "end":
2789
2411
  return _context9.stop();
@@ -2791,14 +2413,12 @@ var OroClient = /*#__PURE__*/function () {
2791
2413
  }
2792
2414
  }, _callee9);
2793
2415
  }));
2794
-
2795
2416
  return function (_x21) {
2796
2417
  return _ref2.apply(this, arguments);
2797
2418
  };
2798
2419
  }())).then(function (consults) {
2799
2420
  return consults.flat();
2800
2421
  });
2801
-
2802
2422
  case 5:
2803
2423
  indexConsultLockbox = _context10.sent;
2804
2424
  this.vaultIndexAdd((_this$vaultIndexAdd = {}, _this$vaultIndexAdd[IndexKey.Consultation] = indexConsultLockbox, _this$vaultIndexAdd)).then(function () {
@@ -2806,7 +2426,6 @@ var OroClient = /*#__PURE__*/function () {
2806
2426
  })["catch"](function () {
2807
2427
  return console.error('The index failed to update!');
2808
2428
  });
2809
-
2810
2429
  case 7:
2811
2430
  case "end":
2812
2431
  return _context10.stop();
@@ -2814,11 +2433,9 @@ var OroClient = /*#__PURE__*/function () {
2814
2433
  }
2815
2434
  }, _callee10, this);
2816
2435
  }));
2817
-
2818
2436
  function forceUpdateIndexEntries() {
2819
2437
  return _forceUpdateIndexEntries.apply(this, arguments);
2820
2438
  }
2821
-
2822
2439
  return forceUpdateIndexEntries;
2823
2440
  }()
2824
2441
  /**
@@ -2828,13 +2445,11 @@ var OroClient = /*#__PURE__*/function () {
2828
2445
  * @param indexOwnerUuid
2829
2446
  */
2830
2447
  ;
2831
-
2832
2448
  _proto.vaultIndexAdd =
2833
2449
  /*#__PURE__*/
2834
2450
  function () {
2835
2451
  var _vaultIndexAdd = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(entries, indexOwnerUuid) {
2836
2452
  var rsaPub, base64IndexOwnerPubKey, encryptedIndex, _i, _Object$keys, keyString, key;
2837
-
2838
2453
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
2839
2454
  while (1) {
2840
2455
  switch (_context11.prev = _context11.next) {
@@ -2843,43 +2458,34 @@ var OroClient = /*#__PURE__*/function () {
2843
2458
  _context11.next = 2;
2844
2459
  break;
2845
2460
  }
2846
-
2847
2461
  throw IncompleteAuthentication;
2848
-
2849
2462
  case 2:
2850
2463
  if (!indexOwnerUuid) {
2851
2464
  _context11.next = 9;
2852
2465
  break;
2853
2466
  }
2854
-
2855
2467
  _context11.next = 5;
2856
2468
  return this.guardClient.identityGet(indexOwnerUuid);
2857
-
2858
2469
  case 5:
2859
2470
  base64IndexOwnerPubKey = _context11.sent.publicKey;
2860
2471
  rsaPub = this.toolbox.decodeFromBase64(base64IndexOwnerPubKey);
2861
2472
  _context11.next = 10;
2862
2473
  break;
2863
-
2864
2474
  case 9:
2865
2475
  rsaPub = this.rsa["public"]();
2866
-
2867
2476
  case 10:
2868
2477
  encryptedIndex = {};
2869
2478
  _i = 0, _Object$keys = Object.keys(entries);
2870
-
2871
2479
  case 12:
2872
2480
  if (!(_i < _Object$keys.length)) {
2873
2481
  _context11.next = 23;
2874
2482
  break;
2875
2483
  }
2876
-
2877
2484
  keyString = _Object$keys[_i];
2878
2485
  key = keyString;
2879
2486
  _context11.t0 = key;
2880
2487
  _context11.next = _context11.t0 === IndexKey.ConsultationLockbox ? 18 : 20;
2881
2488
  break;
2882
-
2883
2489
  case 18:
2884
2490
  encryptedIndex[key] = entries[key].map(function (e) {
2885
2491
  return _extends({}, e, {
@@ -2897,16 +2503,13 @@ var OroClient = /*#__PURE__*/function () {
2897
2503
  };
2898
2504
  });
2899
2505
  return _context11.abrupt("break", 20);
2900
-
2901
2506
  case 20:
2902
2507
  _i++;
2903
2508
  _context11.next = 12;
2904
2509
  break;
2905
-
2906
2510
  case 23:
2907
2511
  _context11.next = 25;
2908
2512
  return this.vaultClient.vaultIndexPut(encryptedIndex, indexOwnerUuid);
2909
-
2910
2513
  case 25:
2911
2514
  case "end":
2912
2515
  return _context11.stop();
@@ -2914,11 +2517,9 @@ var OroClient = /*#__PURE__*/function () {
2914
2517
  }
2915
2518
  }, _callee11, this);
2916
2519
  }));
2917
-
2918
2520
  function vaultIndexAdd(_x22, _x23) {
2919
2521
  return _vaultIndexAdd.apply(this, arguments);
2920
2522
  }
2921
-
2922
2523
  return vaultIndexAdd;
2923
2524
  }()
2924
2525
  /**
@@ -2929,7 +2530,6 @@ var OroClient = /*#__PURE__*/function () {
2929
2530
  * @param lockboxOwnerUuid the lockbox owner (ignored if lockbox is owned by self)
2930
2531
  */
2931
2532
  ;
2932
-
2933
2533
  _proto.grantLockbox =
2934
2534
  /*#__PURE__*/
2935
2535
  function () {
@@ -2943,18 +2543,14 @@ var OroClient = /*#__PURE__*/function () {
2943
2543
  _context12.next = 2;
2944
2544
  break;
2945
2545
  }
2946
-
2947
2546
  throw IncompleteAuthentication;
2948
-
2949
2547
  case 2:
2950
2548
  _context12.next = 4;
2951
2549
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
2952
-
2953
2550
  case 4:
2954
2551
  secret = _context12.sent.key();
2955
2552
  _context12.next = 7;
2956
2553
  return this.guardClient.identityGet(granteeUuid);
2957
-
2958
2554
  case 7:
2959
2555
  base64GranteePublicKey = _context12.sent.publicKey;
2960
2556
  granteePublicKey = this.toolbox.decodeFromBase64(base64GranteePublicKey);
@@ -2965,7 +2561,6 @@ var OroClient = /*#__PURE__*/function () {
2965
2561
  };
2966
2562
  _context12.next = 13;
2967
2563
  return this.vaultClient.lockboxGrant(lockboxUuid, request, lockboxOwnerUuid);
2968
-
2969
2564
  case 13:
2970
2565
  case "end":
2971
2566
  return _context12.stop();
@@ -2973,11 +2568,9 @@ var OroClient = /*#__PURE__*/function () {
2973
2568
  }
2974
2569
  }, _callee12, this);
2975
2570
  }));
2976
-
2977
2571
  function grantLockbox(_x24, _x25, _x26) {
2978
2572
  return _grantLockbox.apply(this, arguments);
2979
2573
  }
2980
-
2981
2574
  return grantLockbox;
2982
2575
  }()
2983
2576
  /**
@@ -2991,7 +2584,6 @@ var OroClient = /*#__PURE__*/function () {
2991
2584
  * @returns the data uuid
2992
2585
  */
2993
2586
  ;
2994
-
2995
2587
  _proto.createMessageData =
2996
2588
  /*#__PURE__*/
2997
2589
  function () {
@@ -3005,20 +2597,16 @@ var OroClient = /*#__PURE__*/function () {
3005
2597
  _context13.next = 2;
3006
2598
  break;
3007
2599
  }
3008
-
3009
2600
  throw IncompleteAuthentication;
3010
-
3011
2601
  case 2:
3012
2602
  _context13.next = 4;
3013
2603
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
3014
-
3015
2604
  case 4:
3016
2605
  symmetricEncryptor = _context13.sent;
3017
2606
  encryptedData = symmetricEncryptor.jsonEncryptToBase64Payload(message);
3018
2607
  _context13.t0 = symmetricEncryptor;
3019
2608
  _context13.next = 9;
3020
2609
  return this.guardClient.whoAmI();
3021
-
3022
2610
  case 9:
3023
2611
  _context13.t1 = _context13.sent.sub;
3024
2612
  _context13.t2 = {
@@ -3037,7 +2625,6 @@ var OroClient = /*#__PURE__*/function () {
3037
2625
  privateMetadata: encryptedPrivateMeta
3038
2626
  };
3039
2627
  return _context13.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3040
-
3041
2628
  case 15:
3042
2629
  case "end":
3043
2630
  return _context13.stop();
@@ -3045,11 +2632,9 @@ var OroClient = /*#__PURE__*/function () {
3045
2632
  }
3046
2633
  }, _callee13, this);
3047
2634
  }));
3048
-
3049
2635
  function createMessageData(_x27, _x28, _x29, _x30, _x31) {
3050
2636
  return _createMessageData.apply(this, arguments);
3051
2637
  }
3052
-
3053
2638
  return createMessageData;
3054
2639
  }()
3055
2640
  /**
@@ -3063,7 +2648,6 @@ var OroClient = /*#__PURE__*/function () {
3063
2648
  * @returns the data uuid
3064
2649
  */
3065
2650
  ;
3066
-
3067
2651
  _proto.createMessageAttachmentData =
3068
2652
  /*#__PURE__*/
3069
2653
  function () {
@@ -3077,20 +2661,16 @@ var OroClient = /*#__PURE__*/function () {
3077
2661
  _context14.next = 2;
3078
2662
  break;
3079
2663
  }
3080
-
3081
2664
  throw IncompleteAuthentication;
3082
-
3083
2665
  case 2:
3084
2666
  _context14.next = 4;
3085
2667
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
3086
-
3087
2668
  case 4:
3088
2669
  symmetricEncryptor = _context14.sent;
3089
2670
  _context14.t0 = symmetricEncryptor;
3090
2671
  _context14.t1 = Uint8Array;
3091
2672
  _context14.next = 9;
3092
2673
  return data.arrayBuffer();
3093
-
3094
2674
  case 9:
3095
2675
  _context14.t2 = _context14.sent;
3096
2676
  _context14.t3 = new _context14.t1(_context14.t2);
@@ -3098,7 +2678,6 @@ var OroClient = /*#__PURE__*/function () {
3098
2678
  _context14.t4 = symmetricEncryptor;
3099
2679
  _context14.next = 15;
3100
2680
  return this.guardClient.whoAmI();
3101
-
3102
2681
  case 15:
3103
2682
  _context14.t5 = _context14.sent.sub;
3104
2683
  _context14.t6 = data.name;
@@ -3123,7 +2702,6 @@ var OroClient = /*#__PURE__*/function () {
3123
2702
  privateMetadata: encryptedPrivateMeta
3124
2703
  };
3125
2704
  return _context14.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3126
-
3127
2705
  case 24:
3128
2706
  case "end":
3129
2707
  return _context14.stop();
@@ -3131,11 +2709,9 @@ var OroClient = /*#__PURE__*/function () {
3131
2709
  }
3132
2710
  }, _callee14, this);
3133
2711
  }));
3134
-
3135
2712
  function createMessageAttachmentData(_x32, _x33, _x34, _x35, _x36) {
3136
2713
  return _createMessageAttachmentData.apply(this, arguments);
3137
2714
  }
3138
-
3139
2715
  return createMessageAttachmentData;
3140
2716
  }()
3141
2717
  /**
@@ -3151,7 +2727,6 @@ var OroClient = /*#__PURE__*/function () {
3151
2727
  * @returns the data uuid
3152
2728
  */
3153
2729
  ;
3154
-
3155
2730
  _proto.createConsultationAttachmentData =
3156
2731
  /*#__PURE__*/
3157
2732
  function () {
@@ -3165,21 +2740,17 @@ var OroClient = /*#__PURE__*/function () {
3165
2740
  withNotification: false
3166
2741
  };
3167
2742
  }
3168
-
3169
2743
  if (this.rsa) {
3170
2744
  _context15.next = 3;
3171
2745
  break;
3172
2746
  }
3173
-
3174
2747
  throw IncompleteAuthentication;
3175
-
3176
2748
  case 3:
3177
2749
  _context15.t0 = this;
3178
2750
  _context15.t1 = lockboxUuid;
3179
2751
  _context15.t2 = Uint8Array;
3180
2752
  _context15.next = 8;
3181
2753
  return data.arrayBuffer();
3182
-
3183
2754
  case 8:
3184
2755
  _context15.t3 = _context15.sent;
3185
2756
  _context15.t4 = new _context15.t2(_context15.t3);
@@ -3191,7 +2762,6 @@ var OroClient = /*#__PURE__*/function () {
3191
2762
  };
3192
2763
  _context15.next = 13;
3193
2764
  return this.guardClient.whoAmI();
3194
-
3195
2765
  case 13:
3196
2766
  _context15.t6 = _context15.sent.sub;
3197
2767
  _context15.t7 = data.name;
@@ -3203,7 +2773,6 @@ var OroClient = /*#__PURE__*/function () {
3203
2773
  _context15.t10 = previousDataUuid;
3204
2774
  _context15.t11 = options;
3205
2775
  return _context15.abrupt("return", _context15.t0.createBytesData.call(_context15.t0, _context15.t1, _context15.t4, _context15.t5, _context15.t8, _context15.t9, _context15.t10, _context15.t11));
3206
-
3207
2776
  case 20:
3208
2777
  case "end":
3209
2778
  return _context15.stop();
@@ -3211,11 +2780,9 @@ var OroClient = /*#__PURE__*/function () {
3211
2780
  }
3212
2781
  }, _callee15, this);
3213
2782
  }));
3214
-
3215
2783
  function createConsultationAttachmentData(_x37, _x38, _x39, _x40, _x41, _x42, _x43) {
3216
2784
  return _createConsultationAttachmentData.apply(this, arguments);
3217
2785
  }
3218
-
3219
2786
  return createConsultationAttachmentData;
3220
2787
  }()
3221
2788
  /**
@@ -3231,7 +2798,6 @@ var OroClient = /*#__PURE__*/function () {
3231
2798
  * @returns the data uuid
3232
2799
  */
3233
2800
  ;
3234
-
3235
2801
  _proto.createJsonData =
3236
2802
  /*#__PURE__*/
3237
2803
  function () {
@@ -3246,18 +2812,14 @@ var OroClient = /*#__PURE__*/function () {
3246
2812
  withNotification: false
3247
2813
  };
3248
2814
  }
3249
-
3250
2815
  if (this.rsa) {
3251
2816
  _context16.next = 3;
3252
2817
  break;
3253
2818
  }
3254
-
3255
2819
  throw IncompleteAuthentication;
3256
-
3257
2820
  case 3:
3258
2821
  _context16.next = 5;
3259
2822
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
3260
-
3261
2823
  case 5:
3262
2824
  symmetricEncryptor = _context16.sent;
3263
2825
  encryptedData = symmetricEncryptor.jsonEncryptToBase64Payload(data);
@@ -3267,17 +2829,13 @@ var OroClient = /*#__PURE__*/function () {
3267
2829
  publicMetadata: meta,
3268
2830
  privateMetadata: encryptedPrivateMeta
3269
2831
  };
3270
-
3271
2832
  if (!options.withNotification) {
3272
2833
  _context16.next = 13;
3273
2834
  break;
3274
2835
  }
3275
-
3276
2836
  return _context16.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3277
-
3278
2837
  case 13:
3279
2838
  return _context16.abrupt("return", this.vaultClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3280
-
3281
2839
  case 14:
3282
2840
  case "end":
3283
2841
  return _context16.stop();
@@ -3285,11 +2843,9 @@ var OroClient = /*#__PURE__*/function () {
3285
2843
  }
3286
2844
  }, _callee16, this);
3287
2845
  }));
3288
-
3289
2846
  function createJsonData(_x44, _x45, _x46, _x47, _x48, _x49, _x50) {
3290
2847
  return _createJsonData.apply(this, arguments);
3291
2848
  }
3292
-
3293
2849
  return createJsonData;
3294
2850
  }()
3295
2851
  /**
@@ -3303,7 +2859,6 @@ var OroClient = /*#__PURE__*/function () {
3303
2859
  * @returns the data uuid
3304
2860
  */
3305
2861
  ;
3306
-
3307
2862
  _proto.getOrInsertJsonData =
3308
2863
  /*#__PURE__*/
3309
2864
  function () {
@@ -3319,34 +2874,28 @@ var OroClient = /*#__PURE__*/function () {
3319
2874
  forceReplace: false
3320
2875
  };
3321
2876
  }
3322
-
3323
2877
  _context17.next = 3;
3324
2878
  return this.vaultClient.lockboxManifestGet(lockboxUuid, publicMetadata);
3325
-
3326
2879
  case 3:
3327
2880
  manifest = _context17.sent;
3328
-
3329
2881
  if (!(!options.forceReplace && manifest.length > 0)) {
3330
2882
  _context17.next = 9;
3331
2883
  break;
3332
2884
  }
3333
-
3334
2885
  console.log("The data for " + JSON.stringify(publicMetadata) + " already exist");
3335
2886
  return _context17.abrupt("return", manifest[0].dataUuid);
3336
-
3337
2887
  case 9:
3338
2888
  _context17.next = 11;
3339
- return this.createJsonData(lockboxUuid, data, publicMetadata, privateMetadata, undefined, // if forceReplace and data already exist, then replace data. Otherwise insert it
2889
+ return this.createJsonData(lockboxUuid, data, publicMetadata, privateMetadata, undefined,
2890
+ // if forceReplace and data already exist, then replace data. Otherwise insert it
3340
2891
  options.forceReplace && manifest.length > 0 ? manifest[0].dataUuid : undefined, {
3341
2892
  withNotification: options.withNotification
3342
2893
  })["catch"](function (err) {
3343
2894
  console.error("Error while upserting data " + JSON.stringify(publicMetadata) + " data", err);
3344
2895
  throw err;
3345
2896
  });
3346
-
3347
2897
  case 11:
3348
2898
  return _context17.abrupt("return", _context17.sent.dataUuid);
3349
-
3350
2899
  case 12:
3351
2900
  case "end":
3352
2901
  return _context17.stop();
@@ -3354,11 +2903,9 @@ var OroClient = /*#__PURE__*/function () {
3354
2903
  }
3355
2904
  }, _callee17, this);
3356
2905
  }));
3357
-
3358
2906
  function getOrInsertJsonData(_x51, _x52, _x53, _x54, _x55) {
3359
2907
  return _getOrInsertJsonData.apply(this, arguments);
3360
2908
  }
3361
-
3362
2909
  return getOrInsertJsonData;
3363
2910
  }()
3364
2911
  /**
@@ -3374,7 +2921,6 @@ var OroClient = /*#__PURE__*/function () {
3374
2921
  * @returns the data uuid
3375
2922
  */
3376
2923
  ;
3377
-
3378
2924
  _proto.createBytesData =
3379
2925
  /*#__PURE__*/
3380
2926
  function () {
@@ -3389,18 +2935,14 @@ var OroClient = /*#__PURE__*/function () {
3389
2935
  withNotification: false
3390
2936
  };
3391
2937
  }
3392
-
3393
2938
  if (this.rsa) {
3394
2939
  _context18.next = 3;
3395
2940
  break;
3396
2941
  }
3397
-
3398
2942
  throw IncompleteAuthentication;
3399
-
3400
2943
  case 3:
3401
2944
  _context18.next = 5;
3402
2945
  return this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid);
3403
-
3404
2946
  case 5:
3405
2947
  symmetricEncryptor = _context18.sent;
3406
2948
  encryptedData = symmetricEncryptor.bytesEncryptToBase64Payload(data);
@@ -3410,17 +2952,13 @@ var OroClient = /*#__PURE__*/function () {
3410
2952
  publicMetadata: meta,
3411
2953
  privateMetadata: encryptedPrivateMeta
3412
2954
  };
3413
-
3414
2955
  if (!options.withNotification) {
3415
2956
  _context18.next = 13;
3416
2957
  break;
3417
2958
  }
3418
-
3419
2959
  return _context18.abrupt("return", this.tellerClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3420
-
3421
2960
  case 13:
3422
2961
  return _context18.abrupt("return", this.vaultClient.lockboxDataStore(lockboxUuid, request, lockboxOwnerUuid, previousDataUuid));
3423
-
3424
2962
  case 14:
3425
2963
  case "end":
3426
2964
  return _context18.stop();
@@ -3428,11 +2966,9 @@ var OroClient = /*#__PURE__*/function () {
3428
2966
  }
3429
2967
  }, _callee18, this);
3430
2968
  }));
3431
-
3432
2969
  function createBytesData(_x56, _x57, _x58, _x59, _x60, _x61, _x62) {
3433
2970
  return _createBytesData.apply(this, arguments);
3434
2971
  }
3435
-
3436
2972
  return createBytesData;
3437
2973
  }()
3438
2974
  /**
@@ -3447,13 +2983,11 @@ var OroClient = /*#__PURE__*/function () {
3447
2983
  * @returns the data specified by the generic type <T>
3448
2984
  */
3449
2985
  ;
3450
-
3451
2986
  _proto.getJsonData =
3452
2987
  /*#__PURE__*/
3453
2988
  function () {
3454
2989
  var _getJsonData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(lockboxUuid, dataUuid, lockboxOwnerUuid) {
3455
2990
  var _yield$Promise$all, encryptedPayload, symmetricDecryptor;
3456
-
3457
2991
  return _regeneratorRuntime().wrap(function _callee19$(_context19) {
3458
2992
  while (1) {
3459
2993
  switch (_context19.prev = _context19.next) {
@@ -3462,19 +2996,15 @@ var OroClient = /*#__PURE__*/function () {
3462
2996
  _context19.next = 2;
3463
2997
  break;
3464
2998
  }
3465
-
3466
2999
  throw IncompleteAuthentication;
3467
-
3468
3000
  case 2:
3469
3001
  _context19.next = 4;
3470
3002
  return Promise.all([this.vaultClient.lockboxDataGet(lockboxUuid, dataUuid, lockboxOwnerUuid), this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid)]);
3471
-
3472
3003
  case 4:
3473
3004
  _yield$Promise$all = _context19.sent;
3474
3005
  encryptedPayload = _yield$Promise$all[0];
3475
3006
  symmetricDecryptor = _yield$Promise$all[1];
3476
3007
  return _context19.abrupt("return", symmetricDecryptor.base64PayloadDecryptToJson(encryptedPayload.data));
3477
-
3478
3008
  case 8:
3479
3009
  case "end":
3480
3010
  return _context19.stop();
@@ -3482,11 +3012,9 @@ var OroClient = /*#__PURE__*/function () {
3482
3012
  }
3483
3013
  }, _callee19, this);
3484
3014
  }));
3485
-
3486
3015
  function getJsonData(_x63, _x64, _x65) {
3487
3016
  return _getJsonData.apply(this, arguments);
3488
3017
  }
3489
-
3490
3018
  return getJsonData;
3491
3019
  }()
3492
3020
  /**
@@ -3497,13 +3025,11 @@ var OroClient = /*#__PURE__*/function () {
3497
3025
  * @returns the bytes data
3498
3026
  */
3499
3027
  ;
3500
-
3501
3028
  _proto.getBytesData =
3502
3029
  /*#__PURE__*/
3503
3030
  function () {
3504
3031
  var _getBytesData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(lockboxUuid, dataUuid, lockboxOwnerUuid) {
3505
3032
  var _yield$Promise$all2, encryptedPayload, symmetricDecryptor;
3506
-
3507
3033
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
3508
3034
  while (1) {
3509
3035
  switch (_context20.prev = _context20.next) {
@@ -3512,19 +3038,15 @@ var OroClient = /*#__PURE__*/function () {
3512
3038
  _context20.next = 2;
3513
3039
  break;
3514
3040
  }
3515
-
3516
3041
  throw IncompleteAuthentication;
3517
-
3518
3042
  case 2:
3519
3043
  _context20.next = 4;
3520
3044
  return Promise.all([this.vaultClient.lockboxDataGet(lockboxUuid, dataUuid, lockboxOwnerUuid), this.getCachedSecretCryptor(lockboxUuid, lockboxOwnerUuid)]);
3521
-
3522
3045
  case 4:
3523
3046
  _yield$Promise$all2 = _context20.sent;
3524
3047
  encryptedPayload = _yield$Promise$all2[0];
3525
3048
  symmetricDecryptor = _yield$Promise$all2[1];
3526
3049
  return _context20.abrupt("return", symmetricDecryptor.base64PayloadDecryptToBytes(encryptedPayload.data));
3527
-
3528
3050
  case 8:
3529
3051
  case "end":
3530
3052
  return _context20.stop();
@@ -3532,11 +3054,9 @@ var OroClient = /*#__PURE__*/function () {
3532
3054
  }
3533
3055
  }, _callee20, this);
3534
3056
  }));
3535
-
3536
3057
  function getBytesData(_x66, _x67, _x68) {
3537
3058
  return _getBytesData.apply(this, arguments);
3538
3059
  }
3539
-
3540
3060
  return getBytesData;
3541
3061
  }()
3542
3062
  /**
@@ -3550,7 +3070,6 @@ var OroClient = /*#__PURE__*/function () {
3550
3070
  * @returns decrypted lockboxes granted to user
3551
3071
  */
3552
3072
  ;
3553
-
3554
3073
  _proto.getGrants =
3555
3074
  /*#__PURE__*/
3556
3075
  function () {
@@ -3564,33 +3083,24 @@ var OroClient = /*#__PURE__*/function () {
3564
3083
  _context21.next = 2;
3565
3084
  break;
3566
3085
  }
3567
-
3568
3086
  throw IncompleteAuthentication;
3569
-
3570
3087
  case 2:
3571
3088
  filterString = JSON.stringify(filter); // retrieves cached grants
3572
-
3573
3089
  if (!this.cachedMetadataGrants[filterString]) {
3574
3090
  _context21.next = 5;
3575
3091
  break;
3576
3092
  }
3577
-
3578
3093
  return _context21.abrupt("return", this.cachedMetadataGrants[filterString]);
3579
-
3580
3094
  case 5:
3581
3095
  _context21.next = 7;
3582
3096
  return this.getAccountRole();
3583
-
3584
3097
  case 7:
3585
3098
  currentAccountRole = _context21.sent;
3586
-
3587
3099
  if (!(currentAccountRole.length === 1 && currentAccountRole[0] === OtherRoleType.User)) {
3588
3100
  _context21.next = 10;
3589
3101
  break;
3590
3102
  }
3591
-
3592
3103
  return _context21.abrupt("return", []);
3593
-
3594
3104
  case 10:
3595
3105
  if (![OtherRoleType.Patient, OtherRoleType.User].every(function (requiredRole) {
3596
3106
  return currentAccountRole.includes(requiredRole);
@@ -3598,46 +3108,36 @@ var OroClient = /*#__PURE__*/function () {
3598
3108
  _context21.next = 26;
3599
3109
  break;
3600
3110
  }
3601
-
3602
3111
  if (!filter) {
3603
3112
  _context21.next = 17;
3604
3113
  break;
3605
3114
  }
3606
-
3607
3115
  _context21.next = 14;
3608
3116
  return filterGrantsWithLockboxMetadata(this, filter);
3609
-
3610
3117
  case 14:
3611
3118
  encryptedGrants = _context21.sent;
3612
3119
  _context21.next = 20;
3613
3120
  break;
3614
-
3615
3121
  case 17:
3616
3122
  _context21.next = 19;
3617
3123
  return this.vaultClient.grantsGet();
3618
-
3619
3124
  case 19:
3620
3125
  encryptedGrants = _context21.sent.grants;
3621
-
3622
3126
  case 20:
3623
3127
  _context21.next = 22;
3624
3128
  return decryptGrants(encryptedGrants, this.rsa);
3625
-
3626
3129
  case 22:
3627
3130
  decryptedGrants = _context21.sent;
3628
3131
  // sets the cached grant
3629
3132
  this.cachedMetadataGrants[filterString] = decryptedGrants;
3630
3133
  console.info('[sdk:grant] Found grant for patient');
3631
3134
  return _context21.abrupt("return", decryptedGrants);
3632
-
3633
3135
  case 26:
3634
3136
  if (filter) {
3635
3137
  _context21.next = 28;
3636
3138
  break;
3637
3139
  }
3638
-
3639
3140
  throw MissingGrantFilter;
3640
-
3641
3141
  case 28:
3642
3142
  _context21.next = 30;
3643
3143
  return this.vaultClient.vaultIndexGet([IndexKey.ConsultationLockbox], [filter.consultationId]).then(function (res) {
@@ -3646,23 +3146,18 @@ var OroClient = /*#__PURE__*/function () {
3646
3146
  console.error(e);
3647
3147
  return [];
3648
3148
  });
3649
-
3650
3149
  case 30:
3651
3150
  grantsByConsultLockbox = _context21.sent;
3652
3151
  decryptedConsults = decryptConsultLockboxGrants(grantsByConsultLockbox != null ? grantsByConsultLockbox : [], this.rsa);
3653
-
3654
3152
  if (!(decryptedConsults.length > 0)) {
3655
3153
  _context21.next = 36;
3656
3154
  break;
3657
3155
  }
3658
-
3659
3156
  console.info('[sdk:index] Grants found in user`s constant time secure index');
3660
3157
  this.cachedMetadataGrants[filterString] = decryptedConsults;
3661
3158
  return _context21.abrupt("return", this.cachedMetadataGrants[filterString]);
3662
-
3663
3159
  case 36:
3664
3160
  return _context21.abrupt("return", []);
3665
-
3666
3161
  case 37:
3667
3162
  case "end":
3668
3163
  return _context21.stop();
@@ -3670,11 +3165,9 @@ var OroClient = /*#__PURE__*/function () {
3670
3165
  }
3671
3166
  }, _callee21, this);
3672
3167
  }));
3673
-
3674
3168
  function getGrants(_x69) {
3675
3169
  return _getGrants.apply(this, arguments);
3676
3170
  }
3677
-
3678
3171
  return getGrants;
3679
3172
  }()
3680
3173
  /**
@@ -3683,7 +3176,6 @@ var OroClient = /*#__PURE__*/function () {
3683
3176
  * @returns the role based scopes defined by the whoami
3684
3177
  */
3685
3178
  ;
3686
-
3687
3179
  _proto.getAccountRole =
3688
3180
  /*#__PURE__*/
3689
3181
  function () {
@@ -3694,10 +3186,8 @@ var OroClient = /*#__PURE__*/function () {
3694
3186
  case 0:
3695
3187
  _context22.next = 2;
3696
3188
  return this.guardClient.whoAmI();
3697
-
3698
3189
  case 2:
3699
3190
  return _context22.abrupt("return", _context22.sent.scope.split(' '));
3700
-
3701
3191
  case 3:
3702
3192
  case "end":
3703
3193
  return _context22.stop();
@@ -3705,11 +3195,9 @@ var OroClient = /*#__PURE__*/function () {
3705
3195
  }
3706
3196
  }, _callee22, this);
3707
3197
  }));
3708
-
3709
3198
  function getAccountRole() {
3710
3199
  return _getAccountRole.apply(this, arguments);
3711
3200
  }
3712
-
3713
3201
  return getAccountRole;
3714
3202
  }()
3715
3203
  /**
@@ -3720,7 +3208,6 @@ var OroClient = /*#__PURE__*/function () {
3720
3208
  * @returns
3721
3209
  */
3722
3210
  ;
3723
-
3724
3211
  _proto.getCachedSecretCryptor =
3725
3212
  /*#__PURE__*/
3726
3213
  function () {
@@ -3734,22 +3221,17 @@ var OroClient = /*#__PURE__*/function () {
3734
3221
  _context23.next = 2;
3735
3222
  break;
3736
3223
  }
3737
-
3738
3224
  throw IncompleteAuthentication;
3739
-
3740
3225
  case 2:
3741
3226
  index = this.secrets.findIndex(function (secret) {
3742
3227
  return secret.lockboxUuid === lockboxUuid;
3743
3228
  });
3744
-
3745
3229
  if (!(index === -1)) {
3746
3230
  _context23.next = 13;
3747
3231
  break;
3748
3232
  }
3749
-
3750
3233
  _context23.next = 6;
3751
3234
  return this.vaultClient.lockboxSecretGet(lockboxUuid, lockboxOwnerUuid);
3752
-
3753
3235
  case 6:
3754
3236
  encryptedSecret = _context23.sent.sharedSecret;
3755
3237
  secret = this.rsa.base64DecryptToBytes(encryptedSecret);
@@ -3759,10 +3241,8 @@ var OroClient = /*#__PURE__*/function () {
3759
3241
  cryptor: cryptor
3760
3242
  });
3761
3243
  return _context23.abrupt("return", cryptor);
3762
-
3763
3244
  case 13:
3764
3245
  return _context23.abrupt("return", this.secrets[index].cryptor);
3765
-
3766
3246
  case 14:
3767
3247
  case "end":
3768
3248
  return _context23.stop();
@@ -3770,11 +3250,9 @@ var OroClient = /*#__PURE__*/function () {
3770
3250
  }
3771
3251
  }, _callee23, this);
3772
3252
  }));
3773
-
3774
3253
  function getCachedSecretCryptor(_x70, _x71) {
3775
3254
  return _getCachedSecretCryptor.apply(this, arguments);
3776
3255
  }
3777
-
3778
3256
  return getCachedSecretCryptor;
3779
3257
  }()
3780
3258
  /**
@@ -3787,7 +3265,6 @@ var OroClient = /*#__PURE__*/function () {
3787
3265
  * @returns the personal data
3788
3266
  */
3789
3267
  ;
3790
-
3791
3268
  _proto.getPersonalInformationsFromConsultId =
3792
3269
  /*#__PURE__*/
3793
3270
  function () {
@@ -3801,9 +3278,7 @@ var OroClient = /*#__PURE__*/function () {
3801
3278
  forceRefresh: false
3802
3279
  };
3803
3280
  }
3804
-
3805
3281
  return _context24.abrupt("return", this.getMetaCategoryFromConsultId(consultationId, category, options));
3806
-
3807
3282
  case 2:
3808
3283
  case "end":
3809
3284
  return _context24.stop();
@@ -3811,11 +3286,9 @@ var OroClient = /*#__PURE__*/function () {
3811
3286
  }
3812
3287
  }, _callee24, this);
3813
3288
  }));
3814
-
3815
3289
  function getPersonalInformationsFromConsultId(_x72, _x73, _x74) {
3816
3290
  return _getPersonalInformationsFromConsultId.apply(this, arguments);
3817
3291
  }
3818
-
3819
3292
  return getPersonalInformationsFromConsultId;
3820
3293
  }()
3821
3294
  /**
@@ -3827,7 +3300,6 @@ var OroClient = /*#__PURE__*/function () {
3827
3300
  * @returns the medical data
3828
3301
  */
3829
3302
  ;
3830
-
3831
3303
  _proto.getMedicalDataFromConsultId =
3832
3304
  /*#__PURE__*/
3833
3305
  function () {
@@ -3841,9 +3313,7 @@ var OroClient = /*#__PURE__*/function () {
3841
3313
  forceRefresh: false
3842
3314
  };
3843
3315
  }
3844
-
3845
3316
  return _context25.abrupt("return", this.getMetaCategoryFromConsultId(consultationId, MetadataCategory.Medical, options));
3846
-
3847
3317
  case 2:
3848
3318
  case "end":
3849
3319
  return _context25.stop();
@@ -3851,20 +3321,15 @@ var OroClient = /*#__PURE__*/function () {
3851
3321
  }
3852
3322
  }, _callee25, this);
3853
3323
  }));
3854
-
3855
3324
  function getMedicalDataFromConsultId(_x75, _x76) {
3856
3325
  return _getMedicalDataFromConsultId.apply(this, arguments);
3857
3326
  }
3858
-
3859
3327
  return getMedicalDataFromConsultId;
3860
3328
  }();
3861
-
3862
3329
  _proto.getMetaCategoryFromConsultId = /*#__PURE__*/function () {
3863
3330
  var _getMetaCategoryFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(consultationId, category, options) {
3864
3331
  var _this2 = this;
3865
-
3866
3332
  var grants, workflowData, _loop, _iterator, _step;
3867
-
3868
3333
  return _regeneratorRuntime().wrap(function _callee27$(_context28) {
3869
3334
  while (1) {
3870
3335
  switch (_context28.prev = _context28.next) {
@@ -3874,12 +3339,10 @@ var OroClient = /*#__PURE__*/function () {
3874
3339
  forceRefresh: false
3875
3340
  };
3876
3341
  }
3877
-
3878
3342
  _context28.next = 3;
3879
3343
  return this.getGrants({
3880
3344
  consultationId: consultationId
3881
3345
  });
3882
-
3883
3346
  case 3:
3884
3347
  grants = _context28.sent;
3885
3348
  workflowData = [];
@@ -3896,26 +3359,21 @@ var OroClient = /*#__PURE__*/function () {
3896
3359
  documentType: DocumentType.PopulatedWorkflowData,
3897
3360
  consultationIds: [consultationId]
3898
3361
  }, true, grant.lockboxOwnerUuid, options);
3899
-
3900
3362
  case 3:
3901
3363
  manifest = _context27.sent;
3902
-
3903
3364
  if (!(manifest.length === 0)) {
3904
3365
  _context27.next = 8;
3905
3366
  break;
3906
3367
  }
3907
-
3908
3368
  _context27.next = 7;
3909
3369
  return _this2.getLockboxManifest(grant.lockboxUuid, {
3910
3370
  category: category,
3911
3371
  documentType: DocumentType.PopulatedWorkflowData
3912
3372
  }, true, grant.lockboxOwnerUuid, options);
3913
-
3914
3373
  case 7:
3915
3374
  manifest = _context27.sent.filter(function (entry) {
3916
3375
  return !entry.metadata.consultationIds;
3917
3376
  });
3918
-
3919
3377
  case 8:
3920
3378
  _context27.next = 10;
3921
3379
  return Promise.all(manifest.map( /*#__PURE__*/function () {
@@ -3929,7 +3387,6 @@ var OroClient = /*#__PURE__*/function () {
3929
3387
  _context26.t2 = entry.dataUuid;
3930
3388
  _context26.next = 5;
3931
3389
  return _this2.getJsonData(grant.lockboxUuid, entry.dataUuid);
3932
-
3933
3390
  case 5:
3934
3391
  _context26.t3 = _context26.sent;
3935
3392
  return _context26.abrupt("return", {
@@ -3938,7 +3395,6 @@ var OroClient = /*#__PURE__*/function () {
3938
3395
  dataUuid: _context26.t2,
3939
3396
  data: _context26.t3
3940
3397
  });
3941
-
3942
3398
  case 7:
3943
3399
  case "end":
3944
3400
  return _context26.stop();
@@ -3946,16 +3402,13 @@ var OroClient = /*#__PURE__*/function () {
3946
3402
  }
3947
3403
  }, _callee26);
3948
3404
  }));
3949
-
3950
3405
  return function (_x80) {
3951
3406
  return _ref3.apply(this, arguments);
3952
3407
  };
3953
3408
  }()));
3954
-
3955
3409
  case 10:
3956
3410
  data = _context27.sent;
3957
3411
  workflowData = _extends({}, workflowData, data);
3958
-
3959
3412
  case 12:
3960
3413
  case "end":
3961
3414
  return _context27.stop();
@@ -3964,22 +3417,17 @@ var OroClient = /*#__PURE__*/function () {
3964
3417
  }, _loop);
3965
3418
  });
3966
3419
  _iterator = _createForOfIteratorHelperLoose(grants);
3967
-
3968
3420
  case 7:
3969
3421
  if ((_step = _iterator()).done) {
3970
3422
  _context28.next = 11;
3971
3423
  break;
3972
3424
  }
3973
-
3974
3425
  return _context28.delegateYield(_loop(), "t0", 9);
3975
-
3976
3426
  case 9:
3977
3427
  _context28.next = 7;
3978
3428
  break;
3979
-
3980
3429
  case 11:
3981
3430
  return _context28.abrupt("return", workflowData);
3982
-
3983
3431
  case 12:
3984
3432
  case "end":
3985
3433
  return _context28.stop();
@@ -3987,11 +3435,9 @@ var OroClient = /*#__PURE__*/function () {
3987
3435
  }
3988
3436
  }, _callee27, this);
3989
3437
  }));
3990
-
3991
3438
  function getMetaCategoryFromConsultId(_x77, _x78, _x79) {
3992
3439
  return _getMetaCategoryFromConsultId.apply(this, arguments);
3993
3440
  }
3994
-
3995
3441
  return getMetaCategoryFromConsultId;
3996
3442
  }()
3997
3443
  /**
@@ -4000,7 +3446,6 @@ var OroClient = /*#__PURE__*/function () {
4000
3446
  * @returns the personal data
4001
3447
  */
4002
3448
  ;
4003
-
4004
3449
  _proto.getPersonalInformations =
4005
3450
  /*#__PURE__*/
4006
3451
  function () {
@@ -4012,44 +3457,34 @@ var OroClient = /*#__PURE__*/function () {
4012
3457
  case 0:
4013
3458
  _context29.next = 2;
4014
3459
  return this.getGrants();
4015
-
4016
3460
  case 2:
4017
3461
  grant = _context29.sent.find(function (lockbox) {
4018
3462
  return lockbox.lockboxOwnerUuid === userId;
4019
3463
  });
4020
-
4021
3464
  if (grant) {
4022
3465
  _context29.next = 5;
4023
3466
  break;
4024
3467
  }
4025
-
4026
3468
  throw MissingGrant;
4027
-
4028
3469
  case 5:
4029
3470
  lockboxUuid = grant.lockboxUuid, lockboxOwnerUuid = grant.lockboxOwnerUuid;
4030
-
4031
3471
  if (lockboxUuid) {
4032
3472
  _context29.next = 8;
4033
3473
  break;
4034
3474
  }
4035
-
4036
3475
  throw MissingLockbox;
4037
-
4038
3476
  case 8:
4039
3477
  if (lockboxOwnerUuid) {
4040
3478
  _context29.next = 10;
4041
3479
  break;
4042
3480
  }
4043
-
4044
3481
  throw MissingLockboxOwner;
4045
-
4046
3482
  case 10:
4047
3483
  _context29.next = 12;
4048
3484
  return this.getLockboxManifest(lockboxUuid, {
4049
3485
  category: MetadataCategory.Personal,
4050
3486
  documentType: DocumentType.PopulatedWorkflowData
4051
3487
  }, false, userId);
4052
-
4053
3488
  case 12:
4054
3489
  identificationDataUuid = _context29.sent[0].dataUuid;
4055
3490
  _context29.t0 = lockboxOwnerUuid;
@@ -4057,7 +3492,6 @@ var OroClient = /*#__PURE__*/function () {
4057
3492
  _context29.t2 = identificationDataUuid;
4058
3493
  _context29.next = 18;
4059
3494
  return this.getJsonData(lockboxUuid, identificationDataUuid);
4060
-
4061
3495
  case 18:
4062
3496
  _context29.t3 = _context29.sent;
4063
3497
  return _context29.abrupt("return", {
@@ -4066,7 +3500,6 @@ var OroClient = /*#__PURE__*/function () {
4066
3500
  dataUuid: _context29.t2,
4067
3501
  data: _context29.t3
4068
3502
  });
4069
-
4070
3503
  case 20:
4071
3504
  case "end":
4072
3505
  return _context29.stop();
@@ -4074,11 +3507,9 @@ var OroClient = /*#__PURE__*/function () {
4074
3507
  }
4075
3508
  }, _callee28, this);
4076
3509
  }));
4077
-
4078
3510
  function getPersonalInformations(_x81) {
4079
3511
  return _getPersonalInformations.apply(this, arguments);
4080
3512
  }
4081
-
4082
3513
  return getPersonalInformations;
4083
3514
  }()
4084
3515
  /**
@@ -4088,7 +3519,6 @@ var OroClient = /*#__PURE__*/function () {
4088
3519
  * @returns the grant
4089
3520
  */
4090
3521
  ;
4091
-
4092
3522
  _proto.getGrantFromConsultId =
4093
3523
  /*#__PURE__*/
4094
3524
  function () {
@@ -4102,20 +3532,15 @@ var OroClient = /*#__PURE__*/function () {
4102
3532
  return this.getGrants({
4103
3533
  consultationId: consultationId
4104
3534
  });
4105
-
4106
3535
  case 2:
4107
3536
  grants = _context30.sent;
4108
-
4109
3537
  if (!(grants.length === 0)) {
4110
3538
  _context30.next = 5;
4111
3539
  break;
4112
3540
  }
4113
-
4114
3541
  throw AssociatedLockboxNotFound;
4115
-
4116
3542
  case 5:
4117
3543
  return _context30.abrupt("return", grants[0]);
4118
-
4119
3544
  case 6:
4120
3545
  case "end":
4121
3546
  return _context30.stop();
@@ -4123,11 +3548,9 @@ var OroClient = /*#__PURE__*/function () {
4123
3548
  }
4124
3549
  }, _callee29, this);
4125
3550
  }));
4126
-
4127
3551
  function getGrantFromConsultId(_x82) {
4128
3552
  return _getGrantFromConsultId.apply(this, arguments);
4129
3553
  }
4130
-
4131
3554
  return getGrantFromConsultId;
4132
3555
  }()
4133
3556
  /**
@@ -4136,7 +3559,6 @@ var OroClient = /*#__PURE__*/function () {
4136
3559
  * @returns the identity
4137
3560
  */
4138
3561
  ;
4139
-
4140
3562
  _proto.getIdentityFromConsultId =
4141
3563
  /*#__PURE__*/
4142
3564
  function () {
@@ -4148,24 +3570,18 @@ var OroClient = /*#__PURE__*/function () {
4148
3570
  case 0:
4149
3571
  _context31.next = 2;
4150
3572
  return this.getGrantFromConsultId(consultationId);
4151
-
4152
3573
  case 2:
4153
3574
  grant = _context31.sent;
4154
-
4155
3575
  if (!(grant && grant.lockboxOwnerUuid)) {
4156
3576
  _context31.next = 9;
4157
3577
  break;
4158
3578
  }
4159
-
4160
3579
  _context31.next = 6;
4161
3580
  return this.guardClient.identityGet(grant.lockboxOwnerUuid);
4162
-
4163
3581
  case 6:
4164
3582
  return _context31.abrupt("return", _context31.sent);
4165
-
4166
3583
  case 9:
4167
3584
  return _context31.abrupt("return", undefined);
4168
-
4169
3585
  case 10:
4170
3586
  case "end":
4171
3587
  return _context31.stop();
@@ -4173,11 +3589,9 @@ var OroClient = /*#__PURE__*/function () {
4173
3589
  }
4174
3590
  }, _callee30, this);
4175
3591
  }));
4176
-
4177
3592
  function getIdentityFromConsultId(_x83) {
4178
3593
  return _getIdentityFromConsultId.apply(this, arguments);
4179
3594
  }
4180
-
4181
3595
  return getIdentityFromConsultId;
4182
3596
  }()
4183
3597
  /**
@@ -4191,13 +3605,11 @@ var OroClient = /*#__PURE__*/function () {
4191
3605
  * @returns the lockbox manifest
4192
3606
  */
4193
3607
  ;
4194
-
4195
3608
  _proto.getLockboxManifest =
4196
3609
  /*#__PURE__*/
4197
3610
  function () {
4198
3611
  var _getLockboxManifest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(lockboxUuid, filter, expandPrivateMetadata, lockboxOwnerUuid, options) {
4199
3612
  var _this3 = this;
4200
-
4201
3613
  var manifestKey;
4202
3614
  return _regeneratorRuntime().wrap(function _callee32$(_context33) {
4203
3615
  while (1) {
@@ -4208,21 +3620,17 @@ var OroClient = /*#__PURE__*/function () {
4208
3620
  forceRefresh: false
4209
3621
  };
4210
3622
  }
4211
-
4212
3623
  manifestKey = JSON.stringify({
4213
3624
  lockboxUuid: lockboxUuid,
4214
3625
  filter: filter,
4215
3626
  expandPrivateMetadata: expandPrivateMetadata,
4216
3627
  lockboxOwnerUuid: lockboxOwnerUuid
4217
3628
  });
4218
-
4219
3629
  if (!(!options.forceRefresh && this.cachedManifest[manifestKey])) {
4220
3630
  _context33.next = 4;
4221
3631
  break;
4222
3632
  }
4223
-
4224
3633
  return _context33.abrupt("return", this.cachedManifest[manifestKey]);
4225
-
4226
3634
  case 4:
4227
3635
  return _context33.abrupt("return", this.vaultClient.lockboxManifestGet(lockboxUuid, filter, lockboxOwnerUuid).then(function (manifest) {
4228
3636
  return Promise.all(manifest.map( /*#__PURE__*/function () {
@@ -4236,17 +3644,13 @@ var OroClient = /*#__PURE__*/function () {
4236
3644
  _context32.next = 5;
4237
3645
  break;
4238
3646
  }
4239
-
4240
3647
  _context32.next = 3;
4241
3648
  return _this3.getJsonData(lockboxUuid, entry.metadata.privateMetadata, lockboxOwnerUuid);
4242
-
4243
3649
  case 3:
4244
3650
  privateMeta = _context32.sent;
4245
3651
  entry.metadata = _extends({}, entry.metadata, privateMeta);
4246
-
4247
3652
  case 5:
4248
3653
  return _context32.abrupt("return", entry);
4249
-
4250
3654
  case 6:
4251
3655
  case "end":
4252
3656
  return _context32.stop();
@@ -4254,7 +3658,6 @@ var OroClient = /*#__PURE__*/function () {
4254
3658
  }
4255
3659
  }, _callee31);
4256
3660
  }));
4257
-
4258
3661
  return function (_x89) {
4259
3662
  return _ref4.apply(this, arguments);
4260
3663
  };
@@ -4262,7 +3665,6 @@ var OroClient = /*#__PURE__*/function () {
4262
3665
  return _this3.cachedManifest[manifestKey] = manifest;
4263
3666
  });
4264
3667
  }));
4265
-
4266
3668
  case 5:
4267
3669
  case "end":
4268
3670
  return _context33.stop();
@@ -4270,11 +3672,9 @@ var OroClient = /*#__PURE__*/function () {
4270
3672
  }
4271
3673
  }, _callee32, this);
4272
3674
  }));
4273
-
4274
3675
  function getLockboxManifest(_x84, _x85, _x86, _x87, _x88) {
4275
3676
  return _getLockboxManifest.apply(this, arguments);
4276
3677
  }
4277
-
4278
3678
  return getLockboxManifest;
4279
3679
  }()
4280
3680
  /**
@@ -4285,13 +3685,11 @@ var OroClient = /*#__PURE__*/function () {
4285
3685
  * @returns
4286
3686
  */
4287
3687
  ;
4288
-
4289
3688
  _proto.createPersonalInformations =
4290
3689
  /*#__PURE__*/
4291
3690
  function () {
4292
3691
  var _createPersonalInformations = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(identity, data, dataUuid) {
4293
3692
  var _yield$this$getGrants;
4294
-
4295
3693
  var lockboxUuid;
4296
3694
  return _regeneratorRuntime().wrap(function _callee33$(_context34) {
4297
3695
  while (1) {
@@ -4299,40 +3697,31 @@ var OroClient = /*#__PURE__*/function () {
4299
3697
  case 0:
4300
3698
  _context34.next = 2;
4301
3699
  return this.getGrants();
4302
-
4303
3700
  case 2:
4304
3701
  _context34.t0 = _yield$this$getGrants = _context34.sent.find(function (lockbox) {
4305
3702
  return lockbox.lockboxOwnerUuid === identity.id;
4306
3703
  });
4307
-
4308
3704
  if (!(_context34.t0 == null)) {
4309
3705
  _context34.next = 7;
4310
3706
  break;
4311
3707
  }
4312
-
4313
3708
  _context34.t1 = void 0;
4314
3709
  _context34.next = 8;
4315
3710
  break;
4316
-
4317
3711
  case 7:
4318
3712
  _context34.t1 = _yield$this$getGrants.lockboxUuid;
4319
-
4320
3713
  case 8:
4321
3714
  lockboxUuid = _context34.t1;
4322
-
4323
3715
  if (!lockboxUuid) {
4324
3716
  _context34.next = 13;
4325
3717
  break;
4326
3718
  }
4327
-
4328
3719
  return _context34.abrupt("return", this.createJsonData(lockboxUuid, data, {
4329
3720
  category: MetadataCategory.Personal,
4330
3721
  documentType: DocumentType.PopulatedWorkflowData
4331
3722
  }, {}, undefined, dataUuid));
4332
-
4333
3723
  case 13:
4334
3724
  throw MissingLockbox;
4335
-
4336
3725
  case 14:
4337
3726
  case "end":
4338
3727
  return _context34.stop();
@@ -4340,11 +3729,9 @@ var OroClient = /*#__PURE__*/function () {
4340
3729
  }
4341
3730
  }, _callee33, this);
4342
3731
  }));
4343
-
4344
3732
  function createPersonalInformations(_x90, _x91, _x92) {
4345
3733
  return _createPersonalInformations.apply(this, arguments);
4346
3734
  }
4347
-
4348
3735
  return createPersonalInformations;
4349
3736
  }()
4350
3737
  /**
@@ -4355,13 +3742,11 @@ var OroClient = /*#__PURE__*/function () {
4355
3742
  * @returns
4356
3743
  */
4357
3744
  ;
4358
-
4359
3745
  _proto.createUserPreference =
4360
3746
  /*#__PURE__*/
4361
3747
  function () {
4362
3748
  var _createUserPreference = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(identity, preference, dataUuid) {
4363
3749
  var _yield$this$getGrants2;
4364
-
4365
3750
  var lockboxUuid;
4366
3751
  return _regeneratorRuntime().wrap(function _callee34$(_context35) {
4367
3752
  while (1) {
@@ -4369,40 +3754,31 @@ var OroClient = /*#__PURE__*/function () {
4369
3754
  case 0:
4370
3755
  _context35.next = 2;
4371
3756
  return this.getGrants();
4372
-
4373
3757
  case 2:
4374
3758
  _context35.t0 = _yield$this$getGrants2 = _context35.sent.find(function (lockbox) {
4375
3759
  return lockbox.lockboxOwnerUuid === identity.id;
4376
3760
  });
4377
-
4378
3761
  if (!(_context35.t0 == null)) {
4379
3762
  _context35.next = 7;
4380
3763
  break;
4381
3764
  }
4382
-
4383
3765
  _context35.t1 = void 0;
4384
3766
  _context35.next = 8;
4385
3767
  break;
4386
-
4387
3768
  case 7:
4388
3769
  _context35.t1 = _yield$this$getGrants2.lockboxUuid;
4389
-
4390
3770
  case 8:
4391
3771
  lockboxUuid = _context35.t1;
4392
-
4393
3772
  if (!lockboxUuid) {
4394
3773
  _context35.next = 13;
4395
3774
  break;
4396
3775
  }
4397
-
4398
3776
  return _context35.abrupt("return", this.createJsonData(lockboxUuid, preference, {
4399
3777
  category: MetadataCategory.Preference,
4400
3778
  contentType: 'application/json'
4401
3779
  }, {}, undefined, dataUuid));
4402
-
4403
3780
  case 13:
4404
3781
  throw MissingLockbox;
4405
-
4406
3782
  case 14:
4407
3783
  case "end":
4408
3784
  return _context35.stop();
@@ -4410,11 +3786,9 @@ var OroClient = /*#__PURE__*/function () {
4410
3786
  }
4411
3787
  }, _callee34, this);
4412
3788
  }));
4413
-
4414
3789
  function createUserPreference(_x93, _x94, _x95) {
4415
3790
  return _createUserPreference.apply(this, arguments);
4416
3791
  }
4417
-
4418
3792
  return createUserPreference;
4419
3793
  }()
4420
3794
  /**
@@ -4423,7 +3797,6 @@ var OroClient = /*#__PURE__*/function () {
4423
3797
  * @returns the user preference
4424
3798
  */
4425
3799
  ;
4426
-
4427
3800
  _proto.getDataFromGrant =
4428
3801
  /*#__PURE__*/
4429
3802
  function () {
@@ -4434,28 +3807,22 @@ var OroClient = /*#__PURE__*/function () {
4434
3807
  switch (_context36.prev = _context36.next) {
4435
3808
  case 0:
4436
3809
  lockboxUuid = grant.lockboxUuid, lockboxOwnerUuid = grant.lockboxOwnerUuid;
4437
-
4438
3810
  if (lockboxUuid) {
4439
3811
  _context36.next = 3;
4440
3812
  break;
4441
3813
  }
4442
-
4443
3814
  throw MissingLockbox;
4444
-
4445
3815
  case 3:
4446
3816
  if (lockboxOwnerUuid) {
4447
3817
  _context36.next = 5;
4448
3818
  break;
4449
3819
  }
4450
-
4451
3820
  throw MissingLockboxOwner;
4452
-
4453
3821
  case 5:
4454
3822
  _context36.next = 7;
4455
3823
  return this.getLockboxManifest(lockboxUuid, filter, false, grant.lockboxOwnerUuid, {
4456
3824
  forceRefresh: true
4457
3825
  });
4458
-
4459
3826
  case 7:
4460
3827
  identificationDataUuid = _context36.sent[0].dataUuid;
4461
3828
  _context36.t0 = lockboxOwnerUuid;
@@ -4463,7 +3830,6 @@ var OroClient = /*#__PURE__*/function () {
4463
3830
  _context36.t2 = identificationDataUuid;
4464
3831
  _context36.next = 13;
4465
3832
  return this.getJsonData(lockboxUuid, identificationDataUuid);
4466
-
4467
3833
  case 13:
4468
3834
  _context36.t3 = _context36.sent;
4469
3835
  return _context36.abrupt("return", {
@@ -4472,7 +3838,6 @@ var OroClient = /*#__PURE__*/function () {
4472
3838
  dataUuid: _context36.t2,
4473
3839
  data: _context36.t3
4474
3840
  });
4475
-
4476
3841
  case 15:
4477
3842
  case "end":
4478
3843
  return _context36.stop();
@@ -4480,11 +3845,9 @@ var OroClient = /*#__PURE__*/function () {
4480
3845
  }
4481
3846
  }, _callee35, this);
4482
3847
  }));
4483
-
4484
3848
  function getDataFromGrant(_x96, _x97) {
4485
3849
  return _getDataFromGrant.apply(this, arguments);
4486
3850
  }
4487
-
4488
3851
  return getDataFromGrant;
4489
3852
  }()
4490
3853
  /**
@@ -4493,7 +3856,6 @@ var OroClient = /*#__PURE__*/function () {
4493
3856
  * @returns the user preference
4494
3857
  */
4495
3858
  ;
4496
-
4497
3859
  _proto.getUserPreferenceFromConsultId =
4498
3860
  /*#__PURE__*/
4499
3861
  function () {
@@ -4505,23 +3867,18 @@ var OroClient = /*#__PURE__*/function () {
4505
3867
  case 0:
4506
3868
  _context37.next = 2;
4507
3869
  return this.getGrantFromConsultId(consultationId);
4508
-
4509
3870
  case 2:
4510
3871
  grant = _context37.sent;
4511
-
4512
3872
  if (grant) {
4513
3873
  _context37.next = 5;
4514
3874
  break;
4515
3875
  }
4516
-
4517
3876
  throw MissingGrant;
4518
-
4519
3877
  case 5:
4520
3878
  return _context37.abrupt("return", this.getDataFromGrant(grant, {
4521
3879
  category: MetadataCategory.Preference,
4522
3880
  contentType: 'application/json'
4523
3881
  }));
4524
-
4525
3882
  case 6:
4526
3883
  case "end":
4527
3884
  return _context37.stop();
@@ -4529,11 +3886,9 @@ var OroClient = /*#__PURE__*/function () {
4529
3886
  }
4530
3887
  }, _callee36, this);
4531
3888
  }));
4532
-
4533
3889
  function getUserPreferenceFromConsultId(_x98) {
4534
3890
  return _getUserPreferenceFromConsultId.apply(this, arguments);
4535
3891
  }
4536
-
4537
3892
  return getUserPreferenceFromConsultId;
4538
3893
  }()
4539
3894
  /**
@@ -4542,7 +3897,6 @@ var OroClient = /*#__PURE__*/function () {
4542
3897
  * @returns the user preference
4543
3898
  */
4544
3899
  ;
4545
-
4546
3900
  _proto.getUserPreference =
4547
3901
  /*#__PURE__*/
4548
3902
  function () {
@@ -4554,25 +3908,20 @@ var OroClient = /*#__PURE__*/function () {
4554
3908
  case 0:
4555
3909
  _context38.next = 2;
4556
3910
  return this.getGrants();
4557
-
4558
3911
  case 2:
4559
3912
  grant = _context38.sent.find(function (lockbox) {
4560
3913
  return lockbox.lockboxOwnerUuid === identity.id;
4561
3914
  });
4562
-
4563
3915
  if (grant) {
4564
3916
  _context38.next = 5;
4565
3917
  break;
4566
3918
  }
4567
-
4568
3919
  throw MissingGrant;
4569
-
4570
3920
  case 5:
4571
3921
  return _context38.abrupt("return", this.getDataFromGrant(grant, {
4572
3922
  category: MetadataCategory.Preference,
4573
3923
  contentType: 'application/json'
4574
3924
  }));
4575
-
4576
3925
  case 6:
4577
3926
  case "end":
4578
3927
  return _context38.stop();
@@ -4580,11 +3929,9 @@ var OroClient = /*#__PURE__*/function () {
4580
3929
  }
4581
3930
  }, _callee37, this);
4582
3931
  }));
4583
-
4584
3932
  function getUserPreference(_x99) {
4585
3933
  return _getUserPreference.apply(this, arguments);
4586
3934
  }
4587
-
4588
3935
  return getUserPreference;
4589
3936
  }()
4590
3937
  /**
@@ -4593,7 +3940,6 @@ var OroClient = /*#__PURE__*/function () {
4593
3940
  * @returns the user preference
4594
3941
  */
4595
3942
  ;
4596
-
4597
3943
  _proto.getRecoveryDataFromConsultId =
4598
3944
  /*#__PURE__*/
4599
3945
  function () {
@@ -4605,23 +3951,18 @@ var OroClient = /*#__PURE__*/function () {
4605
3951
  case 0:
4606
3952
  _context39.next = 2;
4607
3953
  return this.getGrantFromConsultId(consultationId);
4608
-
4609
3954
  case 2:
4610
3955
  grant = _context39.sent;
4611
-
4612
3956
  if (grant) {
4613
3957
  _context39.next = 5;
4614
3958
  break;
4615
3959
  }
4616
-
4617
3960
  throw MissingGrant;
4618
-
4619
3961
  case 5:
4620
3962
  return _context39.abrupt("return", this.getDataFromGrant(grant, {
4621
3963
  category: MetadataCategory.Recovery,
4622
3964
  contentType: 'application/json'
4623
3965
  }));
4624
-
4625
3966
  case 6:
4626
3967
  case "end":
4627
3968
  return _context39.stop();
@@ -4629,11 +3970,9 @@ var OroClient = /*#__PURE__*/function () {
4629
3970
  }
4630
3971
  }, _callee38, this);
4631
3972
  }));
4632
-
4633
3973
  function getRecoveryDataFromConsultId(_x100) {
4634
3974
  return _getRecoveryDataFromConsultId.apply(this, arguments);
4635
3975
  }
4636
-
4637
3976
  return getRecoveryDataFromConsultId;
4638
3977
  }()
4639
3978
  /**
@@ -4642,7 +3981,6 @@ var OroClient = /*#__PURE__*/function () {
4642
3981
  * @returns the user preference
4643
3982
  */
4644
3983
  ;
4645
-
4646
3984
  _proto.getRecoveryData =
4647
3985
  /*#__PURE__*/
4648
3986
  function () {
@@ -4654,25 +3992,20 @@ var OroClient = /*#__PURE__*/function () {
4654
3992
  case 0:
4655
3993
  _context40.next = 2;
4656
3994
  return this.getGrants();
4657
-
4658
3995
  case 2:
4659
3996
  grant = _context40.sent.find(function (lockbox) {
4660
3997
  return lockbox.lockboxOwnerUuid === identity.id;
4661
3998
  });
4662
-
4663
3999
  if (grant) {
4664
4000
  _context40.next = 5;
4665
4001
  break;
4666
4002
  }
4667
-
4668
4003
  throw MissingGrant;
4669
-
4670
4004
  case 5:
4671
4005
  return _context40.abrupt("return", this.getDataFromGrant(grant, {
4672
4006
  category: MetadataCategory.Recovery,
4673
4007
  contentType: 'application/json'
4674
4008
  }));
4675
-
4676
4009
  case 6:
4677
4010
  case "end":
4678
4011
  return _context40.stop();
@@ -4680,11 +4013,9 @@ var OroClient = /*#__PURE__*/function () {
4680
4013
  }
4681
4014
  }, _callee39, this);
4682
4015
  }));
4683
-
4684
4016
  function getRecoveryData(_x101) {
4685
4017
  return _getRecoveryData.apply(this, arguments);
4686
4018
  }
4687
-
4688
4019
  return getRecoveryData;
4689
4020
  }()
4690
4021
  /**
@@ -4698,13 +4029,11 @@ var OroClient = /*#__PURE__*/function () {
4698
4029
  * @returns the list of consults
4699
4030
  */
4700
4031
  ;
4701
-
4702
4032
  _proto.getAssignedConsultations =
4703
4033
  /*#__PURE__*/
4704
4034
  function () {
4705
4035
  var _getAssignedConsultations = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(practiceUuid) {
4706
4036
  var _this4 = this;
4707
-
4708
4037
  return _regeneratorRuntime().wrap(function _callee41$(_context42) {
4709
4038
  while (1) {
4710
4039
  switch (_context42.prev = _context42.next) {
@@ -4712,7 +4041,6 @@ var OroClient = /*#__PURE__*/function () {
4712
4041
  _context42.t0 = Promise;
4713
4042
  _context42.next = 3;
4714
4043
  return this.getGrants();
4715
-
4716
4044
  case 3:
4717
4045
  _context42.t1 = _context42.sent.map(function (grant) {
4718
4046
  return _this4.getLockboxManifest(grant.lockboxUuid, {
@@ -4727,10 +4055,8 @@ var OroClient = /*#__PURE__*/function () {
4727
4055
  case 0:
4728
4056
  _context41.next = 2;
4729
4057
  return _this4.consultClient.getConsultByUUID(entry.metadata.consultationId, practiceUuid);
4730
-
4731
4058
  case 2:
4732
4059
  return _context41.abrupt("return", _context41.sent);
4733
-
4734
4060
  case 3:
4735
4061
  case "end":
4736
4062
  return _context41.stop();
@@ -4738,7 +4064,6 @@ var OroClient = /*#__PURE__*/function () {
4738
4064
  }
4739
4065
  }, _callee40);
4740
4066
  }));
4741
-
4742
4067
  return function (_x103) {
4743
4068
  return _ref5.apply(this, arguments);
4744
4069
  };
@@ -4750,7 +4075,6 @@ var OroClient = /*#__PURE__*/function () {
4750
4075
  return _context42.abrupt("return", _context42.t0.all.call(_context42.t0, _context42.t1).then(function (consults) {
4751
4076
  return consults.flat();
4752
4077
  }));
4753
-
4754
4078
  case 5:
4755
4079
  case "end":
4756
4080
  return _context42.stop();
@@ -4758,11 +4082,9 @@ var OroClient = /*#__PURE__*/function () {
4758
4082
  }
4759
4083
  }, _callee41, this);
4760
4084
  }));
4761
-
4762
4085
  function getAssignedConsultations(_x102) {
4763
4086
  return _getAssignedConsultations.apply(this, arguments);
4764
4087
  }
4765
-
4766
4088
  return getAssignedConsultations;
4767
4089
  }()
4768
4090
  /**
@@ -4771,13 +4093,11 @@ var OroClient = /*#__PURE__*/function () {
4771
4093
  * @param practiceUuid
4772
4094
  */
4773
4095
  ;
4774
-
4775
4096
  _proto.getPastConsultationsFromConsultId =
4776
4097
  /*#__PURE__*/
4777
4098
  function () {
4778
4099
  var _getPastConsultationsFromConsultId = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(consultationId, practiceUuid) {
4779
4100
  var _this5 = this;
4780
-
4781
4101
  var grant, consultationsInLockbox;
4782
4102
  return _regeneratorRuntime().wrap(function _callee43$(_context44) {
4783
4103
  while (1) {
@@ -4785,36 +4105,28 @@ var OroClient = /*#__PURE__*/function () {
4785
4105
  case 0:
4786
4106
  _context44.next = 2;
4787
4107
  return this.getGrantFromConsultId(consultationId);
4788
-
4789
4108
  case 2:
4790
4109
  grant = _context44.sent;
4791
-
4792
4110
  if (grant) {
4793
4111
  _context44.next = 5;
4794
4112
  break;
4795
4113
  }
4796
-
4797
4114
  return _context44.abrupt("return", undefined);
4798
-
4799
4115
  case 5:
4800
4116
  _context44.next = 7;
4801
4117
  return this.vaultClient.lockboxMetadataGet(grant.lockboxUuid, ['consultationId'], ['consultationId'], {
4802
4118
  category: MetadataCategory.Consultation,
4803
4119
  documentType: DocumentType.PopulatedWorkflowData
4804
4120
  }, grant.lockboxOwnerUuid);
4805
-
4806
4121
  case 7:
4807
4122
  consultationsInLockbox = _context44.sent.flat().map(function (metadata) {
4808
4123
  return metadata.consultationId;
4809
4124
  });
4810
-
4811
4125
  if (!(consultationsInLockbox.length == 0)) {
4812
4126
  _context44.next = 10;
4813
4127
  break;
4814
4128
  }
4815
-
4816
4129
  return _context44.abrupt("return", []);
4817
-
4818
4130
  case 10:
4819
4131
  _context44.next = 12;
4820
4132
  return Promise.all(consultationsInLockbox.map( /*#__PURE__*/function () {
@@ -4825,10 +4137,8 @@ var OroClient = /*#__PURE__*/function () {
4825
4137
  case 0:
4826
4138
  _context43.next = 2;
4827
4139
  return _this5.consultClient.getConsultByUUID(consultId, practiceUuid);
4828
-
4829
4140
  case 2:
4830
4141
  return _context43.abrupt("return", _context43.sent);
4831
-
4832
4142
  case 3:
4833
4143
  case "end":
4834
4144
  return _context43.stop();
@@ -4836,15 +4146,12 @@ var OroClient = /*#__PURE__*/function () {
4836
4146
  }
4837
4147
  }, _callee42);
4838
4148
  }));
4839
-
4840
4149
  return function (_x106) {
4841
4150
  return _ref6.apply(this, arguments);
4842
4151
  };
4843
4152
  }()));
4844
-
4845
4153
  case 12:
4846
4154
  return _context44.abrupt("return", _context44.sent);
4847
-
4848
4155
  case 13:
4849
4156
  case "end":
4850
4157
  return _context44.stop();
@@ -4852,11 +4159,9 @@ var OroClient = /*#__PURE__*/function () {
4852
4159
  }
4853
4160
  }, _callee43, this);
4854
4161
  }));
4855
-
4856
4162
  function getPastConsultationsFromConsultId(_x104, _x105) {
4857
4163
  return _getPastConsultationsFromConsultId.apply(this, arguments);
4858
4164
  }
4859
-
4860
4165
  return getPastConsultationsFromConsultId;
4861
4166
  }()
4862
4167
  /**
@@ -4866,13 +4171,11 @@ var OroClient = /*#__PURE__*/function () {
4866
4171
  * @returns
4867
4172
  */
4868
4173
  ;
4869
-
4870
4174
  _proto.getPatientConsultationData =
4871
4175
  /*#__PURE__*/
4872
4176
  function () {
4873
4177
  var _getPatientConsultationData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(consultationId, options) {
4874
4178
  var _this6 = this;
4875
-
4876
4179
  return _regeneratorRuntime().wrap(function _callee44$(_context45) {
4877
4180
  while (1) {
4878
4181
  switch (_context45.prev = _context45.next) {
@@ -4882,13 +4185,11 @@ var OroClient = /*#__PURE__*/function () {
4882
4185
  forceRefresh: false
4883
4186
  };
4884
4187
  }
4885
-
4886
4188
  _context45.t0 = Promise;
4887
4189
  _context45.next = 4;
4888
4190
  return this.getGrants({
4889
4191
  consultationId: consultationId
4890
4192
  });
4891
-
4892
4193
  case 4:
4893
4194
  _context45.t1 = _context45.sent.map(function (grant) {
4894
4195
  return _this6.getLockboxManifest(grant.lockboxUuid, {
@@ -4904,7 +4205,6 @@ var OroClient = /*#__PURE__*/function () {
4904
4205
  return _context45.abrupt("return", _context45.t0.all.call(_context45.t0, _context45.t1).then(function (data) {
4905
4206
  return data.flat();
4906
4207
  }));
4907
-
4908
4208
  case 6:
4909
4209
  case "end":
4910
4210
  return _context45.stop();
@@ -4912,11 +4212,9 @@ var OroClient = /*#__PURE__*/function () {
4912
4212
  }
4913
4213
  }, _callee44, this);
4914
4214
  }));
4915
-
4916
4215
  function getPatientConsultationData(_x107, _x108) {
4917
4216
  return _getPatientConsultationData.apply(this, arguments);
4918
4217
  }
4919
-
4920
4218
  return getPatientConsultationData;
4921
4219
  }()
4922
4220
  /**
@@ -4925,7 +4223,6 @@ var OroClient = /*#__PURE__*/function () {
4925
4223
  * @returns
4926
4224
  */
4927
4225
  ;
4928
-
4929
4226
  _proto.getPatientPrescriptionsList =
4930
4227
  /*#__PURE__*/
4931
4228
  function () {
@@ -4938,7 +4235,6 @@ var OroClient = /*#__PURE__*/function () {
4938
4235
  category: MetadataCategory.Consultation,
4939
4236
  documentType: DocumentType.Prescription
4940
4237
  }, true, consultationId));
4941
-
4942
4238
  case 1:
4943
4239
  case "end":
4944
4240
  return _context46.stop();
@@ -4946,11 +4242,9 @@ var OroClient = /*#__PURE__*/function () {
4946
4242
  }
4947
4243
  }, _callee45, this);
4948
4244
  }));
4949
-
4950
4245
  function getPatientPrescriptionsList(_x109) {
4951
4246
  return _getPatientPrescriptionsList.apply(this, arguments);
4952
4247
  }
4953
-
4954
4248
  return getPatientPrescriptionsList;
4955
4249
  }()
4956
4250
  /**
@@ -4959,7 +4253,6 @@ var OroClient = /*#__PURE__*/function () {
4959
4253
  * @returns
4960
4254
  */
4961
4255
  ;
4962
-
4963
4256
  _proto.getPatientResultsList =
4964
4257
  /*#__PURE__*/
4965
4258
  function () {
@@ -4972,7 +4265,6 @@ var OroClient = /*#__PURE__*/function () {
4972
4265
  category: MetadataCategory.Consultation,
4973
4266
  documentType: DocumentType.Result
4974
4267
  }, true, consultationId));
4975
-
4976
4268
  case 1:
4977
4269
  case "end":
4978
4270
  return _context47.stop();
@@ -4980,11 +4272,9 @@ var OroClient = /*#__PURE__*/function () {
4980
4272
  }
4981
4273
  }, _callee46, this);
4982
4274
  }));
4983
-
4984
4275
  function getPatientResultsList(_x110) {
4985
4276
  return _getPatientResultsList.apply(this, arguments);
4986
4277
  }
4987
-
4988
4278
  return getPatientResultsList;
4989
4279
  }()
4990
4280
  /**
@@ -4993,7 +4283,6 @@ var OroClient = /*#__PURE__*/function () {
4993
4283
  * @returns Document[] corresponding to the patient treatment plan options
4994
4284
  */
4995
4285
  ;
4996
-
4997
4286
  _proto.getPatientTreatmentPlans =
4998
4287
  /*#__PURE__*/
4999
4288
  function () {
@@ -5006,7 +4295,6 @@ var OroClient = /*#__PURE__*/function () {
5006
4295
  category: MetadataCategory.Consultation,
5007
4296
  documentType: DocumentType.TreatmentPlan
5008
4297
  }, true, consultationId));
5009
-
5010
4298
  case 1:
5011
4299
  case "end":
5012
4300
  return _context48.stop();
@@ -5014,11 +4302,9 @@ var OroClient = /*#__PURE__*/function () {
5014
4302
  }
5015
4303
  }, _callee47, this);
5016
4304
  }));
5017
-
5018
4305
  function getPatientTreatmentPlans(_x111) {
5019
4306
  return _getPatientTreatmentPlans.apply(this, arguments);
5020
4307
  }
5021
-
5022
4308
  return getPatientTreatmentPlans;
5023
4309
  }()
5024
4310
  /**
@@ -5028,7 +4314,6 @@ var OroClient = /*#__PURE__*/function () {
5028
4314
  * @returns
5029
4315
  */
5030
4316
  ;
5031
-
5032
4317
  _proto.getPatientTreatmentPlanByUuid =
5033
4318
  /*#__PURE__*/
5034
4319
  function () {
@@ -5042,7 +4327,6 @@ var OroClient = /*#__PURE__*/function () {
5042
4327
  documentType: DocumentType.TreatmentPlan,
5043
4328
  treatmentPlanId: treatmentPlanId
5044
4329
  }, true, consultationId));
5045
-
5046
4330
  case 1:
5047
4331
  case "end":
5048
4332
  return _context49.stop();
@@ -5050,11 +4334,9 @@ var OroClient = /*#__PURE__*/function () {
5050
4334
  }
5051
4335
  }, _callee48, this);
5052
4336
  }));
5053
-
5054
4337
  function getPatientTreatmentPlanByUuid(_x112, _x113) {
5055
4338
  return _getPatientTreatmentPlanByUuid.apply(this, arguments);
5056
4339
  }
5057
-
5058
4340
  return getPatientTreatmentPlanByUuid;
5059
4341
  }()
5060
4342
  /**
@@ -5067,13 +4349,11 @@ var OroClient = /*#__PURE__*/function () {
5067
4349
  * @returns the filtered document list
5068
4350
  */
5069
4351
  ;
5070
-
5071
4352
  _proto.getPatientDocumentsList =
5072
4353
  /*#__PURE__*/
5073
4354
  function () {
5074
4355
  var _getPatientDocumentsList = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(filters, expandPrivateMetadata, consultationId) {
5075
4356
  var _this7 = this;
5076
-
5077
4357
  return _regeneratorRuntime().wrap(function _callee50$(_context51) {
5078
4358
  while (1) {
5079
4359
  switch (_context51.prev = _context51.next) {
@@ -5083,7 +4363,6 @@ var OroClient = /*#__PURE__*/function () {
5083
4363
  return this.getGrants({
5084
4364
  consultationId: consultationId
5085
4365
  });
5086
-
5087
4366
  case 3:
5088
4367
  _context51.t1 = _context51.sent.map(function (grant) {
5089
4368
  return _this7.getLockboxManifest(grant.lockboxUuid, _extends({}, filters, {
@@ -5101,7 +4380,6 @@ var OroClient = /*#__PURE__*/function () {
5101
4380
  lockboxOwnerUuid: grant.lockboxOwnerUuid,
5102
4381
  lockboxUuid: grant.lockboxUuid
5103
4382
  }, entry));
5104
-
5105
4383
  case 1:
5106
4384
  case "end":
5107
4385
  return _context50.stop();
@@ -5109,7 +4387,6 @@ var OroClient = /*#__PURE__*/function () {
5109
4387
  }
5110
4388
  }, _callee49);
5111
4389
  }));
5112
-
5113
4390
  return function (_x117) {
5114
4391
  return _ref7.apply(this, arguments);
5115
4392
  };
@@ -5119,7 +4396,6 @@ var OroClient = /*#__PURE__*/function () {
5119
4396
  return _context51.abrupt("return", _context51.t0.all.call(_context51.t0, _context51.t1).then(function (data) {
5120
4397
  return data.flat();
5121
4398
  }));
5122
-
5123
4399
  case 5:
5124
4400
  case "end":
5125
4401
  return _context51.stop();
@@ -5127,17 +4403,14 @@ var OroClient = /*#__PURE__*/function () {
5127
4403
  }
5128
4404
  }, _callee50, this);
5129
4405
  }));
5130
-
5131
4406
  function getPatientDocumentsList(_x114, _x115, _x116) {
5132
4407
  return _getPatientDocumentsList.apply(this, arguments);
5133
4408
  }
5134
-
5135
4409
  return getPatientDocumentsList;
5136
4410
  }()
5137
4411
  /****************************************************************************************************************
5138
4412
  * RECOVERY *
5139
4413
  ****************************************************************************************************************/
5140
-
5141
4414
  /**
5142
4415
  * @name recoverPrivateKeyFromSecurityQuestions
5143
4416
  * @description Recovers and sets the rsa private key from the answered security questions
@@ -5147,7 +4420,6 @@ var OroClient = /*#__PURE__*/function () {
5147
4420
  * @param threshold the number of answers needed to recover the key
5148
4421
  */
5149
4422
  ;
5150
-
5151
4423
  _proto.recoverPrivateKeyFromSecurityQuestions =
5152
4424
  /*#__PURE__*/
5153
4425
  function () {
@@ -5159,7 +4431,6 @@ var OroClient = /*#__PURE__*/function () {
5159
4431
  case 0:
5160
4432
  _context52.next = 2;
5161
4433
  return this.guardClient.identityGet(id);
5162
-
5163
4434
  case 2:
5164
4435
  shards = _context52.sent.recoverySecurityQuestions;
5165
4436
  answeredShards = shards.filter(function (shard) {
@@ -5173,7 +4444,6 @@ var OroClient = /*#__PURE__*/function () {
5173
4444
  item.securityAnswer = recoverySecurityAnswers[index];
5174
4445
  return item;
5175
4446
  });
5176
-
5177
4447
  try {
5178
4448
  // reconstructs the key from the answered security answers
5179
4449
  privateKey = this.toolbox.reconstructSecret(answeredShards, threshold);
@@ -5181,7 +4451,6 @@ var OroClient = /*#__PURE__*/function () {
5181
4451
  } catch (e) {
5182
4452
  console.error(e);
5183
4453
  }
5184
-
5185
4454
  case 5:
5186
4455
  case "end":
5187
4456
  return _context52.stop();
@@ -5189,11 +4458,9 @@ var OroClient = /*#__PURE__*/function () {
5189
4458
  }
5190
4459
  }, _callee51, this);
5191
4460
  }));
5192
-
5193
4461
  function recoverPrivateKeyFromSecurityQuestions(_x118, _x119, _x120, _x121) {
5194
4462
  return _recoverPrivateKeyFromSecurityQuestions.apply(this, arguments);
5195
4463
  }
5196
-
5197
4464
  return recoverPrivateKeyFromSecurityQuestions;
5198
4465
  }()
5199
4466
  /**
@@ -5203,7 +4470,6 @@ var OroClient = /*#__PURE__*/function () {
5203
4470
  * @param password
5204
4471
  */
5205
4472
  ;
5206
-
5207
4473
  _proto.recoverPrivateKeyFromPassword =
5208
4474
  /*#__PURE__*/
5209
4475
  function () {
@@ -5215,21 +4481,17 @@ var OroClient = /*#__PURE__*/function () {
5215
4481
  case 0:
5216
4482
  _context53.next = 2;
5217
4483
  return this.guardClient.identityGet(id);
5218
-
5219
4484
  case 2:
5220
4485
  identity = _context53.sent;
5221
4486
  recoveryPayload = identity.recoveryPassword;
5222
4487
  symmetricDecryptor = this.toolbox.CryptoChaCha.fromPassphrase(password);
5223
4488
  privateKey = symmetricDecryptor.base64PayloadDecryptToBytes(recoveryPayload);
5224
-
5225
4489
  if (identity.recoveryLogin) {
5226
4490
  //Ensure we can recover from a page reload
5227
4491
  symetricEncryptor = this.toolbox.CryptoChaCha.fromPassphrase(identity.recoveryLogin);
5228
4492
  sessionStorage.setItem(sessionStorePrivateKeyName(id), symetricEncryptor.bytesEncryptToBase64Payload(privateKey));
5229
4493
  }
5230
-
5231
4494
  this.rsa = this.toolbox.CryptoRSA.fromKey(privateKey);
5232
-
5233
4495
  case 8:
5234
4496
  case "end":
5235
4497
  return _context53.stop();
@@ -5237,11 +4499,9 @@ var OroClient = /*#__PURE__*/function () {
5237
4499
  }
5238
4500
  }, _callee52, this);
5239
4501
  }));
5240
-
5241
4502
  function recoverPrivateKeyFromPassword(_x122, _x123) {
5242
4503
  return _recoverPrivateKeyFromPassword.apply(this, arguments);
5243
4504
  }
5244
-
5245
4505
  return recoverPrivateKeyFromPassword;
5246
4506
  }()
5247
4507
  /**
@@ -5251,7 +4511,6 @@ var OroClient = /*#__PURE__*/function () {
5251
4511
  * @param masterKey
5252
4512
  */
5253
4513
  ;
5254
-
5255
4514
  _proto.recoverPrivateKeyFromMasterKey =
5256
4515
  /*#__PURE__*/
5257
4516
  function () {
@@ -5263,13 +4522,11 @@ var OroClient = /*#__PURE__*/function () {
5263
4522
  case 0:
5264
4523
  _context54.next = 2;
5265
4524
  return this.guardClient.identityGet(id);
5266
-
5267
4525
  case 2:
5268
4526
  recoveryPayload = _context54.sent.recoveryMasterKey;
5269
4527
  symmetricDecryptor = this.toolbox.CryptoChaCha.fromPassphrase(masterKey);
5270
4528
  privateKey = symmetricDecryptor.base64PayloadDecryptToBytes(recoveryPayload);
5271
4529
  this.rsa = this.toolbox.CryptoRSA.fromKey(privateKey);
5272
-
5273
4530
  case 6:
5274
4531
  case "end":
5275
4532
  return _context54.stop();
@@ -5277,11 +4534,9 @@ var OroClient = /*#__PURE__*/function () {
5277
4534
  }
5278
4535
  }, _callee53, this);
5279
4536
  }));
5280
-
5281
4537
  function recoverPrivateKeyFromMasterKey(_x124, _x125) {
5282
4538
  return _recoverPrivateKeyFromMasterKey.apply(this, arguments);
5283
4539
  }
5284
-
5285
4540
  return recoverPrivateKeyFromMasterKey;
5286
4541
  }()
5287
4542
  /**
@@ -5293,7 +4548,6 @@ var OroClient = /*#__PURE__*/function () {
5293
4548
  * @param threshold the number of answers needed to rebuild the secret
5294
4549
  */
5295
4550
  ;
5296
-
5297
4551
  _proto.updateSecurityQuestions =
5298
4552
  /*#__PURE__*/
5299
4553
  function () {
@@ -5307,9 +4561,7 @@ var OroClient = /*#__PURE__*/function () {
5307
4561
  _context55.next = 2;
5308
4562
  break;
5309
4563
  }
5310
-
5311
4564
  throw IncompleteAuthentication;
5312
-
5313
4565
  case 2:
5314
4566
  securityQuestionPayload = this.toolbox.breakSecretIntoShards(recoverySecurityQuestions, recoverySecurityAnswers, this.rsa["private"](), threshold);
5315
4567
  updateRequest = {
@@ -5317,10 +4569,8 @@ var OroClient = /*#__PURE__*/function () {
5317
4569
  };
5318
4570
  _context55.next = 6;
5319
4571
  return this.guardClient.identityUpdate(id, updateRequest);
5320
-
5321
4572
  case 6:
5322
4573
  return _context55.abrupt("return", _context55.sent);
5323
-
5324
4574
  case 7:
5325
4575
  case "end":
5326
4576
  return _context55.stop();
@@ -5328,11 +4578,9 @@ var OroClient = /*#__PURE__*/function () {
5328
4578
  }
5329
4579
  }, _callee54, this);
5330
4580
  }));
5331
-
5332
4581
  function updateSecurityQuestions(_x126, _x127, _x128, _x129) {
5333
4582
  return _updateSecurityQuestions.apply(this, arguments);
5334
4583
  }
5335
-
5336
4584
  return updateSecurityQuestions;
5337
4585
  }()
5338
4586
  /**
@@ -5347,7 +4595,6 @@ var OroClient = /*#__PURE__*/function () {
5347
4595
  * @param oldPassword
5348
4596
  */
5349
4597
  ;
5350
-
5351
4598
  _proto.updatePassword =
5352
4599
  /*#__PURE__*/
5353
4600
  function () {
@@ -5361,17 +4608,13 @@ var OroClient = /*#__PURE__*/function () {
5361
4608
  _context56.next = 2;
5362
4609
  break;
5363
4610
  }
5364
-
5365
4611
  throw IncompleteAuthentication;
5366
-
5367
4612
  case 2:
5368
4613
  symmetricEncryptor = this.toolbox.CryptoChaCha.fromPassphrase(newPassword);
5369
4614
  passwordPayload = symmetricEncryptor.bytesEncryptToBase64Payload(this.rsa["private"]());
5370
-
5371
4615
  if (oldPassword) {
5372
4616
  oldPassword = this.toolbox.hashStringToBase64(this.toolbox.hashStringToBase64(oldPassword));
5373
4617
  }
5374
-
5375
4618
  newPassword = this.toolbox.hashStringToBase64(this.toolbox.hashStringToBase64(newPassword));
5376
4619
  updateRequest = {
5377
4620
  password: {
@@ -5382,10 +4625,8 @@ var OroClient = /*#__PURE__*/function () {
5382
4625
  };
5383
4626
  _context56.next = 9;
5384
4627
  return this.guardClient.identityUpdate(id, updateRequest);
5385
-
5386
4628
  case 9:
5387
4629
  return _context56.abrupt("return", _context56.sent);
5388
-
5389
4630
  case 10:
5390
4631
  case "end":
5391
4632
  return _context56.stop();
@@ -5393,11 +4634,9 @@ var OroClient = /*#__PURE__*/function () {
5393
4634
  }
5394
4635
  }, _callee55, this);
5395
4636
  }));
5396
-
5397
4637
  function updatePassword(_x130, _x131, _x132) {
5398
4638
  return _updatePassword.apply(this, arguments);
5399
4639
  }
5400
-
5401
4640
  return updatePassword;
5402
4641
  }()
5403
4642
  /**
@@ -5409,7 +4648,6 @@ var OroClient = /*#__PURE__*/function () {
5409
4648
  * @param lockboxUuid
5410
4649
  */
5411
4650
  ;
5412
-
5413
4651
  _proto.updateMasterKey =
5414
4652
  /*#__PURE__*/
5415
4653
  function () {
@@ -5423,9 +4661,7 @@ var OroClient = /*#__PURE__*/function () {
5423
4661
  _context57.next = 2;
5424
4662
  break;
5425
4663
  }
5426
-
5427
4664
  throw IncompleteAuthentication;
5428
-
5429
4665
  case 2:
5430
4666
  symmetricEncryptor = this.toolbox.CryptoChaCha.fromPassphrase(masterKey);
5431
4667
  masterKeyPayload = symmetricEncryptor.bytesEncryptToBase64Payload(this.rsa["private"]());
@@ -5434,7 +4670,6 @@ var OroClient = /*#__PURE__*/function () {
5434
4670
  };
5435
4671
  _context57.next = 7;
5436
4672
  return this.guardClient.identityUpdate(id, updateRequest);
5437
-
5438
4673
  case 7:
5439
4674
  updatedIdentity = _context57.sent;
5440
4675
  _context57.next = 10;
@@ -5446,10 +4681,8 @@ var OroClient = /*#__PURE__*/function () {
5446
4681
  }, {}, {
5447
4682
  forceReplace: true
5448
4683
  });
5449
-
5450
4684
  case 10:
5451
4685
  return _context57.abrupt("return", updatedIdentity);
5452
-
5453
4686
  case 11:
5454
4687
  case "end":
5455
4688
  return _context57.stop();
@@ -5457,19 +4690,16 @@ var OroClient = /*#__PURE__*/function () {
5457
4690
  }
5458
4691
  }, _callee56, this);
5459
4692
  }));
5460
-
5461
4693
  function updateMasterKey(_x133, _x134, _x135) {
5462
4694
  return _updateMasterKey.apply(this, arguments);
5463
4695
  }
5464
-
5465
4696
  return updateMasterKey;
5466
4697
  }();
5467
-
5468
4698
  return OroClient;
5469
4699
  }();
5470
4700
 
5471
4701
  var _excluded = ["locale"],
5472
- _excluded2 = ["locale"];
4702
+ _excluded2 = ["locale"];
5473
4703
  var CliniaService = /*#__PURE__*/function () {
5474
4704
  function CliniaService(url, apiKey, locale) {
5475
4705
  this.url = url;
@@ -5480,30 +4710,24 @@ var CliniaService = /*#__PURE__*/function () {
5480
4710
  }
5481
4711
  });
5482
4712
  }
5483
-
5484
4713
  var _proto = CliniaService.prototype;
5485
-
5486
4714
  _proto.placeSearch = function placeSearch(searchOptions) {
5487
4715
  var locale = searchOptions.locale,
5488
- data = _objectWithoutPropertiesLoose(searchOptions, _excluded);
5489
-
4716
+ data = _objectWithoutPropertiesLoose(searchOptions, _excluded);
5490
4717
  return this.api.post(this.url + "/search/v1/indexes/health_facility/query", data, {
5491
4718
  params: {
5492
4719
  locale: locale != null ? locale : this.locale
5493
4720
  }
5494
4721
  });
5495
4722
  };
5496
-
5497
4723
  _proto.placeMatch = function placeMatch(searchOptions, type) {
5498
4724
  var locale = searchOptions.locale,
5499
- data = _objectWithoutPropertiesLoose(searchOptions, _excluded2);
5500
-
4725
+ data = _objectWithoutPropertiesLoose(searchOptions, _excluded2);
5501
4726
  var request = this.api.post(this.url + "/search/v1/matches", data, {
5502
4727
  params: {
5503
4728
  locale: locale != null ? locale : this.locale
5504
4729
  }
5505
4730
  });
5506
-
5507
4731
  if (type) {
5508
4732
  request = request.then(function (places) {
5509
4733
  return places.filter(function (place) {
@@ -5511,10 +4735,8 @@ var CliniaService = /*#__PURE__*/function () {
5511
4735
  });
5512
4736
  });
5513
4737
  }
5514
-
5515
4738
  return request;
5516
4739
  };
5517
-
5518
4740
  return CliniaService;
5519
4741
  }();
5520
4742
 
@@ -5533,27 +4755,25 @@ var wasmPath = 'node_modules/oro-toolbox';
5533
4755
  * @param authenticationCallback (optional) authenticationCallback the authentification callback
5534
4756
  * @returns an instance of OroClient
5535
4757
  */
5536
-
5537
4758
  var init = function init(toolbox, tellerBaseURL, vaultBaseURL, guardBaseURL, searchBaseURL, practiceBaseURL, consultBaseURL, workflowBaseURL, diagnosisBaseURL, authenticationCallback) {
5538
4759
  var _initApis = initApis__default({
5539
- tellerBaseURL: tellerBaseURL,
5540
- vaultBaseURL: vaultBaseURL,
5541
- guardBaseURL: guardBaseURL,
5542
- searchBaseURL: searchBaseURL,
5543
- practiceBaseURL: practiceBaseURL,
5544
- consultBaseURL: consultBaseURL,
5545
- workflowBaseURL: workflowBaseURL,
5546
- diagnosisBaseURL: diagnosisBaseURL
5547
- }, authenticationCallback),
5548
- tellerService = _initApis.tellerService,
5549
- practiceService = _initApis.practiceService,
5550
- consultService = _initApis.consultService,
5551
- vaultService = _initApis.vaultService,
5552
- guardService = _initApis.guardService,
5553
- searchService = _initApis.searchService,
5554
- workflowService = _initApis.workflowService,
5555
- diagnosisService = _initApis.diagnosisService;
5556
-
4760
+ tellerBaseURL: tellerBaseURL,
4761
+ vaultBaseURL: vaultBaseURL,
4762
+ guardBaseURL: guardBaseURL,
4763
+ searchBaseURL: searchBaseURL,
4764
+ practiceBaseURL: practiceBaseURL,
4765
+ consultBaseURL: consultBaseURL,
4766
+ workflowBaseURL: workflowBaseURL,
4767
+ diagnosisBaseURL: diagnosisBaseURL
4768
+ }, authenticationCallback),
4769
+ tellerService = _initApis.tellerService,
4770
+ practiceService = _initApis.practiceService,
4771
+ consultService = _initApis.consultService,
4772
+ vaultService = _initApis.vaultService,
4773
+ guardService = _initApis.guardService,
4774
+ searchService = _initApis.searchService,
4775
+ workflowService = _initApis.workflowService,
4776
+ diagnosisService = _initApis.diagnosisService;
5557
4777
  var client = new OroClient(toolbox, tellerService, vaultService, guardService, searchService, practiceService, consultService, workflowService, diagnosisService, authenticationCallback);
5558
4778
  return client;
5559
4779
  };