agora-appbuilder-core 2.3.0-beta.2 → 2.3.0-beta.22

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 (78) hide show
  1. package/Readme.md +11 -6
  2. package/package.json +2 -2
  3. package/template/Gulpfile.js +112 -13
  4. package/template/_package-lock.json +13011 -13288
  5. package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +2 -0
  6. package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +4 -5
  7. package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +3 -1
  8. package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +3 -1
  9. package/template/agora-rn-uikit/src/Rtc/Create.tsx +64 -33
  10. package/template/agora-rn-uikit/src/Rtc/Join.tsx +11 -2
  11. package/template/agora-rn-uikit/src/RtcConfigure.tsx +23 -4
  12. package/template/agora-rn-uikit/src/Utils/permission.ts +17 -6
  13. package/template/bridge/rtc/webNg/RtcEngine.ts +51 -26
  14. package/template/esbuild.rsdk.go +20 -6
  15. package/template/fpe-api/components.ts +15 -0
  16. package/template/fpe-api/context.ts +2 -3
  17. package/template/fpe-api/install.ts +19 -9
  18. package/template/fpe-api/typeDefinition.ts +7 -6
  19. package/template/fpe-api/utils.ts +32 -25
  20. package/template/global.d.ts +3 -2
  21. package/template/index.rsdk.tsx +15 -4
  22. package/template/index.wsdk.tsx +13 -3
  23. package/template/package.json +4 -2
  24. package/template/react-native-toast-message/src/index.js +3 -7
  25. package/template/react-native-toast-message/src/{index.wsdk.js → index.sdk.tsx} +1 -1
  26. package/template/react-native-toast-message/src/styles.sdk.ts +17 -0
  27. package/template/src/SDKAppWrapper.tsx +1 -1
  28. package/template/src/components/Chat.tsx +23 -5
  29. package/template/src/components/ChatContext.ts +15 -4
  30. package/template/src/components/Controls.native.tsx +10 -6
  31. package/template/src/components/Controls.tsx +6 -4
  32. package/template/src/components/HostControlView.tsx +5 -3
  33. package/template/src/components/Navbar.tsx +15 -13
  34. package/template/src/components/RTMConfigure.tsx +20 -50
  35. package/template/src/components/chat-messages/useChatMessages.tsx +369 -70
  36. package/template/src/components/contexts/LiveStreamDataContext.tsx +3 -3
  37. package/template/src/components/contexts/ScreenShareContext.tsx +2 -0
  38. package/template/src/components/livestream/LiveStreamContext.tsx +9 -6
  39. package/template/src/components/participants/MeParticipant.tsx +5 -3
  40. package/template/src/components/participants/RemoteParticipants.tsx +9 -7
  41. package/template/src/components/precall/LocalMute.native.tsx +12 -8
  42. package/template/src/components/precall/LocalMute.tsx +5 -3
  43. package/template/src/components/precall/textInput.tsx +1 -1
  44. package/template/src/components/useShareLink.tsx +37 -39
  45. package/template/src/components/useUserPreference.tsx +125 -0
  46. package/template/src/custom-events/CustomEvents.ts +39 -23
  47. package/template/src/custom-events/types.ts +3 -3
  48. package/template/src/language/default-labels/videoCallScreenLabels.ts +4 -2
  49. package/template/src/pages/Create.tsx +10 -3
  50. package/template/src/pages/Join.tsx +4 -1
  51. package/template/src/pages/VideoCall.tsx +61 -56
  52. package/template/src/pages/video-call/CustomUserContextHolder.tsx +13 -5
  53. package/template/src/pages/video-call/VideoCallScreen.tsx +18 -15
  54. package/template/src/rtm/RTMEngine.ts +13 -0
  55. package/template/src/rtm/utils.ts +1 -1
  56. package/template/src/rtm-events/EventUtils.ts +3 -0
  57. package/template/src/rtm-events/EventsQueue.ts +9 -3
  58. package/template/src/rtm-events/constants.ts +3 -1
  59. package/template/src/subComponents/ChatBubble.tsx +22 -4
  60. package/template/src/subComponents/ChatContainer.tsx +30 -19
  61. package/template/src/subComponents/ChatInput.tsx +38 -26
  62. package/template/src/subComponents/SelectDevice.tsx +1 -1
  63. package/template/src/subComponents/recording/useRecording.tsx +15 -4
  64. package/template/src/subComponents/recording/useRecordingLayoutQuery.tsx +11 -5
  65. package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +35 -26
  66. package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +83 -33
  67. package/template/src/utils/SdkEvents.ts +3 -3
  68. package/template/src/utils/getMeetingInvite.ts +38 -15
  69. package/template/src/utils/getUniqueID.ts +5 -0
  70. package/template/src/utils/useDeleteMessage.ts +36 -0
  71. package/template/src/utils/useEditMessage.ts +41 -0
  72. package/template/src/utils/useGetName.ts +2 -3
  73. package/template/src/utils/useJoinMeeting.ts +22 -14
  74. package/template/src/utils/useLocalShareScreenUid.ts +19 -0
  75. package/template/src/utils/useSendMessage.ts +4 -5
  76. package/template/src/utils/useSetName.ts +2 -4
  77. package/template/webpack.rsdk.config.js +3 -2
  78. package/template/webpack.wsdk.config.js +0 -1
