agora-appbuilder-core 4.0.20 → 4.0.21-beta.2

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 (59) hide show
  1. package/package.json +1 -1
  2. package/template/customization-api/app-state.ts +1 -0
  3. package/template/customization-api/sub-components.ts +4 -0
  4. package/template/customization-api/typeDefinition.ts +7 -2
  5. package/template/customization-api/types.ts +6 -0
  6. package/template/customization-api/utils.ts +3 -0
  7. package/template/defaultConfig.js +4 -1
  8. package/template/global.d.ts +3 -0
  9. package/template/src/AppRoutes.tsx +7 -0
  10. package/template/src/app-state/useVirtualBackground.ts +117 -0
  11. package/template/src/assets/font-styles.css +164 -160
  12. package/template/src/assets/fonts/icomoon.ttf +0 -0
  13. package/template/src/assets/selection.json +3452 -1
  14. package/template/src/atoms/CustomIcon.tsx +1 -0
  15. package/template/src/auth/AuthProvider.tsx +0 -5
  16. package/template/src/auth/config.ts +1 -9
  17. package/template/src/components/Controls.tsx +42 -28
  18. package/template/src/components/Navbar.tsx +3 -1
  19. package/template/src/components/Precall.native.tsx +14 -2
  20. package/template/src/components/Precall.tsx +14 -2
  21. package/template/src/components/chat/chatConfigure.native.tsx +20 -15
  22. package/template/src/components/chat/chatConfigure.tsx +32 -20
  23. package/template/src/components/precall/joinWaitingRoomBtn.native.tsx +3 -3
  24. package/template/src/components/precall/joinWaitingRoomBtn.tsx +3 -3
  25. package/template/src/components/recording-bot/RecordingBotRoute.tsx +6 -0
  26. package/template/src/components/recordings/recording-table.tsx +165 -69
  27. package/template/src/components/recordings/style.ts +55 -0
  28. package/template/src/components/recordings/utils.ts +46 -4
  29. package/template/src/components/virtual-background/VBCard.tsx +1 -1
  30. package/template/src/components/virtual-background/VBPanel.tsx +5 -1
  31. package/template/src/components/virtual-background/VButils.native.ts +16 -0
  32. package/template/src/components/virtual-background/VButils.ts +29 -13
  33. package/template/src/components/virtual-background/useVB.native.tsx +20 -14
  34. package/template/src/components/virtual-background/useVB.tsx +49 -31
  35. package/template/src/language/default-labels/videoCallScreenLabels.ts +3 -1
  36. package/template/src/logger/transports/agora-transport.native.ts +3 -3
  37. package/template/src/logger/transports/agora-transport.ts +2 -2
  38. package/template/src/pages/VideoCall.tsx +66 -44
  39. package/template/src/pages/video-call/ActionSheetContent.tsx +3 -0
  40. package/template/src/pages/video-call/VideoCallScreen.tsx +58 -5
  41. package/template/src/rtm-events/constants.ts +5 -8
  42. package/template/src/subComponents/ChatInput.native.tsx +4 -2
  43. package/template/src/subComponents/ChatInput.tsx +6 -2
  44. package/template/src/subComponents/EndcallPopup.tsx +5 -1
  45. package/template/src/subComponents/caption/Transcript.tsx +1 -1
  46. package/template/src/subComponents/caption/TranscriptIcon.tsx +2 -2
  47. package/template/src/subComponents/caption/useSTTAPI.tsx +17 -2
  48. package/template/src/subComponents/chat/ChatActionMenu.tsx +8 -2
  49. package/template/src/subComponents/chat/ChatAttachment.native.tsx +10 -4
  50. package/template/src/subComponents/chat/ChatSendButton.tsx +4 -2
  51. package/template/src/subComponents/chat/ImagePopup.tsx +8 -2
  52. package/template/src/subComponents/recording/useIsRecordingBot.tsx +2 -1
  53. package/template/src/subComponents/recording/useRecording.tsx +346 -129
  54. package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +30 -1
  55. package/template/src/utils/fetch-retry.ts +23 -0
  56. package/template/src/utils/useLocalAudio.ts +32 -1
  57. package/template/src/utils/useLocalVideo.ts +69 -0
  58. package/template/src/utils/useSpeechToText.ts +102 -0
  59. package/template/tsconfig_wsdk_index.json +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.0.20",
