agora-appbuilder-core 2.3.0-beta.9 → 3.0.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 (205) hide show
  1. package/Readme.md +11 -6
  2. package/package.json +1 -1
  3. package/template/Gulpfile.js +121 -83
  4. package/template/_gitignore +2 -2
  5. package/template/_package-lock.json +12959 -13248
  6. package/template/agora-rn-uikit/src/AgoraUIKit.tsx +2 -2
  7. package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +2 -0
  8. package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +3 -3
  9. package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +4 -5
  10. package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +3 -1
  11. package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +2 -2
  12. package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +1 -1
  13. package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +1 -1
  14. package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +1 -1
  15. package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +1 -1
  16. package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +4 -4
  17. package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +7 -5
  18. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +1 -1
  19. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +1 -1
  20. package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +2 -2
  21. package/template/agora-rn-uikit/src/Rtc/Create.tsx +88 -43
  22. package/template/agora-rn-uikit/src/Rtc/Join.tsx +13 -4
  23. package/template/agora-rn-uikit/src/RtcConfigure.tsx +36 -19
  24. package/template/agora-rn-uikit/src/Utils/permission.ts +17 -6
  25. package/template/babel.config.js +9 -9
  26. package/template/bridge/rtc/webNg/RtcEngine.ts +51 -26
  27. package/template/customization-api/action-library.ts +22 -0
  28. package/template/{fpe-api/context.ts → customization-api/app-state.ts} +16 -14
  29. package/template/customization-api/customEvents.ts +9 -0
  30. package/template/{fpe-api/install.ts → customization-api/customize.ts} +27 -26
  31. package/template/{fpe-api → customization-api}/index.ts +11 -6
  32. package/template/{fpe-api/components.ts → customization-api/sub-components.ts} +22 -3
  33. package/template/{fpe-api → customization-api}/typeDefinition.ts +13 -14
  34. package/template/customization-api/utils.ts +30 -0
  35. package/template/{fpe-implementation → customization-implementation}/createHook.ts +0 -0
  36. package/template/{fpe-implementation/dummyFpe.ts → customization-implementation/dummyConfig.ts} +4 -4
  37. package/template/customization-implementation/index.ts +4 -0
  38. package/template/{fpe-api/useFpe.tsx → customization-implementation/useCustomization.tsx} +12 -12
  39. package/template/{fpe.config.js → customization.config.js} +11 -11
  40. package/template/electron/main/index.js +42 -35
  41. package/template/esbuild.rsdk.go +8 -17
  42. package/template/global.d.ts +4 -3
  43. package/template/index.rsdk.tsx +13 -5
  44. package/template/index.wsdk.tsx +21 -5
  45. package/template/package.json +3 -0
  46. package/template/react-native-toast-message/src/index.js +3 -7
  47. package/template/react-native-toast-message/src/{index.wsdk.js → index.sdk.tsx} +1 -1
  48. package/template/react-native-toast-message/src/styles.sdk.ts +17 -0
  49. package/template/src/App.tsx +8 -4
  50. package/template/src/AppWrapper.tsx +8 -6
  51. package/template/src/SDKAppWrapper.tsx +28 -21
  52. package/template/src/app-state/useLocalUserInfo.ts +8 -0
  53. package/template/src/app-state/useMessages.ts +52 -0
  54. package/template/src/atoms/PrimaryButton.tsx +2 -2
  55. package/template/src/atoms/SecondaryButton.tsx +12 -4
  56. package/template/src/atoms/TextInput.tsx +2 -2
  57. package/template/src/components/Chat.tsx +22 -11
  58. package/template/src/components/ChatContext.ts +10 -27
  59. package/template/src/components/Controls.native.tsx +13 -7
  60. package/template/src/components/Controls.tsx +15 -24
  61. package/template/src/components/DeviceConfigure.tsx +4 -3
  62. package/template/src/components/EventsConfigure.tsx +54 -0
  63. package/template/src/components/GridVideo.tsx +5 -6
  64. package/template/src/components/HostControlView.tsx +13 -19
  65. package/template/src/components/Navbar.tsx +54 -41
  66. package/template/src/components/NetworkQualityContext.tsx +4 -3
  67. package/template/src/components/ParticipantsView.tsx +7 -7
  68. package/template/src/components/PinnedVideo.tsx +3 -4
  69. package/template/src/components/Precall.native.tsx +3 -3
  70. package/template/src/components/Precall.tsx +14 -10
  71. package/template/src/components/RTMConfigure.tsx +61 -219
  72. package/template/src/components/SettingsView.tsx +6 -3
  73. package/template/src/components/Share.tsx +24 -18
  74. package/template/src/components/chat-messages/useChatMessages.tsx +397 -80
  75. package/template/src/components/chat-notification/useChatNotification.tsx +2 -2
  76. package/template/src/components/chat-ui/useChatUIControl.tsx +1 -1
  77. package/template/src/components/common/Logo.tsx +3 -2
  78. package/template/src/components/contexts/LiveStreamDataContext.tsx +3 -3
  79. package/template/src/components/contexts/ScreenShareContext.tsx +3 -1
  80. package/template/src/components/contexts/VideoMeetingDataContext.tsx +85 -0
  81. package/template/src/components/contexts/WhiteboardContext.tsx +8 -8
  82. package/template/src/components/livestream/LiveStreamContext.tsx +88 -74
  83. package/template/src/components/meeting-info/useMeetingInfo.tsx +23 -19
  84. package/template/src/components/meeting-info/useSetMeetingInfo.tsx +1 -1
  85. package/template/src/components/participants/AllAudienceParticipants.tsx +2 -2
  86. package/template/src/components/participants/AllHostParticipants.tsx +4 -4
  87. package/template/src/components/participants/MeParticipant.tsx +5 -3
  88. package/template/src/components/participants/ParticipantName.tsx +2 -2
  89. package/template/src/components/participants/RemoteParticipants.tsx +9 -7
  90. package/template/src/components/precall/LocalMute.native.tsx +14 -10
  91. package/template/src/components/precall/LocalMute.tsx +7 -5
  92. package/template/src/components/precall/VideoPreview.native.tsx +6 -6
  93. package/template/src/components/precall/VideoPreview.tsx +3 -3
  94. package/template/src/components/precall/joinCallBtn.tsx +3 -3
  95. package/template/src/components/precall/meetingTitle.tsx +3 -1
  96. package/template/src/components/precall/selectDevice.tsx +2 -2
  97. package/template/src/components/precall/usePreCall.tsx +1 -1
  98. package/template/src/components/styles.ts +3 -3
  99. package/template/src/components/useShareLink.tsx +69 -29
  100. package/template/src/components/useUserPreference.tsx +16 -15
  101. package/template/src/components/useWakeLock.tsx +3 -3
  102. package/template/src/language/i18nTypes.ts +1 -1
  103. package/template/src/language/index.ts +2 -2
  104. package/template/src/language/useLanguage.tsx +2 -3
  105. package/template/src/pages/Authenticate.tsx +3 -2
  106. package/template/src/pages/Create.tsx +18 -20
  107. package/template/src/pages/Join.tsx +6 -7
  108. package/template/src/pages/VideoCall.tsx +74 -66
  109. package/template/src/pages/create/useCreate.tsx +1 -1
  110. package/template/src/pages/video-call/CustomUserContextHolder.tsx +14 -6
  111. package/template/src/pages/video-call/DefaultLayouts.ts +8 -8
  112. package/template/src/pages/video-call/{NameWithMicStatus.tsx → NameWithMicIcon.tsx} +8 -1
  113. package/template/src/pages/video-call/RenderComponent.tsx +7 -10
  114. package/template/src/pages/video-call/VideoCallScreen.tsx +31 -22
  115. package/template/src/pages/video-call/VideoComponent.tsx +13 -15
  116. package/template/src/pages/video-call/VideoRenderer.tsx +6 -6
  117. package/template/src/pages/video-call/useLayoutsData.ts +23 -0
  118. package/template/src/rtm/RTMEngine.ts +13 -0
  119. package/template/src/rtm-events/EventUtils.ts +20 -20
  120. package/template/src/rtm-events/EventsQueue.ts +9 -3
  121. package/template/src/rtm-events/constants.ts +5 -0
  122. package/template/src/rtm-events/index.tsx +1 -3
  123. package/template/src/{custom-events/CustomEvents.ts → rtm-events-api/Events.ts} +67 -61
  124. package/template/src/rtm-events-api/index.tsx +6 -0
  125. package/template/src/rtm-events-api/types.ts +22 -0
  126. package/template/src/subComponents/ChatBubble.tsx +24 -8
  127. package/template/src/subComponents/ChatContainer.tsx +24 -15
  128. package/template/src/subComponents/ChatInput.tsx +56 -42
  129. package/template/src/subComponents/LanguageSelector.tsx +2 -2
  130. package/template/src/subComponents/LayoutIconDropdown.native.tsx +5 -5
  131. package/template/src/subComponents/LayoutIconDropdown.tsx +7 -7
  132. package/template/src/subComponents/LocalAudioMute.tsx +3 -4
  133. package/template/src/subComponents/LocalEndCall.tsx +3 -6
  134. package/template/src/subComponents/LocalSwitchCamera.tsx +3 -4
  135. package/template/src/subComponents/LocalVideoMute.tsx +3 -3
  136. package/template/src/subComponents/NetworkQualityPill.tsx +8 -9
  137. package/template/src/subComponents/OpenInNativeButton.tsx +2 -3
  138. package/template/src/subComponents/RemoteAudioMute.tsx +5 -11
  139. package/template/src/subComponents/RemoteEndCall.tsx +3 -10
  140. package/template/src/subComponents/RemoteVideoMute.tsx +3 -10
  141. package/template/src/subComponents/SelectDevice.tsx +1 -1
  142. package/template/src/subComponents/SelectOAuth.tsx +3 -2
  143. package/template/src/subComponents/SidePanelButtons.ts +6 -5
  144. package/template/src/subComponents/TextWithTooltip.tsx +6 -2
  145. package/template/src/subComponents/{toastConfig.tsx → ToastConfig.tsx} +2 -2
  146. package/template/src/subComponents/chat/ChatParticipants.tsx +6 -5
  147. package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +2 -2
  148. package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +4 -3
  149. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +2 -2
  150. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +2 -4
  151. package/template/src/subComponents/livestream/index.ts +2 -2
  152. package/template/src/subComponents/recording/useRecording.tsx +44 -23
  153. package/template/src/subComponents/recording/useRecordingLayoutQuery.tsx +11 -5
  154. package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +46 -34
  155. package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +97 -38
  156. package/template/src/subComponents/screenshare/useScreenshare.tsx +1 -1
  157. package/template/src/utils/SdkEvents.ts +9 -46
  158. package/template/src/utils/common.tsx +25 -9
  159. package/template/src/utils/getUniqueID.ts +5 -0
  160. package/template/src/utils/isMobileOrTablet.native.ts +2 -2
  161. package/template/src/utils/isMobileOrTablet.ts +21 -8
  162. package/template/src/utils/useButtonTemplate.tsx +1 -1
  163. package/template/src/utils/useCreateMeeting.ts +21 -10
  164. package/template/src/utils/useGetMeetingPhrase.ts +11 -8
  165. package/template/src/utils/{IsAttendeeUser.ts → useIsAttendee.ts} +3 -1
  166. package/template/src/utils/{isAudioEnabled.ts → useIsAudioEnabled.ts} +4 -4
  167. package/template/src/utils/{isHostUser.ts → useIsHost.ts} +13 -16
  168. package/template/src/utils/{isPSTNUser.ts → useIsPSTN.ts} +2 -2
  169. package/template/src/utils/{isScreenShareUser.ts → useIsScreenShare.ts} +0 -0
  170. package/template/src/utils/{isVideoEnabled.ts → useIsVideoEnabled.ts} +5 -6
  171. package/template/src/utils/useJoinMeeting.ts +8 -6
  172. package/template/src/utils/useLayout.tsx +5 -5
  173. package/template/src/utils/useMutePSTN.ts +5 -3
  174. package/template/src/utils/useMuteToggleLocal.ts +3 -4
  175. package/template/src/utils/useRemoteEndCall.ts +11 -10
  176. package/template/src/utils/useRemoteMute.ts +42 -20
  177. package/template/src/utils/useSidePanel.tsx +1 -1
  178. package/template/src/utils/useString.ts +2 -2
  179. package/template/src/utils/useUserName.ts +11 -0
  180. package/template/tsconfig_fpeApi.json +8 -9
  181. package/template/tsconfig_rsdk_index.json +8 -9
  182. package/template/tsconfig_wsdk_index.json +8 -9
  183. package/template/webpack.commons.js +9 -9
  184. package/template/webpack.rsdk.config.js +4 -2
  185. package/template/webpack.ts.config.js +6 -6
  186. package/template/webpack.wsdk.config.js +2 -1
  187. package/template/fpe-api/fpeEvents.ts +0 -9
  188. package/template/fpe-api/utils.ts +0 -61
  189. package/template/fpe-implementation/index.ts +0 -1
  190. package/template/fpe-todo.txt +0 -14
  191. package/template/src/components/RTMEvents.tsx +0 -84
  192. package/template/src/custom-events/index.tsx +0 -4
  193. package/template/src/custom-events/types.ts +0 -51
  194. package/template/src/pages/video-call/CustomLayout.ts +0 -17
  195. package/template/src/rtm-events/types.ts +0 -7
  196. package/template/src/utils/getMeetingInvite.ts +0 -53
  197. package/template/src/utils/useGroupMessages.ts +0 -24
  198. package/template/src/utils/useNavParams.ts +0 -6
  199. package/template/src/utils/useNavigateTo.ts +0 -8
  200. package/template/src/utils/usePrivateMessages.ts +0 -33
  201. package/template/src/utils/useSendControlMessage.ts +0 -51
  202. package/template/src/utils/useSendMessage.ts +0 -40
  203. package/template/src/utils/useSetUnreadMessageCount.ts +0 -43
  204. package/template/src/utils/useUnreadMessageCount.ts +0 -50
  205. package/template/src/utils/useUserList.ts +0 -26
