agora-appbuilder-core 4.0.0-ms.5 → 4.0.0-spl.3

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 (43) hide show
  1. package/package.json +1 -1
  2. package/template/_package-lock.json +0 -11
  3. package/template/bridge/rtc/webNg/RtcEngine.ts +1 -1
  4. package/template/global.d.ts +0 -3
  5. package/template/package.json +0 -1
  6. package/template/src/App.tsx +76 -3
  7. package/template/src/AppWrapper.tsx +13 -16
  8. package/template/src/SDKAppWrapper.tsx +22 -8
  9. package/template/src/components/DeviceConfigure.tsx +290 -102
  10. package/template/src/components/GraphQLProvider.tsx +12 -40
  11. package/template/src/components/Navigation.tsx +15 -1
  12. package/template/src/components/OAuthConfig.ts +10 -20
  13. package/template/src/components/RTMConfigure.tsx +3 -0
  14. package/template/src/components/Router.electron.ts +0 -1
  15. package/template/src/components/Router.native.ts +0 -1
  16. package/template/src/components/Router.sdk.ts +0 -1
  17. package/template/src/components/Router.ts +0 -1
  18. package/template/src/components/SdkApiContext.tsx +162 -11
  19. package/template/src/components/SettingsView.tsx +1 -3
  20. package/template/src/components/StorageContext.tsx +1 -2
  21. package/template/src/components/StoreToken.tsx +1 -5
  22. package/template/src/components/precall/joinCallBtn.native.tsx +1 -3
  23. package/template/src/components/precall/joinCallBtn.tsx +0 -4
  24. package/template/src/components/useUserPreference.tsx +0 -27
  25. package/template/src/pages/VideoCall.tsx +4 -7
  26. package/template/src/subComponents/LocalEndCall.tsx +0 -1
  27. package/template/src/subComponents/LogoutButton.tsx +1 -1
  28. package/template/src/subComponents/recording/useRecording.tsx +2 -14
  29. package/template/src/utils/SdkEvents.ts +13 -3
  30. package/template/src/utils/common.tsx +5 -2
  31. package/template/src/utils/useCreateMeeting.ts +11 -2
  32. package/template/src/utils/useJoinMeeting.ts +0 -4
  33. package/template/webpack.web.config.js +3 -7
  34. package/template/src/AppRoutes.tsx +0 -53
  35. package/template/src/auth/AuthProvider.tsx +0 -261
  36. package/template/src/auth/AuthRoute.tsx +0 -76
  37. package/template/src/auth/IDPAuth.tsx +0 -16
  38. package/template/src/auth/config.ts +0 -45
  39. package/template/src/auth/useIDPAuth.tsx +0 -40
  40. package/template/src/auth/useTokenAuth.tsx +0 -153
  41. package/template/src/components/Navigation.sdk.tsx +0 -32
  42. package/template/src/pages/Login.tsx +0 -45
  43. package/template/src/subComponents/Loading.tsx +0 -47
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.0.0-ms.5",
3
+ "version": "4.0.0-spl.3",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -25,7 +25,6 @@
25
25
  "electron-updater": "4.3.9",
26
26
  "exponential-backoff": "3.1.0",
27
27
  "graphql": "15.5.0",
28
- "jwt-decode": "3.1.2",
29
28
  "nanoevents": "7.0.1",
30
29
  "nanoid": "4.0.0",
31
30
  "nosleep.js": "0.12.0",
@@ -19420,11 +19419,6 @@
19420
19419
  "integrity": "sha512-qpcRocdkUmf+UTNBYx5w6dexX5J31AKK1OmPwH630a83DdVVUIngk55RSAiIGpQyoH0dlr872VHfPjnQnK1qDQ==",
19421
19420
  "dev": true
19422
19421
  },
