Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into OB-Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
web-mi committed Oct 10, 2023
2 parents 01751b1 + 68f346e commit 760a7b3
Show file tree
Hide file tree
Showing 100 changed files with 13,102 additions and 19,922 deletions.
28,860 changes: 10,579 additions & 18,281 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/api/apiGetUserData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import { endpoints } from '../resources/scripts/endpoints';
import { UserDataInterface } from '../globalState';
import { fetchData, FETCH_METHODS } from './fetchData';

export const apiGetUserData = async (): Promise<UserDataInterface> => {
export const apiGetUserData = async (
responseHandling?: string[]
): Promise<UserDataInterface> => {
const url = endpoints.userData;

return fetchData({
url: url,
rcValidation: true,
responseHandling,
method: FETCH_METHODS.GET
});
};
18 changes: 18 additions & 0 deletions src/api/apiJoinGroupChat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { endpoints } from '../resources/scripts/endpoints';
import {
fetchData,
FETCH_METHODS,
FETCH_ERRORS,
FETCH_SUCCESS
} from './fetchData';

export const apiJoinGroupChat = async (roomId: string): Promise<any> =>
fetchData({
url: endpoints.videocallServiceBase + '/join/' + roomId,
method: FETCH_METHODS.POST,
responseHandling: [
FETCH_ERRORS.CONFLICT,
FETCH_ERRORS.CATCH_ALL,
FETCH_SUCCESS.CONTENT
]
});
35 changes: 9 additions & 26 deletions src/api/apiLogoutKeycloak.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,20 @@
import { endpoints } from '../resources/scripts/endpoints';
import { getValueFromCookie } from '../components/sessionCookie/accessSessionCookie';
import {
getErrorCaseForStatus,
redirectToErrorPage
} from '../components/error/errorHandling';

export const apiKeycloakLogout = (): Promise<any> =>
new Promise((resolve, reject) => {
const url = endpoints.keycloakLogout;
const refreshToken = getValueFromCookie('refreshToken');
const data = `client_id=app&grant_type=refresh_token&refresh_token=${refreshToken}`;
export const apiKeycloakLogout = async (): Promise<any> => {
const url = endpoints.keycloakLogout;
const refreshToken = getValueFromCookie('refreshToken');
const data = `client_id=app&grant_type=refresh_token&refresh_token=${refreshToken}`;

const req = new Request(url, {
return fetch(
new Request(url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'cache-control': 'no-cache'
},
credentials: 'include',
body: data
});

fetch(req)
.then((response) => {
if (response.status === 204) {
resolve(response);
} else {
const error = getErrorCaseForStatus(response.status);
redirectToErrorPage(error);
reject(new Error('keycloakLogout'));
}
})
.catch((error) => {
reject(error);
});
});
})
);
};
13 changes: 10 additions & 3 deletions src/api/apiStartVideoCall.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
import { endpoints } from '../resources/scripts/endpoints';
import { fetchData, FETCH_METHODS, FETCH_SUCCESS } from './fetchData';
import {
fetchData,
FETCH_METHODS,
FETCH_SUCCESS,
FETCH_ERRORS
} from './fetchData';

export const apiStartVideoCall = async (
sessionId: number,
initiatorDisplayName: string
initiatorDisplayName: string,
groupId?: number
): Promise<{ moderatorVideoCallUrl: string }> => {
const url = endpoints.startVideoCall;
const videoCallData = JSON.stringify({
sessionId: sessionId,
groupChatId: groupId,
initiatorDisplayName: initiatorDisplayName
});

return fetchData({
url: url,
method: FETCH_METHODS.POST,
bodyData: videoCallData,
responseHandling: [FETCH_SUCCESS.CONTENT],
responseHandling: [FETCH_SUCCESS.CONTENT, FETCH_ERRORS.CATCH_ALL],
rcValidation: true
});
};
6 changes: 4 additions & 2 deletions src/api/appointments/getAppointment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { endpoints } from '../../resources/scripts/endpoints';
import { FETCH_ERRORS, FETCH_METHODS, fetchData } from '../fetchData';

