@100mslive/roomkit-react 0.3.22-alpha.0 → 0.3.22-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. package/dist/Accordion/Accordion.d.ts +134 -322
  2. package/dist/Accordion/index.d.ts +134 -322
  3. package/dist/Avatar/Avatar.d.ts +47 -141
  4. package/dist/Button/Button.d.ts +47 -141
  5. package/dist/Checkbox/Checkbox.d.ts +134 -322
  6. package/dist/Collapsible/Collapsible.d.ts +201 -483
  7. package/dist/Divider/Divider.d.ts +134 -322
  8. package/dist/Dropdown/Dropdown.d.ts +804 -1932
  9. package/dist/Fieldset/Fieldset.d.ts +47 -141
  10. package/dist/Footer/Footer.d.ts +536 -1288
  11. package/dist/{HLSView-EPPGI6XI.js → HLSView-LCFZPBH3.js} +2 -2
  12. package/dist/{HLSView-JYFTZVCM.css → HLSView-Z2JID2W7.css} +3 -3
  13. package/dist/{HLSView-JYFTZVCM.css.map → HLSView-Z2JID2W7.css.map} +1 -1
  14. package/dist/IconButton/IconButton.d.ts +47 -141
  15. package/dist/Input/Input.d.ts +362 -926
  16. package/dist/Label/Label.d.ts +47 -141
  17. package/dist/Layout/Box.d.ts +47 -141
  18. package/dist/Layout/Flex.d.ts +47 -141
  19. package/dist/Link/Link.d.ts +47 -141
  20. package/dist/Modal/Dialog.d.ts +329 -987
  21. package/dist/Modal/DialogContent.d.ts +469 -1127
  22. package/dist/Pagination/StyledPagination.d.ts +268 -644
  23. package/dist/Popover/index.d.ts +201 -483
  24. package/dist/Prebuilt/IconButton.d.ts +134 -322
  25. package/dist/Prebuilt/components/Chat/ChatBody.d.ts +134 -322
  26. package/dist/Prebuilt/components/Leave/LeaveAtoms.d.ts +335 -805
  27. package/dist/Prebuilt/components/Notifications/DeviceChangeNotifications.d.ts +1 -0
  28. package/dist/Prebuilt/components/Notifications/DeviceInUseError.d.ts +2 -0
  29. package/dist/Prebuilt/components/Notifications/ErrorNotifications.d.ts +1 -0
  30. package/dist/Prebuilt/components/Notifications/MessageNotifications.d.ts +1 -0
  31. package/dist/Prebuilt/components/Notifications/PollNotificationModal.d.ts +1 -0
  32. package/dist/Prebuilt/components/Settings/common.d.ts +134 -322
  33. package/dist/Progress/index.d.ts +134 -322
  34. package/dist/RadioGroup/RadioGroup.d.ts +201 -483
  35. package/dist/ReactSelect/ReactSelect.d.ts +670 -1610
  36. package/dist/Select/Select.d.ts +201 -483
  37. package/dist/Sheet/Sheet.d.ts +329 -987
  38. package/dist/Slider/Slider.d.ts +47 -141
  39. package/dist/Stats/StyledStats.d.ts +402 -966
  40. package/dist/Switch/Switch.d.ts +47 -141
  41. package/dist/Tabs/Tabs.d.ts +268 -644
  42. package/dist/Text/Text.d.ts +47 -141
  43. package/dist/TextArea/TextArea.d.ts +47 -141
  44. package/dist/Theme/base.config.d.ts +26 -78
  45. package/dist/Theme/stitches.config.d.ts +1046 -1493
  46. package/dist/TileMenu/StyledMenuTile.d.ts +469 -1127
  47. package/dist/Toast/Toast.d.ts +382 -946
  48. package/dist/Video/Video.d.ts +47 -141
  49. package/dist/VideoList/StyledVideoList.d.ts +201 -483
  50. package/dist/VideoTile/StyledVideoTile.d.ts +670 -1610
  51. package/dist/{chunk-ZAX5VT7V.js → chunk-CRGZUJSX.js} +1000 -875
  52. package/dist/chunk-CRGZUJSX.js.map +7 -0
  53. package/dist/index.cjs.css +2 -2
  54. package/dist/index.cjs.css.map +1 -1
  55. package/dist/index.cjs.js +1038 -861
  56. package/dist/index.cjs.js.map +4 -4
  57. package/dist/index.css +2 -2
  58. package/dist/index.css.map +1 -1
  59. package/dist/index.js +1 -1
  60. package/dist/meta.cjs.json +348 -78
  61. package/dist/meta.esbuild.json +355 -85
  62. package/package.json +8 -8
  63. package/src/Avatar/Avatar.tsx +1 -1
  64. package/src/Popover/Popover.stories.tsx +1 -1
  65. package/src/Prebuilt/components/Header/common.jsx +6 -5
  66. package/src/Prebuilt/components/Notifications/DeviceChangeNotifications.tsx +18 -0
  67. package/src/Prebuilt/components/Notifications/DeviceInUseError.tsx +79 -0
  68. package/src/Prebuilt/components/Notifications/ErrorNotifications.tsx +56 -0
  69. package/src/Prebuilt/components/Notifications/MessageNotifications.tsx +24 -0
  70. package/src/Prebuilt/components/Notifications/Notifications.tsx +13 -159
  71. package/src/Prebuilt/components/Notifications/PeerNotifications.tsx +23 -2
  72. package/src/Prebuilt/components/Notifications/PollNotificationModal.tsx +71 -0
  73. package/src/Prebuilt/components/Notifications/ReconnectNotifications.tsx +1 -5
  74. package/src/Prebuilt/components/Notifications/TrackBulkUnmuteModal.tsx +7 -5
  75. package/src/Prebuilt/components/Notifications/TrackNotifications.tsx +23 -1
  76. package/src/Prebuilt/components/Notifications/TrackUnmuteModal.tsx +13 -5
  77. package/src/Prebuilt/components/StatsForNerds.jsx +32 -3
  78. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +2 -2
  79. package/src/Prebuilt/components/VirtualBackground/VBOption.tsx +3 -1
  80. package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +6 -0
  81. package/dist/chunk-ZAX5VT7V.js.map +0 -7
  82. /package/dist/{HLSView-EPPGI6XI.js.map → HLSView-LCFZPBH3.js.map} +0 -0
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "prebuilt",
11
11
  "roomkit"
