@100mslive/roomkit-react 0.1.20-alpha.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +27 -2
  2. package/dist/{HLSView-BWR4T6PI.js → HLSView-ULB4DC6B.js} +2 -2
  3. package/dist/Input/Input.d.ts +3 -3
  4. package/dist/Prebuilt/components/Chat/ChatActions.d.ts +2 -1
  5. package/dist/Prebuilt/components/Polls/CreateQuestions/DeleteQuestionModal.d.ts +6 -0
  6. package/dist/Prebuilt/components/Polls/CreateQuestions/QuestionForm.d.ts +22 -0
  7. package/dist/Prebuilt/components/Polls/CreateQuestions/SavedQuestion.d.ts +11 -0
  8. package/dist/Prebuilt/components/Polls/Voting/StandardVoting.d.ts +5 -0
  9. package/dist/Prebuilt/components/Polls/Voting/TimedVoting.d.ts +5 -0
  10. package/dist/Prebuilt/components/Polls/Voting/Voting.d.ts +5 -0
  11. package/dist/Prebuilt/components/Polls/common/Line.d.ts +2 -0
  12. package/dist/Prebuilt/components/Polls/common/OptionInputWithDelete.d.ts +8 -0
  13. package/dist/Prebuilt/components/Polls/common/StatusIndicator.d.ts +4 -0
  14. package/dist/Prebuilt/components/Polls/common/VoteCount.d.ts +4 -0
  15. package/dist/Prebuilt/components/Polls/common/VoteProgress.d.ts +6 -0
  16. package/dist/Prebuilt/components/Polls/common/VoterList.d.ts +4 -0
  17. package/dist/Prebuilt/components/TileMenu/utils.d.ts +5 -0
  18. package/dist/Prebuilt/components/hooks/usePinnedBy.d.ts +1 -0
  19. package/dist/Prebuilt/components/hooks/{useSetPinnedMessages.d.ts → usePinnedMessages.d.ts} +6 -1
  20. package/dist/TextArea/TextArea.d.ts +441 -0
  21. package/dist/TextArea/index.d.ts +1 -0
  22. package/dist/Toast/Toast.d.ts +1 -1
  23. package/dist/{chunk-SYBH2G3R.js → chunk-GVA4I77Z.js} +2802 -2740
  24. package/dist/chunk-GVA4I77Z.js.map +7 -0
  25. package/dist/index.cjs.js +3035 -2967
  26. package/dist/index.cjs.js.map +4 -4
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.js +3 -1
  29. package/dist/meta.cjs.json +476 -394
  30. package/dist/meta.esbuild.json +486 -402
  31. package/package.json +7 -8
  32. package/src/Button/Button.tsx +4 -4
  33. package/src/Input/Input.tsx +1 -1
  34. package/src/Prebuilt/components/Chat/ChatActions.tsx +25 -8
  35. package/src/Prebuilt/components/Chat/ChatBody.tsx +64 -21
  36. package/src/Prebuilt/components/Chat/ChatFooter.tsx +1 -0
  37. package/src/Prebuilt/components/Chat/PinnedMessage.tsx +2 -2
  38. package/src/Prebuilt/components/Header/AdditionalRoomState.jsx +1 -38
  39. package/src/Prebuilt/components/Header/StreamActions.tsx +1 -1
  40. package/src/Prebuilt/components/Polls/CreatePollQuiz/PollsQuizMenu.jsx +11 -1
  41. package/src/Prebuilt/components/Polls/CreateQuestions/{DeleteQuestionModal.jsx → DeleteQuestionModal.tsx} +9 -1
  42. package/src/Prebuilt/components/Polls/CreateQuestions/{QuestionForm.jsx → QuestionForm.tsx} +71 -30
  43. package/src/Prebuilt/components/Polls/CreateQuestions/{SavedQuestion.jsx → SavedQuestion.tsx} +24 -15
  44. package/src/Prebuilt/components/Polls/Voting/LeaderboardSummary.tsx +1 -1
  45. package/src/Prebuilt/components/Polls/Voting/QuestionCard.jsx +61 -80
  46. package/src/Prebuilt/components/Polls/Voting/{StandardVoting.jsx → StandardVoting.tsx} +3 -7
  47. package/src/Prebuilt/components/Polls/Voting/{TimedVoting.jsx → TimedVoting.tsx} +4 -7
  48. package/src/Prebuilt/components/Polls/Voting/{Voting.jsx → Voting.tsx} +4 -3
  49. package/src/Prebuilt/components/Polls/common/Line.tsx +4 -0
  50. package/src/Prebuilt/components/Polls/common/{OptionInputWithDelete.jsx → OptionInputWithDelete.tsx} +14 -2
  51. package/src/Prebuilt/components/Polls/common/SingleChoiceOptions.jsx +1 -1
  52. package/src/Prebuilt/components/Polls/common/{StatusIndicator.jsx → StatusIndicator.tsx} +1 -2
  53. package/src/Prebuilt/components/Polls/common/{VoteCount.jsx → VoteCount.tsx} +1 -2
  54. package/src/Prebuilt/components/Polls/common/{VoteProgress.jsx → VoteProgress.tsx} +3 -2
  55. package/src/Prebuilt/components/Polls/common/{VoterList.jsx → VoterList.tsx} +1 -1
  56. package/src/Prebuilt/components/TileMenu/TileMenu.jsx +3 -1
  57. package/src/Prebuilt/components/TileMenu/TileMenuContent.tsx +15 -3
  58. package/src/Prebuilt/components/TileMenu/utils.ts +7 -0
  59. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +7 -3
  60. package/src/Prebuilt/components/VideoTile.jsx +2 -4
  61. package/src/Prebuilt/components/hooks/usePinnedBy.tsx +22 -0
  62. package/src/Prebuilt/components/hooks/{useSetPinnedMessages.ts → usePinnedMessages.ts} +2 -2
  63. package/src/Prebuilt/components/hooks/useUnreadPollQuizPresent.tsx +1 -4
  64. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +0 -1
  65. package/src/TextArea/TextArea.tsx +30 -0
  66. package/src/TextArea/index.tsx +1 -0
  67. package/src/index.ts +1 -0
  68. package/src/store/StorybookSDK.ts +3 -1
  69. package/dist/Prebuilt/plugins/whiteboard/ToggleWhiteboard.d.ts +0 -5
  70. package/dist/chunk-SYBH2G3R.js.map +0 -7
  71. package/src/Prebuilt/components/Polls/common/Votes.jsx +0 -72
  72. package/src/Prebuilt/layouts/WhiteboardView.jsx +0 -40
  73. package/src/Prebuilt/plugins/whiteboard/PusherCommunicationProvider.js +0 -110
  74. package/src/Prebuilt/plugins/whiteboard/README.md +0 -29
  75. package/src/Prebuilt/plugins/whiteboard/ToggleWhiteboard.tsx +0 -37
  76. package/src/Prebuilt/plugins/whiteboard/Whiteboard.css +0 -12
  77. package/src/Prebuilt/plugins/whiteboard/Whiteboard.jsx +0 -11
  78. package/src/Prebuilt/plugins/whiteboard/WhiteboardEvents.js +0 -8
  79. package/src/Prebuilt/plugins/whiteboard/index.js +0 -3
  80. package/src/Prebuilt/plugins/whiteboard/useMultiplayerState.js +0 -212
  81. package/src/Prebuilt/plugins/whiteboard/useWhiteboardMetadata.js +0 -47
  82. /package/dist/{HLSView-BWR4T6PI.js.map → HLSView-ULB4DC6B.js.map} +0 -0
