@100mslive/roomkit-react 0.3.24-alpha.0 → 0.3.24-alpha.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. package/dist/Theme/ThemeProvider.d.ts +1 -0
  2. package/dist/index.cjs.css +2 -2
  3. package/dist/index.cjs.css.map +1 -1
  4. package/dist/index.cjs.js +34109 -37488
  5. package/dist/index.cjs.js.map +4 -4
  6. package/dist/index.css +2 -2
  7. package/dist/index.css.map +1 -1
  8. package/dist/index.js +36389 -73
  9. package/dist/index.js.map +4 -4
  10. package/dist/meta.cjs.json +5568 -5617
  11. package/dist/meta.esbuild.json +6032 -8744
  12. package/package.json +7 -7
  13. package/src/Prebuilt/App.tsx +3 -6
  14. package/src/Prebuilt/components/Chat/Chat.tsx +8 -12
  15. package/src/Prebuilt/components/Footer/WhiteboardToggle.tsx +11 -4
  16. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +3 -3
  17. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +3 -0
  18. package/src/Prebuilt/components/Preview/PreviewJoin.tsx +3 -2
  19. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +30 -43
  20. package/src/Prebuilt/layouts/HLSView.jsx +2 -3
  21. package/src/Prebuilt/layouts/SidePane.tsx +6 -12
  22. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +64 -69
  23. package/src/Theme/ThemeProvider.tsx +9 -3
  24. package/dist/ConferenceScreen-CLPW3BGP.css +0 -2780
  25. package/dist/ConferenceScreen-CLPW3BGP.css.map +0 -7
  26. package/dist/ConferenceScreen-M6RBPTAJ.js +0 -1774
  27. package/dist/ConferenceScreen-M6RBPTAJ.js.map +0 -7
  28. package/dist/EmbedView-DDSO7ZCV.js +0 -17
  29. package/dist/EmbedView-DDSO7ZCV.js.map +0 -7
  30. package/dist/EmbedView-HGIUZHKA.css +0 -2780
  31. package/dist/EmbedView-HGIUZHKA.css.map +0 -7
  32. package/dist/EmojiReaction-23JDKJD4.js +0 -11
  33. package/dist/EmojiReaction-23JDKJD4.js.map +0 -7
  34. package/dist/HLSView-OW77EAAO.css +0 -2780
  35. package/dist/HLSView-OW77EAAO.css.map +0 -7
  36. package/dist/HLSView-Q6GEB3UM.js +0 -1666
  37. package/dist/HLSView-Q6GEB3UM.js.map +0 -7
  38. package/dist/LeaveScreen-BYTE73MT.js +0 -556
  39. package/dist/LeaveScreen-BYTE73MT.js.map +0 -7
  40. package/dist/LeaveScreen-P7AATEIF.css +0 -2780
  41. package/dist/LeaveScreen-P7AATEIF.css.map +0 -7
  42. package/dist/MoreSettings-LV5X2U6K.css +0 -2780
  43. package/dist/MoreSettings-LV5X2U6K.css.map +0 -7
  44. package/dist/MoreSettings-WSHMMNOC.js +0 -16
  45. package/dist/MoreSettings-WSHMMNOC.js.map +0 -7
  46. package/dist/PDFView-RIPRIIH6.css +0 -2780
  47. package/dist/PDFView-RIPRIIH6.css.map +0 -7
  48. package/dist/PDFView-ZFSG2ESE.js +0 -84
  49. package/dist/PDFView-ZFSG2ESE.js.map +0 -7
  50. package/dist/Polls-QWW5LTTB.js +0 -1584
  51. package/dist/Polls-QWW5LTTB.js.map +0 -7
  52. package/dist/Polls-ULYGUPPF.css +0 -2780
  53. package/dist/Polls-ULYGUPPF.css.map +0 -7
  54. package/dist/RaiseHand-K7NFLH7H.js +0 -10
  55. package/dist/RaiseHand-K7NFLH7H.js.map +0 -7
  56. package/dist/RoleProminence-235AFT7F.js +0 -116
  57. package/dist/RoleProminence-235AFT7F.js.map +0 -7
  58. package/dist/RoleProminence-6XN3POS5.css +0 -2780
  59. package/dist/RoleProminence-6XN3POS5.css.map +0 -7
  60. package/dist/RoomDetailsPane-O5TFMTPI.css +0 -2780
  61. package/dist/RoomDetailsPane-O5TFMTPI.css.map +0 -7
  62. package/dist/RoomDetailsPane-RF3D3TDR.js +0 -53
  63. package/dist/RoomDetailsPane-RF3D3TDR.js.map +0 -7
  64. package/dist/ScreenshareLayout-KNEB3AJJ.css +0 -2780
  65. package/dist/ScreenshareLayout-KNEB3AJJ.css.map +0 -7
  66. package/dist/ScreenshareLayout-PSQMS3NC.js +0 -358
  67. package/dist/ScreenshareLayout-PSQMS3NC.js.map +0 -7
  68. package/dist/SidePaneTabs-I6DECE5R.css +0 -2780
  69. package/dist/SidePaneTabs-I6DECE5R.css.map +0 -7
  70. package/dist/SidePaneTabs-NXHBI2JB.js +0 -1354
  71. package/dist/SidePaneTabs-NXHBI2JB.js.map +0 -7
  72. package/dist/VBPicker-2CQ3IIO7.js +0 -322
  73. package/dist/VBPicker-2CQ3IIO7.js.map +0 -7
  74. package/dist/VBPicker-DCNYGO23.css +0 -2780
  75. package/dist/VBPicker-DCNYGO23.css.map +0 -7
  76. package/dist/WaitingView-NZIUOXBI.js +0 -10
  77. package/dist/WaitingView-NZIUOXBI.js.map +0 -7
  78. package/dist/WhiteboardLayout-4YLFM3EY.js +0 -96
  79. package/dist/WhiteboardLayout-4YLFM3EY.js.map +0 -7
  80. package/dist/WhiteboardLayout-JUOBDFKY.css +0 -2780
  81. package/dist/WhiteboardLayout-JUOBDFKY.css.map +0 -7
  82. package/dist/chunk-3C7IESSI.js +0 -254
  83. package/dist/chunk-3C7IESSI.js.map +0 -7
  84. package/dist/chunk-7FD3VT6Q.js +0 -114
  85. package/dist/chunk-7FD3VT6Q.js.map +0 -7
  86. package/dist/chunk-AHI4HCY3.js +0 -62
  87. package/dist/chunk-AHI4HCY3.js.map +0 -7
  88. package/dist/chunk-BGSYLCVD.js +0 -6337
  89. package/dist/chunk-BGSYLCVD.js.map +0 -7
  90. package/dist/chunk-DANANDDE.js +0 -418
  91. package/dist/chunk-DANANDDE.js.map +0 -7
  92. package/dist/chunk-ETRNLEWQ.js +0 -2658
  93. package/dist/chunk-ETRNLEWQ.js.map +0 -7
  94. package/dist/chunk-EWPHJFZJ.js +0 -487
  95. package/dist/chunk-EWPHJFZJ.js.map +0 -7
  96. package/dist/chunk-F63YJBI4.js +0 -98
  97. package/dist/chunk-F63YJBI4.js.map +0 -7
  98. package/dist/chunk-GLAJUP3O.js +0 -576
  99. package/dist/chunk-GLAJUP3O.js.map +0 -7
  100. package/dist/chunk-GOXRTCTY.js +0 -90
  101. package/dist/chunk-GOXRTCTY.js.map +0 -7
  102. package/dist/chunk-HMCBZI3A.js +0 -59
  103. package/dist/chunk-HMCBZI3A.js.map +0 -7
  104. package/dist/chunk-HVYTC3PX.js +0 -171
  105. package/dist/chunk-HVYTC3PX.js.map +0 -7
  106. package/dist/chunk-LJVP6AWF.js +0 -262
  107. package/dist/chunk-LJVP6AWF.js.map +0 -7
  108. package/dist/chunk-LXJGCRKM.js +0 -30
  109. package/dist/chunk-LXJGCRKM.js.map +0 -7
  110. package/dist/chunk-MG3UGW66.js +0 -16800
  111. package/dist/chunk-MG3UGW66.js.map +0 -7
  112. package/dist/chunk-MUKUP7JU.js +0 -161
  113. package/dist/chunk-MUKUP7JU.js.map +0 -7
  114. package/dist/chunk-OV6MVDCL.js +0 -41
  115. package/dist/chunk-OV6MVDCL.js.map +0 -7
  116. package/dist/chunk-P6NV2XO4.js +0 -178
  117. package/dist/chunk-P6NV2XO4.js.map +0 -7
  118. package/dist/chunk-REL3HBSD.js +0 -71
  119. package/dist/chunk-REL3HBSD.js.map +0 -7
  120. package/dist/chunk-U4SQBXPZ.js +0 -830
  121. package/dist/chunk-U4SQBXPZ.js.map +0 -7
  122. package/dist/chunk-YEL5ZTFU.js +0 -136
  123. package/dist/chunk-YEL5ZTFU.js.map +0 -7
