agora-appbuilder-core 2.3.0-beta.22 → 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.22",
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": [
@@ -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';
@@ -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
 
@@ -91,7 +91,7 @@ const Create = () => {
91
91
  if (isWeb) {
92
92
  document.title = $config.APP_NAME;
93
93
  }
94
- SDKEvents.on('joinMeetingWithPhrase', (phrase) => {
94
+ const unbind = SDKEvents.on('joinMeetingWithPhrase', (phrase) => {
95
95
  console.log(
96
96
  'SDKEvents: joinMeetingWithPhrase event called', phrase
97
97
  );
@@ -99,7 +99,7 @@ const Create = () => {
99
99
  navigateTo(phrase)
100
100
  });
101
101
  return () => {
102
- SDKEvents.off('joinMeetingWithPhrase');
102
+ unbind();
103
103
  };
104
104
  }, []);
105
105
 
@@ -107,12 +107,6 @@ const Create = () => {
107
107
  setRoomCreated(true);
108
108
  };
109
109
 
110
- useEffect(() => {
111
- if (attendee) {
112
- SDKEvents.emit('create', host, attendee, pstn);
113
- }
114
- }, [attendee]);
115
-
116
110
  const createRoomAndNavigateToShare = async (
117
111
  roomTitle: string,
118
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
- '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('SDKEvents: emit called:', eventName, ...args);
59
- this.eventsMap[eventName](...args);
60
- this.eventSubs[eventName] = args;
61
- },
62
- off: function (eventName) {
63
- console.log('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
  {