@100mslive/roomkit-react 0.3.3-alpha.0 → 0.3.3-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. package/dist/Accordion/Accordion.d.ts +1 -0
  2. package/dist/Accordion/index.d.ts +1 -0
  3. package/dist/{HLSView-NVF25XHT.js → HLSView-GDOF4655.js} +2 -2
  4. package/dist/Prebuilt/components/RaiseHand.d.ts +1 -1
  5. package/dist/Prebuilt/components/hooks/useMetadata.d.ts +8 -0
  6. package/dist/{chunk-2V7F62FX.js → chunk-ZDW56PPL.js} +29 -33
  7. package/dist/chunk-ZDW56PPL.js.map +7 -0
  8. package/dist/index.cjs.js +480 -481
  9. package/dist/index.cjs.js.map +4 -4
  10. package/dist/index.js +1 -1
  11. package/dist/meta.cjs.json +37 -42
  12. package/dist/meta.esbuild.json +43 -48
  13. package/package.json +7 -7
  14. package/src/Accordion/Accordion.tsx +4 -4
  15. package/src/Prebuilt/components/Chat/ChatBody.tsx +10 -0
  16. package/src/Prebuilt/components/Chat/ChatFooter.tsx +2 -4
  17. package/src/Prebuilt/components/ConferenceScreen.tsx +1 -4
  18. package/src/Prebuilt/components/Footer/Footer.tsx +1 -4
  19. package/src/Prebuilt/components/Footer/RoleAccordion.tsx +1 -0
  20. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +0 -1
  21. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +1 -5
  22. package/src/Prebuilt/components/PreviousRoleInMetadata.tsx +0 -1
  23. package/src/Prebuilt/components/RaiseHand.tsx +7 -1
  24. package/src/Prebuilt/components/RoleChangeRequest/RoleChangeRequestModal.tsx +0 -1
  25. package/src/Prebuilt/components/hooks/{useMetadata.jsx → useMetadata.tsx} +2 -8
  26. package/dist/chunk-2V7F62FX.js.map +0 -7
  27. /package/dist/{HLSView-NVF25XHT.js.map → HLSView-GDOF4655.js.map} +0 -0
@@ -410,6 +410,7 @@ export const ChatBody = React.forwardRef<VariableSizeList, { scrollToBottom: (co
410
410
  }, [blacklistedMessageIDs, messages]);
411
411
 
412
412
  const vanillaStore = useHMSVanillaStore();
413
+ const rerenderOnFirstMount = useRef(false);
413
414
 
