oro-sdk 2.1.4-dev1.0 → 2.2.1

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 (63) hide show
  1. package/README.md +26 -34
  2. package/dist/client.d.ts +4 -4
  3. package/dist/helpers/client.d.ts +1 -1
  4. package/dist/helpers/patient-registration.d.ts +1 -1
  5. package/dist/helpers/vault-grants.d.ts +1 -1
  6. package/dist/helpers/workflow.d.ts +1 -1
  7. package/dist/index.d.ts +15 -1
  8. package/dist/models/client.d.ts +1 -1
  9. package/dist/models/error.d.ts +0 -14
  10. package/dist/models/index.d.ts +0 -7
  11. package/dist/oro-sdk.cjs.development.js +313 -2367
  12. package/dist/oro-sdk.cjs.development.js.map +1 -1
  13. package/dist/oro-sdk.cjs.production.min.js +1 -1
  14. package/dist/oro-sdk.cjs.production.min.js.map +1 -1
  15. package/dist/oro-sdk.esm.js +246 -2344
  16. package/dist/oro-sdk.esm.js.map +1 -1
  17. package/dist/sdk-revision/client.d.ts +2 -2
  18. package/dist/services/index.d.ts +0 -9
  19. package/package.json +4 -1
  20. package/src/client.ts +161 -435
  21. package/src/helpers/client.ts +1 -1
  22. package/src/helpers/patient-registration.ts +85 -166
  23. package/src/helpers/vault-grants.ts +1 -1
  24. package/src/helpers/workflow.ts +21 -59
  25. package/src/index.ts +42 -28
  26. package/src/models/client.ts +1 -1
  27. package/src/models/error.ts +6 -13
  28. package/src/models/index.ts +0 -7
  29. package/src/sdk-revision/client.ts +25 -20
  30. package/src/services/external/clinia.ts +1 -1
  31. package/src/services/index.ts +0 -9
  32. package/dist/models/consult.d.ts +0 -102
  33. package/dist/models/diagnosis.d.ts +0 -122
  34. package/dist/models/guard.d.ts +0 -119
  35. package/dist/models/practice.d.ts +0 -353
  36. package/dist/models/shared.d.ts +0 -8
  37. package/dist/models/vault.d.ts +0 -124
  38. package/dist/models/workflow.d.ts +0 -106
  39. package/dist/services/api.d.ts +0 -11
  40. package/dist/services/axios.d.ts +0 -14
  41. package/dist/services/consult.d.ts +0 -54
  42. package/dist/services/diagnosis.d.ts +0 -44
  43. package/dist/services/guard.d.ts +0 -92
  44. package/dist/services/practice.d.ts +0 -100
  45. package/dist/services/teller.d.ts +0 -9
  46. package/dist/services/vault.d.ts +0 -54
  47. package/dist/services/workflow.d.ts +0 -21
  48. package/src/models/consult.ts +0 -110
  49. package/src/models/diagnosis.ts +0 -141
  50. package/src/models/guard.ts +0 -136
  51. package/src/models/practice.ts +0 -411
  52. package/src/models/shared.ts +0 -6
  53. package/src/models/vault.ts +0 -158
  54. package/src/models/workflow.ts +0 -142
  55. package/src/services/api.ts +0 -77
  56. package/src/services/axios.ts +0 -91
  57. package/src/services/consult.ts +0 -265
  58. package/src/services/diagnosis.ts +0 -144
  59. package/src/services/guard.ts +0 -228
  60. package/src/services/practice.ts +0 -537
  61. package/src/services/teller.ts +0 -39
  62. package/src/services/vault.ts +0 -178
  63. package/src/services/workflow.ts +0 -36
@@ -1,5 +1,5 @@
1
- import axios from 'axios';
2
- import createAuthRefreshInterceptor from 'axios-auth-refresh';
1
+ import initApis__default, { MetadataCategory, MedicalStatus, IndexKey, DocumentType, AxiosService } from 'oro-sdk-apis';
2
+ export * from 'oro-sdk-apis';
3
3
  import { uuidParse, CryptoRSA } from 'oro-toolbox';
4
4
  import * as oroToolbox from 'oro-toolbox';
5
5
  export { oroToolbox as OroToolboxNamespace };
@@ -231,14 +231,6 @@ function _objectWithoutPropertiesLoose(source, excluded) {
231
231
  return target;
232
232
  }
233
233
 
