@100mslive/roomkit-react 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. package/dist/{HLSView-PWVM4OIP.js → HLSView-IENE4HRP.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/Notifications/ChatNotifications.d.ts +2 -0
  11. package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +2 -1
  12. package/dist/Prebuilt/components/VirtualBackground/VBCollection.d.ts +2 -1
  13. package/dist/Prebuilt/components/VirtualBackground/VBPicker.d.ts +3 -0
  14. package/dist/Prebuilt/components/VirtualBackground/constants.d.ts +0 -6
  15. package/dist/Prebuilt/components/hooks/useChatBlacklist.d.ts +4 -0
  16. package/dist/Prebuilt/components/hooks/useSetPinnedMessages.d.ts +16 -0
  17. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +3 -2
  18. package/dist/{chunk-WREKGNP6.js → chunk-U4AB6X6M.js} +2178 -1148
  19. package/dist/chunk-U4AB6X6M.js.map +7 -0
  20. package/dist/index.cjs.js +2746 -1638
  21. package/dist/index.cjs.js.map +4 -4
  22. package/dist/index.js +1 -1
  23. package/dist/meta.cjs.json +803 -208
  24. package/dist/meta.esbuild.json +812 -217
  25. package/package.json +8 -7
  26. package/src/Prebuilt/App.tsx +3 -14
  27. package/src/Prebuilt/AppContext.tsx +0 -2
  28. package/src/Prebuilt/common/{constants.js → constants.ts} +22 -20
  29. package/src/Prebuilt/components/AppData/{AppData.jsx → AppData.tsx} +8 -22
  30. package/src/Prebuilt/components/AppData/useUISettings.js +0 -4
  31. package/src/Prebuilt/components/AuthToken.jsx +15 -5
  32. package/src/Prebuilt/components/Chat/Chat.jsx +49 -73
  33. package/src/Prebuilt/components/Chat/ChatBody.jsx +241 -51
  34. package/src/Prebuilt/components/Chat/ChatFooter.tsx +56 -6
  35. package/src/Prebuilt/components/Chat/ChatStates.jsx +68 -0
  36. package/src/Prebuilt/components/Chat/MwebChatOption.tsx +24 -0
  37. package/src/Prebuilt/components/Chat/Navigation.tsx +60 -0
  38. package/src/Prebuilt/components/Chat/PinnedMessage.tsx +116 -0
  39. package/src/Prebuilt/components/Footer/Footer.tsx +4 -7
  40. package/src/Prebuilt/components/Header/common.jsx +1 -1
  41. package/src/Prebuilt/components/Notifications/ChatNotifications.tsx +34 -0
  42. package/src/Prebuilt/components/Notifications/Notifications.tsx +2 -0
  43. package/src/Prebuilt/components/Polls/Voting/QuestionCard.jsx +6 -4
  44. package/src/Prebuilt/components/Polls/Voting/TimedVoting.jsx +3 -2
  45. package/src/Prebuilt/components/Polls/common/VoteCount.jsx +6 -4
  46. package/src/Prebuilt/components/Preview/PreviewJoin.tsx +7 -9
  47. package/src/Prebuilt/components/RoleChangeRequest/RoleChangeRequestModal.tsx +4 -1
  48. package/src/Prebuilt/components/Settings/DeviceSettings.jsx +1 -1
  49. package/src/Prebuilt/components/SidePaneTabs.tsx +3 -2
  50. package/src/Prebuilt/components/Toast/ToastConfig.jsx +1 -0
  51. package/src/Prebuilt/components/VirtualBackground/VBCollection.tsx +4 -4
  52. package/src/Prebuilt/components/VirtualBackground/{VBPicker.jsx → VBPicker.tsx} +64 -44
  53. package/src/Prebuilt/components/VirtualBackground/constants.ts +0 -8
  54. package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +10 -1
  55. package/src/Prebuilt/components/hooks/useChatBlacklist.ts +21 -0
  56. package/src/Prebuilt/components/hooks/useSetPinnedMessages.ts +75 -0
  57. package/src/Prebuilt/components/hooks/useUserPreferences.jsx +1 -0
  58. package/src/Prebuilt/layouts/SidePane.tsx +1 -1
  59. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +16 -8
  60. package/src/Prebuilt/plugins/whiteboard/PusherCommunicationProvider.js +1 -1
  61. package/src/Prebuilt/plugins/whiteboard/README.md +1 -1
  62. package/src/Prebuilt/primitives/DialogContent.jsx +1 -1
  63. package/src/Prebuilt/provider/roomLayoutProvider/constants/index.ts +12 -1
  64. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +5 -1
  65. package/dist/chunk-WREKGNP6.js.map +0 -7
  66. package/src/Prebuilt/components/hooks/useSetPinnedMessage.js +0 -38
  67. package/src/Prebuilt/services/tokenService.js +0 -49
  68. /package/dist/{HLSView-PWVM4OIP.js.map → HLSView-IENE4HRP.js.map} +0 -0
@@ -42,7 +42,16 @@ export const useAutoStartStreaming = () => {
42
42
  streamStartedRef.current = false;
43
43
  setHLSStarted(false);
44
44
  }
45
- }, [hmsActions, isHLSRunning, isHLSStarted, setHLSStarted, showStreamingUI, isRTMPRunning]);
45
+ }, [
46
+ hmsActions,
47
+ isHLSRunning,
48
+ isHLSStarted,
49
+ setHLSStarted,
50
+ showStreamingUI,
51
+ isRTMPRunning,
52
+ isHLSRecordingOn,
53
+ isBrowserRecordingOn,
54
+ ]);
46
55
 
