agora-appbuilder-core 4.0.25 → 4.0.26-beta-2

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 (29) hide show
  1. package/package.json +1 -1
  2. package/template/android/app/src/main/assets/fonts/icomoon.ttf +0 -0
  3. package/template/customization-api/typeDefinition.ts +3 -8
  4. package/template/customization-api/utils.ts +1 -0
  5. package/template/defaultConfig.js +51 -51
  6. package/template/src/AppWrapper.tsx +1 -1
  7. package/template/src/assets/font-styles.css +4 -0
  8. package/template/src/assets/fonts/icomoon.ttf +0 -0
  9. package/template/src/assets/selection.json +1 -3452
  10. package/template/src/atoms/ActionMenu.tsx +88 -23
  11. package/template/src/atoms/Carousel.tsx +30 -24
  12. package/template/src/atoms/CustomIcon.tsx +1 -0
  13. package/template/src/atoms/ParticipantsCount.tsx +3 -10
  14. package/template/src/atoms/RecordingInfo.tsx +25 -30
  15. package/template/src/atoms/Toolbar.tsx +0 -8
  16. package/template/src/atoms/ToolbarPreset.tsx +77 -45
  17. package/template/src/components/Controls.tsx +289 -218
  18. package/template/src/components/Leftbar.tsx +62 -43
  19. package/template/src/components/Navbar.tsx +80 -77
  20. package/template/src/components/NavbarMobile.tsx +51 -46
  21. package/template/src/components/Rightbar.tsx +60 -43
  22. package/template/src/components/room-info/useRoomInfo.tsx +1 -1
  23. package/template/src/language/default-labels/videoCallScreenLabels.ts +1 -2
  24. package/template/src/pages/video-call/ActionSheet.tsx +4 -4
  25. package/template/src/pages/video-call/ActionSheetContent.tsx +134 -211
  26. package/template/src/pages/video-call/VideoCallMobileView.tsx +21 -27
  27. package/template/src/pages/video-call/VideoCallScreen.tsx +30 -20
  28. package/template/src/pages/video-call/index.ts +2 -0
  29. package/template/src/utils/common.tsx +48 -0
@@ -40,14 +40,24 @@ import Transcript, {
40
40
  } from '../../subComponents/caption/Transcript';
41
41
 
42
42
  import Spacer from '../../atoms/Spacer';
43
- import Leftbar, {LeftbarProps} from '../../components/Leftbar';
44
- import Rightbar, {RightbarProps} from '../../components/Rightbar';
43
+ import Leftbar, {
44
+ LeftbarProps as LeftbarPropsInterface,
45
+ } from '../../components/Leftbar';
46
+ import Rightbar, {
47
+ RightbarProps as RightbarInterface,
48
+ } from '../../components/Rightbar';
45
49
  import useFindActiveSpeaker from '../../utils/useFindActiveSpeaker';
46
50
  import VBPanel, {
47
51
  VBPanelProps,
48
52
  } from '../../components/virtual-background/VBPanel';
49
53
  import {LogSource, logger} from '../../logger/AppBuilderLogger';
50
54
  import {useIsRecordingBot} from '../../subComponents/recording/useIsRecordingBot';
55
+ import {
56
+ ToolbarBottomPresetProps,
57
+ ToolbarLeftPresetProps,
58
+ ToolbarRightPresetProps,
59
+ ToolbarTopPresetProps,
60
+ } from 'src/atoms/ToolbarPreset';
51
61
 
