agora-appbuilder-core 2.3.0-beta.9 → 3.0.1

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 (206) 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} +21 -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 +11 -0
  53. package/template/src/app-state/useMessages.ts +55 -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 +4 -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 +26 -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/rtm-events-api/Events.ts +255 -0
  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 +4 -3
  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 +47 -24
  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 +98 -39
  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 +41 -9
  159. package/template/src/utils/getUniqueID.ts +5 -0
  160. package/template/src/utils/isMobileOrTablet.native.ts +6 -2
  161. package/template/src/utils/isMobileOrTablet.ts +25 -8
  162. package/template/src/utils/useButtonTemplate.tsx +1 -1
  163. package/template/src/utils/useCreateMeeting.ts +24 -10
  164. package/template/src/utils/useGetMeetingPhrase.ts +11 -8
  165. package/template/src/utils/{IsAttendeeUser.ts → useIsAttendee.ts} +12 -16
  166. package/template/src/utils/{isAudioEnabled.ts → useIsAudioEnabled.ts} +8 -4
  167. package/template/src/utils/{isHostUser.ts → useIsHost.ts} +17 -16
  168. package/template/src/utils/{isPSTNUser.ts → useIsPSTN.ts} +4 -3
  169. package/template/src/utils/{isScreenShareUser.ts → useIsScreenShare.ts} +1 -1
  170. package/template/src/utils/{isVideoEnabled.ts → useIsVideoEnabled.ts} +9 -6
  171. package/template/src/utils/useJoinMeeting.ts +11 -7
  172. package/template/src/utils/useLayout.tsx +8 -6
  173. package/template/src/utils/useMutePSTN.ts +5 -3
  174. package/template/src/utils/useMuteToggleLocal.ts +6 -4
  175. package/template/src/utils/useRemoteEndCall.ts +14 -10
  176. package/template/src/utils/useRemoteMute.ts +45 -20
  177. package/template/src/utils/useSidePanel.tsx +4 -1
  178. package/template/src/utils/useString.ts +2 -2
  179. package/template/src/utils/useUserName.ts +14 -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/CustomEvents.ts +0 -238
  193. package/template/src/custom-events/index.tsx +0 -4
  194. package/template/src/custom-events/types.ts +0 -51
  195. package/template/src/pages/video-call/CustomLayout.ts +0 -17
  196. package/template/src/rtm-events/types.ts +0 -7
  197. package/template/src/utils/getMeetingInvite.ts +0 -53
  198. package/template/src/utils/useGroupMessages.ts +0 -24
  199. package/template/src/utils/useNavParams.ts +0 -6
  200. package/template/src/utils/useNavigateTo.ts +0 -8
  201. package/template/src/utils/usePrivateMessages.ts +0 -33
  202. package/template/src/utils/useSendControlMessage.ts +0 -51
  203. package/template/src/utils/useSendMessage.ts +0 -40
  204. package/template/src/utils/useSetUnreadMessageCount.ts +0 -43
  205. package/template/src/utils/useUnreadMessageCount.ts +0 -50
  206. 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,47 @@ 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
+ /**
33
+ * Checks whether the application is running as a web app and returns true/false.
34
+ * @returns function
35
+ */
36
+ const isWeb = () => Platform === 'web' && ReactNativePlatform.OS === 'web';
37
+
38
+ /**
39
+ * Checks whether the application is running as an android app and returns true/false.
40
+ * @returns function
41
+ */
42
+ const isAndroid = () =>
43
+ //@ts-ignore
44
+ Platform === 'native' && ReactNativePlatform.OS === 'android';
45
+
46
+ /**
47
+ * Checks whether the application is running as an iOS app and returns true/false.
48
+ * @returns function
49
+ */
50
+ //@ts-ignore
51
+ const isIOS = () => Platform === 'native' && ReactNativePlatform.OS === 'ios';
52
+
53
+ /**
54
+ * Checks whether the application is running as an electron desktop app and returns true/false.
55
+ * @returns function
56
+ */
57
+ //@ts-ignore
58
+ const isDesktop = () => Platform === 'electron';
59
+
30
60
  const isArray = (data: any[]) =>
31
61
  data && Array.isArray(data) && data.length ? true : false ? true : false;
