agora-appbuilder-core 4.1.7-beta.8 → 4.1.8-beta.1
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 +1 -1
- package/template/_package-lock.json +30671 -5376
- package/template/defaultConfig.js +2 -2
- package/template/esbuild.rsdk.go +1 -2
- package/template/package.json +0 -1
- package/template/src/AppWrapper.tsx +30 -35
- package/template/src/auth/AuthProvider.tsx +28 -35
- package/template/src/auth/IDPAuth.tsx +1 -14
- package/template/src/components/Controls.tsx +45 -15
- package/template/src/components/common/GenericModal.tsx +143 -0
- package/template/src/components/common/GenericPopup.tsx +152 -0
- package/template/src/components/common/data-table.tsx +385 -0
- package/template/src/components/controls/useControlPermissionMatrix.tsx +6 -7
- package/template/src/components/precall/usePreCall.tsx +1 -2
- package/template/src/components/stt-transcript/STTTranscriptTable.tsx +295 -0
- package/template/src/components/stt-transcript/ViewSTTTranscriptModal.tsx +44 -0
- package/template/src/components/stt-transcript/useFetchSTTTranscript.tsx +193 -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 +0 -5
- package/template/src/subComponents/LogoutButton.tsx +1 -11
- 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 +0 -3
- package/template/src/utils/useMutePSTN.ts +47 -45
- package/template/webpack.rsdk.config.js +1 -2
- package/template/src/components/GraphQLProvider.tsx +0 -122
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {View, Text, TouchableOpacity} from 'react-native';
|
|
3
|
+
import Tooltip from '../../atoms/Tooltip';
|
|
4
|
+
import Clipboard from '../../subComponents/Clipboard';
|
|
5
|
+
import Spacer from '../../atoms/Spacer';
|
|
6
|
+
import {style} from '../recordings/style';
|
|
7
|
+
import {TableBody, TableFooter, TableHeader} from '../common/data-table';
|
|
8
|
+
import {
|
|
9
|
+
FetchSTTTranscriptResponse,
|
|
10
|
+
useFetchSTTTranscript,
|
|
11
|
+
} from './useFetchSTTTranscript';
|
|
12
|
+
import {
|
|
13
|
+
capitalizeFirstLetter,
|
|
14
|
+
downloadS3Link,
|
|
15
|
+
getFormattedDateTime,
|
|
16
|
+
} from '../../utils/common';
|
|
17
|
+
import IconButtonWithToolTip from '../../atoms/IconButton';
|
|
18
|
+
import ImageIcon from '../../atoms/ImageIcon';
|
|
19
|
+
import Loading from '../../subComponents/Loading';
|
|
20
|
+
import GenericPopup from '../common/GenericPopup';
|
|
21
|
+
import PlatformWrapper from '../../utils/PlatformWrapper';
|
|
22
|
+
|
|
23
|
+
const headers = ['Date', 'Time', 'Status', 'Actions'];
|
|
24
|
+
|
|
25
|
+
interface STTItemRowProps {
|
|
26
|
+
item: FetchSTTTranscriptResponse['stts'][0];
|
|
27
|
+
onDeleteAction: (id: string) => void;
|
|
28
|
+
onDownloadAction: (link: string) => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function STTItemRow({item, onDeleteAction, onDownloadAction}: STTItemRowProps) {
|
|
32
|
+
const [date, time] = getFormattedDateTime(item.created_at);
|
|
33
|
+
const sttStatus = item.status;
|
|
34
|
+
|
|
35
|
+
if (
|
|
36
|
+
sttStatus === 'STOPPING' ||
|
|
37
|
+
sttStatus === 'STARTED' ||
|
|
38
|
+
(sttStatus === 'INPROGRESS' && !item?.download_url)
|
|
39
|
+
) {
|
|
40
|
+
return (
|
|
41
|
+
<View key={item.id} style={style.pt12}>
|
|
42
|
+
<View style={[style.infotextContainer, style.captionContainer]}>
|
|
43
|
+
<ImageIcon
|
|
44
|
+
iconSize={20}
|
|
45
|
+
iconType="plain"
|
|
46
|
+
name="info"
|
|
47
|
+
tintColor={$config.SEMANTIC_NEUTRAL}
|
|
48
|
+
/>
|
|
49
|
+
<Text style={[style.captionText]}>
|
|
50
|
+
Current STT is ongoing. Once the meeting concludes, we'll generate
|
|
51
|
+
the link
|
|
52
|
+
</Text>
|
|
53
|
+
</View>
|
|
54
|
+
</View>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
return (
|
|
58
|
+
<View style={style.tbrow} key={item.id}>
|
|
59
|
+
<View style={[style.td, style.plzero]}>
|
|
60
|
+
<Text style={style.ttime}>{date}</Text>
|
|
61
|
+
</View>
|
|
62
|
+
<View style={[style.td]}>
|
|
63
|
+
<Text style={style.ttime}>{time}</Text>
|
|
64
|
+
</View>
|
|
65
|
+
<View style={[style.td]}>
|
|
66
|
+
<Text style={style.ttime}>{capitalizeFirstLetter(sttStatus)}</Text>
|
|
67
|
+
</View>
|
|
68
|
+
<View style={style.td}>
|
|
69
|
+
{!item.download_url ? (
|
|
70
|
+
<View style={[style.tactions, {marginTop: 0}]}>
|
|
71
|
+
<Text style={style.placeHolder}>{'No transcripts found'}</Text>
|
|
72
|
+
</View>
|
|
73
|
+
) : item?.download_url?.length > 0 ? (
|
|
74
|
+
<View style={style.tactions}>
|
|
75
|
+
<View>
|
|
76
|
+
{item?.download_url?.map((link: string, i: number) => (
|
|
77
|
+
<View
|
|
78
|
+
key={i}
|
|
79
|
+
style={[
|
|
80
|
+
style.tactions,
|
|
81
|
+
//if stts contains multiple parts then we need to add some space each row
|
|
82
|
+
i >= 1 ? {marginTop: 8} : {},
|
|
83
|
+
]}>
|
|
84
|
+
<View>
|
|
85
|
+
<IconButtonWithToolTip
|
|
86
|
+
hoverEffect={true}
|
|
87
|
+
hoverEffectStyle={style.iconButtonHoverEffect}
|
|
88
|
+
containerStyle={style.iconButton}
|
|
89
|
+
iconProps={{
|
|
90
|
+
name: 'download',
|
|
91
|
+
iconType: 'plain',
|
|
92
|
+
iconSize: 20,
|
|
93
|
+
tintColor: `${$config.SECONDARY_ACTION_COLOR}`,
|
|
94
|
+
}}
|
|
95
|
+
onPress={() => {
|
|
96
|
+
onDownloadAction(link);
|
|
97
|
+
}}
|
|
98
|
+
/>
|
|
99
|
+
</View>
|
|
100
|
+
<View style={[style.pl10]}>
|
|
101
|
+
<Tooltip
|
|
102
|
+
isClickable
|
|
103
|
+
placement="left"
|
|
104
|
+
toolTipMessage="Link Copied"
|
|
105
|
+
onPress={() => {
|
|
106
|
+
Clipboard.setString(link);
|
|
107
|
+
}}
|
|
108
|
+
toolTipIcon={
|
|
109
|
+
<>
|
|
110
|
+
<ImageIcon
|
|
111
|
+
iconType="plain"
|
|
112
|
+
name="tick-fill"
|
|
113
|
+
tintColor={$config.SEMANTIC_SUCCESS}
|
|
114
|
+
iconSize={20}
|
|
115
|
+
/>
|
|
116
|
+
<Spacer size={8} horizontal={true} />
|
|
117
|
+
</>
|
|
118
|
+
}
|
|
119
|
+
fontSize={12}
|
|
120
|
+
renderContent={() => {
|
|
121
|
+
return (
|
|
122
|
+
<PlatformWrapper>
|
|
123
|
+
{(isHovered: boolean) => (
|
|
124
|
+
<TouchableOpacity
|
|
125
|
+
style={[
|
|
126
|
+
isHovered ? style.iconButtonHoverEffect : {},
|
|
127
|
+
style.iconShareLink,
|
|
128
|
+
]}
|
|
129
|
+
onPress={() => {
|
|
130
|
+
Clipboard.setString(link);
|
|
131
|
+
}}>
|
|
132
|
+
<ImageIcon
|
|
133
|
+
iconType="plain"
|
|
134
|
+
name="copy-link"
|
|
135
|
+
iconSize={20}
|
|
136
|
+
tintColor={$config.SECONDARY_ACTION_COLOR}
|
|
137
|
+
/>
|
|
138
|
+
</TouchableOpacity>
|
|
139
|
+
)}
|
|
140
|
+
</PlatformWrapper>
|
|
141
|
+
);
|
|
142
|
+
}}
|
|
143
|
+
/>
|
|
144
|
+
</View>
|
|
145
|
+
<View style={[style.pl10]}>
|
|
146
|
+
<IconButtonWithToolTip
|
|
147
|
+
hoverEffect={true}
|
|
148
|
+
hoverEffectStyle={style.iconButtonHoverEffect}
|
|
149
|
+
containerStyle={style.iconButton}
|
|
150
|
+
iconProps={{
|
|
151
|
+
name: 'delete',
|
|
152
|
+
iconType: 'plain',
|
|
153
|
+
iconSize: 20,
|
|
154
|
+
tintColor: `${$config.SEMANTIC_ERROR}`,
|
|
155
|
+
}}
|
|
156
|
+
onPress={() => {
|
|
157
|
+
//show confirmation popup
|
|
158
|
+
onDeleteAction && onDeleteAction(item.id);
|
|
159
|
+
}}
|
|
160
|
+
/>
|
|
161
|
+
</View>
|
|
162
|
+
</View>
|
|
163
|
+
))}
|
|
164
|
+
</View>
|
|
165
|
+
</View>
|
|
166
|
+
) : (
|
|
167
|
+
<View style={(style.tactions, {marginTop: 0})}>
|
|
168
|
+
<Text style={style.placeHolder}>No transcripts found</Text>
|
|
169
|
+
</View>
|
|
170
|
+
)}
|
|
171
|
+
</View>
|
|
172
|
+
</View>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function EmptyTranscriptState() {
|
|
177
|
+
return (
|
|
178
|
+
<View style={style.infotextContainer}>
|
|
179
|
+
<View>
|
|
180
|
+
<ImageIcon
|
|
181
|
+
iconType="plain"
|
|
182
|
+
name="info"
|
|
183
|
+
tintColor={'#777777'}
|
|
184
|
+
iconSize={32}
|
|
185
|
+
/>
|
|
186
|
+
</View>
|
|
187
|
+
<View>
|
|
188
|
+
<Text style={[style.infoText, style.pt10, style.pl10]}>
|
|
189
|
+
No transcripts found for this meeting
|
|
190
|
+
</Text>
|
|
191
|
+
</View>
|
|
192
|
+
</View>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function ErrorTranscriptState(message: any) {
|
|
197
|
+
return <Text style={[style.ttime, style.pv10, style.ph20]}>{message}</Text>;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function STTTranscriptTable() {
|
|
201
|
+
const {
|
|
202
|
+
status,
|
|
203
|
+
stts,
|
|
204
|
+
pagination,
|
|
205
|
+
error,
|
|
206
|
+
currentPage,
|
|
207
|
+
setCurrentPage,
|
|
208
|
+
deleteTranscript,
|
|
209
|
+
} = useFetchSTTTranscript();
|
|
210
|
+
|
|
211
|
+
// id of STT transcript to delete
|
|
212
|
+
const [sttIdToDelete, setSTTIdToDelete] = React.useState<string | undefined>(
|
|
213
|
+
undefined,
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
// message for any download‐error popup
|
|
217
|
+
const [downloadError, setDownloadError] = React.useState<
|
|
218
|
+
string | undefined
|
|
219
|
+
>();
|
|
220
|
+
|
|
221
|
+
if (status === 'rejected') {
|
|
222
|
+
return <ErrorTranscriptState message={error?.message} />;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const onDeleteSTTRecord = async () => {
|
|
226
|
+
try {
|
|
227
|
+
await deleteTranscript(sttIdToDelete!);
|
|
228
|
+
} catch (err: any) {
|
|
229
|
+
setDownloadError(err.message);
|
|
230
|
+
} finally {
|
|
231
|
+
setSTTIdToDelete(undefined);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
return (
|
|
236
|
+
<>
|
|
237
|
+
<View style={style.ttable}>
|
|
238
|
+
<TableHeader columns={headers} />
|
|
239
|
+
<TableBody
|
|
240
|
+
status={status}
|
|
241
|
+
items={stts}
|
|
242
|
+
loadingComponent={
|
|
243
|
+
<Loading background="transparent" text="Fetching transcripts.." />
|
|
244
|
+
}
|
|
245
|
+
renderRow={item => (
|
|
246
|
+
<STTItemRow
|
|
247
|
+
key={item.id}
|
|
248
|
+
item={item}
|
|
249
|
+
onDeleteAction={id => {
|
|
250
|
+
setSTTIdToDelete(id);
|
|
251
|
+
}}
|
|
252
|
+
onDownloadAction={link => {
|
|
253
|
+
downloadS3Link(link).catch((err: Error) => {
|
|
254
|
+
setDownloadError(err.message || 'Download failed');
|
|
255
|
+
});
|
|
256
|
+
}}
|
|
257
|
+
/>
|
|
258
|
+
)}
|
|
259
|
+
emptyComponent={<EmptyTranscriptState />}
|
|
260
|
+
/>
|
|
261
|
+
<TableFooter
|
|
262
|
+
currentPage={currentPage}
|
|
263
|
+
onPageChange={setCurrentPage}
|
|
264
|
+
pagination={pagination}
|
|
265
|
+
/>
|
|
266
|
+
</View>
|
|
267
|
+
{sttIdToDelete && (
|
|
268
|
+
<GenericPopup
|
|
269
|
+
title="Delete ? "
|
|
270
|
+
variant="error"
|
|
271
|
+
message="Are you sure want to delete the transcript ? This action can't be undone."
|
|
272
|
+
visible={!!sttIdToDelete}
|
|
273
|
+
setVisible={() => setSTTIdToDelete(undefined)}
|
|
274
|
+
onConfirm={onDeleteSTTRecord}
|
|
275
|
+
onCancel={() => {
|
|
276
|
+
setSTTIdToDelete(undefined);
|
|
277
|
+
}}
|
|
278
|
+
/>
|
|
279
|
+
)}
|
|
280
|
+
{/** DOWNLOAD ERROR POPUP **/}
|
|
281
|
+
{downloadError && (
|
|
282
|
+
<GenericPopup
|
|
283
|
+
title="Download Error"
|
|
284
|
+
variant="error"
|
|
285
|
+
message={downloadError}
|
|
286
|
+
visible={true}
|
|
287
|
+
setVisible={() => setDownloadError(undefined)}
|
|
288
|
+
onConfirm={() => setDownloadError(undefined)}
|
|
289
|
+
/>
|
|
290
|
+
)}
|
|
291
|
+
</>
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export default STTTranscriptTable;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, {SetStateAction, Dispatch} from 'react';
|
|
2
|
+
import {View, StyleSheet} from 'react-native';
|
|
3
|
+
import {useString} from '../../utils/useString';
|
|
4
|
+
import {sttModalTitleIntn} from '../../language/default-labels/videoCallScreenLabels';
|
|
5
|
+
import GenericModal from '../common/GenericModal';
|
|
6
|
+
import STTTranscriptTable from './STTTranscriptTable';
|
|
7
|
+
|
|
8
|
+
interface ViewSTTModalProps {
|
|
9
|
+
setModalOpen: Dispatch<SetStateAction<boolean>>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function ViewSTTTranscriptModal(props: ViewSTTModalProps) {
|
|
13
|
+
const {setModalOpen} = props;
|
|
14
|
+
|
|
15
|
+
const sttModalTitle = useString(sttModalTitleIntn)();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<GenericModal
|
|
19
|
+
visible={true}
|
|
20
|
+
onRequestClose={() => setModalOpen(false)}
|
|
21
|
+
showCloseIcon={true}
|
|
22
|
+
title={sttModalTitle}
|
|
23
|
+
cancelable={false}
|
|
24
|
+
contentContainerStyle={style.contentContainer}>
|
|
25
|
+
<View style={style.fullBody}>
|
|
26
|
+
<STTTranscriptTable />
|
|
27
|
+
</View>
|
|
28
|
+
</GenericModal>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const style = StyleSheet.create({
|
|
33
|
+
contentContainer: {
|
|
34
|
+
display: 'flex',
|
|
35
|
+
flexDirection: 'column',
|
|
36
|
+
alignItems: 'flex-start',
|
|
37
|
+
flexShrink: 0,
|
|
38
|
+
width: '100%',
|
|
39
|
+
},
|
|
40
|
+
fullBody: {
|
|
41
|
+
width: '100%',
|
|
42
|
+
flex: 1,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import {useState, useCallback, useEffect, useContext} from 'react';
|
|
2
|
+
import StorageContext from '../StorageContext';
|
|
3
|
+
import {useRoomInfo} from 'customization-api';
|
|
4
|
+
import getUniqueID from '../../utils/getUniqueID';
|
|
5
|
+
import {logger, LogSource} from '../../logger/AppBuilderLogger';
|
|
6
|
+
|
|
7
|
+
export interface FetchSTTTranscriptResponse {
|
|
8
|
+
pagination: {
|
|
9
|
+
limit: number;
|
|
10
|
+
total: number;
|
|
11
|
+
page: number;
|
|
12
|
+
};
|
|
13
|
+
stts: {
|
|
14
|
+
id: string;
|
|
15
|
+
download_url: string[];
|
|
16
|
+
title: string;
|
|
17
|
+
product_name: string;
|
|
18
|
+
status: 'COMPLETED' | 'STARTED' | 'INPROGRESS' | 'STOPPING';
|
|
19
|
+
created_at: string;
|
|
20
|
+
ended_at: string;
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type APIStatus = 'idle' | 'pending' | 'resolved' | 'rejected';
|
|
25
|
+
|
|
26
|
+
export function useFetchSTTTranscript(defaultLimit = 10) {
|
|
27
|
+
const {
|
|
28
|
+
data: {roomId},
|
|
29
|
+
} = useRoomInfo();
|
|
30
|
+
const {store} = useContext(StorageContext);
|
|
31
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
32
|
+
|
|
33
|
+
const [state, setState] = useState<{
|
|
34
|
+
status: APIStatus;
|
|
35
|
+
data: {
|
|
36
|
+
stts: FetchSTTTranscriptResponse['stts'];
|
|
37
|
+
pagination: FetchSTTTranscriptResponse['pagination'];
|
|
38
|
+
};
|
|
39
|
+
error: any;
|
|
40
|
+
}>({
|
|
41
|
+
status: 'idle',
|
|
42
|
+
data: {stts: [], pagination: {total: 0, limit: defaultLimit, page: 1}},
|
|
43
|
+
error: null,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const fetchStts = useCallback(
|
|
47
|
+
async (page: number) => {
|
|
48
|
+
const requestId = getUniqueID();
|
|
49
|
+
const start = Date.now();
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
if (!roomId?.host) {
|
|
53
|
+
return Promise.reject('room id is empty');
|
|
54
|
+
}
|
|
55
|
+
const res = await fetch(
|
|
56
|
+
`${$config.BACKEND_ENDPOINT}/v1/stt-transcript`,
|
|
57
|
+
{
|
|
58
|
+
method: 'POST',
|
|
59
|
+
headers: {
|
|
60
|
+
'Content-Type': 'application/json',
|
|
61
|
+
authorization: store.token ? `Bearer ${store.token}` : '',
|
|
62
|
+
'X-Request-Id': requestId,
|
|
63
|
+
'X-Session-Id': logger.getSessionId(),
|
|
64
|
+
},
|
|
65
|
+
body: JSON.stringify({
|
|
66
|
+
passphrase: roomId.host,
|
|
67
|
+
limit: defaultLimit,
|
|
68
|
+
page,
|
|
69
|
+
}),
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
const json = await res.json();
|
|
73
|
+
const end = Date.now();
|
|
74
|
+
|
|
75
|
+
if (!res.ok) {
|
|
76
|
+
logger.error(
|
|
77
|
+
LogSource.NetworkRest,
|
|
78
|
+
'stt-transcript',
|
|
79
|
+
'Fetching STT transcripts failed',
|
|
80
|
+
{
|
|
81
|
+
json,
|
|
82
|
+
start,
|
|
83
|
+
end,
|
|
84
|
+
latency: end - start,
|
|
85
|
+
requestId,
|
|
86
|
+
},
|
|
87
|
+
);
|
|
88
|
+
throw new Error(json?.error?.message || 'Unknown fetch error');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
logger.debug(
|
|
92
|
+
LogSource.NetworkRest,
|
|
93
|
+
'stt-transcript',
|
|
94
|
+
'Fetched STT transcripts',
|
|
95
|
+
{
|
|
96
|
+
json,
|
|
97
|
+
start,
|
|
98
|
+
end,
|
|
99
|
+
latency: end - start,
|
|
100
|
+
requestId,
|
|
101
|
+
},
|
|
102
|
+
);
|
|
103
|
+
return json;
|
|
104
|
+
} catch (err) {
|
|
105
|
+
return Promise.reject(err);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
[roomId.host, store.token, defaultLimit],
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const getSTTs = useCallback(
|
|
112
|
+
(page: number) => {
|
|
113
|
+
setState(s => ({...s, status: 'pending'}));
|
|
114
|
+
fetchStts(page).then(
|
|
115
|
+
data =>
|
|
116
|
+
setState({
|
|
117
|
+
status: 'resolved',
|
|
118
|
+
data: {
|
|
119
|
+
stts: data.stts || [],
|
|
120
|
+
pagination: data.pagination || {
|
|
121
|
+
total: 0,
|
|
122
|
+
limit: defaultLimit,
|
|
123
|
+
page: 1,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
error: null,
|
|
127
|
+
}),
|
|
128
|
+
err => setState(s => ({...s, status: 'rejected', error: err})),
|
|
129
|
+
);
|
|
130
|
+
},
|
|
131
|
+
[fetchStts, defaultLimit],
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const deleteTranscript = useCallback(
|
|
135
|
+
async (id: string) => {
|
|
136
|
+
const res = await fetch(
|
|
137
|
+
`${
|
|
138
|
+
$config.BACKEND_ENDPOINT
|
|
139
|
+
}/v1/stt-transcript/${id}?passphrase=${encodeURIComponent(
|
|
140
|
+
roomId.host,
|
|
141
|
+
)}`,
|
|
142
|
+
{
|
|
143
|
+
method: 'DELETE',
|
|
144
|
+
headers: {'Content-Type': 'application/json'},
|
|
145
|
+
},
|
|
146
|
+
);
|
|
147
|
+
if (!res.ok) {
|
|
148
|
+
const body = await res.json();
|
|
149
|
+
throw new Error(
|
|
150
|
+
body?.error?.message ?? `Delete failed (${res.status})`,
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
// optimistic update local state:
|
|
154
|
+
setState(prev => {
|
|
155
|
+
// remove the deleted item
|
|
156
|
+
const newStts = prev.data.stts.filter(item => item.id !== id);
|
|
157
|
+
// decrement total count
|
|
158
|
+
const newTotal = Math.max(prev.data.pagination.total - 1, 0);
|
|
159
|
+
// if we just removed the *last* item on this page, go back a page
|
|
160
|
+
let newPage = prev.data.pagination.page;
|
|
161
|
+
if (prev.data.stts.length === 1 && newPage > 1) {
|
|
162
|
+
newPage = newPage - 1;
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
...prev,
|
|
166
|
+
data: {
|
|
167
|
+
stts: newStts,
|
|
168
|
+
pagination: {
|
|
169
|
+
...prev.data.pagination,
|
|
170
|
+
total: newTotal,
|
|
171
|
+
page: newPage,
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
[roomId.host],
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
useEffect(() => {
|
|
181
|
+
getSTTs(currentPage);
|
|
182
|
+
}, [currentPage, getSTTs]);
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
status: state.status as APIStatus,
|
|
186
|
+
stts: state.data.stts,
|
|
187
|
+
pagination: state.data.pagination,
|
|
188
|
+
error: state.error,
|
|
189
|
+
currentPage,
|
|
190
|
+
setCurrentPage,
|
|
191
|
+
deleteTranscript,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
@@ -24,7 +24,6 @@ import useLocalScreenShareUid from '../utils/useLocalShareScreenUid';
|
|
|
24
24
|
import {createHook} from 'customization-implementation';
|
|
25
25
|
import ChatContext from './ChatContext';
|
|
26
26
|
import {filterObject, useContent, useRoomInfo, useRtc} from 'customization-api';
|
|
27
|
-
import {gql, useMutation} from '@apollo/client';
|
|
28
27
|
import {
|
|
29
28
|
PSTNUserLabel,
|
|
30
29
|
videoRoomScreenshareText,
|
|
@@ -55,15 +54,6 @@ const UserPreferenceContext =
|
|
|
55
54
|
uids: {},
|
|
56
55
|
});
|
|
57
56
|
|
|
58
|
-
const UPDATE_USER_NAME_MUTATION = gql`
|
|
59
|
-
mutation updateUserName($name: String!) {
|
|
60
|
-
updateUserName(name: $name) {
|
|
61
|
-
name
|
|
62
|
-
email
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
66
|
-
|
|
67
57
|
const UserPreferenceProvider = (props: {
|
|
68
58
|
children: React.ReactNode;
|
|
69
59
|
callActive: boolean;
|
|
@@ -81,7 +71,6 @@ const UserPreferenceProvider = (props: {
|
|
|
81
71
|
const getInitialUsername = () =>
|
|
82
72
|
store?.displayName ? store.displayName : '';
|
|
83
73
|
const [displayName, setDisplayName] = useState(getInitialUsername());
|
|
84
|
-
const [updateUserName] = useMutation(UPDATE_USER_NAME_MUTATION);
|
|
85
74
|
|
|
86
75
|
const {languageCode} = useLanguage();
|
|
87
76
|
const {screenShareData} = useScreenContext();
|
|
@@ -109,6 +109,8 @@ export const toolbarItemNoiseCancellationText =
|
|
|
109
109
|
export const toolbarItemWhiteboardText = 'toolbarItemWhiteboardText';
|
|
110
110
|
export const toolbarItemCaptionText = 'toolbarItemCaptionText';
|
|
111
111
|
export const toolbarItemTranscriptText = 'toolbarItemTranscriptText';
|
|
112
|
+
export const toolbarItemManageTranscriptText =
|
|
113
|
+
'toolbarItemManageTranscriptText';
|
|
112
114
|
export const toolbarItemVirtualBackgroundText =
|
|
113
115
|
'toolbarItemVirtualBackgroundText';
|
|
114
116
|
export const toolbarItemViewRecordingText = 'toolbarItemViewRecordingText';
|
|
@@ -149,6 +151,7 @@ export const nativeStopScreensharePopupPrimaryBtnText =
|
|
|
149
151
|
'nativeStopScreensharePopupPrimaryBtnText';
|
|
150
152
|
|
|
151
153
|
export const recordingModalTitleIntn = 'recordingModalTitleIntn';
|
|
154
|
+
export const transcriptModalTitleIntn = 'transcriptModalTitleIntn';
|
|
152
155
|
export const stopRecordingPopupHeading = 'stopRecordingPopupHeading';
|
|
153
156
|
export const stopRecordingPopupSubHeading = 'stopRecordingPopupSubHeading';
|
|
154
157
|
export const stopRecordingPopupPrimaryBtnText =
|
|
@@ -570,6 +573,7 @@ export interface I18nVideoCallScreenLabelsInterface {
|
|
|
570
573
|
[toolbarItemWhiteboardText]?: I18nConditionalType;
|
|
571
574
|
[toolbarItemCaptionText]?: I18nConditionalType;
|
|
572
575
|
[toolbarItemTranscriptText]?: I18nConditionalType;
|
|
576
|
+
[toolbarItemManageTranscriptText]?: I18nConditionalType;
|
|
573
577
|
[toolbarItemVirtualBackgroundText]?: I18nBaseType;
|
|
574
578
|
[toolbarItemViewRecordingText]?: I18nConditionalType;
|
|
575
579
|
|
|
@@ -605,6 +609,7 @@ export interface I18nVideoCallScreenLabelsInterface {
|
|
|
605
609
|
[nativeStopScreensharePopupPrimaryBtnText]?: I18nBaseType;
|
|
606
610
|
|
|
607
611
|
[recordingModalTitleIntn]?: I18nBaseType;
|
|
612
|
+
[transcriptModalTitleIntn]?: I18nBaseType;
|
|
608
613
|
[stopRecordingPopupHeading]?: I18nBaseType;
|
|
609
614
|
[stopRecordingPopupSubHeading]?: I18nBaseType;
|
|
610
615
|
[stopRecordingPopupPrimaryBtnText]?: I18nBaseType;
|
|
@@ -937,6 +942,7 @@ export const VideoCallScreenLabels: I18nVideoCallScreenLabelsInterface = {
|
|
|
937
942
|
[toolbarItemTranscriptText]: active =>
|
|
938
943
|
active ? 'Hide Transcript' : 'Show Transcript',
|
|
939
944
|
[toolbarItemViewRecordingText]: 'View Recordings',
|
|
945
|
+
[toolbarItemManageTranscriptText]: 'View Transcripts',
|
|
940
946
|
|
|
941
947
|
[toolbarItemRaiseHandText]: active => (active ? 'Lower Hand' : 'Raise Hand'),
|
|
942
948
|
[toolbarItemSwitchCameraText]: 'Switch Camera',
|
|
@@ -1019,6 +1025,7 @@ export const VideoCallScreenLabels: I18nVideoCallScreenLabelsInterface = {
|
|
|
1019
1025
|
`Once removed, ${name} will still be able to screen share later.`,
|
|
1020
1026
|
[removeScreenshareFromRoomPopupPrimaryBtnText]: 'REMOVE',
|
|
1021
1027
|
|
|
1028
|
+
[transcriptModalTitleIntn]: 'View Transcripts',
|
|
1022
1029
|
[sttChangeLanguagePopupHeading]: isFirstTimeOpened =>
|
|
1023
1030
|
isFirstTimeOpened ? 'Set Spoken Language' : 'Change Spoken Language',
|
|
1024
1031
|
[sttChangeLanguagePopupSubHeading]:
|
|
@@ -237,9 +237,9 @@ const Create = () => {
|
|
|
237
237
|
});
|
|
238
238
|
showShareScreen();
|
|
239
239
|
} catch (error) {
|
|
240
|
-
const errorCode = error?.
|
|
240
|
+
const errorCode = error?.code;
|
|
241
241
|
if (AuthErrorCodes.indexOf(errorCode) !== -1 && isSDK()) {
|
|
242
|
-
SDKEvents.emit('unauthorized', error
|
|
242
|
+
SDKEvents.emit('unauthorized', error);
|
|
243
243
|
}
|
|
244
244
|
setLoading(false);
|
|
245
245
|
logger.error(
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
*/
|
|
12
12
|
// @ts-nocheck
|
|
13
13
|
import React, {useState, useContext, useEffect, useRef} from 'react';
|
|
14
|
-
import {useApolloClient} from '@apollo/client';
|
|
15
14
|
import {View, StyleSheet, Text} from 'react-native';
|
|
16
15
|
import {
|
|
17
16
|
RtcConfigure,
|
|
@@ -133,8 +132,6 @@ const VideoCall: React.FC = () => {
|
|
|
133
132
|
const joiningLoaderLabel = useString(videoRoomStartingCallText)();
|
|
134
133
|
const bannedUserText = useString(userBannedText)();
|
|
135
134
|
|
|
136
|
-
const client = useApolloClient();
|
|
137
|
-
|
|
138
135
|
const {setGlobalErrorMessage} = useContext(ErrorContext);
|
|
139
136
|
const {awake, release} = useWakeLock();
|
|
140
137
|
const {isRecordingBot} = useIsRecordingBot();
|
|
@@ -424,8 +421,6 @@ const VideoCall: React.FC = () => {
|
|
|
424
421
|
} else {
|
|
425
422
|
history.push('/');
|
|
426
423
|
}
|
|
427
|
-
// client.resetStore();//https://github.com/apollographql/apollo-client/issues/2919#issuecomment-406311579
|
|
428
|
-
client.cache.reset();
|
|
429
424
|
}, 0);
|
|
430
425
|
},
|
|
431
426
|
UserJoined: (uid: UidType) => {
|
|
@@ -13,14 +13,8 @@ import React, {useContext} from 'react';
|
|
|
13
13
|
import {TouchableOpacity, Text, StyleSheet} from 'react-native';
|
|
14
14
|
import StorageContext, {initStoreValue} from '../components/StorageContext';
|
|
15
15
|
import {useHistory} from '../components/Router';
|
|
16
|
-
import {gql, useMutation} from '@apollo/client';
|
|
17
16
|
import {useString} from '../utils/useString';
|
|
18
17
|
|
|
19
|
-
const LOGOUT = gql`
|
|
20
|
-
mutation logoutSession($token: String!) {
|
|
21
|
-
logoutSession(token: $token)
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
18
|
/**
|
|
25
19
|
* Sends a logout request to the backend and logs out the user from the frontend.
|
|
26
20
|
*/
|
|
@@ -28,7 +22,6 @@ const LogoutButton = () => {
|
|
|
28
22
|
const {store, setStore} = useContext(StorageContext);
|
|
29
23
|
const {token} = store;
|
|
30
24
|
const history = useHistory();
|
|
31
|
-
const [logoutQuery] = useMutation(LOGOUT);
|
|
32
25
|
//commented for v1 release
|
|
33
26
|
// const oauthLoginLabel = useString('oauthLoginLabel')();
|
|
34
27
|
// const logoutButton = useString('logoutButton')();
|
|
@@ -41,16 +34,13 @@ const LogoutButton = () => {
|
|
|
41
34
|
* User stored some data in localstorage we don't want to remove their on logout.
|
|
42
35
|
* so setting prevstate with store default value
|
|
43
36
|
*/
|
|
44
|
-
setStore(
|
|
37
|
+
setStore(prevState => {
|
|
45
38
|
return {
|
|
46
39
|
...prevState,
|
|
47
40
|
...initStoreValue,
|
|
48
41
|
};
|
|
49
42
|
});
|
|
50
43
|
}
|
|
51
|
-
logoutQuery({variables: {token}}).catch((e) => {
|
|
52
|
-
console.log(e);
|
|
53
|
-
});
|
|
54
44
|
};
|
|
55
45
|
|
|
56
46
|
const login = () => {
|