in customer/src/customer/index.js [53:100]
$('#contactDetails').submit(function(e) {
e.preventDefault();
var customerName = $('#firstName').val();
var username = $('#username').val();
if (!customerName || !username) {
alert('you must enter a name & username');
document.getElementById('contactDetails').reset();
} else {
document.getElementById('contactDetails').reset();
connect.ChatInterface.initiateChat(
{
name: customerName,
username: username,
region: AWS_REGION,
apiGatewayEndpoint: API_GATEWAY_ENDPOINT,
contactAttributes: JSON.stringify({
customerName: customerName,
}),
contactFlowId: CONTACT_FLOW_ID,
instanceId: INSTANCE_ID,
},
successHandler,
failureHandler
);
$('#firstName').blur();
$('#username').blur();
const endChatEl = document.getElementById('startChat')
setTimeout(() => {
const xEl = document.querySelector('.sc-eHgmQL.kBXJGC.sc-gzVnrw.bsduuv')
xEl.addEventListener('click', () => {
endChatEl.value = "Speak to an agent"
})
}, 1000)
endChatEl.disabled = true;
endChatEl.value = "End chat";
document.getElementById('firstName').disabled = true;
document.getElementById('username').disabled = true;
$('#nav').css('width', '1063');
$('#chatWrapper').hide();
$('#section-chat').show('slide');
$('#section-chat').draggable({
handle: '.header-wrapper',
});
$('#divSpinner')
.delay(310)
.fadeIn();
}
});