agora-appbuilder-core 4.1.7 → 4.1.8-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.
- package/package.json +2 -2
- package/template/_package-lock.json +30671 -5376
- package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +1 -1
- package/template/agora-rn-uikit/src/Rtc/Join.tsx +18 -9
- package/template/bridge/rtc/webNg/RtcEngine.ts +2 -2
- package/template/defaultConfig.js +4 -3
- package/template/esbuild.rsdk.go +1 -2
- package/template/global.d.ts +1 -0
- package/template/package.json +1 -2
- package/template/src/AppWrapper.tsx +30 -35
- package/template/src/atoms/TextInput.tsx +3 -0
- package/template/src/auth/AuthProvider.tsx +28 -35
- package/template/src/auth/IDPAuth.tsx +1 -14
- package/template/src/components/Controls.tsx +47 -15
- package/template/src/components/common/GenericModal.tsx +143 -0
- package/template/src/components/common/GenericPopup.tsx +151 -0
- package/template/src/components/common/data-table.tsx +412 -0
- package/template/src/components/controls/useControlPermissionMatrix.tsx +9 -7
- package/template/src/components/precall/usePreCall.tsx +1 -2
- package/template/src/components/recordings/RecordingItemRow.tsx +289 -0
- package/template/src/components/recordings/RecordingsDateTable.tsx +99 -25
- package/template/src/components/recordings/TextTrackItemRow.tsx +120 -0
- package/template/src/components/room-info/useRoomInfo.tsx +1 -0
- package/template/src/components/text-tracks/TextTracksTable.tsx +306 -0
- package/template/src/components/text-tracks/ViewTextTracksModal.tsx +44 -0
- package/template/src/components/text-tracks/useFetchSTTTranscript.tsx +262 -0
- package/template/src/components/useUserPreference.tsx +0 -11
- package/template/src/language/default-labels/videoCallScreenLabels.ts +7 -0
- package/template/src/logger/AppBuilderLogger.tsx +1 -0
- package/template/src/pages/Create.tsx +2 -2
- package/template/src/pages/VideoCall.tsx +1 -6
- package/template/src/subComponents/ChatInput.tsx +72 -1
- package/template/src/subComponents/LogoutButton.tsx +1 -11
- package/template/src/subComponents/recording/useRecording.tsx +19 -4
- package/template/src/subComponents/recording/useRecordingLayoutQuery.tsx +83 -78
- package/template/src/utils/common.tsx +79 -1
- package/template/src/utils/useCreateRoom.ts +94 -112
- package/template/src/utils/useEndCall.ts +16 -3
- package/template/src/utils/useGetMeetingPhrase.ts +67 -76
- package/template/src/utils/useJoinRoom.ts +5 -4
- package/template/src/utils/useMutePSTN.ts +47 -45
- package/template/webpack.rsdk.config.js +1 -2
- package/template/src/components/GraphQLProvider.tsx +0 -122
|
@@ -1,31 +1,13 @@
|
|
|
1
|
-
import {gql, useMutation} from '@apollo/client';
|
|
2
1
|
import {RoomInfoContextInterface} from '../components/room-info/useRoomInfo';
|
|
3
2
|
import {useSetRoomInfo} from '../components/room-info/useSetRoomInfo';
|
|
4
3
|
import SDKEvents from '../utils/SdkEvents';
|
|
5
|
-
import isSDK from './isSDK';
|
|
6
4
|
import {LogSource, logger} from '../logger/AppBuilderLogger';
|
|
7
5
|
import getUniqueID from './getUniqueID';
|
|
6
|
+
import {useContext} from 'react';
|
|
7
|
+
import StorageContext from '../components/StorageContext';
|
|
8
|
+
|
|
9
|
+
const CREATE_ROOM_URL = `${$config.BACKEND_ENDPOINT}/v1/channel`;
|
|
8
10
|
|
|
9
|
-
const CREATE_CHANNEL = gql`
|
|
10
|
-
mutation CreateChannel($title: String!, $enablePSTN: Boolean) {
|
|
11
|
-
createChannel(title: $title, enablePSTN: $enablePSTN) {
|
|
12
|
-
passphrase {
|
|
13
|
-
host
|
|
14
|
-
view
|
|
15
|
-
}
|
|
16
|
-
channel
|
|
17
|
-
title
|
|
18
|
-
pstn {
|
|
19
|
-
number
|
|
20
|
-
dtmf
|
|
21
|
-
error {
|
|
22
|
-
code
|
|
23
|
-
message
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
29
11
|
/**
|
|
30
12
|
* Returns an asynchronous function to create a meeting with the given options.
|
|
31
13
|
*/
|
|
@@ -34,8 +16,8 @@ export type createRoomFun = (
|
|
|
34
16
|
enablePSTN?: boolean,
|
|
35
17
|
) => Promise<void>;
|
|
36
18
|
export default function useCreateRoom(): createRoomFun {
|
|
37
|
-
const [createChannel, {error}] = useMutation(CREATE_CHANNEL);
|
|
38
19
|
const {setRoomInfo} = useSetRoomInfo();
|
|
20
|
+
const {store} = useContext(StorageContext);
|
|
39
21
|
return async (
|
|
40
22
|
roomTitle: string,
|
|
41
23
|
enablePSTN?: boolean,
|
|
@@ -56,25 +38,99 @@ export default function useCreateRoom(): createRoomFun {
|
|
|
56
38
|
requestId,
|
|
57
39
|
},
|
|
58
40
|
);
|
|
59
|
-
|
|
60
|
-
|
|
41
|
+
try {
|
|
42
|
+
const payload = JSON.stringify({
|
|
43
|
+
title: roomTitle,
|
|
44
|
+
enable_pstn: enablePSTN,
|
|
45
|
+
});
|
|
46
|
+
const response = await fetch(`${CREATE_ROOM_URL}`, {
|
|
47
|
+
method: 'POST',
|
|
61
48
|
headers: {
|
|
49
|
+
'Content-Type': 'application/json',
|
|
50
|
+
authorization: store.token ? `Bearer ${store.token}` : '',
|
|
62
51
|
'X-Request-Id': requestId,
|
|
63
52
|
'X-Session-Id': logger.getSessionId(),
|
|
64
53
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
54
|
+
body: payload,
|
|
55
|
+
});
|
|
56
|
+
const res = await response.json();
|
|
57
|
+
if (res?.error) {
|
|
58
|
+
throw res.error;
|
|
59
|
+
} else if (res?.channel) {
|
|
60
|
+
const endReqTs = Date.now();
|
|
61
|
+
const latency = endReqTs - startReqTs;
|
|
62
|
+
logger.log(
|
|
63
|
+
LogSource.NetworkRest,
|
|
64
|
+
'createChannel',
|
|
65
|
+
'API createChannel. Channel created successfully',
|
|
66
|
+
{
|
|
67
|
+
responseData: res,
|
|
68
|
+
startReqTs,
|
|
69
|
+
endReqTs,
|
|
70
|
+
latency: latency,
|
|
71
|
+
requestId,
|
|
72
|
+
},
|
|
73
|
+
);
|
|
74
|
+
let roomInfo: Partial<RoomInfoContextInterface['data']> = {
|
|
75
|
+
roomId: {
|
|
76
|
+
attendee: '',
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
if (res?.viewer_pass_phrase) {
|
|
80
|
+
roomInfo.roomId.attendee = res.viewer_pass_phrase;
|
|
81
|
+
}
|
|
82
|
+
if (res?.host_pass_phrase) {
|
|
83
|
+
roomInfo.roomId.host = res.host_pass_phrase;
|
|
84
|
+
}
|
|
85
|
+
if (enablePSTN === true && res?.pstn) {
|
|
86
|
+
if (res.pstn?.error?.code || res.pstn?.error?.message) {
|
|
87
|
+
roomInfo.pstn = {
|
|
88
|
+
number: '',
|
|
89
|
+
pin: '',
|
|
90
|
+
error: {
|
|
91
|
+
code: res.pstn?.error?.code,
|
|
92
|
+
message: res.pstn?.error?.message,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
} else {
|
|
96
|
+
roomInfo.pstn = {
|
|
97
|
+
number: res.pstn?.number,
|
|
98
|
+
pin: res.pstn?.dtmf,
|
|
99
|
+
error: null,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
logger.log(LogSource.Internals, 'CREATE_MEETING', 'Room created', {
|
|
104
|
+
isHost: true,
|
|
105
|
+
isSeparateHostLink: isSeparateHostLink ? true : false,
|
|
106
|
+
meetingTitle: roomTitle,
|
|
107
|
+
roomId: roomInfo?.roomId,
|
|
108
|
+
pstn: roomInfo?.pstn,
|
|
109
|
+
});
|
|
110
|
+
setRoomInfo(prev => {
|
|
111
|
+
return {
|
|
112
|
+
...prev,
|
|
113
|
+
data: {
|
|
114
|
+
isHost: true,
|
|
115
|
+
isSeparateHostLink: isSeparateHostLink ? true : false,
|
|
116
|
+
meetingTitle: roomTitle,
|
|
117
|
+
roomId: roomInfo?.roomId,
|
|
118
|
+
pstn: roomInfo?.pstn,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
SDKEvents.emit(
|
|
123
|
+
'create',
|
|
124
|
+
roomInfo.roomId.host,
|
|
125
|
+
roomInfo.roomId.attendee,
|
|
126
|
+
roomInfo?.pstn,
|
|
127
|
+
);
|
|
128
|
+
} else {
|
|
129
|
+
throw new Error(`An error occurred in parsing the channel data.`);
|
|
130
|
+
}
|
|
131
|
+
} catch (error) {
|
|
132
|
+
const endReqTs = Date.now();
|
|
133
|
+
const latency = endReqTs - startReqTs;
|
|
78
134
|
logger.error(
|
|
79
135
|
LogSource.NetworkRest,
|
|
80
136
|
'createChannel',
|
|
@@ -89,79 +145,5 @@ export default function useCreateRoom(): createRoomFun {
|
|
|
89
145
|
);
|
|
90
146
|
throw error;
|
|
91
147
|
}
|
|
92
|
-
|
|
93
|
-
if (res && res?.data && res?.data?.createChannel) {
|
|
94
|
-
logger.log(
|
|
95
|
-
LogSource.NetworkRest,
|
|
96
|
-
'createChannel',
|
|
97
|
-
'API createChannel. Channel created successfully',
|
|
98
|
-
{
|
|
99
|
-
responseData: res.data.createChannel,
|
|
100
|
-
startReqTs,
|
|
101
|
-
endReqTs,
|
|
102
|
-
latency: latency,
|
|
103
|
-
requestId,
|
|
104
|
-
},
|
|
105
|
-
);
|
|
106
|
-
let roomInfo: Partial<RoomInfoContextInterface['data']> = {
|
|
107
|
-
roomId: {
|
|
108
|
-
attendee: '',
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
if (res?.data?.createChannel?.passphrase?.view) {
|
|
112
|
-
roomInfo.roomId.attendee = res.data.createChannel.passphrase.view;
|
|
113
|
-
}
|
|
114
|
-
if (res?.data?.createChannel?.passphrase?.host) {
|
|
115
|
-
roomInfo.roomId.host = res.data.createChannel.passphrase.host;
|
|
116
|
-
}
|
|
117
|
-
if (enablePSTN === true && res?.data?.createChannel?.pstn) {
|
|
118
|
-
if (
|
|
119
|
-
res.data.createChannel.pstn?.error?.code ||
|
|
120
|
-
res.data.createChannel.pstn?.error?.message
|
|
121
|
-
) {
|
|
122
|
-
roomInfo.pstn = {
|
|
123
|
-
number: '',
|
|
124
|
-
pin: '',
|
|
125
|
-
error: {
|
|
126
|
-
code: res.data.createChannel.pstn?.error?.code,
|
|
127
|
-
message: res.data.createChannel.pstn?.error?.message,
|
|
128
|
-
},
|
|
129
|
-
};
|
|
130
|
-
} else {
|
|
131
|
-
roomInfo.pstn = {
|
|
132
|
-
number: res.data.createChannel.pstn?.number,
|
|
133
|
-
pin: res.data.createChannel.pstn?.dtmf,
|
|
134
|
-
error: null,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
logger.log(LogSource.Internals, 'CREATE_MEETING', 'Room created', {
|
|
139
|
-
isHost: true,
|
|
140
|
-
isSeparateHostLink: isSeparateHostLink ? true : false,
|
|
141
|
-
meetingTitle: roomTitle,
|
|
142
|
-
roomId: roomInfo?.roomId,
|
|
143
|
-
pstn: roomInfo?.pstn,
|
|
144
|
-
});
|
|
145
|
-
setRoomInfo(prev => {
|
|
146
|
-
return {
|
|
147
|
-
...prev,
|
|
148
|
-
data: {
|
|
149
|
-
isHost: true,
|
|
150
|
-
isSeparateHostLink: isSeparateHostLink ? true : false,
|
|
151
|
-
meetingTitle: roomTitle,
|
|
152
|
-
roomId: roomInfo?.roomId,
|
|
153
|
-
pstn: roomInfo?.pstn,
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
});
|
|
157
|
-
SDKEvents.emit(
|
|
158
|
-
'create',
|
|
159
|
-
roomInfo.roomId.host,
|
|
160
|
-
roomInfo.roomId.attendee,
|
|
161
|
-
roomInfo?.pstn,
|
|
162
|
-
);
|
|
163
|
-
} else {
|
|
164
|
-
throw new Error(`An error occurred in parsing the channel data.`);
|
|
165
|
-
}
|
|
166
148
|
};
|
|
167
149
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {useContext} from 'react';
|
|
2
2
|
import {useCustomization} from 'customization-implementation';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
useCaption,
|
|
5
|
+
useContent,
|
|
6
|
+
useRoomInfo,
|
|
7
|
+
useSTTAPI,
|
|
8
|
+
} from 'customization-api';
|
|
4
9
|
import {PropsContext, DispatchContext} from '../../agora-rn-uikit';
|
|
5
10
|
import {useHistory} from '../components/Router';
|
|
6
11
|
import {stopForegroundService} from '../subComponents/LocalEndCall';
|
|
@@ -18,6 +23,7 @@ const useEndCall = () => {
|
|
|
18
23
|
} = useRoomInfo();
|
|
19
24
|
const {authLogin} = useAuth();
|
|
20
25
|
const {deleteChatUser} = useChatConfigure();
|
|
26
|
+
const {stop: stopSTTAPI} = useSTTAPI();
|
|
21
27
|
|
|
22
28
|
const {rtcProps} = useContext(PropsContext);
|
|
23
29
|
const {dispatch} = useContext(DispatchContext);
|
|
@@ -49,9 +55,16 @@ const useEndCall = () => {
|
|
|
49
55
|
stopForegroundService();
|
|
50
56
|
// stopping STT on call end,if only last user is remaining in call
|
|
51
57
|
const usersInCall = Object.entries(defaultContent).filter(
|
|
52
|
-
item =>
|
|
58
|
+
item =>
|
|
59
|
+
item[1].type === 'rtc' && item[1].isHost === 'true' && !item[1].offline,
|
|
53
60
|
);
|
|
54
|
-
usersInCall.length === 1 && isSTTActive
|
|
61
|
+
if (usersInCall.length === 1 && isSTTActive) {
|
|
62
|
+
console.log('Stopping stt api as only one host is in the call');
|
|
63
|
+
stopSTTAPI().catch(error => {
|
|
64
|
+
console.log('Error stopping stt', error);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
55
68
|
// removing user from chat server
|
|
56
69
|
if ($config.CHAT) {
|
|
57
70
|
deleteChatUser();
|
|
@@ -1,31 +1,15 @@
|
|
|
1
1
|
import {useContext} from 'react';
|
|
2
|
-
import {gql} from '@apollo/client';
|
|
3
2
|
import {RoomInfoContextInterface} from '../components/room-info/useRoomInfo';
|
|
4
3
|
import {useSetRoomInfo} from '../components/room-info/useSetRoomInfo';
|
|
5
|
-
import {GraphQLContext} from '../components/GraphQLProvider';
|
|
6
4
|
import getUniqueID from './getUniqueID';
|
|
7
5
|
import {LogSource, logger} from '../logger/AppBuilderLogger';
|
|
6
|
+
import StorageContext from '../components/StorageContext';
|
|
8
7
|
|
|
9
|
-
const
|
|
10
|
-
query share($passphrase: String!) {
|
|
11
|
-
share(passphrase: $passphrase) {
|
|
12
|
-
passphrase {
|
|
13
|
-
host
|
|
14
|
-
view
|
|
15
|
-
}
|
|
16
|
-
channel
|
|
17
|
-
title
|
|
18
|
-
pstn {
|
|
19
|
-
number
|
|
20
|
-
dtmf
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
8
|
+
const SHARE_URL = `${$config.BACKEND_ENDPOINT}/v1/channel/share`;
|
|
25
9
|
|
|
26
10
|
export default function useGetMeetingPhrase() {
|
|
27
11
|
const {setRoomInfo} = useSetRoomInfo();
|
|
28
|
-
const {
|
|
12
|
+
const {store} = useContext(StorageContext);
|
|
29
13
|
return async (phrase: string) => {
|
|
30
14
|
const requestId = getUniqueID();
|
|
31
15
|
const startReqTs = Date.now();
|
|
@@ -38,25 +22,77 @@ export default function useGetMeetingPhrase() {
|
|
|
38
22
|
startReqTs,
|
|
39
23
|
},
|
|
40
24
|
);
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
try {
|
|
26
|
+
const payload = JSON.stringify({
|
|
27
|
+
passphrase: phrase,
|
|
28
|
+
});
|
|
29
|
+
const res = await fetch(`${SHARE_URL}`, {
|
|
30
|
+
method: 'POST',
|
|
43
31
|
headers: {
|
|
32
|
+
'Content-Type': 'application/json',
|
|
33
|
+
authorization: store.token ? `Bearer ${store.token}` : '',
|
|
44
34
|
'X-Request-Id': requestId,
|
|
45
35
|
'X-Session-Id': logger.getSessionId(),
|
|
46
36
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
37
|
+
body: payload,
|
|
38
|
+
});
|
|
39
|
+
const response = await res.json();
|
|
40
|
+
if (response?.error) {
|
|
41
|
+
throw response.error;
|
|
42
|
+
} else {
|
|
43
|
+
const endReqTs = Date.now();
|
|
44
|
+
logger.log(
|
|
45
|
+
LogSource.Internals,
|
|
46
|
+
'GET_MEETING_PHRASE',
|
|
47
|
+
'Query GET_MEETING_PHRASE success',
|
|
48
|
+
{
|
|
49
|
+
responseData: response,
|
|
50
|
+
requestId,
|
|
51
|
+
startReqTs,
|
|
52
|
+
endReqTs,
|
|
53
|
+
latency: endReqTs - startReqTs,
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
try {
|
|
57
|
+
if (response) {
|
|
58
|
+
let data = response;
|
|
59
|
+
let roomInfo: Partial<RoomInfoContextInterface['data']> = {
|
|
60
|
+
roomId: {attendee: ''},
|
|
61
|
+
};
|
|
62
|
+
if (data?.passphrases?.attendee) {
|
|
63
|
+
roomInfo.roomId.attendee = data.passphrases.attendee;
|
|
64
|
+
}
|
|
65
|
+
if (data?.passphrases?.host) {
|
|
66
|
+
roomInfo.roomId.host = data.passphrases.host;
|
|
67
|
+
}
|
|
68
|
+
if (data?.pstn) {
|
|
69
|
+
roomInfo.pstn = {
|
|
70
|
+
number: data.pstn.number,
|
|
71
|
+
pin: data.pstn.dtmf,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
setRoomInfo(prevState => {
|
|
75
|
+
return {
|
|
76
|
+
...prevState,
|
|
77
|
+
data: {
|
|
78
|
+
...prevState.data,
|
|
79
|
+
roomId: roomInfo.roomId,
|
|
80
|
+
pstn: roomInfo?.pstn,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
} catch (error) {
|
|
86
|
+
throw new Error('An error occurred in parsing the channel data.');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
} catch (error) {
|
|
90
|
+
const endReqTs = Date.now();
|
|
55
91
|
logger.error(
|
|
56
92
|
LogSource.Internals,
|
|
57
93
|
'GET_MEETING_PHRASE',
|
|
58
94
|
'Query GET_MEETING_PHRASE failed',
|
|
59
|
-
JSON.stringify(
|
|
95
|
+
JSON.stringify(error || {}),
|
|
60
96
|
{
|
|
61
97
|
requestId,
|
|
62
98
|
startReqTs,
|
|
@@ -64,52 +100,7 @@ export default function useGetMeetingPhrase() {
|
|
|
64
100
|
latency: endReqTs - startReqTs,
|
|
65
101
|
},
|
|
66
102
|
);
|
|
67
|
-
throw
|
|
68
|
-
} else {
|
|
69
|
-
logger.log(
|
|
70
|
-
LogSource.Internals,
|
|
71
|
-
'GET_MEETING_PHRASE',
|
|
72
|
-
'Query GET_MEETING_PHRASE success',
|
|
73
|
-
{
|
|
74
|
-
responseData: response,
|
|
75
|
-
requestId,
|
|
76
|
-
startReqTs,
|
|
77
|
-
endReqTs,
|
|
78
|
-
latency: endReqTs - startReqTs,
|
|
79
|
-
},
|
|
80
|
-
);
|
|
81
|
-
try {
|
|
82
|
-
if (response && response.data) {
|
|
83
|
-
let data = response.data;
|
|
84
|
-
let roomInfo: Partial<RoomInfoContextInterface['data']> = {
|
|
85
|
-
roomId: {attendee: ''},
|
|
86
|
-
};
|
|
87
|
-
if (data?.share?.passphrase?.view) {
|
|
88
|
-
roomInfo.roomId.attendee = data.share.passphrase.view;
|
|
89
|
-
}
|
|
90
|
-
if (data?.share?.passphrase?.host) {
|
|
91
|
-
roomInfo.roomId.host = data.share.passphrase.host;
|
|
92
|
-
}
|
|
93
|
-
if (data?.share?.pstn) {
|
|
94
|
-
roomInfo.pstn = {
|
|
95
|
-
number: data.share.pstn.number,
|
|
96
|
-
pin: data.share.pstn.dtmf,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
setRoomInfo(prevState => {
|
|
100
|
-
return {
|
|
101
|
-
...prevState,
|
|
102
|
-
data: {
|
|
103
|
-
...prevState.data,
|
|
104
|
-
roomId: roomInfo.roomId,
|
|
105
|
-
pstn: roomInfo?.pstn,
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
} catch (error) {
|
|
111
|
-
throw new Error('An error occurred in parsing the channel data.');
|
|
112
|
-
}
|
|
103
|
+
throw error;
|
|
113
104
|
}
|
|
114
105
|
};
|
|
115
106
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import {useContext} from 'react';
|
|
2
|
-
import {gql} from '@apollo/client';
|
|
3
2
|
import StorageContext from '../components/StorageContext';
|
|
4
3
|
import {RoomInfoContextInterface} from '../components/room-info/useRoomInfo';
|
|
5
4
|
import {useSetRoomInfo} from '../components/room-info/useSetRoomInfo';
|
|
6
|
-
import {GraphQLContext} from '../components/GraphQLProvider';
|
|
7
|
-
import useGetName from './useGetName';
|
|
8
5
|
import useWaitingRoomAPI from '../subComponents/waiting-rooms/useWaitingRoomAPI';
|
|
9
6
|
import {base64ToUint8Array} from '../utils';
|
|
10
7
|
import {LogSource, logger} from '../logger/AppBuilderLogger';
|
|
@@ -61,7 +58,6 @@ export default function useJoinRoom() {
|
|
|
61
58
|
send_event: false,
|
|
62
59
|
});
|
|
63
60
|
} else {
|
|
64
|
-
console.log('debugging store.token', store.token);
|
|
65
61
|
logger.log(
|
|
66
62
|
LogSource.NetworkRest,
|
|
67
63
|
'joinChannel',
|
|
@@ -160,6 +156,11 @@ export default function useJoinRoom() {
|
|
|
160
156
|
isWaitingRoomEnabled ? data.secretSalt : data.secret_salt,
|
|
161
157
|
) as Uint8Array;
|
|
162
158
|
}
|
|
159
|
+
|
|
160
|
+
if (data?.encryption_mode) {
|
|
161
|
+
roomInfo.encryptionMode = data.encryption_mode;
|
|
162
|
+
}
|
|
163
|
+
|
|
163
164
|
if (data?.screen_share_user?.uid || data?.screenShare?.uid) {
|
|
164
165
|
roomInfo.screenShareUid = isWaitingRoomEnabled
|
|
165
166
|
? data.screenShare.uid
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import {gql, useMutation} from '@apollo/client';
|
|
2
1
|
import {UidType} from '../../agora-rn-uikit';
|
|
3
2
|
import {useRoomInfo} from '../components/room-info/useRoomInfo';
|
|
4
3
|
import useIsPSTN from './useIsPSTN';
|
|
5
4
|
import getUniqueID from './getUniqueID';
|
|
6
5
|
import {LogSource, logger} from '../logger/AppBuilderLogger';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
mute
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
`;
|
|
6
|
+
import {useContext} from 'react';
|
|
7
|
+
import StorageContext from '../components/StorageContext';
|
|
8
|
+
|
|
9
|
+
const MUTE_PSTN_URL = `${$config.BACKEND_ENDPOINT}/v1/channel/pstn/mute`;
|
|
15
10
|
|
|
16
11
|
const useMutePSTN = () => {
|
|
17
|
-
const [mutePSTN, {data, loading, error}] = useMutation(MUTE_PSTN);
|
|
18
12
|
const {
|
|
19
13
|
data: {isHost, roomId},
|
|
20
14
|
} = useRoomInfo();
|
|
15
|
+
const {store} = useContext(StorageContext);
|
|
21
16
|
const isPSTN = useIsPSTN();
|
|
22
17
|
return async (uid: UidType) => {
|
|
23
18
|
const startReqTs = Date.now();
|
|
@@ -30,48 +25,55 @@ const useMutePSTN = () => {
|
|
|
30
25
|
'Mutation try to call MUTE_PSTN ',
|
|
31
26
|
{startReqTs, requestId},
|
|
32
27
|
);
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
const payload = JSON.stringify({
|
|
29
|
+
uid: uid?.toString(),
|
|
30
|
+
passphrase: roomId?.host,
|
|
31
|
+
mute: true,
|
|
32
|
+
});
|
|
33
|
+
try {
|
|
34
|
+
const res = await fetch(`${MUTE_PSTN_URL}`, {
|
|
35
|
+
method: 'POST',
|
|
35
36
|
headers: {
|
|
37
|
+
'Content-Type': 'application/json',
|
|
38
|
+
authorization: store.token ? `Bearer ${store.token}` : '',
|
|
36
39
|
'X-Request-Id': requestId,
|
|
37
40
|
'X-Session-Id': logger.getSessionId(),
|
|
38
41
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
42
|
+
body: payload,
|
|
43
|
+
});
|
|
44
|
+
const response = await res.json();
|
|
45
|
+
|
|
46
|
+
if (response?.error) {
|
|
47
|
+
throw response?.error;
|
|
48
|
+
} else {
|
|
49
|
+
const endReqTs = Date.now();
|
|
50
|
+
logger.log(
|
|
51
|
+
LogSource.Internals,
|
|
52
|
+
'MUTE_PSTN',
|
|
53
|
+
'Mutation MUTE_PSTN success',
|
|
54
|
+
{startReqTs, endReqTs, latency: endReqTs - startReqTs, requestId},
|
|
55
|
+
);
|
|
56
|
+
return response;
|
|
57
|
+
}
|
|
58
|
+
} catch (error) {
|
|
59
|
+
const endReqTs = Date.now();
|
|
60
|
+
logger.error(
|
|
61
|
+
LogSource.Internals,
|
|
62
|
+
'MUTE_PSTN',
|
|
63
|
+
'Mutation MUTE_PSTN success',
|
|
64
|
+
JSON.stringify(error || {}),
|
|
65
|
+
{
|
|
66
|
+
startReqTs,
|
|
67
|
+
endReqTs,
|
|
68
|
+
latency: endReqTs - startReqTs,
|
|
69
|
+
requestId,
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
47
74
|
} else {
|
|
48
75
|
console.error('UID does not belong to the PSTN user.');
|
|
49
76
|
}
|
|
50
|
-
if (!loading && error) {
|
|
51
|
-
const endReqTs = Date.now();
|
|
52
|
-
logger.error(
|
|
53
|
-
LogSource.Internals,
|
|
54
|
-
'MUTE_PSTN',
|
|
55
|
-
'Mutation MUTE_PSTN success',
|
|
56
|
-
JSON.stringify(error || {}),
|
|
57
|
-
{
|
|
58
|
-
startReqTs,
|
|
59
|
-
endReqTs,
|
|
60
|
-
latency: endReqTs - startReqTs,
|
|
61
|
-
requestId,
|
|
62
|
-
},
|
|
63
|
-
);
|
|
64
|
-
throw error;
|
|
65
|
-
} else {
|
|
66
|
-
const endReqTs = Date.now();
|
|
67
|
-
logger.log(
|
|
68
|
-
LogSource.Internals,
|
|
69
|
-
'MUTE_PSTN',
|
|
70
|
-
'Mutation MUTE_PSTN success',
|
|
71
|
-
{startReqTs, endReqTs, latency: endReqTs - startReqTs, requestId},
|
|
72
|
-
);
|
|
73
|
-
return data;
|
|
74
|
-
}
|
|
75
77
|
} else {
|
|
76
78
|
console.error('A host can only mute audience audio or video.');
|
|
77
79
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const commons = require('./webpack.commons');
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const {
|
|
3
|
+
const {merge} = require('webpack-merge');
|
|
4
4
|
|
|
5
5
|
const isDevelopment = process.env.NODE_ENV === 'development';
|
|
6
6
|
|
|
@@ -16,7 +16,6 @@ module.exports = merge(commons, {
|
|
|
16
16
|
'react-dom': 'react-dom',
|
|
17
17
|
'react-router': 'react-router',
|
|
18
18
|
'react-router-dom': 'react-router-dom',
|
|
19
|
-
'@apollo/client': '@apollo/client',
|
|
20
19
|
},
|
|
21
20
|
// Main entry point for the web application
|
|
22
21
|
entry: {
|