@zohoim/chat-components 0.0.2 → 0.0.3
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/es/ActionIcon/ActionIcon.js +19 -9
- package/es/ActionIcon/css/cssJSLogic.js +1 -0
- package/es/ActionIcon/props/defaultProps.js +3 -1
- package/es/ActionIcon/props/propTypes.js +4 -2
- package/es/IMDateTime/css/IMDateTime.module.css +0 -0
- package/es/IMDateTime/css/cssJSLogic.js +0 -0
- package/es/IMDateTime/index.js +0 -0
- package/es/IMDateTime/props/defaultProps.js +0 -0
- package/es/IMDateTime/props/propTypes.js +0 -0
- package/es/IMIntegrationIcon/IMIntegrationIcon.js +90 -0
- package/es/IMIntegrationIcon/css/IMIntegrationIcon.module.css +98 -0
- package/es/IMIntegrationIcon/css/cssJSLogic.js +56 -0
- package/es/IMIntegrationIcon/index.js +2 -0
- package/es/IMIntegrationIcon/props/defaultProps.js +9 -0
- package/es/IMIntegrationIcon/props/propConstants.js +8 -0
- package/es/IMIntegrationIcon/props/propTypes.js +25 -0
- package/es/IMMessage/IMMessage.js +143 -0
- package/es/IMMessage/css/IMMessage.module.css +0 -0
- package/es/IMMessage/css/cssJSLogic.js +10 -0
- package/es/IMMessage/index.js +1 -0
- package/es/IMMessage/props/defaultProps.js +51 -0
- package/es/IMMessage/props/propTypes.js +98 -0
- package/es/IMMessage/renderChild/renderMessage.js +8 -0
- package/es/IMMessage/renderChild/renderMessageActions.js +8 -0
- package/es/IMMessage/renderChild/renderMessageBox.js +15 -0
- package/es/IMMessage/renderChild/renderMessageBoxFooter.js +8 -0
- package/es/IMMessage/renderChild/renderMessageFooter.js +8 -0
- package/es/IMMessage/renderChild/renderMessageHeader.js +8 -0
- package/es/IMMessage/renderChild/renderMessageOwner.js +8 -0
- package/es/IMMessage/renderChild/renderMessageStatus.js +8 -0
- package/es/IMMessageActions/IMMessageActions.js +146 -0
- package/es/IMMessageActions/css/IMMessageActions.module.css +23 -0
- package/es/IMMessageActions/css/cssJSLogic.js +20 -0
- package/es/IMMessageActions/index.js +1 -0
- package/es/IMMessageActions/props/defaultProps.js +12 -0
- package/es/IMMessageActions/props/propTypes.js +30 -0
- package/es/IMMessageAvatar/IMMessageAvatar.js +45 -0
- package/es/IMMessageAvatar/css/IMMessageAvatar.module.css +0 -0
- package/es/IMMessageAvatar/css/cssJSLogic.js +0 -0
- package/es/IMMessageAvatar/index.js +1 -0
- package/es/IMMessageAvatar/props/defaultProps.js +10 -0
- package/es/IMMessageAvatar/props/propTypes.js +28 -0
- package/es/IMMessageStatus/IMMessageStatus.js +69 -0
- package/es/IMMessageStatus/css/IMMessageStatus.module.css +12 -0
- package/es/IMMessageStatus/css/cssJSLogic.js +22 -0
- package/es/IMMessageStatus/index.js +1 -0
- package/es/IMMessageStatus/props/defaultProps.js +6 -0
- package/es/IMMessageStatus/props/propTypes.js +21 -0
- package/es/MessageAction/MessageAction.js +42 -0
- package/es/MessageAction/css/MessageAction.module.css +0 -0
- package/es/MessageAction/css/cssJSLogic.js +0 -0
- package/es/MessageAction/index.js +1 -0
- package/es/MessageAction/props/defaultProps.js +8 -0
- package/es/MessageAction/props/propTypes.js +14 -0
- package/es/MessageActions/MessageActions.js +30 -7
- package/es/MessageActions/css/MessageActions.module.css +3 -0
- package/es/MessageActions/css/cssJSLogic.js +10 -0
- package/es/MessageActions/index.js +1 -2
- package/es/MessageActions/props/defaultProps.js +6 -3
- package/es/MessageActions/props/propConstants.js +3 -1
- package/es/MessageActions/props/propTypes.js +6 -2
- package/es/MessageActionsMore/MessageActionsMore.js +23 -5
- package/es/MessageActionsMore/css/MessageActionsMore.module.css +16 -0
- package/es/MessageActionsMore/css/cssJsLogic.js +28 -0
- package/es/MessageActionsMore/props/defaultProps.js +8 -4
- package/es/MessageActionsMore/props/propTypes.js +9 -3
- package/es/MessageAvatar/MessageAvatar.js +56 -0
- package/es/MessageAvatar/css/MessageAvatar.module.css +21 -0
- package/es/MessageAvatar/css/cssJSLogic.js +18 -0
- package/es/MessageAvatar/index.js +1 -0
- package/es/MessageAvatar/props/defaultProps.js +9 -0
- package/es/MessageAvatar/props/propTypes.js +13 -0
- package/es/MessageBox/css/MessageBox.module.css +11 -0
- package/es/MessageBox/css/cssJSLogic.js +3 -1
- package/es/MessageBox/index.js +1 -2
- package/es/MessageBox/props/defaultProps.js +4 -1
- package/es/MessageBox/props/propTypes.js +6 -4
- package/es/MessageBoxFooter/MessageBoxFooter.js +10 -3
- package/es/MessageBoxFooter/css/MessageBoxFooter.module.css +3 -1
- package/es/MessageBoxFooter/css/cssJSLogic.js +10 -0
- package/es/MessageBoxFooter/index.js +1 -2
- package/es/MessageBoxFooter/props/defaultProps.js +3 -1
- package/es/MessageBoxFooter/props/propTypes.js +1 -0
- package/es/MessageBubble/MessageBubble.js +13 -17
- package/es/MessageBubble/css/MessageBubble.module.css +5 -0
- package/es/MessageBubble/css/cssJSLogic.js +5 -12
- package/es/MessageBubble/index.js +1 -2
- package/es/MessageBubble/props/defaultProps.js +6 -4
- package/es/MessageBubble/props/propConstants.js +6 -6
- package/es/MessageBubble/props/propTypes.js +8 -7
- package/es/MoreActionItem/MoreActionItem.js +75 -0
- package/es/MoreActionItem/css/MoreActionItem.module.css +31 -0
- package/es/MoreActionItem/css/cssJSLogic.js +27 -0
- package/es/MoreActionItem/index.js +1 -0
- package/es/MoreActionItem/props/defaultProps.js +11 -0
- package/es/MoreActionItem/props/propTypes.js +12 -0
- package/es/TextMessage/DefaultActions.js +0 -1
- package/es/TextMessage/TextMessage.js +6 -6
- package/es/Theme/defaultTheme.js +20 -3
- package/es/icons/create-icon-components.js +141 -0
- package/es/icons/factory/actions/convertTicket.svg +21 -0
- package/es/icons/factory/integrations/chInstagram.svg +4 -0
- package/es/icons/factory/integrations/chWhatsApp.svg +4 -0
- package/es/icons/factory/integrations/ttASAP.svg +1 -0
- package/es/icons/factory/integrations/ttTelegram.svg +1 -0
- package/es/icons/factory/integrations/ttTwillio.svg +1 -0
- package/es/icons/factory/integrations/ttTwitter.svg +1 -0
- package/es/icons/factory/integrations/ttWechat.svg +1 -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 +27 -0
- package/es/icons/iconSrc/actions/ConvertTicket.js +24 -0
- package/es/icons/iconSrc/actions/index.js +1 -0
- package/es/icons/iconSrc/integrations/ChInstagram.js +17 -0
- package/es/icons/iconSrc/integrations/ChWhatsApp.js +19 -0
- package/es/icons/iconSrc/integrations/TtASAP.js +31 -0
- package/es/icons/iconSrc/integrations/TtTelegram.js +21 -0
- package/es/icons/iconSrc/integrations/TtTwillio.js +35 -0
- package/es/icons/iconSrc/integrations/TtTwitter.js +40 -0
- package/es/icons/iconSrc/integrations/TtWechat.js +41 -0
- package/es/icons/iconSrc/integrations/index.js +7 -0
- package/es/icons/iconSrc/messageStatus/Clock.js +13 -0
- package/es/icons/iconSrc/messageStatus/DoubleTick.js +15 -0
- package/es/icons/iconSrc/messageStatus/Failed.js +13 -0
- package/es/icons/iconSrc/messageStatus/Tick.js +12 -0
- package/es/icons/iconSrc/messageStatus/index.js +4 -0
- package/es/index.js +10 -1
- package/es/{AvatarSpace → unused/AvatarSpace}/AvatarSpace.js +5 -0
- package/package.json +15 -9
- /package/es/{MessageBoxFooter/css/cssJsLogic.js → IMDateTime/IMDateTime.js} +0 -0
- /package/es/{AvatarSpace → unused/AvatarSpace}/css/AvatarSpace.module.css +0 -0
- /package/es/{AvatarSpace → unused/AvatarSpace}/css/cssJSLogic.js +0 -0
- /package/es/{AvatarSpace → unused/AvatarSpace}/index.js +0 -0
- /package/es/{AvatarSpace → unused/AvatarSpace}/props/defaultProps.js +0 -0
- /package/es/{AvatarSpace → unused/AvatarSpace}/props/propConstants.js +0 -0
- /package/es/{AvatarSpace → unused/AvatarSpace}/props/propTypes.js +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
/** ** Constants *** */
|
|
5
|
+
import integrationConstants from '@zohoim/chat-components-utils/es/constants/integrationConstants';
|
|
6
|
+
import { defaultMessageActions } from '@zohoim/chat-components-utils/es/constants/messageActionConstants';
|
|
7
|
+
import messageStatusConstants from '@zohoim/chat-components-utils/es/constants/messageStatusConstants';
|
|
8
|
+
import { direction } from '@zohoim/chat-components-utils/es/constants/messageConstants';
|
|
9
|
+
import sizes from '@zohoim/chat-components-utils/es/constants/sizes';
|
|
10
|
+
const {
|
|
11
|
+
REPLY,
|
|
12
|
+
COPY,
|
|
13
|
+
DOWNLOAD,
|
|
14
|
+
CREATE_TICKET,
|
|
15
|
+
RESEND,
|
|
16
|
+
DELETE,
|
|
17
|
+
FORWARD
|
|
18
|
+
} = defaultMessageActions;
|
|
19
|
+
const {
|
|
20
|
+
WHATSAPP,
|
|
21
|
+
TELEGRAM,
|
|
22
|
+
INSTAGRAM,
|
|
23
|
+
ASAP,
|
|
24
|
+
WECHAT,
|
|
25
|
+
TWILLIO,
|
|
26
|
+
LINE
|
|
27
|
+
} = integrationConstants;
|
|
28
|
+
const {
|
|
29
|
+
SENT,
|
|
30
|
+
SAVED,
|
|
31
|
+
QUEUED,
|
|
32
|
+
DELIVERED,
|
|
33
|
+
READ,
|
|
34
|
+
UNSENT,
|
|
35
|
+
FAILED,
|
|
36
|
+
OUTGOING
|
|
37
|
+
} = messageStatusConstants;
|
|
38
|
+
const {
|
|
39
|
+
IN,
|
|
40
|
+
OUT
|
|
41
|
+
} = direction;
|
|
42
|
+
const imMessagePropTypes = {
|
|
43
|
+
customStyle: PropTypes.object,
|
|
44
|
+
direction: PropTypes.oneOf([IN, OUT]),
|
|
45
|
+
isActive: PropTypes.bool,
|
|
46
|
+
needMessageActions: PropTypes.bool,
|
|
47
|
+
renderMessageBoxFooter: PropTypes.func,
|
|
48
|
+
/* Avatar Related Props Start */
|
|
49
|
+
needSender: PropTypes.bool,
|
|
50
|
+
isShowSender: PropTypes.bool,
|
|
51
|
+
senderSrc: PropTypes.string,
|
|
52
|
+
senderAlternateSrc: PropTypes.string,
|
|
53
|
+
senderTitle: PropTypes.string,
|
|
54
|
+
senderAvatarSize: PropTypes.oneOf(['xxsmall', 'small', 'xsmall', 'medium', 'xmedium', 'large', 'xlarge']),
|
|
55
|
+
senderName: PropTypes.string,
|
|
56
|
+
avatarCustomStyle: PropTypes.object,
|
|
57
|
+
senderIntegrationIcon: PropTypes.oneOf([WHATSAPP, TELEGRAM, INSTAGRAM, ASAP, WECHAT, TWILLIO, LINE]),
|
|
58
|
+
senderIntegrationIconSize: PropTypes.oneOf([sizes.SMALL, sizes.MEDIUM]),
|
|
59
|
+
senderIntegrationIconCustomStyle: PropTypes.object,
|
|
60
|
+
isCustomIntegrationIcon: PropTypes.bool,
|
|
61
|
+
isCustomSenderAvatar: PropTypes.bool,
|
|
62
|
+
renderCustomIntegrationIcon: PropTypes.func,
|
|
63
|
+
renderCustomSenderAvatar: PropTypes.func,
|
|
64
|
+
/*Avatar Related Props End*/
|
|
65
|
+
|
|
66
|
+
/* MessageBox Props Start */
|
|
67
|
+
needMessageBox: PropTypes.bool,
|
|
68
|
+
renderMessage: PropTypes.func,
|
|
69
|
+
renderMessageFooter: PropTypes.func,
|
|
70
|
+
renderMessageHeader: PropTypes.func,
|
|
71
|
+
messageBoxCustomStyle: PropTypes.object,
|
|
72
|
+
isFailedMessage: PropTypes.bool,
|
|
73
|
+
/*MessageBox Props End */
|
|
74
|
+
|
|
75
|
+
/* MessageAction Props Start */
|
|
76
|
+
messageActions: PropTypes.arrayOf(PropTypes.shape({
|
|
77
|
+
id: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([REPLY, COPY, DOWNLOAD, CREATE_TICKET, RESEND, DELETE, FORWARD])]).isRequired,
|
|
78
|
+
displayText: PropTypes.string,
|
|
79
|
+
renderFunction: PropTypes.func,
|
|
80
|
+
iconTitle: PropTypes.string
|
|
81
|
+
})),
|
|
82
|
+
renderSecondaryActions: PropTypes.func,
|
|
83
|
+
actionsDefaultShowCount: PropTypes.number,
|
|
84
|
+
actionIconCustomStyle: PropTypes.object,
|
|
85
|
+
moreActionItemCustomStyle: PropTypes.object,
|
|
86
|
+
onSelectAction: PropTypes.func,
|
|
87
|
+
messageActionCustomStyle: PropTypes.object,
|
|
88
|
+
moreActionPopupCustomStyle: PropTypes.object,
|
|
89
|
+
/* MessageAction Props End */
|
|
90
|
+
|
|
91
|
+
/* MessageStatus Props Start */
|
|
92
|
+
messageStatus: PropTypes.oneOf([SENT, SAVED, QUEUED, DELIVERED, READ, UNSENT, FAILED, OUTGOING]),
|
|
93
|
+
messageStatusCustomStyle: PropTypes.object,
|
|
94
|
+
statusTitle: PropTypes.string
|
|
95
|
+
/*MessageStatus Props End */
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default imMessagePropTypes;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
/** ** Components *** */
|
|
5
|
+
import IMMessageStatus from '../../IMMessageStatus/IMMessageStatus';
|
|
6
|
+
export default function renderMessageBoxFooter(props) {
|
|
7
|
+
return /*#__PURE__*/React.createElement(IMMessageStatus, null);
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
/** ** Components *** */
|
|
5
|
+
import IMMessageActions from '../../IMMessageActions/IMMessageActions';
|
|
6
|
+
export default function renderMessageBoxFooter(props) {
|
|
7
|
+
return /*#__PURE__*/React.createElement(IMMessageActions, null);
|
|
8
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
/** ** Components *** */
|
|
5
|
+
import MessageBox from '../../MessageBox/MessageBox';
|
|
6
|
+
export default function renderMessageBox(props) {
|
|
7
|
+
const {
|
|
8
|
+
renderMessageFooter,
|
|
9
|
+
renderMessageHeader,
|
|
10
|
+
renderMessageStatus,
|
|
11
|
+
renderMessage,
|
|
12
|
+
customStyle
|
|
13
|
+
} = props;
|
|
14
|
+
return /*#__PURE__*/React.createElement(MessageBox, props);
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
/** ** Components *** */
|
|
5
|
+
import MessageBoxFooter from '../../MessageBoxFooter/MessageBoxFooter';
|
|
6
|
+
export default function renderMessageBoxFooter(props) {
|
|
7
|
+
return /*#__PURE__*/React.createElement(MessageBoxFooter, null);
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
/** ** Components *** */
|
|
5
|
+
import IMMessageStatus from '../../IMMessageStatus/IMMessageStatus';
|
|
6
|
+
export default function renderMessageBoxFooter(props) {
|
|
7
|
+
return /*#__PURE__*/React.createElement(IMMessageStatus, null);
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
/** ** Components *** */
|
|
5
|
+
import IMMessageStatus from '../../IMMessageStatus/IMMessageStatus';
|
|
6
|
+
export default function renderMessageBoxFooter(props) {
|
|
7
|
+
return /*#__PURE__*/React.createElement(IMMessageStatus, null);
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
/** ** Components *** */
|
|
5
|
+
import IMMessageAvatar from '../../IMMessageAvatar/IMMessageAvatar';
|
|
6
|
+
export default function renderMessageBoxFooter(props) {
|
|
7
|
+
return /*#__PURE__*/React.createElement(IMMessageAvatar, null);
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
/** ** Components *** */
|
|
5
|
+
import IMMessageStatus from '../../IMMessageStatus/IMMessageStatus';
|
|
6
|
+
export default function renderMessageBoxFooter(props) {
|
|
7
|
+
return /*#__PURE__*/React.createElement(IMMessageStatus, props);
|
|
8
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/* eslint-disable no-use-before-define */
|
|
2
|
+
/* eslint-disable react/jsx-no-bind */
|
|
3
|
+
/* eslint-disable max-len */
|
|
4
|
+
/* eslint-disable arrow-parens */
|
|
5
|
+
|
|
6
|
+
/** ** Libraries *** */
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
/** ** Components *** */
|
|
10
|
+
import ActionIcon from '../ActionIcon/ActionIcon';
|
|
11
|
+
import MessageActions from '../MessageActions/MessageActions';
|
|
12
|
+
import MessageAction from '../MessageAction/MessageAction';
|
|
13
|
+
|
|
14
|
+
/** ** Icons *** */
|
|
15
|
+
import ReplyIcon from '@zohodesk/icon/es/general/Reply';
|
|
16
|
+
import ReloadIcon from '@zohodesk/icon/es/general/Reload';
|
|
17
|
+
import CopyIcon from '@zohodesk/icon/es/general/Copy';
|
|
18
|
+
import DownloadIcon from '@zohodesk/icon/es/general/Cloud';
|
|
19
|
+
import DeleteIcon from '@zohodesk/icon/es/general/Delete';
|
|
20
|
+
import ForwardIcon from '@zohodesk/icon/es/channels/EmailForward';
|
|
21
|
+
import MoreIcon from '@zohodesk/icon/es/general/More';
|
|
22
|
+
import ConvertTicket from '../icons/iconSrc/actions/ConvertTicket';
|
|
23
|
+
|
|
24
|
+
/** ** Hooks *** */
|
|
25
|
+
import useIMMessageActions from '@zohoim/chat-components-hooks/es/IMMessageActions/useIMMessageActions';
|
|
26
|
+
|
|
27
|
+
/** ** Methods *** */
|
|
28
|
+
import renderHandler from '@zohoim/chat-components-utils/es/renderHandler';
|
|
29
|
+
import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
30
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
31
|
+
|
|
32
|
+
/** ** Constants *** */
|
|
33
|
+
import imMessageActionsDefaultProps from './props/defaultProps';
|
|
34
|
+
import imMessageActionsPropTypes from './props/propTypes';
|
|
35
|
+
import { dummyObject } from '@zohoim/chat-components-utils/es/constants';
|
|
36
|
+
import { defaultMessageActions } from '@zohoim/chat-components-utils/es/constants/messageActionConstants';
|
|
37
|
+
|
|
38
|
+
/** ** CSS *** */
|
|
39
|
+
import style from './css/IMMessageActions.module.css';
|
|
40
|
+
const {
|
|
41
|
+
REPLY,
|
|
42
|
+
COPY,
|
|
43
|
+
DOWNLOAD,
|
|
44
|
+
CREATE_TICKET,
|
|
45
|
+
RESEND,
|
|
46
|
+
DELETE,
|
|
47
|
+
FORWARD
|
|
48
|
+
} = defaultMessageActions;
|
|
49
|
+
export default function IMMessageActions(props) {
|
|
50
|
+
const {
|
|
51
|
+
actions,
|
|
52
|
+
defaultShowCount,
|
|
53
|
+
actionIconCustomStyle,
|
|
54
|
+
moreItemCustomStyle,
|
|
55
|
+
onSelect,
|
|
56
|
+
customStyle,
|
|
57
|
+
morePopupCustomStyle,
|
|
58
|
+
renderSecondaryActions
|
|
59
|
+
} = props;
|
|
60
|
+
|
|
61
|
+
/* external customization */
|
|
62
|
+
const newStyle = useMergeStyle(style, customStyle);
|
|
63
|
+
/* css classnames added based on logic */
|
|
64
|
+
const {
|
|
65
|
+
moreIconClass,
|
|
66
|
+
secondaryActionsClass,
|
|
67
|
+
iconStyle
|
|
68
|
+
} = cssJSLogic(props, newStyle);
|
|
69
|
+
const {
|
|
70
|
+
actionDetails
|
|
71
|
+
} = useIMMessageActions({
|
|
72
|
+
actions,
|
|
73
|
+
defaultRenderFunction: renderAction
|
|
74
|
+
});
|
|
75
|
+
const {
|
|
76
|
+
allActions
|
|
77
|
+
} = actionDetails;
|
|
78
|
+
function handleClickAction(_ref) {
|
|
79
|
+
let {
|
|
80
|
+
id
|
|
81
|
+
} = _ref;
|
|
82
|
+
onSelect && onSelect({
|
|
83
|
+
id
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function renderIcon(_ref2) {
|
|
87
|
+
let {
|
|
88
|
+
id
|
|
89
|
+
} = _ref2;
|
|
90
|
+
const iconMapping = {
|
|
91
|
+
[REPLY]: ReplyIcon,
|
|
92
|
+
[COPY]: CopyIcon,
|
|
93
|
+
[DOWNLOAD]: DownloadIcon,
|
|
94
|
+
[CREATE_TICKET]: ConvertTicket,
|
|
95
|
+
[RESEND]: ReloadIcon,
|
|
96
|
+
[DELETE]: DeleteIcon,
|
|
97
|
+
[FORWARD]: ForwardIcon
|
|
98
|
+
};
|
|
99
|
+
const IconComponent = iconMapping[id];
|
|
100
|
+
return IconComponent ? /*#__PURE__*/React.createElement(IconComponent, {
|
|
101
|
+
customStyle: iconStyle
|
|
102
|
+
}) : null;
|
|
103
|
+
}
|
|
104
|
+
function renderAction() {
|
|
105
|
+
let {
|
|
106
|
+
id,
|
|
107
|
+
isShowInMore,
|
|
108
|
+
action
|
|
109
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
110
|
+
const {
|
|
111
|
+
displayText,
|
|
112
|
+
iconTitle
|
|
113
|
+
} = action || dummyObject;
|
|
114
|
+
return /*#__PURE__*/React.createElement(MessageAction, {
|
|
115
|
+
displayText: displayText,
|
|
116
|
+
id: id,
|
|
117
|
+
index: id,
|
|
118
|
+
key: id,
|
|
119
|
+
renderIcon: renderIcon,
|
|
120
|
+
onClick: handleClickAction,
|
|
121
|
+
isShowInMore: isShowInMore,
|
|
122
|
+
iconTitle: iconTitle,
|
|
123
|
+
actionIconCustomStyle: actionIconCustomStyle,
|
|
124
|
+
moreItemCustomStyle: moreItemCustomStyle
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function renderMoreIcon() {
|
|
128
|
+
return /*#__PURE__*/React.createElement(ActionIcon, {
|
|
129
|
+
renderIcon: () => /*#__PURE__*/React.createElement("div", {
|
|
130
|
+
className: moreIconClass
|
|
131
|
+
}, /*#__PURE__*/React.createElement(MoreIcon, null)),
|
|
132
|
+
customStyle: actionIconCustomStyle
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
const secondaryActions = renderHandler(renderSecondaryActions)();
|
|
136
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(MessageActions, {
|
|
137
|
+
actions: allActions,
|
|
138
|
+
renderMoreIcon: renderMoreIcon,
|
|
139
|
+
defaultShowCount: defaultShowCount,
|
|
140
|
+
morePopupCustomStyle: morePopupCustomStyle
|
|
141
|
+
}), secondaryActions ? /*#__PURE__*/React.createElement("div", {
|
|
142
|
+
className: secondaryActionsClass
|
|
143
|
+
}, secondaryActions) : null);
|
|
144
|
+
}
|
|
145
|
+
IMMessageActions.propTypes = imMessageActionsPropTypes;
|
|
146
|
+
IMMessageActions.defaultProps = imMessageActionsDefaultProps;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.varClass {
|
|
2
|
+
--imMessageActions-secondaryActions_margin: var(--imlib_size_5);
|
|
3
|
+
--imMessageActions-action_icon_size: var(--imlib_size_15);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
[dir=ltr] .moreIcon svg {
|
|
7
|
+
transform: rotate(90deg);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
[dir=rtl] .moreIcon svg {
|
|
11
|
+
transform: rotate(-90deg);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.secondaryActions {
|
|
15
|
+
composes: varClass;
|
|
16
|
+
margin-top: var(--imMessageActions-secondaryActions_margin);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.icon {
|
|
20
|
+
composes: varClass;
|
|
21
|
+
width: var(--imMessageActions-action_icon_size);
|
|
22
|
+
height: var(--imMessageActions-action_icon_size);
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** ** Methods *** */
|
|
2
|
+
import { compileClassNames } from '@zohodesk/utils';
|
|
3
|
+
export default function cssJSLogic(props, style) {
|
|
4
|
+
const moreIconClass = compileClassNames({
|
|
5
|
+
[style.moreIcon]: true
|
|
6
|
+
});
|
|
7
|
+
const secondaryActionsClass = compileClassNames({
|
|
8
|
+
[style.secondaryActions]: true
|
|
9
|
+
});
|
|
10
|
+
const iconClass = compileClassNames({
|
|
11
|
+
[style.icon]: true
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
moreIconClass,
|
|
15
|
+
secondaryActionsClass,
|
|
16
|
+
iconStyle: {
|
|
17
|
+
base: iconClass
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as IMMessageActions } from './IMMessageActions';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** ** Constants *** */
|
|
2
|
+
import { dummyObject, dummyArray } from '@zohoim/chat-components-utils/es/constants';
|
|
3
|
+
import { actionsDefaultShowCount } from '@zohoim/chat-components-utils/es/constants/messageActionConstants';
|
|
4
|
+
const imMessageActionsDefaultProps = {
|
|
5
|
+
customStyle: dummyObject,
|
|
6
|
+
actionIconCustomStyle: dummyObject,
|
|
7
|
+
morePopupCustomStyle: dummyObject,
|
|
8
|
+
moreItemCustomStyle: dummyObject,
|
|
9
|
+
defaultShowCount: actionsDefaultShowCount,
|
|
10
|
+
actions: dummyArray
|
|
11
|
+
};
|
|
12
|
+
export default imMessageActionsDefaultProps;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
/** ** Constants *** */
|
|
5
|
+
import { defaultMessageActions } from "@zohoim/chat-components-utils/es/constants/messageActionConstants";
|
|
6
|
+
const {
|
|
7
|
+
REPLY,
|
|
8
|
+
COPY,
|
|
9
|
+
DOWNLOAD,
|
|
10
|
+
CREATE_TICKET,
|
|
11
|
+
RESEND,
|
|
12
|
+
DELETE,
|
|
13
|
+
FORWARD
|
|
14
|
+
} = defaultMessageActions;
|
|
15
|
+
const imMessageActionsPropTypes = {
|
|
16
|
+
actions: PropTypes.arrayOf(PropTypes.shape({
|
|
17
|
+
id: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([REPLY, COPY, DOWNLOAD, CREATE_TICKET, RESEND, DELETE, FORWARD])]).isRequired,
|
|
18
|
+
displayText: PropTypes.string,
|
|
19
|
+
renderFunction: PropTypes.func,
|
|
20
|
+
iconTitle: PropTypes.string
|
|
21
|
+
})).isRequired,
|
|
22
|
+
defaultShowCount: PropTypes.number,
|
|
23
|
+
actionIconCustomStyle: PropTypes.object,
|
|
24
|
+
morePopupCustomStyle: PropTypes.object,
|
|
25
|
+
moreItemCustomStyle: PropTypes.object,
|
|
26
|
+
onSelect: PropTypes.func,
|
|
27
|
+
customStyle: PropTypes.object,
|
|
28
|
+
renderSecondaryActions: PropTypes.func
|
|
29
|
+
};
|
|
30
|
+
export default imMessageActionsPropTypes;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
/** ** Components *** */
|
|
5
|
+
import MessageAvatar from '../MessageAvatar/MessageAvatar';
|
|
6
|
+
import IMIntegrationIcon from '../IMIntegrationIcon/IMIntegrationIcon';
|
|
7
|
+
|
|
8
|
+
/** ** Constants *** */
|
|
9
|
+
import imMessageAvatarDefaultProps from './props/defaultProps';
|
|
10
|
+
import imMessageAvatarPropTypes from './props/propTypes';
|
|
11
|
+
export default function IMMessageAvatar(props) {
|
|
12
|
+
const {
|
|
13
|
+
src,
|
|
14
|
+
alternateSrc,
|
|
15
|
+
title,
|
|
16
|
+
avatarSize,
|
|
17
|
+
name,
|
|
18
|
+
customStyle,
|
|
19
|
+
integrationName,
|
|
20
|
+
iconSize,
|
|
21
|
+
iconCustomStyle,
|
|
22
|
+
isCustomIcon,
|
|
23
|
+
renderCustomIcon
|
|
24
|
+
} = props;
|
|
25
|
+
function renderIcon() {
|
|
26
|
+
return /*#__PURE__*/React.createElement(IMIntegrationIcon, {
|
|
27
|
+
integrationName: integrationName,
|
|
28
|
+
size: iconSize,
|
|
29
|
+
customStyle: iconCustomStyle,
|
|
30
|
+
isCustom: isCustomIcon,
|
|
31
|
+
renderIcon: renderCustomIcon
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return /*#__PURE__*/React.createElement(MessageAvatar, {
|
|
35
|
+
src: src,
|
|
36
|
+
alternateSrc: alternateSrc,
|
|
37
|
+
title: title,
|
|
38
|
+
size: avatarSize,
|
|
39
|
+
name: name,
|
|
40
|
+
renderIcon: renderIcon,
|
|
41
|
+
customStyle: customStyle
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
IMMessageAvatar.defaultProps = imMessageAvatarDefaultProps;
|
|
45
|
+
IMMessageAvatar.propTypes = imMessageAvatarPropTypes;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as IMMessageAvatar } from './IMMessageAvatar';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** ** Constants *** */
|
|
2
|
+
import { dummyObject } from '@zohoim/chat-components-utils/es/constants';
|
|
3
|
+
const imMessageActionsDefaultProps = {
|
|
4
|
+
customStyle: dummyObject,
|
|
5
|
+
iconCustomStyle: dummyObject,
|
|
6
|
+
isCustomIcon: false,
|
|
7
|
+
title: 'RAVI KUMAR',
|
|
8
|
+
name: 'RAVI KUMAR'
|
|
9
|
+
};
|
|
10
|
+
export default imMessageActionsDefaultProps;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
/** ** Constants *** */
|
|
5
|
+
import integrationConstants from '@zohoim/chat-components-utils/es/constants/integrationConstants';
|
|
6
|
+
const {
|
|
7
|
+
WHATSAPP,
|
|
8
|
+
TELEGRAM,
|
|
9
|
+
INSTAGRAM,
|
|
10
|
+
ASAP,
|
|
11
|
+
WECHAT,
|
|
12
|
+
TWILLIO,
|
|
13
|
+
LINE
|
|
14
|
+
} = integrationConstants;
|
|
15
|
+
const imMessageAvatarPropTypes = {
|
|
16
|
+
src: PropTypes.string,
|
|
17
|
+
alternateSrc: PropTypes.string,
|
|
18
|
+
title: PropTypes.string,
|
|
19
|
+
avatarSize: PropTypes.string,
|
|
20
|
+
name: PropTypes.string,
|
|
21
|
+
customStyle: PropTypes.object,
|
|
22
|
+
integrationName: PropTypes.oneOf([WHATSAPP, TELEGRAM, INSTAGRAM, ASAP, WECHAT, TWILLIO, LINE]),
|
|
23
|
+
iconSize: PropTypes.string,
|
|
24
|
+
iconCustomStyle: PropTypes.object,
|
|
25
|
+
isCustomIcon: PropTypes.bool,
|
|
26
|
+
renderCustomIcon: PropTypes.string
|
|
27
|
+
};
|
|
28
|
+
export default imMessageAvatarPropTypes;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-no-bind */
|
|
2
|
+
/* eslint-disable max-len */
|
|
3
|
+
|
|
4
|
+
/** ** Libraries *** */
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
/** ** Hooks *** */
|
|
8
|
+
import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
|
|
9
|
+
|
|
10
|
+
/** ** Constants *** */
|
|
11
|
+
import imMessageStatusDefaultProps from './props/defaultProps';
|
|
12
|
+
import imMessageStatusPropTypes from './props/propTypes';
|
|
13
|
+
import messageStatusConstants from '@zohoim/chat-components-utils/es/constants/messageStatusConstants';
|
|
14
|
+
|
|
15
|
+
/** ** Methods *** */
|
|
16
|
+
import cssJSLogic from './css/cssJSLogic';
|
|
17
|
+
|
|
18
|
+
/** ** Styles *** */
|
|
19
|
+
import style from './css/IMMessageStatus.module.css';
|
|
20
|
+
|
|
21
|
+
/** ** Icons *** */
|
|
22
|
+
import DoubleTickIcon from '../icons/iconSrc/messageStatus/DoubleTick';
|
|
23
|
+
import TickIcon from '../icons/iconSrc/messageStatus/Tick';
|
|
24
|
+
import ClockIcon from '../icons/iconSrc/messageStatus/Clock';
|
|
25
|
+
import FailedIcon from '../icons/iconSrc/messageStatus/Failed';
|
|
26
|
+
const {
|
|
27
|
+
SENT,
|
|
28
|
+
SAVED,
|
|
29
|
+
QUEUED,
|
|
30
|
+
DELIVERED,
|
|
31
|
+
READ,
|
|
32
|
+
UNSENT,
|
|
33
|
+
FAILED,
|
|
34
|
+
OUTGOING
|
|
35
|
+
} = messageStatusConstants;
|
|
36
|
+
const messageStatusIconMapping = {
|
|
37
|
+
[OUTGOING]: ClockIcon,
|
|
38
|
+
[SAVED]: TickIcon,
|
|
39
|
+
[QUEUED]: TickIcon,
|
|
40
|
+
[SENT]: DoubleTickIcon,
|
|
41
|
+
[DELIVERED]: DoubleTickIcon,
|
|
42
|
+
[READ]: DoubleTickIcon,
|
|
43
|
+
[UNSENT]: FailedIcon,
|
|
44
|
+
[FAILED]: FailedIcon
|
|
45
|
+
};
|
|
46
|
+
export default function IMMessageStatus(props) {
|
|
47
|
+
const {
|
|
48
|
+
messageStatus,
|
|
49
|
+
customStyle,
|
|
50
|
+
title
|
|
51
|
+
} = props;
|
|
52
|
+
|
|
53
|
+
/* External customization */
|
|
54
|
+
const newStyle = useMergeStyle(style, customStyle);
|
|
55
|
+
/* CSS classnames added based on logic */
|
|
56
|
+
const {
|
|
57
|
+
statusClass
|
|
58
|
+
} = cssJSLogic(props, newStyle);
|
|
59
|
+
|
|
60
|
+
/* Render Icon */
|
|
61
|
+
const IconComponent = messageStatusIconMapping[messageStatus];
|
|
62
|
+
return IconComponent ? /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: statusClass,
|
|
64
|
+
"data-title": title
|
|
65
|
+
}, /*#__PURE__*/React.createElement(IconComponent, null)) : null;
|
|
66
|
+
}
|
|
67
|
+
IMMessageStatus.propTypes = imMessageStatusPropTypes;
|
|
68
|
+
IMMessageStatus.defaultProps = imMessageStatusDefaultProps;
|
|
69
|
+
IMMessageStatus.displayName = 'IMMessageStatus';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** ** Methods *** */
|
|
2
|
+
import { compileClassNames } from "@zohodesk/utils";
|
|
3
|
+
|
|
4
|
+
/** ** Constants *** */
|
|
5
|
+
import messageStatusConstants from "@zohoim/chat-components-utils/es/constants/messageStatusConstants";
|
|
6
|
+
const {
|
|
7
|
+
READ,
|
|
8
|
+
UNSENT,
|
|
9
|
+
FAILED
|
|
10
|
+
} = messageStatusConstants;
|
|
11
|
+
export default function cssJSLogic(props, style) {
|
|
12
|
+
const isRead = props.messageStatus === READ;
|
|
13
|
+
const isFailed = props.messageStatus === FAILED || props.messageStatus === UNSENT;
|
|
14
|
+
const statusClass = compileClassNames({
|
|
15
|
+
[style.messageStatus]: isRead || isFailed ? false : true,
|
|
16
|
+
[style.readStatus]: isRead,
|
|
17
|
+
[style.failedStatus]: isFailed
|
|
18
|
+
});
|
|
19
|
+
return {
|
|
20
|
+
statusClass
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as IMMessageStatus } from './IMMessageStatus';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** ** Libraries *** */
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
/** ** Constants *** */
|
|
5
|
+
import messageStatusConstants from '@zohoim/chat-components-utils/es/constants/messageStatusConstants';
|
|
6
|
+
const {
|
|
7
|
+
SENT,
|
|
8
|
+
SAVED,
|
|
9
|
+
QUEUED,
|
|
10
|
+
DELIVERED,
|
|
11
|
+
READ,
|
|
12
|
+
UNSENT,
|
|
13
|
+
FAILED,
|
|
14
|
+
OUTGOING
|
|
15
|
+
} = messageStatusConstants;
|
|
16
|
+
const imMessageStatusPropTypes = {
|
|
17
|
+
messageStatus: PropTypes.oneOf([SENT, SAVED, QUEUED, DELIVERED, READ, UNSENT, FAILED, OUTGOING]).isRequired,
|
|
18
|
+
customStyle: PropTypes.object,
|
|
19
|
+
title: PropTypes.string
|
|
20
|
+
};
|
|
21
|
+
export default imMessageStatusPropTypes;
|