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,13 +10,15 @@
10
10
  *********************************************
11
11
  */
12
12
  import React from 'react';
13
- import {Platform} from 'react-native';
13
+ import {Platform as ReactNativePlatform} from 'react-native';
14
+ import Platform from '../subComponents/Platform';
15
+
14
16
  import * as ReactIs from 'react-is';
15
17
 
16
18
  const isValidReactComponent = <T,>(Component?: React.ComponentType<T>) =>
17
19
  Component && ReactIs.isValidElementType(Component) ? true : false;
18
20
 
19
- const hasBrandLogo: boolean = !!$config.LOGO;
21
+ const useHasBrandLogo = () => () => !!$config.LOGO;
20
22
 
21
23
  const shouldAuthenticate: boolean =
22
24
  $config.ENABLE_APPLE_OAUTH ||
@@ -24,17 +26,31 @@ const shouldAuthenticate: boolean =
24
26
  $config.ENABLE_MICROSOFT_OAUTH ||
25
27
  $config.ENABLE_SLACK_OAUTH;
26
28
 
27
- const isWeb = Platform.OS === 'web';
28
- const isAndroid = Platform.OS === 'android';
29
- const isIOS = Platform.OS === 'ios';
29
+ //for our internal usage don't check Platform - electron and web will same kind ui checks. thats why we have isWeb for external usage
30
+ const isWebInternal = () => ReactNativePlatform.OS === 'web';
31
+
32
+ const isWeb = () => Platform === 'web' && ReactNativePlatform.OS === 'web';
33
+
34
+ const isAndroid = () =>
35
+ //@ts-ignore
36
+ Platform === 'native' && ReactNativePlatform.OS === 'android';
37
+
38
+ //@ts-ignore
39
+ const isIOS = () => Platform === 'native' && ReactNativePlatform.OS === 'ios';
40
+
41
+ //@ts-ignore
42
+ const isDestop = () => Platform === 'electron';
43
+
30
44
  const isArray = (data: any[]) =>
31
45
  data && Array.isArray(data) && data.length ? true : false ? true : false;
32
46
  export {
33
- hasBrandLogo,
34
- shouldAuthenticate,
35
- isWeb,
36
- isIOS,
47
+ useHasBrandLogo,
37
48
  isAndroid,
49
+ isIOS,
50
+ isWebInternal,
51
+ isWeb,
52
+ isDestop,
53
+ shouldAuthenticate,
38
54
  isArray,
39
55
  isValidReactComponent,
40
56
  };
@@ -0,0 +1,5 @@
1
+ import {nanoid} from 'nanoid/non-secure';
2
+
3
+ export default function getUniqueID() {
4
+ return nanoid();
5
+ }
@@ -1,5 +1,5 @@
1
1
  const isMobileOrTablet = () => {
2
2
  return true;
3
- }
3
+ };
4
4
 
5
- export default isMobileOrTablet;
5
+ export default isMobileOrTablet;
@@ -1,10 +1,23 @@
1
- declare global{
2
- interface Window {opera?: any}
1
+ declare global {
2
+ interface Window {
3
+ opera?: any;
4
+ }
3
5
  }
6
+
4
7
  const isMobileOrTablet = () => {
5
- let check = false;
6
- (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator?.userAgent||navigator?.vendor||window?.opera);
7
- return check;
8
- }
9
-
10
- export default isMobileOrTablet;
8
+ let check = false;
9
+ (function (a) {
10
+ if (
11
+ /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(
12
+ a,
13
+ ) ||
14
+ /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
15
+ a.substr(0, 4),
16
+ )
17
+ )
18
+ check = true;
19
+ })(navigator?.userAgent || navigator?.vendor || window?.opera);
20
+ return check;
21
+ };
22
+
23
+ export default isMobileOrTablet;
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  import React from 'react';
14
- import {createHook} from 'fpe-implementation';
14
+ import {createHook} from 'customization-implementation';
15
15
 
