agora-appbuilder-core 4.0.25-beta-1 → 4.0.25-beta-5

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 (32) hide show
  1. package/package.json +1 -1
  2. package/template/customization-api/typeDefinition.ts +1 -4
  3. package/template/customization-api/utils.ts +1 -0
  4. package/template/defaultConfig.js +2 -0
  5. package/template/global.d.ts +2 -0
  6. package/template/src/AppRoutes.tsx +1 -7
  7. package/template/src/auth/AuthProvider.tsx +70 -24
  8. package/template/src/auth/useIDPAuth.electron.tsx +59 -2
  9. package/template/src/auth/useIDPAuth.native.tsx +59 -2
  10. package/template/src/auth/useIDPAuth.tsx +60 -2
  11. package/template/src/auth/useTokenAuth.tsx +66 -4
  12. package/template/src/components/DeviceConfigure.tsx +74 -68
  13. package/template/src/components/GraphQLProvider.tsx +0 -1
  14. package/template/src/components/contexts/WaitingRoomContext.tsx +11 -4
  15. package/template/src/components/recording-bot/RecordingBotRoute.tsx +1 -1
  16. package/template/src/components/useUserPreference.tsx +56 -9
  17. package/template/src/components/whiteboard/WhiteboardConfigure.tsx +4 -1
  18. package/template/src/components/whiteboard/WhiteboardToolBox.tsx +185 -24
  19. package/template/src/components/whiteboard/WhiteboardWidget.tsx +47 -6
  20. package/template/src/logger/AppBuilderLogger.tsx +78 -36
  21. package/template/src/logger/transports/customer-transport.ts +6 -2
  22. package/template/src/pages/VideoCall.tsx +3 -5
  23. package/template/src/subComponents/SelectDevice.tsx +14 -52
  24. package/template/src/subComponents/caption/useSTTAPI.tsx +39 -3
  25. package/template/src/subComponents/recording/useRecording.tsx +63 -14
  26. package/template/src/subComponents/waiting-rooms/useWaitingRoomAPI.ts +30 -8
  27. package/template/src/utils/common.tsx +6 -1
  28. package/template/src/utils/useCreateRoom.ts +21 -2
  29. package/template/src/utils/useFindActiveSpeaker.ts +12 -5
  30. package/template/src/utils/useGetMeetingPhrase.ts +44 -1
  31. package/template/src/utils/useJoinRoom.ts +29 -2
  32. package/template/src/utils/useMutePSTN.ts +29 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.0.25-beta-1",
3
+ "version": "4.0.25-beta-5",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -21,6 +21,7 @@ import {I18nInterface} from '../src/language/i18nTypes';
21
21
  import {IconsInterface} from '../src/atoms/CustomIcon';
22
22
  import {ToolbarCustomItem} from './sub-components';
23
23
  import {TextDataInterface} from '../src/language/default-labels';
24
+ import {VBPanelProps} from '../src/components/virtual-background/VBPanel';
24
25
 
25
26
  export const CUSTOM_ROUTES_PREFIX = '/r/';
26
27
 
@@ -59,10 +60,6 @@ export interface LayoutItem {
59
60
  component: LayoutComponent;
60
61
  }
61
62
 
62
- export interface VBPanelProps {
63
- isOnPrecall?: boolean;
64
- }
65
-
66
63
  export type ToolbarType = React.ComponentType | Array<ToolbarCustomItem>;
