Toggles the visibility of the chat modal based on the current state and event settings.
Param: options
The options for the clickChat function.
Param: options.isMessagesModalVisible
Indicates if the messages modal is currently visible.
Param: options.updateIsMessagesModalVisible
Function to update the visibility state of the messages modal.
Param: options.chatSetting
The chat setting for the event, which can be "allow" or other values.
Param: options.islevel
The participant's level, where "2" indicates a level that allows chat.
Param: options.showAlert
Optional function to show an alert message.
Returns
A promise that resolves when the operation is complete.
Remarks
This function checks the current visibility state of the messages modal. If it is already visible, it will hide the modal.
If it is not visible, it checks the chat settings and the participant's level to determine whether to show an alert
indicating that chat is disabled or to display the chat modal.
Example
constoptions: ClickChatOptions = { isMessagesModalVisible:false, updateIsMessagesModalVisible: (visible) =>console.log(`Modal is now ${visible?'visible':'hidden'}`), chatSetting:'allow', islevel:'1', showAlert: (alert) =>console.log(`Alert: ${alert.message}`), };
Toggles the visibility of the chat modal based on the current state and event settings.
Param: options
The options for the clickChat function.
Param: options.isMessagesModalVisible
Indicates if the messages modal is currently visible.
Param: options.updateIsMessagesModalVisible
Function to update the visibility state of the messages modal.
Param: options.chatSetting
The chat setting for the event, which can be "allow" or other values.
Param: options.islevel
The participant's level, where "2" indicates a level that allows chat.
Param: options.showAlert
Optional function to show an alert message.
Returns
A promise that resolves when the operation is complete.
Remarks
This function checks the current visibility state of the messages modal. If it is already visible, it will hide the modal. If it is not visible, it checks the chat settings and the participant's level to determine whether to show an alert indicating that chat is disabled or to display the chat modal.
Example