47
56
  useEffect(() => {
48
57
  if (!isHLSStarted && !isHLSRunning) {
@@ -0,0 +1,21 @@
1
+ import { useCallback } from 'react';
2
+ import { useHMSActions } from '@100mslive/react-sdk';
3
+ // @ts-ignore
4
+ import { ToastManager } from '../Toast/ToastManager';
5
+ import { SESSION_STORE_KEY } from '../../common/constants';
6
+
7
+ export const useChatBlacklist = (
8
+ sessionStoreKey: SESSION_STORE_KEY.CHAT_MESSAGE_BLACKLIST | SESSION_STORE_KEY.CHAT_PEER_BLACKLIST,
9
+ ) => {
10
+ const hmsActions = useHMSActions();
11
+
12
+ const blacklistItem = useCallback(
13
+ async (blacklistedIDs: string[], blacklistID: string) =>
14
+ await hmsActions.sessionStore
15
+ .set(sessionStoreKey, [...blacklistedIDs, blacklistID])
16
+ .catch(err => ToastManager.addToast({ title: err.description })),
17
+ [hmsActions, sessionStoreKey],
18
+ );
19
+
20
+ return { blacklistItem };
21
+ };
@@ -0,0 +1,75 @@
1
+ import { useCallback } from 'react';
2
+ import { HMSMessage, selectPeerNameByID, useHMSActions, useHMSVanillaStore } from '@100mslive/react-sdk';
3
+ // @ts-ignore
4
+ import { ToastManager } from '../Toast/ToastManager';
5
+ // @ts-ignore
6
+ import { SESSION_STORE_KEY } from '../../common/constants';
7
+
8
+ type PinnedMessage = {
9
+ text: string;
10
+ id: string;
11
+ authorId: string;
12
+ pinnedBy: string;
13
+ };
14
+
15
+ /**
16
+ * set pinned chat message by updating the session store
17
+ */
18
+ export const useSetPinnedMessages = () => {
19
+ const hmsActions = useHMSActions();
20
+ const vanillaStore = useHMSVanillaStore();
21
+
22
+ const setPinnedMessages = useCallback(
23
+ async (pinnedMessages: PinnedMessage[] = [], message: HMSMessage, pinnedBy: string) => {
24
+ const peerName = vanillaStore.getState(selectPeerNameByID(message?.sender)) || message?.senderName;
25
+ const newPinnedMessage = { text: '', id: message.id, pinnedBy, authorId: message?.senderUserId || '' };
26
+
27
+ if (message && peerName) {
28
+ newPinnedMessage['text'] = `${peerName}: ${message.message}`;
29
+ } else if (message) {
30
+ newPinnedMessage['text'] = message.message;
31
+ }
32
+
33
+ if (newPinnedMessage && !pinnedMessages.find(pinnedMessage => pinnedMessage.id === newPinnedMessage.id)) {
34
+ await hmsActions.sessionStore
35
+ .set(SESSION_STORE_KEY.PINNED_MESSAGES, [...pinnedMessages, newPinnedMessage].slice(-3)) // Limiting to maximum of 3 messages - FIFO
36
+ .catch(err => ToastManager.addToast({ title: err.description }));
37
+ }
38
+ },
39
+ [hmsActions, vanillaStore],
40
+ );
41
+
42
+ const removePinnedMessage = useCallback(
43
+ async (pinnedMessages: PinnedMessage[] = [], indexToRemove: number) => {
44
+ if (pinnedMessages[indexToRemove]) {
45
+ await hmsActions.sessionStore
46
+ .set(
47
+ SESSION_STORE_KEY.PINNED_MESSAGES,
48
+ pinnedMessages.filter((_, index: number) => index !== indexToRemove),
49
+ )
50
+ .catch(err => ToastManager.addToast({ title: err.description }));
51
+ }
52
+ },
53
+ [hmsActions],
54
+ );
55
+
56
+ const unpinBlacklistedMessages = useCallback(
57
+ async (
58
+ pinnedMessages: PinnedMessage[] = [],
59
+ blacklistedPeerIDSet: Set<string>,
60
+ blacklistedMessageIDSet: Set<string>,
61
+ ) => {
62
+ const filteredPinnedMessages = pinnedMessages?.filter(
63
+ pinnedMessage =>
64
+ !blacklistedMessageIDSet?.has(pinnedMessage.id) && !blacklistedPeerIDSet.has(pinnedMessage.authorId),
65
+ );
66
+
67
+ await hmsActions.sessionStore
68
+ .set(SESSION_STORE_KEY.PINNED_MESSAGES, filteredPinnedMessages)
69
+ .catch(err => ToastManager.addToast({ title: err.description }));
70
+ },
71
+ [hmsActions],
72
+ );
73
+
74
+ return { setPinnedMessages, removePinnedMessage, unpinBlacklistedMessages };
75
+ };
@@ -6,6 +6,7 @@ export const UserPreferencesKeys = {
6
6
  NOTIFICATIONS: 'notifications',
7
7
  UI_SETTINGS: 'uiSettings',
8
8
  RTMP_URLS: 'rtmpUrls',
9
+ USER_ID: 'userId',
9
10
  };
10
11
 
11
12
  export const defaultPreviewPreference = {
@@ -41,7 +41,7 @@ const SidePane = ({
41
41
  ViewComponent = <SidePaneTabs screenType={screenType} hideControls={hideControls} active={sidepane} />;
42
42
  }
43
43
  if (sidepane === SIDE_PANE_OPTIONS.VB) {
44
- ViewComponent = <VBPicker />;
44
+ ViewComponent = <VBPicker {...elements.virtual_background} />;
45
45
  }
46
46
 
47
47
  useEffect(() => {
@@ -8,7 +8,7 @@ import { selectIsConnectedToRoom, selectLocalPeerRoleName, useHMSActions, useHMS
8
8
  // @ts-ignore: No implicit Any
9
9
  import FullPageProgress from '../components/FullPageProgress';
10
10
  import { GridLayout } from '../components/VideoLayouts/GridLayout';
11
- import { Flex } from '../../Layout';
11
+ import { Box, Flex } from '../../Layout';
12
12
  // @ts-ignore: No implicit Any
13
13
  import { EmbedView } from './EmbedView';
14
14
  // @ts-ignore: No implicit Any
@@ -51,7 +51,13 @@ export const VideoStreamingSection = ({
51
51
  if (!isConnected) {
52
52
  return;
53
53
  }
54
- hmsActions.sessionStore.observe([SESSION_STORE_KEY.PINNED_MESSAGE, SESSION_STORE_KEY.SPOTLIGHT]);
54
+ hmsActions.sessionStore.observe([
55
+ SESSION_STORE_KEY.PINNED_MESSAGES,
56
+ SESSION_STORE_KEY.SPOTLIGHT,
57
+ SESSION_STORE_KEY.CHAT_STATE,
58
+ SESSION_STORE_KEY.CHAT_MESSAGE_BLACKLIST,
59
+ SESSION_STORE_KEY.CHAT_PEER_BLACKLIST,
60
+ ]);
55
61
  // eslint-disable-next-line react-hooks/exhaustive-deps
56
62
  }, [isConnected, hmsActions]);
57
63
 
@@ -84,12 +90,14 @@ export const VideoStreamingSection = ({
84
90
  }}
85
91
  >
86
92
  {ViewComponent}
87
- <SidePane
88
- screenType={screenType}
89
- // @ts-ignore
90
- tileProps={(elements as DefaultConferencingScreen_Elements)?.video_tile_layout?.grid}
91
- hideControls={hideControls}
92
- />
93
+ <Box css={{ height: '100%', maxHeight: '100%', overflowY: 'clip' }}>
94
+ <SidePane
95
+ screenType={screenType}
96
+ // @ts-ignore
97
+ tileProps={(elements as DefaultConferencingScreen_Elements)?.video_tile_layout?.grid}
98
+ hideControls={hideControls}
99
+ />
100
+ </Box>
93
101
  </Flex>
94
102
  </Suspense>
95
103
  );
@@ -36,7 +36,7 @@ class PusherCommunicationProvider {
36
36
 
37
37
  /** @private */
38
38
  this.pusher = new Pusher(process.env.REACT_APP_PUSHER_APP_KEY, {
39
- cluster: 'ap2',
39
+ cluster: process.env.REACT_APP_PUSHER_CLUSTER || 'ap2',
40
40
  authEndpoint: process.env.REACT_APP_PUSHER_AUTHENDPOINT,
41
41
  });
42
42
 
@@ -24,6 +24,6 @@ APP_ID="app_id"
24
24
  ## Whiteboard Client
25
25
 
26
26
  - Copy the whole folder at `/src/plugins/whiteboard` into your live video conferencing apps using 100ms' SDKs.
27
- - Add the pusher app key and pusher auth endpoint to `REACT_APP_PUSHER_APP_KEY` and `REACT_APP_PUSHER_AUTHENDPOINT` environment variables.
27
+ - Add the pusher app key, auth endpoint and cluster to `REACT_APP_PUSHER_APP_KEY`, `REACT_APP_PUSHER_AUTHENDPOINT`, `REACT_APP_PUSHER_CLUSTER` environment variables.
28
28
  - The `useWhiteboardMetadata` hook returns state such as the whiteboard owner(`whiteboardOwner`) and action to toggle the whiteboard(`toggleWhiteboard`). Refer usage in `ToggleWhiteboard.jsx` - an icon button to toggle the whiteboard based on the active state.
29
29
  - When the whiteboard is active(`whiteboardOwner` from `useWhiteboardMetadata` is not null), render the `Whiteboard` component on your UI to let your users draw on the whiteboard. Refer `mainView.jsx` and `WhiteboardView.jsx`.
@@ -102,7 +102,7 @@ export const RequestDialog = ({ open = true, onOpenChange, title, body, actionTe
102
102
  );
103
103
 
104
104
  /**
105
- * a row of items which breaks into column on small screen. For e.g. title on left and options to select
105
+ * a row of items which breaks into column on small screen. For example title on left and options to select
106
106
  * from on right for select component.
107
107
  */
108
108
  export const DialogRow = ({ children, breakSm = false, css, justify = 'between' }) => {
@@ -30,7 +30,18 @@ export const defaultLayout: Layout = {
30
30
  conferencing: {
31
31
  default: {
32
32
  elements: {
33
- chat: {},
33
+ chat: {
34
+ public_chat_enabled: true,
35
+ private_chat_enabled: true,
36
+ chat_title: 'Chat',
37
+ allow_pinning_messages: true,
38
+ message_placeholder: 'Send a message...',
39
+ real_time_controls: {
40
+ can_disable_chat: true,
41
+ can_block_user: true,
42
+ can_hide_message: true,
43
+ },
44
+ },
34
45
  participant_list: {},
35
46
  video_tile_layout: {
36
47
  grid: {
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  ConferencingScreen,
3
+ DefaultConferencingScreen_Elements,
3
4
  DefaultPreviewScreen_Elements,
5
+ HLSLiveStreamingScreen_Elements,
4
6
  LeaveScreen,
5
7
  PreviewScreen,
6
8
  Screens,
@@ -43,10 +45,12 @@ export function useRoomLayoutPreviewScreen() {
43
45
  };
44
46
  }
45
47
 
48
+ export type ConferencingScreenElements = DefaultConferencingScreen_Elements & HLSLiveStreamingScreen_Elements;
49
+
46
50
  export function useRoomLayoutConferencingScreen() {
47
51
  const screenProps = useRoomLayoutScreen({ screen: 'conferencing' }) || {};
48
52
  const screenType = Object.keys(screenProps)[0] as keyof ConferencingScreen;
49
- const elements = screenProps[screenType]?.elements;
53
+ const elements = screenProps[screenType]?.elements as ConferencingScreenElements;
50
54
  // @ts-ignore
51
55
  const hideSections: string[] = screenProps[screenType]?.hideSections || [];
52
56
  return {