@zohoim/chat-components 0.0.1-cx
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/es/ActionIcon/ActionIcon.js +82 -0
- package/es/ActionIcon/css/ActionIcon.module.css +8 -0
- package/es/ActionIcon/index.js +1 -0
- package/es/ActionIcon/props/defaultProps.js +8 -0
- package/es/ActionIcon/props/propTypes.js +17 -0
- package/es/ActionIconWrapper/ActionIconWrapper.js +61 -0
- package/es/ActionIconWrapper/css/ActionIconWrapper.module.css +32 -0
- package/es/ActionIconWrapper/css/cssJSLogic.js +14 -0
- package/es/ActionIconWrapper/index.js +1 -0
- package/es/ActionIconWrapper/props/defaultProps.js +6 -0
- package/es/ActionIconWrapper/props/propTypes.js +12 -0
- package/es/AttachmentBubble/AttachmentBubble.js +87 -0
- package/es/AttachmentBubble/css/AttachmentBubble.module.css +55 -0
- package/es/AttachmentBubble/css/cssJSLogic.js +18 -0
- package/es/AttachmentBubble/index.js +1 -0
- package/es/AttachmentBubble/props/defaultProps.js +8 -0
- package/es/AttachmentBubble/props/propTypes.js +19 -0
- package/es/AttachmentBubbleInfo/AttachmentBubbleInfo.js +48 -0
- package/es/AttachmentBubbleInfo/css/AttachmentBubbleInfo.module.css +39 -0
- package/es/AttachmentBubbleInfo/css/cssJSLogic.js +13 -0
- package/es/AttachmentBubbleInfo/index.js +1 -0
- package/es/AttachmentBubbleInfo/props/defaultProps.js +6 -0
- package/es/AttachmentBubbleInfo/props/propTypes.js +9 -0
- package/es/AttachmentIcon/AttachmentIcon.js +60 -0
- package/es/AttachmentIcon/css/AttachmentIcon.module.css +8 -0
- package/es/AttachmentIcon/css/cssJSLogic.js +13 -0
- package/es/AttachmentIcon/index.js +1 -0
- package/es/AttachmentIcon/props/defaultProps.js +8 -0
- package/es/AttachmentIcon/props/propTypes.js +21 -0
- package/es/AttachmentIcon/utils/getAttachmentIconComponent.js +81 -0
- package/es/Audio/Audio.js +38 -0
- package/es/Audio/css/Audio.module.css +7 -0
- package/es/Audio/index.js +1 -0
- package/es/Audio/props/defaultProps.js +6 -0
- package/es/Audio/props/propTypes.js +8 -0
- package/es/AudioBubble/AudioBubble.js +56 -0
- package/es/AudioBubble/css/AudioBubble.module.css +4 -0
- package/es/AudioBubble/index.js +1 -0
- package/es/AudioBubble/props/defaultProps.js +7 -0
- package/es/AudioBubble/props/propTypes.js +16 -0
- package/es/Fonts/puviFont.module.css +62 -0
- package/es/ImageBubble/ImageBubble.js +70 -0
- package/es/ImageBubble/css/ImageBubble.module.css +63 -0
- package/es/ImageBubble/css/cssJSLogic.js +15 -0
- package/es/ImageBubble/index.js +1 -0
- package/es/ImageBubble/props/defaultProps.js +6 -0
- package/es/ImageBubble/props/propTypes.js +13 -0
- package/es/LazyLoadImage/LazyLoadImage.js +37 -0
- package/es/LazyLoadImage/css/LazyLoadImage.module.css +5 -0
- package/es/LazyLoadImage/index.js +1 -0
- package/es/LazyLoadImage/props/defaultProps.js +6 -0
- package/es/LazyLoadImage/props/propTypes.js +8 -0
- package/es/LocationBubble/LocationBubble.js +62 -0
- package/es/LocationBubble/css/LocationBubble.module.css +57 -0
- package/es/LocationBubble/css/cssJSLogic.js +13 -0
- package/es/LocationBubble/images/location.png +0 -0
- package/es/LocationBubble/index.js +1 -0
- package/es/LocationBubble/props/defaultProps.js +6 -0
- package/es/LocationBubble/props/propTypes.js +8 -0
- package/es/MediaBubbleWrapper/MediaBubbleWrapper.js +62 -0
- package/es/MediaBubbleWrapper/css/MediaBubbleWrapper.module.css +7 -0
- package/es/MediaBubbleWrapper/index.js +1 -0
- package/es/MediaBubbleWrapper/props/defaultProps.js +7 -0
- package/es/MediaBubbleWrapper/props/propTypes.js +17 -0
- package/es/Message/Message.js +126 -0
- package/es/Message/index.js +1 -0
- package/es/Message/props/defaultProps.js +12 -0
- package/es/Message/props/propTypes.js +41 -0
- package/es/MessageAction/MessageAction.js +60 -0
- package/es/MessageAction/index.js +1 -0
- package/es/MessageAction/props/defaultProps.js +8 -0
- package/es/MessageAction/props/propTypes.js +21 -0
- package/es/MessageActions/MessageActions.js +120 -0
- package/es/MessageActions/css/MessageActions.module.css +24 -0
- package/es/MessageActions/index.js +1 -0
- package/es/MessageActions/props/defaultProps.js +10 -0
- package/es/MessageActions/props/propTypes.js +25 -0
- package/es/MessageActionsMore/MessageActionsMore.js +101 -0
- package/es/MessageActionsMore/css/MessageActionsMore.module.css +23 -0
- package/es/MessageActionsMore/index.js +1 -0
- package/es/MessageActionsMore/props/defaultProps.js +9 -0
- package/es/MessageActionsMore/props/propTypes.js +13 -0
- package/es/MessageActionsWrapper/MessageActionsWrapper.js +68 -0
- package/es/MessageActionsWrapper/css/MessageActionsWrapper.module.css +3 -0
- package/es/MessageActionsWrapper/index.js +1 -0
- package/es/MessageActionsWrapper/props/defaultProps.js +9 -0
- package/es/MessageActionsWrapper/props/propTypes.js +15 -0
- package/es/MessageAvatar/MessageAvatar.js +49 -0
- package/es/MessageAvatar/css/MessageAvatar.module.css +23 -0
- package/es/MessageAvatar/index.js +1 -0
- package/es/MessageAvatar/props/defaultProps.js +7 -0
- package/es/MessageAvatar/props/propTypes.js +13 -0
- package/es/MessageBox/MessageBox.js +66 -0
- package/es/MessageBox/css/MessageBox.module.css +56 -0
- package/es/MessageBox/css/cssJSLogic.js +18 -0
- package/es/MessageBox/index.js +1 -0
- package/es/MessageBox/props/defaultProps.js +6 -0
- package/es/MessageBox/props/propTypes.js +13 -0
- package/es/MessageBubble/MessageBubble.js +116 -0
- package/es/MessageBubble/css/MessageBubble.module.css +101 -0
- package/es/MessageBubble/css/cssJSLogic.js +34 -0
- package/es/MessageBubble/index.js +1 -0
- package/es/MessageBubble/props/defaultProps.js +11 -0
- package/es/MessageBubble/props/propTypes.js +17 -0
- package/es/MessageStatus/MessageStatus.js +77 -0
- package/es/MessageStatus/css/MessageStatus.module.css +17 -0
- package/es/MessageStatus/css/cssJSLogic.js +26 -0
- package/es/MessageStatus/index.js +1 -0
- package/es/MessageStatus/props/defaultProps.js +6 -0
- package/es/MessageStatus/props/propTypes.js +12 -0
- package/es/MoreActionItem/MoreActionItem.js +72 -0
- package/es/MoreActionItem/css/MoreActionItem.module.css +27 -0
- package/es/MoreActionItem/index.js +1 -0
- package/es/MoreActionItem/props/defaultProps.js +7 -0
- package/es/MoreActionItem/props/propTypes.js +14 -0
- package/es/ReplyBubble/ReplyBubble.js +118 -0
- package/es/ReplyBubble/css/ReplyBubble.module.css +23 -0
- package/es/ReplyBubble/css/cssJSLogic.js +14 -0
- package/es/ReplyBubble/index.js +1 -0
- package/es/ReplyBubble/props/defaultProps.js +8 -0
- package/es/ReplyBubble/props/propTypes.js +28 -0
- package/es/ReplyBubbleContent/ReplyBubbleContent.js +61 -0
- package/es/ReplyBubbleContent/css/ReplyBubbleContent.module.css +75 -0
- package/es/ReplyBubbleContent/css/cssJSLogic.js +13 -0
- package/es/ReplyBubbleContent/index.js +1 -0
- package/es/ReplyBubbleContent/props/defaultProps.js +6 -0
- package/es/ReplyBubbleContent/props/propTypes.js +11 -0
- package/es/ReplyBubbleHeader/ReplyBubbleHeader.js +74 -0
- package/es/ReplyBubbleHeader/css/ReplyBubbleHeader.module.css +44 -0
- package/es/ReplyBubbleHeader/css/cssJSLogic.js +12 -0
- package/es/ReplyBubbleHeader/index.js +1 -0
- package/es/ReplyBubbleHeader/props/defaultProps.js +7 -0
- package/es/ReplyBubbleHeader/props/propTypes.js +13 -0
- package/es/TextBubble/TextBubble.js +49 -0
- package/es/TextBubble/css/TextBubble.module.css +35 -0
- package/es/TextBubble/css/cssJSLogic.js +18 -0
- package/es/TextBubble/index.js +1 -0
- package/es/TextBubble/props/defaultProps.js +6 -0
- package/es/TextBubble/props/propTypes.js +10 -0
- package/es/Theme/ThemeAssets.js +78 -0
- package/es/Theme/ThemeWrapper.js +88 -0
- package/es/Theme/TooltipWrapper.js +85 -0
- package/es/Theme/constants/index.js +41 -0
- package/es/Theme/css/TooltipWrapper.module.css +10 -0
- package/es/Theme/index.js +1 -0
- package/es/Theme/props/defaultProps.js +10 -0
- package/es/Theme/props/propTypes.js +14 -0
- package/es/Theme/themeVariables/commonThemeColorVariable.js +17 -0
- package/es/Theme/themeVariables/dark/blueTheme.js +116 -0
- package/es/Theme/themeVariables/dark/commonColorVariable.js +16 -0
- package/es/Theme/themeVariables/dark/greenTheme.js +115 -0
- package/es/Theme/themeVariables/dark/orangeTheme.js +115 -0
- package/es/Theme/themeVariables/dark/redTheme.js +115 -0
- package/es/Theme/themeVariables/dark/yellowTheme.js +115 -0
- package/es/Theme/themeVariables/light/blueTheme.js +114 -0
- package/es/Theme/themeVariables/light/commonColorVariable.js +35 -0
- package/es/Theme/themeVariables/light/greenTheme.js +114 -0
- package/es/Theme/themeVariables/light/orangeTheme.js +114 -0
- package/es/Theme/themeVariables/light/redTheme.js +114 -0
- package/es/Theme/themeVariables/light/yellowTheme.js +114 -0
- package/es/Theme/themeVariables/pureDark/blueTheme.js +115 -0
- package/es/Theme/themeVariables/pureDark/commonColorVariable.js +18 -0
- package/es/Theme/themeVariables/pureDark/greenTheme.js +115 -0
- package/es/Theme/themeVariables/pureDark/orangeTheme.js +115 -0
- package/es/Theme/themeVariables/pureDark/redTheme.js +115 -0
- package/es/Theme/themeVariables/pureDark/yellowTheme.js +115 -0
- package/es/Theme/utils/combineConfigurations.js +17 -0
- package/es/Theme/utils/flatVariables.js +12 -0
- package/es/Theme/utils/getCustomizedCssVariables.js +19 -0
- package/es/Theme/utils/getThemeConfigurations.js +81 -0
- package/es/Theme/utils/getWrapperDivProps.js +16 -0
- package/es/Video/Video.js +38 -0
- package/es/Video/css/Video.module.css +5 -0
- package/es/Video/index.js +1 -0
- package/es/Video/props/defaultProps.js +6 -0
- package/es/Video/props/propTypes.js +8 -0
- package/es/VideoBubble/VideoBubble.js +66 -0
- package/es/VideoBubble/css/VideoBubble.module.css +12 -0
- package/es/VideoBubble/css/cssJSLogic.js +14 -0
- package/es/VideoBubble/index.js +1 -0
- package/es/VideoBubble/props/defaultProps.js +7 -0
- package/es/VideoBubble/props/propTypes.js +17 -0
- package/es/constants/index.js +1 -0
- package/es/css/common.module.css +6 -0
- package/es/icons/create-icon-components.js +172 -0
- package/es/icons/factory/attachments/audio.svg +19 -0
- package/es/icons/factory/attachments/code.svg +21 -0
- package/es/icons/factory/attachments/image.svg +20 -0
- package/es/icons/factory/attachments/pdf.svg +19 -0
- package/es/icons/factory/attachments/ppt.svg +1 -0
- package/es/icons/factory/attachments/text.svg +22 -0
- package/es/icons/factory/attachments/unknown.svg +21 -0
- package/es/icons/factory/attachments/video.svg +19 -0
- package/es/icons/factory/attachments/xls.svg +1 -0
- package/es/icons/factory/attachments/zip.svg +27 -0
- package/es/icons/factory/common/alertTriangle.svg +5 -0
- package/es/icons/factory/common/article.svg +4 -0
- package/es/icons/factory/common/reply.svg +6 -0
- package/es/icons/factory/messageStatus/clock.svg +7 -0
- package/es/icons/factory/messageStatus/doubleTick.svg +1 -0
- package/es/icons/factory/messageStatus/failed.svg +7 -0
- package/es/icons/factory/messageStatus/tick.svg +1 -0
- package/es/icons/icon.template.js +28 -0
- package/es/icons/iconSrc/attachments/Audio.js +38 -0
- package/es/icons/iconSrc/attachments/Code.js +44 -0
- package/es/icons/iconSrc/attachments/Image.js +43 -0
- package/es/icons/iconSrc/attachments/Pdf.js +38 -0
- package/es/icons/iconSrc/attachments/Ppt.js +26 -0
- package/es/icons/iconSrc/attachments/Text.js +47 -0
- package/es/icons/iconSrc/attachments/Txt.js +47 -0
- package/es/icons/iconSrc/attachments/Unknown.js +42 -0
- package/es/icons/iconSrc/attachments/Video.js +38 -0
- package/es/icons/iconSrc/attachments/Xls.js +26 -0
- package/es/icons/iconSrc/attachments/Zip.js +86 -0
- package/es/icons/iconSrc/attachments/index.js +10 -0
- package/es/icons/iconSrc/common/AlertTriangle.js +23 -0
- package/es/icons/iconSrc/common/Article.js +17 -0
- package/es/icons/iconSrc/common/Reply.js +13 -0
- package/es/icons/iconSrc/common/index.js +3 -0
- package/es/icons/iconSrc/messageStatus/Clock.js +14 -0
- package/es/icons/iconSrc/messageStatus/DoubleTick.js +16 -0
- package/es/icons/iconSrc/messageStatus/Failed.js +14 -0
- package/es/icons/iconSrc/messageStatus/Tick.js +13 -0
- package/es/icons/iconSrc/messageStatus/index.js +4 -0
- package/es/im/ArticleBubble/ArticleBubble.js +80 -0
- package/es/im/ArticleBubble/css/ArticleBubble.module.css +75 -0
- package/es/im/ArticleBubble/css/cssJSLogic.js +12 -0
- package/es/im/ArticleBubble/index.js +1 -0
- package/es/im/ArticleBubble/props/defaultProps.js +6 -0
- package/es/im/ArticleBubble/props/propTypes.js +14 -0
- package/es/im/IMIntegrationIcon/IMIntegrationIcon.js +73 -0
- package/es/im/IMIntegrationIcon/css/IMIntegrationIcon.module.css +72 -0
- package/es/im/IMIntegrationIcon/css/cssJSLogic.js +53 -0
- package/es/im/IMIntegrationIcon/index.js +1 -0
- package/es/im/IMIntegrationIcon/props/defaultProps.js +11 -0
- package/es/im/IMIntegrationIcon/props/propTypes.js +14 -0
- package/es/im/IMMessage/IMMessage.js +197 -0
- package/es/im/IMMessage/css/IMMessage.module.css +36 -0
- package/es/im/IMMessage/css/cssJSLogic.js +15 -0
- package/es/im/IMMessage/index.js +1 -0
- package/es/im/IMMessage/props/defaultProps.js +16 -0
- package/es/im/IMMessage/props/propTypes.js +126 -0
- package/es/im/IMMessageContent/IMMessageContent.js +128 -0
- package/es/im/IMMessageContent/css/IMMessageContent.module.css +8 -0
- package/es/im/IMMessageContent/index.js +1 -0
- package/es/im/IMMessageContent/props/defaultProps.js +9 -0
- package/es/im/IMMessageContent/props/propTypes.js +54 -0
- package/es/im/IMMessageMeta/IMMessageMeta.js +72 -0
- package/es/im/IMMessageMeta/css/IMMessageMeta.module.css +46 -0
- package/es/im/IMMessageMeta/css/cssJSLogic.js +29 -0
- package/es/im/IMMessageMeta/index.js +1 -0
- package/es/im/IMMessageMeta/props/defaultProps.js +11 -0
- package/es/im/IMMessageMeta/props/propTypes.js +42 -0
- package/es/im/IMMessageMetaInfo/IMMessageMetaInfo.js +29 -0
- package/es/im/IMMessageMetaInfo/css/IMMessageMetaInfo.module.css +14 -0
- package/es/im/IMMessageMetaInfo/index.js +1 -0
- package/es/im/IMMessageMetaInfo/props/defaultProps.js +8 -0
- package/es/im/IMMessageMetaInfo/props/propTypes.js +8 -0
- package/es/im/IMPermaLink/IMPermaLink.js +48 -0
- package/es/im/IMPermaLink/css/IMPermaLink.module.css +14 -0
- package/es/im/IMPermaLink/css/cssJSLogic.js +14 -0
- package/es/im/IMPermaLink/index.js +1 -0
- package/es/im/IMPermaLink/props/defaultProps.js +6 -0
- package/es/im/IMPermaLink/props/propTypes.js +11 -0
- package/es/im/IMReplyBubble/IMReplyBubble.js +52 -0
- package/es/im/IMReplyBubble/index.js +1 -0
- package/es/im/IMReplyBubble/props/defaultProps.js +7 -0
- package/es/im/IMReplyBubble/props/propTypes.js +29 -0
- package/es/im/IMTextBubble/IMTextBubble.js +40 -0
- package/es/im/IMTextBubble/index.js +1 -0
- package/es/im/IMTextBubble/props/defaultProps.js +8 -0
- package/es/im/IMTextBubble/props/propTypes.js +31 -0
- package/es/im/css/common.module.css +6 -0
- package/es/im/index.js +9 -0
- package/es/index.js +32 -0
- package/package.json +49 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
/** ** Libraries *** */
|
|
4
|
+
import React, { useCallback, useMemo } from 'react';
|
|
5
|
+
/** ** Hooks *** */
|
|
6
|
+
|
|
7
|
+
import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
8
|
+
import useIMMessage from '@zohoim/chat-components-hooks/es/im/IMMessage/useIMMessage';
|
|
9
|
+
/** ** Methods *** */
|
|
10
|
+
|
|
11
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
12
|
+
/** ** Constants *** */
|
|
13
|
+
|
|
14
|
+
import imMessageDefaultProps from './props/defaultProps';
|
|
15
|
+
import imMessagePropTypes from './props/propTypes';
|
|
16
|
+
import { dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
|
|
17
|
+
/** ** Components *** */
|
|
18
|
+
|
|
19
|
+
import Message from '../../Message/Message';
|
|
20
|
+
import IMMessageContent from '../IMMessageContent/IMMessageContent';
|
|
21
|
+
import IMPermaLink from '../IMPermaLink/IMPermaLink';
|
|
22
|
+
import IMIntegrationIcon from '../IMIntegrationIcon/IMIntegrationIcon';
|
|
23
|
+
import IMMessageMeta from '../IMMessageMeta/IMMessageMeta';
|
|
24
|
+
/** ** Styles *** */
|
|
25
|
+
|
|
26
|
+
import style from './css/IMMessage.module.css';
|
|
27
|
+
export default function IMMessage(props) {
|
|
28
|
+
const {
|
|
29
|
+
defaultAvatarUrls,
|
|
30
|
+
messageDetails,
|
|
31
|
+
sessionDetails,
|
|
32
|
+
messageDisplayProps,
|
|
33
|
+
actions,
|
|
34
|
+
onSelectAction,
|
|
35
|
+
onMouseEnterAction,
|
|
36
|
+
replyText,
|
|
37
|
+
seeMoreText,
|
|
38
|
+
deleteMessageText,
|
|
39
|
+
messageBubbleTitleI18N,
|
|
40
|
+
messageStatusI18N,
|
|
41
|
+
messageMetaInfoI18N,
|
|
42
|
+
onLoadFullMessage,
|
|
43
|
+
onClickReply,
|
|
44
|
+
onTicketClick,
|
|
45
|
+
messageContentClickMapping,
|
|
46
|
+
customStyle,
|
|
47
|
+
customProps
|
|
48
|
+
} = props;
|
|
49
|
+
const {
|
|
50
|
+
messageProps = dummyObject,
|
|
51
|
+
imMessageContentProps = dummyObject,
|
|
52
|
+
imTicketLinkProps = dummyObject,
|
|
53
|
+
imIntegrationIconProps = dummyObject,
|
|
54
|
+
imMessageMetaProps = dummyObject
|
|
55
|
+
} = customProps;
|
|
56
|
+
const {
|
|
57
|
+
isHighlightMessage,
|
|
58
|
+
needSender,
|
|
59
|
+
isShowSender,
|
|
60
|
+
isShowMessageTime,
|
|
61
|
+
isShowMessageStatus,
|
|
62
|
+
needMessageActions,
|
|
63
|
+
isShowFullContent
|
|
64
|
+
} = messageDisplayProps;
|
|
65
|
+
const newStyle = useMergeStyle(style, customStyle);
|
|
66
|
+
const {
|
|
67
|
+
direction,
|
|
68
|
+
isIncoming,
|
|
69
|
+
isOutgoing,
|
|
70
|
+
// isBot,
|
|
71
|
+
senderSrc,
|
|
72
|
+
senderAlternateSrc,
|
|
73
|
+
senderName,
|
|
74
|
+
isShowIntegrationIcon,
|
|
75
|
+
integrationName,
|
|
76
|
+
// messageMetaType,
|
|
77
|
+
// messageType,
|
|
78
|
+
messageStatus,
|
|
79
|
+
isFailedMessage,
|
|
80
|
+
isSendingMessage,
|
|
81
|
+
messageStatusTitle,
|
|
82
|
+
isValidAttachment,
|
|
83
|
+
dateTimeDetails,
|
|
84
|
+
autoMessageType,
|
|
85
|
+
// messageId,
|
|
86
|
+
ticketId,
|
|
87
|
+
ticketNumber,
|
|
88
|
+
ticketUrl
|
|
89
|
+
} = useIMMessage({
|
|
90
|
+
defaultAvatarUrls,
|
|
91
|
+
messageDetails,
|
|
92
|
+
sessionDetails,
|
|
93
|
+
messageStatusI18N
|
|
94
|
+
});
|
|
95
|
+
/** ** Render Footer *** */
|
|
96
|
+
|
|
97
|
+
const handleRenderMessageBoxFooter = useCallback(() => {
|
|
98
|
+
const {
|
|
99
|
+
displayDateTime,
|
|
100
|
+
tooltip
|
|
101
|
+
} = dateTimeDetails || {};
|
|
102
|
+
return /*#__PURE__*/React.createElement(IMMessageMeta, _extends({
|
|
103
|
+
autoMessageType: autoMessageType,
|
|
104
|
+
direction: direction,
|
|
105
|
+
isValidAttachment: isValidAttachment,
|
|
106
|
+
messageMetaInfoI18N: messageMetaInfoI18N,
|
|
107
|
+
time: isShowMessageTime ? displayDateTime : '',
|
|
108
|
+
timeTooltip: tooltip
|
|
109
|
+
}, imMessageMetaProps));
|
|
110
|
+
}, [isShowMessageTime, dateTimeDetails, direction, autoMessageType, imMessageMetaProps, isValidAttachment, messageMetaInfoI18N]);
|
|
111
|
+
/** ** Render Message Content *** */
|
|
112
|
+
|
|
113
|
+
const handleRenderMessage = useCallback(() => /*#__PURE__*/React.createElement(IMMessageContent, _extends({
|
|
114
|
+
deleteMessageText: deleteMessageText,
|
|
115
|
+
isFailed: isFailedMessage,
|
|
116
|
+
isSending: isSendingMessage,
|
|
117
|
+
isShowFullContent: isShowFullContent,
|
|
118
|
+
messageBubbleTitleI18N: messageBubbleTitleI18N,
|
|
119
|
+
messageContentClickMapping: messageContentClickMapping,
|
|
120
|
+
messageDetails: messageDetails,
|
|
121
|
+
onClickReply: onClickReply,
|
|
122
|
+
onLoadFullMessage: onLoadFullMessage,
|
|
123
|
+
replyText: replyText,
|
|
124
|
+
seeMoreText: seeMoreText,
|
|
125
|
+
sessionDetails: sessionDetails
|
|
126
|
+
}, imMessageContentProps)), [seeMoreText, replyText, deleteMessageText, messageDetails, sessionDetails, messageContentClickMapping, messageBubbleTitleI18N, onLoadFullMessage, onClickReply, isFailedMessage, isSendingMessage, imMessageContentProps, isShowFullContent]);
|
|
127
|
+
/** ** Render Secondary Actions - TicketId *** */
|
|
128
|
+
|
|
129
|
+
const handleRenderSecondaryActions = useCallback(() => {
|
|
130
|
+
const {
|
|
131
|
+
imTicketLinkClass
|
|
132
|
+
} = cssJSLogic({
|
|
133
|
+
isIncoming,
|
|
134
|
+
isOutgoing
|
|
135
|
+
}, newStyle);
|
|
136
|
+
const customStyle = {
|
|
137
|
+
text: imTicketLinkClass
|
|
138
|
+
};
|
|
139
|
+
return /*#__PURE__*/React.createElement(IMPermaLink, _extends({
|
|
140
|
+
customStyle: customStyle,
|
|
141
|
+
href: ticketUrl,
|
|
142
|
+
id: ticketId,
|
|
143
|
+
onClick: onTicketClick,
|
|
144
|
+
text: ticketNumber ? `#${ticketNumber}` : ''
|
|
145
|
+
}, imTicketLinkProps));
|
|
146
|
+
}, [ticketNumber, ticketUrl, ticketId, onTicketClick, imTicketLinkProps, newStyle, isIncoming, isOutgoing]);
|
|
147
|
+
/** ** Render Owner Status Icon *** */
|
|
148
|
+
|
|
149
|
+
const handleRenderIntegIcon = useCallback(() => /*#__PURE__*/React.createElement(IMIntegrationIcon, _extends({
|
|
150
|
+
integrationName: isShowIntegrationIcon ? integrationName : ''
|
|
151
|
+
}, imIntegrationIconProps)), [isShowIntegrationIcon, integrationName, imIntegrationIconProps]);
|
|
152
|
+
/** ** Construct Owner Details *** */
|
|
153
|
+
|
|
154
|
+
const ownerDetails = useMemo(() => ({
|
|
155
|
+
src: senderSrc,
|
|
156
|
+
alternateSrc: senderAlternateSrc,
|
|
157
|
+
name: senderName
|
|
158
|
+
}), [senderSrc, senderAlternateSrc, senderName]);
|
|
159
|
+
/** ** Construct Custom Props With default Footer *** */
|
|
160
|
+
|
|
161
|
+
const messageCustomProps = useMemo(() => {
|
|
162
|
+
const {
|
|
163
|
+
customProps
|
|
164
|
+
} = messageProps || dummyObject;
|
|
165
|
+
const {
|
|
166
|
+
messageBubbleProps = dummyObject
|
|
167
|
+
} = customProps || dummyObject;
|
|
168
|
+
return { ...messageProps,
|
|
169
|
+
customProps: { ...customProps,
|
|
170
|
+
messageBubbleProps: {
|
|
171
|
+
renderMessageBoxFooter: handleRenderMessageBoxFooter,
|
|
172
|
+
...messageBubbleProps
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}, [messageProps, handleRenderMessageBoxFooter]);
|
|
177
|
+
return /*#__PURE__*/React.createElement(Message, _extends({
|
|
178
|
+
actions: actions,
|
|
179
|
+
direction: direction,
|
|
180
|
+
isActive: isHighlightMessage,
|
|
181
|
+
isShowMessageStatus: isShowMessageStatus,
|
|
182
|
+
isShowSender: isShowSender,
|
|
183
|
+
needMessageActions: needMessageActions,
|
|
184
|
+
needSender: needSender,
|
|
185
|
+
onMouseEnterAction: onMouseEnterAction,
|
|
186
|
+
onSelectAction: onSelectAction,
|
|
187
|
+
ownerDetails: ownerDetails,
|
|
188
|
+
renderContent: handleRenderMessage,
|
|
189
|
+
renderOwnerStatusIcon: handleRenderIntegIcon,
|
|
190
|
+
renderSecondaryActions: handleRenderSecondaryActions,
|
|
191
|
+
status: messageStatus,
|
|
192
|
+
statusTooltip: messageStatusTitle
|
|
193
|
+
}, messageCustomProps));
|
|
194
|
+
}
|
|
195
|
+
IMMessage.propTypes = imMessagePropTypes;
|
|
196
|
+
IMMessage.defaultProps = imMessageDefaultProps;
|
|
197
|
+
IMMessage.displayName = 'IMMessage';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.varClass {
|
|
2
|
+
--imTicketLink-top_gap: var(--zd_size5);
|
|
3
|
+
--imTicketLink-font_size: var(--zd_font_size12);
|
|
4
|
+
--imTicketLink-max_width: var(--zd_size150);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ticketLink {
|
|
8
|
+
composes: varClass;
|
|
9
|
+
font-size: var(--imTicketLink-font_size);
|
|
10
|
+
max-width: var(--imTicketLink-max_width);
|
|
11
|
+
margin-top: var(--imTicketLink-top_gap);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ticketLinkRight {
|
|
15
|
+
composes: ticketLink;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
[dir=ltr] .ticketLinkRight {
|
|
19
|
+
text-align: left;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[dir=rtl] .ticketLinkRight {
|
|
23
|
+
text-align: right;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ticketLinkLeft {
|
|
27
|
+
composes: ticketLink;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[dir=ltr] .ticketLinkLeft {
|
|
31
|
+
text-align: right;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
[dir=rtl] .ticketLinkLeft {
|
|
35
|
+
text-align: left;
|
|
36
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** ** Methods *** */
|
|
2
|
+
import { compileClassNames } from '@zohodesk/utils';
|
|
3
|
+
export default function cssJSLogic(props, style) {
|
|
4
|
+
const {
|
|
5
|
+
isIncoming,
|
|
6
|
+
isOutgoing
|
|
7
|
+
} = props;
|
|
8
|
+
const imTicketLinkClass = compileClassNames({
|
|
9
|
+
[style.ticketLinkLeft]: isOutgoing,
|
|
10
|
+
[style.ticketLinkRight]: isIncoming
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
imTicketLinkClass
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as IMMessage } from './IMMessage';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// import React from 'react';
|
|
2
|
+
|
|
3
|
+
/** ** Constants *** */
|
|
4
|
+
import { dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
|
|
5
|
+
const imMessageDefaultProps = {
|
|
6
|
+
messageDetails: dummyObject,
|
|
7
|
+
sessionDetails: dummyObject,
|
|
8
|
+
messageStatusI18N: dummyObject,
|
|
9
|
+
messageBubbleTitleI18N: dummyObject,
|
|
10
|
+
messageMetaInfoI18N: dummyObject,
|
|
11
|
+
customProps: dummyObject,
|
|
12
|
+
customStyle: dummyObject,
|
|
13
|
+
messageDisplayProps: dummyObject,
|
|
14
|
+
messageContentClickMapping: dummyObject
|
|
15
|
+
};
|
|
16
|
+
export default imMessageDefaultProps;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
/** ** Constants *** */
|
|
4
|
+
|
|
5
|
+
import { defaultMessageActions } from '@zohoim/chat-components-utils/es/constants/messageActionConstants';
|
|
6
|
+
import messageStatusConstants from '@zohoim/chat-components-utils/es/constants/messageStatusConstants';
|
|
7
|
+
import autoMessageTypes from '@zohoim/chat-components-utils/es/imUtils/constants/autoMessageTypes';
|
|
8
|
+
const {
|
|
9
|
+
WELCOMEMSG,
|
|
10
|
+
WORKFLOW_MESSAGE,
|
|
11
|
+
WORKFLOW_NOTIFICATION,
|
|
12
|
+
UN_SUPPORTED_FILE
|
|
13
|
+
} = autoMessageTypes;
|
|
14
|
+
const {
|
|
15
|
+
SENT,
|
|
16
|
+
SAVED,
|
|
17
|
+
QUEUED,
|
|
18
|
+
DELIVERED,
|
|
19
|
+
READ,
|
|
20
|
+
UNSENT,
|
|
21
|
+
FAILED,
|
|
22
|
+
OUTGOING
|
|
23
|
+
} = messageStatusConstants;
|
|
24
|
+
const imMessagePropTypes = {
|
|
25
|
+
messageDetails: PropTypes.shape({
|
|
26
|
+
displayMessage: PropTypes.string.isRequired,
|
|
27
|
+
actor: PropTypes.shape({
|
|
28
|
+
contactName: PropTypes.string,
|
|
29
|
+
externalId: PropTypes.string,
|
|
30
|
+
name: PropTypes.string,
|
|
31
|
+
photoURL: PropTypes.string,
|
|
32
|
+
type: PropTypes.string
|
|
33
|
+
}),
|
|
34
|
+
attachment: PropTypes.string,
|
|
35
|
+
contentType: PropTypes.string,
|
|
36
|
+
dateTimeDetails: PropTypes.shape({
|
|
37
|
+
displayDateTime: PropTypes.string,
|
|
38
|
+
tooltip: PropTypes.string
|
|
39
|
+
}),
|
|
40
|
+
direction: PropTypes.string,
|
|
41
|
+
id: PropTypes.string,
|
|
42
|
+
isCustomMessage: PropTypes.bool,
|
|
43
|
+
layout: PropTypes.string,
|
|
44
|
+
locationUrl: PropTypes.string,
|
|
45
|
+
meta: PropTypes.shape({
|
|
46
|
+
DESK_TICKET_ID: PropTypes.string,
|
|
47
|
+
DESK_TICKET_NUMBER: PropTypes.string,
|
|
48
|
+
SYSTEM_MESSAGE_TYPE: PropTypes.string
|
|
49
|
+
}),
|
|
50
|
+
replyToMessage: PropTypes.object,
|
|
51
|
+
status: PropTypes.string,
|
|
52
|
+
type: PropTypes.string
|
|
53
|
+
}).isRequired,
|
|
54
|
+
sessionDetails: PropTypes.shape({
|
|
55
|
+
integrationService: PropTypes.string
|
|
56
|
+
}),
|
|
57
|
+
defaultAvatarUrls: PropTypes.shape({
|
|
58
|
+
autoMessageAvatar: PropTypes.string,
|
|
59
|
+
defaultAgentAvatar: PropTypes.string,
|
|
60
|
+
defaultContactAvatar: PropTypes.string
|
|
61
|
+
}),
|
|
62
|
+
messageDisplayProps: PropTypes.shape({
|
|
63
|
+
isHighlightMessage: PropTypes.bool,
|
|
64
|
+
isShowFullContent: PropTypes.bool,
|
|
65
|
+
isShowMessageStatus: PropTypes.bool,
|
|
66
|
+
isShowMessageTime: PropTypes.bool,
|
|
67
|
+
isShowSender: PropTypes.bool,
|
|
68
|
+
needMessageActions: PropTypes.bool,
|
|
69
|
+
needSender: PropTypes.bool
|
|
70
|
+
}),
|
|
71
|
+
messageStatusI18N: PropTypes.shape({
|
|
72
|
+
[DELIVERED]: PropTypes.string,
|
|
73
|
+
[FAILED]: PropTypes.string,
|
|
74
|
+
[OUTGOING]: PropTypes.string,
|
|
75
|
+
[QUEUED]: PropTypes.string,
|
|
76
|
+
[READ]: PropTypes.string,
|
|
77
|
+
[SAVED]: PropTypes.string,
|
|
78
|
+
[SENT]: PropTypes.string,
|
|
79
|
+
[UNSENT]: PropTypes.string
|
|
80
|
+
}),
|
|
81
|
+
messageBubbleTitleI18N: PropTypes.shape({
|
|
82
|
+
attachmentBubbleTitle: PropTypes.string
|
|
83
|
+
}),
|
|
84
|
+
messageMetaInfoI18N: PropTypes.shape({
|
|
85
|
+
autoMessagesI18N: PropTypes.shape({
|
|
86
|
+
[UN_SUPPORTED_FILE]: PropTypes.string,
|
|
87
|
+
[WELCOMEMSG]: PropTypes.string,
|
|
88
|
+
[WORKFLOW_MESSAGE]: PropTypes.string,
|
|
89
|
+
[WORKFLOW_NOTIFICATION]: PropTypes.string
|
|
90
|
+
}),
|
|
91
|
+
autoMessagesTitleI18N: PropTypes.shape({
|
|
92
|
+
[UN_SUPPORTED_FILE]: PropTypes.string,
|
|
93
|
+
[WELCOMEMSG]: PropTypes.string,
|
|
94
|
+
[WORKFLOW_MESSAGE]: PropTypes.string,
|
|
95
|
+
[WORKFLOW_NOTIFICATION]: PropTypes.string
|
|
96
|
+
}),
|
|
97
|
+
restrictedAttachmentMetaInfo: PropTypes.shape({
|
|
98
|
+
info: PropTypes.string,
|
|
99
|
+
title: PropTypes.string
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
actions: PropTypes.arrayOf(PropTypes.shape({
|
|
103
|
+
displayText: PropTypes.string.isRequired,
|
|
104
|
+
id: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf(Object.values(defaultMessageActions))]).isRequired,
|
|
105
|
+
iconTitle: PropTypes.string,
|
|
106
|
+
isDisabled: PropTypes.bool,
|
|
107
|
+
renderFunction: PropTypes.func
|
|
108
|
+
})),
|
|
109
|
+
onSelectAction: PropTypes.func,
|
|
110
|
+
onMouseEnterAction: PropTypes.func,
|
|
111
|
+
replyText: PropTypes.string,
|
|
112
|
+
seeMoreText: PropTypes.string,
|
|
113
|
+
deleteMessageText: PropTypes.string,
|
|
114
|
+
onLoadFullMessage: PropTypes.func,
|
|
115
|
+
onClickReply: PropTypes.func,
|
|
116
|
+
onTicketClick: PropTypes.func,
|
|
117
|
+
messageContentClickMapping: PropTypes.object,
|
|
118
|
+
customStyle: PropTypes.object,
|
|
119
|
+
customProps: PropTypes.shape({
|
|
120
|
+
imIntegrationIconProps: PropTypes.object,
|
|
121
|
+
imMessageContentProps: PropTypes.object,
|
|
122
|
+
imPermaLinkProps: PropTypes.object,
|
|
123
|
+
messageProps: PropTypes.object
|
|
124
|
+
})
|
|
125
|
+
};
|
|
126
|
+
export default imMessagePropTypes;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
/* eslint-disable react/jsx-indent */
|
|
4
|
+
|
|
5
|
+
/** ** Libraries *** */
|
|
6
|
+
import React, { Fragment } from 'react';
|
|
7
|
+
/** ** Hooks *** */
|
|
8
|
+
|
|
9
|
+
import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
10
|
+
import useIMMessageContent from '@zohoim/chat-components-hooks/es/im/IMMessageContent/useIMMessageContent';
|
|
11
|
+
/** ** Constants *** */
|
|
12
|
+
|
|
13
|
+
import imMessageContentDefaultProps from './props/defaultProps';
|
|
14
|
+
import imMessageContentPropTypes from './props/propTypes';
|
|
15
|
+
import { dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
|
|
16
|
+
/** ** Styles *** */
|
|
17
|
+
|
|
18
|
+
import style from './css/IMMessageContent.module.css';
|
|
19
|
+
/** ** Components *** */
|
|
20
|
+
|
|
21
|
+
import IMReplyBubble from '../IMReplyBubble/IMReplyBubble';
|
|
22
|
+
import IMTextBubble from '../IMTextBubble/IMTextBubble';
|
|
23
|
+
import LocationBubble from '../../LocationBubble/LocationBubble';
|
|
24
|
+
import ImageBubble from '../../ImageBubble/ImageBubble';
|
|
25
|
+
import VideoBubble from '../../VideoBubble/VideoBubble';
|
|
26
|
+
import AudioBubble from '../../AudioBubble/AudioBubble';
|
|
27
|
+
import AttachmentBubble from '../../AttachmentBubble/AttachmentBubble';
|
|
28
|
+
export default function IMMessageContent(props) {
|
|
29
|
+
const {
|
|
30
|
+
messageDetails,
|
|
31
|
+
sessionDetails,
|
|
32
|
+
onLoadFullMessage,
|
|
33
|
+
onClickReply,
|
|
34
|
+
seeMoreText,
|
|
35
|
+
replyText,
|
|
36
|
+
deleteMessageText,
|
|
37
|
+
customStyle,
|
|
38
|
+
customProps,
|
|
39
|
+
renderCustomMessage,
|
|
40
|
+
onClick: propOnClick,
|
|
41
|
+
isFailed,
|
|
42
|
+
isSending,
|
|
43
|
+
messageContentClickMapping,
|
|
44
|
+
messageBubbleTitleI18N,
|
|
45
|
+
isShowFullContent
|
|
46
|
+
} = props;
|
|
47
|
+
const {
|
|
48
|
+
imReplyBubbleProps = dummyObject,
|
|
49
|
+
imTextBubbleProps = dummyObject,
|
|
50
|
+
locationBubbleProps = dummyObject,
|
|
51
|
+
imageBubbleProps = dummyObject,
|
|
52
|
+
videoBubbleProps = dummyObject,
|
|
53
|
+
audioBubbleProps = dummyObject,
|
|
54
|
+
attachmentBubbleProps = dummyObject
|
|
55
|
+
} = customProps;
|
|
56
|
+
const {
|
|
57
|
+
onImageBubbleClick,
|
|
58
|
+
onAttachmentBubbleClick
|
|
59
|
+
} = messageContentClickMapping;
|
|
60
|
+
const {
|
|
61
|
+
attachmentBubbleTitle
|
|
62
|
+
} = messageBubbleTitleI18N || dummyObject;
|
|
63
|
+
const {
|
|
64
|
+
isShowLayoutBubble,
|
|
65
|
+
isShowReplyBubble,
|
|
66
|
+
isShowImageBubble,
|
|
67
|
+
isShowVideoBubble,
|
|
68
|
+
isShowAudioBubble,
|
|
69
|
+
isShowAttachmentBubble,
|
|
70
|
+
isShowLocationBubble,
|
|
71
|
+
isShowTextBubble,
|
|
72
|
+
isShowCustomBubble,
|
|
73
|
+
isShowDeleteBubble,
|
|
74
|
+
replyToMessageDetails: replyToMessage,
|
|
75
|
+
attachmentDetails,
|
|
76
|
+
locationUrl
|
|
77
|
+
} = useIMMessageContent({
|
|
78
|
+
messageDetails,
|
|
79
|
+
onClick: propOnClick
|
|
80
|
+
});
|
|
81
|
+
/* External CSS Customization */
|
|
82
|
+
|
|
83
|
+
const newStyle = useMergeStyle(style, customStyle);
|
|
84
|
+
const wrapperDivProps = {
|
|
85
|
+
className: newStyle.messageContentRow
|
|
86
|
+
};
|
|
87
|
+
return /*#__PURE__*/React.createElement(Fragment, null, isShowLayoutBubble ? null : null, isShowDeleteBubble ? /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: newStyle.deleteBubble
|
|
89
|
+
}, deleteMessageText) : null, isShowReplyBubble ? /*#__PURE__*/React.createElement("div", wrapperDivProps, /*#__PURE__*/React.createElement(IMReplyBubble, _extends({
|
|
90
|
+
isFailed: isFailed,
|
|
91
|
+
messageDetails: replyToMessage,
|
|
92
|
+
onClick: onClickReply,
|
|
93
|
+
replyText: replyText
|
|
94
|
+
}, imReplyBubbleProps))) : null, isShowCustomBubble ? renderCustomMessage({
|
|
95
|
+
messageDetails,
|
|
96
|
+
isFailed
|
|
97
|
+
}) : null, isShowImageBubble ? /*#__PURE__*/React.createElement("div", wrapperDivProps, /*#__PURE__*/React.createElement(ImageBubble, _extends({
|
|
98
|
+
imageDetails: attachmentDetails,
|
|
99
|
+
isFailed: isFailed,
|
|
100
|
+
isSending: isSending,
|
|
101
|
+
onClick: onImageBubbleClick
|
|
102
|
+
}, imageBubbleProps))) : null, isShowVideoBubble ? /*#__PURE__*/React.createElement("div", wrapperDivProps, /*#__PURE__*/React.createElement(VideoBubble, _extends({
|
|
103
|
+
isFailed: isFailed,
|
|
104
|
+
videoDetails: attachmentDetails
|
|
105
|
+
}, videoBubbleProps))) : null, isShowAudioBubble ? /*#__PURE__*/React.createElement("div", wrapperDivProps, /*#__PURE__*/React.createElement(AudioBubble, _extends({
|
|
106
|
+
audioDetails: attachmentDetails,
|
|
107
|
+
isFailed: isFailed
|
|
108
|
+
}, audioBubbleProps))) : null, isShowAttachmentBubble ? /*#__PURE__*/React.createElement("div", wrapperDivProps, /*#__PURE__*/React.createElement(AttachmentBubble, _extends({
|
|
109
|
+
attachmentBubbleTitle: attachmentBubbleTitle,
|
|
110
|
+
attachmentDetails: attachmentDetails,
|
|
111
|
+
isFailed: isFailed,
|
|
112
|
+
isSending: isSending,
|
|
113
|
+
onClick: onAttachmentBubbleClick
|
|
114
|
+
}, attachmentBubbleProps))) : null, isShowLocationBubble ? /*#__PURE__*/React.createElement("div", wrapperDivProps, /*#__PURE__*/React.createElement(LocationBubble, _extends({
|
|
115
|
+
isFailed: isFailed,
|
|
116
|
+
locationUrl: locationUrl
|
|
117
|
+
}, locationBubbleProps))) : null, isShowTextBubble ? /*#__PURE__*/React.createElement("div", wrapperDivProps, /*#__PURE__*/React.createElement(IMTextBubble, _extends({
|
|
118
|
+
isFailed: isFailed,
|
|
119
|
+
isShowFullContent: isShowFullContent,
|
|
120
|
+
messageDetails: messageDetails,
|
|
121
|
+
moreText: seeMoreText,
|
|
122
|
+
onLoadFullMessage: onLoadFullMessage,
|
|
123
|
+
sessionDetails: sessionDetails
|
|
124
|
+
}, imTextBubbleProps))) : null);
|
|
125
|
+
}
|
|
126
|
+
IMMessageContent.propTypes = imMessageContentPropTypes;
|
|
127
|
+
IMMessageContent.defaultProps = imMessageContentDefaultProps;
|
|
128
|
+
IMMessageContent.displayName = 'IMMessageContent';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as IMMessageContent } from './IMMessageContent';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** ** Constants *** */
|
|
2
|
+
import { dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
|
|
3
|
+
const imMessageContentDefaultProps = {
|
|
4
|
+
customStyle: dummyObject,
|
|
5
|
+
customProps: dummyObject,
|
|
6
|
+
messageBubbleTitleI18N: dummyObject,
|
|
7
|
+
messageContentClickMapping: dummyObject
|
|
8
|
+
};
|
|
9
|
+
export default imMessageContentDefaultProps;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
const imMessageContentPropTypes = {
|
|
4
|
+
messageDetails: PropTypes.shape({
|
|
5
|
+
displayMessage: PropTypes.string.isRequired,
|
|
6
|
+
attachment: PropTypes.string,
|
|
7
|
+
contentType: PropTypes.string,
|
|
8
|
+
dateTimeDetails: PropTypes.shape({
|
|
9
|
+
displayDateTime: PropTypes.string,
|
|
10
|
+
tooltip: PropTypes.string
|
|
11
|
+
}),
|
|
12
|
+
direction: PropTypes.string,
|
|
13
|
+
fullMessage: PropTypes.string,
|
|
14
|
+
id: PropTypes.string,
|
|
15
|
+
layout: PropTypes.string,
|
|
16
|
+
location: PropTypes.string,
|
|
17
|
+
meta: PropTypes.shape({
|
|
18
|
+
DESK_TICKET_ID: PropTypes.string,
|
|
19
|
+
DESK_TICKET_NUMBER: PropTypes.string,
|
|
20
|
+
SYSTEM_MESSAGE_TYPE: PropTypes.string
|
|
21
|
+
}),
|
|
22
|
+
replyToMessage: PropTypes.object,
|
|
23
|
+
status: PropTypes.string,
|
|
24
|
+
type: PropTypes.string
|
|
25
|
+
}).isRequired,
|
|
26
|
+
sessionDetails: PropTypes.shape({
|
|
27
|
+
id: PropTypes.string
|
|
28
|
+
}),
|
|
29
|
+
onClick: PropTypes.func,
|
|
30
|
+
messageContentClickMapping: PropTypes.object,
|
|
31
|
+
messageBubbleTitleI18N: PropTypes.shape({
|
|
32
|
+
attachmentBubbleTitle: PropTypes.string
|
|
33
|
+
}),
|
|
34
|
+
onLoadFullMessage: PropTypes.func,
|
|
35
|
+
onClickReply: PropTypes.func,
|
|
36
|
+
seeMoreText: PropTypes.string,
|
|
37
|
+
deleteMessageText: PropTypes.string,
|
|
38
|
+
replyText: PropTypes.string,
|
|
39
|
+
renderCustomMessage: PropTypes.func,
|
|
40
|
+
customStyle: PropTypes.object,
|
|
41
|
+
customProps: PropTypes.shape({
|
|
42
|
+
attachmentBubbleProps: PropTypes.object,
|
|
43
|
+
audioBubbleProps: PropTypes.object,
|
|
44
|
+
imReplyBubbleProps: PropTypes.object,
|
|
45
|
+
imTextBubbleProps: PropTypes.object,
|
|
46
|
+
imageBubbleProps: PropTypes.object,
|
|
47
|
+
locationBubbleProps: PropTypes.object,
|
|
48
|
+
videoBubbleProps: PropTypes.object
|
|
49
|
+
}),
|
|
50
|
+
isFailed: PropTypes.bool,
|
|
51
|
+
isSending: PropTypes.bool,
|
|
52
|
+
isShowFullContent: PropTypes.bool
|
|
53
|
+
};
|
|
54
|
+
export default imMessageContentPropTypes;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
/** ** Libraries *** */
|
|
4
|
+
import React from 'react';
|
|
5
|
+
/** ** Hooks *** */
|
|
6
|
+
|
|
7
|
+
import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
8
|
+
import useIMMessageMeta from '@zohoim/chat-components-hooks/es/im/IMMessageMeta/useIMMessageMeta';
|
|
9
|
+
/** ** Constants *** */
|
|
10
|
+
|
|
11
|
+
import imMessageMetaDefaultProps from './props/defaultProps';
|
|
12
|
+
import imMessageMetaPropTypes from './props/propTypes';
|
|
13
|
+
import { dummyObject } from '@zohoim/chat-components-utils/es/constants/emptyConstants';
|
|
14
|
+
/** ** Methods *** */
|
|
15
|
+
|
|
16
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
17
|
+
/** ** Styles *** */
|
|
18
|
+
|
|
19
|
+
import style from './css/IMMessageMeta.module.css';
|
|
20
|
+
/** ** Components *** */
|
|
21
|
+
|
|
22
|
+
import { Container } from '@zohodesk/components/es/Layout';
|
|
23
|
+
import IMMessageMetaInfo from '../IMMessageMetaInfo/IMMessageMetaInfo';
|
|
24
|
+
export default function IMMessageMeta(props) {
|
|
25
|
+
const {
|
|
26
|
+
direction,
|
|
27
|
+
customStyle,
|
|
28
|
+
time,
|
|
29
|
+
timeTooltip,
|
|
30
|
+
messageMetaInfoI18N,
|
|
31
|
+
autoMessageType,
|
|
32
|
+
isValidAttachment,
|
|
33
|
+
customProps
|
|
34
|
+
} = props;
|
|
35
|
+
const {
|
|
36
|
+
imMessageMetaInfoProps = dummyObject
|
|
37
|
+
} = customProps;
|
|
38
|
+
const {
|
|
39
|
+
imMessageMetaInfoTitle,
|
|
40
|
+
imMessageMetaInfoContent
|
|
41
|
+
} = useIMMessageMeta({
|
|
42
|
+
messageMetaInfoI18N,
|
|
43
|
+
autoMessageType,
|
|
44
|
+
isValidAttachment
|
|
45
|
+
});
|
|
46
|
+
/* External CSS Customization */
|
|
47
|
+
|
|
48
|
+
const newStyle = useMergeStyle(style, customStyle);
|
|
49
|
+
/* CSS classnames added based on logic */
|
|
50
|
+
|
|
51
|
+
const {
|
|
52
|
+
imMessageMetaClass,
|
|
53
|
+
dotClass
|
|
54
|
+
} = cssJSLogic({
|
|
55
|
+
direction
|
|
56
|
+
}, newStyle);
|
|
57
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, imMessageMetaInfoContent || time ? /*#__PURE__*/React.createElement(Container, {
|
|
58
|
+
alignBox: "row",
|
|
59
|
+
className: imMessageMetaClass
|
|
60
|
+
}, imMessageMetaInfoContent ? /*#__PURE__*/React.createElement(IMMessageMetaInfo, _extends({
|
|
61
|
+
imMessageMetaInfoContent: imMessageMetaInfoContent,
|
|
62
|
+
imMessageMetaInfoTitle: imMessageMetaInfoTitle
|
|
63
|
+
}, imMessageMetaInfoProps)) : null, imMessageMetaInfoContent && time ? /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: dotClass
|
|
65
|
+
}, "\u22C5") : null, time ? /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: newStyle.dateTime,
|
|
67
|
+
"data-title": timeTooltip
|
|
68
|
+
}, time) : null) : null);
|
|
69
|
+
}
|
|
70
|
+
IMMessageMeta.propTypes = imMessageMetaPropTypes;
|
|
71
|
+
IMMessageMeta.defaultProps = imMessageMetaDefaultProps;
|
|
72
|
+
IMMessageMeta.displayName = 'IMMessageMeta';
|