package/Readme.md CHANGED
@@ -1,18 +1,23 @@
1
1
  # App builder core
2
+
2
3
  This repository is a part of [RTE app builder](https://appbuilder.agora.io).
3
4
 
4
5
  ## Development instructions
6
+
5
7
  1. Clone the repo
6
8
 
7
9
  2. Navigate into project directory and run:
8
- ```
9
- npm run dev-setup -- meeting
10
- npm run dev-setup -- live-streaming
11
- ```
12
- This command will automatically set everything up for development
10
+ ```
11
+ npm run dev-setup -- meeting
12
+ npm run dev-setup -- live-streaming
13
+ npm run dev-setup -- voice-chat
14
+ npm run dev-setup -- audio-livecast
15
+ ```
16
+ This command will automatically set everything up for development
13
17
 
14
18
  To build react sdk using esbuild,
19
+
15
20
  1. Install the go compiler from https://go.dev/doc/install
16
21
  2. Run `go mod tidy` to download dependencies
17
22
 
18
- You can now build react sdk using esbuild through npm script
23
+ You can now build react sdk using esbuild through npm script
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "2.3.0-beta.2",
3
+ "version": "2.3.0-beta.22",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -13,7 +13,7 @@
13
13
  "deps": "cd template && npm i",
14
14
  "dev-setup": "npm run uikit && npm run deps && node devSetup.js",
15
15
  "web-build": "cd template && npm run web:build && cd .. && npm run copy-vercel",
16
- "copy-vercel": "cp vercel.json Builds/web",
16
+ "copy-vercel": "cp -r Builds/web template/dist && cp vercel.json template/dist",
17
17
  "pre-release": "cd template && cp package-lock.json _package-lock.json"
18
18
  },
19
19
  "author": {
@@ -24,14 +24,33 @@ const WebpackDevServer = require('webpack-dev-server');
24
24
  const webpackConfig = require('./webpack.renderer.config');
25
25
  const webpackRsdkConfig = require('./webpack.rsdk.config');
26
26
 
27
- const BUILD_PATH =
28
- process.env.TARGET === 'wsdk'
27
+ const outPathArg = process.argv.indexOf('--outpath')
28
+ getBuildPath = () => {
29
+ if (outPathArg == -1) {
30
+ return process.env.TARGET === 'wsdk'
29
31
  ? path.join(__dirname, '../Builds/web-sdk')
30
32
  : process.env.TARGET === 'rsdk'
31
33
  ? path.join(__dirname, '../Builds/react-sdk')
32
34
  : process.env.TARGET === 'android'
33
35
  ? path.join(__dirname, '../Builds/android')
34
36
  : path.join(__dirname, '../Builds/.electron');
37
+ } else {
38
+ return process.argv[outPathArg+1].split('/').slice(0, -1).join('/')
39
+ }
40
+ }
41
+ const BUILD_PATH = getBuildPath();
42
+ const TS_DEFS_BUILD_PATH = process.env.TARGET === 'wsdk'
43
+ ? path.join(__dirname, '../Builds/ts-defs/web-sdk')
44
+ : process.env.TARGET === 'rsdk'
45
+ ? path.join(__dirname, '../Builds/ts-defs/react-sdk')
46
+ : process.env.TARGET === 'android'
47
+ ? path.join(__dirname, '../Builds/ts-defs/android')
48
+ : path.join(__dirname, '../Builds/ts-defs/.electron');
49
+
50
+ const pkgNameArg = process.argv.indexOf('--pkgname')
51
+ const PACKAGE_NAME = pkgNameArg == -1
52
+ ? 'agora-app-builder-sdk'
53
+ : process.argv[pkgNameArg+1]
35
54
 
36
55
  let PRODUCT_NAME;
37
56
 
@@ -73,7 +92,7 @@ const general = {
73
92
  });
74
93
 
75
94
  let newPackage = {
76
- name: 'agora-app-builder-sdk',
95
+ name: PACKAGE_NAME,
77
96
  version,
78
97
  private,
79
98
  author,
@@ -122,13 +141,33 @@ const general = {
122
141
  );
123
142
  },
124
143
  typescriptFix: () => {
125
- 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
+ )
126
156
  .pipe(replace('"agora-rn-uikit"', '"agora-rn-uikit/src/index"'))
127
157
  .pipe(dest('../Builds/'));
128
158
  },
129
159
  typescriptClean: () => {
130
160
  return del([`${path.join(BUILD_PATH, '../', '/')}*.d.ts`], {force: true});
131
161
  },
162
+ genTsDefs: (cb) => {
163
+ runCli(`mkdir -p ${TS_DEFS_BUILD_PATH} && cp ${BUILD_PATH}/index.d.ts ${TS_DEFS_BUILD_PATH}/index.d.ts`, cb);
164
+ },
165
+ useTsDefs: (cb) => {
166
+ runCli(`cp ${TS_DEFS_BUILD_PATH}/index.d.ts ${BUILD_PATH}/index.d.ts`, cb)
167
+ },
168
+ npmPack: (cb) => {
169
+ runCli(`cd ${BUILD_PATH} && npm pack`, cb)
170
+ }
132
171
  };
