handleMessageSubmit()

in src/components/Widget/index.js [775:791]


  handleMessageSubmit(event) {
    event.preventDefault();
    const userUttered = event.target.message.value;

    if (userUttered && userUttered.trim()) {
      const result = userUttered.replace(/(?:start[_]?flows?|set[_]?slots?)\([^)]*\)/gi, '');
      this.props.dispatch(addUserMessage(result));
      this.props.dispatch(emitUserMessage(result));
      // Mark that first chat has started
      this.props.dispatch(setFirstChatStarted());
      // Set bot processing state when user sends a message
      this.props.dispatch(setBotProcessing(true));
      // Start 30-second timeout to reset bot processing if backend hangs
      startBotProcessingTimeout(this.props.dispatch);
    }
    event.target.message.value = '';
  }