@100mslive/roomkit-react 0.1.4-alpha.0 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. package/dist/{HLSView-T267ZHOS.js → HLSView-CTAJQUU4.js} +7 -11
  2. package/dist/{HLSView-T267ZHOS.js.map → HLSView-CTAJQUU4.js.map} +1 -1
  3. package/dist/PinnedTrackView-CQKONH4O.js +102 -0
  4. package/dist/PinnedTrackView-CQKONH4O.js.map +7 -0
  5. package/dist/Popover/index.d.ts +1 -0
  6. package/dist/Prebuilt/App.d.ts +25 -0
  7. package/dist/Prebuilt/index.d.ts +1 -0
  8. package/dist/Prebuilt/provider/roomLayoutProvider/index.d.ts +1 -1
  9. package/dist/Sheet/Sheet.d.ts +3093 -0
  10. package/dist/Sheet/index.d.ts +1 -0
  11. package/dist/Theme/ThemeProvider.d.ts +4 -286
  12. package/dist/Theme/stitches.config.d.ts +1 -1
  13. package/dist/{VirtualBackground-BCKXNDTD.js → VirtualBackground-GGGBJYVY.js} +31 -7
  14. package/dist/VirtualBackground-GGGBJYVY.js.map +7 -0
  15. package/dist/chunk-I2FJWE74.js +827 -0
  16. package/dist/chunk-I2FJWE74.js.map +7 -0
  17. package/dist/{chunk-NLZVUXR3.js → chunk-L2SX7GBO.js} +3020 -2189
  18. package/dist/chunk-L2SX7GBO.js.map +7 -0
  19. package/dist/chunk-NOKIGB6Y.js +1100 -0
  20. package/dist/chunk-NOKIGB6Y.js.map +7 -0
  21. package/dist/chunk-TJNDX446.js +67 -0
  22. package/dist/chunk-TJNDX446.js.map +7 -0
  23. package/dist/{chunk-3HMUOAD6.js → conference-OEO7VOJD.js} +3136 -653
  24. package/dist/conference-OEO7VOJD.js.map +7 -0
  25. package/dist/index.cjs.js +15733 -15498
  26. package/dist/index.cjs.js.map +4 -4
  27. package/dist/index.js +4 -8
  28. package/dist/meta.cjs.json +3248 -3039
  29. package/dist/meta.esbuild.json +3398 -3386
  30. package/dist/utils/animations.d.ts +16 -0
  31. package/package.json +8 -11
  32. package/src/Button/Button.tsx +4 -4
  33. package/src/Dropdown/Dropdown.tsx +2 -2
  34. package/src/IconButton/IconButton.tsx +4 -2
  35. package/src/Pagination/StyledPagination.tsx +1 -0
  36. package/src/Popover/index.tsx +2 -1
  37. package/src/Prebuilt/{App.jsx → App.tsx} +95 -48
  38. package/src/Prebuilt/Prebuilt.stories.tsx +22 -8
  39. package/src/Prebuilt/common/constants.js +1 -2
  40. package/src/Prebuilt/common/hooks.js +8 -0
  41. package/src/Prebuilt/common/utils.js +15 -0
  42. package/src/Prebuilt/components/AppData/AppData.jsx +1 -2
  43. package/src/Prebuilt/components/AppData/useUISettings.js +0 -5
  44. package/src/Prebuilt/components/AudioVideoToggle.jsx +69 -26
  45. package/src/Prebuilt/components/AuthToken.jsx +3 -2
  46. package/src/Prebuilt/components/Chat/ChatSelector.jsx +1 -1
  47. package/src/Prebuilt/components/Connection/TileConnection.jsx +0 -1
  48. package/src/Prebuilt/components/EmojiReaction.jsx +23 -73
  49. package/src/Prebuilt/components/EndSessionContent.jsx +57 -0
  50. package/src/Prebuilt/components/EqualProminence.jsx +180 -0
  51. package/src/Prebuilt/components/ErrorBoundary.jsx +4 -10
  52. package/src/Prebuilt/components/Footer/EmojiCard.jsx +34 -0
  53. package/src/Prebuilt/components/Footer/Footer.jsx +73 -0
  54. package/src/Prebuilt/components/{Header → Footer}/ParticipantList.jsx +5 -5
  55. package/src/Prebuilt/components/Header/ConferencingHeader.jsx +27 -7
  56. package/src/Prebuilt/components/Header/HeaderComponents.jsx +16 -14
  57. package/src/Prebuilt/components/Header/StreamActions.jsx +101 -36
  58. package/src/Prebuilt/components/Header/StreamingHeader.jsx +1 -1
  59. package/src/Prebuilt/components/Header/common.jsx +164 -0
  60. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +1 -2
  61. package/src/Prebuilt/components/LeaveCard.jsx +19 -0
  62. package/src/Prebuilt/components/LeaveRoom.jsx +35 -143
  63. package/src/Prebuilt/components/LeaveSessionContent.jsx +45 -0
  64. package/src/Prebuilt/components/MoreSettings/ActionTile.jsx +55 -0
  65. package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +96 -0
  66. package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +31 -54
  67. package/src/Prebuilt/components/MoreSettings/EmbedUrl.jsx +48 -73
  68. package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +5 -221
  69. package/src/Prebuilt/components/MoreSettings/MuteAllContent.jsx +61 -0
  70. package/src/Prebuilt/components/MoreSettings/MuteAllModal.jsx +32 -49
  71. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopLeaveRoom.jsx +129 -0
  72. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.jsx +219 -0
  73. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebLeaveRoom.jsx +100 -0
  74. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.jsx +259 -0
  75. package/src/Prebuilt/components/Notifications/Notifications.jsx +0 -2
  76. package/src/Prebuilt/components/Notifications/ReconnectNotifications.jsx +0 -4
  77. package/src/Prebuilt/components/PIP/PIPComponent.jsx +30 -26
  78. package/src/Prebuilt/components/PIP/PIPManager.js +13 -0
  79. package/src/Prebuilt/components/PIP/index.jsx +2 -7
  80. package/src/Prebuilt/components/Pagination.jsx +4 -4
  81. package/src/Prebuilt/components/Preview/PreviewContainer.jsx +5 -13
  82. package/src/Prebuilt/components/Preview/PreviewForm.jsx +9 -5
  83. package/src/Prebuilt/components/Preview/PreviewJoin.jsx +20 -27
  84. package/src/Prebuilt/components/RaiseHand.jsx +27 -0
  85. package/src/Prebuilt/components/ScreenShare.jsx +1 -1
  86. package/src/Prebuilt/components/ScreenshareDisplay.jsx +2 -2
  87. package/src/Prebuilt/components/ScreenshareTile.jsx +2 -2
  88. package/src/Prebuilt/components/Settings/DeviceSettings.jsx +2 -1
  89. package/src/Prebuilt/components/Settings/LayoutSettings.jsx +1 -24
  90. package/src/Prebuilt/components/Settings/SettingsModal.jsx +152 -17
  91. package/src/Prebuilt/components/ShareMenuIcon.jsx +1 -0
  92. package/src/Prebuilt/components/TileMenu/TileMenu.jsx +133 -0
  93. package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +313 -0
  94. package/src/Prebuilt/components/VideoList.jsx +5 -33
  95. package/src/Prebuilt/components/VideoTile.jsx +30 -8
  96. package/src/Prebuilt/components/conference.jsx +14 -1
  97. package/src/Prebuilt/components/init/Init.jsx +0 -27
  98. package/src/Prebuilt/components/init/initUtils.js +0 -23
  99. package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +2 -1
  100. package/src/Prebuilt/components/pdfAnnotator/pdfInfo.jsx +1 -1
  101. package/src/Prebuilt/components/pdfAnnotator/shareScreenOptions.jsx +19 -8
  102. package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +1 -0
  103. package/src/Prebuilt/images/pdf-share.png +0 -0
  104. package/src/Prebuilt/images/screen-share.png +0 -0
  105. package/src/Prebuilt/index.ts +1 -0
  106. package/src/Prebuilt/layouts/EmbedView.jsx +0 -1
  107. package/src/Prebuilt/layouts/InsetView.jsx +65 -24
  108. package/src/Prebuilt/layouts/PDFView.jsx +0 -1
  109. package/src/Prebuilt/layouts/SidePane.jsx +8 -7
  110. package/src/Prebuilt/layouts/WhiteboardView.jsx +2 -4
  111. package/src/Prebuilt/layouts/mainView.jsx +22 -31
  112. package/src/Prebuilt/layouts/screenShareView.jsx +0 -2
  113. package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +25 -1
  114. package/src/Prebuilt/plugins/whiteboard/index.js +1 -1
  115. package/src/Prebuilt/primitives/DialogContent.jsx +1 -1
  116. package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +1 -1
  117. package/src/Sheet/Sheet.mdx +19 -0
  118. package/src/Sheet/Sheet.stories.tsx +103 -0
  119. package/src/Sheet/Sheet.tsx +118 -0
  120. package/src/Sheet/index.ts +1 -0
  121. package/src/Theme/ThemeProvider.tsx +10 -13
  122. package/src/Theme/base.config.ts +1 -1
  123. package/src/Theme/stitches.config.ts +1 -1
  124. package/src/TileMenu/StyledMenuTile.tsx +2 -2
  125. package/src/TileMenu/TileMenu.tsx +2 -0
  126. package/src/VideoTile/StyledVideoTile.tsx +5 -0
  127. package/src/utils/animations.ts +18 -0
  128. package/dist/ActiveSpeakerView-AGL73O6U.css +0 -11
  129. package/dist/ActiveSpeakerView-AGL73O6U.css.map +0 -7
  130. package/dist/ActiveSpeakerView-UPFD5RXA.js +0 -39
  131. package/dist/ActiveSpeakerView-UPFD5RXA.js.map +0 -7
  132. package/dist/HLSView-64OG755F.css +0 -11
  133. package/dist/HLSView-64OG755F.css.map +0 -7
  134. package/dist/PinnedTrackView-O4FHHHOV.js +0 -70
  135. package/dist/PinnedTrackView-O4FHHHOV.js.map +0 -7
  136. package/dist/PinnedTrackView-YWAZ2342.css +0 -11
  137. package/dist/PinnedTrackView-YWAZ2342.css.map +0 -7
  138. package/dist/VirtualBackground-BCKXNDTD.js.map +0 -7
  139. package/dist/chunk-3HMUOAD6.js.map +0 -7
  140. package/dist/chunk-6GXDYWD5.js +0 -243
  141. package/dist/chunk-6GXDYWD5.js.map +0 -7
  142. package/dist/chunk-NLZVUXR3.js.map +0 -7
  143. package/dist/chunk-ORPC2GYB.js +0 -58
  144. package/dist/chunk-ORPC2GYB.js.map +0 -7
  145. package/dist/chunk-YE4RPJYG.js +0 -811
  146. package/dist/chunk-YE4RPJYG.js.map +0 -7
  147. package/dist/conference-7KHWJZLG.css +0 -11
  148. package/dist/conference-7KHWJZLG.css.map +0 -7
  149. package/dist/conference-ETISNCLN.js +0 -3697
  150. package/dist/conference-ETISNCLN.js.map +0 -7
  151. package/dist/index.cjs.css +0 -11
  152. package/dist/index.cjs.css.map +0 -7
  153. package/dist/index.css +0 -11
  154. package/dist/index.css.map +0 -7
  155. package/dist/transcription-JJQ4UAIK.js +0 -356
  156. package/dist/transcription-JJQ4UAIK.js.map +0 -7
  157. package/src/Prebuilt/common/useSortedPeers.js +0 -28
  158. package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.jsx +0 -96
  159. package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.stories.tsx +0 -46
  160. package/src/Prebuilt/components/Footer/ConferencingFooter.jsx +0 -101
  161. package/src/Prebuilt/components/Footer/StreamingFooter.jsx +0 -71
  162. package/src/Prebuilt/components/Footer.jsx +0 -8
  163. package/src/Prebuilt/components/MoreSettings/ChangeSelfRole.jsx +0 -67
  164. package/src/Prebuilt/components/TileMenu.jsx +0 -268
  165. package/src/Prebuilt/index.d.ts +0 -20
  166. 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-alpha.0",
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-alpha.0",
79
- "@100mslive/hms-virtual-background": "1.11.13-alpha.0",
80
- "@100mslive/react-icons": "0.8.13-alpha.0",
81
- "@100mslive/react-sdk": "0.8.13-alpha.0",
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.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",
@@ -98,10 +98,8 @@
98
98
  "@radix-ui/react-toast": "1.0.0",