16
16
  export enum ButtonTemplateName {
17
17
  topBar,
@@ -1,6 +1,7 @@
1
1
  import {gql, useMutation} from '@apollo/client';
2
2
  import {MeetingInfoContextInterface} from '../components/meeting-info/useMeetingInfo';
3
3
  import {useSetMeetingInfo} from '../components/meeting-info/useSetMeetingInfo';
4
+ import SDKEvents from '../utils/SdkEvents';
4
5
 
5
6
  const CREATE_CHANNEL = gql`
6
7
  mutation CreateChannel(
@@ -45,28 +46,38 @@ export default function useCreateMeeting() {
45
46
  throw error;
46
47
  }
47
48
  if (res && res?.data && res?.data?.createChannel) {
48
- let meetingInfoPassPhrase: MeetingInfoContextInterface['meetingPassphrase'] =
49
- {
49
+ let meetingInfo: Partial<MeetingInfoContextInterface['data']> = {
50
+ roomId: {
50
51
  attendee: '',
51
- };
52
+ },
53
+ };
52
54
  if (res?.data?.createChannel?.passphrase?.view) {
53
- meetingInfoPassPhrase.attendee = res.data.createChannel.passphrase.view;
55
+ meetingInfo.roomId.attendee = res.data.createChannel.passphrase.view;
54
56
  }
55
57
  if (res?.data?.createChannel?.passphrase?.host) {
56
- meetingInfoPassPhrase.host = res.data.createChannel.passphrase.host;
58
+ meetingInfo.roomId.host = res.data.createChannel.passphrase.host;
57
59
  }
58
60
  if (enablePSTN === true && res?.data?.createChannel?.pstn) {
59
- meetingInfoPassPhrase.pstn = {
61
+ meetingInfo.pstn = {
60
62
  number: res.data.createChannel.pstn.number,
61
63
  pin: res.data.createChannel.pstn.dtmf,
62
64
  };
63
65
  }
64
66
  setMeetingInfo({
65
- isHost: true,
66
- isSeparateHostLink: isSeparateHostLink ? true : false,
67
- meetingTitle: roomTitle,
68
- meetingPassphrase: meetingInfoPassPhrase,
67
+ data: {
68
+ isHost: true,
69
+ isSeparateHostLink: isSeparateHostLink ? true : false,
70
+ meetingTitle: roomTitle,
71
+ roomId: meetingInfo?.roomId,
72
+ pstn: meetingInfo?.pstn,
73
+ },
69
74
  });
75
+ SDKEvents.emit(
76
+ 'create',
77
+ meetingInfo.roomId.host,
78
+ meetingInfo.roomId.attendee,
79
+ meetingInfo?.pstn,
80
+ );
70
81
  } else {
71
82
  throw new Error(`An error occurred in parsing the channel data.`);
72
83
  }
@@ -37,18 +37,17 @@ export default function useGetMeetingPhrase() {
37
37
  try {
38
38
  if (response && response.data) {
39
39
  let data = response.data;
40
- let meetingPassphrase: MeetingInfoContextInterface['meetingPassphrase'] =
41
- {
42
- attendee: '',
43
- };
40
+ let meetingInfo: Partial<MeetingInfoContextInterface['data']> = {
41
+ roomId: {attendee: ''},
42
+ };
44
43
  if (data?.share?.passphrase?.view) {
45
- meetingPassphrase.attendee = data.share.passphrase.view;
44
+ meetingInfo.roomId.attendee = data.share.passphrase.view;
46
45
  }
47
46
  if (data?.share?.passphrase?.host) {
48
- meetingPassphrase.host = data.share.passphrase.host;
47
+ meetingInfo.roomId.host = data.share.passphrase.host;
49
48
  }
50
49
  if (data?.share?.pstn) {
51
- meetingPassphrase.pstn = {
50
+ meetingInfo.pstn = {
52
51
  number: data.share.pstn.number,
53
52
  pin: data.share.pstn.dtmf,
54
53
  };
@@ -56,7 +55,11 @@ export default function useGetMeetingPhrase() {
56
55
  setMeetingInfo((prevState) => {
57
56
  return {
58
57
  ...prevState,
59
- meetingPassphrase,
58
+ data: {
59
+ ...prevState.data,
60
+ roomId: meetingInfo.roomId,
61
+ pstn: meetingInfo?.pstn,
62
+ },
60
63
  };
61
64
  });
62
65
  }
@@ -23,7 +23,9 @@ function useIsAttendee() {
23
23
  };
24
24
  return isAttendee;
25
25
  } else {
26
- const {isHost} = useMeetingInfo();
26
+ const {
27
+ data: {isHost},
28
+ } = useMeetingInfo();
27
29
  const isAttendee = (uid: UidType) => {
28
30
  return !isHost ? true : false;
29
31
  };
@@ -9,21 +9,21 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
+ import {useRender} from 'customization-api';
12
13
  import {UidType} from '../../agora-rn-uikit';
13
14
  import {ToggleState} from '../../agora-rn-uikit/src/Contexts/PropsContext';
14
- import useUserList from './useUserList';
15
15
 
16
16
  function useIsAudioEnabled() {
17
- const {renderList} = useUserList();
17
+ const {renderList} = useRender();
18
18
  /**
19
19
  *
20
20
  * @param uid UidType
21
21
  * @returns boolean
22
22
  */
23
- const audioEnabled = (uid: UidType): boolean =>
23
+ const isAudioEnabled = (uid: UidType): boolean =>
24
24
  renderList[uid]?.audio === ToggleState.enabled;
25
25
 
26
- return audioEnabled;
26
+ return isAudioEnabled;
27
27
  }
28
28
 
29
29
  export default useIsAudioEnabled;
@@ -9,25 +9,22 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
-
13
- import {useMeetingInfo} from '../components/meeting-info/useMeetingInfo';
14
- import {useLiveStreamDataContext} from '../components/contexts/LiveStreamDataContext';
15
12
  import {UidType} from '../../agora-rn-uikit';
13
+ import {useLiveStreamDataContext} from '../components/contexts/LiveStreamDataContext';
14
+ import {useVideoMeetingData} from '../components/contexts/VideoMeetingDataContext';
16
15
 
17
16
  function useIsHost() {
18
- if ($config.EVENT_MODE) {
19
- const {hostUids} = useLiveStreamDataContext();
20
- const isHost = (uid: UidType) => {
21
- return hostUids.filter((hostId) => hostId === uid).length ? true : false;
22
- };
23
- return isHost;
24
- } else {
25
- const {isHost} = useMeetingInfo();
26
- const isHostFun = (uid: UidType) => {
27
- return isHost ? true : false;
28
- };
29
- return isHostFun;
30
- }
17
+ const {hostUids: liveStreamHostUids} = useLiveStreamDataContext();
18
+ const {hostUids: videoMeetingHostUids} = useVideoMeetingData();
19
+ const isHost = (uid: UidType) => {
20
+ const hostUidsData = $config.EVENT_MODE
21
+ ? liveStreamHostUids
22
+ : videoMeetingHostUids;
23
+ return hostUidsData.filter((hostId) => hostId === uid).length
24
+ ? true
25
+ : false;
26
+ };
27
+ return isHost;
31
28
  }
32
29
 
33
30
  export default useIsHost;
@@ -9,14 +9,14 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
+ import {useRender} from 'customization-api';
12
13
  import {UidType} from '../../agora-rn-uikit';
13
- import useUserList from './useUserList';
14
14
  /**
15
15
  * This hook will return the function to check whether the current user is a PSTN user or not
16
16
  * @returns function
17
17
  */
18
18
  function useIsPSTN() {
19
- const {renderList} = useUserList();
19
+ const {renderList} = useRender();
20
20
  /**
21
21
  *
22
22
  * @param uid number
@@ -9,21 +9,20 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import {UidType} from '../../agora-rn-uikit';
13
- import {ToggleState} from '../../agora-rn-uikit/src/Contexts/PropsContext';
14
- import useUserList from './useUserList';
12
+ import {useRender} from 'customization-api';
13
+ import {UidType, ToggleState} from '../../agora-rn-uikit';
15
14
 
16
15
  function useIsVideoEnabled() {
17
- const {renderList} = useUserList();
16
+ const {renderList} = useRender();
18
17
 
19
18
  /**
20
19
  *
21
20
  * @param uid UidType
22
21
  * @returns boolean
23
22
  */
24
- const videoEnabled = (uid: UidType): boolean =>
23
+ const isVideoEnabled = (uid: UidType): boolean =>
25
24
  renderList[uid]?.video === ToggleState.enabled;
26
25
 
27
- return videoEnabled;
26
+ return isVideoEnabled;
28
27
  }
29
28
  export default useIsVideoEnabled;
@@ -77,9 +77,7 @@ export default function useJoinMeeting() {
77
77
  } else {
78
78
  if (response && response.data) {
79
79
  let data = response.data;
80
- let meetingInfo: Partial<MeetingInfoContextInterface> = {
81
- isJoinDataFetched: true,
82
- };
80
+ let meetingInfo: Partial<MeetingInfoContextInterface['data']> = {};
83
81
  if (data?.joinChannel?.channel) {
84
82
  meetingInfo.channel = data.joinChannel.channel;
85
83
  }
@@ -90,10 +88,10 @@ export default function useJoinMeeting() {
90
88
  meetingInfo.token = data.joinChannel.mainUser.rtc;
91
89
  }
92
90
  if (data?.joinChannel?.mainUser?.rtm) {
93
- meetingInfo.rtm = data.joinChannel.mainUser.rtm;
91
+ meetingInfo.rtmToken = data.joinChannel.mainUser.rtm;
94
92
  }
95
93
  if (data?.joinChannel?.secret) {
96
- meetingInfo.secret = data.joinChannel.secret;
94
+ meetingInfo.encryptionSecret = data.joinChannel.secret;
97
95
  }
98
96
  if (data?.joinChannel?.screenShare?.uid) {
99
97
  meetingInfo.screenShareUid = data.joinChannel.screenShare.uid;
@@ -114,7 +112,11 @@ export default function useJoinMeeting() {
114
112
  setMeetingInfo((prevState) => {
115
113
  return {
116
114
  ...prevState,
117
- ...meetingInfo,
115
+ isJoinDataFetched: true,
116
+ data: {
117
+ ...prevState.data,
118
+ ...meetingInfo,
119
+ },
118
120
  };
119
121
  });
120
122
  } else {
@@ -11,16 +11,16 @@
11
11
  */
12
12
 
13
13
  import React, {SetStateAction} from 'react';
14
- import {createHook} from 'fpe-implementation';
14
+ import {createHook} from 'customization-implementation';
15
15
 
16
16
  export interface LayoutContextInterface {
17
- activeLayoutName: string;
18
- setActiveLayoutName: React.Dispatch<SetStateAction<string>>;
17
+ currentLayout: string;
18
+ setLayout: React.Dispatch<SetStateAction<string>>;
19
19
  }
20
20
 
21
21
  const LayoutContext = React.createContext<LayoutContextInterface>({
22
- activeLayoutName: '',
23
- setActiveLayoutName: () => {},
22
+ currentLayout: '',
23
+ setLayout: () => {},
24
24
  });
25
25
 
26
26
  interface LayoutProviderProps {
@@ -1,7 +1,7 @@
1
1
  import {gql, useMutation} from '@apollo/client';
2
2
  import {UidType} from '../../agora-rn-uikit';
3
3
  import {useMeetingInfo} from '../components/meeting-info/useMeetingInfo';
4
- import useIsPSTN from './isPSTNUser';
4
+ import useIsPSTN from './useIsPSTN';
5
5
  const MUTE_PSTN = gql`
6
6
  mutation mutePSTN($uid: Int!, $passphrase: String!, $mute: Boolean!) {
7
7
  mutePSTN(uid: $uid, passphrase: $passphrase, mute: $mute) {
@@ -13,7 +13,9 @@ const MUTE_PSTN = gql`
13
13
 
14
14
  const useMutePSTN = () => {
15
15
  const [mutePSTN, {data, loading, error}] = useMutation(MUTE_PSTN);
16
- const {isHost, meetingPassphrase} = useMeetingInfo();
16
+ const {
17
+ data: {isHost, roomId},
18
+ } = useMeetingInfo();
17
19
  const isPSTN = useIsPSTN();
18
20
  return async (uid: UidType) => {
19
21
  if (isHost) {
@@ -21,7 +23,7 @@ const useMutePSTN = () => {
21
23
  await mutePSTN({
22
24
  variables: {
23
25
  uid: uid,
24
- passphrase: meetingPassphrase?.host,
26
+ passphrase: roomId?.host,
25
27
  //todo: hari need to test mute flag for PSTN
26
28
  mute: 1,
27
29
  },
@@ -9,8 +9,7 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import {useContext} from 'react';
13
- import {RtcContext, LocalContext} from '../../agora-rn-uikit';
12
+ import {useLocalUserInfo, useRtc} from 'customization-api';
14
13
  import {ToggleState} from '../../agora-rn-uikit/src/Contexts/PropsContext';
15
14
 
16
15
  export enum MUTE_LOCAL_TYPE {
@@ -18,8 +17,8 @@ export enum MUTE_LOCAL_TYPE {
18
17
  video,
19
18
  }
20
19
  function useMuteToggleLocal() {
21
- const {RtcEngine, dispatch} = useContext(RtcContext);
22
- const local = useContext(LocalContext);
20
+ const {RtcEngine, dispatch} = useRtc();
21
+ const local = useLocalUserInfo();
23
22
 
24
23
  return async (type: MUTE_LOCAL_TYPE) => {
25
24
  switch (type) {
@@ -1,21 +1,22 @@
1
1
  import {controlMessageEnum} from '../components/ChatContext';
2
- import {UidType} from '../../agora-rn-uikit';
3
2
  import {useMeetingInfo} from '../components/meeting-info/useMeetingInfo';
4
- import useIsPSTN from './isPSTNUser';
5
- import useSendControlMessage, {
6
- CONTROL_MESSAGE_TYPE,
7
- } from '../utils/useSendControlMessage';
3
+ import useIsPSTN from './useIsPSTN';
4
+ import {UidType} from '../../agora-rn-uikit';
5
+ import events, {EventPersistLevel} from '../rtm-events-api';
8
6
 
9
7
  const useRemoteEndCall = () => {
10
- const sendCtrlMsgToUid = useSendControlMessage();
11
- const {isHost} = useMeetingInfo();
8
+ const {
9
+ data: {isHost},
10
+ } = useMeetingInfo();
12
11
  const isPSTN = useIsPSTN();
12
+
13
13
  return (uid: UidType) => {
14
- if (isHost) {
14
+ if (isHost && uid) {
15
15
  if (!isPSTN(uid)) {
16
- sendCtrlMsgToUid(
17
- CONTROL_MESSAGE_TYPE.controlMessageToUid,
16
+ events.send(
18
17
  controlMessageEnum.kickUser,
18
+ '',
19
+ EventPersistLevel.LEVEL1,
19
20
  uid,
20
21
  );
21
22
  }
@@ -10,47 +10,69 @@
10
10
  *********************************************
11
11
  */
12
12
  import {useMeetingInfo} from '../components/meeting-info/useMeetingInfo';
13
- import {UidType} from '../../agora-rn-uikit';
14
13
  import {controlMessageEnum} from '../components/ChatContext';
15
- import useIsPSTN from './isPSTNUser';
14
+ import useIsPSTN from './useIsPSTN';
16
15
  import useMutePSTN from './useMutePSTN';
17
- import useSendControlMessage, {
18
- CONTROL_MESSAGE_TYPE,
19
- } from '../utils/useSendControlMessage';
16
+ import {UidType} from '../../agora-rn-uikit';
17
+ import events, {EventPersistLevel} from '../rtm-events-api';
20
18
 
21
19
  export enum MUTE_REMOTE_TYPE {
22
20
  audio,
23
21
  video,
24
22
  }
25
23
  function useRemoteMute() {
26
- const sendCtrlMsgToUid = useSendControlMessage();
27
- const {isHost} = useMeetingInfo();
24
+ const {
25
+ data: {isHost},
26
+ } = useMeetingInfo();
28
27
  const isPSTN = useIsPSTN();
29
28
  const mutePSTN = useMutePSTN();
30
- return async (type: MUTE_REMOTE_TYPE, uid: UidType) => {
29
+
30
+ return async (type: MUTE_REMOTE_TYPE, uid?: UidType) => {
31
31
  if (isHost) {
32
32
  switch (type) {
33
33
  case MUTE_REMOTE_TYPE.audio:
34
- if (isPSTN(uid)) {
35
- try {
36
- mutePSTN(uid);
37
- } catch (error) {
38
- console.error('An error occurred while muting the PSTN user.');
34
+ // To individual
35
+ if (uid) {
36
+ if (isPSTN(uid)) {
37
+ try {
38
+ mutePSTN(uid);
39
+ } catch (error) {
40
+ console.error('An error occurred while muting the PSTN user.');
41
+ }
42
+ } else {
43
+ events.send(
44
+ controlMessageEnum.muteAudio,
45
+ '',
46
+ EventPersistLevel.LEVEL1,
47
+ uid,
48
+ );
39
49
  }
40
50
  } else {
41
- sendCtrlMsgToUid(
42
- CONTROL_MESSAGE_TYPE.controlMessageToUid,
51
+ // To everyone
52
+ events.send(
43
53
  controlMessageEnum.muteAudio,
44
- uid,
54
+ '',
55
+ EventPersistLevel.LEVEL1,
45
56
  );
46
57
  }
47
58
  break;
48
59
  case MUTE_REMOTE_TYPE.video:
49
- if (!isPSTN(uid)) {
50
- sendCtrlMsgToUid(
51
- CONTROL_MESSAGE_TYPE.controlMessageToUid,
60
+ if (uid) {
61
+ // To individual
62
+ if (!isPSTN(uid)) {
63
+ events.send(
64
+ controlMessageEnum.muteVideo,
65
+ '',
66
+ EventPersistLevel.LEVEL1,
67
+ uid,
68
+ );
69
+ }
70
+ } else {
71
+ // To everyone
72
+ events.send(
52
73
  controlMessageEnum.muteVideo,
53
- uid,
74
+ '',
75
+ EventPersistLevel.LEVEL1,
54
76
  );
55
77
  }
56
78
  break;
@@ -12,7 +12,7 @@
12
12
 
13
13
  import React, {SetStateAction} from 'react';
14
14
  import {SidePanelType} from '../subComponents/SidePanelEnum';
15
- import {createHook} from 'fpe-implementation';
15
+ import {createHook} from 'customization-implementation';
16
16
 
17
17
  export interface SidePanelContextInterface {
18
18
  sidePanel: SidePanelType;
@@ -9,7 +9,7 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import {useFpe} from 'fpe-api';
12
+ import {useCustomization} from 'customization-implementation';
13
13
  import {useLanguage} from '../language/useLanguage';
14
14
  import {DEFAULT_I18_DATA} from '../language';
15
15
  import {TextDataInterface} from '../language/default-labels/index';
@@ -17,7 +17,7 @@ import {TextDataInterface} from '../language/default-labels/index';
17
17
  export function usei18nData(
18
18
  selectedLanguageCode: string = DEFAULT_I18_DATA.locale,
19
19
  ) {
20
- const languageData = useFpe((data) => data?.i18n);
20
+ const languageData = useCustomization((data) => data?.i18n);
21
21
  if (
22
22
  !selectedLanguageCode ||
23
23
  !languageData ||
@@ -0,0 +1,11 @@
1
+ import useSetName from './useSetName';
2
+ import useGetName from './useGetName';
3
+
4
+ export default function useUserName(): [
5
+ string,
6
+ React.Dispatch<React.SetStateAction<string>>,
7
+ ] {
8
+ const setName = useSetName();
9
+ const name = useGetName();
10
+ return [name, setName];
11
+ }