@100mslive/roomkit-react 0.1.4-alpha.1 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{HLSView-F2K5VSTS.js → HLSView-CTAJQUU4.js} +7 -11
- package/dist/{HLSView-F2K5VSTS.js.map → HLSView-CTAJQUU4.js.map} +1 -1
- package/dist/PinnedTrackView-CQKONH4O.js +102 -0
- package/dist/PinnedTrackView-CQKONH4O.js.map +7 -0
- package/dist/Popover/index.d.ts +1 -0
- package/dist/Prebuilt/App.d.ts +25 -0
- package/dist/Prebuilt/index.d.ts +1 -0
- package/dist/Prebuilt/provider/roomLayoutProvider/index.d.ts +1 -1
- package/dist/Sheet/Sheet.d.ts +3093 -0
- package/dist/Sheet/index.d.ts +1 -0
- package/dist/Theme/ThemeProvider.d.ts +4 -286
- package/dist/Theme/stitches.config.d.ts +1 -1
- package/dist/{VirtualBackground-S3XEPZ2T.js → VirtualBackground-GGGBJYVY.js} +31 -7
- package/dist/VirtualBackground-GGGBJYVY.js.map +7 -0
- package/dist/chunk-I2FJWE74.js +827 -0
- package/dist/chunk-I2FJWE74.js.map +7 -0
- package/dist/{chunk-42SWPN2C.js → chunk-L2SX7GBO.js} +3020 -2189
- package/dist/chunk-L2SX7GBO.js.map +7 -0
- package/dist/chunk-NOKIGB6Y.js +1100 -0
- package/dist/chunk-NOKIGB6Y.js.map +7 -0
- package/dist/chunk-TJNDX446.js +67 -0
- package/dist/chunk-TJNDX446.js.map +7 -0
- package/dist/{chunk-ESUJK7AT.js → conference-OEO7VOJD.js} +3136 -653
- package/dist/conference-OEO7VOJD.js.map +7 -0
- package/dist/index.cjs.js +15733 -15498
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.js +4 -8
- package/dist/meta.cjs.json +3355 -3017
- package/dist/meta.esbuild.json +3534 -3329
- package/dist/utils/animations.d.ts +16 -0
- package/package.json +8 -10
- package/src/Button/Button.tsx +4 -4
- package/src/Dropdown/Dropdown.tsx +2 -2
- package/src/IconButton/IconButton.tsx +4 -2
- package/src/Pagination/StyledPagination.tsx +1 -0
- package/src/Popover/index.tsx +2 -1
- package/src/Prebuilt/{App.jsx → App.tsx} +95 -48
- package/src/Prebuilt/Prebuilt.stories.tsx +22 -8
- package/src/Prebuilt/common/constants.js +1 -2
- package/src/Prebuilt/common/hooks.js +8 -0
- package/src/Prebuilt/common/utils.js +15 -0
- package/src/Prebuilt/components/AppData/AppData.jsx +1 -2
- package/src/Prebuilt/components/AppData/useUISettings.js +0 -5
- package/src/Prebuilt/components/AudioVideoToggle.jsx +69 -26
- package/src/Prebuilt/components/AuthToken.jsx +3 -2
- package/src/Prebuilt/components/Chat/ChatSelector.jsx +1 -1
- package/src/Prebuilt/components/Connection/TileConnection.jsx +0 -1
- package/src/Prebuilt/components/EmojiReaction.jsx +23 -73
- package/src/Prebuilt/components/EndSessionContent.jsx +57 -0
- package/src/Prebuilt/components/EqualProminence.jsx +180 -0
- package/src/Prebuilt/components/ErrorBoundary.jsx +4 -10
- package/src/Prebuilt/components/Footer/EmojiCard.jsx +34 -0
- package/src/Prebuilt/components/Footer/Footer.jsx +73 -0
- package/src/Prebuilt/components/{Header → Footer}/ParticipantList.jsx +5 -5
- package/src/Prebuilt/components/Header/ConferencingHeader.jsx +27 -7
- package/src/Prebuilt/components/Header/HeaderComponents.jsx +16 -14
- package/src/Prebuilt/components/Header/StreamActions.jsx +101 -36
- package/src/Prebuilt/components/Header/StreamingHeader.jsx +1 -1
- package/src/Prebuilt/components/Header/common.jsx +164 -0
- package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +1 -2
- package/src/Prebuilt/components/LeaveCard.jsx +19 -0
- package/src/Prebuilt/components/LeaveRoom.jsx +35 -143
- package/src/Prebuilt/components/LeaveSessionContent.jsx +45 -0
- package/src/Prebuilt/components/MoreSettings/ActionTile.jsx +55 -0
- package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +96 -0
- package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +31 -54
- package/src/Prebuilt/components/MoreSettings/EmbedUrl.jsx +48 -73
- package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +5 -221
- package/src/Prebuilt/components/MoreSettings/MuteAllContent.jsx +61 -0
- package/src/Prebuilt/components/MoreSettings/MuteAllModal.jsx +32 -49
- package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopLeaveRoom.jsx +129 -0
- package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.jsx +219 -0
- package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebLeaveRoom.jsx +100 -0
- package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.jsx +259 -0
- package/src/Prebuilt/components/Notifications/Notifications.jsx +0 -2
- package/src/Prebuilt/components/Notifications/ReconnectNotifications.jsx +0 -4
- package/src/Prebuilt/components/PIP/PIPComponent.jsx +30 -26
- package/src/Prebuilt/components/PIP/PIPManager.js +13 -0
- package/src/Prebuilt/components/PIP/index.jsx +2 -7
- package/src/Prebuilt/components/Pagination.jsx +4 -4
- package/src/Prebuilt/components/Preview/PreviewContainer.jsx +5 -13
- package/src/Prebuilt/components/Preview/PreviewForm.jsx +9 -5
- package/src/Prebuilt/components/Preview/PreviewJoin.jsx +20 -27
- package/src/Prebuilt/components/RaiseHand.jsx +27 -0
- package/src/Prebuilt/components/ScreenShare.jsx +1 -1
- package/src/Prebuilt/components/ScreenshareDisplay.jsx +2 -2
- package/src/Prebuilt/components/ScreenshareTile.jsx +2 -2
- package/src/Prebuilt/components/Settings/DeviceSettings.jsx +2 -1
- package/src/Prebuilt/components/Settings/LayoutSettings.jsx +1 -24
- package/src/Prebuilt/components/Settings/SettingsModal.jsx +152 -17
- package/src/Prebuilt/components/ShareMenuIcon.jsx +1 -0
- package/src/Prebuilt/components/TileMenu/TileMenu.jsx +133 -0
- package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +313 -0
- package/src/Prebuilt/components/VideoList.jsx +5 -33
- package/src/Prebuilt/components/VideoTile.jsx +30 -8
- package/src/Prebuilt/components/conference.jsx +14 -1
- package/src/Prebuilt/components/init/Init.jsx +0 -27
- package/src/Prebuilt/components/init/initUtils.js +0 -23
- package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +2 -1
- package/src/Prebuilt/components/pdfAnnotator/pdfInfo.jsx +1 -1
- package/src/Prebuilt/components/pdfAnnotator/shareScreenOptions.jsx +19 -8
- package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +1 -0
- package/src/Prebuilt/images/pdf-share.png +0 -0
- package/src/Prebuilt/images/screen-share.png +0 -0
- package/src/Prebuilt/index.ts +1 -0
- package/src/Prebuilt/layouts/EmbedView.jsx +0 -1
- package/src/Prebuilt/layouts/InsetView.jsx +65 -24
- package/src/Prebuilt/layouts/PDFView.jsx +0 -1
- package/src/Prebuilt/layouts/SidePane.jsx +8 -7
- package/src/Prebuilt/layouts/mainView.jsx +22 -31
- package/src/Prebuilt/layouts/screenShareView.jsx +0 -2
- package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +25 -1
- package/src/Prebuilt/primitives/DialogContent.jsx +1 -1
- package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +1 -1
- package/src/Sheet/Sheet.mdx +19 -0
- package/src/Sheet/Sheet.stories.tsx +103 -0
- package/src/Sheet/Sheet.tsx +118 -0
- package/src/Sheet/index.ts +1 -0
- package/src/Theme/ThemeProvider.tsx +10 -13
- package/src/Theme/base.config.ts +1 -1
- package/src/Theme/stitches.config.ts +1 -1
- package/src/TileMenu/StyledMenuTile.tsx +2 -2
- package/src/TileMenu/TileMenu.tsx +2 -0
- package/src/VideoTile/StyledVideoTile.tsx +5 -0
- package/src/utils/animations.ts +18 -0
- package/dist/ActiveSpeakerView-V6O4K3BV.js +0 -39
- package/dist/ActiveSpeakerView-V6O4K3BV.js.map +0 -7
- package/dist/PinnedTrackView-7YQG4QKC.js +0 -70
- package/dist/PinnedTrackView-7YQG4QKC.js.map +0 -7
- package/dist/VirtualBackground-S3XEPZ2T.js.map +0 -7
- package/dist/chunk-42SWPN2C.js.map +0 -7
- package/dist/chunk-4NEZLVVH.js +0 -811
- package/dist/chunk-4NEZLVVH.js.map +0 -7
- package/dist/chunk-4ZBEFSRC.js +0 -58
- package/dist/chunk-4ZBEFSRC.js.map +0 -7
- package/dist/chunk-ESUJK7AT.js.map +0 -7
- package/dist/chunk-R6PDR5WZ.js +0 -243
- package/dist/chunk-R6PDR5WZ.js.map +0 -7
- package/dist/conference-7QKOMJPP.js +0 -3697
- package/dist/conference-7QKOMJPP.js.map +0 -7
- package/dist/transcription-RJA4V6PC.js +0 -356
- package/dist/transcription-RJA4V6PC.js.map +0 -7
- package/src/Prebuilt/common/useSortedPeers.js +0 -28
- package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.jsx +0 -96
- package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.stories.tsx +0 -46
- package/src/Prebuilt/components/Footer/ConferencingFooter.jsx +0 -101
- package/src/Prebuilt/components/Footer/StreamingFooter.jsx +0 -71
- package/src/Prebuilt/components/Footer.jsx +0 -8
- package/src/Prebuilt/components/MoreSettings/ChangeSelfRole.jsx +0 -67
- package/src/Prebuilt/components/TileMenu.jsx +0 -268
- package/src/Prebuilt/index.d.ts +0 -20
- package/src/Prebuilt/index.js +0 -2
@@ -22,6 +22,22 @@ export declare const slideRightAndFade: (start?: string) => {
|
|
22
22
|
(): string;
|
23
23
|
name: string;
|
24
24
|
};
|
25
|
+
export declare const sheetSlideIn: {
|
26
|
+
(): string;
|
27
|
+
name: string;
|
28
|
+
};
|
29
|
+
export declare const sheetSlideOut: {
|
30
|
+
(): string;
|
31
|
+
name: string;
|
32
|
+
};
|
33
|
+
export declare const sheetFadeIn: {
|
34
|
+
(): string;
|
35
|
+
name: string;
|
36
|
+
};
|
37
|
+
export declare const sheetFadeOut: {
|
38
|
+
(): string;
|
39
|
+
name: string;
|
40
|
+
};
|
25
41
|
export declare const slideDownAndFade: (start?: string) => {
|
26
42
|
(): string;
|
27
43
|
name: string;
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"prebuilt",
|
11
11
|
"roomkit"
|
12
12
|
],
|
13
|
-
"version": "0.1.4
|
13
|
+
"version": "0.1.4",
|
14
14
|
"author": "100ms",
|
15
15
|
"license": "MIT",
|
16
16
|
"files": [
|
@@ -75,17 +75,17 @@
|
|
75
75
|
"react": ">=17.0.2 <19.0.0"
|
76
76
|
},
|
77
77
|
"dependencies": {
|
78
|
-
"@100mslive/hls-player": "0.1.13
|
79
|
-
"@100mslive/hms-virtual-background": "1.11.13
|
80
|
-
"@100mslive/react-icons": "0.8.13
|
81
|
-
"@100mslive/react-sdk": "0.8.13
|
78
|
+
"@100mslive/hls-player": "0.1.13",
|
79
|
+
"@100mslive/hms-virtual-background": "1.11.13",
|
80
|
+
"@100mslive/react-icons": "0.8.13",
|
81
|
+
"@100mslive/react-sdk": "0.8.13",
|
82
82
|
"@100mslive/types-prebuilt": "0.10.0",
|
83
83
|
"@emoji-mart/data": "^1.0.6",
|
84
84
|
"@emoji-mart/react": "^1.0.1",
|
85
85
|
"@radix-ui/react-accordion": "1.0.0",
|
86
86
|
"@radix-ui/react-checkbox": "1.0.0",
|
87
87
|
"@radix-ui/react-collapsible": "1.0.0",
|
88
|
-
"@radix-ui/react-dialog": "1.0.
|
88
|
+
"@radix-ui/react-dialog": "1.0.4",
|
89
89
|
"@radix-ui/react-dropdown-menu": "2.0.5",
|
90
90
|
"@radix-ui/react-label": "1.0.0",
|
91
91
|
"@radix-ui/react-popover": "1.0.6",
|
@@ -100,7 +100,6 @@
|
|
100
100
|
"@stitches/react": "^1.2.8",
|
101
101
|
"emoji-mart": "^5.2.2",
|
102
102
|
"eventemitter2": "^6.4.7",
|
103
|
-
"hls.js": "^1.3.0",
|
104
103
|
"lodash.merge": "^4.6.2",
|
105
104
|
"pusher-js": "^7.0.3",
|
106
105
|
"qrcode.react": "^3.1.0",
|
@@ -113,8 +112,7 @@
|
|
113
112
|
"recordrtc": "^5.6.2",
|
114
113
|
"screenfull": "^5.1.0",
|
115
114
|
"uuid": "^8.3.2",
|
116
|
-
"worker-timers": "^7.0.40"
|
117
|
-
"zipyai": "^1.3.24"
|
115
|
+
"worker-timers": "^7.0.40"
|
118
116
|
},
|
119
|
-
"gitHead": "
|
117
|
+
"gitHead": "a545bf04356bdc9c665e184e2b3413a3d14c2f6c"
|
120
118
|
}
|
package/src/Button/Button.tsx
CHANGED
@@ -107,8 +107,8 @@ const StyledButton = styled('button', {
|
|
107
107
|
'$secondary_bright',
|
108
108
|
'$secondary_dim',
|
109
109
|
'$secondary_disabled',
|
110
|
-
'$
|
111
|
-
'$
|
110
|
+
'$on_surface_high',
|
111
|
+
'$on_surface_low',
|
112
112
|
),
|
113
113
|
},
|
114
114
|
{
|
@@ -131,8 +131,8 @@ const StyledButton = styled('button', {
|
|
131
131
|
'$primary_bright',
|
132
132
|
'$primary_dim',
|
133
133
|
'$primary_disabled',
|
134
|
-
'$
|
135
|
-
'$
|
134
|
+
'$on_surface_high',
|
135
|
+
'$on_surface_low',
|
136
136
|
),
|
137
137
|
},
|
138
138
|
],
|
@@ -53,7 +53,7 @@ const DropdownItem = styled(Item, {
|
|
53
53
|
display: 'flex',
|
54
54
|
alignItems: 'center',
|
55
55
|
outline: 'none',
|
56
|
-
backgroundColor: '$
|
56
|
+
backgroundColor: '$surface_dim',
|
57
57
|
'&:hover': {
|
58
58
|
cursor: 'pointer',
|
59
59
|
bg: '$surface_bright',
|
@@ -74,7 +74,7 @@ const DropdownContent = styled(Content, {
|
|
74
74
|
maxHeight: '$64',
|
75
75
|
r: '$1',
|
76
76
|
py: '$4',
|
77
|
-
backgroundColor: '$
|
77
|
+
backgroundColor: '$surface_dim',
|
78
78
|
overflowY: 'auto',
|
79
79
|
boxShadow: '0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23)',
|
80
80
|
zIndex: 20,
|
@@ -17,8 +17,10 @@ export const IconButton = styled('button', {
|
|
17
17
|
'&:not([disabled]):focus': {
|
18
18
|
outline: 'none',
|
19
19
|
},
|
20
|
-
'
|
21
|
-
|
20
|
+
'@media (hover: hover)': {
|
21
|
+
'&:not([disabled]):hover': {
|
22
|
+
backgroundColor: '$on_surface_low',
|
23
|
+
},
|
22
24
|
},
|
23
25
|
'&[disabled]': {
|
24
26
|
opacity: 0.5,
|
package/src/Popover/index.tsx
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Arrow, Content, Popover as Root, Portal, Trigger } from '@radix-ui/react-popover';
|
1
|
+
import { Arrow, Close, Content, Popover as Root, Portal, Trigger } from '@radix-ui/react-popover';
|
2
2
|
import { styled } from '../Theme';
|
3
3
|
import { popoverAnimation } from '../utils/animations';
|
4
4
|
|
@@ -23,4 +23,5 @@ export const Popover = {
|
|
23
23
|
Trigger: StyledTrigger,
|
24
24
|
Portal: Portal,
|
25
25
|
Arrow: StyledArrow,
|
26
|
+
Close: Close,
|
26
27
|
};
|
@@ -1,37 +1,80 @@
|
|
1
|
-
import React, { Suspense, useEffect, useRef } from 'react';
|
1
|
+
import React, { MutableRefObject, ReactElement, Suspense, useEffect, useRef } from 'react';
|
2
2
|
import { BrowserRouter, MemoryRouter, Navigate, Route, Routes, useParams } from 'react-router-dom';
|
3
|
+
import { HMSStatsStoreWrapper, HMSStoreWrapper, IHMSNotifications } from '@100mslive/hms-video-store';
|
4
|
+
import { Layout, Logo, Screens, Theme, Typography } from '@100mslive/types-prebuilt';
|
3
5
|
import {
|
6
|
+
HMSActions,
|
4
7
|
HMSReactiveStore,
|
5
8
|
HMSRoomProvider,
|
6
9
|
selectIsConnectedToRoom,
|
7
10
|
useHMSActions,
|
8
11
|
useHMSStore,
|
9
12
|
} from '@100mslive/react-sdk';
|
13
|
+
// @ts-ignore: No implicit Any
|
10
14
|
import { AppData } from './components/AppData/AppData';
|
15
|
+
// @ts-ignore: No implicit Any
|
11
16
|
import { BeamSpeakerLabelsLogging } from './components/AudioLevel/BeamSpeakerLabelsLogging';
|
17
|
+
// @ts-ignore: No implicit Any
|
12
18
|
import AuthToken from './components/AuthToken';
|
19
|
+
// @ts-ignore: No implicit Any
|
13
20
|
import { ErrorBoundary } from './components/ErrorBoundary';
|
21
|
+
// @ts-ignore: No implicit Any
|
14
22
|
import FullPageProgress from './components/FullPageProgress';
|
23
|
+
// @ts-ignore: No implicit Any
|
15
24
|
import { Init } from './components/init/Init';
|
25
|
+
// @ts-ignore: No implicit Any
|
16
26
|
import { KeyboardHandler } from './components/Input/KeyboardInputManager';
|
27
|
+
// @ts-ignore: No implicit Any
|
17
28
|
import { Notifications } from './components/Notifications';
|
29
|
+
// @ts-ignore: No implicit Any
|
18
30
|
import PostLeave from './components/PostLeave';
|
31
|
+
// @ts-ignore: No implicit Any
|
19
32
|
import PreviewContainer from './components/Preview/PreviewContainer';
|
33
|
+
// @ts-ignore: No implicit Any
|
20
34
|
import { ToastContainer } from './components/Toast/ToastContainer';
|
21
|
-
import { RoomLayoutContext, RoomLayoutProvider } from './provider/roomLayoutProvider
|
35
|
+
import { RoomLayoutContext, RoomLayoutProvider } from './provider/roomLayoutProvider';
|
22
36
|
import { Box } from '../Layout';
|
23
37
|
import { globalStyles, HMSThemeProvider } from '../Theme';
|
38
|
+
// @ts-ignore: No implicit Any
|
24
39
|
import { HMSPrebuiltContext, useHMSPrebuiltContext } from './AppContext';
|
40
|
+
// @ts-ignore: No implicit Any
|
25
41
|
import { FlyingEmoji } from './plugins/FlyingEmoji';
|
42
|
+
// @ts-ignore: No implicit Any
|
26
43
|
import { RemoteStopScreenshare } from './plugins/RemoteStopScreenshare';
|
44
|
+
// @ts-ignore: No implicit Any
|
27
45
|
import { getRoutePrefix } from './common/utils';
|
46
|
+
// @ts-ignore: No implicit Any
|
28
47
|
import { FeatureFlags } from './services/FeatureFlags';
|
29
48
|
|
49
|
+
// @ts-ignore: No implicit Any
|
30
50
|
const Conference = React.lazy(() => import('./components/conference'));
|
31
51
|
|
52
|
+
export type HMSPrebuiltOptions = {
|
53
|
+
userName?: string;
|
54
|
+
userId?: string;
|
55
|
+
endpoints?: object;
|
56
|
+
};
|
57
|
+
|
58
|
+
export type HMSPrebuiltProps = {
|
59
|
+
roomCode?: string;
|
60
|
+
logo?: Logo;
|
61
|
+
typography?: Typography;
|
62
|
+
themes?: Theme[];
|
63
|
+
options?: HMSPrebuiltOptions;
|
64
|
+
screens?: Screens;
|
65
|
+
onLeave?: () => void;
|
66
|
+
};
|
67
|
+
|
68
|
+
export type HMSPrebuiltRefType = {
|
69
|
+
hmsActions: HMSActions;
|
70
|
+
hmsStore: HMSStoreWrapper;
|
71
|
+
hmsStats: HMSStatsStoreWrapper;
|
72
|
+
hmsNotifications: IHMSNotifications;
|
73
|
+
};
|
74
|
+
|
32
75
|
// TODO: remove now that there are options to change to portrait
|
33
|
-
const getAspectRatio = ({ width, height }) => {
|
34
|
-
const host = process.env.REACT_APP_HOST_NAME;
|
76
|
+
const getAspectRatio = ({ width, height }: { width: number; height: number }) => {
|
77
|
+
const host = process.env.REACT_APP_HOST_NAME || '';
|
35
78
|
const portraitDomains = (process.env.REACT_APP_PORTRAIT_MODE_DOMAINS || '').split(',');
|
36
79
|
if (portraitDomains.includes(host) && width > height) {
|
37
80
|
return { width: height, height: width };
|
@@ -39,23 +82,14 @@ const getAspectRatio = ({ width, height }) => {
|
|
39
82
|
return { width, height };
|
40
83
|
};
|
41
84
|
|
42
|
-
export const HMSPrebuilt = React.forwardRef(
|
85
|
+
export const HMSPrebuilt = React.forwardRef<HMSPrebuiltRefType, HMSPrebuiltProps>(
|
43
86
|
(
|
44
87
|
{
|
45
88
|
roomCode = '',
|
46
89
|
logo,
|
47
90
|
typography,
|
48
91
|
themes,
|
49
|
-
options: {
|
50
|
-
userName = '',
|
51
|
-
userId = '',
|
52
|
-
endpoints: {
|
53
|
-
init: initEndpoint = '',
|
54
|
-
tokenByRoomCode: tokenByRoomCodeEndpoint = '',
|
55
|
-
tokenByRoomIdRole: tokenByRoomIdRoleEndpoint = '',
|
56
|
-
roomLayout: roomLayoutEndpoint = '',
|
57
|
-
} = {},
|
58
|
-
} = {},
|
92
|
+
options: { userName = '', userId = '', endpoints } = {},
|
59
93
|
screens,
|
60
94
|
onLeave,
|
61
95
|
},
|
@@ -64,7 +98,7 @@ export const HMSPrebuilt = React.forwardRef(
|
|
64
98
|
const aspectRatio = '1-1';
|
65
99
|
const metadata = '';
|
66
100
|
const { 0: width, 1: height } = aspectRatio.split('-').map(el => parseInt(el));
|
67
|
-
const reactiveStore = useRef();
|
101
|
+
const reactiveStore = useRef<HMSPrebuiltRefType>();
|
68
102
|
|
69
103
|
const [hydrated, setHydrated] = React.useState(false);
|
70
104
|
useEffect(() => {
|
@@ -87,26 +121,31 @@ export const HMSPrebuilt = React.forwardRef(
|
|
87
121
|
if (!ref || !reactiveStore.current) {
|
88
122
|
return;
|
89
123
|
}
|
90
|
-
|
91
|
-
ref.current = { ...reactiveStore.current };
|
124
|
+
(ref as MutableRefObject<HMSPrebuiltRefType>).current = { ...reactiveStore.current };
|
92
125
|
}, [ref]);
|
93
126
|
|
94
127
|
// leave room when component unmounts
|
95
128
|
useEffect(
|
96
129
|
() => () => {
|
97
|
-
|
130
|
+
reactiveStore?.current?.hmsActions.leave();
|
98
131
|
},
|
99
132
|
[],
|
100
133
|
);
|
101
134
|
|
102
|
-
const
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
135
|
+
const endpointsObj = endpoints as
|
136
|
+
| {
|
137
|
+
init: string;
|
138
|
+
tokenByRoomCode: string;
|
139
|
+
tokenByRoomIdRole: string;
|
140
|
+
roomLayout: string;
|
141
|
+
}
|
142
|
+
| undefined;
|
143
|
+
const tokenByRoomCodeEndpoint: string = endpointsObj?.tokenByRoomCode || '';
|
144
|
+
const initEndpoint: string = endpointsObj?.init || '';
|
145
|
+
const roomLayoutEndpoint: string = endpointsObj?.roomLayout || '';
|
146
|
+
const tokenByRoomIdRoleEndpoint: string = endpointsObj?.tokenByRoomIdRole || '';
|
108
147
|
|
109
|
-
const overrideLayout = {
|
148
|
+
const overrideLayout: Partial<Layout> = {
|
110
149
|
logo,
|
111
150
|
themes,
|
112
151
|
typography,
|
@@ -129,21 +168,26 @@ export const HMSPrebuilt = React.forwardRef(
|
|
129
168
|
onLeave,
|
130
169
|
userName,
|
131
170
|
userId,
|
132
|
-
endpoints
|
171
|
+
endpoints: {
|
172
|
+
tokenByRoomCode: tokenByRoomCodeEndpoint,
|
173
|
+
init: initEndpoint,
|
174
|
+
tokenByRoomIdRole: tokenByRoomIdRoleEndpoint,
|
175
|
+
roomLayout: roomLayoutEndpoint,
|
176
|
+
},
|
133
177
|
}}
|
134
178
|
>
|
135
179
|
<HMSRoomProvider
|
136
180
|
isHMSStatsOn={FeatureFlags.enableStatsForNerds}
|
137
|
-
actions={reactiveStore.current
|
138
|
-
store={reactiveStore.current
|
139
|
-
notifications={reactiveStore.current
|
140
|
-
stats={reactiveStore.current
|
181
|
+
actions={reactiveStore.current?.hmsActions}
|
182
|
+
store={reactiveStore.current?.hmsStore}
|
183
|
+
notifications={reactiveStore.current?.hmsNotifications}
|
184
|
+
stats={reactiveStore.current?.hmsStats}
|
141
185
|
>
|
142
186
|
<RoomLayoutProvider roomLayoutEndpoint={roomLayoutEndpoint} overrideLayout={overrideLayout}>
|
143
187
|
<RoomLayoutContext.Consumer>
|
144
188
|
{layout => {
|
145
|
-
const theme = layout
|
146
|
-
const { typography } = layout;
|
189
|
+
const theme: Theme = layout?.themes?.[0] || ({} as Theme);
|
190
|
+
const { typography } = layout || {};
|
147
191
|
let fontFamily = ['sans-serif'];
|
148
192
|
if (typography?.font_family) {
|
149
193
|
fontFamily = [`${typography?.font_family}`, ...fontFamily];
|
@@ -157,8 +201,10 @@ export const HMSPrebuilt = React.forwardRef(
|
|
157
201
|
themeType={`${theme.name}-${Date.now()}`}
|
158
202
|
aspectRatio={getAspectRatio({ width, height })}
|
159
203
|
theme={{
|
204
|
+
//@ts-ignore: Prebuilt theme to match stiches theme
|
160
205
|
colors: theme.palette,
|
161
206
|
fonts: {
|
207
|
+
//@ts-ignore: font list to match token types of stiches
|
162
208
|
sans: fontFamily,
|
163
209
|
},
|
164
210
|
}}
|
@@ -189,7 +235,7 @@ export const HMSPrebuilt = React.forwardRef(
|
|
189
235
|
|
190
236
|
HMSPrebuilt.displayName = 'HMSPrebuilt';
|
191
237
|
|
192
|
-
const Redirector = ({ showPreview }) => {
|
238
|
+
const Redirector = ({ showPreview }: { showPreview: boolean }) => {
|
193
239
|
const { roomId, role } = useParams();
|
194
240
|
|
195
241
|
if (!roomId && !role) {
|
@@ -278,7 +324,7 @@ const BackSwipe = () => {
|
|
278
324
|
return null;
|
279
325
|
};
|
280
326
|
|
281
|
-
const Router = ({ children }) => {
|
327
|
+
const Router = ({ children }: { children: ReactElement }) => {
|
282
328
|
const { roomId, role, roomCode } = useHMSPrebuiltContext();
|
283
329
|
return [roomId, role, roomCode].every(value => !value) ? (
|
284
330
|
<BrowserRouter>{children}</BrowserRouter>
|
@@ -289,21 +335,22 @@ const Router = ({ children }) => {
|
|
289
335
|
);
|
290
336
|
};
|
291
337
|
|
292
|
-
function AppRoutes({ authTokenByRoomCodeEndpoint }) {
|
338
|
+
function AppRoutes({ authTokenByRoomCodeEndpoint }: { authTokenByRoomCodeEndpoint: string }) {
|
293
339
|
return (
|
294
340
|
<Router>
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
<
|
305
|
-
|
306
|
-
|
341
|
+
<>
|
342
|
+
<ToastContainer />
|
343
|
+
<Notifications />
|
344
|
+
<BackSwipe />
|
345
|
+
<FlyingEmoji />
|
346
|
+
<RemoteStopScreenshare />
|
347
|
+
<KeyboardHandler />
|
348
|
+
<BeamSpeakerLabelsLogging />
|
349
|
+
<AuthToken authTokenByRoomCodeEndpoint={authTokenByRoomCodeEndpoint} />
|
350
|
+
<Routes>
|
351
|
+
<Route path="/*" element={<RouteList />} />
|
352
|
+
</Routes>
|
353
|
+
</>
|
307
354
|
</Router>
|
308
355
|
);
|
309
356
|
}
|
@@ -1,28 +1,42 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { Meta, StoryFn } from '@storybook/react';
|
3
|
-
import { HMSPrebuilt } from '.';
|
3
|
+
import { HMSPrebuilt, HMSPrebuiltOptions, HMSPrebuiltProps } from '.';
|
4
4
|
|
5
5
|
export default {
|
6
6
|
title: 'UI Components/Prebuilt',
|
7
7
|
component: HMSPrebuilt,
|
8
8
|
argTypes: {
|
9
|
-
roomCode: { control: { type: 'text' }, defaultValue: '
|
10
|
-
logo: { control: { type: 'object' }, defaultValue:
|
9
|
+
roomCode: { control: { type: 'text' }, defaultValue: '' },
|
10
|
+
logo: { control: { type: 'object' }, defaultValue: null },
|
11
11
|
typography: { control: { type: 'object' }, defaultValue: 'Roboto' },
|
12
12
|
},
|
13
13
|
} as Meta<typeof HMSPrebuilt>;
|
14
14
|
|
15
|
-
const PrebuiltRoomCodeStory: StoryFn<typeof HMSPrebuilt> = ({
|
15
|
+
const PrebuiltRoomCodeStory: StoryFn<typeof HMSPrebuilt> = ({
|
16
|
+
roomCode = '',
|
17
|
+
logo,
|
18
|
+
themes,
|
19
|
+
typography,
|
20
|
+
options,
|
21
|
+
}: HMSPrebuiltProps) => {
|
16
22
|
return <HMSPrebuilt roomCode={roomCode} logo={logo} options={options} themes={themes} typography={typography} />;
|
17
23
|
};
|
18
24
|
|
19
25
|
export const Example = PrebuiltRoomCodeStory.bind({});
|
26
|
+
const endpoints: HMSPrebuiltOptions['endpoints'] = {
|
27
|
+
roomLayout: process.env.STORYBOOK_ROOM_LAYOUT_ENDPOINT,
|
28
|
+
tokenByRoomCode: process.env.STORYBOOK_TOKEN_BY_ROOM_CODE_ENDPOINT,
|
29
|
+
init: process.env.STORYBOOK_INIT_API_ENDPOINT,
|
30
|
+
};
|
31
|
+
|
32
|
+
const hasEndpoints = Object.values(endpoints).some(val => !!val);
|
33
|
+
|
20
34
|
Example.args = {
|
21
|
-
roomCode:
|
35
|
+
roomCode: process.env.STORYBOOK_SAMPLE_ROOM_CODE,
|
22
36
|
options: {
|
23
|
-
|
24
|
-
|
25
|
-
|
37
|
+
userName: '',
|
38
|
+
userId: '',
|
39
|
+
endpoints: hasEndpoints ? endpoints : undefined,
|
26
40
|
},
|
27
41
|
typography: {
|
28
42
|
font_family: 'Roboto',
|
@@ -134,6 +134,7 @@ export const APP_DATA = {
|
|
134
134
|
dropdownList: 'dropdownList',
|
135
135
|
authToken: 'authToken',
|
136
136
|
pdfConfig: 'pdfConfig',
|
137
|
+
minimiseInset: 'minimiseInset',
|
137
138
|
};
|
138
139
|
export const UI_SETTINGS = {
|
139
140
|
isAudioOnly: 'isAudioOnly',
|
@@ -143,8 +144,6 @@ export const UI_SETTINGS = {
|
|
143
144
|
showStatsOnTiles: 'showStatsOnTiles',
|
144
145
|
enableAmbientMusic: 'enableAmbientMusic',
|
145
146
|
mirrorLocalVideo: 'mirrorLocalVideo',
|
146
|
-
activeSpeakerSorting: 'activeSpeakerSorting',
|
147
|
-
hideLocalVideo: 'hideLocalVideo',
|
148
147
|
};
|
149
148
|
|
150
149
|
export const SIDE_PANE_OPTIONS = {
|
@@ -1,6 +1,8 @@
|
|
1
1
|
// @ts-check
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
3
|
+
import { JoinForm_JoinBtnType } from '@100mslive/types-prebuilt/elements/join_form';
|
3
4
|
import { selectAvailableRoleNames, selectIsConnectedToRoom, selectPeerCount, useHMSStore } from '@100mslive/react-sdk';
|
5
|
+
import { useRoomLayout } from '../provider/roomLayoutProvider';
|
4
6
|
import { isInternalRole } from './utils';
|
5
7
|
|
6
8
|
/**
|
@@ -45,3 +47,9 @@ export const useFilteredRoles = () => {
|
|
45
47
|
const roles = useHMSStore(selectAvailableRoleNames).filter(role => !isInternalRole(role));
|
46
48
|
return roles;
|
47
49
|
};
|
50
|
+
|
51
|
+
export const useShowStreamingUI = () => {
|
52
|
+
const layout = useRoomLayout();
|
53
|
+
const { join_form } = layout?.screens?.preview?.default?.elements || {};
|
54
|
+
return join_form?.join_btn_type === JoinForm_JoinBtnType.JOIN_BTN_TYPE_JOIN_AND_GO_LIVE;
|
55
|
+
};
|
@@ -83,3 +83,18 @@ export const getUpdatedHeight = (e, MINIMUM_HEIGHT) => {
|
|
83
83
|
const sheetHeightInVH = Math.max(MINIMUM_HEIGHT, heightToPercentage > 80 ? 100 : heightToPercentage);
|
84
84
|
return `${sheetHeightInVH}vh`;
|
85
85
|
};
|
86
|
+
|
87
|
+
export const getFormattedCount = num => {
|
88
|
+
const formatter = new Intl.NumberFormat('en', { notation: 'compact', maximumFractionDigits: 2 });
|
89
|
+
const formattedNum = formatter.format(num);
|
90
|
+
return formattedNum;
|
91
|
+
};
|
92
|
+
|
93
|
+
export const formatTime = timeInSeconds => {
|
94
|
+
timeInSeconds = Math.floor(timeInSeconds / 1000);
|
95
|
+
const hours = Math.floor(timeInSeconds / 3600);
|
96
|
+
const minutes = Math.floor((timeInSeconds % 3600) / 60);
|
97
|
+
const seconds = timeInSeconds % 60;
|
98
|
+
const hour = hours !== 0 ? `${hours < 10 ? '0' : ''}${hours}:` : '';
|
99
|
+
return `${hour}${minutes < 10 ? '0' : ''}${minutes}:${seconds < 10 ? '0' : ''}${seconds}`;
|
100
|
+
};
|
@@ -48,8 +48,6 @@ const initialAppData = {
|
|
48
48
|
[UI_SETTINGS.enableAmbientMusic]: false,
|
49
49
|
[UI_SETTINGS.uiViewMode]: UI_MODE_GRID,
|
50
50
|
[UI_SETTINGS.mirrorLocalVideo]: true,
|
51
|
-
[UI_SETTINGS.activeSpeakerSorting]: process.env.REACT_APP_ENV === 'qa',
|
52
|
-
[UI_SETTINGS.hideLocalVideo]: false,
|
53
51
|
},
|
54
52
|
[APP_DATA.subscribedNotifications]: {
|
55
53
|
PEER_JOINED: false,
|
@@ -72,6 +70,7 @@ const initialAppData = {
|
|
72
70
|
[APP_DATA.waitingViewerRole]: DEFAULT_WAITING_VIEWER_ROLE,
|
73
71
|
[APP_DATA.dropdownList]: [],
|
74
72
|
[APP_DATA.authToken]: '',
|
73
|
+
[APP_DATA.minimiseInset]: false,
|
75
74
|
};
|
76
75
|
|
77
76
|
export const AppData = React.memo(({ appDetails, tokenEndpoint }) => {
|
@@ -51,11 +51,6 @@ export const useIsHeadless = () => {
|
|
51
51
|
return isHeadless;
|
52
52
|
};
|
53
53
|
|
54
|
-
export const useActiveSpeakerSorting = () => {
|
55
|
-
const activeSpeakerSorting = useUISettings(UI_SETTINGS.activeSpeakerSorting);
|
56
|
-
return activeSpeakerSorting;
|
57
|
-
};
|
58
|
-
|
59
54
|
export const useHLSViewerRole = () => {
|
60
55
|
return useHMSStore(selectAppData(APP_DATA.hlsViewerRole));
|
61
56
|
};
|