diff --git a/src/components/WebexInMeeting/WebexInMeeting.jsx b/src/components/WebexInMeeting/WebexInMeeting.jsx index c85ada97a..073effb4f 100644 --- a/src/components/WebexInMeeting/WebexInMeeting.jsx +++ b/src/components/WebexInMeeting/WebexInMeeting.jsx @@ -1,12 +1,21 @@ -import React, {useEffect, useState} from 'react'; +import React, {useContext, useEffect, useState} from 'react'; import PropTypes from 'prop-types'; +import {MeetingState} from '@webex/component-adapter-interfaces'; import Banner from '../generic/Banner/Banner'; import WebexLocalMedia from '../WebexLocalMedia/WebexLocalMedia'; import WebexRemoteMedia from '../WebexRemoteMedia/WebexRemoteMedia'; import webexComponentClasses from '../helpers'; -import {useElementDimensions, useMeeting, useRef} from '../hooks'; +import { + AdapterContext, + useElementDimensions, + useMeeting, + useRef, +} from '../hooks'; import {TABLET, DESKTOP, DESKTOP_LARGE} from '../breakpoints'; +import {Modal} from '../generic'; +import WebexMeetingGuestAuthentication from '../WebexMeetingGuestAuthentication/WebexMeetingGuestAuthentication'; +import WebexMeetingHostAuthentication from '../WebexMeetingHostAuthentication/WebexMeetingHostAuthentication'; /** * Webex In-Meeting component displays the remote stream plus @@ -17,15 +26,23 @@ import {TABLET, DESKTOP, DESKTOP_LARGE} from '../breakpoints'; * @param {string} props.layout Layout to apply on remote video * @param {string} props.meetingID ID of the meeting for which to show media * @param {object} props.style Custom style to apply + * @param {object} props.setEscapedAuthentication Set true if user escapes authentication * @returns {object} JSX of the component */ export default function WebexInMeeting({ - className, layout, meetingID, style, + className, layout, meetingID, style, setEscapedAuthentication, }) { - const {remoteShare, localShare} = useMeeting(meetingID); + const adapter = useContext(AdapterContext); + const { + remoteShare, + localShare, + passwordRequired, + state, + } = useMeeting(meetingID); const meetingRef = useRef(); const {width, height} = useElementDimensions(meetingRef); const [maxWidth, setMaxWidth] = useState('none'); + const [authModal, setAuthModal] = useState('guest'); const localMediaType = localShare?.stream ? 'screen' : 'video'; const [cssClasses, sc] = webexComponentClasses('in-meeting', className, { tablet: width >= TABLET && width < DESKTOP, @@ -33,13 +50,39 @@ export default function WebexInMeeting({ 'desktop-xl': width >= DESKTOP_LARGE, 'remote-sharing': remoteShare !== null, }); + const {NOT_JOINED} = MeetingState; useEffect(() => { setMaxWidth(height ? (height * 16) / 9 : 'none'); }, [height]); + const onCloseHandler = () => { + adapter.meetingsAdapter.clearPasswordRequiredFlag(meetingID); + setEscapedAuthentication(true); + }; + return (