Skip to content

Commit

Permalink
feat(livechat): remove anonymous session handling
Browse files Browse the repository at this point in the history
  • Loading branch information
koepferd committed Aug 8, 2024
1 parent ee75b2a commit e305ca6
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 277 deletions.
61 changes: 0 additions & 61 deletions src/components/app/FinishedAnonymousConversationHandler.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/components/overlay/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
72 changes: 1 addition & 71 deletions src/components/sessionMenu/SessionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@ import {
} from 'react';
import { generatePath, Link, Redirect, useHistory } from 'react-router-dom';
import {
AnonymousConversationFinishedContext,
AUTHORITIES,
hasUserAuthority,
SessionTypeContext,
useConsultingType,
UserDataContext,
ActiveSessionContext
} from '../../globalState';
import {
SessionItemInterface,
STATUS_FINISHED
} from '../../globalState/interfaces';
import { SessionItemInterface } from '../../globalState/interfaces';
import {
SESSION_LIST_TAB,
SESSION_LIST_TAB_ARCHIVE,
Expand All @@ -28,7 +24,6 @@ import {
import { Overlay, OVERLAY_FUNCTIONS } from '../overlay/Overlay';
import {
archiveSessionSuccessOverlayItem,
finishAnonymousChatSecurityOverlayItem,
groupChatErrorOverlayItem,
leaveGroupChatSecurityOverlayItem,
leaveGroupChatSuccessOverlayItem,
Expand All @@ -37,7 +32,6 @@ import {
videoCallErrorOverlayItem
} from './sessionMenuHelpers';
import {
apiFinishAnonymousConversation,
apiPutArchive,
apiPutDearchive,
apiPutGroupChat,
Expand Down Expand Up @@ -90,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);
Expand Down Expand Up @@ -162,16 +153,6 @@ 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) {
Expand Down Expand Up @@ -251,33 +232,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(() => {
Expand Down Expand Up @@ -397,20 +351,6 @@ export const SessionMenu = (props: SessionMenuProps) => {

return (
<div className="sessionMenu__wrapper">
{activeSession.isLive &&
activeSession.item.status !== STATUS_FINISHED &&
type !== SESSION_LIST_TYPES.ENQUIRY && (
<span
onClick={handleFinishAnonymousChat}
className="sessionMenu__item--desktop sessionMenu__button"
>
<span className="sessionMenu__icon">
<LeaveChatIcon />
{translate('anonymous.session.finishChat')}
</span>
</span>
)}

{hasVideoCallFeatures() && (
<div
className="sessionMenu__videoCallButtons"
Expand Down Expand Up @@ -470,16 +410,6 @@ export const SessionMenu = (props: SessionMenuProps) => {
flyoutOpen && 'sessionMenu__content--open'
}`}
>
{activeSession.isLive &&
activeSession.item.status !== STATUS_FINISHED &&
type !== SESSION_LIST_TYPES.ENQUIRY && (
<div
className="sessionMenu__item sessionMenu__item--mobile"
onClick={handleFinishAnonymousChat}
>
{translate('anonymous.session.finishChat')}
</div>
)}
{hasVideoCallFeatures() && (
<>
<div
Expand Down
47 changes: 0 additions & 47 deletions src/components/sessionMenu/sessionMenuHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,53 +89,6 @@ export const leaveGroupChatSuccessOverlayItem: OverlayItem = {
]
};

export const finishAnonymousChatSecurityOverlayItem: OverlayItem = {
svg: WavingIllustration,
illustrationBackground: 'neutral',
headline: 'anonymous.overlay.finishChat.headline',
copy: 'anonymous.overlay.finishChat.consultant.copy',
buttonSet: [
{
label: 'anonymous.overlay.finishChat.button1',
function: OVERLAY_FUNCTIONS.FINISH_ANONYMOUS_CONVERSATION,
type: BUTTON_TYPES.PRIMARY
},
{
label: 'anonymous.overlay.finishChat.button2',
function: OVERLAY_FUNCTIONS.CLOSE,
type: BUTTON_TYPES.SECONDARY
}
]
};

export const selfFinishedAnonymousChatSuccessOverlayItem: OverlayItem = {
svg: WavingIllustration,
illustrationBackground: 'neutral',
headline: 'anonymous.overlay.chatWasFinished.headline',
headlineStyleLevel: '1',
copy: 'anonymous.overlay.chatWasFinished.copy',
buttonSet: [
{
label: 'anonymous.overlay.chatWasFinished.button',
function: OVERLAY_FUNCTIONS.REDIRECT_TO_URL,
type: BUTTON_TYPES.PRIMARY
}
]
};

export const finishAnonymousChatSuccessOverlayItem: OverlayItem = {
svg: CheckIllustration,
illustrationBackground: 'info',
headline: 'anonymous.overlay.finishChat.success.headline',
buttonSet: [
{
label: 'anonymous.overlay.finishChat.success.button',
function: OVERLAY_FUNCTIONS.REDIRECT_TO_URL,
type: BUTTON_TYPES.PRIMARY
}
]
};

export const archiveSessionSuccessOverlayItem: OverlayItem = {
svg: CheckIllustration,
illustrationBackground: 'info',
Expand Down
1 change: 0 additions & 1 deletion src/extensions/resources/scripts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const config: AppConfigInterface = {
..._.merge(baseConfig, {
urls: {
chatScheduleUrl: uiUrl + '/registration',
finishedAnonymousChatRedirect: 'https://www.diakonie.de',
home: uiUrl + '/registration',
landingpage: '/registration',
toEntry: uiUrl + '/registration',
Expand Down
3 changes: 0 additions & 3 deletions src/globalState/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ export * from './helpers/stateHelpers';

export * from './provider/ActiveSessionProvider';
export * from './provider/AgencySpecificProvider';
export * from './provider/AnonymousConversationFinishedProvider';
export * from './provider/AnonymousEnquiryAcceptedProvider';
export * from './provider/AnonymousConversationStartedProvider';
export * from './provider/ConsultantListProvider';
export * from './provider/ConsultingTypesProvider';
export * from './provider/E2EEProvider';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export interface AppConfigUrlsInterface {
error401: string;
error404: string;
error500: string;
finishedAnonymousChatRedirect: string;
home: string;
landingpage: string;
releases: string;
Expand Down
41 changes: 0 additions & 41 deletions src/globalState/provider/AnonymousConversationFinishedProvider.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions src/globalState/provider/AnonymousConversationStartedProvider.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions src/globalState/provider/AnonymousEnquiryAcceptedProvider.tsx

This file was deleted.

Loading

0 comments on commit e305ca6

Please sign in to comment.