@100mslive/roomkit-react 0.3.23 → 0.3.24-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) 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/IconButton/IconButton.d.ts +47 -141
  12. package/dist/Input/Input.d.ts +362 -926
  13. package/dist/Label/Label.d.ts +47 -141
  14. package/dist/Layout/Box.d.ts +47 -141
  15. package/dist/Layout/Flex.d.ts +47 -141
  16. package/dist/Link/Link.d.ts +47 -141
  17. package/dist/Modal/Dialog.d.ts +329 -987
  18. package/dist/Modal/DialogContent.d.ts +469 -1127
  19. package/dist/Pagination/StyledPagination.d.ts +268 -644
  20. package/dist/Popover/index.d.ts +201 -483
  21. package/dist/Prebuilt/IconButton.d.ts +134 -322
  22. package/dist/Prebuilt/components/Chat/ChatBody.d.ts +134 -322
  23. package/dist/Prebuilt/components/Leave/LeaveAtoms.d.ts +335 -805
  24. package/dist/Prebuilt/components/Notifications/DeviceChangeNotifications.d.ts +1 -0
  25. package/dist/Prebuilt/components/Notifications/ErrorNotifications.d.ts +1 -0
  26. package/dist/Prebuilt/components/Notifications/MessageNotifications.d.ts +1 -0
  27. package/dist/Prebuilt/components/Notifications/PollNotificationModal.d.ts +1 -0
  28. package/dist/Prebuilt/components/Notifications/RoleChangeNotification.d.ts +1 -0
  29. package/dist/Prebuilt/components/Settings/common.d.ts +134 -322
  30. package/dist/Progress/index.d.ts +134 -322
  31. package/dist/RadioGroup/RadioGroup.d.ts +201 -483
  32. package/dist/ReactSelect/ReactSelect.d.ts +670 -1610
  33. package/dist/Select/Select.d.ts +201 -483
  34. package/dist/Sheet/Sheet.d.ts +329 -987
  35. package/dist/Slider/Slider.d.ts +47 -141
  36. package/dist/Stats/StyledStats.d.ts +402 -966
  37. package/dist/Switch/Switch.d.ts +47 -141
  38. package/dist/Tabs/Tabs.d.ts +268 -644
  39. package/dist/Text/Text.d.ts +47 -141
  40. package/dist/TextArea/TextArea.d.ts +47 -141
  41. package/dist/Theme/base.config.d.ts +26 -78
  42. package/dist/Theme/stitches.config.d.ts +1046 -1493
  43. package/dist/TileMenu/StyledMenuTile.d.ts +469 -1127
  44. package/dist/Toast/Toast.d.ts +382 -946
  45. package/dist/Video/Video.d.ts +47 -141
  46. package/dist/VideoList/StyledVideoList.d.ts +201 -483
  47. package/dist/VideoTile/StyledVideoTile.d.ts +670 -1610
  48. package/dist/android-perm-1.png +0 -0
  49. package/dist/audio-level.png +0 -0
  50. package/dist/empty-chat.svg +12 -0
  51. package/dist/index.cjs.css +2 -2
  52. package/dist/index.cjs.css.map +1 -1
  53. package/dist/index.cjs.js +34062 -37242
  54. package/dist/index.cjs.js.map +4 -4
  55. package/dist/index.css +2 -2
  56. package/dist/index.css.map +1 -1
  57. package/dist/index.js +36387 -67
  58. package/dist/index.js.map +4 -4
  59. package/dist/ios-perm-0.png +0 -0
  60. package/dist/meta.cjs.json +1531 -1218
  61. package/dist/meta.esbuild.json +942 -794
  62. package/dist/pdf-share.png +0 -0
  63. package/dist/screen-share.png +0 -0
  64. package/dist/transaction_error.svg +12 -0
  65. package/package.json +8 -8
  66. package/src/Avatar/Avatar.tsx +1 -1
  67. package/src/Popover/Popover.stories.tsx +1 -1
  68. package/src/Prebuilt/components/Chat/Chat.tsx +1 -1
  69. package/src/Prebuilt/components/Chat/ChatFooter.tsx +1 -1
  70. package/src/Prebuilt/components/Footer/WhiteboardToggle.tsx +11 -4
  71. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +3 -3
  72. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +3 -0
  73. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +14 -1
  74. package/src/Prebuilt/components/Notifications/DeviceChangeNotifications.tsx +18 -0
  75. package/src/Prebuilt/components/Notifications/ErrorNotifications.tsx +56 -0
  76. package/src/Prebuilt/components/Notifications/MessageNotifications.tsx +24 -0
  77. package/src/Prebuilt/components/Notifications/Notifications.tsx +13 -171
  78. package/src/Prebuilt/components/Notifications/PeerNotifications.tsx +9 -2
  79. package/src/Prebuilt/components/Notifications/PollNotificationModal.tsx +71 -0
  80. package/src/Prebuilt/components/Notifications/ReconnectNotifications.tsx +1 -5
  81. package/src/Prebuilt/components/Notifications/RoleChangeNotification.tsx +24 -0
  82. package/src/Prebuilt/components/Notifications/TrackBulkUnmuteModal.tsx +7 -5
  83. package/src/Prebuilt/components/Notifications/TrackNotifications.tsx +23 -1
  84. package/src/Prebuilt/components/Notifications/TrackUnmuteModal.tsx +13 -5
  85. package/src/Prebuilt/components/Preview/PreviewJoin.tsx +3 -2
  86. package/src/Prebuilt/components/StatsForNerds.jsx +122 -9
  87. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +0 -1
  88. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +2 -2
  89. package/src/Prebuilt/components/VirtualBackground/VBOption.tsx +3 -1
  90. package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +6 -0
  91. package/src/Prebuilt/layouts/HLSView.jsx +3 -3
  92. package/src/Prebuilt/layouts/PDFView.jsx +1 -0
  93. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +82 -86
  94. package/src/Prebuilt/layouts/WaitingView.tsx +2 -2
  95. package/dist/HLSView-HYI6LLL6.js +0 -1652
  96. package/dist/HLSView-HYI6LLL6.js.map +0 -7
  97. package/dist/HLSView-S4NJF7Q2.css +0 -2780
  98. package/dist/HLSView-S4NJF7Q2.css.map +0 -7
  99. package/dist/chunk-LRJSQMZ4.js +0 -34759
  100. package/dist/chunk-LRJSQMZ4.js.map +0 -7