99
99
  "@radix-ui/react-tooltip": "1.0.6",
100
100
  "@stitches/react": "^1.2.8",
101
- "@tldraw/tldraw": "^1.18.4",
102
101
  "emoji-mart": "^5.2.2",
103
102
  "eventemitter2": "^6.4.7",
104
- "hls.js": "^1.3.0",
105
103
  "lodash.merge": "^4.6.2",
106
104
  "pusher-js": "^7.0.3",
107
105
  "qrcode.react": "^3.1.0",
@@ -114,8 +112,7 @@
114
112
  "recordrtc": "^5.6.2",
115
113
  "screenfull": "^5.1.0",
116
114
  "uuid": "^8.3.2",
117
- "worker-timers": "^7.0.40",
118
- "zipyai": "^1.3.24"
115
+ "worker-timers": "^7.0.40"
119
116
  },
120
- "gitHead": "149d1cf9dd51d27800097d81057207e52a046797"
117
+ "gitHead": "a545bf04356bdc9c665e184e2b3413a3d14c2f6c"
121
118
  }
@@ -107,8 +107,8 @@ const StyledButton = styled('button', {
107
107
  '$secondary_bright',
108
108
  '$secondary_dim',
109
109
  '$secondary_disabled',
110
- '$on_secondary_high',
111
- '$on_secondary_low',
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
- '$on_primary_high',
135
- '$on_primary_low',
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: '$surface_default',
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: '$surface_default',
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
- '&:not([disabled]):hover': {
21
- backgroundColor: '$on_surface_low',
20
+ '@media (hover: hover)': {
21
+ '&:not([disabled]):hover': {
22
+ backgroundColor: '$on_surface_low',
23
+ },
22
24
  },
23
25
  '&[disabled]': {
24
26
  opacity: 0.5,
@@ -21,6 +21,7 @@ const Chevron = styled('button', {
21
21
  color: '$on_surface_low',
22
22
  cursor: 'not-allowed',
23
23
  },
24
+ backgroundColor: 'transparent',
24
25
  display: 'flex',
25
26
  });
26
27
 
@@ -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/index.tsx';
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
- return reactiveStore.current.hmsActions.leave();
130
+ reactiveStore?.current?.hmsActions.leave();
98
131
  },
99
132
  [],
100
133
  );
101
134
 
102
- const endpoints = {
103
- tokenByRoomCode: tokenByRoomCodeEndpoint,
104
- init: initEndpoint,
105
- tokenByRoomIdRole: tokenByRoomIdRoleEndpoint,
106
- roomLayout: roomLayoutEndpoint,
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.hmsActions}
138
- store={reactiveStore.current.hmsStore}
139
- notifications={reactiveStore.current.hmsNotifications}
140
- stats={reactiveStore.current.hmsStats}
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.themes?.[0] || {};
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
- <ToastContainer />
296
- <Notifications />
297
- <BackSwipe />
298
- <FlyingEmoji />
299
- <RemoteStopScreenshare />
300
- <KeyboardHandler />
301
- <BeamSpeakerLabelsLogging />
302
- <AuthToken authTokenByRoomCodeEndpoint={authTokenByRoomCodeEndpoint} />
303
- <Routes>
304
- <Route path="/*" element={<RouteList />} />
305
- <Route path="/streaming/*" element={<RouteList />} />
306
- </Routes>
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: 'tsj-obqh-lwx' },
10
- logo: { control: { type: 'object' }, defaultValue: undefined },
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> = ({ roomCode = '', logo, themes, typography, options }) => {
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: 'tsj-obqh-lwx',
35
+ roomCode: process.env.STORYBOOK_SAMPLE_ROOM_CODE,
22
36
  options: {
23
- endpoints: {
24
- roomLayout: 'https://demo8271564.mockable.io/v2/layouts/ui',
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
  };