in src/components/Chat/ChatTranscriptor/ChatMessages/ChatMessage.js [161:199]
render() {
let {direction, error} = this.props.messageDetails.transportDetails;
const messageStyle = direction === Direction.Outgoing ? this.props.outgoingMsgStyle : this.props.incomingMsgStyle;
//Hack to simulate ChatJS response with attachment content types
const bodyStyleConfig = {};
if (this.props.isLatestMessage &&
this.props.messageDetails.content.type === ContentType.MESSAGE_CONTENT_TYPE.INTERACTIVE_MESSAGE) {
bodyStyleConfig.hideDirectionArrow = true;
bodyStyleConfig.removePadding = true;
}
let content, contentType;
if (this.props.messageDetails.type === ATTACHMENT_MESSAGE) {
//Use Attachments data as content if available
//If an attachment message does not have this data, it means the upload was rejected
if (this.props.messageDetails.Attachments && this.props.messageDetails.Attachments.length > 0) {
content = this.props.messageDetails.Attachments[0];
contentType = content.ContentType;
} else {
content = {
AttachmentName: this.props.messageDetails.content.name
};
contentType = this.props.messageDetails.content.type
}
} else {
content = this.props.messageDetails.content.data;
contentType = this.props.messageDetails.content.type
}
return (
<React.Fragment>
<Header>{this.renderHeader()}</Header>
<Body direction={direction} messageStyle={messageStyle} {...bodyStyleConfig}>
{this.renderContent(content, contentType)}
</Body>
{error && this.renderTransportError(error)}
</React.Fragment>
);
}