Binary file
Binary file
@@ -0,0 +1,12 @@
1
+ <svg width="80" height="80" viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M70 68.3333V26.6667C70 24.825 68.5083 23.3333 66.6667 23.3333H13.3333C11.4917 23.3333 10 24.825 10 26.6667V68.3333C10 70.175 11.4917 71.6667 13.3333 71.6667H66.6667C68.5083 71.6667 70 70.175 70 68.3333Z" fill="#272A31"/>
3
+ <path d="M20 31.6667H60C61.8417 31.6667 63.3333 33.1583 63.3333 35C63.3333 36.8417 61.8417 38.3333 60 38.3333H20C18.1583 38.3333 16.6667 36.8417 16.6667 35C16.6667 33.1583 18.1583 31.6667 20 31.6667Z" fill="#8F9099"/>
4
+ <path d="M58.3333 36.6667V10C58.3333 9.08 57.5867 8.33334 56.6667 8.33334H55C55 9.25334 54.2533 10 53.3333 10C52.4133 10 51.6667 9.25334 51.6667 8.33334H48.3333C48.3333 9.25334 47.5867 10 46.6667 10C45.7467 10 45 9.25334 45 8.33334H41.6667C41.6667 9.25334 40.92 10 40 10C39.08 10 38.3333 9.25334 38.3333 8.33334H35C35 9.25334 34.2533 10 33.3333 10C32.4133 10 31.6667 9.25334 31.6667 8.33334H28.3333C28.3333 9.25334 27.5867 10 26.6667 10C25.7467 10 25 9.25334 25 8.33334H23.3333C22.4133 8.33334 21.6667 9.08 21.6667 10V36.6667H58.3333Z" fill="#C74E5B"/>
5
+ <path d="M21.6667 43.3333H58.3333C60.175 43.3333 61.6667 44.825 61.6667 46.6667V50C61.6667 51.8417 60.175 53.3333 58.3333 53.3333H21.6667C19.825 53.3333 18.3333 51.8417 18.3333 50V46.6667C18.3333 44.825 19.825 43.3333 21.6667 43.3333Z" fill="#C5C6D0"/>
6
+ <path d="M60 66.6667H55C54.08 66.6667 53.3333 65.92 53.3333 65V60C53.3333 59.08 54.08 58.3333 55 58.3333H60C60.92 58.3333 61.6667 59.08 61.6667 60V65C61.6667 65.92 60.92 66.6667 60 66.6667Z" fill="#C5C6D0"/>
7
+ <path d="M25 66.6667H20C19.08 66.6667 18.3333 65.92 18.3333 65V60C18.3333 59.08 19.08 58.3333 20 58.3333H25C25.92 58.3333 26.6667 59.08 26.6667 60V65C26.6667 65.92 25.92 66.6667 25 66.6667ZM36.6667 66.6667H31.6667C30.7467 66.6667 30 65.92 30 65V60C30 59.08 30.7467 58.3333 31.6667 58.3333H36.6667C37.5867 58.3333 38.3333 59.08 38.3333 60V65C38.3333 65.92 37.5867 66.6667 36.6667 66.6667ZM48.3333 66.6667H43.3333C42.4133 66.6667 41.6667 65.92 41.6667 65V60C41.6667 59.08 42.4133 58.3333 43.3333 58.3333H48.3333C49.2533 58.3333 50 59.08 50 60V65C50 65.92 49.2533 66.6667 48.3333 66.6667Z" fill="#C5C6D0"/>
8
+ <path d="M58.3333 35H21.6667V38.3333H58.3333V35Z" fill="#C74E5B"/>
9
+ <path opacity="0.05" d="M45.3033 32.315C44.6383 32.315 44.01 32.0567 43.5367 31.585L40 28.0467L36.465 31.5817C35.9917 32.0533 35.365 32.3133 34.6967 32.3133C34.0283 32.3133 33.4 32.0533 32.9267 31.58L31.75 30.4033C31.2783 29.9333 31.0183 29.3033 31.0183 28.6333C31.0183 27.9667 31.2783 27.3383 31.75 26.8667L35.2867 23.3333L31.7517 19.7983C31.28 19.3283 31.02 18.7 31.02 18.0317C31.02 17.3617 31.28 16.7333 31.7517 16.2617L32.93 15.0833C33.4017 14.6117 34.0283 14.3517 34.6983 14.3517C35.3633 14.3517 35.9917 14.61 36.465 15.0817L40 18.62L43.535 15.0833C44.0083 14.6117 44.635 14.3517 45.3033 14.3517C45.9683 14.3517 46.5967 14.61 47.07 15.0817L48.25 16.2617C48.7217 16.7317 48.9817 17.3617 48.9817 18.0317C48.9817 18.6983 48.7217 19.3267 48.25 19.7983L44.7117 23.3333L48.2483 26.87C49.2217 27.84 49.2233 29.425 48.2517 30.4017L47.07 31.5833C46.5983 32.055 45.9717 32.315 45.3033 32.315Z" fill="black"/>
10
+ <path opacity="0.07" d="M45.3033 31.4817C44.8583 31.4817 44.44 31.3083 44.125 30.995L40 26.8683L35.875 30.9933C35.56 31.3083 35.1417 31.48 34.6967 31.48C34.25 31.48 33.8317 31.3067 33.5183 30.9917L32.34 29.8133C32.025 29.4983 31.8517 29.08 31.8517 28.6333C31.8517 28.1883 32.025 27.77 32.34 27.455L36.465 23.3333L32.34 19.2083C32.0267 18.895 31.8517 18.4767 31.8517 18.0317C31.8517 17.585 32.025 17.1667 32.34 16.8517L33.5183 15.6733C33.8317 15.36 34.25 15.1867 34.6967 15.1867C35.1417 15.1867 35.56 15.36 35.875 15.6733L40 19.7983L44.125 15.6717C44.44 15.3567 44.8583 15.185 45.3033 15.185C45.7483 15.185 46.1667 15.3583 46.4817 15.6717L47.66 16.8517C47.975 17.1667 48.1483 17.585 48.1483 18.0317C48.1483 18.4767 47.975 18.895 47.66 19.21L43.5333 23.3333L47.66 27.46C48.31 28.1067 48.31 29.1633 47.6617 29.815L46.4817 30.995C46.1667 31.3083 45.7483 31.4817 45.3033 31.4817Z" fill="black"/>
11
+ <path d="M42.3567 23.3333L47.0717 18.6183C47.3967 18.2933 47.3967 17.765 47.0717 17.44L45.8933 16.2617C45.5667 15.9367 45.04 15.9367 44.715 16.2617L40 20.9767L35.2867 16.2633C34.9617 15.9383 34.4333 15.9383 34.1083 16.2633L32.93 17.4417C32.605 17.7667 32.605 18.295 32.93 18.62L37.6433 23.3333L32.93 28.0467C32.605 28.3717 32.605 28.9 32.93 29.225L34.1083 30.4033C34.4333 30.7283 34.9617 30.7283 35.2867 30.4033L40 25.69L44.715 30.405C45.04 30.73 45.5683 30.73 45.8933 30.405L47.0717 29.2267C47.3967 28.9 47.3967 28.3733 47.0717 28.0483L42.3567 23.3333Z" fill="#FFEDEC"/>
12
+ </svg>
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "prebuilt",
11
11
  "roomkit"
