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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. package/dist/{HLSView-CTAJQUU4.js → HLSView-PY2FKWX3.js} +191 -123
  2. package/dist/HLSView-PY2FKWX3.js.map +7 -0
  3. package/dist/Prebuilt/App.d.ts +3 -0
  4. package/dist/Prebuilt/AppContext.d.ts +13 -0
  5. package/dist/Prebuilt/common/PeersSorter.d.ts +21 -0
  6. package/dist/Prebuilt/components/Footer/Footer.d.ts +6 -0
  7. package/dist/Prebuilt/components/Header/Header.d.ts +2 -0
  8. package/dist/Prebuilt/components/InsetTile.d.ts +2 -0
  9. package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +7 -0
  10. package/dist/Prebuilt/components/Leave/EndSessionContent.d.ts +8 -0
  11. package/dist/Prebuilt/components/Leave/LeaveAtoms.d.ts +2196 -0
  12. package/dist/Prebuilt/components/Leave/LeaveCard.d.ts +12 -0
  13. package/dist/Prebuilt/components/Leave/LeaveRoom.d.ts +5 -0
  14. package/dist/Prebuilt/components/Leave/LeaveSessionContent.d.ts +6 -0
  15. package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +7 -0
  16. package/dist/Prebuilt/components/MoreSettings/MoreSettings.d.ts +6 -0
  17. package/dist/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.d.ts +6 -0
  18. package/dist/Prebuilt/components/Pagination.d.ts +6 -0
  19. package/dist/Prebuilt/components/Preview/PreviewForm.d.ts +10 -0
  20. package/dist/Prebuilt/components/SecondaryTiles.d.ts +3 -0
  21. package/dist/Prebuilt/components/VideoLayouts/EqualProminence.d.ts +3 -0
  22. package/dist/Prebuilt/components/VideoLayouts/Grid.d.ts +5 -0
  23. package/dist/Prebuilt/components/VideoLayouts/GridLayout.d.ts +10 -0
  24. package/dist/Prebuilt/components/VideoLayouts/ProminenceLayout.d.ts +12 -0
  25. package/dist/Prebuilt/components/VideoLayouts/RoleProminence.d.ts +3 -0
  26. package/dist/Prebuilt/components/VideoLayouts/ScreenshareLayout.d.ts +3 -0
  27. package/dist/Prebuilt/components/VideoLayouts/interface.d.ts +8 -0
  28. package/dist/Prebuilt/components/hooks/useRoleProminencePeers.d.ts +5 -0
  29. package/dist/Prebuilt/components/hooks/useTileLayout.d.ts +12 -0
  30. package/dist/Prebuilt/components/hooks/useVideoTileLayout.d.ts +11 -0
  31. package/dist/Prebuilt/layouts/SidePane.d.ts +6 -0
  32. package/dist/Prebuilt/layouts/VideoStreamingSection.d.ts +6 -0
  33. package/dist/Prebuilt/plugins/whiteboard/ToggleWhiteboard.d.ts +5 -0
  34. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.d.ts +1 -0
  35. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.d.ts +1 -0
  36. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +17 -0
  37. package/dist/Prebuilt/provider/roomLayoutProvider/index.d.ts +6 -1
  38. package/dist/{VirtualBackground-GGGBJYVY.js → VirtualBackground-AYDHYLIZ.js} +5 -11
  39. package/dist/VirtualBackground-AYDHYLIZ.js.map +7 -0
  40. package/dist/{chunk-TJNDX446.js → chunk-E2M2ZSOL.js} +8 -5
  41. package/dist/chunk-E2M2ZSOL.js.map +7 -0
  42. package/dist/chunk-GQD2AGWW.js +888 -0
  43. package/dist/chunk-GQD2AGWW.js.map +7 -0
  44. package/dist/{chunk-L2SX7GBO.js → chunk-RXTHJUMZ.js} +2462 -4738
  45. package/dist/chunk-RXTHJUMZ.js.map +7 -0
  46. package/dist/conference-V2XZGTKU.js +5927 -0
  47. package/dist/conference-V2XZGTKU.js.map +7 -0
  48. package/dist/index.cjs.js +9414 -15534
  49. package/dist/index.cjs.js.map +4 -4
  50. package/dist/index.js +2 -2
  51. package/dist/meta.cjs.json +2156 -3347
  52. package/dist/meta.esbuild.json +2601 -3885
  53. package/package.json +7 -7
  54. package/src/Button/Button.tsx +2 -2
  55. package/src/Prebuilt/App.tsx +49 -33
  56. package/src/Prebuilt/{AppContext.jsx → AppContext.tsx} +11 -3
  57. package/src/Prebuilt/IconButton.jsx +1 -0
  58. package/src/Prebuilt/Prebuilt.stories.tsx +1 -0
  59. package/src/Prebuilt/common/{PeersSorter.js → PeersSorter.ts} +15 -10
  60. package/src/Prebuilt/common/constants.js +3 -112
  61. package/src/Prebuilt/common/hooks.js +34 -1
  62. package/src/Prebuilt/common/utils.js +0 -8
  63. package/src/Prebuilt/components/AppData/AppData.jsx +3 -13
  64. package/src/Prebuilt/components/AppData/useUISettings.js +0 -4
  65. package/src/Prebuilt/components/AudioVideoToggle.jsx +6 -0
  66. package/src/Prebuilt/components/AuthToken.jsx +11 -42
  67. package/src/Prebuilt/components/Chat/Chat.jsx +57 -26
  68. package/src/Prebuilt/components/Chat/ChatBody.jsx +92 -32
  69. package/src/Prebuilt/components/Chat/ChatFooter.jsx +72 -48
  70. package/src/Prebuilt/components/Chat/ChatParticipantHeader.jsx +73 -0
  71. package/src/Prebuilt/components/Chat/ChatSelector.jsx +16 -17
  72. package/src/Prebuilt/components/Chat/ChatSelectorContainer.jsx +81 -0
  73. package/src/Prebuilt/components/Connection/TileConnection.jsx +30 -12
  74. package/src/Prebuilt/components/EmojiReaction.jsx +18 -17
  75. package/src/Prebuilt/components/Footer/ChatToggle.jsx +1 -7
  76. package/src/Prebuilt/components/Footer/Footer.tsx +89 -0
  77. package/src/Prebuilt/components/Footer/ParticipantList.jsx +213 -173
  78. package/src/Prebuilt/components/Footer/RoleAccordion.jsx +78 -0
  79. package/src/Prebuilt/components/HMSVideo/Controls.jsx +2 -2
  80. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +33 -10
  81. package/src/Prebuilt/components/HMSVideo/PlayButton.jsx +1 -1
  82. package/src/Prebuilt/components/HMSVideo/VideoTime.jsx +3 -3
  83. package/src/Prebuilt/components/HMSVideo/VolumeControl.jsx +38 -9
  84. package/src/Prebuilt/components/Header/{ConferencingHeader.jsx → Header.tsx} +9 -7
  85. package/src/Prebuilt/components/Header/HeaderComponents.jsx +13 -4
  86. package/src/Prebuilt/components/Header/StreamActions.jsx +33 -60
  87. package/src/Prebuilt/components/Header/index.tsx +1 -0
  88. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +17 -3
  89. package/src/Prebuilt/components/InsetTile.tsx +122 -0
  90. package/src/Prebuilt/components/{MoreSettings/SplitComponents/DesktopLeaveRoom.jsx → Leave/DesktopLeaveRoom.tsx} +50 -18
  91. package/src/Prebuilt/components/{EndSessionContent.jsx → Leave/EndSessionContent.tsx} +19 -9
  92. package/src/Prebuilt/components/Leave/LeaveAtoms.tsx +26 -0
  93. package/src/Prebuilt/components/{LeaveCard.jsx → Leave/LeaveCard.tsx} +22 -3
  94. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +63 -0
  95. package/src/Prebuilt/components/{LeaveSessionContent.jsx → Leave/LeaveSessionContent.tsx} +13 -5
  96. package/src/Prebuilt/components/{MoreSettings/SplitComponents/MwebLeaveRoom.jsx → Leave/MwebLeaveRoom.tsx} +38 -13
  97. package/src/Prebuilt/components/MetaActions.jsx +15 -23
  98. package/src/Prebuilt/components/MoreSettings/ActionTile.jsx +5 -0
  99. package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +12 -7
  100. package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +1 -1
  101. package/src/Prebuilt/components/MoreSettings/FullScreenItem.jsx +1 -4
  102. package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +27 -0
  103. package/src/Prebuilt/components/MoreSettings/SplitComponents/{DesktopOptions.jsx → DesktopOptions.tsx} +86 -75
  104. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.jsx +20 -19
  105. package/src/Prebuilt/components/Notifications/HLSFailureModal.jsx +3 -1
  106. package/src/Prebuilt/components/Notifications/Notifications.jsx +18 -11
  107. package/src/Prebuilt/components/Notifications/PeerNotifications.jsx +14 -2
  108. package/src/Prebuilt/components/Notifications/PermissionErrorModal.jsx +10 -4
  109. package/src/Prebuilt/components/PIP/PIPComponent.jsx +7 -16
  110. package/src/Prebuilt/components/PIP/PIPManager.js +1 -0
  111. package/src/Prebuilt/components/{Pagination.jsx → Pagination.tsx} +35 -6
  112. package/src/Prebuilt/components/Playlist/Playlist.jsx +1 -6
  113. package/src/Prebuilt/components/PostLeave.jsx +7 -7
  114. package/src/Prebuilt/components/Preview/PreviewContainer.jsx +5 -13
  115. package/src/Prebuilt/components/Preview/{PreviewForm.jsx → PreviewForm.tsx} +14 -4
  116. package/src/Prebuilt/components/Preview/PreviewJoin.jsx +9 -7
  117. package/src/Prebuilt/components/RaiseHand.jsx +0 -7
  118. package/src/Prebuilt/components/RoleChangeRequestModal.jsx +82 -6
  119. package/src/Prebuilt/components/ScreenshareDisplay.jsx +4 -10
  120. package/src/Prebuilt/components/ScreenshareTile.jsx +41 -33
  121. package/src/Prebuilt/components/SecondaryTiles.tsx +34 -0
  122. package/src/Prebuilt/components/Settings/LayoutSettings.jsx +2 -12
  123. package/src/Prebuilt/components/Settings/NotificationSettings.jsx +3 -9
  124. package/src/Prebuilt/components/Settings/SettingsModal.jsx +3 -9
  125. package/src/Prebuilt/components/StatsForNerds.jsx +3 -1
  126. package/src/Prebuilt/components/TileMenu/TileMenu.jsx +15 -16
  127. package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +21 -19
  128. package/src/Prebuilt/components/Toast/ToastConfig.jsx +53 -11
  129. package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +62 -0
  130. package/src/Prebuilt/components/VideoLayouts/Grid.tsx +41 -0
  131. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +92 -0
  132. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +60 -0
  133. package/src/Prebuilt/components/VideoLayouts/RoleProminence.tsx +56 -0
  134. package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +36 -0
  135. package/src/Prebuilt/components/VideoLayouts/interface.ts +9 -0
  136. package/src/Prebuilt/components/VideoTile.jsx +93 -43
  137. package/src/Prebuilt/components/conference.jsx +24 -20
  138. package/src/Prebuilt/components/hooks/useMetadata.jsx +7 -0
  139. package/src/Prebuilt/components/hooks/useRoleProminencePeers.tsx +38 -0
  140. package/src/Prebuilt/components/hooks/useTileLayout.tsx +121 -0
  141. package/src/Prebuilt/components/hooks/useVideoTileLayout.ts +22 -0
  142. package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +5 -72
  143. package/src/Prebuilt/components/pdfAnnotator/submitPdf.jsx +4 -45
  144. package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +2 -17
  145. package/src/Prebuilt/components/peerTileUtils.jsx +1 -1
  146. package/src/Prebuilt/images/empty-chat.svg +12 -0
  147. package/src/Prebuilt/layouts/EmbedView.jsx +17 -40
  148. package/src/Prebuilt/layouts/HLSView.jsx +83 -66
  149. package/src/Prebuilt/layouts/PDFView.jsx +1 -11
  150. package/src/Prebuilt/layouts/SidePane.tsx +96 -0
  151. package/src/Prebuilt/layouts/{mainView.jsx → VideoStreamingSection.tsx} +38 -47
  152. package/src/Prebuilt/layouts/WhiteboardView.jsx +10 -34
  153. package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +1 -4
  154. package/src/Prebuilt/plugins/whiteboard/{ToggleWhiteboard.jsx → ToggleWhiteboard.tsx} +5 -9
  155. package/src/Prebuilt/primitives/DialogContent.jsx +15 -11
  156. package/src/Prebuilt/provider/roomLayoutProvider/constants/index.ts +17 -2
  157. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.ts +36 -13
  158. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.ts +10 -0
  159. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +65 -0
  160. package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +17 -6
  161. package/dist/HLSView-CTAJQUU4.js.map +0 -7
  162. package/dist/PinnedTrackView-CQKONH4O.js +0 -102
  163. package/dist/PinnedTrackView-CQKONH4O.js.map +0 -7
  164. package/dist/VirtualBackground-GGGBJYVY.js.map +0 -7
  165. package/dist/chunk-I2FJWE74.js +0 -827
  166. package/dist/chunk-I2FJWE74.js.map +0 -7
  167. package/dist/chunk-L2SX7GBO.js.map +0 -7
  168. package/dist/chunk-NOKIGB6Y.js +0 -1100
  169. package/dist/chunk-NOKIGB6Y.js.map +0 -7
  170. package/dist/chunk-TJNDX446.js.map +0 -7
  171. package/dist/conference-OEO7VOJD.js +0 -8995
  172. package/dist/conference-OEO7VOJD.js.map +0 -7
  173. package/src/Prebuilt/components/Chat/ChatHeader.jsx +0 -67
  174. package/src/Prebuilt/components/EqualProminence.jsx +0 -180
  175. package/src/Prebuilt/components/FirstPersonDisplay.jsx +0 -50
  176. package/src/Prebuilt/components/Footer/Footer.jsx +0 -73
  177. package/src/Prebuilt/components/Header/Header.jsx +0 -8
  178. package/src/Prebuilt/components/Header/StreamingHeader.jsx +0 -54
  179. package/src/Prebuilt/components/LeaveRoom.jsx +0 -94
  180. package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +0 -10
  181. package/src/Prebuilt/components/Notifications/MessageNotifications.jsx +0 -25
  182. package/src/Prebuilt/components/gridView.jsx +0 -85
  183. package/src/Prebuilt/components/hooks/useFeatures.js +0 -22
  184. package/src/Prebuilt/components/hooks/useNavigation.js +0 -19
  185. package/src/Prebuilt/components/hooks/useSkipPreview.jsx +0 -20
  186. package/src/Prebuilt/components/pdfAnnotator/pdfErrorView.jsx +0 -29
  187. package/src/Prebuilt/images/Logo.svg +0 -8
  188. package/src/Prebuilt/layouts/ActiveSpeakerView.jsx +0 -34
  189. package/src/Prebuilt/layouts/InsetView.jsx +0 -260
  190. package/src/Prebuilt/layouts/PinnedTrackView.jsx +0 -59
  191. package/src/Prebuilt/layouts/SidePane.jsx +0 -52
  192. package/src/Prebuilt/layouts/mainGridView.jsx +0 -98
  193. package/src/Prebuilt/layouts/screenShareView.jsx +0 -183
  194. /package/{src/Prebuilt/components/Header/index.jsx → dist/Prebuilt/components/Header/index.d.ts} +0 -0
  195. /package/src/Prebuilt/components/{ScreenShare.jsx → ScreenShareToggle.jsx} +0 -0
  196. /package/src/{assets → Prebuilt/images}/android-perm-1.png +0 -0
  197. /package/src/{assets → Prebuilt/images}/ios-perm-0.png +0 -0
