@zohoim/chat-components 0.0.10 → 0.0.13

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.
Files changed (210) hide show
  1. package/es/ActionIcon/ActionIcon.js +2 -2
  2. package/es/ArticleBubble/ArticleBubble.js +17 -15
  3. package/es/ArticleBubble/css/ArticleBubble.module.css +37 -29
  4. package/es/AttachmentBubble/AttachmentBubble.js +14 -12
  5. package/es/AttachmentBubble/css/AttachmentBubble.module.css +4 -4
  6. package/es/AttachmentBubble/css/cssJSLogic.js +1 -1
  7. package/es/AttachmentBubbleInfo/AttachmentBubbleInfo.js +0 -1
  8. package/es/AttachmentBubbleInfo/css/AttachmentBubbleInfo.module.css +1 -0
  9. package/es/AttachmentBubbleInfo/css/cssJSLogic.js +1 -1
  10. package/es/Audio/Audio.js +23 -23
  11. package/es/AudioBubble/AudioBubble.js +2 -3
  12. package/es/AudioBubble/css/cssJSLogic.js +2 -2
  13. package/es/ImageBubble/ImageBubble.js +7 -6
  14. package/es/InfoBubble/InfoBubble.js +0 -1
  15. package/es/LazyLoadImage/LazyLoadImage.js +5 -6
  16. package/es/LocationBubble/LocationBubble.js +20 -21
  17. package/es/LocationBubble/css/LocationBubble.module.css +9 -7
  18. package/es/MediaControls/MediaControls.js +0 -1
  19. package/es/Message/Message.js +58 -93
  20. package/es/Message/props/defaultProps.js +2 -34
  21. package/es/Message/props/propTypes.js +19 -57
  22. package/es/MessageAction/MessageAction.js +5 -5
  23. package/es/MessageActions/MessageActions.js +120 -45
  24. package/es/MessageActions/css/MessageActions.module.css +30 -2
  25. package/es/MessageActions/css/cssJSLogic.js +13 -3
  26. package/es/MessageActions/props/defaultProps.js +5 -3
  27. package/es/MessageActions/props/propTypes.js +22 -4
  28. package/es/MessageActionsMore/MessageActionsMore.js +5 -5
  29. package/es/MessageActionsWrapper/MessageActionsWrapper.js +75 -0
  30. package/es/MessageActionsWrapper/css/MessageActionsWrapper.module.css +3 -0
  31. package/es/MessageActionsWrapper/css/cssJSLogic.js +10 -0
  32. package/es/MessageActionsWrapper/index.js +1 -0
  33. package/es/MessageActionsWrapper/props/defaultProps.js +10 -0
  34. package/es/MessageActionsWrapper/props/propTypes.js +12 -0
  35. package/es/MessageAvatar/MessageAvatar.js +7 -6
  36. package/es/MessageAvatar/props/defaultProps.js +3 -3
  37. package/es/MessageBubble/MessageBubble.js +1 -1
  38. package/es/MessageBubble/props/defaultProps.js +2 -2
  39. package/es/MessageBubble/props/propConstants.js +1 -1
  40. package/es/MessageBubble/props/propTypes.js +2 -2
  41. package/es/{im/IMMessageStatus/IMMessageStatus.js → MessageStatus/MessageStatus.js} +18 -15
  42. package/es/{im/IMMessageStatus → MessageStatus}/css/cssJSLogic.js +3 -3
  43. package/es/MessageStatus/index.js +1 -0
  44. package/es/{im/IMMessageStatus → MessageStatus}/props/defaultProps.js +2 -2
  45. package/es/{im/IMMessageStatus → MessageStatus}/props/propTypes.js +4 -3
  46. package/es/MoreActionItem/MoreActionItem.js +7 -7
  47. package/es/MoreActionItem/css/cssJSLogic.js +1 -1
  48. package/es/ReplyBubble/ReplyBubble.js +4 -3
  49. package/es/ReplyBubbleContent/ReplyBubbleContent.js +16 -12
  50. package/es/ReplyBubbleContent/css/ReplyBubbleContent.module.css +26 -16
  51. package/es/ReplyBubbleHeader/ReplyBubbleHeader.js +20 -18
  52. package/es/ReplyBubbleHeader/css/ReplyBubbleHeader.module.css +15 -4
  53. package/es/ReplyBubbleHeader/css/cssJSLogic.js +9 -1
  54. package/es/ReplyBubbleHeader/props/defaultProps.js +1 -2
  55. package/es/ReplyBubbleHeader/props/propTypes.js +1 -2
  56. package/es/TextBubble/TextBubble.js +8 -9
  57. package/es/TextBubble/css/TextBubble.module.css +11 -2
  58. package/es/Theme/ThemeWrapper.js +32 -29
  59. package/es/Theme/crm/dark/blueFanTheme.js +1 -1
  60. package/es/Theme/crm/dark/blueTheme.js +1 -1
  61. package/es/Theme/crm/dark/darkBlueTheme.js +1 -1
  62. package/es/Theme/crm/dark/darkGreyTheme.js +1 -1
  63. package/es/Theme/crm/dark/greenTheme.js +1 -1
  64. package/es/Theme/crm/dark/orangeTheme.js +1 -1
  65. package/es/Theme/crm/dark/pinkTheme.js +1 -1
  66. package/es/Theme/crm/dark/tealTheme.js +1 -1
  67. package/es/Theme/crm/dark/whiteTheme.js +1 -1
  68. package/es/Theme/crm/light/blueFanTheme.js +1 -1
  69. package/es/Theme/crm/light/blueTheme.js +1 -1
  70. package/es/Theme/crm/light/darkBlueTheme.js +1 -1
  71. package/es/Theme/crm/light/darkGreyTheme.js +1 -1
  72. package/es/Theme/crm/light/greenTheme.js +1 -1
  73. package/es/Theme/crm/light/orangeTheme.js +1 -1
  74. package/es/Theme/crm/light/pinkTheme.js +1 -1
  75. package/es/Theme/crm/light/tealTheme.js +1 -1
  76. package/es/Theme/crm/light/whiteTheme.js +1 -1
  77. package/es/Theme/crm/pureDark/blueFanTheme.js +1 -1
  78. package/es/Theme/crm/pureDark/blueTheme.js +1 -1
  79. package/es/Theme/crm/pureDark/darkBlueTheme.js +1 -1
  80. package/es/Theme/crm/pureDark/darkGreyTheme.js +1 -1
  81. package/es/Theme/crm/pureDark/greenTheme.js +1 -1
  82. package/es/Theme/crm/pureDark/orangeTheme.js +1 -1
  83. package/es/Theme/crm/pureDark/pinkTheme.js +1 -1
  84. package/es/Theme/crm/pureDark/tealTheme.js +1 -1
  85. package/es/Theme/crm/pureDark/whiteTheme.js +1 -1
  86. package/es/Theme/desk/commonDeskColorVariable.js +10 -10
  87. package/es/Theme/desk/dark/blueTheme.js +42 -16
  88. package/es/Theme/desk/dark/commonColorVariable.js +10 -5
  89. package/es/Theme/desk/dark/greenTheme.js +41 -15
  90. package/es/Theme/desk/dark/orangeTheme.js +34 -8
  91. package/es/Theme/desk/dark/redTheme.js +50 -15
  92. package/es/Theme/desk/dark/yellowTheme.js +41 -15
  93. package/es/Theme/desk/light/blueTheme.js +35 -18
  94. package/es/Theme/desk/light/commonColorVariable.js +7 -1
  95. package/es/Theme/desk/light/greenTheme.js +39 -13
  96. package/es/Theme/desk/light/orangeTheme.js +38 -13
  97. package/es/Theme/desk/light/redTheme.js +38 -13
  98. package/es/Theme/desk/light/yellowTheme.js +39 -13
  99. package/es/Theme/desk/pureDark/blueTheme.js +41 -14
  100. package/es/Theme/desk/pureDark/commonColorVariable.js +6 -1
  101. package/es/Theme/desk/pureDark/greenTheme.js +40 -14
  102. package/es/Theme/desk/pureDark/orangeTheme.js +40 -14
  103. package/es/Theme/desk/pureDark/redTheme.js +40 -14
  104. package/es/Theme/desk/pureDark/yellowTheme.js +40 -14
  105. package/es/Theme/utils/getThemeConfigurations.js +5 -5
  106. package/es/Video/Video.js +13 -12
  107. package/es/VideoBubble/VideoBubble.js +2 -3
  108. package/es/icons/create-icon-components.js +1 -0
  109. package/es/icons/icon.template.js +2 -2
  110. package/es/icons/iconSrc/actions/ConvertTicket.js +1 -0
  111. package/es/icons/iconSrc/actions/index.js +1 -1
  112. package/es/icons/iconSrc/attachments/Audio.js +1 -0
  113. package/es/icons/iconSrc/attachments/Code.js +1 -0
  114. package/es/icons/iconSrc/attachments/Image.js +1 -0
  115. package/es/icons/iconSrc/attachments/Pdf.js +1 -0
  116. package/es/icons/iconSrc/attachments/Txt.js +1 -0
  117. package/es/icons/iconSrc/attachments/Unknown.js +1 -0
  118. package/es/icons/iconSrc/attachments/Video.js +1 -0
  119. package/es/icons/iconSrc/attachments/Zip.js +1 -0
  120. package/es/icons/iconSrc/attachments/index.js +8 -8
  121. package/es/icons/iconSrc/common/Article.js +1 -0
  122. package/es/icons/iconSrc/common/Quote.js +1 -0
  123. package/es/icons/iconSrc/common/index.js +2 -2
  124. package/es/icons/iconSrc/integrations/ChInstagram.js +1 -0
  125. package/es/icons/iconSrc/integrations/ChWhatsApp.js +1 -0
  126. package/es/icons/iconSrc/integrations/TtASAP.js +1 -0
  127. package/es/icons/iconSrc/integrations/TtTelegram.js +1 -0
  128. package/es/icons/iconSrc/integrations/TtTwillio.js +1 -0
  129. package/es/icons/iconSrc/integrations/TtTwitter.js +1 -0
  130. package/es/icons/iconSrc/integrations/TtWechat.js +1 -0
  131. package/es/icons/iconSrc/integrations/index.js +7 -7
  132. package/es/icons/iconSrc/messageStatus/Clock.js +1 -0
  133. package/es/icons/iconSrc/messageStatus/DoubleTick.js +1 -0
  134. package/es/icons/iconSrc/messageStatus/Failed.js +1 -0
  135. package/es/icons/iconSrc/messageStatus/Tick.js +1 -0
  136. package/es/icons/iconSrc/messageStatus/index.js +4 -4
  137. package/es/im/IMArticleBubble/IMArticleBubble.js +3 -4
  138. package/es/im/IMAttachmentBubble/IMAttachmentBubble.js +4 -5
  139. package/es/im/IMAttachmentIcon/IMAttachmentIcon.js +8 -9
  140. package/es/im/IMAudioBubble/IMAudioBubble.js +3 -4
  141. package/es/im/IMAudioBubble/css/cssJSLogic.js +2 -2
  142. package/es/im/IMAutoMessageInfo/IMAutoMessageInfo.js +0 -1
  143. package/es/im/IMDateTime/IMDateTime.js +0 -1
  144. package/es/im/IMDateTime/css/IMDateTime.module.css +6 -1
  145. package/es/im/IMImageBubble/IMImageBubble.js +6 -5
  146. package/es/im/IMInfoBubble/IMInfoBubble.js +0 -1
  147. package/es/im/IMLocationBubble/IMLocationBubble.js +6 -5
  148. package/es/im/IMMessage/IMMessage.js +57 -103
  149. package/es/im/IMMessage/props/defaultProps.js +1 -19
  150. package/es/im/IMMessage/props/propTypes.js +17 -30
  151. package/es/im/IMMessageAvatar/IMMessageAvatar.js +7 -7
  152. package/es/im/IMMessageAvatar/props/defaultProps.js +4 -4
  153. package/es/im/IMMessageAvatar/props/propTypes.js +25 -0
  154. package/es/im/IMMessageContent/IMMessageContent.js +44 -28
  155. package/es/im/IMMessageContent/css/IMMessageContent.module.css +3 -0
  156. package/es/im/IMMessageMeta/IMMessageMeta.js +3 -4
  157. package/es/im/IMReplyBubble/IMReplyBubble.js +14 -12
  158. package/es/im/IMReplyBubble/css/IMReplyBubble.module.css +7 -13
  159. package/es/im/IMTextBubble/IMTextBubble.js +3 -4
  160. package/es/im/IMTicketLink/IMTicketLink.js +1 -3
  161. package/es/im/IMVideoBubble/IMVideoBubble.js +3 -4
  162. package/es/im/index.js +0 -2
  163. package/es/index.js +28 -30
  164. package/es/{MessageWrapper → unused/MessageWrapper}/MessageWrapper.js +0 -1
  165. package/es/{TextMessage → unused/TextMessage}/DefaultActions.js +4 -4
  166. package/es/{TextMessage → unused/TextMessage}/TextMessage.js +14 -14
  167. package/es/{TextMessage → unused/TextMessage}/TextMessage1.js +18 -21
  168. package/package.json +4 -4
  169. package/es/im/IMMessage/renderChild/renderMessage.js +0 -8
  170. package/es/im/IMMessage/renderChild/renderMessageActions.js +0 -8
  171. package/es/im/IMMessage/renderChild/renderMessageBox.js +0 -15
  172. package/es/im/IMMessage/renderChild/renderMessageBoxFooter.js +0 -8
  173. package/es/im/IMMessage/renderChild/renderMessageFooter.js +0 -8
  174. package/es/im/IMMessage/renderChild/renderMessageHeader.js +0 -8
  175. package/es/im/IMMessage/renderChild/renderMessageOwner.js +0 -8
  176. package/es/im/IMMessage/renderChild/renderMessageStatus.js +0 -8
  177. package/es/im/IMMessageActions/IMMessageActions.js +0 -150
  178. package/es/im/IMMessageActions/css/IMMessageActions.module.css +0 -31
  179. package/es/im/IMMessageActions/css/cssJSLogic.js +0 -20
  180. package/es/im/IMMessageActions/index.js +0 -1
  181. package/es/im/IMMessageActions/props/defaultProps.js +0 -12
  182. package/es/im/IMMessageActions/props/propTypes.js +0 -30
  183. package/es/im/IMMessageStatus/index.js +0 -1
  184. /package/es/{MessageActions → MessageActionsWrapper}/props/propConstants.js +0 -0
  185. /package/es/{im/IMMessageStatus/css/IMMessageStatus.module.css → MessageStatus/css/MessageStatus.module.css} +0 -0
  186. /package/es/{MessageBoxFooter → unused/MessageBoxFooter}/MessageBoxFooter.js +0 -0
  187. /package/es/{MessageBoxFooter → unused/MessageBoxFooter}/css/MessageBoxFooter.module.css +0 -0
  188. /package/es/{MessageBoxFooter → unused/MessageBoxFooter}/css/cssJSLogic.js +0 -0
  189. /package/es/{MessageBoxFooter → unused/MessageBoxFooter}/index.js +0 -0
  190. /package/es/{MessageBoxFooter → unused/MessageBoxFooter}/props/defaultProps.js +0 -0
  191. /package/es/{MessageBoxFooter → unused/MessageBoxFooter}/props/propTypes.js +0 -0
  192. /package/es/{MessageBoxHeader → unused/MessageBoxHeader}/MessageBoxHeader.js +0 -0
  193. /package/es/{MessageBoxHeader → unused/MessageBoxHeader}/css/MessageBoxHeader.module.css +0 -0
  194. /package/es/{MessageBoxHeader → unused/MessageBoxHeader}/css/cssJsLogic.js +0 -0
  195. /package/es/{MessageBoxHeader → unused/MessageBoxHeader}/index.js +0 -0
  196. /package/es/{MessageBoxHeader → unused/MessageBoxHeader}/props/defaultProps.js +0 -0
  197. /package/es/{MessageBoxHeader → unused/MessageBoxHeader}/props/propTypes.js +0 -0
  198. /package/es/{MessageWrapper → unused/MessageWrapper}/css/MessageWrapper.module.css +0 -0
  199. /package/es/{MessageWrapper → unused/MessageWrapper}/css/cssJSLogic.js +0 -0
  200. /package/es/{MessageWrapper → unused/MessageWrapper}/index.js +0 -0
  201. /package/es/{MessageWrapper → unused/MessageWrapper}/props/defaultProps.js +0 -0
  202. /package/es/{MessageWrapper → unused/MessageWrapper}/props/propTypes.js +0 -0
  203. /package/es/{TextMessage → unused/TextMessage}/css/TextMessage.module.css +0 -0
  204. /package/es/{TextMessage → unused/TextMessage}/css/cssJSLogic.js +0 -0
  205. /package/es/{TextMessage → unused/TextMessage}/index.js +0 -0
  206. /package/es/{TextMessage → unused/TextMessage}/props/defaultProps.js +0 -0
  207. /package/es/{TextMessage → unused/TextMessage}/props/propConstants.js +0 -0
  208. /package/es/{TextMessage → unused/TextMessage}/props/propTypes.js +0 -0
  209. /package/es/{Theme → unused}/darkTheme.js +0 -0
  210. /package/es/{Theme → unused}/defaultTheme.js +0 -0
