diff --git a/.github/workflows/dockerImage.yml b/.github/workflows/dockerImage.yml index 9c9923f37..04c8a38ec 100644 --- a/.github/workflows/dockerImage.yml +++ b/.github/workflows/dockerImage.yml @@ -10,7 +10,6 @@ on: - 'dockerImage.v.*' - 'v*' - jobs: build: name: Build diff --git a/cypress/fixtures/registration/agency.json b/cypress/fixtures/registration/agency.json index 83a44d3bc..ed708e557 100644 --- a/cypress/fixtures/registration/agency.json +++ b/cypress/fixtures/registration/agency.json @@ -4,7 +4,6 @@ "postcode": "postcode", "city": "city", "description": "description", - "teamAgency": true, "offline": false, "consultingType": 1, "topicIds": null diff --git a/cypress/fixtures/registration/consultingType.json b/cypress/fixtures/registration/consultingType.json index 7235f05f6..45cb8d244 100644 --- a/cypress/fixtures/registration/consultingType.json +++ b/cypress/fixtures/registration/consultingType.json @@ -19,12 +19,10 @@ } }, "isSubsequentRegistrationAllowed": true, - "isAnonymousConversationAllowed": true, "isSetEmailAllowed": true, "slug": "suchtberatung", "languageFormal": true, "lockedAgencies": false, - "excludeNonMainConsultantsFromTeamSessions": false, "whiteSpot": { "whiteSpotAgencyAssigned": true, "whiteSpotAgencyId": 100 @@ -46,20 +44,12 @@ "relation": true, "state": false }, - "initializeFeedbackChat": false, "roles": { "consultant": { "main": ["consultant"], "peer": ["consultant"] } }, - "notifications": { - "teamSessions": { - "newMessage": { - "allTeamConsultants": false - } - } - }, "showAskerProfile": true, "welcomeScreen": { "anonymous": { diff --git a/cypress/fixtures/service.agencies.json b/cypress/fixtures/service.agencies.json index fa14f1ff9..99e496cff 100644 --- a/cypress/fixtures/service.agencies.json +++ b/cypress/fixtures/service.agencies.json @@ -5,7 +5,6 @@ "postcode": "postcode", "city": "city", "description": "description", - "teamAgency": true, "offline": false, "consultingType": 1, "url": "url", diff --git a/cypress/fixtures/service.consultingtypes.addiction.json b/cypress/fixtures/service.consultingtypes.addiction.json index 7235f05f6..45cb8d244 100644 --- a/cypress/fixtures/service.consultingtypes.addiction.json +++ b/cypress/fixtures/service.consultingtypes.addiction.json @@ -19,12 +19,10 @@ } }, "isSubsequentRegistrationAllowed": true, - "isAnonymousConversationAllowed": true, "isSetEmailAllowed": true, "slug": "suchtberatung", "languageFormal": true, "lockedAgencies": false, - "excludeNonMainConsultantsFromTeamSessions": false, "whiteSpot": { "whiteSpotAgencyAssigned": true, "whiteSpotAgencyId": 100 @@ -46,20 +44,12 @@ "relation": true, "state": false }, - "initializeFeedbackChat": false, "roles": { "consultant": { "main": ["consultant"], "peer": ["consultant"] } }, - "notifications": { - "teamSessions": { - "newMessage": { - "allTeamConsultants": false - } - } - }, "showAskerProfile": true, "welcomeScreen": { "anonymous": { diff --git a/cypress/fixtures/service.consultingtypes.emigration.json b/cypress/fixtures/service.consultingtypes.emigration.json index 8dc7efb54..ce6c14c61 100644 --- a/cypress/fixtures/service.consultingtypes.emigration.json +++ b/cypress/fixtures/service.consultingtypes.emigration.json @@ -21,12 +21,10 @@ } }, "isSubsequentRegistrationAllowed": true, - "isAnonymousConversationAllowed": true, "isSetEmailAllowed": true, "slug": "rw-auswanderung", "languageFormal": true, "lockedAgencies": false, - "excludeNonMainConsultantsFromTeamSessions": false, "whiteSpot": { "whiteSpotAgencyAssigned": true, "whiteSpotAgencyId": 1731 @@ -43,20 +41,12 @@ "sendFurtherStepsMessage": true, "sendSaveSessionDataMessage": true, "sessionDataInitializing": {}, - "initializeFeedbackChat": false, "roles": { "consultant": { "main": ["consultant"], "peer": ["consultant"] } }, - "notifications": { - "teamSessions": { - "newMessage": { - "allTeamConsultants": false - } - } - }, "showAskerProfile": false, "welcomeScreen": { "anonymous": { diff --git a/cypress/fixtures/service.consultingtypes.pregnancy.json b/cypress/fixtures/service.consultingtypes.pregnancy.json index 1eabaa92a..f6d82bca2 100644 --- a/cypress/fixtures/service.consultingtypes.pregnancy.json +++ b/cypress/fixtures/service.consultingtypes.pregnancy.json @@ -19,13 +19,11 @@ } }, "isSubsequentRegistrationAllowed": true, - "isAnonymousConversationAllowed": true, "isVideoCallAllowed": true, "isSetEmailAllowed": true, "slug": "suchtberatung", "languageFormal": true, "lockedAgencies": false, - "excludeNonMainConsultantsFromTeamSessions": false, "whiteSpot": { "whiteSpotAgencyAssigned": true, "whiteSpotAgencyId": 100 @@ -47,20 +45,12 @@ "relation": true, "state": false }, - "initializeFeedbackChat": false, "roles": { "consultant": { "main": ["consultant"], "peer": ["consultant"] } }, - "notifications": { - "teamSessions": { - "newMessage": { - "allTeamConsultants": false - } - } - }, "showAskerProfile": true, "welcomeScreen": { "anonymous": { diff --git a/cypress/fixtures/service.consultingtypes.u25.json b/cypress/fixtures/service.consultingtypes.u25.json index 4649c0e3b..fdb9e9fdf 100644 --- a/cypress/fixtures/service.consultingtypes.u25.json +++ b/cypress/fixtures/service.consultingtypes.u25.json @@ -23,12 +23,10 @@ } }, "isSubsequentRegistrationAllowed": false, - "isAnonymousConversationAllowed": false, "isSetEmailAllowed": false, "slug": "u25", "languageFormal": false, "lockedAgencies": false, - "excludeNonMainConsultantsFromTeamSessions": false, "whiteSpot": { "whiteSpotAgencyAssigned": false }, @@ -50,20 +48,12 @@ "relation": false, "state": true }, - "initializeFeedbackChat": true, "roles": { "consultant": { "main": ["consultant", "u25-consultant", "u25-main-consultant"], "peer": ["consultant", "u25-consultant"] } }, - "notifications": { - "teamSessions": { - "newMessage": { - "allTeamConsultants": false - } - } - }, "showAskerProfile": true, "requiredComponents": { "age": { diff --git a/cypress/fixtures/service.users.data.json b/cypress/fixtures/service.users.data.json index eec6202ed..21a27b674 100644 --- a/cypress/fixtures/service.users.data.json +++ b/cypress/fixtures/service.users.data.json @@ -13,7 +13,6 @@ "postcode": "12345", "city": "city", "description": "description", - "teamAgency": true, "offline": false, "consultingType": 0 } @@ -23,11 +22,9 @@ "AUTHORIZATION_VIEW_AGENCY_CONSULTANTS", "AUTHORIZATION_ASSIGN_CONSULTANT_TO_SESSION" ], - "hasAnonymousConversations": false, "consultingTypes": null, "formalLanguage": true, "absent": false, - "inTeamAgency": true, "languages": [], "emailToggles": [ { @@ -37,10 +34,6 @@ { "name": "NEW_CHAT_MESSAGE_FROM_ADVICE_SEEKER", "state": true - }, - { - "name": "NEW_FEEDBACK_MESSAGE_FROM_ADVICE_SEEKER", - "state": true } ] }, @@ -58,17 +51,14 @@ "postcode": "12345", "city": "city", "description": "description", - "teamAgency": true, "offline": false, "consultingType": 2 } ], "grantedAuthorities": ["AUTHORIZATION_CONSULTANT_DEFAULT"], - "hasAnonymousConversations": false, "consultingTypes": null, "formalLanguage": true, - "absent": false, - "inTeamAgency": true + "absent": false }, { "userId": "asker", @@ -90,16 +80,13 @@ "postcode": "12345", "city": "city", "description": null, - "teamAgency": true, "offline": false, "consultingType": 1 } }, "17": { "sessionData": null, "isRegistered": false, "agency": null } }, - "hasAnonymousConversations": false, "formalLanguage": true, - "absent": false, - "inTeamAgency": false + "absent": false } ] diff --git a/cypress/fixtures/service.users.sessions.room.json b/cypress/fixtures/service.users.sessions.room.json index 7f29441d3..388a3e81a 100644 --- a/cypress/fixtures/service.users.sessions.room.json +++ b/cypress/fixtures/service.users.sessions.room.json @@ -7,15 +7,11 @@ "postcode": "12345", "language": "de", "groupId": "someGroupId", - "feedbackGroupId": null, - "isPeerChat": false, "askerRcId": "askerRcId", "e2eLastMessage": null, "lastMessage": null, "messageDate": 0, "messagesRead": false, - "feedbackRead": true, - "isTeamSession": false, "registrationType": "REGISTERED", "createDate": "2022-06-15T08:09:18Z", "attachment": null, diff --git a/cypress/support/commands/mockApi.ts b/cypress/support/commands/mockApi.ts index 30d2d8b40..845ad802d 100644 --- a/cypress/support/commands/mockApi.ts +++ b/cypress/support/commands/mockApi.ts @@ -38,10 +38,6 @@ const defaultReturns = { { name: 'NEW_CHAT_MESSAGE_FROM_ADVICE_SEEKER', state: false - }, - { - name: 'NEW_FEEDBACK_MESSAGE_FROM_ADVICE_SEEKER', - state: false } ] }, diff --git a/cypress/support/sessions.ts b/cypress/support/sessions.ts index 39b512220..455b85829 100644 --- a/cypress/support/sessions.ts +++ b/cypress/support/sessions.ts @@ -2,7 +2,6 @@ import { v4 as uuid } from 'uuid'; import { SESSION_LIST_TYPES } from '../../src/components/session/sessionHelpers'; import { ListItemInterface, - SessionItemInterface, SessionUserDataInterface } from '../../src/globalState/interfaces'; @@ -43,15 +42,10 @@ export const generateConsultantSession = ({ status, postcode: 12345, groupId: rcGroupId, - feedbackGroupId: null, askerRcId: 'askerRcId', lastMessage: 'lastMessage', messageDate: 1606900238, messagesRead: messagesRead === undefined ? true : messagesRead, - feedbackRead: true, - isTeamSession: true, - isFeedbackSession: false, - isPeerChat: false, attachment: null, registrationType: 'REGISTERED', e2eLastMessage: { @@ -90,11 +84,9 @@ export const generateMultipleConsultantSessions = (amount: number): void => { }; export const generateAskerSession = ({ - messagesRead, - isTeamSession + messagesRead }: { messagesRead?: boolean; - isTeamSession?: boolean; } = {}): ListItemInterface => { const sessionId = Math.random(); const rcGroupId = uuid(); @@ -112,15 +104,10 @@ export const generateAskerSession = ({ status: 2, postcode: 12345, groupId: rcGroupId, - feedbackGroupId: 'feedbackGroupId1', askerRcId: 'askerRcId1', lastMessage: null, messageDate: null, messagesRead: messagesRead === undefined ? true : messagesRead, - feedbackRead: null, - isTeamSession: isTeamSession === undefined ? true : isTeamSession, - isFeedbackSession: false, - isPeerChat: false, attachment: null, registrationType: 'REGISTERED', e2eLastMessage: { @@ -141,7 +128,6 @@ export const generateAskerSession = ({ postcode: '12345', city: 'city', description: null, - teamAgency: true, offline: false, consultingType: 1 }, diff --git a/src/api/apiAnonymousConversationAvailability.ts b/src/api/apiAnonymousConversationAvailability.ts deleted file mode 100644 index c411dc1ba..000000000 --- a/src/api/apiAnonymousConversationAvailability.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { endpoints } from '../resources/scripts/endpoints'; -import { fetchData, FETCH_METHODS, FETCH_ERRORS } from './fetchData'; - -export interface AnonymousConversationAvailabilityInterface { - numAvailableConsultants: number; - status: string; -} - -export const apiAnonymousConversationAvailability = async ( - sessionId: number -): Promise => { - const url = `${endpoints.anonymousBase}${sessionId}`; - - return fetchData({ - url: url, - method: FETCH_METHODS.GET, - responseHandling: [FETCH_ERRORS.CONFLICT, FETCH_ERRORS.ABORTED] - }); -}; diff --git a/src/api/apiEnquiryAcceptance.ts b/src/api/apiEnquiryAcceptance.ts index 2eda4c840..b4b488b12 100644 --- a/src/api/apiEnquiryAcceptance.ts +++ b/src/api/apiEnquiryAcceptance.ts @@ -1,13 +1,8 @@ import { endpoints } from '../resources/scripts/endpoints'; import { fetchData, FETCH_ERRORS, FETCH_METHODS } from './fetchData'; -export const apiEnquiryAcceptance = async ( - sessionId: number, - isAnonymousEnquiry: boolean = false -): Promise => { - const url = isAnonymousEnquiry - ? `${endpoints.anonymousAskerBase}${sessionId}/accept` - : `${endpoints.sessionBase}/new/${sessionId}`; +export const apiEnquiryAcceptance = async (sessionId: number): Promise => { + const url = `${endpoints.sessionBase}/new/${sessionId}`; return fetchData({ url: url, diff --git a/src/api/apiFinishAnonymousConversation.ts b/src/api/apiFinishAnonymousConversation.ts deleted file mode 100644 index b7184f538..000000000 --- a/src/api/apiFinishAnonymousConversation.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { endpoints } from '../resources/scripts/endpoints'; -import { fetchData, FETCH_METHODS, FETCH_ERRORS } from './fetchData'; - -export const apiFinishAnonymousConversation = async ( - sessionId: number -): Promise => { - const url = `${endpoints.anonymousBase}${sessionId}/finish`; - - return fetchData({ - url: url, - method: FETCH_METHODS.PUT, - responseHandling: [FETCH_ERRORS.CONFLICT, FETCH_ERRORS.ABORTED] - }); -}; diff --git a/src/api/apiForwardMessage.ts b/src/api/apiForwardMessage.ts deleted file mode 100644 index 7ada6c679..000000000 --- a/src/api/apiForwardMessage.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { endpoints } from '../resources/scripts/endpoints'; -import { fetchData, FETCH_METHODS } from './fetchData'; - -export const apiForwardMessage = async ( - messageData: string, - messageDate: string, - displayName: string, - userId: string, - rcGroupId: string, - isEncrypted: boolean -): Promise => { - const url = endpoints.forwardMessage; - const headersData = { rcGroupId: rcGroupId }; - const data = JSON.stringify({ - message: messageData, - timestamp: messageDate, - username: displayName, // TODO change to displayName if message service is adjusted - rcUserId: userId, - t: isEncrypted ? 'e2e' : '' - }); - - return fetchData({ - url: url, - method: FETCH_METHODS.POST, - headersData: headersData, - rcValidation: true, - bodyData: data - }); -}; diff --git a/src/api/apiGetConsultantSessionList.ts b/src/api/apiGetConsultantSessionList.ts index a21f2f6fe..14718f22e 100644 --- a/src/api/apiGetConsultantSessionList.ts +++ b/src/api/apiGetConsultantSessionList.ts @@ -1,21 +1,17 @@ import { endpoints } from '../resources/scripts/endpoints'; import { - SESSION_LIST_TAB_ANONYMOUS, SESSION_LIST_TAB_ARCHIVE, SESSION_LIST_TYPES } from '../components/session/sessionHelpers'; import { ListItemsResponseInterface } from '../globalState/interfaces'; import { FETCH_ERRORS, FETCH_METHODS, fetchData } from './fetchData'; -export const INITIAL_FILTER: string = 'all'; -export const FILTER_FEEDBACK: string = 'feedback'; export const INITIAL_OFFSET: number = 0; export const SESSION_COUNT: number = 15; export const TIMEOUT: number = 10000; export interface ApiGetConsultantSessionListInterface { type: SESSION_LIST_TYPES; - filter?: typeof INITIAL_FILTER | typeof FILTER_FEEDBACK; offset?: number; sessionListTab?: string; count?: number; @@ -24,34 +20,22 @@ export interface ApiGetConsultantSessionListInterface { export const apiGetConsultantSessionList = async ({ type, - filter = INITIAL_FILTER, offset = INITIAL_OFFSET, sessionListTab, count = SESSION_COUNT, signal }: ApiGetConsultantSessionListInterface): Promise => { - const isTeamSession: boolean = type === SESSION_LIST_TYPES.TEAMSESSION; let url: string; - if (isTeamSession) { - url = `${ - sessionListTab === SESSION_LIST_TAB_ARCHIVE - ? `${endpoints.teamSessionsBase}${SESSION_LIST_TAB_ARCHIVE}?` - : `${endpoints.consultantTeamSessions}` - }`; - } else if (type === SESSION_LIST_TYPES.MY_SESSION) { + if (type === SESSION_LIST_TYPES.MY_SESSION) { url = `${ sessionListTab === SESSION_LIST_TAB_ARCHIVE ? `${endpoints.myMessagesBase}${SESSION_LIST_TAB_ARCHIVE}?` : `${endpoints.consultantSessions}` }`; } else { - url = `${endpoints.consultantEnquiriesBase}${ - sessionListTab && sessionListTab === SESSION_LIST_TAB_ANONYMOUS - ? `${SESSION_LIST_TAB_ANONYMOUS}` - : 'registered' - }?`; + url = `${endpoints.consultantEnquiriesBase}registered?`; } - url = url + `count=${count}&filter=${filter}&offset=${offset}`; + url = url + `count=${count}&filter=all&offset=${offset}`; return fetchData({ url: url, diff --git a/src/api/apiPostAnonymousRegistration.ts b/src/api/apiPostAnonymousRegistration.ts deleted file mode 100644 index c533b4899..000000000 --- a/src/api/apiPostAnonymousRegistration.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { removeAllCookies } from '../components/sessionCookie/accessSessionCookie'; -import { endpoints } from '../resources/scripts/endpoints'; -import { - fetchData, - FETCH_METHODS, - FETCH_SUCCESS, - FETCH_ERRORS -} from './fetchData'; - -export interface AnonymousRegistrationResponse { - userName: string; - sessionId: number; - accessToken: string; - expiresIn: number; - refreshToken: string; - rcUserId: string; - rcToken: string; - rcGroupId: string; - refreshExpiresIn: number; -} - -export const apiPostAnonymousRegistration = async ( - consultingType: number -): Promise => { - const url = endpoints.registerAnonymousAsker; - const data = JSON.stringify({ - consultingType: consultingType - }); - - removeAllCookies(); - - return fetchData({ - url: url, - method: FETCH_METHODS.POST, - bodyData: data, - skipAuth: true, - responseHandling: [FETCH_SUCCESS.CONTENT, FETCH_ERRORS.CONFLICT] - }); -}; diff --git a/src/api/apiSendAliasMessage.ts b/src/api/apiSendAliasMessage.ts index 9e1037c0f..81c177d03 100644 --- a/src/api/apiSendAliasMessage.ts +++ b/src/api/apiSendAliasMessage.ts @@ -3,8 +3,6 @@ import { fetchData, FETCH_METHODS } from './fetchData'; export enum ALIAS_MESSAGE_TYPES { E2EE_ACTIVATED = 'E2EE_ACTIVATED', - FINISHED_CONVERSATION = 'FINISHED_CONVERSATION', - FORWARD = 'FORWARD', FURTHER_STEPS = 'FURTHER_STEPS', UPDATE_SESSION_DATA = 'UPDATE_SESSION_DATA', VIDEOCALL = 'VIDEOCALL', diff --git a/src/api/apiSendMessage.ts b/src/api/apiSendMessage.ts index 74cd68058..fe628591f 100644 --- a/src/api/apiSendMessage.ts +++ b/src/api/apiSendMessage.ts @@ -4,16 +4,11 @@ import { fetchData, FETCH_METHODS } from './fetchData'; export const apiSendMessage = ( messageData: string, rcGroupIdOrSessionId: string | number, - isFeedback: boolean, sendMailNotification: boolean, isEncrypted: boolean ): Promise => { - const url = isFeedback - ? endpoints.sendMessageToFeedback - : endpoints.sendMessage; - const activeGroupId = isFeedback - ? { rcFeedbackGroupId: rcGroupIdOrSessionId } - : { rcGroupId: rcGroupIdOrSessionId }; + const url = endpoints.sendMessage; + const activeGroupId = { rcGroupId: rcGroupIdOrSessionId }; const message = JSON.stringify({ message: messageData, t: isEncrypted ? 'e2e' : '', diff --git a/src/api/apiUploadAttachment.ts b/src/api/apiUploadAttachment.ts index 2ccb8e3f3..341b76751 100644 --- a/src/api/apiUploadAttachment.ts +++ b/src/api/apiUploadAttachment.ts @@ -11,7 +11,6 @@ const isLocalDevelopment = nodeEnv === 'development'; export const apiUploadAttachment = ( attachment: File, rcGroupIdOrSessionId: string | number, - isFeedback: boolean, sendMailNotification: boolean, uploadProgress: Function, handleXhr: (xhr) => void, @@ -24,9 +23,7 @@ export const apiUploadAttachment = ( const rcUid = getValueFromCookie('rc_uid'); const csrfToken = generateCsrfToken(); - const url = isFeedback - ? endpoints.attachmentUploadFeedbackRoom + rcGroupIdOrSessionId - : endpoints.attachmentUpload + rcGroupIdOrSessionId; + const url = endpoints.attachmentUpload + rcGroupIdOrSessionId; let data = new FormData(); data.append('file', attachment); diff --git a/src/api/index.ts b/src/api/index.ts index 0bbb47cae..6f44622a9 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -2,9 +2,6 @@ export * from './apiAgencySelection'; export * from './apiDeleteAskerAccount'; export * from './apiDraftMessages'; export * from './apiEnquiryAcceptance'; -export * from './apiFinishAnonymousConversation'; -export * from './apiAnonymousConversationAvailability'; -export * from './apiForwardMessage'; export * from './apiGetAgencyConsultantList'; export * from './apiGetAgencyId'; export * from './apiGetAskerSessionList'; @@ -21,7 +18,6 @@ export * from './apiGetUserData'; export * from './apiGroupChatSettings'; export * from './apiLogoutKeycloak'; export * from './apiLogoutRocketchat'; -export * from './apiPostAnonymousRegistration'; export * from './apiPostRegistration'; export * from './apiPutArchive'; export * from './apiPutDearchive'; diff --git a/src/components/agencyRadioSelect/AgencyRadioSelect.tsx b/src/components/agencyRadioSelect/AgencyRadioSelect.tsx index 3673207d0..75736ac94 100644 --- a/src/components/agencyRadioSelect/AgencyRadioSelect.tsx +++ b/src/components/agencyRadioSelect/AgencyRadioSelect.tsx @@ -56,7 +56,6 @@ export const AgencyRadioSelect = ({ prefix: 'agency' }} info={agency} - showTeamAgencyInfo={agency.teamAgency} isProfileView={showTooltipAbove} /> diff --git a/src/components/app/FinishedAnonymousConversationHandler.tsx b/src/components/app/FinishedAnonymousConversationHandler.tsx deleted file mode 100644 index 51180d90e..000000000 --- a/src/components/app/FinishedAnonymousConversationHandler.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { OVERLAY_FUNCTIONS, Overlay } from '../overlay/Overlay'; -import * as React from 'react'; -import { useContext, useEffect, useState } from 'react'; -import { - AnonymousConversationFinishedContext, - RocketChatContext -} from '../../globalState'; -import { removeAllCookies } from '../sessionCookie/accessSessionCookie'; -import { useAppConfig } from '../../hooks/useAppConfig'; -import { - finishAnonymousChatSuccessOverlayItem, - selfFinishedAnonymousChatSuccessOverlayItem -} from '../sessionMenu/sessionMenuHelpers'; - -export const FinishedAnonymousConversationHandler = () => { - const settings = useAppConfig(); - - const [overlayActive, setOverlayActive] = useState(false); - const { anonymousConversationFinished, setAnonymousConversationFinished } = - useContext(AnonymousConversationFinishedContext); - const { close: closeWebsocket } = useContext(RocketChatContext); - - /* - ToDo: Refactor the anonymous logic because dropping cookies is not a clear logout. - Other requests should be blocked too because refresh requests will end in 401 - */ - useEffect(() => { - if (anonymousConversationFinished) { - closeWebsocket(false); - setOverlayActive(true); - setTimeout(() => { - removeAllCookies(); - }, 1500); - } else { - setOverlayActive(false); - } - }, [ - anonymousConversationFinished, - closeWebsocket, - setAnonymousConversationFinished - ]); - - const handleOverlayAction = (buttonFunction: string) => { - if (buttonFunction === OVERLAY_FUNCTIONS.REDIRECT_TO_URL) { - window.location.href = settings.urls.finishedAnonymousChatRedirect; - } - }; - - if (!overlayActive) return null; - - return ( - - ); -}; diff --git a/src/components/app/NavigationBar.tsx b/src/components/app/NavigationBar.tsx index 8659c231c..5d791c6dd 100644 --- a/src/components/app/NavigationBar.tsx +++ b/src/components/app/NavigationBar.tsx @@ -23,10 +23,7 @@ import { ReactComponent as LogoutIconOutline } from '../../resources/img/icons/l import { ReactComponent as LogoutIconFilled } from '../../resources/img/icons/logout_filled.svg'; import clsx from 'clsx'; import { RocketChatUnreadContext } from '../../globalState/provider/RocketChatUnreadProvider'; -import { - apiFinishAnonymousConversation, - apiGetAskerSessionList -} from '../../api'; +import { apiGetAskerSessionList } from '../../api'; import { useTranslation } from 'react-i18next'; import { LocaleSwitch } from '../localeSwitch/LocaleSwitch'; import { userHasBudibaseTools } from '../../api/apiGetTools'; @@ -51,18 +48,15 @@ export const NavigationBar = ({ const { consultingTypes } = useContext(ConsultingTypesContext); const { sessions, dispatch } = useContext(SessionsDataContext); const { selectableLocales } = useContext(LocaleContext); - const [sessionId, setSessionId] = useState(null); const [hasTools, setHasTools] = useState(false); const isConsultant = hasUserAuthority( AUTHORITIES.CONSULTANT_DEFAULT, userData ); - const { - sessions: unreadSessions, - group: unreadGroup, - teamsessions: unreadTeamSessions - } = useContext(RocketChatUnreadContext); + const { sessions: unreadSessions, group: unreadGroup } = useContext( + RocketChatUnreadContext + ); const { tenant } = useContext(TenantContext); const ref_menu = useRef([]); @@ -71,13 +65,8 @@ export const NavigationBar = ({ const ref_select = useRef(); const handleLogout = useCallback(() => { - if (hasUserAuthority(AUTHORITIES.ANONYMOUS_DEFAULT, userData)) { - apiFinishAnonymousConversation(sessionId).catch((error) => { - console.error(error); - }); - } onLogout(); - }, [onLogout, sessionId, userData]); + }, [onLogout]); const location = useLocation(); const [animateNavIcon, setAnimateNavIcon] = useState(false); @@ -94,7 +83,6 @@ export const NavigationBar = ({ ready: true, sessions: sessionsData.sessions }); - setSessionId(sessionsData?.sessions?.[0]?.session?.id); }); } }, [dispatch, isConsultant]); @@ -113,12 +101,7 @@ export const NavigationBar = ({ return; } - if ( - unreadSessions.length + - unreadGroup.length + - unreadTeamSessions.length > - 0 - ) { + if (unreadSessions.length + unreadGroup.length > 0) { setAnimateNavIcon(true); } @@ -126,16 +109,12 @@ export const NavigationBar = ({ setAnimateNavIcon(false); animateNavIconTimeoutRef.current = null; }, 1000); - }, [unreadSessions, unreadGroup, unreadTeamSessions]); - - const notificationConsultant = isConsultant ? 0 : unreadTeamSessions.length; + }, [unreadSessions, unreadGroup]); const pathsToShowUnreadMessageNotification = { '/sessions/consultant/sessionView': unreadSessions.length + unreadGroup.length, - '/sessions/user/view': - unreadSessions.length + unreadGroup.length + notificationConsultant, - '/sessions/consultant/teamSessionView': unreadTeamSessions.length, + '/sessions/user/view': unreadSessions.length + unreadGroup.length, '/profile': isFirstVisit && !browserNotificationsSettings().visited }; diff --git a/src/components/app/RouterConfig.tsx b/src/components/app/RouterConfig.tsx index 0a9f82a78..a464357cc 100644 --- a/src/components/app/RouterConfig.tsx +++ b/src/components/app/RouterConfig.tsx @@ -5,13 +5,9 @@ import { SESSION_LIST_TYPES, SESSION_TYPE_ARCHIVED, SESSION_TYPE_ENQUIRY, - SESSION_TYPE_FEEDBACK, SESSION_TYPE_GROUP, - SESSION_TYPE_LIVECHAT, - SESSION_TYPE_SESSION, - SESSION_TYPE_TEAMSESSION + SESSION_TYPE_SESSION } from '../session/sessionHelpers'; - import { AskerInfo } from '../askerInfo/AskerInfo'; import { Profile } from '../profile/Profile'; import { SessionViewEmpty } from '../session/SessionViewEmpty'; @@ -21,15 +17,12 @@ import { Appointments } from '../appointment/Appointments'; import VideoConference from '../videoConference/VideoConference'; import { AUTHORITIES, hasUserAuthority } from '../../globalState'; import { AppConfigInterface } from '../../globalState/interfaces'; - import { ReactComponent as OverviewIconOutline } from '../../resources/img/icons/overview_outline.svg'; import { ReactComponent as OverviewIconFilled } from '../../resources/img/icons/overview_filled.svg'; import { ReactComponent as InboxIconOutline } from '../../resources/img/icons/inbox_outline.svg'; import { ReactComponent as InboxIconFilled } from '../../resources/img/icons/inbox_filled.svg'; import { ReactComponent as MessagesIconOutline } from '../../resources/img/icons/messages_outline.svg'; import { ReactComponent as MessagesIconFilled } from '../../resources/img/icons/messages_filled.svg'; -import { ReactComponent as TeamsIconOutline } from '../../resources/img/icons/teams_outline.svg'; -import { ReactComponent as TeamsIconFilled } from '../../resources/img/icons/teams_filled.svg'; import { ReactComponent as ProfilIconOutline } from '../../resources/img/icons/profil_outline.svg'; import { ReactComponent as ProfilIconFilled } from '../../resources/img/icons/profil_filled.svg'; import { ReactComponent as ToolsIconOutline } from '../../resources/img/icons/tools_outline.svg'; @@ -159,9 +152,7 @@ export const RouterConfigUser = ( SESSION_TYPE_SESSION, SESSION_TYPE_ARCHIVED, SESSION_TYPE_GROUP, - SESSION_TYPE_LIVECHAT, - SESSION_TYPE_ENQUIRY, - SESSION_TYPE_TEAMSESSION + SESSION_TYPE_ENQUIRY ] }, { @@ -172,9 +163,7 @@ export const RouterConfigUser = ( SESSION_TYPE_SESSION, SESSION_TYPE_ARCHIVED, SESSION_TYPE_GROUP, - SESSION_TYPE_LIVECHAT, - SESSION_TYPE_ENQUIRY, - SESSION_TYPE_TEAMSESSION + SESSION_TYPE_ENQUIRY ] } ], @@ -272,7 +261,7 @@ export const RouterConfigConsultant = (settings: AppConfigInterface): any => { { path: '/sessions/consultant/sessionPreview/:rcGroupId?/:sessionId?', component: SessionsListWrapper, - sessionTypes: [SESSION_TYPE_ENQUIRY, SESSION_TYPE_LIVECHAT], + sessionTypes: [SESSION_TYPE_ENQUIRY], type: SESSION_LIST_TYPES.ENQUIRY, exact: false }, @@ -282,9 +271,7 @@ export const RouterConfigConsultant = (settings: AppConfigInterface): any => { sessionTypes: [ SESSION_TYPE_SESSION, SESSION_TYPE_ARCHIVED, - SESSION_TYPE_GROUP, - SESSION_TYPE_FEEDBACK, - SESSION_TYPE_TEAMSESSION + SESSION_TYPE_GROUP ], type: SESSION_LIST_TYPES.MY_SESSION, exact: false @@ -365,281 +352,3 @@ export const RouterConfigConsultant = (settings: AppConfigInterface): any => { toolsRoutes }; }; - -export const RouterConfigTeamConsultant = ( - settings: AppConfigInterface -): any => { - return { - plainRoutes: [ - { - condition: hasVideoCallFeature, - path: settings.urls.consultantVideoConference, - exact: true, - component: VideoConference - } - ], - navigation: [ - overviewRoute(settings), - { - to: '/sessions/consultant/sessionPreview', - icon: InboxIconOutline, - iconFilled: InboxIconFilled, - titleKeys: { - large: 'navigation.consultant.enquiries' - } - }, - { - to: '/sessions/consultant/sessionView', - icon: MessagesIconOutline, - iconFilled: MessagesIconFilled, - titleKeys: { - large: 'navigation.consultant.sessions.large', - small: 'navigation.consultant.sessions.small' - } - }, - { - to: '/sessions/consultant/teamSessionView', - icon: TeamsIconOutline, - iconFilled: TeamsIconFilled, - titleKeys: { - large: 'navigation.consultant.teamsessions.large', - small: 'navigation.consultant.teamsessions.small' - } - }, - { - condition: (userData, consultingTypes) => - isVideoAppointmentsEnabled( - userData, - consultingTypes, - settings.disableVideoAppointments - ), - to: '/termine', - icon: CalendarIconOutline, - iconFilled: CalendarIconFilled, - titleKeys: { - large: 'navigation.appointments' - } - }, - { - condition: showAppointmentsMenuItem, - to: '/booking/events', - icon: CalendarIconOutline, - iconFilled: CalendarIconFilled, - titleKeys: { - large: 'navigation.booking.events' - } - }, - { - to: '/profile', - icon: ProfilIconOutline, - iconFilled: ProfilIconFilled, - titleKeys: { - large: 'navigation.profile' - } - } - ], - listRoutes: [ - { - path: '/sessions/consultant/sessionPreview/:rcGroupId?/:sessionId?', - component: SessionsListWrapper, - sessionTypes: [SESSION_TYPE_LIVECHAT, SESSION_TYPE_ENQUIRY], - type: SESSION_LIST_TYPES.ENQUIRY, - exact: false - }, - { - path: '/sessions/consultant/sessionView/:rcGroupId?/:sessionId?', - component: SessionsListWrapper, - sessionTypes: [ - SESSION_TYPE_SESSION, - SESSION_TYPE_ARCHIVED, - SESSION_TYPE_GROUP, - SESSION_TYPE_FEEDBACK, - SESSION_TYPE_TEAMSESSION - ], - type: SESSION_LIST_TYPES.MY_SESSION, - exact: false - }, - { - path: '/sessions/consultant/teamSessionView/:rcGroupId?/:sessionId?', - component: SessionsListWrapper, - sessionTypes: [ - SESSION_TYPE_SESSION, - SESSION_TYPE_ARCHIVED, - SESSION_TYPE_GROUP, - SESSION_TYPE_FEEDBACK, - SESSION_TYPE_TEAMSESSION - ], - type: SESSION_LIST_TYPES.TEAMSESSION, - exact: false - } - ], - detailRoutes: [ - { - path: '/sessions/consultant/sessionPreview/', - component: SessionViewEmpty, - type: SESSION_LIST_TYPES.ENQUIRY - }, - { - path: '/sessions/consultant/sessionPreview/:rcGroupId/:sessionId', - component: SessionView, - type: SESSION_LIST_TYPES.ENQUIRY - }, - { - path: '/sessions/consultant/sessionView/', - component: SessionViewEmpty, - type: SESSION_LIST_TYPES.MY_SESSION - }, - { - path: '/sessions/consultant/sessionView/:rcGroupId/:sessionId/', - component: SessionView, - type: SESSION_LIST_TYPES.MY_SESSION - }, - { - path: '/sessions/consultant/sessionView/:rcGroupId/:sessionId/editGroupChat', - component: CreateGroupChatView, - type: SESSION_LIST_TYPES.MY_SESSION - }, - { - path: '/sessions/consultant/teamSessionView/', - component: SessionViewEmpty, - type: SESSION_LIST_TYPES.TEAMSESSION - }, - { - path: '/sessions/consultant/teamSessionView/:rcGroupId/:sessionId/', - component: SessionView, - type: SESSION_LIST_TYPES.TEAMSESSION - }, - { - path: '/sessions/consultant/teamSessionView/:rcGroupId/:sessionId/editGroupChat', - component: CreateGroupChatView, - type: SESSION_LIST_TYPES.TEAMSESSION - } - ], - userProfileRoutes: [ - { - path: '/sessions/consultant/sessionPreview/:rcGroupId/:sessionId/userProfile', - component: AskerInfo, - type: SESSION_LIST_TYPES.ENQUIRY - }, - { - path: '/sessions/consultant/sessionView/:rcGroupId/:sessionId/userProfile', - component: AskerInfo, - type: SESSION_LIST_TYPES.MY_SESSION - }, - { - path: '/sessions/consultant/sessionView/:rcGroupId/:sessionId/groupChatInfo', - component: GroupChatInfo, - type: SESSION_LIST_TYPES.MY_SESSION - }, - { - path: '/sessions/consultant/teamSessionView/:rcGroupId/:sessionId/userProfile', - component: AskerInfo, - type: SESSION_LIST_TYPES.TEAMSESSION - }, - { - path: '/sessions/consultant/teamSessionView/:rcGroupId/:sessionId/groupChatInfo', - component: GroupChatInfo, - type: SESSION_LIST_TYPES.TEAMSESSION - }, - { - path: '/sessions/consultant/sessionView/createGroupChat/', - component: CreateGroupChatView, - type: SESSION_LIST_TYPES.MY_SESSION - } - ], - profileRoutes: [ - { - path: '/overview', - component: OverviewPage - }, - { - path: '/profile', - exact: false, - component: Profile - }, - { - condition: (userData, consultingTypes) => - isVideoAppointmentsEnabled( - userData, - consultingTypes, - settings.disableVideoAppointments - ), - path: '/termine', - exact: false, - component: Appointments - } - ], - appointmentRoutes, - toolsRoutes - }; -}; - -export const RouterConfigPeerConsultant = ( - settings: AppConfigInterface -): any => { - return RouterConfigConsultant(settings); -}; - -export const RouterConfigMainConsultant = ( - settings: AppConfigInterface -): any => { - const config = RouterConfigTeamConsultant(settings); - - config.navigation[3].titleKeys = { - large: 'navigation.consultant.peersessions.large', - small: 'navigation.consultant.peersessions.small' - }; - return config; -}; - -export const RouterConfigAnonymousAsker = (): any => { - return { - navigation: [ - { - to: '/sessions/user/view', - icon: MessagesIconOutline, - iconFilled: MessagesIconFilled, - titleKeys: { - large: 'navigation.asker.sessions.large', - small: 'navigation.asker.sessions.small' - } - } - ], - listRoutes: [ - { - path: '/sessions/user/view/:rcGroupId?/:sessionId?', - component: SessionsListWrapper, - exact: false, - sessionTypes: [ - SESSION_TYPE_SESSION, - SESSION_TYPE_ARCHIVED, - SESSION_TYPE_GROUP, - SESSION_TYPE_LIVECHAT, - SESSION_TYPE_ENQUIRY, - SESSION_TYPE_TEAMSESSION - ] - } - ], - detailRoutes: [ - { - path: '/sessions/user/view/:rcGroupId/:sessionId', - component: SessionView, - type: SESSION_LIST_TYPES.MY_SESSION - }, - { - path: '/sessions/user/view/', - component: SessionViewEmpty, - type: SESSION_LIST_TYPES.MY_SESSION - }, - { - path: '/booking/reschedule', - component: BookingReschedule - }, - { - path: '/booking/events', - exact: false, - component: BookingEvents - } - ] - }; -}; diff --git a/src/components/app/Routing.tsx b/src/components/app/Routing.tsx index 77e9bc3ed..36b8bad04 100644 --- a/src/components/app/Routing.tsx +++ b/src/components/app/Routing.tsx @@ -1,14 +1,7 @@ import * as React from 'react'; import { useContext, useMemo, Suspense } from 'react'; import { Route, Switch, Redirect } from 'react-router-dom'; -import { - RouterConfigUser, - RouterConfigConsultant, - RouterConfigTeamConsultant, - RouterConfigMainConsultant, - RouterConfigPeerConsultant, - RouterConfigAnonymousAsker -} from './RouterConfig'; +import { RouterConfigUser, RouterConfigConsultant } from './RouterConfig'; import { AbsenceHandler } from './AbsenceHandler'; import { UserDataContext, @@ -20,7 +13,6 @@ import { } from '../../globalState'; import { NavigationBar } from './NavigationBar'; import { Header } from '../header/Header'; -import { FinishedAnonymousConversationHandler } from './FinishedAnonymousConversationHandler'; import { ReleaseNote } from '../releaseNote/ReleaseNote'; import { NonPlainRoutesWrapper } from './NonPlainRoutesWrapper'; import { Walkthrough } from '../walkthrough/Walkthrough'; @@ -41,24 +33,9 @@ export const Routing = (props: RoutingProps) => { const hasAssignedConsultant = useAskerHasAssignedConsultant(); const routerConfig = useMemo(() => { - if (hasUserAuthority(AUTHORITIES.VIEW_ALL_PEER_SESSIONS, userData)) { - return RouterConfigMainConsultant(settings); - } - if (hasUserAuthority(AUTHORITIES.USE_FEEDBACK, userData)) { - return RouterConfigPeerConsultant(settings); - } - if ( - hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData) && - userData.inTeamAgency - ) { - return RouterConfigTeamConsultant(settings); - } if (hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData)) { return RouterConfigConsultant(settings); } - if (hasUserAuthority(AUTHORITIES.ANONYMOUS_DEFAULT, userData)) { - return RouterConfigAnonymousAsker(); - } return RouterConfigUser(settings, hasAssignedConsultant); }, [userData, settings, hasAssignedConsultant]); @@ -365,10 +342,6 @@ export const Routing = (props: RoutingProps) => { AUTHORITIES.CONSULTANT_DEFAULT, userData ) && } - {hasUserAuthority( - AUTHORITIES.ANONYMOUS_DEFAULT, - userData - ) && } {hasUserAuthority( AUTHORITIES.CONSULTANT_DEFAULT, userData diff --git a/src/components/app/WebsocketHandler.tsx b/src/components/app/WebsocketHandler.tsx index 25fe929e8..34a57f9c2 100644 --- a/src/components/app/WebsocketHandler.tsx +++ b/src/components/app/WebsocketHandler.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { useContext, useEffect, useMemo, useState } from 'react'; +import { useContext, useEffect, useState } from 'react'; import { useHistory } from 'react-router-dom'; import { Stomp } from '@stomp/stompjs'; import * as SockJS from 'sockjs-client'; @@ -10,24 +10,14 @@ import { VideoCallRequestProps } from '../incomingVideoCall/IncomingVideoCall'; import { - AnonymousConversationFinishedContext, - AnonymousConversationStartedContext, - AnonymousEnquiryAcceptedContext, - AUTHORITIES, - ConsultingTypesContext, - hasUserAuthority, NotificationsContext, - UserDataContext, WebsocketConnectionDeactivatedContext } from '../../globalState'; -import { SESSION_LIST_TAB_ANONYMOUS } from '../session/sessionHelpers'; import { isBrowserNotificationTypeEnabled, sendNotification } from '../../utils/notificationHelpers'; import { useTranslation } from 'react-i18next'; -import { RocketChatUserStatusContext } from '../../globalState/provider/RocketChatUserStatusProvider'; -import { STATUS_ONLINE } from './RocketChat'; import { useAppConfig } from '../../hooks/useAppConfig'; interface WebsocketHandlerProps { @@ -38,45 +28,14 @@ export const WebsocketHandler = ({ disconnect }: WebsocketHandlerProps) => { const { t: translate } = useTranslation(); const history = useHistory(); const { releaseToggles } = useAppConfig(); - const { userData } = useContext(UserDataContext); - const { consultingTypes } = useContext(ConsultingTypesContext); - const { status } = useContext(RocketChatUserStatusContext); - const [newStompDirectMessage, setNewStompDirectMessage] = useState(false); - const [newStompAnonymousEnquiry, setNewStompAnonymousEnquiry] = - useState(false); const [newStompVideoCallRequest, setNewStompVideoCallRequest] = useState(); const { addNotification } = useContext(NotificationsContext); - const { setAnonymousEnquiryAccepted } = useContext( - AnonymousEnquiryAcceptedContext - ); - const { setAnonymousConversationFinished } = useContext( - AnonymousConversationFinishedContext - ); const { setWebsocketConnectionDeactivated } = useContext( WebsocketConnectionDeactivatedContext ); - const { setAnonymousConversationStarted } = useContext( - AnonymousConversationStartedContext - ); - - const hasLiveChatAndEnabled = useMemo( - () => - consultingTypes && - hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData) && - userData.hasAnonymousConversations && - userData.agencies.some( - (agency) => - (consultingTypes ?? []).find( - (consultingType) => - consultingType.id === agency.consultingType - )?.isAnonymousConversationAllowed - ) && - status === STATUS_ONLINE, - [consultingTypes, userData, status] - ); const stompClient = Stomp.over(function () { return new SockJS(endpoints.liveservice); @@ -138,31 +97,6 @@ export const WebsocketHandler = ({ disconnect }: WebsocketHandlerProps) => { } }, [newStompDirectMessage]); // eslint-disable-line react-hooks/exhaustive-deps - useEffect(() => { - if (newStompAnonymousEnquiry) { - setNewStompAnonymousEnquiry(false); - - if (!hasLiveChatAndEnabled) { - return; - } - - setAnonymousConversationStarted(true); - if ( - !releaseToggles.enableNewNotifications || - isBrowserNotificationTypeEnabled('initialEnquiry') - ) { - sendNotification(translate('notifications.enquiry.new'), { - showAlways: true, - onclick: () => { - history.push( - `/sessions/consultant/sessionPreview?sessionListTab=${SESSION_LIST_TAB_ANONYMOUS}` - ); - } - }); - } - } - }, [newStompAnonymousEnquiry, hasLiveChatAndEnabled]); // eslint-disable-line react-hooks/exhaustive-deps - useEffect(() => { if (newStompVideoCallRequest) { addNotification({ @@ -187,14 +121,6 @@ export const WebsocketHandler = ({ disconnect }: WebsocketHandlerProps) => { const stompEventContent: VideoCallRequestProps = stompMessageBody['eventContent']; setNewStompVideoCallRequest(stompEventContent); - } else if (stompEventType === 'newAnonymousEnquiry') { - setNewStompAnonymousEnquiry(true); - } else if (stompEventType === 'anonymousEnquiryAccepted') { - setAnonymousEnquiryAccepted(true); - } else if (stompEventType === 'anonymousConversationFinished') { - const finishConversationPhase = - stompMessageBody.eventContent?.finishConversationPhase; - setAnonymousConversationFinished(finishConversationPhase); } message.ack({ 'message-id': message.headers.id }); }); diff --git a/src/components/app/app.tsx b/src/components/app/app.tsx index 014c49253..e5ea578cb 100644 --- a/src/components/app/app.tsx +++ b/src/components/app/app.tsx @@ -46,11 +46,7 @@ const Registration = lazy(() => default: m.Registration })) ); -const WaitingRoomLoader = lazy(() => - import('../waitingRoom/WaitingRoomLoader').then((m) => ({ - default: m.WaitingRoomLoader - })) -); + const VideoConference = lazy( () => import('../videoConference/VideoConference') ); @@ -171,14 +167,6 @@ const RouterWrapper = ({ extraRoutes }: RouterWrapperProps) => { - - - setStartWebsocket(true) - } - /> - - diff --git a/src/components/askerInfo/AskerInfoAssign.tsx b/src/components/askerInfo/AskerInfoAssign.tsx index e16191738..aa1d74d01 100644 --- a/src/components/askerInfo/AskerInfoAssign.tsx +++ b/src/components/askerInfo/AskerInfoAssign.tsx @@ -20,7 +20,6 @@ export const AskerInfoAssign = ({ const { userData } = useContext(UserDataContext); return ( - !activeSession.isLive && hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData) && ( <> diff --git a/src/components/askerInfo/AskerInfoContent.tsx b/src/components/askerInfo/AskerInfoContent.tsx index 3902fa223..e327e6faa 100644 --- a/src/components/askerInfo/AskerInfoContent.tsx +++ b/src/components/askerInfo/AskerInfoContent.tsx @@ -24,30 +24,23 @@ export const AskerInfoContent = () => { const { type } = useContext(SessionTypeContext); const isSessionAssignAvailable = useMemo(() => { - const isPeerChat = activeSession.item.isPeerChat; - const isLiveChat = activeSession.isLive; const isGroupChat = activeSession.isGroup; const isEnquiryListView = type === SESSION_LIST_TYPES.ENQUIRY; const isAsker = hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData); - if (isAsker || isLiveChat || isGroupChat) { + if (isAsker || isGroupChat) { return false; } if (isEnquiryListView) { - return ( - isPeerChat && - hasUserAuthority( - AUTHORITIES.ASSIGN_CONSULTANT_TO_ENQUIRY, - userData - ) + return hasUserAuthority( + AUTHORITIES.ASSIGN_CONSULTANT_TO_ENQUIRY, + userData ); } return hasUserAuthority( - isPeerChat - ? AUTHORITIES.ASSIGN_CONSULTANT_TO_PEER_SESSION - : AUTHORITIES.ASSIGN_CONSULTANT_TO_SESSION, + AUTHORITIES.ASSIGN_CONSULTANT_TO_SESSION, userData ); }, [activeSession, type, userData]); diff --git a/src/components/askerInfo/AskerInfoData.tsx b/src/components/askerInfo/AskerInfoData.tsx index 03e1e21b3..7a7fb5a78 100644 --- a/src/components/askerInfo/AskerInfoData.tsx +++ b/src/components/askerInfo/AskerInfoData.tsx @@ -31,17 +31,16 @@ export const AskerInfoData = () => {

{topic?.name || ''}

- {activeSession.item.consultingType === 0 && - !activeSession.isLive && ( -
-

- {translate('userProfile.data.postcode')} -

-

- {activeSession.item.postcode} -

-
- )} + {activeSession.item.consultingType === 0 && ( +
+

+ {translate('userProfile.data.postcode')} +

+

+ {activeSession.item.postcode} +

+
+ )} {preparedUserSessionData.map((item, index) => item.type === 'age' && item.value === 'null' ? null : (
diff --git a/src/components/form/textarea.styles.scss b/src/components/form/textarea.styles.scss index f13eaefc5..fc1ba3add 100644 --- a/src/components/form/textarea.styles.scss +++ b/src/components/form/textarea.styles.scss @@ -66,7 +66,7 @@ } /* stylelint-disable */ - label:not(.requestFeedbackLabel) { + label { width: calc(100% - #{$grid-base-three * 2}); position: absolute; left: $grid-base-three; @@ -77,5 +77,6 @@ text-align: left; background-color: white; } + /* stylelint-enable */ } diff --git a/src/components/infoTooltip/InfoTooltip.tsx b/src/components/infoTooltip/InfoTooltip.tsx index 6537644ca..cf8c7d82b 100644 --- a/src/components/infoTooltip/InfoTooltip.tsx +++ b/src/components/infoTooltip/InfoTooltip.tsx @@ -19,13 +19,11 @@ export interface DisplayInfoProps { ns: string; }; isProfileView?: boolean; - showTeamAgencyInfo?: boolean; } export const InfoTooltip = ({ translation, isProfileView, - showTeamAgencyInfo, info }: DisplayInfoProps) => { const { t: translate } = useTranslation(['common', translation.ns]); @@ -88,17 +86,6 @@ export const InfoTooltip = ({ }`} ref={agencyInfoRef} > - {showTeamAgencyInfo && ( -
-
- )} {displayInfo.name && ( { - const { t: translate } = useTranslation(); - const [messageCopied, setMessageCopied] = useState(false); - let timeoutId: number = null; - - useEffect(() => { - return () => { - // Unset timeout on unmounting to prevent state change on unmounted components - if (timeoutId) window.clearTimeout(timeoutId); - }; - }); - - const copyText = async (content) => { - await copyTextToClipboard(content, () => { - setMessageCopied(true); - timeoutId = window.setTimeout(() => setMessageCopied(false), 3000); - }); - }; - - return ( -
copyText(props.message)} - > - - -
- ); -}; diff --git a/src/components/message/ForwardMessage.tsx b/src/components/message/ForwardMessage.tsx deleted file mode 100644 index 545a626ed..000000000 --- a/src/components/message/ForwardMessage.tsx +++ /dev/null @@ -1,137 +0,0 @@ -import * as React from 'react'; -import { useCallback, useContext, useState } from 'react'; - -import { apiForwardMessage } from '../../api'; -import { ReactComponent as ArrowForwardIcon } from '../../resources/img/icons/arrow-forward.svg'; -import { ReactComponent as CheckmarkIcon } from '../../resources/img/icons/checkmark.svg'; -import { encryptText } from '../../utils/encryptionHelpers'; -import { useE2EE } from '../../hooks/useE2EE'; -import { E2EEContext } from '../../globalState'; -import { useTranslation } from 'react-i18next'; -import { apiPostError, ERROR_LEVEL_WARN } from '../../api/apiPostError'; -import { useE2EEViewElements } from '../../hooks/useE2EEViewElements'; -import { Overlay } from '../overlay/Overlay'; -import { useTimeoutOverlay } from '../../hooks/useTimeoutOverlay'; -import { - OVERLAY_E2EE, - OVERLAY_REQUEST -} from '../../globalState/interfaces/AppConfig/OverlaysConfigInterface'; - -interface ForwardMessageProps { - right: boolean; - message: string; - messageTime: string; - displayName: string; - askerRcId: string; - groupId: string; -} - -export const ForwardMessage = (props: ForwardMessageProps) => { - const { t: translate } = useTranslation(); - const [messageForwarded, setMessageForwarded] = useState(false); - const [isRequestInProgress, setIsRequestInProgress] = useState(false); - - const { visible: requestOverlayVisible, overlay: requestOverlay } = - useTimeoutOverlay(isRequestInProgress); - - /* E2EE */ - const { key, keyID, encrypted, encryptRoom } = useE2EE(props.groupId); - const { - visible: e2eeOverlayVisible, - setState: setE2EEState, - overlay: e2eeOverlay - } = useE2EEViewElements(); - - const { isE2eeEnabled } = useContext(E2EEContext); - - const forwardMessage = useCallback(async () => { - if (isRequestInProgress) { - return null; - } - - setIsRequestInProgress(true); - - if (encrypted && !keyID) { - console.error("Can't send message without key"); - setIsRequestInProgress(false); - return null; - } - - let message = props.message; - let isEncrypted = isE2eeEnabled; - try { - message = await encryptText(message, keyID, key); - } catch (e: any) { - apiPostError({ - name: e.name, - message: e.message, - stack: e.stack, - level: ERROR_LEVEL_WARN - }).then(); - - isEncrypted = false; - } - - apiForwardMessage( - message, - props.messageTime, - props.displayName, - props.askerRcId, - props.groupId, - isEncrypted - ).then(() => { - encryptRoom(setE2EEState).then(() => { - setMessageForwarded(true); - setTimeout(() => { - setMessageForwarded(false); - setIsRequestInProgress(false); - }, 3000); - }); - }); - }, [ - isRequestInProgress, - encrypted, - props.message, - props.messageTime, - props.displayName, - props.askerRcId, - props.groupId, - isE2eeEnabled, - key, - keyID, - encryptRoom, - setE2EEState - ]); - - return ( -
- - - - {requestOverlayVisible && ( - - )} - {e2eeOverlayVisible && ( - - )} -
- ); -}; diff --git a/src/components/message/MessageDisplayName.tsx b/src/components/message/MessageDisplayName.tsx index 37074e37a..5403789ff 100644 --- a/src/components/message/MessageDisplayName.tsx +++ b/src/components/message/MessageDisplayName.tsx @@ -1,27 +1,19 @@ import { isUserModerator } from '../session/sessionHelpers'; import * as React from 'react'; import { useCallback, useContext } from 'react'; -import { - formatToHHMM, - getPrettyDateFromMessageDate -} from '../../utils/dateHelpers'; -import { ReactComponent as ArrowForwardIcon } from '../../resources/img/icons/arrow-forward.svg'; -import { ForwardMessageDTO } from './MessageItemComponent'; import { ActiveSessionContext } from '../../globalState'; import { useTranslation } from 'react-i18next'; interface MessageDisplayNameProps { - alias?: ForwardMessageDTO; isUser: Boolean; isMyMessage: Boolean; - type: 'forwarded' | 'user' | 'consultant' | 'self' | 'system'; + type: 'user' | 'consultant' | 'self' | 'system'; userId: string; username: string; displayName: string; } export const MessageDisplayName = ({ - alias, isUser, isMyMessage, type, @@ -32,20 +24,6 @@ export const MessageDisplayName = ({ const { t: translate } = useTranslation(); const { activeSession } = useContext(ActiveSessionContext); - const forwardedLabel = useCallback(() => { - const prettyDate = getPrettyDateFromMessageDate( - Math.round(alias.timestamp / 1000) - ); - - return translate('message.forward.label', { - username: alias.displayName || alias.username, - date: prettyDate.str - ? translate(prettyDate.str) - : translate(prettyDate.date), - time: alias.timestamp && formatToHHMM(alias.timestamp) - }); - }, [alias, translate]); - const subscriberIsModerator = isUserModerator({ chatItem: activeSession.item, rcUserId: userId @@ -77,20 +55,11 @@ export const MessageDisplayName = ({ return ( <> - {!alias && displayName && ( -
- {getUsernameWithPrefix()} -
- )} - - {alias && ( -
- - {forwardedLabel()} -
- )} +
+ {getUsernameWithPrefix()} +
); }; diff --git a/src/components/message/MessageItemComponent.tsx b/src/components/message/MessageItemComponent.tsx index ddd10a3c8..4e5dab1b6 100644 --- a/src/components/message/MessageItemComponent.tsx +++ b/src/components/message/MessageItemComponent.tsx @@ -7,18 +7,12 @@ import { hasUserAuthority, AUTHORITIES, E2EEContext, - SessionTypeContext, RocketChatGlobalSettingsContext, ActiveSessionContext } from '../../globalState'; -import { - ConsultingTypeInterface, - STATUS_ARCHIVED -} from '../../globalState/interfaces'; -import { isUserModerator, SESSION_LIST_TYPES } from '../session/sessionHelpers'; -import { ForwardMessage } from './ForwardMessage'; +import { STATUS_ARCHIVED } from '../../globalState/interfaces'; +import { isUserModerator } from '../session/sessionHelpers'; import { MessageMetaData } from './MessageMetaData'; -import { CopyMessage } from './CopyMessage'; import { MessageDisplayName } from './MessageDisplayName'; import { markdownToDraft } from 'markdown-draft-js'; import { stateToHTML } from 'draft-js-export-html'; @@ -70,14 +64,6 @@ import { BanUser, BanUserOverlay } from '../banUser/BanUser'; import { getValueFromCookie } from '../sessionCookie/accessSessionCookie'; import { VideoChatDetails, VideoChatDetailsAlias } from './VideoChatDetails'; -export interface ForwardMessageDTO { - message: string; - rcUserId: string; - timestamp: any; - username: string; - displayName: string; -} - export interface VideoCallMessageDTO { eventType: 'IGNORED_CALL'; initiatorRcUserId: string; @@ -99,7 +85,6 @@ export interface MessageItem { groupId?: string; isNotRead: boolean; alias?: { - forwardMessageDTO?: ForwardMessageDTO; videoCallMessageDTO?: VideoCallMessageDTO; content?: string; messageType: ALIAS_MESSAGE_TYPES; @@ -115,7 +100,6 @@ interface MessageItemComponentProps extends MessageItem { isOnlyEnquiry?: boolean; isMyMessage: boolean; clientName: string; - resortData: ConsultingTypeInterface; isUserBanned: boolean; handleDecryptionErrors: ( id: string, @@ -133,7 +117,6 @@ export const MessageItemComponent = ({ message, messageDate, messageTime, - resortData, isMyMessage, displayName, username, @@ -153,7 +136,6 @@ export const MessageItemComponent = ({ const { activeSession, reloadActiveSession } = useContext(ActiveSessionContext); const { userData } = useContext(UserDataContext); - const { type } = useContext(SessionTypeContext); const [renderedMessage, setRenderedMessage] = useState(null); const [decryptedMessage, setDecryptedMessage] = useState< @@ -242,9 +224,6 @@ export const MessageItemComponent = ({ if (isMyMessage) { return 'self'; } - if (alias?.forwardMessageDTO) { - return 'forwarded'; - } if (displayName === 'system') { return 'system'; } @@ -293,8 +272,6 @@ export const MessageItemComponent = ({ alias?.messageType === ALIAS_MESSAGE_TYPES.UPDATE_SESSION_DATA; const isVideoCallMessage = alias?.messageType === ALIAS_MESSAGE_TYPES.VIDEOCALL; - const isFinishedConversationMessage = - alias?.messageType === ALIAS_MESSAGE_TYPES.FINISHED_CONVERSATION; const isUserMutedMessage = alias?.messageType === ALIAS_MESSAGE_TYPES.USER_MUTED; const isE2EEActivatedMessage = @@ -317,7 +294,6 @@ export const MessageItemComponent = ({ return null; } - const isTeamSession = activeSession?.item?.isTeamSession; const isMySession = activeSession?.consultant?.id === userData?.userId; const isAppointmentSet = alias?.messageType === ALIAS_MESSAGE_TYPES.APPOINTMENT_SET || @@ -355,7 +331,6 @@ export const MessageItemComponent = ({ return isAsker ? ( clickReassignRequestMessage( accepted, @@ -366,7 +341,6 @@ export const MessageItemComponent = ({ ) : ( ); @@ -400,14 +374,6 @@ export const MessageItemComponent = ({ messageType={alias.messageType} /> ); - case isFinishedConversationMessage: - return ( - - {translate( - 'anonymous.session.systemMessage.chatFinished' - )} - - ); case isVideoCallMessage && !videoCallMessage?.eventType: const parsedMessage = JSON.parse( alias.content @@ -456,7 +422,6 @@ export const MessageItemComponent = ({ <>
))} - {activeSession.isFeedback && ( - - )} - {hasRenderedMessage && - hasUserAuthority( - AUTHORITIES.USE_FEEDBACK, - userData - ) && - type !== SESSION_LIST_TYPES.ENQUIRY && - activeSession.isSession && - activeSession.item.feedbackGroupId && - !activeSession.isFeedback && - activeSession.item.status !== - STATUS_ARCHIVED && ( - - )}
); @@ -578,9 +513,7 @@ export const MessageItemComponent = ({ messageTime={messageTime} t={t} type={getUsernameType()} - isReadStatusDisabled={ - isVideoCallMessage || isFinishedConversationMessage - } + isReadStatusDisabled={isVideoCallMessage} />
diff --git a/src/components/message/MessageMetaData.tsx b/src/components/message/MessageMetaData.tsx index 8f82c8e45..ab7a658c7 100644 --- a/src/components/message/MessageMetaData.tsx +++ b/src/components/message/MessageMetaData.tsx @@ -27,8 +27,6 @@ export const MessageMetaData = (props: MessageMetaDataProps) => { const isReadStatus = () => { if ( hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData) || - hasUserAuthority(AUTHORITIES.ANONYMOUS_DEFAULT, userData) || - (!activeSession.isGroup && activeSession.isFeedback) || props.isReadStatusDisabled ) { return null; diff --git a/src/components/message/ReassignMessage.tsx b/src/components/message/ReassignMessage.tsx index d0a3f744c..4a6a421f8 100644 --- a/src/components/message/ReassignMessage.tsx +++ b/src/components/message/ReassignMessage.tsx @@ -7,7 +7,6 @@ import { ConsultantListContext } from '../../globalState'; export const ReassignRequestMessage: React.FC<{ fromConsultantName: string; toConsultantName: string; - isTeamSession: boolean; onClick: (accepted: boolean) => void; }> = (props) => { const { t: translate } = useTranslation(); @@ -27,9 +26,7 @@ export const ReassignRequestMessage: React.FC<{ {translate( - `session.reassign.system.message.reassign.description.${ - props.isTeamSession ? 'team' : 'noTeam' - }`, + 'session.reassign.system.message.reassign.description.noTeam', { oldConsultant: props.fromConsultantName, newConsultant: props.toConsultantName @@ -70,7 +67,6 @@ export const ReassignRequestSentMessage: React.FC<{ toAskerName: string; fromConsultantId: string; toConsultantId: string; - isTeamSession: boolean; isMySession: boolean; }> = (props) => { const { t: translate } = useTranslation(); @@ -91,12 +87,6 @@ export const ReassignRequestSentMessage: React.FC<{ let descriptionToTranslate = 'session.reassign.system.message.reassign.sent.description.noTeam'; - if (props.isTeamSession && props.isMySession) - descriptionToTranslate = - 'session.reassign.system.message.reassign.sent.description.team.self'; - if (props.isTeamSession && !props.isMySession) - descriptionToTranslate = - 'session.reassign.system.message.reassign.sent.description.team.other'; return (
diff --git a/src/components/message/VideoCallMessage.tsx b/src/components/message/VideoCallMessage.tsx index 26fbcebc0..60b4b3dce 100644 --- a/src/components/message/VideoCallMessage.tsx +++ b/src/components/message/VideoCallMessage.tsx @@ -1,10 +1,7 @@ import * as React from 'react'; import { ICON_CALL_OFF, SystemMessage } from './SystemMessage'; import { VideoCallMessageDTO } from './MessageItemComponent'; -import { - currentUserIsTeamConsultant, - currentUserWasVideoCallInitiator -} from '../../utils/videoCallHelpers'; +import { currentUserWasVideoCallInitiator } from '../../utils/videoCallHelpers'; import { useTranslation } from 'react-i18next'; interface VideoCallMessageProps { videoCallMessage: VideoCallMessageDTO; @@ -30,22 +27,7 @@ export const VideoCallMessage = (props: VideoCallMessageProps) => { ) : ( <> {props.videoCallMessage.initiatorUserName}{' '} - {currentUserIsTeamConsultant( - props.videoCallMessage.initiatorRcUserId, - props.activeSessionAskerRcId - ) ? ( - <> - {translate( - 'videoCall.incomingCall.rejected.teamconsultant.prefix' - )}{' '} - {props.activeSessionUsername}{' '} - {translate( - 'videoCall.incomingCall.rejected.suffix' - )} - - ) : ( - translate('videoCall.incomingCall.ignored') - )} + {translate('videoCall.incomingCall.ignored')} ) } diff --git a/src/components/message/message.styles.scss b/src/components/message/message.styles.scss index 57265bb98..ca70b459d 100644 --- a/src/components/message/message.styles.scss +++ b/src/components/message/message.styles.scss @@ -19,6 +19,7 @@ $message-attachment-color: $secondary !default; opacity: 0; transform: translate(0, 0) scale(0.98); } + 100% { opacity: 1; transform: translate(0, 0) scale(1); @@ -50,6 +51,7 @@ $message-attachment-color: $secondary !default; line-height: 13px; text-align: center; } + &__username { text-align: left; display: flex; @@ -71,21 +73,6 @@ $message-attachment-color: $secondary !default; color: $message-name-consultant; } - &--forwarded { - font-size: $font-size-secondary; - line-height: $line-height-secondary; - color: $message-name-forwarded; - - svg { - display: inline-block; - margin-right: 8px; - padding-bottom: 4px; - path { - fill: $text-low-emphasis; - } - } - } - .flyoutMenu { margin-left: $grid-base; } @@ -316,10 +303,6 @@ $message-attachment-color: $secondary !default; color: var(--text-color-contrast-switch, $white); } } - - &--forwarded { - background-color: $yellow-4; - } } &__action { @@ -336,12 +319,6 @@ $message-attachment-color: $secondary !default; fill: var(--skin-color-secondary, $secondary); } - &.forward { - &--active { - animation: successReverse 2.5s ease forwards; - } - } - &.copy { &--active { animation: successCopyReverse 2.5s ease forwards; @@ -525,6 +502,7 @@ $message-attachment-color: $secondary !default; transform: translate(-50%, 0) scale(0); opacity: 0; } + 33%, 66% { transform: translate(-50%, 0) scale(1); @@ -532,25 +510,13 @@ $message-attachment-color: $secondary !default; } } -@keyframes successReverse { - 100%, - 0% { - transform: scale(1); - opacity: 1; - } - 15%, - 80% { - transform: scale(0) rotate(45deg); - opacity: 0; - } -} - @keyframes successCopyReverse { 100%, 0% { transform: scale(1); opacity: 1; } + 15%, 80% { transform: scale(0); diff --git a/src/components/messageSubmitInterface/messageSubmitInterface.yellowTheme.styles.scss b/src/components/messageSubmitInterface/messageSubmitInterface.yellowTheme.styles.scss deleted file mode 100644 index 392c51695..000000000 --- a/src/components/messageSubmitInterface/messageSubmitInterface.yellowTheme.styles.scss +++ /dev/null @@ -1,23 +0,0 @@ -.session--yellowTheme { - .textarea { - background-color: $message-submit-interface-textarea-background-color-yellow; - } -} - -.session { - .textarea--yellowTheme { - animation: yellowThemeHighlight 1.5s forwards; - } - - @keyframes yellowThemeHighlight { - 0% { - background: $dark-grey; - } - 20% { - background: $yellow-4; - } - 100% { - background: var(--skin-color-secondary-light, $yellow-3); - } - } -} diff --git a/src/components/messageSubmitInterface/messageSubmitInterfaceComponent.tsx b/src/components/messageSubmitInterface/messageSubmitInterfaceComponent.tsx index 3cde178c6..88c5d8564 100644 --- a/src/components/messageSubmitInterface/messageSubmitInterfaceComponent.tsx +++ b/src/components/messageSubmitInterface/messageSubmitInterfaceComponent.tsx @@ -11,19 +11,17 @@ import { useHistory } from 'react-router-dom'; import { SendMessageButton } from './SendMessageButton'; import { SESSION_LIST_TYPES } from '../session/sessionHelpers'; -import { Checkbox } from '../checkbox/Checkbox'; import { AUTHORITIES, getContact, hasUserAuthority, - AnonymousConversationFinishedContext, E2EEContext, SessionTypeContext, useTenant, UserDataContext, ActiveSessionContext } from '../../globalState'; -import { STATUS_ARCHIVED, STATUS_FINISHED } from '../../globalState/interfaces'; +import { STATUS_ARCHIVED } from '../../globalState/interfaces'; import { apiPutDearchive, apiSendEnquiry, @@ -69,7 +67,6 @@ import { ReactComponent as RemoveIcon } from '../../resources/img/icons/x.svg'; import { ReactComponent as CalendarMonthIcon } from '../../resources/img/icons/calendar-month-navigation.svg'; import './emojiPicker.styles'; import './messageSubmitInterface.styles'; -import './messageSubmitInterface.yellowTheme.styles'; import clsx from 'clsx'; import { mobileListView } from '../app/navigationHandler'; import { Button, ButtonItem, BUTTON_TYPES } from '../button/Button'; @@ -97,7 +94,6 @@ import { OVERLAY_REQUEST } from '../../globalState/interfaces/AppConfig/OverlaysConfigInterface'; import { getIconForAttachmentType } from '../message/messageHelpers'; -import classNames from 'classnames'; //Linkify Plugin const omitKey = (key, { [key]: _, ...obj }) => obj; @@ -127,8 +123,7 @@ const INFO_TYPES = { ATTACHMENT_SIZE_ERROR: 'ATTACHMENT_SIZE_ERROR', ATTACHMENT_FORMAT_ERROR: 'ATTACHMENT_FORMAT_ERROR', ATTACHMENT_QUOTA_REACHED_ERROR: 'ATTACHMENT_QUOTA_REACHED_ERROR', - ATTACHMENT_OTHER_ERROR: 'ATTACHMENT_OTHER_ERROR', - FINISHED_CONVERSATION: 'FINISHED_CONVERSATION' + ATTACHMENT_OTHER_ERROR: 'ATTACHMENT_OTHER_ERROR' }; export interface MessageSubmitInterfaceComponentProps { @@ -165,9 +160,6 @@ export const MessageSubmitInterfaceComponent = ({ const { activeSession, reloadActiveSession } = useContext(ActiveSessionContext); const { type, path: listPath } = useContext(SessionTypeContext); - const { anonymousConversationFinished } = useContext( - AnonymousConversationFinishedContext - ); const { isE2eeEnabled } = useContext(E2EEContext); const [activeInfo, setActiveInfo] = useState(null); @@ -187,14 +179,7 @@ export const MessageSubmitInterfaceComponent = ({ const [isSessionArchived, setIsSessionArchived] = useState( activeSession.item.status === STATUS_ARCHIVED ); - const [isTypingActive, setIsTypingActive] = useState( - activeSession.isGroup || activeSession.isLive - ); - const [isLiveChatFinished, setIsLiveChatFinished] = useState( - activeSession.isLive && activeSession.item.status === STATUS_FINISHED - ); - const [requestFeedbackCheckboxChecked, setRequestFeedbackCheckboxChecked] = - useState(false); + const [isTypingActive, setIsTypingActive] = useState(activeSession.isGroup); const [showAppointmentButton, setShowAppointmentButton] = useState(false); //Emoji Picker Plugin @@ -218,7 +203,6 @@ export const MessageSubmitInterfaceComponent = ({ // This loads the keys for current activeSession.rid which is already set: // to groupChat.groupId on group chats // to session.groupId on session chats - // to session.feebackGroupId on feedback chats const { keyID, key, @@ -229,15 +213,6 @@ export const MessageSubmitInterfaceComponent = ({ ready: e2EEReady } = useE2EE(activeSession.rid || null); - // This loads keys for feedback chat to have the ability to encrypt - // the feedback chat when checkbox "Request feedback" is checked - const { - keyID: feedbackChatKeyId, - key: feedbackChatKey, - encryptRoom: feedbackEncryptRoom, - ready: feedbackE2EEReady - } = useE2EE(activeSession.item.feedbackGroupId); - const { visible: e2eeOverlayVisible, setState: setE2EEState, @@ -261,18 +236,11 @@ export const MessageSubmitInterfaceComponent = ({ activeSession.consultant?.absent ); setIsSessionArchived(activeSession.item.status === STATUS_ARCHIVED); - setIsTypingActive(activeSession.isGroup || activeSession.isLive); - setIsLiveChatFinished( - activeSession.isLive && - activeSession.item.status === STATUS_FINISHED - ); + setIsTypingActive(activeSession.isGroup); }, [activeSession, activeSession.item.status, userData]); const { onChange: onDraftMessageChange, loaded: draftLoaded } = - useDraftMessage( - !anonymousConversationFinished && !isRequestInProgress, - setEditorState - ); + useDraftMessage(!isRequestInProgress, setEditorState); useEffect(() => { if ( @@ -282,18 +250,10 @@ export const MessageSubmitInterfaceComponent = ({ setActiveInfo(INFO_TYPES.ARCHIVED); } else if (isConsultantAbsent) { setActiveInfo(INFO_TYPES.ABSENT); - } else if (isLiveChatFinished) { - setActiveInfo(INFO_TYPES.FINISHED_CONVERSATION); } else { setActiveInfo(null); } - }, [isConsultantAbsent, isLiveChatFinished, isSessionArchived, userData]); - - useEffect(() => { - if (isLiveChatFinished) { - setActiveInfo(INFO_TYPES.FINISHED_CONVERSATION); - } - }, [isLiveChatFinished]); + }, [isConsultantAbsent, isSessionArchived, userData]); const getTypedMarkdownMessage = useCallback( (currentEditorState?: EditorState) => { @@ -511,37 +471,16 @@ export const MessageSubmitInterfaceComponent = ({ const handleMessageSendSuccess = useCallback(() => { onMessageSendSuccess?.(); - if (requestFeedbackCheckboxChecked) { - const feedbackButton = document.querySelector( - '.sessionInfo__feedbackButton' - ); - feedbackButton?.classList.add( - 'sessionInfo__feedbackButton--active' - ); - setTimeout(() => { - feedbackButton?.classList.remove( - 'sessionInfo__feedbackButton--active' - ); - }, 700); - } setEditorState(EditorState.createEmpty()); setActiveInfo(''); resizeTextarea(); setTimeout(() => setIsRequestInProgress(false), 1200); - }, [onMessageSendSuccess, requestFeedbackCheckboxChecked, resizeTextarea]); + }, [onMessageSendSuccess, resizeTextarea]); const sendMessage = useCallback( - async ( - sendToFeedbackEndpoint, - message, - attachment: File, - isEncrypted - ) => { - const sendToRoomWithId = sendToFeedbackEndpoint - ? activeSession.item.feedbackGroupId - : activeSession.rid || activeSession.item.id; - const getSendMailNotificationStatus = () => - !activeSession.isGroup && !activeSession.isLive; + async (message, attachment: File, isEncrypted) => { + const sendToRoomWithId = activeSession.rid || activeSession.item.id; + const getSendMailNotificationStatus = () => !activeSession.isGroup; if (attachment) { let res: any; @@ -577,7 +516,6 @@ export const MessageSubmitInterfaceComponent = ({ res = await apiUploadAttachment( attachmentFile, sendToRoomWithId, - sendToFeedbackEndpoint, getSendMailNotificationStatus(), setUploadProgress, setAttachmentUpload, @@ -617,7 +555,6 @@ export const MessageSubmitInterfaceComponent = ({ await apiSendMessage( message, sendToRoomWithId, - sendToFeedbackEndpoint, getSendMailNotificationStatus() && !attachment, isEncrypted ) @@ -640,8 +577,6 @@ export const MessageSubmitInterfaceComponent = ({ }, [ activeSession.isGroup, - activeSession.isLive, - activeSession.item.feedbackGroupId, activeSession.item.id, activeSession.rid, cleanupAttachment, @@ -673,21 +608,11 @@ export const MessageSubmitInterfaceComponent = ({ return null; } - const sendToFeedbackEndpoint = - requestFeedbackCheckboxChecked || activeSession.isFeedback; - - const messageKeyId = requestFeedbackCheckboxChecked - ? feedbackChatKeyId - : keyID; - const messageKey = requestFeedbackCheckboxChecked - ? feedbackChatKey - : key; - let message = getTypedMarkdownMessage().trim(); let isEncrypted = isE2eeEnabled; if (message.length > 0 && isE2eeEnabled) { try { - message = await encryptText(message, messageKeyId, messageKey); + message = await encryptText(message, keyID, key); } catch (e: any) { apiPostError({ name: e.name, @@ -708,31 +633,16 @@ export const MessageSubmitInterfaceComponent = ({ return; } - await sendMessage( - sendToFeedbackEndpoint, - message, - attachment, - isEncrypted - ); - - if (requestFeedbackCheckboxChecked) { - await feedbackEncryptRoom(setE2EEState); - } + await sendMessage(message, attachment, isEncrypted); }, [ - activeSession.isFeedback, encrypted, - feedbackChatKey, - feedbackChatKeyId, - feedbackEncryptRoom, getTypedMarkdownMessage, isE2eeEnabled, key, keyID, preselectedFile, - requestFeedbackCheckboxChecked, sendEnquiry, sendMessage, - setE2EEState, type, userData ]); @@ -782,12 +692,6 @@ export const MessageSubmitInterfaceComponent = ({ userData ]); - const handleRequestFeedbackCheckbox = useCallback(() => { - setRequestFeedbackCheckboxChecked( - (requestFeedbackCheckboxChecked) => !requestFeedbackCheckboxChecked - ); - }, []); - const handleAttachmentSelect = useCallback(() => { const attachmentInput: any = attachmentInputRef.current; attachmentInput.click(); @@ -873,13 +777,6 @@ export const MessageSubmitInterfaceComponent = ({ infoHeadline: translate('attachments.error.other.headline'), infoMessage: translate('attachments.error.other.message') }; - } else if (activeInfo === INFO_TYPES.FINISHED_CONVERSATION) { - infoData = { - isInfo: true, - infoHeadline: translate( - 'anonymous.session.infoMessage.chatFinished' - ) - }; } else if (activeInfo === INFO_TYPES.ARCHIVED) { infoData = { isInfo: true, @@ -901,12 +798,6 @@ export const MessageSubmitInterfaceComponent = ({ !hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData))) && !tenant?.settings?.featureAttachmentUploadDisabled; - const hasRequestFeedbackCheckbox = - hasUserAuthority(AUTHORITIES.USE_FEEDBACK, userData) && - !hasUserAuthority(AUTHORITIES.VIEW_ALL_PEER_SESSIONS, userData) && - activeSession.item.feedbackGroupId && - (activeSession.isGroup || !activeSession.isFeedback); - const bookingButton: ButtonItem = useMemo( () => ({ label: translate('message.submit.booking.buttonLabel'), @@ -923,7 +814,7 @@ export const MessageSubmitInterfaceComponent = ({ return null; }, []); - if (!e2EEReady || !feedbackE2EEReady) { + if (!e2EEReady) { return null; } @@ -951,202 +842,166 @@ export const MessageSubmitInterfaceComponent = ({ /> )} {activeInfo && } - {!isLiveChatFinished && ( -
- {hasRequestFeedbackCheckbox && ( - - )} -
-
- - - - setIsRichtextActive( - !isRichtextActive - ) - } - title={translate( - 'enquiry.write.input.format' - )} - aria-label={translate( - 'enquiry.write.input.format' - )} - /> - - + + +
+
+ + + + setIsRichtextActive(!isRichtextActive) + } + title={translate( + 'enquiry.write.input.format' + )} + aria-label={translate( + 'enquiry.write.input.format' + )} + /> - + + +
resizeTextarea()} + onFocus={toggleAbsentMessage} + onBlur={toggleAbsentMessage} > -
resizeTextarea()} - onFocus={toggleAbsentMessage} - onBlur={toggleAbsentMessage} - > - - {(externalProps) => ( -
- - - -
- )} -
- - handleEditorBeforeInput(editorState) - } - handlePastedText={( - text: string, - html?: string - ): DraftHandleValue => { - const newEditorState = - handleEditorPastedText( - editorState, - text, - html - ); - if (newEditorState) { - setEditorState(newEditorState); - } - return 'handled'; - }} - plugins={[ - linkifyPlugin, - staticToolbarPlugin, - emojiPlugin - ]} - tabIndex={0} - /> -
- {hasUploadFunctionality && - (!attachmentSelected ? ( - - + {(externalProps) => ( +
+ + + - - ) : ( -
- - - - {getAttachmentIcon( - attachmentSelected.type - )} -

- { - attachmentSelected.name - } -

- - - -
-
- ))} - -
- + + handleEditorBeforeInput(editorState) } + handlePastedText={( + text: string, + html?: string + ): DraftHandleValue => { + const newEditorState = + handleEditorPastedText( + editorState, + text, + html + ); + if (newEditorState) { + setEditorState(newEditorState); + } + return 'handled'; + }} + plugins={[ + linkifyPlugin, + staticToolbarPlugin, + emojiPlugin + ]} + tabIndex={0} />
+ {hasUploadFunctionality && + (!attachmentSelected ? ( + + + + ) : ( +
+ + + + {getAttachmentIcon( + attachmentSelected.type + )} +

+ {attachmentSelected.name} +

+ + + +
+
+
+ ))} + +
+
- {showAppointmentButton && ( -
- -
- )}
- {hasUploadFunctionality && ( - + {showAppointmentButton && ( +
+ +
)} - - )} +
+ {hasUploadFunctionality && ( + + )} + {requestOverlayVisible && ( diff --git a/src/components/overlay/Overlay.tsx b/src/components/overlay/Overlay.tsx index e31d26aa5..80e9e9290 100644 --- a/src/components/overlay/Overlay.tsx +++ b/src/components/overlay/Overlay.tsx @@ -31,7 +31,6 @@ export const OVERLAY_FUNCTIONS = { NEXT_STEP: 'NEXT_STEP', PREV_STEP: 'PREV_STEP', DELETE_SESSION: 'DELETE_SESSION', - FINISH_ANONYMOUS_CONVERSATION: 'FINISH_ANONYMOUS_CONVERSATION', ARCHIVE: 'ARCHIVE', CONFIRM_EDIT: 'CONFIRM_EDIT', ASSIGN: 'ASSIGN', diff --git a/src/components/profile/ConsultantLiveChatAvailability.tsx b/src/components/profile/ConsultantLiveChatAvailability.tsx deleted file mode 100644 index a70744a1e..000000000 --- a/src/components/profile/ConsultantLiveChatAvailability.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import * as React from 'react'; -import { Headline } from '../headline/Headline'; -import { Text } from '../text/Text'; -import Switch from 'react-switch'; -import { useTranslation } from 'react-i18next'; -import { apiPatchUserData } from '../../api/apiPatchUserData'; -import { useContext } from 'react'; -import { RocketChatUserStatusContext } from '../../globalState/provider/RocketChatUserStatusProvider'; -import { UserDataContext } from '../../globalState'; -import { STATUS_ONLINE } from '../app/RocketChat'; - -export const ConsultantLiveChatAvailability = () => { - const { t: translate } = useTranslation(); - - const { status } = useContext(RocketChatUserStatusContext); - const { reloadUserData } = useContext(UserDataContext); - - const toggleSwitch = () => { - apiPatchUserData({ - available: status !== STATUS_ONLINE - }) - .then(reloadUserData) - .catch(console.log); - }; - - return ( -
-
- - -
-
- - -
-
- ); -}; diff --git a/src/components/profile/profile.routes.ts b/src/components/profile/profile.routes.ts index 5fe54f89a..949e16c5f 100644 --- a/src/components/profile/profile.routes.ts +++ b/src/components/profile/profile.routes.ts @@ -14,7 +14,6 @@ import { OverviewBookings } from './OverviewMobile/Bookings'; import { OverviewSessions } from './OverviewMobile/Sessions'; import { profileRoutesSettings } from './profileSettings.routes'; import { profileRoutesHelp } from './profileHelp.routes'; -import { ConsultantLiveChatAvailability } from './ConsultantLiveChatAvailability'; import { TenantDataInterface, AppConfigInterface @@ -166,30 +165,6 @@ const profileRoutes = ( } ] }, - { - title: 'profile.routes.activities.availability', - url: '/verfuegbarkeit', - elements: [ - { - component: ConsultantLiveChatAvailability, - column: COLUMN_RIGHT, - condition: (userData, consultingTypes) => - hasUserAuthority( - AUTHORITIES.CONSULTANT_DEFAULT, - userData - ) && - userData.hasAnonymousConversations && - userData.agencies.some( - (agency) => - (consultingTypes ?? []).find( - (consultingType) => - consultingType.id === - agency.consultingType - )?.isAnonymousConversationAllowed - ) - } - ] - }, { title: 'profile.routes.activities.absence', url: '/abwesenheit', diff --git a/src/components/session/AcceptAssign.tsx b/src/components/session/AcceptAssign.tsx index 8fecffdda..16c3d7a50 100644 --- a/src/components/session/AcceptAssign.tsx +++ b/src/components/session/AcceptAssign.tsx @@ -18,7 +18,6 @@ import { apiEnquiryAcceptance, FETCH_ERRORS } from '../../api'; import { Button, BUTTON_TYPES, ButtonItem } from '../button/Button'; import { useWatcher } from '../../hooks/useWatcher'; import { apiGetSessionRoomBySessionId } from '../../api/apiGetSessionRooms'; -import { SessionAssign } from '../sessionAssign/SessionAssign'; import { ReactComponent as CheckIcon } from '../../resources/img/illustrations/check.svg'; import { ReactComponent as XIcon } from '../../resources/img/illustrations/x.svg'; import { useTranslation } from 'react-i18next'; @@ -30,18 +29,11 @@ import { } from '../../globalState/interfaces/AppConfig/OverlaysConfigInterface'; interface AcceptAssignProps { - assignable: boolean; assigned?: boolean; - isAnonymous: boolean; btnLabel: string; } -export const AcceptAssign = ({ - assignable, - assigned, - btnLabel, - isAnonymous -}: AcceptAssignProps) => { +export const AcceptAssign = ({ assigned, btnLabel }: AcceptAssignProps) => { const { t: translate } = useTranslation(); const { rcGroupId: groupIdFromParam } = useParams<{ rcGroupId: string }>(); const history = useHistory(); @@ -159,7 +151,7 @@ export const AcceptAssign = ({ } setIsRequestInProgress(true); - apiEnquiryAcceptance(sessionId, isAnonymous) + apiEnquiryAcceptance(sessionId) .then(() => encryptRoom(setE2EEState)) .then(() => setIsRequestInProgress(false)) .then(() => setOverlayItem(enquirySuccessfullyAcceptedOverlayItem)) @@ -205,16 +197,12 @@ export const AcceptAssign = ({ return ( <>
- {assignable ? ( - - ) : ( -
{requestOverlayVisible && ( diff --git a/src/components/session/AcceptLiveChatView.tsx b/src/components/session/AcceptLiveChatView.tsx deleted file mode 100644 index d50bc87cc..000000000 --- a/src/components/session/AcceptLiveChatView.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import * as React from 'react'; -import { useCallback, useContext, useEffect, useRef, useState } from 'react'; -import { getContact, ActiveSessionContext } from '../../globalState'; -import './session.styles'; -import { FETCH_ERRORS } from '../../api'; -import { SessionHeaderComponent } from '../sessionHeader/SessionHeaderComponent'; -import { Headline } from '../headline/Headline'; -import { useWatcher } from '../../hooks/useWatcher'; -import { apiGetSessionRoomBySessionId } from '../../api/apiGetSessionRooms'; -import { AcceptAssign } from './AcceptAssign'; -import { useTranslation } from 'react-i18next'; - -interface AcceptLiveChatViewProps { - bannedUsers: string[]; -} - -export const AcceptLiveChatView = ({ - bannedUsers -}: AcceptLiveChatViewProps) => { - const { t: translate } = useTranslation(); - const { activeSession } = useContext(ActiveSessionContext); - - const abortController = useRef(null); - - const [assigned, setAssigned] = useState(false); - - const updateActiveSession = useCallback(() => { - if (abortController.current) { - abortController.current.abort(); - } - - abortController.current = new AbortController(); - - return apiGetSessionRoomBySessionId( - activeSession.item.id, - abortController.current.signal - ).catch((e) => { - if (e.message === FETCH_ERRORS.ABORT) { - return; - } else if (e.message === FETCH_ERRORS.FORBIDDEN) { - setAssigned(true); - } - }); - }, [activeSession.item.id]); - - const [startWatcher, stopWatcher, isWatcherRunning] = useWatcher( - updateActiveSession, - 3000 - ); - - useEffect(() => { - if (!isWatcherRunning && !assigned) { - startWatcher(); - } - - return () => { - if (isWatcherRunning) { - stopWatcher(); - } - if (abortController.current) { - abortController.current.abort(); - abortController.current = null; - } - }; - }, [assigned, isWatcherRunning, startWatcher, stopWatcher]); - - return ( -
-
-
- -
- -
- -
- - -
-
- ); -}; diff --git a/src/components/session/SessionItemComponent.tsx b/src/components/session/SessionItemComponent.tsx index b835cf15e..31f9749f6 100644 --- a/src/components/session/SessionItemComponent.tsx +++ b/src/components/session/SessionItemComponent.tsx @@ -18,7 +18,6 @@ import { } from '../message/MessageItemComponent'; import { SessionHeaderComponent } from '../sessionHeader/SessionHeaderComponent'; import { Button, BUTTON_TYPES, ButtonItem } from '../button/Button'; -import { apiGetConsultingType } from '../../api'; import { AUTHORITIES, getContact, @@ -28,9 +27,7 @@ import { useTenant, ActiveSessionContext } from '../../globalState'; -import { ConsultingTypeInterface } from '../../globalState/interfaces'; import './session.styles'; -import './session.yellowTheme.styles'; import { useDebouncedCallback } from 'use-debounce'; import { ReactComponent as ArrowDoubleDownIcon } from '../../resources/img/icons/arrow-double-down.svg'; import smoothScroll from './smoothScrollHelper'; @@ -83,10 +80,7 @@ export const SessionItemComponent = (props: SessionItemProps) => { ); useEffect(() => { - setCanWriteMessage( - type !== SESSION_LIST_TYPES.ENQUIRY || - hasUserAuthority(AUTHORITIES.VIEW_ALL_PEER_SESSIONS, userData) - ); + setCanWriteMessage(type !== SESSION_LIST_TYPES.ENQUIRY); }, [type, userData]); const resetUnreadCount = () => { @@ -171,37 +165,11 @@ export const SessionItemComponent = (props: SessionItemProps) => { } }, [isScrolledToBottom]); // eslint-disable-line - const [resortData, setResortData] = useState(); - useEffect(() => { - if (activeSession.item.consultingType) { - let isCanceled = false; - apiGetConsultingType({ - consultingTypeId: activeSession.item.consultingType - }).then((response) => { - if (isCanceled) return; - setResortData(response); - }); - return () => { - isCanceled = true; - }; - } - }, [activeSession.item.consultingType]); - const getPlaceholder = () => { if (activeSession.isGroup) { return translate('enquiry.write.input.placeholder.groupChat'); } else if (hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData)) { return translate('enquiry.write.input.placeholder.asker'); - } else if ( - hasUserAuthority(AUTHORITIES.VIEW_ALL_PEER_SESSIONS, userData) && - activeSession.isFeedback - ) { - return translate('enquiry.write.input.placeholder.feedback.main'); - } else if ( - hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData) && - activeSession.isFeedback - ) { - return translate('enquiry.write.input.placeholder.feedback.peer'); } else if (hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData)) { return translate('enquiry.write.input.placeholder.consultant'); } @@ -355,13 +323,7 @@ export const SessionItemComponent = (props: SessionItemProps) => { ); return ( -
+
{ askerRcId={activeSession.item.askerRcId} isOnlyEnquiry={isOnlyEnquiry} isMyMessage={isMyMessage(message.userId)} - resortData={resortData} isUserBanned={props.bannedUsers.includes( message.username )} @@ -448,17 +409,7 @@ export const SessionItemComponent = (props: SessionItemProps) => {
{type === SESSION_LIST_TYPES.ENQUIRY && ( - + )} {canWriteMessage && ( diff --git a/src/components/session/SessionStream.tsx b/src/components/session/SessionStream.tsx index 6eb3b52d6..d5e6023fa 100644 --- a/src/components/session/SessionStream.tsx +++ b/src/components/session/SessionStream.tsx @@ -11,7 +11,6 @@ import { useParams, useHistory } from 'react-router-dom'; import { Loading } from '../app/Loading'; import { SessionItemComponent } from './SessionItemComponent'; import { - AnonymousConversationFinishedContext, AUTHORITIES, ConsultantListContext, E2EEContext, @@ -22,7 +21,6 @@ import { UserDataContext, ActiveSessionContext } from '../../globalState'; -import { STATUS_FINISHED } from '../../globalState/interfaces'; import { apiGetAgencyConsultantList, apiGetSessionData, @@ -42,7 +40,6 @@ import useTyping from '../../utils/useTyping'; import './session.styles'; import { useE2EE } from '../../hooks/useE2EE'; import { - EVENT_ROOMS_CHANGED, EVENT_SUBSCRIPTIONS_CHANGED, SUB_STREAM_NOTIFY_USER, SUB_STREAM_ROOM_MESSAGES @@ -75,9 +72,6 @@ export const SessionStream = ({ const { userData } = useContext(UserDataContext); const { subscribe, unsubscribe } = useContext(RocketChatContext); const { getSetting } = useContext(RocketChatGlobalSettingsContext); - const { anonymousConversationFinished } = useContext( - AnonymousConversationFinishedContext - ); const { rcGroupId } = useParams<{ rcGroupId: string }>(); const subscribed = useRef(false); @@ -86,7 +80,7 @@ export const SessionStream = ({ const [loading, setLoading] = useState(true); const [overlayItem, setOverlayItem] = useState(null); - const { activeSession, readActiveSession, reloadActiveSession } = + const { activeSession, readActiveSession } = useContext(ActiveSessionContext); const { addNewUsersToEncryptedRoom } = useE2EE(activeSession?.rid); @@ -138,19 +132,8 @@ export const SessionStream = ({ return; } - const isLiveChatFinished = - activeSession.isLive && - activeSession.item.status === STATUS_FINISHED; - - if ( - !hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData) && - isLiveChatFinished - ) { - return; - } - readActiveSession(); - }, [activeSession, readActiveSession, readonly, userData]); + }, [readActiveSession, readonly]); /** * ToDo: roomMessageBounce is just a temporary fix because currently @@ -159,7 +142,7 @@ export const SessionStream = ({ */ const handleRoomMessage = useCallback( (args) => { - if (args.length === 0 || anonymousConversationFinished) return; + if (args.length === 0) return; args // Map collected from debounce callback @@ -191,7 +174,6 @@ export const SessionStream = ({ }, [ - anonymousConversationFinished, checkMutedUserForThisSession, isE2eeEnabled, activeSession.isGroup, @@ -244,18 +226,6 @@ export const SessionStream = ({ ) ); - const handleLiveChatStopped = useUpdatingRef( - useCallback( - ([, room]) => { - if (!room.ro) { - return; - } - reloadActiveSession(); - }, - [reloadActiveSession] - ) - ); - const handleSubscriptionChanged = useUpdatingRef( useCallback( ([event]) => { @@ -279,11 +249,6 @@ export const SessionStream = ({ } else { subscribed.current = true; - if (anonymousConversationFinished) { - setLoading(false); - return; - } - // check if any user needs to be added when opening session view addNewUsersToEncryptedRoom().then(); @@ -305,26 +270,15 @@ export const SessionStream = ({ event: EVENT_SUBSCRIPTIONS_CHANGED, userId: getValueFromCookie('rc_uid') }, - activeSession.isGroup || activeSession.isLive + activeSession.isGroup ? handleChatStopped : handleSubscriptionChanged ); - if (activeSession.isGroup || activeSession.isLive) { + if (activeSession.isGroup) { subscribeTyping(); } - if (activeSession.isLive) { - subscribe( - { - name: SUB_STREAM_NOTIFY_USER, - event: EVENT_ROOMS_CHANGED, - userId: getValueFromCookie('rc_uid') - }, - handleLiveChatStopped - ); - } - setLoading(false); }) .catch((e) => { @@ -359,34 +313,21 @@ export const SessionStream = ({ event: EVENT_SUBSCRIPTIONS_CHANGED, userId: getValueFromCookie('rc_uid') }, - activeSession.isGroup || activeSession.isLive + activeSession.isGroup ? handleChatStopped : handleSubscriptionChanged ); - if (activeSession.isGroup || activeSession.isLive) { + if (activeSession.isGroup) { unsubscribeTyping(); } - - if (activeSession.isLive) { - unsubscribe( - { - name: SUB_STREAM_NOTIFY_USER, - event: EVENT_ROOMS_CHANGED, - userId: getValueFromCookie('rc_uid') - }, - handleLiveChatStopped - ); - } } }; }, [ activeSession, addNewUsersToEncryptedRoom, - anonymousConversationFinished, fetchSessionMessages, handleChatStopped, - handleLiveChatStopped, handleSubscriptionChanged, onDebounceMessage, setSessionRead, @@ -400,7 +341,6 @@ export const SessionStream = ({ useEffect(() => { if ( - activeSession.isLive || activeSession.isGroup || hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData) ) { @@ -417,7 +357,6 @@ export const SessionStream = ({ }); }, [ activeSession.isGroup, - activeSession.isLive, activeSession.item.agencyId, setConsultantList, userData diff --git a/src/components/session/SessionView.tsx b/src/components/session/SessionView.tsx index dbf3c532a..b0e7fa524 100644 --- a/src/components/session/SessionView.tsx +++ b/src/components/session/SessionView.tsx @@ -23,7 +23,6 @@ import useUpdatingRef from '../../hooks/useUpdatingRef'; import { useSearchParam } from '../../hooks/useSearchParams'; import { useSession } from '../../hooks/useSession'; import { SessionStream } from './SessionStream'; -import { AcceptLiveChatView } from './AcceptLiveChatView'; import { RocketChatUsersOfRoomProvider } from '../../globalState/provider/RocketChatUsersOfRoomProvider'; import { useSetAtom } from 'jotai'; import { agencyLogoAtom } from '../../store/agencyLogoAtom'; @@ -192,23 +191,6 @@ export const SessionView = () => { ); } - if ( - activeSession?.isEnquiry && - !activeSession?.isEmptyEnquiry && - activeSession.isLive - ) { - return ( - - - - - - ); - } - return ( { const chatItem = getChatItemForSession(session); switch (!isGroupChat(chatItem) && chatItem.status) { case STATUS_ENQUIRY: case STATUS_EMPTY: - if (isLiveChat(chatItem)) { - return SESSION_TYPE_LIVECHAT; - } return SESSION_TYPE_ENQUIRY; case STATUS_ARCHIVED: return SESSION_TYPE_ARCHIVED; } - if (!isGroupChat(chatItem) && chatItem?.feedbackGroupId === rid) { - return SESSION_TYPE_FEEDBACK; - } else if (isGroupChat(chatItem)) { + if (isGroupChat(chatItem)) { return SESSION_TYPE_GROUP; } - if (isTeamSession(chatItem) && session?.consultant?.id !== uid) { - return SESSION_TYPE_TEAMSESSION; - } - return SESSION_TYPE_SESSION; }; @@ -86,30 +68,13 @@ export const getChatTypeForListItem = ( export const isSessionChat = ( chatItem: SessionItemInterface | GroupChatItemInterface ): chatItem is SessionItemInterface => { - return chatItem && 'feedbackGroupId' in chatItem; -}; - -export const isLiveChat = ( - chatItem: SessionItemInterface | GroupChatItemInterface -): chatItem is SessionItemInterface => { - return ( - isSessionChat(chatItem) && - chatItem.registrationType === REGISTRATION_TYPE_ANONYMOUS - ); + return chatItem && 'askerRcId' in chatItem; }; export const isGroupChat = ( chatItem: SessionItemInterface | GroupChatItemInterface ): chatItem is GroupChatItemInterface => { - return ( - (chatItem as GroupChatItemInterface) && !('feedbackGroupId' in chatItem) - ); -}; - -export const isTeamSession = ( - sessionItem: SessionItemInterface -): sessionItem is SessionItemInterface => { - return sessionItem && sessionItem.isTeamSession; + return (chatItem as GroupChatItemInterface) && 'moderators' in chatItem; }; export const getChatItemForSession = ( @@ -125,20 +90,15 @@ export const getChatItemForSession = ( return sessionItem[chatType] as SessionItemInterface; }; -export const SESSION_LIST_TAB_ANONYMOUS = 'anonymous'; export const SESSION_LIST_TAB_ARCHIVE = 'archive'; -export type SESSION_LIST_TAB = - | typeof SESSION_LIST_TAB_ANONYMOUS - | typeof SESSION_LIST_TAB_ARCHIVE; +export type SESSION_LIST_TAB = typeof SESSION_LIST_TAB_ARCHIVE; export const getViewPathForType = (type: SESSION_LIST_TYPES) => { if (type === SESSION_LIST_TYPES.ENQUIRY) { return 'sessionPreview'; } else if (type === SESSION_LIST_TYPES.MY_SESSION) { return 'sessionView'; - } else if (type === SESSION_LIST_TYPES.TEAMSESSION) { - return 'teamSessionView'; } }; diff --git a/src/components/sessionAssign/RequestSessionAssign.tsx b/src/components/sessionAssign/RequestSessionAssign.tsx index 158aa7200..22f307b48 100644 --- a/src/components/sessionAssign/RequestSessionAssign.tsx +++ b/src/components/sessionAssign/RequestSessionAssign.tsx @@ -73,8 +73,6 @@ export const RequestSessionAssign = (props: { value?: string }) => { const selectedConsultant = consultantList.filter( (consultant) => consultant.value === activeSession?.consultant?.id )[0]; - const isTeamSession = activeSession?.item?.isTeamSession; - const isMyOwnSession = selected?.value === profileData.userId; const client = activeSession.user.username; const newConsultant = selected.label; @@ -95,26 +93,6 @@ export const RequestSessionAssign = (props: { value?: string }) => { } ); - if (isTeamSession && isMyOwnSession) { - overlayText = translate( - 'session.assignOther.overlay.subtitle.team.self', - { - newConsultant, - toAskerName - } - ); - } - - if (isTeamSession && !isMyOwnSession) { - overlayText = translate( - 'session.assignOther.overlay.subtitle.team.other', - { - newConsultant, - toAskerName - } - ); - } - const reassignSession: OverlayItem = { headline: translate('session.assignOther.overlay.headline.1', { client, diff --git a/src/components/sessionAssign/SessionAssign.tsx b/src/components/sessionAssign/SessionAssign.tsx deleted file mode 100644 index ddc701665..000000000 --- a/src/components/sessionAssign/SessionAssign.tsx +++ /dev/null @@ -1,284 +0,0 @@ -import * as React from 'react'; -import { useState, useEffect, useContext, useCallback, useMemo } from 'react'; -import { useHistory } from 'react-router-dom'; -import { Overlay, OverlayItem, OVERLAY_FUNCTIONS } from '../overlay/Overlay'; -import { BUTTON_TYPES } from '../button/Button'; -import { - apiGetAgencyConsultantList, - apiSessionAssign, - FETCH_ERRORS, - apiDeleteUserFromRoom -} from '../../api'; -import { - UserDataContext, - ConsultantListContext, - E2EEContext, - SessionTypeContext, - ActiveSessionContext -} from '../../globalState'; -import { SelectDropdown } from '../select/SelectDropdown'; -import { ReactComponent as CheckIcon } from '../../resources/img/illustrations/check.svg'; -import { useE2EE } from '../../hooks/useE2EE'; -import { useSearchParam } from '../../hooks/useSearchParams'; -import { SESSION_LIST_TAB } from '../session/sessionHelpers'; -import { - prepareConsultantDataForSelect, - prepareSelectDropdown -} from './sessionAssignHelper'; -import { useTranslation } from 'react-i18next'; -import { useE2EEViewElements } from '../../hooks/useE2EEViewElements'; -import { useTimeoutOverlay } from '../../hooks/useTimeoutOverlay'; -import { - OVERLAY_E2EE, - OVERLAY_REQUEST -} from '../../globalState/interfaces/AppConfig/OverlaysConfigInterface'; - -export interface Consultant { - consultantId: string; - firstName: string; - lastName: string; -} - -export const SessionAssign = (props: { value?: string }) => { - const { t: translate } = useTranslation(); - const history = useHistory(); - - const { activeSession } = useContext(ActiveSessionContext); - const { userData } = useContext(UserDataContext); - const { path: listPath } = useContext(SessionTypeContext); - const { consultantList, setConsultantList } = useContext( - ConsultantListContext - ); - const [overlayActive, setOverlayActive] = useState(false); - const [overlayItem, setOverlayItem] = useState({}); - const [selectedOption, setSelectedOption] = useState(); - const [isRequestInProgress, setIsRequestInProgress] = useState(false); - - const { isE2eeEnabled } = useContext(E2EEContext); - - const { addNewUsersToEncryptedRoom, encryptRoom } = useE2EE( - activeSession.item.groupId - ); - - const { - visible: e2eeOverlayVisible, - setState: setE2EEState, - overlay: e2eeOverlay - } = useE2EEViewElements(); - - const { visible: requestOverlayVisible, overlay: requestOverlay } = - useTimeoutOverlay( - isRequestInProgress, - null, - userData.userId === selectedOption - ? translate('session.assignSelf.inProgress') - : translate('session.assignOther.inProgress'), - null, - 0 - ); - - const sessionListTab = useSearchParam('sessionListTab'); - const getSessionListTab = () => - `${sessionListTab ? `?sessionListTab=${sessionListTab}` : ''}`; - - const assignOtherOverlay: OverlayItem = useMemo( - () => ({ - svg: CheckIcon, - headline: translate('session.assignOther.overlay.headline.2'), - buttonSet: [ - { - label: translate('session.assignOther.button.label'), - function: OVERLAY_FUNCTIONS.CLOSE, - functionArgs: { - gotoOverview: true - }, - type: BUTTON_TYPES.AUTO_CLOSE - } - ] - }), - [translate] - ); - - const assignSelfOverlay: OverlayItem = useMemo( - () => ({ - svg: CheckIcon, - headline: translate('session.assignSelf.overlay.headline1'), - buttonSet: [ - { - label: translate('session.assignSelf.button1.label'), - function: OVERLAY_FUNCTIONS.REDIRECT, - type: BUTTON_TYPES.PRIMARY - }, - { - label: translate('session.assignSelf.button2.label'), - function: OVERLAY_FUNCTIONS.CLOSE, - type: BUTTON_TYPES.SECONDARY - } - ] - }), - [translate] - ); - - const assignSession: OverlayItem = useMemo( - () => ({ - headline: translate('session.assignSelf.overlay.headline2'), - copy: translate('session.assignSelf.overlay.subtitle'), - buttonSet: [ - { - label: translate( - 'session.assignSelf.overlay.button.cancel' - ), - function: OVERLAY_FUNCTIONS.CLOSE, - type: BUTTON_TYPES.SECONDARY - }, - { - label: translate( - 'session.assignSelf.overlay.button.assign' - ), - function: 'ASSIGN', - type: BUTTON_TYPES.PRIMARY - } - ] - }), - [translate] - ); - - const alreadyAssignedSession: OverlayItem = useMemo( - () => ({ - headline: translate('session.alreadyAssigned.overlay.headline'), - buttonSet: [ - { - label: translate( - 'session.alreadyAssigned.overlay.button.cancel' - ), - function: OVERLAY_FUNCTIONS.CLOSE, - type: BUTTON_TYPES.SECONDARY - }, - { - label: translate( - 'session.alreadyAssigned.overlay.button.redirect' - ), - function: OVERLAY_FUNCTIONS.REDIRECT, - type: BUTTON_TYPES.PRIMARY - } - ] - }), - [translate] - ); - - useEffect(() => { - const agencyId = activeSession.item.agencyId.toString(); - if (consultantList && consultantList.length <= 0) { - apiGetAgencyConsultantList(agencyId) - .then((response) => { - const consultants = - prepareConsultantDataForSelect(response); - setConsultantList(consultants); - }) - .catch((error) => { - console.log(error); - }); - } - }, []); // eslint-disable-line react-hooks/exhaustive-deps - - const initOverlays = useCallback(() => { - const overlay = - userData.userId === selectedOption - ? assignSelfOverlay - : assignOtherOverlay; - setOverlayActive(true); - setOverlayItem(overlay); - }, [ - assignOtherOverlay, - assignSelfOverlay, - selectedOption, - userData.userId - ]); - - const handleE2EEAssign = async (sessionId, userId) => { - if (isE2eeEnabled) { - try { - // If already encrypted this will be skipped - await encryptRoom(setE2EEState); - // If room was already encrypted add new users - await addNewUsersToEncryptedRoom(); - await apiDeleteUserFromRoom(sessionId, userId); - } catch (e) { - console.log('error encrypting new user key'); - } - } - }; - - const handleDatalistSelect = (selectedOption) => { - if ( - userData.userId === activeSession?.consultant?.id && - userData.userId === selectedOption.value - ) { - setOverlayItem(alreadyAssignedSession); - } else { - setOverlayItem(assignSession); - } - setOverlayActive(true); - setSelectedOption(selectedOption.value); - }; - - const handleOverlayAction = ( - buttonFunction: string, - buttonArgs: { [key: string]: any } - ) => { - switch (buttonFunction) { - case 'ASSIGN': - setIsRequestInProgress(true); - apiSessionAssign(activeSession.item.id, selectedOption) - .then(() => - handleE2EEAssign(activeSession.item.id, userData.userId) - ) - .then(() => initOverlays()) - .catch((error) => { - if (error === FETCH_ERRORS.CONFLICT) { - return null; - } else console.log(error); - }) - .finally(() => setIsRequestInProgress(false)); - break; - case OVERLAY_FUNCTIONS.REDIRECT: - setOverlayItem(null); - setOverlayActive(false); - history.push( - `/sessions/consultant/sessionView/${activeSession.item.groupId}/${activeSession.item.id}` - ); - break; - case OVERLAY_FUNCTIONS.CLOSE: - if (buttonArgs?.gotoOverview) { - history.push(listPath + getSessionListTab()); - } - setOverlayItem(null); - setOverlayActive(false); - break; - } - }; - - return ( -
- - {requestOverlayVisible && ( - - )} - {e2eeOverlayVisible && ( - - )} - {overlayActive && ( - - )} -
- ); -}; diff --git a/src/components/sessionHeader/GroupChatHeader/index.tsx b/src/components/sessionHeader/GroupChatHeader/index.tsx index 933c6a02e..dda369014 100644 --- a/src/components/sessionHeader/GroupChatHeader/index.tsx +++ b/src/components/sessionHeader/GroupChatHeader/index.tsx @@ -82,7 +82,6 @@ export const GroupChatHeader = ({ !hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData) && consultingType?.showAskerProfile && activeSession.isSession && - !activeSession.isLive && ((type === SESSION_LIST_TYPES.ENQUIRY && Object.entries(userSessionData).length !== 0) || SESSION_LIST_TYPES.ENQUIRY !== type); diff --git a/src/components/sessionHeader/SessionHeaderComponent.tsx b/src/components/sessionHeader/SessionHeaderComponent.tsx index 9b360487d..3c92cb155 100644 --- a/src/components/sessionHeader/SessionHeaderComponent.tsx +++ b/src/components/sessionHeader/SessionHeaderComponent.tsx @@ -29,7 +29,6 @@ import { } from '../profile/profileHelpers'; import { ReactComponent as BackIcon } from '../../resources/img/icons/arrow-left.svg'; import './sessionHeader.styles'; -import './sessionHeader.yellowTheme.styles'; import { useSearchParam } from '../../hooks/useSearchParams'; import { useTranslation } from 'react-i18next'; import { GroupChatHeader } from './GroupChatHeader'; @@ -62,8 +61,7 @@ export const SessionHeaderComponent = (props: SessionHeaderProps) => { const preparedUserSessionData = hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData) && - userSessionData && - !activeSession.isLive + userSessionData ? convertUserDataObjectToArray(userSessionData) : null; const translateBase = getUserDataTranslateBase( @@ -115,7 +113,6 @@ export const SessionHeaderComponent = (props: SessionHeaderProps) => { !hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData) && consultingType?.showAskerProfile && activeSession.isSession && - !activeSession.isLive && ((type === SESSION_LIST_TYPES.ENQUIRY && enquiryUserProfileCondition) || SESSION_LIST_TYPES.ENQUIRY !== type); @@ -131,35 +128,6 @@ export const SessionHeaderComponent = (props: SessionHeaderProps) => { ); } - if (activeSession.isFeedback) { - return ( -
-
- - - -
-

{translate('session.feedback.label')}

-
-
-
- {activeSession.user.username ? ( -
- {activeSession.user.username} -
- ) : null} -
-
- ); - } - return (
@@ -176,11 +144,7 @@ export const SessionHeaderComponent = (props: SessionHeaderProps) => { !isAskerInfoAvailable() })} > - {(hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData) || - hasUserAuthority( - AUTHORITIES.ANONYMOUS_DEFAULT, - userData - )) && ( + {hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData) && (

{contact?.displayName || contact?.username || diff --git a/src/components/sessionHeader/sessionHeader.styles.scss b/src/components/sessionHeader/sessionHeader.styles.scss index da3791554..d7cef697a 100644 --- a/src/components/sessionHeader/sessionHeader.styles.scss +++ b/src/components/sessionHeader/sessionHeader.styles.scss @@ -57,8 +57,7 @@ $iconSize: 24px; } } - &__backButton, - &__feedbackBackButton { + &__backButton { svg { width: $iconSize; height: $iconSize; @@ -78,14 +77,6 @@ $iconSize: 24px; } } - &__feedbackBackButton { - padding-right: 10px; - - @include breakpoint($fromLarge) { - display: block; - } - } - &__username { cursor: pointer; overflow: hidden; @@ -98,6 +89,7 @@ $iconSize: 24px; &--deactivate { cursor: unset; } + a { text-decoration: none; } @@ -124,32 +116,6 @@ $iconSize: 24px; margin-right: 20px; } - &__feedbackButton { - display: none; - - @include breakpoint($fromLarge) { - display: inline-block; - } - - &--active .button__item { - transform: scale(1.2); - animation: yellowThemeHighlight 1.5s forwards; - - @keyframes yellowThemeHighlight { - 0% { - background-color: $yellow-3; - } - 20% { - background-color: $yellow-4; - } - 100% { - background-color: $yellow-3; - } - } - } - } - - &__feedbackMetaInfo, &__metaInfo { width: 100%; max-width: $xlarge; @@ -291,9 +257,4 @@ $iconSize: 24px; } } } - &__feedbackMetaInfo { - @include breakpoint($fromLarge) { - padding-left: 36px; - } - } } diff --git a/src/components/sessionHeader/sessionHeader.yellowTheme.styles.scss b/src/components/sessionHeader/sessionHeader.yellowTheme.styles.scss deleted file mode 100644 index 449e576fe..000000000 --- a/src/components/sessionHeader/sessionHeader.yellowTheme.styles.scss +++ /dev/null @@ -1,9 +0,0 @@ -.session--yellowTheme { - .sessionInfo { - background-color: $yellow-1; - - @include breakpoint($fromLarge) { - background-color: var(--skin-color-secondary-light, $yellow-2); - } - } -} diff --git a/src/components/sessionMenu/SessionMenu.tsx b/src/components/sessionMenu/SessionMenu.tsx index d2b19ed51..4944e9349 100644 --- a/src/components/sessionMenu/SessionMenu.tsx +++ b/src/components/sessionMenu/SessionMenu.tsx @@ -8,7 +8,6 @@ import { } from 'react'; import { generatePath, Link, Redirect, useHistory } from 'react-router-dom'; import { - AnonymousConversationFinishedContext, AUTHORITIES, hasUserAuthority, SessionTypeContext, @@ -16,10 +15,7 @@ import { UserDataContext, ActiveSessionContext } from '../../globalState'; -import { - SessionItemInterface, - STATUS_FINISHED -} from '../../globalState/interfaces'; +import { SessionItemInterface } from '../../globalState/interfaces'; import { SESSION_LIST_TAB, SESSION_LIST_TAB_ARCHIVE, @@ -28,7 +24,6 @@ import { import { Overlay, OVERLAY_FUNCTIONS } from '../overlay/Overlay'; import { archiveSessionSuccessOverlayItem, - finishAnonymousChatSecurityOverlayItem, groupChatErrorOverlayItem, leaveGroupChatSecurityOverlayItem, leaveGroupChatSuccessOverlayItem, @@ -37,7 +32,6 @@ import { videoCallErrorOverlayItem } from './sessionMenuHelpers'; import { - apiFinishAnonymousConversation, apiPutArchive, apiPutDearchive, apiPutGroupChat, @@ -47,7 +41,6 @@ import { import { logout } from '../logout/logout'; import { mobileListView } from '../app/navigationHandler'; import { isGroupChatOwner } from '../groupChat/groupChatHelpers'; -import { ReactComponent as FeedbackIcon } from '../../resources/img/icons/pen-paper.svg'; import { ReactComponent as LeaveChatIcon } from '../../resources/img/icons/out.svg'; import { ReactComponent as GroupChatInfoIcon } from '../../resources/img/icons/i.svg'; import { ReactComponent as StopGroupChatIcon } from '../../resources/img/icons/x.svg'; @@ -91,9 +84,6 @@ export const SessionMenu = (props: SessionMenuProps) => { const { userData } = useContext(UserDataContext); const { type, path: listPath } = useContext(SessionTypeContext); - const { setAnonymousConversationFinished } = useContext( - AnonymousConversationFinishedContext - ); const { activeSession, reloadActiveSession } = useContext(ActiveSessionContext); @@ -163,23 +153,7 @@ export const SessionMenu = (props: SessionMenuProps) => { setOverlayActive(true); }; - const handleFinishAnonymousChat = () => { - if (hasUserAuthority(AUTHORITIES.ANONYMOUS_DEFAULT, userData)) { - finishAnonymousChatSecurityOverlayItem.copy = translate( - 'anonymous.overlay.finishChat.asker.copy' - ); - } - setOverlayItem(finishAnonymousChatSecurityOverlayItem); - setOverlayActive(true); - }; - const handleArchiveSession = () => { - // location type - if (type === SESSION_LIST_TYPES.TEAMSESSION) { - archiveSessionSuccessOverlayItem.copy = translate( - 'archive.overlay.teamsession.success.copy' - ); - } setOverlayItem(archiveSessionSuccessOverlayItem); setOverlayActive(true); }; @@ -252,33 +226,6 @@ export const SessionMenu = (props: SessionMenuProps) => { setRedirectToSessionsList(true); } else if (buttonFunction === OVERLAY_FUNCTIONS.LOGOUT) { logout(); - } else if ( - buttonFunction === OVERLAY_FUNCTIONS.FINISH_ANONYMOUS_CONVERSATION - ) { - apiFinishAnonymousConversation(activeSession.item.id) - .then(() => { - setIsRequestInProgress(false); - - if ( - hasUserAuthority( - AUTHORITIES.ANONYMOUS_DEFAULT, - userData - ) - ) { - setAnonymousConversationFinished('DONE'); - } else { - setOverlayActive(false); - setOverlayItem(null); - } - }) - .catch((error) => { - console.error(error); - setIsRequestInProgress(false); - setOverlayActive(false); - setOverlayItem(null); - }); - } else if (buttonFunction === OVERLAY_FUNCTIONS.REDIRECT_TO_URL) { - window.location.href = settings.urls.finishedAnonymousChatRedirect; } else if (buttonFunction === OVERLAY_FUNCTIONS.ARCHIVE) { apiPutArchive(activeSession.item.id) .then(() => { @@ -305,7 +252,7 @@ export const SessionMenu = (props: SessionMenuProps) => { //TODO: //enquiries: only RS profil - //sessions/peer/team: feedback (if u25), rs, docu + //sessions: rs, docu //imprint/dataschutz all users all devices //dynamicly menut items in flyout: @@ -356,22 +303,9 @@ export const SessionMenu = (props: SessionMenuProps) => { ) }; - const buttonFeedback: ButtonItem = { - type: BUTTON_TYPES.SMALL_ICON, - smallIconBackgroundColor: 'yellow', - icon: ( - - ), - label: translate('chatFlyout.feedback') - }; - const hasVideoCallFeatures = () => hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData) && activeSession.isSession && - !activeSession.isLive && type !== SESSION_LIST_TYPES.ENQUIRY && consultingType.isVideoCallAllowed; @@ -410,20 +344,6 @@ export const SessionMenu = (props: SessionMenuProps) => { return (
- {activeSession.isLive && - activeSession.item.status !== STATUS_FINISHED && - type !== SESSION_LIST_TYPES.ENQUIRY && ( - - - - {translate('anonymous.session.finishChat')} - - - )} - {hasVideoCallFeatures() && (
{
)} - {!hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData) && - type !== SESSION_LIST_TYPES.ENQUIRY && - activeSession.item.feedbackGroupId && ( - - - - )} - - -