export const getAppointment = async (
appointmentId: string
appointmentId: string,
skipAuth: boolean = false
): Promise<AppointmentsDataInterface> => {
const url = endpoints.appointmentsServiceBase + '/' + appointmentId;

return fetchData({
url: url,
method: FETCH_METHODS.GET,
responseHandling: [FETCH_ERRORS.CATCH_ALL_WITH_RESPONSE]
responseHandling: [FETCH_ERRORS.CATCH_ALL_WITH_RESPONSE],
skipAuth: skipAuth
});
};
1 change: 1 addition & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export * from './apiPostAnonymousRegistration';
export * from './apiPostRegistration';
export * from './apiPutArchive';
export * from './apiPutDearchive';
export * from './apiJoinGroupChat';
export * from './apiPutGroupChat';
export * from './apiPatchConsultantData';
export * from './apiPutConsultantData';
Expand Down
6 changes: 4 additions & 2 deletions src/api/videocalls/getJwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { endpoints } from '../../resources/scripts/endpoints';
import { FETCH_ERRORS, FETCH_METHODS, fetchData } from '../fetchData';

export const getJwt = async (
appointmentId: string
appointmentId: string,
skipAuth: boolean = false
): Promise<VideoCallJwtDataInterface> => {
const url = endpoints.videocallServiceBase + '/' + appointmentId + '/jwt';

return fetchData({
url: url,
method: FETCH_METHODS.GET,
responseHandling: [FETCH_ERRORS.CATCH_ALL_WITH_RESPONSE]
responseHandling: [FETCH_ERRORS.CATCH_ALL_WITH_RESPONSE],
skipAuth: skipAuth
});
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.encryption-banner {
background-color: #f7d9d9;
display: flex;
position: fixed;
justify-content: center;
padding: $grid-base-two $grid-base-three;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ export const E2EEncryptionSupportBanner = () => {
}
}, [userData, consultingTypes, sessions]);

useEffect(() => {
const fn = showBanner ? 'add' : 'remove';
document.body.classList[fn]('banner-open');
}, [showBanner]);

if (!showBanner) {
return null;
}
Expand Down
8 changes: 0 additions & 8 deletions src/components/app/AuthenticatedApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useCallback, useContext, useEffect, useState } from 'react';
import { Routing } from './Routing';
import {
UserDataContext,
NotificationsContext,
hasUserAuthority,
AUTHORITIES,
ConsultingTypesContext,
Expand All @@ -16,7 +15,6 @@ import { apiGetConsultingTypes } from '../../api';
import { Loading } from './Loading';
import { handleTokenRefresh } from '../auth/auth';
import { logout } from '../logout/logout';
import { Notifications } from '../notifications/Notifications';
import './authenticatedApp.styles';
import './navigation.styles';
import { requestPermissions } from '../../utils/notificationHelpers';
Expand Down Expand Up @@ -48,7 +46,6 @@ export const AuthenticatedApp = ({
const [appReady, setAppReady] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(true);
const [userDataRequested, setUserDataRequested] = useState<boolean>(false);
const { notifications } = useContext(NotificationsContext);

useEffect(() => {
// When the user has a group chat id that means that we need to join the user in the group chat
Expand Down Expand Up @@ -124,11 +121,6 @@ export const AuthenticatedApp = ({
<RocketChatUserStatusProvider>
<E2EEncryptionSupportBanner />
<Routing logout={handleLogout} />
{notifications && (
<Notifications
notifications={notifications}
/>
)}
</RocketChatUserStatusProvider>
</RocketChatUnreadProvider>
</RocketChatSubscriptionsProvider>
Expand Down
Loading

0 comments on commit 760a7b3

Please sign in to comment.