32
62
  export {
33
- hasBrandLogo,
34
- shouldAuthenticate,
35
- isWeb,
36
- isIOS,
63
+ useHasBrandLogo,
37
64
  isAndroid,
65
+ isIOS,
66
+ isWebInternal,
67
+ isWeb,
68
+ isDesktop,
69
+ shouldAuthenticate,
38
70
  isArray,
39
71
  isValidReactComponent,
40
72
  };
@@ -0,0 +1,5 @@
1
+ import {nanoid} from 'nanoid/non-secure';
2
+
3
+ export default function getUniqueID() {
4
+ return nanoid();
5
+ }
@@ -1,5 +1,9 @@
1
+ /**
2
+ * Checks whether the application is running as a web application on a mobile or tablet device and returns true/false.
3
+ * @returns function
4
+ */
1
5
  const isMobileOrTablet = () => {
2
6
  return true;
3
- }
7
+ };
4
8
 
5
- export default isMobileOrTablet;
9
+ export default isMobileOrTablet;
@@ -1,10 +1,27 @@
1
- declare global{
2
- interface Window {opera?: any}
1
+ declare global {
2
+ interface Window {
3
+ opera?: any;
4
+ }
3
5
  }
6
+
7
+ /**
8
+ * Checks whether the application is running as a web application on a mobile or tablet device and returns true/false.
9
+ * @returns function
10
+ */
4
11
  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;
12
+ let check = false;
13
+ (function (a) {
14
+ if (
15
+ /(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(
16
+ a,
17
+ ) ||
18
+ /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(
19
+ a.substr(0, 4),
20
+ )
21
+ )
22
+ check = true;
23
+ })(navigator?.userAgent || navigator?.vendor || window?.opera);
24
+ return check;
25
+ };
26
+
27
+ 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(
@@ -26,6 +27,9 @@ const CREATE_CHANNEL = gql`
26
27
  }
27
28
  }
28
29
  `;
30
+ /**
31
+ * Returns an asynchronous function to create a meeting with the given options.
32
+ */
29
33
  export default function useCreateMeeting() {
30
34
  const [createChannel, {error}] = useMutation(CREATE_CHANNEL);
31
35
  const {setMeetingInfo} = useSetMeetingInfo();
@@ -45,28 +49,38 @@ export default function useCreateMeeting() {
45
49
  throw error;
46
50
  }
47
51
  if (res && res?.data && res?.data?.createChannel) {
48
- let meetingInfoPassPhrase: MeetingInfoContextInterface['meetingPassphrase'] =
49
- {
52
+ let meetingInfo: Partial<MeetingInfoContextInterface['data']> = {
53
+ roomId: {
50
54
  attendee: '',
51
- };
55
+ },
56
+ };
52
57
  if (res?.data?.createChannel?.passphrase?.view) {
53
- meetingInfoPassPhrase.attendee = res.data.createChannel.passphrase.view;
58
+ meetingInfo.roomId.attendee = res.data.createChannel.passphrase.view;
54
59
  }
55
60
  if (res?.data?.createChannel?.passphrase?.host) {
56
- meetingInfoPassPhrase.host = res.data.createChannel.passphrase.host;
61
+ meetingInfo.roomId.host = res.data.createChannel.passphrase.host;
57
62
  }
58
63
  if (enablePSTN === true && res?.data?.createChannel?.pstn) {
59
- meetingInfoPassPhrase.pstn = {
64
+ meetingInfo.pstn = {
60
65
  number: res.data.createChannel.pstn.number,
61
66
  pin: res.data.createChannel.pstn.dtmf,
62
67
  };
63
68
  }
64
69
  setMeetingInfo({
65
- isHost: true,
66
- isSeparateHostLink: isSeparateHostLink ? true : false,
67
- meetingTitle: roomTitle,
68
- meetingPassphrase: meetingInfoPassPhrase,
70
+ data: {
71
+ isHost: true,
72
+ isSeparateHostLink: isSeparateHostLink ? true : false,
73
+ meetingTitle: roomTitle,
74
+ roomId: meetingInfo?.roomId,
75
+ pstn: meetingInfo?.pstn,
76
+ },
69
77
  });
78
+ SDKEvents.emit(
79
+ 'create',
80
+ meetingInfo.roomId.host,
81
+ meetingInfo.roomId.attendee,
82
+ meetingInfo?.pstn,
83
+ );
70
84
  } else {
71
85
  throw new Error(`An error occurred in parsing the channel data.`);
72
86
  }
@@ -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
  }
@@ -9,26 +9,22 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import {useMeetingInfo} from '../components/meeting-info/useMeetingInfo';
13
12
  import {useLiveStreamDataContext} from '../components/contexts/LiveStreamDataContext';
14
13
  import {UidType} from '../../agora-rn-uikit';
14
+ import {useVideoMeetingData} from '../components/contexts/VideoMeetingDataContext';
15
15
 
16
+ /**
17
+ * Returns a function that checks whether the given uid is an attendee and returns true/false
18
+ * @returns function
19
+ */
16
20
  function useIsAttendee() {
17
- if ($config.EVENT_MODE) {
18
- const {audienceUids} = useLiveStreamDataContext();
19
- const isAttendee = (uid: UidType) => {
20
- return audienceUids.filter((audienceUid) => audienceUid === uid).length
21
- ? true
22
- : false;
23
- };
24
- return isAttendee;
25
- } else {
26
- const {isHost} = useMeetingInfo();
27
- const isAttendee = (uid: UidType) => {
28
- return !isHost ? true : false;
29
- };
30
- return isAttendee;
31
- }
21
+ const {audienceUids: lsAudienceUids} = useLiveStreamDataContext();
22
+ const {attendeeUids: vmAudienceUids} = useVideoMeetingData();
23
+ const isAttendee = (uid: UidType) => {
24
+ const attUidsData = $config.EVENT_MODE ? lsAudienceUids : vmAudienceUids;
25
+ return attUidsData.filter((attId) => attId === uid).length ? true : false;
26
+ };
27
+ return isAttendee;
32
28
  }
33
29
 
34
30
  export default useIsAttendee;
@@ -9,21 +9,25 @@
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
+ /**
17
+ * Returns a function that checks the audio state for a given uid and returns true/false
18
+ * @returns function
19
+ */
16
20
  function useIsAudioEnabled() {
17
- const {renderList} = useUserList();
21
+ const {renderList} = useRender();
18
22
  /**
19
23
  *
20
24
  * @param uid UidType
21
25
  * @returns boolean
22
26
  */
23
- const audioEnabled = (uid: UidType): boolean =>
27
+ const isAudioEnabled = (uid: UidType): boolean =>
24
28
  renderList[uid]?.audio === ToggleState.enabled;
25
29
 
26
- return audioEnabled;
30
+ return isAudioEnabled;
27
31
  }
28
32
 
29
33
  export default useIsAudioEnabled;
@@ -9,25 +9,26 @@
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
 
16
+ /**
17
+ * Returns a function that checks whether the given uid is a host and returns true/false
18
+ * @returns function
19
+ */
17
20
  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
- }
21
+ const {hostUids: liveStreamHostUids} = useLiveStreamDataContext();
22
+ const {hostUids: videoMeetingHostUids} = useVideoMeetingData();
23
+ const isHost = (uid: UidType) => {
24
+ const hostUidsData = $config.EVENT_MODE
25
+ ? liveStreamHostUids
26
+ : videoMeetingHostUids;
27
+ return hostUidsData.filter((hostId) => hostId === uid).length
28
+ ? true
29
+ : false;
30
+ };
31
+ return isHost;
31
32
  }
32
33
 
33
34
  export default useIsHost;
@@ -9,14 +9,15 @@
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
+ * Returns a function that checks whether the given uid is a PSTN user and returns true/false
16
17
  * @returns function
17
18
  */
18
19
  function useIsPSTN() {
19
- const {renderList} = useUserList();
20
+ const {renderList} = useRender();
20
21
  /**
21
22
  *
22
23
  * @param uid number
@@ -13,7 +13,7 @@ import {UidType} from '../../agora-rn-uikit';
13
13
  import {useScreenContext} from '../components/contexts/ScreenShareContext';
14
14
 
15
15
  /**
16
- * This hook will return the function to check whether the screen is shared or not
16
+ * This hook will return the function which take UID and return true if screensharing active on the UID
17
17
  * @returns function
18
18
  */
19
19
  function useIsScreenShare() {
@@ -9,21 +9,24 @@
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
 
15
+ /**
16
+ * Returns a function that checks the video state for a given uid and returns true/false
17
+ * @returns function
18
+ */
16
19
  function useIsVideoEnabled() {
17
- const {renderList} = useUserList();
20
+ const {renderList} = useRender();
18
21
 
19
22
  /**
20
23
  *
21
24
  * @param uid UidType
22
25
  * @returns boolean
23
26
  */
24
- const videoEnabled = (uid: UidType): boolean =>
27
+ const isVideoEnabled = (uid: UidType): boolean =>
25
28
  renderList[uid]?.video === ToggleState.enabled;
26
29
 
27
- return videoEnabled;
30
+ return isVideoEnabled;
28
31
  }
29
32
  export default useIsVideoEnabled;
@@ -50,7 +50,9 @@ const JOIN_CHANNEL_PHRASE = gql`
50
50
  }
51
51
  }
52
52
  `;
53
-
53
+ /**
54
+ * Returns an asynchronous function to join a meeting with the given phrase.
55
+ */
54
56
  export default function useJoinMeeting() {
55
57
  const {store} = useContext(StorageContext);
56
58
  const {setMeetingInfo} = useSetMeetingInfo();
@@ -77,9 +79,7 @@ export default function useJoinMeeting() {
77
79
  } else {
78
80
  if (response && response.data) {
79
81
  let data = response.data;
80
- let meetingInfo: Partial<MeetingInfoContextInterface> = {
81
- isJoinDataFetched: true,
82
- };
82
+ let meetingInfo: Partial<MeetingInfoContextInterface['data']> = {};
83
83
  if (data?.joinChannel?.channel) {
84
84
  meetingInfo.channel = data.joinChannel.channel;
85
85
  }
@@ -90,10 +90,10 @@ export default function useJoinMeeting() {
90
90
  meetingInfo.token = data.joinChannel.mainUser.rtc;
91
91
  }
92
92
  if (data?.joinChannel?.mainUser?.rtm) {
93
- meetingInfo.rtm = data.joinChannel.mainUser.rtm;
93
+ meetingInfo.rtmToken = data.joinChannel.mainUser.rtm;
94
94
  }
95
95
  if (data?.joinChannel?.secret) {
96
- meetingInfo.secret = data.joinChannel.secret;
96
+ meetingInfo.encryptionSecret = data.joinChannel.secret;
97
97
  }
98
98
  if (data?.joinChannel?.screenShare?.uid) {
99
99
  meetingInfo.screenShareUid = data.joinChannel.screenShare.uid;
@@ -114,7 +114,11 @@ export default function useJoinMeeting() {
114
114
  setMeetingInfo((prevState) => {
115
115
  return {
116
116
  ...prevState,
117
- ...meetingInfo,
117
+ isJoinDataFetched: true,
118
+ data: {
119
+ ...prevState.data,
120
+ ...meetingInfo,
121
+ },
118
122
  };
119
123
  });
120
124
  } 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 {
@@ -34,7 +34,9 @@ const LayoutProvider = (props: LayoutProviderProps) => {
34
34
  </LayoutContext.Provider>
35
35
  );
36
36
  };
37
-
37
+ /**
38
+ * The Layout app state governs the video call screen content display layout.
39
+ */
38
40
  const useLayout = createHook(LayoutContext);
39
41
 
40
42
  export {LayoutProvider, useLayout};
@@ -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,17 +9,19 @@
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 {
17
16
  audio,
18
17
  video,
19
18
  }
19
+ /**
20
+ * Returns an asynchronous function to toggle muted state of the given track type for the local user.
21
+ */
20
22
  function useMuteToggleLocal() {
21
- const {RtcEngine, dispatch} = useContext(RtcContext);
22
- const local = useContext(LocalContext);
23
+ const {RtcEngine, dispatch} = useRtc();
24
+ const local = useLocalUserInfo();
23
25
 
24
26
  return async (type: MUTE_LOCAL_TYPE) => {
25
27
  switch (type) {
@@ -1,21 +1,25 @@
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
 
7
+ /**
8
+ * Returns a function to end the call for a remote user with the given uid.
9
+ */
9
10
  const useRemoteEndCall = () => {
10
- const sendCtrlMsgToUid = useSendControlMessage();
11
- const {isHost} = useMeetingInfo();
11
+ const {
12
+ data: {isHost},
13
+ } = useMeetingInfo();
12
14
  const isPSTN = useIsPSTN();
15
+
13
16
  return (uid: UidType) => {
14
- if (isHost) {
17
+ if (isHost && uid) {
15
18
  if (!isPSTN(uid)) {
16
- sendCtrlMsgToUid(
17
- CONTROL_MESSAGE_TYPE.controlMessageToUid,
19
+ events.send(
18
20
  controlMessageEnum.kickUser,
21
+ '',
22
+ EventPersistLevel.LEVEL1,
19
23
  uid,
20
24
  );
21
25
  }