Finally, we call the InitializeChatEventHandlers function, passing in the env object, to initialize the event handlers for the live chat feature:
The InitializeChatEventHandlers function is responsible for setting up all the event listeners required by the live chat feature. There are two controls that require user interaction. The first is the message input field, where the user types and sends their questions by hitting the Enter key. The second is the close button, the X, that's found on the upper right hand corner of the chat box, used to close the live chat feature.
To handle the user interaction with the message input field, we set up the keypress event listener, which ...