import type { RcvDelegator } from '@ringcentral-integration/commons/modules/RcVideo'; import { ASSISTED_USERS_MYSELF, RCV_ITEM_NAME, } from '@ringcentral-integration/commons/modules/RcVideo'; import { RcIcon, RcLink, RcListItemText, RcMenuItem, RcSelect, RcSwitch, RcTypography, RcBox, RcAlert, RcIconButton, } from '@ringcentral/juno'; import { ChevronLeft, Close, InfoBorder } from '@ringcentral/juno-icon'; import type { FunctionComponent } from 'react'; import React, { useEffect, useMemo, useRef, useState } from 'react'; import FormattedMessage from '../FormattedMessage'; import { VideoPanelProps } from '../GenericMeetingPanel'; import { MigrateToPluginAlert } from '../MeetingAlert'; import { ExtendedTooltip } from '../MeetingConfigsV2/ExtendedTooltip'; import { SpinnerOverlay } from '../SpinnerOverlay'; import { MeetingSettingsCard } from './MeetingSettingsCard'; import { RCV_SCHEDULE_ON_BEHALF_GUIDANCE_LINK } from './constants'; import { t } from './i18n'; import { StyledListItem, StyledRcCard, TitleWrapper } from './styled'; import styles from './styles.scss'; export const SchedulerMeetingPanel: FunctionComponent = ( props, ) => { const { disabled, currentLocale, meeting, init, enablePersonalMeeting, isPersonalMeetingDisabled, personalMeetingId, personalMeetingName, personalMeetingLink, switchUsePersonalMeetingId, onCloseMigrationAlert, delegators, showScheduleOnBehalf, updateScheduleFor, showSpinnerInConfigPanel, brandConfig, showMigrationAlert, onPasswordChangeClick, updateMeetingSettings, updatePersonalMeetingSettings, trackSettingChanges, isJoinBeforeHostDisabled, isWaitingRoomTypeDisabled, isWaitingRoomDisabled, isRequirePasswordDisabled, isWaitingRoomNotCoworkerDisabled, isWaitingRoomGuestDisabled, isAuthenticatedCanJoinDisabled, personalMeeting, useSimpleRcv = false, } = props; useEffect(() => { if (init) { init(); } }, []); /* Scrollbar */ const configRef = useRef(null); const [hasScrollBar, setHasScrollBar] = useState(false); useEffect(() => { setHasScrollBar( // @ts-expect-error TS(2532): Object is possibly 'undefined'. configRef.current.scrollHeight > configRef.current.clientHeight, ); }, []); const showPersonalMeeting = useMemo( () => enablePersonalMeeting && (personalMeetingId || personalMeetingName), [enablePersonalMeeting, personalMeetingId, personalMeetingName], ); const [showAssistedUserAlert, setShowAssistedUserAlert] = useState(true); const assistedUser = useMemo(() => { return ( delegators?.find((item) => item.extensionId === meeting.extensionId) || delegators?.[0] ); }, [delegators, meeting.extensionId]); useEffect(() => { if (!showScheduleOnBehalf) { return; } setShowAssistedUserAlert(assistedUser!.name !== ASSISTED_USERS_MYSELF); }, [assistedUser, showScheduleOnBehalf]); const [showEditPMI, setShowEditPMI] = useState(false); // don't show password in the link const linkWithoutPassword = personalMeetingLink?.replace(/\?pw=[^&]+/, ''); if (showEditPMI) { return (
setShowEditPMI(false)} className={styles.backButton} /> {t('pmiSettingsTitle')} {t('pmiSettingsDescription')}
); } return (
{showSpinnerInConfigPanel ? : null} {showMigrationAlert && brandConfig.substituteName && ( )} {showScheduleOnBehalf ? ( <>
{t('scheduleFor')} { e.stopPropagation(); }} onKeyDown={(e) => { if (e.key === 'Enter' || e.key === ' ') { e.stopPropagation(); } }} >
{t('scheduleForGuidance')}

{t('scheduleForGuidanceMore')}
} > { e.stopPropagation(); }} /> { updateScheduleFor(e.target.value as string); trackSettingChanges?.(RCV_ITEM_NAME.scheduleFor); }} value={meeting.extensionId} > {delegators?.map((item: RcvDelegator, index: number) => { const userName = item.name === ASSISTED_USERS_MYSELF ? t(item.name) : item.name; return ( {userName} ); })}
{showAssistedUserAlert && ( setShowAssistedUserAlert(false)} /> )} ) : null} {t('meetingSettings')} {t('meetingSettingsDescription')} {showPersonalMeeting && ( {t('usePersonalMeetingIdInstead')} } secondary={ <> {linkWithoutPassword} {meeting.usePersonalMeetingId && ( setShowEditPMI(true)} > {t('editSettings')} )} } /> { switchUsePersonalMeetingId(checked); }} /> )} ); };