12
12
  ],
13
- "version": "0.3.23",
13
+ "version": "0.3.24-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.23",
78
+ "@100mslive/hls-player": "0.3.24-alpha.1",
79
79
  "@100mslive/hms-noise-cancellation": "0.0.1",
80
- "@100mslive/hms-virtual-background": "1.13.23",
81
- "@100mslive/hms-whiteboard": "0.0.13",
82
- "@100mslive/react-icons": "0.10.23",
83
- "@100mslive/react-sdk": "0.10.23",
80
+ "@100mslive/hms-virtual-background": "1.13.24-alpha.1",
81
+ "@100mslive/hms-whiteboard": "0.0.14-alpha.1",
82
+ "@100mslive/react-icons": "0.10.24-alpha.1",
83
+ "@100mslive/react-sdk": "0.10.24-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": "b82ff1de51cc685dc6fb0bff9a36d69f4120fd65"
120
+ "gitHead": "18cb652a46d0b15c85cedc5193b301ef4080be81"
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',
@@ -8,7 +8,7 @@ import { ChevronDownIcon } from '@100mslive/react-icons';
8
8
  import { Button } from '../../../Button';
9
9
  import { Box, Flex } from '../../../Layout';
10
10
  import { config as cssConfig } from '../../../Theme';
11
- // @ts-ignore: No implicit any
11
+ // @ts-ignore: No implicit Any
12
12
  import { EmojiReaction } from '../EmojiReaction';
