@botonic/react
Version:
Build Chatbots using React
21 lines • 1.54 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessageFooter = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const index_types_1 = require("../../index-types");
const context_1 = require("../../webchat/context");
const message_feedback_1 = require("./message-feedback");
const styles_1 = require("./styles");
const timestamps_1 = require("./timestamps");
const MessageFooter = ({ enabletimestamps, messageJSON, sentBy, feedbackEnabled, inferenceId, botInteractionId, }) => {
const { getThemeProperty } = (0, react_1.useContext)(context_1.WebchatContext);
const { timestampsEnabled, timestampStyle } = (0, timestamps_1.resolveMessageTimestamps)(getThemeProperty, enabletimestamps);
const isSentByUser = sentBy === index_types_1.SENDERS.user;
const messageFooterClass = isSentByUser
? 'message-footer-user'
: 'message-footer-bot';
return ((0, jsx_runtime_1.jsxs)(styles_1.MessageFooterContainer, Object.assign({ className: messageFooterClass, isSentByUser: isSentByUser }, { children: [timestampsEnabled ? ((0, jsx_runtime_1.jsx)(timestamps_1.MessageTimestamp, { sentBy: sentBy, style: timestampStyle, timestamp: messageJSON.timestamp })) : null, feedbackEnabled ? ((0, jsx_runtime_1.jsx)(message_feedback_1.MessageFeedback, { inferenceId: inferenceId, messageId: messageJSON.id, botInteractionId: botInteractionId })) : null] })));
};
exports.MessageFooter = MessageFooter;
//# sourceMappingURL=message-footer.js.map
;