@100mslive/roomkit-react 0.1.8 → 0.1.9-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{HLSView-DDGPZHA2.js → HLSView-4JC65BAY.js} +3 -3
- package/dist/Modal/Dialog.d.ts +402 -1706
- package/dist/Prebuilt/App.d.ts +5 -0
- package/dist/Prebuilt/AppContext.d.ts +1 -0
- package/dist/Prebuilt/AppStateContext.d.ts +16 -0
- package/dist/Prebuilt/components/ConferenceScreen.d.ts +2 -0
- package/dist/Prebuilt/components/Footer/PollsToggle.d.ts +2 -0
- package/dist/Prebuilt/components/LeaveScreen.d.ts +2 -0
- package/dist/Prebuilt/components/MwebLandscapePrompt.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/AutoplayBlockedModal.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/HLSFailureModal.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/InitErrorModal.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/Notifications.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/PeerNotifications.d.ts +1 -0
- package/dist/Prebuilt/components/Notifications/PermissionErrorModal.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/ReconnectNotifications.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/TrackBulkUnmuteModal.d.ts +2 -0
- package/dist/Prebuilt/components/Notifications/TrackNotifications.d.ts +1 -0
- package/dist/Prebuilt/components/Notifications/TrackUnmuteModal.d.ts +2 -0
- package/dist/Prebuilt/components/Polls/Polls.d.ts +2 -0
- package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +1 -2
- package/dist/Prebuilt/components/Preview/PreviewScreen.d.ts +2 -0
- package/dist/Prebuilt/components/hooks/useRedirectToLeave.d.ts +1 -1
- package/dist/{VirtualBackground-UVZJVOA2.js → VirtualBackground-MIRXD2HZ.js} +3 -5
- package/dist/{VirtualBackground-UVZJVOA2.js.map → VirtualBackground-MIRXD2HZ.js.map} +1 -1
- package/dist/chunk-322YFA55.js +14441 -0
- package/dist/chunk-322YFA55.js.map +7 -0
- package/dist/{chunk-6SQTFOK6.js → chunk-6UGU3UJL.js} +66 -3
- package/dist/chunk-6UGU3UJL.js.map +7 -0
- package/dist/context/DialogContext.d.ts +6 -0
- package/dist/hooks/useDialogContainerSelector.d.ts +1 -0
- package/dist/index.cjs.js +10944 -9974
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -2
- package/dist/meta.cjs.json +3871 -3188
- package/dist/meta.esbuild.json +4303 -3728
- package/dist/utils/animations.d.ts +11 -0
- package/package.json +6 -7
- package/src/Modal/Dialog.tsx +31 -3
- package/src/Prebuilt/App.tsx +46 -99
- package/src/Prebuilt/AppContext.tsx +4 -0
- package/src/Prebuilt/AppStateContext.tsx +71 -0
- package/src/Prebuilt/common/constants.js +35 -0
- package/src/Prebuilt/common/utils.js +47 -0
- package/src/Prebuilt/components/AppData/AppData.jsx +5 -0
- package/src/Prebuilt/components/AppData/useSidepane.js +23 -1
- package/src/Prebuilt/components/AppData/useUISettings.js +48 -4
- package/src/Prebuilt/components/{conference.jsx → ConferenceScreen.tsx} +30 -43
- package/src/Prebuilt/components/Footer/Footer.tsx +5 -0
- package/src/Prebuilt/components/Footer/PaginatedParticipants.tsx +63 -32
- package/src/Prebuilt/components/Footer/ParticipantList.jsx +2 -1
- package/src/Prebuilt/components/Footer/PollsToggle.tsx +22 -0
- package/src/Prebuilt/components/Footer/RoleAccordion.tsx +2 -2
- package/src/Prebuilt/components/Header/StreamActions.tsx +5 -3
- package/src/Prebuilt/components/Leave/DesktopLeaveRoom.tsx +4 -5
- package/src/Prebuilt/components/Leave/LeaveRoom.tsx +0 -4
- package/src/Prebuilt/components/{PostLeave.jsx → LeaveScreen.tsx} +6 -13
- package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +2 -3
- package/src/Prebuilt/components/MoreSettings/EmbedUrl.jsx +2 -3
- package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +18 -1
- package/src/Prebuilt/components/{MwebLandscapePrompt.jsx → MwebLandscapePrompt.tsx} +10 -11
- package/src/Prebuilt/components/Notifications/{AutoplayBlockedModal.jsx → AutoplayBlockedModal.tsx} +2 -1
- package/src/Prebuilt/components/Notifications/{HLSFailureModal.jsx → HLSFailureModal.tsx} +10 -8
- package/src/Prebuilt/components/Notifications/{InitErrorModal.jsx → InitErrorModal.tsx} +5 -2
- package/src/Prebuilt/components/Notifications/{Notifications.jsx → Notifications.tsx} +41 -27
- package/src/Prebuilt/components/Notifications/{PeerNotifications.jsx → PeerNotifications.tsx} +3 -0
- package/src/Prebuilt/components/Notifications/{PermissionErrorModal.jsx → PermissionErrorModal.tsx} +6 -4
- package/src/Prebuilt/components/Notifications/{ReconnectNotifications.jsx → ReconnectNotifications.tsx} +11 -6
- package/src/Prebuilt/components/Notifications/{TrackBulkUnmuteModal.jsx → TrackBulkUnmuteModal.tsx} +9 -3
- package/src/Prebuilt/components/Notifications/{TrackUnmuteModal.jsx → TrackUnmuteModal.tsx} +9 -3
- package/src/Prebuilt/components/Notifications/index.tsx +1 -0
- package/src/Prebuilt/components/Polls/CreatePollQuiz/PollsQuizMenu.jsx +229 -0
- package/src/Prebuilt/components/Polls/CreatePollQuiz/Timer.jsx +71 -0
- package/src/Prebuilt/components/Polls/CreateQuestions/CreateQuestions.jsx +132 -0
- package/src/Prebuilt/components/Polls/CreateQuestions/DeleteQuestionModal.jsx +66 -0
- package/src/Prebuilt/components/Polls/CreateQuestions/QuestionForm.jsx +251 -0
- package/src/Prebuilt/components/Polls/CreateQuestions/SavedQuestion.jsx +57 -0
- package/src/Prebuilt/components/Polls/Polls.tsx +28 -0
- package/src/Prebuilt/components/Polls/Voting/PollResultSummary.jsx +125 -0
- package/src/Prebuilt/components/Polls/Voting/QuestionCard.jsx +249 -0
- package/src/Prebuilt/components/Polls/Voting/StandardVoting.jsx +40 -0
- package/src/Prebuilt/components/Polls/Voting/TimedVoting.jsx +36 -0
- package/src/Prebuilt/components/Polls/Voting/Voting.jsx +99 -0
- package/src/Prebuilt/components/Polls/common/MultipleChoiceOptions.jsx +101 -0
- package/src/Prebuilt/components/Polls/common/OptionInputWithDelete.jsx +25 -0
- package/src/Prebuilt/components/Polls/common/SingleChoiceOptions.jsx +125 -0
- package/src/Prebuilt/components/Polls/common/StatusIndicator.jsx +47 -0
- package/src/Prebuilt/components/Polls/common/VoteCount.jsx +28 -0
- package/src/Prebuilt/components/Polls/common/VoteProgress.jsx +17 -0
- package/src/Prebuilt/components/Polls/common/VoterList.jsx +22 -0
- package/src/Prebuilt/components/Polls/common/Votes.jsx +72 -0
- package/src/Prebuilt/components/Preview/PreviewForm.tsx +3 -2
- package/src/Prebuilt/components/Preview/PreviewJoin.tsx +32 -27
- package/src/Prebuilt/components/Preview/{PreviewContainer.tsx → PreviewScreen.tsx} +2 -19
- package/src/Prebuilt/components/RaiseHand.jsx +1 -1
- package/src/Prebuilt/components/RoleChangeModal.jsx +2 -3
- package/src/Prebuilt/components/RoleChangeRequest/RequestPrompt.tsx +2 -3
- package/src/Prebuilt/components/Settings/SettingsModal.jsx +2 -3
- package/src/Prebuilt/components/Settings/StartRecording.jsx +15 -4
- package/src/Prebuilt/components/SidePaneTabs.tsx +1 -1
- package/src/Prebuilt/components/StatsForNerds.jsx +2 -3
- package/src/Prebuilt/components/Streaming/Common.jsx +31 -21
- package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +8 -9
- package/src/Prebuilt/components/VideoTile.jsx +37 -33
- package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +3 -3
- package/src/Prebuilt/components/hooks/useRedirectToLeave.tsx +9 -17
- package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +2 -3
- package/src/Prebuilt/components/pdfAnnotator/submitPdf.jsx +1 -1
- package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +2 -3
- package/src/Prebuilt/layouts/EmbedView.jsx +47 -60
- package/src/Prebuilt/layouts/PDFView.jsx +49 -99
- package/src/Prebuilt/layouts/SidePane.tsx +8 -4
- package/src/Prebuilt/layouts/VideoStreamingSection.tsx +2 -2
- package/src/Prebuilt/primitives/DialogContent.jsx +4 -5
- package/src/context/DialogContext.tsx +13 -0
- package/src/hooks/useDialogContainerSelector.tsx +7 -0
- package/src/index.ts +1 -0
- package/src/utils/animations.ts +6 -0
- package/dist/Prebuilt/components/Notifications/HeadlessEndRoomListener.d.ts +0 -2
- package/dist/Prebuilt/components/PrebuiltDialogPortal.d.ts +0 -4
- package/dist/Prebuilt/components/PrebuiltTileElements.d.ts +0 -2198
- package/dist/Prebuilt/components/Preview/PreviewContainer.d.ts +0 -3
- package/dist/chunk-6SQTFOK6.js.map +0 -7
- package/dist/chunk-HUMNPIYI.js +0 -70
- package/dist/chunk-HUMNPIYI.js.map +0 -7
- package/dist/chunk-PRM33R4R.js +0 -7160
- package/dist/chunk-PRM33R4R.js.map +0 -7
- package/dist/conference-N7S47TDK.js +0 -6602
- package/dist/conference-N7S47TDK.js.map +0 -7
- package/src/Prebuilt/components/GoLiveButton.jsx +0 -42
- package/src/Prebuilt/components/Notifications/HeadlessEndRoomListener.tsx +0 -23
- package/src/Prebuilt/components/PrebuiltDialogPortal.tsx +0 -6
- package/src/Prebuilt/components/PrebuiltTileElements.tsx +0 -5
- package/src/Prebuilt/components/Streaming/HLSStreaming.jsx +0 -220
- package/src/Prebuilt/components/Streaming/RTMPStreaming.jsx +0 -334
- package/src/Prebuilt/components/Streaming/StreamingLanding.jsx +0 -76
- /package/dist/{HLSView-DDGPZHA2.js.map → HLSView-4JC65BAY.js.map} +0 -0
- /package/{src/Prebuilt/components/Notifications/index.jsx → dist/Prebuilt/components/Notifications/index.d.ts} +0 -0
- /package/src/Prebuilt/components/Notifications/{TrackNotifications.jsx → TrackNotifications.tsx} +0 -0
@@ -6,6 +6,17 @@ export declare const slideUp: (controller: string) => {
|
|
6
6
|
(): string;
|
7
7
|
name: string;
|
8
8
|
};
|
9
|
+
export declare const translateAcross: ({ xFrom, yFrom, zFrom, xTo, yTo, zTo }: {
|
10
|
+
xFrom?: string | undefined;
|
11
|
+
yFrom?: string | undefined;
|
12
|
+
zFrom?: string | undefined;
|
13
|
+
xTo?: string | undefined;
|
14
|
+
yTo?: string | undefined;
|
15
|
+
zTo?: string | undefined;
|
16
|
+
}) => {
|
17
|
+
(): string;
|
18
|
+
name: string;
|
19
|
+
};
|
9
20
|
export declare const dialogOpen: {
|
10
21
|
(): string;
|
11
22
|
name: string;
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"prebuilt",
|
11
11
|
"roomkit"
|
12
12
|
],
|
13
|
-
"version": "0.1.
|
13
|
+
"version": "0.1.9-alpha.1",
|
14
14
|
"author": "100ms",
|
15
15
|
"license": "MIT",
|
16
16
|
"files": [
|
@@ -76,10 +76,10 @@
|
|
76
76
|
"react": ">=17.0.2 <19.0.0"
|
77
77
|
},
|
78
78
|
"dependencies": {
|
79
|
-
"@100mslive/hls-player": "0.1.
|
80
|
-
"@100mslive/hms-virtual-background": "1.11.
|
81
|
-
"@100mslive/react-icons": "0.8.
|
82
|
-
"@100mslive/react-sdk": "0.8.
|
79
|
+
"@100mslive/hls-player": "0.1.18-alpha.1",
|
80
|
+
"@100mslive/hms-virtual-background": "1.11.18-alpha.1",
|
81
|
+
"@100mslive/react-icons": "0.8.18-alpha.1",
|
82
|
+
"@100mslive/react-sdk": "0.8.18-alpha.1",
|
83
83
|
"@100mslive/types-prebuilt": "0.12.0",
|
84
84
|
"@emoji-mart/data": "^1.0.6",
|
85
85
|
"@emoji-mart/react": "^1.0.1",
|
@@ -106,7 +106,6 @@
|
|
106
106
|
"qrcode.react": "^3.1.0",
|
107
107
|
"react-draggable": "^4.4.5",
|
108
108
|
"react-intersection-observer": "^9.4.3",
|
109
|
-
"react-router-dom": "^6.3.0",
|
110
109
|
"react-use": "^17.4.0",
|
111
110
|
"react-virtualized-auto-sizer": "^1.0.7",
|
112
111
|
"react-window": "^1.8.7",
|
@@ -115,5 +114,5 @@
|
|
115
114
|
"uuid": "^8.3.2",
|
116
115
|
"worker-timers": "^7.0.40"
|
117
116
|
},
|
118
|
-
"gitHead": "
|
117
|
+
"gitHead": "ac35df485fe756c88bd2ebd40e421475ec748bb1"
|
119
118
|
}
|
package/src/Modal/Dialog.tsx
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
import React, { ReactNode, useRef } from 'react';
|
1
2
|
import { Root } from '@radix-ui/react-dialog';
|
2
3
|
import { styled } from '@stitches/react';
|
4
|
+
import { CSS } from '../Theme';
|
3
5
|
import {
|
4
6
|
DialogClose,
|
5
7
|
DialogDefaultCloseIcon,
|
@@ -10,17 +12,43 @@ import {
|
|
10
12
|
StyledDialogPortal,
|
11
13
|
StyledDialogTrigger,
|
12
14
|
} from './DialogContent';
|
15
|
+
import { useDialogContainerSelector } from '../hooks/useDialogContainerSelector';
|
13
16
|
|
14
17
|
const StyledDialog = styled(Root, {});
|
18
|
+
const CustomDialogContent = ({ children, props = {}, css = {} }: { children: ReactNode; props?: any; css?: CSS }) => (
|
19
|
+
<StyledDialogContent css={{ ...css, position: 'absolute' }} {...props}>
|
20
|
+
{children}
|
21
|
+
</StyledDialogContent>
|
22
|
+
);
|
23
|
+
const CustomDialogOverlay = ({ css = {} }: { css?: CSS }) => (
|
24
|
+
<StyledDialogOverlay css={{ ...css, position: 'absolute' }} />
|
25
|
+
);
|
26
|
+
const CustomDialogPortal = ({ children, container }: { children: ReactNode; container?: HTMLElement | null }) => {
|
27
|
+
const dialogContainerSelector = useDialogContainerSelector();
|
28
|
+
const containerRef = useRef<HTMLElement | null>(null);
|
29
|
+
|
30
|
+
if (container) {
|
31
|
+
containerRef.current = container;
|
32
|
+
} else if (dialogContainerSelector && !containerRef.current) {
|
33
|
+
containerRef.current = document.querySelector(dialogContainerSelector) as HTMLElement;
|
34
|
+
} else if (!containerRef.current) {
|
35
|
+
containerRef.current = document.body;
|
36
|
+
}
|
37
|
+
return (
|
38
|
+
<StyledDialogPortal container={containerRef.current}>
|
39
|
+
<>{children}</>
|
40
|
+
</StyledDialogPortal>
|
41
|
+
);
|
42
|
+
};
|
15
43
|
|
16
44
|
export const Dialog = {
|
17
45
|
Root: StyledDialog,
|
18
46
|
Trigger: StyledDialogTrigger,
|
19
|
-
Overlay:
|
20
|
-
Content:
|
47
|
+
Overlay: CustomDialogOverlay,
|
48
|
+
Content: CustomDialogContent,
|
21
49
|
Title: DialogTitle,
|
22
50
|
Description: DialogDescription,
|
23
51
|
Close: DialogClose,
|
24
52
|
DefaultClose: DialogDefaultCloseIcon,
|
25
|
-
Portal:
|
53
|
+
Portal: CustomDialogPortal,
|
26
54
|
};
|
package/src/Prebuilt/App.tsx
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import React, { MutableRefObject,
|
2
|
-
import { BrowserRouter, MemoryRouter, Navigate, Route, Routes, useParams } from 'react-router-dom';
|
1
|
+
import React, { MutableRefObject, useEffect, useRef } from 'react';
|
3
2
|
import { HMSStatsStoreWrapper, HMSStoreWrapper, IHMSNotifications } from '@100mslive/hms-video-store';
|
4
3
|
import { Layout, Logo, Screens, Theme, Typography } from '@100mslive/types-prebuilt';
|
5
4
|
import {
|
@@ -14,27 +13,25 @@ import {
|
|
14
13
|
import { AppData } from './components/AppData/AppData';
|
15
14
|
// @ts-ignore: No implicit Any
|
16
15
|
import AuthToken from './components/AuthToken';
|
16
|
+
import { ConferenceScreen } from './components/ConferenceScreen';
|
17
17
|
// @ts-ignore: No implicit Any
|
18
18
|
import { ErrorBoundary } from './components/ErrorBoundary';
|
19
19
|
// @ts-ignore: No implicit Any
|
20
|
-
import FullPageProgress from './components/FullPageProgress';
|
21
|
-
// @ts-ignore: No implicit Any
|
22
20
|
import { Init } from './components/init/Init';
|
23
21
|
// @ts-ignore: No implicit Any
|
24
22
|
import { KeyboardHandler } from './components/Input/KeyboardInputManager';
|
25
|
-
|
23
|
+
import { LeaveScreen } from './components/LeaveScreen';
|
24
|
+
import { MwebLandscapePrompt } from './components/MwebLandscapePrompt';
|
26
25
|
import { Notifications } from './components/Notifications';
|
27
|
-
import {
|
28
|
-
// @ts-ignore: No implicit Any
|
29
|
-
import PostLeave from './components/PostLeave';
|
30
|
-
// @ts-ignore: No implicit Any
|
31
|
-
import PreviewContainer from './components/Preview/PreviewContainer';
|
26
|
+
import { PreviewScreen } from './components/Preview/PreviewScreen';
|
32
27
|
// @ts-ignore: No implicit Any
|
33
28
|
import { ToastContainer } from './components/Toast/ToastContainer';
|
34
29
|
import { RoomLayoutContext, RoomLayoutProvider, useRoomLayout } from './provider/roomLayoutProvider';
|
30
|
+
import { DialogContainerProvider } from '../context/DialogContext';
|
35
31
|
import { Box } from '../Layout';
|
36
32
|
import { globalStyles, HMSThemeProvider } from '../Theme';
|
37
|
-
import { HMSPrebuiltContext
|
33
|
+
import { HMSPrebuiltContext } from './AppContext';
|
34
|
+
import { AppStateContext, PrebuiltStates, useAppStateManager } from './AppStateContext';
|
38
35
|
// @ts-ignore: No implicit Any
|
39
36
|
import { FlyingEmoji } from './plugins/FlyingEmoji';
|
40
37
|
// @ts-ignore: No implicit Any
|
@@ -48,9 +45,8 @@ import {
|
|
48
45
|
} from './provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
|
49
46
|
// @ts-ignore: No implicit Any
|
50
47
|
import { FeatureFlags } from './services/FeatureFlags';
|
51
|
-
|
52
48
|
// @ts-ignore: No implicit Any
|
53
|
-
|
49
|
+
import { DEFAULT_PORTAL_CONTAINER } from './common/constants';
|
54
50
|
|
55
51
|
export type HMSPrebuiltOptions = {
|
56
52
|
userName?: string;
|
@@ -70,6 +66,11 @@ export type HMSPrebuiltProps = {
|
|
70
66
|
role?: string;
|
71
67
|
onLeave?: () => void;
|
72
68
|
onJoin?: () => void;
|
69
|
+
/**
|
70
|
+
* @remarks
|
71
|
+
* Specify css selectors for the HTML element to be used as container for dialogs. Affects the positioning and focus of dialogs.
|
72
|
+
*/
|
73
|
+
containerSelector?: string;
|
73
74
|
};
|
74
75
|
|
75
76
|
export type HMSPrebuiltRefType = {
|
@@ -86,6 +87,7 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
|
|
86
87
|
authToken = '',
|
87
88
|
roomId = '',
|
88
89
|
role = '',
|
90
|
+
containerSelector = DEFAULT_PORTAL_CONTAINER,
|
89
91
|
logo,
|
90
92
|
typography,
|
91
93
|
themes,
|
@@ -174,6 +176,7 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
|
|
174
176
|
roomCode,
|
175
177
|
roomId,
|
176
178
|
role,
|
179
|
+
containerSelector,
|
177
180
|
onLeave,
|
178
181
|
onJoin,
|
179
182
|
userName,
|
@@ -221,17 +224,23 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
|
|
221
224
|
>
|
222
225
|
<AppData appDetails={metadata} tokenEndpoint={tokenByRoomIdRoleEndpoint} />
|
223
226
|
<Init />
|
224
|
-
<
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
227
|
+
<DialogContainerProvider dialogContainerSelector={containerSelector}>
|
228
|
+
<Box
|
229
|
+
id={DEFAULT_PORTAL_CONTAINER.slice(1)} //Skips the #
|
230
|
+
css={{
|
231
|
+
bg: '$background_dim',
|
232
|
+
size: '100%',
|
233
|
+
lineHeight: '1.5',
|
234
|
+
'-webkit-text-size-adjust': '100%',
|
235
|
+
position: 'relative',
|
236
|
+
}}
|
237
|
+
>
|
238
|
+
<AppRoutes
|
239
|
+
authTokenByRoomCodeEndpoint={tokenByRoomCodeEndpoint}
|
240
|
+
defaultAuthToken={authToken}
|
241
|
+
/>
|
242
|
+
</Box>
|
243
|
+
</DialogContainerProvider>
|
235
244
|
</HMSThemeProvider>
|
236
245
|
);
|
237
246
|
}}
|
@@ -246,66 +255,17 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
|
|
246
255
|
|
247
256
|
HMSPrebuilt.displayName = 'HMSPrebuilt';
|
248
257
|
|
249
|
-
const
|
250
|
-
const { roomId, role } = useParams();
|
251
|
-
return <Navigate to={`/${showPreview ? 'preview' : 'meeting'}/${roomId}/${role || ''}`} />;
|
252
|
-
};
|
253
|
-
|
254
|
-
const RouteList = () => {
|
258
|
+
const AppStates = ({ activeState }: { activeState: PrebuiltStates }) => {
|
255
259
|
const { isPreviewScreenEnabled } = useRoomLayoutPreviewScreen();
|
256
260
|
const { isLeaveScreenEnabled } = useRoomLayoutLeaveScreen();
|
257
261
|
useAutoStartStreaming();
|
258
|
-
return (
|
259
|
-
<Routes>
|
260
|
-
{isPreviewScreenEnabled ? (
|
261
|
-
<Route path="preview">
|
262
|
-
<Route
|
263
|
-
path=":roomId/:role"
|
264
|
-
element={
|
265
|
-
<Suspense fallback={<FullPageProgress text="Loading preview..." />}>
|
266
|
-
<PreviewContainer />
|
267
|
-
</Suspense>
|
268
|
-
}
|
269
|
-
/>
|
270
|
-
<Route
|
271
|
-
path=":roomId"
|
272
|
-
element={
|
273
|
-
<Suspense fallback={<FullPageProgress text="Loading preview..." />}>
|
274
|
-
<PreviewContainer />
|
275
|
-
</Suspense>
|
276
|
-
}
|
277
|
-
/>
|
278
|
-
</Route>
|
279
|
-
) : null}
|
280
|
-
<Route path="meeting">
|
281
|
-
<Route
|
282
|
-
path=":roomId/:role"
|
283
|
-
element={
|
284
|
-
<Suspense fallback={<FullPageProgress text="Joining..." />}>
|
285
|
-
<Conference />
|
286
|
-
</Suspense>
|
287
|
-
}
|
288
|
-
/>
|
289
|
-
<Route
|
290
|
-
path=":roomId"
|
291
|
-
element={
|
292
|
-
<Suspense fallback={<FullPageProgress text="Joining..." />}>
|
293
|
-
<Conference />
|
294
|
-
</Suspense>
|
295
|
-
}
|
296
|
-
/>
|
297
|
-
</Route>
|
298
|
-
{isLeaveScreenEnabled ? (
|
299
|
-
<Route path="leave">
|
300
|
-
<Route path=":roomId/:role" element={<PostLeave />} />
|
301
|
-
<Route path=":roomId" element={<PostLeave />} />
|
302
|
-
</Route>
|
303
|
-
) : null}
|
304
262
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
263
|
+
if (activeState === PrebuiltStates.PREVIEW && isPreviewScreenEnabled) {
|
264
|
+
return <PreviewScreen />;
|
265
|
+
} else if (activeState === PrebuiltStates.LEAVE && isLeaveScreenEnabled) {
|
266
|
+
return <LeaveScreen />;
|
267
|
+
}
|
268
|
+
return <ConferenceScreen />;
|
309
269
|
};
|
310
270
|
|
311
271
|
const BackSwipe = () => {
|
@@ -325,17 +285,6 @@ const BackSwipe = () => {
|
|
325
285
|
return null;
|
326
286
|
};
|
327
287
|
|
328
|
-
const Router = ({ children }: { children: ReactElement }) => {
|
329
|
-
const { roomId, role, roomCode } = useHMSPrebuiltContext();
|
330
|
-
return [roomId, role, roomCode].every(value => !value) ? (
|
331
|
-
<BrowserRouter>{children}</BrowserRouter>
|
332
|
-
) : (
|
333
|
-
<MemoryRouter initialEntries={[`/${roomCode ? roomCode : `${roomId}/${role || ''}`}`]} initialIndex={0}>
|
334
|
-
{children}
|
335
|
-
</MemoryRouter>
|
336
|
-
);
|
337
|
-
};
|
338
|
-
|
339
288
|
function AppRoutes({
|
340
289
|
authTokenByRoomCodeEndpoint,
|
341
290
|
defaultAuthToken,
|
@@ -345,23 +294,21 @@ function AppRoutes({
|
|
345
294
|
}) {
|
346
295
|
const roomLayout = useRoomLayout();
|
347
296
|
const isNotificationsDisabled = useIsNotificationDisabled();
|
297
|
+
const { activeState, rejoin } = useAppStateManager();
|
298
|
+
|
348
299
|
return (
|
349
|
-
<
|
300
|
+
<AppStateContext.Provider value={{ rejoin }}>
|
350
301
|
<>
|
351
302
|
<ToastContainer />
|
352
303
|
<Notifications />
|
304
|
+
<MwebLandscapePrompt />
|
353
305
|
<BackSwipe />
|
354
306
|
{!isNotificationsDisabled && <FlyingEmoji />}
|
355
307
|
<RemoteStopScreenshare />
|
356
|
-
<HeadlessEndRoomListener />
|
357
308
|
<KeyboardHandler />
|
358
309
|
<AuthToken authTokenByRoomCodeEndpoint={authTokenByRoomCodeEndpoint} defaultAuthToken={defaultAuthToken} />
|
359
|
-
{roomLayout &&
|
360
|
-
<Routes>
|
361
|
-
<Route path="/*" element={<RouteList />} />
|
362
|
-
</Routes>
|
363
|
-
)}
|
310
|
+
{roomLayout && activeState && <AppStates activeState={activeState} />}
|
364
311
|
</>
|
365
|
-
</
|
312
|
+
</AppStateContext.Provider>
|
366
313
|
);
|
367
314
|
}
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import React, { useContext } from 'react';
|
2
|
+
// @ts-ignore
|
3
|
+
import { DEFAULT_PORTAL_CONTAINER } from './common/constants';
|
2
4
|
|
3
5
|
type HMSPrebuiltContextType = {
|
4
6
|
roomCode: string;
|
@@ -6,6 +8,7 @@ type HMSPrebuiltContextType = {
|
|
6
8
|
role?: string;
|
7
9
|
userName?: string;
|
8
10
|
userId?: string;
|
11
|
+
containerSelector: string;
|
9
12
|
endpoints?: Record<string, string>;
|
10
13
|
onLeave?: () => void;
|
11
14
|
onJoin?: () => void;
|
@@ -15,6 +18,7 @@ export const HMSPrebuiltContext = React.createContext<HMSPrebuiltContextType>({
|
|
15
18
|
roomCode: '',
|
16
19
|
userName: '',
|
17
20
|
userId: '',
|
21
|
+
containerSelector: DEFAULT_PORTAL_CONTAINER,
|
18
22
|
endpoints: {},
|
19
23
|
onLeave: undefined,
|
20
24
|
onJoin: undefined,
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import React, { useContext, useEffect } from 'react';
|
2
|
+
import { usePreviousDistinct } from 'react-use';
|
3
|
+
import { HMSRoomState, selectRoomState, useHMSStore } from '@100mslive/react-sdk';
|
4
|
+
import { useRoomLayout } from './provider/roomLayoutProvider';
|
5
|
+
import { useRedirectToLeave } from './components/hooks/useRedirectToLeave';
|
6
|
+
import {
|
7
|
+
useRoomLayoutLeaveScreen,
|
8
|
+
useRoomLayoutPreviewScreen,
|
9
|
+
} from './provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
|
10
|
+
|
11
|
+
export enum PrebuiltStates {
|
12
|
+
MEETING = 'meeting',
|
13
|
+
PREVIEW = 'preview',
|
14
|
+
LEAVE = 'leave',
|
15
|
+
}
|
16
|
+
|
17
|
+
type AppStateContextType = {
|
18
|
+
rejoin: () => void;
|
19
|
+
};
|
20
|
+
|
21
|
+
export const AppStateContext = React.createContext<AppStateContextType>({
|
22
|
+
rejoin: () => {
|
23
|
+
console.log('Rejoin');
|
24
|
+
},
|
25
|
+
});
|
26
|
+
|
27
|
+
AppStateContext.displayName = 'AppStateContext';
|
28
|
+
|
29
|
+
export const useHMSAppStateContext = () => {
|
30
|
+
const context = useContext(AppStateContext);
|
31
|
+
if (!context) {
|
32
|
+
throw Error('Make sure AppStateContext.Provider is present at the top level of your application');
|
33
|
+
}
|
34
|
+
return context;
|
35
|
+
};
|
36
|
+
|
37
|
+
export const useAppStateManager = () => {
|
38
|
+
const roomLayout = useRoomLayout();
|
39
|
+
const [activeState, setActiveState] = React.useState<PrebuiltStates | undefined>();
|
40
|
+
const roomState = useHMSStore(selectRoomState);
|
41
|
+
const prevRoomState = usePreviousDistinct(roomState);
|
42
|
+
const { isLeaveScreenEnabled } = useRoomLayoutLeaveScreen();
|
43
|
+
const { isPreviewScreenEnabled } = useRoomLayoutPreviewScreen();
|
44
|
+
const { redirectToLeave } = useRedirectToLeave();
|
45
|
+
|
46
|
+
const rejoin = () => {
|
47
|
+
setActiveState(isPreviewScreenEnabled ? PrebuiltStates.PREVIEW : PrebuiltStates.MEETING);
|
48
|
+
};
|
49
|
+
|
50
|
+
useEffect(() => {
|
51
|
+
if (!roomLayout) {
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
if (roomState === HMSRoomState.Connected) {
|
55
|
+
setActiveState(PrebuiltStates.MEETING);
|
56
|
+
} else if (
|
57
|
+
prevRoomState &&
|
58
|
+
[HMSRoomState.Reconnecting, HMSRoomState.Connected].includes(prevRoomState) &&
|
59
|
+
[HMSRoomState.Disconnecting, HMSRoomState.Disconnected].includes(roomState)
|
60
|
+
) {
|
61
|
+
redirectToLeave().then(() => {
|
62
|
+
const goTo = isPreviewScreenEnabled ? PrebuiltStates.PREVIEW : PrebuiltStates.MEETING;
|
63
|
+
setActiveState(isLeaveScreenEnabled ? PrebuiltStates.LEAVE : goTo);
|
64
|
+
});
|
65
|
+
} else if (!prevRoomState && roomState === HMSRoomState.Disconnected) {
|
66
|
+
setActiveState(isPreviewScreenEnabled ? PrebuiltStates.PREVIEW : PrebuiltStates.MEETING);
|
67
|
+
}
|
68
|
+
}, [roomLayout, roomState, isLeaveScreenEnabled, isPreviewScreenEnabled, prevRoomState, redirectToLeave]);
|
69
|
+
|
70
|
+
return { activeState, rejoin };
|
71
|
+
};
|
@@ -45,6 +45,7 @@ export const APP_DATA = {
|
|
45
45
|
minimiseInset: 'minimiseInset',
|
46
46
|
activeScreensharePeerId: 'activeScreensharePeerId',
|
47
47
|
disableNotifications: 'disableNotifications',
|
48
|
+
pollState: 'pollState',
|
48
49
|
};
|
49
50
|
export const UI_SETTINGS = {
|
50
51
|
isAudioOnly: 'isAudioOnly',
|
@@ -59,6 +60,19 @@ export const SIDE_PANE_OPTIONS = {
|
|
59
60
|
PARTICIPANTS: 'Participants',
|
60
61
|
CHAT: 'Chat',
|
61
62
|
STREAMING: 'STREAMING',
|
63
|
+
POLLS: 'POLLS',
|
64
|
+
};
|
65
|
+
|
66
|
+
export const POLL_STATE = {
|
67
|
+
pollInView: 'pollInView',
|
68
|
+
view: 'view',
|
69
|
+
};
|
70
|
+
|
71
|
+
export const POLL_VIEWS = {
|
72
|
+
CREATE_POLL_QUIZ: 'CREATE_POLL_QUIZ',
|
73
|
+
CREATE_QUESTIONS: 'CREATE_QUESTIONS',
|
74
|
+
VOTE: 'VOTE',
|
75
|
+
RESULTS: 'RESULTS',
|
62
76
|
};
|
63
77
|
|
64
78
|
export const SUBSCRIBED_NOTIFICATIONS = {
|
@@ -93,4 +107,25 @@ export const SESSION_STORE_KEY = {
|
|
93
107
|
SPOTLIGHT: 'spotlight',
|
94
108
|
};
|
95
109
|
|
110
|
+
export const INTERACTION_TYPE = {
|
111
|
+
POLL: 'Poll',
|
112
|
+
QUIZ: 'Quiz',
|
113
|
+
};
|
114
|
+
|
115
|
+
export const QUESTION_TYPE_TITLE = {
|
116
|
+
'single-choice': 'Single Choice',
|
117
|
+
'multiple-choice': 'Multiple Choice',
|
118
|
+
// "short-answer": "Short Answer",
|
119
|
+
// "long-answer": "Long Answer",
|
120
|
+
};
|
121
|
+
|
122
|
+
export const QUESTION_TYPE = {
|
123
|
+
SINGLE_CHOICE: 'single-choice',
|
124
|
+
MULTIPLE_CHOICE: 'multiple-choice',
|
125
|
+
// SHORT_ANSWER: "short-answer",
|
126
|
+
// LONG_ANSWER: "long-answer",
|
127
|
+
};
|
128
|
+
|
96
129
|
export const ROLE_CHANGE_DECLINED = 'role_change_declined';
|
130
|
+
|
131
|
+
export const DEFAULT_PORTAL_CONTAINER = '#prebuilt-container';
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { QUESTION_TYPE } from './constants';
|
2
|
+
|
1
3
|
// eslint-disable-next-line complexity
|
2
4
|
export function shadeColor(color, percent) {
|
3
5
|
let R = parseInt(color.substring(1, 3), 16);
|
@@ -88,3 +90,48 @@ export const formatTime = timeInSeconds => {
|
|
88
90
|
const hour = hours !== 0 ? `${hours < 10 ? '0' : ''}${hours}:` : '';
|
89
91
|
return `${hour}${minutes < 10 ? '0' : ''}${minutes}:${seconds < 10 ? '0' : ''}${seconds}`;
|
90
92
|
};
|
93
|
+
|
94
|
+
const compareArrays = (a, b) => {
|
95
|
+
if (a.length !== b.length) return false;
|
96
|
+
else {
|
97
|
+
// Comparing each element of your array
|
98
|
+
for (var i = 0; i < a.length; i++) {
|
99
|
+
if (a[i] !== b[i]) {
|
100
|
+
return false;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
return true;
|
104
|
+
}
|
105
|
+
};
|
106
|
+
|
107
|
+
export const checkCorrectAnswer = (answer, localPeerResponse, type) => {
|
108
|
+
if (type === QUESTION_TYPE.SINGLE_CHOICE) {
|
109
|
+
return answer?.option === localPeerResponse?.option;
|
110
|
+
} else if (type === QUESTION_TYPE.MULTIPLE_CHOICE) {
|
111
|
+
return answer?.options && localPeerResponse?.options && compareArrays(answer?.options, localPeerResponse?.options);
|
112
|
+
}
|
113
|
+
};
|
114
|
+
|
115
|
+
export const isValidTextInput = (text, minLength = 1, maxLength = 100) => {
|
116
|
+
return text && text.length >= minLength && text.length <= maxLength;
|
117
|
+
};
|
118
|
+
|
119
|
+
export const calculateAvatarAndAttribBoxSize = (calculatedWidth, calculatedHeight) => {
|
120
|
+
if (!calculatedWidth || !calculatedHeight) {
|
121
|
+
return [undefined, undefined];
|
122
|
+
}
|
123
|
+
|
124
|
+
let avatarSize = 'large';
|
125
|
+
if (calculatedWidth <= 150 || calculatedHeight <= 150) {
|
126
|
+
avatarSize = 'small';
|
127
|
+
} else if (calculatedWidth <= 300 || calculatedHeight <= 300) {
|
128
|
+
avatarSize = 'medium';
|
129
|
+
}
|
130
|
+
|
131
|
+
let attribBoxSize = 'medium';
|
132
|
+
if (calculatedWidth <= 180 || calculatedHeight <= 180) {
|
133
|
+
attribBoxSize = 'small';
|
134
|
+
}
|
135
|
+
|
136
|
+
return [avatarSize, attribBoxSize];
|
137
|
+
};
|
@@ -21,6 +21,7 @@ import {
|
|
21
21
|
APP_DATA,
|
22
22
|
CHAT_SELECTOR,
|
23
23
|
DEFAULT_WAITING_VIEWER_ROLE,
|
24
|
+
POLL_STATE,
|
24
25
|
SIDE_PANE_OPTIONS,
|
25
26
|
UI_MODE_GRID,
|
26
27
|
UI_SETTINGS,
|
@@ -66,6 +67,10 @@ const initialAppData = {
|
|
66
67
|
[APP_DATA.minimiseInset]: false,
|
67
68
|
[APP_DATA.activeScreensharePeerId]: '',
|
68
69
|
[APP_DATA.disableNotifications]: false,
|
70
|
+
[APP_DATA.pollState]: {
|
71
|
+
[POLL_STATE.pollInView]: '',
|
72
|
+
[POLL_STATE.view]: '',
|
73
|
+
},
|
69
74
|
};
|
70
75
|
|
71
76
|
export const AppData = React.memo(({ appDetails, tokenEndpoint }) => {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { useCallback } from 'react';
|
2
2
|
import { selectAppData, useHMSActions, useHMSStore, useHMSVanillaStore } from '@100mslive/react-sdk';
|
3
|
-
import {
|
3
|
+
import { usePollViewState } from './useUISettings';
|
4
|
+
import { APP_DATA, POLL_STATE, POLL_VIEWS, SIDE_PANE_OPTIONS } from '../../common/constants';
|
4
5
|
|
5
6
|
/**
|
6
7
|
* Gives a boolean value if the sidepaneType matches current sidepane value in store
|
@@ -37,6 +38,26 @@ export const useSidepaneToggle = sidepaneType => {
|
|
37
38
|
return toggleSidepane;
|
38
39
|
};
|
39
40
|
|
41
|
+
export const usePollViewToggle = () => {
|
42
|
+
const { view, setPollState } = usePollViewState();
|
43
|
+
const isOpen = useSidepaneState() === SIDE_PANE_OPTIONS.POLLS;
|
44
|
+
const toggleSidepane = useSidepaneToggle(SIDE_PANE_OPTIONS.POLLS);
|
45
|
+
|
46
|
+
const togglePollView = useCallback(
|
47
|
+
id => {
|
48
|
+
id = typeof id === 'string' ? id : undefined;
|
49
|
+
setPollState({
|
50
|
+
[POLL_STATE.pollInView]: id,
|
51
|
+
[POLL_STATE.view]: id ? POLL_VIEWS.VOTE : isOpen && view ? null : POLL_VIEWS.CREATE_POLL_QUIZ,
|
52
|
+
});
|
53
|
+
toggleSidepane();
|
54
|
+
},
|
55
|
+
[view, setPollState, isOpen, toggleSidepane],
|
56
|
+
);
|
57
|
+
|
58
|
+
return togglePollView;
|
59
|
+
};
|
60
|
+
|
40
61
|
/**
|
41
62
|
* reset's the sidepane value
|
42
63
|
*/
|
@@ -44,6 +65,7 @@ export const useSidepaneReset = () => {
|
|
44
65
|
const hmsActions = useHMSActions();
|
45
66
|
const resetSidepane = useCallback(() => {
|
46
67
|
hmsActions.setAppData(APP_DATA.sidePane, '');
|
68
|
+
hmsActions.setAppData(APP_DATA.pollInView, '');
|
47
69
|
}, [hmsActions]);
|
48
70
|
return resetSidepane;
|
49
71
|
};
|