19423
- "node_modules/jwt-decode": {
19424
- "version": "3.1.2",
19425
- "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-3.1.2.tgz",
19426
- "integrity": "sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A=="
19427
- },
19428
19422
  "node_modules/keyv": {
19429
19423
  "version": "3.1.0",
19430
19424
  "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz",
@@ -44622,11 +44616,6 @@
44622
44616
  "integrity": "sha512-qpcRocdkUmf+UTNBYx5w6dexX5J31AKK1OmPwH630a83DdVVUIngk55RSAiIGpQyoH0dlr872VHfPjnQnK1qDQ==",
44623
44617
  "dev": true
44624
44618
  },
44625
- "jwt-decode": {
44626
- "version": "3.1.2",
44627
- "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-3.1.2.tgz",
44628
- "integrity": "sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A=="
44629
- },
44630
44619
  "keyv": {
44631
44620
  "version": "3.1.0",
44632
44621
  "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz",
@@ -730,11 +730,11 @@ export default class RtcEngine {
730
730
 
731
731
  async changeSpeaker(speakerId, callback, error) {
732
732
  try {
733
- this.speakerDeviceId = speakerId;
734
733
  // setting sepeaker for all remote stream (previously joined users)
735
734
  this.remoteStreams?.forEach((stream, uid, map) => {
736
735
  stream?.audio?.setPlaybackDevice(speakerId);
737
736
  });
737
+ this.speakerDeviceId = speakerId;
738
738
  callback(speakerId);
739
739
  } catch (e) {
740
740
  error(e);
@@ -98,9 +98,6 @@ interface ConfigInterface {
98
98
  ICON_BG_COLOR: string;
99
99
  TOOLBAR_COLOR: string;
100
100
  ACTIVE_SPEAKER: boolean;
101
- ENABLE_TOKEN_AUTH: boolean;
102
- ENABLE_IDP_AUTH: boolean;
103
- PROJECT_ID: string;
104
101
  }
105
102
  declare var $config: ConfigInterface;
106
103
  declare module 'customization' {
@@ -65,7 +65,6 @@
65
65
  "electron-updater": "4.3.9",
66
66
  "exponential-backoff": "3.1.0",
67
67
  "graphql": "15.5.0",
68
- "jwt-decode": "3.1.2",
69
68
  "nanoevents": "7.0.1",
70
69
  "nanoid": "4.0.0",
71
70
  "nosleep.js": "0.12.0",
@@ -11,7 +11,18 @@
11
11
  */
12
12
  import React, {useState, useContext} from 'react';
13
13
  import {Platform} from 'react-native';
14
+ import Join from './pages/Join';
15
+ import VideoCall from './pages/VideoCall';
16
+ import Create from './pages/Create';
17
+ import {Route, Switch, Redirect} from './components/Router';
18
+ import PrivateRoute from './components/PrivateRoute';
19
+ import OAuth from './components/OAuth';
20
+ import StoreToken from './components/StoreToken';
21
+ import {shouldAuthenticate} from './utils/common';
14
22
  import KeyboardManager from 'react-native-keyboard-manager';
23
+ // commented for v1 release
24
+ //import {CustomRoutesInterface, CUSTOM_ROUTES_PREFIX} from 'customization-api';
25
+ //import {useCustomization} from 'customization-implementation';
15
26
  import AppWrapper from './AppWrapper';
16
27
  import {
17
28
  MeetingInfoContextInterface,
@@ -20,9 +31,9 @@ import {
20
31
  } from './components/meeting-info/useMeetingInfo';
21
32
  import {SetMeetingInfoProvider} from './components/meeting-info/useSetMeetingInfo';
22
33
  import {ShareLinkProvider} from './components/useShareLink';
23
- import AppRoutes from './AppRoutes';
34
+ import Endcall from './pages/Endcall';
24
35
 
25
- // hook can't be used in the outside react function calls. so directly checking the platform.
36
+ //hook can't be used in the outside react function calls. so directly checking the platform.
26
37
  if (Platform.OS === 'ios') {
27
38
  KeyboardManager.setEnable(true);
28
39
  KeyboardManager.setEnableAutoToolbar(false);
@@ -45,6 +56,35 @@ declare module 'agora-rn-uikit' {
45
56
  }
46
57
 
47
58
  const App: React.FC = () => {
59
+ //commented for v1 release
60
+ //const CustomRoutes = useCustomization((data) => data?.customRoutes);
61
+ // const RenderCustomRoutes = () => {
62
+ // try {
63
+ // return (
64
+ // CustomRoutes &&
65
+ // Array.isArray(CustomRoutes) &&
66
+ // CustomRoutes.length &&
67
+ // CustomRoutes?.map((item: CustomRoutesInterface, i: number) => {
68
+ // let RouteComponent = item?.isPrivateRoute ? PrivateRoute : Route;
69
+ // return (
70
+ // <RouteComponent
71
+ // path={CUSTOM_ROUTES_PREFIX + item.path}
72
+ // exact={item.exact}
73
+ // key={i}
74
+ // failureRedirectTo={
75
+ // item.failureRedirectTo ? item.failureRedirectTo : '/'
76
+ // }
77
+ // {...item.routeProps}>
78
+ // <item.component {...item.componentProps} />
79
+ // </RouteComponent>
80
+ // );
81
+ // })
82
+ // );
83
+ // } catch (error) {
84
+ // console.error('Error on rendering the custom routes');
85
+ // return null;
86
+ // }
87
+ // };
48
88
  const [meetingInfo, setMeetingInfo] = useState<MeetingInfoContextInterface>(
49
89
  MeetingInfoDefaultValue,
50
90
  );
@@ -54,7 +94,40 @@ const App: React.FC = () => {
54
94
  <SetMeetingInfoProvider value={{setMeetingInfo}}>
55
95
  <MeetingInfoProvider value={{...meetingInfo}}>
56
96
  <ShareLinkProvider>
57
- <AppRoutes />
97
+ <Switch>
98
+ {/* commented for v1 release */}
99
+ {/* {RenderCustomRoutes()} */}
100
+ <Route exact path={'/'}>
101
+ <Redirect to={'/create'} />
102
+ </Route>
103
+ <Route exact path={'/authenticate'}>
104
+ {shouldAuthenticate ? <OAuth /> : <Redirect to={'/'} />}
105
+ </Route>
106
+ <Route path={'/auth-token/:token'}>
107
+ <StoreToken />
108
+ </Route>
109
+ <Route exact path={'/join'}>
110
+ <Join />
111
+ </Route>
112
+ {/* Will be used in the future
113
+ <Route exact path={'/leave'}>
114
+ <Endcall />
115
+ </Route> */}
116
+ {shouldAuthenticate ? (
117
+ <PrivateRoute
118
+ path={'/create'}
119
+ failureRedirectTo={'/authenticate'}>
120
+ <Create />
121
+ </PrivateRoute>
122
+ ) : (
123
+ <Route path={'/create'}>
124
+ <Create />
125
+ </Route>
126
+ )}
127
+ <Route path={'/:phrase'}>
128
+ <VideoCall />
129
+ </Route>
130
+ </Switch>
58
131
  </ShareLinkProvider>
59
132
  </MeetingInfoProvider>
60
133
  </SetMeetingInfoProvider>
@@ -29,7 +29,6 @@ import Error from './components/common/Error';
29
29
  import {ErrorProvider} from './components/common';
30
30
  import {useCustomization} from 'customization-implementation';
31
31
  import {LanguageProvider} from './language/useLanguage';
32
- import {AuthProvider} from './auth/AuthProvider';
33
32
  import {PropsConsumer} from 'agora-rn-uikit';
34
33
  import ToastComponent from './components/ToastComponent';
35
34
  import {ToastContext, ToastProvider} from './components/useToast';
@@ -100,21 +99,19 @@ const AppWrapper = (props: AppWrapperProps) => {
100
99
  ? `/${SdkJoinState.phrase}`
101
100
  : '',
102
101
  ]}>
103
- <AuthProvider>
104
- <SessionProvider>
105
- <ColorConfigure>
106
- <DimensionProvider>
107
- <LanguageProvider>
108
- <ErrorProvider>
109
- <Error />
110
- <Navigation />
111
- {props.children}
112
- </ErrorProvider>
113
- </LanguageProvider>
114
- </DimensionProvider>
115
- </ColorConfigure>
116
- </SessionProvider>
117
- </AuthProvider>
102
+ <SessionProvider>
103
+ <ColorConfigure>
104
+ <DimensionProvider>
105
+ <LanguageProvider>
106
+ <ErrorProvider>
107
+ <Error />
108
+ <Navigation />
109
+ {props.children}
110
+ </ErrorProvider>
111
+ </LanguageProvider>
112
+ </DimensionProvider>
113
+ </ColorConfigure>
114
+ </SessionProvider>
118
115
  </Router>
119
116
  </GraphQLProvider>
120
117
  </StorageProvider>
@@ -20,14 +20,18 @@ import {Unsubscribe} from 'nanoevents';
20
20
  // p: Parameters<T>[0],
21
21
  // ) => ReturnType<T>;
22
22
 
23
+ type deviceId = MediaDeviceInfo['deviceId'];
24
+
23
25
  export interface SdkMethodEvents {
24
26
  customize: (customization: CustomizationApiInterface) => void;
25
27
  join(
26
28
  roomid: string | Partial<MeetingInfoContextInterface['data']>,
27
29
  skipPrecall?: boolean,
28
30
  ): MeetingInfoContextInterface['data'];
29
- 'login':(token:string) => Promise<void>
30
- 'logout':() => Promise<void>
31
+ // mediaDevice: (deviceId: string, kind: MediaDeviceInfo['kind']) => void;
32
+ microphoneDevice: (deviceId: deviceId) => void;
33
+ speakerDevice: (deviceId: deviceId) => void;
34
+ cameraDevice: (deviceId: deviceId) => void;
31
35
  }
32
36
 
33
37
  // interface AppBuilderSdkApiInterface {
@@ -44,12 +48,6 @@ export interface SdkMethodEvents {
44
48
  // }
45
49
 
46
50
  export const AppBuilderSdkApi = {
47
- login: async (token: string) => {
48
- return await SDKMethodEventsManager.emit('login', token);
49
- },
50
- logout: async () => {
51
- return await SDKMethodEventsManager.emit('logout');
52
- },
53
51
  customize: async (customization: CustomizationApiInterface) => {
54
52
  return await SDKMethodEventsManager.emit('customize', customization);
55
53
  },
@@ -68,6 +66,22 @@ export const AppBuilderSdkApi = {
68
66
  const t = await SDKMethodEventsManager.emit('join', roomDetails);
69
67
  return t as unknown as [MeetingInfoContextInterface['data'], () => {}];
70
68
  },
69
+ // setMediaDevice: async (device: MediaDeviceInfo) => {
70
+ // return await SDKMethodEventsManager.emit(
71
+ // 'mediaDevice',
72
+ // device.deviceId,
73
+ // device.kind,
74
+ // );
75
+ // },
76
+ setMicrophone: async (deviceId: MediaDeviceInfo['deviceId']) => {
77
+ return await SDKMethodEventsManager.emit('microphoneDevice', deviceId);
78
+ },
79
+ setSpeaker: async (deviceId: MediaDeviceInfo['deviceId']) => {
80
+ return await SDKMethodEventsManager.emit('speakerDevice', deviceId);
81
+ },
82
+ setCamera: async (deviceId: MediaDeviceInfo['deviceId']) => {
83
+ return await SDKMethodEventsManager.emit('cameraDevice', deviceId);
84
+ },
71
85
  createCustomization: customize,
72
86
  on: <T extends keyof userEventsMapInterface>(
73
87
  userEventName: T,