@medipass/web-sdk 11.38.1-feature-eclipse-reporting.0 → 11.38.1-feature-typescript-claudia.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +95 -0
- package/babel.config.js +2 -1
- package/lib/index.d.ts +262 -0
- package/lib/index.js +83 -3
- package/lib/{regions-7b23080d.js → regions-a0a28864.js} +2 -2
- package/lib/resources/accounts.d.ts +215 -0
- package/lib/resources/accounts.js +3 -3
- package/lib/resources/actions.d.ts +13 -0
- package/lib/resources/actions.js +3 -3
- package/lib/resources/api-keys.d.ts +24 -0
- package/lib/resources/api-keys.js +3 -3
- package/lib/resources/applications.d.ts +31 -0
- package/lib/resources/applications.js +3 -3
- package/lib/resources/attachments.d.ts +32 -0
- package/lib/resources/attachments.js +3 -3
- package/lib/resources/auth.d.ts +59 -0
- package/lib/resources/auth.js +3 -3
- package/lib/resources/bulk-submits.d.ts +17 -0
- package/lib/resources/bulk-submits.js +3 -3
- package/lib/resources/bulk-uploads.d.ts +26 -0
- package/lib/resources/bulk-uploads.js +3 -3
- package/lib/resources/business-profiles.d.ts +18 -0
- package/lib/resources/business-profiles.js +3 -3
- package/lib/resources/businesses.d.ts +132 -0
- package/lib/resources/businesses.js +3 -3
- package/lib/resources/claim-items.d.ts +31 -0
- package/lib/resources/claim-items.js +3 -3
- package/lib/resources/devices.d.ts +11 -0
- package/lib/resources/devices.js +3 -3
- package/lib/resources/doc-accounts.d.ts +32 -0
- package/lib/resources/doc-accounts.js +3 -3
- package/lib/resources/documents.d.ts +90 -0
- package/lib/resources/documents.js +3 -3
- package/lib/resources/emails.d.ts +14 -0
- package/lib/resources/emails.js +3 -3
- package/lib/resources/form-application-templates.d.ts +20 -0
- package/lib/resources/form-application-templates.js +3 -3
- package/lib/resources/form-applications.d.ts +27 -0
- package/lib/resources/form-applications.js +3 -3
- package/lib/resources/forms.d.ts +100 -0
- package/lib/resources/forms.js +3 -3
- package/lib/resources/funder-services.d.ts +8 -0
- package/lib/resources/funder-services.js +3 -3
- package/lib/resources/funder-settings.d.ts +8 -0
- package/lib/resources/funder-settings.js +3 -3
- package/lib/resources/funders.d.ts +5 -0
- package/lib/resources/funders.js +3 -3
- package/lib/resources/futures.d.ts +85 -0
- package/lib/resources/futures.js +3 -3
- package/lib/resources/health-fund-accounts.d.ts +78 -0
- package/lib/resources/health-fund-accounts.js +3 -3
- package/lib/resources/health-fund-settings.d.ts +39 -0
- package/lib/resources/health-fund-settings.js +3 -3
- package/lib/resources/healthfunds.d.ts +64 -0
- package/lib/resources/healthfunds.js +3 -3
- package/lib/resources/icditems.d.ts +14 -0
- package/lib/resources/icditems.js +3 -3
- package/lib/resources/invoice-scans.d.ts +26 -0
- package/lib/resources/invoice-scans.js +3 -3
- package/lib/resources/jhcs.d.ts +7 -0
- package/lib/resources/jhcs.js +3 -3
- package/lib/resources/kyc.d.ts +109 -0
- package/lib/resources/kyc.js +3 -3
- package/lib/resources/logs.d.ts +16 -0
- package/lib/resources/logs.js +3 -3
- package/lib/resources/members.d.ts +92 -0
- package/lib/resources/members.js +3 -3
- package/lib/resources/message-mappings.d.ts +9 -0
- package/lib/resources/message-mappings.js +3 -3
- package/lib/resources/minions.d.ts +40 -0
- package/lib/resources/minions.js +3 -3
- package/lib/resources/modalities.d.ts +19 -0
- package/lib/resources/modalities.js +3 -3
- package/lib/resources/notes.d.ts +17 -0
- package/lib/resources/notes.js +3 -3
- package/lib/resources/onboarding-applications.d.ts +52 -0
- package/lib/resources/onboarding-applications.js +3 -3
- package/lib/resources/onboarding-requests.d.ts +39 -0
- package/lib/resources/onboarding-requests.js +3 -3
- package/lib/resources/ops.d.ts +60 -0
- package/lib/resources/ops.js +3 -3
- package/lib/resources/organisations.d.ts +7 -0
- package/lib/resources/organisations.js +3 -3
- package/lib/resources/partners.d.ts +50 -0
- package/lib/resources/partners.js +3 -3
- package/lib/resources/patients.d.ts +44 -0
- package/lib/resources/patients.js +3 -3
- package/lib/resources/payments.d.ts +155 -0
- package/lib/resources/payments.js +3 -3
- package/lib/resources/pms.d.ts +43 -0
- package/lib/resources/pms.js +3 -3
- package/lib/resources/practice-profiles.d.ts +20 -0
- package/lib/resources/practice-profiles.js +3 -3
- package/lib/resources/practice-types.d.ts +6 -0
- package/lib/resources/practice-types.js +3 -3
- package/lib/resources/practices.d.ts +137 -0
- package/lib/resources/practices.js +3 -3
- package/lib/resources/products.d.ts +23 -0
- package/lib/resources/products.js +3 -3
- package/lib/resources/professional-categories.d.ts +23 -0
- package/lib/resources/professional-categories.js +3 -3
- package/lib/resources/provider-number-types.d.ts +16 -0
- package/lib/resources/provider-number-types.js +3 -3
- package/lib/resources/provider-registration-types.d.ts +15 -0
- package/lib/resources/provider-registration-types.js +3 -3
- package/lib/resources/provider-requests.d.ts +17 -0
- package/lib/resources/provider-requests.js +3 -3
- package/lib/resources/provider-types.d.ts +6 -0
- package/lib/resources/provider-types.js +3 -3
- package/lib/resources/ref-sources.d.ts +6 -0
- package/lib/resources/ref-sources.js +3 -3
- package/lib/resources/risk.d.ts +13 -0
- package/lib/resources/risk.js +3 -3
- package/lib/resources/rnas.d.ts +43 -0
- package/lib/resources/rnas.js +3 -3
- package/lib/resources/roles.d.ts +7 -0
- package/lib/resources/roles.js +3 -3
- package/lib/resources/self-checkout-sessions.d.ts +134 -0
- package/lib/resources/self-checkout-sessions.js +3 -3
- package/lib/resources/services.d.ts +88 -0
- package/lib/resources/services.js +3 -3
- package/lib/resources/settlements.d.ts +37 -0
- package/lib/resources/settlements.js +3 -3
- package/lib/resources/sign-up.d.ts +5 -0
- package/lib/resources/sign-up.js +3 -3
- package/lib/resources/specialties.d.ts +23 -0
- package/lib/resources/specialties.js +3 -3
- package/lib/resources/staff-profiles.d.ts +20 -0
- package/lib/resources/staff-profiles.js +3 -3
- package/lib/resources/staff.d.ts +242 -0
- package/lib/resources/staff.js +3 -3
- package/lib/resources/statistics.d.ts +56 -0
- package/lib/resources/statistics.js +3 -3
- package/lib/resources/subscriptions.d.ts +32 -0
- package/lib/resources/subscriptions.js +3 -3
- package/lib/resources/terminals.d.ts +71 -0
- package/lib/resources/terminals.js +3 -3
- package/lib/resources/transaction-export.d.ts +18 -0
- package/lib/resources/transaction-export.js +3 -3
- package/lib/resources/transactions.d.ts +466 -0
- package/lib/resources/transactions.js +3 -3
- package/lib/resources/triggers.d.ts +20 -0
- package/lib/resources/triggers.js +3 -3
- package/lib/resources/vendors.d.ts +9 -0
- package/lib/resources/vendors.js +3 -3
- package/lib/resources/verify.d.ts +9 -0
- package/lib/resources/verify.js +3 -3
- package/lib/resources/workers.d.ts +3 -0
- package/lib/resources/workers.js +3 -3
- package/lib/resources/workflow-exceptions.d.ts +5 -0
- package/lib/resources/workflow-exceptions.js +3 -3
- package/lib/services/aws.d.ts +54 -0
- package/lib/services/aws.js +3 -3
- package/lib/services/storage.d.ts +28 -0
- package/lib/services/storage.js +126 -18
- package/lib/services/version.d.ts +21 -0
- package/lib/services/version.js +3 -3
- package/lib/{staff-1ec3d500.js → staff-96febcd8.js} +345 -738
- package/lib/types/documents.d.ts +115 -0
- package/lib/types/documents.js +2 -0
- package/lib/types/forms.d.ts +67 -0
- package/lib/types/forms.js +2 -0
- package/lib/types/index.d.ts +42 -0
- package/lib/types/index.js +2 -0
- package/lib/types/message-mappings.d.ts +18 -0
- package/lib/types/message-mappings.js +2 -0
- package/lib/types/notes.d.ts +5 -0
- package/lib/types/notes.js +2 -0
- package/lib/types/products.d.ts +34 -0
- package/lib/types/products.js +2 -0
- package/lib/types/professional-categories.d.ts +20 -0
- package/lib/types/professional-categories.js +2 -0
- package/lib/types/specialties.d.ts +22 -0
- package/lib/types/specialties.js +2 -0
- package/lib/types/subscriptions.d.ts +52 -0
- package/lib/types/subscriptions.js +2 -0
- package/lib/utils/application.d.ts +1 -0
- package/lib/utils/application.js +3 -3
- package/lib/utils/base-urls/core.d.ts +19 -0
- package/lib/utils/base-urls/index.d.ts +37 -0
- package/lib/utils/base-urls/risk.d.ts +17 -0
- package/lib/utils/does-param-exist.d.ts +2 -0
- package/lib/utils/get-axios-error.d.ts +2 -0
- package/lib/utils/param-error.d.ts +3 -0
- package/lib/utils/professions.d.ts +3 -0
- package/lib/utils/professions.js +3 -3
- package/lib/utils/regions.d.ts +1 -0
- package/lib/utils/regions.js +2 -2
- package/lib/utils/request.d.ts +3 -0
- package/lib/utils/request.js +3 -3
- package/lib/utils/staff.d.ts +8 -0
- package/lib/utils/staff.js +3 -3
- package/package.json +19 -9
- package/tsconfig.json +33 -0
- package/.eslintrc +0 -3
- package/lib/_types/documents.js.flow +0 -118
- package/lib/_types/forms.js.flow +0 -57
- package/lib/_types/index.js.flow +0 -47
- package/lib/_types/message-mappings.js.flow +0 -22
- package/lib/_types/notes.js.flow +0 -7
- package/lib/_types/products.js.flow +0 -40
- package/lib/_types/professional-categories.js.flow +0 -25
- package/lib/_types/specialties.js.flow +0 -27
- package/lib/_types/subscriptions.js.flow +0 -58
- package/lib/index.js.flow +0 -438
- package/lib/resources/accounts.js.flow +0 -445
- package/lib/resources/actions.js.flow +0 -25
- package/lib/resources/api-keys.js.flow +0 -54
- package/lib/resources/applications.js.flow +0 -60
- package/lib/resources/attachments.js.flow +0 -75
- package/lib/resources/auth.js.flow +0 -185
- package/lib/resources/bulk-submits.js.flow +0 -43
- package/lib/resources/bulk-uploads.js.flow +0 -56
- package/lib/resources/business-profiles.js.flow +0 -45
- package/lib/resources/businesses.js.flow +0 -267
- package/lib/resources/claim-items.js.flow +0 -76
- package/lib/resources/devices.js.flow +0 -64
- package/lib/resources/doc-accounts.js.flow +0 -61
- package/lib/resources/documents.js.flow +0 -216
- package/lib/resources/emails.js.flow +0 -96
- package/lib/resources/form-application-templates.js.flow +0 -52
- package/lib/resources/form-applications.js.flow +0 -62
- package/lib/resources/forms.js.flow +0 -222
- package/lib/resources/funder-services.js.flow +0 -17
- package/lib/resources/funder-settings.js.flow +0 -58
- package/lib/resources/funders.js.flow +0 -15
- package/lib/resources/futures.js.flow +0 -154
- package/lib/resources/health-fund-accounts.js.flow +0 -198
- package/lib/resources/health-fund-settings.js.flow +0 -104
- package/lib/resources/healthfunds.js.flow +0 -139
- package/lib/resources/icditems.js.flow +0 -36
- package/lib/resources/invoice-scans.js.flow +0 -56
- package/lib/resources/jhcs.js.flow +0 -20
- package/lib/resources/kyc.js.flow +0 -216
- package/lib/resources/logs.js.flow +0 -32
- package/lib/resources/members.js.flow +0 -196
- package/lib/resources/message-mappings.js.flow +0 -25
- package/lib/resources/minions.js.flow +0 -96
- package/lib/resources/modalities.js.flow +0 -46
- package/lib/resources/notes.js.flow +0 -112
- package/lib/resources/onboarding-applications.js.flow +0 -142
- package/lib/resources/onboarding-requests.js.flow +0 -97
- package/lib/resources/ops.js.flow +0 -116
- package/lib/resources/organisations.js.flow +0 -15
- package/lib/resources/partners.js.flow +0 -118
- package/lib/resources/patients.js.flow +0 -102
- package/lib/resources/payments.js.flow +0 -523
- package/lib/resources/pms.js.flow +0 -102
- package/lib/resources/practice-profiles.js.flow +0 -51
- package/lib/resources/practice-types.js.flow +0 -14
- package/lib/resources/practices.js.flow +0 -314
- package/lib/resources/products.js.flow +0 -48
- package/lib/resources/professional-categories.js.flow +0 -56
- package/lib/resources/provider-number-types.js.flow +0 -32
- package/lib/resources/provider-registration-types.js.flow +0 -32
- package/lib/resources/provider-requests.js.flow +0 -46
- package/lib/resources/provider-types.js.flow +0 -14
- package/lib/resources/ref-sources.js.flow +0 -16
- package/lib/resources/risk.js.flow +0 -29
- package/lib/resources/rnas.js.flow +0 -108
- package/lib/resources/roles.js.flow +0 -12
- package/lib/resources/self-checkout-sessions.js.flow +0 -382
- package/lib/resources/services.js.flow +0 -219
- package/lib/resources/settlements.js.flow +0 -97
- package/lib/resources/sign-up.js.flow +0 -15
- package/lib/resources/specialties.js.flow +0 -46
- package/lib/resources/staff-profiles.js.flow +0 -51
- package/lib/resources/staff.js.flow +0 -583
- package/lib/resources/statistics.js.flow +0 -147
- package/lib/resources/subscriptions.js.flow +0 -81
- package/lib/resources/terminals.js.flow +0 -161
- package/lib/resources/transaction-export.js.flow +0 -48
- package/lib/resources/transactions.js.flow +0 -1097
- package/lib/resources/triggers.js.flow +0 -36
- package/lib/resources/vendors.js.flow +0 -28
- package/lib/resources/verify.js.flow +0 -14
- package/lib/resources/workers.js.flow +0 -10
- package/lib/resources/workflow-exceptions.js.flow +0 -17
- package/lib/services/__mocks__/storage.js.flow +0 -30
- package/lib/services/aws.js.flow +0 -339
- package/lib/services/storage.js.flow +0 -92
- package/lib/services/version.js.flow +0 -73
- package/lib/storage-4b403caa.js +0 -1300
- package/lib/utils/application.js.flow +0 -23
- package/lib/utils/base-urls/core.js.flow +0 -18
- package/lib/utils/base-urls/index.js.flow +0 -7
- package/lib/utils/base-urls/risk.js.flow +0 -16
- package/lib/utils/does-param-exist.js.flow +0 -23
- package/lib/utils/get-axios-error.js.flow +0 -8
- package/lib/utils/param-error.js.flow +0 -8
- package/lib/utils/professions.js.flow +0 -66
- package/lib/utils/regions.js.flow +0 -21
- package/lib/utils/request.js.flow +0 -36
- package/lib/utils/staff.js.flow +0 -81
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import sdk from '../index';
|
|
2
|
-
|
|
3
|
-
let _getSelfApplicationCache;
|
|
4
|
-
let _getSelfApplicationCacheInProgress = false;
|
|
5
|
-
|
|
6
|
-
export const getSelfApplicationCached = async () => {
|
|
7
|
-
if (_getSelfApplicationCache) return _getSelfApplicationCache;
|
|
8
|
-
if (!_getSelfApplicationCacheInProgress) {
|
|
9
|
-
try {
|
|
10
|
-
_getSelfApplicationCacheInProgress = true;
|
|
11
|
-
_getSelfApplicationCache = await sdk.applications.getSelfApplication();
|
|
12
|
-
} finally {
|
|
13
|
-
_getSelfApplicationCacheInProgress = false;
|
|
14
|
-
}
|
|
15
|
-
} else {
|
|
16
|
-
let data;
|
|
17
|
-
do {
|
|
18
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
19
|
-
data = _getSelfApplicationCache;
|
|
20
|
-
} while (!data);
|
|
21
|
-
return data;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
au: {
|
|
3
|
-
local: `http://localhost:${process.env.REACT_APP_LOCAL_PORT || 2673}/`,
|
|
4
|
-
dev: 'https://dev-api-au.medipass.io/',
|
|
5
|
-
'pre-prod': 'https://api-au-blue.medipass.io/',
|
|
6
|
-
prod: 'https://api-au.medipass.io/',
|
|
7
|
-
staging: 'https://stg-api-au.medipass.io/',
|
|
8
|
-
perf: 'https://perf-api-au.medipass.io/'
|
|
9
|
-
},
|
|
10
|
-
uk: {
|
|
11
|
-
local: `http://localhost:${process.env.REACT_APP_LOCAL_PORT || 2673}/`,
|
|
12
|
-
dev: 'https://api.dev.uk.medipass.io/',
|
|
13
|
-
'pre-prod': 'https://api.blue.uk.medipass.io/',
|
|
14
|
-
prod: 'https://api.uk.medipass.io/',
|
|
15
|
-
staging: 'https://api.stg.uk.medipass.io/',
|
|
16
|
-
perf: 'https://api.perf.uk.medipass.io/'
|
|
17
|
-
}
|
|
18
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
au: {
|
|
3
|
-
local: `http://localhost:${process.env.REACT_APP_LOCAL_PORT || 7475}/`,
|
|
4
|
-
dev: 'https://dev-risk-au.medipass.io/',
|
|
5
|
-
'pre-prod': 'https://risk-au-blue.medipass.io/',
|
|
6
|
-
prod: 'https://risk-au.medipass.io/',
|
|
7
|
-
staging: 'https://stg-risk-au.medipass.io/'
|
|
8
|
-
},
|
|
9
|
-
uk: {
|
|
10
|
-
local: `http://localhost:${process.env.REACT_APP_LOCAL_PORT || 7475}/`,
|
|
11
|
-
dev: 'https://risk.dev.uk.medipass.io/',
|
|
12
|
-
'pre-prod': 'https://risk.blue.uk.medipass.io/',
|
|
13
|
-
prod: 'https://risk.uk.medipass.io/',
|
|
14
|
-
staging: 'https://risk.stg.uk.medipass.io/'
|
|
15
|
-
}
|
|
16
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import ParamError from './param-error';
|
|
4
|
-
import _forOwn from 'lodash/forOwn';
|
|
5
|
-
|
|
6
|
-
export default (params: Object, hyperMediaEndpoint?: ?string, opts?: Object = { atLeastOneExists: false }) => {
|
|
7
|
-
let valueExists = false;
|
|
8
|
-
if (hyperMediaEndpoint) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
_forOwn(params, (val, key) => {
|
|
12
|
-
if (!val && !opts.atLeastOneExists) {
|
|
13
|
-
throw new ParamError(key);
|
|
14
|
-
}
|
|
15
|
-
if (val && opts.atLeastOneExists) {
|
|
16
|
-
valueExists = true;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
if (!valueExists && opts.atLeastOneExists) {
|
|
20
|
-
throw new ParamError(Object.keys(params).join(' or '));
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import _uniq from 'lodash/uniq';
|
|
2
|
-
import _flatten from 'lodash/flatten';
|
|
3
|
-
import _get from 'lodash/get';
|
|
4
|
-
|
|
5
|
-
import sdk from '../index';
|
|
6
|
-
|
|
7
|
-
export async function parseProfessions(professions, { providerRegistrationTypes } = {}) {
|
|
8
|
-
const professionalCategoryIds = professions.map(registration => registration.professionalCategoryId);
|
|
9
|
-
const uniqueProfessionalCategoryIds = _uniq(professionalCategoryIds).filter(Boolean);
|
|
10
|
-
const professionalCategoryIdsString = uniqueProfessionalCategoryIds.join(',');
|
|
11
|
-
|
|
12
|
-
const specialtyIdSets = professions.map(registration => registration.specialtyIds);
|
|
13
|
-
const specialtyIds = _flatten(specialtyIdSets);
|
|
14
|
-
const uniqueSpecialtyIds = _uniq(specialtyIds).filter(Boolean);
|
|
15
|
-
const specialtyIdsString = uniqueSpecialtyIds.join(',');
|
|
16
|
-
|
|
17
|
-
const [professionalCategoriesResponse, specialtiesResponse, providerTypesResponse] = await Promise.all([
|
|
18
|
-
professionalCategoryIdsString
|
|
19
|
-
? sdk.professionalCategories.getProfessionalCategories({
|
|
20
|
-
professionalCategoryIds: professionalCategoryIdsString,
|
|
21
|
-
limit: 99
|
|
22
|
-
})
|
|
23
|
-
: undefined,
|
|
24
|
-
specialtyIdsString ? sdk.specialties.getSpecialties({ specialtyIds: specialtyIdsString, limit: 99 }) : undefined,
|
|
25
|
-
providerRegistrationTypes
|
|
26
|
-
? providerRegistrationTypes
|
|
27
|
-
: sdk.providerRegistrationTypes.getProviderRegistrationTypes({ limit: 99 })
|
|
28
|
-
]);
|
|
29
|
-
|
|
30
|
-
const professionalCategoriesMap = _get(professionalCategoriesResponse, 'items', []).reduce(
|
|
31
|
-
(currentProfessionalCategories, professionalCategory) => ({
|
|
32
|
-
...currentProfessionalCategories,
|
|
33
|
-
[professionalCategory._id]: professionalCategory
|
|
34
|
-
}),
|
|
35
|
-
{}
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const specialtiesMap = _get(specialtiesResponse, 'items', []).reduce(
|
|
39
|
-
(currentSpecialties, professionalCategory) => ({
|
|
40
|
-
...currentSpecialties,
|
|
41
|
-
[professionalCategory._id]: professionalCategory
|
|
42
|
-
}),
|
|
43
|
-
{}
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const providerRegistrationTypesMap = _get(providerTypesResponse, 'items', []).reduce(
|
|
47
|
-
(currentProviderType, providerType) => ({
|
|
48
|
-
...currentProviderType,
|
|
49
|
-
[providerType._id]: providerType
|
|
50
|
-
}),
|
|
51
|
-
{}
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
const newProfessions = professions.map(registration => {
|
|
55
|
-
const professionalCategory = professionalCategoriesMap[registration.professionalCategoryId];
|
|
56
|
-
const specialties = registration.specialtyIds.map(specialtyId => specialtiesMap[specialtyId]);
|
|
57
|
-
const providerRegistrationType = providerRegistrationTypesMap[registration.providerRegistrationTypeId];
|
|
58
|
-
return {
|
|
59
|
-
professionalCategory,
|
|
60
|
-
specialties,
|
|
61
|
-
providerRegistrationType
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
return newProfessions;
|
|
66
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import cookies from 'js-cookie';
|
|
2
|
-
import storage from '../services/storage';
|
|
3
|
-
|
|
4
|
-
const COUNTRY_CODES = {
|
|
5
|
-
au: 'au',
|
|
6
|
-
gb: 'uk'
|
|
7
|
-
};
|
|
8
|
-
const DEFAULT_COUNTRY = COUNTRY_CODES.au;
|
|
9
|
-
|
|
10
|
-
export function getUserRegion() {
|
|
11
|
-
const countryCookie = (cookies.get('medipassCountry') || '').toLowerCase();
|
|
12
|
-
let countryCode = storage.get('region') || COUNTRY_CODES[countryCookie];
|
|
13
|
-
|
|
14
|
-
Object.values(COUNTRY_CODES).forEach(code => {
|
|
15
|
-
if (typeof window !== 'undefined' && new RegExp(`${code}$`).test(window.location.pathname)) {
|
|
16
|
-
countryCode = code;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
return countryCode || DEFAULT_COUNTRY;
|
|
21
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import * as sentry from '@medipass/utils/sentry';
|
|
4
|
-
import _get from 'lodash/get';
|
|
5
|
-
import type { MedipassRequestOpts } from '../_types';
|
|
6
|
-
import medipassWebSdk from '../index';
|
|
7
|
-
|
|
8
|
-
import getAxiosError from './get-axios-error';
|
|
9
|
-
|
|
10
|
-
const DEFAULT_API_NAME = 'core';
|
|
11
|
-
|
|
12
|
-
const getBaseUrl = (apiName: string, requestOpts: MedipassRequestOpts): string => {
|
|
13
|
-
return requestOpts.baseUrl || _get(medipassWebSdk, `baseUrls[${apiName}]`);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const getVersion = (apiName: string, requestOpts: MedipassRequestOpts): string => {
|
|
17
|
-
return requestOpts.ver || _get(medipassWebSdk, `apiVersions[${apiName}]`) || medipassWebSdk.defaultVersion;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default async (medipassRequestOpts: MedipassRequestOpts, axiosRequestOpts: Object = {}) => {
|
|
21
|
-
const apiName = medipassRequestOpts.apiName || DEFAULT_API_NAME;
|
|
22
|
-
const version = getVersion(apiName, medipassRequestOpts);
|
|
23
|
-
const baseUrl = getBaseUrl(apiName, medipassRequestOpts);
|
|
24
|
-
try {
|
|
25
|
-
const res = await medipassWebSdk.axios(
|
|
26
|
-
// $FlowFixMe
|
|
27
|
-
medipassRequestOpts.hyperMediaEndpoint || `${baseUrl}${version}${medipassRequestOpts.path}`,
|
|
28
|
-
{ ...axiosRequestOpts, ...medipassRequestOpts.requestConfig }
|
|
29
|
-
);
|
|
30
|
-
return medipassRequestOpts.getFullResponse ? res : res.data;
|
|
31
|
-
} catch (error) {
|
|
32
|
-
const axiosError = medipassRequestOpts.getFullError ? error : getAxiosError(error);
|
|
33
|
-
sentry.logError(error, { name: 'AxiosError', data: axiosError });
|
|
34
|
-
throw axiosError;
|
|
35
|
-
}
|
|
36
|
-
};
|
package/lib/utils/staff.js.flow
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import _merge from 'lodash/merge';
|
|
2
|
-
import _uniq from 'lodash/uniq';
|
|
3
|
-
|
|
4
|
-
import sdk from '../index';
|
|
5
|
-
import * as professionsUtils from './professions';
|
|
6
|
-
|
|
7
|
-
export async function parseProviderSet(
|
|
8
|
-
providerSet,
|
|
9
|
-
{
|
|
10
|
-
businessId,
|
|
11
|
-
funders,
|
|
12
|
-
providerRegistrationTypes,
|
|
13
|
-
providerNumberTypes: _providerNumberTypes,
|
|
14
|
-
parseProviderNumberType = false
|
|
15
|
-
} = {}
|
|
16
|
-
) {
|
|
17
|
-
const fetchPractices = async () => {
|
|
18
|
-
const practiceIds = providerSet.map(providerData => providerData.practiceId);
|
|
19
|
-
const uniquePracticeIds = _uniq(practiceIds).filter(Boolean);
|
|
20
|
-
let practices = [];
|
|
21
|
-
practices = await Promise.all(
|
|
22
|
-
uniquePracticeIds.map(practiceId =>
|
|
23
|
-
sdk.practices.getBusinessPractice(businessId, practiceId).catch(() => ({ _id: practiceId }))
|
|
24
|
-
)
|
|
25
|
-
);
|
|
26
|
-
return practices;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const fetchProviderNumberTypes = async () => {
|
|
30
|
-
if (_providerNumberTypes) return _providerNumberTypes;
|
|
31
|
-
const providerNumberTypeIds = providerSet.map(providerData => providerData.providerNumberTypeId);
|
|
32
|
-
const uniqueProviderNumberTypeIds = _uniq(providerNumberTypeIds).filter(Boolean);
|
|
33
|
-
const providerNumberTypes = await Promise.all(
|
|
34
|
-
uniqueProviderNumberTypeIds.map(providerNumberTypeId =>
|
|
35
|
-
sdk.providerNumberTypes.getProviderNumberType(providerNumberTypeId)
|
|
36
|
-
)
|
|
37
|
-
);
|
|
38
|
-
return providerNumberTypes;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const [fundersResponse, practicesResponse, providerRegistrations, providerNumberTypesResponse] = await Promise.all([
|
|
42
|
-
funders ? funders : sdk.funders.getFunders(),
|
|
43
|
-
fetchPractices(),
|
|
44
|
-
// providerSet is in the same shape as professions, so let's just use that func.
|
|
45
|
-
professionsUtils.parseProfessions(providerSet, { providerRegistrationTypes }),
|
|
46
|
-
parseProviderNumberType ? fetchProviderNumberTypes() : []
|
|
47
|
-
]);
|
|
48
|
-
|
|
49
|
-
const fundersMap = fundersResponse.reduce(
|
|
50
|
-
(currentFunders, funder) => ({ ...currentFunders, [funder._id]: funder }),
|
|
51
|
-
{}
|
|
52
|
-
);
|
|
53
|
-
const practicesMap = practicesResponse.reduce(
|
|
54
|
-
(currentPractices, practice) => ({ ...currentPractices, [practice._id]: practice }),
|
|
55
|
-
{}
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
const providerNumberTypesMap = providerNumberTypesResponse?.reduce(
|
|
59
|
-
(currentProviderNumberTypes, providerNumberType) => ({
|
|
60
|
-
...currentProviderNumberTypes,
|
|
61
|
-
[providerNumberType._id]: providerNumberType
|
|
62
|
-
}),
|
|
63
|
-
{}
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const newProviderSet = providerSet.map((providerData, i) => ({
|
|
67
|
-
...providerData,
|
|
68
|
-
...providerRegistrations[i],
|
|
69
|
-
practice: practicesMap[providerData.practiceId],
|
|
70
|
-
funder: fundersMap[providerData.funderId],
|
|
71
|
-
...(parseProviderNumberType && { providerNumberType: providerNumberTypesMap?.[providerData?.providerNumberTypeId] })
|
|
72
|
-
}));
|
|
73
|
-
|
|
74
|
-
return newProviderSet;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export async function parseProviderRegistrations(providerRegistrations, opts = {}) {
|
|
78
|
-
const professions = await professionsUtils.parseProfessions(providerRegistrations, opts);
|
|
79
|
-
const newProviderRegistrations = _merge(providerRegistrations, professions);
|
|
80
|
-
return newProviderRegistrations;
|
|
81
|
-
}
|