oro-sdk-apis 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -0
  3. package/dist/index.d.ts +27 -0
  4. package/dist/index.js +8 -0
  5. package/dist/models/consult.d.ts +102 -0
  6. package/dist/models/diagnosis.d.ts +122 -0
  7. package/dist/models/error.d.ts +12 -0
  8. package/dist/models/guard.d.ts +119 -0
  9. package/dist/models/index.d.ts +8 -0
  10. package/dist/models/practice.d.ts +353 -0
  11. package/dist/models/shared.d.ts +8 -0
  12. package/dist/models/vault.d.ts +124 -0
  13. package/dist/models/workflow.d.ts +106 -0
  14. package/dist/oro-sdk-apis.cjs.development.js +3019 -0
  15. package/dist/oro-sdk-apis.cjs.development.js.map +1 -0
  16. package/dist/oro-sdk-apis.cjs.production.min.js +2 -0
  17. package/dist/oro-sdk-apis.cjs.production.min.js.map +1 -0
  18. package/dist/oro-sdk-apis.esm.js +3051 -0
  19. package/dist/oro-sdk-apis.esm.js.map +1 -0
  20. package/dist/services/api.d.ts +11 -0
  21. package/dist/services/axios.d.ts +14 -0
  22. package/dist/services/consult.d.ts +54 -0
  23. package/dist/services/diagnosis.d.ts +44 -0
  24. package/dist/services/guard.d.ts +92 -0
  25. package/dist/services/index.d.ts +9 -0
  26. package/dist/services/practice.d.ts +98 -0
  27. package/dist/services/teller.d.ts +9 -0
  28. package/dist/services/vault.d.ts +54 -0
  29. package/dist/services/workflow.d.ts +21 -0
  30. package/package.json +62 -0
  31. package/src/index.ts +56 -0
  32. package/src/models/consult.ts +110 -0
  33. package/src/models/diagnosis.ts +141 -0
  34. package/src/models/error.ts +6 -0
  35. package/src/models/guard.ts +136 -0
  36. package/src/models/index.ts +8 -0
  37. package/src/models/practice.ts +411 -0
  38. package/src/models/shared.ts +6 -0
  39. package/src/models/vault.ts +158 -0
  40. package/src/models/workflow.ts +142 -0
  41. package/src/services/api.ts +77 -0
  42. package/src/services/axios.ts +91 -0
  43. package/src/services/consult.ts +264 -0
  44. package/src/services/diagnosis.ts +144 -0
  45. package/src/services/guard.ts +228 -0
  46. package/src/services/index.ts +9 -0
  47. package/src/services/practice.ts +430 -0
  48. package/src/services/teller.ts +39 -0
  49. package/src/services/vault.ts +178 -0
  50. package/src/services/workflow.ts +36 -0
