agora-appbuilder-core 4.0.28 → 4.0.29-beta-11

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.0.28",
3
+ "version": "4.0.29-beta-11",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -61,3 +61,4 @@ export type {ChatUIControlsInterface} from '../src/components/chat-ui/useChatUIC
61
61
  export {useVirtualBackground} from '../src/app-state/useVirtualBackground';
62
62
  export {useBeautyEffects} from '../src/app-state/useBeautyEffects';
63
63
  export {useLiveStreamDataContext} from '../src/components/contexts/LiveStreamDataContext';
64
+ export {useRtmContext} from '../src/components/ChatContext';
@@ -35,6 +35,7 @@ export interface PreCallInterface extends BeforeAndAfterInterface {
35
35
  joinButton?: React.ComponentType;
36
36
  textBox?: React.ComponentType;
37
37
  virtualBackgroundPanel?: React.ComponentType<VBPanelProps>;
38
+ wrapper?: React.ComponentType;
38
39
  }
39
40
  export interface ChatCmpInterface {
40
41
  //commented for v1 release
@@ -47,3 +47,4 @@ export {getSessionId} from '../src/utils/common';
47
47
  export {default as ThemeConfig} from '../src/theme';
48
48
  export {default as hexadecimalTransparency} from '../src/utils/hexadecimalTransparency';
49
49
  export {useFullScreen} from '../src/utils/useFullScreen';
50
+ export {useHideShareTitle} from '../src/utils/useHideShareTile';
@@ -510,8 +510,15 @@ const AuthProvider = (props: AuthProviderProps) => {
510
510
  'API unauth_login Trying to authenticate user',
511
511
  {requestId: requestId, startReqTs},
512
512
  );
513
+ let user_id_unauth = null;
514
+ try {
515
+ if (isWeb()) {
516
+ const urlParams = new URLSearchParams(window?.location?.search);
517
+ user_id_unauth = urlParams.get('user_id');
518
+ }
519
+ } catch (error) {}
513
520
 
514
- fetch(GET_UNAUTH_FLOW_API_ENDPOINT(), {
521
+ fetch(GET_UNAUTH_FLOW_API_ENDPOINT(user_id_unauth), {
515
522
  credentials: 'include',
516
523
  headers: {
517
524
  'X-Request-Id': requestId,
@@ -46,7 +46,12 @@ export const getOriginURL = () => {
46
46
  return isWeb() ? `${window.location.origin}` : `${$config.FRONTEND_ENDPOINT}`;
47
47
  };
48
48
 
49
- export const GET_UNAUTH_FLOW_API_ENDPOINT = () => {
49
+ export const GET_UNAUTH_FLOW_API_ENDPOINT = (user_id?: string) => {
50
+ if (user_id) {
51
+ return `${$config.BACKEND_ENDPOINT}/v1/login?project_id=${
52
+ $config.PROJECT_ID
53
+ }&platform_id=${getPlatformId()}&user_id=${user_id}`;
54
+ }
50
55
  return `${$config.BACKEND_ENDPOINT}/v1/login?project_id=${
51
56
  $config.PROJECT_ID
52
57
  }&platform_id=${getPlatformId()}`;
@@ -13,6 +13,7 @@ import RtmEngine from 'agora-react-native-rtm';
13
13
  import {UidType} from '../../agora-rn-uikit';
14
14
  import {createContext, SetStateAction} from 'react';
15
15
  import {ChatMessageType} from './chat-messages/useChatMessages';
16
+ import {createHook} from 'customization-implementation';
16
17
 
17
18
  export interface ChatBubbleProps {
18
19
  isLocal: boolean;
@@ -82,4 +83,7 @@ export enum controlMessageEnum {
82
83
 
83
84
  const ChatContext = createContext(null as unknown as chatContext);
84
85
 
86
+ const useRtmContext = createHook(ChatContext);
87
+
88
+ export {useRtmContext};
85
89
  export default ChatContext;
@@ -227,6 +227,7 @@ const Precall = (props: any) => {
227
227
  VirtualBackgroundComponent,
228
228
  PrecallAfterView,
229
229
  PrecallBeforeView,
230
+ wrapper: PrecallWrapper,
230
231
  } = useCustomization(data => {
231
232
  const components: {
232
233
  PrecallAfterView: React.ComponentType;
@@ -235,6 +236,7 @@ const Precall = (props: any) => {
235
236
  VideoPreview: React.ComponentType;
236
237
  VirtualBackgroundComponent: React.ComponentType<VBPanelProps>;
237
238
  MeetingName: React.ComponentType<MeetingTitleProps>;
239
+ wrapper: React.ComponentType;
238
240
  } = {
239
241
  PrecallAfterView: React.Fragment,
240
242
  PrecallBeforeView: React.Fragment,
@@ -242,6 +244,7 @@ const Precall = (props: any) => {
242
244
  VideoPreview: PreCallVideoPreview,
243
245
  DeviceSelect: PreCallSelectDevice,
244
246
  VirtualBackgroundComponent: VBPanel,
247
+ wrapper: React.Fragment,
245
248
  };
246
249
  // commented for v1 release
247
250
  // if (
@@ -288,6 +291,14 @@ const Precall = (props: any) => {
288
291
  // }
289
292
  // }
290
293
  // }
294
+ if (
295
+ data?.components?.precall?.wrapper &&
296
+ typeof data?.components?.precall?.wrapper !== 'object'
297
+ ) {
298
+ if (isValidReactComponent(data?.components?.precall?.wrapper)) {
299
+ components.wrapper = data?.components?.precall?.wrapper;
300
+ }
301
+ }
291
302
  if (
292
303
  data?.components?.precall?.virtualBackgroundPanel &&
293
304
  typeof data?.components?.precall.virtualBackgroundPanel !== 'object' &&
@@ -357,7 +368,7 @@ const Precall = (props: any) => {
357
368
  return FpePrecallComponent ? (
358
369
  <FpePrecallComponent />
359
370
  ) : (
360
- <>
371
+ <PrecallWrapper>
361
372
  <PrecallBeforeView />
362
373
  <View style={{flex: 1}}>
363
374
  <ScrollView
@@ -454,7 +465,7 @@ const Precall = (props: any) => {
454
465
  </ScrollView>
455
466
  </View>
456
467
  <PrecallAfterView />
457
- </>
468
+ </PrecallWrapper>
458
469
  );
459
470
  };
460
471
 
@@ -248,6 +248,7 @@ const Precall = () => {
248
248
  VirtualBackgroundComponent,
249
249
  PrecallAfterView,
250
250
  PrecallBeforeView,
251
+ wrapper: PrecallWrapper,
251
252
  } = useCustomization(data => {
252
253
  const components: {
253
254
  PrecallAfterView: React.ComponentType;
@@ -256,6 +257,7 @@ const Precall = () => {
256
257
  VirtualBackgroundComponent: React.ComponentType<VBPanelProps>;
257
258
  VideoPreview: React.ComponentType;
258
259
  MeetingName: React.ComponentType<MeetingTitleProps>;
260
+ wrapper: React.ComponentType;
259
261
  } = {
260
262
  PrecallAfterView: React.Fragment,
261
263
  PrecallBeforeView: React.Fragment,
@@ -263,6 +265,7 @@ const Precall = () => {
263
265
  VideoPreview: PreCallVideoPreview,
264
266
  DeviceSelect: PreCallSelectDevice,
265
267
  VirtualBackgroundComponent: VBPanel,
268
+ wrapper: React.Fragment,
266
269
  };
267
270
  // commented for v1 release
268
271
  // if (
@@ -310,6 +313,15 @@ const Precall = () => {
310
313
  // }
311
314
  // }
312
315
 
316
+ if (
317
+ data?.components?.precall?.wrapper &&
318
+ typeof data?.components?.precall?.wrapper !== 'object'
319
+ ) {
320
+ if (isValidReactComponent(data?.components?.precall?.wrapper)) {
321
+ components.wrapper = data?.components?.precall?.wrapper;
322
+ }
323
+ }
324
+
313
325
  if (
314
326
  data?.components?.precall?.virtualBackgroundPanel &&
315
327
  typeof data?.components?.precall.virtualBackgroundPanel !== 'object' &&
@@ -388,7 +400,7 @@ const Precall = () => {
388
400
  return FpePrecallComponent ? (
389
401
  <FpePrecallComponent />
390
402
  ) : (
391
- <>
403
+ <PrecallWrapper>
392
404
  <PrecallBeforeView />
393
405
  {$config.EVENT_MODE &&
394
406
  rtcProps.role == ClientRoleType.ClientRoleAudience ? (
@@ -529,7 +541,7 @@ const Precall = () => {
529
541
  </View>
530
542
  )}
531
543
  <PrecallAfterView />
532
- </>
544
+ </PrecallWrapper>
533
545
  );
534
546
  };
535
547
 
@@ -10,6 +10,8 @@ import {DispatchContext} from '../../../agora-rn-uikit';
10
10
  import MeetingInfoGridTile from '../../components/meeting-info-invite/MeetingInfoGridTile';
11
11
  import Spacer from '../../atoms/Spacer';
12
12
  import {useLiveStreamDataContext} from '../../components/contexts/LiveStreamDataContext';
13
+ import {useCustomization} from 'customization-implementation';
14
+ import useMount from '../../components/useMount';
13
15
 
14
16
  const VideoComponent = () => {
15
17
  const {dispatch} = useContext(DispatchContext);
@@ -21,23 +23,42 @@ const VideoComponent = () => {
21
23
  const isDesktop = useIsDesktop();
22
24
  const {audienceUids, hostUids} = useLiveStreamDataContext();
23
25
  const [showNoUserInfo, setShowNoUserInfo] = useState(false);
26
+ const isCustomLayoutUsed = useCustomization(config => {
27
+ if (
28
+ typeof config?.components?.videoCall === 'object' &&
29
+ config?.components?.videoCall?.customLayout
30
+ ) {
31
+ return true;
32
+ }
33
+ return false;
34
+ });
24
35
 
25
36
  const {roomPreference} = useRoomInfo();
26
37
 
27
38
  const disableShareTile = roomPreference?.disableShareTile;
39
+ const disableShareTileRef = useRef(disableShareTile);
28
40
 
29
- useEffect(() => {
30
- if (!disableShareTile) {
31
- setTimeout(() => {
41
+ useMount(() => {
42
+ //show share tile after 2.5 seconds because RTC user join take few seconds.
43
+ //meanwhile we don't want to show the share tile
44
+ setTimeout(() => {
45
+ if (!disableShareTileRef.current) {
32
46
  setShowNoUserInfo(true);
33
- }, 2500);
47
+ }
48
+ }, 2500);
49
+ });
50
+
51
+ useEffect(() => {
52
+ disableShareTileRef.current = disableShareTile;
53
+ if (disableShareTile) {
54
+ setShowNoUserInfo(false);
34
55
  }
35
56
  }, [disableShareTile]);
36
57
 
37
58
  const currentLayoutRef = useRef(currentLayout);
38
59
  const gridLayoutName = getGridLayoutName();
39
60
  useEffect(() => {
40
- if (activeUids && activeUids.length === 1) {
61
+ if (activeUids && activeUids.length === 1 && !isCustomLayoutUsed) {
41
62
  if (pinnedUid) {
42
63
  dispatch({type: 'UserPin', value: [0]});
43
64
  dispatch({type: 'UserSecondaryPin', value: [0]});
@@ -46,7 +67,7 @@ const VideoComponent = () => {
46
67
  setLayout(gridLayoutName);
47
68
  }
48
69
  }
49
- }, [activeUids]);
70
+ }, [activeUids, isCustomLayoutUsed]);
50
71
 
51
72
  useEffect(() => {
52
73
  currentLayoutRef.current = currentLayout;
@@ -0,0 +1,16 @@
1
+ import {useSetRoomInfo} from '../components/room-info/useSetRoomInfo';
2
+
3
+ export const useHideShareTitle = () => {
4
+ const {setRoomInfo} = useSetRoomInfo();
5
+ return (disableShareTile: boolean) => {
6
+ setRoomInfo(prevState => {
7
+ return {
8
+ ...prevState,
9
+ roomPreference: {
10
+ ...prevState?.roomPreference,
11
+ disableShareTile: disableShareTile,
12
+ },
13
+ };
14
+ });
15
+ };
16
+ };