oro-sdk-apis 4.3.2 → 5.14.0-dev1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,119 +8,433 @@ import axios from 'axios';
8
8
  * @param value the string to hash
9
9
  * @returns a base64 string representation of a hashed value
10
10
  */
11
+
11
12
  function hashToBase64String(value) {
12
13
  return Buffer.from(sha256().update(value).digest('hex'), 'hex').toString('base64');
13
14
  }
14
15
 
15
- function _regeneratorRuntime() {
16
- _regeneratorRuntime = function () {
17
- return exports;
16
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
17
+ try {
18
+ var info = gen[key](arg);
19
+ var value = info.value;
20
+ } catch (error) {
21
+ reject(error);
22
+ return;
23
+ }
24
+
25
+ if (info.done) {
26
+ resolve(value);
27
+ } else {
28
+ Promise.resolve(value).then(_next, _throw);
29
+ }
30
+ }
31
+
32
+ function _asyncToGenerator(fn) {
33
+ return function () {
34
+ var self = this,
35
+ args = arguments;
36
+ return new Promise(function (resolve, reject) {
37
+ var gen = fn.apply(self, args);
38
+
39
+ function _next(value) {
40
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
41
+ }
42
+
43
+ function _throw(err) {
44
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
45
+ }
46
+
47
+ _next(undefined);
48
+ });
18
49
  };
19
- var exports = {},
20
- Op = Object.prototype,
21
- hasOwn = Op.hasOwnProperty,
22
- defineProperty = Object.defineProperty || function (obj, key, desc) {
23
- obj[key] = desc.value;
24
- },
25
- $Symbol = "function" == typeof Symbol ? Symbol : {},
26
- iteratorSymbol = $Symbol.iterator || "@@iterator",
27
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
28
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
50
+ }
51
+
52
+ function _extends() {
53
+ _extends = Object.assign || function (target) {
54
+ for (var i = 1; i < arguments.length; i++) {
55
+ var source = arguments[i];
56
+
57
+ for (var key in source) {
58
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
59
+ target[key] = source[key];
60
+ }
61
+ }
62
+ }
63
+
64
+ return target;
65
+ };
66
+
67
+ return _extends.apply(this, arguments);
68
+ }
69
+
70
+ function _inheritsLoose(subClass, superClass) {
71
+ subClass.prototype = Object.create(superClass.prototype);
72
+ subClass.prototype.constructor = subClass;
73
+
74
+ _setPrototypeOf(subClass, superClass);
75
+ }
76
+
77
+ function _getPrototypeOf(o) {
78
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
79
+ return o.__proto__ || Object.getPrototypeOf(o);
80
+ };
81
+ return _getPrototypeOf(o);
82
+ }
83
+
84
+ function _setPrototypeOf(o, p) {
85
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
86
+ o.__proto__ = p;
87
+ return o;
88
+ };
89
+
90
+ return _setPrototypeOf(o, p);
91
+ }
92
+
93
+ function _isNativeReflectConstruct() {
94
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
95
+ if (Reflect.construct.sham) return false;
96
+ if (typeof Proxy === "function") return true;
97
+
98
+ try {
99
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
100
+ return true;
101
+ } catch (e) {
102
+ return false;
103
+ }
104
+ }
105
+
106
+ function _construct(Parent, args, Class) {
107
+ if (_isNativeReflectConstruct()) {
108
+ _construct = Reflect.construct;
109
+ } else {
110
+ _construct = function _construct(Parent, args, Class) {
111
+ var a = [null];
112
+ a.push.apply(a, args);
113
+ var Constructor = Function.bind.apply(Parent, a);
114
+ var instance = new Constructor();
115
+ if (Class) _setPrototypeOf(instance, Class.prototype);
116
+ return instance;
117
+ };
118
+ }
119
+
120
+ return _construct.apply(null, arguments);
121
+ }
122
+
123
+ function _isNativeFunction(fn) {
124
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
125
+ }
126
+
127
+ function _wrapNativeSuper(Class) {
128
+ var _cache = typeof Map === "function" ? new Map() : undefined;
129
+
130
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
131
+ if (Class === null || !_isNativeFunction(Class)) return Class;
132
+
133
+ if (typeof Class !== "function") {
134
+ throw new TypeError("Super expression must either be null or a function");
135
+ }
136
+
137
+ if (typeof _cache !== "undefined") {
138
+ if (_cache.has(Class)) return _cache.get(Class);
139
+
140
+ _cache.set(Class, Wrapper);
141
+ }
142
+
143
+ function Wrapper() {
144
+ return _construct(Class, arguments, _getPrototypeOf(this).constructor);
145
+ }
146
+
147
+ Wrapper.prototype = Object.create(Class.prototype, {
148
+ constructor: {
149
+ value: Wrapper,
150
+ enumerable: false,
151
+ writable: true,
152
+ configurable: true
153
+ }
154
+ });
155
+ return _setPrototypeOf(Wrapper, Class);
156
+ };
157
+
158
+ return _wrapNativeSuper(Class);
159
+ }
160
+
161
+ function _assertThisInitialized(self) {
162
+ if (self === void 0) {
163
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
164
+ }
165
+
166
+ return self;
167
+ }
168
+
169
+ function createCommonjsModule(fn, module) {
170
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
171
+ }
172
+
173
+ var runtime_1 = createCommonjsModule(function (module) {
174
+ /**
175
+ * Copyright (c) 2014-present, Facebook, Inc.
176
+ *
177
+ * This source code is licensed under the MIT license found in the
178
+ * LICENSE file in the root directory of this source tree.
179
+ */
180
+
181
+ var runtime = (function (exports) {
182
+
183
+ var Op = Object.prototype;
184
+ var hasOwn = Op.hasOwnProperty;
185
+ var undefined$1; // More compressible than void 0.
186
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
187
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
188
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
189
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
190
+
29
191
  function define(obj, key, value) {
30
- return Object.defineProperty(obj, key, {
192
+ Object.defineProperty(obj, key, {
31
193
  value: value,
32
- enumerable: !0,
33
- configurable: !0,
34
- writable: !0
35
- }), obj[key];
194
+ enumerable: true,
195
+ configurable: true,
196
+ writable: true
197
+ });
198
+ return obj[key];
36
199
  }
37
200
  try {
201
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
38
202
  define({}, "");
39
203
  } catch (err) {
40
- define = function (obj, key, value) {
204
+ define = function(obj, key, value) {
41
205
  return obj[key] = value;
42
206
  };
43
207
  }
208
+
44
209
  function wrap(innerFn, outerFn, self, tryLocsList) {
45
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
46
- generator = Object.create(protoGenerator.prototype),
47
- context = new Context(tryLocsList || []);
48
- return defineProperty(generator, "_invoke", {
49
- value: makeInvokeMethod(innerFn, self, context)
50
- }), generator;
210
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
211
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
212
+ var generator = Object.create(protoGenerator.prototype);
213
+ var context = new Context(tryLocsList || []);
214
+
215
+ // The ._invoke method unifies the implementations of the .next,
216
+ // .throw, and .return methods.
217
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
218
+
219
+ return generator;
51
220
  }
221
+ exports.wrap = wrap;
222
+
223
+ // Try/catch helper to minimize deoptimizations. Returns a completion
224
+ // record like context.tryEntries[i].completion. This interface could
225
+ // have been (and was previously) designed to take a closure to be
226
+ // invoked without arguments, but in all the cases we care about we
227
+ // already have an existing method we want to call, so there's no need
228
+ // to create a new function object. We can even get away with assuming
229
+ // the method takes exactly one argument, since that happens to be true
230
+ // in every case, so we don't have to touch the arguments object. The
231
+ // only additional allocation required is the completion record, which
232
+ // has a stable shape and so hopefully should be cheap to allocate.
52
233
  function tryCatch(fn, obj, arg) {
53
234
  try {
54
- return {
55
- type: "normal",
56
- arg: fn.call(obj, arg)
57
- };
235
+ return { type: "normal", arg: fn.call(obj, arg) };
58
236
  } catch (err) {
59
- return {
60
- type: "throw",
61
- arg: err
62
- };
237
+ return { type: "throw", arg: err };
63
238
  }
64
239
  }
65
- exports.wrap = wrap;
240
+
241
+ var GenStateSuspendedStart = "suspendedStart";
242
+ var GenStateSuspendedYield = "suspendedYield";
243
+ var GenStateExecuting = "executing";
244
+ var GenStateCompleted = "completed";
245
+
246
+ // Returning this object from the innerFn has the same effect as
247
+ // breaking out of the dispatch switch statement.
66
248
  var ContinueSentinel = {};
249
+
250
+ // Dummy constructor functions that we use as the .constructor and
251
+ // .constructor.prototype properties for functions that return Generator
252
+ // objects. For full spec compliance, you may wish to configure your
253
+ // minifier not to mangle the names of these two functions.
67
254
  function Generator() {}
68
255
  function GeneratorFunction() {}
69
256
  function GeneratorFunctionPrototype() {}
257
+
258
+ // This is a polyfill for %IteratorPrototype% for environments that
259
+ // don't natively support it.
70
260
  var IteratorPrototype = {};
71
261
  define(IteratorPrototype, iteratorSymbol, function () {
72
262
  return this;
73
263
  });
74
- var getProto = Object.getPrototypeOf,
75
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
76
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
77
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
264
+
265
+ var getProto = Object.getPrototypeOf;
266
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
267
+ if (NativeIteratorPrototype &&
268
+ NativeIteratorPrototype !== Op &&
269
+ hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
270
+ // This environment has a native %IteratorPrototype%; use it instead
271
+ // of the polyfill.
272
+ IteratorPrototype = NativeIteratorPrototype;
273
+ }
274
+
275
+ var Gp = GeneratorFunctionPrototype.prototype =
276
+ Generator.prototype = Object.create(IteratorPrototype);
277
+ GeneratorFunction.prototype = GeneratorFunctionPrototype;
278
+ define(Gp, "constructor", GeneratorFunctionPrototype);
279
+ define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
280
+ GeneratorFunction.displayName = define(
281
+ GeneratorFunctionPrototype,
282
+ toStringTagSymbol,
283
+ "GeneratorFunction"
284
+ );
285
+
286
+ // Helper for defining the .next, .throw, and .return methods of the
287
+ // Iterator interface in terms of a single ._invoke method.
78
288
  function defineIteratorMethods(prototype) {
79
- ["next", "throw", "return"].forEach(function (method) {
80
- define(prototype, method, function (arg) {
289
+ ["next", "throw", "return"].forEach(function(method) {
290
+ define(prototype, method, function(arg) {
81
291
  return this._invoke(method, arg);
82
292
  });
83
293
  });
84
294
  }
295
+
296
+ exports.isGeneratorFunction = function(genFun) {
297
+ var ctor = typeof genFun === "function" && genFun.constructor;
298
+ return ctor
299
+ ? ctor === GeneratorFunction ||
300
+ // For the native GeneratorFunction constructor, the best we can
301
+ // do is to check its .name property.
302
+ (ctor.displayName || ctor.name) === "GeneratorFunction"
303
+ : false;
304
+ };
305
+
306
+ exports.mark = function(genFun) {
307
+ if (Object.setPrototypeOf) {
308
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
309
+ } else {
310
+ genFun.__proto__ = GeneratorFunctionPrototype;
311
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
312
+ }
313
+ genFun.prototype = Object.create(Gp);
314
+ return genFun;
315
+ };
316
+
317
+ // Within the body of any async function, `await x` is transformed to
318
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
319
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
320
+ // meant to be awaited.
321
+ exports.awrap = function(arg) {
322
+ return { __await: arg };
323
+ };
324
+
85
325
  function AsyncIterator(generator, PromiseImpl) {
86
326
  function invoke(method, arg, resolve, reject) {
87
327
  var record = tryCatch(generator[method], generator, arg);
88
- if ("throw" !== record.type) {
89
- var result = record.arg,
90
- value = result.value;
91
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
92
- invoke("next", value, resolve, reject);
93
- }, function (err) {
94
- invoke("throw", err, resolve, reject);
95
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
96
- result.value = unwrapped, resolve(result);
97
- }, function (error) {
328
+ if (record.type === "throw") {
329
+ reject(record.arg);
330
+ } else {
331
+ var result = record.arg;
332
+ var value = result.value;
333
+ if (value &&
334
+ typeof value === "object" &&
335
+ hasOwn.call(value, "__await")) {
336
+ return PromiseImpl.resolve(value.__await).then(function(value) {
337
+ invoke("next", value, resolve, reject);
338
+ }, function(err) {
339
+ invoke("throw", err, resolve, reject);
340
+ });
341
+ }
342
+
343
+ return PromiseImpl.resolve(value).then(function(unwrapped) {
344
+ // When a yielded Promise is resolved, its final value becomes
345
+ // the .value of the Promise<{value,done}> result for the
346
+ // current iteration.
347
+ result.value = unwrapped;
348
+ resolve(result);
349
+ }, function(error) {
350
+ // If a rejected Promise was yielded, throw the rejection back
351
+ // into the async generator function so it can be handled there.
98
352
  return invoke("throw", error, resolve, reject);
99
353
  });
100
354
  }
101
- reject(record.arg);
102
355
  }
356
+
103
357
  var previousPromise;
104
- defineProperty(this, "_invoke", {
105
- value: function (method, arg) {
106
- function callInvokeWithMethodAndArg() {
107
- return new PromiseImpl(function (resolve, reject) {
108
- invoke(method, arg, resolve, reject);
109
- });
110
- }
111
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
358
+
359
+ function enqueue(method, arg) {
360
+ function callInvokeWithMethodAndArg() {
361
+ return new PromiseImpl(function(resolve, reject) {
362
+ invoke(method, arg, resolve, reject);
363
+ });
112
364
  }
113
- });
365
+
366
+ return previousPromise =
367
+ // If enqueue has been called before, then we want to wait until
368
+ // all previous Promises have been resolved before calling invoke,
369
+ // so that results are always delivered in the correct order. If
370
+ // enqueue has not been called before, then it is important to
371
+ // call invoke immediately, without waiting on a callback to fire,
372
+ // so that the async generator function has the opportunity to do
373
+ // any necessary setup in a predictable way. This predictability
374
+ // is why the Promise constructor synchronously invokes its
375
+ // executor callback, and why async functions synchronously
376
+ // execute code before the first await. Since we implement simple
377
+ // async functions in terms of async generators, it is especially
378
+ // important to get this right, even though it requires care.
379
+ previousPromise ? previousPromise.then(
380
+ callInvokeWithMethodAndArg,
381
+ // Avoid propagating failures to Promises returned by later
382
+ // invocations of the iterator.
383
+ callInvokeWithMethodAndArg
384
+ ) : callInvokeWithMethodAndArg();
385
+ }
386
+
387
+ // Define the unified helper method that is used to implement .next,
388
+ // .throw, and .return (see defineIteratorMethods).
389
+ this._invoke = enqueue;
114
390
  }
391
+
392
+ defineIteratorMethods(AsyncIterator.prototype);
393
+ define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
394
+ return this;
395
+ });
396
+ exports.AsyncIterator = AsyncIterator;
397
+
398
+ // Note that simple async functions are implemented on top of
399
+ // AsyncIterator objects; they just return a Promise for the value of
400
+ // the final result produced by the iterator.
401
+ exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
402
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
403
+
404
+ var iter = new AsyncIterator(
405
+ wrap(innerFn, outerFn, self, tryLocsList),
406
+ PromiseImpl
407
+ );
408
+
409
+ return exports.isGeneratorFunction(outerFn)
410
+ ? iter // If outerFn is a generator, return the full iterator.
411
+ : iter.next().then(function(result) {
412
+ return result.done ? result.value : iter.next();
413
+ });
414
+ };
415
+
115
416
  function makeInvokeMethod(innerFn, self, context) {
116
- var state = "suspendedStart";
117
- return function (method, arg) {
118
- if ("executing" === state) throw new Error("Generator is already running");
119
- if ("completed" === state) {
120
- if ("throw" === method) throw arg;
417
+ var state = GenStateSuspendedStart;
418
+
419
+ return function invoke(method, arg) {
420
+ if (state === GenStateExecuting) {
421
+ throw new Error("Generator is already running");
422
+ }
423
+
424
+ if (state === GenStateCompleted) {
425
+ if (method === "throw") {
426
+ throw arg;
427
+ }
428
+
429
+ // Be forgiving, per 25.3.3.3.3 of the spec:
430
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
121
431
  return doneResult();
122
432
  }
123
- for (context.method = method, context.arg = arg;;) {
433
+
434
+ context.method = method;
435
+ context.arg = arg;
436
+
437
+ while (true) {
124
438
  var delegate = context.delegate;
125
439
  if (delegate) {
126
440
  var delegateResult = maybeInvokeDelegate(delegate, context);
@@ -129,407 +443,605 @@ function _regeneratorRuntime() {
129
443
  return delegateResult;
130
444
  }
131
445
  }
132
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
133
- if ("suspendedStart" === state) throw state = "completed", context.arg;
446
+
447
+ if (context.method === "next") {
448
+ // Setting context._sent for legacy support of Babel's
449
+ // function.sent implementation.
450
+ context.sent = context._sent = context.arg;
451
+
452
+ } else if (context.method === "throw") {
453
+ if (state === GenStateSuspendedStart) {
454
+ state = GenStateCompleted;
455
+ throw context.arg;
456
+ }
457
+
134
458
  context.dispatchException(context.arg);
135
- } else "return" === context.method && context.abrupt("return", context.arg);
136
- state = "executing";
459
+
460
+ } else if (context.method === "return") {
461
+ context.abrupt("return", context.arg);
462
+ }
463
+
464
+ state = GenStateExecuting;
465
+
137
466
  var record = tryCatch(innerFn, self, context);
138
- if ("normal" === record.type) {
139
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
467
+ if (record.type === "normal") {
468
+ // If an exception is thrown from innerFn, we leave state ===
469
+ // GenStateExecuting and loop back for another invocation.
470
+ state = context.done
471
+ ? GenStateCompleted
472
+ : GenStateSuspendedYield;
473
+
474
+ if (record.arg === ContinueSentinel) {
475
+ continue;
476
+ }
477
+
140
478
  return {
141
479
  value: record.arg,
142
480
  done: context.done
143
481
  };
482
+
483
+ } else if (record.type === "throw") {
484
+ state = GenStateCompleted;
485
+ // Dispatch the exception by looping back around to the
486
+ // context.dispatchException(context.arg) call above.
487
+ context.method = "throw";
488
+ context.arg = record.arg;
144
489
  }
145
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
146
490
  }
147
491
  };
148
492
  }
493
+
494
+ // Call delegate.iterator[context.method](context.arg) and handle the
495
+ // result, either by returning a { value, done } result from the
496
+ // delegate iterator, or by modifying context.method and context.arg,
497
+ // setting context.delegate to null, and returning the ContinueSentinel.
149
498
  function maybeInvokeDelegate(delegate, context) {
150
- var methodName = context.method,
151
- method = delegate.iterator[methodName];
152
- if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
499
+ var method = delegate.iterator[context.method];
500
+ if (method === undefined$1) {
501
+ // A .throw or .return when the delegate iterator has no .throw
502
+ // method always terminates the yield* loop.
503
+ context.delegate = null;
504
+
505
+ if (context.method === "throw") {
506
+ // Note: ["return"] must be used for ES3 parsing compatibility.
507
+ if (delegate.iterator["return"]) {
508
+ // If the delegate iterator has a return method, give it a
509
+ // chance to clean up.
510
+ context.method = "return";
511
+ context.arg = undefined$1;
512
+ maybeInvokeDelegate(delegate, context);
513
+
514
+ if (context.method === "throw") {
515
+ // If maybeInvokeDelegate(context) changed context.method from
516
+ // "return" to "throw", let that override the TypeError below.
517
+ return ContinueSentinel;
518
+ }
519
+ }
520
+
521
+ context.method = "throw";
522
+ context.arg = new TypeError(
523
+ "The iterator does not provide a 'throw' method");
524
+ }
525
+
526
+ return ContinueSentinel;
527
+ }
528
+
153
529
  var record = tryCatch(method, delegate.iterator, context.arg);
154
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
530
+
531
+ if (record.type === "throw") {
532
+ context.method = "throw";
533
+ context.arg = record.arg;
534
+ context.delegate = null;
535
+ return ContinueSentinel;
536
+ }
537
+
155
538
  var info = record.arg;
156
- 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);
539
+
540
+ if (! info) {
541
+ context.method = "throw";
542
+ context.arg = new TypeError("iterator result is not an object");
543
+ context.delegate = null;
544
+ return ContinueSentinel;
545
+ }
546
+
547
+ if (info.done) {
548
+ // Assign the result of the finished delegate to the temporary
549
+ // variable specified by delegate.resultName (see delegateYield).
550
+ context[delegate.resultName] = info.value;
551
+
552
+ // Resume execution at the desired location (see delegateYield).
553
+ context.next = delegate.nextLoc;
554
+
555
+ // If context.method was "throw" but the delegate handled the
556
+ // exception, let the outer generator proceed normally. If
557
+ // context.method was "next", forget context.arg since it has been
558
+ // "consumed" by the delegate iterator. If context.method was
559
+ // "return", allow the original .return call to continue in the
560
+ // outer generator.
561
+ if (context.method !== "return") {
562
+ context.method = "next";
563
+ context.arg = undefined$1;
564
+ }
565
+
566
+ } else {
567
+ // Re-yield the result returned by the delegate method.
568
+ return info;
569
+ }
570
+
571
+ // The delegate iterator is finished, so forget it and continue with
572
+ // the outer generator.
573
+ context.delegate = null;
574
+ return ContinueSentinel;
157
575
  }
576
+
577
+ // Define Generator.prototype.{next,throw,return} in terms of the
578
+ // unified ._invoke helper method.
579
+ defineIteratorMethods(Gp);
580
+
581
+ define(Gp, toStringTagSymbol, "Generator");
582
+
583
+ // A Generator should always return itself as the iterator object when the
584
+ // @@iterator function is called on it. Some browsers' implementations of the
585
+ // iterator prototype chain incorrectly implement this, causing the Generator
586
+ // object to not be returned from this call. This ensures that doesn't happen.
587
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
588
+ define(Gp, iteratorSymbol, function() {
589
+ return this;
590
+ });
591
+
592
+ define(Gp, "toString", function() {
593
+ return "[object Generator]";
594
+ });
595
+
158
596
  function pushTryEntry(locs) {
159
- var entry = {
160
- tryLoc: locs[0]
161
- };
162
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
597
+ var entry = { tryLoc: locs[0] };
598
+
599
+ if (1 in locs) {
600
+ entry.catchLoc = locs[1];
601
+ }
602
+
603
+ if (2 in locs) {
604
+ entry.finallyLoc = locs[2];
605
+ entry.afterLoc = locs[3];
606
+ }
607
+
608
+ this.tryEntries.push(entry);
163
609
  }
610
+
164
611
  function resetTryEntry(entry) {
165
612
  var record = entry.completion || {};
166
- record.type = "normal", delete record.arg, entry.completion = record;
613
+ record.type = "normal";
614
+ delete record.arg;
615
+ entry.completion = record;
167
616
  }
617
+
168
618
  function Context(tryLocsList) {
169
- this.tryEntries = [{
170
- tryLoc: "root"
171
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
619
+ // The root entry object (effectively a try statement without a catch
620
+ // or a finally block) gives us a place to store values thrown from
621
+ // locations where there is no enclosing try statement.
622
+ this.tryEntries = [{ tryLoc: "root" }];
623
+ tryLocsList.forEach(pushTryEntry, this);
624
+ this.reset(true);
172
625
  }
626
+
627
+ exports.keys = function(object) {
628
+ var keys = [];
629
+ for (var key in object) {
630
+ keys.push(key);
631
+ }
632
+ keys.reverse();
633
+
634
+ // Rather than returning an object with a next method, we keep
635
+ // things simple and return the next function itself.
636
+ return function next() {
637
+ while (keys.length) {
638
+ var key = keys.pop();
639
+ if (key in object) {
640
+ next.value = key;
641
+ next.done = false;
642
+ return next;
643
+ }
644
+ }
645
+
646
+ // To avoid creating an additional object, we just hang the .value
647
+ // and .done properties off the next function object itself. This
648
+ // also ensures that the minifier will not anonymize the function.
649
+ next.done = true;
650
+ return next;
651
+ };
652
+ };
653
+
173
654
  function values(iterable) {
174
655
  if (iterable) {
175
656
  var iteratorMethod = iterable[iteratorSymbol];
176
- if (iteratorMethod) return iteratorMethod.call(iterable);
177
- if ("function" == typeof iterable.next) return iterable;
657
+ if (iteratorMethod) {
658
+ return iteratorMethod.call(iterable);
659
+ }
660
+
661
+ if (typeof iterable.next === "function") {
662
+ return iterable;
663
+ }
664
+
178
665
  if (!isNaN(iterable.length)) {
179
- var i = -1,
180
- next = function next() {
181
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
182
- return next.value = undefined, next.done = !0, next;
183
- };
666
+ var i = -1, next = function next() {
667
+ while (++i < iterable.length) {
668
+ if (hasOwn.call(iterable, i)) {
669
+ next.value = iterable[i];
670
+ next.done = false;
671
+ return next;
672
+ }
673
+ }
674
+
675
+ next.value = undefined$1;
676
+ next.done = true;
677
+
678
+ return next;
679
+ };
680
+
184
681
  return next.next = next;
185
682
  }
186
683
  }
187
- return {
188
- next: doneResult
189
- };
684
+
685
+ // Return an iterator with no values.
686
+ return { next: doneResult };
190
687
  }
688
+ exports.values = values;
689
+
191
690
  function doneResult() {
192
- return {
193
- value: undefined,
194
- done: !0
195
- };
691
+ return { value: undefined$1, done: true };
196
692
  }
197
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
198
- value: GeneratorFunctionPrototype,
199
- configurable: !0
200
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
201
- value: GeneratorFunction,
202
- configurable: !0
203
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
204
- var ctor = "function" == typeof genFun && genFun.constructor;
205
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
206
- }, exports.mark = function (genFun) {
207
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
208
- }, exports.awrap = function (arg) {
209
- return {
210
- __await: arg
211
- };
212
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
213
- return this;
214
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
215
- void 0 === PromiseImpl && (PromiseImpl = Promise);
216
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
217
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
218
- return result.done ? result.value : iter.next();
219
- });
220
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
221
- return this;
222
- }), define(Gp, "toString", function () {
223
- return "[object Generator]";
224
- }), exports.keys = function (val) {
225
- var object = Object(val),
226
- keys = [];
227
- for (var key in object) keys.push(key);
228
- return keys.reverse(), function next() {
229
- for (; keys.length;) {
230
- var key = keys.pop();
231
- if (key in object) return next.value = key, next.done = !1, next;
232
- }
233
- return next.done = !0, next;
234
- };
235
- }, exports.values = values, Context.prototype = {
693
+
694
+ Context.prototype = {
236
695
  constructor: Context,
237
- reset: function (skipTempReset) {
238
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
696
+
697
+ reset: function(skipTempReset) {
698
+ this.prev = 0;
699
+ this.next = 0;
700
+ // Resetting context._sent for legacy support of Babel's
701
+ // function.sent implementation.
702
+ this.sent = this._sent = undefined$1;
703
+ this.done = false;
704
+ this.delegate = null;
705
+
706
+ this.method = "next";
707
+ this.arg = undefined$1;
708
+
709
+ this.tryEntries.forEach(resetTryEntry);
710
+
711
+ if (!skipTempReset) {
712
+ for (var name in this) {
713
+ // Not sure about the optimal order of these conditions:
714
+ if (name.charAt(0) === "t" &&
715
+ hasOwn.call(this, name) &&
716
+ !isNaN(+name.slice(1))) {
717
+ this[name] = undefined$1;
718
+ }
719
+ }
720
+ }
239
721
  },
240
- stop: function () {
241
- this.done = !0;
242
- var rootRecord = this.tryEntries[0].completion;
243
- if ("throw" === rootRecord.type) throw rootRecord.arg;
722
+
723
+ stop: function() {
724
+ this.done = true;
725
+
726
+ var rootEntry = this.tryEntries[0];
727
+ var rootRecord = rootEntry.completion;
728
+ if (rootRecord.type === "throw") {
729
+ throw rootRecord.arg;
730
+ }
731
+
244
732
  return this.rval;
245
733
  },
246
- dispatchException: function (exception) {
247
- if (this.done) throw exception;
734
+
735
+ dispatchException: function(exception) {
736
+ if (this.done) {
737
+ throw exception;
738
+ }
739
+
248
740
  var context = this;
249
741
  function handle(loc, caught) {
250
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
742
+ record.type = "throw";
743
+ record.arg = exception;
744
+ context.next = loc;
745
+
746
+ if (caught) {
747
+ // If the dispatched exception was caught by a catch block,
748
+ // then let that catch block handle the exception normally.
749
+ context.method = "next";
750
+ context.arg = undefined$1;
751
+ }
752
+
753
+ return !! caught;
251
754
  }
755
+
252
756
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
253
- var entry = this.tryEntries[i],
254
- record = entry.completion;
255
- if ("root" === entry.tryLoc) return handle("end");
757
+ var entry = this.tryEntries[i];
758
+ var record = entry.completion;
759
+
760
+ if (entry.tryLoc === "root") {
761
+ // Exception thrown outside of any try block that could handle
762
+ // it, so set the completion value of the entire function to
763
+ // throw the exception.
764
+ return handle("end");
765
+ }
766
+
256
767
  if (entry.tryLoc <= this.prev) {
257
- var hasCatch = hasOwn.call(entry, "catchLoc"),
258
- hasFinally = hasOwn.call(entry, "finallyLoc");
768
+ var hasCatch = hasOwn.call(entry, "catchLoc");
769
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
770
+
259
771
  if (hasCatch && hasFinally) {
260
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
261
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
772
+ if (this.prev < entry.catchLoc) {
773
+ return handle(entry.catchLoc, true);
774
+ } else if (this.prev < entry.finallyLoc) {
775
+ return handle(entry.finallyLoc);
776
+ }
777
+
262
778
  } else if (hasCatch) {
263
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
779
+ if (this.prev < entry.catchLoc) {
780
+ return handle(entry.catchLoc, true);
781
+ }
782
+
783
+ } else if (hasFinally) {
784
+ if (this.prev < entry.finallyLoc) {
785
+ return handle(entry.finallyLoc);
786
+ }
787
+
264
788
  } else {
265
- if (!hasFinally) throw new Error("try statement without catch or finally");
266
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
789
+ throw new Error("try statement without catch or finally");
267
790
  }
268
791
  }
269
792
  }
270
793
  },
271
- abrupt: function (type, arg) {
794
+
795
+ abrupt: function(type, arg) {
272
796
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
273
797
  var entry = this.tryEntries[i];
274
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
798
+ if (entry.tryLoc <= this.prev &&
799
+ hasOwn.call(entry, "finallyLoc") &&
800
+ this.prev < entry.finallyLoc) {
275
801
  var finallyEntry = entry;
276
802
  break;
277
803
  }
278
804
  }
279
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
805
+
806
+ if (finallyEntry &&
807
+ (type === "break" ||
808
+ type === "continue") &&
809
+ finallyEntry.tryLoc <= arg &&
810
+ arg <= finallyEntry.finallyLoc) {
811
+ // Ignore the finally entry if control is not jumping to a
812
+ // location outside the try/catch block.
813
+ finallyEntry = null;
814
+ }
815
+
280
816
  var record = finallyEntry ? finallyEntry.completion : {};
281
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
817
+ record.type = type;
818
+ record.arg = arg;
819
+
820
+ if (finallyEntry) {
821
+ this.method = "next";
822
+ this.next = finallyEntry.finallyLoc;
823
+ return ContinueSentinel;
824
+ }
825
+
826
+ return this.complete(record);
282
827
  },
283
- complete: function (record, afterLoc) {
284
- if ("throw" === record.type) throw record.arg;
285
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
828
+
829
+ complete: function(record, afterLoc) {
830
+ if (record.type === "throw") {
831
+ throw record.arg;
832
+ }
833
+
834
+ if (record.type === "break" ||
835
+ record.type === "continue") {
836
+ this.next = record.arg;
837
+ } else if (record.type === "return") {
838
+ this.rval = this.arg = record.arg;
839
+ this.method = "return";
840
+ this.next = "end";
841
+ } else if (record.type === "normal" && afterLoc) {
842
+ this.next = afterLoc;
843
+ }
844
+
845
+ return ContinueSentinel;
286
846
  },
287
- finish: function (finallyLoc) {
847
+
848
+ finish: function(finallyLoc) {
288
849
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
289
850
  var entry = this.tryEntries[i];
290
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
851
+ if (entry.finallyLoc === finallyLoc) {
852
+ this.complete(entry.completion, entry.afterLoc);
853
+ resetTryEntry(entry);
854
+ return ContinueSentinel;
855
+ }
291
856
  }
292
857
  },
293
- catch: function (tryLoc) {
858
+
859
+ "catch": function(tryLoc) {
294
860
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
295
861
  var entry = this.tryEntries[i];
296
862
  if (entry.tryLoc === tryLoc) {
297
863
  var record = entry.completion;
298
- if ("throw" === record.type) {
864
+ if (record.type === "throw") {
299
865
  var thrown = record.arg;
300
866
  resetTryEntry(entry);
301
867
  }
302
868
  return thrown;
303
869
  }
304
870
  }
871
+
872
+ // The context.catch method must only be called with a location
873
+ // argument that corresponds to a known catch block.
305
874
  throw new Error("illegal catch attempt");
306
875
  },
307
- delegateYield: function (iterable, resultName, nextLoc) {
308
- return this.delegate = {
309
- iterator: values(iterable),
310
- resultName: resultName,
311
- nextLoc: nextLoc
312
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
313
- }
314
- }, exports;
315
- }
316
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
317
- try {
318
- var info = gen[key](arg);
319
- var value = info.value;
320
- } catch (error) {
321
- reject(error);
322
- return;
323
- }
324
- if (info.done) {
325
- resolve(value);
326
- } else {
327
- Promise.resolve(value).then(_next, _throw);
328
- }
329
- }
330
- function _asyncToGenerator(fn) {
331
- return function () {
332
- var self = this,
333
- args = arguments;
334
- return new Promise(function (resolve, reject) {
335
- var gen = fn.apply(self, args);
336
- function _next(value) {
337
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
338
- }
339
- function _throw(err) {
340
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
341
- }
342
- _next(undefined);
343
- });
344
- };
345
- }
346
- function _extends() {
347
- _extends = Object.assign ? Object.assign.bind() : function (target) {
348
- for (var i = 1; i < arguments.length; i++) {
349
- var source = arguments[i];
350
- for (var key in source) {
351
- if (Object.prototype.hasOwnProperty.call(source, key)) {
352
- target[key] = source[key];
353
- }
876
+
877
+ delegateYield: function(iterable, resultName, nextLoc) {
878
+ this.delegate = {
879
+ iterator: values(iterable),
880
+ resultName: resultName,
881
+ nextLoc: nextLoc
882
+ };
883
+
884
+ if (this.method === "next") {
885
+ // Deliberately forget the last sent value so that we don't
886
+ // accidentally pass it on to the delegate.
887
+ this.arg = undefined$1;
354
888
  }
889
+
890
+ return ContinueSentinel;
355
891
  }
356
- return target;
357
- };
358
- return _extends.apply(this, arguments);
359
- }
360
- function _inheritsLoose(subClass, superClass) {
361
- subClass.prototype = Object.create(superClass.prototype);
362
- subClass.prototype.constructor = subClass;
363
- _setPrototypeOf(subClass, superClass);
364
- }
365
- function _getPrototypeOf(o) {
366
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
367
- return o.__proto__ || Object.getPrototypeOf(o);
368
- };
369
- return _getPrototypeOf(o);
370
- }
371
- function _setPrototypeOf(o, p) {
372
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
373
- o.__proto__ = p;
374
- return o;
375
892
  };
376
- return _setPrototypeOf(o, p);
377
- }
378
- function _isNativeReflectConstruct() {
379
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
380
- if (Reflect.construct.sham) return false;
381
- if (typeof Proxy === "function") return true;
382
- try {
383
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
384
- return true;
385
- } catch (e) {
386
- return false;
387
- }
388
- }
389
- function _construct(Parent, args, Class) {
390
- if (_isNativeReflectConstruct()) {
391
- _construct = Reflect.construct.bind();
893
+
894
+ // Regardless of whether this script is executing as a CommonJS module
895
+ // or not, return the runtime object so that we can declare the variable
896
+ // regeneratorRuntime in the outer scope, which allows this module to be
897
+ // injected easily by `bin/regenerator --include-runtime script.js`.
898
+ return exports;
899
+
900
+ }(
901
+ // If this script is executing as a CommonJS module, use module.exports
902
+ // as the regeneratorRuntime namespace. Otherwise create a new empty
903
+ // object. Either way, the resulting object will be used to initialize
904
+ // the regeneratorRuntime variable at the top of this file.
905
+ module.exports
906
+ ));
907
+
908
+ try {
909
+ regeneratorRuntime = runtime;
910
+ } catch (accidentalStrictMode) {
911
+ // This module should not be running in strict mode, so the above
912
+ // assignment should always work unless something is misconfigured. Just
913
+ // in case runtime.js accidentally runs in strict mode, in modern engines
914
+ // we can explicitly access globalThis. In older engines we can escape
915
+ // strict mode using a global Function call. This could conceivably fail
916
+ // if a Content Security Policy forbids using Function, but in that case
917
+ // the proper solution is to fix the accidental strict mode problem. If
918
+ // you've misconfigured your bundler to force strict mode and applied a
919
+ // CSP to forbid Function, and you're not willing to fix either of those
920
+ // problems, please detail your unique predicament in a GitHub issue.
921
+ if (typeof globalThis === "object") {
922
+ globalThis.regeneratorRuntime = runtime;
392
923
  } else {
393
- _construct = function _construct(Parent, args, Class) {
394
- var a = [null];
395
- a.push.apply(a, args);
396
- var Constructor = Function.bind.apply(Parent, a);
397
- var instance = new Constructor();
398
- if (Class) _setPrototypeOf(instance, Class.prototype);
399
- return instance;
400
- };
401
- }
402
- return _construct.apply(null, arguments);
403
- }
404
- function _isNativeFunction(fn) {
405
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
406
- }
407
- function _wrapNativeSuper(Class) {
408
- var _cache = typeof Map === "function" ? new Map() : undefined;
409
- _wrapNativeSuper = function _wrapNativeSuper(Class) {
410
- if (Class === null || !_isNativeFunction(Class)) return Class;
411
- if (typeof Class !== "function") {
412
- throw new TypeError("Super expression must either be null or a function");
413
- }
414
- if (typeof _cache !== "undefined") {
415
- if (_cache.has(Class)) return _cache.get(Class);
416
- _cache.set(Class, Wrapper);
417
- }
418
- function Wrapper() {
419
- return _construct(Class, arguments, _getPrototypeOf(this).constructor);
420
- }
421
- Wrapper.prototype = Object.create(Class.prototype, {
422
- constructor: {
423
- value: Wrapper,
424
- enumerable: false,
425
- writable: true,
426
- configurable: true
427
- }
428
- });
429
- return _setPrototypeOf(Wrapper, Class);
430
- };
431
- return _wrapNativeSuper(Class);
432
- }
433
- function _assertThisInitialized(self) {
434
- if (self === void 0) {
435
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
924
+ Function("r", "regeneratorRuntime = r")(runtime);
436
925
  }
437
- return self;
438
926
  }
927
+ });
439
928
 
440
929
  var AxiosService = /*#__PURE__*/function () {
441
930
  function AxiosService(config) {
442
931
  if (!config) config = {};
443
932
  this.axios = axios.create(config);
444
933
  }
934
+
445
935
  var _proto = AxiosService.prototype;
936
+
446
937
  _proto.apiRequest = /*#__PURE__*/function () {
447
- var _apiRequest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, url, data) {
448
- return _regeneratorRuntime().wrap(function _callee$(_context) {
449
- while (1) switch (_context.prev = _context.next) {
450
- case 0:
451
- if (!config.headers) config.headers = {};
452
- config.headers['Content-Type'] = 'application/json';
453
- return _context.abrupt("return", this.axios(_extends({}, config, {
454
- url: url,
455
- data: data
456
- })).then(function (res) {
457
- return res.data;
458
- }));
459
- case 3:
460
- case "end":
461
- return _context.stop();
938
+ var _apiRequest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(config, url, data) {
939
+ return runtime_1.wrap(function _callee$(_context) {
940
+ while (1) {
941
+ switch (_context.prev = _context.next) {
942
+ case 0:
943
+ if (!config.headers) config.headers = {};
944
+ config.headers['Content-Type'] = 'application/json';
945
+ return _context.abrupt("return", this.axios(_extends({}, config, {
946
+ url: url,
947
+ data: data
948
+ })).then(function (res) {
949
+ return res.data;
950
+ }));
951
+
952
+ case 3:
953
+ case "end":
954
+ return _context.stop();
955
+ }
462
956
  }
463
957
  }, _callee, this);
464
958
  }));
959
+
465
960
  function apiRequest(_x, _x2, _x3) {
466
961
  return _apiRequest.apply(this, arguments);
467
962
  }
963
+
468
964
  return apiRequest;
469
965
  }();
966
+
470
967
  _proto.apiRequestHeader = /*#__PURE__*/function () {
471
- var _apiRequestHeader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(config, url, headerToRetrieve, data) {
472
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
473
- while (1) switch (_context2.prev = _context2.next) {
474
- case 0:
475
- if (!config.headers) config.headers = {};
476
- config.headers['Content-Type'] = 'application/json';
477
- return _context2.abrupt("return", this.axios(_extends({}, config, {
478
- url: url,
479
- data: data
480
- })).then(function (res) {
481
- if (headerToRetrieve) {
482
- var _res$headers$headerTo;
483
- return (_res$headers$headerTo = res.headers[headerToRetrieve]) != null ? _res$headers$headerTo : res.headers[headerToRetrieve.toLowerCase()];
484
- }
485
- return res.headers;
486
- }));
487
- case 3:
488
- case "end":
489
- return _context2.stop();
968
+ var _apiRequestHeader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(config, url, headerToRetrieve, data) {
969
+ return runtime_1.wrap(function _callee2$(_context2) {
970
+ while (1) {
971
+ switch (_context2.prev = _context2.next) {
972
+ case 0:
973
+ if (!config.headers) config.headers = {};
974
+ config.headers['Content-Type'] = 'application/json';
975
+ return _context2.abrupt("return", this.axios(_extends({}, config, {
976
+ url: url,
977
+ data: data
978
+ })).then(function (res) {
979
+ if (headerToRetrieve) {
980
+ var _res$headers$headerTo;
981
+
982
+ return (_res$headers$headerTo = res.headers[headerToRetrieve]) != null ? _res$headers$headerTo : res.headers[headerToRetrieve.toLowerCase()];
983
+ }
984
+
985
+ return res.headers;
986
+ }));
987
+
988
+ case 3:
989
+ case "end":
990
+ return _context2.stop();
991
+ }
490
992
  }
491
993
  }, _callee2, this);
492
994
  }));
995
+
493
996
  function apiRequestHeader(_x4, _x5, _x6, _x7) {
494
997
  return _apiRequestHeader.apply(this, arguments);
495
998
  }
999
+
496
1000
  return apiRequestHeader;
497
1001
  }();
1002
+
498
1003
  _proto.get = function get(url, config) {
499
1004
  return this.apiRequest(_extends({}, config, {
500
1005
  method: 'get'
501
1006
  }), url);
502
1007
  };
1008
+
503
1009
  _proto.deleteRequest = function deleteRequest(url, config) {
504
1010
  return this.apiRequest(_extends({}, config, {
505
1011
  method: 'delete'
506
1012
  }), url);
507
1013
  };
1014
+
508
1015
  _proto.post = function post(url, data, config) {
509
1016
  return this.apiRequest(_extends({}, config, {
510
1017
  method: 'post'
511
1018
  }), url, data);
512
1019
  };
1020
+
513
1021
  _proto.put = function put(url, data, config) {
514
1022
  return this.apiRequest(_extends({}, config, {
515
1023
  method: 'put'
516
1024
  }), url, data);
517
1025
  };
1026
+
518
1027
  _proto.patch = function patch(url, data, config) {
519
1028
  return this.apiRequest(_extends({}, config, {
520
1029
  method: 'patch'
521
1030
  }), url, data);
522
1031
  };
1032
+
523
1033
  _proto.head = function head(url, config, headerToRetrieve, data) {
524
1034
  return this.apiRequestHeader(_extends({}, config, {
525
1035
  method: 'head'
526
1036
  }), url, headerToRetrieve, data);
527
1037
  };
1038
+
528
1039
  return AxiosService;
529
1040
  }();
530
1041
 
531
1042
  var APIService = /*#__PURE__*/function (_AxiosService) {
532
1043
  _inheritsLoose(APIService, _AxiosService);
1044
+
533
1045
  /**
534
1046
  * The API Service lets you use an axios API and handles oro backend services authentification via JWT tokens
535
1047
  * @param useLocalStorage if set to true, tokens will be stored in localStorage
@@ -538,11 +1050,14 @@ var APIService = /*#__PURE__*/function (_AxiosService) {
538
1050
  */
539
1051
  function APIService(useLocalStorage, config, tokenRefreshFailureCallback) {
540
1052
  var _this;
1053
+
541
1054
  _this = _AxiosService.call(this, config) || this;
542
1055
  _this.useLocalStorage = useLocalStorage;
543
1056
  _this.tokenRefreshFailureCallback = tokenRefreshFailureCallback;
544
1057
  _this.tokens = {};
1058
+
545
1059
  var self = _assertThisInitialized(_this);
1060
+
546
1061
  _this.axios.interceptors.request.use(function (config) {
547
1062
  var token = config.useRefreshToken ? self.getTokens().refreshToken : self.getTokens().accessToken;
548
1063
  config.headers = _extends({}, config.headers, {
@@ -552,42 +1067,51 @@ var APIService = /*#__PURE__*/function (_AxiosService) {
552
1067
  }, function (error) {
553
1068
  Promise.reject(error);
554
1069
  });
1070
+
555
1071
  createAuthRefreshInterceptor(_this.axios, /*#__PURE__*/function () {
556
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(failedRequest) {
1072
+ var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(failedRequest) {
557
1073
  var tokenResp;
558
- return _regeneratorRuntime().wrap(function _callee$(_context) {
559
- while (1) switch (_context.prev = _context.next) {
560
- case 0:
561
- if (!self.authRefreshFn) {
562
- _context.next = 15;
563
- break;
564
- }
565
- _context.prev = 1;
566
- _context.next = 4;
567
- return self.authRefreshFn(self.getTokens().refreshToken);
568
- case 4:
569
- tokenResp = _context.sent;
570
- self.setTokens({
571
- accessToken: tokenResp.accessToken,
572
- refreshToken: tokenResp.refreshToken
573
- });
574
- failedRequest.response.config.headers['Authorization'] = "Bearer " + self.getTokens().accessToken;
575
- return _context.abrupt("return", Promise.resolve());
576
- case 10:
577
- _context.prev = 10;
578
- _context.t0 = _context["catch"](1);
579
- console.error('an error occured while refreshing tokens (notifying callback)', _context.t0);
580
- if (self.tokenRefreshFailureCallback) self.tokenRefreshFailureCallback(failedRequest);
581
- return _context.abrupt("return", Promise.resolve());
582
- case 15:
583
- console.error('The request could not refresh the token (authRefreshFn was not set)', failedRequest);
584
- return _context.abrupt("return", Promise.resolve());
585
- case 17:
586
- case "end":
587
- return _context.stop();
1074
+ return runtime_1.wrap(function _callee$(_context) {
1075
+ while (1) {
1076
+ switch (_context.prev = _context.next) {
1077
+ case 0:
1078
+ if (!self.authRefreshFn) {
1079
+ _context.next = 15;
1080
+ break;
1081
+ }
1082
+
1083
+ _context.prev = 1;
1084
+ _context.next = 4;
1085
+ return self.authRefreshFn(self.getTokens().refreshToken);
1086
+
1087
+ case 4:
1088
+ tokenResp = _context.sent;
1089
+ self.setTokens({
1090
+ accessToken: tokenResp.accessToken,
1091
+ refreshToken: tokenResp.refreshToken
1092
+ });
1093
+ failedRequest.response.config.headers['Authorization'] = "Bearer " + self.getTokens().accessToken;
1094
+ return _context.abrupt("return", Promise.resolve());
1095
+
1096
+ case 10:
1097
+ _context.prev = 10;
1098
+ _context.t0 = _context["catch"](1);
1099
+ console.error('an error occured while refreshing tokens (notifying callback)', _context.t0);
1100
+ if (self.tokenRefreshFailureCallback) self.tokenRefreshFailureCallback(failedRequest);
1101
+ return _context.abrupt("return", Promise.resolve());
1102
+
1103
+ case 15:
1104
+ console.error('The request could not refresh the token (authRefreshFn was not set)', failedRequest);
1105
+ return _context.abrupt("return", Promise.resolve());
1106
+
1107
+ case 17:
1108
+ case "end":
1109
+ return _context.stop();
1110
+ }
588
1111
  }
589
1112
  }, _callee, null, [[1, 10]]);
590
1113
  }));
1114
+
591
1115
  return function (_x) {
592
1116
  return _ref.apply(this, arguments);
593
1117
  };
@@ -596,34 +1120,43 @@ var APIService = /*#__PURE__*/function (_AxiosService) {
596
1120
  });
597
1121
  return _this;
598
1122
  }
1123
+
599
1124
  var _proto = APIService.prototype;
1125
+
600
1126
  _proto.setAuthRefreshFn = function setAuthRefreshFn(fn) {
601
1127
  this.authRefreshFn = fn;
602
1128
  };
1129
+
603
1130
  _proto.setTokens = function setTokens(tokens) {
604
1131
  if (this.useLocalStorage) {
605
1132
  localStorage.setItem('tokens', JSON.stringify(tokens));
606
1133
  }
1134
+
607
1135
  this.tokens = tokens;
608
1136
  };
1137
+
609
1138
  _proto.getTokens = function getTokens() {
610
1139
  if (this.useLocalStorage) {
611
1140
  var tokens = {};
612
1141
  var item = localStorage.getItem('tokens');
1142
+
613
1143
  if (item) {
614
1144
  tokens = JSON.parse(item);
615
1145
  }
1146
+
616
1147
  return tokens;
617
1148
  } else {
618
1149
  return this.tokens;
619
1150
  }
620
1151
  };
1152
+
621
1153
  return APIService;
622
1154
  }(AxiosService);
623
1155
 
624
1156
  /**
625
1157
  * This service enables you to handle one authentication token per practice
626
1158
  */
1159
+
627
1160
  var ApisPracticeManager = /*#__PURE__*/function () {
628
1161
  /**
629
1162
  * The constructor
@@ -636,6 +1169,7 @@ var ApisPracticeManager = /*#__PURE__*/function () {
636
1169
  if (useLocalStorage === void 0) {
637
1170
  useLocalStorage = false;
638
1171
  }
1172
+
639
1173
  this.serviceCollReq = serviceCollReq;
640
1174
  this.getAuthTokenCbk = getAuthTokenCbk;
641
1175
  this.useLocalStorage = useLocalStorage;
@@ -646,73 +1180,98 @@ var ApisPracticeManager = /*#__PURE__*/function () {
646
1180
  * @param practiceUuid the uuid of the practice
647
1181
  * @returns a promise holding a `ServiceCollection`
648
1182
  */
1183
+
1184
+
649
1185
  var _proto = ApisPracticeManager.prototype;
1186
+
650
1187
  _proto.get =
651
1188
  /*#__PURE__*/
652
1189
  function () {
653
- var _get = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(practiceUuid) {
1190
+ var _get = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(practiceUuid) {
654
1191
  var _this = this;
1192
+
655
1193
  var cacheKey, practiceInstance, newPracticeInstance, authTokenFunc;
656
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
657
- while (1) switch (_context2.prev = _context2.next) {
658
- case 0:
659
- cacheKey = practiceUuid != null ? practiceUuid : 'none';
660
- practiceInstance = this.practiceInstances.get(cacheKey);
661
- if (!practiceInstance) {
662
- _context2.next = 4;
663
- break;
664
- }
665
- return _context2.abrupt("return", practiceInstance);
666
- case 4:
667
- newPracticeInstance = init(this.serviceCollReq, undefined, this.useLocalStorage); // Create one auth token callback per practice since the practice uuid needs to change
668
- authTokenFunc = /*#__PURE__*/function () {
669
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
670
- return _regeneratorRuntime().wrap(function _callee$(_context) {
671
- while (1) switch (_context.prev = _context.next) {
672
- case 0:
673
- if (!newPracticeInstance.guardService) {
674
- _context.next = 7;
675
- break;
1194
+ return runtime_1.wrap(function _callee2$(_context2) {
1195
+ while (1) {
1196
+ switch (_context2.prev = _context2.next) {
1197
+ case 0:
1198
+ cacheKey = practiceUuid != null ? practiceUuid : 'none';
1199
+ practiceInstance = this.practiceInstances.get(cacheKey);
1200
+
1201
+ if (!practiceInstance) {
1202
+ _context2.next = 4;
1203
+ break;
1204
+ }
1205
+
1206
+ return _context2.abrupt("return", practiceInstance);
1207
+
1208
+ case 4:
1209
+ newPracticeInstance = init(this.serviceCollReq, undefined, this.useLocalStorage); // Create one auth token callback per practice since the practice uuid needs to change
1210
+
1211
+ authTokenFunc = /*#__PURE__*/function () {
1212
+ var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1213
+ return runtime_1.wrap(function _callee$(_context) {
1214
+ while (1) {
1215
+ switch (_context.prev = _context.next) {
1216
+ case 0:
1217
+ if (!newPracticeInstance.guardService) {
1218
+ _context.next = 7;
1219
+ break;
1220
+ }
1221
+
1222
+ console.log("\x1B[36m[Auth] Refresh auth called (practiceUuid: " + practiceUuid + ")\x1B[36m");
1223
+ _context.next = 4;
1224
+ return _this.getAuthTokenCbk(newPracticeInstance.guardService, practiceUuid);
1225
+
1226
+ case 4:
1227
+ return _context.abrupt("return", _context.sent);
1228
+
1229
+ case 7:
1230
+ throw Error('[Auth] Unable to refresh token guard service is undefined');
1231
+
1232
+ case 8:
1233
+ case "end":
1234
+ return _context.stop();
676
1235
  }
677
- console.log("\x1B[36m[Auth] Refresh auth called (practiceUuid: " + practiceUuid + ")\x1B[36m");
678
- _context.next = 4;
679
- return _this.getAuthTokenCbk(newPracticeInstance.guardService, practiceUuid);
680
- case 4:
681
- return _context.abrupt("return", _context.sent);
682
- case 7:
683
- throw Error('[Auth] Unable to refresh token guard service is undefined');
684
- case 8:
685
- case "end":
686
- return _context.stop();
687
- }
688
- }, _callee);
689
- }));
690
- return function authTokenFunc() {
691
- return _ref.apply(this, arguments);
692
- };
693
- }(); // Initialize the M2M token
694
- _context2.next = 8;
695
- return authTokenFunc();
696
- case 8:
697
- // Set the refresh tokens callback
698
- newPracticeInstance.apiService.setAuthRefreshFn(authTokenFunc);
699
- this.practiceInstances.set(cacheKey, newPracticeInstance);
700
- return _context2.abrupt("return", newPracticeInstance);
701
- case 11:
702
- case "end":
703
- return _context2.stop();
1236
+ }
1237
+ }, _callee);
1238
+ }));
1239
+
1240
+ return function authTokenFunc() {
1241
+ return _ref.apply(this, arguments);
1242
+ };
1243
+ }(); // Initialize the M2M token
1244
+
1245
+
1246
+ _context2.next = 8;
1247
+ return authTokenFunc();
1248
+
1249
+ case 8:
1250
+ // Set the refresh tokens callback
1251
+ newPracticeInstance.apiService.setAuthRefreshFn(authTokenFunc);
1252
+ this.practiceInstances.set(cacheKey, newPracticeInstance);
1253
+ return _context2.abrupt("return", newPracticeInstance);
1254
+
1255
+ case 11:
1256
+ case "end":
1257
+ return _context2.stop();
1258
+ }
704
1259
  }
705
1260
  }, _callee2, this);
706
1261
  }));
1262
+
707
1263
  function get(_x) {
708
1264
  return _get.apply(this, arguments);
709
1265
  }
1266
+
710
1267
  return get;
711
1268
  }();
1269
+
712
1270
  return ApisPracticeManager;
713
1271
  }();
714
1272
 
715
1273
  var AssistantType;
1274
+
716
1275
  (function (AssistantType) {
717
1276
  AssistantType["MedicalSecretary"] = "MedicalSecretary";
718
1277
  AssistantType["Nurse"] = "Nurse";
@@ -720,7 +1279,9 @@ var AssistantType;
720
1279
  AssistantType["Administrative"] = "Administrative";
721
1280
  AssistantType["Other"] = "Other";
722
1281
  })(AssistantType || (AssistantType = {}));
1282
+
723
1283
  var TransmissionKind;
1284
+
724
1285
  (function (TransmissionKind) {
725
1286
  TransmissionKind["Fax"] = "Fax";
726
1287
  TransmissionKind["Email"] = "Email";
@@ -730,7 +1291,9 @@ var TransmissionKind;
730
1291
  TransmissionKind["API"] = "API";
731
1292
  TransmissionKind["Other"] = "Other";
732
1293
  })(TransmissionKind || (TransmissionKind = {}));
1294
+
733
1295
  var TransmissionStatus;
1296
+
734
1297
  (function (TransmissionStatus) {
735
1298
  TransmissionStatus["Preparing"] = "Preparing";
736
1299
  TransmissionStatus["Sending"] = "Sending";
@@ -743,12 +1306,16 @@ var TransmissionStatus;
743
1306
  TransmissionStatus["ReceiverNotAnswering"] = "ReceiverNotAnswering";
744
1307
  TransmissionStatus["ReceiverIncompatible"] = "ReceiverIncompatible";
745
1308
  })(TransmissionStatus || (TransmissionStatus = {}));
1309
+
746
1310
  var ConsultType;
1311
+
747
1312
  (function (ConsultType) {
748
1313
  ConsultType["Onboard"] = "Onboard";
749
1314
  ConsultType["Refill"] = "Refill";
750
1315
  })(ConsultType || (ConsultType = {}));
1316
+
751
1317
  var FeeStatus;
1318
+
752
1319
  (function (FeeStatus) {
753
1320
  FeeStatus["NoFee"] = "NoFee";
754
1321
  FeeStatus["Pending"] = "Pending";
@@ -757,7 +1324,9 @@ var FeeStatus;
757
1324
  FeeStatus["Cancelled"] = "Cancelled";
758
1325
  FeeStatus["Contested"] = "Contested";
759
1326
  })(FeeStatus || (FeeStatus = {}));
1327
+
760
1328
  var MedicalStatus;
1329
+
761
1330
  (function (MedicalStatus) {
762
1331
  MedicalStatus["Creating"] = "Creating";
763
1332
  MedicalStatus["New"] = "New";
@@ -768,7 +1337,9 @@ var MedicalStatus;
768
1337
  MedicalStatus["Archived"] = "Archived";
769
1338
  MedicalStatus["Failed"] = "Failed";
770
1339
  })(MedicalStatus || (MedicalStatus = {}));
1340
+
771
1341
  var TaskStatus;
1342
+
772
1343
  (function (TaskStatus) {
773
1344
  TaskStatus["None"] = "None";
774
1345
  TaskStatus["ToDo"] = "ToDo";
@@ -776,7 +1347,9 @@ var TaskStatus;
776
1347
  TaskStatus["Blocked"] = "Blocked";
777
1348
  TaskStatus["Done"] = "Done";
778
1349
  })(TaskStatus || (TaskStatus = {}));
1350
+
779
1351
  var ClosedReasonType;
1352
+
780
1353
  (function (ClosedReasonType) {
781
1354
  /**
782
1355
  * A completed consultation
@@ -785,28 +1358,35 @@ var ClosedReasonType;
785
1358
  /**
786
1359
  * The conclusion was that what the patient submitted was not a disease
787
1360
  */
1361
+
788
1362
  ClosedReasonType["NotADisease"] = "NotADisease";
789
1363
  /**
790
1364
  * The consultation was not appropriate for virtual
791
1365
  */
1366
+
792
1367
  ClosedReasonType["NotAppropriateForVirtual"] = "NotAppropriateForVirtual";
793
1368
  /**
794
1369
  * Any other reason why the consultation was closed
795
1370
  */
1371
+
796
1372
  ClosedReasonType["Other"] = "Other";
797
1373
  /**
798
1374
  * A consultation that is required to be done in person
799
1375
  */
1376
+
800
1377
  ClosedReasonType["RequiresInPerson"] = "RequiresInPerson";
801
1378
  })(ClosedReasonType || (ClosedReasonType = {}));
802
1379
 
803
1380
  var VisibilityType;
1381
+
804
1382
  (function (VisibilityType) {
805
1383
  VisibilityType["Generic"] = "Generic";
806
1384
  VisibilityType["Private"] = "Private";
807
1385
  VisibilityType["Instance"] = "Instance";
808
1386
  })(VisibilityType || (VisibilityType = {}));
1387
+
809
1388
  var DrugType;
1389
+
810
1390
  (function (DrugType) {
811
1391
  DrugType["Generic"] = "Generic";
812
1392
  DrugType["Instance"] = "Instance";
@@ -815,12 +1395,17 @@ var DrugType;
815
1395
  * Status of the prescription
816
1396
  * Right now, it only serves a soft delete flag
817
1397
  */
1398
+
1399
+
818
1400
  var PrescriptionStatus;
1401
+
819
1402
  (function (PrescriptionStatus) {
820
1403
  PrescriptionStatus["Existing"] = "Existing";
821
1404
  PrescriptionStatus["Deleted"] = "Deleted";
822
1405
  })(PrescriptionStatus || (PrescriptionStatus = {}));
1406
+
823
1407
  var PlanStatus;
1408
+
824
1409
  (function (PlanStatus) {
825
1410
  PlanStatus["Pending"] = "Pending";
826
1411
  PlanStatus["Accepted"] = "Accepted";
@@ -830,69 +1415,88 @@ var PlanStatus;
830
1415
 
831
1416
  var AuthenticationFailed = /*#__PURE__*/function (_Error) {
832
1417
  _inheritsLoose(AuthenticationFailed, _Error);
1418
+
833
1419
  function AuthenticationFailed() {
834
1420
  return _Error.apply(this, arguments) || this;
835
1421
  }
1422
+
836
1423
  return AuthenticationFailed;
837
1424
  }( /*#__PURE__*/_wrapNativeSuper(Error));
838
1425
  var AuthenticationBadRequest = /*#__PURE__*/function (_Error2) {
839
1426
  _inheritsLoose(AuthenticationBadRequest, _Error2);
1427
+
840
1428
  function AuthenticationBadRequest() {
841
1429
  return _Error2.apply(this, arguments) || this;
842
1430
  }
1431
+
843
1432
  return AuthenticationBadRequest;
844
1433
  }( /*#__PURE__*/_wrapNativeSuper(Error));
845
1434
  var AuthenticationServerError = /*#__PURE__*/function (_Error3) {
846
1435
  _inheritsLoose(AuthenticationServerError, _Error3);
1436
+
847
1437
  function AuthenticationServerError() {
848
1438
  return _Error3.apply(this, arguments) || this;
849
1439
  }
1440
+
850
1441
  return AuthenticationServerError;
851
1442
  }( /*#__PURE__*/_wrapNativeSuper(Error));
852
1443
  var AuthenticationUnconfirmedEmail = /*#__PURE__*/function (_Error4) {
853
1444
  _inheritsLoose(AuthenticationUnconfirmedEmail, _Error4);
1445
+
854
1446
  function AuthenticationUnconfirmedEmail() {
855
1447
  return _Error4.apply(this, arguments) || this;
856
1448
  }
1449
+
857
1450
  return AuthenticationUnconfirmedEmail;
858
1451
  }( /*#__PURE__*/_wrapNativeSuper(Error));
859
1452
  var IdentityCreationFailed = /*#__PURE__*/function (_Error5) {
860
1453
  _inheritsLoose(IdentityCreationFailed, _Error5);
1454
+
861
1455
  function IdentityCreationFailed() {
862
1456
  return _Error5.apply(this, arguments) || this;
863
1457
  }
1458
+
864
1459
  return IdentityCreationFailed;
865
1460
  }( /*#__PURE__*/_wrapNativeSuper(Error));
866
1461
  var IdentityCreationBadRequest = /*#__PURE__*/function (_Error6) {
867
1462
  _inheritsLoose(IdentityCreationBadRequest, _Error6);
1463
+
868
1464
  function IdentityCreationBadRequest() {
869
1465
  return _Error6.apply(this, arguments) || this;
870
1466
  }
1467
+
871
1468
  return IdentityCreationBadRequest;
872
1469
  }( /*#__PURE__*/_wrapNativeSuper(Error));
873
1470
  var IdentityCreationConflict = /*#__PURE__*/function (_Error7) {
874
1471
  _inheritsLoose(IdentityCreationConflict, _Error7);
1472
+
875
1473
  function IdentityCreationConflict() {
876
1474
  return _Error7.apply(this, arguments) || this;
877
1475
  }
1476
+
878
1477
  return IdentityCreationConflict;
879
1478
  }( /*#__PURE__*/_wrapNativeSuper(Error));
880
1479
  var VaultDataMissing = /*#__PURE__*/function (_Error8) {
881
1480
  _inheritsLoose(VaultDataMissing, _Error8);
1481
+
882
1482
  function VaultDataMissing() {
883
1483
  return _Error8.apply(this, arguments) || this;
884
1484
  }
1485
+
885
1486
  return VaultDataMissing;
886
1487
  }( /*#__PURE__*/_wrapNativeSuper(Error));
887
1488
 
888
1489
  var WorkflowType;
1490
+
889
1491
  (function (WorkflowType) {
890
1492
  WorkflowType["Onboard"] = "Onboard";
891
1493
  WorkflowType["Followup"] = "Followup";
892
1494
  WorkflowType["Renew"] = "Renew";
893
1495
  WorkflowType["DataRetrieve"] = "DataRetrieve";
894
1496
  })(WorkflowType || (WorkflowType = {}));
1497
+
895
1498
  var RateDimension;
1499
+
896
1500
  (function (RateDimension) {
897
1501
  RateDimension["RatioOnTotal"] = "RatioOnTotal";
898
1502
  RateDimension["FixedOnTotal"] = "FixedOnTotal";
@@ -903,21 +1507,27 @@ var RateDimension;
903
1507
  RateDimension["RatioOnItem"] = "RatioOnItem";
904
1508
  RateDimension["FixedOnItem"] = "FixedOnItem";
905
1509
  })(RateDimension || (RateDimension = {}));
1510
+
906
1511
  var PlanType;
1512
+
907
1513
  (function (PlanType) {
908
1514
  PlanType["Onboard"] = "Onboard";
909
1515
  PlanType["Followup"] = "Followup";
910
1516
  PlanType["Renew"] = "Renew";
911
1517
  PlanType["DataRetrieve"] = "DataRetrieve";
912
1518
  })(PlanType || (PlanType = {}));
1519
+
913
1520
  var PaymentStatus;
1521
+
914
1522
  (function (PaymentStatus) {
915
1523
  PaymentStatus["Pending"] = "Pending";
916
1524
  PaymentStatus["Success"] = "Success";
917
1525
  PaymentStatus["Failure"] = "Failure";
918
1526
  PaymentStatus["Canceled"] = "Canceled";
919
1527
  })(PaymentStatus || (PaymentStatus = {}));
1528
+
920
1529
  var PractitionerStatus;
1530
+
921
1531
  (function (PractitionerStatus) {
922
1532
  PractitionerStatus["Practicing"] = "Practicing";
923
1533
  PractitionerStatus["Retired"] = "Retired";
@@ -927,13 +1537,17 @@ var PractitionerStatus;
927
1537
  PractitionerStatus["InConflict"] = "InConflict";
928
1538
  PractitionerStatus["Delicensed"] = "Delicensed";
929
1539
  })(PractitionerStatus || (PractitionerStatus = {}));
1540
+
930
1541
  var AssignmentStatus;
1542
+
931
1543
  (function (AssignmentStatus) {
932
1544
  AssignmentStatus["Assigned"] = "Assigned";
933
1545
  AssignmentStatus["Reassigned"] = "Reassigned";
934
1546
  AssignmentStatus["Cancelled"] = "Cancelled";
935
1547
  })(AssignmentStatus || (AssignmentStatus = {}));
1548
+
936
1549
  var PractitionnerRoleType;
1550
+
937
1551
  (function (PractitionnerRoleType) {
938
1552
  PractitionnerRoleType["Doctor"] = "Doctor";
939
1553
  PractitionnerRoleType["MedicalAssistant"] = "MedicalAssistant";
@@ -945,13 +1559,17 @@ var PractitionnerRoleType;
945
1559
  PractitionnerRoleType["ManualDispatcher"] = "ManualDispatcher";
946
1560
  PractitionnerRoleType["Other"] = "Other";
947
1561
  })(PractitionnerRoleType || (PractitionnerRoleType = {}));
1562
+
948
1563
  var OtherRoleType;
1564
+
949
1565
  (function (OtherRoleType) {
950
1566
  OtherRoleType["Patient"] = "Patient";
951
1567
  OtherRoleType["User"] = "User";
952
1568
  OtherRoleType["System"] = "System";
953
1569
  })(OtherRoleType || (OtherRoleType = {}));
1570
+
954
1571
  var LicenseStatus;
1572
+
955
1573
  (function (LicenseStatus) {
956
1574
  LicenseStatus["Valid"] = "Valid";
957
1575
  LicenseStatus["Invalid"] = "Invalid";
@@ -959,7 +1577,9 @@ var LicenseStatus;
959
1577
  LicenseStatus["NA"] = "NA";
960
1578
  LicenseStatus["Removed"] = "Removed";
961
1579
  })(LicenseStatus || (LicenseStatus = {}));
1580
+
962
1581
  var PeriodType;
1582
+
963
1583
  (function (PeriodType) {
964
1584
  PeriodType["PerYear"] = "PerYear";
965
1585
  PeriodType["PerQuarter"] = "PerQuarter";
@@ -969,7 +1589,9 @@ var PeriodType;
969
1589
  PeriodType["PerDay"] = "PerDay";
970
1590
  PeriodType["PerHour"] = "PerHour";
971
1591
  })(PeriodType || (PeriodType = {}));
1592
+
972
1593
  var SyncStatus;
1594
+
973
1595
  (function (SyncStatus) {
974
1596
  SyncStatus["Requested"] = "Requested";
975
1597
  SyncStatus["Started"] = "Started";
@@ -977,7 +1599,9 @@ var SyncStatus;
977
1599
  SyncStatus["Failed"] = "Failed";
978
1600
  SyncStatus["Cancelled"] = "Cancelled";
979
1601
  })(SyncStatus || (SyncStatus = {}));
1602
+
980
1603
  var PracticeEmailKind;
1604
+
981
1605
  (function (PracticeEmailKind) {
982
1606
  PracticeEmailKind["SignedUp"] = "SignedUp";
983
1607
  PracticeEmailKind["Onboarded"] = "Onboarded";
@@ -1007,7 +1631,10 @@ var PracticeEmailKind;
1007
1631
  * To be extra explicit, if you want to show a functionnality only in one practice, you will have to add a practice configs in all other practice to hide it (yes it is cumbersome).
1008
1632
  *
1009
1633
  */
1634
+
1635
+
1010
1636
  var PracticeConfigKind;
1637
+
1011
1638
  (function (PracticeConfigKind) {
1012
1639
  PracticeConfigKind["PatientConsultCard"] = "PatientConsultCard";
1013
1640
  PracticeConfigKind["PracticeCloseConsultationTypes"] = "PracticeCloseConsultationTypes";
@@ -1029,7 +1656,9 @@ var PracticeConfigKind;
1029
1656
  PracticeConfigKind["PracticeDiagnosisAndTreatment"] = "PracticeDiagnosisAndTreatment";
1030
1657
  PracticeConfigKind["PracticeInfoLetterDiscount"] = "PracticeInfoLetterDiscount";
1031
1658
  })(PracticeConfigKind || (PracticeConfigKind = {}));
1659
+
1032
1660
  var StripePriceType;
1661
+
1033
1662
  (function (StripePriceType) {
1034
1663
  StripePriceType["Default"] = "Default";
1035
1664
  StripePriceType["Discount"] = "Discount";
@@ -1037,19 +1666,25 @@ var StripePriceType;
1037
1666
  /**
1038
1667
  * All the PaymentIntentRequestMetadata Kind available
1039
1668
  */
1669
+
1670
+
1040
1671
  var PaymentIntentRequestMetadataKind;
1672
+
1041
1673
  (function (PaymentIntentRequestMetadataKind) {
1042
1674
  PaymentIntentRequestMetadataKind["ConsultRequestMetadata"] = "ConsultRequestMetadata";
1043
1675
  PaymentIntentRequestMetadataKind["RefillTreatmentRequestMetadata"] = "RefillTreatmentRequestMetadata";
1044
1676
  })(PaymentIntentRequestMetadataKind || (PaymentIntentRequestMetadataKind = {}));
1045
1677
 
1046
1678
  var IndexKey;
1679
+
1047
1680
  (function (IndexKey) {
1048
1681
  IndexKey["Consultation"] = "Consultation";
1049
1682
  IndexKey["IndexSnapshot"] = "IndexSnapshot";
1050
1683
  IndexKey["ConsultationLockbox"] = "ConsultationLockbox";
1051
1684
  })(IndexKey || (IndexKey = {}));
1685
+
1052
1686
  var DocumentType;
1687
+
1053
1688
  (function (DocumentType) {
1054
1689
  DocumentType["Message"] = "Message";
1055
1690
  DocumentType["Note"] = "Note";
@@ -1068,6 +1703,7 @@ var DocumentType;
1068
1703
  })(DocumentType || (DocumentType = {}));
1069
1704
 
1070
1705
  var InputApplyFunctions;
1706
+
1071
1707
  (function (InputApplyFunctions) {
1072
1708
  InputApplyFunctions["AllUpperCase"] = "AllUpperCase";
1073
1709
  InputApplyFunctions["AllLowerCase"] = "AllLowerCase";
@@ -1075,7 +1711,9 @@ var InputApplyFunctions;
1075
1711
  InputApplyFunctions["AllAlphanumeric"] = "AllAlphanumeric";
1076
1712
  InputApplyFunctions["NoSpaces"] = "NoSpaces";
1077
1713
  })(InputApplyFunctions || (InputApplyFunctions = {}));
1714
+
1078
1715
  var MetadataCategory;
1716
+
1079
1717
  (function (MetadataCategory) {
1080
1718
  MetadataCategory["ChildPersonal"] = "ChildPersonal";
1081
1719
  MetadataCategory["Consultation"] = "Consultation";
@@ -1092,6 +1730,7 @@ var MetadataCategory;
1092
1730
  })(MetadataCategory || (MetadataCategory = {}));
1093
1731
 
1094
1732
  var IndexKind;
1733
+
1095
1734
  (function (IndexKind) {
1096
1735
  IndexKind[IndexKind["consultUuid"] = 0] = "consultUuid";
1097
1736
  IndexKind[IndexKind["consultShortid"] = 1] = "consultShortid";
@@ -1106,7 +1745,9 @@ var ConsultService = /*#__PURE__*/function () {
1106
1745
  this.api = api;
1107
1746
  this.baseURL = baseURL;
1108
1747
  }
1748
+
1109
1749
  var _proto = ConsultService.prototype;
1750
+
1110
1751
  _proto.consultCreate = function consultCreate(c) {
1111
1752
  return this.api.post(this.baseURL + "/v1/consults", c);
1112
1753
  }
@@ -1126,7 +1767,9 @@ var ConsultService = /*#__PURE__*/function () {
1126
1767
  * @param filterIsoLocality the of isoLocality to filter with
1127
1768
  * @param filterAssignee array of practitioner uuids with which you want to filter the consultations
1128
1769
  * @returns a number of consult
1129
- */;
1770
+ */
1771
+ ;
1772
+
1130
1773
  _proto.countConsults = function countConsults(uuidPractice, uuidRequester, statusesMedical, statusesExclude, shortId, columnToSortTo, orderToSortTo, perPage, indexPage, filterAssignedDoctor, filterCurrentPractitioner, filterIsoLocality, filterAssignee, typesConsult, uuidParent) {
1131
1774
  return this.api.head(this.baseURL + "/v1/consults", {
1132
1775
  params: {
@@ -1150,9 +1793,11 @@ var ConsultService = /*#__PURE__*/function () {
1150
1793
  if (!resContentRange || typeof resContentRange !== 'string' && typeof resContentRange !== 'number') {
1151
1794
  return 0;
1152
1795
  }
1796
+
1153
1797
  if (typeof resContentRange === 'number') {
1154
1798
  return resContentRange;
1155
1799
  }
1800
+
1156
1801
  return parseInt(resContentRange);
1157
1802
  });
1158
1803
  }
@@ -1171,7 +1816,9 @@ var ConsultService = /*#__PURE__*/function () {
1171
1816
  * @param filterCurrentPractitioner the uuid of the current assistant assigned to filter with
1172
1817
  * @param filterIsoLocality the of isoLocality to filter with
1173
1818
  * @returns a list of consult
1174
- */;
1819
+ */
1820
+ ;
1821
+
1175
1822
  _proto.getConsults = function getConsults(uuidPractice, uuidRequester, statusesMedical, statusesExclude, shortId, columnToSortTo, orderToSortTo, perPage, indexPage, filterAssignedDoctor, filterCurrentPractitioner, filterIsoLocality, filterAssignee, uuidParent, typesConsult) {
1176
1823
  return this.api.get(this.baseURL + "/v1/consults", {
1177
1824
  params: {
@@ -1193,6 +1840,7 @@ var ConsultService = /*#__PURE__*/function () {
1193
1840
  }
1194
1841
  });
1195
1842
  };
1843
+
1196
1844
  _proto.getConsultByUUID = function getConsultByUUID(uuidConsult, uuidPractice) {
1197
1845
  return this.api.get(this.baseURL + "/v1/consults/" + uuidConsult, {
1198
1846
  params: {
@@ -1200,6 +1848,7 @@ var ConsultService = /*#__PURE__*/function () {
1200
1848
  }
1201
1849
  });
1202
1850
  };
1851
+
1203
1852
  _proto.updateConsultByUUID = function updateConsultByUUID(uuidConsult, consult, uuidPractice, uuidRequester) {
1204
1853
  return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult, consult, {
1205
1854
  params: {
@@ -1208,6 +1857,7 @@ var ConsultService = /*#__PURE__*/function () {
1208
1857
  }
1209
1858
  });
1210
1859
  };
1860
+
1211
1861
  _proto.getConsultFaxStatuses = function getConsultFaxStatuses(uuidConsult) {
1212
1862
  return this.api.get(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions", {
1213
1863
  params: {
@@ -1215,52 +1865,64 @@ var ConsultService = /*#__PURE__*/function () {
1215
1865
  }
1216
1866
  });
1217
1867
  };
1218
- _proto.postConsultTransmission = function postConsultTransmission(uuidConsult, nameDriver, addressOrPhoneToSendTo, file, nameReceiver, txtTransmissionTitle, txtTransmissionNotes
1219
- // numTry ?: number,
1868
+
1869
+ _proto.postConsultTransmission = function postConsultTransmission(uuidConsult, nameDriver, addressOrPhoneToSendTo, file, nameReceiver, txtTransmissionTitle, txtTransmissionNotes // numTry ?: number,
1220
1870
  // delay ?: number,
1221
1871
  ) {
1222
1872
  if (nameDriver === void 0) {
1223
1873
  nameDriver = 'Documo';
1224
1874
  }
1875
+
1225
1876
  var data = new FormData();
1226
1877
  data.append('nameDriverReceiver', nameDriver);
1878
+
1227
1879
  if (addressOrPhoneToSendTo) {
1228
1880
  data.append('addressReceiver', addressOrPhoneToSendTo);
1229
1881
  }
1882
+
1230
1883
  if (file) {
1231
1884
  data.append('file', file);
1232
1885
  }
1886
+
1233
1887
  if (nameReceiver) {
1234
1888
  data.append('nameReceiver', nameReceiver);
1235
1889
  }
1890
+
1236
1891
  if (txtTransmissionTitle) {
1237
1892
  data.append('txtTransmissionTitle', txtTransmissionTitle);
1238
1893
  }
1894
+
1239
1895
  if (txtTransmissionNotes) {
1240
1896
  data.append('txtTransmissionNotes', txtTransmissionNotes);
1241
1897
  }
1898
+
1242
1899
  return this.api.post(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions", data, {
1243
1900
  headers: {
1244
1901
  'Content-Type': 'multipart/form-data;'
1245
1902
  }
1246
1903
  });
1247
1904
  };
1905
+
1248
1906
  _proto.postConsultFax = function postConsultFax(uuidConsult, addressReceiver, file) {
1249
1907
  return this.postConsultTransmission(uuidConsult, 'Documo', addressReceiver, file);
1250
1908
  };
1909
+
1251
1910
  _proto.postConsultEmail = function postConsultEmail(uuidConsult, file) {
1252
1911
  return this.postConsultTransmission(uuidConsult, 'Pharmacierge', undefined, file);
1253
1912
  };
1913
+
1254
1914
  _proto.retryConsultFax = function retryConsultFax(uuidConsult, transmissionId) {
1255
1915
  return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions/" + transmissionId, {
1256
1916
  status: TransmissionStatus.Retrying
1257
1917
  });
1258
1918
  };
1919
+
1259
1920
  _proto.updateConsultTransmissionStatus = function updateConsultTransmissionStatus(transmissionId, uuidConsult, newStatus) {
1260
1921
  return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions/" + transmissionId, {
1261
1922
  status: newStatus
1262
1923
  });
1263
1924
  };
1925
+
1264
1926
  return ConsultService;
1265
1927
  }();
1266
1928
 
@@ -1269,7 +1931,9 @@ var DiagnosisService = /*#__PURE__*/function () {
1269
1931
  this.api = api;
1270
1932
  this.baseURL = baseURL;
1271
1933
  }
1934
+
1272
1935
  var _proto = DiagnosisService.prototype;
1936
+
1273
1937
  _proto.getDiagnoses = function getDiagnoses() {
1274
1938
  return this.api.get(this.baseURL + "/v1/diagnoses");
1275
1939
  }
@@ -1277,16 +1941,25 @@ var DiagnosisService = /*#__PURE__*/function () {
1277
1941
  * Get a diagnosis by uuid that belongs to your practice
1278
1942
  * @param uuidDiagnosis the uuid of the diagnosis
1279
1943
  * @returns a diagnosis
1280
- */;
1944
+ */
1945
+ ;
1946
+
1281
1947
  _proto.getDiagnosisByUuid = function getDiagnosisByUuid(uuidDiagnosis) {
1282
1948
  return this.api.get(this.baseURL + "/v1/diagnoses/" + uuidDiagnosis);
1283
1949
  };
1950
+
1284
1951
  _proto.createDiagnosis = function createDiagnosis(diagnosis) {
1285
1952
  return this.api.post(this.baseURL + "/v1/diagnoses", diagnosis);
1286
1953
  };
1954
+
1287
1955
  _proto.updateDiagnosis = function updateDiagnosis(uuid, diagnosis) {
1288
1956
  return this.api.put(this.baseURL + "/v1/diagnoses/" + uuid, diagnosis);
1289
1957
  };
1958
+
1959
+ _proto.getTreatmentByUuid = function getTreatmentByUuid(uuidDiagnosis, uuidTreatment) {
1960
+ return this.api.get(this.baseURL + "/v1/diagnoses/" + uuidDiagnosis + "/treatments/" + uuidTreatment);
1961
+ };
1962
+
1290
1963
  _proto.getTreatmentsFromDiagnosisUuid = function getTreatmentsFromDiagnosisUuid(diagnosisUuid) {
1291
1964
  return this.api.get(this.baseURL + "/v1/diagnoses/" + diagnosisUuid + "/treatments");
1292
1965
  }
@@ -1294,7 +1967,9 @@ var DiagnosisService = /*#__PURE__*/function () {
1294
1967
  * This function returns treatment plans associated to a consult
1295
1968
  * @param uuidConsult the consult uuid to fetch
1296
1969
  * @returns an array of TreatmentPlan
1297
- */;
1970
+ */
1971
+ ;
1972
+
1298
1973
  _proto.getTreatmentPlansFromConsultUuid = function getTreatmentPlansFromConsultUuid(uuidConsult) {
1299
1974
  return this.api.get(this.baseURL + "/v1/treatment-plans/", {
1300
1975
  params: {
@@ -1306,7 +1981,9 @@ var DiagnosisService = /*#__PURE__*/function () {
1306
1981
  * creates a new treatment for the specified diagnosis
1307
1982
  * @param diagnosisUuid uuid of the diagnosis that the treatment is linked to
1308
1983
  * @param treatmentRequest the treatment to be inserted
1309
- */;
1984
+ */
1985
+ ;
1986
+
1310
1987
  _proto.createTreatment = function createTreatment(diagnosisUuid, treatmentRequest) {
1311
1988
  return this.api.post(this.baseURL + "/v1/diagnoses/" + diagnosisUuid + "/treatments", treatmentRequest);
1312
1989
  }
@@ -1314,7 +1991,9 @@ var DiagnosisService = /*#__PURE__*/function () {
1314
1991
  * This function returns populated treatment plans associated to a consult
1315
1992
  * @param uuidConsult the consult uuid to fetch
1316
1993
  * @returns a TreatmentPlans object
1317
- */;
1994
+ */
1995
+ ;
1996
+
1318
1997
  _proto.getTreatmentPlansPopulatedFromConsultUuid = function getTreatmentPlansPopulatedFromConsultUuid(uuidConsult) {
1319
1998
  return this.api.get(this.baseURL + "/v1/treatment-plans/", {
1320
1999
  params: {
@@ -1323,9 +2002,11 @@ var DiagnosisService = /*#__PURE__*/function () {
1323
2002
  }
1324
2003
  });
1325
2004
  };
2005
+
1326
2006
  _proto.postPlans = function postPlans(plans) {
1327
2007
  return this.api.post(this.baseURL + "/v1/treatment-plans", plans);
1328
2008
  };
2009
+
1329
2010
  _proto.updateTreatmentPlan = function updateTreatmentPlan(uuidPlan, uuidConsult, diagnosisRequest, plan, refill) {
1330
2011
  return this.api.put(this.baseURL + "/v1/treatment-plans/" + uuidPlan, {
1331
2012
  uuidConsult: uuidConsult,
@@ -1334,25 +2015,15 @@ var DiagnosisService = /*#__PURE__*/function () {
1334
2015
  refill: refill
1335
2016
  });
1336
2017
  };
1337
- _proto.updateTreatmentPlanAndSetAssociatedConsult = function updateTreatmentPlanAndSetAssociatedConsult(uuidPlan, consultAssociated, diagnosisRequest, plan, refill) {
1338
- var associatedConsultData = {
1339
- uuidConsult: consultAssociated.uuid,
1340
- consultKind: consultAssociated.consultType
1341
- };
1342
- //this is fire and forget and may fail later
1343
- try {
1344
- this.updateAssociatedConsultsToTreatment(uuidPlan, [associatedConsultData]);
1345
- } catch (_unused) {
1346
- console.error("[SDK Diagnosis] We failed to updated associated consult to the treatment plan " + uuidPlan);
1347
- }
1348
- return this.updateTreatmentPlan(uuidPlan, consultAssociated.uuid, diagnosisRequest, plan, refill);
1349
- };
1350
- _proto.setAssociatedConsultsToTreatment = function setAssociatedConsultsToTreatment(uuidPlan, arrAssociatedConsults) {
1351
- return this.api.post(this.baseURL + "/v1/treatment-plans/" + uuidPlan + "/associated-consults", arrAssociatedConsults);
2018
+
2019
+ _proto.setAssociatedConsultsToTreatment = function setAssociatedConsultsToTreatment(diagnosisUuid, treatmentUuid, arrAssociatedConsults) {
2020
+ return this.api.post(this.baseURL + "/v1/diagnoses/" + diagnosisUuid + "/treatments/" + treatmentUuid + "/associated-consults", arrAssociatedConsults);
1352
2021
  };
1353
- _proto.updateAssociatedConsultsToTreatment = function updateAssociatedConsultsToTreatment(uuidPlan, arrAssociatedConsults) {
1354
- return this.api.put(this.baseURL + "/v1/treatment-plans/" + uuidPlan + "/associated-consults", arrAssociatedConsults);
2022
+
2023
+ _proto.updateAssociatedConsultsToTreatment = function updateAssociatedConsultsToTreatment(diagnosisUuid, treatmentUuid, arrAssociatedConsults) {
2024
+ return this.api.put(this.baseURL + "/v1/diagnoses/" + diagnosisUuid + "/treatments/" + treatmentUuid + "/associated-consults", arrAssociatedConsults);
1355
2025
  };
2026
+
1356
2027
  _proto.acceptTreatmentPlan = function acceptTreatmentPlan(uuidPlan, uuidConsult) {
1357
2028
  return this.api.put(this.baseURL + "/v1/treatment-plans/" + uuidPlan + "/accept", {
1358
2029
  uuidConsult: uuidConsult
@@ -1361,37 +2032,49 @@ var DiagnosisService = /*#__PURE__*/function () {
1361
2032
  /**
1362
2033
  * retrieves all the drugs of the specified practice
1363
2034
  * @param uuidPractice
1364
- */;
2035
+ */
2036
+ ;
2037
+
1365
2038
  _proto.getAllDrugs =
1366
2039
  /*#__PURE__*/
1367
2040
  function () {
1368
- var _getAllDrugs = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(uuidPractice) {
2041
+ var _getAllDrugs = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(uuidPractice) {
1369
2042
  var res;
1370
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1371
- while (1) switch (_context.prev = _context.next) {
1372
- case 0:
1373
- _context.next = 2;
1374
- return this.api.get(this.baseURL + "/v1/drugs/practice/" + uuidPractice);
1375
- case 2:
1376
- res = _context.sent;
1377
- if (!(res && res.foundDrugs)) {
1378
- _context.next = 5;
1379
- break;
1380
- }
1381
- return _context.abrupt("return", res.foundDrugs);
1382
- case 5:
1383
- return _context.abrupt("return", undefined);
1384
- case 6:
1385
- case "end":
1386
- return _context.stop();
2043
+ return runtime_1.wrap(function _callee$(_context) {
2044
+ while (1) {
2045
+ switch (_context.prev = _context.next) {
2046
+ case 0:
2047
+ _context.next = 2;
2048
+ return this.api.get(this.baseURL + "/v1/drugs/practice/" + uuidPractice);
2049
+
2050
+ case 2:
2051
+ res = _context.sent;
2052
+
2053
+ if (!(res && res.foundDrugs)) {
2054
+ _context.next = 5;
2055
+ break;
2056
+ }
2057
+
2058
+ return _context.abrupt("return", res.foundDrugs);
2059
+
2060
+ case 5:
2061
+ return _context.abrupt("return", undefined);
2062
+
2063
+ case 6:
2064
+ case "end":
2065
+ return _context.stop();
2066
+ }
1387
2067
  }
1388
2068
  }, _callee, this);
1389
2069
  }));
2070
+
1390
2071
  function getAllDrugs(_x) {
1391
2072
  return _getAllDrugs.apply(this, arguments);
1392
2073
  }
2074
+
1393
2075
  return getAllDrugs;
1394
2076
  }();
2077
+
1395
2078
  return DiagnosisService;
1396
2079
  }();
1397
2080
 
@@ -1400,6 +2083,7 @@ var GuardService = /*#__PURE__*/function () {
1400
2083
  this.api = api;
1401
2084
  this.baseURL = baseURL;
1402
2085
  this.api.setAuthRefreshFn(this.authRefresh.bind(this)); // This is the default behavior for User JWT tokens. If you want other kind of refresh you shall overwrite this call
2086
+
1403
2087
  this.identityCache = {};
1404
2088
  this.whoAmICache = {};
1405
2089
  }
@@ -1414,7 +2098,10 @@ var GuardService = /*#__PURE__*/function () {
1414
2098
  * ```
1415
2099
  * @param tokens
1416
2100
  */
2101
+
2102
+
1417
2103
  var _proto = GuardService.prototype;
2104
+
1418
2105
  _proto.setTokens = function setTokens(tokens) {
1419
2106
  this.api.setTokens(_extends({}, this.api.getTokens(), tokens));
1420
2107
  }
@@ -1423,59 +2110,76 @@ var GuardService = /*#__PURE__*/function () {
1423
2110
  *
1424
2111
  * @param req The credentials required to get an access token
1425
2112
  * @returns AuthTokenResponse
1426
- */;
2113
+ */
2114
+ ;
2115
+
1427
2116
  _proto.m2mToken =
1428
2117
  /*#__PURE__*/
1429
2118
  function () {
1430
- var _m2mToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(req) {
2119
+ var _m2mToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(req) {
1431
2120
  var resp, config, _e$response, code;
1432
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1433
- while (1) switch (_context.prev = _context.next) {
1434
- case 0:
1435
- _context.prev = 0;
1436
- config = {
1437
- skipAuthRefresh: true
1438
- };
1439
- _context.next = 4;
1440
- return this.api.post(this.baseURL + "/v1/m2m/token", req, config);
1441
- case 4:
1442
- resp = _context.sent;
1443
- this.api.setTokens({
1444
- accessToken: resp.accessToken
1445
- });
1446
- _context.next = 20;
1447
- break;
1448
- case 8:
1449
- _context.prev = 8;
1450
- _context.t0 = _context["catch"](0);
1451
- console.error('Error while posting m2m token:', _context.t0);
1452
- if (!_context.t0.isAxiosError) {
1453
- _context.next = 19;
2121
+
2122
+ return runtime_1.wrap(function _callee$(_context) {
2123
+ while (1) {
2124
+ switch (_context.prev = _context.next) {
2125
+ case 0:
2126
+ _context.prev = 0;
2127
+ config = {
2128
+ skipAuthRefresh: true
2129
+ };
2130
+ _context.next = 4;
2131
+ return this.api.post(this.baseURL + "/v1/m2m/token", req, config);
2132
+
2133
+ case 4:
2134
+ resp = _context.sent;
2135
+ this.api.setTokens({
2136
+ accessToken: resp.accessToken
2137
+ });
2138
+ _context.next = 20;
1454
2139
  break;
1455
- }
1456
- code = (_e$response = _context.t0.response) == null ? void 0 : _e$response.status;
1457
- _context.t1 = code;
1458
- _context.next = _context.t1 === 400 ? 16 : _context.t1 === 500 ? 17 : _context.t1 === 401 ? 18 : 18;
1459
- break;
1460
- case 16:
1461
- throw new AuthenticationBadRequest();
1462
- case 17:
1463
- throw new AuthenticationServerError();
1464
- case 18:
1465
- throw new AuthenticationFailed();
1466
- case 19:
1467
- throw new AuthenticationFailed();
1468
- case 20:
1469
- return _context.abrupt("return", resp);
1470
- case 21:
1471
- case "end":
1472
- return _context.stop();
2140
+
2141
+ case 8:
2142
+ _context.prev = 8;
2143
+ _context.t0 = _context["catch"](0);
2144
+ console.error('Error while posting m2m token:', _context.t0);
2145
+
2146
+ if (!_context.t0.isAxiosError) {
2147
+ _context.next = 19;
2148
+ break;
2149
+ }
2150
+
2151
+ code = (_e$response = _context.t0.response) == null ? void 0 : _e$response.status;
2152
+ _context.t1 = code;
2153
+ _context.next = _context.t1 === 400 ? 16 : _context.t1 === 500 ? 17 : _context.t1 === 401 ? 18 : 18;
2154
+ break;
2155
+
2156
+ case 16:
2157
+ throw new AuthenticationBadRequest();
2158
+
2159
+ case 17:
2160
+ throw new AuthenticationServerError();
2161
+
2162
+ case 18:
2163
+ throw new AuthenticationFailed();
2164
+
2165
+ case 19:
2166
+ throw new AuthenticationFailed();
2167
+
2168
+ case 20:
2169
+ return _context.abrupt("return", resp);
2170
+
2171
+ case 21:
2172
+ case "end":
2173
+ return _context.stop();
2174
+ }
1473
2175
  }
1474
2176
  }, _callee, this, [[0, 8]]);
1475
2177
  }));
2178
+
1476
2179
  function m2mToken(_x) {
1477
2180
  return _m2mToken.apply(this, arguments);
1478
2181
  }
2182
+
1479
2183
  return m2mToken;
1480
2184
  }()
1481
2185
  /**
@@ -1486,61 +2190,78 @@ var GuardService = /*#__PURE__*/function () {
1486
2190
  * @returns AuthTokenResponse
1487
2191
  */
1488
2192
  ;
2193
+
1489
2194
  _proto.authToken =
1490
2195
  /*#__PURE__*/
1491
2196
  function () {
1492
- var _authToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(req) {
2197
+ var _authToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(req) {
1493
2198
  var resp, config, _e$response2, code;
1494
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1495
- while (1) switch (_context2.prev = _context2.next) {
1496
- case 0:
1497
- _context2.prev = 0;
1498
- config = {
1499
- skipAuthRefresh: true
1500
- };
1501
- _context2.next = 4;
1502
- return this.api.post(this.baseURL + "/v1/auth/token", req, config);
1503
- case 4:
1504
- resp = _context2.sent;
1505
- this.api.setTokens({
1506
- accessToken: resp.accessToken,
1507
- refreshToken: resp.refreshToken
1508
- });
1509
- _context2.next = 21;
1510
- break;
1511
- case 8:
1512
- _context2.prev = 8;
1513
- _context2.t0 = _context2["catch"](0);
1514
- console.error('Error while posting auth token:', _context2.t0);
1515
- if (!_context2.t0.isAxiosError) {
1516
- _context2.next = 20;
2199
+
2200
+ return runtime_1.wrap(function _callee2$(_context2) {
2201
+ while (1) {
2202
+ switch (_context2.prev = _context2.next) {
2203
+ case 0:
2204
+ _context2.prev = 0;
2205
+ config = {
2206
+ skipAuthRefresh: true
2207
+ };
2208
+ _context2.next = 4;
2209
+ return this.api.post(this.baseURL + "/v1/auth/token", req, config);
2210
+
2211
+ case 4:
2212
+ resp = _context2.sent;
2213
+ this.api.setTokens({
2214
+ accessToken: resp.accessToken,
2215
+ refreshToken: resp.refreshToken
2216
+ });
2217
+ _context2.next = 21;
1517
2218
  break;
1518
- }
1519
- code = (_e$response2 = _context2.t0.response) == null ? void 0 : _e$response2.status;
1520
- _context2.t1 = code;
1521
- _context2.next = _context2.t1 === 400 ? 16 : _context2.t1 === 424 ? 17 : _context2.t1 === 500 ? 18 : _context2.t1 === 401 ? 19 : 19;
1522
- break;
1523
- case 16:
1524
- throw new AuthenticationBadRequest();
1525
- case 17:
1526
- throw new AuthenticationUnconfirmedEmail();
1527
- case 18:
1528
- throw new AuthenticationServerError();
1529
- case 19:
1530
- throw new AuthenticationFailed();
1531
- case 20:
1532
- throw new AuthenticationFailed();
1533
- case 21:
1534
- return _context2.abrupt("return", resp);
1535
- case 22:
1536
- case "end":
1537
- return _context2.stop();
2219
+
2220
+ case 8:
2221
+ _context2.prev = 8;
2222
+ _context2.t0 = _context2["catch"](0);
2223
+ console.error('Error while posting auth token:', _context2.t0);
2224
+
2225
+ if (!_context2.t0.isAxiosError) {
2226
+ _context2.next = 20;
2227
+ break;
2228
+ }
2229
+
2230
+ code = (_e$response2 = _context2.t0.response) == null ? void 0 : _e$response2.status;
2231
+ _context2.t1 = code;
2232
+ _context2.next = _context2.t1 === 400 ? 16 : _context2.t1 === 424 ? 17 : _context2.t1 === 500 ? 18 : _context2.t1 === 401 ? 19 : 19;
2233
+ break;
2234
+
2235
+ case 16:
2236
+ throw new AuthenticationBadRequest();
2237
+
2238
+ case 17:
2239
+ throw new AuthenticationUnconfirmedEmail();
2240
+
2241
+ case 18:
2242
+ throw new AuthenticationServerError();
2243
+
2244
+ case 19:
2245
+ throw new AuthenticationFailed();
2246
+
2247
+ case 20:
2248
+ throw new AuthenticationFailed();
2249
+
2250
+ case 21:
2251
+ return _context2.abrupt("return", resp);
2252
+
2253
+ case 22:
2254
+ case "end":
2255
+ return _context2.stop();
2256
+ }
1538
2257
  }
1539
2258
  }, _callee2, this, [[0, 8]]);
1540
2259
  }));
2260
+
1541
2261
  function authToken(_x2) {
1542
2262
  return _authToken.apply(this, arguments);
1543
2263
  }
2264
+
1544
2265
  return authToken;
1545
2266
  }()
1546
2267
  /**
@@ -1549,28 +2270,34 @@ var GuardService = /*#__PURE__*/function () {
1549
2270
  * @returns AuthTokenResponse
1550
2271
  */
1551
2272
  ;
2273
+
1552
2274
  _proto.authRefresh =
1553
2275
  /*#__PURE__*/
1554
2276
  function () {
1555
- var _authRefresh = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(refreshToken) {
2277
+ var _authRefresh = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(refreshToken) {
1556
2278
  var config;
1557
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1558
- while (1) switch (_context3.prev = _context3.next) {
1559
- case 0:
1560
- config = {
1561
- skipAuthRefresh: true,
1562
- useRefreshToken: true
1563
- };
1564
- return _context3.abrupt("return", this.api.put(this.baseURL + "/v1/auth/token", null, config));
1565
- case 2:
1566
- case "end":
1567
- return _context3.stop();
2279
+ return runtime_1.wrap(function _callee3$(_context3) {
2280
+ while (1) {
2281
+ switch (_context3.prev = _context3.next) {
2282
+ case 0:
2283
+ config = {
2284
+ skipAuthRefresh: true,
2285
+ useRefreshToken: true
2286
+ };
2287
+ return _context3.abrupt("return", this.api.put(this.baseURL + "/v1/auth/token", null, config));
2288
+
2289
+ case 2:
2290
+ case "end":
2291
+ return _context3.stop();
2292
+ }
1568
2293
  }
1569
2294
  }, _callee3, this);
1570
2295
  }));
2296
+
1571
2297
  function authRefresh(_x3) {
1572
2298
  return _authRefresh.apply(this, arguments);
1573
2299
  }
2300
+
1574
2301
  return authRefresh;
1575
2302
  }()
1576
2303
  /**
@@ -1579,23 +2306,29 @@ var GuardService = /*#__PURE__*/function () {
1579
2306
  * @returns void
1580
2307
  */
1581
2308
  ;
2309
+
1582
2310
  _proto.authLogout =
1583
2311
  /*#__PURE__*/
1584
2312
  function () {
1585
- var _authLogout = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
1586
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1587
- while (1) switch (_context4.prev = _context4.next) {
1588
- case 0:
1589
- return _context4.abrupt("return", this.api.get(this.baseURL + "/v1/auth/logout"));
1590
- case 1:
1591
- case "end":
1592
- return _context4.stop();
2313
+ var _authLogout = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
2314
+ return runtime_1.wrap(function _callee4$(_context4) {
2315
+ while (1) {
2316
+ switch (_context4.prev = _context4.next) {
2317
+ case 0:
2318
+ return _context4.abrupt("return", this.api.get(this.baseURL + "/v1/auth/logout"));
2319
+
2320
+ case 1:
2321
+ case "end":
2322
+ return _context4.stop();
2323
+ }
1593
2324
  }
1594
2325
  }, _callee4, this);
1595
2326
  }));
2327
+
1596
2328
  function authLogout() {
1597
2329
  return _authLogout.apply(this, arguments);
1598
2330
  }
2331
+
1599
2332
  return authLogout;
1600
2333
  }()
1601
2334
  /**
@@ -1605,23 +2338,29 @@ var GuardService = /*#__PURE__*/function () {
1605
2338
  * @returns void
1606
2339
  */
1607
2340
  ;
2341
+
1608
2342
  _proto.authRecover =
1609
2343
  /*#__PURE__*/
1610
2344
  function () {
1611
- var _authRecover = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(req) {
1612
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1613
- while (1) switch (_context5.prev = _context5.next) {
1614
- case 0:
1615
- return _context5.abrupt("return", this.api.post(this.baseURL + "/v1/auth/recover", req));
1616
- case 1:
1617
- case "end":
1618
- return _context5.stop();
2345
+ var _authRecover = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(req) {
2346
+ return runtime_1.wrap(function _callee5$(_context5) {
2347
+ while (1) {
2348
+ switch (_context5.prev = _context5.next) {
2349
+ case 0:
2350
+ return _context5.abrupt("return", this.api.post(this.baseURL + "/v1/auth/recover", req));
2351
+
2352
+ case 1:
2353
+ case "end":
2354
+ return _context5.stop();
2355
+ }
1619
2356
  }
1620
2357
  }, _callee5, this);
1621
2358
  }));
2359
+
1622
2360
  function authRecover(_x4) {
1623
2361
  return _authRecover.apply(this, arguments);
1624
2362
  }
2363
+
1625
2364
  return authRecover;
1626
2365
  }()
1627
2366
  /**
@@ -1632,54 +2371,70 @@ var GuardService = /*#__PURE__*/function () {
1632
2371
  * @returns IdentityResponse
1633
2372
  */
1634
2373
  ;
2374
+
1635
2375
  _proto.identityCreate =
1636
2376
  /*#__PURE__*/
1637
2377
  function () {
1638
- var _identityCreate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(req) {
2378
+ var _identityCreate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(req) {
1639
2379
  var resp, _e$response3, code;
1640
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1641
- while (1) switch (_context6.prev = _context6.next) {
1642
- case 0:
1643
- _context6.prev = 0;
1644
- _context6.next = 3;
1645
- return this.api.post(this.baseURL + "/v1/identities", req);
1646
- case 3:
1647
- resp = _context6.sent;
1648
- this.api.setTokens({
1649
- refreshToken: resp.refreshToken
1650
- });
1651
- _context6.next = 18;
1652
- break;
1653
- case 7:
1654
- _context6.prev = 7;
1655
- _context6.t0 = _context6["catch"](0);
1656
- if (!_context6.t0.isAxiosError) {
1657
- _context6.next = 17;
2380
+
2381
+ return runtime_1.wrap(function _callee6$(_context6) {
2382
+ while (1) {
2383
+ switch (_context6.prev = _context6.next) {
2384
+ case 0:
2385
+ _context6.prev = 0;
2386
+ _context6.next = 3;
2387
+ return this.api.post(this.baseURL + "/v1/identities", req);
2388
+
2389
+ case 3:
2390
+ resp = _context6.sent;
2391
+ this.api.setTokens({
2392
+ refreshToken: resp.refreshToken
2393
+ });
2394
+ _context6.next = 18;
1658
2395
  break;
1659
- }
1660
- code = (_e$response3 = _context6.t0.response) == null ? void 0 : _e$response3.status;
1661
- _context6.t1 = code;
1662
- _context6.next = _context6.t1 === 400 ? 14 : _context6.t1 === 409 ? 15 : _context6.t1 === 500 ? 16 : 16;
1663
- break;
1664
- case 14:
1665
- throw new IdentityCreationBadRequest();
1666
- case 15:
1667
- throw new IdentityCreationConflict();
1668
- case 16:
1669
- throw new IdentityCreationFailed();
1670
- case 17:
1671
- throw new IdentityCreationFailed();
1672
- case 18:
1673
- return _context6.abrupt("return", resp);
1674
- case 19:
1675
- case "end":
1676
- return _context6.stop();
2396
+
2397
+ case 7:
2398
+ _context6.prev = 7;
2399
+ _context6.t0 = _context6["catch"](0);
2400
+
2401
+ if (!_context6.t0.isAxiosError) {
2402
+ _context6.next = 17;
2403
+ break;
2404
+ }
2405
+
2406
+ code = (_e$response3 = _context6.t0.response) == null ? void 0 : _e$response3.status;
2407
+ _context6.t1 = code;
2408
+ _context6.next = _context6.t1 === 400 ? 14 : _context6.t1 === 409 ? 15 : _context6.t1 === 500 ? 16 : 16;
2409
+ break;
2410
+
2411
+ case 14:
2412
+ throw new IdentityCreationBadRequest();
2413
+
2414
+ case 15:
2415
+ throw new IdentityCreationConflict();
2416
+
2417
+ case 16:
2418
+ throw new IdentityCreationFailed();
2419
+
2420
+ case 17:
2421
+ throw new IdentityCreationFailed();
2422
+
2423
+ case 18:
2424
+ return _context6.abrupt("return", resp);
2425
+
2426
+ case 19:
2427
+ case "end":
2428
+ return _context6.stop();
2429
+ }
1677
2430
  }
1678
2431
  }, _callee6, this, [[0, 7]]);
1679
2432
  }));
2433
+
1680
2434
  function identityCreate(_x5) {
1681
2435
  return _identityCreate.apply(this, arguments);
1682
2436
  }
2437
+
1683
2438
  return identityCreate;
1684
2439
  }()
1685
2440
  /**
@@ -1691,46 +2446,61 @@ var GuardService = /*#__PURE__*/function () {
1691
2446
  * @returns IdentityResponse
1692
2447
  */
1693
2448
  ;
2449
+
1694
2450
  _proto.identityGet =
1695
2451
  /*#__PURE__*/
1696
2452
  function () {
1697
- var _identityGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(identityID, skipCache) {
2453
+ var _identityGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(identityID, skipCache) {
1698
2454
  var _tokens$accessToken, _tokens$refreshToken;
2455
+
1699
2456
  var tokens, cacheKey, identity;
1700
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1701
- while (1) switch (_context7.prev = _context7.next) {
1702
- case 0:
1703
- if (skipCache === void 0) {
1704
- skipCache = false;
1705
- }
1706
- tokens = this.api.getTokens();
1707
- cacheKey = ((_tokens$accessToken = tokens.accessToken) != null ? _tokens$accessToken : '') + ((_tokens$refreshToken = tokens.refreshToken) != null ? _tokens$refreshToken : '') + identityID;
1708
- if (!(skipCache || !tokens.accessToken || !this.identityCache[cacheKey])) {
1709
- _context7.next = 10;
1710
- break;
1711
- }
1712
- _context7.next = 6;
1713
- return this.api.get(this.baseURL + "/v1/identities/" + identityID);
1714
- case 6:
1715
- identity = _context7.sent;
1716
- if (!skipCache) {
1717
- _context7.next = 9;
1718
- break;
1719
- }
1720
- return _context7.abrupt("return", identity);
1721
- case 9:
1722
- this.identityCache[cacheKey] = identity;
1723
- case 10:
1724
- return _context7.abrupt("return", this.identityCache[cacheKey]);
1725
- case 11:
1726
- case "end":
1727
- return _context7.stop();
2457
+ return runtime_1.wrap(function _callee7$(_context7) {
2458
+ while (1) {
2459
+ switch (_context7.prev = _context7.next) {
2460
+ case 0:
2461
+ if (skipCache === void 0) {
2462
+ skipCache = false;
2463
+ }
2464
+
2465
+ tokens = this.api.getTokens();
2466
+ cacheKey = ((_tokens$accessToken = tokens.accessToken) != null ? _tokens$accessToken : '') + ((_tokens$refreshToken = tokens.refreshToken) != null ? _tokens$refreshToken : '') + identityID;
2467
+
2468
+ if (!(skipCache || !tokens.accessToken || !this.identityCache[cacheKey])) {
2469
+ _context7.next = 10;
2470
+ break;
2471
+ }
2472
+
2473
+ _context7.next = 6;
2474
+ return this.api.get(this.baseURL + "/v1/identities/" + identityID);
2475
+
2476
+ case 6:
2477
+ identity = _context7.sent;
2478
+
2479
+ if (!skipCache) {
2480
+ _context7.next = 9;
2481
+ break;
2482
+ }
2483
+
2484
+ return _context7.abrupt("return", identity);
2485
+
2486
+ case 9:
2487
+ this.identityCache[cacheKey] = identity;
2488
+
2489
+ case 10:
2490
+ return _context7.abrupt("return", this.identityCache[cacheKey]);
2491
+
2492
+ case 11:
2493
+ case "end":
2494
+ return _context7.stop();
2495
+ }
1728
2496
  }
1729
2497
  }, _callee7, this);
1730
2498
  }));
2499
+
1731
2500
  function identityGet(_x6, _x7) {
1732
2501
  return _identityGet.apply(this, arguments);
1733
2502
  }
2503
+
1734
2504
  return identityGet;
1735
2505
  }()
1736
2506
  /**
@@ -1740,38 +2510,50 @@ var GuardService = /*#__PURE__*/function () {
1740
2510
  * @returns WhoAmIResponse
1741
2511
  */
1742
2512
  ;
2513
+
1743
2514
  _proto.whoAmI =
1744
2515
  /*#__PURE__*/
1745
2516
  function () {
1746
- var _whoAmI = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(refreshCache) {
2517
+ var _whoAmI = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(refreshCache) {
1747
2518
  var _this$api$getTokens$a;
2519
+
1748
2520
  var cacheKey;
1749
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1750
- while (1) switch (_context8.prev = _context8.next) {
1751
- case 0:
1752
- if (refreshCache === void 0) {
1753
- refreshCache = false;
1754
- }
1755
- cacheKey = (_this$api$getTokens$a = this.api.getTokens().accessToken) != null ? _this$api$getTokens$a : '';
1756
- if (!(!this.whoAmICache[cacheKey] || refreshCache)) {
1757
- _context8.next = 6;
1758
- break;
1759
- }
1760
- _context8.next = 5;
1761
- return this.api.get(this.baseURL + "/v1/auth/whoami");
1762
- case 5:
1763
- this.whoAmICache[cacheKey] = _context8.sent;
1764
- case 6:
1765
- return _context8.abrupt("return", this.whoAmICache[cacheKey]);
1766
- case 7:
1767
- case "end":
1768
- return _context8.stop();
2521
+ return runtime_1.wrap(function _callee8$(_context8) {
2522
+ while (1) {
2523
+ switch (_context8.prev = _context8.next) {
2524
+ case 0:
2525
+ if (refreshCache === void 0) {
2526
+ refreshCache = false;
2527
+ }
2528
+
2529
+ cacheKey = (_this$api$getTokens$a = this.api.getTokens().accessToken) != null ? _this$api$getTokens$a : '';
2530
+
2531
+ if (!(!this.whoAmICache[cacheKey] || refreshCache)) {
2532
+ _context8.next = 6;
2533
+ break;
2534
+ }
2535
+
2536
+ _context8.next = 5;
2537
+ return this.api.get(this.baseURL + "/v1/auth/whoami");
2538
+
2539
+ case 5:
2540
+ this.whoAmICache[cacheKey] = _context8.sent;
2541
+
2542
+ case 6:
2543
+ return _context8.abrupt("return", this.whoAmICache[cacheKey]);
2544
+
2545
+ case 7:
2546
+ case "end":
2547
+ return _context8.stop();
2548
+ }
1769
2549
  }
1770
2550
  }, _callee8, this);
1771
2551
  }));
2552
+
1772
2553
  function whoAmI(_x8) {
1773
2554
  return _whoAmI.apply(this, arguments);
1774
2555
  }
2556
+
1775
2557
  return whoAmI;
1776
2558
  }()
1777
2559
  /**
@@ -1782,23 +2564,29 @@ var GuardService = /*#__PURE__*/function () {
1782
2564
  * @returns IdentityResponse
1783
2565
  */
1784
2566
  ;
2567
+
1785
2568
  _proto.identityUpdate =
1786
2569
  /*#__PURE__*/
1787
2570
  function () {
1788
- var _identityUpdate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(identityID, req) {
1789
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1790
- while (1) switch (_context9.prev = _context9.next) {
1791
- case 0:
1792
- return _context9.abrupt("return", this.api.put(this.baseURL + "/v1/identities/" + identityID, req));
1793
- case 1:
1794
- case "end":
1795
- return _context9.stop();
2571
+ var _identityUpdate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(identityID, req) {
2572
+ return runtime_1.wrap(function _callee9$(_context9) {
2573
+ while (1) {
2574
+ switch (_context9.prev = _context9.next) {
2575
+ case 0:
2576
+ return _context9.abrupt("return", this.api.put(this.baseURL + "/v1/identities/" + identityID, req));
2577
+
2578
+ case 1:
2579
+ case "end":
2580
+ return _context9.stop();
2581
+ }
1796
2582
  }
1797
2583
  }, _callee9, this);
1798
2584
  }));
2585
+
1799
2586
  function identityUpdate(_x9, _x10) {
1800
2587
  return _identityUpdate.apply(this, arguments);
1801
2588
  }
2589
+
1802
2590
  return identityUpdate;
1803
2591
  }()
1804
2592
  /**
@@ -1810,31 +2598,37 @@ var GuardService = /*#__PURE__*/function () {
1810
2598
  * @returns QRCodeResponse
1811
2599
  */
1812
2600
  ;
2601
+
1813
2602
  _proto.identityMFAQRCode =
1814
2603
  /*#__PURE__*/
1815
2604
  function () {
1816
- var _identityMFAQRCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(identityID, password) {
2605
+ var _identityMFAQRCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(identityID, password) {
1817
2606
  var req;
1818
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1819
- while (1) switch (_context10.prev = _context10.next) {
1820
- case 0:
1821
- req = {
1822
- password: password
1823
- };
1824
- return _context10.abrupt("return", this.api.post(this.baseURL + "/v1/identities/" + identityID + "/mfa", req, {
1825
- headers: {
1826
- Accept: 'application/json'
1827
- }
1828
- }));
1829
- case 2:
1830
- case "end":
1831
- return _context10.stop();
2607
+ return runtime_1.wrap(function _callee10$(_context10) {
2608
+ while (1) {
2609
+ switch (_context10.prev = _context10.next) {
2610
+ case 0:
2611
+ req = {
2612
+ password: password
2613
+ };
2614
+ return _context10.abrupt("return", this.api.post(this.baseURL + "/v1/identities/" + identityID + "/mfa", req, {
2615
+ headers: {
2616
+ Accept: 'application/json'
2617
+ }
2618
+ }));
2619
+
2620
+ case 2:
2621
+ case "end":
2622
+ return _context10.stop();
2623
+ }
1832
2624
  }
1833
2625
  }, _callee10, this);
1834
2626
  }));
2627
+
1835
2628
  function identityMFAQRCode(_x11, _x12) {
1836
2629
  return _identityMFAQRCode.apply(this, arguments);
1837
2630
  }
2631
+
1838
2632
  return identityMFAQRCode;
1839
2633
  }()
1840
2634
  /**
@@ -1844,23 +2638,29 @@ var GuardService = /*#__PURE__*/function () {
1844
2638
  * @return void
1845
2639
  */
1846
2640
  ;
2641
+
1847
2642
  _proto.identitySendConfirmEmail =
1848
2643
  /*#__PURE__*/
1849
2644
  function () {
1850
- var _identitySendConfirmEmail = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(req) {
1851
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1852
- while (1) switch (_context11.prev = _context11.next) {
1853
- case 0:
1854
- return _context11.abrupt("return", this.api.post(this.baseURL + "/v1/identity/confirm", req));
1855
- case 1:
1856
- case "end":
1857
- return _context11.stop();
2645
+ var _identitySendConfirmEmail = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(req) {
2646
+ return runtime_1.wrap(function _callee11$(_context11) {
2647
+ while (1) {
2648
+ switch (_context11.prev = _context11.next) {
2649
+ case 0:
2650
+ return _context11.abrupt("return", this.api.post(this.baseURL + "/v1/identity/confirm", req));
2651
+
2652
+ case 1:
2653
+ case "end":
2654
+ return _context11.stop();
2655
+ }
1858
2656
  }
1859
2657
  }, _callee11, this);
1860
2658
  }));
2659
+
1861
2660
  function identitySendConfirmEmail(_x13) {
1862
2661
  return _identitySendConfirmEmail.apply(this, arguments);
1863
2662
  }
2663
+
1864
2664
  return identitySendConfirmEmail;
1865
2665
  }()
1866
2666
  /**
@@ -1870,23 +2670,29 @@ var GuardService = /*#__PURE__*/function () {
1870
2670
  * @returns IdentityResponse
1871
2671
  */
1872
2672
  ;
2673
+
1873
2674
  _proto.identityGetByCustomerEmail =
1874
2675
  /*#__PURE__*/
1875
2676
  function () {
1876
- var _identityGetByCustomerEmail = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(email) {
1877
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1878
- while (1) switch (_context12.prev = _context12.next) {
1879
- case 0:
1880
- return _context12.abrupt("return", this.identityGetByHash(email.substring(email.indexOf('+') + 1, email.indexOf('@'))));
1881
- case 1:
1882
- case "end":
1883
- return _context12.stop();
2677
+ var _identityGetByCustomerEmail = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(email) {
2678
+ return runtime_1.wrap(function _callee12$(_context12) {
2679
+ while (1) {
2680
+ switch (_context12.prev = _context12.next) {
2681
+ case 0:
2682
+ return _context12.abrupt("return", this.identityGetByHash(email.substring(email.indexOf('+') + 1, email.indexOf('@'))));
2683
+
2684
+ case 1:
2685
+ case "end":
2686
+ return _context12.stop();
2687
+ }
1884
2688
  }
1885
2689
  }, _callee12, this);
1886
2690
  }));
2691
+
1887
2692
  function identityGetByCustomerEmail(_x14) {
1888
2693
  return _identityGetByCustomerEmail.apply(this, arguments);
1889
2694
  }
2695
+
1890
2696
  return identityGetByCustomerEmail;
1891
2697
  }()
1892
2698
  /**
@@ -1896,25 +2702,32 @@ var GuardService = /*#__PURE__*/function () {
1896
2702
  * @returns IdentityResponse
1897
2703
  */
1898
2704
  ;
2705
+
1899
2706
  _proto.identityGetByHash =
1900
2707
  /*#__PURE__*/
1901
2708
  function () {
1902
- var _identityGetByHash = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(b64Hash) {
1903
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1904
- while (1) switch (_context13.prev = _context13.next) {
1905
- case 0:
1906
- return _context13.abrupt("return", this.identityGet(b64Hash.replace(/\+/g, '-').replace(/\//g, '_')));
1907
- case 1:
1908
- case "end":
1909
- return _context13.stop();
2709
+ var _identityGetByHash = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee13(b64Hash) {
2710
+ return runtime_1.wrap(function _callee13$(_context13) {
2711
+ while (1) {
2712
+ switch (_context13.prev = _context13.next) {
2713
+ case 0:
2714
+ return _context13.abrupt("return", this.identityGet(b64Hash.replace(/\+/g, '-').replace(/\//g, '_')));
2715
+
2716
+ case 1:
2717
+ case "end":
2718
+ return _context13.stop();
2719
+ }
1910
2720
  }
1911
2721
  }, _callee13, this);
1912
2722
  }));
2723
+
1913
2724
  function identityGetByHash(_x15) {
1914
2725
  return _identityGetByHash.apply(this, arguments);
1915
2726
  }
2727
+
1916
2728
  return identityGetByHash;
1917
2729
  }();
2730
+
1918
2731
  return GuardService;
1919
2732
  }();
1920
2733
 
@@ -1928,7 +2741,10 @@ var SearchService = /*#__PURE__*/function () {
1928
2741
  * @param consultUUID
1929
2742
  * @param terms the search terms to be indexed
1930
2743
  */
2744
+
2745
+
1931
2746
  var _proto = SearchService.prototype;
2747
+
1932
2748
  _proto.index = function index(consultUUID, terms) {
1933
2749
  return this.api.post(this.baseURL + "/v1/index", {
1934
2750
  consultUUID: consultUUID,
@@ -1938,12 +2754,15 @@ var SearchService = /*#__PURE__*/function () {
1938
2754
  /**
1939
2755
  * Searches for the consultations corresponding to the search terms entered in the query
1940
2756
  * @param terms array of search terms
1941
- */;
2757
+ */
2758
+ ;
2759
+
1942
2760
  _proto.search = function search(terms) {
1943
2761
  return this.api.post(this.baseURL + "/v1/search", {
1944
2762
  terms: terms
1945
2763
  });
1946
2764
  };
2765
+
1947
2766
  return SearchService;
1948
2767
  }();
1949
2768
 
@@ -1957,7 +2776,10 @@ var PracticeService = /*#__PURE__*/function () {
1957
2776
  * an M2M with the scope `practice.practices.get`
1958
2777
  * @returns an array of practices
1959
2778
  */
2779
+
2780
+
1960
2781
  var _proto = PracticeService.prototype;
2782
+
1961
2783
  _proto.practiceGetAll = function practiceGetAll() {
1962
2784
  return this.api.get(this.baseURL + "/v1/practices");
1963
2785
  }
@@ -1968,7 +2790,9 @@ var PracticeService = /*#__PURE__*/function () {
1968
2790
  * @param hydratePracticeConfigs (optional) if set true it the Practice field configs will be set
1969
2791
  * @param accounts (optional) if set true it the Practice field accounts will be set
1970
2792
  * @returns the found practice or undefined
1971
- */;
2793
+ */
2794
+ ;
2795
+
1972
2796
  _proto.practiceGetFromURL = function practiceGetFromURL(practiceURL, params) {
1973
2797
  return this.api.get(this.baseURL + "/v1/practices", {
1974
2798
  params: _extends({
@@ -1976,6 +2800,7 @@ var PracticeService = /*#__PURE__*/function () {
1976
2800
  }, params)
1977
2801
  });
1978
2802
  };
2803
+
1979
2804
  _proto.practiceGetFromUuid = function practiceGetFromUuid(practiceUuid, locale, withAccounts) {
1980
2805
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid, {
1981
2806
  params: {
@@ -1983,13 +2808,15 @@ var PracticeService = /*#__PURE__*/function () {
1983
2808
  accounts: withAccounts
1984
2809
  }
1985
2810
  });
1986
- }
1987
- /// Practice Configs
2811
+ } /// Practice Configs
2812
+
1988
2813
  /**
1989
2814
  * This function retrieves all configs of a specific practice
1990
2815
  * @param practiceUuid uuid of the practice
1991
2816
  * @returns the practice configs
1992
- */;
2817
+ */
2818
+ ;
2819
+
1993
2820
  _proto.practiceConfigGetFromPracticeUuid = function practiceConfigGetFromPracticeUuid(practiceUuid) {
1994
2821
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/configs");
1995
2822
  }
@@ -1998,7 +2825,9 @@ var PracticeService = /*#__PURE__*/function () {
1998
2825
  * @param practiceUuid uuid of the practice
1999
2826
  * @param kind of the config
2000
2827
  * @returns the practice config
2001
- */;
2828
+ */
2829
+ ;
2830
+
2002
2831
  _proto.practiceConfigGetByKindForPracticeUuid = function practiceConfigGetByKindForPracticeUuid(practiceUuid, kind) {
2003
2832
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/configs/" + kind);
2004
2833
  }
@@ -2007,7 +2836,9 @@ var PracticeService = /*#__PURE__*/function () {
2007
2836
  * @param practiceUuid uuid of the practice
2008
2837
  * @param config the config to add to the practice
2009
2838
  * @returns the created practice config
2010
- */;
2839
+ */
2840
+ ;
2841
+
2011
2842
  _proto.practiceConfigCreateForPracticeUuid = function practiceConfigCreateForPracticeUuid(practiceUuid, config) {
2012
2843
  return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/configs", config);
2013
2844
  }
@@ -2016,15 +2847,18 @@ var PracticeService = /*#__PURE__*/function () {
2016
2847
  * @param practiceUuid uuid of the practice
2017
2848
  * @param config the config to update
2018
2849
  * @returns the practice config
2019
- */;
2850
+ */
2851
+ ;
2852
+
2020
2853
  _proto.practiceConfigUpdate = function practiceConfigUpdate(config) {
2021
2854
  return this.api.put(this.baseURL + "/v1/practices/" + config.uuidPractice + "/configs/" + config.kind, config);
2022
- }
2023
- /// Accounts
2855
+ } /// Accounts
2024
2856
  ;
2857
+
2025
2858
  _proto.practiceGetAccounts = function practiceGetAccounts(practiceUuid) {
2026
2859
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/accounts");
2027
2860
  };
2861
+
2028
2862
  _proto.practiceGetAccount = function practiceGetAccount(practiceUuid, accountUuid) {
2029
2863
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/accounts/" + accountUuid);
2030
2864
  }
@@ -2033,7 +2867,9 @@ var PracticeService = /*#__PURE__*/function () {
2033
2867
  * @param practiceUuid the uuid of the practice
2034
2868
  * @param kind (optional) the kind of WorkflowType to filter in
2035
2869
  * @returns a list of PracticeWorkflow
2036
- */;
2870
+ */
2871
+ ;
2872
+
2037
2873
  _proto.practiceGetWorkflows = function practiceGetWorkflows(practiceUuid, kind) {
2038
2874
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/workflows", {
2039
2875
  params: {
@@ -2041,11 +2877,12 @@ var PracticeService = /*#__PURE__*/function () {
2041
2877
  }
2042
2878
  });
2043
2879
  };
2880
+
2044
2881
  _proto.practiceGetWorkflow = function practiceGetWorkflow(practiceUuid, workflowType) {
2045
2882
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/workflows/" + workflowType);
2046
- }
2047
- /// Plans
2883
+ } /// Plans
2048
2884
  ;
2885
+
2049
2886
  _proto.practiceGetPlans = function practiceGetPlans(practiceUuid, planType) {
2050
2887
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans", {
2051
2888
  params: {
@@ -2053,14 +2890,16 @@ var PracticeService = /*#__PURE__*/function () {
2053
2890
  }
2054
2891
  });
2055
2892
  };
2893
+
2056
2894
  _proto.practiceGetPlan = function practiceGetPlan(practiceUuid, planId) {
2057
2895
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans/" + planId);
2058
2896
  };
2897
+
2059
2898
  _proto.practiceGetPlanPrices = function practiceGetPlanPrices(practiceUuid, planId) {
2060
2899
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans/" + planId + "/prices");
2061
- }
2062
- // Payments
2900
+ } // Payments
2063
2901
  ;
2902
+
2064
2903
  _proto.practiceGetPayments = function practiceGetPayments(practiceUuid, statusPayment, withConsultUUIDNULL, perPage, indexPage) {
2065
2904
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments", {
2066
2905
  params: {
@@ -2071,14 +2910,16 @@ var PracticeService = /*#__PURE__*/function () {
2071
2910
  }
2072
2911
  });
2073
2912
  };
2913
+
2074
2914
  _proto.practiceGetPayment = function practiceGetPayment(practiceUuid, idStripeInvoiceOrPaymentIntent) {
2075
2915
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/" + idStripeInvoiceOrPaymentIntent);
2076
2916
  };
2917
+
2077
2918
  _proto.practiceGetPaymentForStripePaymentIntentWithID = function practiceGetPaymentForStripePaymentIntentWithID(practiceUuid, stripePaymentIntentId) {
2078
2919
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/" + stripePaymentIntentId);
2079
- }
2080
- // Payments Intent
2920
+ } // Payments Intent
2081
2921
  ;
2922
+
2082
2923
  _proto.practiceGetPaymentsIntents = function practiceGetPaymentsIntents(practiceUuid, planType) {
2083
2924
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents", {
2084
2925
  params: {
@@ -2090,7 +2931,9 @@ var PracticeService = /*#__PURE__*/function () {
2090
2931
  * This function return the user hased email to be use for creating payment intent
2091
2932
  * @param email the email to hash
2092
2933
  * @returns a hashed email
2093
- */;
2934
+ */
2935
+ ;
2936
+
2094
2937
  _proto.getPaymentIntentHashedEmail = function getPaymentIntentHashedEmail(email) {
2095
2938
  return hashToBase64String(email.toLowerCase());
2096
2939
  }
@@ -2104,7 +2947,9 @@ var PracticeService = /*#__PURE__*/function () {
2104
2947
  * @param promotionCode (optional) promotion code to apply
2105
2948
  * @param requestMetadata (optional) the request metadata to use. If defined, when payment service call our hooks in practice, it will use it to do required action (create a consult, refill a consult, etc.).
2106
2949
  * @returns
2107
- */;
2950
+ */
2951
+ ;
2952
+
2108
2953
  _proto.practiceCreatePaymentsIntent = function practiceCreatePaymentsIntent(practiceUuid, planId, userEmail, isoLocality, url_subdomain, requestMetadata) {
2109
2954
  return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/", {
2110
2955
  idPlan: planId,
@@ -2117,6 +2962,7 @@ var PracticeService = /*#__PURE__*/function () {
2117
2962
  }
2118
2963
  });
2119
2964
  };
2965
+
2120
2966
  _proto.practiceGetPaymentsIntent = function practiceGetPaymentsIntent(practiceUuid, paymentIntentId) {
2121
2967
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/" + paymentIntentId);
2122
2968
  }
@@ -2129,7 +2975,9 @@ var PracticeService = /*#__PURE__*/function () {
2129
2975
  * @param promotionCode (optional) promotional code to apply
2130
2976
  * @param finalize (optional) if true will finalize the PracticePaymentIntent and related Stripe.Invoice. Once, finalized you cannot modify the PracticePaymentIntent anymore.
2131
2977
  * @returns the updated PracticePaymentIntent
2132
- */;
2978
+ */
2979
+ ;
2980
+
2133
2981
  _proto.practiceUpdatePaymentsIntent = function practiceUpdatePaymentsIntent(practiceUuid, idPraticePaymentIntent, practicePaymentIntent, userEmail, promotionCode, finalize) {
2134
2982
  return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/" + idPraticePaymentIntent, _extends({}, practicePaymentIntent, {
2135
2983
  hashUserEmail: userEmail ? this.getPaymentIntentHashedEmail(userEmail) : undefined
@@ -2144,103 +2992,125 @@ var PracticeService = /*#__PURE__*/function () {
2144
2992
  * Invoice
2145
2993
  * @param practiceUuid UUID of the practice to get the invoice from
2146
2994
  * @param invoiceId ID of the invoice in stripe
2147
- */;
2995
+ */
2996
+ ;
2997
+
2148
2998
  _proto.getInvoice = function getInvoice(practiceUuid, invoiceId) {
2149
2999
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/invoices/" + invoiceId);
2150
- }
2151
- // Practitioner
3000
+ } // Practitioner
2152
3001
  ;
3002
+
2153
3003
  _proto.practiceGetPractitioners = function practiceGetPractitioners(practiceUuid) {
2154
3004
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners");
2155
3005
  };
3006
+
2156
3007
  _proto.practiceUpdatePractitioner = function practiceUpdatePractitioner(practiceUuid, practitionerUuid, requestBody) {
2157
3008
  return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid, requestBody);
2158
3009
  };
3010
+
2159
3011
  _proto.practiceGetPractitioner = function practiceGetPractitioner(practiceUuid, practitionerUuid) {
2160
3012
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid);
2161
- }
2162
- // Practitioner Licenses
3013
+ } // Practitioner Licenses
2163
3014
  ;
3015
+
2164
3016
  _proto.practiceGetPractitionerLicenses = function practiceGetPractitionerLicenses(practiceUuid, practitionerUuid) {
2165
3017
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses");
2166
3018
  };
3019
+
2167
3020
  _proto.practiceCreatePractitionerLicense = function practiceCreatePractitionerLicense(practiceUuid, practitionerUuid, requestBody) {
2168
3021
  return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses", requestBody);
2169
3022
  };
3023
+
2170
3024
  _proto.practiceUpdatePractitionerLicense = function practiceUpdatePractitionerLicense(practiceUuid, practitionerUuid, licenseId, requestBody) {
2171
3025
  return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses/" + licenseId, requestBody);
2172
3026
  };
3027
+
2173
3028
  _proto.practiceGetPractitionerLicense = function practiceGetPractitionerLicense(practiceUuid, practitionerUuid, licenseId) {
2174
3029
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses/" + licenseId);
2175
- }
2176
- // Practitioner Preferences
3030
+ } // Practitioner Preferences
2177
3031
  ;
3032
+
2178
3033
  _proto.practiceGetPractitionerPreferences = function practiceGetPractitionerPreferences(practiceUuid, practitionerUuid) {
2179
3034
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences");
2180
3035
  };
3036
+
2181
3037
  _proto.practiceCreatePractitionerPreference = function practiceCreatePractitionerPreference(practiceUuid, practitionerUuid, requestBody) {
2182
3038
  return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences", requestBody);
2183
3039
  };
3040
+
2184
3041
  _proto.practiceUpdatePractitionerPreference = function practiceUpdatePractitionerPreference(practiceUuid, practitionerUuid, preferenceId, requestBody) {
2185
3042
  return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences/" + preferenceId, requestBody);
2186
3043
  };
3044
+
2187
3045
  _proto.practiceGetPractitionerPreference = function practiceGetPractitionerPreference(practiceUuid, practitionerUuid, preferenceId) {
2188
3046
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences/" + preferenceId);
2189
- }
2190
- // Practitioner Roles
3047
+ } // Practitioner Roles
2191
3048
  ;
3049
+
2192
3050
  _proto.practiceGetPractitionerRoles = function practiceGetPractitionerRoles(practiceUuid, practitionerUuid) {
2193
3051
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles");
2194
3052
  };
3053
+
2195
3054
  _proto.practiceCreatePractitionerRole = function practiceCreatePractitionerRole(practiceUuid, practitionerUuid, requestBody) {
2196
3055
  return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles", requestBody);
2197
3056
  };
3057
+
2198
3058
  _proto.practiceDeletePractitionerRoles = function practiceDeletePractitionerRoles(practiceUuid, practitionerUuid) {
2199
3059
  return this.api.deleteRequest(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles");
2200
3060
  };
3061
+
2201
3062
  _proto.practiceUpdatePractitionerRole = function practiceUpdatePractitionerRole(practiceUuid, practitionerUuid, roleId, requestBody) {
2202
3063
  return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId, requestBody);
2203
3064
  };
3065
+
2204
3066
  _proto.practiceGetPractitionerRole = function practiceGetPractitionerRole(practiceUuid, practitionerUuid, roleId) {
2205
3067
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId);
2206
3068
  };
3069
+
2207
3070
  _proto.practiceDeletePractitionerRole = function practiceDeletePractitionerRole(practiceUuid, practitionerUuid, roleId) {
2208
3071
  return this.api.deleteRequest(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId);
2209
- }
2210
- // Practitioner signature
3072
+ } // Practitioner signature
3073
+
2211
3074
  /**
2212
3075
  * This function returns the practitioner's signature as a Blob
2213
3076
  * @param practiceUuid the practice uuid of the practitioner
2214
3077
  * @param practitionerUuid the practitioner uuid
2215
3078
  * @returns a blob representing the signature
2216
- */;
3079
+ */
3080
+ ;
3081
+
2217
3082
  _proto.practiceGetPractitionerSignature = function practiceGetPractitionerSignature(practiceUuid, practitionerUuid) {
2218
3083
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/signature", {
2219
3084
  responseType: 'blob'
2220
3085
  });
2221
- }
2222
- // Assignments
3086
+ } // Assignments
2223
3087
  ;
3088
+
2224
3089
  _proto.practiceGetAssignments = function practiceGetAssignments(practiceUuid) {
2225
3090
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments");
2226
3091
  };
3092
+
2227
3093
  _proto.practiceCreateAssignment = function practiceCreateAssignment(practiceUuid, requestBody) {
2228
3094
  return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments", requestBody);
2229
3095
  };
3096
+
2230
3097
  _proto.practiceUpdateAssignment = function practiceUpdateAssignment(practiceUuid, assignmentId, requestBody) {
2231
3098
  return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments/" + assignmentId, requestBody);
2232
3099
  };
3100
+
2233
3101
  _proto.practiceGetAssignment = function practiceGetAssignment(practiceUuid, assignmentId) {
2234
3102
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments/" + assignmentId);
2235
- }
2236
- // Quotas
3103
+ } // Quotas
2237
3104
  ;
3105
+
2238
3106
  _proto.practiceGetQuotas = function practiceGetQuotas(practiceUuid) {
2239
3107
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/quotas");
2240
3108
  };
3109
+
2241
3110
  _proto.practiceGetQuota = function practiceGetQuota(practiceUuid, quotaId) {
2242
3111
  return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/quotas/" + quotaId);
2243
3112
  };
3113
+
2244
3114
  return PracticeService;
2245
3115
  }();
2246
3116
 
@@ -2249,35 +3119,44 @@ var TellerService = /*#__PURE__*/function () {
2249
3119
  this.api = api;
2250
3120
  this.baseURL = baseURL;
2251
3121
  }
3122
+
2252
3123
  var _proto = TellerService.prototype;
3124
+
2253
3125
  _proto.lockboxDataStore = /*#__PURE__*/function () {
2254
- var _lockboxDataStore = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(lockboxUuid, req, lockboxOwnerUuid, previousDataUuid, options) {
2255
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2256
- while (1) switch (_context.prev = _context.next) {
2257
- case 0:
2258
- if (options === void 0) {
2259
- options = {
2260
- updateMedicalStatus: true
2261
- };
2262
- }
2263
- return _context.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data", req, {
2264
- params: {
2265
- lockbox_owner_uuid: lockboxOwnerUuid,
2266
- data_uuid: previousDataUuid,
2267
- update_medical_status: options.updateMedicalStatus
3126
+ var _lockboxDataStore = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(lockboxUuid, req, lockboxOwnerUuid, previousDataUuid, options) {
3127
+ return runtime_1.wrap(function _callee$(_context) {
3128
+ while (1) {
3129
+ switch (_context.prev = _context.next) {
3130
+ case 0:
3131
+ if (options === void 0) {
3132
+ options = {
3133
+ updateMedicalStatus: true
3134
+ };
2268
3135
  }
2269
- }));
2270
- case 2:
2271
- case "end":
2272
- return _context.stop();
3136
+
3137
+ return _context.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data", req, {
3138
+ params: {
3139
+ lockbox_owner_uuid: lockboxOwnerUuid,
3140
+ data_uuid: previousDataUuid,
3141
+ update_medical_status: options.updateMedicalStatus
3142
+ }
3143
+ }));
3144
+
3145
+ case 2:
3146
+ case "end":
3147
+ return _context.stop();
3148
+ }
2273
3149
  }
2274
3150
  }, _callee, this);
2275
3151
  }));
3152
+
2276
3153
  function lockboxDataStore(_x, _x2, _x3, _x4, _x5) {
2277
3154
  return _lockboxDataStore.apply(this, arguments);
2278
3155
  }
3156
+
2279
3157
  return lockboxDataStore;
2280
3158
  }();
3159
+
2281
3160
  _proto.updateConsultByUUID = function updateConsultByUUID(patientUuid, uuidConsult, statusMedical, closedReasonType, closedReasonDescription, neverExpires) {
2282
3161
  return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult, {
2283
3162
  patientUuid: patientUuid,
@@ -2295,7 +3174,9 @@ var TellerService = /*#__PURE__*/function () {
2295
3174
  * @param consultationShortId the consultation short id
2296
3175
  * @param fax the address where to send the fax
2297
3176
  * @returns void
2298
- */;
3177
+ */
3178
+ ;
3179
+
2299
3180
  _proto.notifyFaxFailed = function notifyFaxFailed(practiceUuid, consultationUuid, consultationShortId, fax) {
2300
3181
  return this.api.post(this.baseURL + "/v1/fax-failed", {
2301
3182
  consultationUuid: consultationUuid,
@@ -2312,7 +3193,9 @@ var TellerService = /*#__PURE__*/function () {
2312
3193
  * @todo - Make service only exposed route
2313
3194
  * @param uuidConsult the uuid of the consult to reassign
2314
3195
  * @param newPractitionerUuid the uuid of the practitioner that will get reassigned
2315
- */;
3196
+ */
3197
+ ;
3198
+
2316
3199
  _proto.reassignmentEmail = function reassignmentEmail(uuidConsult, newPractitionerUuid) {
2317
3200
  return this.api.post(this.baseURL + "/v1/consult/" + uuidConsult + "/reassignment-email", {
2318
3201
  newPractitionerUuid: newPractitionerUuid
@@ -2324,7 +3207,9 @@ var TellerService = /*#__PURE__*/function () {
2324
3207
  * @param consult
2325
3208
  * @param patientUuid
2326
3209
  * @returns void
2327
- */;
3210
+ */
3211
+ ;
3212
+
2328
3213
  _proto.sendOnlineFaxSuccessfulEmail = function sendOnlineFaxSuccessfulEmail(consult, patientUuid) {
2329
3214
  return this.api.post(this.baseURL + "/v1/online-fax-notify", {
2330
3215
  consult: consult,
@@ -2335,10 +3220,13 @@ var TellerService = /*#__PURE__*/function () {
2335
3220
  * This function will send an email to patient to allow them to resume the consult.
2336
3221
  * @param req the body of the resume consult request
2337
3222
  * @returns void
2338
- */;
3223
+ */
3224
+ ;
3225
+
2339
3226
  _proto.sendResumeConsultEmail = function sendResumeConsultEmail(req) {
2340
3227
  return this.api.post(this.baseURL + "/v1/resume-consult-email", req);
2341
3228
  };
3229
+
2342
3230
  return TellerService;
2343
3231
  }();
2344
3232
 
@@ -2347,85 +3235,110 @@ var VaultService = /*#__PURE__*/function () {
2347
3235
  this.api = api;
2348
3236
  this.baseURL = baseURL;
2349
3237
  }
3238
+
2350
3239
  var _proto = VaultService.prototype;
3240
+
2351
3241
  _proto.lockboxCreate = /*#__PURE__*/function () {
2352
- var _lockboxCreate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(lockboxMetadata) {
2353
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2354
- while (1) switch (_context.prev = _context.next) {
2355
- case 0:
2356
- return _context.abrupt("return", this.api.post(this.baseURL + "/v1/lockbox", lockboxMetadata));
2357
- case 1:
2358
- case "end":
2359
- return _context.stop();
3242
+ var _lockboxCreate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(lockboxMetadata) {
3243
+ return runtime_1.wrap(function _callee$(_context) {
3244
+ while (1) {
3245
+ switch (_context.prev = _context.next) {
3246
+ case 0:
3247
+ return _context.abrupt("return", this.api.post(this.baseURL + "/v1/lockbox", lockboxMetadata));
3248
+
3249
+ case 1:
3250
+ case "end":
3251
+ return _context.stop();
3252
+ }
2360
3253
  }
2361
3254
  }, _callee, this);
2362
3255
  }));
3256
+
2363
3257
  function lockboxCreate(_x) {
2364
3258
  return _lockboxCreate.apply(this, arguments);
2365
3259
  }
3260
+
2366
3261
  return lockboxCreate;
2367
3262
  }();
3263
+
2368
3264
  _proto.lockboxMetadataAdd = /*#__PURE__*/function () {
2369
- var _lockboxMetadataAdd = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(lockboxUuid, lockboxMetadata, lockboxOwnerUuid) {
2370
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2371
- while (1) switch (_context2.prev = _context2.next) {
2372
- case 0:
2373
- return _context2.abrupt("return", this.api.put(this.baseURL + "/v1/lockbox/" + lockboxUuid, lockboxMetadata, {
2374
- params: {
2375
- lockbox_owner_uuid: lockboxOwnerUuid
2376
- }
2377
- }));
2378
- case 1:
2379
- case "end":
2380
- return _context2.stop();
3265
+ var _lockboxMetadataAdd = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(lockboxUuid, lockboxMetadata, lockboxOwnerUuid) {
3266
+ return runtime_1.wrap(function _callee2$(_context2) {
3267
+ while (1) {
3268
+ switch (_context2.prev = _context2.next) {
3269
+ case 0:
3270
+ return _context2.abrupt("return", this.api.put(this.baseURL + "/v1/lockbox/" + lockboxUuid, lockboxMetadata, {
3271
+ params: {
3272
+ lockbox_owner_uuid: lockboxOwnerUuid
3273
+ }
3274
+ }));
3275
+
3276
+ case 1:
3277
+ case "end":
3278
+ return _context2.stop();
3279
+ }
2381
3280
  }
2382
3281
  }, _callee2, this);
2383
3282
  }));
3283
+
2384
3284
  function lockboxMetadataAdd(_x2, _x3, _x4) {
2385
3285
  return _lockboxMetadataAdd.apply(this, arguments);
2386
3286
  }
3287
+
2387
3288
  return lockboxMetadataAdd;
2388
3289
  }();
3290
+
2389
3291
  _proto.lockboxSecretGet = /*#__PURE__*/function () {
2390
- var _lockboxSecretGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(lockboxUuid, lockboxOwnerUuid) {
2391
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2392
- while (1) switch (_context3.prev = _context3.next) {
2393
- case 0:
2394
- return _context3.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/secret", {
2395
- params: {
2396
- lockbox_owner_uuid: lockboxOwnerUuid
2397
- }
2398
- }));
2399
- case 1:
2400
- case "end":
2401
- return _context3.stop();
3292
+ var _lockboxSecretGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(lockboxUuid, lockboxOwnerUuid) {
3293
+ return runtime_1.wrap(function _callee3$(_context3) {
3294
+ while (1) {
3295
+ switch (_context3.prev = _context3.next) {
3296
+ case 0:
3297
+ return _context3.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/secret", {
3298
+ params: {
3299
+ lockbox_owner_uuid: lockboxOwnerUuid
3300
+ }
3301
+ }));
3302
+
3303
+ case 1:
3304
+ case "end":
3305
+ return _context3.stop();
3306
+ }
2402
3307
  }
2403
3308
  }, _callee3, this);
2404
3309
  }));
3310
+
2405
3311
  function lockboxSecretGet(_x5, _x6) {
2406
3312
  return _lockboxSecretGet.apply(this, arguments);
2407
3313
  }
3314
+
2408
3315
  return lockboxSecretGet;
2409
3316
  }();
3317
+
2410
3318
  _proto.lockboxGrant = /*#__PURE__*/function () {
2411
- var _lockboxGrant = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(lockboxUuid, req, lockboxOwnerUuid) {
2412
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
2413
- while (1) switch (_context4.prev = _context4.next) {
2414
- case 0:
2415
- return _context4.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/grant", req, {
2416
- params: {
2417
- lockbox_owner_uuid: lockboxOwnerUuid
2418
- }
2419
- }));
2420
- case 1:
2421
- case "end":
2422
- return _context4.stop();
3319
+ var _lockboxGrant = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(lockboxUuid, req, lockboxOwnerUuid) {
3320
+ return runtime_1.wrap(function _callee4$(_context4) {
3321
+ while (1) {
3322
+ switch (_context4.prev = _context4.next) {
3323
+ case 0:
3324
+ return _context4.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/grant", req, {
3325
+ params: {
3326
+ lockbox_owner_uuid: lockboxOwnerUuid
3327
+ }
3328
+ }));
3329
+
3330
+ case 1:
3331
+ case "end":
3332
+ return _context4.stop();
3333
+ }
2423
3334
  }
2424
3335
  }, _callee4, this);
2425
3336
  }));
3337
+
2426
3338
  function lockboxGrant(_x7, _x8, _x9) {
2427
3339
  return _lockboxGrant.apply(this, arguments);
2428
3340
  }
3341
+
2429
3342
  return lockboxGrant;
2430
3343
  }()
2431
3344
  /**
@@ -2434,23 +3347,29 @@ var VaultService = /*#__PURE__*/function () {
2434
3347
  * @returns decrypted lockboxes granted to user
2435
3348
  */
2436
3349
  ;
3350
+
2437
3351
  _proto.grantsGet =
2438
3352
  /*#__PURE__*/
2439
3353
  function () {
2440
- var _grantsGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
2441
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
2442
- while (1) switch (_context5.prev = _context5.next) {
2443
- case 0:
2444
- return _context5.abrupt("return", this.api.get(this.baseURL + "/v1/grants"));
2445
- case 1:
2446
- case "end":
2447
- return _context5.stop();
3354
+ var _grantsGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
3355
+ return runtime_1.wrap(function _callee5$(_context5) {
3356
+ while (1) {
3357
+ switch (_context5.prev = _context5.next) {
3358
+ case 0:
3359
+ return _context5.abrupt("return", this.api.get(this.baseURL + "/v1/grants"));
3360
+
3361
+ case 1:
3362
+ case "end":
3363
+ return _context5.stop();
3364
+ }
2448
3365
  }
2449
3366
  }, _callee5, this);
2450
3367
  }));
3368
+
2451
3369
  function grantsGet() {
2452
3370
  return _grantsGet.apply(this, arguments);
2453
3371
  }
3372
+
2454
3373
  return grantsGet;
2455
3374
  }()
2456
3375
  /**
@@ -2464,112 +3383,141 @@ var VaultService = /*#__PURE__*/function () {
2464
3383
  * @returns
2465
3384
  */
2466
3385
  ;
3386
+
2467
3387
  _proto.lockboxDataStore =
2468
3388
  /*#__PURE__*/
2469
3389
  function () {
2470
- var _lockboxDataStore = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(lockboxUuid, req, lockboxOwnerUuid, previousDataUuid) {
2471
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
2472
- while (1) switch (_context6.prev = _context6.next) {
2473
- case 0:
2474
- return _context6.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data", req, {
2475
- params: {
2476
- lockbox_owner_uuid: lockboxOwnerUuid,
2477
- data_uuid: previousDataUuid
2478
- }
2479
- }));
2480
- case 1:
2481
- case "end":
2482
- return _context6.stop();
3390
+ var _lockboxDataStore = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(lockboxUuid, req, lockboxOwnerUuid, previousDataUuid) {
3391
+ return runtime_1.wrap(function _callee6$(_context6) {
3392
+ while (1) {
3393
+ switch (_context6.prev = _context6.next) {
3394
+ case 0:
3395
+ return _context6.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data", req, {
3396
+ params: {
3397
+ lockbox_owner_uuid: lockboxOwnerUuid,
3398
+ data_uuid: previousDataUuid
3399
+ }
3400
+ }));
3401
+
3402
+ case 1:
3403
+ case "end":
3404
+ return _context6.stop();
3405
+ }
2483
3406
  }
2484
3407
  }, _callee6, this);
2485
3408
  }));
3409
+
2486
3410
  function lockboxDataStore(_x10, _x11, _x12, _x13) {
2487
3411
  return _lockboxDataStore.apply(this, arguments);
2488
3412
  }
3413
+
2489
3414
  return lockboxDataStore;
2490
3415
  }();
3416
+
2491
3417
  _proto.lockboxDataGet = /*#__PURE__*/function () {
2492
- var _lockboxDataGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(lockboxUuid, dataUuid, lockboxOwnerUuid, stream) {
3418
+ var _lockboxDataGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(lockboxUuid, dataUuid, lockboxOwnerUuid, stream) {
2493
3419
  var data;
2494
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
2495
- while (1) switch (_context7.prev = _context7.next) {
2496
- case 0:
2497
- if (stream === void 0) {
2498
- stream = true;
2499
- }
2500
- _context7.next = 3;
2501
- return this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data/" + dataUuid, {
2502
- params: {
2503
- lockbox_owner_uuid: lockboxOwnerUuid,
2504
- stream: stream
3420
+ return runtime_1.wrap(function _callee7$(_context7) {
3421
+ while (1) {
3422
+ switch (_context7.prev = _context7.next) {
3423
+ case 0:
3424
+ if (stream === void 0) {
3425
+ stream = true;
2505
3426
  }
2506
- });
2507
- case 3:
2508
- data = _context7.sent;
2509
- if (!stream) {
2510
- _context7.next = 6;
2511
- break;
2512
- }
2513
- return _context7.abrupt("return", {
2514
- data: data
2515
- });
2516
- case 6:
2517
- return _context7.abrupt("return", data);
2518
- case 7:
2519
- case "end":
2520
- return _context7.stop();
3427
+
3428
+ _context7.next = 3;
3429
+ return this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data/" + dataUuid, {
3430
+ params: {
3431
+ lockbox_owner_uuid: lockboxOwnerUuid,
3432
+ stream: stream
3433
+ }
3434
+ });
3435
+
3436
+ case 3:
3437
+ data = _context7.sent;
3438
+
3439
+ if (!stream) {
3440
+ _context7.next = 6;
3441
+ break;
3442
+ }
3443
+
3444
+ return _context7.abrupt("return", {
3445
+ data: data
3446
+ });
3447
+
3448
+ case 6:
3449
+ return _context7.abrupt("return", data);
3450
+
3451
+ case 7:
3452
+ case "end":
3453
+ return _context7.stop();
3454
+ }
2521
3455
  }
2522
3456
  }, _callee7, this);
2523
3457
  }));
3458
+
2524
3459
  function lockboxDataGet(_x14, _x15, _x16, _x17) {
2525
3460
  return _lockboxDataGet.apply(this, arguments);
2526
3461
  }
3462
+
2527
3463
  return lockboxDataGet;
2528
3464
  }();
3465
+
2529
3466
  _proto.lockboxManifestGet = /*#__PURE__*/function () {
2530
- var _lockboxManifestGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(lockboxUuid, filter, lockboxOwnerUuid) {
2531
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
2532
- while (1) switch (_context8.prev = _context8.next) {
2533
- case 0:
2534
- return _context8.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid, {
2535
- params: {
2536
- lockbox_owner_uuid: lockboxOwnerUuid,
2537
- filter: filter
2538
- }
2539
- }));
2540
- case 1:
2541
- case "end":
2542
- return _context8.stop();
3467
+ var _lockboxManifestGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(lockboxUuid, filter, lockboxOwnerUuid) {
3468
+ return runtime_1.wrap(function _callee8$(_context8) {
3469
+ while (1) {
3470
+ switch (_context8.prev = _context8.next) {
3471
+ case 0:
3472
+ return _context8.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid, {
3473
+ params: {
3474
+ lockbox_owner_uuid: lockboxOwnerUuid,
3475
+ filter: filter
3476
+ }
3477
+ }));
3478
+
3479
+ case 1:
3480
+ case "end":
3481
+ return _context8.stop();
3482
+ }
2543
3483
  }
2544
3484
  }, _callee8, this);
2545
3485
  }));
3486
+
2546
3487
  function lockboxManifestGet(_x18, _x19, _x20) {
2547
3488
  return _lockboxManifestGet.apply(this, arguments);
2548
3489
  }
3490
+
2549
3491
  return lockboxManifestGet;
2550
3492
  }();
3493
+
2551
3494
  _proto.lockboxMetadataGet = /*#__PURE__*/function () {
2552
- var _lockboxMetadataGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(lockboxUuid, fields, groupby, filter, lockboxOwnerUuid) {
2553
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
2554
- while (1) switch (_context9.prev = _context9.next) {
2555
- case 0:
2556
- return _context9.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/metadata", {
2557
- params: {
2558
- lockbox_owner_uuid: lockboxOwnerUuid,
2559
- fields: fields,
2560
- groupby: groupby,
2561
- filter: filter
2562
- }
2563
- }));
2564
- case 1:
2565
- case "end":
2566
- return _context9.stop();
3495
+ var _lockboxMetadataGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(lockboxUuid, fields, groupby, filter, lockboxOwnerUuid) {
3496
+ return runtime_1.wrap(function _callee9$(_context9) {
3497
+ while (1) {
3498
+ switch (_context9.prev = _context9.next) {
3499
+ case 0:
3500
+ return _context9.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/metadata", {
3501
+ params: {
3502
+ lockbox_owner_uuid: lockboxOwnerUuid,
3503
+ fields: fields,
3504
+ groupby: groupby,
3505
+ filter: filter
3506
+ }
3507
+ }));
3508
+
3509
+ case 1:
3510
+ case "end":
3511
+ return _context9.stop();
3512
+ }
2567
3513
  }
2568
3514
  }, _callee9, this);
2569
3515
  }));
3516
+
2570
3517
  function lockboxMetadataGet(_x21, _x22, _x23, _x24, _x25) {
2571
3518
  return _lockboxMetadataGet.apply(this, arguments);
2572
3519
  }
3520
+
2573
3521
  return lockboxMetadataGet;
2574
3522
  }()
2575
3523
  /**
@@ -2580,27 +3528,33 @@ var VaultService = /*#__PURE__*/function () {
2580
3528
  * @param indexOwnerUuid
2581
3529
  */
2582
3530
  ;
3531
+
2583
3532
  _proto.vaultIndexPut =
2584
3533
  /*#__PURE__*/
2585
3534
  function () {
2586
- var _vaultIndexPut = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(entries, indexOwnerUuid) {
2587
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
2588
- while (1) switch (_context10.prev = _context10.next) {
2589
- case 0:
2590
- return _context10.abrupt("return", this.api.put(this.baseURL + "/v1/index", entries, {
2591
- params: {
2592
- index_owner_uuid: indexOwnerUuid
2593
- }
2594
- }));
2595
- case 1:
2596
- case "end":
2597
- return _context10.stop();
3535
+ var _vaultIndexPut = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(entries, indexOwnerUuid) {
3536
+ return runtime_1.wrap(function _callee10$(_context10) {
3537
+ while (1) {
3538
+ switch (_context10.prev = _context10.next) {
3539
+ case 0:
3540
+ return _context10.abrupt("return", this.api.put(this.baseURL + "/v1/index", entries, {
3541
+ params: {
3542
+ index_owner_uuid: indexOwnerUuid
3543
+ }
3544
+ }));
3545
+
3546
+ case 1:
3547
+ case "end":
3548
+ return _context10.stop();
3549
+ }
2598
3550
  }
2599
3551
  }, _callee10, this);
2600
3552
  }));
3553
+
2601
3554
  function vaultIndexPut(_x26, _x27) {
2602
3555
  return _vaultIndexPut.apply(this, arguments);
2603
3556
  }
3557
+
2604
3558
  return vaultIndexPut;
2605
3559
  }()
2606
3560
  /**
@@ -2609,23 +3563,29 @@ var VaultService = /*#__PURE__*/function () {
2609
3563
  * @param entry the encrypted index snapshot
2610
3564
  */
2611
3565
  ;
3566
+
2612
3567
  _proto.vaultIndexSnapshotPut =
2613
3568
  /*#__PURE__*/
2614
3569
  function () {
2615
- var _vaultIndexSnapshotPut = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(entry) {
2616
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
2617
- while (1) switch (_context11.prev = _context11.next) {
2618
- case 0:
2619
- return _context11.abrupt("return", this.api.put(this.baseURL + "/v1/index-snapshot", entry));
2620
- case 1:
2621
- case "end":
2622
- return _context11.stop();
3570
+ var _vaultIndexSnapshotPut = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(entry) {
3571
+ return runtime_1.wrap(function _callee11$(_context11) {
3572
+ while (1) {
3573
+ switch (_context11.prev = _context11.next) {
3574
+ case 0:
3575
+ return _context11.abrupt("return", this.api.put(this.baseURL + "/v1/index-snapshot", entry));
3576
+
3577
+ case 1:
3578
+ case "end":
3579
+ return _context11.stop();
3580
+ }
2623
3581
  }
2624
3582
  }, _callee11, this);
2625
3583
  }));
3584
+
2626
3585
  function vaultIndexSnapshotPut(_x28) {
2627
3586
  return _vaultIndexSnapshotPut.apply(this, arguments);
2628
3587
  }
3588
+
2629
3589
  return vaultIndexSnapshotPut;
2630
3590
  }()
2631
3591
  /**
@@ -2637,31 +3597,38 @@ var VaultService = /*#__PURE__*/function () {
2637
3597
  * @returns the encrypted index
2638
3598
  */
2639
3599
  ;
3600
+
2640
3601
  _proto.vaultIndexGet =
2641
3602
  /*#__PURE__*/
2642
3603
  function () {
2643
- var _vaultIndexGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(indexKeys, identifiers, timestamp) {
2644
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
2645
- while (1) switch (_context12.prev = _context12.next) {
2646
- case 0:
2647
- return _context12.abrupt("return", this.api.get(this.baseURL + "/v1/index", {
2648
- params: {
2649
- index_keys: indexKeys,
2650
- identifiers: identifiers,
2651
- timestamp: timestamp
2652
- }
2653
- }));
2654
- case 1:
2655
- case "end":
2656
- return _context12.stop();
3604
+ var _vaultIndexGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(indexKeys, identifiers, timestamp) {
3605
+ return runtime_1.wrap(function _callee12$(_context12) {
3606
+ while (1) {
3607
+ switch (_context12.prev = _context12.next) {
3608
+ case 0:
3609
+ return _context12.abrupt("return", this.api.get(this.baseURL + "/v1/index", {
3610
+ params: {
3611
+ index_keys: indexKeys,
3612
+ identifiers: identifiers,
3613
+ timestamp: timestamp
3614
+ }
3615
+ }));
3616
+
3617
+ case 1:
3618
+ case "end":
3619
+ return _context12.stop();
3620
+ }
2657
3621
  }
2658
3622
  }, _callee12, this);
2659
3623
  }));
3624
+
2660
3625
  function vaultIndexGet(_x29, _x30, _x31) {
2661
3626
  return _vaultIndexGet.apply(this, arguments);
2662
3627
  }
3628
+
2663
3629
  return vaultIndexGet;
2664
3630
  }();
3631
+
2665
3632
  return VaultService;
2666
3633
  }();
2667
3634
 
@@ -2674,7 +3641,10 @@ var WorkflowService = /*#__PURE__*/function () {
2674
3641
  * This function returns all workflows
2675
3642
  * @returns desired workflow
2676
3643
  */
3644
+
3645
+
2677
3646
  var _proto = WorkflowService.prototype;
3647
+
2678
3648
  _proto.getWorkflows = function getWorkflows() {
2679
3649
  return this.api.get(this.v1Url + "/workflows");
2680
3650
  }
@@ -2685,7 +3655,9 @@ var WorkflowService = /*#__PURE__*/function () {
2685
3655
  * @param locale (optional) The desired locale of the workflow (default: 'en')
2686
3656
  * @param createdAt (optional) The creation date of the workflow (also used for versionning)
2687
3657
  * @returns desired workflow
2688
- */;
3658
+ */
3659
+ ;
3660
+
2689
3661
  _proto.getWorkflow = function getWorkflow(id, locale, createdAt) {
2690
3662
  return this.api.get(this.v1Url + "/workflows/" + id, {
2691
3663
  params: {
@@ -2694,6 +3666,7 @@ var WorkflowService = /*#__PURE__*/function () {
2694
3666
  }
2695
3667
  });
2696
3668
  };
3669
+
2697
3670
  return WorkflowService;
2698
3671
  }();
2699
3672
 
@@ -2704,18 +3677,20 @@ var WorkflowService = /*#__PURE__*/function () {
2704
3677
  * @param useLocalStorage (default: true) if true store tokens into local storage (only for browsers)
2705
3678
  * @returns an instance of each services with a provided url
2706
3679
  */
3680
+
2707
3681
  var init = function init(services, authenticationCallback, useLocalStorage) {
2708
3682
  if (useLocalStorage === void 0) {
2709
3683
  useLocalStorage = true;
2710
3684
  }
3685
+
2711
3686
  var tellerBaseURL = services.tellerBaseURL,
2712
- practiceBaseURL = services.practiceBaseURL,
2713
- consultBaseURL = services.consultBaseURL,
2714
- vaultBaseURL = services.vaultBaseURL,
2715
- guardBaseURL = services.guardBaseURL,
2716
- searchBaseURL = services.searchBaseURL,
2717
- workflowBaseURL = services.workflowBaseURL,
2718
- diagnosisBaseURL = services.diagnosisBaseURL;
3687
+ practiceBaseURL = services.practiceBaseURL,
3688
+ consultBaseURL = services.consultBaseURL,
3689
+ vaultBaseURL = services.vaultBaseURL,
3690
+ guardBaseURL = services.guardBaseURL,
3691
+ searchBaseURL = services.searchBaseURL,
3692
+ workflowBaseURL = services.workflowBaseURL,
3693
+ diagnosisBaseURL = services.diagnosisBaseURL;
2719
3694
  var apiService = new APIService(useLocalStorage, undefined, authenticationCallback);
2720
3695
  return {
2721
3696
  apiService: apiService,