@zohoim/chat-components 1.1.6-beta.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/es/Theme/TooltipWrapper.js +20 -20
- package/es/constants/index.js +4 -3
- package/es/im/IMAttachmentHandler/IMAttachmentHandler.js +2 -2
- package/es/im/IMAttachmentHandler/props/propTypes.js +1 -1
- package/es/im/IMMessage/props/propTypes.js +1 -1
- package/lib/Theme/TooltipWrapper.js +23 -28
- package/lib/constants/index.js +4 -4
- package/lib/im/IMAttachmentHandler/IMAttachmentHandler.js +2 -2
- package/lib/im/IMAttachmentHandler/props/propTypes.js +1 -1
- package/lib/im/IMMessage/props/propTypes.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -10,6 +10,10 @@ In this Library, We Provide Some Basic Message Components to Build Your Chat App
|
|
|
10
10
|
|
|
11
11
|
> import MessageBubble from '@zohoim/chat-components/es/MessageBubble/MessageBubble’;
|
|
12
12
|
|
|
13
|
+
# 1.2.0
|
|
14
|
+
|
|
15
|
+
- In the chat components, integrationService key name is changed to integrationServiceId
|
|
16
|
+
|
|
13
17
|
# 1.1.6
|
|
14
18
|
|
|
15
19
|
- In the message component, MP3 format support has been added for some integrations.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
/** ** Libraries *** */
|
|
4
|
-
import React
|
|
4
|
+
import React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
/** ** Components *** */
|
|
7
7
|
|
|
@@ -23,32 +23,36 @@ export default function TooltipWrapper(props) {
|
|
|
23
23
|
getContainerRef,
|
|
24
24
|
customStyle = dummyObject
|
|
25
25
|
} = props;
|
|
26
|
-
|
|
27
|
-
const tooltipRef = useRef(null);
|
|
26
|
+
let timer = null;
|
|
27
|
+
const tooltipRef = React.useRef(null);
|
|
28
28
|
setLibraryConfig({
|
|
29
29
|
getTooltipContainer: () => getContainerRef()
|
|
30
30
|
});
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
function handleMouseOverDispatch(e) {
|
|
32
33
|
const containerRef = getContainerRef();
|
|
33
34
|
|
|
34
35
|
if (tooltipRef && tooltipRef.current) {
|
|
35
36
|
tooltipRef.current.handleOver(e, containerRef);
|
|
36
37
|
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function handleOver(e) {
|
|
41
|
+
if (timer) {
|
|
42
|
+
timer = clearTimeout(timer);
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
timer = setTimeout(() => handleMouseOverDispatch(e), getLibraryConfig('tooltipDebounce'));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function removeTimeout() {
|
|
49
|
+
if (timer) {
|
|
50
|
+
timer = clearTimeout(timer);
|
|
48
51
|
}
|
|
49
|
-
}
|
|
52
|
+
} // componentDidMount and componentWillUnmount case
|
|
50
53
|
|
|
51
|
-
|
|
54
|
+
|
|
55
|
+
React.useEffect(() => {
|
|
52
56
|
const containerRef = getContainerRef();
|
|
53
57
|
|
|
54
58
|
if (containerRef) {
|
|
@@ -58,15 +62,11 @@ export default function TooltipWrapper(props) {
|
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
return () => {
|
|
61
|
-
setLibraryConfig({
|
|
62
|
-
getTooltipContainer: () => null
|
|
63
|
-
});
|
|
64
|
-
|
|
65
65
|
if (containerRef) {
|
|
66
66
|
containerRef.removeEventListener('mouseover', handleOver, false);
|
|
67
67
|
containerRef.removeEventListener('mouseout', removeTimeout, false); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
68
68
|
|
|
69
|
-
tooltipRef.current
|
|
69
|
+
tooltipRef.current.unObserveElement();
|
|
70
70
|
}
|
|
71
71
|
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
72
72
|
}, []);
|
package/es/constants/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export const MSG_ACTION_POPUP_PORTAL = 'MSG_ACTION_POPUP_PORTAL';
|
|
2
2
|
export const EDITOR_POPUP_PORTAL = 'EDITOR_POPUP_PORTAL';
|
|
3
3
|
export const EDITOR_POPUP_TARGET_PORTAL = 'EDITOR_POPUP_TARGET_PORTAL';
|
|
4
|
-
const version = '1.4.
|
|
4
|
+
const version = '1.4.9';
|
|
5
5
|
export const defaultEditorURL = // `https://static.localzohocdn.com/rtelibrary/${version}/js/rte.js`;
|
|
6
|
-
|
|
7
|
-
// `https://static.
|
|
6
|
+
// `https://static.zohocdn.com/rtelibrary/${version}/js/rte.js`;
|
|
7
|
+
// `https://static.localzohocdn.com/rtelibrary/${version}/js/rte.min.js`;
|
|
8
|
+
`https://static.zohocdn.com/rtelibrary/${version}/js/rte.min.js`;
|
|
@@ -23,7 +23,7 @@ export default function IMAttachmentHandler(props) {
|
|
|
23
23
|
isMultiAttachment,
|
|
24
24
|
onAttach: propOnAttach,
|
|
25
25
|
attachmentType,
|
|
26
|
-
|
|
26
|
+
integrationServiceId
|
|
27
27
|
} = props;
|
|
28
28
|
const {
|
|
29
29
|
attachmentHandlerProps = dummyObject
|
|
@@ -34,7 +34,7 @@ export default function IMAttachmentHandler(props) {
|
|
|
34
34
|
} = useIMAttachmentHandler({
|
|
35
35
|
onAttach: propOnAttach,
|
|
36
36
|
attachmentType,
|
|
37
|
-
|
|
37
|
+
integrationServiceId
|
|
38
38
|
});
|
|
39
39
|
return /*#__PURE__*/React.createElement(AttachmentHandler, _extends({
|
|
40
40
|
iconName: iconName,
|
|
@@ -23,6 +23,6 @@ const imAttachmentHandlerPropTypes = {
|
|
|
23
23
|
onAttach: PropTypes.func,
|
|
24
24
|
customProps: PropTypes.object,
|
|
25
25
|
attachmentType: PropTypes.oneOf(['image', 'document', 'documentAndImage']),
|
|
26
|
-
|
|
26
|
+
integrationServiceId: PropTypes.oneOf([WHATSAPP, TELEGRAM, INSTAGRAM, WECHAT, TWILLIO, LINE, IM_TALK, FACEBOOKMESSENGER])
|
|
27
27
|
};
|
|
28
28
|
export default imAttachmentHandlerPropTypes;
|
|
@@ -52,7 +52,7 @@ const imMessagePropTypes = {
|
|
|
52
52
|
type: PropTypes.string
|
|
53
53
|
}).isRequired,
|
|
54
54
|
sessionDetails: PropTypes.shape({
|
|
55
|
-
|
|
55
|
+
integrationServiceId: PropTypes.string
|
|
56
56
|
}),
|
|
57
57
|
defaultAvatarUrls: PropTypes.shape({
|
|
58
58
|
autoMessageAvatar: PropTypes.string,
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports["default"] = TooltipWrapper;
|
|
9
7
|
|
|
10
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
9
|
|
|
12
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
11
|
|
|
@@ -23,46 +21,48 @@ var _TooltipWrapperModule = _interopRequireDefault(require("./css/TooltipWrapper
|
|
|
23
21
|
|
|
24
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
23
|
|
|
26
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
-
|
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
-
|
|
30
24
|
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); }
|
|
31
25
|
|
|
32
26
|
function TooltipWrapper(props) {
|
|
33
27
|
var getContainerRef = props.getContainerRef,
|
|
34
28
|
_props$customStyle = props.customStyle,
|
|
35
29
|
customStyle = _props$customStyle === void 0 ? _emptyConstants.dummyObject : _props$customStyle;
|
|
36
|
-
var
|
|
37
|
-
|
|
30
|
+
var timer = null;
|
|
31
|
+
|
|
32
|
+
var tooltipRef = _react["default"].useRef(null);
|
|
33
|
+
|
|
38
34
|
(0, _Config.setLibraryConfig)({
|
|
39
35
|
getTooltipContainer: function getTooltipContainer() {
|
|
40
36
|
return getContainerRef();
|
|
41
37
|
}
|
|
42
38
|
});
|
|
43
|
-
|
|
39
|
+
|
|
40
|
+
function handleMouseOverDispatch(e) {
|
|
44
41
|
var containerRef = getContainerRef();
|
|
45
42
|
|
|
46
43
|
if (tooltipRef && tooltipRef.current) {
|
|
47
44
|
tooltipRef.current.handleOver(e, containerRef);
|
|
48
45
|
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function handleOver(e) {
|
|
49
|
+
if (timer) {
|
|
50
|
+
timer = clearTimeout(timer);
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
timer = setTimeout(function () {
|
|
56
54
|
return handleMouseOverDispatch(e);
|
|
57
55
|
}, (0, _Config.getLibraryConfig)('tooltipDebounce'));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function removeTimeout() {
|
|
59
|
+
if (timer) {
|
|
60
|
+
timer = clearTimeout(timer);
|
|
62
61
|
}
|
|
63
|
-
}
|
|
62
|
+
} // componentDidMount and componentWillUnmount case
|
|
63
|
+
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
_react["default"].useEffect(function () {
|
|
66
66
|
var containerRef = getContainerRef();
|
|
67
67
|
|
|
68
68
|
if (containerRef) {
|
|
@@ -72,22 +72,17 @@ function TooltipWrapper(props) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
return function () {
|
|
75
|
-
(0, _Config.setLibraryConfig)({
|
|
76
|
-
getTooltipContainer: function getTooltipContainer() {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
75
|
if (containerRef) {
|
|
82
76
|
containerRef.removeEventListener('mouseover', handleOver, false);
|
|
83
77
|
containerRef.removeEventListener('mouseout', removeTimeout, false); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
78
|
|
|
85
|
-
tooltipRef.current
|
|
79
|
+
tooltipRef.current.unObserveElement();
|
|
86
80
|
}
|
|
87
81
|
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
88
82
|
}, []);
|
|
89
83
|
/* External CSS Customization */
|
|
90
84
|
|
|
85
|
+
|
|
91
86
|
var newStyle = (0, _useMergeStyle["default"])(_TooltipWrapperModule["default"], customStyle);
|
|
92
87
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
93
88
|
className: newStyle.tooltipWrapper
|
package/lib/constants/index.js
CHANGED
|
@@ -10,9 +10,9 @@ var EDITOR_POPUP_PORTAL = 'EDITOR_POPUP_PORTAL';
|
|
|
10
10
|
exports.EDITOR_POPUP_PORTAL = EDITOR_POPUP_PORTAL;
|
|
11
11
|
var EDITOR_POPUP_TARGET_PORTAL = 'EDITOR_POPUP_TARGET_PORTAL';
|
|
12
12
|
exports.EDITOR_POPUP_TARGET_PORTAL = EDITOR_POPUP_TARGET_PORTAL;
|
|
13
|
-
var version = '1.4.
|
|
13
|
+
var version = '1.4.9';
|
|
14
14
|
var defaultEditorURL = // `https://static.localzohocdn.com/rtelibrary/${version}/js/rte.js`;
|
|
15
|
-
|
|
16
|
-
// `https://static.
|
|
17
|
-
|
|
15
|
+
// `https://static.zohocdn.com/rtelibrary/${version}/js/rte.js`;
|
|
16
|
+
// `https://static.localzohocdn.com/rtelibrary/${version}/js/rte.min.js`;
|
|
17
|
+
"https://static.zohocdn.com/rtelibrary/".concat(version, "/js/rte.min.js");
|
|
18
18
|
exports.defaultEditorURL = defaultEditorURL;
|
|
@@ -31,14 +31,14 @@ function IMAttachmentHandler(props) {
|
|
|
31
31
|
isMultiAttachment = props.isMultiAttachment,
|
|
32
32
|
propOnAttach = props.onAttach,
|
|
33
33
|
attachmentType = props.attachmentType,
|
|
34
|
-
|
|
34
|
+
integrationServiceId = props.integrationServiceId;
|
|
35
35
|
var _customProps$attachme = customProps.attachmentHandlerProps,
|
|
36
36
|
attachmentHandlerProps = _customProps$attachme === void 0 ? _emptyConstants.dummyObject : _customProps$attachme;
|
|
37
37
|
|
|
38
38
|
var _useIMAttachmentHandl = (0, _useIMAttachmentHandler["default"])({
|
|
39
39
|
onAttach: propOnAttach,
|
|
40
40
|
attachmentType: attachmentType,
|
|
41
|
-
|
|
41
|
+
integrationServiceId: integrationServiceId
|
|
42
42
|
}),
|
|
43
43
|
onAttach = _useIMAttachmentHandl.onAttach,
|
|
44
44
|
supportedTypes = _useIMAttachmentHandl.supportedTypes;
|
|
@@ -32,7 +32,7 @@ var imAttachmentHandlerPropTypes = {
|
|
|
32
32
|
onAttach: _propTypes["default"].func,
|
|
33
33
|
customProps: _propTypes["default"].object,
|
|
34
34
|
attachmentType: _propTypes["default"].oneOf(['image', 'document', 'documentAndImage']),
|
|
35
|
-
|
|
35
|
+
integrationServiceId: _propTypes["default"].oneOf([WHATSAPP, TELEGRAM, INSTAGRAM, WECHAT, TWILLIO, LINE, IM_TALK, FACEBOOKMESSENGER])
|
|
36
36
|
};
|
|
37
37
|
var _default = imAttachmentHandlerPropTypes;
|
|
38
38
|
exports["default"] = _default;
|
|
@@ -62,7 +62,7 @@ var imMessagePropTypes = {
|
|
|
62
62
|
type: _propTypes["default"].string
|
|
63
63
|
}).isRequired,
|
|
64
64
|
sessionDetails: _propTypes["default"].shape({
|
|
65
|
-
|
|
65
|
+
integrationServiceId: _propTypes["default"].string
|
|
66
66
|
}),
|
|
67
67
|
defaultAvatarUrls: _propTypes["default"].shape({
|
|
68
68
|
autoMessageAvatar: _propTypes["default"].string,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohoim/chat-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Chat Components",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"@zohodesk/utils": "1.3.14",
|
|
46
46
|
"@zohodesk/variables": "1.0.0",
|
|
47
47
|
"@zohodesk/virtualizer": "1.0.13",
|
|
48
|
-
"@zohoim/chat-components-hooks": "1.
|
|
49
|
-
"@zohoim/chat-components-utils": "1.
|
|
48
|
+
"@zohoim/chat-components-hooks": "1.2.0",
|
|
49
|
+
"@zohoim/chat-components-utils": "1.2.0",
|
|
50
50
|
"html-to-react": "1.7.0 ",
|
|
51
51
|
"jsdom": "23.0.0",
|
|
52
52
|
"react-sortable-hoc": "1.11.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react-sortable-hoc": "1.11.0",
|
|
71
71
|
"velocity-react": "1.4.3"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "dd1848de47c607ef8f2d570df7e5de340153ddbf"
|
|
74
74
|
}
|