@@ -1,827 +0,0 @@
1
- import {
2
- Avatar,
3
- Button,
4
- Dialog,
5
- Input,
6
- Sheet,
7
- Slider,
8
- StyledMenuTile,
9
- StyledPagination,
10
- StyledVideoList,
11
- StyledVideoTile,
12
- TileConnection_default,
13
- ToastManager,
14
- UserPreferencesKeys,
15
- Video,
16
- VideoTileStats,
17
- useBorderAudioLevel,
18
- useDropdownList,
19
- useDropdownSelection,
20
- useIsHeadless,
21
- useSetAppDataByKey,
22
- useShowStreamingUI,
23
- useTheme,
24
- useUISettings,
25
- useUserPreferences
26
- } from "./chunk-L2SX7GBO.js";
27
- import {
28
- APP_DATA,
29
- Box,
30
- FEATURE_LIST,
31
- Flex,
32
- REMOTE_STOP_SCREENSHARE_TYPE,
33
- SESSION_STORE_KEY,
34
- Text,
35
- UI_SETTINGS,
36
- __async,
37
- __spreadProps,
38
- __spreadValues,
39
- config,
40
- init_define_process_env,
41
- useIsFeatureEnabled
42
- } from "./chunk-NOKIGB6Y.js";
43
-
44
- // src/Prebuilt/components/VideoTile.jsx
45
- init_define_process_env();
46
- import React5, { Fragment as Fragment2, useCallback, useMemo, useState as useState3 } from "react";
47
- import { useMedia as useMedia3 } from "react-use";
48
- import {
49
- selectAudioTrackByPeerID,
50
- selectIsPeerAudioEnabled,
51
- selectLocalPeerID as selectLocalPeerID2,
52
- selectPeerMetadata,
53
- selectPeerNameByID,
54
- selectVideoTrackByID,
55
- selectVideoTrackByPeerID as selectVideoTrackByPeerID2,
56
- useHMSStore as useHMSStore5
57
- } from "@100mslive/react-sdk";
58
- import { BrbTileIcon, HandIcon, MicOffIcon as MicOffIcon2 } from "@100mslive/react-icons";
59
-
60
- // src/Prebuilt/components/TileMenu/TileMenu.jsx
61
- init_define_process_env();
62
- import React4, { useState as useState2 } from "react";
63
- import { useMedia as useMedia2 } from "react-use";
64
- import {
65
- selectLocalPeerID,
66
- selectPeerByID,
67
- selectPermissions as selectPermissions2,
68
- selectTemplateAppData,
69
- selectTrackByID as selectTrackByID2,
70
- selectVideoTrackByPeerID,
71
- useHMSStore as useHMSStore3,
72
- useRemoteAVToggle as useRemoteAVToggle2
73
- } from "@100mslive/react-sdk";
74
- import { CrossIcon as CrossIcon2, VerticalMenuIcon } from "@100mslive/react-icons";
75
-
76
- // src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx
77
- init_define_process_env();
78
- import React2, { useState } from "react";
79
- import { useMedia } from "react-use";
80
- import { selectLocalPeerName, useHMSActions, useHMSStore } from "@100mslive/react-sdk";
81
-
82
- // src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx
83
- init_define_process_env();
84
- import React from "react";
85
- import { ChevronLeftIcon, CrossIcon } from "@100mslive/react-icons";
86
- var ChangeNameContent = ({
87
- changeName,
88
- setCurrentName,
89
- currentName,
90
- localPeerName,
91
- isMobile,
92
- onExit,
93
- onBackClick
94
- }) => {
95
- return /* @__PURE__ */ React.createElement(
96
- "form",
97
- {
98
- onSubmit: (e) => __async(void 0, null, function* () {
99
- e.preventDefault();
100
- yield changeName();
101
- })
102
- },
103
- /* @__PURE__ */ React.createElement(
104
- Text,
105
- {
106
- variant: isMobile ? "md" : "lg",
107
- css: {
108
- color: "$on_surface_high",
109
- fontWeight: "$semiBold",
110
- display: "flex",
111
- borderBottom: isMobile ? "1px solid $border_default" : "",
112
- pb: "$6",
113
- mb: "$8",
114
- px: isMobile ? "$8" : ""
115
- }
116
- },
117
- isMobile ? /* @__PURE__ */ React.createElement(ChevronLeftIcon, { onClick: onBackClick, style: { marginRight: "0.5rem" } }) : null,
118
- "Change Name",
119
- /* @__PURE__ */ React.createElement(Box, { css: { color: "inherit", ml: "auto" }, onClick: onExit }, /* @__PURE__ */ React.createElement(CrossIcon, null))
120
- ),
121
- /* @__PURE__ */ React.createElement(Flex, { justify: "center", align: "center", css: { my: "$8", w: "100%", px: isMobile ? "$8" : "" } }, /* @__PURE__ */ React.createElement(
122
- Input,
123
- {
124
- css: { width: "100%", bg: "$surface_default" },
125
- value: currentName,
126
- onChange: (e) => {
127
- setCurrentName(e.target.value);
128
- },
129
- autoComplete: "name",
130
- required: true,
131
- "data-testid": "change_name_field",
132
- onKeyDown: (e) => __async(void 0, null, function* () {
133
- if (e.key === "Enter" && currentName.trim().length > 0 && currentName !== localPeerName) {
134
- e.preventDefault();
135
- changeName();
136
- }
137
- })
138
- }
139
- )),
140
- /* @__PURE__ */ React.createElement(
141
- Flex,
142
- {
143
- justify: "between",
144
- align: "center",
145
- css: {
146
- width: "100%",
147
- gap: "$md",
148
- mt: "$10",
149
- px: isMobile ? "$4" : ""
150
- }
151
- },
152
- isMobile ? null : /* @__PURE__ */ React.createElement(
153
- Button,
154
- {
155
- variant: "standard",
156
- css: { w: "100%" },
157
- outlined: true,
158
- type: "submit",
159
- disabled: !localPeerName,
160
- onClick: onExit
161
- },
162
- "Cancel"
163
- ),
164
- /* @__PURE__ */ React.createElement(
165
- Button,
166
- {
167
- variant: "primary",
168
- css: { width: "100%" },
169
- type: "submit",
170
- disabled: !currentName.trim() || currentName.trim() === localPeerName,
171
- "data-testid": "popup_change_btn"
172
- },
173
- "Change"
174
- )
175
- )
176
- );
177
- };
178
-
179
- // src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx
180
- var ChangeNameModal = ({ onOpenChange, openParentSheet = null }) => {
181
- const [previewPreference, setPreviewPreference] = useUserPreferences(UserPreferencesKeys.PREVIEW);
182
- const hmsActions = useHMSActions();
183
- const localPeerName = useHMSStore(selectLocalPeerName);
184
- const [currentName, setCurrentName] = useState(localPeerName);
185
- const isMobile = useMedia(config.media.md);
186
- const changeName = () => __async(void 0, null, function* () {
187
- const name = currentName.trim();
188
- if (!name || name === localPeerName) {
189
- return;
190
- }
191
- try {
192
- yield hmsActions.changeName(name);
193
- setPreviewPreference(__spreadProps(__spreadValues({}, previewPreference || {}), {
194
- name
195
- }));
196
- } catch (error) {
197
- console.error("failed to update name", error);
198
- ToastManager.addToast({ title: error.message });
199
- } finally {
200
- onOpenChange(false);
201
- }
202
- });
203
- const props = {
204
- changeName,
205
- setCurrentName,
206
- currentName,
207
- localPeerName,
208
- isMobile,
209
- onExit: () => onOpenChange(false),
210
- onBackClick: () => {
211
- onOpenChange(false);
212
- openParentSheet();
213
- }
214
- };
215
- if (isMobile) {
216
- return /* @__PURE__ */ React2.createElement(Sheet.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React2.createElement(Sheet.Content, { css: { bg: "$surface_dim", py: "$8", px: 0 } }, /* @__PURE__ */ React2.createElement(ChangeNameContent, __spreadValues({}, props))));
217
- }
218
- return /* @__PURE__ */ React2.createElement(Dialog.Root, { defaultOpen: true, onOpenChange }, /* @__PURE__ */ React2.createElement(Dialog.Portal, null, /* @__PURE__ */ React2.createElement(Dialog.Overlay, null), /* @__PURE__ */ React2.createElement(Dialog.Content, { css: { bg: "$surface_dim", width: "min(400px,80%)", p: "$10" } }, /* @__PURE__ */ React2.createElement(ChangeNameContent, __spreadValues({}, props)))));
219
- };
220
-
221
- // src/Prebuilt/components/TileMenu/TileMenuContent.jsx
222
- init_define_process_env();
223
- import React3, { Fragment } from "react";
224
- import {
225
- selectPermissions,
226
- selectSessionStore,
227
- selectTrackByID,
228
- useCustomEvent,
229
- useHMSActions as useHMSActions2,
230
- useHMSStore as useHMSStore2,
231
- useRemoteAVToggle
232
- } from "@100mslive/react-sdk";
233
- import {
234
- MicOffIcon,
235
- MicOnIcon,
236
- PencilIcon,
237
- PinIcon,
238
- RemoveUserIcon,
239
- ShareScreenIcon,
240
- ShrinkIcon,
241
- SpeakerIcon,
242
- StarIcon,
243
- VideoOffIcon,
244
- VideoOnIcon
245
- } from "@100mslive/react-icons";
246
- var isSameTile = ({ trackId, videoTrackID, audioTrackID }) => trackId && (videoTrackID && videoTrackID === trackId || audioTrackID && audioTrackID === trackId);
247
- var spacingCSS = { "@md": { my: "$8", fontWeight: "$semiBold", fontSize: "sm" } };
248
- var SpotlightActions = ({
249
- peerId,
250
- onSpotLightClick = () => {
251
- return;
252
- }
253
- }) => {
254
- const hmsActions = useHMSActions2();
255
- const spotlightPeerId = useHMSStore2(selectSessionStore(SESSION_STORE_KEY.SPOTLIGHT));
256
- const isTileSpotlighted = spotlightPeerId === peerId;
257
- const setSpotlightPeerId = (peer) => hmsActions.sessionStore.set(SESSION_STORE_KEY.SPOTLIGHT, peer).catch((err) => ToastManager.addToast({ title: err.description }));
258
- return /* @__PURE__ */ React3.createElement(
259
- StyledMenuTile.ItemButton,
260
- {
261
- css: spacingCSS,
262
- onClick: () => {
263
- if (isTileSpotlighted) {
264
- setSpotlightPeerId();
265
- } else {
266
- setSpotlightPeerId(peerId);
267
- }
268
- onSpotLightClick();
269
- }
270
- },
271
- /* @__PURE__ */ React3.createElement(StarIcon, null),
272
- /* @__PURE__ */ React3.createElement("span", null, isTileSpotlighted ? "Remove from Spotlight" : "Spotlight Tile for everyone")
273
- );
274
- };
275
- var PinActions = ({ audioTrackID, videoTrackID }) => {
276
- const [pinnedTrackId, setPinnedTrackId] = useSetAppDataByKey(APP_DATA.pinnedTrackId);
277
- const isTilePinned = isSameTile({
278
- trackId: pinnedTrackId,
279
- videoTrackID,
280
- audioTrackID
281
- });
282
- return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
283
- StyledMenuTile.ItemButton,
284
- {
285
- css: spacingCSS,
286
- onClick: () => isTilePinned ? setPinnedTrackId() : setPinnedTrackId(videoTrackID || audioTrackID)
287
- },
288
- /* @__PURE__ */ React3.createElement(PinIcon, null),
289
- /* @__PURE__ */ React3.createElement("span", null, isTilePinned ? "Unpin" : "Pin", " Tile for myself")
290
- ));
291
- };
292
- var MinimiseInset = () => {
293
- const [minimised, setMinimised] = useSetAppDataByKey(APP_DATA.minimiseInset);
294
- return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(StyledMenuTile.ItemButton, { css: spacingCSS, onClick: () => setMinimised(!minimised) }, /* @__PURE__ */ React3.createElement(ShrinkIcon, null), /* @__PURE__ */ React3.createElement("span", null, minimised ? "Show" : "Minimise", " your video")));
295
- };
296
- var SimulcastLayers = ({ trackId }) => {
297
- var _a;
298
- const track = useHMSStore2(selectTrackByID(trackId));
299
- const actions = useHMSActions2();
300
- const bg = useDropdownSelection();
301
- if (!((_a = track == null ? void 0 : track.layerDefinitions) == null ? void 0 : _a.length) || track.degraded || !track.enabled) {
302
- return null;
303
- }
304
- const currentLayer = track.layerDefinitions.find((layer) => layer.layer === track.layer);
305
- return /* @__PURE__ */ React3.createElement(Fragment, null, /* @__PURE__ */ React3.createElement(StyledMenuTile.ItemButton, { css: { color: "$on_surface_medium", cursor: "default" } }, "Select maximum resolution"), track.layerDefinitions.map((layer) => {
306
- return /* @__PURE__ */ React3.createElement(
307
- StyledMenuTile.ItemButton,
308
- {
309
- key: layer.layer,
310
- onClick: () => __async(void 0, null, function* () {
311
- yield actions.setPreferredLayer(trackId, layer.layer);
312
- }),
313
- css: {
314
- justifyContent: "space-between",
315
- bg: track.preferredLayer === layer.layer ? bg : void 0,
316
- "&:hover": {
317
- bg: track.preferredLayer === layer.layer ? bg : void 0
318
- }
319
- }
320
- },
321
- /* @__PURE__ */ React3.createElement(
322
- Text,
323
- {
324
- as: "span",
325
- css: {
326
- textTransform: "capitalize",
327
- mr: "$2",
328
- fontWeight: track.preferredLayer === layer.layer ? "$semiBold" : "$regular"
329
- }
330
- },
331
- layer.layer
332
- ),
333
- /* @__PURE__ */ React3.createElement(Text, { as: "span", variant: "xs", css: { color: "$on_surface_medium" } }, layer.resolution.width, "x", layer.resolution.height)
334
- );
335
- }), /* @__PURE__ */ React3.createElement(StyledMenuTile.ItemButton, null, /* @__PURE__ */ React3.createElement(Text, { as: "span", variant: "xs", css: { color: "$on_surface_medium" } }, "Currently streaming:", /* @__PURE__ */ React3.createElement(
336
- Text,
337
- {
338
- as: "span",
339
- variant: "xs",
340
- css: {
341
- fontWeight: "$semiBold",
342
- textTransform: "capitalize",
343
- color: "$on_surface_medium",
344
- ml: "$2"
345
- }
346
- },
347
- currentLayer ? /* @__PURE__ */ React3.createElement(React3.Fragment, null, track.layer, " (", currentLayer.resolution.width, "x", currentLayer.resolution.height, ")") : "-"
348
- ))));
349
- };
350
- var TileMenuContent = (props) => {
351
- const actions = useHMSActions2();
352
- const { removeOthers } = useHMSStore2(selectPermissions);
353
- const {
354
- videoTrackID,
355
- audioTrackID,
356
- isLocal,
357
- isScreenshare,
358
- showSpotlight,
359
- showPinAction,
360
- peerID,
361
- canMinimise,
362
- closeSheetOnClick = () => {
363
- return;
364
- },
365
- openNameChangeModal = () => {
366
- return;
367
- }
368
- } = props;
369
- const { isAudioEnabled, isVideoEnabled, setVolume, toggleAudio, toggleVideo, volume } = useRemoteAVToggle(
370
- audioTrackID,
371
- videoTrackID
372
- );
373
- const { sendEvent } = useCustomEvent({
374
- type: REMOTE_STOP_SCREENSHARE_TYPE
375
- });
376
- const isChangeNameEnabled = useIsFeatureEnabled(FEATURE_LIST.CHANGE_NAME);
377
- return isLocal ? (showPinAction || canMinimise) && /* @__PURE__ */ React3.createElement(React3.Fragment, null, showPinAction && /* @__PURE__ */ React3.createElement(PinActions, { audioTrackID, videoTrackID }), showSpotlight && /* @__PURE__ */ React3.createElement(SpotlightActions, { peerId: peerID, onSpotLightClick: () => closeSheetOnClick() }), canMinimise && /* @__PURE__ */ React3.createElement(MinimiseInset, null), isChangeNameEnabled ? /* @__PURE__ */ React3.createElement(
378
- StyledMenuTile.ItemButton,
379
- {
380
- onClick: () => {
381
- openNameChangeModal();
382
- closeSheetOnClick();
383
- }
384
- },
385
- /* @__PURE__ */ React3.createElement(PencilIcon, null),
386
- /* @__PURE__ */ React3.createElement(Text, { variant: "sm", css: { fontWeight: "$semiBold" } }, "Change Name")
387
- ) : null) : /* @__PURE__ */ React3.createElement(React3.Fragment, null, toggleVideo ? /* @__PURE__ */ React3.createElement(
388
- StyledMenuTile.ItemButton,
389
- {
390
- css: spacingCSS,
391
- onClick: () => {
392
- toggleVideo();
393
- closeSheetOnClick();
394
- },
395
- "data-testid": isVideoEnabled ? "mute_video_participant_btn" : "unmute_video_participant_btn"
396
- },
397
- isVideoEnabled ? /* @__PURE__ */ React3.createElement(VideoOnIcon, null) : /* @__PURE__ */ React3.createElement(VideoOffIcon, null),
398
- /* @__PURE__ */ React3.createElement("span", null, isVideoEnabled ? "Mute" : "Request Unmute")
399
- ) : null, toggleAudio ? /* @__PURE__ */ React3.createElement(
400
- StyledMenuTile.ItemButton,
401
- {
402
- css: spacingCSS,
403
- onClick: () => {
404
- toggleAudio();
405
- closeSheetOnClick();
406
- },
407
- "data-testid": isVideoEnabled ? "mute_audio_participant_btn" : "unmute_audio_participant_btn"
408
- },
409
- isAudioEnabled ? /* @__PURE__ */ React3.createElement(MicOnIcon, null) : /* @__PURE__ */ React3.createElement(MicOffIcon, null),
410
- /* @__PURE__ */ React3.createElement("span", null, isAudioEnabled ? "Mute" : "Request Unmute")
411
- ) : null, audioTrackID ? /* @__PURE__ */ React3.createElement(StyledMenuTile.VolumeItem, { "data-testid": "participant_volume_slider", css: __spreadProps(__spreadValues({}, spacingCSS), { mb: "$0" }) }, /* @__PURE__ */ React3.createElement(Flex, { align: "center", gap: 1 }, /* @__PURE__ */ React3.createElement(SpeakerIcon, null), /* @__PURE__ */ React3.createElement(Box, { as: "span", css: { ml: "$4" } }, "Volume (", volume, ")")), /* @__PURE__ */ React3.createElement(Slider, { css: { my: "0.5rem" }, step: 5, value: [volume], onValueChange: (e) => setVolume(e[0]) })) : null, showPinAction && /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(PinActions, { audioTrackID, videoTrackID }), showSpotlight && /* @__PURE__ */ React3.createElement(SpotlightActions, { peerId: peerID, onSpotLightClick: () => closeSheetOnClick() })), /* @__PURE__ */ React3.createElement(SimulcastLayers, { trackId: videoTrackID }), removeOthers ? /* @__PURE__ */ React3.createElement(
412
- StyledMenuTile.RemoveItem,
413
- {
414
- css: __spreadProps(__spreadValues({}, spacingCSS), { borderTop: "none" }),
415
- onClick: () => __async(void 0, null, function* () {
416
- try {
417
- yield actions.removePeer(peerID, "");
418
- } catch (error) {
419
- }
420
- closeSheetOnClick();
421
- }),
422
- "data-testid": "remove_participant_btn"
423
- },
424
- /* @__PURE__ */ React3.createElement(RemoveUserIcon, null),
425
- /* @__PURE__ */ React3.createElement("span", null, "Remove Participant")
426
- ) : null, removeOthers && isScreenshare ? /* @__PURE__ */ React3.createElement(
427
- StyledMenuTile.RemoveItem,
428
- {
429
- onClick: () => {
430
- sendEvent({});
431
- closeSheetOnClick();
432
- },
433
- css: spacingCSS
434
- },
435
- /* @__PURE__ */ React3.createElement(ShareScreenIcon, null),
436
- /* @__PURE__ */ React3.createElement("span", null, "Stop Screenshare")
437
- ) : null);
438
- };
439
-
440
- // src/Prebuilt/components/TileMenu/TileMenu.jsx
441
- var TileMenu = ({ audioTrackID, videoTrackID, peerID, isScreenshare = false, canMinimise }) => {
442
- var _a, _b;
443
- const [open, setOpen] = useState2(false);
444
- const { theme } = useTheme();
445
- const localPeerID = useHMSStore3(selectLocalPeerID);
446
- const isLocal = localPeerID === peerID;
447
- const { removeOthers, changeRole } = useHMSStore3(selectPermissions2);
448
- const { setVolume, toggleAudio, toggleVideo } = useRemoteAVToggle2(audioTrackID, videoTrackID);
449
- const showSpotlight = changeRole;
450
- const isPrimaryVideoTrack = ((_a = useHMSStore3(selectVideoTrackByPeerID(peerID))) == null ? void 0 : _a.id) === videoTrackID;
451
- const uiMode = useHMSStore3(selectTemplateAppData).uiMode;
452
- const isInset = uiMode === "inset";
453
- const isPinEnabled = useIsFeatureEnabled(FEATURE_LIST.PIN_TILE);
454
- const showPinAction = isPinEnabled && (audioTrackID || videoTrackID && isPrimaryVideoTrack) && !isInset;
455
- const track = useHMSStore3(selectTrackByID2(videoTrackID));
456
- const hideSimulcastLayers = !((_b = track == null ? void 0 : track.layerDefinitions) == null ? void 0 : _b.length) || track.degraded || !track.enabled;
457
- const isMobile = useMedia2(config.media.md);
458
- const peer = useHMSStore3(selectPeerByID(peerID));
459
- const [showNameChangeModal, setShowNameChangeModal] = useState2(false);
460
- useDropdownList({ open, name: "TileMenu" });
461
- if (!(removeOthers || toggleAudio || toggleVideo || setVolume || showPinAction) && hideSimulcastLayers) {
462
- return null;
463
- }
464
- if (isInset && isLocal) {
465
- return null;
466
- }
467
- const openNameChangeModal = () => setShowNameChangeModal(true);
468
- const props = {
469
- isLocal,
470
- isScreenshare,
471
- audioTrackID,
472
- videoTrackID,
473
- peerID,
474
- isPrimaryVideoTrack,
475
- showSpotlight,
476
- showPinAction,
477
- canMinimise,
478
- openNameChangeModal
479
- };
480
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(StyledMenuTile.Root, { open, onOpenChange: setOpen }, /* @__PURE__ */ React4.createElement(
481
- StyledMenuTile.Trigger,
482
- {
483
- "data-testid": "participant_menu_btn",
484
- css: { bg: `${theme.colors.background_dim.value}A3` },
485
- onClick: (e) => e.stopPropagation(),
486
- className: isMobile ? "__cancel-drag-event" : ""
487
- },
488
- /* @__PURE__ */ React4.createElement(VerticalMenuIcon, { width: 20, height: 20 })
489
- ), isMobile ? /* @__PURE__ */ React4.createElement(Sheet.Root, { open, onOpenChange: setOpen }, /* @__PURE__ */ React4.createElement(Sheet.Content, { css: { bg: "$surface_dim", pt: "$8" } }, /* @__PURE__ */ React4.createElement(
490
- Flex,
491
- {
492
- css: {
493
- color: "$on_surface_high",
494
- display: "flex",
495
- w: "100%",
496
- justifyContent: "space-between",
497
- alignItems: "center",
498
- px: "$10",
499
- pb: "$8",
500
- borderBottom: "1px solid $border_default"
501
- }
502
- },
503
- /* @__PURE__ */ React4.createElement(Box, null, /* @__PURE__ */ React4.createElement(Text, { css: { color: "$on_surface_high", fontWeight: "$semiBold" } }, peer.name, isLocal ? ` (You)` : null), (peer == null ? void 0 : peer.roleName) ? /* @__PURE__ */ React4.createElement(Text, { variant: "xs", css: { color: "$on_surface_low", mt: "$2" } }, peer.roleName) : null),
504
- /* @__PURE__ */ React4.createElement(Sheet.Close, { css: { color: "inherit" } }, /* @__PURE__ */ React4.createElement(CrossIcon2, null))
505
- ), /* @__PURE__ */ React4.createElement(Box, { css: { px: "$8", pb: "$10" } }, /* @__PURE__ */ React4.createElement(TileMenuContent, __spreadProps(__spreadValues({}, props), { closeSheetOnClick: () => setOpen(false) }))))) : /* @__PURE__ */ React4.createElement(StyledMenuTile.Content, { side: "top", align: "end" }, /* @__PURE__ */ React4.createElement(TileMenuContent, __spreadValues({}, props)))), showNameChangeModal && /* @__PURE__ */ React4.createElement(ChangeNameModal, { onOpenChange: setShowNameChangeModal }));
506
- };
507
- var TileMenu_default = TileMenu;
508
-
509
- // src/Prebuilt/components/peerTileUtils.jsx
510
- init_define_process_env();
511
- var PEER_NAME_PLACEHOLDER = "peerName";
512
- var labelMap = /* @__PURE__ */ new Map([
513
- [[true, "screen"].toString(), "Your Screen"],
514
- [[true, "regular"].toString(), `You (${PEER_NAME_PLACEHOLDER})`],
515
- [[false, "screen"].toString(), `${PEER_NAME_PLACEHOLDER}'s Screen`],
516
- [[false, "regular"].toString(), PEER_NAME_PLACEHOLDER],
517
- [[true, void 0].toString(), `You (${PEER_NAME_PLACEHOLDER})`],
518
- [[false, void 0].toString(), `${PEER_NAME_PLACEHOLDER}`]
519
- ]);
520
- var getVideoTileLabel = ({ peerName, isLocal, track }) => {
521
- const isPeerPresent = peerName !== void 0;
522
- if (!isPeerPresent || !track) {
523
- return isPeerPresent ? labelMap.get([isLocal, void 0].toString()).replace(PEER_NAME_PLACEHOLDER, peerName) : "";
524
- }
525
- const isLocallyMuted = track.volume === 0;
526
- let label = labelMap.get([isLocal, track.source].toString());
527
- if (label) {
528
- label = label.replace(PEER_NAME_PLACEHOLDER, peerName);
529
- } else {
530
- label = `${peerName} ${track.source}`;
531
- }
532
- label = `${label}${track.degraded ? "(Degraded)" : ""}`;
533
- return `${label}${isLocallyMuted ? " (Muted for you)" : ""}`;
534
- };
535
-
536
- // src/Prebuilt/components/AppData/useAppConfig.js
537
- init_define_process_env();
538
- import { selectAppDataByPath, useHMSStore as useHMSStore4 } from "@100mslive/react-sdk";
539
- var useAppConfig = (...path) => {
540
- const appConfig = useHMSStore4(selectAppDataByPath(APP_DATA.appConfig, ...path));
541
- return appConfig;
542
- };
543
-
544
- // src/Prebuilt/components/VideoTile.jsx
545
- var Tile = ({
546
- peerId,
547
- trackId,
548
- width,
549
- height,
550
- objectFit = "cover",
551
- canMinimise = false,
552
- isDragabble = false,
553
- rootCSS = {},
554
- containerCSS = {}
555
- }) => {
556
- const trackSelector = trackId ? selectVideoTrackByID(trackId) : selectVideoTrackByPeerID2(peerId);
557
- const track = useHMSStore5(trackSelector);
558
- const peerName = useHMSStore5(selectPeerNameByID(peerId));
559
- const audioTrack = useHMSStore5(selectAudioTrackByPeerID(peerId));
560
- const localPeerID = useHMSStore5(selectLocalPeerID2);
561
- const isAudioOnly = useUISettings(UI_SETTINGS.isAudioOnly);
562
- const mirrorLocalVideo = useUISettings(UI_SETTINGS.mirrorLocalVideo);
563
- const showStatsOnTiles = useUISettings(UI_SETTINGS.showStatsOnTiles);
564
- const isHeadless = useIsHeadless();
565
- const isAudioMuted = !useHMSStore5(selectIsPeerAudioEnabled(peerId));
566
- const isVideoMuted = !(track == null ? void 0 : track.enabled);
567
- const [isMouseHovered, setIsMouseHovered] = useState3(false);
568
- const borderAudioRef = useBorderAudioLevel(audioTrack == null ? void 0 : audioTrack.id);
569
- const isVideoDegraded = track == null ? void 0 : track.degraded;
570
- const isLocal = localPeerID === peerId;
571
- const isMobile = useMedia3(config.media.md);
572
- const showStreamingUI = useShowStreamingUI();
573
- const label = getVideoTileLabel({
574
- peerName,
575
- track,
576
- isLocal
577
- });
578
- const onHoverHandler = useCallback((event) => {
579
- setIsMouseHovered(event.type === "mouseenter");
580
- }, []);
581
- const headlessConfig = useAppConfig("headlessConfig");
582
- const hideLabel = isHeadless && (headlessConfig == null ? void 0 : headlessConfig.hideTileName);
583
- const isTileBigEnoughToShowStats = height >= 180 && width >= 180;
584
- const avatarSize = useMemo(() => {
585
- if (!width || !height) {
586
- return void 0;
587
- }
588
- if (width <= 150 || height <= 150) {
589
- return "small";
590
- } else if (width <= 300 || height <= 300) {
591
- return "medium";
592
- }
593
- return "large";
594
- }, [width, height]);
595
- return /* @__PURE__ */ React5.createElement(
596
- StyledVideoTile.Root,
597
- {
598
- css: __spreadValues({
599
- width,
600
- height,
601
- padding: getPadding({
602
- isHeadless,
603
- tileOffset: headlessConfig == null ? void 0 : headlessConfig.tileOffset,
604
- hideAudioLevel: headlessConfig == null ? void 0 : headlessConfig.hideAudioLevel
605
- })
606
- }, rootCSS),
607
- "data-testid": `participant_tile_${peerName}`
608
- },
609
- peerName !== void 0 ? /* @__PURE__ */ React5.createElement(
610
- StyledVideoTile.Container,
611
- {
612
- onMouseEnter: onHoverHandler,
613
- onMouseLeave: onHoverHandler,
614
- ref: isHeadless && (headlessConfig == null ? void 0 : headlessConfig.hideAudioLevel) ? void 0 : borderAudioRef,
615
- noRadius: isHeadless && Number(headlessConfig == null ? void 0 : headlessConfig.tileOffset) === 0,
616
- css: containerCSS
617
- },
618
- showStatsOnTiles && isTileBigEnoughToShowStats ? /* @__PURE__ */ React5.createElement(VideoTileStats, { audioTrackID: audioTrack == null ? void 0 : audioTrack.id, videoTrackID: track == null ? void 0 : track.id, peerID: peerId, isLocal }) : null,
619
- track ? /* @__PURE__ */ React5.createElement(
620
- Video,
621
- {
622
- trackId: track == null ? void 0 : track.id,
623
- attach: isLocal ? void 0 : !isAudioOnly,
624
- mirror: mirrorLocalVideo && peerId === localPeerID && (track == null ? void 0 : track.source) === "regular" && (track == null ? void 0 : track.facingMode) !== "environment",
625
- degraded: isVideoDegraded,
626
- noRadius: isHeadless && Number(headlessConfig == null ? void 0 : headlessConfig.tileOffset) === 0,
627
- "data-testid": "participant_video_tile",
628
- css: {
629
- objectFit
630
- }
631
- }
632
- ) : null,
633
- isVideoMuted || isVideoDegraded || !isLocal && isAudioOnly ? /* @__PURE__ */ React5.createElement(StyledVideoTile.AvatarContainer, null, /* @__PURE__ */ React5.createElement(Avatar, { name: peerName || "", "data-testid": "participant_avatar_icon", size: avatarSize })) : null,
634
- showAudioMuted({
635
- hideTileAudioMute: headlessConfig == null ? void 0 : headlessConfig.hideTileAudioMute,
636
- isHeadless,
637
- isAudioMuted
638
- }) ? /* @__PURE__ */ React5.createElement(
639
- StyledVideoTile.AudioIndicator,
640
- {
641
- "data-testid": "participant_audio_mute_icon",
642
- size: width && height && (width < 180 || height < 180) ? "small" : "medium"
643
- },
644
- /* @__PURE__ */ React5.createElement(MicOffIcon2, null)
645
- ) : null,
646
- (isMouseHovered || isDragabble) && !isHeadless ? /* @__PURE__ */ React5.createElement(
647
- TileMenu_default,
648
- {
649
- peerID: peerId,
650
- audioTrackID: audioTrack == null ? void 0 : audioTrack.id,
651
- videoTrackID: track == null ? void 0 : track.id,
652
- canMinimise
653
- }
654
- ) : null,
655
- /* @__PURE__ */ React5.createElement(PeerMetadata, { peerId }),
656
- showStreamingUI && isMobile ? null : /* @__PURE__ */ React5.createElement(TileConnection_default, { hideLabel, name: label, isTile: true, peerId, width })
657
- ) : null
658
- );
659
- };
660
- var metaStyles = { top: "$4", left: "$4" };
661
- var PeerMetadata = ({ peerId }) => {
662
- const metaData = useHMSStore5(selectPeerMetadata(peerId));
663
- const isHandRaised = (metaData == null ? void 0 : metaData.isHandRaised) || false;
664
- const isBRB = (metaData == null ? void 0 : metaData.isBRBOn) || false;
665
- return /* @__PURE__ */ React5.createElement(Fragment2, null, isHandRaised ? /* @__PURE__ */ React5.createElement(StyledVideoTile.AttributeBox, { css: metaStyles, "data-testid": "raiseHand_icon_onTile" }, /* @__PURE__ */ React5.createElement(HandIcon, { width: 24, height: 24 })) : null, isBRB ? /* @__PURE__ */ React5.createElement(StyledVideoTile.AttributeBox, { css: metaStyles, "data-testid": "brb_icon_onTile" }, /* @__PURE__ */ React5.createElement(BrbTileIcon, { width: 24, height: 24 })) : null);
666
- };
667
- var VideoTile = React5.memo(Tile);
668
- var showAudioMuted = ({ hideTileAudioMute, isHeadless, isAudioMuted }) => {
669
- if (!isHeadless) {
670
- return isAudioMuted;
671
- }
672
- return isAudioMuted && !hideTileAudioMute;
673
- };
674
- var getPadding = ({ isHeadless, tileOffset, hideAudioLevel }) => {
675
- if (!isHeadless || isNaN(Number(tileOffset))) {
676
- return void 0;
677
- }
678
- return Number(tileOffset) === 0 ? hideAudioLevel ? 0 : 3 : void 0;
679
- };
680
- var VideoTile_default = VideoTile;
681
-
682
- // src/Prebuilt/components/VideoList.jsx
683
- init_define_process_env();
684
- import React8, { Fragment as Fragment3, useEffect, useState as useState5 } from "react";
685
- import { useVideoList } from "@100mslive/react-sdk";
686
-
687
- // src/Prebuilt/components/Pagination.jsx
688
- init_define_process_env();
689
- import React6 from "react";
690
- import { ChevronLeftIcon as ChevronLeftIcon2, ChevronRightIcon } from "@100mslive/react-icons";
691
- var Pagination = ({ page, onPageChange, numPages }) => {
692
- const disableLeft = page === 0;
693
- const disableRight = page === numPages - 1;
694
- const nextPage = () => {
695
- onPageChange(Math.min(page + 1, numPages - 1));
696
- };
697
- const prevPage = () => {
698
- onPageChange(Math.max(page - 1, 0));
699
- };
700
- return /* @__PURE__ */ React6.createElement(StyledPagination.Root, null, /* @__PURE__ */ React6.createElement(StyledPagination.Chevron, { disabled: disableLeft, onClick: prevPage }, /* @__PURE__ */ React6.createElement(ChevronLeftIcon2, { width: 16, height: 16, style: { cursor: disableLeft ? "not-allowed" : "pointer" } })), /* @__PURE__ */ React6.createElement(StyledPagination.Dots, null, [...Array(numPages)].map((_, i) => /* @__PURE__ */ React6.createElement(StyledPagination.Dot, { key: i, active: page === i, onClick: () => onPageChange(i) }))), /* @__PURE__ */ React6.createElement(StyledPagination.Chevron, { disabled: disableRight, onClick: nextPage }, /* @__PURE__ */ React6.createElement(ChevronRightIcon, { width: 16, height: 16, style: { cursor: disableRight ? "not-allowed" : "pointer" } })));
701
- };
702
-
703
- // src/Prebuilt/components/ScreenshareTile.jsx
704
- init_define_process_env();
705
- import React7, { useRef, useState as useState4 } from "react";
706
- import { useFullscreen } from "react-use";
707
- import screenfull from "screenfull";
708
- import {
709
- selectLocalPeerID as selectLocalPeerID3,
710
- selectPeerByID as selectPeerByID2,
711
- selectScreenShareAudioByPeerID,
712
- selectScreenShareByPeerID,
713
- useHMSStore as useHMSStore6
714
- } from "@100mslive/react-sdk";
715
- import { ExpandIcon, ShrinkIcon as ShrinkIcon2 } from "@100mslive/react-icons";
716
- var labelStyles = {
717
- position: "unset",
718
- width: "100%",
719
- textAlign: "center",
720
- transform: "none",
721
- mt: "$2",
722
- flexShrink: 0
723
- };
724
- var Tile2 = ({ peerId, width = "100%", height = "100%" }) => {
725
- const isLocal = useHMSStore6(selectLocalPeerID3) === peerId;
726
- const track = useHMSStore6(selectScreenShareByPeerID(peerId));
727
- const peer = useHMSStore6(selectPeerByID2(peerId));
728
- const isAudioOnly = useUISettings(UI_SETTINGS.isAudioOnly);
729
- const isHeadless = useIsHeadless();
730
- const [isMouseHovered, setIsMouseHovered] = useState4(false);
731
- const showStatsOnTiles = useUISettings(UI_SETTINGS.showStatsOnTiles);
732
- const label = getVideoTileLabel({
733
- peerName: peer.name,
734
- isLocal: false,
735
- track
736
- });
737
- const fullscreenRef = useRef(null);
738
- const [fullscreen, setFullscreen] = useState4(false);
739
- const isFullscreen = useFullscreen(fullscreenRef, fullscreen, {
740
- onClose: () => setFullscreen(false)
741
- });
742
- const isFullScreenSupported = screenfull.isEnabled;
743
- const audioTrack = useHMSStore6(selectScreenShareAudioByPeerID(peer == null ? void 0 : peer.id));
744
- return /* @__PURE__ */ React7.createElement(StyledVideoTile.Root, { css: { width, height, p: 0 }, "data-testid": "screenshare_tile" }, peer ? /* @__PURE__ */ React7.createElement(
745
- StyledVideoTile.Container,
746
- {
747
- transparentBg: true,
748
- ref: fullscreenRef,
749
- css: { flexDirection: "column" },
750
- onMouseEnter: () => setIsMouseHovered(true),
751
- onMouseLeave: () => {
752
- setIsMouseHovered(false);
753
- }
754
- },
755
- showStatsOnTiles ? /* @__PURE__ */ React7.createElement(VideoTileStats, { audioTrackID: audioTrack == null ? void 0 : audioTrack.id, videoTrackID: track == null ? void 0 : track.id, peerID: peerId, isLocal }) : null,
756
- isFullScreenSupported && !isHeadless ? /* @__PURE__ */ React7.createElement(StyledVideoTile.FullScreenButton, { onClick: () => setFullscreen(!fullscreen) }, isFullscreen ? /* @__PURE__ */ React7.createElement(ShrinkIcon2, null) : /* @__PURE__ */ React7.createElement(ExpandIcon, null)) : null,
757
- track ? /* @__PURE__ */ React7.createElement(
758
- Video,
759
- {
760
- screenShare: true,
761
- mirror: peer.isLocal && (track == null ? void 0 : track.source) === "regular",
762
- attach: !isAudioOnly,
763
- trackId: track.id
764
- }
765
- ) : null,
766
- /* @__PURE__ */ React7.createElement(StyledVideoTile.Info, { css: labelStyles }, label),
767
- isMouseHovered && !isHeadless && !(peer == null ? void 0 : peer.isLocal) ? /* @__PURE__ */ React7.createElement(TileMenu_default, { isScreenshare: true, peerID: peer == null ? void 0 : peer.id, audioTrackID: audioTrack == null ? void 0 : audioTrack.id, videoTrackID: track == null ? void 0 : track.id }) : null
768
- ) : null);
769
- };
770
- var ScreenshareTile = React7.memo(Tile2);
771
- var ScreenshareTile_default = ScreenshareTile;
772
-
773
- // src/Prebuilt/components/VideoList.jsx
774
- var List = ({ maxTileCount, peers, maxColCount, maxRowCount, includeScreenShareForPeer }) => {
775
- var _a;
776
- const { aspectRatio } = useTheme();
777
- const tileOffset = useAppConfig("headlessConfig", "tileOffset");
778
- const isHeadless = useIsHeadless();
779
- const { ref, pagesWithTiles } = useVideoList({
780
- peers,
781
- maxTileCount,
782
- maxColCount,
783
- maxRowCount,
784
- includeScreenShareForPeer,
785
- aspectRatio,
786
- offsetY: getOffset({ isHeadless, tileOffset })
787
- });
788
- const [page, setPage] = useState5(0);
789
- useEffect(() => {
790
- if (page >= pagesWithTiles.length) {
791
- setPage(0);
792
- }
793
- }, [pagesWithTiles.length, page]);
794
- return /* @__PURE__ */ React8.createElement(StyledVideoList.Root, { ref }, /* @__PURE__ */ React8.createElement(StyledVideoList.Container, { css: { flexWrap: "wrap", placeContent: "center" } }, pagesWithTiles && pagesWithTiles.length > 0 ? (_a = pagesWithTiles[page]) == null ? void 0 : _a.map((tile) => {
795
- var _a2, _b, _c, _d;
796
- if (tile.width === 0 || tile.height === 0) {
797
- return null;
798
- }
799
- return /* @__PURE__ */ React8.createElement(Fragment3, { key: ((_a2 = tile.track) == null ? void 0 : _a2.id) || tile.peer.id }, ((_b = tile.track) == null ? void 0 : _b.source) === "screen" ? /* @__PURE__ */ React8.createElement(ScreenshareTile_default, { width: tile.width, height: tile.height, peerId: tile.peer.id }) : /* @__PURE__ */ React8.createElement(
800
- VideoTile_default,
801
- {
802
- width: tile.width,
803
- height: tile.height,
804
- peerId: (_c = tile.peer) == null ? void 0 : _c.id,
805
- trackId: (_d = tile.track) == null ? void 0 : _d.id
806
- }
807
- ));
808
- }) : null), !isHeadless && pagesWithTiles.length > 1 ? /* @__PURE__ */ React8.createElement(Pagination, { page, onPageChange: setPage, numPages: pagesWithTiles.length }) : null);
809
- };
810
- var VideoList = React8.memo(List);
811
- var getOffset = ({ tileOffset, isHeadless }) => {
812
- if (!isHeadless || isNaN(Number(tileOffset))) {
813
- return 32;
814
- }
815
- return Number(tileOffset);
816
- };
817
- var VideoList_default = VideoList;
818
-
819
- export {
820
- ChangeNameModal,
821
- useAppConfig,
822
- VideoTile_default,
823
- Pagination,
824
- ScreenshareTile_default,
825
- VideoList_default
826
- };
827
- //# sourceMappingURL=chunk-I2FJWE74.js.map