@100mslive/roomkit-react 0.3.14-alpha.1 → 0.3.14-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/Diagnostics/BrowserTest.d.ts +81 -0
  2. package/dist/Diagnostics/components.d.ts +2 -0
  3. package/dist/{HLSView-VSU7IPCJ.js → HLSView-72D4HXOZ.js} +2 -2
  4. package/dist/{HLSView-772PCEEZ.css → HLSView-X4TA7M5M.css} +3 -3
  5. package/dist/{HLSView-772PCEEZ.css.map → HLSView-X4TA7M5M.css.map} +1 -1
  6. package/dist/Prebuilt/App.d.ts +1 -2
  7. package/dist/Prebuilt/components/Notifications/PermissionErrorModal.d.ts +5 -1
  8. package/dist/{chunk-VE34B77C.js → chunk-OZVDS5TG.js} +1254 -1039
  9. package/dist/chunk-OZVDS5TG.js.map +7 -0
  10. package/dist/index.cjs.css +2 -2
  11. package/dist/index.cjs.css.map +1 -1
  12. package/dist/index.cjs.js +1302 -1080
  13. package/dist/index.cjs.js.map +4 -4
  14. package/dist/index.css +2 -2
  15. package/dist/index.css.map +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/meta.cjs.json +101 -32
  18. package/dist/meta.esbuild.json +113 -44
  19. package/package.json +7 -7
  20. package/src/Diagnostics/AudioTest.tsx +80 -57
  21. package/src/Diagnostics/BrowserTest.tsx +139 -0
  22. package/src/Diagnostics/ConnectivityTest.tsx +10 -6
  23. package/src/Diagnostics/Diagnostics.tsx +38 -16
  24. package/src/Diagnostics/VideoTest.tsx +13 -5
  25. package/src/Diagnostics/components.tsx +13 -1
  26. package/src/Prebuilt/App.tsx +1 -9
  27. package/src/Prebuilt/components/Chat/ChatFooter.tsx +4 -1
  28. package/src/Prebuilt/components/Header/common.jsx +3 -0
  29. package/src/Prebuilt/components/Notifications/Notifications.tsx +2 -2
  30. package/src/Prebuilt/components/Notifications/PermissionErrorModal.tsx +13 -11
  31. package/dist/chunk-VE34B77C.js.map +0 -7
  32. /package/dist/{HLSView-VSU7IPCJ.js.map → HLSView-72D4HXOZ.js.map} +0 -0