133
172
 
134
173
  const electron = {
@@ -167,7 +206,18 @@ const reactSdk = {
167
206
  runCli('webpack --config ./webpack.rsdk.config.js', cb);
168
207
  },
169
208
  esbuild: (cb) => {
170
- runCli('go build -o ../esbuild-bin/rsdk ./esbuild.rsdk.go && ../esbuild-bin/rsdk', cb);
209
+ let outPath = '';
210
+ if (outPathArg != -1) {
211
+ outPath = ` --outpath ${process.argv[outPathArg+1]}`
212
+ }
213
+ let configTransformerPath = '';
214
+ const configTransformerPathArg = process.argv.indexOf('--configtransformerpath')
215
+ if (configTransformerPathArg != -1) {
216
+ configTransformerPath = ` --configtransformerpath ${process.argv[configTransformerPathArg+1]}`
217
+ }
218
+ let esbuildCmd = `go build -o ../esbuild-bin/rsdk ./esbuild.rsdk.go && ../esbuild-bin/rsdk${outPath}${configTransformerPath}`
219
+ console.log(esbuildCmd)
220
+ runCli(esbuildCmd, cb);
171
221
  },
172
222
  typescript: (cb) => {
173
223
  runCli(
@@ -189,9 +239,6 @@ const reactSdk = {
189
239
  .pipe(replace('"fpe-api"', '"fpe-api/index"'))
190
240
  .pipe(header('// @ts-nocheck\n'))
191
241
  .pipe(dest(BUILD_PATH));
192
- },
193
- npmPack: (cb) => {
194
- runCli('cd ../Builds/react-sdk && npm pack',cb)
195
242
  }
196
243
  };
197
244
 
@@ -284,7 +331,7 @@ module.exports.reactSdk = series(
284
331
  reactSdk.typescript,
285
332
  reactSdk.typescriptFix,
286
333
  general.typescriptClean,
287
- reactSdk.npmPack,
334
+ general.npmPack,
288
335
  );
289
336
 
290
337
  // react-sdk-esbuild
@@ -298,7 +345,31 @@ module.exports.reactSdkEsbuild = series (
298
345
  reactSdk.typescript,
299
346
  reactSdk.typescriptFix,
300
347
  general.typescriptClean,
301
- reactSdk.npmPack,
348
+ general.npmPack,
349
+ )
350
+
351
+ // generate typescript definitions
352
+ module.exports.makeRsdkTsDefs = series (
353
+ general.clean,
354
+ general.createBuildDirectory,
355
+ general.packageJson,
356
+ reactSdk.esbuild,
357
+ general.typescript,
358
+ general.typescriptFix,
359
+ reactSdk.typescript,
360
+ reactSdk.typescriptFix,
361
+ general.typescriptClean,
362
+ general.genTsDefs,
363
+ )
364
+
365
+ // react-sdk-esbuild with cached type definitions
366
+ module.exports.reactSdkEsbuildCachedTsc = series (
367
+ general.clean,
368
+ general.createBuildDirectory,
369
+ general.packageJson,
370
+ reactSdk.esbuild,
371
+ general.useTsDefs,
372
+ general.npmPack,
302
373
  )
303
374
 
304
375
  // web-sdk
@@ -316,13 +387,41 @@ module.exports.webSdk = series(
316
387
  general.typescriptClean,
317
388
  ),
318
389
  ),
319
- webSdk.npmPack,
390
+ general.npmPack,
391
+ );
392
+
393
+ module.exports.makeWsdkTsDefs = series(
394
+ general.clean,
395
+ general.createBuildDirectory,
396
+ general.packageJson,
397
+ parallel(
398
+ webSdk.webpack,
399
+ series(
400
+ general.typescript,
401
+ general.typescriptFix,
402
+ webSdk.typescript,
403
+ webSdk.typescriptFix,
404
+ general.typescriptClean,
405
+ ),
406
+ ),
407
+ general.genTsDefs,
408
+ );
409
+
410
+ module.exports.webSdkCachedTsc = series(
411
+ general.clean,
412
+ general.createBuildDirectory,
413
+ general.packageJson,
414
+ parallel(
415
+ webSdk.webpack,
416
+ general.useTsDefs,
417
+ ),
418
+ general.npmPack,
320
419
  );
321
420
 
322
421
  module.exports.androidUnix = series(
323
422
  general.clean,
324
423
  general.createBuildDirectory,
325
- // android.gradleBuildUnix,
424
+ android.gradleBuildUnix,
326
425
  android.copyBuild,
327
426
  );
328
427
 
@@ -334,7 +433,7 @@ module.exports.androidWin = series(
334
433
  );
335
434
 
336
435
  module.exports.test = series(
337
- reactSdk.npmPack,
436
+ general.npmPack,
338
437
  // general.typescript,
339
438
  // general.typescriptFix,
340
439
  // reactSdk.typescript,