agora-appbuilder-core 4.1.19-beta.2 → 4.1.19-beta.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.1.19-beta.2",
3
+ "version": "4.1.19-beta.4",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -53,6 +53,7 @@ export interface SidePanelItem {
53
53
  name: string;
54
54
  title: string;
55
55
  component: React.ComponentType;
56
+ headerRightSlot?: React.ReactNode;
56
57
  onClose?: () => void;
57
58
  }
58
59
 
@@ -77,8 +77,8 @@ const DefaultConfig = {
77
77
  CHAT_ORG_NAME: "",
78
78
  CHAT_APP_NAME: "",
79
79
  CHAT_URL: "",
80
- CLI_VERSION: "3.1.19-beta.2",
81
- CORE_VERSION: "4.1.19-beta.2",
80
+ CLI_VERSION: "3.1.19-beta.4",
81
+ CORE_VERSION: "4.1.19-beta.4",
82
82
  DISABLE_LANDSCAPE_MODE: false,
83
83
  STT_AUTO_START: false,
84
84
  CLOUD_RECORDING_AUTO_START: false,
@@ -10,23 +10,18 @@
10
10
  *********************************************
11
11
  */
12
12
  import React from 'react';
13
- import {View, Text, StyleSheet, ScrollView} from 'react-native';
13
+ import {View, StyleSheet, ScrollView} from 'react-native';
14
14
  import {isMobileUA, isWebInternal, useIsSmall} from '../utils/common';
15
15
  import CommonStyles from './CommonStyles';
16
- import SidePanelHeader, {
17
- SidePanelStyles,
18
- } from '../subComponents/SidePanelHeader';
19
- import {useLayout} from '../utils/useLayout';
20
- import {getGridLayoutName} from '../pages/video-call/DefaultLayouts';
21
16
  import useCaptionWidth from '../subComponents/caption/useCaptionWidth';
22
- import {useSidePanel} from '../utils/useSidePanel';
23
- import {SidePanelType} from '../subComponents/SidePanelEnum';
24
17
  import {CustomSidePanelHeader} from '../pages/video-call/SidePanelHeader';
25
-
18
+ import {useLayout} from '../utils/useLayout';
19
+ import {getGridLayoutName} from '../pages/video-call/DefaultLayouts';
26
20
  export interface CustomSidePanelViewInterface {
27
21
  name: string;
28
22
  title?: string;
29
23
  content: React.ComponentType;
24
+ headerRightSlot?: React.ReactNode;
30
25
  onClose?: () => void;
31
26
  showHeader?: boolean;
32
27
  }
@@ -37,12 +32,12 @@ const CustomSidePanelView = (props: CustomSidePanelViewInterface) => {
37
32
  showHeader = true,
38
33
  name,
39
34
  title,
35
+ headerRightSlot,
40
36
  onClose,
41
37
  } = props;
42
- const {currentLayout} = useLayout();
43
38
  const {transcriptHeight} = useCaptionWidth();
44
- const {setSidePanel} = useSidePanel();
45
39
  const isSmall = useIsSmall();
40
+ const {currentLayout} = useLayout();
46
41
 
47
42
  return (
48
43
  <View
@@ -57,13 +52,18 @@ const CustomSidePanelView = (props: CustomSidePanelViewInterface) => {
57
52
  : // desktop maximized
58
53
  CommonStyles.sidePanelContainerWeb,
59
54
  isWebInternal() && !isSmall() && currentLayout === getGridLayoutName()
60
- ? {marginVertical: 4}
55
+ ? {marginTop: 4}
61
56
  : {},
62
57
  //@ts-ignore
63
58
  transcriptHeight && !isMobileUA() && {height: transcriptHeight},
64
59
  ]}>
65
60
  {showHeader && (
66
- <CustomSidePanelHeader name={name} title={title} onClose={onClose} />
61
+ <CustomSidePanelHeader
62
+ name={name}
63
+ title={title}
64
+ headerRightSlot={headerRightSlot}
65
+ onClose={onClose}
66
+ />
67
67
  )}
68
68
  <ScrollView contentContainerStyle={[style.bodyContainer]}>
69
69
  {CustomSidePanelContent ? <CustomSidePanelContent /> : <></>}
@@ -958,6 +958,19 @@ const RtmConfigure = (props: any) => {
958
958
  );
959
959
  return;
960
960
  }
961
+ if (
962
+ !parsedValue ||
963
+ typeof parsedValue !== 'object' ||
964
+ Array.isArray(parsedValue)
965
+ ) {
966
+ logger.debug(
967
+ LogSource.Events,
968
+ 'CUSTOM_EVENTS',
969
+ 'Ignoring non custom-event RTM payload',
970
+ {evt, sender, ts},
971
+ );
972
+ return;
973
+ }
961
974
  const {payload, persistLevel, source} = parsedValue;
