communication-react-19
Version:
React library for building modern communication user experiences utilizing Azure Communication Services (React 19 compatible fork)
42 lines • 1.62 kB
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* Return different conditions based on the current and previous state of recording and transcribing
*
* @param callRecordState - The current call record state: on, off, stopped
* @param callTranscribeState - The current call transcribe state: on, off, stopped
*
* @remarks - The stopped state means: previously on but currently off
*
* @private
*/
export const computeVariant = (callRecordState, callTranscribeState) => {
if (callRecordState === 'on' && callTranscribeState === 'on') {
return 'RECORDING_AND_TRANSCRIPTION_STARTED';
}
else if (callRecordState === 'on' && callTranscribeState === 'off') {
return 'RECORDING_STARTED';
}
else if (callRecordState === 'off' && callTranscribeState === 'on') {
return 'TRANSCRIPTION_STARTED';
}
else if (callRecordState === 'on' && callTranscribeState === 'stopped') {
return 'TRANSCRIPTION_STOPPED_STILL_RECORDING';
}
else if (callRecordState === 'stopped' && callTranscribeState === 'on') {
return 'RECORDING_STOPPED_STILL_TRANSCRIBING';
}
else if (callRecordState === 'off' && callTranscribeState === 'stopped') {
return 'TRANSCRIPTION_STOPPED';
}
else if (callRecordState === 'stopped' && callTranscribeState === 'off') {
return 'RECORDING_STOPPED';
}
else if (callRecordState === 'stopped' && callTranscribeState === 'stopped') {
return 'RECORDING_AND_TRANSCRIPTION_STOPPED';
}
else {
return 'NO_STATE';
}
};
//# sourceMappingURL=Utils.js.map