agora-appbuilder-core 4.0.22-beta-7 → 4.0.22-beta-8

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": "4.0.22-beta-7",
3
+ "version": "4.0.22-beta-8",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -331,9 +331,7 @@ const WhiteboardConfigure: React.FC<WhiteboardPropsInterface> = props => {
331
331
  try {
332
332
  const index = randomIntFromInterval(0, 9);
333
333
  setWhiteboardRoomState(RoomPhase.Connecting);
334
- logger.log(LogSource.Internals, 'WHITEBOARD', 'Trying to join room', {
335
- data: {},
336
- });
334
+ logger.log(LogSource.Internals, 'WHITEBOARD', 'Trying to join room');
337
335
  whiteWebSdkClient.current
338
336
  .joinRoom({
339
337
  cursorAdapter: cursorAdapter,
@@ -349,14 +347,7 @@ const WhiteboardConfigure: React.FC<WhiteboardPropsInterface> = props => {
349
347
  },
350
348
  })
351
349
  .then(room => {
352
- logger.log(
353
- LogSource.Internals,
354
- 'WHITEBOARD',
355
- 'Join room successful',
356
- {
357
- data: {},
358
- },
359
- );
350
+ logger.log(LogSource.Internals, 'WHITEBOARD', 'Join room successful');
360
351
  whiteboardRoom.current = room;
361
352
  cursorAdapter.setRoom(room);
362
353
  whiteboardRoom.current?.setViewMode(ViewMode.Freedom);
@@ -136,9 +136,10 @@ export default class AppBuilderLogger implements Logger {
136
136
  ? pkg.dependencies['agora-rtc-sdk-ng']
137
137
  : pkg.dependencies['react-native-agora'];
138
138
  let roomInfo = {
139
- meetingTitle: null,
139
+ meeting_title: null,
140
140
  phrase: null,
141
- roomId: null,
141
+ room_id: null,
142
+ channel_id: null,
142
143
  };
143
144
  const logger =
144
145
  (status: StatusType) =>
@@ -3,29 +3,39 @@ import {isWeb} from '../../utils/common';
3
3
 
4
4
  /* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value#examples */
5
5
  export function getCircularReplacer() {
6
- const ancestors = [];
7
- return function (key, value) {
8
- if (typeof value !== 'object' || value === null) {
9
- return value;
10
- }
11
- // `this` is the object that value is contained in,
12
- // i.e., its direct parent.
13
- while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) {
14
- ancestors.pop();
15
- }
16
- if (ancestors.includes(value)) {
17
- return '[Circular]';
6
+ const seen = new WeakSet();
7
+ return (key, value) => {
8
+ if (typeof value === 'object' && value !== null) {
9
+ if (seen.has(value)) {
10
+ return;
11
+ }
12
+ seen.add(value);
18
13
  }
19
- ancestors.push(value);
20
14
  return value;
21
15
  };
16
+ // const ancestors = [];
17
+ // return function (key, value) {
18
+ // if (typeof value !== 'object' || value === null) {
19
+ // return value;
20
+ // }
21
+ // // `this` is the object that value is contained in,
22
+ // // i.e., its direct parent.
23
+ // while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) {
24
+ // ancestors.pop();
25
+ // }
26
+ // if (ancestors.includes(value)) {
27
+ // return '[Circular]';
28
+ // }
29
+ // ancestors.push(value);
30
+ // return value;
31
+ // };
22
32
  }
23
33
  const getSafeBody = (p: any[]) => {
24
34
  try {
25
35
  return JSON.stringify(p, getCircularReplacer());
26
36
  } catch (error) {
27
- console.error('there was an error converting this object');
28
- return '';
37
+ console.error('there was an error converting this object', p);
38
+ return [' object convertion error'];
29
39
  }
30
40
  };
31
41
 
@@ -43,19 +53,23 @@ const fetchRetry = createRetryFetch(fetch, {
43
53
  });
44
54
 
45
55
  const sendLogs = (p: any[]) => {
46
- fetchRetry(
47
- 'https://axiom-queue.appbuilder.workers.dev?dataset=app-builder-core-frontend-customer',
48
- // "&strategy=queue", // to send logs to a specific dataset [default: queue]
49
- {
50
- method: 'POST',
51
- headers: new Headers({
52
- 'Content-Type': 'application/json',
53
- }),
54
- body: getSafeBody(p),
55
- },
56
- ).catch(err => {
57
- console.log('error ocuured while replacing circular reference', p, err);
58
- });
56
+ if (p && p?.length) {
57
+ fetchRetry(
58
+ 'https://axiom-queue.appbuilder.workers.dev?dataset=app-builder-core-frontend-customer',
59
+ // "&strategy=queue", // to send logs to a specific dataset [default: queue]
60
+ {
61
+ method: 'POST',
62
+ headers: new Headers({
63
+ 'Content-Type': 'application/json',
64
+ }),
65
+ body: getSafeBody(p),
66
+ },
67
+ ).catch(err => {
68
+ console.log('error ocuured while replacing circular reference', p, err);
69
+ });
70
+ } else {
71
+ console.log('queue is empty, no logs available to send');
72
+ }
59
73
  };
60
74
 
61
75
  export const createAxiomLogger = () => {
@@ -220,9 +220,10 @@ const VideoCall: React.FC = () => {
220
220
  return;
221
221
  }
222
222
  logger.log(LogSource.Internals, 'SET_MEETING_DETAILS', 'Room details', {
223
- meetingTitle: data?.meetingTitle || '',
223
+ meeting_title: data?.meetingTitle || '',
224
224
  phrase: phrase,
225
- roomId: data?.roomId,
225
+ room_id: data?.roomId,
226
+ channel_id: data?.channel,
226
227
  });
227
228
  }, [isJoinDataFetched, data, phrase]);
228
229
 
@@ -36,17 +36,21 @@ const fetchRetry = createRetryFetch(fetch, {
36
36
  });
37
37
 
38
38
  const sendLogs = (p: any[]) => {
39
- fetchRetry(
40
- 'https://axiom-queue.appbuilder.workers.dev?dataset=app-builder-core',
41
- // "&strategy=queue", // to send logs to a specific dataset [default: queue]
42
- {
43
- method: 'POST',
44
- headers: new Headers({
45
- 'Content-Type': 'application/json',
46
- }),
47
- body: JSON.stringify(p, getCircularReplacer()),
48
- },
49
- );
39
+ if (p && p?.length) {
40
+ fetchRetry(
41
+ 'https://axiom-queue.appbuilder.workers.dev?dataset=app-builder-core',
42
+ // "&strategy=queue", // to send logs to a specific dataset [default: queue]
43
+ {
44
+ method: 'POST',
45
+ headers: new Headers({
46
+ 'Content-Type': 'application/json',
47
+ }),
48
+ body: JSON.stringify(p, getCircularReplacer()),
49
+ },
50
+ );
51
+ } else {
52
+ console.log('queue is empty, no logs available to send');
53
+ }
50
54
  };
51
55
 
52
56
  export const createAxiomLogger = () => {