@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.
Files changed (138) hide show
  1. package/es/ActionIcon/ActionIcon.js +19 -9
  2. package/es/ActionIcon/css/cssJSLogic.js +1 -0
  3. package/es/ActionIcon/props/defaultProps.js +3 -1
  4. package/es/ActionIcon/props/propTypes.js +4 -2
  5. package/es/IMDateTime/css/IMDateTime.module.css +0 -0
  6. package/es/IMDateTime/css/cssJSLogic.js +0 -0
  7. package/es/IMDateTime/index.js +0 -0
  8. package/es/IMDateTime/props/defaultProps.js +0 -0
  9. package/es/IMDateTime/props/propTypes.js +0 -0
  10. package/es/IMIntegrationIcon/IMIntegrationIcon.js +90 -0
  11. package/es/IMIntegrationIcon/css/IMIntegrationIcon.module.css +98 -0
  12. package/es/IMIntegrationIcon/css/cssJSLogic.js +56 -0
  13. package/es/IMIntegrationIcon/index.js +2 -0
  14. package/es/IMIntegrationIcon/props/defaultProps.js +9 -0
  15. package/es/IMIntegrationIcon/props/propConstants.js +8 -0
  16. package/es/IMIntegrationIcon/props/propTypes.js +25 -0
  17. package/es/IMMessage/IMMessage.js +143 -0
  18. package/es/IMMessage/css/IMMessage.module.css +0 -0
  19. package/es/IMMessage/css/cssJSLogic.js +10 -0
  20. package/es/IMMessage/index.js +1 -0
  21. package/es/IMMessage/props/defaultProps.js +51 -0
  22. package/es/IMMessage/props/propTypes.js +98 -0
  23. package/es/IMMessage/renderChild/renderMessage.js +8 -0
  24. package/es/IMMessage/renderChild/renderMessageActions.js +8 -0
  25. package/es/IMMessage/renderChild/renderMessageBox.js +15 -0
  26. package/es/IMMessage/renderChild/renderMessageBoxFooter.js +8 -0
  27. package/es/IMMessage/renderChild/renderMessageFooter.js +8 -0
  28. package/es/IMMessage/renderChild/renderMessageHeader.js +8 -0
  29. package/es/IMMessage/renderChild/renderMessageOwner.js +8 -0
  30. package/es/IMMessage/renderChild/renderMessageStatus.js +8 -0
  31. package/es/IMMessageActions/IMMessageActions.js +146 -0
  32. package/es/IMMessageActions/css/IMMessageActions.module.css +23 -0
  33. package/es/IMMessageActions/css/cssJSLogic.js +20 -0
  34. package/es/IMMessageActions/index.js +1 -0
  35. package/es/IMMessageActions/props/defaultProps.js +12 -0
  36. package/es/IMMessageActions/props/propTypes.js +30 -0
  37. package/es/IMMessageAvatar/IMMessageAvatar.js +45 -0
  38. package/es/IMMessageAvatar/css/IMMessageAvatar.module.css +0 -0
  39. package/es/IMMessageAvatar/css/cssJSLogic.js +0 -0
  40. package/es/IMMessageAvatar/index.js +1 -0
  41. package/es/IMMessageAvatar/props/defaultProps.js +10 -0
  42. package/es/IMMessageAvatar/props/propTypes.js +28 -0
  43. package/es/IMMessageStatus/IMMessageStatus.js +69 -0
  44. package/es/IMMessageStatus/css/IMMessageStatus.module.css +12 -0
  45. package/es/IMMessageStatus/css/cssJSLogic.js +22 -0
  46. package/es/IMMessageStatus/index.js +1 -0
  47. package/es/IMMessageStatus/props/defaultProps.js +6 -0
  48. package/es/IMMessageStatus/props/propTypes.js +21 -0
  49. package/es/MessageAction/MessageAction.js +42 -0
  50. package/es/MessageAction/css/MessageAction.module.css +0 -0
  51. package/es/MessageAction/css/cssJSLogic.js +0 -0
  52. package/es/MessageAction/index.js +1 -0
  53. package/es/MessageAction/props/defaultProps.js +8 -0
  54. package/es/MessageAction/props/propTypes.js +14 -0
  55. package/es/MessageActions/MessageActions.js +30 -7
  56. package/es/MessageActions/css/MessageActions.module.css +3 -0
  57. package/es/MessageActions/css/cssJSLogic.js +10 -0
  58. package/es/MessageActions/index.js +1 -2
  59. package/es/MessageActions/props/defaultProps.js +6 -3
  60. package/es/MessageActions/props/propConstants.js +3 -1
  61. package/es/MessageActions/props/propTypes.js +6 -2
  62. package/es/MessageActionsMore/MessageActionsMore.js +23 -5
  63. package/es/MessageActionsMore/css/MessageActionsMore.module.css +16 -0
  64. package/es/MessageActionsMore/css/cssJsLogic.js +28 -0
  65. package/es/MessageActionsMore/props/defaultProps.js +8 -4
  66. package/es/MessageActionsMore/props/propTypes.js +9 -3
  67. package/es/MessageAvatar/MessageAvatar.js +56 -0
  68. package/es/MessageAvatar/css/MessageAvatar.module.css +21 -0
  69. package/es/MessageAvatar/css/cssJSLogic.js +18 -0
  70. package/es/MessageAvatar/index.js +1 -0
  71. package/es/MessageAvatar/props/defaultProps.js +9 -0
  72. package/es/MessageAvatar/props/propTypes.js +13 -0
  73. package/es/MessageBox/css/MessageBox.module.css +11 -0
  74. package/es/MessageBox/css/cssJSLogic.js +3 -1
  75. package/es/MessageBox/index.js +1 -2
  76. package/es/MessageBox/props/defaultProps.js +4 -1
  77. package/es/MessageBox/props/propTypes.js +6 -4
  78. package/es/MessageBoxFooter/MessageBoxFooter.js +10 -3
  79. package/es/MessageBoxFooter/css/MessageBoxFooter.module.css +3 -1
  80. package/es/MessageBoxFooter/css/cssJSLogic.js +10 -0
  81. package/es/MessageBoxFooter/index.js +1 -2
  82. package/es/MessageBoxFooter/props/defaultProps.js +3 -1
  83. package/es/MessageBoxFooter/props/propTypes.js +1 -0
  84. package/es/MessageBubble/MessageBubble.js +13 -17
  85. package/es/MessageBubble/css/MessageBubble.module.css +5 -0
  86. package/es/MessageBubble/css/cssJSLogic.js +5 -12
  87. package/es/MessageBubble/index.js +1 -2
  88. package/es/MessageBubble/props/defaultProps.js +6 -4
  89. package/es/MessageBubble/props/propConstants.js +6 -6
  90. package/es/MessageBubble/props/propTypes.js +8 -7
  91. package/es/MoreActionItem/MoreActionItem.js +75 -0
  92. package/es/MoreActionItem/css/MoreActionItem.module.css +31 -0
  93. package/es/MoreActionItem/css/cssJSLogic.js +27 -0
  94. package/es/MoreActionItem/index.js +1 -0
  95. package/es/MoreActionItem/props/defaultProps.js +11 -0
  96. package/es/MoreActionItem/props/propTypes.js +12 -0
  97. package/es/TextMessage/DefaultActions.js +0 -1
  98. package/es/TextMessage/TextMessage.js +6 -6
  99. package/es/Theme/defaultTheme.js +20 -3
  100. package/es/icons/create-icon-components.js +141 -0
  101. package/es/icons/factory/actions/convertTicket.svg +21 -0
  102. package/es/icons/factory/integrations/chInstagram.svg +4 -0
  103. package/es/icons/factory/integrations/chWhatsApp.svg +4 -0
  104. package/es/icons/factory/integrations/ttASAP.svg +1 -0
  105. package/es/icons/factory/integrations/ttTelegram.svg +1 -0
  106. package/es/icons/factory/integrations/ttTwillio.svg +1 -0
  107. package/es/icons/factory/integrations/ttTwitter.svg +1 -0
  108. package/es/icons/factory/integrations/ttWechat.svg +1 -0
  109. package/es/icons/factory/messageStatus/clock.svg +7 -0
  110. package/es/icons/factory/messageStatus/doubleTick.svg +1 -0
  111. package/es/icons/factory/messageStatus/failed.svg +7 -0
  112. package/es/icons/factory/messageStatus/tick.svg +1 -0
  113. package/es/icons/icon.template.js +27 -0
  114. package/es/icons/iconSrc/actions/ConvertTicket.js +24 -0
  115. package/es/icons/iconSrc/actions/index.js +1 -0
  116. package/es/icons/iconSrc/integrations/ChInstagram.js +17 -0
  117. package/es/icons/iconSrc/integrations/ChWhatsApp.js +19 -0
  118. package/es/icons/iconSrc/integrations/TtASAP.js +31 -0
  119. package/es/icons/iconSrc/integrations/TtTelegram.js +21 -0
  120. package/es/icons/iconSrc/integrations/TtTwillio.js +35 -0
  121. package/es/icons/iconSrc/integrations/TtTwitter.js +40 -0
  122. package/es/icons/iconSrc/integrations/TtWechat.js +41 -0
  123. package/es/icons/iconSrc/integrations/index.js +7 -0
  124. package/es/icons/iconSrc/messageStatus/Clock.js +13 -0
  125. package/es/icons/iconSrc/messageStatus/DoubleTick.js +15 -0
  126. package/es/icons/iconSrc/messageStatus/Failed.js +13 -0
  127. package/es/icons/iconSrc/messageStatus/Tick.js +12 -0
  128. package/es/icons/iconSrc/messageStatus/index.js +4 -0
  129. package/es/index.js +10 -1
  130. package/es/{AvatarSpace → unused/AvatarSpace}/AvatarSpace.js +5 -0
  131. package/package.json +15 -9
  132. /package/es/{MessageBoxFooter/css/cssJsLogic.js → IMDateTime/IMDateTime.js} +0 -0
  133. /package/es/{AvatarSpace → unused/AvatarSpace}/css/AvatarSpace.module.css +0 -0
  134. /package/es/{AvatarSpace → unused/AvatarSpace}/css/cssJSLogic.js +0 -0
  135. /package/es/{AvatarSpace → unused/AvatarSpace}/index.js +0 -0
  136. /package/es/{AvatarSpace → unused/AvatarSpace}/props/defaultProps.js +0 -0
  137. /package/es/{AvatarSpace → unused/AvatarSpace}/props/propConstants.js +0 -0
  138. /package/es/{AvatarSpace → unused/AvatarSpace}/props/propTypes.js +0 -0
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/jsx-no-bind */
1
2
  /* eslint-disable max-len */
