diff --git a/src/providers/AudioVideoProvider/index.tsx b/src/providers/AudioVideoProvider/index.tsx index c03e40a2..05f27a45 100644 --- a/src/providers/AudioVideoProvider/index.tsx +++ b/src/providers/AudioVideoProvider/index.tsx @@ -10,7 +10,7 @@ type AudioVideoValue = AudioVideoFacade | null; export const AudioVideoContext = createContext(null); -const AudioVideoProvider: React.FC> = ({ +export const AudioVideoProvider: React.FC> = ({ children, }) => { const meetingManager = useMeetingManager(); @@ -33,10 +33,8 @@ const AudioVideoProvider: React.FC> = ({ ); }; -const useAudioVideo = (): AudioVideoValue => { +export const useAudioVideo = (): AudioVideoValue => { const audioVideo = useContext(AudioVideoContext); return audioVideo; }; - -export { useAudioVideo, AudioVideoProvider }; diff --git a/src/providers/BackgroundBlurProvider/index.tsx b/src/providers/BackgroundBlurProvider/index.tsx index 822783c3..3050fc77 100644 --- a/src/providers/BackgroundBlurProvider/index.tsx +++ b/src/providers/BackgroundBlurProvider/index.tsx @@ -46,7 +46,7 @@ const BackgroundBlurProviderContext = createContext< BackgroundBlurProviderState | undefined >(undefined); -const BackgroundBlurProvider: FC> = ({ +export const BackgroundBlurProvider: FC> = ({ spec, options, children, @@ -193,7 +193,7 @@ const BackgroundBlurProvider: FC> = ({ ); }; -const useBackgroundBlur = (): BackgroundBlurProviderState => { +export const useBackgroundBlur = (): BackgroundBlurProviderState => { const context = useContext(BackgroundBlurProviderContext); if (!context) { @@ -203,5 +203,3 @@ const useBackgroundBlur = (): BackgroundBlurProviderState => { } return context; }; - -export { BackgroundBlurProvider, useBackgroundBlur }; diff --git a/src/providers/BackgroundReplacementProvider/index.tsx b/src/providers/BackgroundReplacementProvider/index.tsx index 0a8f51a7..8ca9ebec 100644 --- a/src/providers/BackgroundReplacementProvider/index.tsx +++ b/src/providers/BackgroundReplacementProvider/index.tsx @@ -46,11 +46,9 @@ const BackgroundReplacementProviderContext = createContext< BackgroundReplacementProviderState | undefined >(undefined); -const BackgroundReplacementProvider: FC> = ({ - spec, - options, - children, -}) => { +export const BackgroundReplacementProvider: FC< + React.PropsWithChildren +> = ({ spec, options, children }) => { const logger = useLogger(); const [ isBackgroundReplacementSupported, @@ -194,16 +192,15 @@ const BackgroundReplacementProvider: FC> = ({ ); }; -const useBackgroundReplacement = (): BackgroundReplacementProviderState => { - const context = useContext(BackgroundReplacementProviderContext); +export const useBackgroundReplacement = + (): BackgroundReplacementProviderState => { + const context = useContext(BackgroundReplacementProviderContext); - if (!context) { - throw new Error( - 'useBackgroundReplacement must be used within BackgroundReplacementProvider' - ); - } - - return context; -}; + if (!context) { + throw new Error( + 'useBackgroundReplacement must be used within BackgroundReplacementProvider' + ); + } -export { BackgroundReplacementProvider, useBackgroundReplacement }; + return context; + }; diff --git a/src/providers/ContentShareProvider/index.tsx b/src/providers/ContentShareProvider/index.tsx index addb0fda..2fb162d1 100644 --- a/src/providers/ContentShareProvider/index.tsx +++ b/src/providers/ContentShareProvider/index.tsx @@ -25,9 +25,9 @@ const ContentShareContext = createContext(null); const ContentShareControlContext = createContext(null); -const ContentShareProvider: React.FC> = ({ - children, -}) => { +export const ContentShareProvider: React.FC< + React.PropsWithChildren +> = ({ children }) => { const audioVideo = useAudioVideo(); const [state, dispatch] = useReducer(reducer, initialState); const { paused, isLocalUserSharing, isLocalShareLoading } = state; @@ -180,7 +180,7 @@ const ContentShareProvider: React.FC> = ({ ); }; -const useContentShareState = (): ContentShareState => { +export const useContentShareState = (): ContentShareState => { const contentShareState = useContext(ContentShareContext); if (!contentShareState) { @@ -192,7 +192,7 @@ const useContentShareState = (): ContentShareState => { return contentShareState; }; -const useContentShareControls = (): ContentShareControlContextType => { +export const useContentShareControls = (): ContentShareControlContextType => { const context = useContext(ContentShareControlContext); if (!context) { @@ -202,5 +202,3 @@ const useContentShareControls = (): ContentShareControlContextType => { } return context; }; - -export { ContentShareProvider, useContentShareState, useContentShareControls }; diff --git a/src/providers/DevicesProvider/AudioInputProvider.tsx b/src/providers/DevicesProvider/AudioInputProvider.tsx index 63fad950..13050b93 100644 --- a/src/providers/DevicesProvider/AudioInputProvider.tsx +++ b/src/providers/DevicesProvider/AudioInputProvider.tsx @@ -28,7 +28,7 @@ interface Props { const Context = createContext(null); -const AudioInputProvider: React.FC> = ({ +export const AudioInputProvider: React.FC> = ({ children, onDeviceReplacement, }) => { @@ -156,7 +156,7 @@ const AudioInputProvider: React.FC> = ({ return {children}; }; -const useAudioInputs = (): AudioInputContextType => { +export const useAudioInputs = (): AudioInputContextType => { const context = useContext(Context); if (!context) { @@ -165,5 +165,3 @@ const useAudioInputs = (): AudioInputContextType => { return context; }; - -export { AudioInputProvider, useAudioInputs }; diff --git a/src/providers/DevicesProvider/AudioOutputProvider.tsx b/src/providers/DevicesProvider/AudioOutputProvider.tsx index 6f765864..f688db0a 100644 --- a/src/providers/DevicesProvider/AudioOutputProvider.tsx +++ b/src/providers/DevicesProvider/AudioOutputProvider.tsx @@ -17,9 +17,9 @@ import { useMeetingManager } from '../MeetingProvider'; const AudioOutputContext = createContext(null); -const AudioOutputProvider: React.FC> = ({ - children, -}) => { +export const AudioOutputProvider: React.FC< + React.PropsWithChildren +> = ({ children }) => { const logger = useLogger(); const audioVideo = useAudioVideo(); const [audioOutputs, setAudioOutputs] = useState([]); @@ -93,7 +93,7 @@ const AudioOutputProvider: React.FC> = ({ ); }; -const useAudioOutputs = (): AudioOutputContextType => { +export const useAudioOutputs = (): AudioOutputContextType => { const context = useContext(AudioOutputContext); if (!context) { @@ -102,5 +102,3 @@ const useAudioOutputs = (): AudioOutputContextType => { return context; }; - -export { AudioOutputProvider, useAudioOutputs }; diff --git a/src/providers/DevicesProvider/VideoInputProvider.tsx b/src/providers/DevicesProvider/VideoInputProvider.tsx index e430057d..4c9519fb 100644 --- a/src/providers/DevicesProvider/VideoInputProvider.tsx +++ b/src/providers/DevicesProvider/VideoInputProvider.tsx @@ -17,7 +17,7 @@ import { useMeetingManager } from '../MeetingProvider'; const Context = createContext(null); -const VideoInputProvider: React.FC> = ({ +export const VideoInputProvider: React.FC> = ({ children, }) => { const logger = useLogger(); @@ -89,7 +89,7 @@ const VideoInputProvider: React.FC> = ({ return {children}; }; -const useVideoInputs = (): VideoInputContextType => { +export const useVideoInputs = (): VideoInputContextType => { const context = useContext(Context); if (!context) { @@ -98,5 +98,3 @@ const useVideoInputs = (): VideoInputContextType => { return context; }; - -export { VideoInputProvider, useVideoInputs }; diff --git a/src/providers/DevicesProvider/index.tsx b/src/providers/DevicesProvider/index.tsx index d27e1f25..0578978c 100644 --- a/src/providers/DevicesProvider/index.tsx +++ b/src/providers/DevicesProvider/index.tsx @@ -15,7 +15,7 @@ interface Props { ) => Promise; } -const DevicesProvider: React.FC> = ({ +export const DevicesProvider: React.FC> = ({ children, onDeviceReplacement, }) => ( @@ -26,4 +26,4 @@ const DevicesProvider: React.FC> = ({ ); -export { DevicesProvider, useAudioInputs, useAudioOutputs, useVideoInputs }; +export { useAudioInputs, useAudioOutputs, useVideoInputs }; diff --git a/src/providers/FeaturedVideoTileProvider/index.tsx b/src/providers/FeaturedVideoTileProvider/index.tsx index e5f654ac..f94ca335 100644 --- a/src/providers/FeaturedVideoTileProvider/index.tsx +++ b/src/providers/FeaturedVideoTileProvider/index.tsx @@ -21,9 +21,9 @@ const TILE_TRANSITION_DELAY = 1500; const FeaturedTileContext = createContext(null); -const FeaturedVideoTileProvider: React.FC> = ({ - children, -}) => { +export const FeaturedVideoTileProvider: React.FC< + React.PropsWithChildren +> = ({ children }) => { const meetingManager = useMeetingManager(); const { attendeeIdToTileId } = useRemoteVideoTileState(); const activeTileRef = useRef(null); @@ -101,7 +101,7 @@ const FeaturedVideoTileProvider: React.FC> = ({ ); }; -function useFeaturedTileState(): FeaturedTileState { +export function useFeaturedTileState(): FeaturedTileState { const state = useContext(FeaturedTileContext); if (!state) { @@ -112,5 +112,3 @@ function useFeaturedTileState(): FeaturedTileState { return state; } - -export { FeaturedVideoTileProvider, useFeaturedTileState }; diff --git a/src/providers/LocalAudioOutputProvider/index.tsx b/src/providers/LocalAudioOutputProvider/index.tsx index 6ac4a7aa..287eb023 100644 --- a/src/providers/LocalAudioOutputProvider/index.tsx +++ b/src/providers/LocalAudioOutputProvider/index.tsx @@ -17,9 +17,9 @@ import { useLogger } from '../LoggerProvider'; const Context = createContext(null); -const LocalAudioOutputProvider: React.FC> = ({ - children, -}) => { +export const LocalAudioOutputProvider: React.FC< + React.PropsWithChildren +> = ({ children }) => { const logger = useLogger(); const audioVideo = useAudioVideo(); const [isAudioOn, setIsAudioOn] = useState(true); @@ -76,7 +76,7 @@ const LocalAudioOutputProvider: React.FC> = ({ ); }; -const useLocalAudioOutput = (): LocalAudioOutputContextType => { +export const useLocalAudioOutput = (): LocalAudioOutputContextType => { const context = useContext(Context); if (!context) { throw new Error( @@ -85,5 +85,3 @@ const useLocalAudioOutput = (): LocalAudioOutputContextType => { } return context; }; - -export { LocalAudioOutputProvider, useLocalAudioOutput }; diff --git a/src/providers/LocalVideoProvider/index.tsx b/src/providers/LocalVideoProvider/index.tsx index c8a3f6b9..b4c2f65a 100644 --- a/src/providers/LocalVideoProvider/index.tsx +++ b/src/providers/LocalVideoProvider/index.tsx @@ -19,7 +19,7 @@ import { useMeetingManager } from '../MeetingProvider'; const Context = createContext(null); -const LocalVideoProvider: React.FC> = ({ +export const LocalVideoProvider: React.FC> = ({ children, }) => { const logger = useLogger(); @@ -138,7 +138,7 @@ const LocalVideoProvider: React.FC> = ({ return {children}; }; -const useLocalVideo = (): LocalVideoContextType => { +export const useLocalVideo = (): LocalVideoContextType => { const context = useContext(Context); if (!context) { @@ -147,5 +147,3 @@ const useLocalVideo = (): LocalVideoContextType => { return context; }; - -export { LocalVideoProvider, useLocalVideo }; diff --git a/src/providers/MeetingEventProvider/index.tsx b/src/providers/MeetingEventProvider/index.tsx index d87c092a..15573a5a 100644 --- a/src/providers/MeetingEventProvider/index.tsx +++ b/src/providers/MeetingEventProvider/index.tsx @@ -16,9 +16,9 @@ type MeetingEventProviderContextType = export const MeetingEventProviderContext = createContext(undefined); -const MeetingEventProvider: React.FC> = ({ - children, -}) => { +export const MeetingEventProvider: React.FC< + React.PropsWithChildren +> = ({ children }) => { const [meetingEvent, setMeetingEvent] = useState(); const meetingManager = useMeetingManager(); @@ -45,9 +45,7 @@ const MeetingEventProvider: React.FC> = ({ ); }; -const useMeetingEvent = (): MeetingEventProviderContextType => { +export const useMeetingEvent = (): MeetingEventProviderContextType => { const meetingEvent = useContext(MeetingEventProviderContext); return meetingEvent; }; - -export { useMeetingEvent, MeetingEventProvider }; diff --git a/src/providers/NotificationProvider/index.tsx b/src/providers/NotificationProvider/index.tsx index 78e8458c..1b063e07 100644 --- a/src/providers/NotificationProvider/index.tsx +++ b/src/providers/NotificationProvider/index.tsx @@ -16,9 +16,9 @@ import { const StateContext = React.createContext(initialState); const DispatchContext = React.createContext>((): void => {}); -const NotificationProvider: React.FC> = ({ - children, -}) => { +export const NotificationProvider: React.FC< + React.PropsWithChildren +> = ({ children }) => { const [state, dispatch] = useReducer(reducer, initialState); return ( @@ -29,22 +29,14 @@ const NotificationProvider: React.FC> = ({ ); }; -const useNotificationState = () => { +export const useNotificationState = () => { const state = useContext(StateContext); return state; }; -const useNotificationDispatch = () => { +export const useNotificationDispatch = () => { const dispatch = useContext(DispatchContext); return dispatch; }; -export { - NotificationProvider, - useNotificationState, - useNotificationDispatch, - Severity, - NotificationType, - ActionType, - Action, -}; +export { Severity, NotificationType, ActionType, Action }; diff --git a/src/providers/RemoteVideoTileProvider/index.tsx b/src/providers/RemoteVideoTileProvider/index.tsx index 7509b011..7f52a43e 100644 --- a/src/providers/RemoteVideoTileProvider/index.tsx +++ b/src/providers/RemoteVideoTileProvider/index.tsx @@ -9,9 +9,9 @@ import { initialState, reducer, State, VideoTileActionType } from './state'; const Context = createContext(null); -const RemoteVideoTileProvider: React.FC> = ({ - children, -}) => { +export const RemoteVideoTileProvider: React.FC< + React.PropsWithChildren +> = ({ children }) => { const audioVideo = useAudioVideo(); const [state, dispatch] = useReducer(reducer, initialState); @@ -63,7 +63,7 @@ const RemoteVideoTileProvider: React.FC> = ({ return {children}; }; -const useRemoteVideoTileState = (): State => { +export const useRemoteVideoTileState = (): State => { const state = useContext(Context); if (!state) { @@ -74,5 +74,3 @@ const useRemoteVideoTileState = (): State => { return state; }; - -export { RemoteVideoTileProvider, useRemoteVideoTileState }; diff --git a/src/providers/RosterProvider/index.tsx b/src/providers/RosterProvider/index.tsx index 5df2015a..ac3ae887 100644 --- a/src/providers/RosterProvider/index.tsx +++ b/src/providers/RosterProvider/index.tsx @@ -14,7 +14,7 @@ interface RosterContextValue { const RosterContext = React.createContext(null); -const RosterProvider: React.FC> = ({ +export const RosterProvider: React.FC> = ({ children, }) => { const meetingManager = useMeetingManager(); @@ -106,7 +106,7 @@ const RosterProvider: React.FC> = ({ ); }; -function useRosterState(): RosterContextValue { +export function useRosterState(): RosterContextValue { const state = useContext(RosterContext); if (!state) { @@ -115,5 +115,3 @@ function useRosterState(): RosterContextValue { return state; } - -export { RosterProvider, useRosterState }; diff --git a/src/providers/UserActivityProvider/index.tsx b/src/providers/UserActivityProvider/index.tsx index 1c68c969..88e6d89a 100644 --- a/src/providers/UserActivityProvider/index.tsx +++ b/src/providers/UserActivityProvider/index.tsx @@ -14,7 +14,7 @@ export const UserActivityContext = createContext( null ); -const UserActivityProvider: FC> = ({ +export const UserActivityProvider: FC> = ({ children, }) => { const ref = useRef(null); @@ -37,7 +37,7 @@ const UserActivityProvider: FC> = ({ ); }; -function useUserActivityState(): UserActivityState { +export function useUserActivityState(): UserActivityState { const state = useContext(UserActivityContext); if (!state) { @@ -48,5 +48,3 @@ function useUserActivityState(): UserActivityState { return state; } - -export { UserActivityProvider, useUserActivityState }; diff --git a/src/providers/VoiceFocusProvider/index.tsx b/src/providers/VoiceFocusProvider/index.tsx index 9a022073..50c43b21 100644 --- a/src/providers/VoiceFocusProvider/index.tsx +++ b/src/providers/VoiceFocusProvider/index.tsx @@ -37,7 +37,7 @@ interface VoiceFocusState { const VoiceFocusContext = createContext(null); -const VoiceFocusProvider: React.FC> = ({ +export const VoiceFocusProvider: React.FC> = ({ spec, options, createMeetingResponse, @@ -161,7 +161,7 @@ const VoiceFocusProvider: React.FC> = ({ setVoiceFocusDevice(null); setIsVoiceFocusSupported(transformer && transformer.isSupported()); }) - .catch((e) => { + .catch(() => { if (canceled()) { return; } @@ -180,7 +180,7 @@ const VoiceFocusProvider: React.FC> = ({ options: VoiceFocusDeviceOptions | undefined, canceled: () => boolean, createMeetingResponse: JoinMeetingInfo | undefined - ) { + ): Promise { // Throw away the old one and reinitialize. voiceFocusDevice?.stop(); if (voiceFocusTransformer) { @@ -262,7 +262,7 @@ const VoiceFocusProvider: React.FC> = ({ ); }; -const useVoiceFocus = (): VoiceFocusState => { +export const useVoiceFocus = (): VoiceFocusState => { const context = useContext(VoiceFocusContext); if (!context) { @@ -270,5 +270,3 @@ const useVoiceFocus = (): VoiceFocusState => { } return context; }; - -export { VoiceFocusProvider, useVoiceFocus };