agora-appbuilder-core 4.1.7-beta.3 → 4.1.7-beta.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.1.7-beta.3",
3
+ "version": "4.1.7-beta.5",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -77,8 +77,8 @@ const DefaultConfig = {
77
77
  CHAT_ORG_NAME: '',
78
78
  CHAT_APP_NAME: '',
79
79
  CHAT_URL: '',
80
- CLI_VERSION: '3.1.7-beta.3',
81
- CORE_VERSION: '4.1.7-beta.3',
80
+ CLI_VERSION: '3.1.7-beta.5',
81
+ CORE_VERSION: '4.1.7-beta.5',
82
82
  DISABLE_LANDSCAPE_MODE: false,
83
83
  STT_AUTO_START: false,
84
84
  CLOUD_RECORDING_AUTO_START: false,
@@ -232,7 +232,7 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
232
232
  const title = buttonText;
233
233
  const onPress = () => onSubmit();
234
234
  const disabled = $config.ENABLE_WAITING_ROOM_AUTO_REQUEST
235
- ? !hasHostJoined
235
+ ? !hasHostJoined || isInWaitingRoom
236
236
  : isInWaitingRoom || username?.trim() === '';
237
237
  return props?.render ? (
238
238
  props.render(onPress, title, disabled)
@@ -281,7 +281,7 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
281
281
  const title = buttonText;
282
282
  const onPress = () => onSubmit();
283
283
  const disabled = $config.ENABLE_WAITING_ROOM_AUTO_REQUEST
284
- ? !hasHostJoined
284
+ ? !hasHostJoined || isInWaitingRoom
285
285
  : isInWaitingRoom || username?.trim() === '';
286
286
  return props?.render ? (
287
287
  props.render(onPress, title, disabled)
@@ -9,10 +9,11 @@ import useWaitingRoomAPI from '../subComponents/waiting-rooms/useWaitingRoomAPI'
9
9
  import {base64ToUint8Array} from '../utils';
10
10
  import {LogSource, logger} from '../logger/AppBuilderLogger';
11
11
  import getUniqueID from './getUniqueID';
12
- import {
13
- chatErrorNoToken
14
- } from '../language/default-labels/videoCallScreenLabels';
12
+ import {chatErrorNoToken} from '../language/default-labels/videoCallScreenLabels';
15
13
  import {useString} from '../utils/useString';
14
+ import isSDK from './isSDK';
15
+ import {AuthErrorCodes} from './common';
16
+ import SDKEvents from './SdkEvents';
16
17
 
17
18
  const JOIN_CHANNEL_PHRASE_AND_GET_USER = gql`
18
19
  query JoinChannel($passphrase: String!) {
@@ -221,6 +222,12 @@ export default function useJoinRoom() {
221
222
  const endReqTs = Date.now();
222
223
  const latency = endReqTs - startReqTs;
223
224
  if (response?.error) {
225
+ if (isWaitingRoomEnabled) {
226
+ const errorCode = response?.error?.code;
227
+ if (AuthErrorCodes.indexOf(errorCode) !== -1 && isSDK()) {
228
+ SDKEvents.emit('unauthorized', response?.error);
229
+ }
230
+ }
224
231
  logger.error(
225
232
  LogSource.NetworkRest,
226
233
  `${isWaitingRoomEnabled ? 'channel_join_request' : 'joinChannel'}`,
@@ -309,25 +316,22 @@ export default function useJoinRoom() {
309
316
  const chatData = isWaitingRoomEnabled
310
317
  ? data.chat
311
318
  : data?.joinChannel?.chat;
312
- const hasError = chatData?.error?.code || chatData?.error?.message;
313
- const missingUserToken =
314
- !(
315
- isWaitingRoomEnabled
316
- ? data.chat?.userToken
317
- : data?.joinChannel?.chat?.userToken
318
- );
319
- if (
320
- $config.CHAT &&
321
- (hasError || missingUserToken)
322
- ) {
319
+ const hasError = chatData?.error?.code || chatData?.error?.message;
320
+ const missingUserToken = !(isWaitingRoomEnabled
321
+ ? data.chat?.userToken
322
+ : data?.joinChannel?.chat?.userToken);
323
+ if ($config.CHAT && (hasError || missingUserToken)) {
323
324
  roomInfo.chat = {
324
325
  user_token: '',
325
326
  group_id: '',
326
327
  is_group_owner: false,
327
328
  error: {
328
- code: chatData?.error?.code || (missingUserToken ? 'NO_USER_TOKEN' : ''),
329
- message: chatData?.error?.message ||
330
- (missingUserToken ? chatErrorNoTokenText : ''),
329
+ code:
330
+ chatData?.error?.code ||
331
+ (missingUserToken ? 'NO_USER_TOKEN' : ''),
332
+ message:
333
+ chatData?.error?.message ||
334
+ (missingUserToken ? chatErrorNoTokenText : ''),
331
335
  },
332
336
  };
333
337
  } else {
@@ -341,7 +345,7 @@ export default function useJoinRoom() {
341
345
  is_group_owner: isWaitingRoomEnabled
342
346
  ? data.chat.isGroupOwner
343
347
  : data?.joinChannel?.chat?.isGroupOwner,
344
- error: null,
348
+ error: null,
345
349
  };
346
350
  roomInfo.chat = chat;
347
351
  }