234
- function _assertThisInitialized(self) {
235
- if (self === void 0) {
236
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
237
- }
238
-
239
- return self;
240
- }
241
-
242
234
  function _unsupportedIterableToArray(o, minLen) {
243
235
  if (!o) return;
244
236
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -912,2347 +904,130 @@ var runtime = (function (exports) {
912
904
  var finallyEntry = entry;
913
905
  break;
914
906
  }
915
- }
916
-
917
- if (finallyEntry &&
918
- (type === "break" ||
919
- type === "continue") &&
920
- finallyEntry.tryLoc <= arg &&
921
- arg <= finallyEntry.finallyLoc) {
922
- // Ignore the finally entry if control is not jumping to a
923
- // location outside the try/catch block.
924
- finallyEntry = null;
925
- }
926
-
927
- var record = finallyEntry ? finallyEntry.completion : {};
928
- record.type = type;
929
- record.arg = arg;
930
-
931
- if (finallyEntry) {
932
- this.method = "next";
933
- this.next = finallyEntry.finallyLoc;
934
- return ContinueSentinel;
935
- }
936
-
937
- return this.complete(record);
938
- },
939
-
940
- complete: function(record, afterLoc) {
941
- if (record.type === "throw") {
942
- throw record.arg;
943
- }
944
-
945
- if (record.type === "break" ||
946
- record.type === "continue") {
947
- this.next = record.arg;
948
- } else if (record.type === "return") {
949
- this.rval = this.arg = record.arg;
950
- this.method = "return";
951
- this.next = "end";
952
- } else if (record.type === "normal" && afterLoc) {
953
- this.next = afterLoc;
954
- }
955
-
956
- return ContinueSentinel;
957
- },
958
-
959
- finish: function(finallyLoc) {
960
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
961
- var entry = this.tryEntries[i];
962
- if (entry.finallyLoc === finallyLoc) {
963
- this.complete(entry.completion, entry.afterLoc);
964
- resetTryEntry(entry);
965
- return ContinueSentinel;
966
- }
967
- }
968
- },
969
-
970
- "catch": function(tryLoc) {
971
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
972
- var entry = this.tryEntries[i];
973
- if (entry.tryLoc === tryLoc) {
974
- var record = entry.completion;
975
- if (record.type === "throw") {
976
- var thrown = record.arg;
977
- resetTryEntry(entry);
978
- }
979
- return thrown;
980
- }
981
- }
982
-
983
- // The context.catch method must only be called with a location
984
- // argument that corresponds to a known catch block.
985
- throw new Error("illegal catch attempt");
986
- },
987
-
988
- delegateYield: function(iterable, resultName, nextLoc) {
989
- this.delegate = {
990
- iterator: values(iterable),
991
- resultName: resultName,
992
- nextLoc: nextLoc
993
- };
994
-
995
- if (this.method === "next") {
996
- // Deliberately forget the last sent value so that we don't
997
- // accidentally pass it on to the delegate.
998
- this.arg = undefined$1;
999
- }
1000
-
1001
- return ContinueSentinel;
1002
- }
1003
- };
1004
-
1005
- // Regardless of whether this script is executing as a CommonJS module
1006
- // or not, return the runtime object so that we can declare the variable
1007
- // regeneratorRuntime in the outer scope, which allows this module to be
1008
- // injected easily by `bin/regenerator --include-runtime script.js`.
1009
- return exports;
1010
-
1011
- }(
1012
- // If this script is executing as a CommonJS module, use module.exports
1013
- // as the regeneratorRuntime namespace. Otherwise create a new empty
1014
- // object. Either way, the resulting object will be used to initialize
1015
- // the regeneratorRuntime variable at the top of this file.
1016
- module.exports
1017
- ));
1018
-
1019
- try {
1020
- regeneratorRuntime = runtime;
1021
- } catch (accidentalStrictMode) {
1022
- // This module should not be running in strict mode, so the above
1023
- // assignment should always work unless something is misconfigured. Just
1024
- // in case runtime.js accidentally runs in strict mode, in modern engines
1025
- // we can explicitly access globalThis. In older engines we can escape
1026
- // strict mode using a global Function call. This could conceivably fail
1027
- // if a Content Security Policy forbids using Function, but in that case
1028
- // the proper solution is to fix the accidental strict mode problem. If
1029
- // you've misconfigured your bundler to force strict mode and applied a
1030
- // CSP to forbid Function, and you're not willing to fix either of those
1031
- // problems, please detail your unique predicament in a GitHub issue.
1032
- if (typeof globalThis === "object") {
1033
- globalThis.regeneratorRuntime = runtime;
1034
- } else {
1035
- Function("r", "regeneratorRuntime = r")(runtime);
1036
- }
1037
- }
1038
- });
1039
-
1040
- var AxiosService = /*#__PURE__*/function () {
1041
- function AxiosService(config) {
1042
- if (!config) config = {};
1043
- this.axios = axios.create(config);
1044
- }
1045
-
1046
- var _proto = AxiosService.prototype;
1047
-
1048
- _proto.apiRequest = /*#__PURE__*/function () {
1049
- var _apiRequest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(config, url, data) {
1050
- return runtime_1.wrap(function _callee$(_context) {
1051
- while (1) {
1052
- switch (_context.prev = _context.next) {
1053
- case 0:
1054
- if (!config.headers) config.headers = {};
1055
- config.headers['Content-Type'] = 'application/json';
1056
- return _context.abrupt("return", this.axios(_extends({}, config, {
1057
- url: url,
1058
- data: data
1059
- })).then(function (res) {
1060
- return res.data;
1061
- }));
1062
-
1063
- case 3:
1064
- case "end":
1065
- return _context.stop();
1066
- }
1067
- }
1068
- }, _callee, this);
1069
- }));
1070
-
1071
- function apiRequest(_x, _x2, _x3) {
1072
- return _apiRequest.apply(this, arguments);
1073
- }
1074
-
1075
- return apiRequest;
1076
- }();
1077
-
1078
- _proto.apiRequestHeader = /*#__PURE__*/function () {
1079
- var _apiRequestHeader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(config, url, headerToRetrieve, data) {
1080
- return runtime_1.wrap(function _callee2$(_context2) {
1081
- while (1) {
1082
- switch (_context2.prev = _context2.next) {
1083
- case 0:
1084
- if (!config.headers) config.headers = {};
1085
- config.headers['Content-Type'] = 'application/json';
1086
- return _context2.abrupt("return", this.axios(_extends({}, config, {
1087
- url: url,
1088
- data: data
1089
- })).then(function (res) {
1090
- if (headerToRetrieve) {
1091
- var _res$headers$headerTo;
1092
-
1093
- return (_res$headers$headerTo = res.headers[headerToRetrieve]) != null ? _res$headers$headerTo : res.headers[headerToRetrieve.toLowerCase()];
1094
- }
1095
-
1096
- return res.headers;
1097
- }));
1098
-
1099
- case 3:
1100
- case "end":
1101
- return _context2.stop();
1102
- }
1103
- }
1104
- }, _callee2, this);
1105
- }));
1106
-
1107
- function apiRequestHeader(_x4, _x5, _x6, _x7) {
1108
- return _apiRequestHeader.apply(this, arguments);
1109
- }
1110
-
1111
- return apiRequestHeader;
1112
- }();
1113
-
1114
- _proto.get = function get(url, config) {
1115
- return this.apiRequest(_extends({}, config, {
1116
- method: 'get'
1117
- }), url);
1118
- };
1119
-
1120
- _proto.deleteRequest = function deleteRequest(url, config) {
1121
- return this.apiRequest(_extends({}, config, {
1122
- method: 'delete'
1123
- }), url);
1124
- };
1125
-
1126
- _proto.post = function post(url, data, config) {
1127
- return this.apiRequest(_extends({}, config, {
1128
- method: 'post'
1129
- }), url, data);
1130
- };
1131
-
1132
- _proto.put = function put(url, data, config) {
1133
- return this.apiRequest(_extends({}, config, {
1134
- method: 'put'
1135
- }), url, data);
1136
- };
1137
-
1138
- _proto.patch = function patch(url, data, config) {
1139
- return this.apiRequest(_extends({}, config, {
1140
- method: 'patch'
1141
- }), url, data);
1142
- };
1143
-
1144
- _proto.head = function head(url, config, headerToRetrieve, data) {
1145
- return this.apiRequestHeader(_extends({}, config, {
1146
- method: 'head'
1147
- }), url, headerToRetrieve, data);
1148
- };
1149
-
1150
- return AxiosService;
1151
- }();
1152
-
1153
- var APIService = /*#__PURE__*/function (_AxiosService) {
1154
- _inheritsLoose(APIService, _AxiosService);
1155
-
1156
- function APIService(config, tokenRefreshFailureCallback) {
1157
- var _this;
1158
-
1159
- _this = _AxiosService.call(this, config) || this;
1160
- _this.tokenRefreshFailureCallback = tokenRefreshFailureCallback;
1161
-
1162
- var self = _assertThisInitialized(_this);
1163
-
1164
- _this.axios.interceptors.request.use(function (config) {
1165
- var token = config.useRefreshToken ? self.getTokens().refreshToken : self.getTokens().accessToken;
1166
- config.headers = _extends({}, config.headers, {
1167
- Authorization: "Bearer " + token
1168
- });
1169
- return config;
1170
- }, function (error) {
1171
- Promise.reject(error);
1172
- });
1173
-
1174
- createAuthRefreshInterceptor(_this.axios, /*#__PURE__*/function () {
1175
- var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(failedRequest) {
1176
- var tokenResp;
1177
- return runtime_1.wrap(function _callee$(_context) {
1178
- while (1) {
1179
- switch (_context.prev = _context.next) {
1180
- case 0:
1181
- if (!self.authRefreshFn) {
1182
- _context.next = 15;
1183
- break;
1184
- }
1185
-
1186
- _context.prev = 1;
1187
- _context.next = 4;
1188
- return self.authRefreshFn(self.getTokens().refreshToken);
1189
-
1190
- case 4:
1191
- tokenResp = _context.sent;
1192
- self.setTokens({
1193
- accessToken: tokenResp.accessToken,
1194
- refreshToken: tokenResp.refreshToken
1195
- });
1196
- failedRequest.response.config.headers['Authorization'] = "Bearer " + self.getTokens().accessToken;
1197
- return _context.abrupt("return", Promise.resolve());
1198
-
1199
- case 10:
1200
- _context.prev = 10;
1201
- _context.t0 = _context["catch"](1);
1202
- console.error('an error occured while refreshing tokens (notifying callback)', _context.t0);
1203
- if (self.tokenRefreshFailureCallback) self.tokenRefreshFailureCallback(failedRequest);
1204
- return _context.abrupt("return", Promise.resolve());
1205
-
1206
- case 15:
1207
- console.error('The request could not refresh the token (authRefreshFn was not set)', failedRequest);
1208
- return _context.abrupt("return", Promise.resolve());
1209
-
1210
- case 17:
1211
- case "end":
1212
- return _context.stop();
1213
- }
1214
- }
1215
- }, _callee, null, [[1, 10]]);
1216
- }));
1217
-
1218
- return function (_x) {
1219
- return _ref.apply(this, arguments);
1220
- };
1221
- }(), {
1222
- statusCodes: [401, 403]
1223
- });
1224
- return _this;
1225
- }
1226
-
1227
- var _proto = APIService.prototype;
1228
-
1229
- _proto.setAuthRefreshFn = function setAuthRefreshFn(fn) {
1230
- this.authRefreshFn = fn;
1231
- };
1232
-
1233
- _proto.setTokens = function setTokens(tokens) {
1234
- localStorage.setItem('tokens', JSON.stringify(tokens));
1235
- };
1236
-
1237
- _proto.getTokens = function getTokens() {
1238
- var tokens = {};
1239
- var item = localStorage.getItem('tokens');
1240
-
1241
- if (item) {
1242
- tokens = JSON.parse(item);
1243
- }
1244
-
1245
- return tokens;
1246
- };
1247
-
1248
- return APIService;
1249
- }(AxiosService);
1250
-
1251
- var AssistantType;
1252
-
1253
- (function (AssistantType) {
1254
- AssistantType["MedicalSecretary"] = "MedicalSecretary";
1255
- AssistantType["Nurse"] = "Nurse";
1256
- AssistantType["Specialist"] = "Specialist";
1257
- AssistantType["Administrative"] = "Administrative";
1258
- AssistantType["Other"] = "Other";
1259
- })(AssistantType || (AssistantType = {}));
1260
-
1261
- var TransmissionKind;
1262
-
1263
- (function (TransmissionKind) {
1264
- TransmissionKind["Fax"] = "Fax";
1265
- TransmissionKind["Email"] = "Email";
1266
- TransmissionKind["SMS"] = "SMS";
1267
- TransmissionKind["EncryptedEmail"] = "EncryptedEmail";
1268
- TransmissionKind["Logs"] = "Logs";
1269
- TransmissionKind["API"] = "API";
1270
- TransmissionKind["Other"] = "Other";
1271
- })(TransmissionKind || (TransmissionKind = {}));
1272
-
1273
- var TransmissionStatus;
1274
-
1275
- (function (TransmissionStatus) {
1276
- TransmissionStatus["Preparing"] = "Preparing";
1277
- TransmissionStatus["Sending"] = "Sending";
1278
- TransmissionStatus["Sent"] = "Sent";
1279
- TransmissionStatus["Retrying"] = "Retrying";
1280
- TransmissionStatus["Failed"] = "Failed";
1281
- TransmissionStatus["DriverError"] = "DriverError";
1282
- TransmissionStatus["TimedOut"] = "TimedOut";
1283
- TransmissionStatus["ReceiverNotExist"] = "ReceiverNotExist";
1284
- TransmissionStatus["ReceiverNotAnswering"] = "ReceiverNotAnswering";
1285
- TransmissionStatus["ReceiverIncompatible"] = "ReceiverIncompatible";
1286
- })(TransmissionStatus || (TransmissionStatus = {}));
1287
-
1288
- var FeeStatus;
1289
-
1290
- (function (FeeStatus) {
1291
- FeeStatus["NoFee"] = "NoFee";
1292
- FeeStatus["Pending"] = "Pending";
1293
- FeeStatus["Paid"] = "Paid";
1294
- FeeStatus["Reimbursed"] = "Reimbursed";
1295
- FeeStatus["Cancelled"] = "Cancelled";
1296
- FeeStatus["Contested"] = "Contested";
1297
- })(FeeStatus || (FeeStatus = {}));
1298
-
1299
- var MedicalStatus;
1300
-
1301
- (function (MedicalStatus) {
1302
- MedicalStatus["Creating"] = "Creating";
1303
- MedicalStatus["New"] = "New";
1304
- MedicalStatus["ToAnswer"] = "ToAnswer";
1305
- MedicalStatus["Answered"] = "Answered";
1306
- MedicalStatus["Closed"] = "Closed";
1307
- MedicalStatus["Reopened"] = "Reopened";
1308
- MedicalStatus["Archived"] = "Archived";
1309
- })(MedicalStatus || (MedicalStatus = {}));
1310
-
1311
- var TaskStatus;
1312
-
1313
- (function (TaskStatus) {
1314
- TaskStatus["None"] = "None";
1315
- TaskStatus["ToDo"] = "ToDo";
1316
- TaskStatus["InProgress"] = "InProgress";
1317
- TaskStatus["Blocked"] = "Blocked";
1318
- TaskStatus["Done"] = "Done";
1319
- })(TaskStatus || (TaskStatus = {}));
1320
-
1321
- var DiagnosisType;
1322
-
1323
- (function (DiagnosisType) {
1324
- DiagnosisType["Generic"] = "Generic";
1325
- DiagnosisType["Private"] = "Private";
1326
- DiagnosisType["Instance"] = "Instance";
1327
- })(DiagnosisType || (DiagnosisType = {}));
1328
-
1329
- var DrugType;
1330
-
1331
- (function (DrugType) {
1332
- DrugType["Generic"] = "Generic";
1333
- DrugType["Instance"] = "Instance";
1334
- })(DrugType || (DrugType = {}));
1335
-
1336
- var PlanStatus;
1337
-
1338
- (function (PlanStatus) {
1339
- PlanStatus["Pending"] = "Pending";
1340
- PlanStatus["Accepted"] = "Accepted";
1341
- PlanStatus["Rejected"] = "Rejected";
1342
- })(PlanStatus || (PlanStatus = {}));
1343
-
1344
- var IncompleteAuthentication = /*#__PURE__*/function (_Error) {
1345
- _inheritsLoose(IncompleteAuthentication, _Error);
1346
-
1347
- function IncompleteAuthentication() {
1348
- return _Error.apply(this, arguments) || this;
1349
- }
1350
-
1351
- return IncompleteAuthentication;
1352
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1353
- var MissingGrant = /*#__PURE__*/function (_Error2) {
1354
- _inheritsLoose(MissingGrant, _Error2);
1355
-
1356
- function MissingGrant() {
1357
- return _Error2.apply(this, arguments) || this;
1358
- }
1359
-
1360
- return MissingGrant;
1361
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1362
- var MissingLockbox = /*#__PURE__*/function (_Error3) {
1363
- _inheritsLoose(MissingLockbox, _Error3);
1364
-
1365
- function MissingLockbox() {
1366
- return _Error3.apply(this, arguments) || this;
1367
- }
1368
-
1369
- return MissingLockbox;
1370
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1371
- var MissingLockboxOwner = /*#__PURE__*/function (_Error4) {
1372
- _inheritsLoose(MissingLockboxOwner, _Error4);
1373
-
1374
- function MissingLockboxOwner() {
1375
- return _Error4.apply(this, arguments) || this;
1376
- }
1377
-
1378
- return MissingLockboxOwner;
1379
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1380
- var IndexBuildError = /*#__PURE__*/function (_Error5) {
1381
- _inheritsLoose(IndexBuildError, _Error5);
1382
-
1383
- function IndexBuildError() {
1384
- return _Error5.apply(this, arguments) || this;
1385
- }
1386
-
1387
- return IndexBuildError;
1388
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1389
- var AssociatedLockboxNotFound = /*#__PURE__*/function (_Error6) {
1390
- _inheritsLoose(AssociatedLockboxNotFound, _Error6);
1391
-
1392
- function AssociatedLockboxNotFound() {
1393
- return _Error6.apply(this, arguments) || this;
1394
- }
1395
-
1396
- return AssociatedLockboxNotFound;
1397
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1398
- var WorkflowAnswersMissingError = /*#__PURE__*/function (_Error7) {
1399
- _inheritsLoose(WorkflowAnswersMissingError, _Error7);
1400
-
1401
- function WorkflowAnswersMissingError() {
1402
- return _Error7.apply(this, arguments) || this;
1403
- }
1404
-
1405
- return WorkflowAnswersMissingError;
1406
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1407
- var AuthenticationFailed = /*#__PURE__*/function (_Error8) {
1408
- _inheritsLoose(AuthenticationFailed, _Error8);
1409
-
1410
- function AuthenticationFailed() {
1411
- return _Error8.apply(this, arguments) || this;
1412
- }
1413
-
1414
- return AuthenticationFailed;
1415
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1416
- var AuthenticationBadRequest = /*#__PURE__*/function (_Error9) {
1417
- _inheritsLoose(AuthenticationBadRequest, _Error9);
1418
-
1419
- function AuthenticationBadRequest() {
1420
- return _Error9.apply(this, arguments) || this;
1421
- }
1422
-
1423
- return AuthenticationBadRequest;
1424
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1425
- var AuthenticationServerError = /*#__PURE__*/function (_Error10) {
1426
- _inheritsLoose(AuthenticationServerError, _Error10);
1427
-
1428
- function AuthenticationServerError() {
1429
- return _Error10.apply(this, arguments) || this;
1430
- }
1431
-
1432
- return AuthenticationServerError;
1433
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1434
- var IdentityCreationFailed = /*#__PURE__*/function (_Error11) {
1435
- _inheritsLoose(IdentityCreationFailed, _Error11);
1436
-
1437
- function IdentityCreationFailed() {
1438
- return _Error11.apply(this, arguments) || this;
1439
- }
1440
-
1441
- return IdentityCreationFailed;
1442
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1443
- var IdentityCreationBadRequest = /*#__PURE__*/function (_Error12) {
1444
- _inheritsLoose(IdentityCreationBadRequest, _Error12);
1445
-
1446
- function IdentityCreationBadRequest() {
1447
- return _Error12.apply(this, arguments) || this;
1448
- }
1449
-
1450
- return IdentityCreationBadRequest;
1451
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1452
- var IdentityCreationConflict = /*#__PURE__*/function (_Error13) {
1453
- _inheritsLoose(IdentityCreationConflict, _Error13);
1454
-
1455
- function IdentityCreationConflict() {
1456
- return _Error13.apply(this, arguments) || this;
1457
- }
1458
-
1459
- return IdentityCreationConflict;
1460
- }( /*#__PURE__*/_wrapNativeSuper(Error));
1461
-
1462
- var WorkflowType;
1463
-
1464
- (function (WorkflowType) {
1465
- WorkflowType["Onboard"] = "Onboard";
1466
- WorkflowType["Followup"] = "Followup";
1467
- WorkflowType["Renew"] = "Renew";
1468
- WorkflowType["DataRetrieve"] = "DataRetrieve";
1469
- })(WorkflowType || (WorkflowType = {}));
1470
-
1471
- var RateDimension;
1472
-
1473
- (function (RateDimension) {
1474
- RateDimension["RatioOnTotal"] = "RatioOnTotal";
1475
- RateDimension["FixedOnTotal"] = "FixedOnTotal";
1476
- RateDimension["RatioPlatformFee"] = "RatioPlatformFee";
1477
- RateDimension["FixedPlatformFee"] = "FixedPlatformFee";
1478
- RateDimension["RatioOnPlatformFeeTotal"] = "RatioOnPlatformFeeTotal";
1479
- RateDimension["FixedOnPlatformFeeTotal"] = "FixedOnPlatformFeeTotal";
1480
- RateDimension["RatioOnItem"] = "RatioOnItem";
1481
- RateDimension["FixedOnItem"] = "FixedOnItem";
1482
- })(RateDimension || (RateDimension = {}));
1483
-
1484
- var PlanType;
1485
-
1486
- (function (PlanType) {
1487
- PlanType["Onboard"] = "Onboard";
1488
- PlanType["Followup"] = "Followup";
1489
- PlanType["Renew"] = "Renew";
1490
- PlanType["DataRetrieve"] = "DataRetrieve";
1491
- })(PlanType || (PlanType = {}));
1492
-
1493
- var PaymentStatus;
1494
-
1495
- (function (PaymentStatus) {
1496
- PaymentStatus["Pending"] = "Pending";
1497
- PaymentStatus["Success"] = "Success";
1498
- PaymentStatus["Failure"] = "Failure";
1499
- PaymentStatus["Canceled"] = "Canceled";
1500
- })(PaymentStatus || (PaymentStatus = {}));
1501
-
1502
- var PractitionerStatus;
1503
-
1504
- (function (PractitionerStatus) {
1505
- PractitionerStatus["Practicing"] = "Practicing";
1506
- PractitionerStatus["Retired"] = "Retired";
1507
- PractitionerStatus["NotInvolvedAnymore"] = "NotInvolvedAnymore";
1508
- PractitionerStatus["Deactivated"] = "Deactivated";
1509
- PractitionerStatus["Flagged"] = "Flagged";
1510
- PractitionerStatus["InConflict"] = "InConflict";
1511
- PractitionerStatus["Delicensed"] = "Delicensed";
1512
- })(PractitionerStatus || (PractitionerStatus = {}));
1513
-
1514
- var AssignmentStatus;
1515
-
1516
- (function (AssignmentStatus) {
1517
- AssignmentStatus["Assigned"] = "Assigned";
1518
- AssignmentStatus["Reassigned"] = "Reassigned";
1519
- AssignmentStatus["Cancelled"] = "Cancelled";
1520
- })(AssignmentStatus || (AssignmentStatus = {}));
1521
-
1522
- var PractitionnerRoleType;
1523
-
1524
- (function (PractitionnerRoleType) {
1525
- PractitionnerRoleType["Doctor"] = "Doctor";
1526
- PractitionnerRoleType["MedicalAssistant"] = "MedicalAssistant";
1527
- PractitionnerRoleType["MedicalSecretary"] = "MedicalSecretary";
1528
- PractitionnerRoleType["Nurse"] = "Nurse";
1529
- PractitionnerRoleType["Specialist"] = "Specialist";
1530
- PractitionnerRoleType["LabAssistant"] = "LabAssistant";
1531
- PractitionnerRoleType["Administrative"] = "Administrative";
1532
- PractitionnerRoleType["ManualDispatcher"] = "ManualDispatcher";
1533
- PractitionnerRoleType["Other"] = "Other";
1534
- })(PractitionnerRoleType || (PractitionnerRoleType = {}));
1535
-
1536
- var OtherRoleType;
1537
-
1538
- (function (OtherRoleType) {
1539
- OtherRoleType["Patient"] = "Patient";
1540
- OtherRoleType["User"] = "User";
1541
- OtherRoleType["System"] = "System";
1542
- })(OtherRoleType || (OtherRoleType = {}));
1543
-
1544
- var LicenseStatus;
1545
-
1546
- (function (LicenseStatus) {
1547
- LicenseStatus["Valid"] = "Valid";
1548
- LicenseStatus["Invalid"] = "Invalid";
1549
- LicenseStatus["Expired"] = "Expired";
1550
- LicenseStatus["NA"] = "NA";
1551
- LicenseStatus["Removed"] = "Removed";
1552
- })(LicenseStatus || (LicenseStatus = {}));
1553
-
1554
- var PeriodType;
1555
-
1556
- (function (PeriodType) {
1557
- PeriodType["PerYear"] = "PerYear";
1558
- PeriodType["PerQuarter"] = "PerQuarter";
1559
- PeriodType["PerMonth"] = "PerMonth";
1560
- PeriodType["PerWeek"] = "PerWeek";
1561
- PeriodType["PerBusinessDay"] = "PerBusinessDay";
1562
- PeriodType["PerDay"] = "PerDay";
1563
- PeriodType["PerHour"] = "PerHour";
1564
- })(PeriodType || (PeriodType = {}));
1565
-
1566
- var SyncStatus;
1567
-
1568
- (function (SyncStatus) {
1569
- SyncStatus["Requested"] = "Requested";
1570
- SyncStatus["Started"] = "Started";
1571
- SyncStatus["Succeeded"] = "Succeeded";
1572
- SyncStatus["Failed"] = "Failed";
1573
- SyncStatus["Cancelled"] = "Cancelled";
1574
- })(SyncStatus || (SyncStatus = {}));
1575
-
1576
- var PracticeEmailKind;
1577
-
1578
- (function (PracticeEmailKind) {
1579
- PracticeEmailKind["SignedUp"] = "SignedUp";
1580
- PracticeEmailKind["Onboarded"] = "Onboarded";
1581
- PracticeEmailKind["OnboardedPractitioner"] = "OnboardedPractitioner";
1582
- PracticeEmailKind["OnboardedPatient"] = "OnboardedPatient";
1583
- PracticeEmailKind["Answered"] = "Answered";
1584
- PracticeEmailKind["ToAnswer"] = "ToAnswer";
1585
- PracticeEmailKind["FollowedUp"] = "FollowedUp";
1586
- PracticeEmailKind["Renewed"] = "Renewed";
1587
- PracticeEmailKind["DataRetrieved"] = "DataRetrieved";
1588
- })(PracticeEmailKind || (PracticeEmailKind = {}));
1589
-
1590
- var PracticeConfigKind;
1591
-
1592
- (function (PracticeConfigKind) {
1593
- PracticeConfigKind["PractitionerConsultList"] = "PractitionerConsultList";
1594
- PracticeConfigKind["PractitionerChatbox"] = "PractitionerChatbox";
1595
- PracticeConfigKind["PracticeTheme"] = "PracticeTheme";
1596
- PracticeConfigKind["PracticeLocaleSwitcher"] = "PracticeLocaleSwitcher";
1597
- PracticeConfigKind["PracticeCookieBanner"] = "PracticeCookieBanner";
1598
- })(PracticeConfigKind || (PracticeConfigKind = {}));
1599
-
1600
- var StripePriceType;
1601
-
1602
- (function (StripePriceType) {
1603
- StripePriceType["Default"] = "Default";
1604
- StripePriceType["Discount"] = "Discount";
1605
- })(StripePriceType || (StripePriceType = {}));
1606
-
1607
- var IndexKey;
1608
-
1609
- (function (IndexKey) {
1610
- IndexKey["Consultation"] = "Consultation";
1611
- IndexKey["IndexSnapshot"] = "IndexSnapshot";
1612
- IndexKey["ConsultationLockbox"] = "ConsultationLockbox";
1613
- })(IndexKey || (IndexKey = {}));
1614
-
1615
- var DocumentType;
1616
-
1617
- (function (DocumentType) {
1618
- DocumentType["Message"] = "Message";
1619
- DocumentType["Note"] = "Note";
1620
- DocumentType["DoctorsNote"] = "DoctorsNote";
1621
- DocumentType["Prescription"] = "Prescription";
1622
- DocumentType["ExamRequest"] = "ExamRequest";
1623
- DocumentType["Result"] = "Result";
1624
- DocumentType["Attachment"] = "Attachment";
1625
- DocumentType["BigFile"] = "BigFile";
1626
- DocumentType["MeetingRequest"] = "MeetingRequest";
1627
- DocumentType["AudioNote"] = "AudioNote";
1628
- DocumentType["VideoNote"] = "VideoNote";
1629
- DocumentType["PopulatedWorkflowData"] = "PopulatedWorkflowData";
1630
- DocumentType["TreatmentPlan"] = "TreatmentPlan";
1631
- DocumentType["ImageAlias"] = "ImageAlias";
1632
- })(DocumentType || (DocumentType = {}));
1633
-
1634
- var MetadataCategory;
1635
-
1636
- (function (MetadataCategory) {
1637
- MetadataCategory["ChildPersonal"] = "ChildPersonal";
1638
- MetadataCategory["Consultation"] = "Consultation";
1639
- MetadataCategory["DataRetrieval"] = "DataRetrieval";
1640
- MetadataCategory["Followup"] = "Followup";
1641
- MetadataCategory["Recovery"] = "Recovery";
1642
- MetadataCategory["Medical"] = "Medical";
1643
- MetadataCategory["OtherPersonal"] = "OtherPersonal";
1644
- MetadataCategory["Personal"] = "Personal";
1645
- MetadataCategory["Preference"] = "Preference";
1646
- MetadataCategory["Prescription"] = "Prescription";
1647
- MetadataCategory["Raw"] = "Raw";
1648
- })(MetadataCategory || (MetadataCategory = {}));
1649
-
1650
- var ConsultService = /*#__PURE__*/function () {
1651
- function ConsultService(api, baseURL) {
1652
- this.api = api;
1653
- this.baseURL = baseURL;
1654
- }
1655
-
1656
- var _proto = ConsultService.prototype;
1657
-
1658
- _proto.consultCreate = function consultCreate(c) {
1659
- return this.api.post(this.baseURL + "/v1/consults", c);
1660
- }
1661
- /**
1662
- * This function returns the number of consults using parameters
1663
- * @param uuidPractice the practice uuid
1664
- * @param uuidRequester the requester uuid
1665
- * @param statusesMedical an array containing MedicalStatus to include
1666
- * @param statusesExclude an array containing MedicalStatus to exclude
1667
- * @param shortId a shortId matcher (will match all consult with a shortId starting with this `shortId`)
1668
- * @param columnToSortTo the list of columns separated by commas, to sort to (in order of sorting)
1669
- * @param orderToSortTo the type of sorting to do ('asc' for ascending or 'desc' for descending)
1670
- * @param perPage the number of item to retrieve per "page"
1671
- * @param indexPage the actual index of the page to retrieve (0 based: 0 is the first items)
1672
- * @param filterAssignedDoctor the uuid of the doctor for which to filter with
1673
- * @param filterCurrentPractitioner the uuid of the current assistant assigned to filter with
1674
- * @param filterIsoLocality the of isoLocality to filter with
1675
- * @returns a number of consult
1676
- */
1677
- ;
1678
-
1679
- _proto.countConsults = function countConsults(uuidPractice, uuidRequester, statusesMedical, statusesExclude, shortId, columnToSortTo, orderToSortTo, perPage, indexPage, filterAssignedDoctor, filterCurrentPractitioner, filterIsoLocality) {
1680
- return this.api.head(this.baseURL + "/v1/consults", {
1681
- params: {
1682
- uuidPractice: uuidPractice,
1683
- uuidRequester: uuidRequester,
1684
- statusesMedical: statusesMedical,
1685
- statusesExclude: statusesExclude,
1686
- shortId: shortId,
1687
- perPage: perPage,
1688
- page: indexPage,
1689
- sortColumns: columnToSortTo,
1690
- orderColumns: orderToSortTo,
1691
- filterAssignedDoctor: filterAssignedDoctor,
1692
- filterCurrentPractitioner: filterCurrentPractitioner,
1693
- filterIsoLocality: filterIsoLocality
1694
- }
1695
- }, 'Content-Range').then(function (resContentRange) {
1696
- if (!resContentRange || typeof resContentRange !== 'string' && typeof resContentRange !== 'number') {
1697
- return 0;
1698
- }
1699
-
1700
- if (typeof resContentRange === 'number') {
1701
- return resContentRange;
1702
- }
1703
-
1704
- return parseInt(resContentRange);
1705
- });
1706
- }
1707
- /**
1708
- * This function get consults using parameters
1709
- * @param uuidPractice the practice uuid
1710
- * @param uuidRequester the requester uuid
1711
- * @param statusesMedical an array containing MedicalStatus to include
1712
- * @param statusesExclude an array containing MedicalStatus to exclude
1713
- * @param shortId a shortId matcher (will match all consult with a shortId starting with this `shortId`)
1714
- * @param columnToSortTo the list of columns separated by commas, to sort to (in order of sorting)
1715
- * @param orderToSortTo the type of sorting to do ('asc' for ascending or 'desc' for descending)
1716
- * @param perPage the number of item to retrieve per "page"
1717
- * @param indexPage the actual index of the page to retrieve (0 based: 0 is the first items)
1718
- * @param filterAssignedDoctor the uuid of the doctor for which to filter with
1719
- * @param filterCurrentPractitioner the uuid of the current assistant assigned to filter with
1720
- * @param filterIsoLocality the of isoLocality to filter with
1721
- * @returns a list of consult
1722
- */
1723
- ;
1724
-
1725
- _proto.getConsults = function getConsults(uuidPractice, uuidRequester, statusesMedical, statusesExclude, shortId, columnToSortTo, orderToSortTo, perPage, indexPage, filterAssignedDoctor, filterCurrentPractitioner, filterIsoLocality) {
1726
- return this.api.get(this.baseURL + "/v1/consults", {
1727
- params: {
1728
- uuidPractice: uuidPractice,
1729
- uuidRequester: uuidRequester,
1730
- statusesMedical: statusesMedical,
1731
- statusesExclude: statusesExclude,
1732
- shortId: shortId,
1733
- perPage: perPage,
1734
- page: indexPage,
1735
- sortColumns: columnToSortTo,
1736
- orderColumns: orderToSortTo,
1737
- filterAssignedDoctor: filterAssignedDoctor,
1738
- filterCurrentPractitioner: filterCurrentPractitioner,
1739
- filterIsoLocality: filterIsoLocality
1740
- }
1741
- });
1742
- };
1743
-
1744
- _proto.getConsultByUUID = function getConsultByUUID(uuidConsult, uuidPractice) {
1745
- return this.api.get(this.baseURL + "/v1/consults/" + uuidConsult, {
1746
- params: {
1747
- uuidPractice: uuidPractice
1748
- }
1749
- });
1750
- };
1751
-
1752
- _proto.updateConsultByUUID = function updateConsultByUUID(uuidConsult, consult, uuidPractice, uuidRequester) {
1753
- return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult, consult, {
1754
- params: {
1755
- uuidPractice: uuidPractice,
1756
- uuidRequester: uuidRequester
1757
- }
1758
- });
1759
- };
1760
-
1761
- _proto.getConsultFaxStatuses = function getConsultFaxStatuses(uuidConsult) {
1762
- return this.api.get(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions", {
1763
- params: {
1764
- kind: TransmissionKind.Fax
1765
- }
1766
- });
1767
- };
1768
-
1769
- _proto.postConsultTransmission = function postConsultTransmission(uuidConsult, nameDriver, addressOrPhoneToSendTo, file, nameReceiver, txtTransmissionTitle, txtTransmissionNotes // numTry ?: number,
1770
- // delay ?: number,
1771
- ) {
1772
- if (nameDriver === void 0) {
1773
- nameDriver = 'Documo';
1774
- }
1775
-
1776
- var data = new FormData();
1777
- data.append('nameDriverReceiver', nameDriver);
1778
-
1779
- if (addressOrPhoneToSendTo) {
1780
- data.append('addressReceiver', addressOrPhoneToSendTo);
1781
- }
1782
-
1783
- if (file) {
1784
- data.append('file', file);
1785
- }
1786
-
1787
- if (nameReceiver) {
1788
- data.append('nameReceiver', nameReceiver);
1789
- }
1790
-
1791
- if (txtTransmissionTitle) {
1792
- data.append('txtTransmissionTitle', txtTransmissionTitle);
1793
- }
1794
-
1795
- if (txtTransmissionNotes) {
1796
- data.append('txtTransmissionNotes', txtTransmissionNotes);
1797
- }
1798
-
1799
- return this.api.post(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions", data, {
1800
- headers: {
1801
- 'Content-Type': 'multipart/form-data;'
1802
- }
1803
- });
1804
- };
1805
-
1806
- _proto.postConsultFax = function postConsultFax(uuidConsult, addressReceiver, file) {
1807
- return this.postConsultTransmission(uuidConsult, 'Documo', addressReceiver, file);
1808
- };
1809
-
1810
- _proto.postConsultEmail = function postConsultEmail(uuidConsult, file) {
1811
- return this.postConsultTransmission(uuidConsult, 'Pharmacierge', undefined, file);
1812
- };
1813
-
1814
- _proto.retryConsultFax = function retryConsultFax(uuidConsult, transmissionId) {
1815
- return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions/" + transmissionId, {
1816
- status: TransmissionStatus.Retrying
1817
- });
1818
- };
1819
-
1820
- _proto.updateConsultTransmissionStatus = function updateConsultTransmissionStatus(transmissionId, uuidConsult, newStatus) {
1821
- return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult + "/transmissions/" + transmissionId, {
1822
- status: newStatus
1823
- });
1824
- };
1825
-
1826
- return ConsultService;
1827
- }();
1828
-
1829
- var DiagnosisService = /*#__PURE__*/function () {
1830
- function DiagnosisService(api, baseURL) {
1831
- this.api = api;
1832
- this.baseURL = baseURL;
1833
- }
1834
-
1835
- var _proto = DiagnosisService.prototype;
1836
-
1837
- _proto.getDiagnoses = function getDiagnoses() {
1838
- return this.api.get(this.baseURL + "/v1/diagnoses");
1839
- }
1840
- /**
1841
- * Get a diagnosis by uuid that belongs to your practice
1842
- * @param uuidDiagnosis the uuid of the diagnosis
1843
- * @returns a diagnosis
1844
- */
1845
- ;
1846
-
1847
- _proto.getDiagnosisByUuid = function getDiagnosisByUuid(uuidDiagnosis) {
1848
- return this.api.get(this.baseURL + "/v1/diagnoses/" + uuidDiagnosis);
1849
- };
1850
-
1851
- _proto.createDiagnosis = function createDiagnosis(diagnosis) {
1852
- return this.api.post(this.baseURL + "/v1/diagnoses", diagnosis);
1853
- };
1854
-
1855
- _proto.updateDiagnosis = function updateDiagnosis(uuid, diagnosis) {
1856
- return this.api.put(this.baseURL + "/v1/diagnoses/" + uuid, diagnosis);
1857
- };
1858
-
1859
- _proto.getTreatmentsFromDiagnosisUuid = function getTreatmentsFromDiagnosisUuid(diagnosisUuid) {
1860
- return this.api.get(this.baseURL + "/v1/diagnoses/" + diagnosisUuid + "/treatments");
1861
- }
1862
- /**
1863
- * This function returns treatment plans associated to a consult
1864
- * @param uuidConsult the consult uuid to fetch
1865
- * @returns an array of TreatmentPlan
1866
- */
1867
- ;
1868
-
1869
- _proto.getTreatmentPlansFromConsultUuid = function getTreatmentPlansFromConsultUuid(uuidConsult) {
1870
- return this.api.get(this.baseURL + "/v1/treatment-plans/", {
1871
- params: {
1872
- uuidConsult: uuidConsult
1873
- }
1874
- });
1875
- }
1876
- /**
1877
- * creates a new treatment for the diagnosis specified
1878
- * @param diagnosisUuid uuid of the diagnosis that is linked to the treatment
1879
- * @param treatmentRequest the treatment to be inserted
1880
- */
1881
- ;
1882
-
1883
- _proto.createTreatment = function createTreatment(diagnosisUuid, treatmentRequest) {
1884
- return this.api.post(this.baseURL + "/v1/diagnoses/" + diagnosisUuid + "/treatments", treatmentRequest);
1885
- }
1886
- /**
1887
- * This function returns populated treatment plans associated to a consult
1888
- * @param uuidConsult the consult uuid to fetch
1889
- * @returns a TreatmentPlans object
1890
- */
1891
- ;
1892
-
1893
- _proto.getTreatmentPlansPopulatedFromConsultUuid = function getTreatmentPlansPopulatedFromConsultUuid(uuidConsult) {
1894
- return this.api.get(this.baseURL + "/v1/treatment-plans/", {
1895
- params: {
1896
- uuidConsult: uuidConsult,
1897
- populated: true
1898
- }
1899
- });
1900
- };
1901
-
1902
- _proto.postPlans = function postPlans(plans) {
1903
- return this.api.post(this.baseURL + "/v1/treatment-plans", plans);
1904
- };
1905
-
1906
- _proto.updateTreatmentPlan = function updateTreatmentPlan(uuidPlan, uuidConsult, diagnosisRequest, plan) {
1907
- return this.api.put(this.baseURL + "/v1/treatment-plans/" + uuidPlan, {
1908
- uuidConsult: uuidConsult,
1909
- diagnosis: diagnosisRequest,
1910
- plan: plan
1911
- });
1912
- };
1913
-
1914
- _proto.acceptTreatmentPlan = function acceptTreatmentPlan(uuidPlan, uuidConsult) {
1915
- return this.api.put(this.baseURL + "/v1/treatment-plans/" + uuidPlan + "/accept", {
1916
- uuidConsult: uuidConsult
1917
- });
1918
- }
1919
- /**
1920
- * retrieves all the drugs of the specified practice
1921
- * @param uuidPractice
1922
- */
1923
- ;
1924
-
1925
- _proto.getAllDrugs =
1926
- /*#__PURE__*/
1927
- function () {
1928
- var _getAllDrugs = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(uuidPractice) {
1929
- var res;
1930
- return runtime_1.wrap(function _callee$(_context) {
1931
- while (1) {
1932
- switch (_context.prev = _context.next) {
1933
- case 0:
1934
- _context.next = 2;
1935
- return this.api.get(this.baseURL + "/v1/drugs/practice/" + uuidPractice);
1936
-
1937
- case 2:
1938
- res = _context.sent;
1939
-
1940
- if (!(res && res.foundDrugs)) {
1941
- _context.next = 5;
1942
- break;
1943
- }
1944
-
1945
- return _context.abrupt("return", res.foundDrugs);
1946
-
1947
- case 5:
1948
- return _context.abrupt("return", undefined);
1949
-
1950
- case 6:
1951
- case "end":
1952
- return _context.stop();
1953
- }
1954
- }
1955
- }, _callee, this);
1956
- }));
1957
-
1958
- function getAllDrugs(_x) {
1959
- return _getAllDrugs.apply(this, arguments);
1960
- }
1961
-
1962
- return getAllDrugs;
1963
- }();
1964
-
1965
- return DiagnosisService;
1966
- }();
1967
-
1968
- var GuardService = /*#__PURE__*/function () {
1969
- function GuardService(api, baseURL) {
1970
- this.api = api;
1971
- this.baseURL = baseURL;
1972
- this.api.setAuthRefreshFn(this.authRefresh.bind(this));
1973
- this.identityCache = {};
1974
- this.whoAmICache = {};
1975
- }
1976
- /**
1977
- * Will replace access and refresh tokens with `tokens`
1978
- *
1979
- * Note:
1980
- * ```typescript
1981
- * setTokens({accessToken: undefined, refreshToken: 'aTokenValue'}) // will erase accessToken and set refreshToken with 'aTokenValue'
1982
- * setTokens({refreshToken: 'aTokenValue'}) // will keep actual value of accessToken and set refreshToken with 'aTokenValue'
1983
- *
1984
- * ```
1985
- * @param tokens
1986
- */
1987
-
1988
-
1989
- var _proto = GuardService.prototype;
1990
-
1991
- _proto.setTokens = function setTokens(tokens) {
1992
- this.api.setTokens(_extends({}, this.api.getTokens(), tokens));
1993
- }
1994
- /**
1995
- * Allow to retrieve an access token and a refresh token in order
1996
- * to do authenticated request afterward
1997
- *
1998
- * @param req The credentials required to get an access token
1999
- * @returns AuthTokenResponse
2000
- */
2001
- ;
2002
-
2003
- _proto.authToken =
2004
- /*#__PURE__*/
2005
- function () {
2006
- var _authToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(req) {
2007
- var resp, config, _e$response, code;
2008
-
2009
- return runtime_1.wrap(function _callee$(_context) {
2010
- while (1) {
2011
- switch (_context.prev = _context.next) {
2012
- case 0:
2013
- _context.prev = 0;
2014
- config = {
2015
- skipAuthRefresh: true
2016
- };
2017
- _context.next = 4;
2018
- return this.api.post(this.baseURL + "/v1/auth/token", req, config);
2019
-
2020
- case 4:
2021
- resp = _context.sent;
2022
- this.api.setTokens({
2023
- accessToken: resp.accessToken,
2024
- refreshToken: resp.refreshToken
2025
- });
2026
- _context.next = 19;
2027
- break;
2028
-
2029
- case 8:
2030
- _context.prev = 8;
2031
- _context.t0 = _context["catch"](0);
2032
-
2033
- if (!_context.t0.isAxiosError) {
2034
- _context.next = 18;
2035
- break;
2036
- }
2037
-
2038
- code = (_e$response = _context.t0.response) == null ? void 0 : _e$response.status;
2039
- _context.t1 = code;
2040
- _context.next = _context.t1 === 400 ? 15 : _context.t1 === 500 ? 16 : _context.t1 === 401 ? 17 : 17;
2041
- break;
2042
-
2043
- case 15:
2044
- throw new AuthenticationBadRequest();
2045
-
2046
- case 16:
2047
- throw new AuthenticationServerError();
2048
-
2049
- case 17:
2050
- throw new AuthenticationFailed();
2051
-
2052
- case 18:
2053
- throw new AuthenticationFailed();
2054
-
2055
- case 19:
2056
- return _context.abrupt("return", resp);
2057
-
2058
- case 20:
2059
- case "end":
2060
- return _context.stop();
2061
- }
2062
- }
2063
- }, _callee, this, [[0, 8]]);
2064
- }));
2065
-
2066
- function authToken(_x) {
2067
- return _authToken.apply(this, arguments);
2068
- }
2069
-
2070
- return authToken;
2071
- }()
2072
- /**
2073
- * Get new access and refresh token
2074
- *
2075
- * @returns AuthTokenResponse
2076
- */
2077
- ;
2078
-
2079
- _proto.authRefresh =
2080
- /*#__PURE__*/
2081
- function () {
2082
- var _authRefresh = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(refreshToken) {
2083
- var config;
2084
- return runtime_1.wrap(function _callee2$(_context2) {
2085
- while (1) {
2086
- switch (_context2.prev = _context2.next) {
2087
- case 0:
2088
- config = {
2089
- skipAuthRefresh: true,
2090
- useRefreshToken: true
2091
- };
2092
- return _context2.abrupt("return", this.api.put(this.baseURL + "/v1/auth/token", null, config));
2093
-
2094
- case 2:
2095
- case "end":
2096
- return _context2.stop();
2097
- }
2098
- }
2099
- }, _callee2, this);
2100
- }));
2101
-
2102
- function authRefresh(_x2) {
2103
- return _authRefresh.apply(this, arguments);
2104
- }
2105
-
2106
- return authRefresh;
2107
- }()
2108
- /**
2109
- * Call guard to overwrite existing refresh token cookie
2110
- *
2111
- * @returns void
2112
- */
2113
- ;
2114
-
2115
- _proto.authLogout =
2116
- /*#__PURE__*/
2117
- function () {
2118
- var _authLogout = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
2119
- return runtime_1.wrap(function _callee3$(_context3) {
2120
- while (1) {
2121
- switch (_context3.prev = _context3.next) {
2122
- case 0:
2123
- return _context3.abrupt("return", this.api.get(this.baseURL + "/v1/auth/logout"));
2124
-
2125
- case 1:
2126
- case "end":
2127
- return _context3.stop();
2128
- }
2129
- }
2130
- }, _callee3, this);
2131
- }));
2132
-
2133
- function authLogout() {
2134
- return _authLogout.apply(this, arguments);
2135
- }
2136
-
2137
- return authLogout;
2138
- }()
2139
- /**
2140
- * Call guard to attempt account recovery
2141
- *
2142
- * @param req The email address / practice of the account to recover
2143
- * @returns void
2144
- */
2145
- ;
2146
-
2147
- _proto.authRecover =
2148
- /*#__PURE__*/
2149
- function () {
2150
- var _authRecover = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(req) {
2151
- return runtime_1.wrap(function _callee4$(_context4) {
2152
- while (1) {
2153
- switch (_context4.prev = _context4.next) {
2154
- case 0:
2155
- return _context4.abrupt("return", this.api.post(this.baseURL + "/v1/auth/recover", req));
2156
-
2157
- case 1:
2158
- case "end":
2159
- return _context4.stop();
2160
- }
2161
- }
2162
- }, _callee4, this);
2163
- }));
2164
-
2165
- function authRecover(_x3) {
2166
- return _authRecover.apply(this, arguments);
2167
- }
2168
-
2169
- return authRecover;
2170
- }()
2171
- /**
2172
- * Allow to create a new identity. The identity will then need to be confirmed
2173
- * via an email link
2174
- *
2175
- * @param req the information about the new identity to create
2176
- * @returns IdentityResponse
2177
- */
2178
- ;
2179
-
2180
- _proto.identityCreate =
2181
- /*#__PURE__*/
2182
- function () {
2183
- var _identityCreate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(req) {
2184
- var resp, _e$response2, code;
2185
-
2186
- return runtime_1.wrap(function _callee5$(_context5) {
2187
- while (1) {
2188
- switch (_context5.prev = _context5.next) {
2189
- case 0:
2190
- _context5.prev = 0;
2191
- _context5.next = 3;
2192
- return this.api.post(this.baseURL + "/v1/identities", req);
2193
-
2194
- case 3:
2195
- resp = _context5.sent;
2196
- this.api.setTokens({
2197
- refreshToken: resp.refreshToken
2198
- });
2199
- _context5.next = 18;
2200
- break;
2201
-
2202
- case 7:
2203
- _context5.prev = 7;
2204
- _context5.t0 = _context5["catch"](0);
2205
-
2206
- if (!_context5.t0.isAxiosError) {
2207
- _context5.next = 17;
2208
- break;
2209
- }
2210
-
2211
- code = (_e$response2 = _context5.t0.response) == null ? void 0 : _e$response2.status;
2212
- _context5.t1 = code;
2213
- _context5.next = _context5.t1 === 400 ? 14 : _context5.t1 === 409 ? 15 : _context5.t1 === 500 ? 16 : 16;
2214
- break;
2215
-
2216
- case 14:
2217
- throw new IdentityCreationBadRequest();
2218
-
2219
- case 15:
2220
- throw new IdentityCreationConflict();
2221
-
2222
- case 16:
2223
- throw new IdentityCreationFailed();
2224
-
2225
- case 17:
2226
- throw new IdentityCreationFailed();
2227
-
2228
- case 18:
2229
- return _context5.abrupt("return", resp);
2230
-
2231
- case 19:
2232
- case "end":
2233
- return _context5.stop();
2234
- }
2235
- }
2236
- }, _callee5, this, [[0, 7]]);
2237
- }));
2238
-
2239
- function identityCreate(_x4) {
2240
- return _identityCreate.apply(this, arguments);
2241
- }
2242
-
2243
- return identityCreate;
2244
- }()
2245
- /**
2246
- * Retrieve an identity. Will return public fields only when requested
2247
- * without authentication
2248
- *
2249
- * @param identityID Unique id of the identity to retrieve
2250
- * @returns IdentityResponse
2251
- */
2252
- ;
2253
-
2254
- _proto.identityGet =
2255
- /*#__PURE__*/
2256
- function () {
2257
- var _identityGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(identityID) {
2258
- var _tokens$accessToken, _tokens$refreshToken;
2259
-
2260
- var tokens, cacheKey;
2261
- return runtime_1.wrap(function _callee6$(_context6) {
2262
- while (1) {
2263
- switch (_context6.prev = _context6.next) {
2264
- case 0:
2265
- tokens = this.api.getTokens();
2266
- cacheKey = ((_tokens$accessToken = tokens.accessToken) != null ? _tokens$accessToken : '') + ((_tokens$refreshToken = tokens.refreshToken) != null ? _tokens$refreshToken : '') + identityID;
2267
-
2268
- if (!(!tokens.accessToken || !this.identityCache[cacheKey])) {
2269
- _context6.next = 6;
2270
- break;
2271
- }
2272
-
2273
- _context6.next = 5;
2274
- return this.api.get(this.baseURL + "/v1/identities/" + identityID);
2275
-
2276
- case 5:
2277
- this.identityCache[cacheKey] = _context6.sent;
2278
-
2279
- case 6:
2280
- return _context6.abrupt("return", this.identityCache[cacheKey]);
2281
-
2282
- case 7:
2283
- case "end":
2284
- return _context6.stop();
2285
- }
2286
- }
2287
- }, _callee6, this);
2288
- }));
2289
-
2290
- function identityGet(_x5) {
2291
- return _identityGet.apply(this, arguments);
2292
- }
2293
-
2294
- return identityGet;
2295
- }()
2296
- /**
2297
- * Get information about the current authenticated user
2298
- *
2299
- * @param refreshCache if true it will refresh the whoAmI cache (default: false)
2300
- * @returns WhoAmIResponse
2301
- */
2302
- ;
2303
-
2304
- _proto.whoAmI =
2305
- /*#__PURE__*/
2306
- function () {
2307
- var _whoAmI = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(refreshCache) {
2308
- var _this$api$getTokens$a;
2309
-
2310
- var cacheKey;
2311
- return runtime_1.wrap(function _callee7$(_context7) {
2312
- while (1) {
2313
- switch (_context7.prev = _context7.next) {
2314
- case 0:
2315
- if (refreshCache === void 0) {
2316
- refreshCache = false;
2317
- }
2318
-
2319
- cacheKey = (_this$api$getTokens$a = this.api.getTokens().accessToken) != null ? _this$api$getTokens$a : '';
2320
-
2321
- if (!(!this.whoAmICache[cacheKey] || refreshCache)) {
2322
- _context7.next = 6;
2323
- break;
2324
- }
2325
-
2326
- _context7.next = 5;
2327
- return this.api.get(this.baseURL + "/v1/auth/whoami");
2328
-
2329
- case 5:
2330
- this.whoAmICache[cacheKey] = _context7.sent;
2331
-
2332
- case 6:
2333
- return _context7.abrupt("return", this.whoAmICache[cacheKey]);
2334
-
2335
- case 7:
2336
- case "end":
2337
- return _context7.stop();
2338
- }
2339
- }
2340
- }, _callee7, this);
2341
- }));
2342
-
2343
- function whoAmI(_x6) {
2344
- return _whoAmI.apply(this, arguments);
2345
- }
2346
-
2347
- return whoAmI;
2348
- }()
2349
- /**
2350
- * Update an existing identity
2351
- *
2352
- * @param identityID unique id of identity to update
2353
- * @param req update request
2354
- * @returns IdentityResponse
2355
- */
2356
- ;
2357
-
2358
- _proto.identityUpdate =
2359
- /*#__PURE__*/
2360
- function () {
2361
- var _identityUpdate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(identityID, req) {
2362
- return runtime_1.wrap(function _callee8$(_context8) {
2363
- while (1) {
2364
- switch (_context8.prev = _context8.next) {
2365
- case 0:
2366
- return _context8.abrupt("return", this.api.put(this.baseURL + "/v1/identities/" + identityID, req));
2367
-
2368
- case 1:
2369
- case "end":
2370
- return _context8.stop();
2371
- }
2372
- }
2373
- }, _callee8, this);
2374
- }));
2375
-
2376
- function identityUpdate(_x7, _x8) {
2377
- return _identityUpdate.apply(this, arguments);
2378
- }
2379
-
2380
- return identityUpdate;
2381
- }()
2382
- /**
2383
- * Return base64 data representing a QR code that the
2384
- * current identity need in order to use MFA
2385
- *
2386
- * @param identityID unique id of the identity
2387
- * @param password the identity password (already hashed and in base64)
2388
- * @returns QRCodeResponse
2389
- */
2390
- ;
2391
-
2392
- _proto.identityMFAQRCode =
2393
- /*#__PURE__*/
2394
- function () {
2395
- var _identityMFAQRCode = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(identityID, password) {
2396
- var req;
2397
- return runtime_1.wrap(function _callee9$(_context9) {
2398
- while (1) {
2399
- switch (_context9.prev = _context9.next) {
2400
- case 0:
2401
- req = {
2402
- password: password
2403
- };
2404
- return _context9.abrupt("return", this.api.post(this.baseURL + "/v1/identities/" + identityID + "/mfa", req, {
2405
- headers: {
2406
- 'Accept': 'application/json'
2407
- }
2408
- }));
2409
-
2410
- case 2:
2411
- case "end":
2412
- return _context9.stop();
2413
- }
2414
- }
2415
- }, _callee9, this);
2416
- }));
2417
-
2418
- function identityMFAQRCode(_x9, _x10) {
2419
- return _identityMFAQRCode.apply(this, arguments);
2420
- }
2421
-
2422
- return identityMFAQRCode;
2423
- }();
2424
-
2425
- return GuardService;
2426
- }();
2427
-
2428
- var PracticeService = /*#__PURE__*/function () {
2429
- function PracticeService(toolbox, api, baseURL) {
2430
- this.toolbox = toolbox;
2431
- this.api = api;
2432
- this.baseURL = baseURL;
2433
- }
2434
- /**
2435
- * This function get the practice from the URL of a practice
2436
- * It is the entry point of our web apps
2437
- * @param practiceURL URL of the practice to search
2438
- * @param hydratePracticeConfigs (optional) if set true it the Practice field configs will be set
2439
- * @param accounts (optional) if set true it the Practice field accounts will be set
2440
- * @returns the found practice or undefined
2441
- */
2442
-
2443
-
2444
- var _proto = PracticeService.prototype;
2445
-
2446
- _proto.practiceGetFromURL = function practiceGetFromURL(practiceURL, params) {
2447
- return this.api.get(this.baseURL + "/v1/practices", {
2448
- params: _extends({
2449
- url_practice: practiceURL
2450
- }, params)
2451
- });
2452
- };
2453
-
2454
- _proto.practiceGetFromUuid = function practiceGetFromUuid(practiceUuid, locale, withAccounts) {
2455
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid, {
2456
- params: {
2457
- locale: locale,
2458
- accounts: withAccounts
2459
- }
2460
- });
2461
- } /// Practice Configs
2462
-
2463
- /**
2464
- * This function retrieves all configs of a specific practice
2465
- * @param practiceUuid uuid of the practice
2466
- * @returns the practice configs
2467
- */
2468
- ;
2469
-
2470
- _proto.practiceConfigGetFromPracticeUuid = function practiceConfigGetFromPracticeUuid(practiceUuid) {
2471
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/configs");
2472
- }
2473
- /**
2474
- * This function retrieves a specific config of a practice
2475
- * @param practiceUuid uuid of the practice
2476
- * @param kind of the config
2477
- * @returns the practice config
2478
- */
2479
- ;
2480
-
2481
- _proto.practiceConfigGetByKindForPracticeUuid = function practiceConfigGetByKindForPracticeUuid(practiceUuid, kind) {
2482
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/configs/" + kind);
2483
- }
2484
- /**
2485
- * This function creates a config for a specific practice
2486
- * @param practiceUuid uuid of the practice
2487
- * @param config the config to add to the practice
2488
- * @returns the created practice config
2489
- */
2490
- ;
2491
-
2492
- _proto.practiceConfigCreateForPracticeUuid = function practiceConfigCreateForPracticeUuid(practiceUuid, config) {
2493
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/configs", config);
2494
- }
2495
- /**
2496
- * This function updates a specific config of a practice
2497
- * @param practiceUuid uuid of the practice
2498
- * @param config the config to update
2499
- * @returns the practice config
2500
- */
2501
- ;
2502
-
2503
- _proto.practiceConfigUpdate = function practiceConfigUpdate(config) {
2504
- return this.api.put(this.baseURL + "/v1/practices/" + config.uuidPractice + "/configs/" + config.kind, config);
2505
- } /// Accounts
2506
- ;
2507
-
2508
- _proto.practiceGetAccounts = function practiceGetAccounts(practiceUuid) {
2509
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/accounts");
2510
- };
2511
-
2512
- _proto.practiceGetAccount = function practiceGetAccount(practiceUuid, accountUuid) {
2513
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/accounts/" + accountUuid);
2514
- } /// Workflows
2515
- ;
2516
-
2517
- _proto.practiceGetWorkflows = function practiceGetWorkflows(practiceUuid) {
2518
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/workflows");
2519
- };
2520
-
2521
- _proto.practiceGetWorkflow = function practiceGetWorkflow(practiceUuid, workflowType) {
2522
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/workflows/" + workflowType);
2523
- } /// Plans
2524
- ;
2525
-
2526
- _proto.practiceGetPlans = function practiceGetPlans(practiceUuid, planType) {
2527
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans", {
2528
- params: {
2529
- kind: planType
2530
- }
2531
- });
2532
- };
2533
-
2534
- _proto.practiceGetPlan = function practiceGetPlan(practiceUuid, planId) {
2535
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans/" + planId);
2536
- };
2537
-
2538
- _proto.practiceGetPlanPrices = function practiceGetPlanPrices(practiceUuid, planId) {
2539
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/plans/" + planId + "/prices");
2540
- } // Payments
2541
- ;
2542
-
2543
- _proto.practiceGetPayments = function practiceGetPayments(practiceUuid, planType) {
2544
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments", {
2545
- params: {
2546
- kind: planType
2547
- }
2548
- });
2549
- };
2550
-
2551
- _proto.practiceGetPayment = function practiceGetPayment(practiceUuid, idStripeInvoiceOrPaymentIntent) {
2552
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/" + idStripeInvoiceOrPaymentIntent);
2553
- };
2554
-
2555
- _proto.practiceGetPaymentForStripePaymentIntentWithID = function practiceGetPaymentForStripePaymentIntentWithID(practiceUuid, stripePaymentIntentId) {
2556
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/" + stripePaymentIntentId);
2557
- } // Payments Intent
2558
- ;
2559
-
2560
- _proto.practiceGetPaymentsIntents = function practiceGetPaymentsIntents(practiceUuid, planType) {
2561
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents", {
2562
- params: {
2563
- kind: planType
2564
- }
2565
- });
2566
- }
2567
- /**
2568
- * This function return the user hased email to be use for creating payment intent
2569
- * @param email the email to hash
2570
- * @returns a hashed email
2571
- */
2572
- ;
2573
-
2574
- _proto.getPaymentIntentHashedEmail = function getPaymentIntentHashedEmail(email) {
2575
- return this.toolbox.hashStringToBase64(email.toLowerCase());
2576
- };
2577
-
2578
- _proto.practiceCreatePaymentsIntent = function practiceCreatePaymentsIntent(practiceUuid, planId, userEmail, isoLocality, url_subdomain, promotionCode) {
2579
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/", {
2580
- idPlan: planId,
2581
- hashUserEmail: userEmail ? this.getPaymentIntentHashedEmail(userEmail) : undefined,
2582
- isoLocality: isoLocality
2583
- }, {
2584
- params: {
2585
- url_subdomain: url_subdomain,
2586
- promotionCode: promotionCode
2587
- }
2588
- });
2589
- };
2590
-
2591
- _proto.practiceGetPaymentsIntent = function practiceGetPaymentsIntent(practiceUuid, paymentIntentId) {
2592
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/" + paymentIntentId);
2593
- };
2594
-
2595
- _proto.practiceUpdatePaymentsIntent = function practiceUpdatePaymentsIntent(practiceUuid, idPraticePaymentIntent, practicePaymentIntent, userEmail, promotionCode) {
2596
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/payments/intents/" + idPraticePaymentIntent, _extends({}, practicePaymentIntent, {
2597
- hashUserEmail: userEmail ? this.getPaymentIntentHashedEmail(userEmail) : undefined
2598
- }), {
2599
- params: {
2600
- promotionCode: promotionCode
2601
- }
2602
- });
2603
- } // Practitioner
2604
- ;
2605
-
2606
- _proto.practiceGetPractitioners = function practiceGetPractitioners(practiceUuid) {
2607
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners");
2608
- };
2609
-
2610
- _proto.practiceUpdatePractitioner = function practiceUpdatePractitioner(practiceUuid, practitionerUuid, requestBody) {
2611
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid, requestBody);
2612
- };
2613
-
2614
- _proto.practiceGetPractitioner = function practiceGetPractitioner(practiceUuid, practitionerUuid) {
2615
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid);
2616
- } // Practitioner Licenses
2617
- ;
2618
-
2619
- _proto.practiceGetPractitionerLicenses = function practiceGetPractitionerLicenses(practiceUuid, practitionerUuid) {
2620
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses");
2621
- };
2622
-
2623
- _proto.practiceCreatePractitionerLicense = function practiceCreatePractitionerLicense(practiceUuid, practitionerUuid, requestBody) {
2624
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses", requestBody);
2625
- };
2626
-
2627
- _proto.practiceUpdatePractitionerLicense = function practiceUpdatePractitionerLicense(practiceUuid, practitionerUuid, licenseId, requestBody) {
2628
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses/" + licenseId, requestBody);
2629
- };
2630
-
2631
- _proto.practiceGetPractitionerLicense = function practiceGetPractitionerLicense(practiceUuid, practitionerUuid, licenseId) {
2632
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/licenses/" + licenseId);
2633
- } // Practitioner Preferences
2634
- ;
2635
-
2636
- _proto.practiceGetPractitionerPreferences = function practiceGetPractitionerPreferences(practiceUuid, practitionerUuid) {
2637
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences");
2638
- };
2639
-
2640
- _proto.practiceCreatePractitionerPreference = function practiceCreatePractitionerPreference(practiceUuid, practitionerUuid, requestBody) {
2641
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences", requestBody);
2642
- };
2643
-
2644
- _proto.practiceUpdatePractitionerPreference = function practiceUpdatePractitionerPreference(practiceUuid, practitionerUuid, preferenceId, requestBody) {
2645
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences/" + preferenceId, requestBody);
2646
- };
2647
-
2648
- _proto.practiceGetPractitionerPreference = function practiceGetPractitionerPreference(practiceUuid, practitionerUuid, preferenceId) {
2649
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/preferences/" + preferenceId);
2650
- } // Practitioner Roles
2651
- ;
2652
-
2653
- _proto.practiceGetPractitionerRoles = function practiceGetPractitionerRoles(practiceUuid, practitionerUuid) {
2654
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles");
2655
- };
2656
-
2657
- _proto.practiceCreatePractitionerRole = function practiceCreatePractitionerRole(practiceUuid, practitionerUuid, requestBody) {
2658
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles", requestBody);
2659
- };
2660
-
2661
- _proto.practiceDeletePractitionerRoles = function practiceDeletePractitionerRoles(practiceUuid, practitionerUuid) {
2662
- return this.api.deleteRequest(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles");
2663
- };
2664
-
2665
- _proto.practiceUpdatePractitionerRole = function practiceUpdatePractitionerRole(practiceUuid, practitionerUuid, roleId, requestBody) {
2666
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId, requestBody);
2667
- };
2668
-
2669
- _proto.practiceGetPractitionerRole = function practiceGetPractitionerRole(practiceUuid, practitionerUuid, roleId) {
2670
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId);
2671
- };
2672
-
2673
- _proto.practiceDeletePractitionerRole = function practiceDeletePractitionerRole(practiceUuid, practitionerUuid, roleId) {
2674
- return this.api.deleteRequest(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/roles/" + roleId);
2675
- } // Practitioner signature
2676
-
2677
- /**
2678
- * This function returns the practitioner's signature as a Blob
2679
- * @param practiceUuid the practice uuid of the practitioner
2680
- * @param practitionerUuid the practitioner uuid
2681
- * @returns a blob representing the signature
2682
- */
2683
- ;
2684
-
2685
- _proto.practiceGetPractitionerSignature = function practiceGetPractitionerSignature(practiceUuid, practitionerUuid) {
2686
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/practitioners/" + practitionerUuid + "/signature", {
2687
- responseType: 'blob'
2688
- });
2689
- } // Assignments
2690
- ;
2691
-
2692
- _proto.practiceGetAssignments = function practiceGetAssignments(practiceUuid) {
2693
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments");
2694
- };
2695
-
2696
- _proto.practiceCreateAssignment = function practiceCreateAssignment(practiceUuid, requestBody) {
2697
- return this.api.post(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments", requestBody);
2698
- };
2699
-
2700
- _proto.practiceUpdateAssignment = function practiceUpdateAssignment(practiceUuid, assignmentId, requestBody) {
2701
- return this.api.put(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments/" + assignmentId, requestBody);
2702
- };
2703
-
2704
- _proto.practiceGetAssignment = function practiceGetAssignment(practiceUuid, assignmentId) {
2705
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/assignments/" + assignmentId);
2706
- } // Quotas
2707
- ;
2708
-
2709
- _proto.practiceGetQuotas = function practiceGetQuotas(practiceUuid) {
2710
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/quotas");
2711
- };
2712
-
2713
- _proto.practiceGetQuota = function practiceGetQuota(practiceUuid, quotaId) {
2714
- return this.api.get(this.baseURL + "/v1/practices/" + practiceUuid + "/quotas/" + quotaId);
2715
- };
2716
-
2717
- return PracticeService;
2718
- }();
2719
-
2720
- var TellerService = /*#__PURE__*/function () {
2721
- function TellerService(api, baseURL) {
2722
- this.api = api;
2723
- this.baseURL = baseURL;
2724
- }
2725
-
2726
- var _proto = TellerService.prototype;
2727
-
2728
- _proto.lockboxDataStore = /*#__PURE__*/function () {
2729
- var _lockboxDataStore = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(lockboxUuid, req, lockboxOwnerUuid, previousDataUuid) {
2730
- return runtime_1.wrap(function _callee$(_context) {
2731
- while (1) {
2732
- switch (_context.prev = _context.next) {
2733
- case 0:
2734
- return _context.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data", req, {
2735
- params: {
2736
- lockbox_owner_uuid: lockboxOwnerUuid,
2737
- data_uuid: previousDataUuid
2738
- }
2739
- }));
2740
-
2741
- case 1:
2742
- case "end":
2743
- return _context.stop();
2744
- }
2745
- }
2746
- }, _callee, this);
2747
- }));
2748
-
2749
- function lockboxDataStore(_x, _x2, _x3, _x4) {
2750
- return _lockboxDataStore.apply(this, arguments);
2751
- }
2752
-
2753
- return lockboxDataStore;
2754
- }();
2755
-
2756
- _proto.updateConsultByUUID = function updateConsultByUUID(patientUuid, uuidConsult, statusMedical, neverExpires) {
2757
- return this.api.put(this.baseURL + "/v1/consults/" + uuidConsult, {
2758
- patientUuid: patientUuid,
2759
- statusMedical: statusMedical,
2760
- neverExpires: neverExpires
2761
- });
2762
- };
2763
-
2764
- return TellerService;
2765
- }();
2766
-
2767
- var VaultService = /*#__PURE__*/function () {
2768
- function VaultService(api, baseURL) {
2769
- this.api = api;
2770
- this.baseURL = baseURL;
2771
- }
2772
-
2773
- var _proto = VaultService.prototype;
2774
-
2775
- _proto.lockboxCreate = /*#__PURE__*/function () {
2776
- var _lockboxCreate = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(lockboxMetadata) {
2777
- return runtime_1.wrap(function _callee$(_context) {
2778
- while (1) {
2779
- switch (_context.prev = _context.next) {
2780
- case 0:
2781
- return _context.abrupt("return", this.api.post(this.baseURL + "/v1/lockbox", lockboxMetadata));
2782
-
2783
- case 1:
2784
- case "end":
2785
- return _context.stop();
2786
- }
2787
- }
2788
- }, _callee, this);
2789
- }));
2790
-
2791
- function lockboxCreate(_x) {
2792
- return _lockboxCreate.apply(this, arguments);
2793
- }
2794
-
2795
- return lockboxCreate;
2796
- }();
2797
-
2798
- _proto.lockboxMetadataAdd = /*#__PURE__*/function () {
2799
- var _lockboxMetadataAdd = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(lockboxUuid, lockboxMetadata, lockboxOwnerUuid) {
2800
- return runtime_1.wrap(function _callee2$(_context2) {
2801
- while (1) {
2802
- switch (_context2.prev = _context2.next) {
2803
- case 0:
2804
- return _context2.abrupt("return", this.api.put(this.baseURL + "/v1/lockbox/" + lockboxUuid, lockboxMetadata, {
2805
- params: {
2806
- lockbox_owner_uuid: lockboxOwnerUuid
2807
- }
2808
- }));
2809
-
2810
- case 1:
2811
- case "end":
2812
- return _context2.stop();
2813
- }
2814
- }
2815
- }, _callee2, this);
2816
- }));
2817
-
2818
- function lockboxMetadataAdd(_x2, _x3, _x4) {
2819
- return _lockboxMetadataAdd.apply(this, arguments);
2820
- }
2821
-
2822
- return lockboxMetadataAdd;
2823
- }();
2824
-
2825
- _proto.lockboxSecretGet = /*#__PURE__*/function () {
2826
- var _lockboxSecretGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(lockboxUuid, lockboxOwnerUuid) {
2827
- return runtime_1.wrap(function _callee3$(_context3) {
2828
- while (1) {
2829
- switch (_context3.prev = _context3.next) {
2830
- case 0:
2831
- return _context3.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/secret", {
2832
- params: {
2833
- lockbox_owner_uuid: lockboxOwnerUuid
2834
- }
2835
- }));
2836
-
2837
- case 1:
2838
- case "end":
2839
- return _context3.stop();
2840
- }
2841
- }
2842
- }, _callee3, this);
2843
- }));
2844
-
2845
- function lockboxSecretGet(_x5, _x6) {
2846
- return _lockboxSecretGet.apply(this, arguments);
2847
- }
2848
-
2849
- return lockboxSecretGet;
2850
- }();
2851
-
2852
- _proto.lockboxGrant = /*#__PURE__*/function () {
2853
- var _lockboxGrant = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(lockboxUuid, req, lockboxOwnerUuid) {
2854
- return runtime_1.wrap(function _callee4$(_context4) {
2855
- while (1) {
2856
- switch (_context4.prev = _context4.next) {
2857
- case 0:
2858
- return _context4.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/grant", req, {
2859
- params: {
2860
- lockbox_owner_uuid: lockboxOwnerUuid
2861
- }
2862
- }));
2863
-
2864
- case 1:
2865
- case "end":
2866
- return _context4.stop();
2867
- }
2868
- }
2869
- }, _callee4, this);
2870
- }));
2871
-
2872
- function lockboxGrant(_x7, _x8, _x9) {
2873
- return _lockboxGrant.apply(this, arguments);
2874
- }
2875
-
2876
- return lockboxGrant;
2877
- }()
2878
- /**
2879
- * Get all lockboxes granted to user
2880
- * @param filter filter of lockbox metadata
2881
- * @returns decrypted lockboxes granted to user
2882
- */
2883
- ;
2884
-
2885
- _proto.grantsGet =
2886
- /*#__PURE__*/
2887
- function () {
2888
- var _grantsGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
2889
- return runtime_1.wrap(function _callee5$(_context5) {
2890
- while (1) {
2891
- switch (_context5.prev = _context5.next) {
2892
- case 0:
2893
- return _context5.abrupt("return", this.api.get(this.baseURL + "/v1/grants"));
2894
-
2895
- case 1:
2896
- case "end":
2897
- return _context5.stop();
2898
- }
2899
- }
2900
- }, _callee5, this);
2901
- }));
2902
-
2903
- function grantsGet() {
2904
- return _grantsGet.apply(this, arguments);
2905
- }
2906
-
2907
- return grantsGet;
2908
- }()
2909
- /**
2910
- * This function create or update a data into the vault.
2911
- * @note At creation it is necessary to have all `req` filled
2912
- * @note When setting `previousDataUuid` you are updating the data. `req` metadata fields are optional.
2913
- * @param lockboxUuid The lockbox uuid the data will be stored in
2914
- * @param req The request (please see notes)
2915
- * @param lockboxOwnerUuid The uuid of the owner of the lockbox (@deprecated)
2916
- * @param previousDataUuid The data uuid of the data you want to update
2917
- * @returns
2918
- */
2919
- ;
2920
-
2921
- _proto.lockboxDataStore =
2922
- /*#__PURE__*/
2923
- function () {
2924
- var _lockboxDataStore = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(lockboxUuid, req, lockboxOwnerUuid, previousDataUuid) {
2925
- return runtime_1.wrap(function _callee6$(_context6) {
2926
- while (1) {
2927
- switch (_context6.prev = _context6.next) {
2928
- case 0:
2929
- return _context6.abrupt("return", this.api.post(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data", req, {
2930
- params: {
2931
- lockbox_owner_uuid: lockboxOwnerUuid,
2932
- data_uuid: previousDataUuid
2933
- }
2934
- }));
2935
-
2936
- case 1:
2937
- case "end":
2938
- return _context6.stop();
2939
- }
2940
- }
2941
- }, _callee6, this);
2942
- }));
2943
-
2944
- function lockboxDataStore(_x10, _x11, _x12, _x13) {
2945
- return _lockboxDataStore.apply(this, arguments);
2946
- }
2947
-
2948
- return lockboxDataStore;
2949
- }();
2950
-
2951
- _proto.lockboxDataGet = /*#__PURE__*/function () {
2952
- var _lockboxDataGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(lockboxUuid, dataUuid, lockboxOwnerUuid, stream) {
2953
- var data;
2954
- return runtime_1.wrap(function _callee7$(_context7) {
2955
- while (1) {
2956
- switch (_context7.prev = _context7.next) {
2957
- case 0:
2958
- if (stream === void 0) {
2959
- stream = true;
2960
- }
2961
-
2962
- _context7.next = 3;
2963
- return this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/data/" + dataUuid, {
2964
- params: {
2965
- lockbox_owner_uuid: lockboxOwnerUuid,
2966
- stream: stream
2967
- }
2968
- });
2969
-
2970
- case 3:
2971
- data = _context7.sent;
2972
-
2973
- if (!stream) {
2974
- _context7.next = 6;
2975
- break;
2976
- }
2977
-
2978
- return _context7.abrupt("return", {
2979
- data: data
2980
- });
2981
-
2982
- case 6:
2983
- return _context7.abrupt("return", data);
2984
-
2985
- case 7:
2986
- case "end":
2987
- return _context7.stop();
2988
- }
2989
- }
2990
- }, _callee7, this);
2991
- }));
2992
-
2993
- function lockboxDataGet(_x14, _x15, _x16, _x17) {
2994
- return _lockboxDataGet.apply(this, arguments);
2995
- }
2996
-
2997
- return lockboxDataGet;
2998
- }();
2999
-
3000
- _proto.lockboxManifestGet = /*#__PURE__*/function () {
3001
- var _lockboxManifestGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(lockboxUuid, filter, lockboxOwnerUuid) {
3002
- return runtime_1.wrap(function _callee8$(_context8) {
3003
- while (1) {
3004
- switch (_context8.prev = _context8.next) {
3005
- case 0:
3006
- return _context8.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid, {
3007
- params: {
3008
- lockbox_owner_uuid: lockboxOwnerUuid,
3009
- filter: filter
3010
- }
3011
- }));
3012
-
3013
- case 1:
3014
- case "end":
3015
- return _context8.stop();
3016
- }
3017
- }
3018
- }, _callee8, this);
3019
- }));
3020
-
3021
- function lockboxManifestGet(_x18, _x19, _x20) {
3022
- return _lockboxManifestGet.apply(this, arguments);
3023
- }
3024
-
3025
- return lockboxManifestGet;
3026
- }();
3027
-
3028
- _proto.lockboxMetadataGet = /*#__PURE__*/function () {
3029
- var _lockboxMetadataGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(lockboxUuid, fields, groupby, filter, lockboxOwnerUuid) {
3030
- return runtime_1.wrap(function _callee9$(_context9) {
3031
- while (1) {
3032
- switch (_context9.prev = _context9.next) {
3033
- case 0:
3034
- return _context9.abrupt("return", this.api.get(this.baseURL + "/v1/lockboxes/" + lockboxUuid + "/metadata", {
3035
- params: {
3036
- lockbox_owner_uuid: lockboxOwnerUuid,
3037
- fields: fields,
3038
- groupby: groupby,
3039
- filter: filter
3040
- }
3041
- }));
3042
-
3043
- case 1:
3044
- case "end":
3045
- return _context9.stop();
3046
- }
3047
- }
3048
- }, _callee9, this);
3049
- }));
3050
-
3051
- function lockboxMetadataGet(_x21, _x22, _x23, _x24, _x25) {
3052
- return _lockboxMetadataGet.apply(this, arguments);
3053
- }
3054
-
3055
- return lockboxMetadataGet;
3056
- }()
3057
- /**
3058
- * inserts or updates encrypted index entries
3059
- * @note if the index data is being inserted for a user other than the requester, use `indexOwnerUuid`
3060
- * @note if a uuid for an entry is provided, the service will perform an update
3061
- * @param entries the encrypted index data
3062
- * @param indexOwnerUuid
3063
- */
3064
- ;
3065
-
3066
- _proto.vaultIndexPut =
3067
- /*#__PURE__*/
3068
- function () {
3069
- var _vaultIndexPut = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(entries, indexOwnerUuid) {
3070
- return runtime_1.wrap(function _callee10$(_context10) {
3071
- while (1) {
3072
- switch (_context10.prev = _context10.next) {
3073
- case 0:
3074
- return _context10.abrupt("return", this.api.put(this.baseURL + "/v1/index", entries, {
3075
- params: {
3076
- index_owner_uuid: indexOwnerUuid
3077
- }
3078
- }));
3079
-
3080
- case 1:
3081
- case "end":
3082
- return _context10.stop();
3083
- }
3084
- }
3085
- }, _callee10, this);
3086
- }));
3087
-
3088
- function vaultIndexPut(_x26, _x27) {
3089
- return _vaultIndexPut.apply(this, arguments);
3090
- }
3091
-
3092
- return vaultIndexPut;
3093
- }()
3094
- /**
3095
- * inserts or updates index snapshot for the provided index owner
3096
- * @note if the index data is being inserted for a user other than the requester, use `indexOwnerUuid`
3097
- * @param entry the encrypted index snapshot
3098
- */
3099
- ;
3100
-
3101
- _proto.vaultIndexSnapshotPut =
3102
- /*#__PURE__*/
3103
- function () {
3104
- var _vaultIndexSnapshotPut = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(entry) {
3105
- return runtime_1.wrap(function _callee11$(_context11) {
3106
- while (1) {
3107
- switch (_context11.prev = _context11.next) {
3108
- case 0:
3109
- return _context11.abrupt("return", this.api.put(this.baseURL + "/v1/index-snapshot", entry));
3110
-
3111
- case 1:
3112
- case "end":
3113
- return _context11.stop();
3114
- }
3115
- }
3116
- }, _callee11, this);
3117
- }));
3118
-
3119
- function vaultIndexSnapshotPut(_x28) {
3120
- return _vaultIndexSnapshotPut.apply(this, arguments);
3121
- }
3122
-
3123
- return vaultIndexSnapshotPut;
3124
- }()
3125
- /**
3126
- * Retrieves the encrypted index from the vault for the requesting user
3127
- * @note index keys can be specified to narrow the scope of index being requested
3128
- * @param indexKeys accepted index fields determined by vault
3129
- * @param identifiers: an array of unique_hashes or consultation uuids used to identify an index entry
3130
- * @param timestamp the minimum timestamp that index entries were created
3131
- * @returns the encrypted index
3132
- */
3133
- ;
3134
-
3135
- _proto.vaultIndexGet =
3136
- /*#__PURE__*/
3137
- function () {
3138
- var _vaultIndexGet = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee12(indexKeys, identifiers, timestamp) {
3139
- return runtime_1.wrap(function _callee12$(_context12) {
3140
- while (1) {
3141
- switch (_context12.prev = _context12.next) {
3142
- case 0:
3143
- return _context12.abrupt("return", this.api.get(this.baseURL + "/v1/index", {
3144
- params: {
3145
- index_keys: indexKeys,
3146
- identifiers: identifiers,
3147
- timestamp: timestamp
3148
- }
3149
- }));
3150
-
3151
- case 1:
3152
- case "end":
3153
- return _context12.stop();
3154
- }
3155
- }
3156
- }, _callee12, this);
3157
- }));
3158
-
3159
- function vaultIndexGet(_x29, _x30, _x31) {
3160
- return _vaultIndexGet.apply(this, arguments);
3161
- }
3162
-
3163
- return vaultIndexGet;
3164
- }();
3165
-
3166
- return VaultService;
3167
- }();
3168
-
3169
- var WorkflowService = /*#__PURE__*/function () {
3170
- function WorkflowService(api, url) {
3171
- this.api = api;
3172
- this.v1Url = url + "/v1";
3173
- }
3174
- /**
3175
- * This function returns all workflows
3176
- * @returns desired workflow
3177
- */
3178
-
907
+ }
3179
908
 
