function updateGUI()

in website-creator/js/voiceid.js [35:60]


function updateGUI(msg) {
    for (var key in msg) {
        if (msg.hasOwnProperty(key)) {
            if (key === 'VoiceIDAuthStatus') {
                $('#voice-id-prompt').text(msg[key]['value']);
                if (msg[key]['value'] === 'Not enrolled') {
                    $('#voice-id-prompt').text('NOT ENROLLED! Click on Enroll button to enroll the customer');
                    $('#register-voice-id').prop('disabled', false).css('opacity', 1).css('cursor', 'pointer');
                    $('#evaluate-voice-id').prop('disabled', false).css('opacity', 1).css('cursor', 'pointer');
                } else if (msg[key]['value'] === 'Not Authenticated' || msg[key]['value'] === 'Inconclusive' || msg[key]['value'] === 'Error') {
                    $('#voice-id-prompt').text(msg[key]['value'].toUpperCase() + '! Please try again');
                    $('#evaluate-voice-id').prop('disabled', false).css('opacity', 1).css('cursor', 'pointer');
                } else if (msg[key]['value'] === 'Authenticated') {
                    $('#voice-id-prompt').text('AUTHENTICATED!');
                    $('#evaluate-voice-id').prop('disabled', false).css('opacity', 1).css('cursor', 'pointer');
                    $('#opt-out').prop('disabled', false).css('opacity', 1).css('cursor', 'pointer');
                } else if (msg[key]['value'] === 'Opted Out') {
                    $('#voice-id-prompt').text('The caller has opted out of voice authentication.');
                    $('#register-voice-id').prop('disabled', true).css('opacity', 0.5).css('cursor', 'default');
                    $('#evaluate-voice-id').prop('disabled', true).css('opacity', 0.5).css('cursor', 'default');
                    $('#opt-out').prop('disabled', true).css('opacity', 0.5).css('cursor', 'default');
                }
            }
        }
    }
}