414
415
  useEffect(() => {
415
416
  const unsubscribe = vanillaStore.subscribe(() => {
@@ -426,6 +427,15 @@ export const ChatBody = React.forwardRef<VariableSizeList, { scrollToBottom: (co
426
427
  return unsubscribe;
427
428
  }, [vanillaStore, listRef, scrollToBottom]);
428
429
 
430
+ useEffect(() => {
431
+ // @ts-ignore
432
+ if (filteredMessages.length > 0 && listRef?.current && !rerenderOnFirstMount.current) {
433
+ rerenderOnFirstMount.current = true;
434
+ // @ts-ignore
435
+ listRef.current.resetAfterIndex(0);
436
+ }
437
+ }, [listRef, filteredMessages]);
438
+
429
439
  return filteredMessages.length === 0 ? (
430
440
  <EmptyChat />
431
441
  ) : (
@@ -2,7 +2,7 @@ import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'reac
2
2
  import { useMedia } from 'react-use';
3
3
  import data from '@emoji-mart/data';
4
4
  import Picker from '@emoji-mart/react';
5
- import { HMSException, selectLocalPeer, useAVToggle, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
5
+ import { HMSException, selectLocalPeer, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
6
6
  import { EmojiIcon, PauseCircleIcon, SendIcon, VerticalMenuIcon } from '@100mslive/react-icons';
7
7
  import { Box, config as cssConfig, Flex, IconButton as BaseIconButton, Popover, styled, Text } from '../../..';
8
8
  import { IconButton } from '../../../IconButton';
@@ -89,8 +89,6 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
89
89
  const defaultSelection = useDefaultChatSelection();
90
90
  const selection = selectedPeer.name || selectedRole || defaultSelection;
91
91
  const isLocalPeerBlacklisted = useIsPeerBlacklisted({ local: true });
92
- const { toggleAudio, toggleVideo } = useAVToggle();
93
- const noAVPermissions = !(toggleAudio || toggleVideo);
94
92
  const isMwebHLSStream = useMobileHLSStream();
95
93
  const isLandscapeHLSStream = useLandscapeHLSStream();
96
94
 
@@ -275,7 +273,7 @@ export const ChatFooter = ({ onSend, children }: { onSend: (count: number) => vo
275
273
  }}
276
274
  gap="2"
277
275
  >
278
- {noAVPermissions ? <RaiseHand css={{ bg: '$surface_default' }} /> : null}
276
+ <RaiseHand css={{ bg: '$surface_default' }} />
279
277
  <MoreSettings elements={elements} screenType={screenType} />
280
278
  </Flex>
281
279
  </>
@@ -6,7 +6,6 @@ import {
6
6
  selectAppData,
7
7
  selectIsConnectedToRoom,
8
8
  selectRoomState,
9
- useAVToggle,
10
9
  useHMSActions,
11
10
  useHMSStore,
12
11
  } from '@100mslive/react-sdk';
@@ -54,8 +53,6 @@ export const ConferenceScreen = () => {
54
53
  const dropdownListRef = useRef<string[]>();
55
54
  const [isHLSStarted] = useSetAppDataByKey(APP_DATA.hlsStarted);
56
55
 
57
- const { toggleAudio, toggleVideo } = useAVToggle();
58
- const noAVPermissions = !(toggleAudio || toggleVideo);
59
56
  // using it in hls stream to show action button when chat is disabled
60
57
  const showChat = !!screenProps.elements?.chat;
61
58
  const autoRoomJoined = useRef(isPreviewScreenEnabled);
@@ -202,7 +199,7 @@ export const ConferenceScreen = () => {
202
199
  justify="end"
203
200
  gap="2"
204
201
  >
205
- {noAVPermissions ? <RaiseHand /> : null}
202
+ <RaiseHand />
206
203
  <MoreSettings elements={screenProps.elements} screenType={screenProps.screenType} />
207
204
  <Box
208
205
  css={{
@@ -2,7 +2,6 @@ import React, { useEffect } from 'react';
2
2
  import { useMedia } from 'react-use';
3
3
  import { ConferencingScreen } from '@100mslive/types-prebuilt';
4
4
  import { Chat_ChatState } from '@100mslive/types-prebuilt/elements/chat';
5
- import { useAVToggle } from '@100mslive/react-sdk';
6
5
  import { config as cssConfig, Footer as AppFooter } from '../../..';
7
6
  // @ts-ignore: No implicit Any
8
7
  import { AudioVideoToggle } from '../AudioVideoToggle';
@@ -41,8 +40,6 @@ export const Footer = ({
41
40
  const isOverlayChat = !!elements?.chat?.is_overlay;
42
41
  const openByDefault = elements?.chat?.initial_state === Chat_ChatState.CHAT_STATE_OPEN;
43
42
 
44
- const { toggleAudio, toggleVideo } = useAVToggle();
45
- const noAVPermissions = !(toggleAudio || toggleVideo);
46
43
  const isChatOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.CHAT);
47
44
  const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
48
45
  const { showPolls } = useShowPolls();
@@ -90,7 +87,7 @@ export const Footer = ({
90
87
  >
91
88
  {isMobile ? (
92
89
  <>
93
- {noAVPermissions ? <RaiseHand /> : null}
90
+ <RaiseHand />
94
91
  {elements?.chat && <ChatToggle />}
95
92
  <MoreSettings elements={elements} screenType={screenType} />
96
93
  </>
@@ -93,6 +93,7 @@ export const RoleAccordion = ({
93
93
  return (
94
94
  <Accordion.Item value={roleName} css={{ '&:hover .role_actions': { visibility: 'visible' }, mb: '$8' }} ref={ref}>
95
95
  <Accordion.Header
96
+ chevronID={`role_accordion_btn_${roleName}`}
96
97
  iconStyles={{ c: '$on_surface_high' }}
97
98
  css={{
98
99
  textTransform: 'capitalize',
@@ -29,7 +29,6 @@ import { FullScreenItem } from '../FullScreenItem';
29
29
  import { MuteAllModal } from '../MuteAllModal';
30
30
  // @ts-ignore: No implicit any
31
31
  import { useDropdownList } from '../../hooks/useDropdownList';
32
- // @ts-ignore: No implicit any
33
32
  import { useMyMetadata } from '../../hooks/useMetadata';
34
33
  // @ts-ignore: No implicit any
35
34
  import { APP_DATA, isMacOS } from '../../../common/constants';
@@ -6,7 +6,6 @@ import {
6
6
  selectIsConnectedToRoom,
7
7
  selectPeerCount,
8
8
  selectPermissions,
9
- useAVToggle,
10
9
  useHMSActions,
11
10
  useHMSStore,
12
11
  useRecordingStreaming,
@@ -51,7 +50,6 @@ import { usePollViewToggle, useSidepaneToggle } from '../../AppData/useSidepane'
51
50
  import { useShowPolls } from '../../AppData/useUISettings';
52
51
  // @ts-ignore: No implicit any
53
52
  import { useDropdownList } from '../../hooks/useDropdownList';
54
- // @ts-ignore: No implicit any
55
53
  import { useMyMetadata } from '../../hooks/useMetadata';
56
54
  import { useUnreadPollQuizPresent } from '../../hooks/useUnreadPollQuizPresent';
57
55
  import { useLandscapeHLSStream, useMobileHLSStream } from '../../../common/hooks';
@@ -95,8 +93,6 @@ export const MwebOptions = ({
95
93
  const peerCount = useHMSStore(selectPeerCount);
96
94
  const emojiCardRef = useRef(null);
97
95
  const { isBRBOn, toggleBRB, isHandRaised, toggleHandRaise } = useMyMetadata();
98
- const { toggleAudio, toggleVideo } = useAVToggle();
99
- const noAVPermissions = !(toggleAudio || toggleVideo);
100
96
  const { unreadPollQuiz, setUnreadPollQuiz } = useUnreadPollQuizPresent();
101
97
  const { title, description } = useRoomLayoutHeader();
102
98
  const toggleDetailsSheet = useSheetToggle(SHEET_OPTIONS.ROOM_DETAILS);
@@ -175,7 +171,7 @@ export const MwebOptions = ({
175
171
  </ActionTile.Root>
176
172
  )}
177
173
 
178
- {!noAVPermissions ? (
174
+ {elements.hand_raise ? (
179
175
  <ActionTile.Root
180
176
  active={isHandRaised}
181
177
  onClick={() => {
@@ -1,6 +1,5 @@
1
1
  import { useEffect } from 'react';
2
2
  import { selectLocalPeerRoleName, useHMSVanillaStore } from '@100mslive/react-sdk';
3
- // @ts-ignore: No implicit Any
4
3
  import { useMyMetadata } from './hooks/useMetadata';
5
4
 
6
5
  export const PreviousRoleInMetadata = () => {
@@ -4,11 +4,17 @@ import { CSS } from '../../Theme';
4
4
  import { Tooltip } from '../../Tooltip';
5
5
  // @ts-ignore: No implicit Any
6
6
  import IconButton from '../IconButton';
7
- // @ts-ignore: No implicit Any
7
+ import { useRoomLayoutConferencingScreen } from '../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
8
8
  import { useMyMetadata } from './hooks/useMetadata';
9
9
 
10
10
  export const RaiseHand = ({ css }: { css?: CSS }) => {
11
11
  const { isHandRaised, toggleHandRaise } = useMyMetadata();
12
+ const { elements } = useRoomLayoutConferencingScreen();
13
+
14
+ if (!elements.hand_raise) {
15
+ return null;
16
+ }
17
+
12
18
  return (
13
19
  <Tooltip title={isHandRaised ? 'Lower hand' : 'Raise hand'}>
14
20
  <IconButton
@@ -13,7 +13,6 @@ import { Flex, Text } from '../../..';
13
13
  import { PreviewControls, PreviewTile } from '../Preview/PreviewJoin';
14
14
  import { RequestPrompt } from './RequestPrompt';
15
15
  import { useRoomLayoutPreviewScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
16
- // @ts-ignore: No implicit Any
17
16
  import { useMyMetadata } from '../hooks/useMetadata';
18
17
  // @ts-ignore: No implicit Any
19
18
  import { ROLE_CHANGE_DECLINED } from '../../common/constants';
@@ -15,7 +15,7 @@ export const useMyMetadata = () => {
15
15
  const metaData = useHMSStore(selectPeerMetadata(localPeerId));
16
16
  const isHandRaised = useHMSStore(selectHasPeerHandRaised(localPeerId));
17
17
 
18
- const update = async updatedFields => {
18
+ const update = async (updatedFields: Record<string, any>) => {
19
19
  try {
20
20
  // get current state from store and merge updated fields
21
21
  const currentMetadata = vanillaStore.getState(selectPeerMetadata(localPeerId));
@@ -24,6 +24,7 @@ export const useMyMetadata = () => {
24
24
  } catch (error) {
25
25
  console.error('failed to update metadata ', updatedFields);
26
26
  }
27
+ return false;
27
28
  };
28
29
 
29
30
  const toggleHandRaise = useCallback(async () => {
@@ -43,12 +44,6 @@ export const useMyMetadata = () => {
43
44
  }
44
45
  }, [metaData?.isBRBOn]); //eslint-disable-line
45
46
 
46
- const setPrevRole = async role => {
47
- await update({
48
- prevRole: role,
49
- });
50
- };
51
-
52
47
  return {
53
48
  isHandRaised,
54
49
  isBRBOn: !!metaData?.isBRBOn,
@@ -56,6 +51,5 @@ export const useMyMetadata = () => {
56
51
  updateMetaData: update,
57
52
  toggleHandRaise,
58
53
  toggleBRB,
59
- setPrevRole,
60
54
  };
61
55
  };