@@ -1,3 +1,4 @@
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); }
1
2
  /* eslint-disable react/jsx-no-bind */
2
3
  /* eslint-disable max-len */
3
4
 
@@ -8,128 +9,92 @@ import React from 'react';
8
9
  import messageDefaultProps from './props/defaultProps';
9
10
  import messagePropTypes from './props/propTypes';
10
11
  import { direction as directionConstants } from '@zohoim/chat-components-utils/es/constants/messageConstants';
12
+ import { dummyObject } from '@zohoim/chat-components-utils/es/constants';
13
+ import messageStatusConstants from '@zohoim/chat-components-utils/es/constants/messageStatusConstants';
11
14
 
12
15
  /** ** Components *** */
13
16
  import MessageBubble from '../MessageBubble/MessageBubble';
14
17
  import MessageBox from '../MessageBox/MessageBox';
15
- import IMMessageAvatar from '../im/IMMessageAvatar/IMMessageAvatar';
16
- import IMMessageActions from '../im/IMMessageActions/IMMessageActions';
17
- import IMMessageStatus from '../im/IMMessageStatus/IMMessageStatus';
18
+ import MessageAvatar from '../MessageAvatar/MessageAvatar';
19
+ import MessageActions from '../MessageActions/MessageActions';
20
+ import MessageStatus from '../MessageStatus/MessageStatus';
21
+ const {
22
+ FAILED
23
+ } = messageStatusConstants;
18
24
  export default function Message(props) {
19
25
  const {
20
- customStyle,
21
26
  direction,
22
27
  isActive,
23
- needMessageActions,
24
- renderMessageBoxFooter,
25
- /* Avatar Related Props Start */
26
- needSender,
27
28
  isShowSender,
28
- senderSrc,
29
- senderAlternateSrc,
30
- senderTitle,
31
- senderAvatarSize,
32
- senderName,
33
- avatarCustomStyle,
34
- senderIntegrationIcon,
35
- senderIntegrationIconSize,
36
- senderIntegrationIconCustomStyle,
37
- isCustomIntegrationIcon,
38
- isCustomSenderAvatar,
39
- renderCustomIntegrationIcon,
40
- renderCustomSenderAvatar,
41
- /*Avatar Related Props End*/
42
-
43
- /* MessageBox Props Start */
44
- isFailedMessage,
45
- needMessageBox,
46
- renderMessage,
47
- renderMessageFooter,
48
- renderMessageHeader,
49
- messageBoxCustomStyle,
50
- /*MessageBox Props End */
51
-
52
- /* MessageAction Props Start */
53
- messageActions,
54
- actionsDefaultShowCount,
55
- actionIconCustomStyle,
56
- moreActionItemCustomStyle,
57
- onSelectAction,
58
- messageActionCustomStyle,
59
- moreActionPopupCustomStyle,
29
+ ownerDetails,
30
+ renderOwnerOverlay,
31
+ status,
32
+ statusTooltip,
33
+ actions,
60
34
  renderSecondaryActions,
61
- /* MessageAction Props End */
62
-
63
- /*MessageStatus Props Start */
64
- messageStatus,
65
- messageStatusCustomStyle,
66
- statusTitle
67
- /*MessageStatus Props End */
35
+ onSelectAction,
36
+ renderContent,
37
+ customProps
68
38
  } = props;
69
- function handleRenderMessageStatus() {
39
+ const {
40
+ messageBubbleProps = dummyObject,
41
+ messageOwnerProps = dummyObject,
42
+ messageBoxProps = dummyObject,
43
+ messageStatusProps = dummyObject,
44
+ messageActionsProps = dummyObject
45
+ } = customProps;
46
+ const isIncoming = direction === directionConstants.IN;
47
+ const isOutgoing = direction === directionConstants.OUT;
48
+ const isFailed = status === FAILED;
49
+ function handleRenderMessageOwner() {
50
+ const {
51
+ src,
52
+ alternateSrc,
53
+ name
54
+ } = ownerDetails || dummyObject;
70
55
  const props = {
71
- messageStatus,
72
- customStyle: messageStatusCustomStyle,
73
- title: statusTitle
56
+ src,
57
+ alternateSrc,
58
+ title: name,
59
+ renderIcon: renderOwnerOverlay
74
60
  };
75
- return messageStatus ? /*#__PURE__*/React.createElement(IMMessageStatus, props) : null;
61
+ return ownerDetails ? /*#__PURE__*/React.createElement(MessageAvatar, _extends({}, props, messageOwnerProps)) : null;
76
62
  }
77
- function handleRenderMessageBox() {
63
+ function handleRenderMessageStatus() {
78
64
  const props = {
79
- renderMessageFooter,
80
- renderMessageHeader,
81
- renderMessageStatus: handleRenderMessageStatus,
82
- renderMessage,
83
- customStyle: messageBoxCustomStyle,
84
- isFailed: isFailedMessage,
85
- isIncoming: direction === directionConstants.IN,
86
- isOutgoing: direction === directionConstants.OUT
65
+ messageStatus: status,
66
+ title: statusTooltip
87
67
  };
88
- return /*#__PURE__*/React.createElement(MessageBox, props);
68
+ return status ? /*#__PURE__*/React.createElement(MessageStatus, _extends({}, props, messageStatusProps)) : null;
89
69
  }
90
- function handleRenderMessageOwner() {
70
+ function handleRenderMessageBox() {
91
71
  const props = {
92
- src: senderSrc,
93
- alternateSrc: senderAlternateSrc,
94
- title: senderTitle,
95
- avatarSize: senderAvatarSize,
96
- name: senderName,
97
- customStyle: avatarCustomStyle,
98
- integrationName: senderIntegrationIcon,
99
- iconSize: senderIntegrationIconSize,
100
- iconCustomStyle: senderIntegrationIconCustomStyle,
101
- isCustomIcon: isCustomIntegrationIcon,
102
- renderCustomIcon: renderCustomIntegrationIcon,
103
- isCustomAvatar: isCustomSenderAvatar,
104
- renderCustomAvatar: renderCustomSenderAvatar
72
+ renderMessageStatus: handleRenderMessageStatus,
73
+ renderMessage: renderContent,
74
+ isFailed,
75
+ isIncoming,
76
+ isOutgoing
105
77
  };
106
- return isShowSender ? /*#__PURE__*/React.createElement(IMMessageAvatar, props) : null;
78
+ return /*#__PURE__*/React.createElement(MessageBox, _extends({}, props, messageBoxProps));
107
79
  }
108
80
  function handleRenderMessageActions() {
109
81
  const props = {
110
- actions: messageActions,
111
- renderSecondaryActions: renderSecondaryActions,
112
- defaultShowCount: actionsDefaultShowCount,
113
- actionIconCustomStyle: actionIconCustomStyle,
114
- moreItemCustomStyle: moreActionItemCustomStyle,
82
+ actions,
115
83
  onSelect: onSelectAction,
116
- customStyle: messageActionCustomStyle,
117
- morePopupCustomStyle: moreActionPopupCustomStyle
84
+ renderSecondaryActions
118
85
  };
119
- return /*#__PURE__*/React.createElement(IMMessageActions, props);
86
+ return /*#__PURE__*/React.createElement(MessageActions, _extends({}, props, messageActionsProps));
120
87
  }
121
- return /*#__PURE__*/React.createElement(MessageBubble, {
88
+ const needMessageActions = !!actions;
89
+ return /*#__PURE__*/React.createElement(MessageBubble, _extends({
122
90
  direction: direction,
123
91
  isActive: isActive,
124
92
  needMessageActions: needMessageActions,
125
- renderMessageBox: handleRenderMessageBox,
126
- renderMessageBoxFooter: renderMessageBoxFooter,
127
- renderMessageOwner: handleRenderMessageOwner,
93
+ needSender: isShowSender,
128
94
  renderMessageActions: handleRenderMessageActions,
129
- customStyle: customStyle,
130
- needSender: needSender,
131
- isShowSender: isShowSender
132
- });
95
+ renderMessageBox: handleRenderMessageBox,
96
+ renderMessageOwner: handleRenderMessageOwner
97
+ }, messageBubbleProps));
133
98
  }
134
99
  Message.propTypes = messagePropTypes;
135
100
  Message.defaultProps = messageDefaultProps;
@@ -1,43 +1,11 @@
1
1
  /** ** Constants *** */
2
- import { dummyObject, dummyArray } from '@zohoim/chat-components-utils/es/constants';
3
2
  import { direction } from '@zohoim/chat-components-utils/es/constants/messageConstants';
4
- import sizes from '@zohoim/chat-components-utils/es/constants/sizes';
5
- import { actionsDefaultShowCount } from '@zohoim/chat-components-utils/es/constants/messageActionConstants';
6
3
  const messageDefaultProps = {
7
- customStyle: dummyObject,
8
4
  direction: direction.IN,
9
5
  isActive: false,
10
- needMessageActions: true,
11
- needSender: true,
12
6
  isShowSender: true,
13
- senderSrc: '',
14
- senderAlternateSrc: '',
15
- senderTitle: '',
16
- //'RAVI KUMAR',
17
- senderAvatarSize: 'medium',
18
- senderName: '',
19
- //'Ravi kumar',
20
- avatarCustomStyle: dummyObject,
21
- senderIntegrationIcon: '',
22
- //WHATSAPP
23
- senderIntegrationIconSize: sizes.SMALL,
24
- senderIntegrationIconCustomStyle: dummyObject,
25
- isCustomIntegrationIcon: false,
26
- isCustomSenderAvatar: false,
27
- needMessageBox: true,
28
- isFailedMessage: false,
29
- messageBoxCustomStyle: dummyObject,
30
- messageActions: dummyArray,
31
- actionsDefaultShowCount: actionsDefaultShowCount,
32
- actionIconCustomStyle: dummyObject,
33
- moreActionItemCustomStyle: dummyObject,
34
- messageActionCustomStyle: dummyObject,
35
- moreActionPopupCustomStyle: dummyObject,
36
- messageStatus: '',
37
- // READ,
38
- messageStatusCustomStyle: dummyObject,
39
- statusTitle: '' // READ,
40
- // renderMessage: () => <div>Test</div>
7
+ customProps: {}
8
+ // renderContent: () => <div>Test</div>
41
9
  };
42
10
 
43
11
  export default messageDefaultProps;
@@ -2,11 +2,9 @@
2
2
  import PropTypes from 'prop-types';
3
3
 
4
4
  /** ** Constants *** */
5
- import integrationConstants from '@zohoim/chat-components-utils/es/constants/integrationConstants';
6
5
  import { defaultMessageActions } from '@zohoim/chat-components-utils/es/constants/messageActionConstants';
7
6
  import messageStatusConstants from '@zohoim/chat-components-utils/es/constants/messageStatusConstants';
8
7
  import { direction } from '@zohoim/chat-components-utils/es/constants/messageConstants';
9
- import sizes from '@zohoim/chat-components-utils/es/constants/sizes';
10
8
  const {
11
9
  REPLY,
12
10
  COPY,
@@ -16,15 +14,6 @@ const {
16
14
  DELETE,
17
15
  FORWARD
18
16
  } = defaultMessageActions;
19
- const {
20
- WHATSAPP,
21
- TELEGRAM,
22
- INSTAGRAM,
23
- ASAP,
24
- WECHAT,
25
- TWILLIO,
26
- LINE
27
- } = integrationConstants;
28
17
  const {
29
18
  SENT,
30
19
  SAVED,
@@ -40,59 +29,32 @@ const {
40
29
  OUT
41
30
  } = direction;
42
31
  const messagePropTypes = {
43
- customStyle: PropTypes.object,
44
- direction: PropTypes.oneOf([IN, OUT]),
32
+ direction: PropTypes.oneOf([IN, OUT]).isRequired,
45
33
  isActive: PropTypes.bool,
46
- needMessageActions: PropTypes.bool,
47
- renderMessageBoxFooter: PropTypes.func,
48
- /* Avatar Related Props Start */
49
- needSender: PropTypes.bool,
50
34
  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.isRequired,
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({
35
+ ownerDetails: PropTypes.shape({
36
+ src: PropTypes.string,
37
+ alternateSrc: PropTypes.string,
38
+ name: PropTypes.string
39
+ }),
40
+ renderOwnerOverlay: PropTypes.func,
41
+ status: PropTypes.oneOf([SENT, SAVED, QUEUED, DELIVERED, READ, UNSENT, FAILED, OUTGOING]),
42
+ statusTooltip: PropTypes.string,
43
+ actions: PropTypes.arrayOf(PropTypes.shape({
77
44
  id: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([REPLY, COPY, DOWNLOAD, CREATE_TICKET, RESEND, DELETE, FORWARD])]).isRequired,
78
45
  displayText: PropTypes.string,
79
46
  renderFunction: PropTypes.func,
80
47
  iconTitle: PropTypes.string
81
48
  })),
82
- renderSecondaryActions: PropTypes.func,
83
- actionsDefaultShowCount: PropTypes.number,
84
- actionIconCustomStyle: PropTypes.object,
85
- moreActionItemCustomStyle: PropTypes.object,
86
49
  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 */
50
+ renderSecondaryActions: PropTypes.func,
51
+ renderContent: PropTypes.func.isRequired,
52
+ customProps: PropTypes.shape({
53
+ messageBubbleProps: PropTypes.object,
54
+ messageOwnerProps: PropTypes.object,
55
+ messageBoxProps: PropTypes.object,
56
+ messageStatusProps: PropTypes.object,
57
+ messageActionsProps: PropTypes.object
58
+ })
96
59
  };
97
-
98
60
  export default messagePropTypes;
@@ -24,19 +24,19 @@ export default function MessageAction(props) {
24
24
  closePopup
25
25
  } = props;
26
26
  return /*#__PURE__*/React.createElement(React.Fragment, null, isShowInMore ? /*#__PURE__*/React.createElement(MoreActionItem, {
27
+ closePopup: closePopup,
28
+ customStyle: moreItemCustomStyle,
27
29
  displayText: displayText,
28
30
  iconTitle: iconTitle,
29
31
  id: id,
30
32
  index: index,
31
- customStyle: moreItemCustomStyle,
32
33
  onClick: onClick,
33
- renderIcon: renderIcon,
34
- closePopup: closePopup
34
+ renderIcon: renderIcon
35
35
  }) : /*#__PURE__*/React.createElement(ActionIcon, {
36
- renderIcon: renderIcon,
37
36
  customStyle: actionIconCustomStyle,
38
- onClick: onClick,
39
37
  id: id,
38
+ onClick: onClick,
39
+ renderIcon: renderIcon,
40
40
  title: iconTitle
41
41
  }));
42
42
  }
@@ -1,75 +1,150 @@
1
+ /* eslint-disable no-use-before-define */
2
+ /* eslint-disable react/jsx-no-bind */
1
3
  /* eslint-disable max-len */
4
+ /* eslint-disable arrow-parens */
2
5
 
3
6
  /** ** Libraries *** */
4
7
  import React from 'react';
5
8
 
6
9
  /** ** Components *** */
7
- import { Container } from '@zohodesk/components/lib/Layout';
8
- import MessageActionsMore from '../MessageActionsMore/MessageActionsMore';
10
+ import ActionIcon from '../ActionIcon/ActionIcon';
11
+ import MessageActionsWrapper from '../MessageActionsWrapper/MessageActionsWrapper';
12
+ import MessageAction from '../MessageAction/MessageAction';
9
13
 
10
- /** ** Hooks *** */
11
- import { useMessageAction } from '@zohoim/chat-components-hooks';
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';
12
23
 
13
- /** ** Constants *** */
14
- import messageActionsDefaultProps from './props/defaultProps';
15
- import messageActionsPropTypes from './props/propTypes';
16
- import constantProps from './props/propConstants';
24
+ /** ** Hooks *** */
25
+ import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
26
+ import useMessageActions from '@zohoim/chat-components-hooks/es/MessageActions/useMessageActions';
17
27
 
18
28
  /** ** Methods *** */
19
29
  import renderHandler from '@zohoim/chat-components-utils/es/common/renderHandler';
20
- import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
21
30
  import cssJSLogic from './css/cssJSLogic';
22
31
 
23
- /** ** Style *** */
32
+ /** ** Constants *** */
33
+ import messageActionsDefaultProps from './props/defaultProps';
34
+ import messageActionsPropTypes 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 *** */
24
39
  import style from './css/MessageActions.module.css';
25
- function MessageActions(props) {
40
+ const {
41
+ REPLY,
42
+ COPY,
43
+ DOWNLOAD,
44
+ CREATE_TICKET,
45
+ RESEND,
46
+ DELETE,
47
+ FORWARD
48
+ } = defaultMessageActions;
49
+ export default function MessageActions(props) {
26
50
  const {
27
51
  actions,
28
- renderMoreIcon,
29
52
  defaultShowCount,
53
+ actionIconCustomStyle,
54
+ moreItemCustomStyle,
55
+ onSelect,
30
56
  customStyle,
31
- morePopupCustomStyle
57
+ morePopupCustomStyle,
58
+ renderSecondaryActions
32
59
  } = props;
33
60
 
34
61
  /* external customization */
35
62
  const newStyle = useMergeStyle(style, customStyle);
36
63
  /* css classnames added based on logic */
37
64
  const {
38
- actionsClass
65
+ moreIconClass,
66
+ secondaryActionsClass,
67
+ iconStyle
39
68
  } = cssJSLogic(props, newStyle);
40
69
  const {
41
- isShowMore: isShowMoreIcon,
42
- revampedActions = []
43
- } = useMessageAction(actions, defaultShowCount);
70
+ actionDetails
71
+ } = useMessageActions({
72
+ actions,
73
+ defaultRenderFunction: renderAction
74
+ });
44
75
  const {
45
- defaultActions = [],
46
- moreActions
47
- } = revampedActions;
48
- function renderRow(defaultActions, isShowMore) {
49
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Container, {
50
- alignBox: "row"
51
- }, defaultActions.map(action => {
52
- const {
53
- id,
54
- renderFunction
55
- } = action;
56
- return renderHandler(renderFunction)({
57
- id,
58
- isShowInMore: false,
59
- action
60
- }); // id, isRenderInMorePopup
61
- }), isShowMore ? /*#__PURE__*/React.createElement(MessageActionsMore, {
62
- actions: moreActions,
63
- renderMoreIcon: renderMoreIcon,
64
- customStyle: morePopupCustomStyle
65
- }) : null));
76
+ allActions
77
+ } = actionDetails;
78
+ function handleClickAction(_ref) {
79
+ let {
80
+ id,
81
+ e
82
+ } = _ref;
83
+ onSelect && onSelect({
84
+ id,
85
+ e
86
+ });
87
+ }
88
+ function renderIcon(_ref2) {
89
+ let {
90
+ id
91
+ } = _ref2;
92
+ const iconMapping = {
93
+ [REPLY]: ReplyIcon,
94
+ [COPY]: CopyIcon,
95
+ [DOWNLOAD]: DownloadIcon,
96
+ [CREATE_TICKET]: ConvertTicket,
97
+ [RESEND]: ReloadIcon,
98
+ [DELETE]: DeleteIcon,
99
+ [FORWARD]: ForwardIcon
100
+ };
101
+ const IconComponent = iconMapping[id];
102
+ return IconComponent ? /*#__PURE__*/React.createElement(IconComponent, {
103
+ customStyle: iconStyle
104
+ }) : null;
105
+ }
106
+ function renderAction() {
107
+ let {
108
+ id,
109
+ isShowInMore,
110
+ action,
111
+ closePopup
112
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
113
+ const {
114
+ displayText,
115
+ iconTitle
116
+ } = action || dummyObject;
117
+ return /*#__PURE__*/React.createElement(MessageAction, {
118
+ actionIconCustomStyle: actionIconCustomStyle,
119
+ closePopup: closePopup,
120
+ displayText: displayText,
121
+ iconTitle: iconTitle,
122
+ id: id,
123
+ index: id,
124
+ isShowInMore: isShowInMore,
125
+ key: id,
126
+ moreItemCustomStyle: moreItemCustomStyle,
127
+ onClick: handleClickAction,
128
+ renderIcon: renderIcon
129
+ });
130
+ }
131
+ function renderMoreIcon() {
132
+ return /*#__PURE__*/React.createElement(ActionIcon, {
133
+ customStyle: actionIconCustomStyle,
134
+ renderIcon: () => /*#__PURE__*/React.createElement("div", {
135
+ className: moreIconClass
136
+ }, /*#__PURE__*/React.createElement(MoreIcon, null))
137
+ });
66
138
  }
67
- return /*#__PURE__*/React.createElement("div", {
68
- className: actionsClass
69
- }, renderRow(defaultActions, isShowMoreIcon));
139
+ const secondaryActions = renderHandler(renderSecondaryActions)();
140
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(MessageActionsWrapper, {
141
+ actions: allActions,
142
+ defaultShowCount: defaultShowCount,
143
+ morePopupCustomStyle: morePopupCustomStyle,
144
+ renderMoreIcon: renderMoreIcon
145
+ }), secondaryActions ? /*#__PURE__*/React.createElement("div", {
146
+ className: secondaryActionsClass
147
+ }, secondaryActions) : null);
70
148
  }
71
- MessageActions.defaultProps = messageActionsDefaultProps;
72
149
  MessageActions.propTypes = messageActionsPropTypes;
73
- MessageActions.constantProps = constantProps;
74
- MessageActions.displayName = 'MessageActions';
75
- export default MessageActions;
150
+ MessageActions.defaultProps = messageActionsDefaultProps;
@@ -1,3 +1,31 @@
1
- .messageActions {
2
- /*Use this class for message actions customization*/
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
+ [dir=ltr] .secondaryActions {
20
+ text-align: left;
21
+ }
22
+
23
+ [dir=rtl] .secondaryActions {
24
+ text-align: right;
25
+ }
26
+
27
+ .icon {
28
+ composes: varClass;
29
+ width: var(--imMessageActions-action_icon_size);
30
+ height: var(--imMessageActions-action_icon_size);
3
31
  }
@@ -1,10 +1,20 @@
1
1
  /** ** Methods *** */
2
2
  import { compileClassNames } from '@zohodesk/utils';
3
3
  export default function cssJSLogic(props, style) {
4
- const actionsClass = compileClassNames({
5
- [style.messageActions]: true
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
6
12
  });
7
13
  return {
8
- actionsClass
14
+ moreIconClass,
15
+ secondaryActionsClass,
16
+ iconStyle: {
17
+ base: iconClass
18
+ }
9
19
  };
10
20
  }
@@ -1,10 +1,12 @@
1
1
  /** ** Constants *** */
2
2
  import { dummyObject, dummyArray } from '@zohoim/chat-components-utils/es/constants';
3
- import propConstants from './propConstants';
3
+ import { actionsDefaultShowCount } from '@zohoim/chat-components-utils/es/constants/messageActionConstants';
4
4
  const messageActionsDefaultProps = {
5
- actions: dummyArray,
6
5
  customStyle: dummyObject,
6
+ actionIconCustomStyle: dummyObject,
7
7
  morePopupCustomStyle: dummyObject,
8
- defaultShowCount: propConstants.actions.defaultShowCount
8
+ moreItemCustomStyle: dummyObject,
9
+ defaultShowCount: actionsDefaultShowCount,
10
+ actions: dummyArray
9
11
  };
10
12
  export default messageActionsDefaultProps;
@@ -1,12 +1,30 @@
1
1
  /** ** Libraries *** */
2
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;
3
15
  const messageActionsPropTypes = {
4
- renderMoreIcon: PropTypes.func,
5
16
  actions: PropTypes.arrayOf(PropTypes.shape({
6
- id: PropTypes.string.isRequired,
7
- renderFunction: PropTypes.func
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
8
21
  })).isRequired,
9
22
  defaultShowCount: PropTypes.number,
10
- customStyle: PropTypes.object
23
+ actionIconCustomStyle: PropTypes.object,
24
+ morePopupCustomStyle: PropTypes.object,
25
+ moreItemCustomStyle: PropTypes.object,
26
+ onSelect: PropTypes.func,
27
+ customStyle: PropTypes.object,
28
+ renderSecondaryActions: PropTypes.func
11
29
  };
12
30
  export default messageActionsPropTypes;