@100mslive/roomkit-react 0.3.24-alpha.0 → 0.3.24-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs.css +2 -2
- package/dist/index.cjs.css.map +1 -1
- package/dist/index.cjs.js +34103 -37488
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +36383 -73
- package/dist/index.js.map +4 -4
- package/dist/meta.cjs.json +5567 -5616
- package/dist/meta.esbuild.json +6030 -8742
- package/package.json +7 -7
- package/src/Prebuilt/App.tsx +2 -6
- package/src/Prebuilt/components/Chat/Chat.tsx +8 -12
- package/src/Prebuilt/components/Footer/WhiteboardToggle.tsx +11 -4
- package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +3 -3
- package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +3 -0
- package/src/Prebuilt/components/Preview/PreviewJoin.tsx +3 -2
- package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +30 -43
- package/src/Prebuilt/layouts/HLSView.jsx +2 -3
- package/src/Prebuilt/layouts/SidePane.tsx +6 -12
- package/src/Prebuilt/layouts/VideoStreamingSection.tsx +64 -69
- package/dist/ConferenceScreen-CLPW3BGP.css +0 -2780
- package/dist/ConferenceScreen-CLPW3BGP.css.map +0 -7
- package/dist/ConferenceScreen-M6RBPTAJ.js +0 -1774
- package/dist/ConferenceScreen-M6RBPTAJ.js.map +0 -7
- package/dist/EmbedView-DDSO7ZCV.js +0 -17
- package/dist/EmbedView-DDSO7ZCV.js.map +0 -7
- package/dist/EmbedView-HGIUZHKA.css +0 -2780
- package/dist/EmbedView-HGIUZHKA.css.map +0 -7
- package/dist/EmojiReaction-23JDKJD4.js +0 -11
- package/dist/EmojiReaction-23JDKJD4.js.map +0 -7
- package/dist/HLSView-OW77EAAO.css +0 -2780
- package/dist/HLSView-OW77EAAO.css.map +0 -7
- package/dist/HLSView-Q6GEB3UM.js +0 -1666
- package/dist/HLSView-Q6GEB3UM.js.map +0 -7
- package/dist/LeaveScreen-BYTE73MT.js +0 -556
- package/dist/LeaveScreen-BYTE73MT.js.map +0 -7
- package/dist/LeaveScreen-P7AATEIF.css +0 -2780
- package/dist/LeaveScreen-P7AATEIF.css.map +0 -7
- package/dist/MoreSettings-LV5X2U6K.css +0 -2780
- package/dist/MoreSettings-LV5X2U6K.css.map +0 -7
- package/dist/MoreSettings-WSHMMNOC.js +0 -16
- package/dist/MoreSettings-WSHMMNOC.js.map +0 -7
- package/dist/PDFView-RIPRIIH6.css +0 -2780
- package/dist/PDFView-RIPRIIH6.css.map +0 -7
- package/dist/PDFView-ZFSG2ESE.js +0 -84
- package/dist/PDFView-ZFSG2ESE.js.map +0 -7
- package/dist/Polls-QWW5LTTB.js +0 -1584
- package/dist/Polls-QWW5LTTB.js.map +0 -7
- package/dist/Polls-ULYGUPPF.css +0 -2780
- package/dist/Polls-ULYGUPPF.css.map +0 -7
- package/dist/RaiseHand-K7NFLH7H.js +0 -10
- package/dist/RaiseHand-K7NFLH7H.js.map +0 -7
- package/dist/RoleProminence-235AFT7F.js +0 -116
- package/dist/RoleProminence-235AFT7F.js.map +0 -7
- package/dist/RoleProminence-6XN3POS5.css +0 -2780
- package/dist/RoleProminence-6XN3POS5.css.map +0 -7
- package/dist/RoomDetailsPane-O5TFMTPI.css +0 -2780
- package/dist/RoomDetailsPane-O5TFMTPI.css.map +0 -7
- package/dist/RoomDetailsPane-RF3D3TDR.js +0 -53
- package/dist/RoomDetailsPane-RF3D3TDR.js.map +0 -7
- package/dist/ScreenshareLayout-KNEB3AJJ.css +0 -2780
- package/dist/ScreenshareLayout-KNEB3AJJ.css.map +0 -7
- package/dist/ScreenshareLayout-PSQMS3NC.js +0 -358
- package/dist/ScreenshareLayout-PSQMS3NC.js.map +0 -7
- package/dist/SidePaneTabs-I6DECE5R.css +0 -2780
- package/dist/SidePaneTabs-I6DECE5R.css.map +0 -7
- package/dist/SidePaneTabs-NXHBI2JB.js +0 -1354
- package/dist/SidePaneTabs-NXHBI2JB.js.map +0 -7
- package/dist/VBPicker-2CQ3IIO7.js +0 -322
- package/dist/VBPicker-2CQ3IIO7.js.map +0 -7
- package/dist/VBPicker-DCNYGO23.css +0 -2780
- package/dist/VBPicker-DCNYGO23.css.map +0 -7
- package/dist/WaitingView-NZIUOXBI.js +0 -10
- package/dist/WaitingView-NZIUOXBI.js.map +0 -7
- package/dist/WhiteboardLayout-4YLFM3EY.js +0 -96
- package/dist/WhiteboardLayout-4YLFM3EY.js.map +0 -7
- package/dist/WhiteboardLayout-JUOBDFKY.css +0 -2780
- package/dist/WhiteboardLayout-JUOBDFKY.css.map +0 -7
- package/dist/chunk-3C7IESSI.js +0 -254
- package/dist/chunk-3C7IESSI.js.map +0 -7
- package/dist/chunk-7FD3VT6Q.js +0 -114
- package/dist/chunk-7FD3VT6Q.js.map +0 -7
- package/dist/chunk-AHI4HCY3.js +0 -62
- package/dist/chunk-AHI4HCY3.js.map +0 -7
- package/dist/chunk-BGSYLCVD.js +0 -6337
- package/dist/chunk-BGSYLCVD.js.map +0 -7
- package/dist/chunk-DANANDDE.js +0 -418
- package/dist/chunk-DANANDDE.js.map +0 -7
- package/dist/chunk-ETRNLEWQ.js +0 -2658
- package/dist/chunk-ETRNLEWQ.js.map +0 -7
- package/dist/chunk-EWPHJFZJ.js +0 -487
- package/dist/chunk-EWPHJFZJ.js.map +0 -7
- package/dist/chunk-F63YJBI4.js +0 -98
- package/dist/chunk-F63YJBI4.js.map +0 -7
- package/dist/chunk-GLAJUP3O.js +0 -576
- package/dist/chunk-GLAJUP3O.js.map +0 -7
- package/dist/chunk-GOXRTCTY.js +0 -90
- package/dist/chunk-GOXRTCTY.js.map +0 -7
- package/dist/chunk-HMCBZI3A.js +0 -59
- package/dist/chunk-HMCBZI3A.js.map +0 -7
- package/dist/chunk-HVYTC3PX.js +0 -171
- package/dist/chunk-HVYTC3PX.js.map +0 -7
- package/dist/chunk-LJVP6AWF.js +0 -262
- package/dist/chunk-LJVP6AWF.js.map +0 -7
- package/dist/chunk-LXJGCRKM.js +0 -30
- package/dist/chunk-LXJGCRKM.js.map +0 -7
- package/dist/chunk-MG3UGW66.js +0 -16800
- package/dist/chunk-MG3UGW66.js.map +0 -7
- package/dist/chunk-MUKUP7JU.js +0 -161
- package/dist/chunk-MUKUP7JU.js.map +0 -7
- package/dist/chunk-OV6MVDCL.js +0 -41
- package/dist/chunk-OV6MVDCL.js.map +0 -7
- package/dist/chunk-P6NV2XO4.js +0 -178
- package/dist/chunk-P6NV2XO4.js.map +0 -7
- package/dist/chunk-REL3HBSD.js +0 -71
- package/dist/chunk-REL3HBSD.js.map +0 -7
- package/dist/chunk-U4SQBXPZ.js +0 -830
- package/dist/chunk-U4SQBXPZ.js.map +0 -7
- package/dist/chunk-YEL5ZTFU.js +0 -136
- package/dist/chunk-YEL5ZTFU.js.map +0 -7
@@ -1,1354 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
Participant,
|
3
|
-
ParticipantList,
|
4
|
-
ParticipantSearch,
|
5
|
-
ROW_HEIGHT,
|
6
|
-
itemKey
|
7
|
-
} from "./chunk-U4SQBXPZ.js";
|
8
|
-
import {
|
9
|
-
AnnotisedMessage,
|
10
|
-
CHAT_MESSAGE_LIMIT,
|
11
|
-
ChatBody,
|
12
|
-
MoreSettings,
|
13
|
-
useIsPeerBlacklisted,
|
14
|
-
usePinnedMessages
|
15
|
-
} from "./chunk-ETRNLEWQ.js";
|
16
|
-
import "./chunk-3C7IESSI.js";
|
17
|
-
import "./chunk-7FD3VT6Q.js";
|
18
|
-
import {
|
19
|
-
RaiseHand
|
20
|
-
} from "./chunk-OV6MVDCL.js";
|
21
|
-
import "./chunk-AHI4HCY3.js";
|
22
|
-
import {
|
23
|
-
useSidepaneResetOnLayoutUpdate
|
24
|
-
} from "./chunk-LXJGCRKM.js";
|
25
|
-
import {
|
26
|
-
Button,
|
27
|
-
HorizontalDivider,
|
28
|
-
Loading,
|
29
|
-
Mm,
|
30
|
-
Popover,
|
31
|
-
Sheet,
|
32
|
-
Tabs,
|
33
|
-
Xm,
|
34
|
-
useIsSidepaneTypeOpen,
|
35
|
-
useSidepaneReset,
|
36
|
-
useSidepaneToggle
|
37
|
-
} from "./chunk-MG3UGW66.js";
|
38
|
-
import {
|
39
|
-
Text
|
40
|
-
} from "./chunk-MUKUP7JU.js";
|
41
|
-
import {
|
42
|
-
Dropdown,
|
43
|
-
ToastManager,
|
44
|
-
useDefaultChatSelection,
|
45
|
-
useFilteredRoles,
|
46
|
-
useLandscapeHLSStream,
|
47
|
-
useMobileHLSStream
|
48
|
-
} from "./chunk-DANANDDE.js";
|
49
|
-
import {
|
50
|
-
Box,
|
51
|
-
Flex
|
52
|
-
} from "./chunk-GOXRTCTY.js";
|
53
|
-
import {
|
54
|
-
IconButton,
|
55
|
-
Tooltip,
|
56
|
-
getFormattedCount,
|
57
|
-
useRoomLayoutConferencingScreen,
|
58
|
-
useSetSubscribedChatSelector,
|
59
|
-
useSubscribeChatSelector
|
60
|
-
} from "./chunk-BGSYLCVD.js";
|
61
|
-
import {
|
62
|
-
APP_DATA,
|
63
|
-
CHAT_SELECTOR,
|
64
|
-
SIDE_PANE_OPTIONS,
|
65
|
-
__async,
|
66
|
-
__objRest,
|
67
|
-
__spreadProps,
|
68
|
-
__spreadValues,
|
69
|
-
config,
|
70
|
-
init_define_process_env,
|
71
|
-
styled
|
72
|
-
} from "./chunk-GLAJUP3O.js";
|
73
|
-
|
74
|
-
// src/Prebuilt/components/SidePaneTabs.tsx
|
75
|
-
init_define_process_env();
|
76
|
-
import React11, { useEffect as useEffect5, useState as useState6 } from "react";
|
77
|
-
import { useMedia as useMedia6 } from "react-use";
|
78
|
-
import { match as match2 } from "ts-pattern";
|
79
|
-
import { selectPeerCount, useHMSStore as useHMSStore9 } from "@100mslive/react-sdk";
|
80
|
-
import { CrossIcon as CrossIcon3 } from "@100mslive/react-icons";
|
81
|
-
|
82
|
-
// src/Prebuilt/components/Chat/Chat.tsx
|
83
|
-
init_define_process_env();
|
84
|
-
import React8, { Suspense, useCallback as useCallback4, useRef as useRef3 } from "react";
|
85
|
-
import { useMedia as useMedia5 } from "react-use";
|
86
|
-
import { match } from "ts-pattern";
|
87
|
-
import { selectHMSMessagesCount, useHMSActions as useHMSActions4, useHMSStore as useHMSStore6, useHMSVanillaStore } from "@100mslive/react-sdk";
|
88
|
-
import { ChevronDownIcon as ChevronDownIcon3 } from "@100mslive/react-icons";
|
89
|
-
|
90
|
-
// src/Prebuilt/components/Chat/ChatFooter.tsx
|
91
|
-
init_define_process_env();
|
92
|
-
import React3, { useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2, useState as useState3 } from "react";
|
93
|
-
import { useMedia as useMedia3 } from "react-use";
|
94
|
-
import data from "@emoji-mart/data/sets/14/apple.json";
|
95
|
-
import Picker from "@emoji-mart/react";
|
96
|
-
import { selectLocalPeer, useHMSActions as useHMSActions2, useHMSStore as useHMSStore3 } from "@100mslive/react-sdk";
|
97
|
-
import { EmojiIcon, PauseCircleIcon, SendIcon, VerticalMenuIcon } from "@100mslive/react-icons";
|
98
|
-
|
99
|
-
// src/Prebuilt/components/Chat/ChatSelectorContainer.tsx
|
100
|
-
init_define_process_env();
|
101
|
-
import React2, { useState as useState2 } from "react";
|
102
|
-
import { useMedia as useMedia2 } from "react-use";
|
103
|
-
import { ChevronDownIcon, ChevronUpIcon, CrossIcon, GroupIcon, PersonIcon } from "@100mslive/react-icons";
|
104
|
-
|
105
|
-
// src/Prebuilt/components/Chat/ChatSelector.tsx
|
106
|
-
init_define_process_env();
|
107
|
-
import React, { useMemo, useState } from "react";
|
108
|
-
import { useMedia } from "react-use";
|
109
|
-
import {
|
110
|
-
HMSPeerType,
|
111
|
-
selectMessagesUnreadCountByPeerID,
|
112
|
-
selectMessagesUnreadCountByRole,
|
113
|
-
selectRemotePeers,
|
114
|
-
selectUnreadHMSMessagesCount,
|
115
|
-
useHMSStore
|
116
|
-
} from "@100mslive/react-sdk";
|
117
|
-
import { CheckIcon, PeopleIcon } from "@100mslive/react-icons";
|
118
|
-
var ChatDotIcon = () => {
|
119
|
-
return /* @__PURE__ */ React.createElement(Box, { css: { size: "$6", bg: "$primary_default", mx: "$2", r: "$round" } });
|
120
|
-
};
|
121
|
-
var SelectorItem = ({
|
122
|
-
value,
|
123
|
-
active,
|
124
|
-
onClick,
|
125
|
-
unreadCount,
|
126
|
-
icon = void 0
|
127
|
-
}) => {
|
128
|
-
const isMobile = useMedia(config.media.md);
|
129
|
-
const Root = !isMobile ? Dropdown.Item : (_a) => {
|
130
|
-
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
131
|
-
return /* @__PURE__ */ React.createElement(Flex, __spreadProps(__spreadValues({}, rest), { css: __spreadValues({ p: "$6 $8" }, rest.css) }), children);
|
132
|
-
};
|
133
|
-
return /* @__PURE__ */ React.createElement(
|
134
|
-
Root,
|
135
|
-
{
|
136
|
-
"data-testid": "chat_members",
|
137
|
-
css: { align: "center", px: "$10", py: "$4", bg: "$surface_default" },
|
138
|
-
onClick
|
139
|
-
},
|
140
|
-
/* @__PURE__ */ React.createElement(
|
141
|
-
Text,
|
142
|
-
{
|
143
|
-
variant: "sm",
|
144
|
-
css: { display: "flex", alignItems: "center", gap: "$4", fontWeight: "$semiBold", color: "$on_surface_high" }
|
145
|
-
},
|
146
|
-
icon,
|
147
|
-
value
|
148
|
-
),
|
149
|
-
/* @__PURE__ */ React.createElement(Flex, { align: "center", css: { ml: "auto", color: "$on_primary_high" } }, unreadCount > 0 && /* @__PURE__ */ React.createElement(Tooltip, { title: `${unreadCount} unread` }, /* @__PURE__ */ React.createElement(Box, { css: { mr: active ? "$3" : 0 } }, /* @__PURE__ */ React.createElement(ChatDotIcon, null))), active && /* @__PURE__ */ React.createElement(CheckIcon, { width: 16, height: 16 }))
|
150
|
-
);
|
151
|
-
};
|
152
|
-
var SelectorHeader = React.memo(
|
153
|
-
({ isHorizontalDivider = true, children }) => {
|
154
|
-
return /* @__PURE__ */ React.createElement(Box, { css: { flexShrink: 0 } }, isHorizontalDivider && /* @__PURE__ */ React.createElement(HorizontalDivider, { space: 4 }), /* @__PURE__ */ React.createElement(
|
155
|
-
Text,
|
156
|
-
{
|
157
|
-
variant: "overline",
|
158
|
-
css: { p: "$4 $10", fontWeight: "$semiBold", textTransform: "uppercase", color: "$on_surface_medium" }
|
159
|
-
},
|
160
|
-
children
|
161
|
-
));
|
162
|
-
}
|
163
|
-
);
|
164
|
-
var Everyone = React.memo(({ active }) => {
|
165
|
-
const unreadCount = useHMSStore(selectUnreadHMSMessagesCount);
|
166
|
-
const [, setPeerSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.PEER);
|
167
|
-
const [, setRoleSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.ROLE);
|
168
|
-
return /* @__PURE__ */ React.createElement(
|
169
|
-
SelectorItem,
|
170
|
-
{
|
171
|
-
value: "Everyone",
|
172
|
-
icon: /* @__PURE__ */ React.createElement(PeopleIcon, null),
|
173
|
-
active,
|
174
|
-
unreadCount,
|
175
|
-
onClick: () => {
|
176
|
-
setPeerSelector({});
|
177
|
-
setRoleSelector("");
|
178
|
-
}
|
179
|
-
}
|
180
|
-
);
|
181
|
-
});
|
182
|
-
var RoleItem = React.memo(({ role, active }) => {
|
183
|
-
const unreadCount = useHMSStore(selectMessagesUnreadCountByRole(role));
|
184
|
-
const [, setPeerSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.PEER);
|
185
|
-
const [, setRoleSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.ROLE);
|
186
|
-
return /* @__PURE__ */ React.createElement(
|
187
|
-
SelectorItem,
|
188
|
-
{
|
189
|
-
value: role,
|
190
|
-
active,
|
191
|
-
unreadCount,
|
192
|
-
onClick: () => {
|
193
|
-
setPeerSelector({});
|
194
|
-
setRoleSelector(role);
|
195
|
-
}
|
196
|
-
}
|
197
|
-
);
|
198
|
-
});
|
199
|
-
var PeerItem = ({ peerId, name, active }) => {
|
200
|
-
const unreadCount = useHMSStore(selectMessagesUnreadCountByPeerID(peerId));
|
201
|
-
const [, setPeerSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.PEER);
|
202
|
-
const [, setRoleSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.ROLE);
|
203
|
-
return /* @__PURE__ */ React.createElement(
|
204
|
-
SelectorItem,
|
205
|
-
{
|
206
|
-
value: name,
|
207
|
-
active,
|
208
|
-
unreadCount,
|
209
|
-
onClick: () => {
|
210
|
-
setPeerSelector({ id: peerId, name });
|
211
|
-
setRoleSelector("");
|
212
|
-
}
|
213
|
-
}
|
214
|
-
);
|
215
|
-
};
|
216
|
-
var VirtualizedSelectItemList = ({
|
217
|
-
peers,
|
218
|
-
selectedRole,
|
219
|
-
selectedPeerId,
|
220
|
-
searchValue,
|
221
|
-
isPublicChatEnabled
|
222
|
-
}) => {
|
223
|
-
const roles = useFilteredRoles();
|
224
|
-
const filteredPeers = useMemo(
|
225
|
-
() => peers.filter(
|
226
|
-
// search should be empty or search phrase should be included in name
|
227
|
-
(peer) => (!searchValue || peer.name.toLowerCase().includes(searchValue.toLowerCase())) && peer.type !== HMSPeerType.SIP
|
228
|
-
),
|
229
|
-
[peers, searchValue]
|
230
|
-
);
|
231
|
-
const listItems = useMemo(() => {
|
232
|
-
let selectItems = [];
|
233
|
-
if (isPublicChatEnabled && !searchValue) {
|
234
|
-
selectItems = [/* @__PURE__ */ React.createElement(Everyone, { active: !selectedRole && !selectedPeerId })];
|
235
|
-
}
|
236
|
-
if (roles.length > 0 && !searchValue) {
|
237
|
-
selectItems.push(/* @__PURE__ */ React.createElement(SelectorHeader, { isHorizontalDivider: isPublicChatEnabled }, "Roles"));
|
238
|
-
roles.forEach(
|
239
|
-
(userRole) => selectItems.push(/* @__PURE__ */ React.createElement(RoleItem, { key: userRole, active: selectedRole === userRole, role: userRole }))
|
240
|
-
);
|
241
|
-
}
|
242
|
-
if (filteredPeers.length > 0) {
|
243
|
-
selectItems.push(
|
244
|
-
/* @__PURE__ */ React.createElement(SelectorHeader, { isHorizontalDivider: isPublicChatEnabled || roles.length > 0 }, "Participants")
|
245
|
-
);
|
246
|
-
}
|
247
|
-
filteredPeers.forEach(
|
248
|
-
(peer) => selectItems.push(
|
249
|
-
/* @__PURE__ */ React.createElement(PeerItem, { key: peer.id, name: peer.name, peerId: peer.id, active: peer.id === selectedPeerId })
|
250
|
-
)
|
251
|
-
);
|
252
|
-
return selectItems;
|
253
|
-
}, [isPublicChatEnabled, searchValue, selectedRole, selectedPeerId, roles, filteredPeers]);
|
254
|
-
return /* @__PURE__ */ React.createElement(Dropdown.Group, { css: { overflowY: "auto", maxHeight: "$64", bg: "$surface_default" } }, listItems.map((item, index) => /* @__PURE__ */ React.createElement(Box, { key: index }, item)));
|
255
|
-
};
|
256
|
-
var ChatSelector = ({ role, peerId }) => {
|
257
|
-
var _a, _b;
|
258
|
-
const { elements } = useRoomLayoutConferencingScreen();
|
259
|
-
const peers = useHMSStore(selectRemotePeers);
|
260
|
-
const [search, setSearch] = useState("");
|
261
|
-
const isPrivateChatEnabled = !!((_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.private_chat_enabled);
|
262
|
-
const isPublicChatEnabled = !!((_b = elements == null ? void 0 : elements.chat) == null ? void 0 : _b.public_chat_enabled);
|
263
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, peers.length > 0 && isPrivateChatEnabled && /* @__PURE__ */ React.createElement(Box, { css: { px: "$4" } }, /* @__PURE__ */ React.createElement(ParticipantSearch, { onSearch: setSearch, placeholder: "Search for participants" })), /* @__PURE__ */ React.createElement(
|
264
|
-
VirtualizedSelectItemList,
|
265
|
-
{
|
266
|
-
selectedRole: role,
|
267
|
-
selectedPeerId: peerId,
|
268
|
-
peers: isPrivateChatEnabled ? peers : [],
|
269
|
-
isPublicChatEnabled,
|
270
|
-
searchValue: search
|
271
|
-
}
|
272
|
-
));
|
273
|
-
};
|
274
|
-
|
275
|
-
// src/Prebuilt/components/Chat/ChatSelectorContainer.tsx
|
276
|
-
var ChatSelectorContainer = () => {
|
277
|
-
var _a, _b;
|
278
|
-
const [open, setOpen] = useState2(false);
|
279
|
-
const isMobile = useMedia2(config.media.md);
|
280
|
-
const { elements } = useRoomLayoutConferencingScreen();
|
281
|
-
const isPrivateChatEnabled = !!((_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.private_chat_enabled);
|
282
|
-
const isPublicChatEnabled = !!((_b = elements == null ? void 0 : elements.chat) == null ? void 0 : _b.public_chat_enabled);
|
283
|
-
const roles = useFilteredRoles();
|
284
|
-
const selectedPeer = useSubscribeChatSelector(CHAT_SELECTOR.PEER);
|
285
|
-
const selectedRole = useSubscribeChatSelector(CHAT_SELECTOR.ROLE);
|
286
|
-
const defaultSelection = useDefaultChatSelection();
|
287
|
-
const selection = selectedPeer.name || selectedRole || defaultSelection;
|
288
|
-
if (!(isPrivateChatEnabled || isPublicChatEnabled || roles.length > 0) && !isPrivateChatEnabled && !selection) {
|
289
|
-
return null;
|
290
|
-
}
|
291
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Flex, { align: "center", css: { mb: "$8", flex: "1 1 0", pl: "$2" } }, /* @__PURE__ */ React2.createElement(Text, { variant: "xs", css: { color: "$on_surface_medium" } }, selection ? "To" : "Choose Participant"), isMobile ? /* @__PURE__ */ React2.createElement(
|
292
|
-
Flex,
|
293
|
-
{
|
294
|
-
align: "center",
|
295
|
-
css: { c: "$on_surface_medium", border: "1px solid $border_bright", r: "$0", p: "$1 $2", ml: "$6" },
|
296
|
-
gap: "1",
|
297
|
-
onClick: (e) => {
|
298
|
-
setOpen((value) => !value);
|
299
|
-
e.stopPropagation();
|
300
|
-
}
|
301
|
-
},
|
302
|
-
/* @__PURE__ */ React2.createElement(
|
303
|
-
Text,
|
304
|
-
{
|
305
|
-
variant: "caption",
|
306
|
-
css: {
|
307
|
-
c: "$on_surface_high",
|
308
|
-
pr: "$2",
|
309
|
-
display: "flex",
|
310
|
-
alignItems: "center",
|
311
|
-
gap: "$1",
|
312
|
-
textTransform: selection !== selectedPeer.name ? "capitalize" : void 0
|
313
|
-
}
|
314
|
-
},
|
315
|
-
selection === CHAT_SELECTOR.EVERYONE ? /* @__PURE__ */ React2.createElement(GroupIcon, { width: 16, height: 16 }) : /* @__PURE__ */ React2.createElement(PersonIcon, { width: 16, height: 16 }),
|
316
|
-
selection || "Search"
|
317
|
-
),
|
318
|
-
selection && (open ? /* @__PURE__ */ React2.createElement(ChevronUpIcon, { width: 16, height: 16 }) : /* @__PURE__ */ React2.createElement(ChevronDownIcon, { width: 16, height: 16 }))
|
319
|
-
) : /* @__PURE__ */ React2.createElement(Dropdown.Root, { open, onOpenChange: (value) => setOpen(value) }, /* @__PURE__ */ React2.createElement(
|
320
|
-
Dropdown.Trigger,
|
321
|
-
{
|
322
|
-
asChild: true,
|
323
|
-
"data-testid": "participant_list_filter",
|
324
|
-
css: {
|
325
|
-
background: "$primary_default",
|
326
|
-
r: "$0",
|
327
|
-
p: "$1 $2",
|
328
|
-
ml: "$6"
|
329
|
-
},
|
330
|
-
tabIndex: 0
|
331
|
-
},
|
332
|
-
/* @__PURE__ */ React2.createElement(Flex, { align: "center", css: { c: "$on_surface_medium" }, gap: "1" }, /* @__PURE__ */ React2.createElement(
|
333
|
-
Text,
|
334
|
-
{
|
335
|
-
variant: "caption",
|
336
|
-
css: {
|
337
|
-
c: "$on_surface_high",
|
338
|
-
pr: "$2",
|
339
|
-
display: "flex",
|
340
|
-
alignItems: "center",
|
341
|
-
gap: "$1",
|
342
|
-
textTransform: selection !== selectedPeer.name ? "capitalize" : void 0
|
343
|
-
}
|
344
|
-
},
|
345
|
-
selection === CHAT_SELECTOR.EVERYONE ? /* @__PURE__ */ React2.createElement(GroupIcon, { width: 16, height: 16 }) : /* @__PURE__ */ React2.createElement(PersonIcon, { width: 16, height: 16 }),
|
346
|
-
selection || "Search"
|
347
|
-
), selection && /* @__PURE__ */ React2.createElement(
|
348
|
-
ChevronDownIcon,
|
349
|
-
{
|
350
|
-
style: { transform: open ? "rotate(180deg)" : "rotate(0deg)", transition: "transform 150ms ease" },
|
351
|
-
width: 12,
|
352
|
-
height: 12
|
353
|
-
}
|
354
|
-
))
|
355
|
-
), /* @__PURE__ */ React2.createElement(
|
356
|
-
Dropdown.Content,
|
357
|
-
{
|
358
|
-
css: {
|
359
|
-
w: "$64",
|
360
|
-
overflow: "hidden",
|
361
|
-
maxHeight: "unset",
|
362
|
-
bg: "$surface_default"
|
363
|
-
},
|
364
|
-
align: "start",
|
365
|
-
sideOffset: 8
|
366
|
-
},
|
367
|
-
/* @__PURE__ */ React2.createElement(ChatSelector, { role: selectedRole, peerId: selectedPeer.id })
|
368
|
-
))), isMobile ? /* @__PURE__ */ React2.createElement(Sheet.Root, { open, onOpenChange: (value) => setOpen(value) }, /* @__PURE__ */ React2.createElement(Sheet.Content, { css: { pt: "$8" } }, /* @__PURE__ */ React2.createElement(
|
369
|
-
Sheet.Title,
|
370
|
-
{
|
371
|
-
css: {
|
372
|
-
display: "flex",
|
373
|
-
w: "100%",
|
374
|
-
justifyContent: "space-between",
|
375
|
-
px: "$10",
|
376
|
-
pb: "$4",
|
377
|
-
mb: "$8",
|
378
|
-
borderBottom: "1px solid $border_bright"
|
379
|
-
}
|
380
|
-
},
|
381
|
-
/* @__PURE__ */ React2.createElement(Text, { css: { color: "$on_surface_medium", fontWeight: "$semiBold" } }, "Chat with"),
|
382
|
-
/* @__PURE__ */ React2.createElement(Sheet.Close, { css: { color: "$on_surface_medium" } }, /* @__PURE__ */ React2.createElement(CrossIcon, null))
|
383
|
-
), /* @__PURE__ */ React2.createElement(
|
384
|
-
Box,
|
385
|
-
{
|
386
|
-
onClick: () => {
|
387
|
-
setOpen(false);
|
388
|
-
}
|
389
|
-
},
|
390
|
-
/* @__PURE__ */ React2.createElement(ChatSelector, { role: selectedRole, peerId: selectedPeer.id })
|
391
|
-
))) : null);
|
392
|
-
};
|
393
|
-
|
394
|
-
// src/Prebuilt/components/AppData/useChatState.js
|
395
|
-
init_define_process_env();
|
396
|
-
import { useCallback } from "react";
|
397
|
-
import { selectAppData, useHMSActions, useHMSStore as useHMSStore2 } from "@100mslive/react-sdk";
|
398
|
-
var useChatDraftMessage = () => {
|
399
|
-
const hmsActions = useHMSActions();
|
400
|
-
let chatDraftMessage = useHMSStore2(selectAppData(APP_DATA.chatDraft));
|
401
|
-
if (chatDraftMessage === void 0 || chatDraftMessage === null) {
|
402
|
-
chatDraftMessage = "";
|
403
|
-
}
|
404
|
-
const setDraftMessage = useCallback(
|
405
|
-
(message) => {
|
406
|
-
hmsActions.setAppData(APP_DATA.chatDraft, message, true);
|
407
|
-
},
|
408
|
-
[hmsActions]
|
409
|
-
);
|
410
|
-
return [chatDraftMessage, setDraftMessage];
|
411
|
-
};
|
412
|
-
|
413
|
-
// src/Prebuilt/components/Chat/useEmojiPickerStyles.js
|
414
|
-
init_define_process_env();
|
415
|
-
import { useEffect, useRef } from "react";
|
416
|
-
var useEmojiPickerStyles = (showing) => {
|
417
|
-
const ref = useRef(null);
|
418
|
-
useEffect(() => {
|
419
|
-
if (showing) {
|
420
|
-
setTimeout(() => {
|
421
|
-
var _a, _b;
|
422
|
-
const root = (_b = (_a = ref.current) == null ? void 0 : _a.querySelector("em-emoji-picker")) == null ? void 0 : _b.shadowRoot;
|
423
|
-
const style = document.createElement("style");
|
424
|
-
style.textContent = `
|
425
|
-
#root {
|
426
|
-
--em-rgb-color: var(--hms-ui-colors-on_surface_high);
|
427
|
-
--em-rgb-input: var(--hms-ui-colors-on_primary_high);
|
428
|
-
--em-color-border: var(--hms-ui-colors-surface_bright);
|
429
|
-
--color-b: var(--hms-ui-colors-on_surface_high);
|
430
|
-
--rgb-background: transparent;
|
431
|
-
color: var(--hms-ui-colors-on_surface_high);
|
432
|
-
font-family: var(--hms-ui-fonts-sans);
|
433
|
-
}
|
434
|
-
.sticky {
|
435
|
-
top: 0.25rem;
|
436
|
-
background-color: var(--hms-ui-colors-surface_bright);
|
437
|
-
margin-top: 0.5rem;
|
438
|
-
}
|
439
|
-
`;
|
440
|
-
root == null ? void 0 : root.appendChild(style);
|
441
|
-
}, 0);
|
442
|
-
}
|
443
|
-
}, [showing]);
|
444
|
-
return ref;
|
445
|
-
};
|
446
|
-
|
447
|
-
// src/Prebuilt/components/Chat/ChatFooter.tsx
|
448
|
-
var TextArea = styled("textarea", {
|
449
|
-
width: "100%",
|
450
|
-
bg: "transparent",
|
451
|
-
color: "$on_primary_high",
|
452
|
-
resize: "none",
|
453
|
-
lineHeight: "1rem",
|
454
|
-
position: "relative",
|
455
|
-
fontFamily: "$sans",
|
456
|
-
fontSize: "100%",
|
457
|
-
margin: 0,
|
458
|
-
padding: 0,
|
459
|
-
top: "$3",
|
460
|
-
"&:focus": {
|
461
|
-
boxShadow: "none",
|
462
|
-
outline: "none"
|
463
|
-
}
|
464
|
-
});
|
465
|
-
function EmojiPicker({ onSelect }) {
|
466
|
-
const [showEmoji, setShowEmoji] = useState3(false);
|
467
|
-
const ref = useEmojiPickerStyles(showEmoji);
|
468
|
-
return /* @__PURE__ */ React3.createElement(Popover.Root, { open: showEmoji, onOpenChange: setShowEmoji }, /* @__PURE__ */ React3.createElement(Popover.Trigger, { asChild: true, css: { appearance: "none" } }, /* @__PURE__ */ React3.createElement(IconButton, { as: "div" }, /* @__PURE__ */ React3.createElement(EmojiIcon, null))), /* @__PURE__ */ React3.createElement(Popover.Portal, null, /* @__PURE__ */ React3.createElement(
|
469
|
-
Popover.Content,
|
470
|
-
{
|
471
|
-
alignOffset: -40,
|
472
|
-
sideOffset: 16,
|
473
|
-
align: "end",
|
474
|
-
css: {
|
475
|
-
p: 0
|
476
|
-
}
|
477
|
-
},
|
478
|
-
/* @__PURE__ */ React3.createElement(
|
479
|
-
Box,
|
480
|
-
{
|
481
|
-
css: {
|
482
|
-
minWidth: 352,
|
483
|
-
minHeight: 435
|
484
|
-
},
|
485
|
-
ref
|
486
|
-
},
|
487
|
-
/* @__PURE__ */ React3.createElement(Picker, { onEmojiSelect: onSelect, data, previewPosition: "none", skinPosition: "search" })
|
488
|
-
)
|
489
|
-
)));
|
490
|
-
}
|
491
|
-
var ChatFooter = ({ onSend, children }) => {
|
492
|
-
var _a, _b, _c, _d, _e;
|
493
|
-
const hmsActions = useHMSActions2();
|
494
|
-
const inputRef = useRef2(null);
|
495
|
-
const [draftMessage, setDraftMessage] = useChatDraftMessage();
|
496
|
-
const isMobile = useMedia3(config.media.md);
|
497
|
-
const { elements, screenType } = useRoomLayoutConferencingScreen();
|
498
|
-
const message_placeholder = ((_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.message_placeholder) || "Send a message";
|
499
|
-
const localPeer = useHMSStore3(selectLocalPeer);
|
500
|
-
const isOverlayChat = (_b = elements == null ? void 0 : elements.chat) == null ? void 0 : _b.is_overlay;
|
501
|
-
const canDisableChat = !!((_d = (_c = elements == null ? void 0 : elements.chat) == null ? void 0 : _c.real_time_controls) == null ? void 0 : _d.can_disable_chat);
|
502
|
-
const selectedPeer = useSubscribeChatSelector(CHAT_SELECTOR.PEER);
|
503
|
-
const [selectedRole, setRoleSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.ROLE);
|
504
|
-
const defaultSelection = useDefaultChatSelection();
|
505
|
-
const selection = selectedPeer.name || selectedRole || defaultSelection;
|
506
|
-
const isLocalPeerBlacklisted = useIsPeerBlacklisted({ local: true });
|
507
|
-
const isMwebHLSStream = useMobileHLSStream();
|
508
|
-
const [messageLengthExceeded, setMessageLengthExceeded] = useState3(false);
|
509
|
-
const isLandscapeHLSStream = useLandscapeHLSStream();
|
510
|
-
useEffect2(() => {
|
511
|
-
var _a2, _b2;
|
512
|
-
if (!selectedPeer.id && !selectedRole && !["Everyone", ""].includes(defaultSelection)) {
|
513
|
-
setRoleSelector(defaultSelection);
|
514
|
-
} else {
|
515
|
-
if (!(isMobile || isLandscapeHLSStream) && !((_a2 = elements == null ? void 0 : elements.chat) == null ? void 0 : _a2.disable_autofocus)) {
|
516
|
-
(_b2 = inputRef.current) == null ? void 0 : _b2.focus();
|
517
|
-
}
|
518
|
-
}
|
519
|
-
}, [defaultSelection, selectedPeer, selectedRole, setRoleSelector, isMobile, isLandscapeHLSStream, elements == null ? void 0 : elements.chat]);
|
520
|
-
const resetInputHeight = useCallback2(() => {
|
521
|
-
if (inputRef.current) {
|
522
|
-
inputRef.current.style.height = `${Math.max(
|
523
|
-
32,
|
524
|
-
inputRef.current.value ? Math.min(inputRef.current.scrollHeight, 24 * 4) : 0
|
525
|
-
)}px`;
|
526
|
-
}
|
527
|
-
}, []);
|
528
|
-
const updateInputHeight = useCallback2(() => {
|
529
|
-
if (inputRef.current) {
|
530
|
-
inputRef.current.style.height = `${Math.max(32, Math.min(inputRef.current.scrollHeight, 24 * 4))}px`;
|
531
|
-
}
|
532
|
-
}, []);
|
533
|
-
const sendMessage = useCallback2(() => __async(void 0, null, function* () {
|
534
|
-
var _a2;
|
535
|
-
const message = (_a2 = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a2.value;
|
536
|
-
if (!message || !message.trim().length) {
|
537
|
-
return;
|
538
|
-
}
|
539
|
-
try {
|
540
|
-
if (selectedRole) {
|
541
|
-
yield hmsActions.sendGroupMessage(message, [selectedRole]);
|
542
|
-
} else if (selectedPeer.id) {
|
543
|
-
yield hmsActions.sendDirectMessage(message, selectedPeer.id);
|
544
|
-
} else {
|
545
|
-
yield hmsActions.sendBroadcastMessage(message);
|
546
|
-
}
|
547
|
-
inputRef.current.value = "";
|
548
|
-
resetInputHeight();
|
549
|
-
setTimeout(() => {
|
550
|
-
onSend(1);
|
551
|
-
}, 0);
|
552
|
-
} catch (error) {
|
553
|
-
const err = error;
|
554
|
-
ToastManager.addToast({
|
555
|
-
title: err.message.startsWith("Invalid peer") ? `${selectedPeer.name} is not in this room` : err.message
|
556
|
-
});
|
557
|
-
}
|
558
|
-
}), [selectedRole, selectedPeer, hmsActions, onSend]);
|
559
|
-
useEffect2(() => {
|
560
|
-
const messageElement = inputRef.current;
|
561
|
-
if (messageElement) {
|
562
|
-
messageElement.value = draftMessage;
|
563
|
-
updateInputHeight();
|
564
|
-
setMessageLengthExceeded(draftMessage.length > CHAT_MESSAGE_LIMIT);
|
565
|
-
}
|
566
|
-
}, [draftMessage]);
|
567
|
-
useEffect2(() => {
|
568
|
-
const messageElement = inputRef.current;
|
569
|
-
return () => {
|
570
|
-
setDraftMessage((messageElement == null ? void 0 : messageElement.value) || "");
|
571
|
-
};
|
572
|
-
}, [setDraftMessage]);
|
573
|
-
if (isLocalPeerBlacklisted) {
|
574
|
-
return null;
|
575
|
-
}
|
576
|
-
return /* @__PURE__ */ React3.createElement(Box, { css: { position: "relative" } }, /* @__PURE__ */ React3.createElement(Flex, null, /* @__PURE__ */ React3.createElement(ChatSelectorContainer, null), canDisableChat && isMobile && isOverlayChat ? /* @__PURE__ */ React3.createElement(Flex, { align: "center", justify: "end", css: { mb: "$4" }, onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React3.createElement(Popover.Root, null, /* @__PURE__ */ React3.createElement(Popover.Trigger, { asChild: true }, /* @__PURE__ */ React3.createElement(IconButton, { css: { border: "1px solid $border_bright" } }, /* @__PURE__ */ React3.createElement(VerticalMenuIcon, { height: "16", width: "16" }))), /* @__PURE__ */ React3.createElement(Popover.Portal, null, /* @__PURE__ */ React3.createElement(
|
577
|
-
Popover.Content,
|
578
|
-
{
|
579
|
-
align: "end",
|
580
|
-
side: "top",
|
581
|
-
onClick: () => {
|
582
|
-
const chatState = {
|
583
|
-
enabled: false,
|
584
|
-
updatedBy: {
|
585
|
-
peerId: localPeer == null ? void 0 : localPeer.id,
|
586
|
-
userId: localPeer == null ? void 0 : localPeer.customerUserId,
|
587
|
-
userName: localPeer == null ? void 0 : localPeer.name
|
588
|
-
},
|
589
|
-
updatedAt: Date.now()
|
590
|
-
};
|
591
|
-
hmsActions.sessionStore.set("chatState" /* CHAT_STATE */, chatState);
|
592
|
-
},
|
593
|
-
css: {
|
594
|
-
backgroundColor: "$surface_default",
|
595
|
-
display: "flex",
|
596
|
-
alignItems: "center",
|
597
|
-
gap: "$4",
|
598
|
-
borderRadius: "$1",
|
599
|
-
color: "$on_surface_high",
|
600
|
-
cursor: "pointer",
|
601
|
-
"&:hover": { backgroundColor: "$surface_dim" }
|
602
|
-
}
|
603
|
-
},
|
604
|
-
/* @__PURE__ */ React3.createElement(PauseCircleIcon, null),
|
605
|
-
/* @__PURE__ */ React3.createElement(Text, { variant: "sm", css: { fontWeight: "$semiBold" } }, "Pause Chat")
|
606
|
-
)))) : null), selection && /* @__PURE__ */ React3.createElement(Flex, { align: ((_e = inputRef.current) == null ? void 0 : _e.scrollHeight) === 32 ? "center" : "end", css: { gap: "$4", w: "100%" } }, /* @__PURE__ */ React3.createElement(
|
607
|
-
Flex,
|
608
|
-
{
|
609
|
-
align: "end",
|
610
|
-
css: __spreadValues({
|
611
|
-
bg: isOverlayChat && isMobile ? "$surface_dim" : "$surface_default",
|
612
|
-
minHeight: "$16",
|
613
|
-
position: "relative",
|
614
|
-
py: isOverlayChat && isMobile ? "$2" : "$6",
|
615
|
-
pl: "$8",
|
616
|
-
flexGrow: 1,
|
617
|
-
r: "$1",
|
618
|
-
"@md": {
|
619
|
-
minHeight: "$14",
|
620
|
-
boxSizing: "border-box"
|
621
|
-
}
|
622
|
-
}, isLandscapeHLSStream ? { minHeight: "$14", py: 0 } : {})
|
623
|
-
},
|
624
|
-
children,
|
625
|
-
/* @__PURE__ */ React3.createElement(
|
626
|
-
TextArea,
|
627
|
-
{
|
628
|
-
maxLength: CHAT_MESSAGE_LIMIT + 10,
|
629
|
-
css: {
|
630
|
-
c: "$on_surface_high",
|
631
|
-
"&:valid ~ .send-msg": { color: "$on_surface_high" },
|
632
|
-
"& ~ .send-msg": { color: "$on_surface_low" },
|
633
|
-
"&::placeholder": { color: "$on_surface_medium" },
|
634
|
-
border: "none"
|
635
|
-
},
|
636
|
-
placeholder: message_placeholder,
|
637
|
-
ref: inputRef,
|
638
|
-
required: true,
|
639
|
-
autoFocus: !(isMobile || isLandscapeHLSStream),
|
640
|
-
onKeyPress: (event) => __async(void 0, null, function* () {
|
641
|
-
if (event.key === "Enter") {
|
642
|
-
if (!event.shiftKey && !messageLengthExceeded) {
|
643
|
-
event.preventDefault();
|
644
|
-
yield sendMessage();
|
645
|
-
}
|
646
|
-
}
|
647
|
-
}),
|
648
|
-
autoComplete: "off",
|
649
|
-
"aria-autocomplete": "none",
|
650
|
-
onChange: (e) => {
|
651
|
-
updateInputHeight();
|
652
|
-
setMessageLengthExceeded(e.target.value.length > CHAT_MESSAGE_LIMIT);
|
653
|
-
},
|
654
|
-
onBlur: resetInputHeight,
|
655
|
-
onPaste: (e) => e.stopPropagation(),
|
656
|
-
onCut: (e) => e.stopPropagation(),
|
657
|
-
onCopy: (e) => e.stopPropagation()
|
658
|
-
}
|
659
|
-
),
|
660
|
-
!isMobile && !isLandscapeHLSStream ? /* @__PURE__ */ React3.createElement(
|
661
|
-
EmojiPicker,
|
662
|
-
{
|
663
|
-
onSelect: (emoji) => {
|
664
|
-
if (inputRef.current) {
|
665
|
-
inputRef.current.value += ` ${emoji.native} `;
|
666
|
-
}
|
667
|
-
}
|
668
|
-
}
|
669
|
-
) : null,
|
670
|
-
/* @__PURE__ */ React3.createElement(
|
671
|
-
IconButton,
|
672
|
-
{
|
673
|
-
className: "send-msg",
|
674
|
-
onClick: sendMessage,
|
675
|
-
disabled: messageLengthExceeded,
|
676
|
-
css: {
|
677
|
-
ml: "auto",
|
678
|
-
height: "max-content",
|
679
|
-
mr: "$4",
|
680
|
-
"&:hover": { c: isMobile ? "" : "$on_surface_medium" }
|
681
|
-
},
|
682
|
-
"data-testid": "send_msg_btn"
|
683
|
-
},
|
684
|
-
/* @__PURE__ */ React3.createElement(SendIcon, null)
|
685
|
-
)
|
686
|
-
), (isMwebHLSStream || isLandscapeHLSStream) && /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
|
687
|
-
Flex,
|
688
|
-
{
|
689
|
-
css: {
|
690
|
-
alignItems: "center"
|
691
|
-
},
|
692
|
-
gap: "2"
|
693
|
-
},
|
694
|
-
/* @__PURE__ */ React3.createElement(RaiseHand, { css: { bg: "$surface_default" } }),
|
695
|
-
/* @__PURE__ */ React3.createElement(MoreSettings, { elements, screenType })
|
696
|
-
))), messageLengthExceeded && /* @__PURE__ */ React3.createElement(Text, { variant: "xs", css: { color: "$alert_error_default", fontWeight: "$semiBold", mt: "$1", ml: "$7" } }, "Message cannot exceed 2000 characters"));
|
697
|
-
};
|
698
|
-
|
699
|
-
// src/Prebuilt/components/Chat/ChatStates.tsx
|
700
|
-
init_define_process_env();
|
701
|
-
import React4, { useCallback as useCallback3 } from "react";
|
702
|
-
import { selectLocalPeer as selectLocalPeer2, selectSessionStore, useHMSActions as useHMSActions3, useHMSStore as useHMSStore4 } from "@100mslive/react-sdk";
|
703
|
-
var ChatPaused = () => {
|
704
|
-
var _a, _b;
|
705
|
-
const hmsActions = useHMSActions3();
|
706
|
-
const { elements } = useRoomLayoutConferencingScreen();
|
707
|
-
const can_disable_chat = !!((_b = (_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.real_time_controls) == null ? void 0 : _b.can_disable_chat);
|
708
|
-
const { enabled: isChatEnabled = true, updatedBy: chatStateUpdatedBy = "" } = useHMSStore4(selectSessionStore("chatState" /* CHAT_STATE */)) || {};
|
709
|
-
const localPeer = useHMSStore4(selectLocalPeer2);
|
710
|
-
const unPauseChat = useCallback3(
|
711
|
-
() => __async(void 0, null, function* () {
|
712
|
-
return yield hmsActions.sessionStore.set("chatState" /* CHAT_STATE */, {
|
713
|
-
enabled: true,
|
714
|
-
updatedBy: { userName: localPeer == null ? void 0 : localPeer.name, userId: localPeer == null ? void 0 : localPeer.customerUserId, peerId: localPeer == null ? void 0 : localPeer.id },
|
715
|
-
updatedAt: Date.now()
|
716
|
-
});
|
717
|
-
}),
|
718
|
-
[hmsActions, localPeer]
|
719
|
-
);
|
720
|
-
return isChatEnabled ? null : /* @__PURE__ */ React4.createElement(
|
721
|
-
Flex,
|
722
|
-
{
|
723
|
-
align: "center",
|
724
|
-
justify: "between",
|
725
|
-
css: { borderRadius: "$1", bg: "$surface_default", p: "$2 $4 $2 $8", w: "100%" }
|
726
|
-
},
|
727
|
-
/* @__PURE__ */ React4.createElement(Box, null, /* @__PURE__ */ React4.createElement(Text, { variant: "sm", css: { fontWeight: "$semiBold", color: "$on_surface_high" } }, "Chat paused"), /* @__PURE__ */ React4.createElement(
|
728
|
-
Text,
|
729
|
-
{
|
730
|
-
variant: "xs",
|
731
|
-
css: { color: "$on_surface_medium", maxWidth: "100%", overflow: "hidden", textOverflow: "ellipsis" }
|
732
|
-
},
|
733
|
-
"Chat has been paused by ",
|
734
|
-
(chatStateUpdatedBy == null ? void 0 : chatStateUpdatedBy.peerId) === (localPeer == null ? void 0 : localPeer.id) ? "you" : chatStateUpdatedBy == null ? void 0 : chatStateUpdatedBy.userName
|
735
|
-
)),
|
736
|
-
can_disable_chat ? /* @__PURE__ */ React4.createElement(Button, { css: { fontWeight: "$semiBold", fontSize: "$sm", borderRadius: "$2" }, onClick: unPauseChat }, "Resume") : /* @__PURE__ */ React4.createElement(React4.Fragment, null)
|
737
|
-
);
|
738
|
-
};
|
739
|
-
var ChatBlocked = () => {
|
740
|
-
const isLocalPeerBlacklisted = useIsPeerBlacklisted({ local: true });
|
741
|
-
if (!isLocalPeerBlacklisted) {
|
742
|
-
return null;
|
743
|
-
}
|
744
|
-
return /* @__PURE__ */ React4.createElement(
|
745
|
-
Flex,
|
746
|
-
{
|
747
|
-
align: "center",
|
748
|
-
justify: "between",
|
749
|
-
css: { borderRadius: "$1", bg: "$surface_default", p: "$4 $4 $4 $8", w: "100%" }
|
750
|
-
},
|
751
|
-
/* @__PURE__ */ React4.createElement(Text, { variant: "sm", css: { color: "$on_surface_medium", textAlign: "center", w: "100%" } }, "You've been blocked from sending messages")
|
752
|
-
);
|
753
|
-
};
|
754
|
-
|
755
|
-
// src/Prebuilt/components/Chat/PinnedMessage.tsx
|
756
|
-
init_define_process_env();
|
757
|
-
import React7, { useEffect as useEffect3, useState as useState4 } from "react";
|
758
|
-
import { useSwipeable } from "react-swipeable";
|
759
|
-
import { useMedia as useMedia4 } from "react-use";
|
760
|
-
import { selectSessionStore as selectSessionStore2, useHMSStore as useHMSStore5 } from "@100mslive/react-sdk";
|
761
|
-
import { PinIcon, UnpinIcon } from "@100mslive/react-icons";
|
762
|
-
|
763
|
-
// src/Prebuilt/components/Chat/ArrowNavigation.tsx
|
764
|
-
init_define_process_env();
|
765
|
-
import React5 from "react";
|
766
|
-
import { ChevronDownIcon as ChevronDownIcon2, ChevronUpIcon as ChevronUpIcon2 } from "@100mslive/react-icons";
|
767
|
-
var ArrowNavigation = ({
|
768
|
-
total,
|
769
|
-
index,
|
770
|
-
showPrevious,
|
771
|
-
showNext
|
772
|
-
}) => {
|
773
|
-
if (total < 2) {
|
774
|
-
return null;
|
775
|
-
}
|
776
|
-
return /* @__PURE__ */ React5.createElement(Flex, { direction: "column", css: { gap: "$1" } }, /* @__PURE__ */ React5.createElement(
|
777
|
-
Flex,
|
778
|
-
{
|
779
|
-
onClick: showPrevious,
|
780
|
-
css: index === 0 ? { cursor: "not-allowed", color: "$on_surface_low" } : { cursor: "pointer", color: "$on_surface_medium" }
|
781
|
-
},
|
782
|
-
/* @__PURE__ */ React5.createElement(ChevronUpIcon2, { height: 20, width: 20 })
|
783
|
-
), /* @__PURE__ */ React5.createElement(
|
784
|
-
Flex,
|
785
|
-
{
|
786
|
-
onClick: showNext,
|
787
|
-
css: index === total - 1 ? { cursor: "not-allowed", color: "$on_surface_low" } : { cursor: "pointer", color: "$on_surface_medium" }
|
788
|
-
},
|
789
|
-
/* @__PURE__ */ React5.createElement(ChevronDownIcon2, { height: 20, width: 20 })
|
790
|
-
));
|
791
|
-
};
|
792
|
-
|
793
|
-
// src/Prebuilt/components/Chat/StickIndicator.tsx
|
794
|
-
init_define_process_env();
|
795
|
-
import React6 from "react";
|
796
|
-
var StickIndicator = ({ total, index }) => {
|
797
|
-
const sticksCount = Math.min(3, total);
|
798
|
-
if (total < 2) {
|
799
|
-
return null;
|
800
|
-
}
|
801
|
-
return /* @__PURE__ */ React6.createElement(Flex, { direction: "column", css: { gap: "$1" } }, [...Array(sticksCount)].map((_, i) => /* @__PURE__ */ React6.createElement(
|
802
|
-
Box,
|
803
|
-
{
|
804
|
-
css: {
|
805
|
-
borderLeft: "2px solid",
|
806
|
-
height: "$4",
|
807
|
-
borderColor: i === index ? "$on_surface_high" : "$on_surface_low"
|
808
|
-
}
|
809
|
-
}
|
810
|
-
)));
|
811
|
-
};
|
812
|
-
|
813
|
-
// src/Prebuilt/components/Chat/PinnedMessage.tsx
|
814
|
-
var PINNED_MESSAGE_LENGTH = 75;
|
815
|
-
var PinnedMessage = () => {
|
816
|
-
var _a, _b, _c, _d;
|
817
|
-
const pinnedMessages = useHMSStore5(selectSessionStore2("pinnedMessages" /* PINNED_MESSAGES */));
|
818
|
-
const [pinnedMessageIndex, setPinnedMessageIndex] = useState4(0);
|
819
|
-
const { removePinnedMessage } = usePinnedMessages();
|
820
|
-
const isMobile = useMedia4(config.media.md);
|
821
|
-
const { elements } = useRoomLayoutConferencingScreen();
|
822
|
-
const canUnpinMessage = !!((_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.allow_pinning_messages);
|
823
|
-
const [hideOverflow, setHideOverflow] = useState4(true);
|
824
|
-
const currentPinnedMessage = ((_b = pinnedMessages == null ? void 0 : pinnedMessages[pinnedMessageIndex]) == null ? void 0 : _b.text) || "";
|
825
|
-
const canOverflow = currentPinnedMessage.length > PINNED_MESSAGE_LENGTH;
|
826
|
-
const showPreviousPinnedMessage = () => {
|
827
|
-
const previousIndex = Math.max(pinnedMessageIndex - 1, 0);
|
828
|
-
setHideOverflow(pinnedMessages[previousIndex].text.length > PINNED_MESSAGE_LENGTH);
|
829
|
-
setPinnedMessageIndex(previousIndex);
|
830
|
-
};
|
831
|
-
const showNextPinnedMessage = () => {
|
832
|
-
const nextIndex = Math.min(pinnedMessageIndex + 1, pinnedMessages.length - 1);
|
833
|
-
setHideOverflow(pinnedMessages[nextIndex].text.length > PINNED_MESSAGE_LENGTH);
|
834
|
-
setPinnedMessageIndex(nextIndex);
|
835
|
-
};
|
836
|
-
const swipeHandlers = useSwipeable({
|
837
|
-
onSwipedUp: () => showNextPinnedMessage(),
|
838
|
-
onSwipedDown: () => showPreviousPinnedMessage()
|
839
|
-
});
|
840
|
-
useEffect3(() => {
|
841
|
-
const count = (pinnedMessages == null ? void 0 : pinnedMessages.length) || 1;
|
842
|
-
if (pinnedMessageIndex >= count) {
|
843
|
-
setPinnedMessageIndex(count - 1);
|
844
|
-
}
|
845
|
-
}, [pinnedMessageIndex, pinnedMessages]);
|
846
|
-
if (!pinnedMessages || pinnedMessages.length === 0) {
|
847
|
-
return null;
|
848
|
-
}
|
849
|
-
return /* @__PURE__ */ React7.createElement(Flex, { align: "center", css: { w: "100%", gap: "$4" } }, !isMobile ? /* @__PURE__ */ React7.createElement(
|
850
|
-
ArrowNavigation,
|
851
|
-
{
|
852
|
-
index: pinnedMessageIndex,
|
853
|
-
total: pinnedMessages.length,
|
854
|
-
showPrevious: showPreviousPinnedMessage,
|
855
|
-
showNext: showNextPinnedMessage
|
856
|
-
}
|
857
|
-
) : null, /* @__PURE__ */ React7.createElement(
|
858
|
-
Flex,
|
859
|
-
{
|
860
|
-
css: {
|
861
|
-
p: "$4",
|
862
|
-
color: "$on_surface_high",
|
863
|
-
bg: isMobile && ((_c = elements == null ? void 0 : elements.chat) == null ? void 0 : _c.is_overlay) ? "rgba(0, 0, 0, 0.64)" : "$surface_brighter",
|
864
|
-
r: "$1",
|
865
|
-
gap: "$4",
|
866
|
-
mb: "$8",
|
867
|
-
mt: "$8",
|
868
|
-
flexGrow: 1,
|
869
|
-
border: "1px solid $border_bright"
|
870
|
-
},
|
871
|
-
align: "center",
|
872
|
-
justify: "between"
|
873
|
-
},
|
874
|
-
isMobile ? /* @__PURE__ */ React7.createElement(StickIndicator, { index: pinnedMessageIndex, total: pinnedMessages.length }) : null,
|
875
|
-
/* @__PURE__ */ React7.createElement(
|
876
|
-
Box,
|
877
|
-
{
|
878
|
-
css: {
|
879
|
-
w: "100%",
|
880
|
-
maxHeight: "$18",
|
881
|
-
overflowY: "auto",
|
882
|
-
overflowX: "hidden",
|
883
|
-
wordBreak: "break-word",
|
884
|
-
"& p span": {
|
885
|
-
color: "$primary_default"
|
886
|
-
}
|
887
|
-
}
|
888
|
-
},
|
889
|
-
/* @__PURE__ */ React7.createElement(
|
890
|
-
Text,
|
891
|
-
__spreadProps(__spreadValues({
|
892
|
-
variant: "sm",
|
893
|
-
css: { color: "$on_surface_high" }
|
894
|
-
}, swipeHandlers), {
|
895
|
-
title: (_d = pinnedMessages[pinnedMessageIndex]) == null ? void 0 : _d.text
|
896
|
-
}),
|
897
|
-
/* @__PURE__ */ React7.createElement(
|
898
|
-
AnnotisedMessage,
|
899
|
-
{
|
900
|
-
message: currentPinnedMessage,
|
901
|
-
length: hideOverflow ? PINNED_MESSAGE_LENGTH : currentPinnedMessage.length
|
902
|
-
}
|
903
|
-
),
|
904
|
-
canOverflow ? /* @__PURE__ */ React7.createElement("span", { style: { cursor: "pointer" }, onClick: () => setHideOverflow((prev) => !prev) }, "\xA0", hideOverflow ? "... See more" : "Collapse") : null
|
905
|
-
)
|
906
|
-
),
|
907
|
-
canUnpinMessage ? /* @__PURE__ */ React7.createElement(
|
908
|
-
Flex,
|
909
|
-
{
|
910
|
-
onClick: () => {
|
911
|
-
removePinnedMessage(pinnedMessageIndex);
|
912
|
-
setPinnedMessageIndex(Math.max(0, pinnedMessageIndex - 1));
|
913
|
-
},
|
914
|
-
css: {
|
915
|
-
cursor: "pointer",
|
916
|
-
color: "$on_surface_medium",
|
917
|
-
"&:hover": { color: "$on_surface_high" },
|
918
|
-
"&:hover .hide-on-hover": { display: "none !important" },
|
919
|
-
"&:hover .show-on-hover": { display: "block !important" }
|
920
|
-
},
|
921
|
-
title: "Unpin Message"
|
922
|
-
},
|
923
|
-
/* @__PURE__ */ React7.createElement(UnpinIcon, { className: "show-on-hover", style: { display: "none" }, height: 20, width: 20 }),
|
924
|
-
/* @__PURE__ */ React7.createElement(PinIcon, { className: "hide-on-hover", style: { display: "block" }, height: 20, width: 20 })
|
925
|
-
) : null
|
926
|
-
));
|
927
|
-
};
|
928
|
-
|
929
|
-
// src/Prebuilt/components/Chat/Chat.tsx
|
930
|
-
var MoreSettings2 = React8.lazy(
|
931
|
-
() => import("./MoreSettings-WSHMMNOC.js").then((module) => ({ default: module.MoreSettings }))
|
932
|
-
);
|
933
|
-
var RaiseHand2 = React8.lazy(() => import("./RaiseHand-K7NFLH7H.js").then((module) => ({ default: module.RaiseHand })));
|
934
|
-
var EmojiReaction = React8.lazy(() => import("./EmojiReaction-23JDKJD4.js").then((module) => ({ default: module.EmojiReaction })));
|
935
|
-
var Chat = () => {
|
936
|
-
var _a, _b;
|
937
|
-
const { elements, screenType } = useRoomLayoutConferencingScreen();
|
938
|
-
const listRef = useRef3(null);
|
939
|
-
const hmsActions = useHMSActions4();
|
940
|
-
const vanillaStore = useHMSVanillaStore();
|
941
|
-
const { enabled: isChatEnabled = true } = useHMSStore6(Xm("chatState" /* CHAT_STATE */)) || {};
|
942
|
-
const isMobile = useMedia5(config.media.md);
|
943
|
-
const isMobileHLSStream = useMobileHLSStream();
|
944
|
-
const isLandscapeStream = useLandscapeHLSStream();
|
945
|
-
useSidepaneResetOnLayoutUpdate("chat", SIDE_PANE_OPTIONS.CHAT);
|
946
|
-
const isLocalPeerBlacklisted = useIsPeerBlacklisted({ local: true });
|
947
|
-
const scrollToBottom = useCallback4(
|
948
|
-
(unreadCount = 0) => {
|
949
|
-
var _a2;
|
950
|
-
if (listRef.current && listRef.current.scrollToItem && unreadCount > 0) {
|
951
|
-
const messagesCount = vanillaStore.getState(selectHMSMessagesCount);
|
952
|
-
(_a2 = listRef.current) == null ? void 0 : _a2.scrollToItem(messagesCount, "end");
|
953
|
-
requestAnimationFrame(() => {
|
954
|
-
var _a3;
|
955
|
-
(_a3 = listRef.current) == null ? void 0 : _a3.scrollToItem(messagesCount, "end");
|
956
|
-
});
|
957
|
-
hmsActions.setMessageRead(true);
|
958
|
-
}
|
959
|
-
},
|
960
|
-
[hmsActions, vanillaStore]
|
961
|
-
);
|
962
|
-
const streaming = isMobileHLSStream || isLandscapeStream;
|
963
|
-
return /* @__PURE__ */ React8.createElement(
|
964
|
-
Flex,
|
965
|
-
{
|
966
|
-
direction: "column",
|
967
|
-
justify: "end",
|
968
|
-
css: {
|
969
|
-
size: "100%",
|
970
|
-
gap: "$4"
|
971
|
-
}
|
972
|
-
},
|
973
|
-
isMobile && ((_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.is_overlay) && !streaming ? null : /* @__PURE__ */ React8.createElement(PinnedMessage, null),
|
974
|
-
/* @__PURE__ */ React8.createElement(ChatBody, { ref: listRef, scrollToBottom }),
|
975
|
-
/* @__PURE__ */ React8.createElement(Flex, { align: "center", css: { w: "100%", gap: "$2" } }, /* @__PURE__ */ React8.createElement(ChatPaused, null), /* @__PURE__ */ React8.createElement(ChatBlocked, null), streaming && (!isChatEnabled || isLocalPeerBlacklisted) && /* @__PURE__ */ React8.createElement(Suspense, { fallback: /* @__PURE__ */ React8.createElement(React8.Fragment, null) }, /* @__PURE__ */ React8.createElement(RaiseHand2, { css: { bg: "$surface_default" } }), /* @__PURE__ */ React8.createElement(MoreSettings2, { elements, screenType }))),
|
976
|
-
isMobile && ((_b = elements == null ? void 0 : elements.chat) == null ? void 0 : _b.is_overlay) && !streaming ? /* @__PURE__ */ React8.createElement(PinnedMessage, null) : null,
|
977
|
-
isChatEnabled ? /* @__PURE__ */ React8.createElement(ChatFooter, { onSend: scrollToBottom }, /* @__PURE__ */ React8.createElement(NewMessageIndicator, { scrollToBottom, listRef })) : null,
|
978
|
-
streaming && /* @__PURE__ */ React8.createElement(
|
979
|
-
Box,
|
980
|
-
{
|
981
|
-
css: __spreadValues({
|
982
|
-
position: "absolute"
|
983
|
-
}, match({ isLandscapeStream, isMobileHLSStream, isChatEnabled, isLocalPeerBlacklisted }).with(
|
984
|
-
{
|
985
|
-
isLandscapeStream: true,
|
986
|
-
isChatEnabled: true
|
987
|
-
},
|
988
|
-
() => ({ bottom: "$19", right: "$10" })
|
989
|
-
).with(
|
990
|
-
{
|
991
|
-
isLandscapeStream: true,
|
992
|
-
isChatEnabled: false
|
993
|
-
},
|
994
|
-
() => ({ bottom: "$20", right: "$10" })
|
995
|
-
).with(
|
996
|
-
{
|
997
|
-
isMobileHLSStream: true,
|
998
|
-
isChatEnabled: false
|
999
|
-
},
|
1000
|
-
() => ({ bottom: "$19", right: "$8" })
|
1001
|
-
).with(
|
1002
|
-
{
|
1003
|
-
isMobileHLSStream: true,
|
1004
|
-
isChatEnabled: true,
|
1005
|
-
isLocalPeerBlacklisted: false
|
1006
|
-
},
|
1007
|
-
() => ({ bottom: "$17", right: "$8" })
|
1008
|
-
).with(
|
1009
|
-
{
|
1010
|
-
isLandscapeStream: false,
|
1011
|
-
isChatEnabled: true,
|
1012
|
-
isLocalPeerBlacklisted: true
|
1013
|
-
},
|
1014
|
-
() => ({ bottom: "$18", right: "$8" })
|
1015
|
-
).with(
|
1016
|
-
{
|
1017
|
-
isMobileHLSStream: true,
|
1018
|
-
isLocalPeerBlacklisted: true
|
1019
|
-
},
|
1020
|
-
() => ({ bottom: "$20", right: "$8" })
|
1021
|
-
).otherwise(() => ({})))
|
1022
|
-
},
|
1023
|
-
/* @__PURE__ */ React8.createElement(Suspense, { fallback: /* @__PURE__ */ React8.createElement(React8.Fragment, null) }, /* @__PURE__ */ React8.createElement(EmojiReaction, null))
|
1024
|
-
)
|
1025
|
-
);
|
1026
|
-
};
|
1027
|
-
var NewMessageIndicator = ({
|
1028
|
-
scrollToBottom,
|
1029
|
-
listRef
|
1030
|
-
}) => {
|
1031
|
-
const unreadCount = useHMSStore6(Mm);
|
1032
|
-
if (!unreadCount || !listRef.current) {
|
1033
|
-
return null;
|
1034
|
-
}
|
1035
|
-
const outerElement = listRef.current._outerRef;
|
1036
|
-
if (outerElement && outerElement.clientHeight + outerElement.scrollTop + outerElement.offsetTop >= outerElement.scrollHeight) {
|
1037
|
-
return null;
|
1038
|
-
}
|
1039
|
-
return /* @__PURE__ */ React8.createElement(
|
1040
|
-
Flex,
|
1041
|
-
{
|
1042
|
-
justify: "center",
|
1043
|
-
css: {
|
1044
|
-
width: "100%",
|
1045
|
-
left: 0,
|
1046
|
-
bottom: "$28",
|
1047
|
-
position: "absolute"
|
1048
|
-
}
|
1049
|
-
},
|
1050
|
-
/* @__PURE__ */ React8.createElement(
|
1051
|
-
Button,
|
1052
|
-
{
|
1053
|
-
variant: "standard",
|
1054
|
-
onClick: () => {
|
1055
|
-
scrollToBottom(unreadCount);
|
1056
|
-
},
|
1057
|
-
icon: true,
|
1058
|
-
css: {
|
1059
|
-
p: "$3 $4",
|
1060
|
-
pl: "$6",
|
1061
|
-
"& > svg": { ml: "$4" },
|
1062
|
-
borderRadius: "$round",
|
1063
|
-
fontSize: "$xs",
|
1064
|
-
fontWeight: "$semiBold",
|
1065
|
-
c: "$on_secondary_high"
|
1066
|
-
}
|
1067
|
-
},
|
1068
|
-
"New ",
|
1069
|
-
unreadCount === 1 ? "message" : "messages",
|
1070
|
-
/* @__PURE__ */ React8.createElement(ChevronDownIcon3, { height: 16, width: 16 })
|
1071
|
-
)
|
1072
|
-
);
|
1073
|
-
};
|
1074
|
-
|
1075
|
-
// src/Prebuilt/components/Footer/PaginatedParticipants.tsx
|
1076
|
-
init_define_process_env();
|
1077
|
-
import React9, { useEffect as useEffect4, useState as useState5 } from "react";
|
1078
|
-
import { useInView } from "react-intersection-observer";
|
1079
|
-
import { useMeasure } from "react-use";
|
1080
|
-
import { VariableSizeList } from "react-window";
|
1081
|
-
import { selectIsConnectedToRoom, useHMSStore as useHMSStore7, usePaginatedParticipants } from "@100mslive/react-sdk";
|
1082
|
-
import { ChevronLeftIcon, CrossIcon as CrossIcon2 } from "@100mslive/react-icons";
|
1083
|
-
var LoadMoreParticipants = ({
|
1084
|
-
hasNext,
|
1085
|
-
loadMore,
|
1086
|
-
style
|
1087
|
-
}) => {
|
1088
|
-
const { ref, inView } = useInView();
|
1089
|
-
const [inProgress, setInProgress] = useState5(false);
|
1090
|
-
useEffect4(() => {
|
1091
|
-
if (hasNext && inView && !inProgress) {
|
1092
|
-
setInProgress(true);
|
1093
|
-
loadMore().catch(console.error).finally(() => setInProgress(false));
|
1094
|
-
}
|
1095
|
-
}, [hasNext, loadMore, inView, inProgress]);
|
1096
|
-
return /* @__PURE__ */ React9.createElement(Flex, { ref, style, align: "center", justify: "center" }, inProgress ? /* @__PURE__ */ React9.createElement(Loading, { size: 16 }) : null);
|
1097
|
-
};
|
1098
|
-
var VirtualizedParticipantItem = React9.memo(
|
1099
|
-
({
|
1100
|
-
index,
|
1101
|
-
data: data2,
|
1102
|
-
style
|
1103
|
-
}) => {
|
1104
|
-
if (!data2.peerList[index]) {
|
1105
|
-
return /* @__PURE__ */ React9.createElement(LoadMoreParticipants, { hasNext: data2.hasNext, loadMore: data2.loadMorePeers, style });
|
1106
|
-
}
|
1107
|
-
return /* @__PURE__ */ React9.createElement(
|
1108
|
-
Participant,
|
1109
|
-
{
|
1110
|
-
key: data2.peerList[index].id,
|
1111
|
-
peer: data2.peerList[index],
|
1112
|
-
isConnected: data2.isConnected,
|
1113
|
-
style
|
1114
|
-
}
|
1115
|
-
);
|
1116
|
-
}
|
1117
|
-
);
|
1118
|
-
var PaginatedParticipants = ({ roleName, onBack }) => {
|
1119
|
-
const { peers, total, hasNext, loadPeers, loadMorePeers } = usePaginatedParticipants({ role: roleName, limit: 20 });
|
1120
|
-
const [search, setSearch] = useState5("");
|
1121
|
-
const filteredPeers = peers.filter((p) => {
|
1122
|
-
var _a;
|
1123
|
-
return (_a = p.name) == null ? void 0 : _a.toLowerCase().includes(search == null ? void 0 : search.toLowerCase());
|
1124
|
-
});
|
1125
|
-
const isConnected = useHMSStore7(selectIsConnectedToRoom);
|
1126
|
-
const [ref, { width }] = useMeasure();
|
1127
|
-
const height = ROW_HEIGHT * (filteredPeers.length + 1);
|
1128
|
-
const resetSidePane = useSidepaneReset();
|
1129
|
-
useEffect4(() => {
|
1130
|
-
loadPeers();
|
1131
|
-
}, []);
|
1132
|
-
return /* @__PURE__ */ React9.createElement(Flex, { ref, direction: "column", css: { size: "100%", gap: "$4" } }, /* @__PURE__ */ React9.createElement(Flex, { align: "center" }, /* @__PURE__ */ React9.createElement(Flex, { align: "center", css: { flex: "1 1 0", cursor: "pointer" }, onClick: onBack }, /* @__PURE__ */ React9.createElement(ChevronLeftIcon, null), /* @__PURE__ */ React9.createElement(Text, { variant: "lg", css: { flex: "1 1 0" } }, "Participants")), /* @__PURE__ */ React9.createElement(
|
1133
|
-
IconButton,
|
1134
|
-
{
|
1135
|
-
onClick: (e) => {
|
1136
|
-
e.stopPropagation();
|
1137
|
-
resetSidePane();
|
1138
|
-
},
|
1139
|
-
"data-testid": "close_sidepane"
|
1140
|
-
},
|
1141
|
-
/* @__PURE__ */ React9.createElement(CrossIcon2, null)
|
1142
|
-
)), /* @__PURE__ */ React9.createElement(ParticipantSearch, { onSearch: (search2) => setSearch(search2), placeholder: `Search for ${roleName}` }), /* @__PURE__ */ React9.createElement(Flex, { direction: "column", css: { border: "1px solid $border_default", borderRadius: "$1", flex: "1 1 0" } }, /* @__PURE__ */ React9.createElement(Flex, { align: "center", css: { height: ROW_HEIGHT, borderBottom: "1px solid $border_default", px: "$8" } }, /* @__PURE__ */ React9.createElement(Text, { css: { fontSize: "$space$7" } }, roleName, "(", getFormattedCount(peers.length), "/", getFormattedCount(total), ")")), /* @__PURE__ */ React9.createElement(Box, { css: { flex: "1 1 0", overflowY: "auto", overflowX: "hidden", mr: "-$10" } }, /* @__PURE__ */ React9.createElement(
|
1143
|
-
VariableSizeList,
|
1144
|
-
{
|
1145
|
-
itemSize: (index) => index === filteredPeers.length + 1 ? 16 : ROW_HEIGHT,
|
1146
|
-
itemData: { peerList: filteredPeers, hasNext: hasNext(), loadMorePeers, isConnected: isConnected === true },
|
1147
|
-
itemKey,
|
1148
|
-
itemCount: filteredPeers.length + 1,
|
1149
|
-
width,
|
1150
|
-
height
|
1151
|
-
},
|
1152
|
-
VirtualizedParticipantItem
|
1153
|
-
))));
|
1154
|
-
};
|
1155
|
-
|
1156
|
-
// src/Prebuilt/components/ChatSettings.tsx
|
1157
|
-
init_define_process_env();
|
1158
|
-
import React10 from "react";
|
1159
|
-
import { selectLocalPeer as selectLocalPeer3, selectSessionStore as selectSessionStore3, useHMSActions as useHMSActions5, useHMSStore as useHMSStore8 } from "@100mslive/react-sdk";
|
1160
|
-
import { PauseCircleIcon as PauseCircleIcon2, SettingsIcon } from "@100mslive/react-icons";
|
1161
|
-
var ChatSettings = () => {
|
1162
|
-
var _a, _b;
|
1163
|
-
const hmsActions = useHMSActions5();
|
1164
|
-
const localPeer = useHMSStore8(selectLocalPeer3);
|
1165
|
-
const { elements } = useRoomLayoutConferencingScreen();
|
1166
|
-
const canPauseChat = !!((_b = (_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.real_time_controls) == null ? void 0 : _b.can_disable_chat);
|
1167
|
-
const { enabled: isChatEnabled = true } = useHMSStore8(selectSessionStore3("chatState" /* CHAT_STATE */)) || {};
|
1168
|
-
const showPause = canPauseChat && isChatEnabled;
|
1169
|
-
if (!showPause) {
|
1170
|
-
return null;
|
1171
|
-
}
|
1172
|
-
return /* @__PURE__ */ React10.createElement(Popover.Root, null, /* @__PURE__ */ React10.createElement(Popover.Trigger, { asChild: true, css: { px: "$4" } }, /* @__PURE__ */ React10.createElement(
|
1173
|
-
Flex,
|
1174
|
-
{
|
1175
|
-
align: "center",
|
1176
|
-
css: { color: "$on_surface_medium", "&:hover": { color: "$on_surface_high" }, cursor: "pointer" }
|
1177
|
-
},
|
1178
|
-
/* @__PURE__ */ React10.createElement(SettingsIcon, null)
|
1179
|
-
)), /* @__PURE__ */ React10.createElement(Popover.Portal, null, /* @__PURE__ */ React10.createElement(
|
1180
|
-
Popover.Content,
|
1181
|
-
{
|
1182
|
-
align: "end",
|
1183
|
-
side: "bottom",
|
1184
|
-
sideOffset: 2,
|
1185
|
-
onClick: () => {
|
1186
|
-
const chatState = {
|
1187
|
-
enabled: false,
|
1188
|
-
updatedBy: {
|
1189
|
-
peerId: localPeer == null ? void 0 : localPeer.id,
|
1190
|
-
userId: localPeer == null ? void 0 : localPeer.customerUserId,
|
1191
|
-
userName: localPeer == null ? void 0 : localPeer.name
|
1192
|
-
},
|
1193
|
-
updatedAt: Date.now()
|
1194
|
-
};
|
1195
|
-
hmsActions.sessionStore.set("chatState" /* CHAT_STATE */, chatState);
|
1196
|
-
},
|
1197
|
-
css: {
|
1198
|
-
backgroundColor: "$surface_default",
|
1199
|
-
display: "flex",
|
1200
|
-
alignItems: "center",
|
1201
|
-
gap: "$4",
|
1202
|
-
borderRadius: "$1",
|
1203
|
-
color: "$on_surface_high",
|
1204
|
-
cursor: "pointer",
|
1205
|
-
"&:hover": { backgroundColor: "$surface_dim" }
|
1206
|
-
}
|
1207
|
-
},
|
1208
|
-
/* @__PURE__ */ React10.createElement(PauseCircleIcon2, null),
|
1209
|
-
/* @__PURE__ */ React10.createElement(Text, { variant: "sm", css: { fontWeight: "$semiBold" } }, "Pause Chat")
|
1210
|
-
)));
|
1211
|
-
};
|
1212
|
-
|
1213
|
-
// src/Prebuilt/components/SidePaneTabs.tsx
|
1214
|
-
var tabTriggerCSS = {
|
1215
|
-
color: "$on_surface_low",
|
1216
|
-
p: "$4",
|
1217
|
-
fontWeight: "$semiBold",
|
1218
|
-
fontSize: "$sm",
|
1219
|
-
w: "100%",
|
1220
|
-
justifyContent: "center",
|
1221
|
-
'&[data-state="active"]': {
|
1222
|
-
color: "$on_surface_high"
|
1223
|
-
}
|
1224
|
-
};
|
1225
|
-
var ParticipantCount = ({ count }) => {
|
1226
|
-
return count < 1e3 ? /* @__PURE__ */ React11.createElement("span", null, "(", count, ")") : /* @__PURE__ */ React11.createElement(Tooltip, { title: count }, /* @__PURE__ */ React11.createElement("span", null, "(", getFormattedCount(count), ")"));
|
1227
|
-
};
|
1228
|
-
var SidePaneTabs = React11.memo(({ active = SIDE_PANE_OPTIONS.CHAT, hideTab = false }) => {
|
1229
|
-
var _a, _b;
|
1230
|
-
const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
|
1231
|
-
const toggleParticipants = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
|
1232
|
-
const resetSidePane = useSidepaneReset();
|
1233
|
-
const [activeTab, setActiveTab] = useState6(active);
|
1234
|
-
const [activeRole, setActiveRole] = useState6("");
|
1235
|
-
const peerCount = useHMSStore9(selectPeerCount);
|
1236
|
-
const { elements, screenType } = useRoomLayoutConferencingScreen();
|
1237
|
-
const chat_title = ((_a = elements == null ? void 0 : elements.chat) == null ? void 0 : _a.chat_title) || "Chat";
|
1238
|
-
const showChat = !!(elements == null ? void 0 : elements.chat);
|
1239
|
-
const showParticipants = !!(elements == null ? void 0 : elements.participant_list);
|
1240
|
-
const hideTabs = !(showChat && showParticipants) || hideTab;
|
1241
|
-
const isMobile = useMedia6(config.media.md);
|
1242
|
-
const isOverlayChat = !!((_b = elements == null ? void 0 : elements.chat) == null ? void 0 : _b.is_overlay) && isMobile;
|
1243
|
-
const { off_stage_roles = [] } = (elements == null ? void 0 : elements.on_stage_exp) || {};
|
1244
|
-
const isChatOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.CHAT);
|
1245
|
-
const showChatSettings = showChat && isChatOpen && (!isMobile || !isOverlayChat);
|
1246
|
-
useEffect5(() => {
|
1247
|
-
match2({ activeTab, showChat, showParticipants }).with({ activeTab: SIDE_PANE_OPTIONS.CHAT, showChat: false, showParticipants: true }, () => {
|
1248
|
-
setActiveTab(SIDE_PANE_OPTIONS.PARTICIPANTS);
|
1249
|
-
}).with({ activeTab: SIDE_PANE_OPTIONS.PARTICIPANTS, showChat: true, showParticipants: false }, () => {
|
1250
|
-
setActiveTab(SIDE_PANE_OPTIONS.CHAT);
|
1251
|
-
}).with({ showChat: false, showParticipants: false }, () => {
|
1252
|
-
resetSidePane();
|
1253
|
-
});
|
1254
|
-
}, [showChat, activeTab, showParticipants, resetSidePane]);
|
1255
|
-
useEffect5(() => {
|
1256
|
-
setActiveTab(active);
|
1257
|
-
}, [active]);
|
1258
|
-
if (activeRole) {
|
1259
|
-
return /* @__PURE__ */ React11.createElement(
|
1260
|
-
Flex,
|
1261
|
-
{
|
1262
|
-
direction: "column",
|
1263
|
-
css: {
|
1264
|
-
color: "$on_primary_high",
|
1265
|
-
h: "100%",
|
1266
|
-
transition: "margin 0.3s ease-in-out",
|
1267
|
-
position: "relative"
|
1268
|
-
}
|
1269
|
-
},
|
1270
|
-
/* @__PURE__ */ React11.createElement(Box, { css: { position: "absolute", left: 0, top: 0, size: "100%", zIndex: 21, bg: "$surface_dim" } }, /* @__PURE__ */ React11.createElement(PaginatedParticipants, { roleName: activeRole, onBack: () => setActiveRole("") }))
|
1271
|
-
);
|
1272
|
-
}
|
1273
|
-
return /* @__PURE__ */ React11.createElement(
|
1274
|
-
Flex,
|
1275
|
-
{
|
1276
|
-
direction: "column",
|
1277
|
-
css: {
|
1278
|
-
color: "$on_primary_high",
|
1279
|
-
h: "100%",
|
1280
|
-
transition: "margin 0.3s ease-in-out"
|
1281
|
-
}
|
1282
|
-
},
|
1283
|
-
match2({ isOverlayChat, isChatOpen, showChat, hideTabs }).with({ isOverlayChat: true, isChatOpen: true, showChat: true }, () => /* @__PURE__ */ React11.createElement(Chat, null)).with({ hideTabs: true }, () => {
|
1284
|
-
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(Flex, { justify: "between", css: { w: "100%", "&:empty": { display: "none" } } }, /* @__PURE__ */ React11.createElement(
|
1285
|
-
Text,
|
1286
|
-
{
|
1287
|
-
variant: "sm",
|
1288
|
-
css: {
|
1289
|
-
fontWeight: "$semiBold",
|
1290
|
-
p: "$4",
|
1291
|
-
c: "$on_surface_high",
|
1292
|
-
pr: "$12",
|
1293
|
-
"&:empty": { display: "none" }
|
1294
|
-
}
|
1295
|
-
},
|
1296
|
-
activeTab === SIDE_PANE_OPTIONS.CHAT ? screenType !== "hls_live_streaming" && chat_title : /* @__PURE__ */ React11.createElement("span", null, "Participants\xA0", /* @__PURE__ */ React11.createElement(ParticipantCount, { count: peerCount }))
|
1297
|
-
), /* @__PURE__ */ React11.createElement(Flex, null, showChatSettings ? /* @__PURE__ */ React11.createElement(ChatSettings, null) : null, isOverlayChat && isChatOpen ? null : /* @__PURE__ */ React11.createElement(
|
1298
|
-
IconButton,
|
1299
|
-
{
|
1300
|
-
css: {
|
1301
|
-
my: "$1",
|
1302
|
-
color: "$on_surface_medium",
|
1303
|
-
"&:hover": { color: "$on_surface_high" },
|
1304
|
-
"&:empty": { display: "none" }
|
1305
|
-
},
|
1306
|
-
onClick: (e) => {
|
1307
|
-
e.stopPropagation();
|
1308
|
-
if (activeTab === SIDE_PANE_OPTIONS.CHAT) {
|
1309
|
-
toggleChat();
|
1310
|
-
} else {
|
1311
|
-
toggleParticipants();
|
1312
|
-
}
|
1313
|
-
},
|
1314
|
-
"data-testid": "close_chat"
|
1315
|
-
},
|
1316
|
-
screenType === "hls_live_streaming" && isChatOpen ? null : /* @__PURE__ */ React11.createElement(CrossIcon3, null)
|
1317
|
-
))), activeTab === SIDE_PANE_OPTIONS.CHAT ? /* @__PURE__ */ React11.createElement(Chat, null) : /* @__PURE__ */ React11.createElement(ParticipantList, { offStageRoles: off_stage_roles, onActive: setActiveRole }));
|
1318
|
-
}).otherwise(() => {
|
1319
|
-
return /* @__PURE__ */ React11.createElement(
|
1320
|
-
Tabs.Root,
|
1321
|
-
{
|
1322
|
-
value: activeTab,
|
1323
|
-
onValueChange: setActiveTab,
|
1324
|
-
css: {
|
1325
|
-
flexDirection: "column",
|
1326
|
-
size: "100%"
|
1327
|
-
}
|
1328
|
-
},
|
1329
|
-
/* @__PURE__ */ React11.createElement(Flex, { css: { w: "100%" } }, /* @__PURE__ */ React11.createElement(Tabs.List, { css: { flexGrow: 1, borderRadius: "$2", bg: "$surface_default" } }, /* @__PURE__ */ React11.createElement(Tabs.Trigger, { value: SIDE_PANE_OPTIONS.CHAT, onClick: toggleChat, css: tabTriggerCSS }, chat_title), /* @__PURE__ */ React11.createElement(Tabs.Trigger, { value: SIDE_PANE_OPTIONS.PARTICIPANTS, onClick: toggleParticipants, css: tabTriggerCSS }, "Participants\xA0", /* @__PURE__ */ React11.createElement(ParticipantCount, { count: peerCount }))), showChatSettings ? /* @__PURE__ */ React11.createElement(ChatSettings, null) : null, isOverlayChat && isChatOpen ? null : /* @__PURE__ */ React11.createElement(
|
1330
|
-
IconButton,
|
1331
|
-
{
|
1332
|
-
css: { my: "$1", color: "$on_surface_medium", "&:hover": { color: "$on_surface_high" } },
|
1333
|
-
onClick: (e) => {
|
1334
|
-
e.stopPropagation();
|
1335
|
-
if (activeTab === SIDE_PANE_OPTIONS.CHAT) {
|
1336
|
-
toggleChat();
|
1337
|
-
} else {
|
1338
|
-
toggleParticipants();
|
1339
|
-
}
|
1340
|
-
},
|
1341
|
-
"data-testid": "close_chat"
|
1342
|
-
},
|
1343
|
-
/* @__PURE__ */ React11.createElement(CrossIcon3, null)
|
1344
|
-
)),
|
1345
|
-
/* @__PURE__ */ React11.createElement(Tabs.Content, { value: SIDE_PANE_OPTIONS.PARTICIPANTS, css: { p: 0 } }, /* @__PURE__ */ React11.createElement(ParticipantList, { offStageRoles: off_stage_roles, onActive: setActiveRole })),
|
1346
|
-
/* @__PURE__ */ React11.createElement(Tabs.Content, { value: SIDE_PANE_OPTIONS.CHAT, css: { p: 0 } }, /* @__PURE__ */ React11.createElement(Chat, null))
|
1347
|
-
);
|
1348
|
-
})
|
1349
|
-
);
|
1350
|
-
});
|
1351
|
-
export {
|
1352
|
-
SidePaneTabs
|
1353
|
-
};
|
1354
|
-
//# sourceMappingURL=SidePaneTabs-NXHBI2JB.js.map
|