agora-appbuilder-core 2.3.0-beta.21 → 2.3.0-beta.23

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": "2.3.0-beta.21",
3
+ "version": "2.3.0-beta.23",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -141,7 +141,18 @@ const general = {
141
141
  );
142
142
  },
143
143
  typescriptFix: () => {
144
- return src('../Builds/fpe-api.d.ts')
144
+ return src(['../Builds/fpe-api.d.ts', './global.d.ts'])
145
+ .pipe(concat('./fpe-api.d.ts'))
146
+ .pipe(
147
+ replace(
148
+ `declare var $config: ConfigInterface;
149
+ declare module 'test-fpe' {
150
+ const data: {};
151
+ export default data;
152
+ }`,
153
+ ' ',
154
+ ),
155
+ )
145
156
  .pipe(replace('"agora-rn-uikit"', '"agora-rn-uikit/src/index"'))
146
157
  .pipe(dest('../Builds/'));
147
158
  },
@@ -23,6 +23,7 @@
23
23
  "electron-updater": "4.3.9",
24
24
  "exponential-backoff": "3.1.0",
25
25
  "graphql": "15.5.0",
26
+ "nanoevents": "7.0.1",
26
27
  "nanoid": "4.0.0",
27
28
  "nosleep.js": "0.12.0",
28
29
  "react": "16.13.1",
@@ -21451,6 +21452,14 @@
21451
21452
  "integrity": "sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA==",
21452
21453
  "optional": true
21453
21454
  },
21455
+ "node_modules/nanoevents": {
21456
+ "version": "7.0.1",
21457
+ "resolved": "https://registry.npmjs.org/nanoevents/-/nanoevents-7.0.1.tgz",
21458
+ "integrity": "sha512-o6lpKiCxLeijK4hgsqfR6CNToPyRU3keKyyI6uwuHRvpRTbZ0wXw51WRgyldVugZqoJfkGFrjrIenYH3bfEO3Q==",
21459
+ "engines": {
21460
+ "node": "^14.0.0 || ^16.0.0 || >=18.0.0"
21461
+ }
21462
+ },
21454
21463
  "node_modules/nanoid": {
21455
21464
  "version": "4.0.0",
21456
21465
  "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-4.0.0.tgz",
@@ -45805,6 +45814,11 @@
45805
45814
  "integrity": "sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA==",
45806
45815
  "optional": true
45807
45816
  },