3180
- var _proto = WorkflowService.prototype;
909
+ if (finallyEntry &&
910
+ (type === "break" ||
911
+ type === "continue") &&
912
+ finallyEntry.tryLoc <= arg &&
913
+ arg <= finallyEntry.finallyLoc) {
914
+ // Ignore the finally entry if control is not jumping to a
915
+ // location outside the try/catch block.
916
+ finallyEntry = null;
917
+ }
3181
918
 
3182
- _proto.getWorkflows = function getWorkflows() {
3183
- return this.api.get(this.v1Url + "/workflows");
3184
- }
3185
- /**
3186
- * This function retrieves a workflow. If `locale` is not found, it will try to find 'en' version of it.
3187
- * By default, will return most recent workflow of a specific `id`. `createdAt` can be used to select older version.
3188
- * @param id The uuid of the workflow
3189
- * @param locale (optional) The desired locale of the workflow (default: 'en')
3190
- * @param createdAt (optional) The creation date of the workflow (also used for versionning)
3191
- * @returns desired workflow
3192
- */
3193
- ;
919
+ var record = finallyEntry ? finallyEntry.completion : {};
920
+ record.type = type;
921
+ record.arg = arg;
3194
922
 
3195
- _proto.getWorkflow = function getWorkflow(id, locale, createdAt) {
3196
- return this.api.get(this.v1Url + "/workflows/" + id, {
3197
- params: {
3198
- locale: locale,
3199
- createdAt: createdAt
923
+ if (finallyEntry) {
924
+ this.method = "next";
925
+ this.next = finallyEntry.finallyLoc;
926
+ return ContinueSentinel;
3200
927
  }
3201
- });
3202
- };
3203
928
 
3204
- return WorkflowService;
3205
- }();
929
+ return this.complete(record);
930
+ },
3206
931
 