52
62
  const VideoCallScreen = () => {
53
63
  useFindActiveSpeaker();
@@ -90,12 +100,12 @@ const VideoCallScreen = () => {
90
100
  TopbarComponent: React.ComponentType<NavbarProps>;
91
101
  VideocallBeforeView: React.ComponentType;
92
102
  VideocallAfterView: React.ComponentType;
93
- LeftbarComponent: React.ComponentType<LeftbarProps>;
94
- RightbarComponent: React.ComponentType<RightbarProps>;
95
- BottombarProps?: ToolbarCustomItem[];
96
- TopbarProps?: ToolbarCustomItem[];
97
- LeftbarProps?: ToolbarCustomItem[];
98
- RightbarProps?: ToolbarCustomItem[];
103
+ LeftbarComponent: React.ComponentType<LeftbarPropsInterface>;
104
+ RightbarComponent: React.ComponentType<RightbarInterface>;
105
+ BottombarProps?: any;
106
+ TopbarProps?: any;
107
+ LeftbarProps?: any;
108
+ RightbarProps?: any;
99
109
  } = {
100
110
  BottombarComponent: Controls,
101
111
  TopbarComponent: Navbar,
@@ -110,10 +120,10 @@ const VideoCallScreen = () => {
110
120
  VideocallWrapper: React.Fragment,
111
121
  LeftbarComponent: Leftbar,
112
122
  RightbarComponent: Rightbar,
113
- BottombarProps: [],
114
- TopbarProps: [],
115
- LeftbarProps: [],
116
- RightbarProps: [],
123
+ BottombarProps: {},
124
+ TopbarProps: {},
125
+ LeftbarProps: {},
126
+ RightbarProps: {},
117
127
  };
118
128
  if (
119
129
  data?.components?.videoCall &&
@@ -187,28 +197,28 @@ const VideoCallScreen = () => {
187
197
  if (
188
198
  data?.components?.videoCall.bottomToolBar &&
189
199
  typeof data?.components?.videoCall.bottomToolBar === 'object' &&
190
- data?.components?.videoCall.bottomToolBar.length
200
+ Object.keys(data?.components?.videoCall.bottomToolBar)?.length
191
201
  ) {
192
202
  components.BottombarProps = data?.components?.videoCall.bottomToolBar;
193
203
  }
194
204
  if (
195
205
  data?.components?.videoCall.topToolBar &&
196
206
  typeof data?.components?.videoCall.topToolBar === 'object' &&
197
- data?.components?.videoCall.topToolBar.length
207
+ Object.keys(data?.components?.videoCall.topToolBar)?.length
198
208
  ) {
199
209
  components.TopbarProps = data?.components?.videoCall.topToolBar;
200
210
  }
201
211
  if (
202
212
  data?.components?.videoCall.rightToolBar &&
203
213
  typeof data?.components?.videoCall.rightToolBar === 'object' &&
204
- data?.components?.videoCall.rightToolBar.length
214
+ Object.keys(data?.components?.videoCall.rightToolBar)?.length
205
215
  ) {
206
216
  components.RightbarProps = data?.components?.videoCall.rightToolBar;
207
217
  }
208
218
  if (
209
219
  data?.components?.videoCall.leftToolBar &&
210
220
  typeof data?.components?.videoCall.leftToolBar === 'object' &&
211
- data?.components?.videoCall.leftToolBar.length
221
+ Object.keys(data?.components?.videoCall.leftToolBar)?.length
212
222
  ) {
213
223
  components.LeftbarProps = data?.components?.videoCall.leftToolBar;
214
224
  }
@@ -302,7 +312,7 @@ const VideoCallScreen = () => {
302
312
  <ToolbarProvider value={{position: ToolbarPosition.left}}>
303
313
  {LeftbarProps?.length ? (
304
314
  <LeftbarComponent
305
- customItems={LeftbarProps}
315
+ items={LeftbarProps}
306
316
  includeDefaultItems={false}
307
317
  />
308
318
  ) : (
@@ -319,7 +329,7 @@ const VideoCallScreen = () => {
319
329
  <ToolbarProvider value={{position: ToolbarPosition.top}}>
320
330
  {TopbarProps?.length ? (
321
331
  <TopbarComponent
322
- customItems={TopbarProps}
332
+ items={TopbarProps}
323
333
  includeDefaultItems={false}
324
334
  />
325
335
  ) : (
@@ -379,7 +389,7 @@ const VideoCallScreen = () => {
379
389
  <ToolbarProvider value={{position: ToolbarPosition.bottom}}>
380
390
  {BottombarProps?.length ? (
381
391
  <BottombarComponent
382
- customItems={BottombarProps}
392
+ items={BottombarProps}
383
393
  includeDefaultItems={false}
384
394
  />
385
395
  ) : (
@@ -402,7 +412,7 @@ const VideoCallScreen = () => {
402
412
  <ToolbarProvider value={{position: ToolbarPosition.right}}>
403
413
  {RightbarProps?.length ? (
404
414
  <RightbarComponent
405
- customItems={RightbarProps}
415
+ items={RightbarProps}
406
416
  includeDefaultItems={false}
407
417
  />
408
418
  ) : (
@@ -18,6 +18,7 @@ import Controls, {
18
18
  ScreenShareToolbarItem,
19
19
  RecordingToolbarItem,
20
20
  LocalEndcallToolbarItem,
21
+ MoreButtonToolbarItem,
21
22
  } from '../../components/Controls';
22
23
  import ChatBubble from '../../subComponents/ChatBubble';
23
24
  import {ChatInput} from '../../subComponents/ChatInput';
@@ -45,6 +46,7 @@ const ToolbarComponents = {
45
46
  RecordingToolbarItem,
46
47
  LocalEndcallToolbarItem,
47
48
  WhiteboardToolbarItem: WhiteboardButton,
49
+ MoreButtonToolbarItem,
48
50
  };
49
51
  export {
50
52
  ParticipantsView,
@@ -264,6 +264,37 @@ const CustomToolbarSort = (a, b) =>
264
264
  (a.hasOwnProperty('order') ? a.order : 999999) -
265
265
  (b.hasOwnProperty('order') ? b.order : 999999);
266
266
 
267
+ const CustomToolbarSorting = sourceObject => {
268
+ try {
269
+ return Object.keys(sourceObject).sort((a, b) => {
270
+ return (
271
+ (sourceObject[a].hasOwnProperty('order')
272
+ ? sourceObject[a].order
273
+ : 999999) -
274
+ (sourceObject[b].hasOwnProperty('order')
275
+ ? sourceObject[b].order
276
+ : 999999)
277
+ );
278
+ });
279
+ } catch (error) {
280
+ console.error('CustomSortingToolbarObject Failed', error);
281
+ return [];
282
+ }
283
+ };
284
+
285
+ function CustomToolbarMerge(obj1, obj2) {
286
+ let merged = {...obj1};
287
+ for (let key in obj2) {
288
+ if (obj2.hasOwnProperty(key)) {
289
+ merged[key] =
290
+ obj1[key] && obj1[key].toString() === '[object Object]'
291
+ ? CustomToolbarMerge(obj1[key], obj2[key])
292
+ : obj2[key];
293
+ }
294
+ }
295
+ return merged;
296
+ }
297
+
267
298
  const randomString = (
268
299
  length = 5,
269
300
  chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
@@ -327,6 +358,20 @@ const updateToolbarDefaultConfig = (data, defaultItemsConfig) => {
327
358
  });
328
359
  };
329
360
 
361
+ const MergeMoreButtonFields = (data, customizedData) => {
362
+ const keys = Object.keys(customizedData);
363
+ return data?.map(i => {
364
+ if (i?.componentName && keys?.indexOf(i?.componentName) !== -1) {
365
+ return {
366
+ ...i,
367
+ ...customizedData[i?.componentName],
368
+ };
369
+ } else {
370
+ return i;
371
+ }
372
+ });
373
+ };
374
+
330
375
  export {
331
376
  getSessionId,
332
377
  updateToolbarDefaultConfig,
@@ -357,4 +402,7 @@ export {
357
402
  randomIntFromInterval,
358
403
  getOS,
359
404
  hexToRgb,
405
+ CustomToolbarSorting,
406
+ CustomToolbarMerge,
407
+ MergeMoreButtonFields,
360
408
  };