45817
+ "nanoevents": {
45818
+ "version": "7.0.1",
45819
+ "resolved": "https://registry.npmjs.org/nanoevents/-/nanoevents-7.0.1.tgz",
45820
+ "integrity": "sha512-o6lpKiCxLeijK4hgsqfR6CNToPyRU3keKyyI6uwuHRvpRTbZ0wXw51WRgyldVugZqoJfkGFrjrIenYH3bfEO3Q=="
45821
+ },
45808
45822
  "nanoid": {
45809
45823
  "version": "4.0.0",
45810
45824
  "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-4.0.0.tgz",
@@ -211,6 +211,7 @@ func rsdk(iopath *ioPaths) api.BuildResult {
211
211
  MinifyWhitespace: true,
212
212
  MinifyIdentifiers: true,
213
213
  MinifySyntax: true,
214
+ Sourcemap: api.SourceMapExternal,
214
215
 
215
216
  // debug options. does not affect bundle size
216
217
  // Metafile: true,
@@ -54,4 +54,8 @@ export {SidePanelButtonsArray} from '../src/subComponents/SidePanelButtons';
54
54
  export {
55
55
  ImageIcon as UiKitImageIcon,
56
56
  MaxVideoView as UiKitMaxVideoView,
57
+ BtnTemplate as UiKitBtnTemplate,
58
+ ClientRole as UikitClientRole,
59
+ ChannelProfile as UikitChannelProfile,
57
60
  } from '../agora-rn-uikit';
61
+ export type {BtnTemplateInterface as UikitBtnTemplateInterface} from '../agora-rn-uikit';
@@ -66,4 +66,5 @@ export {
66
66
  isWeb,
67
67
  shouldAuthenticate,
68
68
  } from '../src/utils/common';
69
+ export {default as isMobileOrTablet} from '../src/utils/isMobileOrTablet';
69
70
  export {useLocalUid} from '../agora-rn-uikit';
@@ -12,16 +12,27 @@
12
12
  /**
13
13
  * @format
14
14
  */
15
- import SDKAppWrapper,{AppBuilderSdkApi,AppBuilderSdkApiInterface} from './src/SDKAppWrapper';
15
+ import SDKAppWrapper, {
16
+ AppBuilderSdkApi,
17
+ AppBuilderSdkApiInterface,
18
+ } from './src/SDKAppWrapper';
16
19
  import React from 'react';
20
+ import * as RN from 'react-native-web';
21
+ import jsonFile from './config.json';
22
+
17
23
  export * from 'fpe-api';
24
+ export * from 'fpe-implementation';
18
25
 
19
26
  interface AppBuilderReactSdkInterface extends AppBuilderSdkApiInterface {
20
27
  View: React.FC;
21
28
  }
22
29
 
23
30
  const AppBuilderReactSdkApi: AppBuilderReactSdkInterface = {
24
- ...AppBuilderSdkApi,
25
- View: SDKAppWrapper,
26
- }
31
+ ...AppBuilderSdkApi,
32
+ View: SDKAppWrapper,
33
+ };
34
+
35
+ let config: ConfigInterface = jsonFile as unknown as ConfigInterface;
36
+
37
+ export {React, RN, config};
27
38
  export default AppBuilderReactSdkApi;
@@ -1,9 +1,16 @@
1
1
  import {AppRegistry} from 'react-native';
2
- import SDKAppWrapper,{AppBuilderSdkApi,AppBuilderSdkApiInterface} from './src/SDKAppWrapper';
2
+ import SDKAppWrapper, {
3
+ AppBuilderSdkApi,
4
+ AppBuilderSdkApiInterface,
5
+ } from './src/SDKAppWrapper';
6
+ import React from 'react';
7
+ import * as RN from 'react-native-web';
8
+ import jsonFile from './config.json';
9
+
3
10
  export * from 'fpe-api';
11
+ export * from 'fpe-implementation';
4
12
 
5
- interface AppBuilderWebSdkInterface extends AppBuilderSdkApiInterface {
6
- }
13
+ interface AppBuilderWebSdkInterface extends AppBuilderSdkApiInterface {}
7
14
 
8
15
  const AppBuilderWebSdkApi: AppBuilderWebSdkInterface = AppBuilderSdkApi;
9
16
 
@@ -24,4 +31,7 @@ class AppBuilder extends HTMLElement {
24
31
 
25
32
  customElements.define('app-builder', AppBuilder);
26
33
 
34
+ let config: ConfigInterface = jsonFile as unknown as ConfigInterface;
35
+
36
+ export {React, RN, config};
27
37
  export default AppBuilderWebSdkApi;
@@ -18,6 +18,7 @@
18
18
  "web-sdk:build": "cross-env TARGET=wsdk NODE_ENV=production gulp webSdk",
19
19
  "react-sdk": "cross-env TARGET=rsdk NODE_ENV=development gulp reactSdk",
20
20
  "react-sdk:build": "cross-env TARGET=rsdk NODE_ENV=production gulp reactSdk",
21
+ "react-sdk:esbuild": "cross-env TARGET=rsdk NODE_ENV=production gulp reactSdkEsbuild",
21
22
  "electron:start": "cross-env NODE_ENV=development gulp electron_development",
22
23
  "electron:build": "cross-env NODE_ENV=production gulp electron_build",
23
24
  "windows": "cross-env TARGET=windows npm run electron:start",
@@ -62,6 +63,7 @@
62
63
  "electron-updater": "4.3.9",
63
64
  "exponential-backoff": "3.1.0",
64
65
  "graphql": "15.5.0",
66
+ "nanoevents": "7.0.1",
65
67
  "nanoid": "4.0.0",
66
68
  "nosleep.js": "0.12.0",
67
69
  "react": "16.13.1",
@@ -9,7 +9,10 @@ export interface userEventsMapInterface {
9
9
  create: (
10
10
  hostPhrase: string,
11
11
  attendeePhrase?: string,
12
- pstnNumer?: string,
12
+ pstnNumer?: {
13
+ number: string;
14
+ pin: string;
15
+ },
13
16
  ) => void;
14
17
  preJoin: (meetingTitle: string, devices: MediaDeviceInfo[]) => void;
15
18
  join: (
@@ -27,7 +30,6 @@ export interface AppBuilderSdkApiInterface {
27
30
  userEventName: T,
28
31
  callBack: userEventsMapInterface[T],
29
32
  ) => void;
30
- off: (userEventName: keyof userEventsMapInterface) => void;
31
33
  }
32
34
 
33
35
  export const AppBuilderSdkApi: AppBuilderSdkApiInterface = {
@@ -40,9 +42,7 @@ export const AppBuilderSdkApi: AppBuilderSdkApiInterface = {
40
42
  createFPE,
41
43
  on: (userEventName, cb) => {
42
44
  SDKEvents.on(userEventName, cb);
43
- },
44
- off: (userEventName) => {
45
- SDKEvents.off(userEventName);
45
+ console.log('SDKEvents: Event Registered', userEventName);
46
46
  },
47
47
  };
48
48
 
@@ -50,7 +50,7 @@ const SDKAppWrapper = () => {
50
50
  const [fpe, setFpe] = useState(fpeConfig);
51
51
  useEffect(() => {
52
52
  SDKEvents.on('addFpe', (sdkFpeConfig) => {
53
- console.log('DEBUG(aditya)-SDKEvents: addFpe event called');
53
+ console.log('SDKEvents: addFpe event called');
54
54
  setFpe(sdkFpeConfig);
55
55
  });
56
56
  // Join event consumed in Create.tsx
@@ -30,6 +30,7 @@ import useJoinMeeting from '../utils/useJoinMeeting';
30
30
  import SDKEvents from '../utils/SdkEvents';
31
31
  import {MeetingInfoDefaultValue} from '../components/meeting-info/useMeetingInfo';
32
32
  import {useSetMeetingInfo} from '../components/meeting-info/useSetMeetingInfo';
33
+ import useNavigateTo from '../utils/useNavigateTo';
33
34
 
34
35
  const Create = () => {
35
36
  const {CreateComponent} = useFpe((data) => {
@@ -64,6 +65,7 @@ const Create = () => {
64
65
  const {
65
66
  meetingPassphrase: {attendee, host, pstn},
66
67
  } = useMeetingInfo();
68
+ const navigateTo = useNavigateTo();
67
69
  //commented for v1 release
68
70
  // const createdText = useString('meetingCreatedNotificationLabel')();
69
71
  // const hostControlsToggle = useString<boolean>('hostControlsToggle');
@@ -89,14 +91,15 @@ const Create = () => {
89
91
  if (isWeb) {
90
92
  document.title = $config.APP_NAME;
91
93
  }
92
- SDKEvents.on('joinMeetingWithPhrase', (phrase) => {
94
+ const unbind = SDKEvents.on('joinMeetingWithPhrase', (phrase) => {
93
95
  console.log(
94
- 'DEBUG(aditya)-SDKEvents: joinMeetingWithPhrase event called',
96
+ 'SDKEvents: joinMeetingWithPhrase event called', phrase
95
97
  );
96
- useJoin(phrase);
98
+ setMeetingInfo(MeetingInfoDefaultValue);
99
+ navigateTo(phrase)
97
100
  });
98
101
  return () => {
99
- SDKEvents.off('joinMeetingWithPhrase');
102
+ unbind();
100
103
  };
101
104
  }, []);
102
105
 
@@ -104,12 +107,6 @@ const Create = () => {
104
107
  setRoomCreated(true);
105
108
  };
106
109
 
107
- useEffect(() => {
108
- if (attendee) {
109
- SDKEvents.emit('create', host, attendee, pstn);
110
- }
111
- }, [attendee]);
112
-
113
110
  const createRoomAndNavigateToShare = async (
114
111
  roomTitle: string,
115
112
  enablePSTN: boolean,
@@ -128,16 +128,20 @@ const VideoCallScreen = () => {
128
128
 
129
129
  useEffect(() => {
130
130
  /**
131
- * Commenting this code as getDevices API is web only
131
+ * OLD: Commenting this code as getDevices API is web only
132
132
  * The below code fails on native app
133
+ * RESPONSE: Added isWeb check to restrict execution only on web.
133
134
  */
134
- // new Promise((res) =>
135
- // rtc.RtcEngine.getDevices(function (devices: MediaDeviceInfo[]) {
136
- // res(devices);
137
- // }),
138
- // ).then((devices: MediaDeviceInfo[]) => {
139
- // SDKEvents.emit('join', meetingTitle, devices, isHost);
140
- // });
135
+ if (isWeb) {
136
+ new Promise((res) =>
137
+ rtc.RtcEngine.getDevices(function (devices: MediaDeviceInfo[]) {
138
+ res(devices);
139
+ }),
140
+ ).then((devices: MediaDeviceInfo[]) => {
141
+ SDKEvents.emit('join', meetingTitle, devices, isHost);
142
+ console.log('SDKEvents: Event Called join')
143
+ });
144
+ }
141
145
  }, []);
142
146
 
143
147
  return VideocallComponent ? (
@@ -14,55 +14,13 @@
14
14
  */
15
15
  type callBackType = (...args: any[]) => void;
16
16
  import {userEventsMapInterface} from '../SDKAppWrapper';
17
+ import {createNanoEvents} from 'nanoevents';
17
18
 
18
19
  interface eventsMapInterface extends userEventsMapInterface {
19
- addFpe: callBackType;
20
- joinMeetingWithPhrase: (phrase: string) => void;
21
- }
22
- interface SDKEventsInterface {
23
- eventsMap: eventsMapInterface;
24
- eventSubs: {[key in keyof eventsMapInterface]: any};
25
- emit: (eventName: keyof eventsMapInterface, ...args: any) => void;
26
- on: (eventName: keyof eventsMapInterface, cb: callBackType) => void;
27
- off: (eventName: keyof eventsMapInterface) => void;
20
+ addFpe?: callBackType;
21
+ joinMeetingWithPhrase?: (phrase: string) => void;
28
22
  }
29
23
 
30
- const SDKEvents: SDKEventsInterface = {
31
- eventsMap: {
32
- addFpe: () => {},
33
- joinMeetingWithPhrase: (p) => {},
34
- leave: () => {},
35
- create: () => {},
36
- preJoin: () => {},
37
- join: () => {},
38
- },
39
- eventSubs: {
40
- addFpe: null,
41
- joinMeetingWithPhrase: null,
42
- leave: null,
43
- create: null,
44
- preJoin: null,
45
- join: null,
46
- },
47
- on: function (eventName, cb) {
48
- console.log(
49
- 'DEBUG(aditya)-SDKEvents: event registered:',
50
- eventName,
51
- );
52
- this.eventsMap[eventName] = cb;
53
- if (this.eventSubs[eventName]) {
54
- cb(...this.eventSubs[eventName]);
55
- }
56
- },
57
- emit: function (eventName, ...args) {
58
- console.log('DEBUG(aditya)-SDKEvents: emit called:', eventName, ...args);
59
- this.eventsMap[eventName](...args);
60
- this.eventSubs[eventName] = args;
61
- },
62
- off: function (eventName) {
63
- console.log('DEBUG(aditya)-SDKEvents: event deregistered:', eventName);
64
- this.eventSubs[eventName] = null;
65
- },
66
- };
24
+ const SDKEvents = createNanoEvents<eventsMapInterface>();
67
25
 
68
26
  export default SDKEvents;
@@ -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(
@@ -67,6 +68,12 @@ export default function useCreateMeeting() {
67
68
  meetingTitle: roomTitle,
68
69
  meetingPassphrase: meetingInfoPassPhrase,
69
70
  });
71
+ SDKEvents.emit(
72
+ 'create',
73
+ meetingInfoPassPhrase.host,
74
+ meetingInfoPassPhrase.attendee,
75
+ meetingInfoPassPhrase.pstn,
76
+ );
70
77
  } else {
71
78
  throw new Error(`An error occurred in parsing the channel data.`);
72
79
  }
@@ -85,7 +85,7 @@ module.exports = {
85
85
  ].filter(Boolean),
86
86
  },
87
87
  // Enable source maps during development
88
- // devtool: isDevelopment ? 'eval-cheap-module-source-map' : undefined,
88
+ devtool: isDevelopment ? 'eval-cheap-module-source-map' : undefined,
89
89
  module: {
90
90
  rules: [
91
91
  {
@@ -16,6 +16,7 @@ module.exports = merge(commons, {
16
16
  'react-router': 'react-router',
17
17
  'react-router-dom': 'react-router-dom',
18
18
  '@apollo/client': '@apollo/client',
19
+ nanoid: 'nanoid',
19
20
  },
20
21
  // Main entry point for the web application
21
22
  entry: {
@@ -25,9 +26,9 @@ module.exports = merge(commons, {
25
26
  output: {
26
27
  path: path.resolve(__dirname, `../Builds/react-sdk`),
27
28
  filename: 'index.js',
28
- library:{
29
+ library: {
29
30
  type: 'commonjs2',
30
- }
31
+ },
31
32
  },
32
33
  // watch: isDevelopment
33
34
  });
@@ -20,7 +20,6 @@ const baseConfig = {
20
20
  name: 'AgoraAppBuilder',
21
21
  },
22
22
  },
23
- watch: isDevelopment
24
23
  };
25
24
 
26
25
  const mappedConfigs = libraryTargets.map((target, _) => {