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

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-5",
3
+ "version": "4.0.22-beta-7",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -38,6 +38,7 @@ import {
38
38
  loadingText,
39
39
  } from '../language/default-labels/commonLabels';
40
40
  import {LogSource, logger} from '../logger/AppBuilderLogger';
41
+ import getUniqueID from '../utils/getUniqueID';
41
42
 
42
43
  export const GET_USER = gql`
43
44
  query getUser {
@@ -292,6 +293,11 @@ const AuthProvider = (props: AuthProviderProps) => {
292
293
  await apolloClient.query({
293
294
  query: GET_USER,
294
295
  fetchPolicy: 'network-only',
296
+ context: {
297
+ headers: {
298
+ 'X-Request-Id': getUniqueID(),
299
+ },
300
+ },
295
301
  });
296
302
  } catch (error) {
297
303
  throw new Error(error);
@@ -471,6 +477,9 @@ const AuthProvider = (props: AuthProviderProps) => {
471
477
  );
472
478
  fetch(GET_UNAUTH_FLOW_API_ENDPOINT(), {
473
479
  credentials: 'include',
480
+ headers: {
481
+ 'X-Request-Id': getUniqueID(),
482
+ },
474
483
  })
475
484
  .then(response => response.json())
476
485
  .then(response => {
@@ -9,6 +9,7 @@ import useTokenAuth from './useTokenAuth';
9
9
  import {useHistory} from '../components/Router';
10
10
  import {useString} from '../utils/useString';
11
11
  import {authSessionTimeoutToastHeading} from '../language/default-labels/commonLabels';
12
+ import getUniqueID from '../utils/getUniqueID';
12
13
 
13
14
  export const useIDPAuth = () => {
14
15
  const {store, setStore} = useContext(StorageContext);
@@ -22,6 +23,7 @@ export const useIDPAuth = () => {
22
23
  fetch(`${$config.BACKEND_ENDPOINT}/v1/idp/logout`, {
23
24
  headers: {
24
25
  authorization: store?.token ? `Bearer ${store?.token}` : '',
26
+ 'X-Request-Id': getUniqueID(),
25
27
  },
26
28
  })
27
29
  .then(response => response.json())
@@ -8,6 +8,7 @@ import {
8
8
  } from './openIDPURL.native';
9
9
  import StorageContext from '../components/StorageContext';
10
10
  import useTokenAuth from './useTokenAuth';
11
+ import getUniqueID from '../utils/getUniqueID';
11
12
 
12
13
  export const useIDPAuth = () => {
13
14
  const {store, setStore} = useContext(StorageContext);
@@ -19,9 +20,10 @@ export const useIDPAuth = () => {
19
20
  fetch(`${$config.BACKEND_ENDPOINT}/v1/idp/logout`, {
20
21
  headers: {
21
22
  authorization: store?.token ? `Bearer ${store?.token}` : '',
23
+ 'X-Request-Id': getUniqueID(),
22
24
  },
23
25
  })
24
- .then((response) => response.json())
26
+ .then(response => response.json())
25
27
  .then((res: any) => {
26
28
  if (res && res?.url) {
27
29
  //Storing the URL in the local variable
@@ -37,7 +39,7 @@ export const useIDPAuth = () => {
37
39
  InAppBrowser.openAuth(
38
40
  IDPAuthLogoutURL,
39
41
  encodeURIComponent(getIDPAuthLoginURL()),
40
- ).then((res) => {
42
+ ).then(res => {
41
43
  if (res && res?.type === 'cancel') {
42
44
  setShowNativePopup && setShowNativePopup(true);
43
45
  }
@@ -54,7 +56,7 @@ export const useIDPAuth = () => {
54
56
  reject(false);
55
57
  }
56
58
  })
57
- .catch((_) => {
59
+ .catch(_ => {
58
60
  reject(false);
59
61
  });
60
62
  } catch (error) {
@@ -4,6 +4,7 @@ import {enableIDPAuth, getIDPAuthLoginURL} from './openIDPURL';
4
4
  import useTokenAuth from './useTokenAuth';
5
5
  import StorageContext from '../components/StorageContext';
6
6
  import {useContext} from 'react';
7
+ import getUniqueID from '../utils/getUniqueID';
7
8
 
8
9
  export const useIDPAuth = () => {
9
10
  const location = useLocation();
@@ -17,9 +18,10 @@ export const useIDPAuth = () => {
17
18
  credentials: 'include',
18
19
  headers: {
19
20
  authorization: store?.token ? `Bearer ${store?.token}` : '',
21
+ 'X-Request-Id': getUniqueID(),
20
22
  },
21
23
  })
22
- .then((response) => response.json())
24
+ .then(response => response.json())
23
25
  .then((res: any) => {
24
26
  if (res && res?.url) {
25
27
  //Storing the URL in the local variable
@@ -47,7 +49,7 @@ export const useIDPAuth = () => {
47
49
  reject(false);
48
50
  }
49
51
  })
50
- .catch((_) => {
52
+ .catch(_ => {
51
53
  reject(false);
52
54
  });
53
55
  } catch (error) {
@@ -5,6 +5,7 @@ import SdkEvents from '../utils/SdkEvents';
5
5
  import isSDK from '../utils/isSDK';
6
6
  import {getPlatformId} from './config';
7
7
  import {LogSource, logger} from '../logger/AppBuilderLogger';
8
+ import getUniqueID from '../utils/getUniqueID';
8
9
  const REFRESH_TOKEN_DURATION_IN_SEC = 59;
9
10
 
10
11
  const useTokenAuth = () => {
@@ -44,6 +45,7 @@ const useTokenAuth = () => {
44
45
  'Content-Type': 'application/json',
45
46
  authorization: store?.token ? `Bearer ${store.token}` : '',
46
47
  'X-Platform-ID': getPlatformId(),
48
+ 'X-Request-Id': getUniqueID(),
47
49
  },
48
50
  })
49
51
  .then(response => response.json())
@@ -174,6 +176,7 @@ const useTokenAuth = () => {
174
176
  authorization: tokenRef.current
175
177
  ? `Bearer ${tokenRef.current}`
176
178
  : '',
179
+ 'X-Request-Id': getUniqueID(),
177
180
  },
178
181
  },
179
182
  )
@@ -19,6 +19,7 @@ import {
19
19
  // from,
20
20
  } from '@apollo/client';
21
21
  import React, {createContext, useContext, useEffect, useState} from 'react';
22
+ import getUniqueID from '../../src/utils/getUniqueID';
22
23
  import StorageContext from './StorageContext';
23
24
 
24
25
  export const GraphQLContext = createContext<{
@@ -53,6 +54,7 @@ const authLink = (token: string) => {
53
54
  ...headers,
54
55
  'X-Project-ID': $config.PROJECT_ID,
55
56
  'X-Platform-ID': 'turnkey_web',
57
+ 'X-REQUEST-ID': getUniqueID(),
56
58
  ...(token && {
57
59
  authorization: token ? `Bearer ${token}` : '',
58
60
  }),
@@ -42,6 +42,7 @@ import {
42
42
  whiteboardToolboxWidthLabel,
43
43
  } from '../../language/default-labels/videoCallScreenLabels';
44
44
  import {LogSource, logger} from '../../logger/AppBuilderLogger';
45
+ import getUniqueID from '../../utils/getUniqueID';
45
46
 
46
47
  const supportedDocTypes = [
47
48
  'application/msword',
@@ -325,6 +326,8 @@ const WhiteboardToolBox = ({whiteboardRoom}) => {
325
326
  const myHeaders2 = new Headers();
326
327
  myHeaders2.append('Content-Type', 'application/json');
327
328
  myHeaders2.append('Authorization', `Bearer ${store?.token}`);
329
+ myHeaders2.append('X-Request-Id', getUniqueID());
330
+
328
331
  const body = JSON.stringify({
329
332
  resource_url: url,
330
333
  passphrase: roomId?.host,
@@ -398,6 +401,7 @@ const WhiteboardToolBox = ({whiteboardRoom}) => {
398
401
  const myHeaders2 = new Headers();
399
402
  myHeaders2.append('Content-Type', 'application/json');
400
403
  myHeaders2.append('Authorization', `Bearer ${store?.token}`);
404
+ myHeaders2.append('X-Request-Id', getUniqueID());
401
405
  const body = JSON.stringify({
402
406
  resource_url: url,
403
407
  });
@@ -468,6 +472,7 @@ const WhiteboardToolBox = ({whiteboardRoom}) => {
468
472
  method: 'GET',
469
473
  headers: {
470
474
  authorization: store?.token ? `Bearer ${store?.token}` : '',
475
+ 'X-Request-Id': getUniqueID(),
471
476
  },
472
477
  })
473
478
  .then(async res => {
@@ -48,6 +48,7 @@ import {
48
48
  whiteboardWidgetZoomInText,
49
49
  whiteboardWidgetZoomOutText,
50
50
  } from '../../language/default-labels/videoCallScreenLabels';
51
+ import getUniqueID from '../../utils/getUniqueID';
51
52
 
52
53
  const Seperator = () => {
53
54
  return (
@@ -126,6 +127,7 @@ const WhiteboardWidget = ({whiteboardRoom}) => {
126
127
  const myHeaders2 = new Headers();
127
128
  myHeaders2.append('Content-Type', 'application/json');
128
129
  myHeaders2.append('Authorization', `Bearer ${store?.token}`);
130
+ myHeaders2.append('X-Request-Id', getUniqueID());
129
131
  const body = JSON.stringify({
130
132
  room_uuid: room_uuid,
131
133
  path: '/init',
@@ -9,6 +9,7 @@ import useGetName from '../../utils/useGetName';
9
9
  import {capitalizeFirstLetter} from '../../utils/common';
10
10
  import {PropsContext, useLocalUid} from '../../../agora-rn-uikit';
11
11
  import {logger, LogSource} from '../../logger/AppBuilderLogger';
12
+ import getUniqueID from '../../utils/getUniqueID';
12
13
 
13
14
  interface IuseSTTAPI {
14
15
  start: (lang: LanguageType[]) => Promise<{message: string} | null>;
@@ -55,6 +56,7 @@ const useSTTAPI = (): IuseSTTAPI => {
55
56
  headers: {
56
57
  'Content-Type': 'application/json',
57
58
  authorization: store.token ? `Bearer ${store.token}` : '',
59
+ 'X-Request-Id': getUniqueID(),
58
60
  },
59
61
  body: JSON.stringify({
60
62
  passphrase: roomId?.host || '',
@@ -50,6 +50,7 @@ import {useScreenContext} from '../../components/contexts/ScreenShareContext';
50
50
  import {useLiveStreamDataContext} from '../../components/contexts/LiveStreamDataContext';
51
51
  import {fetchRetry} from '../../utils/fetch-retry';
52
52
  import {LogSource, logger} from '../../logger/AppBuilderLogger';
53
+ import getUniqueID from '../../utils/getUniqueID';
53
54
 
54
55
  const log = (...args: any[]) => {
55
56
  console.log('[Recording_v2:] ', ...args);
@@ -262,6 +263,7 @@ const RecordingProvider = (props: RecordingProviderProps) => {
262
263
  headers: {
263
264
  'Content-Type': 'application/json',
264
265
  authorization: store.token ? `Bearer ${store.token}` : '',
266
+ 'X-Request-Id': getUniqueID(),
265
267
  },
266
268
  body: JSON.stringify({
267
269
  passphrase: roomId.host,
@@ -474,6 +476,7 @@ const RecordingProvider = (props: RecordingProviderProps) => {
474
476
  headers: {
475
477
  'Content-Type': 'application/json',
476
478
  authorization: store.token ? `Bearer ${store.token}` : '',
479
+ 'X-Request-Id': getUniqueID(),
477
480
  },
478
481
  body: JSON.stringify({
479
482
  passphrase: roomId?.host,
@@ -8,6 +8,7 @@ import useGetName from '../../utils/useGetName';
8
8
  import {useLocalUid} from '../../../agora-rn-uikit';
9
9
  import {useParams} from '../../components/Router';
10
10
  import {LogSource, logger} from '../../logger/AppBuilderLogger';
11
+ import getUniqueID from '../../utils/getUniqueID';
11
12
 
12
13
  interface IuseWaitingRoomAPI {
13
14
  request: (params: {
@@ -37,6 +38,7 @@ const useWaitingRoomAPI = (): IuseWaitingRoomAPI => {
37
38
  headers: {
38
39
  'Content-Type': 'application/json',
39
40
  authorization: store.token ? `Bearer ${store.token}` : '',
41
+ 'X-Request-Id': getUniqueID(),
40
42
  },
41
43
  body: payload,
42
44
  });