Skip to content

Commit ac79764

Browse files
committed
Add Halo Connect and Meditech configs
1 parent 1e8fd2c commit ac79764

6 files changed

Lines changed: 81 additions & 1 deletion

File tree

src/containers/App/hooks.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { useEffect, useMemo, useState } from 'react';
22

3-
import { getToken } from '@beda.software/emr/services';
3+
import { getToken , axiosInstance as axiosFHIRInstance } from '@beda.software/emr/services';
44

55
import { clientSharedUserInitService } from 'src/populateUserInfoSharedState';
66
import { AuthProvider, getAuthProviderFromStorage } from 'src/services/auth';
77

8+
89
export function useApp() {
910
const [authProvider, setAuthProvider] = useState<AuthProvider | null>(getAuthProviderFromStorage());
1011
const sharedUserInitService = useMemo(
@@ -20,6 +21,8 @@ export function useApp() {
2021
authProviderHeader.style.display = 'none';
2122
}
2223
}
24+
25+
axiosFHIRInstance.defaults.headers['Ocp-Apim-Subscription-Key'] = `923b7ac4add44b02be0e93d3303e55e1`;
2326
}, []);
2427

2528
return { sharedUserInitService, setAuthProvider };

src/containers/PatientDetails/dashboard/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ const patientDashboardConfig: DashboardInstance = {
2525
...(config.baseURL === 'https://bps-interop-practicegateway-connectathon-fhir-api.deva.svc.bpcloud.dev/api/interop/r4/fhir/' ? [{
2626
widget: SummaryContainer,
2727
}] : []),
28+
...(config.baseURL === 'https://api.stage.haloconnect.io/integrator/sites/63255e8a-d04a-42a6-8c75-90aa880ad94e/fhir/R4/' ? [{
29+
widget: SummaryContainer,
30+
}] : []),
31+
...(config.baseURL === 'https://alexapiuat.medtechglobal.com/FHIR' ? [{
32+
widget: SummaryContainer,
33+
}] : []),
2834
...(config.baseURL === 'https://api-v1.test.medirecords.com/fhir/v1' ? [{
2935
widget: SummaryContainer,
3036
}] : []),

src/containers/PatientDetails/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { PatientEncounter } from './encounters';
1111
import { PatientApps } from './PatientApps/index';
1212
import { PatientServiceRequest } from './requests';
1313
import { ResourcesTabRoutes } from './ResourcesTabRoutes';
14+
import { useEffect } from 'react';
15+
import { axiosInstance as axiosFHIRInstance } from '@beda.software/emr/services';
1416

1517
const getName = compileAsFirst<Patient, string>("Patient.name.given.first() + ' ' + Patient.name.family");
1618

@@ -49,6 +51,10 @@ if (config.baseURL === 'https://smartonfhir.aidbox.beda.software') {
4951
}
5052

5153
export function PatientDetails() {
54+
useEffect(() => {
55+
axiosFHIRInstance.defaults.headers['Ocp-Apim-Subscription-Key'] = `923b7ac4add44b02be0e93d3303e55e1`;
56+
}, []);
57+
5258
return (
5359
<PatientDashboardProvider dashboard={dashboard}>
5460
<DetailPage<Patient>

src/containers/SignIn/hooks.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ export function useSignIn(props: SignInProps) {
4343
window.localStorage.setItem('token', 'september_connectathon_2025');
4444
window.location.href = '/patients';
4545
return;
46+
} else if ([AuthProvider.HaloConnect].indexOf(activeAuthProvider) != -1) {
47+
//These provider doesn't need authorization
48+
window.localStorage.setItem('token', 'token');
49+
window.location.href = '/patients';
50+
return;
51+
} else if ([AuthProvider.MedtechGlobal].indexOf(activeAuthProvider) != -1) {
52+
//These provider doesn't need authorization
53+
window.localStorage.setItem(
54+
'token',
55+
'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjVPZjlQNUY5Z0NDd0NtRjJCT0hIeEREUS1EayIsImtpZCI6IjVPZjlQNUY5Z0NDd0NtRjJCT0hIeEREUS1EayJ9',
56+
);
57+
window.location.href = '/patients';
58+
return;
4659
} else if ([AuthProvider.Sparked].indexOf(activeAuthProvider) != -1) {
4760
//These providers don't need authorization
4861
window.localStorage.setItem('token', 'token');

src/populateUserInfoSharedState/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,7 @@ export const clientSharedUserInitService: { [key in AuthProvider]: SharedUserIni
8282
[AuthProvider.BP]: mockUserInfoSharedState('15000000-0020-0000-0000-98a3489d6ffc'),
8383
[AuthProvider.IRIS]: mockUserInfoSharedState('cardy-igist'),
8484
[AuthProvider.MediRecords]: mockUserInfoSharedState('b82b3842-ba16-4b01-8c24-7b0deee9b660'),
85+
[AuthProvider.HaloConnect]: mockUserInfoSharedState('pr-1'),
86+
[AuthProvider.MedtechGlobal]: mockUserInfoSharedState('pr-1'),
8587
[AuthProvider.Sparked]: mockUserInfoSharedState('leishman-leesa'),
8688
};

src/services/auth.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export enum AuthProvider {
88
BP = 'best-practice',
99
IRIS = 'isris',
1010
MediRecords = 'medirecords',
11+
HaloConnect = 'halo-connect',
12+
MedtechGlobal = 'medtech-global',
1113
Sparked = 'sparked',
1214
}
1315

@@ -39,6 +41,7 @@ export interface AuthClientConfigParams {
3941
tabTitle: string;
4042
message: string;
4143
sharedCredentials?: SharedCredentials;
44+
headers?: { [key in string]: string };
4245
}
4346

4447
type TierConfig = { [key in Tier]: TierBaseConfig };
@@ -118,6 +121,28 @@ export const tierConfigMap: { [key in AuthProvider]: TierConfig } = {
118121
fhirBaseUrl: 'https://api-v1.test.medirecords.com/fhir/v1',
119122
},
120123
},
124+
[AuthProvider.HaloConnect]: {
125+
develop: {
126+
baseUrl: 'https://api.stage.haloconnect.io/integrator/sites/63255e8a-d04a-42a6-8c75-90aa880ad94e/fhir/R4/',
127+
fhirBaseUrl:
128+
'https://api.stage.haloconnect.io/integrator/sites/63255e8a-d04a-42a6-8c75-90aa880ad94e/fhir/R4/',
129+
},
130+
production: {
131+
baseUrl: 'https://api.stage.haloconnect.io/integrator/sites/63255e8a-d04a-42a6-8c75-90aa880ad94e/fhir/R4/',
132+
fhirBaseUrl:
133+
'https://api.stage.haloconnect.io/integrator/sites/63255e8a-d04a-42a6-8c75-90aa880ad94e/fhir/R4/',
134+
},
135+
},
136+
[AuthProvider.MedtechGlobal]: {
137+
develop: {
138+
baseUrl: 'https://alexapiuat.medtechglobal.com/FHIR',
139+
fhirBaseUrl: 'https://alexapiuat.medtechglobal.com/FHIR',
140+
},
141+
production: {
142+
baseUrl: 'https://alexapiuat.medtechglobal.com/FHIR',
143+
fhirBaseUrl: 'https://alexapiuat.medtechglobal.com/FHIR',
144+
},
145+
},
121146
[AuthProvider.Sparked]: {
122147
develop: {
123148
baseUrl: 'https://smile.sparked-fhir.com/aucore/fhir/DEFAULT/',
@@ -232,6 +257,31 @@ export const authClientConfigMap: { [key in AuthProvider]: AuthClientConfigParam
232257
tabTitle: 'Medirecords',
233258
message: 'No authorization required',
234259
},
260+
[AuthProvider.HaloConnect]: {
261+
clientId: 'halo-connect',
262+
authPath: 'smart/oauth/authorize',
263+
tokenPath: 'smart/oauth/token',
264+
responseType: 'code',
265+
redirectURL: `${window.location.origin}`,
266+
grantType: 'authorization_code',
267+
scope: ['openid', 'fhirUser'],
268+
tabTitle: 'Halo Connect',
269+
message: 'No authorization required',
270+
headers: {
271+
'Ocp-Apim-Subscription-Key': '923b7ac4add44b02be0e93d3303e55e1',
272+
},
273+
},
274+
[AuthProvider.MedtechGlobal]: {
275+
clientId: 'meditech-global',
276+
authPath: 'smart/oauth/authorize',
277+
tokenPath: 'https://login.microsoftonline.com/8a024e99-aba3-4b25-b875-28b0c0ca6096/oauth2/v2.0/token',
278+
responseType: 'code',
279+
redirectURL: `${window.location.origin}/auth`,
280+
grantType: 'authorization_code',
281+
scope: ['openid', 'fhirUser'],
282+
tabTitle: 'Medtech Global',
283+
message: 'No authorization required',
284+
},
235285
[AuthProvider.Sparked]: {
236286
clientId: 'sparked',
237287
authPath: 'smart/oauth/authorize',

0 commit comments

Comments
 (0)