3
+ "version": "4.0.21-beta.2",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -58,3 +58,4 @@ export {
58
58
  ChatType,
59
59
  } from '../src/components/chat-ui/useChatUIControls';
60
60
  export type {ChatUIControlsInterface} from '../src/components/chat-ui/useChatUIControls';
61
+ export {useVirtualBackground} from '../src/app-state/useVirtualBackground';
@@ -72,3 +72,7 @@ export type {
72
72
  ToolbarCustomItem,
73
73
  ToolbarPresetProps,
74
74
  } from '../src/atoms/ToolbarPreset';
75
+ export {default as TranscriptPanel} from '../src/subComponents/caption/Transcript';
76
+ export type {TranscriptProps} from '../src/subComponents/caption/Transcript';
77
+ export {default as CaptionPanel} from '../src/subComponents/caption/CaptionContainer';
78
+ export {default as VBPreview} from '../src/components/virtual-background/VideoPreview';
@@ -38,6 +38,7 @@ export interface PreCallInterface extends BeforeAndAfterInterface {
38
38
  deviceSelect?: React.ComponentType;
39
39
  joinButton?: React.ComponentType;
40
40
  textBox?: React.ComponentType;
41
+ virtualBackgroundPanel?: React.ComponentType;
41
42
  }
42
43
  export interface ChatCmpInterface {
43
44
  //commented for v1 release
@@ -68,6 +69,9 @@ export interface VideoCallInterface extends BeforeAndAfterInterface {
68
69
  //settingsPanel?: React.ComponentType;
69
70
  participantsPanel?: React.ComponentType;
70
71
  chat?: ChatCmpInterface;
72
+ captionPanel?: React.ComponentType;
73
+ transcriptPanel?: React.ComponentType;
74
+ virtualBackgroundPanel?: React.ComponentType;
71
75
  customLayout?: (layouts: LayoutItem[]) => LayoutItem[];
72
76
  wrapper?: React.ComponentType;
73
77
  invitePopup?: {
@@ -82,8 +86,9 @@ export type ComponentsInterface = {
82
86
  */
83
87
  appRoot?: React.ComponentType;
84
88
  // commented for v1 release
85
- // precall?: PreCallInterface | React.ComponentType;
86
- precall?: React.ComponentType;
89
+ precall?: PreCallInterface | React.ComponentType;
90
+ preferenceWrapper?: React.ComponentType;
91
+ //precall?: React.ComponentType;
87
92
  //create?: React.ComponentType;
88
93
  //share?: React.ComponentType;
89
94
  //join?: React.ComponentType;
@@ -31,3 +31,9 @@ export {
31
31
  SDKChatType,
32
32
  } from '../src/components/chat-messages/useChatMessages';
33
33
  export {UploadStatus} from '../src/components/chat-ui/useChatUIControls';
34
+ export {type VBPanelProps} from '../src/components/virtual-background/VBPanel';
35
+ export {
36
+ type VBMode,
37
+ type Option,
38
+ } from '../src/components/virtual-background/useVB';
39
+ export {type VBCardProps} from '../src/components/virtual-background/VBCard';
@@ -32,3 +32,6 @@ export {isWeb, isIOS, isAndroid, isDesktop} from '../src/utils/common';
32
32
  export {default as isMobileOrTablet} from '../src/utils/isMobileOrTablet';
33
33
  export {useLocalUid} from '../agora-rn-uikit';
34
34
  export {default as useLocalAudio} from '../src/utils/useLocalAudio';
35
+ export {default as useLocalVideo} from '../src/utils/useLocalVideo';
36
+ export type {LanguageType} from '../src/subComponents/caption/utils';
37
+ export {default as useSpeechToText} from '../src/utils/useSpeechToText';
@@ -11,6 +11,7 @@ const DefaultConfig = {
11
11
  PRECALL: true,
12
12
  CHAT: true,
13
13
  CLOUD_RECORDING: false,
14
+ RECORDING_MODE: 'WEB',
14
15
  SCREEN_SHARING: true,
15
16
  LANDING_SUB_HEADING: 'The Real-Time Engagement Platform',
16
17
  ENCRYPTION_ENABLED: false,
@@ -61,6 +62,8 @@ const DefaultConfig = {
61
62
  ENABLE_IDP_AUTH: false,
62
63
  ENABLE_TOKEN_AUTH: false,
63
64
  ENABLE_STT: false,
65
+ ENABLE_CAPTION: true,
66
+ ENABLE_MEETING_TRANSCRIPT: true,
64
67
  ENABLE_NOISE_CANCELLATION: true,
65
68
  ENABLE_VIRTUAL_BACKGROUND: true,
66
69
  ENABLE_WHITEBOARD: false,
@@ -69,7 +72,7 @@ const DefaultConfig = {
69
72
  WHITEBOARD_APPIDENTIFIER: '',
70
73
  WHITEBOARD_REGION: '',
71
74
  ENABLE_NOISE_CANCELLATION_BY_DEFAULT: false,
72
- CHAT_ORG_NAME:'',
75
+ CHAT_ORG_NAME: '',
73
76
  CHAT_APP_NAME: '',
74
77
  CHAT_URL: '',
75
78
  };
@@ -53,6 +53,7 @@ interface ConfigInterface {
53
53
  PRECALL: boolean;
54
54
  CHAT: boolean;
55
55
  CLOUD_RECORDING: boolean;
56
+ RECORDING_MODE: 'WEB' | 'MIX';
56
57
  SCREEN_SHARING: boolean;
57
58
  CLIENT_ID: string;
58
59
  LANDING_SUB_HEADING: string;
@@ -104,6 +105,8 @@ interface ConfigInterface {
104
105
  ENABLE_IDP_AUTH: boolean;
105
106
  PROJECT_ID: string;
106
107
  ENABLE_STT: boolean;
108
+ ENABLE_CAPTION: boolean;
109
+ ENABLE_MEETING_TRANSCRIPT: boolean;
107
110
  ENABLE_NOISE_CANCELLATION: boolean;
108
111
  ENABLE_VIRTUAL_BACKGROUND: boolean;
109
112
  ENABLE_WHITEBOARD: boolean;
@@ -22,10 +22,17 @@ import {CUSTOM_ROUTES_PREFIX, CustomRoutesInterface} from 'customization-api';
22
22
  import PrivateRoute from './components/PrivateRoute';
23
23
  import RecordingBotRoute from './components/recording-bot/RecordingBotRoute';
24
24
  import {useIsRecordingBot} from './subComponents/recording/useIsRecordingBot';
25
+ import {LogSource, logger} from './logger/AppBuilderLogger';
25
26
  import {isValidReactComponent} from './utils/common';
26
27
 
27
28
  function VideoCallWrapper(props) {
28
29
  const {isRecordingBotRoute} = useIsRecordingBot();
30
+ logger.debug(
31
+ LogSource.Internals,
32
+ 'RECORDING',
33
+ 'Check if this is a recording bot route',
34
+ isRecordingBotRoute,
35
+ );
29
36
  return isRecordingBotRoute ? (
30
37
  <RecordingBotRoute history={props.history}>
31
38
  <VideoCall />
@@ -0,0 +1,117 @@
1
+ import {useEffect, useRef} from 'react';
2
+ import {convertBlobToBase64} from '../../src/components/virtual-background/VButils';
3
+ import {
4
+ Option,
5
+ useVB,
6
+ type VBMode,
7
+ } from '../../src/components/virtual-background/useVB';
8
+
9
+ import {useSidePanel} from '../utils/useSidePanel';
10
+ import {SidePanelType} from '../subComponents/SidePanelEnum';
11
+
12
+ export interface VBConfig {
13
+ target: 'mainView' | 'preview';
14
+ blurDegree?: number;
15
+ type: 'blur' | 'img' | 'custom'; // Adjust this as needed based on your configuration options
16
+ source?: HTMLImageElement;
17
+ }
18
+
19
+ export interface virtualBackgroundInterface {
20
+ virtualBackgrounds: Option[]; // options available in vb panel
21
+ addVirtualBackgrounds: (options: Option[]) => void;
22
+ setVBPreview: (type: VBMode, path: string) => void;
23
+ applyVirtualBackground: () => void;
24
+ isVirtualBackgroundSelected: (type: VBMode, path: string) => boolean;
25
+ hideVirtualBackgroundPanel: () => void;
26
+ }
27
+
28
+ export const useVirtualBackground: () => virtualBackgroundInterface = () => {
29
+ const {
30
+ options,
31
+ setOptions,
32
+ selectedImage,
33
+ vbMode,
34
+ setSelectedImage,
35
+ setVBmode,
36
+ setSaveVB,
37
+ isVBActive,
38
+ setIsVBActive,
39
+ applyVirtualBackgroundToMainView,
40
+ applyVirtualBackgroundToPreviewView,
41
+ } = useVB();
42
+
43
+ const {setSidePanel} = useSidePanel();
44
+
45
+ const updateVBOptions = async (options: Option[]) => {
46
+ console.warn('Sdsd');
47
+ const vbOptions = [];
48
+ for (let i = 0; i < options.length; i++) {
49
+ const option = options[i];
50
+
51
+ if (option.type === 'image' && option?.isBase64Image === false) {
52
+ const imgObj = {
53
+ type: 'image',
54
+ icon: 'vb',
55
+ path: '',
56
+ id: `VBOption_${i + 1}`,
57
+ };
58
+ try {
59
+ imgObj.path = await convertBlobToBase64(option.path);
60
+ } catch (error) {
61
+ console.error(
62
+ `Error fetching and converting image ${option.path}:`,
63
+ error,
64
+ );
65
+ }
66
+ vbOptions.push(imgObj);
67
+ if (option?.isSelected && !selectedImage) {
68
+ setSelectedImage(imgObj.path);
69
+ setVBmode('image');
70
+ }
71
+ } else {
72
+ vbOptions.push(option);
73
+ }
74
+ }
75
+ setOptions(vbOptions);
76
+ };
77
+
78
+ const setVBPreview = (type: VBMode, path: string) => {
79
+ if (path) {
80
+ setSelectedImage(path);
81
+ } else {
82
+ setSelectedImage(null);
83
+ }
84
+ setVBmode(type);
85
+ setSaveVB(false);
86
+ };
87
+
88
+ const applyVirtualBackground = () => {
89
+ setSaveVB(true);
90
+ };
91
+
92
+ const isVirtualBackgroundSelected = (type: VBMode, path: string) => {
93
+ return path ? path === selectedImage : type === vbMode;
94
+ };
95
+
96
+ const hideVirtualBackgroundPanel = () => {
97
+ setSidePanel(SidePanelType.None);
98
+ setIsVBActive(false);
99
+ };
100
+
101
+ //TODO: later
102
+ // const applyVirtualBackground = (config: VBConfig) => {
103
+ // if (config.target === 'mainView') {
104
+ // applyVirtualBackgroundToMainView(config);
105
+ // } else {
106
+ // applyVirtualBackgroundToPreviewView(config);
107
+ // }
108
+ // };
109
+ return {
110
+ virtualBackgrounds: options,
111
+ addVirtualBackgrounds: updateVBOptions,
112
+ setVBPreview,
113
+ applyVirtualBackground,
114
+ isVirtualBackgroundSelected,
115
+ hideVirtualBackgroundPanel,
116
+ };
117
+ };