3207
- var _excluded = ["locale"],
3208
- _excluded2 = ["locale"];
3209
- var CliniaService = /*#__PURE__*/function () {
3210
- function CliniaService(url, apiKey, locale) {
3211
- this.url = url;
3212
- this.locale = locale;
3213
- this.api = new AxiosService({
3214
- headers: {
3215
- 'X-Clinia-API-Key': apiKey
932
+ complete: function(record, afterLoc) {
933
+ if (record.type === "throw") {
934
+ throw record.arg;
3216
935
  }
3217
- });
3218
- }
3219
936
 
3220
- var _proto = CliniaService.prototype;
937
+ if (record.type === "break" ||
938
+ record.type === "continue") {
939
+ this.next = record.arg;
940
+ } else if (record.type === "return") {
941
+ this.rval = this.arg = record.arg;
942
+ this.method = "return";
943
+ this.next = "end";
944
+ } else if (record.type === "normal" && afterLoc) {
945
+ this.next = afterLoc;
946
+ }
3221
947
 
3222
- _proto.placeSearch = function placeSearch(searchOptions) {
3223
- var locale = searchOptions.locale,
3224
- data = _objectWithoutPropertiesLoose(searchOptions, _excluded);
948
+ return ContinueSentinel;
949
+ },
3225
950
 
3226
- return this.api.post(this.url + "/search/v1/indexes/health_facility/query", data, {
3227
- params: {
3228
- locale: locale != null ? locale : this.locale
951
+ finish: function(finallyLoc) {
952
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
953
+ var entry = this.tryEntries[i];
954
+ if (entry.finallyLoc === finallyLoc) {
955
+ this.complete(entry.completion, entry.afterLoc);
956
+ resetTryEntry(entry);
957
+ return ContinueSentinel;
958
+ }
3229
959
  }
3230
- });
3231
- };
960
+ },
3232
961
 
3233
- _proto.placeMatch = function placeMatch(searchOptions, type) {
3234
- var locale = searchOptions.locale,
3235
- data = _objectWithoutPropertiesLoose(searchOptions, _excluded2);
962
+ "catch": function(tryLoc) {
963
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
964
+ var entry = this.tryEntries[i];
965
+ if (entry.tryLoc === tryLoc) {
966
+ var record = entry.completion;
967
+ if (record.type === "throw") {
968
+ var thrown = record.arg;
969
+ resetTryEntry(entry);
970
+ }
971
+ return thrown;
972
+ }
973
+ }
3236
974
 
3237
- var request = this.api.post(this.url + "/search/v1/matches", data, {
3238
- params: {
3239
- locale: locale != null ? locale : this.locale
975
+ // The context.catch method must only be called with a location
976
+ // argument that corresponds to a known catch block.
977
+ throw new Error("illegal catch attempt");
978
+ },
979
+
980
+ delegateYield: function(iterable, resultName, nextLoc) {
981
+ this.delegate = {
982
+ iterator: values(iterable),
983
+ resultName: resultName,
984
+ nextLoc: nextLoc
985
+ };
986
+
987
+ if (this.method === "next") {
988
+ // Deliberately forget the last sent value so that we don't
989
+ // accidentally pass it on to the delegate.
990
+ this.arg = undefined$1;
3240
991
  }
3241
- });
3242
992
 
3243
- if (type) {
3244
- request = request.then(function (places) {
3245
- return places.filter(function (place) {
3246
- return place.type === type;
3247
- });
3248
- });
993
+ return ContinueSentinel;
3249
994
  }
3250
-
3251
- return request;
3252
995
  };
3253
996
 
3254
- return CliniaService;
3255
- }();
997
+ // Regardless of whether this script is executing as a CommonJS module
998
+ // or not, return the runtime object so that we can declare the variable
999
+ // regeneratorRuntime in the outer scope, which allows this module to be
1000
+ // injected easily by `bin/regenerator --include-runtime script.js`.
1001
+ return exports;
1002
+
1003
+ }(
1004
+ // If this script is executing as a CommonJS module, use module.exports
1005
+ // as the regeneratorRuntime namespace. Otherwise create a new empty
1006
+ // object. Either way, the resulting object will be used to initialize
1007
+ // the regeneratorRuntime variable at the top of this file.
1008
+ module.exports
1009
+ ));
1010
+
1011
+ try {
1012
+ regeneratorRuntime = runtime;
1013
+ } catch (accidentalStrictMode) {
1014
+ // This module should not be running in strict mode, so the above
1015
+ // assignment should always work unless something is misconfigured. Just
1016
+ // in case runtime.js accidentally runs in strict mode, in modern engines
1017
+ // we can explicitly access globalThis. In older engines we can escape
1018
+ // strict mode using a global Function call. This could conceivably fail
1019
+ // if a Content Security Policy forbids using Function, but in that case
1020
+ // the proper solution is to fix the accidental strict mode problem. If
1021
+ // you've misconfigured your bundler to force strict mode and applied a
1022
+ // CSP to forbid Function, and you're not willing to fix either of those
1023
+ // problems, please detail your unique predicament in a GitHub issue.
1024
+ if (typeof globalThis === "object") {
1025
+ globalThis.regeneratorRuntime = runtime;
1026
+ } else {
1027
+ Function("r", "regeneratorRuntime = r")(runtime);
1028
+ }
1029
+ }
1030
+ });
3256
1031
 
