@webex/plugin-meetings 2.60.1-next.2 → 2.60.1-next.4
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/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/constants.d.ts +4 -2
- package/dist/constants.js +7 -5
- package/dist/constants.js.map +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/meeting/index.d.ts +56 -12
- package/dist/meeting/index.js +351 -259
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/voicea-meeting.d.ts +20 -0
- package/dist/meeting/voicea-meeting.js +201 -0
- package/dist/meeting/voicea-meeting.js.map +1 -0
- package/dist/webinar/index.js +1 -1
- package/package.json +21 -20
- package/src/constants.ts +7 -2
- package/src/meeting/index.ts +299 -155
- package/src/meeting/voicea-meeting.ts +161 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
export const getSpeaker = (members, csis = []) =>
|
|
2
|
+
Object.values(members).find((member: any) => {
|
|
3
|
+
const memberCSIs = member.participant.status.csis ?? [];
|
|
4
|
+
|
|
5
|
+
return csis.some((csi) => memberCSIs.includes(csi));
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const getSpeakerFromProxyOrStore = ({csisKey, meetingMembers, transcriptData}) => {
|
|
9
|
+
let speaker = {
|
|
10
|
+
speakerId: '',
|
|
11
|
+
name: '',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
let needsCaching = false;
|
|
15
|
+
|
|
16
|
+
if (csisKey && transcriptData.speakerProxy[csisKey]) {
|
|
17
|
+
speaker = transcriptData.speakerProxy[csisKey];
|
|
18
|
+
}
|
|
19
|
+
const meetingMember: any = getSpeaker(meetingMembers, [csisKey]);
|
|
20
|
+
|
|
21
|
+
const speakerInStore = {
|
|
22
|
+
speakerId: meetingMember?.participant.person.id ?? '',
|
|
23
|
+
name: meetingMember?.participant.person.name ?? '',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
if (
|
|
27
|
+
meetingMember &&
|
|
28
|
+
(speakerInStore.speakerId !== speaker.speakerId || speakerInStore.name !== speaker.name)
|
|
29
|
+
) {
|
|
30
|
+
needsCaching = true;
|
|
31
|
+
speaker = speakerInStore;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return {speaker, needsCaching};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const processNewCaptions = ({data, meeting}) => {
|
|
38
|
+
const {transcriptId} = data;
|
|
39
|
+
const transcriptData = meeting.transcription;
|
|
40
|
+
|
|
41
|
+
if (data.isFinal) {
|
|
42
|
+
const doesInterimTranscriptionExist = transcriptId in transcriptData.interimCaptions;
|
|
43
|
+
|
|
44
|
+
if (doesInterimTranscriptionExist) {
|
|
45
|
+
transcriptData.interimCaptions[transcriptId].forEach((fakeId) => {
|
|
46
|
+
const fakeTranscriptIndex = transcriptData.captions.findIndex(
|
|
47
|
+
(transcript) => transcript.id === fakeId
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
if (fakeTranscriptIndex !== -1) {
|
|
51
|
+
transcriptData.captions.splice(fakeTranscriptIndex, 1);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
delete transcriptData.interimCaptions[transcriptId];
|
|
55
|
+
}
|
|
56
|
+
const csisKey = data.transcript?.csis[0];
|
|
57
|
+
|
|
58
|
+
const {needsCaching, speaker} = getSpeakerFromProxyOrStore({
|
|
59
|
+
meetingMembers: meeting.members.membersCollection.members,
|
|
60
|
+
transcriptData,
|
|
61
|
+
csisKey,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (needsCaching) {
|
|
65
|
+
transcriptData.speakerProxy[csisKey] = speaker;
|
|
66
|
+
}
|
|
67
|
+
const captionData = {
|
|
68
|
+
id: transcriptId,
|
|
69
|
+
isFinal: data.isFinal,
|
|
70
|
+
translations: data.translations,
|
|
71
|
+
text: data.transcript?.text,
|
|
72
|
+
currentSpokenLanguage: data.transcript?.transcriptLanguageCode,
|
|
73
|
+
timestamp: data.timestamp,
|
|
74
|
+
speaker,
|
|
75
|
+
};
|
|
76
|
+
transcriptData.captions.push(captionData);
|
|
77
|
+
}
|
|
78
|
+
const {transcripts = []} = data;
|
|
79
|
+
const transcriptsPerCsis = new Map();
|
|
80
|
+
|
|
81
|
+
for (const transcript of transcripts) {
|
|
82
|
+
const {
|
|
83
|
+
text,
|
|
84
|
+
transcript_language_code: currentSpokenLanguage,
|
|
85
|
+
csis: [csisMember],
|
|
86
|
+
} = transcript;
|
|
87
|
+
|
|
88
|
+
const newCaption = `${transcriptsPerCsis.get(csisMember)?.text ?? ''} ${text}`;
|
|
89
|
+
|
|
90
|
+
// eslint-disable-next-line camelcase
|
|
91
|
+
transcriptsPerCsis.set(csisMember, {text: newCaption, currentSpokenLanguage});
|
|
92
|
+
}
|
|
93
|
+
const fakeTranscriptionIds = [];
|
|
94
|
+
|
|
95
|
+
for (const [key, value] of transcriptsPerCsis) {
|
|
96
|
+
const {needsCaching, speaker} = getSpeakerFromProxyOrStore({
|
|
97
|
+
meetingMembers: meeting.members.membersCollection.members,
|
|
98
|
+
transcriptData,
|
|
99
|
+
csisKey: key,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
if (needsCaching) {
|
|
103
|
+
transcriptData.speakerProxy[key] = speaker;
|
|
104
|
+
}
|
|
105
|
+
const {speakerId} = speaker;
|
|
106
|
+
const fakeId = `${transcriptId}_${speakerId}`;
|
|
107
|
+
const captionData = {
|
|
108
|
+
id: fakeId,
|
|
109
|
+
isFinal: data.isFinal,
|
|
110
|
+
translations: value.translations,
|
|
111
|
+
text: value.text,
|
|
112
|
+
currentCaptionLanguage: value.currentSpokenLanguage,
|
|
113
|
+
timestamp: value?.timestamp,
|
|
114
|
+
speaker,
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const fakeTranscriptIndex = transcriptData.captions.findIndex(
|
|
118
|
+
(transcript) => transcript.id === fakeId
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
if (fakeTranscriptIndex !== -1) {
|
|
122
|
+
transcriptData.captions.splice(fakeTranscriptIndex, 1);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
fakeTranscriptionIds.push(fakeId);
|
|
126
|
+
transcriptData.captions.push(captionData);
|
|
127
|
+
}
|
|
128
|
+
transcriptData.interimCaptions[transcriptId] = fakeTranscriptionIds;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const processHighlightCreated = ({data, meeting}) => {
|
|
132
|
+
const transcriptData = meeting.transcription;
|
|
133
|
+
|
|
134
|
+
if (!transcriptData.highlights) {
|
|
135
|
+
transcriptData.highlights = [];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const csisKey = data.csis && data.csis.length > 0 ? data.csis[0] : undefined;
|
|
139
|
+
const {needsCaching, speaker} = getSpeakerFromProxyOrStore({
|
|
140
|
+
meetingMembers: meeting.members.membersCollection.members,
|
|
141
|
+
transcriptData,
|
|
142
|
+
csisKey,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
if (needsCaching) {
|
|
146
|
+
transcriptData.speakerProxy[csisKey] = speaker;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const highlightCreated = {
|
|
150
|
+
id: data.highlightId,
|
|
151
|
+
meta: {
|
|
152
|
+
label: data.highlightLabel,
|
|
153
|
+
source: data.highlightSource,
|
|
154
|
+
},
|
|
155
|
+
text: data.text,
|
|
156
|
+
timestamp: data.timestamp,
|
|
157
|
+
speaker,
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
meeting.transcription.highlights.push(highlightCreated);
|
|
161
|
+
};
|