function authenticateVoice()

in website-creator/js/voiceid.js [89:112]


function authenticateVoice(startNew) {
    $('#voice-id-prompt').text('Please wait for authentication ...');

    if (typeof agent === "undefined") {
        agent = new connect.Agent();
    }
    let agentConn = agent.getContacts()[0].getConnections()[0];
    $('#loading-image').css('display', 'inline-block');

    agentConn.evaluateSpeakerWithVoiceId(startNew)
        .then((response) => {
            $('#voice-id-prompt').text(response.AuthenticationResult.Decision);
            $('#loading-image').css('display', 'none');
            if (response.AuthenticationResult.Decision === 'Authenticated') {
                $('#opt-out').prop('disabled', false).css('opacity', 1).css('cursor', 'pointer');
                $('#voice-id-prompt').text('AUTHENTICATED!');
            }
        })
        .catch((error) => {
            console.log(error);
            $('#voice-id-prompt').text('auth failed');
            $('#loading-image').css('display', 'none');
        });
}