12
12
  ],
13
- "version": "0.3.22-alpha.0",
13
+ "version": "0.3.22-alpha.1",
14
14
  "author": "100ms",
15
15
  "license": "MIT",
16
16
  "repository": {
@@ -75,12 +75,12 @@
75
75
  "react": ">=17.0.2 <19.0.0"
76
76
  },
77
77
  "dependencies": {
78
- "@100mslive/hls-player": "0.3.22-alpha.0",
78
+ "@100mslive/hls-player": "0.3.22-alpha.1",
79
79
  "@100mslive/hms-noise-cancellation": "0.0.1",
80
- "@100mslive/hms-virtual-background": "1.13.22-alpha.0",
81
- "@100mslive/hms-whiteboard": "0.0.12-alpha.0",
82
- "@100mslive/react-icons": "0.10.22-alpha.0",
83
- "@100mslive/react-sdk": "0.10.22-alpha.0",
80
+ "@100mslive/hms-virtual-background": "1.13.22-alpha.1",
81
+ "@100mslive/hms-whiteboard": "0.0.12-alpha.1",
82
+ "@100mslive/react-icons": "0.10.22-alpha.1",
83
+ "@100mslive/react-sdk": "0.10.22-alpha.1",
84
84
  "@100mslive/types-prebuilt": "0.12.12",
85
85
  "@emoji-mart/data": "^1.0.6",
86
86
  "@emoji-mart/react": "^1.0.1",
@@ -99,7 +99,7 @@
99
99
  "@radix-ui/react-tabs": "1.0.0",
100
100
  "@radix-ui/react-toast": "1.0.0",
101
101
  "@radix-ui/react-tooltip": "1.0.6",
102
- "@stitches/react": "^1.2.8",
102
+ "@stitches/react": "1.3.1-1",
103
103
  "emoji-mart": "^5.2.2",
104
104
  "eventemitter2": "^6.4.9",
105
105
  "lodash.merge": "^4.6.2",
@@ -117,5 +117,5 @@
117
117
  "uuid": "^8.3.2",
118
118
  "worker-timers": "^7.0.40"
119
119
  },
120
- "gitHead": "d6442187dcb9cfd7be47e4fa96fce78f4ac4f50b"
120
+ "gitHead": "12d0289650b160b7c4b97cbd4336877a2e4baf4b"
121
121
  }