@@ -0,0 +1,139 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { parsedUserAgent } from '@100mslive/react-sdk';
3
+ import { TestContainer, TestFooter } from './components';
4
+ import { Box, Flex } from '../Layout';
5
+ import { Text } from '../Text';
6
+ import { hmsDiagnostics } from './hms';
7
+
8
+ const CMS_MEDIA_SERVER = 'https://storage.googleapis.com/100ms-cms-prod/';
9
+
10
+ export const operatingSystemIconInfo = {
11
+ tizen: {
12
+ key: 'tizen',
13
+ val: 'Tizen',
14
+ icon: `${CMS_MEDIA_SERVER}cms/Tizen_b99350214e/Tizen_b99350214e.svg`,
15
+ },
16
+ 'mac os': {
17
+ key: 'macos',
18
+ val: 'Mac OS',
19
+ icon: `${CMS_MEDIA_SERVER}cms/mac_OS_804456afd8/mac_OS_804456afd8.png`,
20
+ },
21
+ windows: {
22
+ key: 'windows',
23
+ val: 'Windows',
24
+ icon: `${CMS_MEDIA_SERVER}cms/Windows_fdfe6749b6/Windows_fdfe6749b6.svg`,
25
+ },
26
+ linux: {
27
+ key: 'linux',
28
+ val: 'Linux',
29
+ icon: `${CMS_MEDIA_SERVER}cms/Linux_31f8353a2e/Linux_31f8353a2e.svg`,
30
+ },
31
+ chromium: {
32
+ key: 'chromium',
33
+ val: 'Chromium',
34
+ icon: `${CMS_MEDIA_SERVER}cms/Chromium_3df17710bd/Chromium_3df17710bd.svg`,
35
+ },
36
+ ubuntu: {
37
+ key: 'ubuntu',
38
+ val: 'Ubuntu',
39
+ icon: `${CMS_MEDIA_SERVER}cms/Ubuntu_966dd923c5/Ubuntu_966dd923c5.svg`,
40
+ },
41
+ ios: {
42
+ key: 'ios',
43
+ val: 'iOS',
44
+ icon: `${CMS_MEDIA_SERVER}cms/i_OS_3cdc9d9b71/i_OS_3cdc9d9b71.svg`,
45
+ },
46
+ android: {
47
+ key: 'android',
48
+ val: 'Android',
49
+ icon: `${CMS_MEDIA_SERVER}cms/Android_49dcfdc934/Android_49dcfdc934.svg`,
50
+ },
51
+ };
52
+
53
+ export const browserTypeIconInfo = {
54
+ brave: {
55
+ key: 'brave',
56
+ val: 'Brave',
57
+ icon: `${CMS_MEDIA_SERVER}cms/Brave_7e66131f09/Brave_7e66131f09.svg`,
58
+ },
59
+ chrome: {
60
+ key: 'chrome',
61
+ val: 'Chrome',
62
+ icon: `${CMS_MEDIA_SERVER}cms/Chrome_7bf77fbdd7/Chrome_7bf77fbdd7.svg`,
63
+ },
64
+ firefox: {
65
+ key: 'firefox',
66
+ val: 'Firefox',
67
+ icon: `${CMS_MEDIA_SERVER}cms/Firefox_30f3976fb8/Firefox_30f3976fb8.svg`,
68
+ },
69
+ safari: {
70
+ key: 'safari',
71
+ val: 'Safari',
72
+ icon: `${CMS_MEDIA_SERVER}cms/Safari_254e74ed94/Safari_254e74ed94.svg`,
73
+ },
74
+ 'mobile safari': {
75
+ key: 'safari',
76
+ val: 'Safari',
77
+ icon: `${CMS_MEDIA_SERVER}cms/Safari_254e74ed94/Safari_254e74ed94.svg`,
78
+ },
79
+ edge: {
80
+ key: 'edge',
81
+ val: 'Edge',
82
+ icon: `${CMS_MEDIA_SERVER}cms/Edge_23add4a83f/Edge_23add4a83f.svg`,
83
+ },
84
+ opera: {
85
+ key: 'opera',
86
+ val: 'Opera',
87
+ icon: `${CMS_MEDIA_SERVER}cms/Opera_0f3bf4eb19/Opera_0f3bf4eb19.svg`,
88
+ },
89
+ };
90
+
91
+ const CheckDetails = ({ title, value, iconURL }: { title: string; value: string; iconURL?: string }) => (
92
+ <Box css={{ w: '100%', my: '$10', p: '$10', r: '$1', bg: '$surface_default', '@lg': { w: 'auto' } }}>
93
+ <Text css={{ c: '$on_primary_medium', mb: '$6' }}>{title}</Text>
94
+ <Flex align="center">
95
+ {iconURL && (
96
+ <Box css={{ size: '2rem', r: '$round', bg: '$surface_brighter', mr: '$4' }}>
97
+ <img style={{ objectFit: 'contain', width: '2rem' }} src={iconURL} alt={value} />
98
+ </Box>
99
+ )}
100
+ <Text>{value}</Text>
101
+ </Flex>
102
+ </Box>
103
+ );
104
+
105
+ export const BrowserTest = () => {
106
+ const [error, setError] = useState<Error | undefined>();
107
+ useEffect(() => {
108
+ try {
109
+ hmsDiagnostics.checkBrowserSupport();
110
+ } catch (err) {
111
+ setError(err as Error);
112
+ }
113
+ }, []);
114
+ return (
115
+ <>
116
+ <TestContainer css={{ display: 'flex', gap: '$8', '@lg': { display: 'block' } }}>
117
+ <CheckDetails
118
+ title="Browser"
119
+ iconURL={
120
+ parsedUserAgent.getBrowser().name &&
121
+ browserTypeIconInfo[parsedUserAgent.getBrowser().name?.toLowerCase() as keyof typeof browserTypeIconInfo]
122
+ ?.icon
123
+ }
124
+ value={`${parsedUserAgent.getBrowser().name} ${parsedUserAgent.getBrowser().version}`}
125
+ />
126
+ <CheckDetails
127
+ title="Operating system"
128
+ iconURL={
129
+ parsedUserAgent.getOS().name &&
130
+ operatingSystemIconInfo[parsedUserAgent.getOS().name?.toLowerCase() as keyof typeof operatingSystemIconInfo]
131
+ ?.icon
132
+ }
133
+ value={`${parsedUserAgent.getOS().name} ${parsedUserAgent.getOS().version}`}
134
+ />
135
+ </TestContainer>
136
+ <TestFooter error={error} ctaText="Is your device information correct?" />
137
+ </>
138
+ );
139
+ };
@@ -1,7 +1,7 @@
1
- import React, { useState } from 'react';
1
+ import React, { useContext, useState } from 'react';
2
2
  import { ConnectivityCheckResult, ConnectivityState, DiagnosticsRTCStats } from '@100mslive/react-sdk';