@@ -0,0 +1,3051 @@
1
+ import createAuthRefreshInterceptor from 'axios-auth-refresh';
2
+ import axios from 'axios';
3
+ import { Buffer } from 'buffer/';
4
+ import { sha256 } from 'hash.js';
5
+
6
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
7
+ try {
8
+ var info = gen[key](arg);
9
+ var value = info.value;
10
+ } catch (error) {
11
+ reject(error);
12
+ return;
13
+ }
14
+
15
+ if (info.done) {
16
+ resolve(value);
17
+ } else {
18
+ Promise.resolve(value).then(_next, _throw);
19
+ }
20
+ }
21
+
22
+ function _asyncToGenerator(fn) {
23
+ return function () {
24
+ var self = this,
25
+ args = arguments;
26
+ return new Promise(function (resolve, reject) {
27
+ var gen = fn.apply(self, args);
28
+
29
+ function _next(value) {
30
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
31
+ }
32
+
33
+ function _throw(err) {
34
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
35
+ }
36
+
37
+ _next(undefined);
38
+ });
39
+ };
40
+ }
41
+
42
+ function _extends() {
43
+ _extends = Object.assign || function (target) {
44
+ for (var i = 1; i < arguments.length; i++) {
45
+ var source = arguments[i];
46
+
47
+ for (var key in source) {
48
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
49
+ target[key] = source[key];
50
+ }
51
+ }
52
+ }
53
+
54
+ return target;
55
+ };
56
+
57
+ return _extends.apply(this, arguments);
58
+ }
59
+
60
+ function _inheritsLoose(subClass, superClass) {
61
+ subClass.prototype = Object.create(superClass.prototype);
62
+ subClass.prototype.constructor = subClass;
63
+
64
+ _setPrototypeOf(subClass, superClass);
65
+ }
66
+
67
+ function _getPrototypeOf(o) {
68
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
69
+ return o.__proto__ || Object.getPrototypeOf(o);
70
+ };
71
+ return _getPrototypeOf(o);
72
+ }
73
+
74
+ function _setPrototypeOf(o, p) {
75
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
76
+ o.__proto__ = p;
77
+ return o;
78
+ };
79
+
80
+ return _setPrototypeOf(o, p);
81
+ }
82
+
83
+ function _isNativeReflectConstruct() {
84
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
85
+ if (Reflect.construct.sham) return false;
86
+ if (typeof Proxy === "function") return true;
87
+
88
+ try {
89
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
90
+ return true;
91
+ } catch (e) {
92
+ return false;
93
+ }
94
+ }
95
+
96
+ function _construct(Parent, args, Class) {
97
+ if (_isNativeReflectConstruct()) {
98
+ _construct = Reflect.construct;
99
+ } else {
100
+ _construct = function _construct(Parent, args, Class) {
101
+ var a = [null];
102
+ a.push.apply(a, args);
103
+ var Constructor = Function.bind.apply(Parent, a);
104
+ var instance = new Constructor();
105
+ if (Class) _setPrototypeOf(instance, Class.prototype);
106
+ return instance;
107
+ };
108
+ }
109
+
110
+ return _construct.apply(null, arguments);
111
+ }
112
+
113
+ function _isNativeFunction(fn) {
114
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
115
+ }
116
+
117
+ function _wrapNativeSuper(Class) {
118
+ var _cache = typeof Map === "function" ? new Map() : undefined;
119
+
120
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
121
+ if (Class === null || !_isNativeFunction(Class)) return Class;
122
+
123
+ if (typeof Class !== "function") {
124
+ throw new TypeError("Super expression must either be null or a function");
125
+ }
126
+
127
+ if (typeof _cache !== "undefined") {
128
+ if (_cache.has(Class)) return _cache.get(Class);
129
+
130
+ _cache.set(Class, Wrapper);
131
+ }
132
+
133
+ function Wrapper() {
134
+ return _construct(Class, arguments, _getPrototypeOf(this).constructor);
135
+ }
136
+
137
+ Wrapper.prototype = Object.create(Class.prototype, {
138
+ constructor: {
139
+ value: Wrapper,
140
+ enumerable: false,
141
+ writable: true,
142
+ configurable: true
143
+ }
144
+ });
145
+ return _setPrototypeOf(Wrapper, Class);
146
+ };
147
+
148
+ return _wrapNativeSuper(Class);
149
+ }
150
+
151
+ function _assertThisInitialized(self) {
152
+ if (self === void 0) {
153
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
154
+ }
155
+
156
+ return self;
157
+ }
158
+
159
+ function createCommonjsModule(fn, module) {
160
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
161
+ }
162
+
163
+ var runtime_1 = createCommonjsModule(function (module) {
164
+ /**
165
+ * Copyright (c) 2014-present, Facebook, Inc.
166
+ *
167
+ * This source code is licensed under the MIT license found in the
168
+ * LICENSE file in the root directory of this source tree.
169
+ */
170
+
171
+ var runtime = (function (exports) {
172
+
173
+ var Op = Object.prototype;
174
+ var hasOwn = Op.hasOwnProperty;
175
+ var undefined$1; // More compressible than void 0.
176
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
177
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
178
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
179
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
180
+
181
+ function define(obj, key, value) {
182
+ Object.defineProperty(obj, key, {
183
+ value: value,
184
+ enumerable: true,
185
+ configurable: true,
186
+ writable: true
187
+ });
188
+ return obj[key];
189
+ }
190
+ try {
191
+ // IE 8 has a broken Object.defineProperty that only works on DOM objects.
192
+ define({}, "");
193
+ } catch (err) {
194
+ define = function(obj, key, value) {
195
+ return obj[key] = value;
196
+ };
197
+ }
198
+
199
+ function wrap(innerFn, outerFn, self, tryLocsList) {
200
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
201
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
202
+ var generator = Object.create(protoGenerator.prototype);
203
+ var context = new Context(tryLocsList || []);
204
+
205
+ // The ._invoke method unifies the implementations of the .next,
206
+ // .throw, and .return methods.
207
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
208
+
209
+ return generator;
210
+ }
211
+ exports.wrap = wrap;
212
+
213
+ // Try/catch helper to minimize deoptimizations. Returns a completion
214
+ // record like context.tryEntries[i].completion. This interface could
215
+ // have been (and was previously) designed to take a closure to be
216
+ // invoked without arguments, but in all the cases we care about we
217
+ // already have an existing method we want to call, so there's no need
218
+ // to create a new function object. We can even get away with assuming
219
+ // the method takes exactly one argument, since that happens to be true
220
+ // in every case, so we don't have to touch the arguments object. The
221
+ // only additional allocation required is the completion record, which
222
+ // has a stable shape and so hopefully should be cheap to allocate.
223
+ function tryCatch(fn, obj, arg) {
224
+ try {
225
+ return { type: "normal", arg: fn.call(obj, arg) };
226
+ } catch (err) {
227
+ return { type: "throw", arg: err };
228
+ }
229
+ }
230
+
231
+ var GenStateSuspendedStart = "suspendedStart";
232
+ var GenStateSuspendedYield = "suspendedYield";
233
+ var GenStateExecuting = "executing";
234
+ var GenStateCompleted = "completed";
235
+
236
+ // Returning this object from the innerFn has the same effect as
237
+ // breaking out of the dispatch switch statement.
238
+ var ContinueSentinel = {};
239
+
240
+ // Dummy constructor functions that we use as the .constructor and
241
+ // .constructor.prototype properties for functions that return Generator
242
+ // objects. For full spec compliance, you may wish to configure your
243
+ // minifier not to mangle the names of these two functions.
244
+ function Generator() {}
245
+ function GeneratorFunction() {}
246
+ function GeneratorFunctionPrototype() {}
247
+
248
+ // This is a polyfill for %IteratorPrototype% for environments that
249
+ // don't natively support it.
250
+ var IteratorPrototype = {};
251
+ define(IteratorPrototype, iteratorSymbol, function () {
252
+ return this;
253
+ });
254
+
255
+ var getProto = Object.getPrototypeOf;
256
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
257
+ if (NativeIteratorPrototype &&
258
+ NativeIteratorPrototype !== Op &&
259
+ hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
260
+ // This environment has a native %IteratorPrototype%; use it instead
261
+ // of the polyfill.
262
+ IteratorPrototype = NativeIteratorPrototype;
263
+ }
264
+
265
+ var Gp = GeneratorFunctionPrototype.prototype =
266
+ Generator.prototype = Object.create(IteratorPrototype);
267
+ GeneratorFunction.prototype = GeneratorFunctionPrototype;
268
+ define(Gp, "constructor", GeneratorFunctionPrototype);
269
+ define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
270
+ GeneratorFunction.displayName = define(
271
+ GeneratorFunctionPrototype,
272
+ toStringTagSymbol,
273
+ "GeneratorFunction"
274
+ );
275
+
276
+ // Helper for defining the .next, .throw, and .return methods of the
277
+ // Iterator interface in terms of a single ._invoke method.
278
+ function defineIteratorMethods(prototype) {
279
+ ["next", "throw", "return"].forEach(function(method) {
280
+ define(prototype, method, function(arg) {
281
+ return this._invoke(method, arg);
282
+ });
283
+ });
284
+ }
285
+
286
+ exports.isGeneratorFunction = function(genFun) {
287
+ var ctor = typeof genFun === "function" && genFun.constructor;
288
+ return ctor
289
+ ? ctor === GeneratorFunction ||
290
+ // For the native GeneratorFunction constructor, the best we can
291
+ // do is to check its .name property.
292
+ (ctor.displayName || ctor.name) === "GeneratorFunction"
293
+ : false;
294
+ };
295
+
296
+ exports.mark = function(genFun) {
297
+ if (Object.setPrototypeOf) {
298
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
299
+ } else {
300
+ genFun.__proto__ = GeneratorFunctionPrototype;
301
+ define(genFun, toStringTagSymbol, "GeneratorFunction");
302
+ }
303
+ genFun.prototype = Object.create(Gp);
304
+ return genFun;
305
+ };
306
+
307
+ // Within the body of any async function, `await x` is transformed to
308
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
309
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
310
+ // meant to be awaited.
311
+ exports.awrap = function(arg) {
312
+ return { __await: arg };
313
+ };
314
+
315
+ function AsyncIterator(generator, PromiseImpl) {
316
+ function invoke(method, arg, resolve, reject) {
317
+ var record = tryCatch(generator[method], generator, arg);
318
+ if (record.type === "throw") {
319
+ reject(record.arg);
320
+ } else {
321
+ var result = record.arg;
322
+ var value = result.value;
323
+ if (value &&
324
+ typeof value === "object" &&
325
+ hasOwn.call(value, "__await")) {
326
+ return PromiseImpl.resolve(value.__await).then(function(value) {
327
+ invoke("next", value, resolve, reject);
328
+ }, function(err) {
329
+ invoke("throw", err, resolve, reject);
330
+ });
331
+ }
332
+
333
+ return PromiseImpl.resolve(value).then(function(unwrapped) {
334
+ // When a yielded Promise is resolved, its final value becomes
335
+ // the .value of the Promise<{value,done}> result for the
336
+ // current iteration.
337
+ result.value = unwrapped;
338
+ resolve(result);
339
+ }, function(error) {
340
+ // If a rejected Promise was yielded, throw the rejection back
341
+ // into the async generator function so it can be handled there.
342
+ return invoke("throw", error, resolve, reject);
343
+ });
344
+ }
345
+ }
346
+
347
+ var previousPromise;
348
+
349
+ function enqueue(method, arg) {
350
+ function callInvokeWithMethodAndArg() {
351
+ return new PromiseImpl(function(resolve, reject) {
352
+ invoke(method, arg, resolve, reject);
353
+ });
354
+ }
355
+
356
+ return previousPromise =
357
+ // If enqueue has been called before, then we want to wait until
358
+ // all previous Promises have been resolved before calling invoke,
359
+ // so that results are always delivered in the correct order. If
360
+ // enqueue has not been called before, then it is important to
361
+ // call invoke immediately, without waiting on a callback to fire,
362
+ // so that the async generator function has the opportunity to do
363
+ // any necessary setup in a predictable way. This predictability
364
+ // is why the Promise constructor synchronously invokes its
365
+ // executor callback, and why async functions synchronously
366
+ // execute code before the first await. Since we implement simple
367
+ // async functions in terms of async generators, it is especially
368
+ // important to get this right, even though it requires care.
369
+ previousPromise ? previousPromise.then(
370
+ callInvokeWithMethodAndArg,
371
+ // Avoid propagating failures to Promises returned by later
372
+ // invocations of the iterator.
373
+ callInvokeWithMethodAndArg
374
+ ) : callInvokeWithMethodAndArg();
375
+ }
376
+
377
+ // Define the unified helper method that is used to implement .next,
378
+ // .throw, and .return (see defineIteratorMethods).
379
+ this._invoke = enqueue;
380
+ }
381
+
382
+ defineIteratorMethods(AsyncIterator.prototype);
383
+ define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
384
+ return this;
385
+ });
386
+ exports.AsyncIterator = AsyncIterator;
387
+
388
+ // Note that simple async functions are implemented on top of
389
+ // AsyncIterator objects; they just return a Promise for the value of
390
+ // the final result produced by the iterator.
391
+ exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
392
+ if (PromiseImpl === void 0) PromiseImpl = Promise;
393
+
394
+ var iter = new AsyncIterator(
395
+ wrap(innerFn, outerFn, self, tryLocsList),
396
+ PromiseImpl
397
+ );
398
+
399
+ return exports.isGeneratorFunction(outerFn)
400
+ ? iter // If outerFn is a generator, return the full iterator.
401
+ : iter.next().then(function(result) {
402
+ return result.done ? result.value : iter.next();
403
+ });
404
+ };
405
+
406
+ function makeInvokeMethod(innerFn, self, context) {
407
+ var state = GenStateSuspendedStart;
408
+
409
+ return function invoke(method, arg) {
410
+ if (state === GenStateExecuting) {
411
+ throw new Error("Generator is already running");
412
+ }
413
+
414
+ if (state === GenStateCompleted) {
415
+ if (method === "throw") {
416
+ throw arg;
417
+ }
418
+
419
+ // Be forgiving, per 25.3.3.3.3 of the spec:
420
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
421
+ return doneResult();
422
+ }
423
+
424
+ context.method = method;
425
+ context.arg = arg;
426
+
427
+ while (true) {
428
+ var delegate = context.delegate;
429
+ if (delegate) {
430
+ var delegateResult = maybeInvokeDelegate(delegate, context);
431
+ if (delegateResult) {
432
+ if (delegateResult === ContinueSentinel) continue;
433
+ return delegateResult;
434
+ }
435
+ }
436
+
437
+ if (context.method === "next") {
438
+ // Setting context._sent for legacy support of Babel's
439
+ // function.sent implementation.
440
+ context.sent = context._sent = context.arg;
441
+
442
+ } else if (context.method === "throw") {
443
+ if (state === GenStateSuspendedStart) {
444
+ state = GenStateCompleted;
445
+ throw context.arg;
446
+ }
447
+
448
+ context.dispatchException(context.arg);
449
+
450
+ } else if (context.method === "return") {
451
+ context.abrupt("return", context.arg);
452
+ }
453
+
454
+ state = GenStateExecuting;
455
+
456
+ var record = tryCatch(innerFn, self, context);
457
+ if (record.type === "normal") {
458
+ // If an exception is thrown from innerFn, we leave state ===
459
+ // GenStateExecuting and loop back for another invocation.
460
+ state = context.done
461
+ ? GenStateCompleted
462
+ : GenStateSuspendedYield;
463
+
464
+ if (record.arg === ContinueSentinel) {
465
+ continue;
466
+ }
467
+
468
+ return {
469
+ value: record.arg,
470
+ done: context.done
471
+ };
472
+
473
+ } else if (record.type === "throw") {
474
+ state = GenStateCompleted;
475
+ // Dispatch the exception by looping back around to the
476
+ // context.dispatchException(context.arg) call above.
477
+ context.method = "throw";
478
+ context.arg = record.arg;
479
+ }
480
+ }
481
+ };
482
+ }
483
+
484
+ // Call delegate.iterator[context.method](context.arg) and handle the
485
+ // result, either by returning a { value, done } result from the
486
+ // delegate iterator, or by modifying context.method and context.arg,
487
+ // setting context.delegate to null, and returning the ContinueSentinel.
488
+ function maybeInvokeDelegate(delegate, context) {
489
+ var method = delegate.iterator[context.method];
490
+ if (method === undefined$1) {
491
+ // A .throw or .return when the delegate iterator has no .throw
492
+ // method always terminates the yield* loop.
493
+ context.delegate = null;
494
+
495
+ if (context.method === "throw") {
496
+ // Note: ["return"] must be used for ES3 parsing compatibility.
497
+ if (delegate.iterator["return"]) {
498
+ // If the delegate iterator has a return method, give it a
499
+ // chance to clean up.
500
+ context.method = "return";
501
+ context.arg = undefined$1;
502
+ maybeInvokeDelegate(delegate, context);
503
+
504
+ if (context.method === "throw") {
505
+ // If maybeInvokeDelegate(context) changed context.method from
506
+ // "return" to "throw", let that override the TypeError below.
507
+ return ContinueSentinel;
508
+ }
509
+ }
510
+
511
+ context.method = "throw";
512
+ context.arg = new TypeError(
513
+ "The iterator does not provide a 'throw' method");
514
+ }
515
+
516
+ return ContinueSentinel;
517
+ }
518
+
519
+ var record = tryCatch(method, delegate.iterator, context.arg);
520
+
521
+ if (record.type === "throw") {
522
+ context.method = "throw";
523
+ context.arg = record.arg;
524
+ context.delegate = null;
525
+ return ContinueSentinel;
526
+ }
527
+
528
+ var info = record.arg;
529
+
530
+ if (! info) {
531
+ context.method = "throw";
532
+ context.arg = new TypeError("iterator result is not an object");
533
+ context.delegate = null;
534
+ return ContinueSentinel;
535
+ }
536
+
537
+ if (info.done) {
538
+ // Assign the result of the finished delegate to the temporary
539
+ // variable specified by delegate.resultName (see delegateYield).
540
+ context[delegate.resultName] = info.value;
541
+
542
+ // Resume execution at the desired location (see delegateYield).
543
+ context.next = delegate.nextLoc;
544
+
545
+ // If context.method was "throw" but the delegate handled the
546
+ // exception, let the outer generator proceed normally. If
547
+ // context.method was "next", forget context.arg since it has been
548
+ // "consumed" by the delegate iterator. If context.method was
549
+ // "return", allow the original .return call to continue in the
550
+ // outer generator.
551
+ if (context.method !== "return") {
552
+ context.method = "next";
553
+ context.arg = undefined$1;
554
+ }
555
+
556
+ } else {
557
+ // Re-yield the result returned by the delegate method.
558
+ return info;
559
+ }
560
+
561
+ // The delegate iterator is finished, so forget it and continue with
562
+ // the outer generator.
563
+ context.delegate = null;
564
+ return ContinueSentinel;
565
+ }
566
+
567
+ // Define Generator.prototype.{next,throw,return} in terms of the
568
+ // unified ._invoke helper method.
569
+ defineIteratorMethods(Gp);
570
+
571
+ define(Gp, toStringTagSymbol, "Generator");
572
+
573
+ // A Generator should always return itself as the iterator object when the
574
+ // @@iterator function is called on it. Some browsers' implementations of the
575
+ // iterator prototype chain incorrectly implement this, causing the Generator
576
+ // object to not be returned from this call. This ensures that doesn't happen.
577
+ // See https://github.com/facebook/regenerator/issues/274 for more details.
578
+ define(Gp, iteratorSymbol, function() {
579
+ return this;
580
+ });
581
+
582
+ define(Gp, "toString", function() {
583
+ return "[object Generator]";
584
+ });
585
+
586
+ function pushTryEntry(locs) {
587
+ var entry = { tryLoc: locs[0] };
588
+
589
+ if (1 in locs) {
590
+ entry.catchLoc = locs[1];
591
+ }
592
+
593
+ if (2 in locs) {
594
+ entry.finallyLoc = locs[2];
595
+ entry.afterLoc = locs[3];
596
+ }
597
+
598
+ this.tryEntries.push(entry);
599
+ }
600
+
601
+ function resetTryEntry(entry) {
602
+ var record = entry.completion || {};
603
+ record.type = "normal";
604
+ delete record.arg;
605
+ entry.completion = record;
606
+ }
607
+
608
+ function Context(tryLocsList) {
609
+ // The root entry object (effectively a try statement without a catch
610
+ // or a finally block) gives us a place to store values thrown from
611
+ // locations where there is no enclosing try statement.
612
+ this.tryEntries = [{ tryLoc: "root" }];
613
+ tryLocsList.forEach(pushTryEntry, this);
614
+ this.reset(true);
615
+ }
616
+
617
+ exports.keys = function(object) {
618
+ var keys = [];
619
+ for (var key in object) {
620
+ keys.push(key);
621
+ }
622
+ keys.reverse();
623
+
624
+ // Rather than returning an object with a next method, we keep
625
+ // things simple and return the next function itself.
626
+ return function next() {
627
+ while (keys.length) {
628
+ var key = keys.pop();
629
+ if (key in object) {
630
+ next.value = key;
631
+ next.done = false;
632
+ return next;
633
+ }
634
+ }
635
+
636
+ // To avoid creating an additional object, we just hang the .value
637
+ // and .done properties off the next function object itself. This
638
+ // also ensures that the minifier will not anonymize the function.
639
+ next.done = true;
640
+ return next;
641
+ };
642
+ };
643
+
644
+ function values(iterable) {
645
+ if (iterable) {
646
+ var iteratorMethod = iterable[iteratorSymbol];
647
+ if (iteratorMethod) {
648
+ return iteratorMethod.call(iterable);
649
+ }
650
+
651
+ if (typeof iterable.next === "function") {
652
+ return iterable;
653
+ }
654
+
655
+ if (!isNaN(iterable.length)) {
656
+ var i = -1, next = function next() {
657
+ while (++i < iterable.length) {
658
+ if (hasOwn.call(iterable, i)) {
659
+ next.value = iterable[i];
660
+ next.done = false;
661
+ return next;
662
+ }
663
+ }
664
+
665
+ next.value = undefined$1;
666
+ next.done = true;
667
+
668
+ return next;
669
+ };
670
+
671
+ return next.next = next;
672
+ }
673
+ }
674
+
675
+ // Return an iterator with no values.
676
+ return { next: doneResult };
677
+ }
678
+ exports.values = values;
679
+
680
+ function doneResult() {
681
+ return { value: undefined$1, done: true };
682
+ }
683
+
684
+ Context.prototype = {
685
+ constructor: Context,
686
+
687
+ reset: function(skipTempReset) {
688
+ this.prev = 0;
689
+ this.next = 0;
690
+ // Resetting context._sent for legacy support of Babel's
691
+ // function.sent implementation.
692
+ this.sent = this._sent = undefined$1;
693
+ this.done = false;
694
+ this.delegate = null;
695
+
696
+ this.method = "next";
697
+ this.arg = undefined$1;
698
+
699
+ this.tryEntries.forEach(resetTryEntry);
700
+
701
+ if (!skipTempReset) {
702
+ for (var name in this) {
703
+ // Not sure about the optimal order of these conditions:
704
+ if (name.charAt(0) === "t" &&
705
+ hasOwn.call(this, name) &&
706
+ !isNaN(+name.slice(1))) {
707
+ this[name] = undefined$1;
708
+ }
709
+ }
710
+ }
711
+ },
712
+
713
+ stop: function() {
714
+ this.done = true;
715
+
716
+ var rootEntry = this.tryEntries[0];
717
+ var rootRecord = rootEntry.completion;
718
+ if (rootRecord.type === "throw") {
719
+ throw rootRecord.arg;
720
+ }
721
+
722
+ return this.rval;
723
+ },
724
+
725
+ dispatchException: function(exception) {
726
+ if (this.done) {
727
+ throw exception;
728
+ }
729
+
730
+ var context = this;
731
+ function handle(loc, caught) {
732
+ record.type = "throw";
733
+ record.arg = exception;
734
+ context.next = loc;
735
+
736
+ if (caught) {
737
+ // If the dispatched exception was caught by a catch block,
738
+ // then let that catch block handle the exception normally.
739
+ context.method = "next";
740
+ context.arg = undefined$1;
741
+ }
742
+
743
+ return !! caught;
744
+ }
745
+
746
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
747
+ var entry = this.tryEntries[i];
748
+ var record = entry.completion;
749
+
750
+ if (entry.tryLoc === "root") {
751
+ // Exception thrown outside of any try block that could handle
752
+ // it, so set the completion value of the entire function to
753
+ // throw the exception.
754
+ return handle("end");
755
+ }
756
+
757
+ if (entry.tryLoc <= this.prev) {
758
+ var hasCatch = hasOwn.call(entry, "catchLoc");
759
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
760
+
761
+ if (hasCatch && hasFinally) {
762
+ if (this.prev < entry.catchLoc) {
763
+ return handle(entry.catchLoc, true);
764
+ } else if (this.prev < entry.finallyLoc) {
765
+ return handle(entry.finallyLoc);
766
+ }
767
+
768
+ } else if (hasCatch) {
769
+ if (this.prev < entry.catchLoc) {
770
+ return handle(entry.catchLoc, true);
771
+ }
772
+
773
+ } else if (hasFinally) {
774
+ if (this.prev < entry.finallyLoc) {
775
+ return handle(entry.finallyLoc);
776
+ }
777
+
778
+ } else {
779
+ throw new Error("try statement without catch or finally");
780
+ }
781
+ }
782
+ }
783
+ },
784
+
785
+ abrupt: function(type, arg) {
786
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
787
+ var entry = this.tryEntries[i];
788
+ if (entry.tryLoc <= this.prev &&
789
+ hasOwn.call(entry, "finallyLoc") &&
790
+ this.prev < entry.finallyLoc) {
791
+ var finallyEntry = entry;
792
+ break;
793
+ }
794
+ }
795
+
796
+ if (finallyEntry &&
797
+ (type === "break" ||
798
+ type === "continue") &&
799
+ finallyEntry.tryLoc <= arg &&
800
+ arg <= finallyEntry.finallyLoc) {
801
+ // Ignore the finally entry if control is not jumping to a
802
+ // location outside the try/catch block.
803
+ finallyEntry = null;
804
+ }
805
+
806
+ var record = finallyEntry ? finallyEntry.completion : {};
807
+ record.type = type;
808
+ record.arg = arg;
809
+
810
+ if (finallyEntry) {
811
+ this.method = "next";
812
+ this.next = finallyEntry.finallyLoc;
813
+ return ContinueSentinel;
814
+ }
815
+
816
+ return this.complete(record);
817
+ },
818
+
819
+ complete: function(record, afterLoc) {
820
+ if (record.type === "throw") {
821
+ throw record.arg;
822
+ }
823
+
824
+ if (record.type === "break" ||
825
+ record.type === "continue") {
826
+ this.next = record.arg;
827
+ } else if (record.type === "return") {
828
+ this.rval = this.arg = record.arg;
829
+ this.method = "return";
830
+ this.next = "end";
831
+ } else if (record.type === "normal" && afterLoc) {
832
+ this.next = afterLoc;
833
+ }
834
+
835
+ return ContinueSentinel;
836
+ },
837
+
838
+ finish: function(finallyLoc) {
839
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
840
+ var entry = this.tryEntries[i];
841
+ if (entry.finallyLoc === finallyLoc) {
842
+ this.complete(entry.completion, entry.afterLoc);
843
+ resetTryEntry(entry);
844
+ return ContinueSentinel;
845
+ }
846
+ }
847
+ },
848
+
849
+ "catch": function(tryLoc) {
850
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
851
+ var entry = this.tryEntries[i];
852
+ if (entry.tryLoc === tryLoc) {
853
+ var record = entry.completion;
854
+ if (record.type === "throw") {
855
+ var thrown = record.arg;
856
+ resetTryEntry(entry);
857
+ }
858
+ return thrown;
859
+ }
860
+ }
861
+
862
+ // The context.catch method must only be called with a location
863
+ // argument that corresponds to a known catch block.
864
+ throw new Error("illegal catch attempt");
865
+ },
866
+
867
+ delegateYield: function(iterable, resultName, nextLoc) {
868
+ this.delegate = {
869
+ iterator: values(iterable),
870
+ resultName: resultName,
871
+ nextLoc: nextLoc
872
+ };
873
+
874
+ if (this.method === "next") {
875
+ // Deliberately forget the last sent value so that we don't
876
+ // accidentally pass it on to the delegate.
877
+ this.arg = undefined$1;
878
+ }
879
+
880
+ return ContinueSentinel;
881
+ }
882
+ };
883
+
884
+ // Regardless of whether this script is executing as a CommonJS module
885
+ // or not, return the runtime object so that we can declare the variable
886
+ // regeneratorRuntime in the outer scope, which allows this module to be
887
+ // injected easily by `bin/regenerator --include-runtime script.js`.
888
+ return exports;
889
+
890
+ }(
891
+ // If this script is executing as a CommonJS module, use module.exports
892
+ // as the regeneratorRuntime namespace. Otherwise create a new empty
893
+ // object. Either way, the resulting object will be used to initialize
894
+ // the regeneratorRuntime variable at the top of this file.
895
+ module.exports
896
+ ));
897
+
898
+ try {
899
+ regeneratorRuntime = runtime;
900
+ } catch (accidentalStrictMode) {
901
+ // This module should not be running in strict mode, so the above
902
+ // assignment should always work unless something is misconfigured. Just
903
+ // in case runtime.js accidentally runs in strict mode, in modern engines
904
+ // we can explicitly access globalThis. In older engines we can escape
905
+ // strict mode using a global Function call. This could conceivably fail
906
+ // if a Content Security Policy forbids using Function, but in that case
907
+ // the proper solution is to fix the accidental strict mode problem. If
908
+ // you've misconfigured your bundler to force strict mode and applied a
909
+ // CSP to forbid Function, and you're not willing to fix either of those
910
+ // problems, please detail your unique predicament in a GitHub issue.
911
+ if (typeof globalThis === "object") {
912
+ globalThis.regeneratorRuntime = runtime;
913
+ } else {
914
+ Function("r", "regeneratorRuntime = r")(runtime);
915
+ }
916
+ }
917
+ });
918
+
919
+ var AxiosService = /*#__PURE__*/function () {
920
+ function AxiosService(config) {
921
+ if (!config) config = {};
922
+ this.axios = axios.create(config);
923
+ }
924
+
925
+ var _proto = AxiosService.prototype;
926
+
927
+ _proto.apiRequest = /*#__PURE__*/function () {
928
+ var _apiRequest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(config, url, data) {
929
+ return runtime_1.wrap(function _callee$(_context) {
930
+ while (1) {
931
+ switch (_context.prev = _context.next) {
932
+ case 0:
933
+ if (!config.headers) config.headers = {};
934
+ config.headers['Content-Type'] = 'application/json';
935
+ return _context.abrupt("return", this.axios(_extends({}, config, {
936
+ url: url,
937
+ data: data
938
+ })).then(function (res) {
939
+ return res.data;
940
+ }));
941
+
942
+ case 3:
943
+ case "end":
944
+ return _context.stop();
945
+ }
946
+ }
947
+ }, _callee, this);
948
+ }));
949
+
950
+ function apiRequest(_x, _x2, _x3) {
951
+ return _apiRequest.apply(this, arguments);
952
+ }
953
+
954
+ return apiRequest;
955
+ }();
956
+
957
+ _proto.apiRequestHeader = /*#__PURE__*/function () {
958
+ var _apiRequestHeader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(config, url, headerToRetrieve, data) {
959
+ return runtime_1.wrap(function _callee2$(_context2) {
960
+ while (1) {
961
+ switch (_context2.prev = _context2.next) {
962
+ case 0:
963
+ if (!config.headers) config.headers = {};
964
+ config.headers['Content-Type'] = 'application/json';
965
+ return _context2.abrupt("return", this.axios(_extends({}, config, {
966
+ url: url,
967
+ data: data
968
+ })).then(function (res) {
969
+ if (headerToRetrieve) {
970
+ var _res$headers$headerTo;
971
+
972
+ return (_res$headers$headerTo = res.headers[headerToRetrieve]) != null ? _res$headers$headerTo : res.headers[headerToRetrieve.toLowerCase()];
973
+ }
974
+
975
+ return res.headers;
976
+ }));
977
+
978
+ case 3:
979
+ case "end":
980
+ return _context2.stop();
981
+ }
982
+ }
983
+ }, _callee2, this);
984
+ }));
985
+
986
+ function apiRequestHeader(_x4, _x5, _x6, _x7) {
987
+ return _apiRequestHeader.apply(this, arguments);
988
+ }
989
+
990
+ return apiRequestHeader;
991
+ }();
992
+
993
+ _proto.get = function get(url, config) {
994
+ return this.apiRequest(_extends({}, config, {
995
+ method: 'get'
996
+ }), url);
997
+ };
998
+
999
+ _proto.deleteRequest = function deleteRequest(url, config) {
1000
+ return this.apiRequest(_extends({}, config, {
1001
+ method: 'delete'
1002
+ }), url);
1003
+ };
1004
+
1005
+ _proto.post = function post(url, data, config) {
1006
+ return this.apiRequest(_extends({}, config, {
1007
+ method: 'post'
1008
+ }), url, data);
1009
+ };
1010
+
1011
+ _proto.put = function put(url, data, config) {
1012
+ return this.apiRequest(_extends({}, config, {
1013
+ method: 'put'
1014
+ }), url, data);
1015
+ };
1016
+
1017
+ _proto.patch = function patch(url, data, config) {
1018
+ return this.apiRequest(_extends({}, config, {
1019
+ method: 'patch'
1020
+ }), url, data);
1021
+ };
1022
+
1023
+ _proto.head = function head(url, config, headerToRetrieve, data) {
1024
+ return this.apiRequestHeader(_extends({}, config, {
1025
+ method: 'head'
1026
+ }), url, headerToRetrieve, data);
1027
+ };
1028
+
1029
+ return AxiosService;
1030
+ }();
1031
+
1032
+ var APIService = /*#__PURE__*/function (_AxiosService) {
1033
+ _inheritsLoose(APIService, _AxiosService);
1034
+
1035
+ function APIService(config, tokenRefreshFailureCallback) {
1036
+ var _this;
1037
+
1038
+ _this = _AxiosService.call(this, config) || this;
1039
+ _this.tokenRefreshFailureCallback = tokenRefreshFailureCallback;
1040
+
1041
+ var self = _assertThisInitialized(_this);
1042
+
1043
+ _this.axios.interceptors.request.use(function (config) {
1044
+ var token = config.useRefreshToken ? self.getTokens().refreshToken : self.getTokens().accessToken;
1045
+ config.headers = _extends({}, config.headers, {
1046
+ Authorization: "Bearer " + token
1047
+ });
1048
+ return config;
1049
+ }, function (error) {
1050
+ Promise.reject(error);
1051
+ });
1052
+
1053
+ createAuthRefreshInterceptor(_this.axios, /*#__PURE__*/function () {
1054
+ var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(failedRequest) {
1055
+ var tokenResp;
1056
+ return runtime_1.wrap(function _callee$(_context) {
1057
+ while (1) {
1058
+ switch (_context.prev = _context.next) {
1059
+ case 0:
1060
+ if (!self.authRefreshFn) {
1061
+ _context.next = 15;
1062
+ break;
1063
+ }
1064
+
1065
+ _context.prev = 1;
1066
+ _context.next = 4;
1067
+ return self.authRefreshFn(self.getTokens().refreshToken);
1068
+
1069
+ case 4:
1070
+ tokenResp = _context.sent;
1071
+ self.setTokens({
1072
+ accessToken: tokenResp.accessToken,
1073
+ refreshToken: tokenResp.refreshToken
1074
+ });
1075
+ failedRequest.response.config.headers['Authorization'] = "Bearer " + self.getTokens().accessToken;
1076
+ return _context.abrupt("return", Promise.resolve());
1077
+
1078
+ case 10:
1079
+ _context.prev = 10;
1080
+ _context.t0 = _context["catch"](1);
1081
+ console.error('an error occured while refreshing tokens (notifying callback)', _context.t0);
1082
+ if (self.tokenRefreshFailureCallback) self.tokenRefreshFailureCallback(failedRequest);
1083
+ return _context.abrupt("return", Promise.resolve());
1084
+
1085
+ case 15:
1086
+ console.error('The request could not refresh the token (authRefreshFn was not set)', failedRequest);
1087
+ return _context.abrupt("return", Promise.resolve());
1088
+
1089
+ case 17:
1090
+ case "end":
1091
+ return _context.stop();
1092
+ }
1093
+ }
1094
+ }, _callee, null, [[1, 10]]);
1095
+ }));
1096
+
1097
+ return function (_x) {
1098
+ return _ref.apply(this, arguments);
1099
+ };
1100
+ }(), {
1101
+ statusCodes: [401, 403]
1102
+ });
1103
+ return _this;
1104
+ }
1105
+
1106
+ var _proto = APIService.prototype;
1107
+
1108
+ _proto.setAuthRefreshFn = function setAuthRefreshFn(fn) {
1109
+ this.authRefreshFn = fn;
1110
+ };
1111
+
1112
+ _proto.setTokens = function setTokens(tokens) {
1113
+ localStorage.setItem('tokens', JSON.stringify(tokens));
1114
+ };
1115
+
1116
+ _proto.getTokens = function getTokens() {
1117
+ var tokens = {};
1118
+ var item = localStorage.getItem('tokens');
1119
+
1120
+ if (item) {
1121
+ tokens = JSON.parse(item);
1122
+ }
1123
+
1124
+ return tokens;
1125
+ };
1126
+
1127
+ return APIService;
1128
+ }(AxiosService);
1129
+
1130
+ var AssistantType;
1131
+
1132
+ (function (AssistantType) {
1133
+ AssistantType["MedicalSecretary"] = "MedicalSecretary";
1134
+ AssistantType["Nurse"] = "Nurse";
1135
+ AssistantType["Specialist"] = "Specialist";
1136
+ AssistantType["Administrative"] = "Administrative";
1137
+ AssistantType["Other"] = "Other";
1138
+ })(AssistantType || (AssistantType = {}));
1139
+
1140
+ var TransmissionKind;
1141
+
1142
+ (function (TransmissionKind) {
1143
+ TransmissionKind["Fax"] = "Fax";
1144
+ TransmissionKind["Email"] = "Email";
1145
+ TransmissionKind["SMS"] = "SMS";
1146
+ TransmissionKind["EncryptedEmail"] = "EncryptedEmail";
1147
+ TransmissionKind["Logs"] = "Logs";
1148
+ TransmissionKind["API"] = "API";
1149
+ TransmissionKind["Other"] = "Other";
1150
+ })(TransmissionKind || (TransmissionKind = {}));
1151
+
1152
+ var TransmissionStatus;
1153
+
1154
+ (function (TransmissionStatus) {
1155
+ TransmissionStatus["Preparing"] = "Preparing";
1156
+ TransmissionStatus["Sending"] = "Sending";
1157
+ TransmissionStatus["Sent"] = "Sent";
1158
+ TransmissionStatus["Retrying"] = "Retrying";
1159
+ TransmissionStatus["Failed"] = "Failed";
1160
+ TransmissionStatus["DriverError"] = "DriverError";
1161
+ TransmissionStatus["TimedOut"] = "TimedOut";
1162
+ TransmissionStatus["ReceiverNotExist"] = "ReceiverNotExist";
1163
+ TransmissionStatus["ReceiverNotAnswering"] = "ReceiverNotAnswering";
1164
+ TransmissionStatus["ReceiverIncompatible"] = "ReceiverIncompatible";
1165
+ })(TransmissionStatus || (TransmissionStatus = {}));
1166
+
1167
+ var FeeStatus;
1168
+
1169
+ (function (FeeStatus) {
1170
+ FeeStatus["NoFee"] = "NoFee";
1171
+ FeeStatus["Pending"] = "Pending";
1172
+ FeeStatus["Paid"] = "Paid";
1173
+ FeeStatus["Reimbursed"] = "Reimbursed";
1174
+ FeeStatus["Cancelled"] = "Cancelled";
1175
+ FeeStatus["Contested"] = "Contested";
1176
+ })(FeeStatus || (FeeStatus = {}));
1177
+
1178
+ var MedicalStatus;
1179
+
1180
+ (function (MedicalStatus) {
1181
+ MedicalStatus["Creating"] = "Creating";
1182
+ MedicalStatus["New"] = "New";
1183
+ MedicalStatus["ToAnswer"] = "ToAnswer";
1184
+ MedicalStatus["Answered"] = "Answered";
1185
+ MedicalStatus["Closed"] = "Closed";
1186
+ MedicalStatus["Reopened"] = "Reopened";
1187
+ MedicalStatus["Archived"] = "Archived";
1188
+ })(MedicalStatus || (MedicalStatus = {}));
1189
+
1190
+ var TaskStatus;
1191
+
1192
+ (function (TaskStatus) {
1193
+ TaskStatus["None"] = "None";
1194
+ TaskStatus["ToDo"] = "ToDo";
1195
+ TaskStatus["InProgress"] = "InProgress";
1196
+ TaskStatus["Blocked"] = "Blocked";
1197
+ TaskStatus["Done"] = "Done";
1198
+ })(TaskStatus || (TaskStatus = {}));
1199
+
1200
+ var DiagnosisType;
1201
+
1202
+ (function (DiagnosisType) {
1203
+ DiagnosisType["Generic"] = "Generic";
1204
+ DiagnosisType["Private"] = "Private";
1205
+ DiagnosisType["Instance"] = "Instance";
1206
+ })(DiagnosisType || (DiagnosisType = {}));
1207
+
1208
+ var DrugType;
1209
+
1210
+ (function (DrugType) {
1211
+ DrugType["Generic"] = "Generic";
1212
+ DrugType["Instance"] = "Instance";
1213
+ })(DrugType || (DrugType = {}));
1214
+
1215
+ var PlanStatus;
1216
+
1217
+ (function (PlanStatus) {
1218
+ PlanStatus["Pending"] = "Pending";
1219
+ PlanStatus["Accepted"] = "Accepted";
1220
+ PlanStatus["Rejected"] = "Rejected";
1221
+ })(PlanStatus || (PlanStatus = {}));
1222
+
1223
+ var AuthenticationFailed = /*#__PURE__*/function (_Error) {
1224
+ _inheritsLoose(AuthenticationFailed, _Error);
1225
+
1226
+ function AuthenticationFailed() {
1227
+ return _Error.apply(this, arguments) || this;
1228
+ }
1229
+
1230
+ return AuthenticationFailed;
1231
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1232
+ var AuthenticationBadRequest = /*#__PURE__*/function (_Error2) {
1233
+ _inheritsLoose(AuthenticationBadRequest, _Error2);
1234
+
1235
+ function AuthenticationBadRequest() {
1236
+ return _Error2.apply(this, arguments) || this;
1237
+ }
1238
+
1239
+ return AuthenticationBadRequest;
1240
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1241
+ var AuthenticationServerError = /*#__PURE__*/function (_Error3) {
1242
+ _inheritsLoose(AuthenticationServerError, _Error3);
1243
+
1244
+ function AuthenticationServerError() {
1245
+ return _Error3.apply(this, arguments) || this;
1246
+ }
1247
+
1248
+ return AuthenticationServerError;
1249
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1250
+ var IdentityCreationFailed = /*#__PURE__*/function (_Error4) {
1251
+ _inheritsLoose(IdentityCreationFailed, _Error4);
1252
+
1253
+ function IdentityCreationFailed() {
1254
+ return _Error4.apply(this, arguments) || this;
1255
+ }
1256
+
1257
+ return IdentityCreationFailed;
1258
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1259
+ var IdentityCreationBadRequest = /*#__PURE__*/function (_Error5) {
1260
+ _inheritsLoose(IdentityCreationBadRequest, _Error5);
1261
+
1262
+ function IdentityCreationBadRequest() {
1263
+ return _Error5.apply(this, arguments) || this;
1264
+ }
1265
+
1266
+ return IdentityCreationBadRequest;
1267
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1268
+ var IdentityCreationConflict = /*#__PURE__*/function (_Error6) {
1269
+ _inheritsLoose(IdentityCreationConflict, _Error6);
1270
+
1271
+ function IdentityCreationConflict() {
1272
+ return _Error6.apply(this, arguments) || this;
1273
+ }
1274
+
1275
+ return IdentityCreationConflict;
1276
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1277
+
1278
+ var WorkflowType;
1279
+
1280
+ (function (WorkflowType) {
1281
+ WorkflowType["Onboard"] = "Onboard";
1282
+ WorkflowType["Followup"] = "Followup";
1283
+ WorkflowType["Renew"] = "Renew";
1284
+ WorkflowType["DataRetrieve"] = "DataRetrieve";
1285
+ })(WorkflowType || (WorkflowType = {}));
1286
+
1287
+ var RateDimension;
1288
+
1289
+ (function (RateDimension) {
1290
+ RateDimension["RatioOnTotal"] = "RatioOnTotal";
1291
+ RateDimension["FixedOnTotal"] = "FixedOnTotal";
1292
+ RateDimension["RatioPlatformFee"] = "RatioPlatformFee";
1293
+ RateDimension["FixedPlatformFee"] = "FixedPlatformFee";
1294
+ RateDimension["RatioOnPlatformFeeTotal"] = "RatioOnPlatformFeeTotal";
1295
+ RateDimension["FixedOnPlatformFeeTotal"] = "FixedOnPlatformFeeTotal";
1296
+ RateDimension["RatioOnItem"] = "RatioOnItem";
1297
+ RateDimension["FixedOnItem"] = "FixedOnItem";
1298
+ })(RateDimension || (RateDimension = {}));
1299
+
1300
+ var PlanType;
1301
+
1302
+ (function (PlanType) {
1303
+ PlanType["Onboard"] = "Onboard";
1304
+ PlanType["Followup"] = "Followup";
1305
+ PlanType["Renew"] = "Renew";
1306
+ PlanType["DataRetrieve"] = "DataRetrieve";
1307
+ })(PlanType || (PlanType = {}));
1308
+
1309
+ var PaymentStatus;
1310
+
1311
+ (function (PaymentStatus) {
1312
+ PaymentStatus["Pending"] = "Pending";
1313
+ PaymentStatus["Success"] = "Success";
1314
+ PaymentStatus["Failure"] = "Failure";
1315
+ PaymentStatus["Canceled"] = "Canceled";
1316
+ })(PaymentStatus || (PaymentStatus = {}));
1317
+
1318
+ var PractitionerStatus;
1319
+
1320
+ (function (PractitionerStatus) {
1321
+ PractitionerStatus["Practicing"] = "Practicing";
1322
+ PractitionerStatus["Retired"] = "Retired";
1323
+ PractitionerStatus["NotInvolvedAnymore"] = "NotInvolvedAnymore";
1324
+ PractitionerStatus["Deactivated"] = "Deactivated";
1325
+ PractitionerStatus["Flagged"] = "Flagged";
1326
+ PractitionerStatus["InConflict"] = "InConflict";
1327
+ PractitionerStatus["Delicensed"] = "Delicensed";
1328
+ })(PractitionerStatus || (PractitionerStatus = {}));
1329
+
1330
+ var AssignmentStatus;
1331
+
1332
+ (function (AssignmentStatus) {
1333
+ AssignmentStatus["Assigned"] = "Assigned";
1334
+ AssignmentStatus["Reassigned"] = "Reassigned";
1335
+ AssignmentStatus["Cancelled"] = "Cancelled";
1336
+ })(AssignmentStatus || (AssignmentStatus = {}));
1337
+
1338
+ var PractitionnerRoleType;
1339
+
1340
+ (function (PractitionnerRoleType) {
1341
+ PractitionnerRoleType["Doctor"] = "Doctor";
1342
+ PractitionnerRoleType["MedicalAssistant"] = "MedicalAssistant";
1343
+ PractitionnerRoleType["MedicalSecretary"] = "MedicalSecretary";
1344
+ PractitionnerRoleType["Nurse"] = "Nurse";
1345
+ PractitionnerRoleType["Specialist"] = "Specialist";
1346
+ PractitionnerRoleType["LabAssistant"] = "LabAssistant";
1347
+ PractitionnerRoleType["Administrative"] = "Administrative";
1348
+ PractitionnerRoleType["ManualDispatcher"] = "ManualDispatcher";
1349
+ PractitionnerRoleType["Other"] = "Other";
1350
+ })(PractitionnerRoleType || (PractitionnerRoleType = {}));
1351
+
1352
+ var OtherRoleType;
1353
+
1354
+ (function (OtherRoleType) {
1355
+ OtherRoleType["Patient"] = "Patient";
1356
+ OtherRoleType["User"] = "User";
1357
+ OtherRoleType["System"] = "System";
1358
+ })(OtherRoleType || (OtherRoleType = {}));
1359
+
1360
+ var LicenseStatus;
1361
+
1362
+ (function (LicenseStatus) {
1363
+ LicenseStatus["Valid"] = "Valid";
1364
+ LicenseStatus["Invalid"] = "Invalid";
1365
+ LicenseStatus["Expired"] = "Expired";
1366
+ LicenseStatus["NA"] = "NA";
1367
+ LicenseStatus["Removed"] = "Removed";
1368
+ })(LicenseStatus || (LicenseStatus = {}));
1369
+
1370
+ var PeriodType;
1371
+
1372
+ (function (PeriodType) {
1373
+ PeriodType["PerYear"] = "PerYear";
1374
+ PeriodType["PerQuarter"] = "PerQuarter";
1375
+ PeriodType["PerMonth"] = "PerMonth";
1376
+ PeriodType["PerWeek"] = "PerWeek";
1377
+ PeriodType["PerBusinessDay"] = "PerBusinessDay";
1378
+ PeriodType["PerDay"] = "PerDay";
1379
+ PeriodType["PerHour"] = "PerHour";
1380
+ })(PeriodType || (PeriodType = {}));
1381
+
1382
+ var SyncStatus;
1383
+
1384
+ (function (SyncStatus) {
1385
+ SyncStatus["Requested"] = "Requested";
1386
+ SyncStatus["Started"] = "Started";
1387
+ SyncStatus["Succeeded"] = "Succeeded";
1388
+ SyncStatus["Failed"] = "Failed";
1389
+ SyncStatus["Cancelled"] = "Cancelled";
1390
+ })(SyncStatus || (SyncStatus = {}));
1391
+
1392
+ var PracticeEmailKind;
1393
+
1394
+ (function (PracticeEmailKind) {
1395
+ PracticeEmailKind["SignedUp"] = "SignedUp";
1396
+ PracticeEmailKind["Onboarded"] = "Onboarded";
1397
+ PracticeEmailKind["OnboardedPractitioner"] = "OnboardedPractitioner";
1398
+ PracticeEmailKind["OnboardedPatient"] = "OnboardedPatient";
1399
+ PracticeEmailKind["Answered"] = "Answered";
1400
+ PracticeEmailKind["ToAnswer"] = "ToAnswer";
1401
+ PracticeEmailKind["FollowedUp"] = "FollowedUp";
1402
+ PracticeEmailKind["Renewed"] = "Renewed";
1403
+ PracticeEmailKind["DataRetrieved"] = "DataRetrieved";
1404
+ })(PracticeEmailKind || (PracticeEmailKind = {}));
1405
+
1406
+ var PracticeConfigKind;
1407
+
1408
+ (function (PracticeConfigKind) {
1409
+ PracticeConfigKind["PractitionerConsultList"] = "PractitionerConsultList";
1410
+ PracticeConfigKind["PractitionerChatbox"] = "PractitionerChatbox";
1411
+ PracticeConfigKind["PracticeTheme"] = "PracticeTheme";
1412
+ PracticeConfigKind["PracticeLocaleSwitcher"] = "PracticeLocaleSwitcher";
1413
+ PracticeConfigKind["PracticeCookieBanner"] = "PracticeCookieBanner";
1414
+ })(PracticeConfigKind || (PracticeConfigKind = {}));
1415
+
1416
+ var StripePriceType;
1417
+
1418
+ (function (StripePriceType) {
1419
+ StripePriceType["Default"] = "Default";
1420
+ StripePriceType["Discount"] = "Discount";
1421
+ })(StripePriceType || (StripePriceType = {}));
1422
+
1423
+ var IndexKey;
1424
+
1425
+ (function (IndexKey) {
1426
+ IndexKey["Consultation"] = "Consultation";
1427
+ IndexKey["IndexSnapshot"] = "IndexSnapshot";
1428
+ IndexKey["ConsultationLockbox"] = "ConsultationLockbox";
1429
+ })(IndexKey || (IndexKey = {}));
1430
+
1431
+ var DocumentType;
1432
+
1433
+ (function (DocumentType) {
1434
+ DocumentType["Message"] = "Message";
1435
+ DocumentType["Note"] = "Note";
1436
+ DocumentType["DoctorsNote"] = "DoctorsNote";
1437
+ DocumentType["Prescription"] = "Prescription";
1438
+ DocumentType["ExamRequest"] = "ExamRequest";
1439
+ DocumentType["Result"] = "Result";
1440
+ DocumentType["Attachment"] = "Attachment";
1441
+ DocumentType["BigFile"] = "BigFile";
1442
+ DocumentType["MeetingRequest"] = "MeetingRequest";
1443
+ DocumentType["AudioNote"] = "AudioNote";
1444
+ DocumentType["VideoNote"] = "VideoNote";
1445
+ DocumentType["PopulatedWorkflowData"] = "PopulatedWorkflowData";
1446
+ DocumentType["TreatmentPlan"] = "TreatmentPlan";
1447
+ DocumentType["ImageAlias"] = "ImageAlias";
1448
+ })(DocumentType || (DocumentType = {}));
1449
+
1450
+ var MetadataCategory;
1451
+
1452
+ (function (MetadataCategory) {
1453
+ MetadataCategory["ChildPersonal"] = "ChildPersonal";
1454
+ MetadataCategory["Consultation"] = "Consultation";
1455
+ MetadataCategory["DataRetrieval"] = "DataRetrieval";
1456
+ MetadataCategory["Followup"] = "Followup";
1457
+ MetadataCategory["Recovery"] = "Recovery";
1458
+ MetadataCategory["Medical"] = "Medical";
1459
+ MetadataCategory["OtherPersonal"] = "OtherPersonal";
1460
+ MetadataCategory["Personal"] = "Personal";
1461
+ MetadataCategory["Preference"] = "Preference";
1462
+ MetadataCategory["Prescription"] = "Prescription";
1463
+ MetadataCategory["Raw"] = "Raw";
1464
+ })(MetadataCategory || (MetadataCategory = {}));
1465
+
1466
+ var ConsultService = /*#__PURE__*/function () {
1467
+ function ConsultService(api, baseURL) {
1468
+ this.api = api;
1469
+ this.baseURL = baseURL;
1470
+ }
1471
+
1472
+ var _proto = ConsultService.prototype;
1473
+
1474
+ _proto.consultCreate = function consultCreate(c) {
1475
+ return this.api.post(this.baseURL + "/v1/consults", c);
1476
+ }
1477
+ /**
1478
+ * This function returns the number of consults using parameters
1479
+ * @param uuidPractice the practice uuid
1480
+ * @param uuidRequester the requester uuid
1481
+ * @param statusesMedical an array containing MedicalStatus to include
1482
+ * @param statusesExclude an array containing MedicalStatus to exclude
1483
+ * @param shortId a shortId matcher (will match all consult with a shortId starting with this `shortId`)
1484
+ * @param columnToSortTo the list of columns separated by commas, to sort to (in order of sorting)
1485
+ * @param orderToSortTo the type of sorting to do ('asc' for ascending or 'desc' for descending)
1486
+ * @param perPage the number of item to retrieve per "page"
1487
+ * @param indexPage the actual index of the page to retrieve (0 based: 0 is the first items)
1488
+ * @param filterAssignedDoctor the uuid of the doctor for which to filter with
1489
+ * @param filterCurrentPractitioner the uuid of the current assistant assigned to filter with
1490
+ * @param filterIsoLocality the of isoLocality to filter with
1491
+ * @returns a number of consult
1492
+ */
1493
+ ;
1494
+
1495
+ _proto.countConsults = function countConsults(uuidPractice, uuidRequester, statusesMedical, statusesExclude, shortId, columnToSortTo, orderToSortTo, perPage, indexPage, filterAssignedDoctor, filterCurrentPractitioner, filterIsoLocality) {
1496
+ return this.api.head(this.baseURL + "/v1/consults", {
1497
+ params: {
1498
+ uuidPractice: uuidPractice,
1499
+ uuidRequester: uuidRequester,
1500
+ statusesMedical: statusesMedical,
1501
+ statusesExclude: statusesExclude,
1502
+ shortId: shortId,
1503
+ perPage: perPage,
1504
+ page: indexPage,
1505
+ sortColumns: columnToSortTo,
1506
+ orderColumns: orderToSortTo,
1507
+ filterAssignedDoctor: filterAssignedDoctor,
1508
+ filterCurrentPractitioner: filterCurrentPractitioner,
1509
+ filterIsoLocality: filterIsoLocality
1510
+ }
1511
+ }, 'Content-Range').then(function (resContentRange) {
1512
+ if (!resContentRange || typeof resContentRange !== 'string' && typeof resContentRange !== 'number') {
1513
+ return 0;
1514
+ }
1515
+
1516
+ if (typeof resContentRange === 'number') {
1517
+ return resContentRange;
1518
+ }
1519
+
1520
+ return parseInt(resContentRange);
1521
+ });
1522
+ }
1523
+ /**
1524
+ * This function get consults using parameters
1525
+ * @param uuidPractice the practice uuid
1526
+ * @param uuidRequester the requester uuid
1527
+ * @param statusesMedical an array containing MedicalStatus to include
1528
+ * @param statusesExclude an array containing MedicalStatus to exclude
1529
+ * @param shortId a shortId matcher (will match all consult with a shortId starting with this `shortId`)
1530
+ * @param columnToSortTo the list of columns separated by commas, to sort to (in order of sorting)
1531
+ * @param orderToSortTo the type of sorting to do ('asc' for ascending or 'desc' for descending)
1532
+ * @param perPage the number of item to retrieve per "page"
1533
+ * @param indexPage the actual index of the page to retrieve (0 based: 0 is the first items)
1534
+ * @param filterAssignedDoctor the uuid of the doctor for which to filter with
1535
+ * @param filterCurrentPractitioner the uuid of the current assistant assigned to filter with
1536
+ * @param filterIsoLocality the of isoLocality to filter with
1537
+ * @returns a list of consult
1538
+ */
1539
+ ;
1540
+
1541
+ _proto.getConsults = function getConsults(uuidPractice, uuidRequester, statusesMedical, statusesExclude, shortId, columnToSortTo, orderToSortTo, perPage, indexPage, filterAssignedDoctor, filterCurrentPractitioner, filterIsoLocality) {
1542
+ return this.api.get(this.baseURL + "/v1/consults", {
1543
+ params: {
1544
+ uuidPractice: uuidPractice,
1545
+ uuidRequester: uuidRequester,
1546
+ statusesMedical: statusesMedical,
1547
+ statusesExclude: statusesExclude,
1548
+ shortId: shortId,
1549
+ perPage: perPage,
1550
+ page: indexPage,
1551
+ sortColumns: columnToSortTo,
1552
+ orderColumns: orderToSortTo,
1553
+ filterAssignedDoctor: filterAssignedDoctor,
1554
+ filterCurrentPractitioner: filterCurrentPractitioner,
1555
+ filterIsoLocality: filterIsoLocality
1556
+ }
1557
+ });
1558
+ };
1559
+
1560
+ _proto.getConsultByUUID = function getConsultByUUID(uuidConsult, uuidPractice) {
1561
+ return this.api.get(this.baseURL + "/v1/consults/" + uuidConsult, {
1562
+ params: {
1563
+ uuidPractice: uuidPractice
1564
+ }
1565
+ });
1566
+ };
1567
+
1568
+ _proto.updateConsultByUUID = function updateConsultByUUID(uuidConsult, consult, uuidPractice, uuidRequester) {
1569
+ return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult, consult, {
1570
+ params: {
1571
+ uuidPractice: uuidPractice,
1572
+ uuidRequester: uuidRequester
1573
+ }
1574
+ });
1575
+ };
1576
+
1577
+ _proto.getConsultFaxStatuses = function getConsultFaxStatuses(uuidConsult) {
1578
+ return this.api.get(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions", {
1579
+ params: {
1580
+ kind: TransmissionKind.Fax
1581
+ }
1582
+ });
1583
+ };
1584
+
1585
+ _proto.postConsultTransmission = function postConsultTransmission(uuidConsult, nameDriver, addressOrPhoneToSendTo, file, nameReceiver, txtTransmissionTitle, txtTransmissionNotes // numTry ?: number,
1586
+ // delay ?: number,
1587
+ ) {
1588
+ if (nameDriver === void 0) {
1589
+ nameDriver = 'Documo';
1590
+ }
1591
+
1592
+ var data = new FormData();
1593
+ data.append('nameDriverReceiver', nameDriver);
1594
+
1595
+ if (addressOrPhoneToSendTo) {
1596
+ data.append('addressReceiver', addressOrPhoneToSendTo);
1597
+ }
1598
+
1599
+ if (file) {
1600
+ data.append('file', file);
1601
+ }
1602
+
1603
+ if (nameReceiver) {
1604
+ data.append('nameReceiver', nameReceiver);
1605
+ }
1606
+
1607
+ if (txtTransmissionTitle) {
1608
+ data.append('txtTransmissionTitle', txtTransmissionTitle);
1609
+ }
1610
+
1611
+ if (txtTransmissionNotes) {
1612
+ data.append('txtTransmissionNotes', txtTransmissionNotes);
1613
+ }
1614
+
1615
+ return this.api.post(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions", data, {
1616
+ headers: {
1617
+ 'Content-Type': 'multipart/form-data;'
1618
+ }
1619
+ });
1620
+ };
1621
+
1622
+ _proto.postConsultFax = function postConsultFax(uuidConsult, addressReceiver, file) {
1623
+ return this.postConsultTransmission(uuidConsult, 'Documo', addressReceiver, file);
1624
+ };
1625
+
1626
+ _proto.postConsultEmail = function postConsultEmail(uuidConsult, file) {
1627
+ return this.postConsultTransmission(uuidConsult, 'Pharmacierge', undefined, file);
1628
+ };
1629
+
1630
+ _proto.retryConsultFax = function retryConsultFax(uuidConsult, transmissionId) {
1631
+ return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions/" + transmissionId, {
1632
+ status: TransmissionStatus.Retrying
1633
+ });
1634
+ };
1635
+
1636
+ _proto.updateConsultTransmissionStatus = function updateConsultTransmissionStatus(transmissionId, uuidConsult, newStatus) {
1637
+ return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions/" + transmissionId, {
1638
+ status: newStatus
1639
+ });
1640
+ };
1641
+
1642
+ return ConsultService;
1643
+ }();
1644
+
1645
+ var DiagnosisService = /*#__PURE__*/function () {
1646
+ function DiagnosisService(api, baseURL) {
1647
+ this.api = api;
1648
+ this.baseURL = baseURL;
1649
+ }
1650
+
1651
+ var _proto = DiagnosisService.prototype;
1652
+
1653
+ _proto.getDiagnoses = function getDiagnoses() {
1654
+ return this.api.get(this.baseURL + "/v1/diagnoses");
1655
+ }
1656
+ /**
1657
+ * Get a diagnosis by uuid that belongs to your practice
1658
+ * @param uuidDiagnosis the uuid of the diagnosis
1659
+ * @returns a diagnosis
1660
+ */
1661
+ ;
1662
+
1663
+ _proto.getDiagnosisByUuid = function getDiagnosisByUuid(uuidDiagnosis) {
1664
+ return this.api.get(this.baseURL + "/v1/diagnoses/" + uuidDiagnosis);
1665
+ };
1666
+
1667
+ _proto.createDiagnosis = function createDiagnosis(diagnosis) {
1668
+ return this.api.post(this.baseURL + "/v1/diagnoses", diagnosis);
1669
+ };
1670
+
1671
+ _proto.updateDiagnosis = function updateDiagnosis(uuid, diagnosis) {
1672
+ return this.api.put(this.baseURL + "/v1/diagnoses/" + uuid, diagnosis);
1673
+ };
1674
+
1675
+ _proto.getTreatmentsFromDiagnosisUuid = function getTreatmentsFromDiagnosisUuid(diagnosisUuid) {
1676
+ return this.api.get(this.baseURL + "/v1/diagnoses/" + diagnosisUuid + "/treatments");
1677
+ }
1678
+ /**
1679
+ * This function returns treatment plans associated to a consult
1680
+ * @param uuidConsult the consult uuid to fetch
1681
+ * @returns an array of TreatmentPlan
1682
+ */
1683
+ ;
1684
+
1685
+ _proto.getTreatmentPlansFromConsultUuid = function getTreatmentPlansFromConsultUuid(uuidConsult) {
1686
+ return this.api.get(this.baseURL + "/v1/treatment-plans/", {
1687
+ params: {
1688
+ uuidConsult: uuidConsult
1689
+ }
1690
+ });
1691
+ }
1692
+ /**
1693
+ * creates a new treatment for the specified diagnosis
1694
+ * @param diagnosisUuid uuid of the diagnosis that the treatment is linked to
1695
+ * @param treatmentRequest the treatment to be inserted
1696
+ */
1697
+ ;
1698
+
1699
+ _proto.createTreatment = function createTreatment(diagnosisUuid, treatmentRequest) {
1700
+ return this.api.post(this.baseURL + "/v1/diagnoses/" + diagnosisUuid + "/treatments", treatmentRequest);
1701
+ }
1702
+ /**
1703
+ * This function returns populated treatment plans associated to a consult
1704
+ * @param uuidConsult the consult uuid to fetch
1705
+ * @returns a TreatmentPlans object
1706
+ */
1707
+ ;
1708
+
1709
+ _proto.getTreatmentPlansPopulatedFromConsultUuid = function getTreatmentPlansPopulatedFromConsultUuid(uuidConsult) {
1710
+ return this.api.get(this.baseURL + "/v1/treatment-plans/", {
1711
+ params: {
1712
+ uuidConsult: uuidConsult,
1713
+ populated: true
1714
+ }
1715
+ });
1716
+ };
1717
+
1718
+ _proto.postPlans = function postPlans(plans) {
1719
+ return this.api.post(this.baseURL + "/v1/treatment-plans", plans);
1720
+ };
1721
+
1722
+ _proto.updateTreatmentPlan = function updateTreatmentPlan(uuidPlan, uuidConsult, diagnosisRequest, plan) {
1723
+ return this.api.put(this.baseURL + "/v1/treatment-plans/" + uuidPlan, {
1724
+ uuidConsult: uuidConsult,
1725
+ diagnosis: diagnosisRequest,
1726
+ plan: plan
1727
+ });
1728
+ };
1729
+
1730
+ _proto.acceptTreatmentPlan = function acceptTreatmentPlan(uuidPlan, uuidConsult) {
1731
+ return this.api.put(this.baseURL + "/v1/treatment-plans/" + uuidPlan + "/accept", {
1732
+ uuidConsult: uuidConsult
1733
+ });
1734
+ }
1735
+ /**
1736
+ * retrieves all the drugs of the specified practice
1737
+ * @param uuidPractice
1738
+ */
1739
+ ;
1740
+
1741
+ _proto.getAllDrugs =
1742
+ /*#__PURE__*/
1743
+ function () {
1744
+ var _getAllDrugs = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(uuidPractice) {
1745
+ var res;
1746
+ return runtime_1.wrap(function _callee$(_context) {
1747
+ while (1) {
1748
+ switch (_context.prev = _context.next) {
1749
+ case 0:
1750
+ _context.next = 2;
1751
+ return this.api.get(this.baseURL + "/v1/drugs/practice/" + uuidPractice);
1752
+
1753
+ case 2:
1754
+ res = _context.sent;
1755
+
1756
+ if (!(res && res.foundDrugs)) {
1757
+ _context.next = 5;
1758
+ break;
1759
+ }
1760
+
1761
+ return _context.abrupt("return", res.foundDrugs);
1762
+
1763
+ case 5:
1764
+ return _context.abrupt("return", undefined);
1765
+
1766
+ case 6:
1767
+ case "end":
1768
+ return _context.stop();
1769
+ }
1770
+ }
1771
+ }, _callee, this);
1772
+ }));
1773
+
1774
+ function getAllDrugs(_x) {
1775
+ return _getAllDrugs.apply(this, arguments);
1776
+ }
1777
+
1778
+ return getAllDrugs;
1779
+ }();
1780
+
1781
+ return DiagnosisService;
1782
+ }();
1783
+
1784
+ var GuardService = /*#__PURE__*/function () {
1785
+ function GuardService(api, baseURL) {
1786
+ this.api = api;
1787
+ this.baseURL = baseURL;
1788
+ this.api.setAuthRefreshFn(this.authRefresh.bind(this));
1789
+ this.identityCache = {};
1790
+ this.whoAmICache = {};
1791
+ }
1792
+ /**
1793
+ * Will replace access and refresh tokens with `tokens`
1794
+ *
1795
+ * Note:
1796
+ * ```typescript
1797
+ * setTokens({accessToken: undefined, refreshToken: 'aTokenValue'}) // will erase accessToken and set refreshToken with 'aTokenValue'
1798
+ * setTokens({refreshToken: 'aTokenValue'}) // will keep actual value of accessToken and set refreshToken with 'aTokenValue'
1799
+ *
1800
+ * ```
1801
+ * @param tokens
1802
+ */
1803
+
1804
+
1805
+ var _proto = GuardService.prototype;
1806
+
1807
+ _proto.setTokens = function setTokens(tokens) {
1808
+ this.api.setTokens(_extends({}, this.api.getTokens(), tokens));
1809
+ }
1810
+ /**
1811
+ * Allow to retrieve an access token and a refresh token in order
1812
+ * to do authenticated request afterward
1813
+ *
1814
+ * @param req The credentials required to get an access token
1815
+ * @returns AuthTokenResponse
1816
+ */
1817
+ ;
1818
+
1819
+ _proto.authToken =
1820
+ /*#__PURE__*/
1821
+ function () {
1822
+ var _authToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(req) {
1823
+ var resp, config, _e$response, code;
1824
+
1825
+ return runtime_1.wrap(function _callee$(_context) {
1826
+ while (1) {
1827
+ switch (_context.prev = _context.next) {
1828
+ case 0:
1829
+ _context.prev = 0;
1830
+ config = {
1831
+ skipAuthRefresh: true
1832
+ };
1833
+ _context.next = 4;
1834
+ return this.api.post(this.baseURL + "/v1/auth/token", req, config);
1835
+
1836
+ case 4:
1837
+ resp = _context.sent;
1838
+ this.api.setTokens({
1839
+ accessToken: resp.accessToken,
1840
+ refreshToken: resp.refreshToken
1841
+ });
1842
+ _context.next = 19;
1843
+ break;
1844
+
1845
+ case 8:
1846
+ _context.prev = 8;
1847
+ _context.t0 = _context["catch"](0);
1848
+
1849
+ if (!_context.t0.isAxiosError) {
1850
+ _context.next = 18;
1851
+ break;
1852
+ }
1853
+
1854
+ code = (_e$response = _context.t0.response) == null ? void 0 : _e$response.status;
1855
+ _context.t1 = code;
1856
+ _context.next = _context.t1 === 400 ? 15 : _context.t1 === 500 ? 16 : _context.t1 === 401 ? 17 : 17;
1857
+ break;
1858
+
1859
+ case 15:
1860
+ throw new AuthenticationBadRequest();
1861
+
1862
+ case 16:
1863
+ throw new AuthenticationServerError();
1864
+
1865
+ case 17:
1866
+ throw new AuthenticationFailed();
1867
+
1868
+ case 18:
1869
+ throw new AuthenticationFailed();
1870
+
1871
+ case 19:
1872
+ return _context.abrupt("return", resp);
1873
+
1874
+ case 20:
1875
+ case "end":
1876
+ return _context.stop();
1877
+ }
1878
+ }
1879
+ }, _callee, this, [[0, 8]]);
1880
+ }));
1881
+
1882
+ function authToken(_x) {
1883
+ return _authToken.apply(this, arguments);
1884
+ }
1885
+
1886
+ return authToken;
1887
+ }()
1888
+ /**
1889
+ * Get new access and refresh token
1890
+ *
1891
+ * @returns AuthTokenResponse
1892
+ */
1893
+ ;
1894
+
1895
+ _proto.authRefresh =
1896
+ /*#__PURE__*/
1897
+ function () {
1898
+ var _authRefresh = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(refreshToken) {
1899
+ var config;
1900
+ return runtime_1.wrap(function _callee2$(_context2) {
1901
+ while (1) {
1902
+ switch (_context2.prev = _context2.next) {
1903
+ case 0:
1904
+ config = {
1905
+ skipAuthRefresh: true,
1906
+ useRefreshToken: true
1907
+ };
1908
+ return _context2.abrupt("return", this.api.put(this.baseURL + "/v1/auth/token", null, config));
1909
+
1910
+ case 2:
1911
+ case "end":
1912
+ return _context2.stop();
1913
+ }
1914
+ }
1915
+ }, _callee2, this);
1916
+ }));
1917
+
1918
+ function authRefresh(_x2) {
1919
+ return _authRefresh.apply(this, arguments);
1920
+ }
1921
+
1922
+ return authRefresh;
1923
+ }()
1924
+ /**
1925
+ * Call guard to overwrite existing refresh token cookie
1926
+ *
1927
+ * @returns void
1928
+ */
1929
+ ;
1930
+
1931
+ _proto.authLogout =
1932
+ /*#__PURE__*/
1933
+ function () {
1934
+ var _authLogout = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
1935
+ return runtime_1.wrap(function _callee3$(_context3) {
1936
+ while (1) {
1937
+ switch (_context3.prev = _context3.next) {
1938
+ case 0:
1939
+ return _context3.abrupt("return", this.api.get(this.baseURL + "/v1/auth/logout"));
1940
+
1941
+ case 1:
1942
+ case "end":
1943
+ return _context3.stop();
1944
+ }
1945
+ }
1946
+ }, _callee3, this);
1947
+ }));
1948
+
1949
+ function authLogout() {
1950
+ return _authLogout.apply(this, arguments);
1951
+ }
1952
+
1953
+ return authLogout;
1954
+ }()
1955
+ /**
1956
+ * Call guard to attempt account recovery
1957
+ *
1958
+ * @param req The email address / practice of the account to recover
1959
+ * @returns void
1960
+ */
1961
+ ;
1962
+
1963
+ _proto.authRecover =
1964
+ /*#__PURE__*/
1965
+ function () {
1966
+ var _authRecover = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(req) {
1967
+ return runtime_1.wrap(function _callee4$(_context4) {
1968
+ while (1) {
1969
+ switch (_context4.prev = _context4.next) {
1970
+ case 0:
1971
+ return _context4.abrupt("return", this.api.post(this.baseURL + "/v1/auth/recover", req));
1972
+
1973
+ case 1:
1974
+ case "end":
1975
+ return _context4.stop();
1976
+ }
1977
+ }
1978
+ }, _callee4, this);
1979
+ }));
1980
+
1981
+ function authRecover(_x3) {
1982
+ return _authRecover.apply(this, arguments);
1983
+ }
1984
+
1985
+ return authRecover;
1986
+ }()
1987
+ /**
1988
+ * Allow to create a new identity. The identity will then need to be confirmed
1989
+ * via an email link
1990
+ *
1991
+ * @param req the information about the new identity to create
1992
+ * @returns IdentityResponse
1993
+ */
1994
+ ;
1995
+
1996
+ _proto.identityCreate =
1997
+ /*#__PURE__*/
1998
+ function () {
1999
+ var _identityCreate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(req) {
2000
+ var resp, _e$response2, code;
2001
+
2002
+ return runtime_1.wrap(function _callee5$(_context5) {
2003
+ while (1) {
2004
+ switch (_context5.prev = _context5.next) {
2005
+ case 0:
2006
+ _context5.prev = 0;
2007
+ _context5.next = 3;
2008
+ return this.api.post(this.baseURL + "/v1/identities", req);
2009
+
2010
+ case 3:
2011
+ resp = _context5.sent;
2012
+ this.api.setTokens({
2013
+ refreshToken: resp.refreshToken
2014
+ });
2015
+ _context5.next = 18;
2016
+ break;
2017
+
2018
+ case 7:
2019
+ _context5.prev = 7;
2020
+ _context5.t0 = _context5["catch"](0);
2021
+
2022
+ if (!_context5.t0.isAxiosError) {
2023
+ _context5.next = 17;
2024
+ break;
2025
+ }
2026
+
2027
+ code = (_e$response2 = _context5.t0.response) == null ? void 0 : _e$response2.status;
2028
+ _context5.t1 = code;
2029
+ _context5.next = _context5.t1 === 400 ? 14 : _context5.t1 === 409 ? 15 : _context5.t1 === 500 ? 16 : 16;
2030
+ break;
2031
+
2032
+ case 14:
2033
+ throw new IdentityCreationBadRequest();
2034
+
2035
+ case 15:
2036
+ throw new IdentityCreationConflict();
2037
+
2038
+ case 16:
2039
+ throw new IdentityCreationFailed();
2040
+
2041
+ case 17:
2042
+ throw new IdentityCreationFailed();
2043
+
2044
+ case 18:
2045
+ return _context5.abrupt("return", resp);
2046
+
2047
+ case 19:
2048
+ case "end":
2049
+ return _context5.stop();
2050
+ }
2051
+ }
2052
+ }, _callee5, this, [[0, 7]]);
2053
+ }));
2054
+
2055
+ function identityCreate(_x4) {
2056
+ return _identityCreate.apply(this, arguments);
2057
+ }
2058
+
2059
+ return identityCreate;
2060
+ }()
2061
+ /**
2062
+ * Retrieve an identity. Will return public fields only when requested
2063
+ * without authentication
2064
+ *
2065
+ * @param identityID Unique id of the identity to retrieve
2066
+ * @returns IdentityResponse
2067
+ */
2068
+ ;
2069
+
2070
+ _proto.identityGet =
2071
+ /*#__PURE__*/
2072
+ function () {
2073
+ var _identityGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(identityID) {
2074
+ var _tokens$accessToken, _tokens$refreshToken;
2075
+
2076
+ var tokens, cacheKey;
2077
+ return runtime_1.wrap(function _callee6$(_context6) {
2078
+ while (1) {
2079
+ switch (_context6.prev = _context6.next) {
2080
+ case 0:
2081
+ tokens = this.api.getTokens();
2082
+ cacheKey = ((_tokens$accessToken = tokens.accessToken) != null ? _tokens$accessToken : '') + ((_tokens$refreshToken = tokens.refreshToken) != null ? _tokens$refreshToken : '') + identityID;
2083
+
2084
+ if (!(!tokens.accessToken || !this.identityCache[cacheKey])) {
2085
+ _context6.next = 6;
2086
+ break;
2087
+ }
2088
+
2089
+ _context6.next = 5;
2090
+ return this.api.get(this.baseURL + "/v1/identities/" + identityID);
2091
+
2092
+ case 5:
2093
+ this.identityCache[cacheKey] = _context6.sent;
2094
+
2095
+ case 6:
2096
+ return _context6.abrupt("return", this.identityCache[cacheKey]);
2097
+
2098
+ case 7:
2099
+ case "end":
2100
+ return _context6.stop();
2101
+ }
2102
+ }
2103
+ }, _callee6, this);
2104
+ }));
2105
+
2106
+ function identityGet(_x5) {
2107
+ return _identityGet.apply(this, arguments);
2108
+ }
2109
+
2110
+ return identityGet;
2111
+ }()
2112
+ /**
2113
+ * Get information about the current authenticated user
2114
+ *
2115
+ * @param refreshCache if true it will refresh the whoAmI cache (default: false)
2116
+ * @returns WhoAmIResponse
2117
+ */
2118
+ ;
2119
+
2120
+ _proto.whoAmI =
2121
+ /*#__PURE__*/
2122
+ function () {
2123
+ var _whoAmI = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(refreshCache) {
2124
+ var _this$api$getTokens$a;
2125
+
2126
+ var cacheKey;
2127
+ return runtime_1.wrap(function _callee7$(_context7) {
2128
+ while (1) {
2129
+ switch (_context7.prev = _context7.next) {
2130
+ case 0:
2131
+ if (refreshCache === void 0) {
2132
+ refreshCache = false;
2133
+ }
2134
+
2135
+ cacheKey = (_this$api$getTokens$a = this.api.getTokens().accessToken) != null ? _this$api$getTokens$a : '';
2136
+
2137
+ if (!(!this.whoAmICache[cacheKey] || refreshCache)) {
2138
+ _context7.next = 6;
2139
+ break;
2140
+ }
2141
+
2142
+ _context7.next = 5;
2143
+ return this.api.get(this.baseURL + "/v1/auth/whoami");
2144
+
2145
+ case 5:
2146
+ this.whoAmICache[cacheKey] = _context7.sent;
2147
+
2148
+ case 6:
2149
+ return _context7.abrupt("return", this.whoAmICache[cacheKey]);
2150
+
2151
+ case 7:
2152
+ case "end":
2153
+ return _context7.stop();
2154
+ }
2155
+ }
2156
+ }, _callee7, this);
2157
+ }));
2158
+
2159
+ function whoAmI(_x6) {
2160
+ return _whoAmI.apply(this, arguments);
2161
+ }
2162
+
2163
+ return whoAmI;
2164
+ }()
2165
+ /**
2166
+ * Update an existing identity
2167
+ *
2168
+ * @param identityID unique id of identity to update
2169
+ * @param req update request
2170
+ * @returns IdentityResponse
2171
+ */
2172
+ ;
2173
+
2174
+ _proto.identityUpdate =
2175
+ /*#__PURE__*/
2176
+ function () {
2177
+ var _identityUpdate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(identityID, req) {
2178
+ return runtime_1.wrap(function _callee8$(_context8) {
2179
+ while (1) {
2180
+ switch (_context8.prev = _context8.next) {
2181
+ case 0:
2182
+ return _context8.abrupt("return", this.api.put(this.baseURL + "/v1/identities/" + identityID, req));
2183
+
2184
+ case 1:
2185
+ case "end":
2186
+ return _context8.stop();
2187
+ }
2188
+ }
2189
+ }, _callee8, this);
2190
+ }));
2191
+
2192
+ function identityUpdate(_x7, _x8) {
2193
+ return _identityUpdate.apply(this, arguments);
2194
+ }
2195
+
2196
+ return identityUpdate;
2197
+ }()
2198
+ /**
2199
+ * Return base64 data representing a QR code that the
2200
+ * current identity need in order to use MFA
2201
+ *
2202
+ * @param identityID unique id of the identity
2203
+ * @param password the identity password (already hashed and in base64)
2204
+ * @returns QRCodeResponse
2205
+ */
2206
+ ;
2207
+
2208
+ _proto.identityMFAQRCode =
2209
+ /*#__PURE__*/
2210
+ function () {
2211
+ var _identityMFAQRCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(identityID, password) {
2212
+ var req;
2213
+ return runtime_1.wrap(function _callee9$(_context9) {
2214
+ while (1) {
2215
+ switch (_context9.prev = _context9.next) {
2216
+ case 0:
2217
+ req = {
2218
+ password: password
2219
+ };
2220
+ return _context9.abrupt("return", this.api.post(this.baseURL + "/v1/identities/" + identityID + "/mfa", req, {
2221
+ headers: {
2222
+ 'Accept': 'application/json'
2223
+ }
2224
+ }));
2225
+
2226
+ case 2:
2227
+ case "end":
2228
+ return _context9.stop();
2229
+ }
2230
+ }
2231
+ }, _callee9, this);
2232
+ }));
2233
+
2234
+ function identityMFAQRCode(_x9, _x10) {
2235
+ return _identityMFAQRCode.apply(this, arguments);
2236
+ }
2237
+
2238
+ return identityMFAQRCode;
2239
+ }();
2240
+
2241
+ return GuardService;
2242
+ }();
2243
+
2244
+ var PracticeService = /*#__PURE__*/function () {
2245
+ function PracticeService(api, baseURL) {
2246
+ this.api = api;
2247
+ this.baseURL = baseURL;
2248
+ }
2249
+ /**
2250
+ * This function get the practice from the URL of a practice
2251
+ * It is the entry point of our web apps
2252
+ * @param practiceURL URL of the practice to search
2253
+ * @param hydratePracticeConfigs (optional) if set true it the Practice field configs will be set
2254
+ * @param accounts (optional) if set true it the Practice field accounts will be set
2255
+ * @returns the found practice or undefined
2256
+ */
2257
+
2258
+
2259
+ var _proto = PracticeService.prototype;
2260
+
2261
+ _proto.practiceGetFromURL = function practiceGetFromURL(practiceURL, params) {
2262
+ return this.api.get(this.baseURL + "/v1/practices", {
2263
+ params: _extends({
2264
+ url_practice: practiceURL
2265
+ }, params)
2266
+ });
2267
+ };
2268
+
2269
+ _proto.practiceGetFromUuid = function practiceGetFromUuid(practiceUuid, locale, withAccounts) {
2270
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid, {
2271
+ params: {
2272
+ locale: locale,
2273
+ accounts: withAccounts
2274
+ }
2275
+ });
2276
+ } /// Practice Configs
2277
+
2278
+ /**
2279
+ * This function retrieves all configs of a specific practice
2280
+ * @param practiceUuid uuid of the practice
2281
+ * @returns the practice configs
2282
+ */
2283
+ ;
2284
+
2285
+ _proto.practiceConfigGetFromPracticeUuid = function practiceConfigGetFromPracticeUuid(practiceUuid) {
2286
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/configs");
2287
+ }
2288
+ /**
2289
+ * This function retrieves a specific config of a practice
2290
+ * @param practiceUuid uuid of the practice
2291
+ * @param kind of the config
2292
+ * @returns the practice config
2293
+ */
2294
+ ;
2295
+
2296
+ _proto.practiceConfigGetByKindForPracticeUuid = function practiceConfigGetByKindForPracticeUuid(practiceUuid, kind) {
2297
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/configs/" + kind);
2298
+ }
2299
+ /**
2300
+ * This function creates a config for a specific practice
2301
+ * @param practiceUuid uuid of the practice
2302
+ * @param config the config to add to the practice
2303
+ * @returns the created practice config
2304
+ */
2305
+ ;
2306
+
2307
+ _proto.practiceConfigCreateForPracticeUuid = function practiceConfigCreateForPracticeUuid(practiceUuid, config) {
2308
+ return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/configs", config);
2309
+ }
2310
+ /**
2311
+ * This function updates a specific config of a practice
2312
+ * @param practiceUuid uuid of the practice
2313
+ * @param config the config to update
2314
+ * @returns the practice config
2315
+ */
2316
+ ;
2317
+
2318
+ _proto.practiceConfigUpdate = function practiceConfigUpdate(config) {
2319
+ return this.api.put(this.baseURL + "/v1/practices/" + config.uuidPractice + "/configs/" + config.kind, config);
2320
+ } /// Accounts
2321
+ ;
2322
+
2323
+ _proto.practiceGetAccounts = function practiceGetAccounts(practiceUuid) {
2324
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/accounts");
2325
+ };
2326
+
2327
+ _proto.practiceGetAccount = function practiceGetAccount(practiceUuid, accountUuid) {
2328
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/accounts/" + accountUuid);
2329
+ } /// Workflows
2330
+ ;
2331
+
2332
+ _proto.practiceGetWorkflows = function practiceGetWorkflows(practiceUuid) {
2333
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/workflows");
2334
+ };
2335
+
2336
+ _proto.practiceGetWorkflow = function practiceGetWorkflow(practiceUuid, workflowType) {
2337
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/workflows/" + workflowType);
2338
+ } /// Plans
2339
+ ;
2340
+
2341
+ _proto.practiceGetPlans = function practiceGetPlans(practiceUuid, planType) {
2342
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans", {
2343
+ params: {
2344
+ kind: planType
2345
+ }
2346
+ });
2347
+ };
2348
+
2349
+ _proto.practiceGetPlan = function practiceGetPlan(practiceUuid, planId) {
2350
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans/" + planId);
2351
+ };
2352
+
2353
+ _proto.practiceGetPlanPrices = function practiceGetPlanPrices(practiceUuid, planId) {
2354
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans/" + planId + "/prices");
2355
+ } // Payments
2356
+ ;
2357
+
2358
+ _proto.practiceGetPayments = function practiceGetPayments(practiceUuid, planType) {
2359
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments", {
2360
+ params: {
2361
+ kind: planType
2362
+ }
2363
+ });
2364
+ };
2365
+
2366
+ _proto.practiceGetPayment = function practiceGetPayment(practiceUuid, idStripeInvoiceOrPaymentIntent) {
2367
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/" + idStripeInvoiceOrPaymentIntent);
2368
+ };
2369
+
2370
+ _proto.practiceGetPaymentForStripePaymentIntentWithID = function practiceGetPaymentForStripePaymentIntentWithID(practiceUuid, stripePaymentIntentId) {
2371
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/" + stripePaymentIntentId);
2372
+ } // Payments Intent
2373
+ ;
2374
+
2375
+ _proto.practiceGetPaymentsIntents = function practiceGetPaymentsIntents(practiceUuid, planType) {
2376
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents", {
2377
+ params: {
2378
+ kind: planType
2379
+ }
2380
+ });
2381
+ }
2382
+ /**
2383
+ * This function return the user hased email to be use for creating payment intent
2384
+ * @param email the email to hash
2385
+ * @returns a hashed email
2386
+ */
2387
+ ;
2388
+
2389
+ _proto.getPaymentIntentHashedEmail = function getPaymentIntentHashedEmail(email) {
2390
+ return Buffer.from(sha256().update(email.toLowerCase()).digest('hex'), 'hex').toString('base64');
2391
+ };
2392
+
2393
+ _proto.practiceCreatePaymentsIntent = function practiceCreatePaymentsIntent(practiceUuid, planId, userEmail, isoLocality, url_subdomain, promotionCode) {
2394
+ return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/", {
2395
+ idPlan: planId,
2396
+ hashUserEmail: userEmail ? this.getPaymentIntentHashedEmail(userEmail) : undefined,
2397
+ isoLocality: isoLocality
2398
+ }, {
2399
+ params: {
2400
+ url_subdomain: url_subdomain,
2401
+ promotionCode: promotionCode
2402
+ }
2403
+ });
2404
+ };
2405
+
2406
+ _proto.practiceGetPaymentsIntent = function practiceGetPaymentsIntent(practiceUuid, paymentIntentId) {
2407
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/" + paymentIntentId);
2408
+ };
2409
+
2410
+ _proto.practiceUpdatePaymentsIntent = function practiceUpdatePaymentsIntent(practiceUuid, idPraticePaymentIntent, practicePaymentIntent, userEmail, promotionCode) {
2411
+ return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/" + idPraticePaymentIntent, _extends({}, practicePaymentIntent, {
2412
+ hashUserEmail: userEmail ? this.getPaymentIntentHashedEmail(userEmail) : undefined
2413
+ }), {
2414
+ params: {
2415
+ promotionCode: promotionCode
2416
+ }
2417
+ });
2418
+ } // Practitioner
2419
+ ;
2420
+
2421
+ _proto.practiceGetPractitioners = function practiceGetPractitioners(practiceUuid) {
2422
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners");
2423
+ };
2424
+
2425
+ _proto.practiceUpdatePractitioner = function practiceUpdatePractitioner(practiceUuid, practitionerUuid, requestBody) {
2426
+ return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid, requestBody);
2427
+ };
2428
+
2429
+ _proto.practiceGetPractitioner = function practiceGetPractitioner(practiceUuid, practitionerUuid) {
2430
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid);
2431
+ } // Practitioner Licenses
2432
+ ;
2433
+
2434
+ _proto.practiceGetPractitionerLicenses = function practiceGetPractitionerLicenses(practiceUuid, practitionerUuid) {
2435
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses");
2436
+ };
2437
+
2438
+ _proto.practiceCreatePractitionerLicense = function practiceCreatePractitionerLicense(practiceUuid, practitionerUuid, requestBody) {
2439
+ return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses", requestBody);
2440
+ };
2441
+
2442
+ _proto.practiceUpdatePractitionerLicense = function practiceUpdatePractitionerLicense(practiceUuid, practitionerUuid, licenseId, requestBody) {
2443
+ return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses/" + licenseId, requestBody);
2444
+ };
2445
+
2446
+ _proto.practiceGetPractitionerLicense = function practiceGetPractitionerLicense(practiceUuid, practitionerUuid, licenseId) {
2447
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses/" + licenseId);
2448
+ } // Practitioner Preferences
2449
+ ;
2450
+
2451
+ _proto.practiceGetPractitionerPreferences = function practiceGetPractitionerPreferences(practiceUuid, practitionerUuid) {
2452
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences");
2453
+ };
2454
+
2455
+ _proto.practiceCreatePractitionerPreference = function practiceCreatePractitionerPreference(practiceUuid, practitionerUuid, requestBody) {
2456
+ return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences", requestBody);
2457
+ };
2458
+
2459
+ _proto.practiceUpdatePractitionerPreference = function practiceUpdatePractitionerPreference(practiceUuid, practitionerUuid, preferenceId, requestBody) {
2460
+ return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences/" + preferenceId, requestBody);
2461
+ };
2462
+
2463
+ _proto.practiceGetPractitionerPreference = function practiceGetPractitionerPreference(practiceUuid, practitionerUuid, preferenceId) {
2464
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences/" + preferenceId);
2465
+ } // Practitioner Roles
2466
+ ;
2467
+
2468
+ _proto.practiceGetPractitionerRoles = function practiceGetPractitionerRoles(practiceUuid, practitionerUuid) {
2469
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles");
2470
+ };
2471
+
2472
+ _proto.practiceCreatePractitionerRole = function practiceCreatePractitionerRole(practiceUuid, practitionerUuid, requestBody) {
2473
+ return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles", requestBody);
2474
+ };
2475
+
2476
+ _proto.practiceDeletePractitionerRoles = function practiceDeletePractitionerRoles(practiceUuid, practitionerUuid) {
2477
+ return this.api.deleteRequest(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles");
2478
+ };
2479
+
2480
+ _proto.practiceUpdatePractitionerRole = function practiceUpdatePractitionerRole(practiceUuid, practitionerUuid, roleId, requestBody) {
2481
+ return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId, requestBody);
2482
+ };
2483
+
2484
+ _proto.practiceGetPractitionerRole = function practiceGetPractitionerRole(practiceUuid, practitionerUuid, roleId) {
2485
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId);
2486
+ };
2487
+
2488
+ _proto.practiceDeletePractitionerRole = function practiceDeletePractitionerRole(practiceUuid, practitionerUuid, roleId) {
2489
+ return this.api.deleteRequest(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId);
2490
+ } // Practitioner signature
2491
+
2492
+ /**
2493
+ * This function returns the practitioner's signature as a Blob
2494
+ * @param practiceUuid the practice uuid of the practitioner
2495
+ * @param practitionerUuid the practitioner uuid
2496
+ * @returns a blob representing the signature
2497
+ */
2498
+ ;
2499
+
2500
+ _proto.practiceGetPractitionerSignature = function practiceGetPractitionerSignature(practiceUuid, practitionerUuid) {
2501
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/signature", {
2502
+ responseType: 'blob'
2503
+ });
2504
+ } // Assignments
2505
+ ;
2506
+
2507
+ _proto.practiceGetAssignments = function practiceGetAssignments(practiceUuid) {
2508
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments");
2509
+ };
2510
+
2511
+ _proto.practiceCreateAssignment = function practiceCreateAssignment(practiceUuid, requestBody) {
2512
+ return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments", requestBody);
2513
+ };
2514
+
2515
+ _proto.practiceUpdateAssignment = function practiceUpdateAssignment(practiceUuid, assignmentId, requestBody) {
2516
+ return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments/" + assignmentId, requestBody);
2517
+ };
2518
+
2519
+ _proto.practiceGetAssignment = function practiceGetAssignment(practiceUuid, assignmentId) {
2520
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments/" + assignmentId);
2521
+ } // Quotas
2522
+ ;
2523
+
2524
+ _proto.practiceGetQuotas = function practiceGetQuotas(practiceUuid) {
2525
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/quotas");
2526
+ };
2527
+
2528
+ _proto.practiceGetQuota = function practiceGetQuota(practiceUuid, quotaId) {
2529
+ return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/quotas/" + quotaId);
2530
+ };
2531
+
2532
+ return PracticeService;
2533
+ }();
2534
+
2535
+ var TellerService = /*#__PURE__*/function () {
2536
+ function TellerService(api, baseURL) {
2537
+ this.api = api;
2538
+ this.baseURL = baseURL;
2539
+ }
2540
+
2541
+ var _proto = TellerService.prototype;
2542
+
2543
+ _proto.lockboxDataStore = /*#__PURE__*/function () {
2544
+ var _lockboxDataStore = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(lockboxUuid, req, lockboxOwnerUuid, previousDataUuid) {
2545
+ return runtime_1.wrap(function _callee$(_context) {
2546
+ while (1) {
2547
+ switch (_context.prev = _context.next) {
2548
+ case 0:
2549
+ return _context.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data", req, {
2550
+ params: {
2551
+ lockbox_owner_uuid: lockboxOwnerUuid,
2552
+ data_uuid: previousDataUuid
2553
+ }
2554
+ }));
2555
+
2556
+ case 1:
2557
+ case "end":
2558
+ return _context.stop();
2559
+ }
2560
+ }
2561
+ }, _callee, this);
2562
+ }));
2563
+
2564
+ function lockboxDataStore(_x, _x2, _x3, _x4) {
2565
+ return _lockboxDataStore.apply(this, arguments);
2566
+ }
2567
+
2568
+ return lockboxDataStore;
2569
+ }();
2570
+
2571
+ _proto.updateConsultByUUID = function updateConsultByUUID(patientUuid, uuidConsult, statusMedical, neverExpires) {
2572
+ return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult, {
2573
+ patientUuid: patientUuid,
2574
+ statusMedical: statusMedical,
2575
+ neverExpires: neverExpires
2576
+ });
2577
+ };
2578
+
2579
+ return TellerService;
2580
+ }();
2581
+
2582
+ var VaultService = /*#__PURE__*/function () {
2583
+ function VaultService(api, baseURL) {
2584
+ this.api = api;
2585
+ this.baseURL = baseURL;
2586
+ }
2587
+
2588
+ var _proto = VaultService.prototype;
2589
+
2590
+ _proto.lockboxCreate = /*#__PURE__*/function () {
2591
+ var _lockboxCreate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(lockboxMetadata) {
2592
+ return runtime_1.wrap(function _callee$(_context) {
2593
+ while (1) {
2594
+ switch (_context.prev = _context.next) {
2595
+ case 0:
2596
+ return _context.abrupt("return", this.api.post(this.baseURL + "/v1/lockbox", lockboxMetadata));
2597
+
2598
+ case 1:
2599
+ case "end":
2600
+ return _context.stop();
2601
+ }
2602
+ }
2603
+ }, _callee, this);
2604
+ }));
2605
+
2606
+ function lockboxCreate(_x) {
2607
+ return _lockboxCreate.apply(this, arguments);
2608
+ }
2609
+
2610
+ return lockboxCreate;
2611
+ }();
2612
+
2613
+ _proto.lockboxMetadataAdd = /*#__PURE__*/function () {
2614
+ var _lockboxMetadataAdd = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(lockboxUuid, lockboxMetadata, lockboxOwnerUuid) {
2615
+ return runtime_1.wrap(function _callee2$(_context2) {
2616
+ while (1) {
2617
+ switch (_context2.prev = _context2.next) {
2618
+ case 0:
2619
+ return _context2.abrupt("return", this.api.put(this.baseURL + "/v1/lockbox/" + lockboxUuid, lockboxMetadata, {
2620
+ params: {
2621
+ lockbox_owner_uuid: lockboxOwnerUuid
2622
+ }
2623
+ }));
2624
+
2625
+ case 1:
2626
+ case "end":
2627
+ return _context2.stop();
2628
+ }
2629
+ }
2630
+ }, _callee2, this);
2631
+ }));
2632
+
2633
+ function lockboxMetadataAdd(_x2, _x3, _x4) {
2634
+ return _lockboxMetadataAdd.apply(this, arguments);
2635
+ }
2636
+
2637
+ return lockboxMetadataAdd;
2638
+ }();
2639
+
2640
+ _proto.lockboxSecretGet = /*#__PURE__*/function () {
2641
+ var _lockboxSecretGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(lockboxUuid, lockboxOwnerUuid) {
2642
+ return runtime_1.wrap(function _callee3$(_context3) {
2643
+ while (1) {
2644
+ switch (_context3.prev = _context3.next) {
2645
+ case 0:
2646
+ return _context3.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/secret", {
2647
+ params: {
2648
+ lockbox_owner_uuid: lockboxOwnerUuid
2649
+ }
2650
+ }));
2651
+
2652
+ case 1:
2653
+ case "end":
2654
+ return _context3.stop();
2655
+ }
2656
+ }
2657
+ }, _callee3, this);
2658
+ }));
2659
+
2660
+ function lockboxSecretGet(_x5, _x6) {
2661
+ return _lockboxSecretGet.apply(this, arguments);
2662
+ }
2663
+
2664
+ return lockboxSecretGet;
2665
+ }();
2666
+
2667
+ _proto.lockboxGrant = /*#__PURE__*/function () {
2668
+ var _lockboxGrant = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(lockboxUuid, req, lockboxOwnerUuid) {
2669
+ return runtime_1.wrap(function _callee4$(_context4) {
2670
+ while (1) {
2671
+ switch (_context4.prev = _context4.next) {
2672
+ case 0:
2673
+ return _context4.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/grant", req, {
2674
+ params: {
2675
+ lockbox_owner_uuid: lockboxOwnerUuid
2676
+ }
2677
+ }));
2678
+
2679
+ case 1:
2680
+ case "end":
2681
+ return _context4.stop();
2682
+ }
2683
+ }
2684
+ }, _callee4, this);
2685
+ }));
2686
+
2687
+ function lockboxGrant(_x7, _x8, _x9) {
2688
+ return _lockboxGrant.apply(this, arguments);
2689
+ }
2690
+
2691
+ return lockboxGrant;
2692
+ }()
2693
+ /**
2694
+ * Get all lockboxes granted to user
2695
+ * @param filter filter of lockbox metadata
2696
+ * @returns decrypted lockboxes granted to user
2697
+ */
2698
+ ;
2699
+
2700
+ _proto.grantsGet =
2701
+ /*#__PURE__*/
2702
+ function () {
2703
+ var _grantsGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
2704
+ return runtime_1.wrap(function _callee5$(_context5) {
2705
+ while (1) {
2706
+ switch (_context5.prev = _context5.next) {
2707
+ case 0:
2708
+ return _context5.abrupt("return", this.api.get(this.baseURL + "/v1/grants"));
2709
+
2710
+ case 1:
2711
+ case "end":
2712
+ return _context5.stop();
2713
+ }
2714
+ }
2715
+ }, _callee5, this);
2716
+ }));
2717
+
2718
+ function grantsGet() {
2719
+ return _grantsGet.apply(this, arguments);
2720
+ }
2721
+
2722
+ return grantsGet;
2723
+ }()
2724
+ /**
2725
+ * This function create or update a data into the vault.
2726
+ * @note At creation it is necessary to have all `req` filled
2727
+ * @note When setting `previousDataUuid` you are updating the data. `req` metadata fields are optional.
2728
+ * @param lockboxUuid The lockbox uuid the data will be stored in
2729
+ * @param req The request (please see notes)
2730
+ * @param lockboxOwnerUuid The uuid of the owner of the lockbox (@deprecated)
2731
+ * @param previousDataUuid The data uuid of the data you want to update
2732
+ * @returns
2733
+ */
2734
+ ;
2735
+
2736
+ _proto.lockboxDataStore =
2737
+ /*#__PURE__*/
2738
+ function () {
2739
+ var _lockboxDataStore = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(lockboxUuid, req, lockboxOwnerUuid, previousDataUuid) {
2740
+ return runtime_1.wrap(function _callee6$(_context6) {
2741
+ while (1) {
2742
+ switch (_context6.prev = _context6.next) {
2743
+ case 0:
2744
+ return _context6.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data", req, {
2745
+ params: {
2746
+ lockbox_owner_uuid: lockboxOwnerUuid,
2747
+ data_uuid: previousDataUuid
2748
+ }
2749
+ }));
2750
+
2751
+ case 1:
2752
+ case "end":
2753
+ return _context6.stop();
2754
+ }
2755
+ }
2756
+ }, _callee6, this);
2757
+ }));
2758
+
2759
+ function lockboxDataStore(_x10, _x11, _x12, _x13) {
2760
+ return _lockboxDataStore.apply(this, arguments);
2761
+ }
2762
+
2763
+ return lockboxDataStore;
2764
+ }();
2765
+
2766
+ _proto.lockboxDataGet = /*#__PURE__*/function () {
2767
+ var _lockboxDataGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(lockboxUuid, dataUuid, lockboxOwnerUuid, stream) {
2768
+ var data;
2769
+ return runtime_1.wrap(function _callee7$(_context7) {
2770
+ while (1) {
2771
+ switch (_context7.prev = _context7.next) {
2772
+ case 0:
2773
+ if (stream === void 0) {
2774
+ stream = true;
2775
+ }
2776
+
2777
+ _context7.next = 3;
2778
+ return this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data/" + dataUuid, {
2779
+ params: {
2780
+ lockbox_owner_uuid: lockboxOwnerUuid,
2781
+ stream: stream
2782
+ }
2783
+ });
2784
+
2785
+ case 3:
2786
+ data = _context7.sent;
2787
+
2788
+ if (!stream) {
2789
+ _context7.next = 6;
2790
+ break;
2791
+ }
2792
+
2793
+ return _context7.abrupt("return", {
2794
+ data: data
2795
+ });
2796
+
2797
+ case 6:
2798
+ return _context7.abrupt("return", data);
2799
+
2800
+ case 7:
2801
+ case "end":
2802
+ return _context7.stop();
2803
+ }
2804
+ }
2805
+ }, _callee7, this);
2806
+ }));
2807
+
2808
+ function lockboxDataGet(_x14, _x15, _x16, _x17) {
2809
+ return _lockboxDataGet.apply(this, arguments);
2810
+ }
2811
+
2812
+ return lockboxDataGet;
2813
+ }();
2814
+
2815
+ _proto.lockboxManifestGet = /*#__PURE__*/function () {
2816
+ var _lockboxManifestGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(lockboxUuid, filter, lockboxOwnerUuid) {
2817
+ return runtime_1.wrap(function _callee8$(_context8) {
2818
+ while (1) {
2819
+ switch (_context8.prev = _context8.next) {
2820
+ case 0:
2821
+ return _context8.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid, {
2822
+ params: {
2823
+ lockbox_owner_uuid: lockboxOwnerUuid,
2824
+ filter: filter
2825
+ }
2826
+ }));
2827
+
2828
+ case 1:
2829
+ case "end":
2830
+ return _context8.stop();
2831
+ }
2832
+ }
2833
+ }, _callee8, this);
2834
+ }));
2835
+
2836
+ function lockboxManifestGet(_x18, _x19, _x20) {
2837
+ return _lockboxManifestGet.apply(this, arguments);
2838
+ }
2839
+
2840
+ return lockboxManifestGet;
2841
+ }();
2842
+
2843
+ _proto.lockboxMetadataGet = /*#__PURE__*/function () {
2844
+ var _lockboxMetadataGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(lockboxUuid, fields, groupby, filter, lockboxOwnerUuid) {
2845
+ return runtime_1.wrap(function _callee9$(_context9) {
2846
+ while (1) {
2847
+ switch (_context9.prev = _context9.next) {
2848
+ case 0:
2849
+ return _context9.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/metadata", {
2850
+ params: {
2851
+ lockbox_owner_uuid: lockboxOwnerUuid,
2852
+ fields: fields,
2853
+ groupby: groupby,
2854
+ filter: filter
2855
+ }
2856
+ }));
2857
+
2858
+ case 1:
2859
+ case "end":
2860
+ return _context9.stop();
2861
+ }
2862
+ }
2863
+ }, _callee9, this);
2864
+ }));
2865
+
2866
+ function lockboxMetadataGet(_x21, _x22, _x23, _x24, _x25) {
2867
+ return _lockboxMetadataGet.apply(this, arguments);
2868
+ }
2869
+
2870
+ return lockboxMetadataGet;
2871
+ }()
2872
+ /**
2873
+ * inserts or updates encrypted index entries
2874
+ * @note if the index data is being inserted for a user other than the requester, use `indexOwnerUuid`
2875
+ * @note if a uuid for an entry is provided, the service will perform an update
2876
+ * @param entries the encrypted index data
2877
+ * @param indexOwnerUuid
2878
+ */
2879
+ ;
2880
+
2881
+ _proto.vaultIndexPut =
2882
+ /*#__PURE__*/
2883
+ function () {
2884
+ var _vaultIndexPut = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(entries, indexOwnerUuid) {
2885
+ return runtime_1.wrap(function _callee10$(_context10) {
2886
+ while (1) {
2887
+ switch (_context10.prev = _context10.next) {
2888
+ case 0:
2889
+ return _context10.abrupt("return", this.api.put(this.baseURL + "/v1/index", entries, {
2890
+ params: {
2891
+ index_owner_uuid: indexOwnerUuid
2892
+ }
2893
+ }));
2894
+
2895
+ case 1:
2896
+ case "end":
2897
+ return _context10.stop();
2898
+ }
2899
+ }
2900
+ }, _callee10, this);
2901
+ }));
2902
+
2903
+ function vaultIndexPut(_x26, _x27) {
2904
+ return _vaultIndexPut.apply(this, arguments);
2905
+ }
2906
+
2907
+ return vaultIndexPut;
2908
+ }()
2909
+ /**
2910
+ * inserts or updates index snapshot for the provided index owner
2911
+ * @note if the index data is being inserted for a user other than the requester, use `indexOwnerUuid`
2912
+ * @param entry the encrypted index snapshot
2913
+ */
2914
+ ;
2915
+
2916
+ _proto.vaultIndexSnapshotPut =
2917
+ /*#__PURE__*/
2918
+ function () {
2919
+ var _vaultIndexSnapshotPut = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(entry) {
2920
+ return runtime_1.wrap(function _callee11$(_context11) {
2921
+ while (1) {
2922
+ switch (_context11.prev = _context11.next) {
2923
+ case 0:
2924
+ return _context11.abrupt("return", this.api.put(this.baseURL + "/v1/index-snapshot", entry));
2925
+
2926
+ case 1:
2927
+ case "end":
2928
+ return _context11.stop();
2929
+ }
2930
+ }
2931
+ }, _callee11, this);
2932
+ }));
2933
+
2934
+ function vaultIndexSnapshotPut(_x28) {
2935
+ return _vaultIndexSnapshotPut.apply(this, arguments);
2936
+ }
2937
+
2938
+ return vaultIndexSnapshotPut;
2939
+ }()
2940
+ /**
2941
+ * Retrieves the encrypted index from the vault for the requesting user
2942
+ * @note index keys can be specified to narrow the scope of index being requested
2943
+ * @param indexKeys accepted index fields determined by vault
2944
+ * @param identifiers: an array of unique_hashes or consultation uuids used to identify an index entry
2945
+ * @param timestamp the minimum timestamp that index entries were created
2946
+ * @returns the encrypted index
2947
+ */
2948
+ ;
2949
+
2950
+ _proto.vaultIndexGet =
2951
+ /*#__PURE__*/
2952
+ function () {
2953
+ var _vaultIndexGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(indexKeys, identifiers, timestamp) {
2954
+ return runtime_1.wrap(function _callee12$(_context12) {
2955
+ while (1) {
2956
+ switch (_context12.prev = _context12.next) {
2957
+ case 0:
2958
+ return _context12.abrupt("return", this.api.get(this.baseURL + "/v1/index", {
2959
+ params: {
2960
+ index_keys: indexKeys,
2961
+ identifiers: identifiers,
2962
+ timestamp: timestamp
2963
+ }
2964
+ }));
2965
+
2966
+ case 1:
2967
+ case "end":
2968
+ return _context12.stop();
2969
+ }
2970
+ }
2971
+ }, _callee12, this);
2972
+ }));
2973
+
2974
+ function vaultIndexGet(_x29, _x30, _x31) {
2975
+ return _vaultIndexGet.apply(this, arguments);
2976
+ }
2977
+
2978
+ return vaultIndexGet;
2979
+ }();
2980
+
2981
+ return VaultService;
2982
+ }();
2983
+
2984
+ var WorkflowService = /*#__PURE__*/function () {
2985
+ function WorkflowService(api, url) {
2986
+ this.api = api;
2987
+ this.v1Url = url + "/v1";
2988
+ }
2989
+ /**
2990
+ * This function returns all workflows
2991
+ * @returns desired workflow
2992
+ */
2993
+
2994
+
2995
+ var _proto = WorkflowService.prototype;
2996
+
2997
+ _proto.getWorkflows = function getWorkflows() {
2998
+ return this.api.get(this.v1Url + "/workflows");
2999
+ }
3000
+ /**
3001
+ * This function retrieves a workflow. If `locale` is not found, it will try to find 'en' version of it.
3002
+ * By default, will return most recent workflow of a specific `id`. `createdAt` can be used to select older version.
3003
+ * @param id The uuid of the workflow
3004
+ * @param locale (optional) The desired locale of the workflow (default: 'en')
3005
+ * @param createdAt (optional) The creation date of the workflow (also used for versionning)
3006
+ * @returns desired workflow
3007
+ */
3008
+ ;
3009
+
3010
+ _proto.getWorkflow = function getWorkflow(id, locale, createdAt) {
3011
+ return this.api.get(this.v1Url + "/workflows/" + id, {
3012
+ params: {
3013
+ locale: locale,
3014
+ createdAt: createdAt
3015
+ }
3016
+ });
3017
+ };
3018
+
3019
+ return WorkflowService;
3020
+ }();
3021
+
3022
+ /**
3023
+ * This function is used to initialize services with a provided url
3024
+ * @param services an object containing the url of the services to init
3025
+ * @param (optional) authenticationCallback the authentification callback
3026
+ * @returns an instance of each services with a provided url
3027
+ */
3028
+
3029
+ var init = function init(services, authenticationCallback) {
3030
+ var tellerBaseURL = services.tellerBaseURL,
3031
+ practiceBaseURL = services.practiceBaseURL,
3032
+ consultBaseURL = services.consultBaseURL,
3033
+ vaultBaseURL = services.vaultBaseURL,
3034
+ guardBaseURL = services.guardBaseURL,
3035
+ workflowBaseURL = services.workflowBaseURL,
3036
+ diagnosisBaseURL = services.diagnosisBaseURL;
3037
+ var apiService = new APIService(undefined, authenticationCallback);
3038
+ return {
3039
+ tellerService: tellerBaseURL ? new TellerService(apiService, tellerBaseURL) : undefined,
3040
+ practiceService: practiceBaseURL ? new PracticeService(apiService, practiceBaseURL) : undefined,
3041
+ consultService: consultBaseURL ? new ConsultService(apiService, consultBaseURL) : undefined,
3042
+ vaultService: vaultBaseURL ? new VaultService(apiService, vaultBaseURL) : undefined,
3043
+ guardService: guardBaseURL ? new GuardService(apiService, guardBaseURL) : undefined,
3044
+ workflowService: workflowBaseURL ? new WorkflowService(apiService, workflowBaseURL) : undefined,
3045
+ diagnosisService: diagnosisBaseURL ? new DiagnosisService(apiService, diagnosisBaseURL) : undefined
3046
+ };
3047
+ };
3048
+
3049
+ export default init;
3050
+ export { APIService, AssignmentStatus, AssistantType, AuthenticationBadRequest, AuthenticationFailed, AuthenticationServerError, AxiosService, ConsultService, DiagnosisService, DiagnosisType, DocumentType, DrugType, FeeStatus, GuardService, IdentityCreationBadRequest, IdentityCreationConflict, IdentityCreationFailed, IndexKey, LicenseStatus, MedicalStatus, MetadataCategory, OtherRoleType, PaymentStatus, PeriodType, PlanStatus, PlanType, PracticeConfigKind, PracticeEmailKind, PracticeService, PractitionerStatus, PractitionnerRoleType, RateDimension, StripePriceType, SyncStatus, TaskStatus, TellerService, TransmissionKind, TransmissionStatus, VaultService, WorkflowService, WorkflowType };
3051
+ //# sourceMappingURL=oro-sdk-apis.esm.js.map