@100mslive/roomkit-react 0.1.12 → 0.1.13-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. package/dist/{HLSView-PWVM4OIP.js → HLSView-AIPLCDXY.js} +2 -2
  2. package/dist/Prebuilt/App.d.ts +0 -2
  3. package/dist/Prebuilt/AppContext.d.ts +0 -2
  4. package/dist/Prebuilt/common/constants.d.ts +110 -0
  5. package/dist/Prebuilt/components/AppData/AppData.d.ts +2 -0
  6. package/dist/Prebuilt/components/Chat/MwebChatOption.d.ts +7 -0
  7. package/dist/Prebuilt/components/Chat/Navigation.d.ts +8 -0
  8. package/dist/Prebuilt/components/Chat/PinnedMessage.d.ts +4 -0
  9. package/dist/Prebuilt/components/Footer/Footer.d.ts +3 -2
  10. package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +2 -1
  11. package/dist/Prebuilt/components/VirtualBackground/VBCollection.d.ts +2 -1
  12. package/dist/Prebuilt/components/VirtualBackground/VBPicker.d.ts +3 -0
  13. package/dist/Prebuilt/components/VirtualBackground/constants.d.ts +0 -6
  14. package/dist/Prebuilt/components/hooks/useChatBlacklist.d.ts +4 -0
  15. package/dist/Prebuilt/components/hooks/useSetPinnedMessages.d.ts +16 -0
  16. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +3 -2
  17. package/dist/{chunk-WREKGNP6.js → chunk-5DCII2TP.js} +2212 -1216
  18. package/dist/chunk-5DCII2TP.js.map +7 -0
  19. package/dist/index.cjs.js +2906 -1848
  20. package/dist/index.cjs.js.map +4 -4
  21. package/dist/index.js +1 -1
  22. package/dist/meta.cjs.json +802 -286
  23. package/dist/meta.esbuild.json +810 -294
  24. package/package.json +8 -7
  25. package/src/Prebuilt/App.tsx +3 -14
  26. package/src/Prebuilt/AppContext.tsx +0 -2
  27. package/src/Prebuilt/common/{constants.js → constants.ts} +22 -20
  28. package/src/Prebuilt/components/AppData/{AppData.jsx → AppData.tsx} +8 -22
  29. package/src/Prebuilt/components/AppData/useUISettings.js +0 -4
  30. package/src/Prebuilt/components/AuthToken.jsx +4 -4
  31. package/src/Prebuilt/components/Chat/Chat.jsx +51 -73
  32. package/src/Prebuilt/components/Chat/ChatBody.jsx +219 -48
  33. package/src/Prebuilt/components/Chat/ChatFooter.tsx +50 -6
  34. package/src/Prebuilt/components/Chat/ChatStates.jsx +66 -0
  35. package/src/Prebuilt/components/Chat/MwebChatOption.tsx +24 -0
  36. package/src/Prebuilt/components/Chat/Navigation.tsx +60 -0
  37. package/src/Prebuilt/components/Chat/PinnedMessage.tsx +118 -0
  38. package/src/Prebuilt/components/Footer/Footer.tsx +4 -7
  39. package/src/Prebuilt/components/Header/common.jsx +1 -1
  40. package/src/Prebuilt/components/Preview/PreviewJoin.tsx +6 -8
  41. package/src/Prebuilt/components/RoleChangeRequest/RoleChangeRequestModal.tsx +4 -1
  42. package/src/Prebuilt/components/Settings/DeviceSettings.jsx +1 -1
  43. package/src/Prebuilt/components/SidePaneTabs.tsx +3 -2
  44. package/src/Prebuilt/components/Toast/ToastConfig.jsx +20 -0
  45. package/src/Prebuilt/components/VirtualBackground/VBCollection.tsx +4 -4
  46. package/src/Prebuilt/components/VirtualBackground/{VBPicker.jsx → VBPicker.tsx} +27 -18
  47. package/src/Prebuilt/components/VirtualBackground/constants.ts +0 -8
  48. package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +10 -1
  49. package/src/Prebuilt/components/hooks/useChatBlacklist.ts +21 -0
  50. package/src/Prebuilt/components/hooks/useSetPinnedMessages.ts +76 -0
  51. package/src/Prebuilt/layouts/SidePane.tsx +1 -1
  52. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +30 -2
  53. package/src/Prebuilt/plugins/whiteboard/PusherCommunicationProvider.js +1 -1
  54. package/src/Prebuilt/plugins/whiteboard/README.md +1 -1
  55. package/src/Prebuilt/primitives/DialogContent.jsx +1 -1
  56. package/src/Prebuilt/provider/roomLayoutProvider/constants/index.ts +12 -1
  57. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +5 -1
  58. package/dist/chunk-WREKGNP6.js.map +0 -7
  59. package/src/Prebuilt/components/hooks/useSetPinnedMessage.js +0 -38
  60. package/src/Prebuilt/services/tokenService.js +0 -49
  61. /package/dist/{HLSView-PWVM4OIP.js.map → HLSView-AIPLCDXY.js.map} +0 -0
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "prebuilt",
11
11
  "roomkit"