@@ -10,7 +10,7 @@
10
10
  *********************************************
11
11
  */
12
12
  const configVars = require('./configTransform');
13
- const getFpePath = require('./fpe.config');
13
+ const getCustomizationApiPath = require('./customization.config');
14
14
 
15
15
  // This file is read only by react native for IOS & Android. Doesn't apply to electron, Web targets
16
16
  module.exports = {
@@ -20,14 +20,14 @@ module.exports = {
20
20
  [
21
21
  require.resolve('babel-plugin-module-resolver'),
22
22
  {
23
- root: ["./"],
23
+ root: ['./'],
24
24
  alias: {
25
- "fpe-api/install": "./fpe-api/install.ts",
26
- "fpe-api": "./fpe-api/index.ts",
27
- "fpe-implementation": "./fpe-implementation/index.ts",
28
- "test-fpe": getFpePath()
29
- }
30
- }
31
- ]
25
+ 'customization-api': './customization-api/index.ts',
26
+ 'customization-implementation':
27
+ './customization-implementation/index.ts',
28
+ customization: getCustomizationApiPath(),
29
+ },
30
+ },
31
+ ],
32
32
  ],
33
33
  };
@@ -31,6 +31,10 @@ import type {
31
31
  import {VideoProfile} from '../quality';
32
32
  import {ChannelProfile, ClientRole} from '../../../agora-rn-uikit';
33
33
  import {role, mode} from './Types';
34
+ import {LOG_ENABLED, GEO_FENCING} from '../../../config.json';
35
+ import {Platform} from 'react-native';
36
+ import isMobileOrTablet from '../../../src/utils/isMobileOrTablet';
37
+
34
38
  interface MediaDeviceInfo {
35
39
  readonly deviceId: string;
36
40
  readonly label: string;
@@ -127,7 +131,7 @@ export enum RnEncryptionEnum {
127
131
  *
128
132
  * @since v3.3.1
129
133
  */
130
- AES256GCM = 6
134
+ AES256GCM = 6,
131
135
  }
132
136
 
133
137
  export enum VideoStreamType {
@@ -161,11 +165,6 @@ if ($config.LOG_ENABLED) {
161
165
  AgoraRTC.disableLogUpload();
162
166
  }
163
167
 
164
- interface CustomEvents {
165
- ScreenshareStopped: callbackType
166
- }
167
-
168
-
169
168
  export default class RtcEngine {
170
169
  public appId: string;
171
170
  // public AgoraRTC: any;
@@ -214,20 +213,42 @@ export default class RtcEngine {
214
213
  this.videoProfile = profile;
215
214
  }
216
215
 
216
+ async enableAudio(): Promise<void> {
217
+ try {
218
+ let localAudio = await AgoraRTC.createMicrophoneAudioTrack({});
219
+ this.localStream.audio = localAudio;
220
+ } catch (e) {
221
+ let audioError = e;
222
+ e.status = {audioError};
223
+ throw e;
224
+ }
225
+ }
226
+
217
227
  async enableVideo(): Promise<void> {
228
+ /**
229
+ * Issue: Backgrounding the browser or app causes the audio streaming to be cut off.
230
+ * Impact: All browsers and apps that use WKWebView on iOS 15.x, such as Safari and Chrome.
231
+ * Solution:
232
+ * Upgrade to the Web SDK v4.7.3 or later versions.
233
+ * When calling createMicrophoneAudioTrack, set bypassWebAudio as true.
234
+ * The Web SDK directly publishes the local audio stream without processing it through WebAudio.
235
+ */
236
+
237
+ const audioConfig =
238
+ Platform.OS == 'web' && isMobileOrTablet() ? {bypassWebAudio: true} : {};
218
239
  try {
219
240
  let [localAudio, localVideo] =
220
- await AgoraRTC.createMicrophoneAndCameraTracks(
221
- {},
222
- {encoderConfig: this.videoProfile},
223
- );
241
+ await AgoraRTC.createMicrophoneAndCameraTracks(audioConfig, {
242
+ encoderConfig: this.videoProfile,
243
+ });
224
244
  this.localStream.audio = localAudio;
225
245
  this.localStream.video = localVideo;
226
246
  } catch (e) {
227
247
  let audioError = false;
228
248
  let videoError = false;
229
249
  try {
230
- let localAudio = await AgoraRTC.createMicrophoneAudioTrack({});
250
+ let localAudio = await AgoraRTC.createMicrophoneAudioTrack(audioConfig);
251
+
231
252
  this.localStream.audio = localAudio;
232
253
  } catch (error) {
233
254
  audioError = error;
@@ -673,6 +694,8 @@ export default class RtcEngine {
673
694
  break;
674
695
  case RnEncryptionEnum.SM4128ECB:
675
696
  mode = 'sm4-128-ecb';
697
+ default:
698
+ mode = 'none';
676
699
  }
677
700
  } else {
678
701
  mode = 'none';
@@ -688,7 +711,7 @@ export default class RtcEngine {
688
711
  },
689
712
  ): Promise<void> {
690
713
  let mode: EncryptionMode;
691
- mode = this.getEncryptionMode(enabled, config.encryptionMode);
714
+ mode = this.getEncryptionMode(enabled, config?.encryptionMode);
692
715
  try {
693
716
  await Promise.all([
694
717
  this.client.setEncryptionConfig(mode, config.encryptionKey),
@@ -784,20 +807,22 @@ export default class RtcEngine {
784
807
  try {
785
808
  console.log('[screenshare]: creating stream');
786
809
 
787
- let mode: EncryptionMode;
788
- mode = this.getEncryptionMode(true, encryption.mode);
789
- try {
790
- /**
791
- * Since version 4.7.0, if client leaves a call
792
- * and joins again the encryption needs to be
793
- * set again
794
- */
795
- await this.screenClient.setEncryptionConfig(
796
- mode,
797
- encryption.screenKey,
798
- );
799
- } catch (e) {
800
- console.log('e: Encryption for screenshare failed', e);
810
+ if (encryption && encryption.screenKey && encryption.mode) {
811
+ let mode: EncryptionMode;
812
+ mode = this.getEncryptionMode(true, encryption?.mode);
813
+ try {
814
+ /**
815
+ * Since version 4.7.0, if client leaves a call
816
+ * and joins again the encryption needs to be
817
+ * set again
818
+ */
819
+ await this.screenClient.setEncryptionConfig(
820
+ mode,
821
+ encryption.screenKey,
822
+ );
823
+ } catch (e) {
824
+ console.log('e: Encryption for screenshare failed', e);
825
+ }
801
826
  }
802
827
 
803
828
  const screenTracks = await AgoraRTC.createScreenVideoTrack(
@@ -0,0 +1,22 @@
1
+ //hooks used for create/join meeting
2
+ export {default as useCreateMeeting} from '../src/utils/useCreateMeeting';
3
+ export {default as useJoinMeeting} from '../src/utils/useJoinMeeting';
4
+
5
+ //mute local audio state
6
+ export {
7
+ MUTE_LOCAL_TYPE,
8
+ default as useMuteToggleLocal,
9
+ } from '../src/utils/useMuteToggleLocal';
10
+
11
+ //remove remote user from the call
12
+ export {default as useRemoteEndcall} from '../src/utils/useRemoteEndCall';
13
+
14
+ //mute remote user audio/video
15
+ export {
16
+ default as useRemoteMute,
17
+ MUTE_REMOTE_TYPE,
18
+ } from '../src/utils/useRemoteMute';
19
+
20
+ export {controlMessageEnum} from '../src/components/ChatContext';
21
+ //audio/video toggle state
22
+ export {ToggleState} from '../agora-rn-uikit/src/Contexts/PropsContext';
@@ -1,21 +1,17 @@
1
1
  /**
2
2
  * Core contexts
3
3
  */
4
- import {createHook} from 'fpe-implementation';
5
- import {
6
- RtcContext,
7
- RenderContext,
8
- PropsContext,
9
- LocalContext,
10
- } from '../agora-rn-uikit';
4
+ import {createHook} from 'customization-implementation';
5
+ import {RtcContext, RenderContext} from '../agora-rn-uikit';
6
+
11
7
  // commented for v1 release
12
8
  //import {default as DeviceContext} from '../src/components/DeviceContext';
13
9
  //import {default as StorageContext} from '../src/components/StorageContext';
14
10
 
15
- export const useRtcContext = createHook(RtcContext);
16
- export const useRenderContext = createHook(RenderContext);
17
- export const usePropsContext = createHook(PropsContext);
18
- export const useLocalContext = createHook(LocalContext);
11
+ export const useRtc = createHook(RtcContext);
12
+ export const useRender = createHook(RenderContext);
13
+ export {useLocalUserInfo} from '../src/app-state/useLocalUserInfo';
14
+
19
15
  // commented for v1 release
20
16
  //export const useDeviceContext = createHook(DeviceContext);
21
17
  //export const useStorageContext = createHook(StorageContext);
@@ -40,6 +36,12 @@ export {useRecording} from '../src/subComponents/recording/useRecording';
40
36
  export type {RecordingContextInterface} from '../src/subComponents/recording/useRecording';
41
37
  export {useMeetingInfo} from '../src/components/meeting-info/useMeetingInfo';
42
38
  export type {MeetingInfoContextInterface} from '../src/components/meeting-info/useMeetingInfo';
43
- // commented for v1 release
44
- // export {useChatUIControl} from '../src/components/chat-ui/useChatUIControl';
45
- // export type {ChatUIControlInterface} from '../src/components/chat-ui/useChatUIControl';
39
+ export {useChatUIControl} from '../src/components/chat-ui/useChatUIControl';
40
+ export type {ChatUIControlInterface} from '../src/components/chat-ui/useChatUIControl';
41
+ export {useMessages} from '../src/app-state/useMessages';
42
+ export type {messageInterface} from '../src/app-state/useMessages';
43
+ export {SidePanelType} from '../src/subComponents/SidePanelEnum';
44
+ export {useSidePanel} from '../src/utils/useSidePanel';
45
+
46
+ //hook used to get/set username
47
+ export {default as useUserName} from '../src/utils/useUserName';
@@ -0,0 +1,9 @@
1
+ // 1. Import Events
2
+ import Events from '../src/rtm-events-api/Events';
3
+ import {EventSource} from '../src/rtm-events-api';
4
+
5
+ // 2. Initialize with source "fpe"
6
+ const customEvents = new Events(EventSource.fpe);
7
+
8
+ // 3. export
9
+ export {customEvents};
@@ -9,12 +9,12 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import {FpeApiInterface} from './typeDefinition';
12
+ import {CustomizationApiInterface} from './typeDefinition';
13
13
  import ReactIs from 'react-is';
14
14
  /**
15
15
  *
16
- * @param config FPE options to override the UI components and customize the application
17
- * @returns config options
16
+ * @param config customization options to override the UI components and customize the application
17
+ * @returns customization options
18
18
  */
19
19
 
20
20
  function isString(data: any) {
@@ -45,18 +45,28 @@ function isComponent(data: any) {
45
45
  return false;
46
46
  }
47
47
 
48
+ //These keys value are not react component. so doing indexOf and checking whether its function or not
49
+ const ignoreTheseKeys = ['customLayout', 'useUserContext'];
50
+
48
51
  function validateComponents(components: any) {
49
52
  for (const key in components) {
50
- let comp = components[key];
51
- if (comp) {
52
- if (isComponent(comp) || isObject(comp)) {
53
- if (isObject(comp)) {
54
- validateComponents(comp);
53
+ if (ignoreTheseKeys.indexOf(key) === -1) {
54
+ let comp = components[key];
55
+ if (comp) {
56
+ if (isComponent(comp) || isObject(comp)) {
57
+ if (isObject(comp)) {
58
+ validateComponents(comp);
59
+ }
60
+ } else {
61
+ console.error(
62
+ `Customize:Error ${key} should be a react component or object`,
63
+ );
55
64
  }
56
- } else {
57
- console.error(
58
- `InstallFPE:Error ${key} should be a react component or object`,
59
- );
65
+ }
66
+ } else {
67
+ let comp = components[key];
68
+ if (comp && !isFunction(comp)) {
69
+ console.error(`Customize:Error ${key} should be an function`);
60
70
  }
61
71
  }
62
72
  }
@@ -67,7 +77,7 @@ function validateLifecycle(data: any) {
67
77
  const callback = data[key];
68
78
  if (callback && !isFunction(callback)) {
69
79
  console.error(
70
- `InstallFPE:Error ${key} should be a function that return async function`,
80
+ `Customize:Error ${key} should be a function that return async function`,
71
81
  );
72
82
  }
73
83
  }
@@ -75,20 +85,14 @@ function validateLifecycle(data: any) {
75
85
 
76
86
  function validateCustomRoutes(routes: any) {
77
87
  if (routes && !Array.isArray(routes)) {
78
- console.error(`InstallFPE:Error customRoutes should be an array`);
79
- }
80
- }
81
-
82
- function validateAppRoot(data: any) {
83
- if (data && !isComponent(data)) {
84
- console.error(`InstallFPE:Error appRoot should be a react component`);
88
+ console.error(`Customize:Error customRoutes should be an array`);
85
89
  }
86
90
  }
87
91
 
88
92
  function validatei18n(data: any) {
89
93
  if (data) {
90
94
  if (!Array.isArray(data)) {
91
- console.error(`InstallFPE:Error i18n should be an array`);
95
+ console.error(`Customize:Error i18n should be an array`);
92
96
  } else {
93
97
  data.map((item) => {
94
98
  const langData = item.data;
@@ -97,7 +101,7 @@ function validatei18n(data: any) {
97
101
  if (value) {
98
102
  if (!(isString(value) || isFunction(value))) {
99
103
  console.error(
100
- `InstallFPE:Error ${item.locale} ${key} should be a string or function`,
104
+ `Customize:Error ${item.locale} ${key} should be a string or function`,
101
105
  );
102
106
  }
103
107
  }
@@ -106,7 +110,7 @@ function validatei18n(data: any) {
106
110
  }
107
111
  }
108
112
  }
109
- export const installFPE = (config: FpeApiInterface) => {
113
+ export const customize = (config: CustomizationApiInterface) => {
110
114
  //validating the components
111
115
  config?.components && validateComponents(config.components);
112
116
 
@@ -114,9 +118,6 @@ export const installFPE = (config: FpeApiInterface) => {
114
118
  //commented for v1 release
115
119
  //config?.customRoutes && validateCustomRoutes(config.customRoutes);
116
120
 
117
- //validating the app root
118
- config?.appRoot && validateAppRoot(config.appRoot);
119
-
120
121
  //validating the i18n
121
122
  config?.i18n && validatei18n(config.i18n);
122
123
 
@@ -9,13 +9,18 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import fpeConfig from 'test-fpe';
13
12
 
14
- export {fpeConfig};
13
+ // TODO: Investigate further
14
+ // Exported like so to prevent error while bundling as react-sdk. Cause: some webpack Edgecase
15
+ import {customize} from './customize';
16
+ import configJSON from '../config.json';
15
17
 
16
- export * from './useFpe';
17
- export * from './context';
18
- export * from './components';
18
+ let $config = configJSON as unknown as ConfigInterface;
19
+
20
+ export {customize, $config};
21
+ export * from './action-library';
22
+ export * from './app-state';
23
+ export * from './customEvents';
24
+ export * from './sub-components';
19
25
  export * from './typeDefinition';
20
26
  export * from './utils';
21
- export * from './fpeEvents';
@@ -1,3 +1,8 @@
1
+ //Common components
2
+ export {default as HorizontalRule} from '../src/atoms/HorizontalRule';
3
+ export {default as PrimaryButton} from '../src/atoms/PrimaryButton';
4
+ export {default as SecondaryButton} from '../src/atoms/SecondaryButton';
5
+ export {default as TextInput} from '../src/atoms/TextInput';
1
6
  //Icons
2
7
  export {default as icons} from '../src/assets/icons';
3
8
 
@@ -18,15 +23,21 @@ export {
18
23
  ParticipantsView,
19
24
  Controls,
20
25
  ControlsComponentsArray,
26
+ Navbar,
27
+ NavBarComponentsArray,
21
28
  ChatBubble,
29
+ ChatSendButton,
30
+ ChatTextInput,
31
+ Chat,
32
+ SettingsView,
22
33
  } from '../src/pages/video-call/index';
23
34
  export {default as GridLayout} from '../src/components/GridVideo';
24
35
  export {default as PinnedLayout} from '../src/components/PinnedVideo';
25
36
  export {default as VideoComponent} from '../src/pages/video-call/VideoComponent';
26
- export {MaxVideoRenderer as MaxVideoView} from '../src/pages/video-call/VideoRenderer';
37
+ export {default as MaxVideoView} from '../src/pages/video-call/VideoRenderer';
27
38
  export {default as RenderComponent} from '../src/pages/video-call/RenderComponent';
28
- export {NameWithMicStatus} from '../src/pages/video-call/NameWithMicStatus';
29
- export {NetworkQualityPill} from '../src/subComponents/NetworkQualityPill';
39
+ export {default as NameWithMicIcon} from '../src/pages/video-call/NameWithMicIcon';
40
+ export {default as NetworkQualityPill} from '../src/subComponents/NetworkQualityPill';
30
41
  //videocall screen
31
42
  export {default as VideocallScreen} from '../src/pages/video-call/VideoCallScreen';
32
43
 
@@ -41,3 +52,11 @@ export {default as VideocallScreen} from '../src/pages/video-call/VideoCallScree
41
52
 
42
53
  //Sidepanel buttons
43
54
  export {SidePanelButtonsArray} from '../src/subComponents/SidePanelButtons';
55
+ export {
56
+ ImageIcon as UiKitImageIcon,
57
+ MaxVideoView as UiKitMaxVideoView,
58
+ BtnTemplate as UiKitBtnTemplate,
59
+ ClientRole as UikitClientRole,
60
+ ChannelProfile as UikitChannelProfile,
61
+ } from '../agora-rn-uikit';
62
+ export type {BtnTemplateInterface as UikitBtnTemplateInterface} from '../agora-rn-uikit';
@@ -17,8 +17,9 @@ import {
17
17
  RenderStateInterface,
18
18
  UidType,
19
19
  } from '../agora-rn-uikit';
20
- import {i18nInterface} from '../src/language/i18nTypes';
20
+ import {I18nInterface} from '../src/language/i18nTypes';
21
21
  import {IconsInterface} from '../agora-rn-uikit/src/Controls/Icons';
22
+ export type {RenderInterface, RenderStateInterface, UidType};
22
23
  export type {
23
24
  ChatTextInputProps,
24
25
  ChatSendButtonProps,
@@ -49,9 +50,8 @@ export interface ChatCmpInterface {
49
50
  //commented for v1 release
50
51
  //extends BeforeAndAfterInterface
51
52
  chatBubble?: React.ComponentType<ChatBubbleProps>;
52
- //commented for v1 release
53
- //chatInput?: React.ComponentType<ChatTextInputProps>;
54
- //chatSentButton?: React.ComponentType<ChatSendButtonProps>;
53
+ chatInput?: React.ComponentType<ChatTextInputProps>;
54
+ chatSendButton?: React.ComponentType<ChatSendButtonProps>;
55
55
  }
56
56
 
57
57
  export interface renderComponentInterface {
@@ -63,7 +63,7 @@ export interface renderComponentObjectInterface {
63
63
  }
64
64
 
65
65
  export type layoutComponent = React.ComponentType<{
66
- renderData: RenderStateInterface['renderPosition'];
66
+ renderData: RenderStateInterface['activeUids'];
67
67
  }>;
68
68
 
69
69
  export interface layoutObjectBase {
@@ -84,16 +84,21 @@ export type layoutObjectType = layoutObjectWithIcon | layoutObjectWithIconName;
84
84
 
85
85
  export interface VideoCallInterface extends BeforeAndAfterInterface {
86
86
  // commented for v1 release
87
- //topBar?: React.ComponentType;
87
+ topBar?: React.ComponentType;
88
88
  //settingsPanel?: React.ComponentType;
89
89
  participantsPanel?: React.ComponentType;
90
90
  bottomBar?: React.ComponentType;
91
91
  chat?: ChatCmpInterface;
92
92
  customContent?: renderComponentObjectInterface;
93
93
  customLayout?: (layouts: layoutObjectType[]) => layoutObjectType[];
94
+ useUserContext?: () => void;
94
95
  }
95
96
 
96
97
  export type ComponentsInterface = {
98
+ /**
99
+ * Custom context/api provider wrapped in root level
100
+ */
101
+ appRoot?: React.ComponentType;
97
102
  // commented for v1 release
98
103
  //precall?: PreCallInterface | React.ComponentType;
99
104
  //create?: React.ComponentType;
@@ -114,7 +119,7 @@ export interface CustomRoutesInterface {
114
119
 
115
120
  export type CustomHookType = () => () => Promise<void>;
116
121
 
117
- export interface FpeApiInterface {
122
+ export interface CustomizationApiInterface {
118
123
  /**
119
124
  * components used to replace whole screen or subcomponents
120
125
  */
@@ -124,14 +129,10 @@ export interface FpeApiInterface {
124
129
  */
125
130
  // commented for v1 release
126
131
  //customRoutes?: CustomRoutesInterface[];
127
- /**
128
- * Custom context/api provider wrapped in root level
129
- */
130
- appRoot?: React.ComponentType;
131
132
  /**
132
133
  * Internationlization
133
134
  */
134
- i18n?: i18nInterface[];
135
+ i18n?: I18nInterface[];
135
136
  /**
136
137
  * Life cycle events
137
138
  */
@@ -140,6 +141,4 @@ export interface FpeApiInterface {
140
141
  // useBeforeJoin?: CustomHookType;
141
142
  // useBeforeCreate?: CustomHookType;
142
143
  // };
143
- // commented for v1 release
144
- //customUserContext?: () => any;
145
144
  }
@@ -0,0 +1,30 @@
1
+ /*
2
+ ********************************************
3
+ Copyright © 2021 Agora Lab, Inc., all rights reserved.
4
+ AppBuilder and all associated components, source code, APIs, services, and documentation
5
+ (the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
6
+ accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
7
+ Use without a license or in violation of any license terms and conditions (including use for
8
+ any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
9
+ information visit https://appbuilder.agora.io.
10
+ *********************************************
11
+ */
12
+ // commented for v1 release
13
+ //export {default as useIsScreenShare} from '../src/utils/useIsScreenShare';
14
+
15
+ //hooks used to check user type
16
+ export {default as useIsHost} from '../src/utils/useIsHost';
17
+ export {default as useIsAttendee} from '../src/utils/useIsAttendee';
18
+ export {default as useIsPSTN} from '../src/utils/useIsPSTN';
19
+
20
+ //hook to manage audio/video states
21
+ export {default as useIsAudioEnabled} from '../src/utils/useIsAudioEnabled';
22
+ export {default as useIsVideoEnabled} from '../src/utils/useIsVideoEnabled';
23
+
24
+ //hooks used for navigation
25
+ export {useHistory, useParams} from '../src/components/Router';
26
+
27
+ //export common function
28
+ export {isWeb, isIOS, isAndroid, isDestop} from '../src/utils/common';
29
+ export {default as isMobileOrTablet} from '../src/utils/isMobileOrTablet';
30
+ export {useLocalUid} from '../agora-rn-uikit';
@@ -9,9 +9,9 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import { installFPE } from "fpe-api/install";
12
+ import {customize} from 'customization-api';
13
13
  /**
14
- * Dummy FPE used to load when project doesn't have the FPE.
14
+ * Dummy Config used to load when project doesn't have the customization.
15
15
  */
16
- const data = installFPE({});
17
- export default data;
16
+ const dummyConfig = customize({});
17
+ export default dummyConfig;
@@ -0,0 +1,4 @@
1
+ export {default as createHook} from './createHook';
2
+ export {CustomizationProvider, useCustomization} from './useCustomization';
3
+ export type {CustomizationProviderProps} from './useCustomization';
4
+ export {default as customizationConfig} from 'customization';
@@ -10,26 +10,26 @@
10
10
  *********************************************
11
11
  */
12
12
  import React from 'react';
13
- import fpeConfig from 'test-fpe';
14
- import {FpeApiInterface} from './typeDefinition';
15
- import {createHook} from 'fpe-implementation';
13
+ import {CustomizationApiInterface} from 'customization-api';
14
+ import customizationConfig from 'customization';
15
+ import createHook from './createHook';
16
16
 
17
- const FpeContext: React.Context<FpeApiInterface> =
18
- React.createContext(fpeConfig);
17
+ const CustomizationContext: React.Context<CustomizationApiInterface> =
18
+ React.createContext(customizationConfig);
19
19
 
20
- export interface FpeProviderInterface {
20
+ export interface CustomizationProviderProps {
21
21
  children: React.ReactNode;
22
- value: FpeApiInterface;
22
+ value: CustomizationApiInterface;
23
23
  }
24
24
 
25
- const FpeProvider = (props: FpeProviderInterface) => {
25
+ const CustomizationProvider = (props: CustomizationProviderProps) => {
26
26
  return (
27
- <FpeContext.Provider value={props.value}>
27
+ <CustomizationContext.Provider value={props.value}>
28
28
  {props.children}
29
- </FpeContext.Provider>
29
+ </CustomizationContext.Provider>
30
30
  );
31
31
  };
32
32
 
33
- const useFpe = createHook(FpeContext);
33
+ const useCustomization = createHook(CustomizationContext);
34
34
 
35
- export {useFpe, FpeProvider};
35
+ export {useCustomization, CustomizationProvider};
@@ -11,19 +11,19 @@
11
11
  */
12
12
 
13
13
  /*
14
- getFpePath - will return test-fpe if exists otherwise it will return the dummy fpe path
14
+ getCustomizationApiPath - will return customization if exists otherwise it will return the dummy customization path
15
15
  */
16
16
  const fs = require('fs');
17
- const FpePathTs = './test-fpe/index.ts';
18
- const FpePathTsx = './test-fpe/index.tsx';
19
- const FpeDummyPath = './fpe-implementation/dummyFpe.ts';
20
- const getFpePath = () => {
21
- if (fs.existsSync(FpePathTs)) {
22
- return FpePathTs;
17
+ const customizationPathTs = './customization/index.ts';
18
+ const customizationPathTsx = './customization/index.tsx';
19
+ const customizationDummyPath = './customization-implementation/dummyConfig.ts';
20
+ const getCustomizationApiPath = () => {
21
+ if (fs.existsSync(customizationPathTs)) {
22
+ return customizationPathTs;
23
23
  }
24
- if (fs.existsSync(FpePathTsx)) {
25
- return FpePathTsx;
24
+ if (fs.existsSync(customizationPathTsx)) {
25
+ return customizationPathTsx;
26
26
  }
27
- return FpeDummyPath;
27
+ return customizationDummyPath;
28
28
  };
29
- module.exports = getFpePath;
29
+ module.exports = getCustomizationApiPath;