@@ -38,6 +38,7 @@ import { ToastManager } from '../Toast/ToastManager';
38
38
  import { useSetAppDataByKey } from '../AppData/useUISettings';
39
39
  // @ts-ignore
40
40
  import { useDropdownSelection } from '../hooks/useDropdownSelection';
41
+ import { getDragClassName } from './utils';
41
42
  import { APP_DATA, REMOTE_STOP_SCREENSHARE_TYPE, SESSION_STORE_KEY } from '../../common/constants';
42
43
 
43
44
  export const isSameTile = ({
@@ -64,6 +65,7 @@ const SpotlightActions = ({
64
65
  const hmsActions = useHMSActions();
65
66
  const spotlightPeerId = useHMSStore(selectSessionStore(SESSION_STORE_KEY.SPOTLIGHT));
66
67
  const isTileSpotlighted = spotlightPeerId === peerId;
68
+ const dragClassName = getDragClassName();
67
69
 
68
70
  const setSpotlightPeerId = (peerIdToSpotlight?: string) =>
69
71
  hmsActions.sessionStore
@@ -72,6 +74,7 @@ const SpotlightActions = ({
72
74
 
73
75
  return (
74
76
  <StyledMenuTile.ItemButton
77
+ className={dragClassName}
75
78
  css={spacingCSS}
76
79
  onClick={() => {
77
80
  if (isTileSpotlighted) {
@@ -90,6 +93,7 @@ const SpotlightActions = ({
90
93
 
91
94
  const PinActions = ({ audioTrackID, videoTrackID }: { videoTrackID: string; audioTrackID: string }) => {
92
95
  const [pinnedTrackId, setPinnedTrackId] = useSetAppDataByKey(APP_DATA.pinnedTrackId);
96
+ const dragClassName = getDragClassName();
93
97
 
94
98
  const isTilePinned = isSameTile({
95
99
  trackId: pinnedTrackId,
@@ -100,6 +104,7 @@ const PinActions = ({ audioTrackID, videoTrackID }: { videoTrackID: string; audi
100
104
  return (
101
105
  <>
102
106
  <StyledMenuTile.ItemButton
107
+ className={dragClassName}
103
108
  css={spacingCSS}
104
109
  onClick={() => (isTilePinned ? setPinnedTrackId() : setPinnedTrackId(videoTrackID || audioTrackID))}
105
110
  >
@@ -112,10 +117,11 @@ const PinActions = ({ audioTrackID, videoTrackID }: { videoTrackID: string; audi
112
117
 
113
118
  const MinimiseInset = () => {
114
119
  const [minimised, setMinimised] = useSetAppDataByKey(APP_DATA.minimiseInset);
120
+ const dragClassName = getDragClassName();
115
121
 
116
122
  return (
117
123
  <>
118
- <StyledMenuTile.ItemButton css={spacingCSS} onClick={() => setMinimised(!minimised)}>
124
+ <StyledMenuTile.ItemButton className={dragClassName} css={spacingCSS} onClick={() => setMinimised(!minimised)}>
119
125
  <ShrinkIcon height={20} width={20} />
120
126
  <span>{minimised ? 'Show' : 'Minimise'} your video</span>
121
127
  </StyledMenuTile.ItemButton>
@@ -131,14 +137,16 @@ const SimulcastLayers = ({ trackId }: { trackId: HMSTrackID }) => {
131
137
  return null;
132
138
  }
133
139
  const currentLayer = track.layerDefinitions.find((layer: HMSSimulcastLayerDefinition) => layer.layer === track.layer);
140
+ const dragClassName = getDragClassName();
134
141
  return (
135
142
  <Fragment>
136
- <StyledMenuTile.ItemButton css={{ color: '$on_surface_medium', cursor: 'default' }}>
143
+ <StyledMenuTile.ItemButton className={dragClassName} css={{ color: '$on_surface_medium', cursor: 'default' }}>
137
144
  Select maximum resolution
138
145
  </StyledMenuTile.ItemButton>
139
146
  {track.layerDefinitions.map((layer: HMSSimulcastLayerDefinition) => {
140
147
  return (
141
148
  <StyledMenuTile.ItemButton
149
+ className={dragClassName}
142
150
  key={layer.layer}
143
151
  onClick={async () => {
144
152
  await actions.setPreferredLayer(trackId, layer.layer);
@@ -174,7 +182,7 @@ const SimulcastLayers = ({ trackId }: { trackId: HMSTrackID }) => {
174
182
  </StyledMenuTile.ItemButton>
175
183
  );
176
184
  })}
177
- <StyledMenuTile.ItemButton>
185
+ <StyledMenuTile.ItemButton className={dragClassName}>
178
186
  <Text as="span" variant="xs" css={{ color: '$on_surface_medium' }}>
179
187
  Currently streaming:
180
188
  <Text
@@ -229,6 +237,7 @@ export const TileMenuContent = ({
229
237
  openNameChangeModal: () => void;
230
238
  }) => {
231
239
  const actions = useHMSActions();
240
+ const dragClassName = getDragClassName();
232
241
  const removeOthers: boolean | undefined = useHMSStore(selectPermissions)?.removeOthers;
233
242
  const { userName } = useHMSPrebuiltContext();
234
243
 
@@ -251,6 +260,7 @@ export const TileMenuContent = ({
251
260
  {canMinimise && <MinimiseInset />}
252
261
  {!userName && (
253
262
  <StyledMenuTile.ItemButton
263
+ className={dragClassName}
254
264
  onClick={() => {
255
265
  openNameChangeModal();
256
266
  closeSheetOnClick();
@@ -268,6 +278,7 @@ export const TileMenuContent = ({
268
278
  <>
269
279
  {toggleVideo ? (
270
280
  <StyledMenuTile.ItemButton
281
+ className={dragClassName}
271
282
  css={spacingCSS}
272
283
  onClick={() => {
273
284
  toggleVideo();
@@ -283,6 +294,7 @@ export const TileMenuContent = ({
283
294
  {toggleAudio ? (
284
295
  <StyledMenuTile.ItemButton
285
296
  css={spacingCSS}
297
+ className={dragClassName}
286
298
  onClick={() => {
287
299
  toggleAudio();
288
300
  closeSheetOnClick();
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Add __cancel-drag-event for the menu to open on touch devices on the draggdable element
3
+ *
4
+ */
5
+ export const getDragClassName = () => {
6
+ return navigator?.maxTouchPoints > 0 ? '__cancel-drag-event' : '';
7
+ };
@@ -1,6 +1,7 @@
1
1
  import React, { useEffect, useMemo, useState } from 'react';
2
2
  import { GridVideoTileLayout } from '@100mslive/types-prebuilt/elements/video_tile_layout';
3
3
  import {
4
+ selectLocalPeerID,
4
5
  selectLocalPeerRoleName,
5
6
  selectPeers,
6
7
  selectPeerScreenSharing,
@@ -42,6 +43,8 @@ export const GridLayout = ({
42
43
  const pinnedTrack = usePinnedTrack();
43
44
  const peers = useHMSStore(selectPeers);
44
45
  const localPeerRole = useHMSStore(selectLocalPeerRoleName);
46
+ const localPeerID = useHMSStore(selectLocalPeerID);
47
+
45
48
  const [activeScreensharePeerId] = useSetAppDataByKey(APP_DATA.activeScreensharePeerId);
46
49
  const isRoleProminence =
47
50
  (prominentRoles.length &&
@@ -55,15 +58,16 @@ export const GridLayout = ({
55
58
  return peers.filter(peer => peer.id !== activeScreensharePeerId);
56
59
  }
57
60
  if (isInsetEnabled) {
58
- // if localPeer role is prominent role, it shows up in the center, so allow it in active speaker sorting
59
- if (localPeerRole && prominentRoles.includes(localPeerRole)) {
61
+ const isLocalPeerPinned = localPeerID === pinnedTrack?.peerId;
62
+ // if localPeer role is prominent role, it shows up in the center or local peer is pinned, so allow it in active speaker sorting
63
+ if ((localPeerRole && prominentRoles.includes(localPeerRole)) || isLocalPeerPinned) {
60
64
  return peers;
61
65
  } else {
62
66
  return peers.filter(peer => !peer.isLocal);
63
67
  }
64
68
  }
65
69
  return peers;
66
- }, [isInsetEnabled, activeScreensharePeerId, localPeerRole, prominentRoles, peers]);
70
+ }, [isInsetEnabled, activeScreensharePeerId, localPeerRole, localPeerID, prominentRoles, peers, pinnedTrack]);
67
71
  const vanillaStore = useHMSVanillaStore();
68
72
  const [sortedPeers, setSortedPeers] = useState(updatedPeers);
69
73
  const peersSorter = useMemo(() => new PeersSorter(vanillaStore), [vanillaStore]);
@@ -1,5 +1,5 @@
1
1
  import React, { Fragment, useCallback, useMemo, useState } from 'react';
2
- import { useMeasure, useMedia } from 'react-use';
2
+ import { useMeasure } from 'react-use';
3
3
  import {
4
4
  selectAudioTrackByPeerID,
5
5
  selectHasPeerHandRaised,
@@ -18,7 +18,6 @@ import TileMenu, { isSameTile } from './TileMenu/TileMenu';
18
18
  import { AudioLevel } from '../../AudioLevel';
19
19
  import { Avatar } from '../../Avatar';
20
20
  import { VideoTileStats } from '../../Stats';
21
- import { config as cssConfig } from '../../Theme';
22
21
  import { Video } from '../../Video';
23
22
  import { StyledVideoTile } from '../../VideoTile';
24
23
  import { getVideoTileLabel } from './peerTileUtils';
@@ -44,7 +43,6 @@ const Tile = ({
44
43
  }) => {
45
44
  const trackSelector = trackId ? selectVideoTrackByID(trackId) : selectVideoTrackByPeerID(peerId);
46
45
  const track = useHMSStore(trackSelector);
47
- const isMobile = useMedia(cssConfig.media.md);
48
46
  const peerName = useHMSStore(selectPeerNameByID(peerId));
49
47
  const audioTrack = useHMSStore(selectAudioTrackByPeerID(peerId));
50
48
  const localPeerID = useHMSStore(selectLocalPeerID);
@@ -141,7 +139,7 @@ const Tile = ({
141
139
  {!hideMetadataOnTile && <PeerMetadata peerId={peerId} size={attribBoxSize} />}
142
140
  </>
143
141
  ) : null}
144
- {isMouseHovered || (isDragabble && isMobile) ? (
142
+ {isMouseHovered || (isDragabble && navigator.maxTouchPoints > 0) ? (
145
143
  <TileMenu
146
144
  peerID={peerId}
147
145
  audioTrackID={audioTrack?.id}
@@ -0,0 +1,22 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { selectSessionStore, useHMSStore } from '@100mslive/react-sdk';
3
+ import { PinnedMessage } from './usePinnedMessages';
4
+ import { SESSION_STORE_KEY } from '../../common/constants';
5
+
6
+ export const usePinnedBy = (messageId: string) => {
7
+ const pinnedMessages = useHMSStore(selectSessionStore(SESSION_STORE_KEY.PINNED_MESSAGES));
8
+ const [pinnedBy, setPinnedBy] = useState('');
9
+
10
+ useEffect(() => {
11
+ let match = '';
12
+ pinnedMessages?.forEach((pinnedMessage: PinnedMessage) => {
13
+ if (pinnedMessage.id === messageId) {
14
+ match = pinnedMessage.pinnedBy;
15
+ }
16
+ });
17
+
18
+ setPinnedBy(match);
19
+ }, [messageId, pinnedMessages]);
20
+
21
+ return pinnedBy;
22
+ };
@@ -11,7 +11,7 @@ import { ToastManager } from '../Toast/ToastManager';
11
11
  // @ts-ignore
12
12
  import { SESSION_STORE_KEY } from '../../common/constants';
13
13
 
14
- type PinnedMessage = {
14
+ export type PinnedMessage = {
15
15
  text: string;
16
16
  id: string;
17
17
  pinnedBy: string;
@@ -20,7 +20,7 @@ type PinnedMessage = {
20
20
  /**
21
21
  * set pinned chat message by updating the session store
22
22
  */
23
- export const useSetPinnedMessages = () => {
23
+ export const usePinnedMessages = () => {
24
24
  const hmsActions = useHMSActions();
25
25
  const vanillaStore = useHMSVanillaStore();
26
26
 
@@ -4,16 +4,13 @@ import { HMSNotificationTypes, useHMSNotifications, useHMSStore } from '@100msli
4
4
 
5
5
  export const useUnreadPollQuizPresent = () => {
6
6
  const localPeerID = useHMSStore(selectLocalPeerID);
7
- const notification = useHMSNotifications();
7
+ const notification = useHMSNotifications(HMSNotificationTypes.POLL_STARTED);
8
8
  const [unreadPollQuiz, setUnreadPollQuiz] = useState(false);
9
9
 
10
10
  useEffect(() => {
11
11
  if (!notification) {
12
12
  return;
13
13
  }
14
- if (notification.type !== HMSNotificationTypes.POLL_STARTED) {
15
- return;
16
- }
17
14
  setUnreadPollQuiz(notification.data.startedBy !== localPeerID);
18
15
  }, [localPeerID, notification]);
19
16
  return { unreadPollQuiz, setUnreadPollQuiz };
@@ -34,7 +34,6 @@ import { useCloseScreenshareWhiteboard } from '../components/hooks/useCloseScree
34
34
  // @ts-ignore: No implicit Any
35
35
  import { SESSION_STORE_KEY } from '../common/constants';
36
36
 
37
- // const WhiteboardView = React.lazy(() => import("./WhiteboardView"));
38
37
  // @ts-ignore: No implicit Any
39
38
  const HLSView = React.lazy(() => import('./HLSView'));
40
39
 
@@ -0,0 +1,30 @@
1
+ import { styled } from '../Theme';
2
+
3
+ export const TextArea = styled('textarea', {
4
+ fontFamily: '$sans',
5
+ lineHeight: 'inherit',
6
+ backgroundColor: '$surface_default',
7
+ borderRadius: '8px',
8
+ outline: 'none',
9
+ border: '1px solid $border_default',
10
+ padding: '0.5rem 0.75rem',
11
+ minHeight: '30px',
12
+ color: '$on_surface_high',
13
+ fontSize: '$md',
14
+ '&:focus': {
15
+ boxShadow: '0 0 0 1px $colors$primary_default',
16
+ border: '1px solid transparent',
17
+ },
18
+ '&::placeholder': {
19
+ color: '$on_surface_medium',
20
+ },
21
+ variants: {
22
+ error: {
23
+ true: {
24
+ '&:focus': {
25
+ boxShadow: '0 0 0 3px $colors$alert_error_default',
26
+ },
27
+ },
28
+ },
29
+ },
30
+ });
@@ -0,0 +1 @@
1
+ export { TextArea } from './TextArea';
package/src/index.ts CHANGED
@@ -37,3 +37,4 @@ export * from './Collapsible';
37
37
  export * from './Prebuilt';
38
38
  export * from './Progress';
39
39
  export * from './context/DialogContext';
40
+ export * from './TextArea';
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  /* eslint-disable @typescript-eslint/no-empty-function */
3
- import { HMSFrameworkInfo } from '@100mslive/hms-video';
3
+ import { HMSFrameworkInfo } from '@100mslive/hms-video-store';
4
4
  import {
5
5
  HMSActions,
6
6
  HMSAudioTrackSettings,
@@ -87,6 +87,7 @@ export class StoryBookSDK implements Partial<HMSActions> {
87
87
  isLocal: true,
88
88
  id: String(this.randomNumber()),
89
89
  auxiliaryTracks: [],
90
+ isHandRaised: false,
90
91
  };
91
92
  store.room.peers.push(this.localPeer.id);
92
93
  store.peers[this.localPeer.id] = this.localPeer;
@@ -111,6 +112,7 @@ export class StoryBookSDK implements Partial<HMSActions> {
111
112
  isLocal: true,
112
113
  id: String(this.randomNumber()),
113
114
  auxiliaryTracks: [],
115
+ isHandRaised: false,
114
116
  };
115
117
  store.room.peers.push(this.localPeer.id);
116
118
  store.peers[this.localPeer.id] = this.localPeer;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { ConferencingScreen } from '@100mslive/types-prebuilt';
3
- export declare const ToggleWhiteboard: ({ screenType }: {
4
- screenType: keyof ConferencingScreen;
5
- }) => React.JSX.Element | null;