67
64
  export type CustomLogger = (
68
65
  message: string,
@@ -35,3 +35,4 @@ export {default as useLocalAudio} from '../src/utils/useLocalAudio';
35
35
  export {default as useLocalVideo} from '../src/utils/useLocalVideo';
36
36
  export type {LanguageType} from '../src/subComponents/caption/utils';
37
37
  export {default as useSpeechToText} from '../src/utils/useSpeechToText';
38
+ export {getSessionId} from '../src/utils/common';
@@ -75,6 +75,8 @@ const DefaultConfig = {
75
75
  CHAT_ORG_NAME: '',
76
76
  CHAT_APP_NAME: '',
77
77
  CHAT_URL: '',
78
+ CLI_VERSION: '',
79
+ CORE_VERSION: '',
78
80
  };
79
81
 
80
82
  module.exports = DefaultConfig;
@@ -118,6 +118,8 @@ interface ConfigInterface {
118
118
  CHAT_APP_NAME: string;
119
119
  CHAT_URL: string;
120
120
  ENABLE_NOISE_CANCELLATION_BY_DEFAULT: boolean;
121
+ CLI_VERSION: string;
122
+ CORE_VERSION: string;
121
123
  }
122
124
  declare var $config: ConfigInterface;
123
125
  declare module 'customization' {
@@ -9,7 +9,7 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import React from 'react';
12
+ import React, {useEffect} from 'react';
13
13
  import Join from './pages/Join';
14
14
  import VideoCall from './pages/VideoCall';
15
15
  import Create from './pages/Create';
@@ -27,12 +27,6 @@ import {isValidReactComponent} from './utils/common';
27
27
 
28
28
  function VideoCallWrapper(props) {
29
29
  const {isRecordingBotRoute} = useIsRecordingBot();
30
- logger.debug(
31
- LogSource.Internals,
32
- 'RECORDING',
33
- 'Check if this is a recording bot route',
34
- isRecordingBotRoute,
35
- );
36
30
  return isRecordingBotRoute ? (
37
31
  <RecordingBotRoute history={props.history}>
38
32
  <VideoCall />
@@ -289,17 +289,55 @@ const AuthProvider = (props: AuthProviderProps) => {
289
289
  }, [authenticated, authError]);
290
290
 
291
291
  async function getUserDetails() {
292
+ const requestId = getUniqueID();
293
+ const startReqTs = Date.now();
292
294
  try {
293
- await apolloClient.query({
295
+ //fetch user details
296
+ logger.log(
297
+ LogSource.NetworkRest,
298
+ 'user_details',
299
+ 'API fetching user_details, to check if user is authenticated',
300
+ {
301
+ requestId,
302
+ startReqTs,
303
+ },
304
+ );
305
+ const res = await apolloClient.query({
294
306
  query: GET_USER,
295
307
  fetchPolicy: 'network-only',
296
308
  context: {
297
309
  headers: {
298
- 'X-Request-Id': getUniqueID(),
310
+ 'X-Request-Id': requestId,
299
311
  },
300
312
  },
301
313
  });
314
+ const endRequestTs = Date.now();
315
+ logger.log(
316
+ LogSource.NetworkRest,
317
+ 'user_details',
318
+ 'API user_details query succesful. User is authenticated',
319
+ {
320
+ responseData: res,
321
+ startReqTs,
322
+ endRequestTs,
323
+ latency: endRequestTs - startReqTs,
324
+ requestId,
325
+ },
326
+ );
302
327
  } catch (error) {
328
+ const endRequestTs = Date.now();
329
+ logger.log(
330
+ LogSource.NetworkRest,
331
+ 'user_details',
332
+ 'API user details query failed. User is un-authenticated. Will Login in the user',
333
+ {
334
+ error,
335
+ startReqTs,
336
+ endRequestTs,
337
+ latency: endRequestTs - startReqTs,
338
+ requestId,
339
+ },
340
+ );
303
341
  throw new Error(error);
304
342
  } finally {
305
343
  setLoading(false);
@@ -328,23 +366,12 @@ const AuthProvider = (props: AuthProviderProps) => {
328
366
  //login link expiry fix
329
367
  location?.search?.indexOf('msg') === -1
330
368
  ) {
331
- //fetch user details
332
- logger.log(
333
- LogSource.NetworkRest,
334
- 'user_details',
335
- 'API fetching user_details, to check if user is authenticated',
336
- );
337
369
  getUserDetails()
338
370
  .then(_ => {
339
371
  //Each time user refresh the page we have to redirect the user to IDP login.then only we can able to refresh the token
340
372
  //because we can't read the cookie so we don't know expirytime.
341
373
  //so each time page refresh will get new token
342
374
  //then only
343
- logger.log(
344
- LogSource.NetworkRest,
345
- 'user_details',
346
- 'API user_details query succesful. User is authenticated',
347
- );
348
375
  if (isWeb() && $config.ENABLE_IDP_AUTH) {
349
376
  //authLogin();this is for cookie based authentication
350
377
  setIsAuthenticated(true);
@@ -352,13 +379,7 @@ const AuthProvider = (props: AuthProviderProps) => {
352
379
  setIsAuthenticated(true);
353
380
  }
354
381
  })
355
- .catch(error => {
356
- logger.log(
357
- LogSource.NetworkRest,
358
- 'user_details',
359
- 'API user details query failed. User is un-authenticated. Will Login in the user',
360
- error,
361
- );
382
+ .catch(() => {
362
383
  setIsAuthenticated(false);
363
384
  authLogin();
364
385
  });
@@ -470,26 +491,39 @@ const AuthProvider = (props: AuthProviderProps) => {
470
491
  'AUTH',
471
492
  'Project has No auth(token or idp) enabled',
472
493
  );
494
+ const requestId = getUniqueID();
495
+ const startReqTs = Date.now();
473
496
  logger.log(
474
497
  LogSource.NetworkRest,
475
498
  'unauth_login',
476
499
  'API unauth_login Trying to authenticate user',
500
+ {requestId: requestId, startReqTs},
477
501
  );
502
+
478
503
  fetch(GET_UNAUTH_FLOW_API_ENDPOINT(), {
479
504
  credentials: 'include',
480
505
  headers: {
481
- 'X-Request-Id': getUniqueID(),
506
+ 'X-Request-Id': requestId,
482
507
  },
483
508
  })
484
509
  .then(response => response.json())
485
510
  .then(response => {
511
+ const endReqTs = Date.now();
512
+ const latency = endReqTs - startReqTs;
486
513
  // unauthenticated flow all platform we will have to handle the token manually
487
514
  // we need to store token manually
488
515
  logger.log(
489
516
  LogSource.NetworkRest,
490
517
  'unauth_login',
491
518
  'API unauth_login authentication successful. User is logged in.',
492
- response.token,
519
+ {
520
+ responseData: response,
521
+ token: response.token,
522
+ startReqTs,
523
+ endReqTs,
524
+ latency,
525
+ requestId,
526
+ },
493
527
  );
494
528
  if (!response.token) {
495
529
  logger.error(
@@ -497,7 +531,11 @@ const AuthProvider = (props: AuthProviderProps) => {
497
531
  'unauth_login',
498
532
  'API unauth_login failed. There was an error',
499
533
  {
500
- data: 'Token not received',
534
+ error: 'Token not received',
535
+ requestId,
536
+ startReqTs,
537
+ endReqTs,
538
+ latency,
501
539
  },
502
540
  );
503
541
  throw new Error('Token not received');
@@ -522,11 +560,19 @@ const AuthProvider = (props: AuthProviderProps) => {
522
560
  }
523
561
  })
524
562
  .catch(error => {
563
+ const endReqTs = Date.now();
564
+ const latency = endReqTs - startReqTs;
525
565
  logger.error(
526
566
  LogSource.NetworkRest,
527
567
  'unauth_login',
528
568
  'API unauth_login failed. There was an error',
529
- error,
569
+ {
570
+ error,
571
+ requestId,
572
+ startReqTs,
573
+ endReqTs,
574
+ latency,
575
+ },
530
576
  );
531
577
  if (error instanceof Error) {
532
578
  setAuthError(error.message);
@@ -10,6 +10,7 @@ import {useHistory} from '../components/Router';
10
10
  import {useString} from '../utils/useString';
11
11
  import {authSessionTimeoutToastHeading} from '../language/default-labels/commonLabels';
12
12
  import getUniqueID from '../utils/getUniqueID';
13
+ import {LogSource, logger} from '../logger/AppBuilderLogger';
13
14
 
14
15
  export const useIDPAuth = () => {
15
16
  const {store, setStore} = useContext(StorageContext);
@@ -18,17 +19,42 @@ export const useIDPAuth = () => {
18
19
  const history = useHistory();
19
20
  const idpLogout = () => {
20
21
  return new Promise((resolve, reject) => {
22
+ const requestId = getUniqueID();
23
+ const startReqTs = Date.now();
21
24
  try {
25
+ logger.log(
26
+ LogSource.NetworkRest,
27
+ 'idp_logout',
28
+ 'API idp_logout Trying to get logout url',
29
+ {
30
+ requestId,
31
+ startReqTs,
32
+ },
33
+ );
22
34
  //v1/idp/logout -> will generate and return URL for IDP logout(frontend need to call this)
23
35
  fetch(`${$config.BACKEND_ENDPOINT}/v1/idp/logout`, {
24
36
  headers: {
25
37
  authorization: store?.token ? `Bearer ${store?.token}` : '',
26
- 'X-Request-Id': getUniqueID(),
38
+ 'X-Request-Id': requestId,
27
39
  },
28
40
  })
29
41
  .then(response => response.json())
30
42
  .then((res: any) => {
31
43
  if (res && res?.url) {
44
+ const endReqTs = Date.now();
45
+ const latency = endReqTs - startReqTs;
46
+ logger.log(
47
+ LogSource.NetworkRest,
48
+ 'idp_logout',
49
+ 'API idp_logout Got logout url',
50
+ {
51
+ requestId,
52
+ responseData: res,
53
+ startReqTs,
54
+ endReqTs,
55
+ latency,
56
+ },
57
+ );
32
58
  //Storing the URL in the local variable
33
59
  const IDPAuthLogoutURL =
34
60
  res?.url +
@@ -48,18 +74,49 @@ export const useIDPAuth = () => {
48
74
  reject(false);
49
75
  });
50
76
  } else {
77
+ const endReqTs = Date.now();
78
+ logError(
79
+ {errorMessage: 'API idp_logout logurl is empty'},
80
+ requestId,
81
+ startReqTs,
82
+ endReqTs,
83
+ );
51
84
  reject(false);
52
85
  }
53
86
  })
54
- .catch(_ => {
87
+ .catch(error => {
88
+ const endReqTs = Date.now();
89
+ logError(error, requestId, startReqTs, endReqTs);
55
90
  reject(false);
56
91
  });
57
92
  } catch (error) {
93
+ const endReqTs = Date.now();
94
+ logError(error, requestId, startReqTs, endReqTs);
58
95
  reject(false);
59
96
  }
60
97
  });
61
98
  };
62
99
 
100
+ const logError = (
101
+ error: any,
102
+ requestId: string,
103
+ startReqTs: number,
104
+ endReqTs: number,
105
+ ) => {
106
+ const latency = endReqTs - startReqTs;
107
+ logger.error(
108
+ LogSource.NetworkRest,
109
+ 'idp_logout',
110
+ 'Error on calling API idp_logout',
111
+ {
112
+ error,
113
+ requestId,
114
+ startReqTs,
115
+ endReqTs,
116
+ latency,
117
+ },
118
+ );
119
+ };
63
120
  return {
64
121
  enableIDPAuth,
65
122
  idpLogout,
@@ -9,23 +9,49 @@ import {
9
9
  import StorageContext from '../components/StorageContext';
10
10
  import useTokenAuth from './useTokenAuth';
11
11
  import getUniqueID from '../utils/getUniqueID';
12
+ import {LogSource, logger} from '../logger/AppBuilderLogger';
12
13
 
13
14
  export const useIDPAuth = () => {
14
15
  const {store, setStore} = useContext(StorageContext);
15
16
  const {tokenLogout} = useTokenAuth();
16
17
  const idpLogout = (setShowNativePopup: (val: boolean) => void) => {
17
18
  return new Promise((resolve, reject) => {
19
+ const requestId = getUniqueID();
20
+ const startReqTs = Date.now();
18
21
  try {
22
+ logger.log(
23
+ LogSource.NetworkRest,
24
+ 'idp_logout',
25
+ 'API idp_logout Trying to get logout url',
26
+ {
27
+ requestId,
28
+ startReqTs,
29
+ },
30
+ );
19
31
  //v1/idp/logout -> will generate and return URL for IDP logout(frontend need to call this)
20
32
  fetch(`${$config.BACKEND_ENDPOINT}/v1/idp/logout`, {
21
33
  headers: {
22
34
  authorization: store?.token ? `Bearer ${store?.token}` : '',
23
- 'X-Request-Id': getUniqueID(),
35
+ 'X-Request-Id': requestId,
24
36
  },
25
37
  })
26
38
  .then(response => response.json())
27
39
  .then((res: any) => {
28
40
  if (res && res?.url) {
41
+ const endReqTs = Date.now();
42
+ const latency = endReqTs - startReqTs;
43
+ logger.log(
44
+ LogSource.NetworkRest,
45
+ 'idp_logout',
46
+ 'API idp_logout Got logout url',
47
+ {
48
+ requestId: requestId,
49
+ responseData: res,
50
+ startReqTs,
51
+ endReqTs,
52
+ latency,
53
+ },
54
+ );
29
55
  //Storing the URL in the local variable
30
56
  const IDPAuthLogoutURL =
31
57
  res?.url +
@@ -53,18 +79,49 @@ export const useIDPAuth = () => {
53
79
  reject(false);
54
80
  });
55
81
  } else {
82
+ const endReqTs = Date.now();
83
+ logError(
84
+ {errorMessage: 'API idp_logout logurl is empty'},
85
+ requestId,
86
+ startReqTs,
87
+ endReqTs,
88
+ );
56
89
  reject(false);
57
90
  }
58
91
  })
59
- .catch(_ => {
92
+ .catch(error => {
93
+ const endReqTs = Date.now();
94
+ logError(error, requestId, startReqTs, endReqTs);
60
95
  reject(false);
61
96
  });
62
97
  } catch (error) {
98
+ const endReqTs = Date.now();
99
+ logError(error, requestId, startReqTs, endReqTs);
63
100
  reject(false);
64
101
  }
65
102
  });
66
103
  };
67
104
 
105
+ const logError = (
106
+ error: any,
107
+ requestId: string,
108
+ startReqTs: number,
109
+ endReqTs: number,
110
+ ) => {
111
+ const latency = endReqTs - startReqTs;
112
+ logger.error(
113
+ LogSource.NetworkRest,
114
+ 'idp_logout',
115
+ 'Error on calling API idp_logout',
116
+ {
117
+ error,
118
+ requestId,
119
+ startReqTs,
120
+ endReqTs,
121
+ latency,
122
+ },
123
+ );
124
+ };
68
125
  return {
69
126
  enableIDPAuth,
70
127
  idpLogout,
@@ -5,6 +5,7 @@ import useTokenAuth from './useTokenAuth';
5
5
  import StorageContext from '../components/StorageContext';
6
6
  import {useContext} from 'react';
7
7
  import getUniqueID from '../utils/getUniqueID';
8
+ import {LogSource, logger} from '../logger/AppBuilderLogger';
8
9
 
9
10
  export const useIDPAuth = () => {
10
11
  const location = useLocation();
@@ -12,18 +13,43 @@ export const useIDPAuth = () => {
12
13
  const {tokenLogout} = useTokenAuth();
13
14
  const idpLogout = (dummy: any) => {
14
15
  return new Promise((resolve, reject) => {
16
+ const requestId = getUniqueID();
17
+ const startReqTs = Date.now();
15
18
  try {
19
+ logger.log(
20
+ LogSource.NetworkRest,
21
+ 'idp_logout',
22
+ 'API idp_logout Trying to get logout url',
23
+ {
24
+ requestId,
25
+ startReqTs,
26
+ },
27
+ );
16
28
  //v1/idp/logout -> will generate and return URL for IDP logout(frontend need to call this)
17
29
  fetch(`${$config.BACKEND_ENDPOINT}/v1/idp/logout`, {
18
30
  credentials: 'include',
19
31
  headers: {
20
32
  authorization: store?.token ? `Bearer ${store?.token}` : '',
21
- 'X-Request-Id': getUniqueID(),
33
+ 'X-Request-Id': requestId,
22
34
  },
23
35
  })
24
36
  .then(response => response.json())
25
37
  .then((res: any) => {
26
38
  if (res && res?.url) {
39
+ const endReqTs = Date.now();
40
+ const latency = endReqTs - startReqTs;
41
+ logger.log(
42
+ LogSource.NetworkRest,
43
+ 'idp_logout',
44
+ 'API idp_logout Got logout url',
45
+ {
46
+ requestId: requestId,
47
+ responseData: res,
48
+ startReqTs,
49
+ endReqTs,
50
+ latency,
51
+ },
52
+ );
27
53
  //Storing the URL in the local variable
28
54
  // const IDPAuthLogoutURL =
29
55
  // res?.url + `&returnTo=${window.location.origin}`;
@@ -46,18 +72,50 @@ export const useIDPAuth = () => {
46
72
  reject(false);
47
73
  });
48
74
  } else {
75
+ const endReqTs = Date.now();
76
+ logError(
77
+ {errorMessage: 'API idp_logout logurl is empty'},
78
+ requestId,
79
+ startReqTs,
80
+ endReqTs,
81
+ );
49
82
  reject(false);
50
83
  }
51
84
  })
52
- .catch(_ => {
85
+ .catch(error => {
86
+ const endReqTs = Date.now();
87
+ logError(error, requestId, startReqTs, endReqTs);
53
88
  reject(false);
54
89
  });
55
90
  } catch (error) {
91
+ const endReqTs = Date.now();
92
+ logError(error, requestId, startReqTs, endReqTs);
56
93
  reject(false);
57
94
  }
58
95
  });
59
96
  };
60
97
 
98
+ const logError = (
99
+ error: any,
100
+ requestId: string,
101
+ startReqTs: number,
102
+ endReqTs: number,
103
+ ) => {
104
+ const latency = endReqTs - startReqTs;
105
+ logger.error(
106
+ LogSource.NetworkRest,
107
+ 'idp_logout',
108
+ 'Error on calling API idp_logout',
109
+ {
110
+ error,
111
+ requestId,
112
+ startReqTs,
113
+ endReqTs,
114
+ latency,
115
+ },
116
+ );
117
+ };
118
+
61
119
  return {
62
120
  enableIDPAuth,
63
121
  idpLogout,
@@ -39,17 +39,42 @@ const useTokenAuth = () => {
39
39
 
40
40
  const getRefreshToken = async () => {
41
41
  if (store?.token) {
42
+ const requestId = getUniqueID();
43
+ const startReqTs = Date.now();
44
+ logger.log(
45
+ LogSource.NetworkRest,
46
+ 'token_refresh',
47
+ 'API token_refresh Trying to refresh the token',
48
+ {
49
+ requestId: requestId,
50
+ startReqTs,
51
+ },
52
+ );
42
53
  await fetch(`${$config.BACKEND_ENDPOINT}/v1/token/refresh`, {
43
54
  method: 'POST',
44
55
  headers: {
45
56
  'Content-Type': 'application/json',
46
57
  authorization: store?.token ? `Bearer ${store.token}` : '',
47
58
  'X-Platform-ID': getPlatformId(),
48
- 'X-Request-Id': getUniqueID(),
59
+ 'X-Request-Id': requestId,
49
60
  },
50
61
  })
51
62
  .then(response => response.json())
52
63
  .then(data => {
64
+ const endReqTs = Date.now();
65
+ const latency = endReqTs - startReqTs;
66
+ logger.log(
67
+ LogSource.NetworkRest,
68
+ 'token_refresh',
69
+ 'API token_refresh successfully done',
70
+ {
71
+ requestId,
72
+ responseData: data,
73
+ startReqTs,
74
+ endReqTs,
75
+ latency,
76
+ },
77
+ );
53
78
  if (data?.token) {
54
79
  updateToken(data.token);
55
80
  if (isSDK()) {
@@ -167,6 +192,17 @@ const useTokenAuth = () => {
167
192
  const tokenLogout = async (cookieLogout: boolean = false) => {
168
193
  return new Promise((resolve, reject) => {
169
194
  try {
195
+ const startReqTs = Date.now();
196
+ const requestId = getUniqueID();
197
+ logger.log(
198
+ LogSource.NetworkRest,
199
+ 'idp_logout',
200
+ 'Trying to call v1 logout',
201
+ {
202
+ startReqTs,
203
+ ...(cookieLogout ? {} : {requestId}),
204
+ },
205
+ );
170
206
  fetch(
171
207
  `${$config.BACKEND_ENDPOINT}/v1/logout`,
172
208
  cookieLogout
@@ -176,16 +212,42 @@ const useTokenAuth = () => {
176
212
  authorization: tokenRef.current
177
213
  ? `Bearer ${tokenRef.current}`
178
214
  : '',
179
- 'X-Request-Id': getUniqueID(),
215
+ 'X-Request-Id': requestId,
180
216
  },
181
217
  },
182
218
  )
183
219
  .then(response => response.text())
184
- .then(_ => {
220
+ .then(res => {
221
+ const endReqTs = Date.now();
222
+ logger.log(
223
+ LogSource.NetworkRest,
224
+ 'idp_logout',
225
+ 'API V1 logout called successfully',
226
+ {
227
+ responseData: res,
228
+ startReqTs,
229
+ endReqTs,
230
+ latency: endReqTs - startReqTs,
231
+ ...(cookieLogout ? {} : {requestId}),
232
+ },
233
+ );
185
234
  resolve(true);
186
235
  updateToken(null);
187
236
  })
188
- .catch(_ => {
237
+ .catch(err => {
238
+ const endReqTs = Date.now();
239
+ logger.error(
240
+ LogSource.NetworkRest,
241
+ 'idp_logout',
242
+ 'Error API V1 logout called successfully',
243
+ {
244
+ error: err,
245
+ startReqTs,
246
+ endReqTs,
247
+ latency: endReqTs - startReqTs,
248
+ ...(cookieLogout ? {} : {requestId}),
249
+ },
250
+ );
189
251
  reject(false);
190
252
  });
191
253
  } catch (error) {