962
975
  // Step 1: Set local attributes
963
976
  if (persistLevel === PersistanceLevel.Session) {
@@ -87,6 +87,7 @@ interface UserActionMenuOptionsOptionsProps {
87
87
  spotlightUid?: UidType;
88
88
  setSpotlightUid?: (uid: UidType) => void;
89
89
  items?: UserActionMenuItemsConfig;
90
+ extraMenuItems?: ActionMenuItem[];
90
91
  }
91
92
 
92
93
  export default function UserActionMenuOptionsOptions(
@@ -102,7 +103,13 @@ export default function UserActionMenuOptionsOptions(
102
103
  useState(false);
103
104
  const [actionMenuitems, setActionMenuitems] = useState<ActionMenuItem[]>([]);
104
105
  const {setSidePanel} = useSidePanel();
105
- const {user, actionMenuVisible, setActionMenuVisible, spotlightUid} = props;
106
+ const {
107
+ user,
108
+ actionMenuVisible,
109
+ setActionMenuVisible,
110
+ spotlightUid,
111
+ extraMenuItems,
112
+ } = props;
106
113
  const {currentLayout} = useLayout();
107
114
  const {pinnedUid, activeUids, customContent, secondaryPinnedUid} =
108
115
  useContent();
@@ -716,6 +723,24 @@ export default function UserActionMenuOptionsOptions(
716
723
  items.push(...customItems);
717
724
  }
718
725
 
726
+ if (extraMenuItems?.length) {
727
+ items.push(
728
+ ...extraMenuItems.map(item => ({
729
+ ...item,
730
+ closeActionMenu: () => {
731
+ item.closeActionMenu?.();
732
+ setActionMenuVisible(false);
733
+ },
734
+ onPress: item.onPress
735
+ ? () => {
736
+ item.onPress?.();
737
+ setActionMenuVisible(false);
738
+ }
739
+ : item.onPress,
740
+ })),
741
+ );
742
+ }
743
+
719
744
  items.sort((a, b) => (a.order ?? 999) - (b.order ?? 999));
720
745
 
721
746
  setActionMenuitems(items);
@@ -729,6 +754,8 @@ export default function UserActionMenuOptionsOptions(
729
754
  secondaryPinnedUid,
730
755
  currentLayout,
731
756
  spotlightUid,
757
+ extraMenuItems,
758
+ setActionMenuVisible,
732
759
  ]);
733
760
 
734
761
  const {width: globalWidth, height: globalHeight} = useWindowDimensions();
@@ -291,6 +291,8 @@ const ActionSheet = props => {
291
291
  isCustomSidePanel={true}
292
292
  customSidePanelProps={{
293
293
  title: sidePanelArray[customSidePanelIndex]?.title,
294
+ headerRightSlot:
295
+ sidePanelArray[customSidePanelIndex]?.headerRightSlot,
294
296
  onClose: sidePanelArray[customSidePanelIndex]?.onClose,
295
297
  name: sidePanelArray[customSidePanelIndex]?.name,
296
298
  }}
@@ -326,6 +326,8 @@ const ActionSheet = props => {
326
326
  isCustomSidePanel={true}
327
327
  customSidePanelProps={{
328
328
  title: sidePanelArray[customSidePanelIndex]?.title,
329
+ headerRightSlot:
330
+ sidePanelArray[customSidePanelIndex]?.headerRightSlot,
329
331
  onClose: sidePanelArray[customSidePanelIndex]?.onClose,
330
332
  name: sidePanelArray[customSidePanelIndex]?.name,
331
333
  }}
@@ -16,6 +16,7 @@ const ActionSheetHandle = (props: {
16
16
  isCustomSidePanel?: boolean;
17
17
  customSidePanelProps?: {
18
18
  title: string;
19
+ headerRightSlot?: React.ReactNode;
19
20
  onClose?: () => void;
20
21
  name: string;
21
22
  };
@@ -208,6 +208,7 @@ export const VBHeader = () => {
208
208
 
209
209
  export const CustomSidePanelHeader = (props: {
210
210
  title: string;
211
+ headerRightSlot?: React.ReactNode;
211
212
  onClose?: () => void;
212
213
  name: string;
213
214
  }) => {
@@ -217,6 +218,7 @@ export const CustomSidePanelHeader = (props: {
217
218
  centerComponent={
218
219
  <Text style={SidePanelStyles.heading}>{props?.title}</Text>
219
220
  }
221
+ trailingComponent={props?.headerRightSlot}
220
222
  trailingIconName="close"
221
223
  trailingIconOnPress={() => {
222
224
  setSidePanel(SidePanelType.None);
@@ -224,7 +226,7 @@ export const CustomSidePanelHeader = (props: {
224
226
  props?.onClose && props?.onClose();
225
227
  } catch (error) {
226
228
  console.error(
227
- `Error on calling onClose in custom side panel ${name}`,
229
+ `Error on calling onClose in custom side panel ${props.name}`,
228
230
  );
229
231
  }
230
232
  }}
@@ -400,6 +400,9 @@ const VideoCallScreen = () => {
400
400
  <CustomSidePanelView
401
401
  content={SidePanelArray[customSidePanelIndex]?.component}
402
402
  title={SidePanelArray[customSidePanelIndex]?.title}
403
+ headerRightSlot={
404
+ SidePanelArray[customSidePanelIndex]?.headerRightSlot
405
+ }
403
406
  name={SidePanelArray[customSidePanelIndex]?.name}
404
407
  onClose={SidePanelArray[customSidePanelIndex]?.onClose}
405
408
  />
@@ -25,6 +25,7 @@ import {
25
25
  } from './DefaultLayouts';
26
26
  import IconButton from '../../atoms/IconButton';
27
27
  import UserActionMenuOptionsOptions from '../../components/participants/UserActionMenuOptions';
28
+ import type {ActionMenuItem} from '../../atoms/ActionMenu';
28
29
  import {
29
30
  isMobileUA,
30
31
  isValidReactComponent,
@@ -60,6 +61,7 @@ export interface VideoRendererProps {
60
61
  CustomChild?: React.ComponentType;
61
62
  avatarRadius?: number;
62
63
  hideMenuOptions?: boolean;
64
+ extraMenuItems?: ActionMenuItem[];
63
65
  containerStyle?: ViewStyle;
64
66
  innerContainerStyle?: ViewStyle;
65
67
  }
@@ -69,6 +71,7 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
69
71
  CustomChild,
70
72
  avatarRadius = 100,
71
73
  hideMenuOptions = false,
74
+ extraMenuItems,
72
75
  containerStyle = {},
73
76
  innerContainerStyle = {},
74
77
  }) => {
@@ -214,6 +217,7 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
214
217
  from={'video-tile'}
215
218
  setSpotlightUid={setSpotlightUid}
216
219
  spotlightUid={spotlightUid}
220
+ extraMenuItems={extraMenuItems}
217
221
  />
218
222
  <PlatformWrapper isHovered={isHovered} setIsHovered={setIsHovered}>
219
223
  <View
@@ -13,6 +13,7 @@ export interface SidePanelHeaderProps {
13
13
  leadingIconOnPress?: () => void;
14
14
  trailingIconName?: keyof IconsInterface;
15
15
  trailingIconOnPress?: () => void;
16
+ trailingComponent?: React.ReactNode;
16
17
  trailingIconName2?: keyof IconsInterface;
17
18
  trailingIconOnPress2?: () => void;
18
19
  isChat?: boolean;
@@ -56,9 +57,21 @@ const SidePanelHeader = React.forwardRef<View, SidePanelHeaderProps>(
56
57
  <View style={{width: 30, height: 'auto'}}></View>
57
58
  ) : null}
58
59
  {props?.centerComponent ? props.centerComponent : null}
59
- <View style={props?.trailingIconName2 && SidePanelStyles.row}>
60
+ <View
61
+ style={
62
+ (props?.trailingIconName2 || props?.trailingComponent) &&
63
+ SidePanelStyles.row
64
+ }>
65
+ {props?.trailingComponent ? props.trailingComponent : null}
60
66
  {props?.trailingIconName ? (
61
- <View ref={ref} collapsable={false} style={{flex: 1}}>
67
+ <View
68
+ ref={ref}
69
+ collapsable={false}
70
+ style={
71
+ props?.trailingIconName2 || props?.trailingComponent
72
+ ? {}
73
+ : {flex: 1}
74
+ }>
62
75
  <IconButton
63
76
  hoverEffect={true}
64
77
  hoverEffectStyle={{
@@ -116,6 +129,7 @@ export const SidePanelStyles = StyleSheet.create({
116
129
  borderBottomWidth: 1,
117
130
  borderBottomColor: $config.CARD_LAYER_3_COLOR,
118
131
  position: 'relative',
132
+ zIndex: 1000,
119
133
  },
120
134
  chatPadding: {
121
135
  paddingHorizontal: 16,