@100mslive/roomkit-react 0.1.18 → 0.1.19-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{HLSView-XU2WQ4VV.js → HLSView-GG4WVUQY.js} +2 -2
- package/dist/Prebuilt/common/constants.d.ts +2 -6
- package/dist/Prebuilt/components/hooks/useChatBlacklist.d.ts +4 -1
- package/dist/{chunk-2FX6MFDM.js → chunk-GXJIUWTP.js} +5542 -73
- package/dist/chunk-GXJIUWTP.js.map +7 -0
- package/dist/index.cjs.js +5543 -74
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.js +1 -1
- package/dist/meta.cjs.json +43 -34
- package/dist/meta.esbuild.json +50 -41
- package/package.json +6 -6
- package/src/Prebuilt/common/constants.ts +4 -4
- package/src/Prebuilt/components/Chat/ChatActions.tsx +4 -2
- package/src/Prebuilt/components/Chat/ChatFooter.tsx +2 -2
- package/src/Prebuilt/components/Chat/ChatStates.tsx +2 -2
- package/src/Prebuilt/components/Polls/CreateQuestions/QuestionForm.jsx +3 -3
- package/src/Prebuilt/components/Polls/Voting/Leaderboard.tsx +9 -1
- package/src/Prebuilt/components/Polls/Voting/LeaderboardEntry.tsx +6 -6
- package/src/Prebuilt/components/Polls/Voting/QuestionCard.jsx +20 -23
- package/src/Prebuilt/components/hooks/useChatBlacklist.ts +2 -2
- package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +11 -2
- package/dist/chunk-2FX6MFDM.js.map +0 -7
- /package/dist/{HLSView-XU2WQ4VV.js.map → HLSView-GG4WVUQY.js.map} +0 -0
@@ -14,7 +14,7 @@ import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvid
|
|
14
14
|
import { useChatDraftMessage } from '../AppData/useChatState';
|
15
15
|
// @ts-ignore
|
16
16
|
import { useSetSubscribedChatSelector, useSubscribeChatSelector } from '../AppData/useUISettings';
|
17
|
-
import {
|
17
|
+
import { useIsPeerBlacklisted } from '../hooks/useChatBlacklist';
|
18
18
|
// @ts-ignore
|
19
19
|
import { useEmojiPickerStyles } from './useEmojiPickerStyles';
|
20
20
|
import { useDefaultChatSelection } from '../../common/hooks';
|
@@ -86,7 +86,7 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
|
|
86
86
|
const [selectedRole, setRoleSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.ROLE);
|
87
87
|
const defaultSelection = useDefaultChatSelection();
|
88
88
|
const selection = selectedPeer.name || selectedRole || defaultSelection;
|
89
|
-
const isLocalPeerBlacklisted =
|
89
|
+
const isLocalPeerBlacklisted = useIsPeerBlacklisted({ local: true });
|
90
90
|
|
91
91
|
useEffect(() => {
|
92
92
|
if (!selectedPeer.id && !selectedRole && !['Everyone', ''].includes(defaultSelection)) {
|
@@ -4,7 +4,7 @@ import { Button } from '../../../Button';
|
|
4
4
|
import { Box, Flex } from '../../../Layout';
|
5
5
|
import { Text } from '../../../Text';
|
6
6
|
import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
|
7
|
-
import {
|
7
|
+
import { useIsPeerBlacklisted } from '../hooks/useChatBlacklist';
|
8
8
|
import { SESSION_STORE_KEY } from '../../common/constants';
|
9
9
|
|
10
10
|
export const ChatPaused = () => {
|
@@ -55,7 +55,7 @@ export const ChatPaused = () => {
|
|
55
55
|
};
|
56
56
|
|
57
57
|
export const ChatBlocked = () => {
|
58
|
-
const isLocalPeerBlacklisted =
|
58
|
+
const isLocalPeerBlacklisted = useIsPeerBlacklisted({ local: true });
|
59
59
|
if (!isLocalPeerBlacklisted) {
|
60
60
|
return null;
|
61
61
|
}
|
@@ -262,9 +262,9 @@ export const isValidQuestion = ({ text, type, options, weight, isQuiz = false })
|
|
262
262
|
return false;
|
263
263
|
}
|
264
264
|
|
265
|
-
if (![QUESTION_TYPE.SINGLE_CHOICE, QUESTION_TYPE.MULTIPLE_CHOICE].includes(type)) {
|
266
|
-
|
267
|
-
}
|
265
|
+
// if (![QUESTION_TYPE.SINGLE_CHOICE, QUESTION_TYPE.MULTIPLE_CHOICE].includes(type)) {
|
266
|
+
// return true;
|
267
|
+
// }
|
268
268
|
|
269
269
|
const everyOptionHasText = options.length > 0 && options.every(option => option && isValidTextInput(option.text, 1));
|
270
270
|
const hasCorrectAnswer = options.some(option => option.isCorrectAnswer);
|
@@ -78,7 +78,15 @@ export const Leaderboard = ({ pollID }: { pollID: string }) => {
|
|
78
78
|
<Text variant="xs" css={{ color: '$on_surface_medium' }}>
|
79
79
|
Based on score and time taken to cast the correct answer
|
80
80
|
</Text>
|
81
|
-
<Box
|
81
|
+
<Box
|
82
|
+
css={{
|
83
|
+
mt: '$8',
|
84
|
+
overflowY: 'auto',
|
85
|
+
flex: '1 1 0',
|
86
|
+
mr: '-$6',
|
87
|
+
pr: '$6',
|
88
|
+
}}
|
89
|
+
>
|
82
90
|
{pollLeaderboard?.entries &&
|
83
91
|
pollLeaderboard.entries.map(question => (
|
84
92
|
<LeaderboardEntry
|
@@ -21,7 +21,7 @@ export const LeaderboardEntry = ({
|
|
21
21
|
maxPossibleScore: number;
|
22
22
|
}) => {
|
23
23
|
return (
|
24
|
-
<Flex align="center" justify="between">
|
24
|
+
<Flex align="center" justify="between" css={{ my: '$4' }}>
|
25
25
|
<Flex align="center" css={{ gap: '$6' }}>
|
26
26
|
<Flex
|
27
27
|
align="center"
|
@@ -44,17 +44,17 @@ export const LeaderboardEntry = ({
|
|
44
44
|
{userName}
|
45
45
|
</Text>
|
46
46
|
|
47
|
-
<Text variant="sm">
|
48
|
-
{score}/{maxPossibleScore} points
|
47
|
+
<Text variant="sm" css={{ mt: '$2' }}>
|
48
|
+
{score} / {maxPossibleScore} points
|
49
49
|
</Text>
|
50
50
|
</Box>
|
51
51
|
</Flex>
|
52
|
-
<Flex align="center" css={{ gap: '$
|
53
|
-
{position === 1 ? <TrophyFilledIcon /> : null}
|
52
|
+
<Flex align="center" css={{ gap: '$4', color: '$on_surface_medium' }}>
|
53
|
+
{position === 1 ? <TrophyFilledIcon height={18} width={18} /> : null}
|
54
54
|
<CheckCircleIcon height={16} width={16} />
|
55
55
|
{questionCount ? (
|
56
56
|
<Text variant="xs">
|
57
|
-
{correctResponses}/{questionCount}
|
57
|
+
{correctResponses} / {questionCount}
|
58
58
|
</Text>
|
59
59
|
) : null}
|
60
60
|
</Flex>
|
@@ -2,22 +2,22 @@
|
|
2
2
|
import React, { useCallback, useMemo, useState } from 'react';
|
3
3
|
import { selectLocalPeer, selectLocalPeerRoleName, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
|
4
4
|
import { CheckCircleIcon, ChevronLeftIcon, ChevronRightIcon, CrossCircleIcon } from '@100mslive/react-icons';
|
5
|
-
import { Box, Button, Flex, IconButton,
|
5
|
+
import { Box, Button, Flex, IconButton, Text } from '../../../../';
|
6
6
|
import { checkCorrectAnswer } from '../../../common/utils';
|
7
7
|
import { MultipleChoiceOptions } from '../common/MultipleChoiceOptions';
|
8
8
|
import { SingleChoiceOptions } from '../common/SingleChoiceOptions';
|
9
9
|
import { QUESTION_TYPE } from '../../../common/constants';
|
10
10
|
|
11
|
-
const TextArea = styled('textarea', {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
});
|
11
|
+
// const TextArea = styled('textarea', {
|
12
|
+
// backgroundColor: '$surface_brighter',
|
13
|
+
// border: '1px solid $border_bright',
|
14
|
+
// borderRadius: '$1',
|
15
|
+
// mb: '$md',
|
16
|
+
// color: '$on_surface_high',
|
17
|
+
// resize: 'none',
|
18
|
+
// p: '$2',
|
19
|
+
// w: '100%',
|
20
|
+
// });
|
21
21
|
|
22
22
|
export const QuestionCard = ({
|
23
23
|
pollID,
|
@@ -67,23 +67,21 @@ export const QuestionCard = ({
|
|
67
67
|
setCurrentIndex(curr => Math.max(1, curr - 1));
|
68
68
|
};
|
69
69
|
|
70
|
-
const [textAnswer, setTextAnswer] = useState('');
|
70
|
+
// const [textAnswer, setTextAnswer] = useState('');
|
71
71
|
const [singleOptionAnswer, setSingleOptionAnswer] = useState();
|
72
72
|
const [multipleOptionAnswer, setMultipleOptionAnswer] = useState(new Set());
|
73
73
|
|
74
|
-
const stringAnswerExpected = [QUESTION_TYPE.LONG_ANSWER, QUESTION_TYPE.SHORT_ANSWER].includes(type);
|
74
|
+
// const stringAnswerExpected = [QUESTION_TYPE.LONG_ANSWER, QUESTION_TYPE.SHORT_ANSWER].includes(type);
|
75
75
|
|
76
76
|
const respondedToQuiz = isQuiz && localPeerResponse && !localPeerResponse.skipped;
|
77
77
|
|
78
78
|
const isValidVote = useMemo(() => {
|
79
|
-
if (
|
80
|
-
return textAnswer.length > 0;
|
81
|
-
} else if (type === QUESTION_TYPE.SINGLE_CHOICE) {
|
79
|
+
if (type === QUESTION_TYPE.SINGLE_CHOICE) {
|
82
80
|
return singleOptionAnswer !== undefined;
|
83
81
|
} else if (type === QUESTION_TYPE.MULTIPLE_CHOICE) {
|
84
82
|
return multipleOptionAnswer.size > 0;
|
85
83
|
}
|
86
|
-
}, [
|
84
|
+
}, [singleOptionAnswer, multipleOptionAnswer, type]);
|
87
85
|
|
88
86
|
const handleVote = useCallback(async () => {
|
89
87
|
if (!isValidVote) {
|
@@ -92,12 +90,11 @@ export const QuestionCard = ({
|
|
92
90
|
await actions.interactivityCenter.addResponsesToPoll(pollID, [
|
93
91
|
{
|
94
92
|
questionIndex: index,
|
95
|
-
text: textAnswer,
|
96
93
|
option: singleOptionAnswer,
|
97
94
|
options: Array.from(multipleOptionAnswer),
|
98
95
|
},
|
99
96
|
]);
|
100
|
-
}, [actions, index, pollID, isValidVote,
|
97
|
+
}, [actions, index, pollID, isValidVote, singleOptionAnswer, multipleOptionAnswer]);
|
101
98
|
|
102
99
|
const handleSkip = useCallback(async () => {
|
103
100
|
await actions.interactivityCenter.addResponsesToPoll(pollID, [
|
@@ -181,7 +178,7 @@ export const QuestionCard = ({
|
|
181
178
|
<Text css={{ color: '$on_surface_high' }}>{text}</Text>
|
182
179
|
</Box>
|
183
180
|
|
184
|
-
{type === QUESTION_TYPE.SHORT_ANSWER ? (
|
181
|
+
{/* {type === QUESTION_TYPE.SHORT_ANSWER ? (
|
185
182
|
<Input
|
186
183
|
disabled={!canRespond}
|
187
184
|
placeholder="Enter your answer"
|
@@ -194,15 +191,15 @@ export const QuestionCard = ({
|
|
194
191
|
cursor: localPeerResponse ? 'not-allowed' : 'text',
|
195
192
|
}}
|
196
193
|
/>
|
197
|
-
) : null}
|
194
|
+
) : null} */}
|
198
195
|
|
199
|
-
{type === QUESTION_TYPE.LONG_ANSWER ? (
|
196
|
+
{/* {type === QUESTION_TYPE.LONG_ANSWER ? (
|
200
197
|
<TextArea
|
201
198
|
disabled={!canRespond}
|
202
199
|
placeholder="Enter your answer"
|
203
200
|
onChange={e => setTextAnswer(e.target.value)}
|
204
201
|
/>
|
205
|
-
) : null}
|
202
|
+
) : null} */}
|
206
203
|
|
207
204
|
{type === QUESTION_TYPE.SINGLE_CHOICE ? (
|
208
205
|
<SingleChoiceOptions
|
@@ -22,8 +22,8 @@ export const useChatBlacklist = (
|
|
22
22
|
return { blacklistItem, blacklistedIDs };
|
23
23
|
};
|
24
24
|
|
25
|
-
export const
|
25
|
+
export const useIsPeerBlacklisted = ({ local = false, peerCustomerUserId = '' }) => {
|
26
26
|
const localPeer = useHMSStore(selectLocalPeer);
|
27
27
|
const blacklistedPeerIDs = useHMSStore(selectSessionStore(SESSION_STORE_KEY.CHAT_PEER_BLACKLIST)) || [];
|
28
|
-
return blacklistedPeerIDs?.includes(localPeer?.customerUserId);
|
28
|
+
return blacklistedPeerIDs?.includes(local ? localPeer?.customerUserId : peerCustomerUserId);
|
29
29
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import type { Layout } from '@100mslive/types-prebuilt';
|
3
|
-
import
|
3
|
+
import { isArray, mergeWith } from 'lodash';
|
4
4
|
// @ts-ignore: fix types
|
5
5
|
import { useAuthToken } from '../../components/AppData/useUISettings';
|
6
6
|
import { useFetchRoomLayout, useFetchRoomLayoutResponse } from './hooks/useFetchRoomLayout';
|
@@ -18,6 +18,14 @@ export const RoomLayoutContext = React.createContext<
|
|
18
18
|
| undefined
|
19
19
|
>(undefined);
|
20
20
|
|
21
|
+
function customizer(objValue: any, srcValue: any) {
|
22
|
+
if (isArray(objValue) && isArray(srcValue)) {
|
23
|
+
return srcValue;
|
24
|
+
}
|
25
|
+
// default mergeWith behaviour is followed
|
26
|
+
return undefined;
|
27
|
+
}
|
28
|
+
|
21
29
|
export const RoomLayoutProvider: React.FC<React.PropsWithChildren<RoomLayoutProviderProps>> = ({
|
22
30
|
children,
|
23
31
|
roomLayoutEndpoint,
|
@@ -25,7 +33,8 @@ export const RoomLayoutProvider: React.FC<React.PropsWithChildren<RoomLayoutProv
|
|
25
33
|
}) => {
|
26
34
|
const authToken: string = useAuthToken();
|
27
35
|
const { layout, updateRoomLayoutForRole } = useFetchRoomLayout({ authToken, endpoint: roomLayoutEndpoint });
|
28
|
-
const mergedLayout = authToken && layout ?
|
36
|
+
const mergedLayout = authToken && layout ? mergeWith(layout, overrideLayout, customizer) : layout;
|
37
|
+
|
29
38
|
return (
|
30
39
|
<RoomLayoutContext.Provider value={{ layout: mergedLayout, updateRoomLayoutForRole }}>
|
31
40
|
{children}
|