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