@@ -1,830 +0,0 @@
1
- import {
2
- useSidepaneResetOnLayoutUpdate
3
- } from "./chunk-LXJGCRKM.js";
4
- import {
5
- Accordion,
6
- Button,
7
- ConnectionIndicator,
8
- HorizontalDivider,
9
- Input,
10
- RoleChangeModal,
11
- useIsSidepaneTypeOpen,
12
- useSidepaneToggle
13
- } from "./chunk-MG3UGW66.js";
14
- import {
15
- Text
16
- } from "./chunk-MUKUP7JU.js";
17
- import {
18
- Dropdown,
19
- ToastManager,
20
- useParticipants
21
- } from "./chunk-DANANDDE.js";
22
- import {
23
- Box,
24
- Flex
25
- } from "./chunk-GOXRTCTY.js";
26
- import {
27
- IconButton_default,
28
- getFormattedCount,
29
- getMetadata,
30
- textEllipsis,
31
- useRoomLayoutConferencingScreen
32
- } from "./chunk-BGSYLCVD.js";
33
- import {
34
- SIDE_PANE_OPTIONS,
35
- __async,
36
- __spreadProps,
37
- __spreadValues,
38
- config,
39
- init_define_process_env
40
- } from "./chunk-GLAJUP3O.js";
41
-
42
- // src/Prebuilt/components/Footer/ParticipantList.tsx
43
- init_define_process_env();
44
- import React4, { Fragment, useCallback, useState as useState3 } from "react";
45
- import { useDebounce, useMedia } from "react-use";
46
- import {
47
- HMSPeerType,
48
- selectAvailableRoleNames,
49
- selectHandRaisedPeers,
50
- selectHasPeerHandRaised,
51
- selectIsLargeRoom as selectIsLargeRoom2,
52
- selectIsPeerAudioEnabled,
53
- selectLocalPeerID as selectLocalPeerID2,
54
- selectPeerCount,
55
- selectPermissions as selectPermissions5,
56
- useHMSStore as useHMSStore6
57
- } from "@100mslive/react-sdk";
58
- import {
59
- AddIcon as AddIcon2,
60
- CallIcon,
61
- ChangeRoleIcon,
62
- CrossIcon as CrossIcon2,
63
- HandIcon,
64
- MicOffIcon as MicOffIcon2,
65
- PeopleIcon,
66
- PersonSettingsIcon,
67
- SearchIcon,
68
- VerticalMenuIcon as VerticalMenuIcon2
69
- } from "@100mslive/react-icons";
70
-
71
- // src/Prebuilt/components/RemoveParticipant.tsx
72
- init_define_process_env();
73
- import React from "react";
74
- import { selectLocalPeerID, selectPermissions, useHMSActions, useHMSStore } from "@100mslive/react-sdk";
75
- import { PeopleRemoveIcon } from "@100mslive/react-icons";
76
- var RemoveParticipant = ({ peerId }) => {
77
- var _a;
78
- const canRemoveOthers = (_a = useHMSStore(selectPermissions)) == null ? void 0 : _a.removeOthers;
79
- const localPeerId = useHMSStore(selectLocalPeerID);
80
- const actions = useHMSActions();
81
- if (peerId === localPeerId || !canRemoveOthers) {
82
- return null;
83
- }
84
- return /* @__PURE__ */ React.createElement(
85
- Dropdown.Item,
86
- {
87
- css: { color: "$alert_error_default", bg: "$surface_default" },
88
- onClick: () => __async(void 0, null, function* () {
89
- try {
90
- yield actions.removePeer(peerId, "");
91
- } catch (error) {
92
- const ex = error;
93
- ToastManager.addToast({ title: ex.message, variant: "error" });
94
- }
95
- })
96
- },
97
- /* @__PURE__ */ React.createElement(PeopleRemoveIcon, null),
98
- /* @__PURE__ */ React.createElement(Text, { variant: "sm", css: { ml: "$4", color: "inherit", fontWeight: "$semiBold" } }, "Remove Participant")
99
- );
100
- };
101
-
102
- // src/Prebuilt/components/Footer/RoleAccordion.tsx
103
- init_define_process_env();
104
- import React3, { useEffect } from "react";
105
- import { useMeasure } from "react-use";
106
- import { FixedSizeList } from "react-window";
107
- import { selectIsLargeRoom, useHMSStore as useHMSStore4, usePaginatedParticipants } from "@100mslive/react-sdk";
108
- import { AddIcon, ChevronRightIcon, CrossIcon } from "@100mslive/react-icons";
109
-
110
- // src/Prebuilt/components/Footer/RoleOptions.tsx
111
- init_define_process_env();
112
- import React2, { useState } from "react";
113
- import { match } from "ts-pattern";
114
- import {
115
- selectPermissions as selectPermissions2,
116
- selectRoleByRoleName,
117
- selectTracksMap,
118
- useHMSActions as useHMSActions2,
119
- useHMSStore as useHMSStore2
120
- } from "@100mslive/react-sdk";
121
- import {
122
- MicOffIcon,
123
- MicOnIcon,
124
- PersonRectangleIcon,
125
- RemoveUserIcon,
126
- VerticalMenuIcon,
127
- VideoOffIcon,
128
- VideoOnIcon
129
- } from "@100mslive/react-icons";
130
- var dropdownItemCSS = { backgroundColor: "$surface_default", gap: "$4", p: "$8" };
131
- var optionTextCSS = {
132
- fontWeight: "$semiBold",
133
- color: "$on_surface_high",
134
- textTransform: "none",
135
- whiteSpace: "nowrap"
136
- };
137
- var DropdownWrapper = ({ children }) => {
138
- const [openOptions, setOpenOptions] = useState(false);
139
- if (React2.Children.toArray(children).length === 0) {
140
- return null;
141
- }
142
- return /* @__PURE__ */ React2.createElement(Dropdown.Root, { open: openOptions, onOpenChange: setOpenOptions }, /* @__PURE__ */ React2.createElement(
143
- Dropdown.Trigger,
144
- {
145
- "data-testid": "role_group_options",
146
- onClick: (e) => e.stopPropagation(),
147
- className: "role_actions",
148
- asChild: true,
149
- css: {
150
- p: "$1",
151
- r: "$0",
152
- c: "$on_surface_high",
153
- visibility: openOptions ? "visible" : "hidden",
154
- "&:hover": {
155
- c: "$on_surface_medium"
156
- },
157
- "@md": {
158
- visibility: "visible"
159
- }
160
- }
161
- },
162
- /* @__PURE__ */ React2.createElement(Flex, null, /* @__PURE__ */ React2.createElement(VerticalMenuIcon, null))
163
- ), /* @__PURE__ */ React2.createElement(
164
- Dropdown.Content,
165
- {
166
- onClick: (e) => e.stopPropagation(),
167
- css: { w: "max-content", bg: "$surface_default", py: 0 },
168
- align: "end"
169
- },
170
- children
171
- ));
172
- };
173
- var RoleOptions = ({ roleName, peerList }) => {
174
- const permissions = useHMSStore2(selectPermissions2);
175
- const hmsActions = useHMSActions2();
176
- const { elements } = useRoomLayoutConferencingScreen();
177
- const { on_stage_role, off_stage_roles = [] } = (elements == null ? void 0 : elements.on_stage_exp) || {};
178
- const canRemoveRoleFromStage = (permissions == null ? void 0 : permissions.changeRole) && roleName === on_stage_role;
179
- const role = useHMSStore2(selectRoleByRoleName(roleName));
180
- const tracks = useHMSStore2(selectTracksMap);
181
- if (!role) {
182
- return null;
183
- }
184
- const canPublishAudio = role.publishParams.allowed.includes("audio");
185
- const canPublishVideo = role.publishParams.allowed.includes("video");
186
- let isVideoOnForSomePeers = false;
187
- let isAudioOnForSomePeers = false;
188
- peerList.forEach((peer) => {
189
- var _a, _b;
190
- if (peer.isLocal) {
191
- return;
192
- }
193
- const isAudioOn = !!peer.audioTrack && ((_a = tracks[peer.audioTrack]) == null ? void 0 : _a.enabled);
194
- const isVideoOn = !!peer.videoTrack && ((_b = tracks[peer.videoTrack]) == null ? void 0 : _b.enabled);
195
- isAudioOnForSomePeers = isAudioOnForSomePeers || isAudioOn;
196
- isVideoOnForSomePeers = isVideoOnForSomePeers || isVideoOn;
197
- });
198
- const setTrackEnabled = (type, enabled = false) => __async(void 0, null, function* () {
199
- try {
200
- yield hmsActions.setRemoteTracksEnabled({ roles: [roleName], source: "regular", type, enabled });
201
- } catch (e) {
202
- console.error(e);
203
- }
204
- });
205
- const canRemoveRoleFromRoom = (permissions == null ? void 0 : permissions.removeOthers) && (on_stage_role === roleName || (off_stage_roles == null ? void 0 : off_stage_roles.includes(roleName)));
206
- if (peerList.length === 0 || // if only local peer is present no need to show any options
207
- peerList.length === 1 && peerList[0].isLocal || !role) {
208
- return null;
209
- }
210
- const removeAllFromStage = () => {
211
- peerList.forEach((peer) => {
212
- const prevRole = getMetadata(peer.metadata).prevRole;
213
- if (prevRole) {
214
- hmsActions.changeRoleOfPeer(peer.id, prevRole, true);
215
- }
216
- });
217
- };
218
- const removePeersFromRoom = () => __async(void 0, null, function* () {
219
- try {
220
- peerList.forEach((peer) => __async(void 0, null, function* () {
221
- yield hmsActions.removePeer(peer.id, "");
222
- }));
223
- } catch (e) {
224
- console.error(e);
225
- }
226
- });
227
- return /* @__PURE__ */ React2.createElement(DropdownWrapper, null, canRemoveRoleFromStage ? /* @__PURE__ */ React2.createElement(
228
- Dropdown.Item,
229
- {
230
- css: __spreadProps(__spreadValues({}, dropdownItemCSS), { borderBottom: "1px solid $border_bright" }),
231
- onClick: removeAllFromStage
232
- },
233
- /* @__PURE__ */ React2.createElement(PersonRectangleIcon, null),
234
- /* @__PURE__ */ React2.createElement(Text, { variant: "sm", css: optionTextCSS }, "Remove all from Stage")
235
- ) : null, match({ canPublishAudio, isAudioOnForSomePeers, canMute: permissions == null ? void 0 : permissions.mute, canUnmute: permissions == null ? void 0 : permissions.unmute }).with({ canPublishAudio: true, isAudioOnForSomePeers: true, canMute: true }, () => {
236
- return /* @__PURE__ */ React2.createElement(Dropdown.Item, { css: dropdownItemCSS, onClick: () => setTrackEnabled("audio", false) }, /* @__PURE__ */ React2.createElement(MicOffIcon, null), /* @__PURE__ */ React2.createElement(Text, { variant: "sm", css: optionTextCSS }, "Mute Audio for All"));
237
- }).with({ canPublishAudio: true, isAudioOnForSomePeers: false, canUnmute: true }, () => {
238
- return /* @__PURE__ */ React2.createElement(Dropdown.Item, { css: dropdownItemCSS, onClick: () => setTrackEnabled("audio", true) }, /* @__PURE__ */ React2.createElement(MicOnIcon, null), /* @__PURE__ */ React2.createElement(Text, { variant: "sm", css: optionTextCSS }, "Request to Unmute Audio for All"));
239
- }).otherwise(() => null), match({ canPublishVideo, isVideoOnForSomePeers, canMute: permissions == null ? void 0 : permissions.mute, canUnmute: permissions == null ? void 0 : permissions.unmute }).with({ canPublishVideo: true, isVideoOnForSomePeers: true, canMute: true }, () => {
240
- return /* @__PURE__ */ React2.createElement(Dropdown.Item, { css: dropdownItemCSS, onClick: () => setTrackEnabled("video", false) }, /* @__PURE__ */ React2.createElement(VideoOffIcon, null), /* @__PURE__ */ React2.createElement(Text, { variant: "sm", css: optionTextCSS }, "Mute Video for All"));
241
- }).with({ canPublishVideo: true, isVideoOnForSomePeers: false, canUnmute: true }, () => {
242
- return /* @__PURE__ */ React2.createElement(Dropdown.Item, { css: dropdownItemCSS, onClick: () => setTrackEnabled("video", true) }, /* @__PURE__ */ React2.createElement(VideoOnIcon, null), /* @__PURE__ */ React2.createElement(Text, { variant: "sm", css: optionTextCSS }, "Request to Unmute Video for All"));
243
- }).otherwise(() => null), canRemoveRoleFromRoom ? /* @__PURE__ */ React2.createElement(
244
- Dropdown.Item,
245
- {
246
- css: __spreadProps(__spreadValues({}, dropdownItemCSS), { borderTop: "1px solid $border_bright", color: "$alert_error_default" }),
247
- onClick: removePeersFromRoom
248
- },
249
- /* @__PURE__ */ React2.createElement(RemoveUserIcon, null),
250
- /* @__PURE__ */ React2.createElement(Text, { variant: "sm", css: __spreadProps(__spreadValues({}, optionTextCSS), { color: "inherit" }) }, "Remove all from Room")
251
- ) : null);
252
- };
253
-
254
- // src/Prebuilt/components/hooks/useGroupOnStageActions.tsx
255
- init_define_process_env();
256
- import { match as match2, P } from "ts-pattern";
257
- import { selectPermissions as selectPermissions3, useHMSActions as useHMSActions3, useHMSStore as useHMSStore3 } from "@100mslive/react-sdk";
258
- var useGroupOnStageActions = ({ peers }) => {
259
- var _a;
260
- const hmsActions = useHMSActions3();
261
- const { elements } = useRoomLayoutConferencingScreen();
262
- const {
263
- bring_to_stage_label,
264
- remove_from_stage_label,
265
- on_stage_role,
266
- off_stage_roles = [],
267
- skip_preview_for_role_change = false
268
- } = elements.on_stage_exp || {};
269
- const canChangeRole = (_a = useHMSStore3(selectPermissions3)) == null ? void 0 : _a.changeRole;
270
- const offStageRolePeers = peers.filter(
271
- (peer) => match2({ on_stage_role, bring_to_stage_label, roleName: peer.roleName }).with(
272
- {
273
- on_stage_role: P.when((role) => !!role),
274
- bring_to_stage_label: P.when((label) => !!label),
275
- roleName: P.when((role) => !!role && off_stage_roles.includes(role))
276
- },
277
- () => true
278
- ).otherwise(() => false)
279
- );
280
- const lowerAllHands = () => __async(void 0, null, function* () {
281
- return Promise.all(peers.map((peer) => hmsActions.lowerRemotePeerHand(peer.id)));
282
- });
283
- const bringAllToStage = () => {
284
- if (!canChangeRole || !on_stage_role) {
285
- return;
286
- }
287
- return Promise.all(
288
- offStageRolePeers.map((peer) => {
289
- return hmsActions.changeRoleOfPeer(peer.id, on_stage_role, skip_preview_for_role_change).then(() => {
290
- return skip_preview_for_role_change ? hmsActions.lowerRemotePeerHand(peer.id) : null;
291
- });
292
- })
293
- );
294
- };
295
- return {
296
- lowerAllHands,
297
- bringAllToStage,
298
- canBringToStage: canChangeRole && offStageRolePeers.length > 0,
299
- bring_to_stage_label,
300
- remove_from_stage_label
301
- };
302
- };
303
-
304
- // src/Prebuilt/components/Footer/RoleAccordion.tsx
305
- var ROW_HEIGHT = 50;
306
- var ITER_TIMER = 5e3;
307
- function itemKey(index, data) {
308
- var _a;
309
- return (_a = data.peerList[index]) == null ? void 0 : _a.id;
310
- }
311
- var VirtualizedParticipantItem = React3.memo(
312
- ({ index, data, style }) => {
313
- return /* @__PURE__ */ React3.createElement(
314
- Participant,
315
- {
316
- key: data.peerList[index].id,
317
- peer: data.peerList[index],
318
- isHandRaisedAccordion: data.isHandRaisedAccordion,
319
- isConnected: data.isConnected,
320
- style
321
- }
322
- );
323
- }
324
- );
325
- var RoleAccordion = ({
326
- peerList = [],
327
- roleName,
328
- isConnected,
329
- filter,
330
- isHandRaisedAccordion = false,
331
- offStageRoles,
332
- onActive
333
- }) => {
334
- const [ref, { width }] = useMeasure();
335
- const isLargeRoom = useHMSStore4(selectIsLargeRoom);
336
- const { peers, total, loadPeers } = usePaginatedParticipants({ role: roleName, limit: 10 });
337
- const isOffStageRole = roleName && offStageRoles.includes(roleName);
338
- let peersInAccordion = peerList;
339
- if (isOffStageRole && isLargeRoom) {
340
- peersInAccordion = peers;
341
- if (filter == null ? void 0 : filter.search) {
342
- peersInAccordion = peersInAccordion.filter((peer) => peer.name.toLowerCase().includes(filter.search || ""));
343
- }
344
- }
345
- const { bringAllToStage, bring_to_stage_label, canBringToStage, lowerAllHands } = useGroupOnStageActions({
346
- peers: peersInAccordion
347
- });
348
- useEffect(() => {
349
- if (!isOffStageRole || !isLargeRoom) {
350
- return;
351
- }
352
- loadPeers();
353
- const interval = setInterval(() => {
354
- loadPeers();
355
- }, ITER_TIMER);
356
- return () => clearInterval(interval);
357
- }, [isOffStageRole, isLargeRoom]);
358
- if (peersInAccordion.length === 0 || isHandRaisedAccordion && (filter == null ? void 0 : filter.search)) {
359
- return null;
360
- }
361
- const height = ROW_HEIGHT * peersInAccordion.length;
362
- const hasNext = total > peersInAccordion.length && !(filter == null ? void 0 : filter.search);
363
- return /* @__PURE__ */ React3.createElement(Accordion.Item, { value: roleName, css: { "&:hover .role_actions": { visibility: "visible" }, mb: "$8" }, ref }, /* @__PURE__ */ React3.createElement(
364
- Accordion.Header,
365
- {
366
- chevronID: `role_accordion_btn_${roleName}`,
367
- iconStyles: { c: "$on_surface_high" },
368
- css: {
369
- textTransform: "capitalize",
370
- p: "$6 $8",
371
- fontSize: "$sm",
372
- fontWeight: "$semiBold",
373
- c: "$on_surface_medium",
374
- borderRadius: "$1",
375
- border: "1px solid $border_default",
376
- '&[data-state="open"]': {
377
- borderBottomLeftRadius: 0,
378
- borderBottomRightRadius: 0
379
- }
380
- }
381
- },
382
- /* @__PURE__ */ React3.createElement(Flex, { justify: "between", align: "center", css: { flexGrow: 1, pr: "$6" } }, /* @__PURE__ */ React3.createElement(
383
- Text,
384
- {
385
- variant: "sm",
386
- css: { fontWeight: "$semiBold", textTransform: "capitalize", color: "$on_surface_medium" }
387
- },
388
- roleName,
389
- " ",
390
- `(${getFormattedCount(isLargeRoom && isOffStageRole ? total : peerList.length)})`
391
- ), /* @__PURE__ */ React3.createElement(RoleOptions, { roleName, peerList: peersInAccordion }))
392
- ), /* @__PURE__ */ React3.createElement(Accordion.Content, { contentStyles: { border: "1px solid $border_default", borderTop: "none" } }, /* @__PURE__ */ React3.createElement(
393
- FixedSizeList,
394
- {
395
- itemSize: ROW_HEIGHT,
396
- itemData: {
397
- peerList: isHandRaisedAccordion ? peersInAccordion.sort((a, b) => {
398
- try {
399
- const aHandRaisedAt = JSON.parse(a.metadata || "{}").handRaisedAt;
400
- const bHandRaisedAt = JSON.parse(b.metadata || "{}").handRaisedAt;
401
- return aHandRaisedAt - bHandRaisedAt;
402
- } catch (err) {
403
- return 0;
404
- }
405
- }) : peersInAccordion,
406
- isConnected,
407
- isHandRaisedAccordion
408
- },
409
- itemKey,
410
- itemCount: peersInAccordion.length,
411
- width,
412
- height
413
- },
414
- VirtualizedParticipantItem
415
- ), (offStageRoles == null ? void 0 : offStageRoles.includes(roleName)) && hasNext ? /* @__PURE__ */ React3.createElement(
416
- Flex,
417
- {
418
- align: "center",
419
- justify: "end",
420
- css: {
421
- gap: "$1",
422
- cursor: "pointer",
423
- color: "$on_surface_high",
424
- p: "$6",
425
- borderTop: "1px solid $border_default"
426
- },
427
- onClick: () => onActive == null ? void 0 : onActive(roleName)
428
- },
429
- /* @__PURE__ */ React3.createElement(Text, { variant: "sm", css: { color: "inherit" } }, "View All"),
430
- /* @__PURE__ */ React3.createElement(ChevronRightIcon, null)
431
- ) : null, isHandRaisedAccordion && canBringToStage && /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(HorizontalDivider, null), /* @__PURE__ */ React3.createElement(Flex, { css: { w: "100%", p: "$6", gap: "$4" }, justify: "center" }, /* @__PURE__ */ React3.createElement(Button, { variant: "standard", onClick: lowerAllHands, icon: true, css: { pl: "$2" } }, /* @__PURE__ */ React3.createElement(CrossIcon, null), " Lower all hands"), /* @__PURE__ */ React3.createElement(Button, { onClick: bringAllToStage, icon: true, css: { pl: "$2" } }, /* @__PURE__ */ React3.createElement(AddIcon, null), " ", bring_to_stage_label)))));
432
- };
433
-
434
- // src/Prebuilt/components/hooks/usePeerOnStageActions.tsx
435
- init_define_process_env();
436
- import { useState as useState2 } from "react";
437
- import { selectPeerMetadata, selectPermissions as selectPermissions4, useHMSActions as useHMSActions4, useHMSStore as useHMSStore5 } from "@100mslive/react-sdk";
438
- var usePeerOnStageActions = ({ peerId, role }) => {
439
- var _a, _b;
440
- const hmsActions = useHMSActions4();
441
- const { elements } = useRoomLayoutConferencingScreen();
442
- const {
443
- bring_to_stage_label,
444
- remove_from_stage_label,
445
- on_stage_role,
446
- off_stage_roles = [],
447
- skip_preview_for_role_change = false
448
- } = elements.on_stage_exp || {};
449
- const isInStage = role === on_stage_role;
450
- const canChangeRole = (_a = useHMSStore5(selectPermissions4)) == null ? void 0 : _a.changeRole;
451
- const shouldShowStageRoleChange = canChangeRole && (isInStage && remove_from_stage_label || (off_stage_roles == null ? void 0 : off_stage_roles.includes(role)) && bring_to_stage_label);
452
- const prevRole = (_b = useHMSStore5(selectPeerMetadata(peerId))) == null ? void 0 : _b.prevRole;
453
- const [open, setOpen] = useState2(false);
454
- const lowerPeerHand = () => __async(void 0, null, function* () {
455
- yield hmsActions.lowerRemotePeerHand(peerId);
456
- });
457
- const handleStageAction = () => __async(void 0, null, function* () {
458
- if (isInStage) {
459
- prevRole && hmsActions.changeRoleOfPeer(peerId, prevRole, true);
460
- } else if (on_stage_role) {
461
- yield hmsActions.changeRoleOfPeer(peerId, on_stage_role, skip_preview_for_role_change);
462
- if (skip_preview_for_role_change) {
463
- yield lowerPeerHand();
464
- }
465
- }
466
- setOpen(false);
467
- });
468
- return {
469
- open,
470
- setOpen,
471
- lowerPeerHand,
472
- handleStageAction,
473
- shouldShowStageRoleChange,
474
- isInStage,
475
- bring_to_stage_label,
476
- remove_from_stage_label
477
- };
478
- };
479
-
480
- // src/Prebuilt/components/Footer/ParticipantList.tsx
481
- var ParticipantList = ({
482
- offStageRoles = [],
483
- onActive
484
- }) => {
485
- const [filter, setFilter] = useState3();
486
- const { participants, isConnected, peerCount } = useParticipants(filter);
487
- const isLargeRoom = useHMSStore6(selectIsLargeRoom2);
488
- const peersOrderedByRoles = {};
489
- const handRaisedPeers = useHMSStore6(selectHandRaisedPeers);
490
- participants.forEach((participant) => {
491
- if (participant.roleName) {
492
- if (peersOrderedByRoles[participant.roleName] === void 0) {
493
- peersOrderedByRoles[participant.roleName] = [];
494
- }
495
- peersOrderedByRoles[participant.roleName].push(participant);
496
- }
497
- });
498
- if (isLargeRoom) {
499
- offStageRoles.forEach((role) => {
500
- if (!peersOrderedByRoles[role]) {
501
- peersOrderedByRoles[role] = [];
502
- }
503
- });
504
- }
505
- useSidepaneResetOnLayoutUpdate("participant_list", SIDE_PANE_OPTIONS.PARTICIPANTS);
506
- const onSearch = useCallback((value) => {
507
- setFilter((filterValue) => {
508
- if (!filterValue) {
509
- filterValue = {};
510
- }
511
- filterValue.search = value.toLowerCase();
512
- return __spreadValues({}, filterValue);
513
- });
514
- }, []);
515
- if (peerCount === 0) {
516
- return null;
517
- }
518
- return /* @__PURE__ */ React4.createElement(Fragment, null, /* @__PURE__ */ React4.createElement(
519
- Flex,
520
- {
521
- direction: "column",
522
- css: {
523
- size: "100%",
524
- gap: "$4"
525
- }
526
- },
527
- !(filter == null ? void 0 : filter.search) && participants.length === 0 ? null : /* @__PURE__ */ React4.createElement(ParticipantSearch, { onSearch, inSidePane: true }),
528
- /* @__PURE__ */ React4.createElement(
529
- VirtualizedParticipants,
530
- {
531
- peersOrderedByRoles,
532
- handRaisedList: handRaisedPeers,
533
- isConnected: !!isConnected,
534
- filter,
535
- offStageRoles,
536
- isLargeRoom,
537
- onActive
538
- },
539
- participants.length === 0 ? /* @__PURE__ */ React4.createElement(
540
- Flex,
541
- {
542
- align: "center",
543
- justify: "center",
544
- className: "emptyParticipants",
545
- css: { w: "100%", p: "$8 0", display: "none" }
546
- },
547
- /* @__PURE__ */ React4.createElement(Text, { variant: "sm" }, !filter ? "No participants" : "No matching participants")
548
- ) : null
549
- )
550
- ));
551
- };
552
- var ParticipantCount = () => {
553
- const peerCount = useHMSStore6(selectPeerCount);
554
- const toggleSidepane = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
555
- const isPeerListOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.PARTICIPANTS);
556
- if (peerCount === 0) {
557
- return null;
558
- }
559
- return /* @__PURE__ */ React4.createElement(
560
- IconButton_default,
561
- {
562
- css: {
563
- w: "auto",
564
- p: "$4",
565
- h: "auto",
566
- bg: isPeerListOpen ? "$surface_brighter" : ""
567
- },
568
- onClick: () => {
569
- if (peerCount > 0) {
570
- toggleSidepane();
571
- }
572
- },
573
- "data-testid": "participant_list"
574
- },
575
- /* @__PURE__ */ React4.createElement(PeopleIcon, null),
576
- /* @__PURE__ */ React4.createElement(Text, { variant: "sm", css: { mx: "$4", c: "inherit" } }, getFormattedCount(peerCount))
577
- );
578
- };
579
- var Participant = ({
580
- peer,
581
- isConnected,
582
- isHandRaisedAccordion,
583
- style
584
- }) => {
585
- const localPeerId = useHMSStore6(selectLocalPeerID2);
586
- return /* @__PURE__ */ React4.createElement(
587
- Flex,
588
- {
589
- key: peer.id,
590
- css: {
591
- w: "100%",
592
- p: "$4 $8",
593
- pr: "$6",
594
- h: "$16",
595
- "&:hover .participant_item": { display: "flex" }
596
- },
597
- align: "center",
598
- justify: "between",
599
- "data-testid": "participant_" + peer.name,
600
- style
601
- },
602
- /* @__PURE__ */ React4.createElement(
603
- Text,
604
- {
605
- variant: "sm",
606
- css: __spreadProps(__spreadValues({}, textEllipsis("100%")), { flex: "1 1 0", mr: "$8", fontWeight: "$semiBold", color: "$on_surface_high" })
607
- },
608
- peer.name,
609
- " ",
610
- localPeerId === peer.id ? "(You)" : ""
611
- ),
612
- isConnected && peer.roleName ? /* @__PURE__ */ React4.createElement(
613
- ParticipantActions,
614
- {
615
- peerId: peer.id,
616
- peerType: peer.type,
617
- role: peer.roleName,
618
- isHandRaisedAccordion
619
- }
620
- ) : null
621
- );
622
- };
623
- var VirtualizedParticipants = ({
624
- peersOrderedByRoles = {},
625
- isConnected,
626
- filter,
627
- handRaisedList = [],
628
- offStageRoles,
629
- isLargeRoom,
630
- onActive,
631
- children
632
- }) => {
633
- return /* @__PURE__ */ React4.createElement(
634
- Flex,
635
- {
636
- direction: "column",
637
- css: {
638
- gap: "$8",
639
- overflowY: "auto",
640
- overflowX: "hidden",
641
- pr: "$10",
642
- mr: "-$10",
643
- flex: "1 1 0",
644
- "& > div:empty ~ .emptyParticipants": {
645
- display: "flex"
646
- }
647
- }
648
- },
649
- /* @__PURE__ */ React4.createElement(Accordion.Root, { type: isLargeRoom ? "single" : "multiple", collapsible: true }, handRaisedList.length > 0 ? /* @__PURE__ */ React4.createElement(
650
- RoleAccordion,
651
- {
652
- peerList: handRaisedList,
653
- roleName: "Hand Raised",
654
- filter,
655
- isConnected,
656
- isHandRaisedAccordion: true,
657
- offStageRoles
658
- }
659
- ) : null, Object.keys(peersOrderedByRoles).map((role) => /* @__PURE__ */ React4.createElement(
660
- RoleAccordion,
661
- {
662
- key: role,
663
- peerList: peersOrderedByRoles[role],
664
- roleName: role,
665
- isConnected,
666
- filter,
667
- offStageRoles,
668
- onActive
669
- }
670
- ))),
671
- children
672
- );
673
- };
674
- var ParticipantActions = React4.memo(
675
- ({
676
- peerId,
677
- peerType,
678
- role,
679
- isHandRaisedAccordion
680
- }) => {
681
- var _a, _b;
682
- const isHandRaised = useHMSStore6(selectHasPeerHandRaised(peerId));
683
- const canChangeRole = (_a = useHMSStore6(selectPermissions5)) == null ? void 0 : _a.changeRole;
684
- const canRemoveOthers = (_b = useHMSStore6(selectPermissions5)) == null ? void 0 : _b.removeOthers;
685
- const { elements } = useRoomLayoutConferencingScreen();
686
- const { on_stage_exp } = elements || {};
687
- const shouldShowMoreActions = on_stage_exp && canChangeRole || canRemoveOthers;
688
- const isAudioMuted = !useHMSStore6(selectIsPeerAudioEnabled(peerId));
689
- return /* @__PURE__ */ React4.createElement(
690
- Flex,
691
- {
692
- align: "center",
693
- css: {
694
- flexShrink: 0,
695
- gap: "$8"
696
- }
697
- },
698
- isHandRaisedAccordion ? /* @__PURE__ */ React4.createElement(HandRaisedAccordionParticipantActions, { peerId, role }) : /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(ConnectionIndicator, { peerId }), peerType === HMSPeerType.SIP && /* @__PURE__ */ React4.createElement(
699
- Flex,
700
- {
701
- align: "center",
702
- justify: "center",
703
- css: { p: "$1", c: "$on_surface_high", bg: "$surface_bright", borderRadius: "$round" }
704
- },
705
- /* @__PURE__ */ React4.createElement(CallIcon, { width: 19, height: 19 })
706
- ), isHandRaised && /* @__PURE__ */ React4.createElement(
707
- Flex,
708
- {
709
- align: "center",
710
- justify: "center",
711
- css: { p: "$1", c: "$on_surface_high", bg: "$surface_bright", borderRadius: "$round" }
712
- },
713
- /* @__PURE__ */ React4.createElement(HandIcon, { height: 19, width: 19 })
714
- ), isAudioMuted ? /* @__PURE__ */ React4.createElement(
715
- Flex,
716
- {
717
- align: "center",
718
- justify: "center",
719
- css: { p: "$2", c: "$on_surface_high", bg: "$surface_bright", borderRadius: "$round" }
720
- },
721
- /* @__PURE__ */ React4.createElement(MicOffIcon2, { height: 19, width: 19 })
722
- ) : null, shouldShowMoreActions ? /* @__PURE__ */ React4.createElement(ParticipantMoreActions, { peerId, role }) : null)
723
- );
724
- }
725
- );
726
- var quickActionStyle = { p: "$1", borderRadius: "$round" };
727
- var HandRaisedAccordionParticipantActions = ({ peerId, role }) => {
728
- const { handleStageAction, lowerPeerHand, shouldShowStageRoleChange, isInStage } = usePeerOnStageActions({
729
- peerId,
730
- role
731
- });
732
- if (!shouldShowStageRoleChange) {
733
- return null;
734
- }
735
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(Button, { variant: "standard", css: quickActionStyle, onClick: lowerPeerHand }, /* @__PURE__ */ React4.createElement(CrossIcon2, { height: 18, width: 18 })), !isInStage && /* @__PURE__ */ React4.createElement(Button, { variant: "primary", onClick: handleStageAction, css: quickActionStyle }, /* @__PURE__ */ React4.createElement(AddIcon2, { height: 18, width: 18 })));
736
- };
737
- var ParticipantMoreActions = ({ peerId, role }) => {
738
- var _a;
739
- const {
740
- open,
741
- setOpen,
742
- bring_to_stage_label,
743
- remove_from_stage_label,
744
- handleStageAction,
745
- isInStage,
746
- shouldShowStageRoleChange
747
- } = usePeerOnStageActions({ peerId, role });
748
- const canChangeRole = !!((_a = useHMSStore6(selectPermissions5)) == null ? void 0 : _a.changeRole);
749
- const [openRoleChangeModal, setOpenRoleChangeModal] = useState3(false);
750
- const roles = useHMSStore6(selectAvailableRoleNames);
751
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(Dropdown.Root, { open, onOpenChange: (value) => setOpen(value), modal: false }, /* @__PURE__ */ React4.createElement(
752
- Dropdown.Trigger,
753
- {
754
- asChild: true,
755
- "data-testid": "participant_more_actions",
756
- className: "participant_item",
757
- css: {
758
- p: "$1",
759
- r: "$0",
760
- c: "$on_surface_high",
761
- display: open ? "flex" : "none",
762
- "&:hover": {
763
- bg: "$surface_bright"
764
- },
765
- "@md": {
766
- display: "flex"
767
- }
768
- },
769
- tabIndex: 0
770
- },
771
- /* @__PURE__ */ React4.createElement(Box, { css: { my: "auto" } }, /* @__PURE__ */ React4.createElement(VerticalMenuIcon2, null))
772
- ), /* @__PURE__ */ React4.createElement(Dropdown.Portal, null, /* @__PURE__ */ React4.createElement(Dropdown.Content, { align: "end", sideOffset: 8, css: { w: "$64", bg: "$surface_default" } }, shouldShowStageRoleChange ? /* @__PURE__ */ React4.createElement(Dropdown.Item, { css: { bg: "$surface_default" }, onClick: () => handleStageAction() }, /* @__PURE__ */ React4.createElement(ChangeRoleIcon, null), /* @__PURE__ */ React4.createElement(Text, { variant: "sm", css: { ml: "$4", fontWeight: "$semiBold", c: "$on_surface_high" } }, isInStage ? remove_from_stage_label : bring_to_stage_label)) : null, canChangeRole && roles.length > 1 ? /* @__PURE__ */ React4.createElement(Dropdown.Item, { css: { bg: "$surface_default" }, onClick: () => setOpenRoleChangeModal(true) }, /* @__PURE__ */ React4.createElement(PersonSettingsIcon, null), /* @__PURE__ */ React4.createElement(Text, { variant: "sm", css: { ml: "$4", fontWeight: "$semiBold", c: "$on_surface_high" } }, "Switch Role")) : null, /* @__PURE__ */ React4.createElement(RemoveParticipant, { peerId })))), openRoleChangeModal && /* @__PURE__ */ React4.createElement(RoleChangeModal, { peerId, onOpenChange: setOpenRoleChangeModal }));
773
- };
774
- var ParticipantSearch = ({
775
- onSearch,
776
- placeholder = "Search for participants",
777
- inSidePane = false
778
- }) => {
779
- const [value, setValue] = React4.useState("");
780
- const isMobile = useMedia(config.media.md);
781
- useDebounce(
782
- () => {
783
- onSearch(value);
784
- },
785
- 300,
786
- [value, onSearch]
787
- );
788
- return /* @__PURE__ */ React4.createElement(
789
- Flex,
790
- {
791
- align: "center",
792
- css: {
793
- p: isMobile ? "0" : "$2 0",
794
- mb: "$2",
795
- position: "relative",
796
- color: "$on_surface_medium",
797
- mt: inSidePane ? "$4" : ""
798
- },
799
- onClick: (e) => e.stopPropagation()
800
- },
801
- /* @__PURE__ */ React4.createElement(SearchIcon, { style: { position: "absolute", left: "0.5rem" } }),
802
- /* @__PURE__ */ React4.createElement(
803
- Input,
804
- {
805
- type: "text",
806
- placeholder,
807
- css: { w: "100%", p: "$6", pl: "$14", bg: inSidePane ? "$surface_default" : "$surface_dim" },
808
- value,
809
- onKeyDown: (event) => {
810
- event.stopPropagation();
811
- },
812
- onChange: (event) => {
813
- setValue(event.currentTarget.value);
814
- },
815
- autoComplete: "off",
816
- "aria-autocomplete": "none"
817
- }
818
- )
819
- );
820
- };
821
-
822
- export {
823
- ROW_HEIGHT,
824
- itemKey,
825
- ParticipantList,
826
- ParticipantCount,
827
- Participant,
828
- ParticipantSearch
829
- };
830
- //# sourceMappingURL=chunk-U4SQBXPZ.js.map