import callDirections from '@ringcentral-integration/commons/enums/callDirections'; import telephonyStatuses from '@ringcentral-integration/commons/enums/telephonyStatus'; import clsx from 'clsx'; import React from 'react'; import EndIcon from '../../assets/images/End.svg'; import { Button } from '../Button'; import CircleButton from '../CircleButton'; import LogBasicInfo from '../LogBasicInfo'; import callControlI18n from '../SmCallControl/i18n'; import i18n from './i18n'; import styles from './styles.scss'; type LogNotificationProps = { currentLocale: string; showLogButton?: boolean; currentLog?: object; formatPhone?: (...args: any[]) => any; isExpand?: boolean; onStay?: (...args: any[]) => any; onDiscard?: (...args: any[]) => any; onSave?: (...args: any[]) => any; onExpand?: (...args: any[]) => any; currentSession?: object; onReject?: (...args: any[]) => any; onHangup?: (...args: any[]) => any; showEndButton?: boolean; disableLinks?: boolean; }; const LogNotification: React.FC = ({ formatPhone, currentLog, currentLocale, showLogButton, isExpand, onStay, onDiscard, onSave, onExpand, currentSession, onReject, onHangup, showEndButton, disableLinks, }) => { let extraButtons = null; if (showEndButton && showLogButton) { let endButton = null; if (currentSession) { // @ts-expect-error TS(2339): Property 'callStatus' does not exist on type '{}'. const { callStatus, direction } = currentSession; const isInComingCall = callDirections.inbound === direction && telephonyStatuses.ringing === callStatus; const endTitle = isInComingCall ? 'reject' : 'hangup'; const endAction = isInComingCall ? onReject : onHangup; endButton = ( ); } extraButtons = (
{endButton}
); } else if (showLogButton) { extraButtons = ( ); } return (
{extraButtons}
{isExpand ? (
{i18n.getString('confirmationInfo', currentLocale)}
{onSave ? ( ) : null} {onDiscard ? ( ) : null} {onStay ? ( ) : null}
) : null}
); }; LogNotification.defaultProps = { showLogButton: true, currentLog: {}, formatPhone: undefined, isExpand: undefined, onStay: undefined, onDiscard: undefined, onSave: undefined, onExpand: undefined, currentSession: undefined, onReject: () => null, onHangup: () => null, showEndButton: false, disableLinks: false, }; export default LogNotification;