in src/components/Widget/index.js [733:773]
dispatchMessage(message) {
if (Object.keys(message).length === 0) {
return;
}
const { customCss, ...messageClean } = message;
if (isText(messageClean)) {
this.props.dispatch(addResponseMessage(messageClean.text));
} else if (isButtons(messageClean)) {
this.props.dispatch(addButtons(messageClean));
} else if (isCarousel(messageClean)) {
this.props.dispatch(
addCarousel(messageClean)
);
} else if (isVideo(messageClean)) {
const element = messageClean.attachment.payload;
this.props.dispatch(
addVideoSnippet({
title: element.title,
video: element.src
})
);
} else if (isImage(messageClean)) {
const element = messageClean.attachment.payload;
this.props.dispatch(
addImageSnippet({
title: element.title,
image: element.src
})
);
} else {
// some custom message
const props = messageClean;
if (this.props.customComponent) {
this.props.dispatch(renderCustomComponent(this.props.customComponent, props, true));
}
}
if (customCss) {
this.props.dispatch(setCustomCss(message.customCss));
}
}