@@ -13,7 +13,7 @@ export const StyledAvatar = styled('div', {
13
13
  ...flexCenter,
14
14
  color: '$colors$on_primary_high',
15
15
  fontFamily: '$sans',
16
- aspectRatio: 1,
16
+ aspectRatio: '1',
17
17
  fontWeight: 600,
18
18
  fontSize: '$space$9',
19
19
  variants: {
@@ -32,7 +32,7 @@ const Template: ComponentStory<typeof Popover.Root> = () => (
32
32
  <Button
33
33
  variant="standard"
34
34
  css={{
35
- aspectRatio: 1,
35
+ aspectRatio: '1',
36
36
  r: '$round',
37
37
  p: '$2 $2',
38
38
  bg: '$background_default',
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import {
3
3
  DeviceType,
4
4
  getAudioDeviceCategory,
5
+ HMSAudioDeviceCategory,
5
6
  selectIsLocalVideoEnabled,
6
7
  selectLocalVideoTrackID,
7
8
  selectVideoTrackByID,
@@ -79,13 +80,13 @@ export const AudioActions = () => {
79
80
  if (!audioFiltered) {
80
81
  return null;
81
82
  }
82
- const deviceCategory = getAudioDeviceCategory(currentSelection.label);
83
+ const deviceCategory = getAudioDeviceCategory(currentSelection?.label);
83
84
  let AudioIcon = <SpeakerIcon />;
84
- if (deviceCategory === 'bluetooth') {
85
+ if (deviceCategory === HMSAudioDeviceCategory.BLUETOOTH) {
85
86
  AudioIcon = <BluetoothIcon />;
86
- } else if (deviceCategory === 'wired') {
87
+ } else if (deviceCategory === HMSAudioDeviceCategory.WIRED) {
87
88
  AudioIcon = <HeadphonesIcon />;
88
- } else if (deviceCategory === 'earpiece') {
89
+ } else if (deviceCategory === HMSAudioDeviceCategory.EARPIECE) {
89
90
  AudioIcon = <TelePhoneIcon />;
90
91
  }
91
92
  return (
@@ -112,7 +113,7 @@ export const AudioActions = () => {
112
113
  await hmsActions.refreshDevices();
113
114
  }}
114
115
  >
115
- <IconButton>{AudioIcon} </IconButton>
116
+ <IconButton>{AudioIcon}</IconButton>
116
117
  </Box>
117
118
  </AudioSelectionSheet>
118
119
  );
@@ -0,0 +1,18 @@
1
+ import { useEffect } from 'react';
2
+ import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
3
+ // @ts-ignore: No implicit Any
4
+ import { ToastManager } from '../Toast/ToastManager';
5
+
6
+ export const DeviceChangeNotifications = () => {
7
+ const notification = useHMSNotifications(HMSNotificationTypes.DEVICE_CHANGE_UPDATE);
8
+
9
+ useEffect(() => {
10
+ if (notification) {
11
+ ToastManager.addToast({
12
+ title: notification.message,
13
+ });
14
+ }
15
+ }, [notification]);
16
+
17
+ return null;
18
+ };
@@ -0,0 +1,79 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
3
+ import { Button, Dialog, Text } from '../../..';
4
+ // @ts-ignore: No implicit Any
5
+ import { DialogContent, DialogRow } from '../../primitives/DialogContent';
6
+ // @ts-ignore: No implicit Any
7
+ import { ToastManager } from '../Toast/ToastManager';
8
+
9
+ const Instruction = ({ description }: { description: string }) => (
10
+ <li>
11
+ <DialogRow css={{ ml: '$4' }}>
12
+ <Text variant="body2">{description}</Text>
13
+ </DialogRow>
14
+ </li>
15
+ );
16
+
17
+ export function DeviceInUseError() {
18
+ const notification = useHMSNotifications(HMSNotificationTypes.ERROR);
19
+ const [showDeviceInUseModal, setShowDeviceInUseModal] = useState(false);
20
+ const [deviceType, setDeviceType] = useState('');
21
+
22
+ useEffect(() => {
23
+ const error = notification?.data;
24
+ if (!error || error.code !== 3003) {
25
+ return;
26
+ }
27
+
28
+ const errorMessage = error?.message;
29
+ ToastManager.addToast({
30
+ title: `Error: ${errorMessage} - ${error?.description}`,
31
+ action: (
32
+ <Button outlined variant="standard" css={{ w: 'max-content' }} onClick={() => setShowDeviceInUseModal(true)}>
33
+ Help
34
+ </Button>
35
+ ),
36
+ });
37
+
38
+ const hasAudio = errorMessage.includes('audio');
39
+ const hasVideo = errorMessage.includes('video');
40
+ const hasScreen = errorMessage.includes('screen');
41
+ if (hasAudio && hasVideo) {
42
+ setDeviceType('camera and microphone');
43
+ } else if (hasAudio) {
44
+ setDeviceType('microphone');
45
+ } else if (hasVideo) {
46
+ setDeviceType('camera');
47
+ } else if (hasScreen) {
48
+ setDeviceType('screen');
49
+ }
50
+ }, [notification]);
51
+
52
+ return (
53
+ <Dialog.Root
54
+ open={showDeviceInUseModal}
55
+ onOpenChange={() => {
56
+ setShowDeviceInUseModal(false);
57
+ }}
58
+ >
59
+ <DialogContent title="Device Access Error">
60
+ <DialogRow>
61
+ <Text variant="body2">
62
+ We weren't able to access your {deviceType} since it's either in use by another application or is not
63
+ configured properly. Please follow the following instructions to resolve this issue.
64
+ </Text>
65
+ </DialogRow>
66
+ <ol>
67
+ <Instruction
68
+ description={`Please check if the ${deviceType} device(s) are in use by another browser or application and close it.`}
69
+ />
70
+ <Instruction
71
+ description={`Go to Browser Settings > Privacy and security > Site settings > ${deviceType} and check if your preferred device is selected as default.`}
72
+ />
73
+ <Instruction description="Try restarting the browser." />
74
+ <Instruction description="Try disconnecting and reconnecting the external device if your intention is to use one." />
75
+ </ol>
76
+ </DialogContent>
77
+ </Dialog.Root>
78
+ );
79
+ }
@@ -0,0 +1,56 @@
1
+ import React, { useEffect } from 'react';
2
+ import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
3
+ import { GroupIcon } from '@100mslive/react-icons';
4
+ import { Box } from '../../../Layout';
5
+ // @ts-ignore: No implicit Any
6
+ import { ToastManager } from '../Toast/ToastManager';
7
+ // @ts-ignore: No implicit Any
8
+ import { useSubscribedNotifications } from '../AppData/useUISettings';
9
+
10
+ export const ErrorNotifications = () => {
11
+ const notification = useHMSNotifications(HMSNotificationTypes.ERROR);
12
+ const subscribedNotifications = useSubscribedNotifications() || {};
13
+
14
+ useEffect(() => {
15
+ if (!notification || !notification.data) return;
16
+
17
+ const { isTerminal, action, code, message, description } = notification.data;
18
+
19
+ if (isTerminal && action !== 'INIT') {
20
+ if ([500, 6008].includes(code)) {
21
+ ToastManager.addToast({
22
+ title: `Error: ${message}`,
23
+ });
24
+ } else if (message === 'role limit reached') {
25
+ ToastManager.addToast({
26
+ title: 'The room is currently full, try joining later',
27
+ close: true,
28
+ icon: (
29
+ <Box css={{ color: '$alert_error_default' }}>
30
+ <GroupIcon />
31
+ </Box>
32
+ ),
33
+ });
34
+ } else {
35
+ ToastManager.addToast({
36
+ title: message || 'We couldn’t reconnect you. When you’re back online, try joining the room.',
37
+ close: false,
38
+ });
39
+ }
40
+ return;
41
+ }
42
+ // Autoplay error or user denied screen share (cancelled browser pop-up)
43
+ if ([3008, 3001, 3011].includes(code)) {
44
+ return;
45
+ }
46
+ if (action === 'INIT') {
47
+ return;
48
+ }
49
+ if (!subscribedNotifications.ERROR) return;
50
+ ToastManager.addToast({
51
+ title: `Error: ${message} - ${description}`,
52
+ });
53
+ }, [notification, subscribedNotifications.ERROR]);
54
+
55
+ return null;
56
+ };
@@ -0,0 +1,24 @@
1
+ import { useEffect } from 'react';
2
+ import { HMSNotificationTypes, selectIsLocalScreenShared } from '@100mslive/hms-video-store';
3
+ import { useAwayNotifications, useHMSNotifications, useHMSStore } from '@100mslive/react-sdk';
4
+ import { useRoomLayout } from '../../provider/roomLayoutProvider';
5
+ import { usePIPWindow } from '../PIP/usePIPWindow';
6
+
7
+ export const MessageNotifications = () => {
8
+ const notification = useHMSNotifications(HMSNotificationTypes.NEW_MESSAGE);
9
+ const amIScreenSharing = useHMSStore(selectIsLocalScreenShared);
10
+ const logoURL = useRoomLayout()?.logo?.url;
11
+ const { pipWindow } = usePIPWindow();
12
+ const { showNotification } = useAwayNotifications();
13
+
14
+ useEffect(() => {
15
+ if (notification && amIScreenSharing && !notification.data?.ignored && !pipWindow) {
16
+ showNotification(`New message from ${notification.data.senderName}`, {
17
+ body: notification.data.message,
18
+ icon: logoURL,
19
+ });
20
+ }
21
+ }, [notification]);
22
+
23
+ return null;
24
+ };
@@ -1,59 +1,31 @@
1
1
  /* eslint-disable no-case-declarations */
2
- import React, { useCallback, useEffect } from 'react';
3
- import {
4
- HMSNotificationTypes,
5
- HMSRoleChangeRequest,
6
- HMSRoomState,
7
- selectIsLocalScreenShared,
8
- selectLocalPeerID,
9
- selectPeerNameByID,
10
- selectRoomState,
11
- useAwayNotifications,
12
- useCustomEvent,
13
- useHMSNotifications,
14
- useHMSStore,
15
- useHMSVanillaStore,
16
- } from '@100mslive/react-sdk';
17
- import { GroupIcon } from '@100mslive/react-icons';
18
- import { Box, Button } from '../../..';
19
- import { useRoomLayout, useUpdateRoomLayout } from '../../provider/roomLayoutProvider';
2
+ import React, { useCallback } from 'react';
3
+ import { HMSRoleChangeRequest, HMSRoomState, selectRoomState, useCustomEvent, useHMSStore } from '@100mslive/react-sdk';
20
4
  // @ts-ignore: No implicit Any
21
5
  import { ToastManager } from '../Toast/ToastManager';
22
6
  import { AutoplayBlockedModal } from './AutoplayBlockedModal';
23
7
  import { ChatNotifications } from './ChatNotifications';
8
+ import { DeviceChangeNotifications } from './DeviceChangeNotifications';
9
+ import { DeviceInUseError } from './DeviceInUseError';
10
+ import { ErrorNotifications } from './ErrorNotifications';
24
11
  import { HandRaisedNotifications } from './HandRaisedNotifications';
25
12
  import { InitErrorModal } from './InitErrorModal';
13
+ import { MessageNotifications } from './MessageNotifications';
26
14
  import { PeerNotifications } from './PeerNotifications';
27
15
  import { PermissionErrorNotificationModal } from './PermissionErrorModal';
16
+ import { PollNotificationModal } from './PollNotificationModal';
28
17
  import { ReconnectNotifications } from './ReconnectNotifications';
29
18
  import { TrackBulkUnmuteModal } from './TrackBulkUnmuteModal';
30
19
  import { TrackNotifications } from './TrackNotifications';
31
20
  import { TrackUnmuteModal } from './TrackUnmuteModal';
32
21
  import { TranscriptionNotifications } from './TranscriptionNotifications';
33
- import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
34
22
  // @ts-ignore: No implicit Any
35
- import { usePollViewToggle } from '../AppData/useSidepane';
36
- // @ts-ignore: No implicit Any
37
- import { useIsNotificationDisabled, useSubscribedNotifications } from '../AppData/useUISettings';
38
- import { usePIPWindow } from '../PIP/usePIPWindow';
23
+ import { useIsNotificationDisabled } from '../AppData/useUISettings';
39
24
  import { ROLE_CHANGE_DECLINED } from '../../common/constants';
40
25
 
41
- const pollToastKey: Record<string, string> = {};
42
-
43
26
  export function Notifications() {
44
- const localPeerID = useHMSStore(selectLocalPeerID);
45
- const notification = useHMSNotifications();
46
- const subscribedNotifications = useSubscribedNotifications() || {};
47
27
  const roomState = useHMSStore(selectRoomState);
48
- const updateRoomLayoutForRole = useUpdateRoomLayout();
49
28
  const isNotificationDisabled = useIsNotificationDisabled();
50
- const screenProps = useRoomLayoutConferencingScreen();
51
- const vanillaStore = useHMSVanillaStore();
52
- const togglePollView = usePollViewToggle();
53
- const { showNotification } = useAwayNotifications();
54
- const amIScreenSharing = useHMSStore(selectIsLocalScreenShared);
55
- const logoURL = useRoomLayout()?.logo?.url;
56
- const { pipWindow } = usePIPWindow();
57
29
 
58
30
  const handleRoleChangeDenied = useCallback((request: HMSRoleChangeRequest & { peerName: string }) => {
59
31
  ToastManager.addToast({
@@ -64,129 +36,6 @@ export function Notifications() {
64
36
 
65
37
  useCustomEvent({ type: ROLE_CHANGE_DECLINED, onEvent: handleRoleChangeDenied });
66
38
 
67
- useEffect(() => {
68
- if (!notification || isNotificationDisabled) {
69
- return;
70
- }
71
- switch (notification.type) {
72
- case HMSNotificationTypes.NAME_UPDATED:
73
- console.log(notification.data.id + ' changed their name to ' + notification.data.name);
74
- break;
75
- case HMSNotificationTypes.ERROR:
76
- if (notification.data?.isTerminal && notification.data?.action !== 'INIT') {
77
- if ([500, 6008].includes(notification.data?.code)) {
78
- ToastManager.addToast({
79
- title: `Error: ${notification.data?.message}`,
80
- });
81
- } else if (notification.data?.message === 'role limit reached') {
82
- ToastManager.addToast({
83
- title: 'The room is currently full, try joining later',
84
- close: true,
85
- icon: (
86
- <Box css={{ color: '$alert_error_default' }}>
87
- <GroupIcon />
88
- </Box>
89
- ),
90
- });
91
- } else {
92
- ToastManager.addToast({
93
- title:
94
- notification.data?.message ||
95
- 'We couldn’t reconnect you. When you’re back online, try joining the room.',
96
- close: false,
97
- });
98
- }
99
- return;
100
- }
101
- // Autoplay error or user denied screen share (cancelled browser pop-up)
102
- if (notification.data?.code === 3008 || notification.data?.code === 3001 || notification.data?.code === 3011) {
103
- return;
104
- }
105
- if (notification.data?.action === 'INIT') {
106
- return;
107
- }
108
- if (!subscribedNotifications.ERROR) return;
109
- ToastManager.addToast({
110
- title: `Error: ${notification.data?.message} - ${notification.data?.description}`,
111
- });
112
- break;
113
- case HMSNotificationTypes.ROLE_UPDATED: {
114
- if (notification.data?.isLocal && notification.data?.roleName) {
115
- ToastManager.addToast({
116
- title: `You are now a ${notification.data.roleName}`,
117
- });
118
- updateRoomLayoutForRole?.(notification.data.roleName);
119
- }
120
- break;
121
- }
122
- case HMSNotificationTypes.CHANGE_TRACK_STATE_REQUEST:
123
- const track = notification.data?.track;
124
- if (!notification.data.enabled) {
125
- ToastManager.addToast({
126
- title: `Your ${track.source} ${track.type} was muted by
127
- ${notification.data.requestedBy?.name}.`,
128
- });
129
- }
130
- break;
131
- case HMSNotificationTypes.REMOVED_FROM_ROOM:
132
- case HMSNotificationTypes.ROOM_ENDED:
133
- ToastManager.addToast({
134
- title: `${notification.message}.
135
- ${notification.data.reason && `Reason: ${notification.data.reason}`}`,
136
- });
137
- break;
138
- case HMSNotificationTypes.DEVICE_CHANGE_UPDATE:
139
- ToastManager.addToast({
140
- title: notification.message,
141
- });
142
- break;
143
-
144
- case HMSNotificationTypes.POLL_STARTED:
145
- if (notification.data.startedBy !== localPeerID && screenProps.screenType !== 'hls_live_streaming') {
146
- const pollStartedBy = vanillaStore.getState(selectPeerNameByID(notification.data.startedBy)) || 'Participant';
147
-
148
- const pollToastID = ToastManager.addToast({
149
- title: `${pollStartedBy} started a ${notification.data.type}: ${notification.data.title}`,
150
- action: (
151
- <Button
152
- onClick={() => togglePollView(notification.data.id)}
153
- variant="standard"
154
- css={{
155
- backgroundColor: '$surface_bright',
156
- fontWeight: '$semiBold',
157
- color: '$on_surface_high',
158
- p: '$xs $md',
159
- }}
160
- >
161
- {notification.data.type === 'quiz' ? 'Answer' : 'Vote'}
162
- </Button>
163
- ),
164
- duration: Infinity,
165
- });
166
- pollToastKey[notification.data.id] = pollToastID;
167
- }
168
- break;
169
- case HMSNotificationTypes.POLL_STOPPED:
170
- const pollID = notification?.data.id;
171
- if (pollID && pollToastKey?.[pollID]) {
172
- ToastManager.removeToast(pollToastKey?.[notification.data.id]);
173
- delete pollToastKey[notification?.data.id];
174
- }
175
- break;
176
- case HMSNotificationTypes.NEW_MESSAGE:
177
- if (amIScreenSharing && !notification.data?.ignored && !pipWindow) {
178
- showNotification(`New message from ${notification.data.senderName}`, {
179
- body: notification.data.message,
180
- icon: logoURL,
181
- });
182
- }
183
- break;
184
- default:
185
- break;
186
- }
187
- // eslint-disable-next-line react-hooks/exhaustive-deps
188
- }, [notification, subscribedNotifications.ERROR, subscribedNotifications.METADATA_UPDATED]);
189
-
190
39
  if (isNotificationDisabled) {
191
40
  return null;
192
41
  }
@@ -197,13 +46,18 @@ export function Notifications() {
197
46
  <TrackBulkUnmuteModal />
198
47
  <TrackNotifications />
199
48
  {roomState === HMSRoomState.Connected ? <PeerNotifications /> : null}
49
+ <PollNotificationModal />
50
+ <MessageNotifications />
51
+ <DeviceChangeNotifications />
200
52
  <ReconnectNotifications />
53
+ <ErrorNotifications />
201
54
  <AutoplayBlockedModal />
202
55
  <PermissionErrorNotificationModal />
203
56
  <InitErrorModal />
204
57
  <ChatNotifications />
205
58
  <HandRaisedNotifications />
206
59
  <TranscriptionNotifications />
60
+ <DeviceInUseError />
207
61
  </>
208
62
  );
209
63
  }
@@ -1,19 +1,28 @@
1
1
  import { useEffect } from 'react';
2
2
  import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
3
+ import { useUpdateRoomLayout } from '../../provider/roomLayoutProvider';
3
4
  // @ts-ignore: No implicit Any
4
5
  import { ToastBatcher } from '../Toast/ToastBatcher';
5
6
  // @ts-ignore: No implicit Any
7
+ import { ToastManager } from '../Toast/ToastManager';
8
+ // @ts-ignore: No implicit Any
6
9
  import { useSetSubscribedChatSelector, useSubscribedNotifications } from '../AppData/useUISettings';
7
10
  // @ts-ignore: No implicit Any
8
11
  import { CHAT_SELECTOR, SUBSCRIBED_NOTIFICATIONS } from '../../common/constants';
9
12
 
10
- const notificationTypes = [HMSNotificationTypes.PEER_JOINED, HMSNotificationTypes.PEER_LEFT];
13
+ const notificationTypes = [
14
+ HMSNotificationTypes.PEER_JOINED,
15
+ HMSNotificationTypes.PEER_LEFT,
16
+ HMSNotificationTypes.NAME_UPDATED,
17
+ HMSNotificationTypes.ROLE_UPDATED,
18
+ ];
11
19
 
12
20
  export const PeerNotifications = () => {
13
21
  const notification = useHMSNotifications(notificationTypes);
14
22
  const isPeerJoinSubscribed = useSubscribedNotifications(SUBSCRIBED_NOTIFICATIONS.PEER_JOINED);
15
23
  const isPeerLeftSubscribed = useSubscribedNotifications(SUBSCRIBED_NOTIFICATIONS.PEER_LEFT);
16
24
  const [selectedPeer, setPeerSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.PEER);
25
+ const updateRoomLayoutForRole = useUpdateRoomLayout();
17
26
 
18
27
  useEffect(() => {
19
28
  if (!notification?.data) {
@@ -35,11 +44,23 @@ export const PeerNotifications = () => {
35
44
  return;
36
45
  }
37
46
  break;
47
+ case HMSNotificationTypes.NAME_UPDATED:
48
+ console.log(notification.data.id + ' changed their name to ' + notification.data.name);
49
+ return;
50
+ case HMSNotificationTypes.ROLE_UPDATED: {
51
+ if (notification.data?.isLocal && notification.data?.roleName) {
52
+ ToastManager.addToast({
53
+ title: `You are now a ${notification.data.roleName}`,
54
+ });
55
+ updateRoomLayoutForRole?.(notification.data.roleName);
56
+ }
57
+ return;
58
+ }
38
59
  default:
39
60
  return;
40
61
  }
41
62
  ToastBatcher.showToast({ notification });
42
- }, [notification, isPeerJoinSubscribed, isPeerLeftSubscribed, selectedPeer.id, setPeerSelector]);
63
+ }, [notification]);
43
64
 
44
65
  return null;
45
66
  };
@@ -0,0 +1,71 @@
1
+ import React, { useEffect } from 'react';
2
+ import {
3
+ HMSNotificationTypes,
4
+ selectLocalPeerID,
5
+ selectPeerNameByID,
6
+ useHMSNotifications,
7
+ useHMSStore,
8
+ useHMSVanillaStore,
9
+ } from '@100mslive/react-sdk';
10
+ import { Button } from '../../../Button';
11
+ // @ts-ignore: No implicit Any
12
+ import { ToastManager } from '../Toast/ToastManager';
13
+ import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
14
+ // @ts-ignore: No implicit Any
15
+ import { usePollViewToggle } from '../AppData/useSidepane';
16
+
17
+ const notificationTypes = [HMSNotificationTypes.POLL_STARTED, HMSNotificationTypes.POLL_STOPPED];
18
+
19
+ const pollToastKey: Record<string, string> = {};
20
+
21
+ export const PollNotificationModal = () => {
22
+ const togglePollView = usePollViewToggle();
23
+ const localPeerID = useHMSStore(selectLocalPeerID);
24
+ const vanillaStore = useHMSVanillaStore();
25
+ const screenProps = useRoomLayoutConferencingScreen();
26
+
27
+ const notification = useHMSNotifications(notificationTypes);
28
+
29
+ useEffect(() => {
30
+ switch (notification?.type) {
31
+ case HMSNotificationTypes.POLL_STARTED:
32
+ if (notification.data.startedBy !== localPeerID && screenProps.screenType !== 'hls_live_streaming') {
33
+ const pollStartedBy = vanillaStore.getState(selectPeerNameByID(notification.data.startedBy)) || 'Participant';
34
+
35
+ const pollToastID = ToastManager.addToast({
36
+ title: `${pollStartedBy} started a ${notification.data.type}: ${notification.data.title}`,
37
+ action: (
38
+ <Button
39
+ onClick={() => togglePollView(notification.data.id)}
40
+ variant="standard"
41
+ css={{
42
+ backgroundColor: '$surface_bright',
43
+ fontWeight: '$semiBold',
44
+ color: '$on_surface_high',
45
+ p: '$xs $md',
46
+ }}
47
+ >
48
+ {notification.data.type === 'quiz' ? 'Answer' : 'Vote'}
49
+ </Button>
50
+ ),
51
+ duration: Infinity,
52
+ });
53
+ pollToastKey[notification.data.id] = pollToastID;
54
+ }
55
+ break;
56
+ case HMSNotificationTypes.POLL_STOPPED:
57
+ {
58
+ const pollID = notification?.data.id;
59
+ if (pollID && pollToastKey?.[pollID]) {
60
+ ToastManager.removeToast(pollToastKey?.[notification.data.id]);
61
+ delete pollToastKey[notification?.data.id];
62
+ }
63
+ }
64
+ break;
65
+ default:
66
+ break;
67
+ }
68
+ }, [notification]);
69
+
70
+ return null;
71
+ };
@@ -5,11 +5,7 @@ import { ToastConfig } from '../Toast/ToastConfig';
5
5
  // @ts-ignore: No implicit Any
6
6
  import { ToastManager } from '../Toast/ToastManager';
7
7
 
8
- const notificationTypes = [
9
- HMSNotificationTypes.RECONNECTED,
10
- HMSNotificationTypes.RECONNECTING,
11
- HMSNotificationTypes.ERROR,
12
- ];
8
+ const notificationTypes = [HMSNotificationTypes.RECONNECTED, HMSNotificationTypes.RECONNECTING];
13
9
  let notificationId: string | null = null;
14
10
 
15
11
  export const ReconnectNotifications = () => {
@@ -9,14 +9,16 @@ import { MicOnIcon } from '@100mslive/react-icons';
9
9
  // @ts-ignore: No implicit Any
10
10
  import { RequestDialog } from '../../primitives/DialogContent';
11
11
 
12
+ const notificationTypes = [
13
+ HMSNotificationTypes.CHANGE_MULTI_TRACK_STATE_REQUEST,
14
+ HMSNotificationTypes.ROOM_ENDED,
15
+ HMSNotificationTypes.REMOVED_FROM_ROOM,
16
+ ];
17
+
12
18
  export const TrackBulkUnmuteModal = () => {
13
19
  const hmsActions = useHMSActions();
14
20
  const [muteNotification, setMuteNotification] = useState<HMSChangeMultiTrackStateRequest | null>(null);
15
- const notification = useHMSNotifications([
16
- HMSNotificationTypes.CHANGE_MULTI_TRACK_STATE_REQUEST,
17
- HMSNotificationTypes.ROOM_ENDED,
18
- HMSNotificationTypes.REMOVED_FROM_ROOM,
19
- ]);
21
+ const notification = useHMSNotifications(notificationTypes);
20
22
 
21
23
  useEffect(() => {
22
24
  switch (notification?.type) {