2
3
 
3
4
  /** ** Libraries *** */
@@ -21,25 +22,34 @@ export default function ActionIcon(props) {
21
22
  renderIcon,
22
23
  customStyle,
23
24
  onClick,
24
- id
25
+ id,
26
+ title
25
27
  } = props;
26
- function handleClick() {
27
- onClick && onClick(id);
28
+ function handleClick(e) {
29
+ onClick && onClick({
30
+ e,
31
+ id
32
+ });
28
33
  }
29
34
 
30
- /* external customization */
35
+ /* External customization */
31
36
  const newStyle = useMergeStyle(style, customStyle);
32
- /* css classnames added based on logic */
37
+
38
+ /* CSS classnames added based on logic */
33
39
  const {
34
40
  actionIconClass
35
41
  } = cssJSLogic(props, newStyle);
36
- const icon = renderHandler(renderIcon)();
42
+
43
+ /* Render Icon */
44
+ const icon = renderHandler(renderIcon)({
45
+ id
46
+ });
37
47
  return icon ? /*#__PURE__*/React.createElement("div", {
38
48
  onClick: handleClick,
39
- className: actionIconClass
49
+ className: actionIconClass,
50
+ "data-title": title
40
51
  }, icon) : null;
41
52
  }
42
53
  ActionIcon.propTypes = actionIconPropTypes;
