@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
@@ -4,9 +4,19 @@ import {
4
4
  DefaultConferencingScreen_Elements,
5
5
  HLSLiveStreamingScreen_Elements,
6
6
  } from '@100mslive/types-prebuilt';
7
- import { selectIsConnectedToRoom, selectLocalPeerRoleName, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
7
+ import { v4 as uuid } from 'uuid';
8
+ import {
9
+ selectIsConnectedToRoom,
10
+ selectLocalPeerName,
11
+ selectLocalPeerRoleName,
12
+ selectSessionStore,
13
+ useHMSActions,
14
+ useHMSStore,
15
+ } from '@100mslive/react-sdk';
8
16
  // @ts-ignore: No implicit Any
9
17
  import FullPageProgress from '../components/FullPageProgress';
18
+ // @ts-ignore: No implicit Any
19
+ import { ToastBatcher } from '../components/Toast/ToastBatcher';
10
20
  import { GridLayout } from '../components/VideoLayouts/GridLayout';
11
21
  import { Flex } from '../../Layout';
12
22
  // @ts-ignore: No implicit Any
@@ -46,15 +56,33 @@ export const VideoStreamingSection = ({
46
56
  const waitingViewerRole = useWaitingViewerRole();
47
57
  const urlToIframe = useUrlToEmbed();
48
58
  const pdfAnnotatorActive = usePDFConfig();
59
+ const localPeerName = useHMSStore(selectLocalPeerName);
60
+ const { enabled: isChatEnabled = true, updatedBy: chatStateUpdatedBy = '' } =
61
+ useHMSStore(selectSessionStore(SESSION_STORE_KEY.CHAT_STATE)) || {};
49
62
 
50
63
  useEffect(() => {
51
64
  if (!isConnected) {
52
65
  return;
53
66
  }
54
- hmsActions.sessionStore.observe([SESSION_STORE_KEY.PINNED_MESSAGE, SESSION_STORE_KEY.SPOTLIGHT]);
67
+ hmsActions.sessionStore.observe([
68
+ SESSION_STORE_KEY.PINNED_MESSAGES,
69
+ SESSION_STORE_KEY.SPOTLIGHT,
70
+ SESSION_STORE_KEY.CHAT_STATE,
71
+ SESSION_STORE_KEY.CHAT_MESSAGE_BLACKLIST,
72
+ SESSION_STORE_KEY.CHAT_PEER_BLACKLIST,
73
+ ]);
55
74
  // eslint-disable-next-line react-hooks/exhaustive-deps
56
75
  }, [isConnected, hmsActions]);
57
76
 
77
+ useEffect(() => {
78
+ if (!chatStateUpdatedBy || chatStateUpdatedBy === localPeerName) {
79
+ return;
80
+ }
81
+ const type = isChatEnabled ? 'CHAT_RESUMED' : 'CHAT_PAUSED';
82
+ const notification = { id: uuid(), message: '', type, data: { name: localPeerName } };
83
+ ToastBatcher.showToast({ notification, type });
84
+ }, [isChatEnabled, chatStateUpdatedBy, localPeerName]);
85
+
58
86
  if (!localPeerRole) {
59
87
  // we don't know the role yet to decide how to render UI
60
88
  return null;
@@ -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 {