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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) 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-GI5NXBYN.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-KUFQ5ONV.js} +34 -35
  7. package/dist/chunk-KUFQ5ONV.js.map +7 -0
  8. package/dist/index.cjs.js +485 -483
  9. package/dist/index.cjs.js.map +4 -4
  10. package/dist/index.js +1 -1
  11. package/dist/meta.cjs.json +39 -44
  12. package/dist/meta.esbuild.json +45 -50
  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/ParticipantList.tsx +4 -1
  20. package/src/Prebuilt/components/Footer/RoleAccordion.tsx +6 -6
  21. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +0 -1
  22. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +1 -5
  23. package/src/Prebuilt/components/PreviousRoleInMetadata.tsx +0 -1
  24. package/src/Prebuilt/components/RaiseHand.tsx +7 -1
  25. package/src/Prebuilt/components/RoleChangeRequest/RoleChangeRequestModal.tsx +0 -1
  26. package/src/Prebuilt/components/hooks/{useMetadata.jsx → useMetadata.tsx} +2 -8
  27. package/dist/chunk-2V7F62FX.js.map +0 -7
  28. /package/dist/{HLSView-NVF25XHT.js.map → HLSView-GI5NXBYN.js.map} +0 -0
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "prebuilt",
11
11
  "roomkit"
12
12
  ],
13
- "version": "0.3.3-alpha.0",
13
+ "version": "0.3.3-alpha.2",
14
14
  "author": "100ms",
15
15
  "license": "MIT",
16
16
  "repository": {
@@ -82,12 +82,12 @@
82
82
  "react": ">=17.0.2 <19.0.0"
83
83
  },
84
84
  "dependencies": {
85
- "@100mslive/hls-player": "0.3.3-alpha.0",
85
+ "@100mslive/hls-player": "0.3.3-alpha.2",
86
86
  "@100mslive/hms-noise-cancellation": "0.0.0-alpha.1",
87
- "@100mslive/hms-virtual-background": "1.13.3-alpha.0",
88
- "@100mslive/react-icons": "0.10.3-alpha.0",
89
- "@100mslive/react-sdk": "0.10.3-alpha.0",
90
- "@100mslive/types-prebuilt": "0.12.7",
87
+ "@100mslive/hms-virtual-background": "1.13.3-alpha.2",
88
+ "@100mslive/react-icons": "0.10.3-alpha.2",
89
+ "@100mslive/react-sdk": "0.10.3-alpha.2",
90
+ "@100mslive/types-prebuilt": "0.12.8",
91
91
  "@emoji-mart/data": "^1.0.6",
92
92
  "@emoji-mart/react": "^1.0.1",
93
93
  "@radix-ui/react-accordion": "1.0.0",
@@ -122,5 +122,5 @@
122
122
  "uuid": "^8.3.2",
123
123
  "worker-timers": "^7.0.40"
124
124
  },
125
- "gitHead": "23e3bf90410ae16869b67438ac403cba6027db98"
125
+ "gitHead": "ada10fb3dc34984fd59f37f08629e8bd2a0f6c4c"
126
126
  }
@@ -64,15 +64,15 @@ export const AccordionRoot = StyledAccordion;
64
64
  export const AccordionItem = StyledItem;
65
65
 
66
66
  export const AccordionHeader: React.FC<
67
- PropsWithChildren<BaseAccordion.AccordionTriggerProps & { iconStyles?: CSS; css?: CSS }>
67
+ PropsWithChildren<BaseAccordion.AccordionTriggerProps & { iconStyles?: CSS; css?: CSS; chevronID?: string }>
68
68
  > = React.forwardRef<
69
69
  HTMLButtonElement,
70
- PropsWithChildren<BaseAccordion.AccordionTriggerProps & { iconStyles?: CSS; css?: CSS }>
71
- >(({ children, iconStyles, css, ...props }, forwardedRef) => (
70
+ PropsWithChildren<BaseAccordion.AccordionTriggerProps & { iconStyles?: CSS; css?: CSS; chevronID?: string }>
71
+ >(({ children, iconStyles, css, chevronID, ...props }, forwardedRef) => (
72
72
  <StyledHeader css={css}>
73
73
  <StyledTrigger {...props} ref={forwardedRef}>
74
74
  {children}
75
- <StyledChevron aria-hidden css={iconStyles} />
75
+ <StyledChevron data-testid={chevronID} aria-hidden css={iconStyles} />
76
76
  </StyledTrigger>
77
77
  </StyledHeader>
78
78
  ));
@@ -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
  </>
@@ -324,12 +324,15 @@ const HandRaisedAccordionParticipantActions = ({ peerId, role }: { peerId: strin
324
324
  peerId,
325
325
  role,
326
326
  });
327
+ if (!shouldShowStageRoleChange) {
328
+ return null;
329
+ }
327
330
  return (
328
331
  <>
329
332
  <Button variant="standard" css={quickActionStyle} onClick={lowerPeerHand}>
330
333
  <CrossIcon height={18} width={18} />
331
334
  </Button>
332
- {shouldShowStageRoleChange && !isInStage && (
335
+ {!isInStage && (
333
336
  <Button variant="primary" onClick={handleStageAction} css={quickActionStyle}>
334
337
  <AddIcon height={18} width={18} />
335
338
  </Button>
@@ -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',
@@ -148,18 +149,17 @@ export const RoleAccordion = ({
148
149
  <ChevronRightIcon />
149
150
  </Flex>
150
151
  ) : null}
151
- {isHandRaisedAccordion && (
152
+ {isHandRaisedAccordion && canBringToStage && (
152
153
  <>
153
154
  <HorizontalDivider />
154
155
  <Flex css={{ w: '100%', p: '$6', gap: '$4' }} justify="center">
155
156
  <Button variant="standard" onClick={lowerAllHands} icon css={{ pl: '$2' }}>
156
157
  <CrossIcon /> Lower all hands
157
158
  </Button>
158
- {canBringToStage && (
159
- <Button onClick={bringAllToStage} icon css={{ pl: '$2' }}>
160
- <AddIcon /> {bring_to_stage_label}
161
- </Button>
162
- )}
159
+
160
+ <Button onClick={bringAllToStage} icon css={{ pl: '$2' }}>
161
+ <AddIcon /> {bring_to_stage_label}
162
+ </Button>
163
163
  </Flex>
164
164
  </>
165
165
  )}
@@ -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
  };