43
54
  ActionIcon.defaultProps = actionIconDefaultProps;
44
- ActionIcon.displayName = 'ActionIcon';
45
- // ActionIcons.constantProps = constantProps;
55
+ ActionIcon.displayName = 'ActionIcon';
@@ -1,3 +1,4 @@
1
+ /** ** Methods *** */
1
2
  import { compileClassNames } from '@zohodesk/utils';
2
3
  export default function cssJSLogic(props, style) {
3
4
  const actionIconClass = compileClassNames({
@@ -1,4 +1,6 @@
1
+ /** ** Constants *** */
2
+ import { dummyObject } from '@zohoim/chat-components-utils/es/constants';
1
3
  const actionIconDefaultProps = {
2
- customStyle: {}
4
+ customStyle: dummyObject
3
5
  };
4
6
  export default actionIconDefaultProps;
@@ -1,8 +1,10 @@
1
+ /** ** Libraries *** */
1
2
  import PropTypes from 'prop-types';
2
3
  const actionIconPropTypes = {
3
4
  customStyle: PropTypes.object,
4
- renderIcon: PropTypes.func,
5
+ renderIcon: PropTypes.func.isRequired,
5
6
  onClick: PropTypes.func,
6
- id: PropTypes.string
7
+ id: PropTypes.string,
8
+ title: PropTypes.string
7
9
  };
8
10
  export default actionIconPropTypes;
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,90 @@
1
+ /* eslint-disable react/jsx-no-bind */
2
+
3
+ /** ** Libraries *** */
4
+ import React from 'react';
5
+
6
+ /** ** Icons *** */
7
+ import WhatsappIcon from '../icons/iconSrc/integrations/ChWhatsApp';
8
+ import TelegramIcon from '../icons/iconSrc/integrations/TtTelegram';
9
+ import InstagramIcon from '../icons/iconSrc/integrations/ChInstagram';
10
+ import ASAPIcon from '../icons/iconSrc/integrations/TtASAP';
11
+ import WeChatIcon from '../icons/iconSrc/integrations/TtWechat';
12
+ import TwillioIcon from '../icons/iconSrc/integrations/TtTwillio';
13
+ import LineIcon from '../icons/iconSrc/integrations/TtTwitter';
14
+ // import TwitterIcon from '../icons/iconSrc/integrations/TtTwitter';
15
+
16
+ /** ** CSS *** */
17
+ import style from './css/IMIntegrationIcon.module.css';
18
+
19
+ /** ** Methods *** */
20
+ import useMergeStyle from '@zohodesk/hooks/es/utils/useMergeStyle';
21
+ import cssJSLogic from './css/cssJSLogic';
22
+
23
+ /** ** Constants *** */
24
+ import imIntegrationIconDefaultProps from './props/defaultProps';
25
+ import imIntegrationIconPropTypes from './props/propTypes';
26
+ import constantProps from './props/propConstants';
27
+ import integrationConstants from '@zohoim/chat-components-utils/es/constants/integrationConstants';
28
+ const {
29
+ WHATSAPP,
30
+ TELEGRAM,
31
+ INSTAGRAM,
32
+ ASAP,
33
+ WECHAT,
34
+ TWILLIO,
35
+ LINE
36
+ } = integrationConstants;
37
+ const integrationIconMapping = {
38
+ [WHATSAPP]: WhatsappIcon,
39
+ [TELEGRAM]: TelegramIcon,
40
+ [INSTAGRAM]: InstagramIcon,
41
+ [ASAP]: ASAPIcon,
42
+ [WECHAT]: WeChatIcon,
43
+ [TWILLIO]: TwillioIcon,
44
+ [LINE]: LineIcon
45
+ // [TWITTER]: TwitterIcon
46
+ };
47
+
48
+ export default function IMIntegrationIcon(props) {
49
+ const {
50
+ customStyle,
51
+ isCustom,
52
+ renderIcon,
53
+ title
54
+ } = props;
55
+
56
+ /* external customization */
57
+ const newStyle = useMergeStyle(style, customStyle);
58
+ /* css classnames added based on logic */
59
+ const {
60
+ iconWrapperClass,
61
+ iconStyle
62
+ } = cssJSLogic(props, newStyle);
63
+ function handleClick(e) {
64
+ const {
65
+ id,
66
+ onClick
67
+ } = props;
68
+ onClick && onClick({
69
+ id,
70
+ e
71
+ });
72
+ }
73
+ function renderDefaultIcon() {
74
+ const {
75
+ integrationName
76
+ } = props;
77
+ const IntegrationIcon = integrationIconMapping[integrationName] || null;
78
+ return IntegrationIcon ? /*#__PURE__*/React.createElement("div", {
79
+ className: iconWrapperClass,
80
+ "data-title": title,
81
+ onClick: handleClick
82
+ }, /*#__PURE__*/React.createElement(IntegrationIcon, {
83
+ customStyle: iconStyle
84
+ })) : null;
85
+ }
86
+ return /*#__PURE__*/React.createElement(React.Fragment, null, isCustom ? renderIcon() : renderDefaultIcon());
87
+ }
88
+ IMIntegrationIcon.defaultProps = imIntegrationIconDefaultProps;
89
+ IMIntegrationIcon.propTypes = imIntegrationIconPropTypes;
90
+ IMIntegrationIcon.constantProps = constantProps;
@@ -0,0 +1,98 @@
1
+ .varClass {
2
+ --integrationIcon-small_height: var(--imlib_size_22);
3
+ --integrationIcon-small_width: var(--imlib_size_22);
4
+ --integrationIcon-medium_height: var(--imlib_size_26);
5
+ --integrationIcon-medium_width: var(--imlib_size_26);
6
+ }
7
+
8
+ .integrationIcon {
9
+ composes: varClass;
10
+ display: flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+
14
+ border-radius: 50%;
15
+ }
16
+
17
+ .integrationIcon :global(.path-0),
18
+ .twillioIcon :global(.cls-1),
19
+ .asapIcon :global(.cls-1),
20
+ .weChatIcon :global(.cls-1),
21
+ .weChatIcon :global(.path-0),
22
+ .lineIcon :global(.cls-1){
23
+ fill: var(--imlib_chat_components_imIntegrationIcon_path0_color);
24
+ }
25
+
26
+ .integrationIcon :global(.path-1),
27
+ .twillioIcon :global(.path-0),
28
+ .twillioIcon :global(.path-1),
29
+ .twillioIcon :global(.path-2),
30
+ .twillioIcon :global(.path-3),
31
+ .twillioIcon :global(.path-4),
32
+ .asapIcon :global(.path-0),
33
+ .asapIcon :global(.path-1),
34
+ .asapIcon :global(.path-2),
35
+ .weChatIcon :global(.cls-2),
36
+ .weChatIcon :global(.path-2),
37
+ .weChatIcon :global(.path-3),
38
+ .weChatIcon :global(.path-4),
39
+ .lineIcon :global(.cls-2),
40
+ .lineIcon :global(.path-0),
41
+ .lineIcon :global(.path-1),
42
+ .lineIcon :global(.path-2),
43
+ .lineIcon :global(.path-3) {
44
+ fill: var(--imlib_chat_components_imIntegrationIcon_path1_color);
45
+ }
46
+
47
+ .small {
48
+ width: var(--integrationIcon-small_height);
49
+ height: var(--integrationIcon-small_width);
50
+ }
51
+
52
+ .medium {
53
+ width: var(--integrationIcon-medium_height);
54
+ height: var(--integrationIcon-medium_width);
55
+ }
56
+
57
+ .whatsappIcon {
58
+ background-color: var(
59
+ --imlib_chat_components_imIntegrationIcon_whatsapp_color
60
+ );
61
+ }
62
+
63
+ .telegramIcon {
64
+ background-color: var(
65
+ --imlib_chat_components_imIntegrationIcon_telegram_color
66
+ );
67
+ }
68
+
69
+ .weChatIcon {
70
+ background-color: var(--imlib_chat_components_imIntegrationIcon_wechat_color);
71
+ }
72
+
73
+ .lineIcon {
74
+ background-color: var(--imlib_chat_components_imIntegrationIcon_line_color);
75
+ }
76
+
77
+ .twillioIcon {
78
+ background-color: var(
79
+ --imlib_chat_components_imIntegrationIcon_twillio_color
80
+ );
81
+ }
82
+
83
+
84
+ .instagramIcon {
85
+ background-color: var(
86
+ --imlib_chat_components_imIntegrationIcon_instagram_color
87
+ );
88
+ }
89
+
90
+ .asapIcon {
91
+ background-color: var(--imlib_chat_components_imIntegrationIcon_asap_color);
92
+ }
93
+
94
+ /* .twitterIcon {
95
+ background-color: var(
96
+ --imlib_chat_components_imIntegrationIcon_twitter_color
97
+ );
98
+ } */
@@ -0,0 +1,56 @@
1
+ /** ** Methods *** */
2
+ import { compileClassNames } from '@zohodesk/utils';
3
+
4
+ /** ** Constants *** */
5
+ import integrationConstants from '@zohoim/chat-components-utils/es/constants/integrationConstants';
6
+ import constantProps from '../props/propConstants';
7
+ const {
8
+ WHATSAPP,
9
+ TELEGRAM,
10
+ INSTAGRAM,
11
+ ASAP,
12
+ WECHAT,
13
+ TWILLIO,
14
+ LINE
15
+ } = integrationConstants;
16
+ export default function cssJSLogic(props, style) {
17
+ const {
18
+ integrationName,
19
+ size
20
+ } = props;
21
+ const isWhatsAppIcon = integrationName === WHATSAPP;
22
+ const isTelegramIcon = integrationName === TELEGRAM;
23
+ const isInstagramIcon = integrationName === INSTAGRAM;
24
+ const isASAPIcon = integrationName === ASAP;
25
+ const isWeChatIcon = integrationName === WECHAT;
26
+ const isTwillioIcon = integrationName === TWILLIO;
27
+ const isLineIcon = integrationName === LINE;
28
+ // const isTwitterIcon = integrationName === TWITTER;
29
+
30
+ const isSmall = size === constantProps.SIZE.SMALL;
31
+ const isMedium = size === constantProps.SIZE.MEDIUM;
32
+ const iconWrapperClass = compileClassNames({
33
+ [style.integrationIcon]: true,
34
+ [style.small]: isSmall,
35
+ [style.medium]: isMedium,
36
+ [style.whatsappIcon]: isWhatsAppIcon,
37
+ [style.telegramIcon]: isTelegramIcon,
38
+ [style.instagramIcon]: isInstagramIcon,
39
+ [style.asapIcon]: isASAPIcon,
40
+ [style.weChatIcon]: isWeChatIcon,
41
+ [style.twillioIcon]: isTwillioIcon,
42
+ [style.lineIcon]: isLineIcon
43
+ // [style.twitterIcon]: isTwitterIcon
44
+ });
45
+
46
+ const iconClass = compileClassNames({
47
+ [style.small]: isSmall,
48
+ [style.medium]: isMedium
49
+ });
50
+ return {
51
+ iconWrapperClass,
52
+ iconStyle: {
53
+ base: iconClass
54
+ }
55
+ };
56
+ }
@@ -0,0 +1,2 @@
1
+ export { default as IMIntegrationIcon } from './IMIntegrationIcon';
2
+ export { default as IMIntegrationIconPropTypes } from './props/propTypes';
@@ -0,0 +1,9 @@
1
+ /** ** Constants *** */
2
+ import { dummyObject } from '@zohoim/chat-components-utils/es/constants';
3
+ import constantProps from './propConstants';
4
+ const imIntegrationIconDefaultProps = {
5
+ customStyle: dummyObject,
6
+ size: constantProps.SIZE.SMALL,
7
+ isCustom: false
8
+ };
9
+ export default imIntegrationIconDefaultProps;
@@ -0,0 +1,8 @@
1
+ /** ** Constants *** */
2
+ import sizes from '@zohoim/chat-components-utils/es/constants/sizes';
3
+ export default {
4
+ SIZE: {
5
+ SMALL: sizes.SMALL,
6
+ MEDIUM: sizes.MEDIUM
7
+ }
8
+ };
@@ -0,0 +1,25 @@
1
+ /** ** Libraries *** */
2
+ import PropTypes from 'prop-types';
3
+
4
+ /** ** Constants *** */
5
+ import integrationConstants from '@zohoim/chat-components-utils/es/constants/integrationConstants';
6
+ import sizes from '@zohoim/chat-components-utils/es/constants/sizes';
7
+ const {
8
+ WHATSAPP,
9
+ TELEGRAM,
10
+ INSTAGRAM,
11
+ ASAP,
12
+ WECHAT,
13
+ TWILLIO,
14
+ LINE
15
+ } = integrationConstants;
16
+ const imIntegrationIconPropTypes = {
17
+ integrationName: PropTypes.oneOf([WHATSAPP, TELEGRAM, INSTAGRAM, ASAP, WECHAT, TWILLIO, LINE]),
18
+ customStyle: PropTypes.object,
19
+ isCustom: PropTypes.bool,
20
+ renderIcon: PropTypes.func,
21
+ size: PropTypes.oneOf([sizes.SMALL, sizes.MEDIUM]),
22
+ id: PropTypes.string,
23
+ onClick: PropTypes.func
24
+ };
25
+ export default imIntegrationIconPropTypes;
@@ -0,0 +1,143 @@
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 imMessageDefaultProps from './props/defaultProps';
12
+ import imMessagePropTypes from './props/propTypes';
13
+
14
+ /** ** Methods *** */
15
+ // import renderHandler from '@zohoim/chat-components-utils/es/renderHandler';
16
+ // import cssJSLogic from './css/cssJSLogic';
17
+
18
+ /** ** Styles *** */
19
+ // import style from './css/IMMessage.module.css';
20
+
21
+ /** ** Components *** */
22
+ import MessageBubble from '../MessageBubble/MessageBubble';
23
+ import MessageBox from '../MessageBox/MessageBox';
24
+ import IMMessageAvatar from '../IMMessageAvatar/IMMessageAvatar';
25
+ import IMMessageActions from '../IMMessageActions/IMMessageActions';
26
+ import IMMessageStatus from '../IMMessageStatus/IMMessageStatus';
27
+ export default function IMMessage(props) {
28
+ const {
29
+ customStyle,
30
+ direction,
31
+ isActive,
32
+ needMessageActions,
33
+ renderMessageBoxFooter,
34
+ /* Avatar Related Props Start */
35
+ needSender,
36
+ isShowSender,
37
+ senderSrc,
38
+ senderAlternateSrc,
39
+ senderTitle,
40
+ senderAvatarSize,
41
+ senderName,
42
+ avatarCustomStyle,
43
+ senderIntegrationIcon,
44
+ senderIntegrationIconSize,
45
+ senderIntegrationIconCustomStyle,
46
+ isCustomIntegrationIcon,
47
+ isCustomSenderAvatar,
48
+ renderCustomIntegrationIcon,
49
+ renderCustomSenderAvatar,
50
+ /*Avatar Related Props End*/
51
+
52
+ /* MessageBox Props Start */
53
+ isFailedMessage,
54
+ needMessageBox,
55
+ renderMessage,
56
+ renderMessageFooter,
57
+ renderMessageHeader,
58
+ messageBoxCustomStyle,
59
+ /*MessageBox Props End */
60
+
61
+ /* MessageAction Props Start */
62
+ messageActions,
63
+ actionsDefaultShowCount,
64
+ actionIconCustomStyle,
65
+ moreActionItemCustomStyle,
66
+ onSelectAction,
67
+ messageActionCustomStyle,
68
+ moreActionPopupCustomStyle,
69
+ renderSecondaryActions,
70
+ /* MessageAction Props End */
71
+
72
+ /*MessageStatus Props Start */
73
+ messageStatus,
74
+ messageStatusCustomStyle,
75
+ statusTitle
76
+ /*MessageStatus Props End */
77
+ } = props;
78
+ function handleRenderMessageStatus() {
79
+ const props = {
80
+ messageStatus,
81
+ customStyle: messageStatusCustomStyle,
82
+ title: statusTitle
83
+ };
84
+ return /*#__PURE__*/React.createElement(IMMessageStatus, props);
85
+ }
86
+ function handleRenderMessageBox() {
87
+ const props = {
88
+ renderMessageFooter,
89
+ renderMessageHeader,
90
+ renderMessageStatus: handleRenderMessageStatus,
91
+ renderMessage,
92
+ customStyle: messageBoxCustomStyle,
93
+ isFailed: isFailedMessage
94
+ };
95
+ return /*#__PURE__*/React.createElement(MessageBox, props);
96
+ }
97
+ function handleRenderMessageOwner() {
98
+ const props = {
99
+ src: senderSrc,
100
+ alternateSrc: senderAlternateSrc,
101
+ title: senderTitle,
102
+ avatarSize: senderAvatarSize,
103
+ name: senderName,
104
+ customStyle: avatarCustomStyle,
105
+ integrationName: senderIntegrationIcon,
106
+ iconSize: senderIntegrationIconSize,
107
+ iconCustomStyle: senderIntegrationIconCustomStyle,
108
+ isCustomIcon: isCustomIntegrationIcon,
109
+ renderCustomIcon: renderCustomIntegrationIcon,
110
+ isCustomAvatar: isCustomSenderAvatar,
111
+ renderCustomAvatar: renderCustomSenderAvatar
112
+ };
113
+ return isShowSender ? /*#__PURE__*/React.createElement(IMMessageAvatar, props) : null;
114
+ }
115
+ function handleRenderMessageActions() {
116
+ const props = {
117
+ actions: messageActions,
118
+ renderSecondaryActions: renderSecondaryActions,
119
+ defaultShowCount: actionsDefaultShowCount,
120
+ actionIconCustomStyle: actionIconCustomStyle,
121
+ moreItemCustomStyle: moreActionItemCustomStyle,
122
+ onSelect: onSelectAction,
123
+ customStyle: messageActionCustomStyle,
124
+ morePopupCustomStyle: moreActionPopupCustomStyle
125
+ };
126
+ return /*#__PURE__*/React.createElement(IMMessageActions, props);
127
+ }
128
+ return /*#__PURE__*/React.createElement(MessageBubble, {
129
+ direction: direction,
130
+ isActive: isActive,
131
+ needMessageActions: needMessageActions,
132
+ renderMessageBox: handleRenderMessageBox,
133
+ renderMessageBoxFooter: renderMessageBoxFooter,
134
+ renderMessageOwner: handleRenderMessageOwner,
135
+ renderMessageActions: handleRenderMessageActions,
136
+ customStyle: customStyle,
137
+ needSender: needSender,
138
+ isShowSender: isShowSender
139
+ });
140
+ }
141
+ IMMessage.propTypes = imMessagePropTypes;
142
+ IMMessage.defaultProps = imMessageDefaultProps;
143
+ IMMessage.displayName = 'IMMessage';
File without changes
@@ -0,0 +1,10 @@
1
+ /** ** Methods *** */
2
+ import { compileClassNames } from '@zohodesk/utils';
3
+ export default function cssJSLogic(props, style) {
4
+ const imMessageClass = compileClassNames({
5
+ [style.imMessage]: true
6
+ });
7
+ return {
8
+ imMessageClass
9
+ };
10
+ }
@@ -0,0 +1 @@
1
+ export { default as IMMessage } from './IMMessage';
@@ -0,0 +1,51 @@
1
+ // import React from 'react';
2
+
3
+ /** ** Constants *** */
4
+ import { dummyObject, dummyArray } from '@zohoim/chat-components-utils/es/constants';
5
+ import { direction } from '@zohoim/chat-components-utils/es/constants/messageConstants';
6
+ // import integrationConstants from '@zohoim/chat-components-utils/es/constants/integrationConstants';
7
+ import sizes from '@zohoim/chat-components-utils/es/constants/sizes';
8
+ import { actionsDefaultShowCount } from '@zohoim/chat-components-utils/es/constants/messageActionConstants';
9
+ // import messageStatusConstants from '@zohoim/chat-components-utils/es/constants/messageStatusConstants';
10
+
11
+ // const { WHATSAPP } = integrationConstants;
12
+ // const { READ } = messageStatusConstants;
13
+
14
+ const imMessageDefaultProps = {
15
+ customStyle: dummyObject,
16
+ direction: direction.IN,
17
+ isActive: false,
18
+ needMessageActions: true,
19
+ needSender: true,
20
+ isShowSender: true,
21
+ senderSrc: '',
22
+ senderAlternateSrc: '',
23
+ senderTitle: '',
24
+ //'RAVI KUMAR',
25
+ senderAvatarSize: 'medium',
26
+ senderName: '',
27
+ //'Ravi kumar',
28
+ avatarCustomStyle: dummyObject,
29
+ senderIntegrationIcon: '',
30
+ //WHATSAPP
31
+ senderIntegrationIconSize: sizes.SMALL,
32
+ senderIntegrationIconCustomStyle: dummyObject,
33
+ isCustomIntegrationIcon: false,
34
+ isCustomSenderAvatar: false,
35
+ needMessageBox: true,
36
+ isFailedMessage: false,
37
+ messageBoxCustomStyle: dummyObject,
38
+ messageActions: dummyArray,
39
+ actionsDefaultShowCount: actionsDefaultShowCount,
40
+ actionIconCustomStyle: dummyObject,
41
+ moreActionItemCustomStyle: dummyObject,
42
+ messageActionCustomStyle: dummyObject,
43
+ moreActionPopupCustomStyle: dummyObject,
44
+ messageStatus: '',
45
+ // READ,
46
+ messageStatusCustomStyle: dummyObject,
47
+ statusTitle: '' // READ,
48
+ // renderMessage: () => <div>Test</div>
49
+ };
50
+
51
+ export default imMessageDefaultProps;