diff --git a/src/components/Input/index.js b/src/components/Input/index.js index 5ca888d..2b24799 100644 --- a/src/components/Input/index.js +++ b/src/components/Input/index.js @@ -8,6 +8,7 @@ import { safeArrayOfItem } from 'helpers' import Menu from 'components/Menu' import MenuSVG from 'components/svgs/menu' import './style.scss' +import { pathOr } from 'ramda' // Number of minimum char to display the char limit. const NUMBER_BEFORE_LIMIT = 5 @@ -106,7 +107,8 @@ class Input extends Component { } sendMenuSelection = (action) => { if (action) { - this.props.onSubmit(action) + const title = pathOr(null, ['content', 'title'], action) + this.props.onSubmit(action, title) } } sendMessage = () => { @@ -115,7 +117,7 @@ class Input extends Component { this.props.onSubmit({ type: 'text', content, - }) + }, content.title) this.setState(prevState => { const historyValues = append(content, prevState.historyValues) const previousValues = append('', historyValues) diff --git a/src/components/Message/QuickReplies.js b/src/components/Message/QuickReplies.js index 1d31072..474046e 100644 --- a/src/components/Message/QuickReplies.js +++ b/src/components/Message/QuickReplies.js @@ -10,6 +10,7 @@ import { truncate, safeArrayOfItem, validButtonContent } from 'helpers' import Text from './Text' import { PrevArrow, NextArrow } from 'components/arrows' +import { pathOr } from 'ramda' class QuickReplies extends Component { state = { @@ -46,8 +47,9 @@ class QuickReplies extends Component { // then one button click has already been send. if (!this._messageHasAlreadyBeenSent) { this._messageHasAlreadyBeenSent = true + const title = pathOr(null, ['content', 'title'], message) this.setState({ displayQuickReplies: false }, () => { - this.props.sendMessage(message) + this.props.sendMessage(message, title) }) } } diff --git a/src/containers/Chat/index.js b/src/containers/Chat/index.js index 3836878..fa6061b 100644 --- a/src/containers/Chat/index.js +++ b/src/containers/Chat/index.js @@ -253,7 +253,7 @@ class Chat extends Component { } this.setState( - prevState => ({ messages: concat(prevState.messages, [backendMessage]) }), + prevState => ({ messages: concat(prevState.messages, [userMessage || backendMessage]) }), () => { if (sendMessagePromise) { addUserMessage(userMessage || backendMessage)