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
@@ -1,238 +0,0 @@
1
- /*
2
- ********************************************
3
- Copyright © 2022 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
-
13
- ('use strict');
14
- import RtmEngine from 'agora-react-native-rtm';
15
- import RTMEngine from '../rtm/RTMEngine';
16
- import {ToOptions, EventPayload} from './types';
17
- import {EventUtils, eventMessageType} from '../rtm-events';
18
- import {TEventCallback, EventSourceEnum} from './types';
19
- import {adjustUID} from '../rtm/utils';
20
-
21
- class CustomEvents {
22
- private engine!: RtmEngine;
23
- private source: EventSourceEnum = EventSourceEnum.core;
24
-
25
- constructor(source?: EventSourceEnum) {
26
- this.engine = RTMEngine.getInstance().engine;
27
- if (source) {
28
- this.source = source;
29
- }
30
- }
31
-
32
- /**
33
- * Persists the data in the local attributes of the user
34
- *
35
- * @param {string} evt to be stored in rtm Attribute key
36
- * @param {any} payload to be stored in rtm Attribute value
37
- * @api private
38
- */
39
- private _persist = async (evt: string, payload: any) => {
40
- try {
41
- const localUserId = RTMEngine.getInstance().localUid;
42
- const rtmAttribute = {key: evt, value: JSON.stringify(payload)};
43
- // Step 1: Call RTM API to update local attributes
44
- await this.engine.addOrUpdateLocalUserAttributes([rtmAttribute]);
45
- } catch (error) {
46
- console.log(
47
- 'CUSTOM_EVENT_API error occured while updating the value ',
48
- error,
49
- );
50
- }
51
- };
52
-
53
- /**
54
- *
55
- */
56
- private _validateEvt = (evt: string): boolean => {
57
- if (typeof evt !== 'string') {
58
- throw Error(
59
- `CUSTOM_EVENT_API Event name cannot be of type ${typeof evt}`,
60
- );
61
- }
62
- if (evt.trim() == '') {
63
- throw Error(`CUSTOM_EVENT_API Name or function cannot be empty`);
64
- }
65
- return true;
66
- };
67
-
68
- private _validateListener = (listener: TEventCallback): boolean => {
69
- if (typeof listener !== 'function') {
70
- throw Error(
71
- `CUSTOM_EVENT_API Function cannot be of type ${typeof listener}`,
72
- );
73
- }
74
- return true;
75
- };
76
-
77
- /**
78
- * Sets the local attribute of user if persist level is 2 or 3.
79
- * If param 'to' is not provided, message is sent in the channel.
80
- * If param 'to' is provided message is sent to that individual.
81
- * If param 'to' is an array of uids is provided then message is sent to all the individual uids in loop.
82
- *
83
- * @param {any} rtmPayload payload to be sent across
84
- * @param {ToOptions} to uid or uids[] of user
85
- * @api private
86
- */
87
- private _send = async (rtmPayload: any, toUid?: ToOptions) => {
88
- const to = typeof toUid == 'string' ? parseInt(toUid) : toUid;
89
-
90
- const text = JSON.stringify({
91
- type: eventMessageType.CUSTOM_EVENT,
92
- msg: rtmPayload,
93
- });
94
- // Case 1: send to channel
95
- if (
96
- typeof to === 'undefined' ||
97
- (typeof to === 'number' && to <= 0) ||
98
- (Array.isArray(to) && to?.length === 0)
99
- ) {
100
- console.log('CUSTOM_EVENT_API: case 1 executed');
101
- try {
102
- const channelId = RTMEngine.getInstance().channelUid;
103
- await this.engine.sendMessageByChannelId(channelId, text);
104
- } catch (error) {
105
- console.log('CUSTOM_EVENT_API: send event case 1 error : ', error);
106
- throw error;
107
- }
108
- }
109
- // Case 2: send to indivdual
110
- if (typeof to === 'number' && to !== 0) {
111
- console.log('CUSTOM_EVENT_API: case 2 executed', to);
112
- const adjustedUID = adjustUID(to);
113
- try {
114
- await this.engine.sendMessageToPeer({
115
- peerId: `${adjustedUID}`,
116
- offline: false,
117
- text,
118
- });
119
- } catch (error) {
120
- console.log('CUSTOM_EVENT_API: send event case 2 error : ', error);
121
- throw error;
122
- }
123
- }
124
- // Case 3: send to multiple individuals
125
- if (typeof to === 'object' && Array.isArray(to)) {
126
- console.log('CUSTOM_EVENT_API: case 3 executed', to);
127
-
128
- try {
129
- for (const uid of to) {
130
- const adjustedUID = adjustUID(uid);
131
- await this.engine.sendMessageToPeer({
132
- peerId: `${adjustedUID}`,
133
- offline: false,
134
- text,
135
- });
136
- }
137
- } catch (error) {
138
- console.log('CUSTOM_EVENT_API: send event case 3 error : ', error);
139
- throw error;
140
- }
141
- }
142
- };
143
-
144
- /**
145
- * Listens for a specified event.
146
- * Adds a listener function to the specified event.
147
- * When the specified event happens, the Events API triggers the callback that you pass.
148
- * The listener will not be added if it is a duplicate.
149
- *
150
- * @param {String} evt Name of the event to attach the listener to.
151
- * @param {Function} listener Method to be called when the event is emitted.
152
- * @api public
153
- */
154
- on = (evt: string, listener: TEventCallback) => {
155
- try {
156
- if (!this._validateEvt(evt) || !this._validateListener(listener)) return;
157
- EventUtils.addListener(evt, listener, this.source);
158
- } catch (error) {
159
- console.log('custom-events-on error: ', error);
160
- }
161
- };
162
-
163
- /**
164
- * Removes a listener function from the specified event if evt and listener function both are provided.
165
- * Removes all listeners from a specified event if listener function is not provided.
166
- * If you do not specify an event then all listeners will be removed.
167
- * That means every event will be emptied.
168
- *
169
- * @param {String} evt Name of the event to remove the listener from.
170
- * @param {Function} listenerToRemove Method to remove from the event.
171
- * @api public
172
- */
173
- off = (evt?: string, listenerToRemove?: TEventCallback) => {
174
- try {
175
- if (listenerToRemove) {
176
- if (
177
- this._validateListener(listenerToRemove) &&
178
- this._validateEvt(evt)
179
- ) {
180
- EventUtils.removeListener(evt, listenerToRemove, this.source);
181
- }
182
- } else if (evt) {
183
- if (this._validateEvt(evt)) {
184
- EventUtils.removeAllListeners(evt, this.source);
185
- }
186
- } else {
187
- EventUtils.removeAll(this.source);
188
- }
189
- } catch (error) {
190
- console.log('custom-events-off error: ', error);
191
- }
192
- };
193
-
194
- /**
195
- * This method sends p2p or channel message depending upon the 'to' value.
196
- * - If 'to' is provided this method sends p2p message.
197
- * - If 'to' is empty this method sends channel message.
198
- *
199
- *
200
- * @param {String} evt Name of the event to remove the listener from.
201
- * @param {EventPayload} payload contains action, level, value metrics.
202
- * - action: {string}
203
- * - level: 1 | 2 | 3
204
- * - value: {string}. NOTICE: value bytelength has MAX_SIZE 32kb limit.
205
- * @param {ToOptions} to uid or uid array. The default mode is to send a message in channel.
206
- * @api public
207
- * */
208
- send = async (evt: string, payload: EventPayload, to?: ToOptions) => {
209
- if (!this._validateEvt(evt)) return;
210
- const {action = '', value = '', level = 1} = payload;
211
-
212
- const rtmPayload = {
213
- evt: evt,
214
- payload: {
215
- action,
216
- value,
217
- level,
218
- source: this.source,
219
- },
220
- };
221
-
222
- if (level === 2 || level === 3) {
223
- console.log('CUSTOM_EVENT_API: Event lifecycle: persist', level);
224
- try {
225
- await this._persist(evt, {...payload, source: this.source});
226
- } catch (error) {
227
- console.log('custom-events-persist error: ', error);
228
- }
229
- }
230
- try {
231
- await this._send(rtmPayload, to);
232
- } catch (error) {
233
- console.log('CUSTOM_EVENT_API: sending failed. ', error);
234
- }
235
- };
236
- }
237
-
238
- export default CustomEvents;
@@ -1,4 +0,0 @@
1
- import CustomEvents from './CustomEvents';
2
-
3
- export * from './types';
4
- export default new CustomEvents();
@@ -1,51 +0,0 @@
1
- import {UidType} from '../../agora-rn-uikit';
2
- type Simplify<T> = T extends infer S ? {[K in keyof S]: S[K]} : never;
3
- type NoneOf<T> = Simplify<{[K in keyof T]?: never}>;
4
- type AtMostOneOf<T> =
5
- | NoneOf<T>
6
- | {[K in keyof T]: Simplify<Pick<T, K> & NoneOf<Omit<T, K>>>}[keyof T];
7
-
8
- // export type TEventOptions = AtMostOneOf<IMessageOptions> & IEventOptions;
9
-
10
- export type ToOptions = UidType | UidType[];
11
-
12
- interface IEventPayloadBase {
13
- action?: any;
14
- }
15
-
16
- interface IEventPayloadWithoutAttributes extends IEventPayloadBase {
17
- level?: never;
18
- value: string;
19
- }
20
-
21
- interface IEventPayloadWithAttributes extends IEventPayloadBase {
22
- level: 2 | 3;
23
- value: string;
24
- }
25
-
26
- export type EventPayload =
27
- | IEventPayloadWithoutAttributes
28
- | IEventPayloadWithAttributes
29
- | Record<string, never>;
30
-
31
- export enum EventSourceEnum {
32
- core = 'core',
33
- fpe = 'fpe',
34
- }
35
- export enum EventLevel {
36
- 'LEVEL1' = 1,
37
- 'LEVEL2',
38
- 'LEVEL3',
39
- }
40
- interface dataPayload {
41
- action: string;
42
- level: 1 | 2 | 3;
43
- value: string;
44
- }
45
- interface EvtCbPayload {
46
- payload: dataPayload;
47
- sender: string;
48
- ts: number;
49
- source: EventSourceEnum;
50
- }
51
- export type TEventCallback = (args: EvtCbPayload) => void;
@@ -1,17 +0,0 @@
1
- import {useFpe} from 'fpe-api';
2
- import {DefaultLayouts} from './DefaultLayouts';
3
-
4
- function useCustomLayout() {
5
- const fpeLayouts = useFpe((config) => {
6
- if (
7
- typeof config?.components?.videoCall === 'object' &&
8
- config?.components?.videoCall?.customLayout
9
- ) {
10
- return config.components.videoCall.customLayout(DefaultLayouts);
11
- } else {
12
- return DefaultLayouts;
13
- }
14
- });
15
- return fpeLayouts;
16
- }
17
- export default useCustomLayout;
@@ -1,7 +0,0 @@
1
- export enum eventMessageType {
2
- CONTROL_GROUP = 1,
3
- CONTROL_PRIVATE,
4
- NORMAL_GROUP,
5
- NORMAL_PRIVATE,
6
- CUSTOM_EVENT,
7
- }
@@ -1,53 +0,0 @@
1
- const GetMeetingInviteURL = (
2
- baseUrl: string,
3
- isHost: boolean,
4
- meetingPassphrase: {
5
- host?: string;
6
- attendee?: string;
7
- },
8
- isSeparateHostLink: boolean,
9
- ) => {
10
- if (isHost) {
11
- if (isSeparateHostLink) {
12
- return {
13
- host: `${baseUrl}/${meetingPassphrase.host}`,
14
- attendee: `${baseUrl}/${meetingPassphrase.attendee}`,
15
- };
16
- } else {
17
- return {
18
- host: `${baseUrl}/${meetingPassphrase.host}`,
19
- };
20
- }
21
- } else {
22
- return {
23
- attendee: `${baseUrl}/${meetingPassphrase.attendee}`,
24
- };
25
- }
26
- };
27
- const GetMeetingInviteID = (
28
- isHost: boolean,
29
- meetingPassphrase: {
30
- host?: string;
31
- attendee?: string;
32
- },
33
- isSeparateHostLink: boolean,
34
- ) => {
35
- if (isHost) {
36
- if (isSeparateHostLink) {
37
- return {
38
- host: `${meetingPassphrase.host}`,
39
- attendee: `${meetingPassphrase.attendee}`,
40
- };
41
- } else {
42
- return {
43
- host: `${meetingPassphrase.host}`,
44
- };
45
- }
46
- } else {
47
- return {
48
- attendee: `${meetingPassphrase.attendee}`,
49
- };
50
- }
51
- };
52
-
53
- export {GetMeetingInviteURL, GetMeetingInviteID};
@@ -1,24 +0,0 @@
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
-
13
- import {useChatMessages} from '../components/chat-messages/useChatMessages';
14
-
15
- /**
16
- * This hook will fetch the group messages
17
- * @returns userList
18
- */
19
- function useGroupMessages() {
20
- const {messageStore} = useChatMessages();
21
- return messageStore;
22
- }
23
-
24
- export default useGroupMessages;
@@ -1,6 +0,0 @@
1
- import {useParams} from '../components/Router';
2
-
3
- export default function useNavParams() {
4
- const data = useParams();
5
- return data;
6
- }
@@ -1,8 +0,0 @@
1
- import {useHistory} from '../components/Router';
2
-
3
- export default function useNavigateTo() {
4
- const history = useHistory();
5
- return (path: string, params?: any) => {
6
- history.push(path, params);
7
- };
8
- }
@@ -1,33 +0,0 @@
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
-
13
- import {useChatMessages} from '../components/chat-messages/useChatMessages';
14
- import {UidType} from '../../agora-rn-uikit';
15
-
16
- /**
17
- * This hook will return function to find the private message by uid
18
- * @returns private message
19
- */
20
- function usePrivateMessages() {
21
- const {privateMessageStore} = useChatMessages();
22
- /**
23
- *
24
- * @param uid - User id
25
- * @returns If uid is passed then it will return particular private message data
26
- * otherwise it will return whole private message store
27
- */
28
- const getPrivateMessage = (uid?: UidType) =>
29
- uid ? privateMessageStore[uid] : privateMessageStore;
30
- return getPrivateMessage;
31
- }
32
-
33
- export default usePrivateMessages;
@@ -1,51 +0,0 @@
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
- import {UidType} from '../../agora-rn-uikit';
13
- import {useContext} from 'react';
14
- import ChatContext, {controlMessageEnum} from '../components/ChatContext';
15
- import {LiveStreamControlMessageEnum} from '../components/livestream';
16
- import {useMeetingInfo} from '../components/meeting-info/useMeetingInfo';
17
-
18
- export enum CONTROL_MESSAGE_TYPE {
19
- controlMessageToEveryOne,
20
- controlMessageToUid,
21
- }
22
- function useSendControlMessage() {
23
- const {sendControlMessage, sendControlMessageToUid} = useContext(ChatContext);
24
- const {isHost} = useMeetingInfo();
25
- return (
26
- type: CONTROL_MESSAGE_TYPE,
27
- message: controlMessageEnum | LiveStreamControlMessageEnum,
28
- uid?: UidType,
29
- ) => {
30
- if (isHost || ($config.EVENT_MODE && $config.RAISE_HAND)) {
31
- switch (type) {
32
- case CONTROL_MESSAGE_TYPE.controlMessageToEveryOne:
33
- sendControlMessage(message);
34
- break;
35
- case CONTROL_MESSAGE_TYPE.controlMessageToUid:
36
- if (uid) {
37
- sendControlMessageToUid(message, uid);
38
- } else {
39
- console.error('UID should be passed');
40
- }
41
- break;
42
- default:
43
- break;
44
- }
45
- } else {
46
- console.error('A host can only send the control message.');
47
- }
48
- };
49
- }
50
-
51
- export default useSendControlMessage;
@@ -1,40 +0,0 @@
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
- import {useContext} from 'react';
13
- import ChatContext from '../components/ChatContext';
14
- import {UidType} from '../../agora-rn-uikit';
15
-
16
- export enum MESSAGE_TYPE {
17
- group,
18
- private,
19
- }
20
- function useSendMessage() {
21
- const {sendMessage, sendMessageToUid} = useContext(ChatContext);
22
- return (type: MESSAGE_TYPE, message: string, uid?: UidType) => {
23
- switch (type) {
24
- case MESSAGE_TYPE.group:
25
- sendMessage(message);
26
- break;
27
- case MESSAGE_TYPE.private:
28
- if (uid) {
29
- sendMessageToUid(message, uid);
30
- } else {
31
- console.error('To send the private message, UID should be passed');
32
- }
33
- break;
34
- default:
35
- break;
36
- }
37
- };
38
- }
39
-
40
- export default useSendMessage;
@@ -1,43 +0,0 @@
1
- import {UidType} from '../../agora-rn-uikit';
2
- import {useChatNotification} from '../components/chat-notification/useChatNotification';
3
-
4
- export enum SET_UNREAD_MESSAGE_COUNT_TYPE {
5
- setPublicMessageCount,
6
- setIndividualMessageCount,
7
- }
8
-
9
- const useSetUnreadMessageCount = () => {
10
- const {setUnreadIndividualMessageCount, setUnreadGroupMessageCount} =
11
- useChatNotification();
12
- return (
13
- type: SET_UNREAD_MESSAGE_COUNT_TYPE,
14
- count: number,
15
- uid?: UidType,
16
- ) => {
17
- switch (type) {
18
- case SET_UNREAD_MESSAGE_COUNT_TYPE.setPublicMessageCount:
19
- setUnreadGroupMessageCount(count);
20
- break;
21
- case SET_UNREAD_MESSAGE_COUNT_TYPE.setIndividualMessageCount:
22
- if (uid) {
23
- setUnreadIndividualMessageCount((prevState) => {
24
- if (prevState && prevState.hasOwnProperty(uid)) {
25
- return {
26
- ...prevState,
27
- [uid]: count,
28
- };
29
- } else {
30
- console.error(`ERROR: Invalid UID`);
31
- return prevState;
32
- }
33
- });
34
- } else {
35
- console.error('UID must be passed for setIndividualMessageCount.');
36
- }
37
- break;
38
- default:
39
- break;
40
- }
41
- };
42
- };
43
- export default useSetUnreadMessageCount;
@@ -1,50 +0,0 @@
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
- import {UidType} from '../../agora-rn-uikit';
13
- import {useChatNotification} from '../components/chat-notification/useChatNotification';
14
-
15
- export enum UNREAD_MESSAGE_COUNT_TYPE {
16
- GroupAndPrivateCount,
17
- GroupCount,
18
- PrivateCount,
19
- PaticularUserUnReadCount,
20
- }
21
-
22
- function useUnreadMessageCount() {
23
- const {
24
- totalUnreadCount,
25
- unreadGroupMessageCount,
26
- unreadPrivateMessageCount,
27
- unreadIndividualMessageCount,
28
- } = useChatNotification();
29
-
30
- const getUnreadCount = (type: UNREAD_MESSAGE_COUNT_TYPE, uid?: UidType) => {
31
- switch (type) {
32
- case UNREAD_MESSAGE_COUNT_TYPE.GroupAndPrivateCount:
33
- return totalUnreadCount;
34
- case UNREAD_MESSAGE_COUNT_TYPE.GroupCount:
35
- return unreadGroupMessageCount;
36
- case UNREAD_MESSAGE_COUNT_TYPE.PrivateCount:
37
- return unreadPrivateMessageCount;
38
- case UNREAD_MESSAGE_COUNT_TYPE.PaticularUserUnReadCount:
39
- return uid && unreadIndividualMessageCount[uid]
40
- ? unreadIndividualMessageCount[uid]
41
- : 0;
42
- default:
43
- return 0;
44
- }
45
- };
46
-
47
- return getUnreadCount;
48
- }
49
-
50
- export default useUnreadMessageCount;
@@ -1,26 +0,0 @@
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
- import {useRenderContext} from 'fpe-api';
13
- /**
14
- * This hook will fetch the user list
15
- * @returns userList
16
- */
17
-
18
- function useUserList() {
19
- const {renderPosition, renderList} = useRenderContext();
20
- return {
21
- renderList: renderList,
22
- renderPosition: renderPosition,
23
- };
24
- }
25
-
26
- export default useUserList;