@100mslive/roomkit-react 0.1.8 → 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-DDGPZHA2.js → HLSView-U53QN3AC.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-PMLQPJB6.js} +3 -5
- package/dist/{VirtualBackground-UVZJVOA2.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-6SQTFOK6.js → chunk-XQ2NRKIW.js} +66 -3
- package/dist/{chunk-6SQTFOK6.js.map → chunk-XQ2NRKIW.js.map} +4 -4
- 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-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-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
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
HandIcon,
|
|
19
19
|
HandRaiseSlashedIcon,
|
|
20
20
|
PeopleIcon,
|
|
21
|
+
QuizIcon,
|
|
21
22
|
RecordIcon,
|
|
22
23
|
SettingsIcon,
|
|
23
24
|
} from '@100mslive/react-icons';
|
|
@@ -40,7 +41,9 @@ import { ChangeNameModal } from '../ChangeNameModal';
|
|
|
40
41
|
// @ts-ignore: No implicit any
|
|
41
42
|
import { MuteAllModal } from '../MuteAllModal';
|
|
42
43
|
// @ts-ignore: No implicit any
|
|
43
|
-
import { useSidepaneToggle } from '../../AppData/useSidepane';
|
|
44
|
+
import { usePollViewToggle, useSidepaneToggle } from '../../AppData/useSidepane';
|
|
45
|
+
// @ts-ignore: No implicit Any
|
|
46
|
+
import { useShowPolls } from '../../AppData/useUISettings';
|
|
44
47
|
// @ts-ignore: No implicit any
|
|
45
48
|
import { useDropdownList } from '../../hooks/useDropdownList';
|
|
46
49
|
// @ts-ignore: No implicit any
|
|
@@ -82,6 +85,8 @@ export const MwebOptions = ({
|
|
|
82
85
|
const [showRecordingOn, setShowRecordingOn] = useState(false);
|
|
83
86
|
const [isRecordingLoading, setIsRecordingLoading] = useState(false);
|
|
84
87
|
const toggleParticipants = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
|
|
88
|
+
const { showPolls } = useShowPolls();
|
|
89
|
+
const togglePollView = usePollViewToggle();
|
|
85
90
|
const peerCount = useHMSStore(selectPeerCount);
|
|
86
91
|
const emojiCardRef = useRef(null);
|
|
87
92
|
const { isBRBOn, toggleBRB, isHandRaised, toggleHandRaise } = useMyMetadata();
|
|
@@ -192,6 +197,18 @@ export const MwebOptions = ({
|
|
|
192
197
|
</ActionTile.Root>
|
|
193
198
|
)}
|
|
194
199
|
|
|
200
|
+
{showPolls && (
|
|
201
|
+
<ActionTile.Root
|
|
202
|
+
onClick={() => {
|
|
203
|
+
togglePollView();
|
|
204
|
+
setOpenOptionsSheet(false);
|
|
205
|
+
}}
|
|
206
|
+
>
|
|
207
|
+
<QuizIcon />
|
|
208
|
+
<ActionTile.Title>Polls and Quizzes</ActionTile.Title>
|
|
209
|
+
</ActionTile.Root>
|
|
210
|
+
)}
|
|
211
|
+
|
|
195
212
|
{elements?.brb && (
|
|
196
213
|
<ActionTile.Root
|
|
197
214
|
active={isBRBOn}
|
|
@@ -4,29 +4,28 @@ import { Button } from '../../Button';
|
|
|
4
4
|
import { Box, Flex } from '../../Layout';
|
|
5
5
|
import { Dialog } from '../../Modal';
|
|
6
6
|
import { Text } from '../../Text';
|
|
7
|
-
import { PrebuiltDialogPortal } from './PrebuiltDialogPortal';
|
|
8
|
-
import { isAndroid, isIOS } from '../common/constants';
|
|
9
7
|
|
|
10
8
|
export const MwebLandscapePrompt = () => {
|
|
11
|
-
const isMobile = isAndroid || isIOS;
|
|
12
9
|
const [showMwebLandscapePrompt, setShowMwebLandscapePrompt] = useState(false);
|
|
13
10
|
|
|
14
11
|
useEffect(() => {
|
|
15
|
-
const
|
|
16
|
-
|
|
12
|
+
const handleRotation = () => {
|
|
13
|
+
const angle = window.screen.orientation.angle;
|
|
14
|
+
const type = window.screen.orientation.type;
|
|
15
|
+
// Angle check needed to diff bw mobile and desktop
|
|
16
|
+
setShowMwebLandscapePrompt(angle >= 90 && type.includes('landscape'));
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
window.addEventListener('resize', handleResize);
|
|
18
|
+
handleRotation();
|
|
19
|
+
window.screen.orientation.addEventListener('change', handleRotation);
|
|
21
20
|
|
|
22
21
|
return () => {
|
|
23
|
-
window.removeEventListener('
|
|
22
|
+
window.screen.orientation.removeEventListener('change', handleRotation);
|
|
24
23
|
};
|
|
25
24
|
}, []);
|
|
26
25
|
|
|
27
26
|
return (
|
|
28
27
|
<Dialog.Root open={showMwebLandscapePrompt} onOpenChange={setShowMwebLandscapePrompt}>
|
|
29
|
-
<
|
|
28
|
+
<Dialog.Portal>
|
|
30
29
|
<Dialog.Overlay />
|
|
31
30
|
<Dialog.Content css={{ w: 'min(420px, 90%)', p: '$8', bg: '$surface_dim' }}>
|
|
32
31
|
<Box>
|
|
@@ -52,7 +51,7 @@ export const MwebLandscapePrompt = () => {
|
|
|
52
51
|
</Flex>
|
|
53
52
|
</Box>
|
|
54
53
|
</Dialog.Content>
|
|
55
|
-
</
|
|
54
|
+
</Dialog.Portal>
|
|
56
55
|
</Dialog.Root>
|
|
57
56
|
);
|
|
58
57
|
};
|
package/src/Prebuilt/components/Notifications/{AutoplayBlockedModal.jsx → AutoplayBlockedModal.tsx}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useAutoplayError } from '@100mslive/react-sdk';
|
|
3
|
-
import { Button, Dialog, Text } from '
|
|
3
|
+
import { Button, Dialog, Text } from '../../..';
|
|
4
|
+
// @ts-ignore: No implicit Any
|
|
4
5
|
import { DialogContent, DialogRow } from '../../primitives/DialogContent';
|
|
5
6
|
|
|
6
7
|
export function AutoplayBlockedModal() {
|
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
import React, { useCallback, useState } from 'react';
|
|
2
|
-
import { selectHLSState, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
|
|
2
|
+
import { selectHLSState, useHMSActions, useHMSStore, useRecordingStreaming } from '@100mslive/react-sdk';
|
|
3
3
|
import { Button } from '../../../Button';
|
|
4
4
|
import { Flex } from '../../../Layout';
|
|
5
5
|
import { Dialog } from '../../../Modal';
|
|
6
6
|
import { Text } from '../../../Text';
|
|
7
|
-
|
|
7
|
+
// @ts-ignore: No implicit Any
|
|
8
8
|
import { useSetAppDataByKey } from '../AppData/useUISettings';
|
|
9
|
+
// @ts-ignore: No implicit Any
|
|
9
10
|
import { APP_DATA } from '../../common/constants';
|
|
10
11
|
|
|
11
12
|
export function HLSFailureModal() {
|
|
12
|
-
const
|
|
13
|
+
const hlsError = useHMSStore(selectHLSState).error || false;
|
|
13
14
|
const [openModal, setOpenModal] = useState(!!hlsError);
|
|
14
15
|
const hmsActions = useHMSActions();
|
|
16
|
+
const { isRTMPRunning } = useRecordingStreaming();
|
|
15
17
|
const [isHLSStarted, setHLSStarted] = useSetAppDataByKey(APP_DATA.hlsStarted);
|
|
16
18
|
const startHLS = useCallback(async () => {
|
|
17
19
|
try {
|
|
18
|
-
if (isHLSStarted) {
|
|
20
|
+
if (isHLSStarted || isRTMPRunning) {
|
|
19
21
|
return;
|
|
20
22
|
}
|
|
21
23
|
setHLSStarted(true);
|
|
22
24
|
await hmsActions.startHLSStreaming({});
|
|
23
25
|
} catch (error) {
|
|
24
|
-
if (error.message.includes('invalid input')) {
|
|
26
|
+
if ((error as Error).message.includes('invalid input')) {
|
|
25
27
|
await startHLS();
|
|
26
28
|
return;
|
|
27
29
|
}
|
|
28
30
|
setHLSStarted(false);
|
|
29
31
|
}
|
|
30
|
-
}, [hmsActions, isHLSStarted, setHLSStarted]);
|
|
32
|
+
}, [hmsActions, isHLSStarted, setHLSStarted, isRTMPRunning]);
|
|
31
33
|
|
|
32
34
|
return hlsError ? (
|
|
33
35
|
<Dialog.Root
|
|
@@ -38,7 +40,7 @@ export function HLSFailureModal() {
|
|
|
38
40
|
}
|
|
39
41
|
}}
|
|
40
42
|
>
|
|
41
|
-
<
|
|
43
|
+
<Dialog.Portal>
|
|
42
44
|
<Dialog.Overlay />
|
|
43
45
|
<Dialog.Content css={{ w: 'min(360px, 90%)' }}>
|
|
44
46
|
<Dialog.Title
|
|
@@ -66,7 +68,7 @@ export function HLSFailureModal() {
|
|
|
66
68
|
</Button>
|
|
67
69
|
</Flex>
|
|
68
70
|
</Dialog.Content>
|
|
69
|
-
</
|
|
71
|
+
</Dialog.Portal>
|
|
70
72
|
</Dialog.Root>
|
|
71
73
|
) : null;
|
|
72
74
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
|
|
3
|
+
import { Text } from '../../..';
|
|
4
|
+
// @ts-ignore: No implicit Any
|
|
3
5
|
import { ErrorDialog } from '../../primitives/DialogContent';
|
|
4
6
|
|
|
5
|
-
export const InitErrorModal = (
|
|
7
|
+
export const InitErrorModal = () => {
|
|
8
|
+
const notification = useHMSNotifications(HMSNotificationTypes.ERROR);
|
|
6
9
|
const [showModal, setShowModal] = useState(false);
|
|
7
10
|
const [info, setInfo] = useState({ title: 'Init Error', description: '' });
|
|
8
11
|
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
/* eslint-disable no-case-declarations */
|
|
2
2
|
import React, { useCallback, useEffect } from 'react';
|
|
3
|
-
import { useNavigate, useParams } from 'react-router-dom';
|
|
4
3
|
import {
|
|
5
4
|
HMSNotificationTypes,
|
|
5
|
+
HMSRoleChangeRequest,
|
|
6
6
|
HMSRoomState,
|
|
7
7
|
selectHasPeerHandRaised,
|
|
8
|
+
selectLocalPeerID,
|
|
9
|
+
selectPeerNameByID,
|
|
8
10
|
selectRoomState,
|
|
9
11
|
useCustomEvent,
|
|
10
12
|
useHMSNotifications,
|
|
11
13
|
useHMSStore,
|
|
12
14
|
useHMSVanillaStore,
|
|
13
15
|
} from '@100mslive/react-sdk';
|
|
14
|
-
import { Button } from '
|
|
16
|
+
import { Button } from '../../..';
|
|
15
17
|
import { useUpdateRoomLayout } from '../../provider/roomLayoutProvider';
|
|
18
|
+
// @ts-ignore: No implicit Any
|
|
16
19
|
import { ToastBatcher } from '../Toast/ToastBatcher';
|
|
20
|
+
// @ts-ignore: No implicit Any
|
|
17
21
|
import { ToastManager } from '../Toast/ToastManager';
|
|
18
22
|
import { AutoplayBlockedModal } from './AutoplayBlockedModal';
|
|
19
23
|
import { InitErrorModal } from './InitErrorModal';
|
|
@@ -23,22 +27,25 @@ import { ReconnectNotifications } from './ReconnectNotifications';
|
|
|
23
27
|
import { TrackBulkUnmuteModal } from './TrackBulkUnmuteModal';
|
|
24
28
|
import { TrackNotifications } from './TrackNotifications';
|
|
25
29
|
import { TrackUnmuteModal } from './TrackUnmuteModal';
|
|
30
|
+
// @ts-ignore: No implicit Any
|
|
31
|
+
import { usePollViewToggle } from '../AppData/useSidepane';
|
|
32
|
+
// @ts-ignore: No implicit Any
|
|
26
33
|
import { useIsNotificationDisabled, useSubscribedNotifications } from '../AppData/useUISettings';
|
|
27
|
-
|
|
34
|
+
// @ts-ignore: No implicit Any
|
|
28
35
|
import { getMetadata } from '../../common/utils';
|
|
36
|
+
// @ts-ignore: No implicit Any
|
|
29
37
|
import { ROLE_CHANGE_DECLINED } from '../../common/constants';
|
|
30
38
|
export function Notifications() {
|
|
39
|
+
const localPeerID = useHMSStore(selectLocalPeerID);
|
|
31
40
|
const notification = useHMSNotifications();
|
|
32
|
-
const navigate = useNavigate();
|
|
33
|
-
const params = useParams();
|
|
34
41
|
const subscribedNotifications = useSubscribedNotifications() || {};
|
|
35
42
|
const roomState = useHMSStore(selectRoomState);
|
|
36
43
|
const updateRoomLayoutForRole = useUpdateRoomLayout();
|
|
37
44
|
const isNotificationDisabled = useIsNotificationDisabled();
|
|
38
|
-
const { redirectToLeave } = useRedirectToLeave();
|
|
39
45
|
const vanillaStore = useHMSVanillaStore();
|
|
46
|
+
const togglePollView = usePollViewToggle();
|
|
40
47
|
|
|
41
|
-
const handleRoleChangeDenied = useCallback(request => {
|
|
48
|
+
const handleRoleChangeDenied = useCallback((request: HMSRoleChangeRequest & { peerName: string }) => {
|
|
42
49
|
ToastManager.addToast({
|
|
43
50
|
title: `${request.peerName} denied your request to join the ${request.role.name} role`,
|
|
44
51
|
variant: 'error',
|
|
@@ -85,28 +92,13 @@ export function Notifications() {
|
|
|
85
92
|
title: `Error: ${notification.data?.message}`,
|
|
86
93
|
});
|
|
87
94
|
} else {
|
|
88
|
-
|
|
89
|
-
const toastId = ToastManager.addToast({
|
|
95
|
+
ToastManager.addToast({
|
|
90
96
|
title:
|
|
91
97
|
notification.data?.message ||
|
|
92
98
|
'We couldn’t reconnect you. When you’re back online, try joining the room.',
|
|
93
|
-
inlineAction: true,
|
|
94
|
-
action: (
|
|
95
|
-
<Button
|
|
96
|
-
onClick={() => {
|
|
97
|
-
ToastManager.removeToast(toastId);
|
|
98
|
-
navigate(`/${params.roomId}${params.role ? `/${params.role}` : ''}`);
|
|
99
|
-
}}
|
|
100
|
-
>
|
|
101
|
-
Rejoin
|
|
102
|
-
</Button>
|
|
103
|
-
),
|
|
104
99
|
close: false,
|
|
105
100
|
});
|
|
106
101
|
}
|
|
107
|
-
// goto leave for terminal if any action is not performed within 1s
|
|
108
|
-
// if network is still unavailable going to preview will throw an error
|
|
109
|
-
redirectToLeave(1000);
|
|
110
102
|
return;
|
|
111
103
|
}
|
|
112
104
|
// Autoplay error or user denied screen share (cancelled browser pop-up)
|
|
@@ -122,11 +114,11 @@ export function Notifications() {
|
|
|
122
114
|
});
|
|
123
115
|
break;
|
|
124
116
|
case HMSNotificationTypes.ROLE_UPDATED: {
|
|
125
|
-
if (notification.data?.isLocal) {
|
|
117
|
+
if (notification.data?.isLocal && notification.data?.roleName) {
|
|
126
118
|
ToastManager.addToast({
|
|
127
119
|
title: `You are now a ${notification.data.roleName}`,
|
|
128
120
|
});
|
|
129
|
-
updateRoomLayoutForRole(notification.data.roleName);
|
|
121
|
+
updateRoomLayoutForRole?.(notification.data.roleName);
|
|
130
122
|
}
|
|
131
123
|
break;
|
|
132
124
|
}
|
|
@@ -145,13 +137,35 @@ export function Notifications() {
|
|
|
145
137
|
title: `${notification.message}.
|
|
146
138
|
${notification.data.reason && `Reason: ${notification.data.reason}`}`,
|
|
147
139
|
});
|
|
148
|
-
redirectToLeave(1000);
|
|
149
140
|
break;
|
|
150
141
|
case HMSNotificationTypes.DEVICE_CHANGE_UPDATE:
|
|
151
142
|
ToastManager.addToast({
|
|
152
143
|
title: notification.message,
|
|
153
144
|
});
|
|
154
145
|
break;
|
|
146
|
+
|
|
147
|
+
case HMSNotificationTypes.POLL_STARTED:
|
|
148
|
+
if (notification.data.startedBy !== localPeerID) {
|
|
149
|
+
const pollStartedBy = vanillaStore.getState(selectPeerNameByID(notification.data.startedBy));
|
|
150
|
+
ToastManager.addToast({
|
|
151
|
+
title: `${pollStartedBy} started a ${notification.data.type}: ${notification.data.title}`,
|
|
152
|
+
action: (
|
|
153
|
+
<Button
|
|
154
|
+
onClick={() => togglePollView(notification.data.id)}
|
|
155
|
+
variant="standard"
|
|
156
|
+
css={{
|
|
157
|
+
backgroundColor: '$surface_bright',
|
|
158
|
+
fontWeight: '$semiBold',
|
|
159
|
+
color: '$on_surface_high',
|
|
160
|
+
p: '$xs $md',
|
|
161
|
+
}}
|
|
162
|
+
>
|
|
163
|
+
Vote
|
|
164
|
+
</Button>
|
|
165
|
+
),
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
155
169
|
default:
|
|
156
170
|
break;
|
|
157
171
|
}
|
|
@@ -171,7 +185,7 @@ export function Notifications() {
|
|
|
171
185
|
<ReconnectNotifications />
|
|
172
186
|
<AutoplayBlockedModal />
|
|
173
187
|
<PermissionErrorModal />
|
|
174
|
-
<InitErrorModal
|
|
188
|
+
<InitErrorModal />
|
|
175
189
|
</>
|
|
176
190
|
);
|
|
177
191
|
}
|
package/src/Prebuilt/components/Notifications/{PeerNotifications.jsx → PeerNotifications.tsx}
RENAMED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
|
|
3
|
+
// @ts-ignore: No implicit Any
|
|
3
4
|
import { ToastBatcher } from '../Toast/ToastBatcher';
|
|
5
|
+
// @ts-ignore: No implicit Any
|
|
4
6
|
import { useSubscribedNotifications } from '../AppData/useUISettings';
|
|
7
|
+
// @ts-ignore: No implicit Any
|
|
5
8
|
import { SUBSCRIBED_NOTIFICATIONS } from '../../common/constants';
|
|
6
9
|
|
|
7
10
|
const notificationTypes = [
|
package/src/Prebuilt/components/Notifications/{PermissionErrorModal.jsx → PermissionErrorModal.tsx}
RENAMED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { useMedia } from 'react-use';
|
|
3
3
|
import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
|
|
4
|
-
import { Button, config as cssConfig, Dialog, Flex, Text } from '
|
|
4
|
+
import { Button, config as cssConfig, Dialog, Flex, Text } from '../../..';
|
|
5
|
+
// @ts-ignore: No implicit Any
|
|
5
6
|
import androidPermissionAlert from '../../images/android-perm-1.png';
|
|
7
|
+
// @ts-ignore: No implicit Any
|
|
6
8
|
import iosPermissions from '../../images/ios-perm-0.png';
|
|
7
|
-
|
|
9
|
+
// @ts-ignore: No implicit Any
|
|
8
10
|
import { isAndroid, isIOS } from '../../common/constants';
|
|
9
11
|
|
|
10
12
|
export function PermissionErrorModal() {
|
|
@@ -40,7 +42,7 @@ export function PermissionErrorModal() {
|
|
|
40
42
|
|
|
41
43
|
return deviceType ? (
|
|
42
44
|
<Dialog.Root open={!!deviceType}>
|
|
43
|
-
<
|
|
45
|
+
<Dialog.Portal>
|
|
44
46
|
<Dialog.Overlay />
|
|
45
47
|
<Dialog.Content css={{ w: 'min(380px, 90%)', p: '$8' }}>
|
|
46
48
|
<Dialog.Title
|
|
@@ -119,7 +121,7 @@ export function PermissionErrorModal() {
|
|
|
119
121
|
</Flex>
|
|
120
122
|
) : null}
|
|
121
123
|
</Dialog.Content>
|
|
122
|
-
</
|
|
124
|
+
</Dialog.Portal>
|
|
123
125
|
</Dialog.Root>
|
|
124
126
|
) : null;
|
|
125
127
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
|
|
3
|
-
import { Dialog, Flex, Loading, Text } from '
|
|
3
|
+
import { Dialog, Flex, Loading, Text } from '../../..';
|
|
4
|
+
// @ts-ignore: No implicit Any
|
|
4
5
|
import { ToastConfig } from '../Toast/ToastConfig';
|
|
6
|
+
// @ts-ignore: No implicit Any
|
|
5
7
|
import { ToastManager } from '../Toast/ToastManager';
|
|
6
8
|
|
|
7
9
|
const notificationTypes = [
|
|
@@ -9,21 +11,24 @@ const notificationTypes = [
|
|
|
9
11
|
HMSNotificationTypes.RECONNECTING,
|
|
10
12
|
HMSNotificationTypes.ERROR,
|
|
11
13
|
];
|
|
12
|
-
let notificationId = null;
|
|
14
|
+
let notificationId: string | null = null;
|
|
13
15
|
|
|
14
16
|
export const ReconnectNotifications = () => {
|
|
15
17
|
const notification = useHMSNotifications(notificationTypes);
|
|
16
18
|
const [open, setOpen] = useState(false);
|
|
17
19
|
useEffect(() => {
|
|
18
|
-
if (notification
|
|
20
|
+
if (!notification) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (notification.type === HMSNotificationTypes.ERROR && notification.data?.isTerminal) {
|
|
19
24
|
setOpen(false);
|
|
20
|
-
} else if (notification
|
|
25
|
+
} else if (notification.type === HMSNotificationTypes.RECONNECTED) {
|
|
21
26
|
notificationId = ToastManager.replaceToast(notificationId, ToastConfig.RECONNECTED.single());
|
|
22
27
|
setOpen(false);
|
|
23
|
-
} else if (notification
|
|
28
|
+
} else if (notification.type === HMSNotificationTypes.RECONNECTING) {
|
|
24
29
|
notificationId = ToastManager.replaceToast(
|
|
25
30
|
notificationId,
|
|
26
|
-
ToastConfig.RECONNECTING.single(notification.data
|
|
31
|
+
ToastConfig.RECONNECTING.single(notification.data?.message),
|
|
27
32
|
);
|
|
28
33
|
}
|
|
29
34
|
}, [notification]);
|
package/src/Prebuilt/components/Notifications/{TrackBulkUnmuteModal.jsx → TrackBulkUnmuteModal.tsx}
RENAMED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
HMSChangeMultiTrackStateRequest,
|
|
4
|
+
HMSNotificationTypes,
|
|
5
|
+
useHMSActions,
|
|
6
|
+
useHMSNotifications,
|
|
7
|
+
} from '@100mslive/react-sdk';
|
|
3
8
|
import { MicOnIcon } from '@100mslive/react-icons';
|
|
9
|
+
// @ts-ignore: No implicit Any
|
|
4
10
|
import { RequestDialog } from '../../primitives/DialogContent';
|
|
5
11
|
|
|
6
12
|
export const TrackBulkUnmuteModal = () => {
|
|
7
13
|
const hmsActions = useHMSActions();
|
|
8
|
-
const [muteNotification, setMuteNotification] = useState(null);
|
|
14
|
+
const [muteNotification, setMuteNotification] = useState<HMSChangeMultiTrackStateRequest | null>(null);
|
|
9
15
|
const notification = useHMSNotifications([
|
|
10
16
|
HMSNotificationTypes.CHANGE_MULTI_TRACK_STATE_REQUEST,
|
|
11
17
|
HMSNotificationTypes.ROOM_ENDED,
|
|
@@ -38,7 +44,7 @@ export const TrackBulkUnmuteModal = () => {
|
|
|
38
44
|
<RequestDialog
|
|
39
45
|
title="Track Unmute Request"
|
|
40
46
|
body={`${peer?.name} has requested you to unmute your tracks.`}
|
|
41
|
-
onOpenChange={value => !value && setMuteNotification(null)}
|
|
47
|
+
onOpenChange={(value: boolean) => !value && setMuteNotification(null)}
|
|
42
48
|
onAction={() => {
|
|
43
49
|
tracks.forEach(track => {
|
|
44
50
|
hmsActions.setEnabledTrack(track.id, enabled);
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
HMSChangeTrackStateRequest,
|
|
4
|
+
HMSNotificationTypes,
|
|
5
|
+
useHMSActions,
|
|
6
|
+
useHMSNotifications,
|
|
7
|
+
} from '@100mslive/react-sdk';
|
|
3
8
|
import { MicOnIcon } from '@100mslive/react-icons';
|
|
9
|
+
// @ts-ignore: No implicit Any
|
|
4
10
|
import { RequestDialog } from '../../primitives/DialogContent';
|
|
5
11
|
|
|
6
12
|
export const TrackUnmuteModal = () => {
|
|
@@ -10,7 +16,7 @@ export const TrackUnmuteModal = () => {
|
|
|
10
16
|
HMSNotificationTypes.ROOM_ENDED,
|
|
11
17
|
HMSNotificationTypes.REMOVED_FROM_ROOM,
|
|
12
18
|
]);
|
|
13
|
-
const [muteNotification, setMuteNotification] = useState(null);
|
|
19
|
+
const [muteNotification, setMuteNotification] = useState<HMSChangeTrackStateRequest | null>(null);
|
|
14
20
|
|
|
15
21
|
useEffect(() => {
|
|
16
22
|
switch (notification?.type) {
|
|
@@ -37,7 +43,7 @@ export const TrackUnmuteModal = () => {
|
|
|
37
43
|
return (
|
|
38
44
|
<RequestDialog
|
|
39
45
|
title="Track Unmute Request"
|
|
40
|
-
onOpenChange={value => !value && setMuteNotification(null)}
|
|
46
|
+
onOpenChange={(value: boolean) => !value && setMuteNotification(null)}
|
|
41
47
|
body={`${peer?.name} has requested you to unmute your ${track?.source} ${track?.type}.`}
|
|
42
48
|
onAction={() => {
|
|
43
49
|
hmsActions.setEnabledTrack(track.id, enabled);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Notifications } from './Notifications';
|