13
13
  import { MoreSettings } from '../MoreSettings/MoreSettings';
14
14
  import { RaiseHand } from '../RaiseHand';
@@ -1,6 +1,6 @@
1
1
  import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { useMedia } from 'react-use';
3
- import data from '@emoji-mart/data';
3
+ import data from '@emoji-mart/data/sets/14/apple.json';
4
4
  import Picker from '@emoji-mart/react';
5
5
  import { HMSException, selectLocalPeer, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
6
6
  import { EmojiIcon, PauseCircleIcon, SendIcon, VerticalMenuIcon } from '@100mslive/react-icons';
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { selectPeerScreenSharing, useHMSStore, useWhiteboard } from '@100mslive/react-sdk';
3
3
  import { PencilDrawIcon } from '@100mslive/react-icons';
4
4
  import { Tooltip } from '../../..';
@@ -11,6 +11,7 @@ export const WhiteboardToggle = () => {
11
11
  const { toggle, open, isOwner } = useWhiteboard();
12
12
  const peerSharing = useHMSStore(selectPeerScreenSharing);
13
13
  const disabled = !!peerSharing || (open && !isOwner);
14
+ const [isLoading, setLoading] = useState(false);
14
15
 
15
16
  if (!toggle) {
16
17
  return null;
@@ -25,17 +26,23 @@ export const WhiteboardToggle = () => {
25
26
  >
26
27
  <IconButton
27
28
  onClick={async () => {
28
- if (disabled) {
29
+ if (disabled || isLoading) {
29
30
  return;
30
31
  }
31
32
  try {
32
- await toggle();
33
+ if (!open) {
34
+ setLoading(true);
35
+ await toggle();
36
+ setTimeout(() => setLoading(false), 500);
37
+ } else {
38
+ await toggle();
39
+ }
33
40
  } catch (error) {
34
41
  ToastManager.addToast({ title: (error as Error).message, variant: 'error' });
35
42
  }
36
43
  }}
37
44
  active={!open}
38
- disabled={disabled}
45
+ disabled={disabled || isLoading}
39
46
  data-testid="whiteboard_btn"
40
47
  >
41
48
  <PencilDrawIcon />
@@ -1,7 +1,7 @@
1
1
  import React, { forwardRef, useEffect, useState } from 'react';
2
2
  import { Flex } from '../../../Layout';
3
3
 
4
- export const HMSVideo = forwardRef(({ children, ...props }, videoRef) => {
4
+ export const HMSVideo = forwardRef(({ children, isFullScreen, ...props }, videoRef) => {
5
5
  const [width, setWidth] = useState('auto');
6
6
 
7
7
  useEffect(() => {
@@ -22,7 +22,7 @@ export const HMSVideo = forwardRef(({ children, ...props }, videoRef) => {
22
22
  return () => {
23
23
  videoEl.removeEventListener('loadedmetadata', updatingVideoWidth);
24
24
  };
25
- }, []);
25
+ }, [videoRef, width]);
26
26
  return (
27
27
  <Flex
28
28
  data-testid="hms-video"
@@ -33,7 +33,7 @@ export const HMSVideo = forwardRef(({ children, ...props }, videoRef) => {
33
33
  transition: 'all 0.3s ease-in-out',
34
34
  '@md': {
35
35
  '& video': {
36
- height: props.isFullScreen ? '' : '$60 !important',
36
+ height: isFullScreen ? '' : '$60 !important',
37
37
  },
38
38
  },
39
39
  '& video::cue': {
@@ -130,6 +130,9 @@ export const DesktopOptions = ({
130
130
 
131
131
  <Dropdown.Content
132
132
  sideOffset={5}
133
+ onCloseAutoFocus={e => {
134
+ e.preventDefault();
135
+ }}
133
136
  align="end"
134
137
  css={{
135
138
  py: '$0',
@@ -43,6 +43,8 @@ import { StopRecordingInSheet } from '../../Header/StreamActions';
43
43
  // @ts-ignore: No implicit any
44
44
  import SettingsModal from '../../Settings/SettingsModal';
45
45
  // @ts-ignore: No implicit any
46
+ import { StatsForNerds } from '../../StatsForNerds';
47
+ // @ts-ignore: No implicit any
46
48
  import { ToastManager } from '../../Toast/ToastManager';
47
49
  // @ts-ignore: No implicit any
48
50
  import { ActionTile } from '../ActionTile';
@@ -94,6 +96,7 @@ export const MwebOptions = ({
94
96
  const [openModals, setOpenModals] = useState(new Set());
95
97
  const [openOptionsSheet, setOpenOptionsSheet] = useState(false);
96
98
  const [openSettingsSheet, setOpenSettingsSheet] = useState(false);
99
+ const [openStatsForNerdsSheet, setOpenStatsForNerdsSheet] = useState(false);
97
100
  const [showEmojiCard, setShowEmojiCard] = useState(false);
98
101
  const [showRecordingOn, setShowRecordingOn] = useState(false);
99
102
  const toggleParticipants = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
@@ -269,7 +272,15 @@ export const MwebOptions = ({
269
272
  <SettingsIcon />
270
273
  <ActionTile.Title>Settings</ActionTile.Title>
271
274
  </ActionTile.Root>
272
-
275
+ <ActionTile.Root
276
+ onClick={() => {
277
+ setOpenStatsForNerdsSheet(true);
278
+ setOpenOptionsSheet(false);
279
+ }}
280
+ >
281
+ <InfoIcon />
282
+ <ActionTile.Title>Stats For Nerds</ActionTile.Title>
283
+ </ActionTile.Root>
273
284
  {isConnected && permissions?.browserRecording ? (
274
285
  <ActionTile.Root
275
286
  disabled={isHLSRunning}
@@ -316,6 +327,8 @@ export const MwebOptions = ({
316
327
  </Sheet.Content>
317
328
  </Sheet.Root>
318
329
  <SettingsModal open={openSettingsSheet} onOpenChange={setOpenSettingsSheet} screenType={screenType} />
330
+ <StatsForNerds open={openStatsForNerdsSheet} onOpenChange={setOpenStatsForNerdsSheet} />
331
+
319
332
  {openModals.has(MODALS.MUTE_ALL) && (
320
333
  <MuteAllModal onOpenChange={(value: boolean) => updateState(MODALS.MUTE_ALL, value)} isMobile />
321
334
  )}
@@ -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,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,71 +1,32 @@
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';
24
9
  import { DeviceInUseError } from './DeviceInUseError';
10
+ import { ErrorNotifications } from './ErrorNotifications';
25
11
  import { HandRaisedNotifications } from './HandRaisedNotifications';
26
12
  import { InitErrorModal } from './InitErrorModal';
13
+ import { MessageNotifications } from './MessageNotifications';
27
14
  import { PeerNotifications } from './PeerNotifications';
28
15
  import { PermissionErrorNotificationModal } from './PermissionErrorModal';
16
+ import { PollNotificationModal } from './PollNotificationModal';
29
17
  import { ReconnectNotifications } from './ReconnectNotifications';
18
+ import { RoleChangeNotification } from './RoleChangeNotification';
30
19
  import { TrackBulkUnmuteModal } from './TrackBulkUnmuteModal';
31
20
  import { TrackNotifications } from './TrackNotifications';
32
21
  import { TrackUnmuteModal } from './TrackUnmuteModal';
33
22
  import { TranscriptionNotifications } from './TranscriptionNotifications';
34
- import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
35
23
  // @ts-ignore: No implicit Any
36
- import { usePollViewToggle } from '../AppData/useSidepane';
37
- // @ts-ignore: No implicit Any
38
- import { useIsNotificationDisabled, useSubscribedNotifications } from '../AppData/useUISettings';
39
- import { usePIPWindow } from '../PIP/usePIPWindow';
24
+ import { useIsNotificationDisabled } from '../AppData/useUISettings';
40
25
  import { ROLE_CHANGE_DECLINED } from '../../common/constants';
41
26
 
42
- const pollToastKey: Record<string, string> = {};
43
-
44
27
  export function Notifications() {
45
- const localPeerID = useHMSStore(selectLocalPeerID);
46
- const notification = useHMSNotifications([
47
- HMSNotificationTypes.NAME_UPDATED,
48
- HMSNotificationTypes.ERROR,
49
- HMSNotificationTypes.ROLE_UPDATED,
50
- HMSNotificationTypes.CHANGE_TRACK_STATE_REQUEST,
51
- HMSNotificationTypes.REMOVED_FROM_ROOM,
52
- HMSNotificationTypes.ROOM_ENDED,
53
- HMSNotificationTypes.DEVICE_CHANGE_UPDATE,
54
- HMSNotificationTypes.POLL_STARTED,
55
- HMSNotificationTypes.POLL_STOPPED,
56
- HMSNotificationTypes.NEW_MESSAGE,
57
- ]);
58
- const subscribedNotifications = useSubscribedNotifications() || {};
59
28
  const roomState = useHMSStore(selectRoomState);
60
- const updateRoomLayoutForRole = useUpdateRoomLayout();
61
29
  const isNotificationDisabled = useIsNotificationDisabled();
62
- const screenProps = useRoomLayoutConferencingScreen();
63
- const vanillaStore = useHMSVanillaStore();
64
- const togglePollView = usePollViewToggle();
65
- const { showNotification } = useAwayNotifications();
66
- const amIScreenSharing = useHMSStore(selectIsLocalScreenShared);
67
- const logoURL = useRoomLayout()?.logo?.url;
68
- const { pipWindow } = usePIPWindow();
69
30
 
70
31
  const handleRoleChangeDenied = useCallback((request: HMSRoleChangeRequest & { peerName: string }) => {
71
32
  ToastManager.addToast({
@@ -76,130 +37,6 @@ export function Notifications() {
76
37
 
77
38
  useCustomEvent({ type: ROLE_CHANGE_DECLINED, onEvent: handleRoleChangeDenied });
78
39
 
79
- useEffect(() => {
80
- if (!notification || isNotificationDisabled) {
81
- return;
82
- }
83
- switch (notification.type) {
84
- case HMSNotificationTypes.NAME_UPDATED:
85
- console.log(notification.data.id + ' changed their name to ' + notification.data.name);
86
- break;
87
- case HMSNotificationTypes.ERROR:
88
- if (notification.data?.isTerminal && notification.data?.action !== 'INIT') {
89
- if ([500, 6008].includes(notification.data?.code)) {
90
- ToastManager.addToast({
91
- title: `Error: ${notification.data?.message}`,
92
- });
93
- } else if (notification.data?.message === 'role limit reached') {
94
- ToastManager.addToast({
95
- title: 'The room is currently full, try joining later',
96
- close: true,
97
- icon: (
98
- <Box css={{ color: '$alert_error_default' }}>
99
- <GroupIcon />
100
- </Box>
101
- ),
102
- });
103
- } else {
104
- ToastManager.addToast({
105
- title:
106
- notification.data?.message ||
107
- 'We couldn’t reconnect you. When you’re back online, try joining the room.',
108
- close: false,
109
- });
110
- }
111
- return;
112
- }
113
- // Autoplay error or user denied screen share (cancelled browser pop-up)
114
- if (notification.data?.code === 3008 || notification.data?.code === 3001 || notification.data?.code === 3011) {
115
- return;
116
- }
117
- if (notification.data?.action === 'INIT') {
118
- return;
119
- }
120
- if (!subscribedNotifications.ERROR) return;
121
- ToastManager.addToast({
122
- title: `Error: ${notification.data?.message} - ${notification.data?.description}`,
123
- duration: 8000,
124
- });
125
- break;
126
- case HMSNotificationTypes.ROLE_UPDATED: {
127
- if (notification.data?.isLocal && notification.data?.roleName) {
128
- ToastManager.addToast({
129
- title: `You are now a ${notification.data.roleName}`,
130
- });
131
- updateRoomLayoutForRole?.(notification.data.roleName);
132
- }
133
- break;
134
- }
135
- case HMSNotificationTypes.CHANGE_TRACK_STATE_REQUEST:
136
- const track = notification.data?.track;
137
- if (!notification.data.enabled) {
138
- ToastManager.addToast({
139
- title: `Your ${track.source} ${track.type} was muted by
140
- ${notification.data.requestedBy?.name}.`,
141
- });
142
- }
143
- break;
144
- case HMSNotificationTypes.REMOVED_FROM_ROOM:
145
- case HMSNotificationTypes.ROOM_ENDED:
146
- ToastManager.addToast({
147
- title: `${notification.message}.
148
- ${notification.data.reason && `Reason: ${notification.data.reason}`}`,
149
- });
150
- break;
151
- case HMSNotificationTypes.DEVICE_CHANGE_UPDATE:
152
- ToastManager.addToast({
153
- title: notification.message,
154
- });
155
- break;
156
-
157
- case HMSNotificationTypes.POLL_STARTED:
158
- if (notification.data.startedBy !== localPeerID && screenProps.screenType !== 'hls_live_streaming') {
159
- const pollStartedBy = vanillaStore.getState(selectPeerNameByID(notification.data.startedBy)) || 'Participant';
160
-
161
- const pollToastID = ToastManager.addToast({
162
- title: `${pollStartedBy} started a ${notification.data.type}: ${notification.data.title}`,
163
- action: (
164
- <Button
165
- onClick={() => togglePollView(notification.data.id)}
166
- variant="standard"
167
- css={{
168
- backgroundColor: '$surface_bright',
169
- fontWeight: '$semiBold',
170
- color: '$on_surface_high',
171
- p: '$xs $md',
172
- }}
173
- >
174
- {notification.data.type === 'quiz' ? 'Answer' : 'Vote'}
175
- </Button>
176
- ),
177
- duration: Infinity,
178
- });
179
- pollToastKey[notification.data.id] = pollToastID;
180
- }
181
- break;
182
- case HMSNotificationTypes.POLL_STOPPED:
183
- const pollID = notification?.data.id;
184
- if (pollID && pollToastKey?.[pollID]) {
185
- ToastManager.removeToast(pollToastKey?.[notification.data.id]);
186
- delete pollToastKey[notification?.data.id];
187
- }
188
- break;
189
- case HMSNotificationTypes.NEW_MESSAGE:
190
- if (amIScreenSharing && !notification.data?.ignored && !pipWindow) {
191
- showNotification(`New message from ${notification.data.senderName}`, {
192
- body: notification.data.message,
193
- icon: logoURL,
194
- });
195
- }
196
- break;
197
- default:
198
- break;
199
- }
200
- // eslint-disable-next-line react-hooks/exhaustive-deps
201
- }, [notification, subscribedNotifications.ERROR, subscribedNotifications.METADATA_UPDATED]);
202
-
203
40
  if (isNotificationDisabled) {
204
41
  return null;
205
42
  }
@@ -210,7 +47,12 @@ export function Notifications() {
210
47
  <TrackBulkUnmuteModal />
211
48
  <TrackNotifications />
212
49
  {roomState === HMSRoomState.Connected ? <PeerNotifications /> : null}
50
+ <RoleChangeNotification />
51
+ <PollNotificationModal />
52
+ <MessageNotifications />
53
+ <DeviceChangeNotifications />
213
54
  <ReconnectNotifications />
55
+ <ErrorNotifications />
214
56
  <AutoplayBlockedModal />
215
57
  <PermissionErrorNotificationModal />
216
58
  <InitErrorModal />
@@ -7,7 +7,11 @@ import { useSetSubscribedChatSelector, useSubscribedNotifications } from '../App
7
7
  // @ts-ignore: No implicit Any
8
8
  import { CHAT_SELECTOR, SUBSCRIBED_NOTIFICATIONS } from '../../common/constants';
9
9
 
10
- const notificationTypes = [HMSNotificationTypes.PEER_JOINED, HMSNotificationTypes.PEER_LEFT];
10
+ const notificationTypes = [
11
+ HMSNotificationTypes.PEER_JOINED,
12
+ HMSNotificationTypes.PEER_LEFT,
13
+ HMSNotificationTypes.NAME_UPDATED,
14
+ ];
11
15
 
12
16
  export const PeerNotifications = () => {
13
17
  const notification = useHMSNotifications(notificationTypes);
@@ -35,11 +39,14 @@ export const PeerNotifications = () => {
35
39
  return;
36
40
  }
37
41
  break;
42
+ case HMSNotificationTypes.NAME_UPDATED:
43
+ console.log(notification.data.id + ' changed their name to ' + notification.data.name);
44
+ return;
38
45
  default:
39
46
  return;
40
47
  }
41
48
  ToastBatcher.showToast({ notification });
42
- }, [notification, isPeerJoinSubscribed, isPeerLeftSubscribed, selectedPeer.id, setPeerSelector]);
49
+ }, [notification]);
43
50
 
44
51
  return null;
45
52
  };
@@ -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
+ };