@100mslive/roomkit-react 0.1.8-alpha.0 → 0.1.9-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{HLSView-IQRPLYNH.js → HLSView-U53QN3AC.js} +3 -3
- package/dist/Modal/Dialog.d.ts +402 -1706
- package/dist/Prebuilt/App.d.ts +6 -0
- package/dist/Prebuilt/AppContext.d.ts +2 -0
- package/dist/Prebuilt/AppStateContext.d.ts +16 -0
- package/dist/Prebuilt/components/ConferenceScreen.d.ts +2 -0
- package/dist/Prebuilt/components/Footer/PaginatedParticipants.d.ts +5 -0
- package/dist/Prebuilt/components/Footer/PollsToggle.d.ts +2 -0
- package/dist/Prebuilt/components/Footer/RoleAccordion.d.ts +10 -3
- 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-GP4ATXD3.js → VirtualBackground-PMLQPJB6.js} +3 -5
- package/dist/{VirtualBackground-GP4ATXD3.js.map → VirtualBackground-PMLQPJB6.js.map} +1 -1
- package/dist/chunk-ANQRGVIX.js +14441 -0
- package/dist/chunk-ANQRGVIX.js.map +7 -0
- package/dist/{chunk-Z3O2WGWV.js → chunk-XQ2NRKIW.js} +66 -3
- package/dist/chunk-XQ2NRKIW.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 +10956 -9818
- 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 +4076 -3201
- package/dist/meta.esbuild.json +4391 -3623
- package/dist/utils/animations.d.ts +11 -0
- package/package.json +6 -7
- package/src/AudioLevel/AudioLevel.tsx +1 -1
- package/src/Modal/Dialog.tsx +31 -3
- package/src/Prebuilt/App.tsx +49 -97
- package/src/Prebuilt/AppContext.tsx +6 -0
- package/src/Prebuilt/AppStateContext.tsx +71 -0
- package/src/Prebuilt/common/constants.js +36 -1
- package/src/Prebuilt/common/utils.js +47 -0
- package/src/Prebuilt/components/AppData/AppData.jsx +6 -1
- package/src/Prebuilt/components/AppData/useSidepane.js +23 -1
- package/src/Prebuilt/components/AppData/useUISettings.js +49 -5
- package/src/Prebuilt/components/Chip.tsx +6 -2
- package/src/Prebuilt/components/{conference.jsx → ConferenceScreen.tsx} +34 -46
- package/src/Prebuilt/components/Footer/Footer.tsx +5 -0
- package/src/Prebuilt/components/Footer/PaginatedParticipants.tsx +125 -0
- package/src/Prebuilt/components/Footer/ParticipantList.jsx +55 -24
- package/src/Prebuilt/components/Footer/PollsToggle.tsx +22 -0
- package/src/Prebuilt/components/Footer/RoleAccordion.tsx +87 -85
- package/src/Prebuilt/components/Footer/RoleOptions.tsx +1 -1
- 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 +29 -21
- 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 +32 -6
- 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 +28 -39
- package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +3 -3
- package/src/Prebuilt/components/hooks/useDropdownSelection.jsx +1 -1
- 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 +9 -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/PrebuiltDialogPortal.d.ts +0 -4
- package/dist/Prebuilt/components/Preview/PreviewContainer.d.ts +0 -3
- package/dist/chunk-2H5NIZB7.js +0 -70
- package/dist/chunk-2H5NIZB7.js.map +0 -7
- package/dist/chunk-GLYGPYNS.js +0 -7125
- package/dist/chunk-GLYGPYNS.js.map +0 -7
- package/dist/chunk-Z3O2WGWV.js.map +0 -7
- package/dist/conference-JD35TNH4.js +0 -6503
- package/dist/conference-JD35TNH4.js.map +0 -7
- package/src/Prebuilt/components/GoLiveButton.jsx +0 -42
- package/src/Prebuilt/components/PrebuiltDialogPortal.tsx +0 -6
- 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-IQRPLYNH.js.map → HLSView-U53QN3AC.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.0",
|
|
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.0",
|
|
80
|
+
"@100mslive/hms-virtual-background": "1.11.18-alpha.0",
|
|
81
|
+
"@100mslive/react-icons": "0.8.18-alpha.0",
|
|
82
|
+
"@100mslive/react-sdk": "0.8.18-alpha.0",
|
|
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": "c8ed9e77d556152e44e6ecee18e13355695d18c5"
|
|
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,26 +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
|
-
|
|
28
|
-
import PostLeave from './components/PostLeave';
|
|
29
|
-
// @ts-ignore: No implicit Any
|
|
30
|
-
import PreviewContainer from './components/Preview/PreviewContainer';
|
|
26
|
+
import { PreviewScreen } from './components/Preview/PreviewScreen';
|
|
31
27
|
// @ts-ignore: No implicit Any
|
|
32
28
|
import { ToastContainer } from './components/Toast/ToastContainer';
|
|
33
29
|
import { RoomLayoutContext, RoomLayoutProvider, useRoomLayout } from './provider/roomLayoutProvider';
|
|
30
|
+
import { DialogContainerProvider } from '../context/DialogContext';
|
|
34
31
|
import { Box } from '../Layout';
|
|
35
32
|
import { globalStyles, HMSThemeProvider } from '../Theme';
|
|
36
|
-
import { HMSPrebuiltContext
|
|
33
|
+
import { HMSPrebuiltContext } from './AppContext';
|
|
34
|
+
import { AppStateContext, PrebuiltStates, useAppStateManager } from './AppStateContext';
|
|
37
35
|
// @ts-ignore: No implicit Any
|
|
38
36
|
import { FlyingEmoji } from './plugins/FlyingEmoji';
|
|
39
37
|
// @ts-ignore: No implicit Any
|
|
@@ -47,9 +45,8 @@ import {
|
|
|
47
45
|
} from './provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
|
|
48
46
|
// @ts-ignore: No implicit Any
|
|
49
47
|
import { FeatureFlags } from './services/FeatureFlags';
|
|
50
|
-
|
|
51
48
|
// @ts-ignore: No implicit Any
|
|
52
|
-
|
|
49
|
+
import { DEFAULT_PORTAL_CONTAINER } from './common/constants';
|
|
53
50
|
|
|
54
51
|
export type HMSPrebuiltOptions = {
|
|
55
52
|
userName?: string;
|
|
@@ -68,6 +65,12 @@ export type HMSPrebuiltProps = {
|
|
|
68
65
|
roomId?: string;
|
|
69
66
|
role?: string;
|
|
70
67
|
onLeave?: () => void;
|
|
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;
|
|
71
74
|
};
|
|
72
75
|
|
|
73
76
|
export type HMSPrebuiltRefType = {
|
|
@@ -84,12 +87,14 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
|
|
|
84
87
|
authToken = '',
|
|
85
88
|
roomId = '',
|
|
86
89
|
role = '',
|
|
90
|
+
containerSelector = DEFAULT_PORTAL_CONTAINER,
|
|
87
91
|
logo,
|
|
88
92
|
typography,
|
|
89
93
|
themes,
|
|
90
94
|
options: { userName = '', userId = '', endpoints } = {},
|
|
91
95
|
screens,
|
|
92
96
|
onLeave,
|
|
97
|
+
onJoin,
|
|
93
98
|
},
|
|
94
99
|
ref,
|
|
95
100
|
) => {
|
|
@@ -171,7 +176,9 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
|
|
|
171
176
|
roomCode,
|
|
172
177
|
roomId,
|
|
173
178
|
role,
|
|
179
|
+
containerSelector,
|
|
174
180
|
onLeave,
|
|
181
|
+
onJoin,
|
|
175
182
|
userName,
|
|
176
183
|
userId,
|
|
177
184
|
endpoints: {
|
|
@@ -217,17 +224,23 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
|
|
|
217
224
|
>
|
|
218
225
|
<AppData appDetails={metadata} tokenEndpoint={tokenByRoomIdRoleEndpoint} />
|
|
219
226
|
<Init />
|
|
220
|
-
<
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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>
|
|
231
244
|
</HMSThemeProvider>
|
|
232
245
|
);
|
|
233
246
|
}}
|
|
@@ -242,66 +255,17 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
|
|
|
242
255
|
|
|
243
256
|
HMSPrebuilt.displayName = 'HMSPrebuilt';
|
|
244
257
|
|
|
245
|
-
const
|
|
246
|
-
const { roomId, role } = useParams();
|
|
247
|
-
return <Navigate to={`/${showPreview ? 'preview' : 'meeting'}/${roomId}/${role || ''}`} />;
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
const RouteList = () => {
|
|
258
|
+
const AppStates = ({ activeState }: { activeState: PrebuiltStates }) => {
|
|
251
259
|
const { isPreviewScreenEnabled } = useRoomLayoutPreviewScreen();
|
|
252
260
|
const { isLeaveScreenEnabled } = useRoomLayoutLeaveScreen();
|
|
253
261
|
useAutoStartStreaming();
|
|
254
|
-
return (
|
|
255
|
-
<Routes>
|
|
256
|
-
{isPreviewScreenEnabled ? (
|
|
257
|
-
<Route path="preview">
|
|
258
|
-
<Route
|
|
259
|
-
path=":roomId/:role"
|
|
260
|
-
element={
|
|
261
|
-
<Suspense fallback={<FullPageProgress text="Loading preview..." />}>
|
|
262
|
-
<PreviewContainer />
|
|
263
|
-
</Suspense>
|
|
264
|
-
}
|
|
265
|
-
/>
|
|
266
|
-
<Route
|
|
267
|
-
path=":roomId"
|
|
268
|
-
element={
|
|
269
|
-
<Suspense fallback={<FullPageProgress text="Loading preview..." />}>
|
|
270
|
-
<PreviewContainer />
|
|
271
|
-
</Suspense>
|
|
272
|
-
}
|
|
273
|
-
/>
|
|
274
|
-
</Route>
|
|
275
|
-
) : null}
|
|
276
|
-
<Route path="meeting">
|
|
277
|
-
<Route
|
|
278
|
-
path=":roomId/:role"
|
|
279
|
-
element={
|
|
280
|
-
<Suspense fallback={<FullPageProgress text="Joining..." />}>
|
|
281
|
-
<Conference />
|
|
282
|
-
</Suspense>
|
|
283
|
-
}
|
|
284
|
-
/>
|
|
285
|
-
<Route
|
|
286
|
-
path=":roomId"
|
|
287
|
-
element={
|
|
288
|
-
<Suspense fallback={<FullPageProgress text="Joining..." />}>
|
|
289
|
-
<Conference />
|
|
290
|
-
</Suspense>
|
|
291
|
-
}
|
|
292
|
-
/>
|
|
293
|
-
</Route>
|
|
294
|
-
{isLeaveScreenEnabled ? (
|
|
295
|
-
<Route path="leave">
|
|
296
|
-
<Route path=":roomId/:role" element={<PostLeave />} />
|
|
297
|
-
<Route path=":roomId" element={<PostLeave />} />
|
|
298
|
-
</Route>
|
|
299
|
-
) : null}
|
|
300
262
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
263
|
+
if (activeState === PrebuiltStates.PREVIEW && isPreviewScreenEnabled) {
|
|
264
|
+
return <PreviewScreen />;
|
|
265
|
+
} else if (activeState === PrebuiltStates.LEAVE && isLeaveScreenEnabled) {
|
|
266
|
+
return <LeaveScreen />;
|
|
267
|
+
}
|
|
268
|
+
return <ConferenceScreen />;
|
|
305
269
|
};
|
|
306
270
|
|
|
307
271
|
const BackSwipe = () => {
|
|
@@ -321,17 +285,6 @@ const BackSwipe = () => {
|
|
|
321
285
|
return null;
|
|
322
286
|
};
|
|
323
287
|
|
|
324
|
-
const Router = ({ children }: { children: ReactElement }) => {
|
|
325
|
-
const { roomId, role, roomCode } = useHMSPrebuiltContext();
|
|
326
|
-
return [roomId, role, roomCode].every(value => !value) ? (
|
|
327
|
-
<BrowserRouter>{children}</BrowserRouter>
|
|
328
|
-
) : (
|
|
329
|
-
<MemoryRouter initialEntries={[`/${roomCode ? roomCode : `${roomId}/${role || ''}`}`]} initialIndex={0}>
|
|
330
|
-
{children}
|
|
331
|
-
</MemoryRouter>
|
|
332
|
-
);
|
|
333
|
-
};
|
|
334
|
-
|
|
335
288
|
function AppRoutes({
|
|
336
289
|
authTokenByRoomCodeEndpoint,
|
|
337
290
|
defaultAuthToken,
|
|
@@ -341,22 +294,21 @@ function AppRoutes({
|
|
|
341
294
|
}) {
|
|
342
295
|
const roomLayout = useRoomLayout();
|
|
343
296
|
const isNotificationsDisabled = useIsNotificationDisabled();
|
|
297
|
+
const { activeState, rejoin } = useAppStateManager();
|
|
298
|
+
|
|
344
299
|
return (
|
|
345
|
-
<
|
|
300
|
+
<AppStateContext.Provider value={{ rejoin }}>
|
|
346
301
|
<>
|
|
347
302
|
<ToastContainer />
|
|
348
303
|
<Notifications />
|
|
304
|
+
<MwebLandscapePrompt />
|
|
349
305
|
<BackSwipe />
|
|
350
306
|
{!isNotificationsDisabled && <FlyingEmoji />}
|
|
351
307
|
<RemoteStopScreenshare />
|
|
352
308
|
<KeyboardHandler />
|
|
353
309
|
<AuthToken authTokenByRoomCodeEndpoint={authTokenByRoomCodeEndpoint} defaultAuthToken={defaultAuthToken} />
|
|
354
|
-
{roomLayout &&
|
|
355
|
-
<Routes>
|
|
356
|
-
<Route path="/*" element={<RouteList />} />
|
|
357
|
-
</Routes>
|
|
358
|
-
)}
|
|
310
|
+
{roomLayout && activeState && <AppStates activeState={activeState} />}
|
|
359
311
|
</>
|
|
360
|
-
</
|
|
312
|
+
</AppStateContext.Provider>
|
|
361
313
|
);
|
|
362
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,16 +8,20 @@ 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;
|
|
14
|
+
onJoin?: () => void;
|
|
11
15
|
};
|
|
12
16
|
|
|
13
17
|
export const HMSPrebuiltContext = React.createContext<HMSPrebuiltContextType>({
|
|
14
18
|
roomCode: '',
|
|
15
19
|
userName: '',
|
|
16
20
|
userId: '',
|
|
21
|
+
containerSelector: DEFAULT_PORTAL_CONTAINER,
|
|
17
22
|
endpoints: {},
|
|
18
23
|
onLeave: undefined,
|
|
24
|
+
onJoin: undefined,
|
|
19
25
|
});
|
|
20
26
|
|
|
21
27
|
HMSPrebuiltContext.displayName = 'HMSPrebuiltContext';
|
|
@@ -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
|
+
};
|
|
@@ -44,7 +44,8 @@ export const APP_DATA = {
|
|
|
44
44
|
pdfConfig: 'pdfConfig',
|
|
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,
|
|
@@ -65,7 +66,11 @@ const initialAppData = {
|
|
|
65
66
|
[APP_DATA.authToken]: '',
|
|
66
67
|
[APP_DATA.minimiseInset]: false,
|
|
67
68
|
[APP_DATA.activeScreensharePeerId]: '',
|
|
68
|
-
[APP_DATA.
|
|
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
|
};
|