3257
1032
  var _personalMetaToPrefix;
3258
1033
  var personalMetaToPrefix = (_personalMetaToPrefix = {}, _personalMetaToPrefix[MetadataCategory.Personal] = 'you', _personalMetaToPrefix[MetadataCategory.ChildPersonal] = 'child', _personalMetaToPrefix[MetadataCategory.OtherPersonal] = 'other', _personalMetaToPrefix);
@@ -3404,6 +1179,61 @@ function sessionStorePrivateKeyName(id) {
3404
1179
  return sessionPrivateKeyPrefix + id;
3405
1180
  }
3406
1181
 
1182
+ var IncompleteAuthentication = /*#__PURE__*/function (_Error) {
1183
+ _inheritsLoose(IncompleteAuthentication, _Error);
1184
+
1185
+ function IncompleteAuthentication() {
1186
+ return _Error.apply(this, arguments) || this;
1187
+ }
1188
+
1189
+ return IncompleteAuthentication;
1190
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1191
+ var MissingGrant = /*#__PURE__*/function (_Error2) {
1192
+ _inheritsLoose(MissingGrant, _Error2);
1193
+
1194
+ function MissingGrant() {
1195
+ return _Error2.apply(this, arguments) || this;
1196
+ }
1197
+
1198
+ return MissingGrant;
1199
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1200
+ var MissingLockbox = /*#__PURE__*/function (_Error3) {
1201
+ _inheritsLoose(MissingLockbox, _Error3);
1202
+
1203
+ function MissingLockbox() {
1204
+ return _Error3.apply(this, arguments) || this;
1205
+ }
1206
+
1207
+ return MissingLockbox;
1208
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1209
+ var MissingLockboxOwner = /*#__PURE__*/function (_Error4) {
1210
+ _inheritsLoose(MissingLockboxOwner, _Error4);
1211
+
1212
+ function MissingLockboxOwner() {
1213
+ return _Error4.apply(this, arguments) || this;
1214
+ }
1215
+
1216
+ return MissingLockboxOwner;
1217
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1218
+ var AssociatedLockboxNotFound = /*#__PURE__*/function (_Error5) {
1219
+ _inheritsLoose(AssociatedLockboxNotFound, _Error5);
1220
+
1221
+ function AssociatedLockboxNotFound() {
1222
+ return _Error5.apply(this, arguments) || this;
1223
+ }
1224
+
1225
+ return AssociatedLockboxNotFound;
1226
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1227
+ var WorkflowAnswersMissingError = /*#__PURE__*/function (_Error6) {
1228
+ _inheritsLoose(WorkflowAnswersMissingError, _Error6);
1229
+
1230
+ function WorkflowAnswersMissingError() {
1231
+ return _Error6.apply(this, arguments) || this;
1232
+ }
1233
+
1234
+ return WorkflowAnswersMissingError;
1235
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
1236
+
3407
1237
  function filterTriggeredAnsweredWithKind(_x, _x2) {
3408
1238
  return _filterTriggeredAnsweredWithKind.apply(this, arguments);
3409
1239
  }
@@ -4526,7 +2356,7 @@ var OroClient = /*#__PURE__*/function () {
4526
2356
  }
4527
2357
  /**
4528
2358
  * clears the vaultIndex and cached metadata grants
4529
- */
2359
+ */
4530
2360
 
4531
2361
 
4532
2362
  var _proto = OroClient.prototype;
@@ -7672,21 +5502,93 @@ var OroClient = /*#__PURE__*/function () {
7672
5502
  return OroClient;
7673
5503
  }();
7674
5504
 
5505
+ var _excluded = ["locale"],
5506
+ _excluded2 = ["locale"];
5507
+ var CliniaService = /*#__PURE__*/function () {
5508
+ function CliniaService(url, apiKey, locale) {
5509
+ this.url = url;
5510
+ this.locale = locale;
5511
+ this.api = new AxiosService({
5512
+ headers: {
5513
+ 'X-Clinia-API-Key': apiKey
5514
+ }
5515
+ });
5516
+ }
5517
+
5518
+ var _proto = CliniaService.prototype;
5519
+
5520
+ _proto.placeSearch = function placeSearch(searchOptions) {
5521
+ var locale = searchOptions.locale,
5522
+ data = _objectWithoutPropertiesLoose(searchOptions, _excluded);
5523
+
5524
+ return this.api.post(this.url + "/search/v1/indexes/health_facility/query", data, {
5525
+ params: {
5526
+ locale: locale != null ? locale : this.locale
5527
+ }
5528
+ });
5529
+ };
5530
+
5531
+ _proto.placeMatch = function placeMatch(searchOptions, type) {
5532
+ var locale = searchOptions.locale,
5533
+ data = _objectWithoutPropertiesLoose(searchOptions, _excluded2);
5534
+
5535
+ var request = this.api.post(this.url + "/search/v1/matches", data, {
5536
+ params: {
5537
+ locale: locale != null ? locale : this.locale
5538
+ }
5539
+ });
5540
+
5541
+ if (type) {
5542
+ request = request.then(function (places) {
5543
+ return places.filter(function (place) {
5544
+ return place.type === type;
5545
+ });
5546
+ });
5547
+ }
5548
+
5549
+ return request;
5550
+ };
5551
+
5552
+ return CliniaService;
5553
+ }();
5554
+
7675
5555
  var wasmPath = 'node_modules/oro-toolbox';
5556
+ /**
5557
+ * This function helps you to initialize and OroClient instance
5558
+ * @param toolbox the OroToolbox object
5559
+ * @param tellerBaseURL the teller service base URL
5560
+ * @param vaultBaseURL the vault service base URL
5561
+ * @param guardBaseURL the guard service base URL
5562
+ * @param practiceBaseURL the practice service base URL
5563
+ * @param consultBaseURL the consult service base URL
5564
+ * @param workflowBaseURL the workflow service base URL
5565
+ * @param diagnosisBaseURL the diagnosis service base URL
5566
+ * @param authenticationCallback (optional) authenticationCallback the authentification callback
5567
+ * @returns an instance of OroClient
5568
+ */
5569
+
5570
+ var init = function init(toolbox, tellerBaseURL, vaultBaseURL, guardBaseURL, practiceBaseURL, consultBaseURL, workflowBaseURL, diagnosisBaseURL, authenticationCallback) {
5571
+ var _initApis = initApis__default({
5572
+ tellerBaseURL: tellerBaseURL,
5573
+ vaultBaseURL: vaultBaseURL,
5574
+ guardBaseURL: guardBaseURL,
5575
+ practiceBaseURL: practiceBaseURL,
5576
+ consultBaseURL: consultBaseURL,
5577
+ workflowBaseURL: workflowBaseURL,
5578
+ diagnosisBaseURL: diagnosisBaseURL
5579
+ }, authenticationCallback),
5580
+ tellerService = _initApis.tellerService,
5581
+ practiceService = _initApis.practiceService,
5582
+ consultService = _initApis.consultService,
5583
+ vaultService = _initApis.vaultService,
5584
+ guardService = _initApis.guardService,
5585
+ workflowService = _initApis.workflowService,
5586
+ diagnosisService = _initApis.diagnosisService;
7676
5587
 
7677
- var init = function init(toolbox, tellerBaseURL, vaultBaseURL, guardBaseURL, practiceBaseURL, consultBaseURL, workflowBaseURL, diagnosisBaseUrl, authenticationCallback) {
7678
- var apiService = new APIService(undefined, authenticationCallback);
7679
- var tellerService = new TellerService(apiService, tellerBaseURL);
7680
- var practiceService = new PracticeService(toolbox, apiService, practiceBaseURL);
7681
- var consultService = new ConsultService(apiService, consultBaseURL);
7682
- var vaultService = new VaultService(apiService, vaultBaseURL);
7683
- var guardService = new GuardService(apiService, guardBaseURL);
7684
- var workflowService = new WorkflowService(apiService, workflowBaseURL);
7685
- var diagnosisService = new DiagnosisService(apiService, diagnosisBaseUrl);
7686
5588
  var client = new OroClient(toolbox, tellerService, vaultService, guardService, practiceService, consultService, workflowService, diagnosisService, authenticationCallback);
7687
5589
  return client;
7688
5590
  };
7689
5591
 
7690
5592
  export default init;
7691
- export { APIService, AssignmentStatus, AssistantType, AssociatedLockboxNotFound, AuthenticationBadRequest, AuthenticationFailed, AuthenticationServerError, AxiosService, CliniaService, ConsultService, DiagnosisService, DiagnosisType, DocumentType, DrugType, FeeStatus, GuardService, IdentityCreationBadRequest, IdentityCreationConflict, IdentityCreationFailed, IncompleteAuthentication, IndexBuildError, IndexKey, LicenseStatus, MedicalStatus, MetadataCategory, MissingGrant, MissingLockbox, MissingLockboxOwner, OroClient, OtherRoleType, PaymentStatus, PeriodType, PlanStatus, PlanType, PracticeConfigKind, PracticeEmailKind, PracticeService, PractitionerStatus, PractitionnerRoleType, RateDimension, StripePriceType, SyncStatus, TaskStatus, TellerService, TransmissionKind, TransmissionStatus, VaultService, WorkflowAnswersMissingError, WorkflowService, WorkflowType, decryptConsultLockboxGrants, decryptGrants, extractAndStorePersonalWorkflowData, extractISOLocalityForConsult, fillWorkflowFromPopulatedWorkflow, filterTriggeredAnsweredWithKind, flattenSelectedAnswers, getImagesFromIndexDb, getInitialisedSelectedAnswers, getWorkflowDataByCategory, identificationToPersonalInformations, isTriggered, registerPatient, sessionStorePrivateKeyName, toActualObject, updatePersonalIntoPopulatedWorkflowData, wasmPath };
5593
+ export { AssociatedLockboxNotFound, CliniaService, IncompleteAuthentication, MissingGrant, MissingLockbox, MissingLockboxOwner, OroClient, WorkflowAnswersMissingError, decryptConsultLockboxGrants, decryptGrants, extractAndStorePersonalWorkflowData, extractISOLocalityForConsult, fillWorkflowFromPopulatedWorkflow, filterTriggeredAnsweredWithKind, flattenSelectedAnswers, getImagesFromIndexDb, getInitialisedSelectedAnswers, getWorkflowDataByCategory, identificationToPersonalInformations, isTriggered, registerPatient, sessionStorePrivateKeyName, toActualObject, updatePersonalIntoPopulatedWorkflowData, wasmPath };
7692
5594
  //# sourceMappingURL=oro-sdk.esm.js.map