12
12
  ],
13
- "version": "0.1.12",
13
+ "version": "0.1.13-alpha.0",
14
14
  "author": "100ms",
15
15
  "license": "MIT",
16
16
  "files": [
@@ -76,11 +76,11 @@
76
76
  "react": ">=17.0.2 <19.0.0"
77
77
  },
78
78
  "dependencies": {
79
- "@100mslive/hls-player": "0.1.21",
80
- "@100mslive/hms-virtual-background": "1.11.21",
81
- "@100mslive/react-icons": "0.8.21",
82
- "@100mslive/react-sdk": "0.8.21",
83
- "@100mslive/types-prebuilt": "0.12.0",
79
+ "@100mslive/hls-player": "0.1.22-alpha.0",
80
+ "@100mslive/hms-virtual-background": "1.11.22-alpha.0",
81
+ "@100mslive/react-icons": "0.8.22-alpha.0",
82
+ "@100mslive/react-sdk": "0.8.22-alpha.0",
83
+ "@100mslive/types-prebuilt": "0.12.4",
84
84
  "@emoji-mart/data": "^1.0.6",
85
85
  "@emoji-mart/react": "^1.0.1",
86
86
  "@radix-ui/react-accordion": "1.0.0",
@@ -106,6 +106,7 @@
106
106
  "qrcode.react": "^3.1.0",
107
107
  "react-draggable": "^4.4.5",
108
108
  "react-intersection-observer": "^9.4.3",
109
+ "react-swipeable": "^7.0.1",
109
110
  "react-use": "^17.4.0",
110
111
  "react-virtualized-auto-sizer": "^1.0.7",
111
112
  "react-window": "^1.8.7",
@@ -114,5 +115,5 @@
114
115
  "uuid": "^8.3.2",
115
116
  "worker-timers": "^7.0.40"
116
117
  },
117
- "gitHead": "b2409381228fa1a60f446f7873086440578f704f"
118
+ "gitHead": "b12ee3cc718d94936eb45de704bd29f823a5cad9"
118
119
  }
@@ -9,7 +9,6 @@ import {
9
9
  useHMSActions,
10
10
  useHMSStore,
11
11
  } from '@100mslive/react-sdk';
12
- // @ts-ignore: No implicit Any
13
12
  import { AppData } from './components/AppData/AppData';
14
13
  // @ts-ignore: No implicit Any
15
14
  import AuthToken from './components/AuthToken';
