@medipass/web-sdk 12.11.1 → 12.11.2-feature-axios-to-fetch.3
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.
- package/jest.setup.js +8 -5
- package/lib/__mocks__/axios.mock.d.ts +2 -2
- package/lib/index.d.ts +16 -16
- package/lib/index.js +4 -3
- package/lib/resources/abr.js +3 -3
- package/lib/resources/accounts.js +3 -3
- package/lib/resources/actions.js +3 -3
- package/lib/resources/aged-care.js +3 -3
- package/lib/resources/api-keys.js +3 -3
- package/lib/resources/applePay.js +3 -3
- package/lib/resources/applications.js +3 -3
- package/lib/resources/attachments.js +3 -3
- package/lib/resources/auth.js +3 -3
- package/lib/resources/blacklist.js +3 -3
- package/lib/resources/bulk-submits.js +3 -3
- package/lib/resources/bulk-uploads.js +3 -3
- package/lib/resources/business-email-log.js +3 -3
- package/lib/resources/business-profiles.js +3 -3
- package/lib/resources/businesses.js +3 -3
- package/lib/resources/claim-items.js +3 -3
- package/lib/resources/devices.js +3 -3
- package/lib/resources/doc-accounts.js +3 -3
- package/lib/resources/documents.js +3 -3
- package/lib/resources/emails.js +3 -3
- package/lib/resources/filter-options.js +3 -3
- package/lib/resources/form-application-templates.js +3 -3
- package/lib/resources/form-applications.js +3 -3
- package/lib/resources/forms.js +3 -3
- package/lib/resources/funder-services.js +3 -3
- package/lib/resources/funder-settings.js +3 -3
- package/lib/resources/funder-values.js +3 -3
- package/lib/resources/funders.js +3 -3
- package/lib/resources/futures.js +3 -3
- package/lib/resources/health-fund-accounts.js +3 -3
- package/lib/resources/health-fund-settings.js +3 -3
- package/lib/resources/healthfunds.js +3 -3
- package/lib/resources/icare.js +3 -3
- package/lib/resources/icditems.js +3 -3
- package/lib/resources/invoice-scans.js +3 -3
- package/lib/resources/jhcs.js +3 -3
- package/lib/resources/kyc.js +3 -3
- package/lib/resources/logs.js +3 -3
- package/lib/resources/members.js +3 -3
- package/lib/resources/message-mappings.js +3 -3
- package/lib/resources/minions.js +3 -3
- package/lib/resources/modalities.js +3 -3
- package/lib/resources/notes.js +3 -3
- package/lib/resources/onboarding-applications.js +3 -3
- package/lib/resources/onboarding-requests.js +3 -3
- package/lib/resources/ops.js +3 -3
- package/lib/resources/organisations.js +3 -3
- package/lib/resources/partners.js +3 -3
- package/lib/resources/patients.js +3 -3
- package/lib/resources/payments.js +3 -3
- package/lib/resources/pms.js +3 -3
- package/lib/resources/practice-profiles.js +3 -3
- package/lib/resources/practice-types.js +3 -3
- package/lib/resources/practices.js +3 -3
- package/lib/resources/products.js +3 -3
- package/lib/resources/professional-categories.js +3 -3
- package/lib/resources/provider-number-types.js +3 -3
- package/lib/resources/provider-registration-types.js +3 -3
- package/lib/resources/provider-requests.js +3 -3
- package/lib/resources/provider-types.js +3 -3
- package/lib/resources/qbe.js +3 -3
- package/lib/resources/ref-sources.js +3 -3
- package/lib/resources/risk.js +3 -3
- package/lib/resources/rnas.js +3 -3
- package/lib/resources/roles.js +3 -3
- package/lib/resources/s3-files.js +3 -3
- package/lib/resources/self-checkout-sessions.js +3 -3
- package/lib/resources/services.js +3 -3
- package/lib/resources/settlements.js +3 -3
- package/lib/resources/sign-up.js +3 -3
- package/lib/resources/specialties.js +3 -3
- package/lib/resources/staff-profiles.js +3 -3
- package/lib/resources/staff.js +3 -3
- package/lib/resources/statistics.js +3 -3
- package/lib/resources/subscriptions.js +3 -3
- package/lib/resources/terminals.js +3 -3
- package/lib/resources/transaction-export.js +3 -3
- package/lib/resources/transaction-reports.js +3 -3
- package/lib/resources/transactions.js +3 -3
- package/lib/resources/triggers.js +3 -3
- package/lib/resources/vendors.js +3 -3
- package/lib/resources/verify.js +3 -3
- package/lib/resources/workers.js +3 -3
- package/lib/resources/workflow-exceptions.js +3 -3
- package/lib/services/aws.js +3 -3
- package/lib/services/version.js +3 -3
- package/lib/{staff-d7246b15.js → staff-1f5fac5b.js} +271 -312
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +5 -0
- package/lib/utils/application.js +3 -3
- package/lib/utils/get-http-error.d.ts +12 -0
- package/lib/utils/get-http-error.js +22 -0
- package/lib/utils/http-client.d.ts +68 -0
- package/lib/utils/http-client.js +414 -0
- package/lib/utils/professions.js +3 -3
- package/lib/utils/request.d.ts +1 -1
- package/lib/utils/request.js +3 -3
- package/lib/utils/staff.js +3 -3
- package/package.json +4 -5
|
@@ -5,12 +5,12 @@ var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
|
5
5
|
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
6
6
|
var _merge = require('lodash/merge');
|
|
7
7
|
var _uniq = require('lodash/uniq');
|
|
8
|
-
var
|
|
8
|
+
var utils_httpClient = require('./utils/http-client.js');
|
|
9
9
|
var differenceInSeconds = require('date-fns/differenceInSeconds');
|
|
10
10
|
var jwtDecode = require('jwt-decode');
|
|
11
11
|
var _forOwn = require('lodash/forOwn');
|
|
12
12
|
var _get = require('lodash/get');
|
|
13
|
-
var
|
|
13
|
+
var utils_getHttpError = require('./utils/get-http-error.js');
|
|
14
14
|
var utils_doesParamExist = require('./utils/does-param-exist.js');
|
|
15
15
|
var _omitBy = require('lodash/omitBy');
|
|
16
16
|
var _isEmpty = require('lodash/isEmpty');
|
|
@@ -34,9 +34,7 @@ var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regenerat
|
|
|
34
34
|
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
35
35
|
var _merge__default = /*#__PURE__*/_interopDefaultLegacy(_merge);
|
|
36
36
|
var _uniq__default = /*#__PURE__*/_interopDefaultLegacy(_uniq);
|
|
37
|
-
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
38
37
|
var differenceInSeconds__default = /*#__PURE__*/_interopDefaultLegacy(differenceInSeconds);
|
|
39
|
-
var jwtDecode__default = /*#__PURE__*/_interopDefaultLegacy(jwtDecode);
|
|
40
38
|
var _forOwn__default = /*#__PURE__*/_interopDefaultLegacy(_forOwn);
|
|
41
39
|
var _get__default = /*#__PURE__*/_interopDefaultLegacy(_get);
|
|
42
40
|
var _omitBy__default = /*#__PURE__*/_interopDefaultLegacy(_omitBy);
|
|
@@ -88,23 +86,23 @@ var stripBottleneckOpts = function stripBottleneckOpts(axiosRequestOpts) {
|
|
|
88
86
|
};
|
|
89
87
|
|
|
90
88
|
var request = /*#__PURE__*/function () {
|
|
91
|
-
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(medipassRequestOpts,
|
|
92
|
-
var apiName, version, baseUrl,
|
|
89
|
+
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(medipassRequestOpts, httpRequestOpts) {
|
|
90
|
+
var apiName, version, baseUrl, strippedHttpRequestOpts, res, httpError;
|
|
93
91
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
94
92
|
while (1) {
|
|
95
93
|
switch (_context.prev = _context.next) {
|
|
96
94
|
case 0:
|
|
97
|
-
if (
|
|
98
|
-
|
|
95
|
+
if (httpRequestOpts === void 0) {
|
|
96
|
+
httpRequestOpts = {};
|
|
99
97
|
}
|
|
100
98
|
|
|
101
99
|
apiName = medipassRequestOpts.apiName || DEFAULT_API_NAME;
|
|
102
100
|
version = getVersion(apiName, medipassRequestOpts);
|
|
103
101
|
baseUrl = getBaseUrl(apiName, medipassRequestOpts);
|
|
104
|
-
|
|
102
|
+
strippedHttpRequestOpts = medipassRequestOpts.unrestrictBottleneckOpts ? httpRequestOpts : module.exports.stripBottleneckOpts(httpRequestOpts);
|
|
105
103
|
_context.prev = 5;
|
|
106
104
|
_context.next = 8;
|
|
107
|
-
return sdkClient.
|
|
105
|
+
return sdkClient.httpClient(medipassRequestOpts.hyperMediaEndpoint || "" + baseUrl + version + medipassRequestOpts.path, _objectSpread$1o({}, strippedHttpRequestOpts, {}, medipassRequestOpts.requestConfig));
|
|
108
106
|
|
|
109
107
|
case 8:
|
|
110
108
|
res = _context.sent;
|
|
@@ -114,8 +112,8 @@ var request = /*#__PURE__*/function () {
|
|
|
114
112
|
_context.prev = 12;
|
|
115
113
|
_context.t0 = _context["catch"](5);
|
|
116
114
|
// @ts-expect-error TS(2345): Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
|
|
117
|
-
|
|
118
|
-
throw
|
|
115
|
+
httpError = medipassRequestOpts.getFullError ? _context.t0 : utils_getHttpError["default"](_context.t0);
|
|
116
|
+
throw httpError;
|
|
119
117
|
|
|
120
118
|
case 16:
|
|
121
119
|
case "end":
|
|
@@ -23363,42 +23361,38 @@ var workflowExceptions = /*#__PURE__*/Object.freeze({
|
|
|
23363
23361
|
|
|
23364
23362
|
var uploadHealthFundFormFileToS3 = /*#__PURE__*/function () {
|
|
23365
23363
|
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(healthFundId, file, opts) {
|
|
23366
|
-
var
|
|
23364
|
+
var _yield$getHealthFundF, signedPost, s3Url, bodyFormData, key;
|
|
23367
23365
|
|
|
23368
23366
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
23369
23367
|
while (1) {
|
|
23370
23368
|
switch (_context.prev = _context.next) {
|
|
23371
23369
|
case 0:
|
|
23372
|
-
awsAxios = axios__default["default"].create();
|
|
23373
|
-
|
|
23374
23370
|
if (healthFundId) {
|
|
23375
|
-
_context.next =
|
|
23371
|
+
_context.next = 2;
|
|
23376
23372
|
break;
|
|
23377
23373
|
}
|
|
23378
23374
|
|
|
23379
23375
|
throw new utils_paramError["default"]('healthFundId');
|
|
23380
23376
|
|
|
23381
|
-
case
|
|
23377
|
+
case 2:
|
|
23382
23378
|
if (file) {
|
|
23383
|
-
_context.next =
|
|
23379
|
+
_context.next = 4;
|
|
23384
23380
|
break;
|
|
23385
23381
|
}
|
|
23386
23382
|
|
|
23387
23383
|
throw new utils_paramError["default"]('file');
|
|
23388
23384
|
|
|
23389
|
-
case
|
|
23390
|
-
_context.
|
|
23391
|
-
_context.next = 8;
|
|
23385
|
+
case 4:
|
|
23386
|
+
_context.next = 6;
|
|
23392
23387
|
return getHealthFundFormUploadUrl(healthFundId, {
|
|
23393
23388
|
contentType: file.type,
|
|
23394
23389
|
fileName: file.name
|
|
23395
23390
|
}, opts);
|
|
23396
23391
|
|
|
23397
|
-
case
|
|
23392
|
+
case 6:
|
|
23398
23393
|
_yield$getHealthFundF = _context.sent;
|
|
23399
23394
|
signedPost = _yield$getHealthFundF.signedPost;
|
|
23400
23395
|
s3Url = _yield$getHealthFundF.s3Url;
|
|
23401
|
-
// eslint-disable-next-line
|
|
23402
23396
|
bodyFormData = new FormData();
|
|
23403
23397
|
|
|
23404
23398
|
for (key in signedPost.fields) {
|
|
@@ -23406,25 +23400,23 @@ var uploadHealthFundFormFileToS3 = /*#__PURE__*/function () {
|
|
|
23406
23400
|
}
|
|
23407
23401
|
|
|
23408
23402
|
bodyFormData.append('file', file);
|
|
23409
|
-
_context.next =
|
|
23410
|
-
return
|
|
23403
|
+
_context.next = 14;
|
|
23404
|
+
return fetch(signedPost.url, {
|
|
23405
|
+
method: 'POST',
|
|
23406
|
+
body: bodyFormData
|
|
23407
|
+
});
|
|
23411
23408
|
|
|
23412
|
-
case
|
|
23409
|
+
case 14:
|
|
23413
23410
|
return _context.abrupt("return", {
|
|
23414
23411
|
publicUrl: s3Url
|
|
23415
23412
|
});
|
|
23416
23413
|
|
|
23417
|
-
case
|
|
23418
|
-
_context.prev = 19;
|
|
23419
|
-
_context.t0 = _context["catch"](5);
|
|
23420
|
-
throw _context.t0;
|
|
23421
|
-
|
|
23422
|
-
case 22:
|
|
23414
|
+
case 15:
|
|
23423
23415
|
case "end":
|
|
23424
23416
|
return _context.stop();
|
|
23425
23417
|
}
|
|
23426
23418
|
}
|
|
23427
|
-
}, _callee
|
|
23419
|
+
}, _callee);
|
|
23428
23420
|
}));
|
|
23429
23421
|
|
|
23430
23422
|
return function uploadHealthFundFormFileToS3(_x, _x2, _x3) {
|
|
@@ -23441,58 +23433,54 @@ var uploadHealthFundFormFileToS3 = /*#__PURE__*/function () {
|
|
|
23441
23433
|
|
|
23442
23434
|
var uploadScannedApplicationToS3 = /*#__PURE__*/function () {
|
|
23443
23435
|
var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(businessId, practiceId, formId, file, opts) {
|
|
23444
|
-
var
|
|
23436
|
+
var _yield$getManualFormU, signedPost, s3Url, bodyFormData, key;
|
|
23445
23437
|
|
|
23446
23438
|
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
|
|
23447
23439
|
while (1) {
|
|
23448
23440
|
switch (_context2.prev = _context2.next) {
|
|
23449
23441
|
case 0:
|
|
23450
|
-
awsAxios = axios__default["default"].create();
|
|
23451
|
-
|
|
23452
23442
|
if (businessId) {
|
|
23453
|
-
_context2.next =
|
|
23443
|
+
_context2.next = 2;
|
|
23454
23444
|
break;
|
|
23455
23445
|
}
|
|
23456
23446
|
|
|
23457
23447
|
throw new utils_paramError["default"]('businessId');
|
|
23458
23448
|
|
|
23459
|
-
case
|
|
23449
|
+
case 2:
|
|
23460
23450
|
if (practiceId) {
|
|
23461
|
-
_context2.next =
|
|
23451
|
+
_context2.next = 4;
|
|
23462
23452
|
break;
|
|
23463
23453
|
}
|
|
23464
23454
|
|
|
23465
23455
|
throw new utils_paramError["default"]('practiceId');
|
|
23466
23456
|
|
|
23467
|
-
case
|
|
23457
|
+
case 4:
|
|
23468
23458
|
if (formId) {
|
|
23469
|
-
_context2.next =
|
|
23459
|
+
_context2.next = 6;
|
|
23470
23460
|
break;
|
|
23471
23461
|
}
|
|
23472
23462
|
|
|
23473
23463
|
throw new utils_paramError["default"]('formId');
|
|
23474
23464
|
|
|
23475
|
-
case
|
|
23465
|
+
case 6:
|
|
23476
23466
|
if (file) {
|
|
23477
|
-
_context2.next =
|
|
23467
|
+
_context2.next = 8;
|
|
23478
23468
|
break;
|
|
23479
23469
|
}
|
|
23480
23470
|
|
|
23481
23471
|
throw new utils_paramError["default"]('file');
|
|
23482
23472
|
|
|
23483
|
-
case
|
|
23484
|
-
_context2.
|
|
23485
|
-
_context2.next = 12;
|
|
23473
|
+
case 8:
|
|
23474
|
+
_context2.next = 10;
|
|
23486
23475
|
return getManualFormUploadUrl(businessId, practiceId, formId, {
|
|
23487
23476
|
contentType: file.type,
|
|
23488
23477
|
fileName: file.name
|
|
23489
23478
|
}, opts);
|
|
23490
23479
|
|
|
23491
|
-
case
|
|
23480
|
+
case 10:
|
|
23492
23481
|
_yield$getManualFormU = _context2.sent;
|
|
23493
23482
|
signedPost = _yield$getManualFormU.signedPost;
|
|
23494
23483
|
s3Url = _yield$getManualFormU.s3Url;
|
|
23495
|
-
// eslint-disable-next-line
|
|
23496
23484
|
bodyFormData = new FormData();
|
|
23497
23485
|
|
|
23498
23486
|
for (key in signedPost.fields) {
|
|
@@ -23500,25 +23488,23 @@ var uploadScannedApplicationToS3 = /*#__PURE__*/function () {
|
|
|
23500
23488
|
}
|
|
23501
23489
|
|
|
23502
23490
|
bodyFormData.append('file', file);
|
|
23503
|
-
_context2.next =
|
|
23504
|
-
return
|
|
23491
|
+
_context2.next = 18;
|
|
23492
|
+
return fetch(signedPost.url, {
|
|
23493
|
+
method: 'POST',
|
|
23494
|
+
body: bodyFormData
|
|
23495
|
+
});
|
|
23505
23496
|
|
|
23506
|
-
case
|
|
23497
|
+
case 18:
|
|
23507
23498
|
return _context2.abrupt("return", {
|
|
23508
23499
|
publicUrl: s3Url
|
|
23509
23500
|
});
|
|
23510
23501
|
|
|
23511
|
-
case
|
|
23512
|
-
_context2.prev = 23;
|
|
23513
|
-
_context2.t0 = _context2["catch"](9);
|
|
23514
|
-
throw _context2.t0;
|
|
23515
|
-
|
|
23516
|
-
case 26:
|
|
23502
|
+
case 19:
|
|
23517
23503
|
case "end":
|
|
23518
23504
|
return _context2.stop();
|
|
23519
23505
|
}
|
|
23520
23506
|
}
|
|
23521
|
-
}, _callee2
|
|
23507
|
+
}, _callee2);
|
|
23522
23508
|
}));
|
|
23523
23509
|
|
|
23524
23510
|
return function uploadScannedApplicationToS3(_x4, _x5, _x6, _x7, _x8) {
|
|
@@ -23535,56 +23521,53 @@ var uploadScannedApplicationToS3 = /*#__PURE__*/function () {
|
|
|
23535
23521
|
|
|
23536
23522
|
var uploadClaimAttachmentToS3 = /*#__PURE__*/function () {
|
|
23537
23523
|
var _ref3 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(businessId, practiceId, staffId, healthFundId, file, opts) {
|
|
23538
|
-
var
|
|
23524
|
+
var _yield$getClaimAttach, signedPost, s3Url, s3SignedUrlId, bodyFormData, key;
|
|
23539
23525
|
|
|
23540
23526
|
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
|
|
23541
23527
|
while (1) {
|
|
23542
23528
|
switch (_context3.prev = _context3.next) {
|
|
23543
23529
|
case 0:
|
|
23544
|
-
awsAxios = axios__default["default"].create();
|
|
23545
|
-
|
|
23546
23530
|
if (businessId) {
|
|
23547
|
-
_context3.next =
|
|
23531
|
+
_context3.next = 2;
|
|
23548
23532
|
break;
|
|
23549
23533
|
}
|
|
23550
23534
|
|
|
23551
23535
|
throw new utils_paramError["default"]('businessId');
|
|
23552
23536
|
|
|
23553
|
-
case
|
|
23537
|
+
case 2:
|
|
23554
23538
|
if (practiceId) {
|
|
23555
|
-
_context3.next =
|
|
23539
|
+
_context3.next = 4;
|
|
23556
23540
|
break;
|
|
23557
23541
|
}
|
|
23558
23542
|
|
|
23559
23543
|
throw new utils_paramError["default"]('practiceId');
|
|
23560
23544
|
|
|
23561
|
-
case
|
|
23545
|
+
case 4:
|
|
23562
23546
|
if (staffId) {
|
|
23563
|
-
_context3.next =
|
|
23547
|
+
_context3.next = 6;
|
|
23564
23548
|
break;
|
|
23565
23549
|
}
|
|
23566
23550
|
|
|
23567
23551
|
throw new utils_paramError["default"]('staffId');
|
|
23568
23552
|
|
|
23569
|
-
case
|
|
23553
|
+
case 6:
|
|
23570
23554
|
if (healthFundId) {
|
|
23571
|
-
_context3.next =
|
|
23555
|
+
_context3.next = 8;
|
|
23572
23556
|
break;
|
|
23573
23557
|
}
|
|
23574
23558
|
|
|
23575
23559
|
throw new utils_paramError["default"]('healthFundId');
|
|
23576
23560
|
|
|
23577
|
-
case
|
|
23561
|
+
case 8:
|
|
23578
23562
|
if (file) {
|
|
23579
|
-
_context3.next =
|
|
23563
|
+
_context3.next = 10;
|
|
23580
23564
|
break;
|
|
23581
23565
|
}
|
|
23582
23566
|
|
|
23583
23567
|
throw new utils_paramError["default"]('file');
|
|
23584
23568
|
|
|
23585
|
-
case
|
|
23586
|
-
_context3.
|
|
23587
|
-
_context3.next = 14;
|
|
23569
|
+
case 10:
|
|
23570
|
+
_context3.next = 12;
|
|
23588
23571
|
return getClaimAttachmentUrl(businessId, practiceId, staffId, {
|
|
23589
23572
|
contentType: file.type,
|
|
23590
23573
|
fileName: file.name,
|
|
@@ -23592,12 +23575,11 @@ var uploadClaimAttachmentToS3 = /*#__PURE__*/function () {
|
|
|
23592
23575
|
contentLength: file.size
|
|
23593
23576
|
}, opts);
|
|
23594
23577
|
|
|
23595
|
-
case
|
|
23578
|
+
case 12:
|
|
23596
23579
|
_yield$getClaimAttach = _context3.sent;
|
|
23597
23580
|
signedPost = _yield$getClaimAttach.signedPost;
|
|
23598
23581
|
s3Url = _yield$getClaimAttach.s3Url;
|
|
23599
23582
|
s3SignedUrlId = _yield$getClaimAttach.s3SignedUrlId;
|
|
23600
|
-
// eslint-disable-next-line
|
|
23601
23583
|
bodyFormData = new FormData();
|
|
23602
23584
|
|
|
23603
23585
|
for (key in signedPost.fields) {
|
|
@@ -23605,26 +23587,24 @@ var uploadClaimAttachmentToS3 = /*#__PURE__*/function () {
|
|
|
23605
23587
|
}
|
|
23606
23588
|
|
|
23607
23589
|
bodyFormData.append('file', file);
|
|
23608
|
-
_context3.next =
|
|
23609
|
-
return
|
|
23590
|
+
_context3.next = 21;
|
|
23591
|
+
return fetch(signedPost.url, {
|
|
23592
|
+
method: 'POST',
|
|
23593
|
+
body: bodyFormData
|
|
23594
|
+
});
|
|
23610
23595
|
|
|
23611
|
-
case
|
|
23596
|
+
case 21:
|
|
23612
23597
|
return _context3.abrupt("return", {
|
|
23613
23598
|
s3Url: s3Url,
|
|
23614
23599
|
s3SignedUrlId: s3SignedUrlId
|
|
23615
23600
|
});
|
|
23616
23601
|
|
|
23617
|
-
case
|
|
23618
|
-
_context3.prev = 26;
|
|
23619
|
-
_context3.t0 = _context3["catch"](11);
|
|
23620
|
-
throw _context3.t0;
|
|
23621
|
-
|
|
23622
|
-
case 29:
|
|
23602
|
+
case 22:
|
|
23623
23603
|
case "end":
|
|
23624
23604
|
return _context3.stop();
|
|
23625
23605
|
}
|
|
23626
23606
|
}
|
|
23627
|
-
}, _callee3
|
|
23607
|
+
}, _callee3);
|
|
23628
23608
|
}));
|
|
23629
23609
|
|
|
23630
23610
|
return function uploadClaimAttachmentToS3(_x9, _x10, _x11, _x12, _x13, _x14) {
|
|
@@ -23640,49 +23620,45 @@ var uploadClaimAttachmentToS3 = /*#__PURE__*/function () {
|
|
|
23640
23620
|
|
|
23641
23621
|
var uploadBusinessPracticeImageToS3 = /*#__PURE__*/function () {
|
|
23642
23622
|
var _ref4 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(businessId, practiceId, file) {
|
|
23643
|
-
var
|
|
23623
|
+
var _yield$getBusinessPra, signedPost, s3Url, bodyFormData, key, data;
|
|
23644
23624
|
|
|
23645
23625
|
return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context4) {
|
|
23646
23626
|
while (1) {
|
|
23647
23627
|
switch (_context4.prev = _context4.next) {
|
|
23648
23628
|
case 0:
|
|
23649
|
-
awsAxios = axios__default["default"].create();
|
|
23650
|
-
|
|
23651
23629
|
if (businessId) {
|
|
23652
|
-
_context4.next =
|
|
23630
|
+
_context4.next = 2;
|
|
23653
23631
|
break;
|
|
23654
23632
|
}
|
|
23655
23633
|
|
|
23656
23634
|
throw new utils_paramError["default"]('businessId');
|
|
23657
23635
|
|
|
23658
|
-
case
|
|
23636
|
+
case 2:
|
|
23659
23637
|
if (practiceId) {
|
|
23660
|
-
_context4.next =
|
|
23638
|
+
_context4.next = 4;
|
|
23661
23639
|
break;
|
|
23662
23640
|
}
|
|
23663
23641
|
|
|
23664
23642
|
throw new utils_paramError["default"]('practiceId');
|
|
23665
23643
|
|
|
23666
|
-
case
|
|
23644
|
+
case 4:
|
|
23667
23645
|
if (file) {
|
|
23668
|
-
_context4.next =
|
|
23646
|
+
_context4.next = 6;
|
|
23669
23647
|
break;
|
|
23670
23648
|
}
|
|
23671
23649
|
|
|
23672
23650
|
throw new utils_paramError["default"]('file');
|
|
23673
23651
|
|
|
23674
|
-
case
|
|
23675
|
-
_context4.
|
|
23676
|
-
_context4.next = 10;
|
|
23652
|
+
case 6:
|
|
23653
|
+
_context4.next = 8;
|
|
23677
23654
|
return getBusinessPracticeUploadUrl(businessId, practiceId, {
|
|
23678
23655
|
contentType: file.type
|
|
23679
23656
|
});
|
|
23680
23657
|
|
|
23681
|
-
case
|
|
23658
|
+
case 8:
|
|
23682
23659
|
_yield$getBusinessPra = _context4.sent;
|
|
23683
23660
|
signedPost = _yield$getBusinessPra.signedPost;
|
|
23684
23661
|
s3Url = _yield$getBusinessPra.s3Url;
|
|
23685
|
-
// eslint-disable-next-line
|
|
23686
23662
|
bodyFormData = new FormData();
|
|
23687
23663
|
|
|
23688
23664
|
for (key in signedPost.fields) {
|
|
@@ -23690,30 +23666,28 @@ var uploadBusinessPracticeImageToS3 = /*#__PURE__*/function () {
|
|
|
23690
23666
|
}
|
|
23691
23667
|
|
|
23692
23668
|
bodyFormData.append('file', file);
|
|
23693
|
-
_context4.next =
|
|
23694
|
-
return
|
|
23669
|
+
_context4.next = 16;
|
|
23670
|
+
return fetch(signedPost.url, {
|
|
23671
|
+
method: 'POST',
|
|
23672
|
+
body: bodyFormData
|
|
23673
|
+
});
|
|
23695
23674
|
|
|
23696
|
-
case
|
|
23697
|
-
_context4.next =
|
|
23675
|
+
case 16:
|
|
23676
|
+
_context4.next = 18;
|
|
23698
23677
|
return updateBusinessPractice(businessId, practiceId, {
|
|
23699
23678
|
logoUrl: s3Url
|
|
23700
23679
|
});
|
|
23701
23680
|
|
|
23702
|
-
case
|
|
23681
|
+
case 18:
|
|
23703
23682
|
data = _context4.sent;
|
|
23704
23683
|
return _context4.abrupt("return", data);
|
|
23705
23684
|
|
|
23706
|
-
case
|
|
23707
|
-
_context4.prev = 24;
|
|
23708
|
-
_context4.t0 = _context4["catch"](7);
|
|
23709
|
-
throw _context4.t0;
|
|
23710
|
-
|
|
23711
|
-
case 27:
|
|
23685
|
+
case 20:
|
|
23712
23686
|
case "end":
|
|
23713
23687
|
return _context4.stop();
|
|
23714
23688
|
}
|
|
23715
23689
|
}
|
|
23716
|
-
}, _callee4
|
|
23690
|
+
}, _callee4);
|
|
23717
23691
|
}));
|
|
23718
23692
|
|
|
23719
23693
|
return function uploadBusinessPracticeImageToS3(_x15, _x16, _x17) {
|
|
@@ -23729,47 +23703,43 @@ var uploadBusinessPracticeImageToS3 = /*#__PURE__*/function () {
|
|
|
23729
23703
|
|
|
23730
23704
|
var uploadBusinessStaffMemberImageToS3 = /*#__PURE__*/function () {
|
|
23731
23705
|
var _ref5 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee5(businessId, staffId, file) {
|
|
23732
|
-
var
|
|
23706
|
+
var _yield$getBusinessSta, signedPost, s3Url, bodyFormData, key, data;
|
|
23733
23707
|
|
|
23734
23708
|
return _regeneratorRuntime__default["default"].wrap(function _callee5$(_context5) {
|
|
23735
23709
|
while (1) {
|
|
23736
23710
|
switch (_context5.prev = _context5.next) {
|
|
23737
23711
|
case 0:
|
|
23738
|
-
awsAxios = axios__default["default"].create();
|
|
23739
|
-
|
|
23740
23712
|
if (businessId) {
|
|
23741
|
-
_context5.next =
|
|
23713
|
+
_context5.next = 2;
|
|
23742
23714
|
break;
|
|
23743
23715
|
}
|
|
23744
23716
|
|
|
23745
23717
|
throw new utils_paramError["default"]('businessId');
|
|
23746
23718
|
|
|
23747
|
-
case
|
|
23719
|
+
case 2:
|
|
23748
23720
|
if (staffId) {
|
|
23749
|
-
_context5.next =
|
|
23721
|
+
_context5.next = 4;
|
|
23750
23722
|
break;
|
|
23751
23723
|
}
|
|
23752
23724
|
|
|
23753
23725
|
throw new utils_paramError["default"]('staffId');
|
|
23754
23726
|
|
|
23755
|
-
case
|
|
23727
|
+
case 4:
|
|
23756
23728
|
if (file) {
|
|
23757
|
-
_context5.next =
|
|
23729
|
+
_context5.next = 6;
|
|
23758
23730
|
break;
|
|
23759
23731
|
}
|
|
23760
23732
|
|
|
23761
23733
|
throw new utils_paramError["default"]('file');
|
|
23762
23734
|
|
|
23763
|
-
case
|
|
23764
|
-
_context5.
|
|
23765
|
-
_context5.next = 10;
|
|
23735
|
+
case 6:
|
|
23736
|
+
_context5.next = 8;
|
|
23766
23737
|
return getBusinessStaffUploadUrl(businessId, staffId, file.type);
|
|
23767
23738
|
|
|
23768
|
-
case
|
|
23739
|
+
case 8:
|
|
23769
23740
|
_yield$getBusinessSta = _context5.sent;
|
|
23770
23741
|
signedPost = _yield$getBusinessSta.signedPost;
|
|
23771
23742
|
s3Url = _yield$getBusinessSta.s3Url;
|
|
23772
|
-
// eslint-disable-next-line
|
|
23773
23743
|
bodyFormData = new FormData();
|
|
23774
23744
|
|
|
23775
23745
|
for (key in signedPost.fields) {
|
|
@@ -23777,30 +23747,28 @@ var uploadBusinessStaffMemberImageToS3 = /*#__PURE__*/function () {
|
|
|
23777
23747
|
}
|
|
23778
23748
|
|
|
23779
23749
|
bodyFormData.append('file', file);
|
|
23780
|
-
_context5.next =
|
|
23781
|
-
return
|
|
23750
|
+
_context5.next = 16;
|
|
23751
|
+
return fetch(signedPost.url, {
|
|
23752
|
+
method: 'POST',
|
|
23753
|
+
body: bodyFormData
|
|
23754
|
+
});
|
|
23782
23755
|
|
|
23783
|
-
case
|
|
23784
|
-
_context5.next =
|
|
23756
|
+
case 16:
|
|
23757
|
+
_context5.next = 18;
|
|
23785
23758
|
return updateBusinessStaffMember(businessId, staffId, {
|
|
23786
23759
|
profilePictureUrl: s3Url
|
|
23787
23760
|
});
|
|
23788
23761
|
|
|
23789
|
-
case
|
|
23762
|
+
case 18:
|
|
23790
23763
|
data = _context5.sent;
|
|
23791
23764
|
return _context5.abrupt("return", data);
|
|
23792
23765
|
|
|
23793
|
-
case
|
|
23794
|
-
_context5.prev = 24;
|
|
23795
|
-
_context5.t0 = _context5["catch"](7);
|
|
23796
|
-
throw _context5.t0;
|
|
23797
|
-
|
|
23798
|
-
case 27:
|
|
23766
|
+
case 20:
|
|
23799
23767
|
case "end":
|
|
23800
23768
|
return _context5.stop();
|
|
23801
23769
|
}
|
|
23802
23770
|
}
|
|
23803
|
-
}, _callee5
|
|
23771
|
+
}, _callee5);
|
|
23804
23772
|
}));
|
|
23805
23773
|
|
|
23806
23774
|
return function uploadBusinessStaffMemberImageToS3(_x18, _x19, _x20) {
|
|
@@ -23815,44 +23783,40 @@ var uploadBusinessStaffMemberImageToS3 = /*#__PURE__*/function () {
|
|
|
23815
23783
|
|
|
23816
23784
|
var uploadInvoiceScanToS3 = /*#__PURE__*/function () {
|
|
23817
23785
|
var _ref6 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee6(businessId, file, opts) {
|
|
23818
|
-
var
|
|
23786
|
+
var _yield$getInvoiceScan, signedPost, s3Url, s3SignedUrlId, bodyFormData, key;
|
|
23819
23787
|
|
|
23820
23788
|
return _regeneratorRuntime__default["default"].wrap(function _callee6$(_context6) {
|
|
23821
23789
|
while (1) {
|
|
23822
23790
|
switch (_context6.prev = _context6.next) {
|
|
23823
23791
|
case 0:
|
|
23824
|
-
awsAxios = axios__default["default"].create();
|
|
23825
|
-
|
|
23826
23792
|
if (businessId) {
|
|
23827
|
-
_context6.next =
|
|
23793
|
+
_context6.next = 2;
|
|
23828
23794
|
break;
|
|
23829
23795
|
}
|
|
23830
23796
|
|
|
23831
23797
|
throw new utils_paramError["default"]('businessId');
|
|
23832
23798
|
|
|
23833
|
-
case
|
|
23799
|
+
case 2:
|
|
23834
23800
|
if (file) {
|
|
23835
|
-
_context6.next =
|
|
23801
|
+
_context6.next = 4;
|
|
23836
23802
|
break;
|
|
23837
23803
|
}
|
|
23838
23804
|
|
|
23839
23805
|
throw new utils_paramError["default"]('file');
|
|
23840
23806
|
|
|
23841
|
-
case
|
|
23842
|
-
_context6.
|
|
23843
|
-
_context6.next = 8;
|
|
23807
|
+
case 4:
|
|
23808
|
+
_context6.next = 6;
|
|
23844
23809
|
return getInvoiceScanUploadUrl(businessId, {
|
|
23845
23810
|
contentType: file.type,
|
|
23846
23811
|
fileName: file.name,
|
|
23847
23812
|
contentLength: file.size
|
|
23848
23813
|
}, opts);
|
|
23849
23814
|
|
|
23850
|
-
case
|
|
23815
|
+
case 6:
|
|
23851
23816
|
_yield$getInvoiceScan = _context6.sent;
|
|
23852
23817
|
signedPost = _yield$getInvoiceScan.signedPost;
|
|
23853
23818
|
s3Url = _yield$getInvoiceScan.s3Url;
|
|
23854
23819
|
s3SignedUrlId = _yield$getInvoiceScan.s3SignedUrlId;
|
|
23855
|
-
// eslint-disable-next-line
|
|
23856
23820
|
bodyFormData = new FormData();
|
|
23857
23821
|
|
|
23858
23822
|
for (key in signedPost.fields) {
|
|
@@ -23860,26 +23824,24 @@ var uploadInvoiceScanToS3 = /*#__PURE__*/function () {
|
|
|
23860
23824
|
}
|
|
23861
23825
|
|
|
23862
23826
|
bodyFormData.append('file', file);
|
|
23863
|
-
_context6.next =
|
|
23864
|
-
return
|
|
23827
|
+
_context6.next = 15;
|
|
23828
|
+
return fetch(signedPost.url, {
|
|
23829
|
+
method: 'POST',
|
|
23830
|
+
body: bodyFormData
|
|
23831
|
+
});
|
|
23865
23832
|
|
|
23866
|
-
case
|
|
23833
|
+
case 15:
|
|
23867
23834
|
return _context6.abrupt("return", {
|
|
23868
23835
|
s3Url: s3Url,
|
|
23869
23836
|
s3SignedUrlId: s3SignedUrlId
|
|
23870
23837
|
});
|
|
23871
23838
|
|
|
23872
|
-
case
|
|
23873
|
-
_context6.prev = 20;
|
|
23874
|
-
_context6.t0 = _context6["catch"](5);
|
|
23875
|
-
throw _context6.t0;
|
|
23876
|
-
|
|
23877
|
-
case 23:
|
|
23839
|
+
case 16:
|
|
23878
23840
|
case "end":
|
|
23879
23841
|
return _context6.stop();
|
|
23880
23842
|
}
|
|
23881
23843
|
}
|
|
23882
|
-
}, _callee6
|
|
23844
|
+
}, _callee6);
|
|
23883
23845
|
}));
|
|
23884
23846
|
|
|
23885
23847
|
return function uploadInvoiceScanToS3(_x21, _x22, _x23) {
|
|
@@ -23894,50 +23856,46 @@ var uploadInvoiceScanToS3 = /*#__PURE__*/function () {
|
|
|
23894
23856
|
|
|
23895
23857
|
var uploadBulkUploadCSVToS3 = /*#__PURE__*/function () {
|
|
23896
23858
|
var _ref7 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee7(businessId, file, opts) {
|
|
23897
|
-
var
|
|
23859
|
+
var contentType, _yield$getBulkUploadU, signedPost, s3Url, s3SignedUrlId, bodyFormData, key;
|
|
23898
23860
|
|
|
23899
23861
|
return _regeneratorRuntime__default["default"].wrap(function _callee7$(_context7) {
|
|
23900
23862
|
while (1) {
|
|
23901
23863
|
switch (_context7.prev = _context7.next) {
|
|
23902
23864
|
case 0:
|
|
23903
|
-
awsAxios = axios__default["default"].create();
|
|
23904
|
-
|
|
23905
23865
|
if (businessId) {
|
|
23906
|
-
_context7.next =
|
|
23866
|
+
_context7.next = 2;
|
|
23907
23867
|
break;
|
|
23908
23868
|
}
|
|
23909
23869
|
|
|
23910
23870
|
throw new utils_paramError["default"]('businessId');
|
|
23911
23871
|
|
|
23912
|
-
case
|
|
23872
|
+
case 2:
|
|
23913
23873
|
if (file) {
|
|
23914
|
-
_context7.next =
|
|
23874
|
+
_context7.next = 4;
|
|
23915
23875
|
break;
|
|
23916
23876
|
}
|
|
23917
23877
|
|
|
23918
23878
|
throw new utils_paramError["default"]('file');
|
|
23919
23879
|
|
|
23920
|
-
case
|
|
23880
|
+
case 4:
|
|
23921
23881
|
contentType = file.type;
|
|
23922
23882
|
|
|
23923
23883
|
if (file.name.includes('.csv') || file.path.includes('.csv')) {
|
|
23924
23884
|
contentType = 'text/csv';
|
|
23925
23885
|
}
|
|
23926
23886
|
|
|
23927
|
-
_context7.
|
|
23928
|
-
_context7.next = 10;
|
|
23887
|
+
_context7.next = 8;
|
|
23929
23888
|
return getBulkUploadUrl(businessId, {
|
|
23930
23889
|
contentType: contentType,
|
|
23931
23890
|
fileName: file.name,
|
|
23932
23891
|
contentLength: file.size
|
|
23933
23892
|
}, opts);
|
|
23934
23893
|
|
|
23935
|
-
case
|
|
23894
|
+
case 8:
|
|
23936
23895
|
_yield$getBulkUploadU = _context7.sent;
|
|
23937
23896
|
signedPost = _yield$getBulkUploadU.signedPost;
|
|
23938
23897
|
s3Url = _yield$getBulkUploadU.s3Url;
|
|
23939
23898
|
s3SignedUrlId = _yield$getBulkUploadU.s3SignedUrlId;
|
|
23940
|
-
// eslint-disable-next-line
|
|
23941
23899
|
bodyFormData = new FormData();
|
|
23942
23900
|
|
|
23943
23901
|
for (key in signedPost.fields) {
|
|
@@ -23945,26 +23903,24 @@ var uploadBulkUploadCSVToS3 = /*#__PURE__*/function () {
|
|
|
23945
23903
|
}
|
|
23946
23904
|
|
|
23947
23905
|
bodyFormData.append('file', file);
|
|
23948
|
-
_context7.next =
|
|
23949
|
-
return
|
|
23906
|
+
_context7.next = 17;
|
|
23907
|
+
return fetch(signedPost.url, {
|
|
23908
|
+
method: 'POST',
|
|
23909
|
+
body: bodyFormData
|
|
23910
|
+
});
|
|
23950
23911
|
|
|
23951
|
-
case
|
|
23912
|
+
case 17:
|
|
23952
23913
|
return _context7.abrupt("return", {
|
|
23953
23914
|
s3Url: s3Url,
|
|
23954
23915
|
s3SignedUrlId: s3SignedUrlId
|
|
23955
23916
|
});
|
|
23956
23917
|
|
|
23957
|
-
case
|
|
23958
|
-
_context7.prev = 22;
|
|
23959
|
-
_context7.t0 = _context7["catch"](7);
|
|
23960
|
-
throw _context7.t0;
|
|
23961
|
-
|
|
23962
|
-
case 25:
|
|
23918
|
+
case 18:
|
|
23963
23919
|
case "end":
|
|
23964
23920
|
return _context7.stop();
|
|
23965
23921
|
}
|
|
23966
23922
|
}
|
|
23967
|
-
}, _callee7
|
|
23923
|
+
}, _callee7);
|
|
23968
23924
|
}));
|
|
23969
23925
|
|
|
23970
23926
|
return function uploadBulkUploadCSVToS3(_x24, _x25, _x26) {
|
|
@@ -23979,44 +23935,40 @@ var uploadBulkUploadCSVToS3 = /*#__PURE__*/function () {
|
|
|
23979
23935
|
|
|
23980
23936
|
var uploadKycTrustDocumentToS3 = /*#__PURE__*/function () {
|
|
23981
23937
|
var _ref8 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee8(businessId, file, opts) {
|
|
23982
|
-
var
|
|
23938
|
+
var _yield$getTrustDocume, signedPost, s3Url, s3SignedUrlId, bodyFormData, key;
|
|
23983
23939
|
|
|
23984
23940
|
return _regeneratorRuntime__default["default"].wrap(function _callee8$(_context8) {
|
|
23985
23941
|
while (1) {
|
|
23986
23942
|
switch (_context8.prev = _context8.next) {
|
|
23987
23943
|
case 0:
|
|
23988
|
-
awsAxios = axios__default["default"].create();
|
|
23989
|
-
|
|
23990
23944
|
if (businessId) {
|
|
23991
|
-
_context8.next =
|
|
23945
|
+
_context8.next = 2;
|
|
23992
23946
|
break;
|
|
23993
23947
|
}
|
|
23994
23948
|
|
|
23995
23949
|
throw new utils_paramError["default"]('businessId');
|
|
23996
23950
|
|
|
23997
|
-
case
|
|
23951
|
+
case 2:
|
|
23998
23952
|
if (file) {
|
|
23999
|
-
_context8.next =
|
|
23953
|
+
_context8.next = 4;
|
|
24000
23954
|
break;
|
|
24001
23955
|
}
|
|
24002
23956
|
|
|
24003
23957
|
throw new utils_paramError["default"]('file');
|
|
24004
23958
|
|
|
24005
|
-
case
|
|
24006
|
-
_context8.
|
|
24007
|
-
_context8.next = 8;
|
|
23959
|
+
case 4:
|
|
23960
|
+
_context8.next = 6;
|
|
24008
23961
|
return getTrustDocumentUploadUrl(businessId, {
|
|
24009
23962
|
contentType: file.type,
|
|
24010
23963
|
fileName: file.name,
|
|
24011
23964
|
contentLength: file.size
|
|
24012
23965
|
}, opts);
|
|
24013
23966
|
|
|
24014
|
-
case
|
|
23967
|
+
case 6:
|
|
24015
23968
|
_yield$getTrustDocume = _context8.sent;
|
|
24016
23969
|
signedPost = _yield$getTrustDocume.signedPost;
|
|
24017
23970
|
s3Url = _yield$getTrustDocume.s3Url;
|
|
24018
23971
|
s3SignedUrlId = _yield$getTrustDocume.s3SignedUrlId;
|
|
24019
|
-
// eslint-disable-next-line
|
|
24020
23972
|
bodyFormData = new FormData();
|
|
24021
23973
|
|
|
24022
23974
|
for (key in signedPost.fields) {
|
|
@@ -24024,26 +23976,24 @@ var uploadKycTrustDocumentToS3 = /*#__PURE__*/function () {
|
|
|
24024
23976
|
}
|
|
24025
23977
|
|
|
24026
23978
|
bodyFormData.append('file', file);
|
|
24027
|
-
_context8.next =
|
|
24028
|
-
return
|
|
23979
|
+
_context8.next = 15;
|
|
23980
|
+
return fetch(signedPost.url, {
|
|
23981
|
+
method: 'POST',
|
|
23982
|
+
body: bodyFormData
|
|
23983
|
+
});
|
|
24029
23984
|
|
|
24030
|
-
case
|
|
23985
|
+
case 15:
|
|
24031
23986
|
return _context8.abrupt("return", {
|
|
24032
23987
|
s3Url: s3Url,
|
|
24033
23988
|
s3SignedUrlId: s3SignedUrlId
|
|
24034
23989
|
});
|
|
24035
23990
|
|
|
24036
|
-
case
|
|
24037
|
-
_context8.prev = 20;
|
|
24038
|
-
_context8.t0 = _context8["catch"](5);
|
|
24039
|
-
throw _context8.t0;
|
|
24040
|
-
|
|
24041
|
-
case 23:
|
|
23991
|
+
case 16:
|
|
24042
23992
|
case "end":
|
|
24043
23993
|
return _context8.stop();
|
|
24044
23994
|
}
|
|
24045
23995
|
}
|
|
24046
|
-
}, _callee8
|
|
23996
|
+
}, _callee8);
|
|
24047
23997
|
}));
|
|
24048
23998
|
|
|
24049
23999
|
return function uploadKycTrustDocumentToS3(_x27, _x28, _x29) {
|
|
@@ -24059,40 +24009,37 @@ var uploadKycTrustDocumentToS3 = /*#__PURE__*/function () {
|
|
|
24059
24009
|
|
|
24060
24010
|
var uploadAttachmentToS3 = /*#__PURE__*/function () {
|
|
24061
24011
|
var _ref9 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee9(businessId, healthFundId, file, opts) {
|
|
24062
|
-
var
|
|
24012
|
+
var _yield$getAttachmentU, signedPost, s3Url, s3SignedUrlId, bodyFormData, key;
|
|
24063
24013
|
|
|
24064
24014
|
return _regeneratorRuntime__default["default"].wrap(function _callee9$(_context9) {
|
|
24065
24015
|
while (1) {
|
|
24066
24016
|
switch (_context9.prev = _context9.next) {
|
|
24067
24017
|
case 0:
|
|
24068
|
-
awsAxios = axios__default["default"].create();
|
|
24069
|
-
|
|
24070
24018
|
if (businessId) {
|
|
24071
|
-
_context9.next =
|
|
24019
|
+
_context9.next = 2;
|
|
24072
24020
|
break;
|
|
24073
24021
|
}
|
|
24074
24022
|
|
|
24075
24023
|
throw new utils_paramError["default"]('businessId');
|
|
24076
24024
|
|
|
24077
|
-
case
|
|
24025
|
+
case 2:
|
|
24078
24026
|
if (healthFundId) {
|
|
24079
|
-
_context9.next =
|
|
24027
|
+
_context9.next = 4;
|
|
24080
24028
|
break;
|
|
24081
24029
|
}
|
|
24082
24030
|
|
|
24083
24031
|
throw new utils_paramError["default"]('healthFundId');
|
|
24084
24032
|
|
|
24085
|
-
case
|
|
24033
|
+
case 4:
|
|
24086
24034
|
if (file) {
|
|
24087
|
-
_context9.next =
|
|
24035
|
+
_context9.next = 6;
|
|
24088
24036
|
break;
|
|
24089
24037
|
}
|
|
24090
24038
|
|
|
24091
24039
|
throw new utils_paramError["default"]('file');
|
|
24092
24040
|
|
|
24093
|
-
case
|
|
24094
|
-
_context9.
|
|
24095
|
-
_context9.next = 10;
|
|
24041
|
+
case 6:
|
|
24042
|
+
_context9.next = 8;
|
|
24096
24043
|
return getAttachmentUrl(businessId, {
|
|
24097
24044
|
contentType: file.type,
|
|
24098
24045
|
fileName: file.name,
|
|
@@ -24100,12 +24047,11 @@ var uploadAttachmentToS3 = /*#__PURE__*/function () {
|
|
|
24100
24047
|
contentLength: file.size
|
|
24101
24048
|
}, opts);
|
|
24102
24049
|
|
|
24103
|
-
case
|
|
24050
|
+
case 8:
|
|
24104
24051
|
_yield$getAttachmentU = _context9.sent;
|
|
24105
24052
|
signedPost = _yield$getAttachmentU.signedPost;
|
|
24106
24053
|
s3Url = _yield$getAttachmentU.s3Url;
|
|
24107
24054
|
s3SignedUrlId = _yield$getAttachmentU.s3SignedUrlId;
|
|
24108
|
-
// eslint-disable-next-line
|
|
24109
24055
|
bodyFormData = new FormData();
|
|
24110
24056
|
|
|
24111
24057
|
for (key in signedPost.fields) {
|
|
@@ -24113,26 +24059,24 @@ var uploadAttachmentToS3 = /*#__PURE__*/function () {
|
|
|
24113
24059
|
}
|
|
24114
24060
|
|
|
24115
24061
|
bodyFormData.append('file', file);
|
|
24116
|
-
_context9.next =
|
|
24117
|
-
return
|
|
24062
|
+
_context9.next = 17;
|
|
24063
|
+
return fetch(signedPost.url, {
|
|
24064
|
+
method: 'POST',
|
|
24065
|
+
body: bodyFormData
|
|
24066
|
+
});
|
|
24118
24067
|
|
|
24119
|
-
case
|
|
24068
|
+
case 17:
|
|
24120
24069
|
return _context9.abrupt("return", {
|
|
24121
24070
|
s3Url: s3Url,
|
|
24122
24071
|
s3SignedUrlId: s3SignedUrlId
|
|
24123
24072
|
});
|
|
24124
24073
|
|
|
24125
|
-
case
|
|
24126
|
-
_context9.prev = 22;
|
|
24127
|
-
_context9.t0 = _context9["catch"](7);
|
|
24128
|
-
throw _context9.t0;
|
|
24129
|
-
|
|
24130
|
-
case 25:
|
|
24074
|
+
case 18:
|
|
24131
24075
|
case "end":
|
|
24132
24076
|
return _context9.stop();
|
|
24133
24077
|
}
|
|
24134
24078
|
}
|
|
24135
|
-
}, _callee9
|
|
24079
|
+
}, _callee9);
|
|
24136
24080
|
}));
|
|
24137
24081
|
|
|
24138
24082
|
return function uploadAttachmentToS3(_x30, _x31, _x32, _x33) {
|
|
@@ -24147,39 +24091,36 @@ var uploadAttachmentToS3 = /*#__PURE__*/function () {
|
|
|
24147
24091
|
|
|
24148
24092
|
var uploadAgedCareAttachmentToS3 = /*#__PURE__*/function () {
|
|
24149
24093
|
var _ref10 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee10(businessId, file, opts) {
|
|
24150
|
-
var
|
|
24094
|
+
var _yield$uploadAgedCare, signedPost, s3Url, s3SignedUrlId, bodyFormData;
|
|
24151
24095
|
|
|
24152
24096
|
return _regeneratorRuntime__default["default"].wrap(function _callee10$(_context10) {
|
|
24153
24097
|
while (1) {
|
|
24154
24098
|
switch (_context10.prev = _context10.next) {
|
|
24155
24099
|
case 0:
|
|
24156
|
-
awsAxios = axios__default["default"].create();
|
|
24157
|
-
|
|
24158
24100
|
if (businessId) {
|
|
24159
|
-
_context10.next =
|
|
24101
|
+
_context10.next = 2;
|
|
24160
24102
|
break;
|
|
24161
24103
|
}
|
|
24162
24104
|
|
|
24163
24105
|
throw new utils_paramError["default"]('businessId');
|
|
24164
24106
|
|
|
24165
|
-
case
|
|
24107
|
+
case 2:
|
|
24166
24108
|
if (file) {
|
|
24167
|
-
_context10.next =
|
|
24109
|
+
_context10.next = 4;
|
|
24168
24110
|
break;
|
|
24169
24111
|
}
|
|
24170
24112
|
|
|
24171
24113
|
throw new utils_paramError["default"]('file');
|
|
24172
24114
|
|
|
24173
|
-
case
|
|
24174
|
-
_context10.
|
|
24175
|
-
_context10.next = 8;
|
|
24115
|
+
case 4:
|
|
24116
|
+
_context10.next = 6;
|
|
24176
24117
|
return uploadAgedCareUrl({
|
|
24177
24118
|
businessId: businessId,
|
|
24178
24119
|
contentType: file.type,
|
|
24179
24120
|
contentLength: file.size
|
|
24180
24121
|
}, opts);
|
|
24181
24122
|
|
|
24182
|
-
case
|
|
24123
|
+
case 6:
|
|
24183
24124
|
_yield$uploadAgedCare = _context10.sent;
|
|
24184
24125
|
signedPost = _yield$uploadAgedCare.signedPost;
|
|
24185
24126
|
s3Url = _yield$uploadAgedCare.s3Url;
|
|
@@ -24191,26 +24132,24 @@ var uploadAgedCareAttachmentToS3 = /*#__PURE__*/function () {
|
|
|
24191
24132
|
bodyFormData.append(key, value);
|
|
24192
24133
|
});
|
|
24193
24134
|
bodyFormData.append('file', file);
|
|
24194
|
-
_context10.next =
|
|
24195
|
-
return
|
|
24135
|
+
_context10.next = 15;
|
|
24136
|
+
return fetch(signedPost.url, {
|
|
24137
|
+
method: 'POST',
|
|
24138
|
+
body: bodyFormData
|
|
24139
|
+
});
|
|
24196
24140
|
|
|
24197
|
-
case
|
|
24141
|
+
case 15:
|
|
24198
24142
|
return _context10.abrupt("return", {
|
|
24199
24143
|
s3Url: s3Url,
|
|
24200
24144
|
s3SignedUrlId: s3SignedUrlId
|
|
24201
24145
|
});
|
|
24202
24146
|
|
|
24203
|
-
case
|
|
24204
|
-
_context10.prev = 20;
|
|
24205
|
-
_context10.t0 = _context10["catch"](5);
|
|
24206
|
-
throw _context10.t0;
|
|
24207
|
-
|
|
24208
|
-
case 23:
|
|
24147
|
+
case 16:
|
|
24209
24148
|
case "end":
|
|
24210
24149
|
return _context10.stop();
|
|
24211
24150
|
}
|
|
24212
24151
|
}
|
|
24213
|
-
}, _callee10
|
|
24152
|
+
}, _callee10);
|
|
24214
24153
|
}));
|
|
24215
24154
|
|
|
24216
24155
|
return function uploadAgedCareAttachmentToS3(_x34, _x35, _x36) {
|
|
@@ -24255,40 +24194,61 @@ var setCurrentAppVersion = function setCurrentAppVersion(version) {
|
|
|
24255
24194
|
|
|
24256
24195
|
var fetchLatestAppVersion = /*#__PURE__*/function () {
|
|
24257
24196
|
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
24258
|
-
var
|
|
24197
|
+
var res, data;
|
|
24259
24198
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
24260
24199
|
while (1) {
|
|
24261
24200
|
switch (_context.prev = _context.next) {
|
|
24262
24201
|
case 0:
|
|
24263
|
-
|
|
24264
|
-
_context.
|
|
24265
|
-
|
|
24266
|
-
return versionAxios.get('/manifest.json');
|
|
24202
|
+
_context.prev = 0;
|
|
24203
|
+
_context.next = 3;
|
|
24204
|
+
return fetch('/manifest.json');
|
|
24267
24205
|
|
|
24268
|
-
case
|
|
24206
|
+
case 3:
|
|
24269
24207
|
res = _context.sent;
|
|
24270
|
-
|
|
24208
|
+
|
|
24209
|
+
if (res.ok) {
|
|
24210
|
+
_context.next = 8;
|
|
24211
|
+
break;
|
|
24212
|
+
}
|
|
24213
|
+
|
|
24214
|
+
if (!(res.status === 404)) {
|
|
24215
|
+
_context.next = 7;
|
|
24216
|
+
break;
|
|
24217
|
+
}
|
|
24218
|
+
|
|
24219
|
+
return _context.abrupt("return", null);
|
|
24220
|
+
|
|
24221
|
+
case 7:
|
|
24222
|
+
throw new Error("HTTP error: " + res.status);
|
|
24271
24223
|
|
|
24272
24224
|
case 8:
|
|
24273
|
-
_context.
|
|
24274
|
-
|
|
24225
|
+
_context.next = 10;
|
|
24226
|
+
return res.json();
|
|
24227
|
+
|
|
24228
|
+
case 10:
|
|
24229
|
+
data = _context.sent;
|
|
24230
|
+
return _context.abrupt("return", _get__default["default"](data, 'app_version'));
|
|
24275
24231
|
|
|
24276
|
-
|
|
24277
|
-
|
|
24232
|
+
case 14:
|
|
24233
|
+
_context.prev = 14;
|
|
24234
|
+
_context.t0 = _context["catch"](0);
|
|
24235
|
+
|
|
24236
|
+
if (!(_context.t0 instanceof Error && _context.t0.message.includes('404'))) {
|
|
24237
|
+
_context.next = 18;
|
|
24278
24238
|
break;
|
|
24279
24239
|
}
|
|
24280
24240
|
|
|
24281
24241
|
return _context.abrupt("return", null);
|
|
24282
24242
|
|
|
24283
|
-
case
|
|
24243
|
+
case 18:
|
|
24284
24244
|
throw _context.t0;
|
|
24285
24245
|
|
|
24286
|
-
case
|
|
24246
|
+
case 19:
|
|
24287
24247
|
case "end":
|
|
24288
24248
|
return _context.stop();
|
|
24289
24249
|
}
|
|
24290
24250
|
}
|
|
24291
|
-
}, _callee, null, [[
|
|
24251
|
+
}, _callee, null, [[0, 14]]);
|
|
24292
24252
|
}));
|
|
24293
24253
|
|
|
24294
24254
|
return function fetchLatestAppVersion() {
|
|
@@ -24615,12 +24575,14 @@ var HEADER__SDK_VERSION = 'x-sdkver';
|
|
|
24615
24575
|
var HEADER__TOKEN = 'x-token';
|
|
24616
24576
|
var _isTokenExpired = function _isTokenExpired(token) {
|
|
24617
24577
|
try {
|
|
24618
|
-
var
|
|
24619
|
-
|
|
24578
|
+
var _decodedToken$exp;
|
|
24579
|
+
|
|
24580
|
+
var decodedToken = jwtDecode.jwtDecode(token);
|
|
24581
|
+
return differenceInSeconds__default["default"](((_decodedToken$exp = decodedToken == null ? void 0 : decodedToken.exp) != null ? _decodedToken$exp : 0) * 1000, new Date()) < 0;
|
|
24620
24582
|
} catch (err) {
|
|
24621
24583
|
return true;
|
|
24622
24584
|
}
|
|
24623
|
-
};
|
|
24585
|
+
};
|
|
24624
24586
|
|
|
24625
24587
|
var _getEnvBaseUrls = function _getEnvBaseUrls(envBaseUrls, _ref) {
|
|
24626
24588
|
var env = _ref.env;
|
|
@@ -24638,7 +24600,13 @@ var sdkClient = {
|
|
|
24638
24600
|
appId: APP_ID,
|
|
24639
24601
|
appVersion: services_storage["default"].get('appVersion'),
|
|
24640
24602
|
apiVer: API_VER,
|
|
24641
|
-
|
|
24603
|
+
httpClient: utils_httpClient.createHttpClient(),
|
|
24604
|
+
|
|
24605
|
+
// Backwards compatibility alias
|
|
24606
|
+
get axios() {
|
|
24607
|
+
return this.httpClient;
|
|
24608
|
+
},
|
|
24609
|
+
|
|
24642
24610
|
baseUrls: undefined,
|
|
24643
24611
|
defaultVersion: DEFAULT_VERSION,
|
|
24644
24612
|
device: services_storage["default"].get('device'),
|
|
@@ -24651,6 +24619,9 @@ var sdkClient = {
|
|
|
24651
24619
|
member: services_storage["default"].get('member'),
|
|
24652
24620
|
requestInterceptor: undefined,
|
|
24653
24621
|
requestInterceptorSuccess: undefined,
|
|
24622
|
+
responseInterceptor: undefined,
|
|
24623
|
+
responseInterceptorSuccess: undefined,
|
|
24624
|
+
responseInterceptorFailure: undefined,
|
|
24654
24625
|
sdkVersion: services_storage["default"].get('sdkVersion'),
|
|
24655
24626
|
tokens: services_storage["default"].get('tokens', {
|
|
24656
24627
|
storeType: 'session'
|
|
@@ -24754,21 +24725,20 @@ var sdkClient = {
|
|
|
24754
24725
|
|
|
24755
24726
|
/**
|
|
24756
24727
|
* Setup the Tyro Health SDK
|
|
24757
|
-
* @param
|
|
24758
|
-
* @param
|
|
24728
|
+
* @param env - The environment that the SDK will point to
|
|
24729
|
+
* @param opts - Additional setup options
|
|
24759
24730
|
*/
|
|
24760
|
-
// @ts-expect-error TS(1015): Parameter cannot have question mark and initialize... Remove this comment to see the full error message
|
|
24761
24731
|
setup: function setup(env, opts) {
|
|
24762
24732
|
if (opts === void 0) {
|
|
24763
24733
|
opts = {};
|
|
24764
24734
|
}
|
|
24765
24735
|
|
|
24766
|
-
// Setup
|
|
24767
|
-
this.
|
|
24736
|
+
// Setup http client instance
|
|
24737
|
+
this.httpClient = utils_httpClient.createHttpClient();
|
|
24768
24738
|
|
|
24769
|
-
if (this.
|
|
24770
|
-
this.
|
|
24771
|
-
this.
|
|
24739
|
+
if (this.httpClient) {
|
|
24740
|
+
this.httpClient.defaults.headers.post['Content-Type'] = CONTENT_TYPE;
|
|
24741
|
+
this.httpClient.defaults.headers.post.Accept = CONTENT_TYPE;
|
|
24772
24742
|
}
|
|
24773
24743
|
|
|
24774
24744
|
this.setConfig(_objectSpread$1({}, opts, {
|
|
@@ -24783,13 +24753,11 @@ var sdkClient = {
|
|
|
24783
24753
|
// Setup initial SDK properties
|
|
24784
24754
|
this.appId = _get__default["default"](opts, 'appId', this.appId);
|
|
24785
24755
|
this.appVersion = _get__default["default"](opts, 'appVersion', this.appVersion);
|
|
24786
|
-
this.apiVer = _get__default["default"](opts, 'apiVer', this.apiVer);
|
|
24787
|
-
|
|
24756
|
+
this.apiVer = _get__default["default"](opts, 'apiVer', this.apiVer);
|
|
24788
24757
|
this.apiVersions = _get__default["default"](opts, 'apiVersions', this.apiVersions);
|
|
24789
24758
|
this.defaultVersion = _get__default["default"](opts, 'defaultVersion', this.defaultVersion);
|
|
24790
24759
|
this.env = _get__default["default"](opts, 'env', this.env);
|
|
24791
|
-
this.sdkVersion = _get__default["default"](opts, 'sdkVersion', this.sdkVersion);
|
|
24792
|
-
|
|
24760
|
+
this.sdkVersion = _get__default["default"](opts, 'sdkVersion', this.sdkVersion);
|
|
24793
24761
|
this.baseUrls = _get__default["default"](opts, 'baseUrls');
|
|
24794
24762
|
this.setRegion(DEFAULT_REGION);
|
|
24795
24763
|
},
|
|
@@ -24800,9 +24768,7 @@ var sdkClient = {
|
|
|
24800
24768
|
|
|
24801
24769
|
/**
|
|
24802
24770
|
* Check if the token is valid and the client is logged in
|
|
24803
|
-
* @return {Boolean} hasValidSession
|
|
24804
24771
|
*/
|
|
24805
|
-
// @ts-expect-error TS(1015): Parameter cannot have question mark and initialize... Remove this comment to see the full error message
|
|
24806
24772
|
hasValidSession: function hasValidSession(tokenType) {
|
|
24807
24773
|
if (tokenType === void 0) {
|
|
24808
24774
|
tokenType = 'account';
|
|
@@ -24813,9 +24779,7 @@ var sdkClient = {
|
|
|
24813
24779
|
|
|
24814
24780
|
/**
|
|
24815
24781
|
* Check if the token has expired
|
|
24816
|
-
* @return {Boolean} hasSessionExpired
|
|
24817
24782
|
*/
|
|
24818
|
-
// @ts-expect-error TS(1015): Parameter cannot have question mark and initialize... Remove this comment to see the full error message
|
|
24819
24783
|
hasSessionExpired: function hasSessionExpired(tokenType) {
|
|
24820
24784
|
if (tokenType === void 0) {
|
|
24821
24785
|
tokenType = 'account';
|
|
@@ -24826,40 +24790,37 @@ var sdkClient = {
|
|
|
24826
24790
|
|
|
24827
24791
|
/**
|
|
24828
24792
|
* Set the HTTP request interceptor - will intercept every HTTP request that the Tyro Health SDK uses.
|
|
24829
|
-
* @param
|
|
24793
|
+
* @param headers - Headers to be included in every request
|
|
24830
24794
|
*/
|
|
24831
24795
|
setRequestInterceptor: function setRequestInterceptor(headers) {
|
|
24832
24796
|
var _this = this;
|
|
24833
24797
|
|
|
24834
|
-
|
|
24835
|
-
this.requestInterceptor = this.axios.interceptors.request.use( /*#__PURE__*/function () {
|
|
24798
|
+
this.requestInterceptor = this.httpClient.interceptors.request.use( /*#__PURE__*/function () {
|
|
24836
24799
|
var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(config) {
|
|
24837
|
-
var
|
|
24800
|
+
var requestHeaders, deviceId;
|
|
24838
24801
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
24839
24802
|
while (1) {
|
|
24840
24803
|
switch (_context.prev = _context.next) {
|
|
24841
24804
|
case 0:
|
|
24842
|
-
|
|
24805
|
+
requestHeaders = _objectSpread$1({}, config.headers);
|
|
24843
24806
|
|
|
24844
24807
|
_forOwn__default["default"](headers, function (val, key) {
|
|
24845
|
-
|
|
24808
|
+
requestHeaders[key] = val;
|
|
24846
24809
|
});
|
|
24847
24810
|
|
|
24848
|
-
|
|
24849
|
-
|
|
24850
|
-
|
|
24811
|
+
requestHeaders[HEADER__APP_ID] = _this.appId;
|
|
24812
|
+
requestHeaders[HEADER__APP_VERSION] = _this.appVersion;
|
|
24813
|
+
requestHeaders[HEADER__API_VER] = _this.apiVer;
|
|
24851
24814
|
|
|
24852
24815
|
if (_this.sdkVersion) {
|
|
24853
|
-
|
|
24854
|
-
}
|
|
24855
|
-
|
|
24816
|
+
requestHeaders[HEADER__SDK_VERSION] = _this.sdkVersion;
|
|
24817
|
+
}
|
|
24856
24818
|
|
|
24857
24819
|
if (config.tokenType === 'session' && _this.tokens.session) {
|
|
24858
|
-
|
|
24820
|
+
requestHeaders.Authorization = _this.tokens.session;
|
|
24859
24821
|
} else if (_this.tokens.account) {
|
|
24860
|
-
|
|
24861
|
-
}
|
|
24862
|
-
|
|
24822
|
+
requestHeaders.Authorization = _this.tokens.account;
|
|
24823
|
+
}
|
|
24863
24824
|
|
|
24864
24825
|
if (config.skipDeviceCheck) {
|
|
24865
24826
|
_context.next = 12;
|
|
@@ -24871,15 +24832,19 @@ var sdkClient = {
|
|
|
24871
24832
|
|
|
24872
24833
|
case 10:
|
|
24873
24834
|
deviceId = _context.sent;
|
|
24874
|
-
|
|
24835
|
+
|
|
24836
|
+
if (deviceId) {
|
|
24837
|
+
requestHeaders[HEADER__DEVICE_ID] = deviceId;
|
|
24838
|
+
}
|
|
24875
24839
|
|
|
24876
24840
|
case 12:
|
|
24877
24841
|
if (_this.requestInterceptorSuccess) {
|
|
24878
|
-
// @ts-expect-error TS(2349): This expression is not callable.
|
|
24879
24842
|
_this.requestInterceptorSuccess(config);
|
|
24880
24843
|
}
|
|
24881
24844
|
|
|
24882
|
-
return _context.abrupt("return",
|
|
24845
|
+
return _context.abrupt("return", _objectSpread$1({}, config, {
|
|
24846
|
+
headers: requestHeaders
|
|
24847
|
+
}));
|
|
24883
24848
|
|
|
24884
24849
|
case 14:
|
|
24885
24850
|
case "end":
|
|
@@ -24903,10 +24868,7 @@ var sdkClient = {
|
|
|
24903
24868
|
setResponseInterceptor: function setResponseInterceptor() {
|
|
24904
24869
|
var _this2 = this;
|
|
24905
24870
|
|
|
24906
|
-
|
|
24907
|
-
this.responseInterceptor = this.axios.interceptors.response.use(function (config) {
|
|
24908
|
-
var response = Object.assign({}, config);
|
|
24909
|
-
|
|
24871
|
+
this.responseInterceptor = this.httpClient.interceptors.response.use(function (response) {
|
|
24910
24872
|
if (response.headers && response.headers[HEADER__TOKEN] && !_get__default["default"](response, 'config.url', '').includes('/auth/impersonate')) {
|
|
24911
24873
|
var authToken = response.headers[HEADER__TOKEN];
|
|
24912
24874
|
|
|
@@ -24916,19 +24878,15 @@ var sdkClient = {
|
|
|
24916
24878
|
if (response.headers && response.headers[HEADER__INTERCOM_HASH]) {
|
|
24917
24879
|
_this2.intercomHash = response.headers[HEADER__INTERCOM_HASH];
|
|
24918
24880
|
services_storage["default"].set('intercomHash', _this2.intercomHash);
|
|
24919
|
-
}
|
|
24920
|
-
|
|
24881
|
+
}
|
|
24921
24882
|
|
|
24922
24883
|
if (_this2.responseInterceptorSuccess) {
|
|
24923
|
-
|
|
24924
|
-
_this2.responseInterceptorSuccess(config);
|
|
24884
|
+
_this2.responseInterceptorSuccess(response);
|
|
24925
24885
|
}
|
|
24926
24886
|
|
|
24927
24887
|
return response;
|
|
24928
24888
|
}, function (err) {
|
|
24929
|
-
// @ts-expect-error TS(2339): Property 'responseInterceptorFailure' does not exi... Remove this comment to see the full error message
|
|
24930
24889
|
if (_this2.responseInterceptorFailure) {
|
|
24931
|
-
// @ts-expect-error TS(2339): Property 'responseInterceptorFailure' does not exi... Remove this comment to see the full error message
|
|
24932
24890
|
_this2.responseInterceptorFailure(_get__default["default"](err, 'response', err));
|
|
24933
24891
|
}
|
|
24934
24892
|
|
|
@@ -24943,20 +24901,18 @@ var sdkClient = {
|
|
|
24943
24901
|
services_storage["default"].remove('tokens');
|
|
24944
24902
|
},
|
|
24945
24903
|
isImpersonating: function isImpersonating() {
|
|
24946
|
-
var _jwtDecode =
|
|
24904
|
+
var _jwtDecode = jwtDecode.jwtDecode(this.tokens.account),
|
|
24947
24905
|
imp = _jwtDecode.imp;
|
|
24948
24906
|
|
|
24949
24907
|
return Boolean(imp);
|
|
24950
24908
|
},
|
|
24951
|
-
// @ts-expect-error TS(1015): Parameter cannot have question mark and initialize... Remove this comment to see the full error message
|
|
24952
24909
|
getTokenExpiry: function getTokenExpiry(tokenType) {
|
|
24953
24910
|
if (tokenType === void 0) {
|
|
24954
24911
|
tokenType = 'account';
|
|
24955
24912
|
}
|
|
24956
24913
|
|
|
24957
|
-
return
|
|
24914
|
+
return jwtDecode.jwtDecode(this.tokens[tokenType]).exp;
|
|
24958
24915
|
},
|
|
24959
|
-
// @ts-expect-error TS(1015): Parameter cannot have question mark and initialize... Remove this comment to see the full error message
|
|
24960
24916
|
setToken: function setToken(token, tokenType) {
|
|
24961
24917
|
var _Object$assign;
|
|
24962
24918
|
|
|
@@ -24983,7 +24939,6 @@ var sdkClient = {
|
|
|
24983
24939
|
console.log("Current region is set to " + region);
|
|
24984
24940
|
|
|
24985
24941
|
if (this.env) {
|
|
24986
|
-
// @ts-expect-error TS(2322): Type '{}' is not assignable to type 'undefined'.
|
|
24987
24942
|
this.baseUrls = this.baseUrls || _getEnvBaseUrls(utils_baseUrls_index["default"], {
|
|
24988
24943
|
env: this.env
|
|
24989
24944
|
});
|
|
@@ -24996,10 +24951,14 @@ var sdkClient = {
|
|
|
24996
24951
|
* Kill the SDK - stop interceptors, clear class properties, clear local storage
|
|
24997
24952
|
*/
|
|
24998
24953
|
stop: function stop() {
|
|
24999
|
-
|
|
25000
|
-
|
|
24954
|
+
if (this.requestInterceptor !== undefined) {
|
|
24955
|
+
this.httpClient.interceptors.request.eject(this.requestInterceptor);
|
|
24956
|
+
}
|
|
24957
|
+
|
|
24958
|
+
if (this.responseInterceptor !== undefined) {
|
|
24959
|
+
this.httpClient.interceptors.response.eject(this.responseInterceptor);
|
|
24960
|
+
}
|
|
25001
24961
|
|
|
25002
|
-
this.axios.interceptors.request.eject(this.responseInterceptor);
|
|
25003
24962
|
this.removeStorage();
|
|
25004
24963
|
},
|
|
25005
24964
|
removeStorage: function removeStorage() {
|