3
3
  import { CheckCircleIcon, CrossCircleIcon, LinkIcon } from '@100mslive/react-icons';
4
- import { TestContainer, TestFooter } from './components';
4
+ import { DiagnosticsContext, TestContainer, TestFooter } from './components';
5
5
  import { Button } from '../Button';
6
6
  import { Box, Flex } from '../Layout';
7
7
  import { Loading } from '../Loading';
@@ -218,6 +218,8 @@ const ConnectivityTestReport = ({
218
218
  }
219
219
 
220
220
  if (result) {
221
+ // for debugging and quick view of results
222
+ console.log(result);
221
223
  return (
222
224
  <>
223
225
  <TestContainer>
@@ -232,10 +234,10 @@ const ConnectivityTestReport = ({
232
234
  );
233
235
  }
234
236
 
235
- if (progress) {
237
+ if (progress !== undefined) {
236
238
  return (
237
239
  <TestContainer css={{ textAlign: 'center' }}>
238
- <Text css={{ c: '$primary_bright' }}>
240
+ <Text css={{ c: '$primary_bright', textAlign: 'center' }}>
239
241
  <Loading size="3.5rem" color="currentColor" />
240
242
  </Text>
241
243
  <Text variant="h6" css={{ mt: '$8' }}>
@@ -308,14 +310,15 @@ const RegionSelector = ({
308
310
  };
309
311
 
310
312
  export const ConnectivityTest = () => {
313
+ const { setConnectivityTested } = useContext(DiagnosticsContext);
311
314
  const [region, setRegion] = useState<string | undefined>(Object.keys(Regions)[0]);
312
315
  const [error, setError] = useState<Error | undefined>();
313
316
  const [progress, setProgress] = useState<ConnectivityState>();
314
317
  const [result, setResult] = useState<ConnectivityCheckResult | undefined>();
315
318
 
316
319
  const startTest = () => {
320
+ setConnectivityTested(false);
317
321
  setError(undefined);
318
- setProgress(ConnectivityState.STARTING);
319
322
  setResult(undefined);
320
323
  hmsDiagnostics
321
324
  .startConnectivityCheck(
@@ -323,6 +326,7 @@ export const ConnectivityTest = () => {
323
326
  setProgress(state);
324
327
  },
325
328
  result => {
329
+ setConnectivityTested(true);
326
330
  setResult(result);
327
331
  },
328
332
  region,
@@ -337,7 +341,7 @@ export const ConnectivityTest = () => {
337
341
  <RegionSelector
338
342
  region={region}
339
343
  setRegion={setRegion}
340
- startTest={!progress || progress === ConnectivityState.COMPLETED ? startTest : undefined}
344
+ startTest={progress === undefined || progress === ConnectivityState.COMPLETED ? startTest : undefined}
341
345
  />
342
346
  <ConnectivityTestReport error={error} result={result} progress={progress} startTest={startTest} />
343
347
  </>
@@ -1,11 +1,12 @@
1
1
  import React, { useContext } from 'react';
2
2
  import { HMSRoomProvider } from '@100mslive/react-sdk';
3
- import { ConnectivityIcon, GlobeIcon, MicOnIcon, VideoOnIcon } from '@100mslive/react-icons';
3
+ import { CheckCircleIcon, ConnectivityIcon, GlobeIcon, MicOnIcon, VideoOnIcon } from '@100mslive/react-icons';
4
4
  import { DiagnosticsContext, DiagnosticsSteps } from './components';
5
5
  import { Box, Flex } from '../Layout';
6
6
  import { Text } from '../Text';
7
7
  import { HMSThemeProvider } from '../Theme';
8
8
  import { AudioTest } from './AudioTest';
9
+ import { BrowserTest } from './BrowserTest';
9
10
  import { ConnectivityTest } from './ConnectivityTest';
10
11
  import { hmsActions, hmsNotifications, hmsStats, hmsStore } from './hms';
11
12
  import { VideoTest } from './VideoTest';
@@ -20,8 +21,8 @@ const DiagnosticsStepIcon: Record<string, React.ReactNode> = {
20
21
  const Container = ({ children }: { children: React.ReactNode }) => (
21
22
  <Box
22
23
  css={{
23
- px: '155px',
24
- py: '160px',
24
+ px: '120px',
25
+ py: '120px',
25
26
  bg: '$background_dim',
26
27
  lineHeight: '1.5',
27
28
  '-webkit-text-size-adjust': '100%',
@@ -45,6 +46,8 @@ const DiagnosticsStepTest = () => {
45
46
  TestComponent = AudioTest;
46
47
  } else if (activeStep === 'video') {
47
48
  TestComponent = VideoTest;
49
+ } else if (activeStep === 'browser') {
50
+ TestComponent = BrowserTest;
48
51
  } else if (activeStep === 'connectivity') {
49
52
  TestComponent = ConnectivityTest;
50
53
  }
@@ -64,37 +67,56 @@ const DiagnosticsStepHeader = () => {
64
67
 
65
68
  const DiagnosticsStep = () => {
66
69
  return (
67
- <Box css={{ border: '1px solid $border_default', r: '$1', w: '75%', '@lg': { w: '100%' } }}>
70
+ <Box css={{ border: '1px solid $border_default', r: '$1', w: '75%', maxWidth: '65rem', '@lg': { w: '100%' } }}>
68
71
  <DiagnosticsStepHeader />
69
- <DiagnosticsStepTest />
72
+ <Box css={{ maxHeight: '55vh', overflowY: 'auto' }}>
73
+ <DiagnosticsStepTest />
74
+ </Box>
70
75
  </Box>
71
76
  );
72
77
  };
73
78
 
74
79
  const DiagnosticsStepsList = () => {
75
- const { activeStep } = useContext(DiagnosticsContext);
80
+ const { activeStep, connectivityTested } = useContext(DiagnosticsContext);
76
81
 
77
82
  return (
78
83
  <Box css={{ w: '25%', '@lg': { display: 'none' } }}>
79
- <ul>
80
- {Object.keys(DiagnosticsSteps).map(key => (
81
- <li key={key}>
82
- <Text variant="md" css={{ mb: '$10', c: activeStep === key ? '$on_primary_high' : '$on_primary_low' }}>
83
- {DiagnosticsSteps[key]}
84
- </Text>
85
- </li>
86
- ))}
87
- </ul>
84
+ {Object.keys(DiagnosticsSteps).map(key => {
85
+ const keys = Object.keys(DiagnosticsSteps);
86
+ const activeStepIndex = keys.indexOf(activeStep);
87
+ const keyIndex = keys.indexOf(key);
88
+ const isStepCompleted = activeStepIndex > keyIndex || (activeStep === 'connectivity' && connectivityTested);
89
+
90
+ let color = '$on_primary_low';
91
+ if (activeStep === key) {
92
+ color = '$on_primary_high';
93
+ }
94
+ if (isStepCompleted) {
95
+ color = '$primary_bright';
96
+ }
97
+
98
+ return (
99
+ <Flex key={key} css={{ mb: '$10', c: color, gap: '$4', alignItems: 'center' }}>
100
+ {isStepCompleted ? (
101
+ <CheckCircleIcon width="1rem" height="1rem" />
102
+ ) : (
103
+ <Text css={{ c: color, fontSize: '1.75rem' }}>&bull;</Text>
104
+ )}
105
+ <Text css={{ c: color }}>{DiagnosticsSteps[key]}</Text>
106
+ </Flex>
107
+ );
108
+ })}
88
109
  </Box>
89
110
  );
90
111
  };
91
112
 
92
113
  export const Diagnostics = () => {
93
114
  const [activeStep, setActiveStep] = React.useState(Object.keys(DiagnosticsSteps)[0]);
115
+ const [connectivityTested, setConnectivityTested] = React.useState(false);
94
116
  return (
95
117
  <HMSRoomProvider store={hmsStore} actions={hmsActions} notifications={hmsNotifications} stats={hmsStats}>
96
118
  <HMSThemeProvider themeType="default">
97
- <DiagnosticsContext.Provider value={{ activeStep, setActiveStep }}>
119
+ <DiagnosticsContext.Provider value={{ activeStep, setActiveStep, connectivityTested, setConnectivityTested }}>
98
120
  <Container>
99
121
  <Text variant="h4">Pre-call Test</Text>
100
122
  <Text variant="md" css={{ c: '$on_primary_medium' }}>
@@ -1,6 +1,13 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { selectDevices, selectLocalMediaSettings, selectLocalVideoTrackID, useHMSStore } from '@100mslive/react-sdk';
2
+ import {
3
+ HMSException,
4
+ selectDevices,
5
+ selectLocalMediaSettings,
6
+ selectLocalVideoTrackID,
7
+ useHMSStore,
8
+ } from '@100mslive/react-sdk';
3
9
  import { VideoOnIcon } from '@100mslive/react-icons';
10
+ import { PermissionErrorModal } from '../Prebuilt/components/Notifications/PermissionErrorModal';
4
11
  import { TestContainer, TestFooter } from './components';
5
12
  import { Flex } from '../Layout';
6
13
  import { Text } from '../Text';
@@ -15,7 +22,7 @@ export const VideoTest = () => {
15
22
  const { videoInput } = allDevices;
16
23
  const trackID = useHMSStore(selectLocalVideoTrackID);
17
24
  const sdkSelectedDevices = useHMSStore(selectLocalMediaSettings);
18
- const [error, setError] = useState<Error | undefined>();
25
+ const [error, setError] = useState<HMSException | undefined>();
19
26
 
20
27
  useEffect(() => {
21
28
  hmsDiagnostics.startCameraCheck().catch(err => setError(err));
@@ -27,10 +34,10 @@ export const VideoTest = () => {
27
34
  {trackID && (
28
35
  <StyledVideoTile.Container
29
36
  css={{
30
- w: '90%',
31
- height: '$48',
37
+ width: '90%',
38
+ aspectRatio: '16/9',
32
39
  mr: '$10',
33
- '@lg': { mr: 0, mb: '$10' },
40
+ '@lg': { mr: 0, mb: '$10', aspectRatio: '1/1' },
34
41
  }}
35
42
  >
36
43
  <Video mirror={true} trackId={trackID} />
@@ -55,6 +62,7 @@ export const VideoTest = () => {
55
62
  </Flex>
56
63
  </TestContainer>
57
64
  <TestFooter error={error} ctaText="Does your video look good?" />
65
+ <PermissionErrorModal error={error} />
58
66
  </>
59
67
  );
60
68
  };
@@ -6,20 +6,26 @@ import { CSS } from '../Theme';
6
6
  import { hmsDiagnostics } from './hms';
7
7
 
8
8
  export const DiagnosticsSteps: Record<string, string> = {
9
+ browser: 'Browser Support',
9
10
  video: 'Test Video',
10
11
  audio: 'Test Audio',
11
- // browser: 'Browser Support',
12
12
  connectivity: 'Connection Quality',
13
13
  };
14
14
 
15
15
  export const DiagnosticsContext = React.createContext<{
16
16
  activeStep: string;
17
17
  setActiveStep: React.Dispatch<React.SetStateAction<string>>;
18
+ connectivityTested: boolean;
19
+ setConnectivityTested: React.Dispatch<React.SetStateAction<boolean>>;
18
20
  }>({
19
21
  activeStep: 'video',
20
22
  setActiveStep: () => {
21
23
  return;
22
24
  },
25
+ connectivityTested: false,
26
+ setConnectivityTested: () => {
27
+ return;
28
+ },
23
29
  });
24
30
 
25
31
  export const TestContainer = ({ css, children }: { css?: CSS; children: React.ReactNode }) => {
@@ -55,11 +61,17 @@ export const TestFooter = ({
55
61
  css={{
56
62
  py: '$8',
57
63
  px: '$10',
64
+ position: 'sticky',
65
+ bottom: '0',
66
+ background: '$background_dim',
58
67
  justifyContent: 'space-between',
59
68
  alignItems: 'center',
60
69
  borderTop: '1px solid $border_default',
61
70
  fontSize: '$sm',
71
+ borderBottomLeftRadius: '$1',
72
+ borderBottomRightRadius: '$1',
62
73
  lineHeight: '$sm',
74
+ zIndex: 1001,
63
75
  '@lg': { flexDirection: 'column', gap: '$8' },
64
76
  }}
65
77
  >
@@ -1,10 +1,5 @@
1
1
  import React, { MutableRefObject, useEffect, useRef } from 'react';
2
- import {
3
- HMSDiagnosticsInterface,
4
- HMSStatsStoreWrapper,
5
- HMSStoreWrapper,
6
- IHMSNotifications,
7
- } from '@100mslive/hms-video-store';
2
+ import { HMSStatsStoreWrapper, HMSStoreWrapper, IHMSNotifications } from '@100mslive/hms-video-store';
8
3
  import { Layout, Logo, Screens, Theme, Typography } from '@100mslive/types-prebuilt';
9
4
  import { match } from 'ts-pattern';
10
5
  import {
@@ -85,7 +80,6 @@ export type HMSPrebuiltRefType = {
85
80
  hmsStore: HMSStoreWrapper;
86
81
  hmsStats: HMSStatsStoreWrapper;
87
82
  hmsNotifications: IHMSNotifications;
88
- hmsDiagnostics: HMSDiagnosticsInterface;
89
83
  };
90
84
 
91
85
  export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps>(
@@ -115,7 +109,6 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
115
109
  const hmsActions = hms.getActions();
116
110
  const hmsNotifications = hms.getNotifications();
117
111
  const hmsStats = hms.getStats();
118
- const hmsDiagnostics = hms.getDiagnosticsSDK();
119
112
  hms.triggerOnSubscribe();
120
113
 
121
114
  reactiveStore.current = {
@@ -123,7 +116,6 @@ export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps
123
116
  hmsStats,
124
117
  hmsStore,
125
118
  hmsNotifications,
126
- hmsDiagnostics,
127
119
  };
128
120
  }, []);
129
121
 
@@ -108,7 +108,10 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
108
108
 
109
109
  const resetInputHeight = useCallback(() => {
110
110
  if (inputRef.current) {
111
- inputRef.current.style.height = `${Math.max(32, inputRef.current.value ? inputRef.current.scrollHeight : 0)}px`;
111
+ inputRef.current.style.height = `${Math.max(
112
+ 32,
113
+ inputRef.current.value ? Math.min(inputRef.current.scrollHeight, 24 * 4) : 0,
114
+ )}px`;
112
115
  }
113
116
  }, []);
114
117
 
@@ -15,6 +15,7 @@ import {
15
15
  CrossIcon,
16
16
  HeadphonesIcon,
17
17
  SpeakerIcon,
18
+ TelePhoneIcon,
18
19
  } from '@100mslive/react-icons';
19
20
  import { HorizontalDivider } from '../../../Divider';
20
21
  import { Label } from '../../../Label';
@@ -82,6 +83,8 @@ export const AudioActions = () => {
82
83
  AudioIcon = <BluetoothIcon />;
83
84
  } else if (currentSelection && currentSelection.label.toLowerCase().includes('wired')) {
84
85
  AudioIcon = <HeadphonesIcon />;
86
+ } else if (currentSelection && currentSelection.label.toLowerCase().includes('earpiece')) {
87
+ AudioIcon = <TelePhoneIcon />;
85
88
  }
86
89
  return (
87
90
  <AudioSelectionSheet
@@ -24,7 +24,7 @@ import { ChatNotifications } from './ChatNotifications';
24
24
  import { HandRaisedNotifications } from './HandRaisedNotifications';
25
25
  import { InitErrorModal } from './InitErrorModal';
26
26
  import { PeerNotifications } from './PeerNotifications';
27
- import { PermissionErrorModal } from './PermissionErrorModal';
27
+ import { PermissionErrorNotificationModal } from './PermissionErrorModal';
28
28
  import { ReconnectNotifications } from './ReconnectNotifications';
29
29
  import { TrackBulkUnmuteModal } from './TrackBulkUnmuteModal';
30
30
  import { TrackNotifications } from './TrackNotifications';
@@ -197,7 +197,7 @@ export function Notifications() {
197
197
  {roomState === HMSRoomState.Connected ? <PeerNotifications /> : null}
198
198
  <ReconnectNotifications />
199
199
  <AutoplayBlockedModal />
200
- <PermissionErrorModal />
200
+ <PermissionErrorNotificationModal />
201
201
  <InitErrorModal />
202
202
  <ChatNotifications />
203
203
  <HandRaisedNotifications />
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { useMedia } from 'react-use';
3
- import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
3
+ import { HMSException, HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
4
4
  import { Button, config as cssConfig, Dialog, Flex, Text } from '../../..';
5
5
  // @ts-ignore: No implicit Any
6
6
  import androidPermissionAlert from '../../images/android-perm-1.png';
@@ -9,22 +9,24 @@ import iosPermissions from '../../images/ios-perm-0.png';
9
9
  // @ts-ignore: No implicit Any
10
10
  import { isAndroid, isIOS } from '../../common/constants';
11
11
 
12
- export function PermissionErrorModal() {
12
+ export function PermissionErrorNotificationModal() {
13
13
  const notification = useHMSNotifications(HMSNotificationTypes.ERROR);
14
+ return <PermissionErrorModal error={notification?.data} />;
15
+ }
16
+
17
+ export const PermissionErrorModal = ({ error }: { error?: HMSException }) => {
14
18
  const [deviceType, setDeviceType] = useState('');
15
19
  const [isSystemError, setIsSystemError] = useState(false);
16
20
  const isMobile = useMedia(cssConfig.media.md);
17
-
18
21
  useEffect(() => {
19
22
  if (
20
- !notification ||
21
- (notification.data?.code !== 3001 && notification.data?.code !== 3011) ||
22
- (notification.data?.code === 3001 && notification.data?.message.includes('screen'))
23
+ !error ||
24
+ (error?.code !== 3001 && error?.code !== 3011) ||
25
+ (error?.code === 3001 && error?.message.includes('screen'))
23
26
  ) {
24
27
  return;
25
28
  }
26
- console.error(`[${notification.type}]`, notification);
27
- const errorMessage = notification.data?.message;
29
+ const errorMessage = error?.message;
28
30
  const hasAudio = errorMessage.includes('audio');
29
31
  const hasVideo = errorMessage.includes('video');
30
32
  const hasScreen = errorMessage.includes('screen');
@@ -37,8 +39,8 @@ export function PermissionErrorModal() {
37
39
  } else if (hasScreen) {
38
40
  setDeviceType('screen');
39
41
  }
40
- setIsSystemError(notification.data.code === 3011);
41
- }, [notification]);
42
+ setIsSystemError(error.code === 3011);
43
+ }, [error]);
42
44
 
43
45
  return deviceType ? (
44
46
  <Dialog.Root open={!!deviceType}>
@@ -131,4 +133,4 @@ export function PermissionErrorModal() {
131
133
  </Dialog.Portal>
132
134
  </Dialog.Root>
133
135
  ) : null;
134
- }
136
+ };