@@ -62,8 +61,6 @@ export type HMSPrebuiltProps = {
62
61
  options?: HMSPrebuiltOptions;
63
62
  screens?: Screens;
64
63
  authToken?: string;
65
- roomId?: string;
66
- role?: string;
67
64
  onLeave?: () => void;
68
65
  onJoin?: () => void;
69
66
  /**
@@ -85,8 +82,6 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
85
82
  {
86
83
  roomCode = '',
87
84
  authToken = '',
88
- roomId = '',
89
- role = '',
90
85
  containerSelector = DEFAULT_PORTAL_CONTAINER,
91
86
  logo,
92
87
  typography,
@@ -98,7 +93,6 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
98
93
  },
99
94
  ref,
100
95
  ) => {
101
- const metadata = '';
102
96
  const reactiveStore = useRef<HMSPrebuiltRefType>();
103
97
 
104
98
  const [hydrated, setHydrated] = React.useState(false);
@@ -138,14 +132,12 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
138
132
  | {
139
133
  init: string;
140
134
  tokenByRoomCode: string;
141
- tokenByRoomIdRole: string;
142
135
  roomLayout: string;
143
136
  }
144
137
  | undefined;
145
138
  const tokenByRoomCodeEndpoint: string = endpointsObj?.tokenByRoomCode || '';
146
139
  const initEndpoint: string = endpointsObj?.init || '';
147
140
  const roomLayoutEndpoint: string = endpointsObj?.roomLayout || '';
148
- const tokenByRoomIdRoleEndpoint: string = endpointsObj?.tokenByRoomIdRole || '';
149
141
 
150
142
  const overrideLayout: Partial<Layout> = {
151
143
  logo,
@@ -154,10 +146,10 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
154
146
  screens,
155
147
  };
156
148
 
157
- if (!roomCode && !(authToken && roomId && role)) {
149
+ if (!roomCode && !authToken) {
158
150
  console.error(`
159
151
  HMSPrebuilt can be initialised by providing:
160
- either just "roomCode" or "authToken" and "roomId" and "role".
152
+ either "roomCode" or "authToken".
161
153
  Please check if you are providing the above values for initialising prebuilt.
162
154
  `);
163
155
  throw Error('Incorrect initializing params for HMSPrebuilt component');
@@ -174,8 +166,6 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
174
166
  <HMSPrebuiltContext.Provider
175
167
  value={{
176
168
  roomCode,
177
- roomId,
178
- role,
179
169
  containerSelector,
180
170
  onLeave,
181
171
  onJoin,
@@ -184,7 +174,6 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
184
174
  endpoints: {
185
175
  tokenByRoomCode: tokenByRoomCodeEndpoint,
186
176
  init: initEndpoint,
187
- tokenByRoomIdRole: tokenByRoomIdRoleEndpoint,
188
177
  roomLayout: roomLayoutEndpoint,
189
178
  },
190
179
  }}
@@ -222,7 +211,7 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
222
211
  },
223
212
  }}
224
213
  >
225
- <AppData appDetails={metadata} tokenEndpoint={tokenByRoomIdRoleEndpoint} />
214
+ <AppData />
226
215
  <Init />
227
216
  <DialogContainerProvider dialogContainerSelector={containerSelector}>
228
217
  <Box
@@ -4,8 +4,6 @@ import { DEFAULT_PORTAL_CONTAINER } from './common/constants';
4
4
 
5
5
  type HMSPrebuiltContextType = {
6
6
  roomCode: string;
7
- roomId?: string;
8
- role?: string;
9
7
  userName?: string;
10
8
  userId?: string;
11
9
  containerSelector: string;
@@ -32,7 +32,6 @@ export const APP_DATA = {
32
32
  waitingViewerRole: 'waitingViewerRole',
33
33
  subscribedNotifications: 'subscribedNotifications',
34
34
  logo: 'logo',
35
- tokenEndpoint: 'tokenEndpoint',
36
35
  appLayout: 'appLayout',
37
36
  hlsStarted: 'hlsStarted',
38
37
  rtmpStarted: 'rtmpStarted',
@@ -104,30 +103,33 @@ export const isIPadOS = false;
104
103
  // navigator?.maxTouchPoints > 2 &&
105
104
  // navigator?.userAgent?.match(/Mac/);
106
105
 
107
- export const SESSION_STORE_KEY = {
108
- TRANSCRIPTION_STATE: 'transcriptionState',
109
- PINNED_MESSAGE: 'pinnedMessage',
110
- SPOTLIGHT: 'spotlight',
111
- };
112
-
113
- export const INTERACTION_TYPE = {
114
- POLL: 'Poll',
115
- QUIZ: 'Quiz',
116
- };
117
-
118
- export const QUESTION_TYPE_TITLE = {
119
- 'single-choice': 'Single Choice',
120
- 'multiple-choice': 'Multiple Choice',
106
+ export enum SESSION_STORE_KEY {
107
+ TRANSCRIPTION_STATE = 'transcriptionState',
108
+ PINNED_MESSAGES = 'pinnedMessages',
109
+ SPOTLIGHT = 'spotlight',
110
+ CHAT_PEER_BLACKLIST = 'chatPeerBlacklist',
111
+ CHAT_MESSAGE_BLACKLIST = 'chatMessageBlacklist',
112
+ CHAT_STATE = 'chatState',
113
+ }
114
+
115
+ export enum INTERACTION_TYPE {
116
+ POLL = 'Poll',
117
+ QUIZ = 'Quiz',
118
+ }
119
+
120
+ export enum QUESTION_TYPE_TITLE {
121
+ 'single-choice' = 'Single Choice',
122
+ 'multiple-choice' = 'Multiple Choice',
121
123
  // "short-answer": "Short Answer",
122
124
  // "long-answer": "Long Answer",
123
- };
125
+ }
124
126
 
125
- export const QUESTION_TYPE = {
126
- SINGLE_CHOICE: 'single-choice',
127
- MULTIPLE_CHOICE: 'multiple-choice',
127
+ export enum QUESTION_TYPE {
128
+ SINGLE_CHOICE = 'single-choice',
129
+ MULTIPLE_CHOICE = 'multiple-choice',
128
130
  // SHORT_ANSWER: "short-answer",
129
131
  // LONG_ANSWER: "long-answer",
130
- };
132
+ }
131
133
 
132
134
  export const ROLE_CHANGE_DECLINED = 'role_change_declined';
133
135
 
@@ -12,9 +12,13 @@ import {
12
12
  useHMSStore,
13
13
  useRecordingStreaming,
14
14
  } from '@100mslive/react-sdk';
15
+ //@ts-ignore
15
16
  import { normalizeAppPolicyConfig } from '../init/initUtils';
17
+ //@ts-ignore
16
18
  import { UserPreferencesKeys, useUserPreferences } from '../hooks/useUserPreferences';
19
+ // @ts-ignore
17
20
  import { useIsSidepaneTypeOpen, useSidepaneToggle } from './useSidepane';
21
+ // @ts-ignore
18
22
  import { useSetAppDataByKey } from './useUISettings';
19
23
  import {
20
24
  APP_DATA,
@@ -25,15 +29,6 @@ import {
25
29
  UI_MODE_GRID,
26
30
  UI_SETTINGS,
27
31
  } from '../../common/constants';
28
- import { VB_EFFECT } from '../VirtualBackground/constants';
29
-
30
- export const getAppDetails = appDetails => {
31
- try {
32
- return !appDetails ? {} : JSON.parse(appDetails);
33
- } catch (error) {
34
- return {};
35
- }
36
- };
37
32
 
38
33
  const initialAppData = {
39
34
  [APP_DATA.uiSettings]: {
@@ -67,15 +62,15 @@ const initialAppData = {
67
62
  [APP_DATA.minimiseInset]: false,
68
63
  [APP_DATA.activeScreensharePeerId]: '',
69
64
  [APP_DATA.disableNotifications]: false,
70
- [APP_DATA.background]: VB_EFFECT.NONE,
71
- [APP_DATA.backgroundType]: VB_EFFECT.NONE,
65
+ [APP_DATA.background]: 'none',
66
+ [APP_DATA.backgroundType]: 'none',
72
67
  [APP_DATA.pollState]: {
73
68
  [POLL_STATE.pollInView]: '',
74
69
  [POLL_STATE.view]: '',
75
70
  },
76
71
  };
77
72
 
78
- export const AppData = React.memo(({ appDetails, tokenEndpoint }) => {
73
+ export const AppData = React.memo(() => {
79
74
  const hmsActions = useHMSActions();
80
75
  const [preferences = {}] = useUserPreferences(UserPreferencesKeys.UI_SETTINGS);
81
76
  const roleNames = useHMSStore(selectAvailableRoleNames);
@@ -88,6 +83,7 @@ export const AppData = React.memo(({ appDetails, tokenEndpoint }) => {
88
83
  ...initialAppData,
89
84
  ...appData,
90
85
  });
86
+ // @ts-ignore
91
87
  hmsActions.setFrameworkInfo({
92
88
  type: 'react-web',
93
89
  isPrebuilt: true,
@@ -105,16 +101,6 @@ export const AppData = React.memo(({ appDetails, tokenEndpoint }) => {
105
101
  hmsActions.setAppData(APP_DATA.uiSettings, updatedSettings, true);
106
102
  }, [preferences, hmsActions]);
107
103
 
108
- useEffect(() => {
109
- const appData = {
110
- [APP_DATA.tokenEndpoint]: tokenEndpoint,
111
- [APP_DATA.appConfig]: getAppDetails(appDetails),
112
- };
113
- for (const key in appData) {
114
- hmsActions.setAppData([key], appData[key]);
115
- }
116
- }, [appDetails, tokenEndpoint, hmsActions]);
117
-
118
104
  useEffect(() => {
119
105
  if (!preferences.subscribedNotifications) {
120
106
  return;
@@ -59,10 +59,6 @@ export const useIsRTMPStartedFromUI = () => {
59
59
  return useHMSStore(selectAppData(APP_DATA.rtmpStarted));
60
60
  };
61
61
 
62
- export const useTokenEndpoint = () => {
63
- return useHMSStore(selectAppData(APP_DATA.tokenEndpoint));
64
- };
65
-
66
62
  export const useAuthToken = () => {
67
63
  return useHMSStore(selectAppData(APP_DATA.authToken));
68
64
  };
@@ -3,7 +3,7 @@ import { useHMSActions } from '@100mslive/react-sdk';
3
3
  import { styled } from '../../Theme';
4
4
  import { useHMSPrebuiltContext } from '../AppContext';
5
5
  import { ErrorDialog } from '../primitives/DialogContent';
6
- import { useSetAppDataByKey, useTokenEndpoint } from './AppData/useUISettings';
6
+ import { useSetAppDataByKey } from './AppData/useUISettings';
7
7
  import { APP_DATA } from '../common/constants';
8
8
 
9
9
  /**
@@ -17,7 +17,6 @@ import { APP_DATA } from '../common/constants';
17
17
  */
18
18
  const AuthToken = React.memo(({ authTokenByRoomCodeEndpoint, defaultAuthToken }) => {
19
19
  const hmsActions = useHMSActions();
20
- const tokenEndpoint = useTokenEndpoint();
21
20
  const { roomCode, userId } = useHMSPrebuiltContext();
22
21
  const [error, setError] = useState({ title: '', body: '' });
23
22
  let authToken = defaultAuthToken;
@@ -28,7 +27,8 @@ const AuthToken = React.memo(({ authTokenByRoomCodeEndpoint, defaultAuthToken })
28
27
  setAuthTokenInAppData(authToken);
29
28
  return;
30
29
  }
31
- if (!tokenEndpoint && !roomCode) {
30
+
31
+ if (!roomCode) {
32
32
  return;
33
33
  }
34
34
 
@@ -36,7 +36,7 @@ const AuthToken = React.memo(({ authTokenByRoomCodeEndpoint, defaultAuthToken })
36
36
  .getAuthTokenByRoomCode({ roomCode, userId }, { endpoint: authTokenByRoomCodeEndpoint })
37
37
  .then(token => setAuthTokenInAppData(token))
38
38
  .catch(error => setError(convertError(error)));
39
- }, [hmsActions, tokenEndpoint, authToken, authTokenByRoomCodeEndpoint, setAuthTokenInAppData, roomCode, userId]);
39
+ }, [hmsActions, authToken, authTokenByRoomCodeEndpoint, setAuthTokenInAppData, roomCode, userId]);
40
40
 
41
41
  if (error.title) {
42
42
  return <ErrorDialog title={error.title}>{error.body}</ErrorDialog>;
@@ -1,76 +1,34 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { useMedia } from 'react-use';
3
+ import { selectLocalPeerID, selectSessionStore } from '@100mslive/hms-video-store';
3
4
  import {
4
5
  HMSNotificationTypes,
5
6
  selectHMSMessagesCount,
6
7
  selectPeerNameByID,
7
- selectPermissions,
8
- selectSessionStore,
9
8
  useHMSActions,
10
9
  useHMSNotifications,
11
10
  useHMSStore,
12
11
  } from '@100mslive/react-sdk';
13
- import { ChevronDownIcon, CrossIcon, PinIcon } from '@100mslive/react-icons';
12
+ import { ChevronDownIcon } from '@100mslive/react-icons';
14
13
  import { Button } from '../../../Button';
15
- import { Box, Flex } from '../../../Layout';
16
- import { Text } from '../../../Text';
14
+ import { Flex } from '../../../Layout';
17
15
  import { config as cssConfig } from '../../../Theme';
18
- import { AnnotisedMessage, ChatBody } from './ChatBody';
16
+ import { ChatBody } from './ChatBody';
19
17
  import { ChatFooter } from './ChatFooter';
18
+ import { ChatBlocked, ChatPaused } from './ChatStates';
19
+ import { PinnedMessage } from './PinnedMessage';
20
20
  import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
21
21
  import { useSetSubscribedChatSelector } from '../AppData/useUISettings';
22
- import { useSetPinnedMessage } from '../hooks/useSetPinnedMessage';
22
+ import { useSetPinnedMessages } from '../hooks/useSetPinnedMessages';
23
23
  import { useUnreadCount } from './useUnreadCount';
24
24
  import { CHAT_SELECTOR, SESSION_STORE_KEY } from '../../common/constants';
25
25
 
26
- const PINNED_MESSAGE_LENGTH = 80;
27
-
28
- const PinnedMessage = ({ clearPinnedMessage }) => {
29
- const permissions = useHMSStore(selectPermissions);
30
- const pinnedMessage = useHMSStore(selectSessionStore(SESSION_STORE_KEY.PINNED_MESSAGE));
31
- const formattedPinnedMessage =
32
- pinnedMessage?.length && pinnedMessage.length > PINNED_MESSAGE_LENGTH
33
- ? `${pinnedMessage.slice(0, PINNED_MESSAGE_LENGTH)}...`
34
- : pinnedMessage;
35
-
36
- return pinnedMessage ? (
37
- <Flex
38
- title={pinnedMessage}
39
- css={{ p: '$4', color: '$on_surface_medium', bg: '$surface_default', r: '$1', gap: '$4', mb: '$8', mt: '$8' }}
40
- align="center"
41
- justify="between"
42
- >
43
- <PinIcon />
44
-
45
- <Box
46
- css={{
47
- color: '$on_surface_medium',
48
- w: '100%',
49
- maxHeight: '$18',
50
- overflowY: 'auto',
51
- }}
52
- >
53
- <Text variant="sm">
54
- <AnnotisedMessage message={formattedPinnedMessage} />
55
- </Text>
56
- </Box>
57
- {permissions.removeOthers && (
58
- <Flex
59
- onClick={() => clearPinnedMessage()}
60
- css={{ cursor: 'pointer', color: '$on_surface_medium', '&:hover': { color: '$on_surface_high' } }}
61
- >
62
- <CrossIcon />
63
- </Flex>
64
- )}
65
- </Flex>
66
- ) : null;
67
- };
68
-
69
26
  export const Chat = ({ screenType }) => {
70
27
  const notification = useHMSNotifications(HMSNotificationTypes.PEER_LEFT);
71
28
  const [peerSelector, setPeerSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.PEER_ID);
72
29
  const [roleSelector, setRoleSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.ROLE);
73
30
  const peerName = useHMSStore(selectPeerNameByID(peerSelector));
31
+ const localPeerId = useHMSStore(selectLocalPeerID);
74
32
  const [chatOptions, setChatOptions] = useState({
75
33
  role: roleSelector || '',
76
34
  peerId: peerSelector && peerName ? peerSelector : '',
@@ -79,7 +37,8 @@ export const Chat = ({ screenType }) => {
79
37
  const [isSelectorOpen] = useState(false);
80
38
  const listRef = useRef(null);
81
39
  const hmsActions = useHMSActions();
82
- const { setPinnedMessage } = useSetPinnedMessage();
40
+ const { removePinnedMessage } = useSetPinnedMessages();
41
+ const pinnedMessages = useHMSStore(selectSessionStore(SESSION_STORE_KEY.PINNED_MESSAGES)) || [];
83
42
 
84
43
  useEffect(() => {
85
44
  if (notification && notification.data && peerSelector === notification.data.id) {
@@ -91,9 +50,12 @@ export const Chat = ({ screenType }) => {
91
50
  });
92
51
  }
93
52
  }, [notification, peerSelector, setPeerSelector]);
94
-
53
+ const blacklistedPeerIDs = useHMSStore(selectSessionStore(SESSION_STORE_KEY.CHAT_PEER_BLACKLIST)) || [];
54
+ const blacklistedPeerIDSet = new Set(blacklistedPeerIDs);
55
+ const isLocalPeerBlacklisted = blacklistedPeerIDSet.has(localPeerId);
95
56
  const storeMessageSelector = selectHMSMessagesCount;
96
57
  const { elements } = useRoomLayoutConferencingScreen();
58
+ const { enabled: isChatEnabled = true } = useHMSStore(selectSessionStore(SESSION_STORE_KEY.CHAT_STATE)) || {};
97
59
  const isMobile = useMedia(cssConfig.media.md);
98
60
 
99
61
  let isScrolledToBottom = false;
@@ -125,7 +87,11 @@ export const Chat = ({ screenType }) => {
125
87
  }}
126
88
  >
127
89
  {isMobile && elements?.chat?.is_overlay ? null : (
128
- <>{elements?.chat?.allow_pinning_messages ? <PinnedMessage clearPinnedMessage={setPinnedMessage} /> : null}</>
90
+ <>
91
+ {elements?.chat?.allow_pinning_messages ? (
92
+ <PinnedMessage clearPinnedMessage={index => removePinnedMessage(pinnedMessages, index)} />
93
+ ) : null}
94
+ </>
129
95
  )}
130
96
 
131
97
  <ChatBody
@@ -134,27 +100,39 @@ export const Chat = ({ screenType }) => {
134
100
  ref={listRef}
135
101
  scrollToBottom={scrollToBottom}
136
102
  screenType={screenType}
103
+ blacklistedPeerIDs={blacklistedPeerIDs}
137
104
  />
138
- <ChatFooter
139
- role={chatOptions.role}
140
- onSend={() => scrollToBottom(1)}
141
- selection={chatOptions.selection}
142
- screenType={screenType}
143
- onSelect={({ role, peerId, selection }) => {
144
- setChatOptions({
145
- role,
146
- peerId,
147
- selection,
148
- });
149
- setPeerSelector(peerId);
150
- setRoleSelector(role);
151
- }}
152
- peerId={chatOptions.peerId}
153
- >
154
- {!isSelectorOpen && !isScrolledToBottom && (
155
- <NewMessageIndicator role={chatOptions.role} peerId={chatOptions.peerId} scrollToBottom={scrollToBottom} />
156
- )}
157
- </ChatFooter>
105
+
106
+ <ChatPaused />
107
+
108
+ {isLocalPeerBlacklisted ? <ChatBlocked /> : null}
109
+
110
+ {isMobile && elements?.chat?.is_overlay && elements?.chat?.allow_pinning_messages ? (
111
+ <PinnedMessage clearPinnedMessage={index => removePinnedMessage(pinnedMessages, index)} />
112
+ ) : null}
113
+
114
+ {isChatEnabled && !isLocalPeerBlacklisted ? (
115
+ <ChatFooter
116
+ role={chatOptions.role}
117
+ onSend={() => scrollToBottom(1)}
118
+ selection={chatOptions.selection}
119
+ screenType={screenType}
120
+ onSelect={({ role, peerId, selection }) => {
121
+ setChatOptions({
122
+ role,
123
+ peerId,
124
+ selection,
125
+ });
126
+ setPeerSelector(peerId);
127
+ setRoleSelector(role);
128
+ }}
129
+ peerId={chatOptions.peerId}
130
+ >
131
+ {!isSelectorOpen && !isScrolledToBottom && (
132
+ <NewMessageIndicator role={chatOptions.role} peerId={chatOptions.peerId} scrollToBottom={scrollToBottom} />
133
+ )}
134
+ </ChatFooter>
135
+ ) : null}
158
136
  </Flex>
159
137
  );
160
138
  };