sceyt-chat-react-uikit 1.6.8-beta.15 → 1.6.8-beta.17
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/components/Message/Message.types.d.ts +2 -0
- package/components/Message/MessageBody/index.d.ts +3 -1
- package/components/Message/index.d.ts +1 -1
- package/components/Messages/MessageList/index.d.ts +2 -0
- package/components/Messages/index.d.ts +1 -0
- package/index.js +199 -161
- package/index.modern.js +199 -161
- package/messageUtils/index.d.ts +4 -2
- package/package.json +1 -1
package/index.modern.js
CHANGED
|
@@ -8268,9 +8268,6 @@ function checkChannelExistsOnMessagesMap(channelId) {
|
|
|
8268
8268
|
return !!messagesMap[channelId];
|
|
8269
8269
|
}
|
|
8270
8270
|
var pendingVideoAttachmentsThumbs = {};
|
|
8271
|
-
var setVideoThumb = function setVideoThumb(attachmentId, thumb) {
|
|
8272
|
-
pendingVideoAttachmentsThumbs[attachmentId] = thumb;
|
|
8273
|
-
};
|
|
8274
8271
|
var getVideoThumb = function getVideoThumb(attachmentId) {
|
|
8275
8272
|
return pendingVideoAttachmentsThumbs[attachmentId];
|
|
8276
8273
|
};
|
|
@@ -11170,7 +11167,7 @@ var UploadAvatarButton = styled.button(_templateObject24 || (_templateObject24 =
|
|
|
11170
11167
|
var UploadAvatarHandler = styled.div(_templateObject25 || (_templateObject25 = _taggedTemplateLiteralLoose(["\n margin-left: 18px;\n font-size: 13px;\n color: ", ";\n"])), function (props) {
|
|
11171
11168
|
return props.color;
|
|
11172
11169
|
});
|
|
11173
|
-
var StyledText = styled.span(_templateObject26 || (_templateObject26 = _taggedTemplateLiteralLoose(["\n font-weight: ", ";\n font-family: ", ";\n font-style: ", ";\n text-decoration: ", ";\n letter-spacing: ", ";\n\n &.mention {\n color: ", ";\n font-weight: ", ";\n }\n &.bold {\n font-weight: 600;\n }\n &.italic {\n font-style: italic;\n }\n &.underline {\n text-decoration: underline;\n }\n &.strikethrough {\n text-decoration: line-through;\n }\n &.underline.strikethrough {\n text-decoration: underline line-through;\n }\n &.monospace {\n letter-spacing: 4px;\n }\n"])), function (props) {
|
|
11170
|
+
var StyledText = styled.span(_templateObject26 || (_templateObject26 = _taggedTemplateLiteralLoose(["\n font-weight: ", ";\n font-family: ", ";\n font-style: ", ";\n text-decoration: ", ";\n letter-spacing: ", ";\n\n &.mention {\n color: ", ";\n font-weight: ", ";\n cursor: ", ";\n }\n &.bold {\n font-weight: 600;\n }\n &.italic {\n font-style: italic;\n }\n &.underline {\n text-decoration: underline;\n }\n &.strikethrough {\n text-decoration: line-through;\n }\n &.underline.strikethrough {\n text-decoration: underline line-through;\n }\n &.monospace {\n letter-spacing: 4px;\n }\n"])), function (props) {
|
|
11174
11171
|
return props.fontWeight || props.isLastMessage && '500';
|
|
11175
11172
|
}, function (props) {
|
|
11176
11173
|
return props.fontFamily;
|
|
@@ -11184,6 +11181,8 @@ var StyledText = styled.span(_templateObject26 || (_templateObject26 = _taggedTe
|
|
|
11184
11181
|
return props.color;
|
|
11185
11182
|
}, function (props) {
|
|
11186
11183
|
return props.isLastMessage && '500';
|
|
11184
|
+
}, function (props) {
|
|
11185
|
+
return props.shouldOpenUserProfileForMention && 'pointer';
|
|
11187
11186
|
});
|
|
11188
11187
|
var MessageOwner = styled.h3(_templateObject27 || (_templateObject27 = _taggedTemplateLiteralLoose(["\n margin: 0 12px 4px 0;\n white-space: nowrap;\n color: ", ";\n margin-left: ", ";\n font-weight: 500;\n font-size: ", ";\n line-height: ", ";\n cursor: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n"])), function (props) {
|
|
11189
11188
|
return props.color;
|
|
@@ -11429,7 +11428,9 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
11429
11428
|
isLastMessage = _ref2.isLastMessage,
|
|
11430
11429
|
asSampleText = _ref2.asSampleText,
|
|
11431
11430
|
accentColor = _ref2.accentColor,
|
|
11432
|
-
textSecondary = _ref2.textSecondary
|
|
11431
|
+
textSecondary = _ref2.textSecondary,
|
|
11432
|
+
onMentionNameClick = _ref2.onMentionNameClick,
|
|
11433
|
+
shouldOpenUserProfileForMention = _ref2.shouldOpenUserProfileForMention;
|
|
11433
11434
|
try {
|
|
11434
11435
|
var messageText = [];
|
|
11435
11436
|
var linkify = new LinkifyIt();
|
|
@@ -11474,12 +11475,18 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
11474
11475
|
className: "" + combinedAttributesList[index - 1].type,
|
|
11475
11476
|
isLastMessage: isLastMessage,
|
|
11476
11477
|
key: attributeOffset + index,
|
|
11477
|
-
color: isLastMessage ? textSecondary : accentColor
|
|
11478
|
+
color: isLastMessage ? textSecondary : accentColor,
|
|
11479
|
+
shouldOpenUserProfileForMention: onMentionNameClick && shouldOpenUserProfileForMention
|
|
11478
11480
|
}, firsTextPart, /*#__PURE__*/React__default.createElement(StyledText, {
|
|
11479
11481
|
className: 'mention',
|
|
11480
11482
|
isLastMessage: isLastMessage,
|
|
11481
11483
|
color: isLastMessage ? textSecondary : accentColor,
|
|
11482
|
-
key: attributeOffset + index
|
|
11484
|
+
key: attributeOffset + index,
|
|
11485
|
+
onClick: function onClick() {
|
|
11486
|
+
if (onMentionNameClick && shouldOpenUserProfileForMention) {
|
|
11487
|
+
onMentionNameClick(mentionDisplay);
|
|
11488
|
+
}
|
|
11489
|
+
}
|
|
11483
11490
|
}, mentionDisplayName), secondTextPart)), index === combinedAttributesList.length - 1 ? secondPart : '');
|
|
11484
11491
|
} else {
|
|
11485
11492
|
nextPartIndex = attribute.offset + attribute.length;
|
|
@@ -11487,7 +11494,13 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
11487
11494
|
className: attribute.type,
|
|
11488
11495
|
isLastMessage: isLastMessage,
|
|
11489
11496
|
color: isLastMessage ? textSecondary : accentColor,
|
|
11490
|
-
key: attributeOffset
|
|
11497
|
+
key: attributeOffset,
|
|
11498
|
+
onClick: function onClick() {
|
|
11499
|
+
if (onMentionNameClick && shouldOpenUserProfileForMention) {
|
|
11500
|
+
onMentionNameClick(mentionDisplay);
|
|
11501
|
+
}
|
|
11502
|
+
},
|
|
11503
|
+
shouldOpenUserProfileForMention: onMentionNameClick && shouldOpenUserProfileForMention
|
|
11491
11504
|
}, mentionDisplayName)), index === combinedAttributesList.length - 1 ? secondPart : '');
|
|
11492
11505
|
}
|
|
11493
11506
|
} else {
|
|
@@ -15490,21 +15503,6 @@ var addData = function addData(db, storeName, keyPath, data) {
|
|
|
15490
15503
|
}
|
|
15491
15504
|
};
|
|
15492
15505
|
|
|
15493
|
-
var getFrame3 = function getFrame3(video, time) {
|
|
15494
|
-
try {
|
|
15495
|
-
var canvas = document.createElement('canvas');
|
|
15496
|
-
canvas.width = video.videoWidth;
|
|
15497
|
-
canvas.height = video.videoHeight;
|
|
15498
|
-
var ctx = canvas.getContext('2d');
|
|
15499
|
-
if (time) {
|
|
15500
|
-
video.currentTime = time;
|
|
15501
|
-
}
|
|
15502
|
-
ctx.drawImage(video, 0, 0);
|
|
15503
|
-
return Promise.resolve(createImageThumbnail(null, canvas.toDataURL(), 10, 10));
|
|
15504
|
-
} catch (e) {
|
|
15505
|
-
return Promise.reject(e);
|
|
15506
|
-
}
|
|
15507
|
-
};
|
|
15508
15506
|
var getFrame = function getFrame(videoSrc, time) {
|
|
15509
15507
|
try {
|
|
15510
15508
|
var video = document.createElement('video');
|
|
@@ -25411,55 +25409,42 @@ var VideoPreview = /*#__PURE__*/memo(function VideoPreview(_ref) {
|
|
|
25411
25409
|
}
|
|
25412
25410
|
}
|
|
25413
25411
|
useEffect(function () {
|
|
25414
|
-
var
|
|
25415
|
-
if (
|
|
25416
|
-
|
|
25417
|
-
|
|
25418
|
-
|
|
25419
|
-
|
|
25420
|
-
|
|
25421
|
-
|
|
25422
|
-
|
|
25423
|
-
|
|
25424
|
-
|
|
25425
|
-
|
|
25426
|
-
};
|
|
25427
|
-
intervalCount++;
|
|
25428
|
-
var _temp3 = function () {
|
|
25429
|
-
if (videoRef.current && videoRef.current.readyState > 3) {
|
|
25430
|
-
var _temp2 = function _temp2() {
|
|
25431
|
-
clearInterval(checkVideoInterval);
|
|
25432
|
-
};
|
|
25433
|
-
setLoading(false);
|
|
25434
|
-
setVideoDuration(videoRef.current.duration);
|
|
25435
|
-
var minutes = Math.floor(videoRef.current.duration / 60);
|
|
25436
|
-
var seconds = Math.floor(videoRef.current.duration % 60);
|
|
25437
|
-
setVideoCurrentTime(minutes + ":" + (seconds < 10 ? "0" + seconds : seconds));
|
|
25438
|
-
var _temp = function () {
|
|
25439
|
-
if (isPreview) {
|
|
25440
|
-
return Promise.resolve(getFrame3(videoRef.current, 0)).then(function (thumb) {
|
|
25441
|
-
if (thumb) {
|
|
25442
|
-
setVideoThumb(file.tid, _extends({}, thumb, {
|
|
25443
|
-
duration: videoRef.current.duration
|
|
25444
|
-
}));
|
|
25445
|
-
if (setVideoIsReadyToSend) {
|
|
25446
|
-
setVideoIsReadyToSend(file.tid);
|
|
25447
|
-
}
|
|
25448
|
-
}
|
|
25449
|
-
});
|
|
25450
|
-
}
|
|
25451
|
-
}();
|
|
25452
|
-
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
|
25453
|
-
}
|
|
25454
|
-
}();
|
|
25455
|
-
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
|
25456
|
-
} catch (e) {
|
|
25457
|
-
return Promise.reject(e);
|
|
25412
|
+
var video = videoRef.current;
|
|
25413
|
+
if (!video) return;
|
|
25414
|
+
var checkReadyState = function checkReadyState() {
|
|
25415
|
+
if (video.readyState > 3) {
|
|
25416
|
+
setLoading(false);
|
|
25417
|
+
setVideoDuration(video.duration);
|
|
25418
|
+
var minutes = Math.floor(video.duration / 60);
|
|
25419
|
+
var seconds = Math.floor(video.duration % 60);
|
|
25420
|
+
setVideoCurrentTime(minutes + ":" + (seconds < 10 ? "0" + seconds : seconds));
|
|
25421
|
+
console.log('videoCurrentTime **************', minutes + ":" + (seconds < 10 ? "0" + seconds : seconds));
|
|
25422
|
+
if (setVideoIsReadyToSend) {
|
|
25423
|
+
setVideoIsReadyToSend(file.tid);
|
|
25458
25424
|
}
|
|
25459
|
-
|
|
25460
|
-
|
|
25425
|
+
return true;
|
|
25426
|
+
}
|
|
25427
|
+
return false;
|
|
25428
|
+
};
|
|
25429
|
+
if (checkReadyState()) return;
|
|
25430
|
+
var handleCanPlay = function handleCanPlay() {
|
|
25431
|
+
return checkReadyState();
|
|
25432
|
+
};
|
|
25433
|
+
var handleLoadedMetadata = function handleLoadedMetadata() {
|
|
25434
|
+
return checkReadyState();
|
|
25435
|
+
};
|
|
25436
|
+
video.addEventListener('canplay', handleCanPlay);
|
|
25437
|
+
video.addEventListener('loadedmetadata', handleLoadedMetadata);
|
|
25438
|
+
var interval = setInterval(function () {
|
|
25439
|
+
console.log('checkReadyState **************');
|
|
25440
|
+
if (checkReadyState()) {
|
|
25441
|
+
clearInterval(interval);
|
|
25442
|
+
}
|
|
25443
|
+
}, 1000);
|
|
25461
25444
|
return function () {
|
|
25462
|
-
|
|
25445
|
+
video.removeEventListener('canplay', handleCanPlay);
|
|
25446
|
+
video.removeEventListener('loadedmetadata', handleLoadedMetadata);
|
|
25447
|
+
clearInterval(interval);
|
|
25463
25448
|
};
|
|
25464
25449
|
}, []);
|
|
25465
25450
|
useEffect(function () {
|
|
@@ -25504,7 +25489,7 @@ var VideoPreview = /*#__PURE__*/memo(function VideoPreview(_ref) {
|
|
|
25504
25489
|
}, !isRepliedMessage && !isPreview && /*#__PURE__*/React__default.createElement(SvgVideoCall, null), videoCurrentTime))));
|
|
25505
25490
|
});
|
|
25506
25491
|
var VideoControls = styled.div(_templateObject$s || (_templateObject$s = _taggedTemplateLiteralLoose(["\n position: absolute;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n"])));
|
|
25507
|
-
var VideoTime = styled.div(_templateObject2$o || (_templateObject2$o = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: ", ";\n bottom: ", ";\n left: ", ";\n font-size: ", ";\n display: flex;\n align-items: center;\n border-radius: 16px;\n padding: ", ";\n background-color: ", ";\n line-height: 14px;\n color: ", ";\n\n & > svg {\n color: ", ";\n margin-right: 4px;\n }\n"])), function (props) {
|
|
25492
|
+
var VideoTime = styled.div(_templateObject2$o || (_templateObject2$o = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: ", ";\n bottom: ", ";\n left: ", ";\n font-size: ", ";\n display: flex;\n align-items: center;\n border-radius: 16px;\n padding: ", ";\n background-color: ", ";\n line-height: 14px;\n color: ", ";\n z-index: 10;\n\n & > svg {\n color: ", ";\n margin-right: 4px;\n }\n"])), function (props) {
|
|
25508
25493
|
return props.isRepliedMessage ? '3px' : props.isDetailsView ? undefined : '8px';
|
|
25509
25494
|
}, function (props) {
|
|
25510
25495
|
return props.isDetailsView ? '8px' : undefined;
|
|
@@ -29393,7 +29378,7 @@ var HiddenMessageTime = styled.span(_templateObject2$u || (_templateObject2$u =
|
|
|
29393
29378
|
}, function (props) {
|
|
29394
29379
|
return props.color;
|
|
29395
29380
|
});
|
|
29396
|
-
var MessageStatusAndTimeContainer = styled.span(_templateObject3$o || (_templateObject3$o = _taggedTemplateLiteralLoose(["\n visibility: ", ";\n display: ", ";\n align-items: flex-end;\n border-radius: 16px;\n padding: ", ";\n background-color: ", ";\n float: right;\n line-height: ", ";\n margin-right: ", ";\n margin-left: ", ";\n margin-bottom: ", ";\n direction: ", ";\n transform: translate(0px, 4px);\n white-space: nowrap;\n width: ", ";\n justify-content: ", ";\n\n & > svg {\n margin-left: 4px;\n height: 14px;\n width: 16px;\n }\n\n & > ", " {\n color: ", ";\n }\n\n ", "\n"])), function (props) {
|
|
29381
|
+
var MessageStatusAndTimeContainer = styled.span(_templateObject3$o || (_templateObject3$o = _taggedTemplateLiteralLoose(["\n visibility: ", ";\n display: ", ";\n align-items: flex-end;\n border-radius: 16px;\n padding: ", ";\n background-color: ", ";\n float: right;\n line-height: ", ";\n margin-right: ", ";\n margin-left: ", ";\n margin-bottom: ", ";\n direction: ", ";\n transform: translate(0px, 4px);\n white-space: nowrap;\n width: ", ";\n justify-content: ", ";\n z-index: 10;\n\n & > svg {\n margin-left: 4px;\n height: 14px;\n width: 16px;\n }\n\n & > ", " {\n color: ", ";\n }\n\n ", "\n"])), function (props) {
|
|
29397
29382
|
return props.showOnlyOnHover && 'hidden';
|
|
29398
29383
|
}, function (props) {
|
|
29399
29384
|
return props.hide ? 'none' : 'flex';
|
|
@@ -29418,7 +29403,7 @@ var MessageStatusAndTimeContainer = styled.span(_templateObject3$o || (_template
|
|
|
29418
29403
|
}, HiddenMessageTime, function (props) {
|
|
29419
29404
|
return props.withAttachment ? props.messageTimeColorOnAttachment : '';
|
|
29420
29405
|
}, function (props) {
|
|
29421
|
-
return props.withAttachment && "\n position: absolute;\n z-index:
|
|
29406
|
+
return props.withAttachment && "\n position: absolute;\n z-index: 10;\n right: " + (props.fileAttachment ? '6px' : '10px') + ";\n bottom: " + (props.fileAttachment ? '9px' : '14px') + ";\n ";
|
|
29422
29407
|
});
|
|
29423
29408
|
var MessageStatusUpdated = styled.span(_templateObject4$k || (_templateObject4$k = _taggedTemplateLiteralLoose(["\n margin-right: 4px;\n font-style: italic;\n font-weight: 400;\n font-size: ", ";\n color: ", ";\n"])), function (props) {
|
|
29424
29409
|
return props.fontSize || '12px';
|
|
@@ -29561,7 +29546,9 @@ var MessageBody = function MessageBody(_ref) {
|
|
|
29561
29546
|
handleMouseLeave = _ref.handleMouseLeave,
|
|
29562
29547
|
handleReactionAddDelete = _ref.handleReactionAddDelete,
|
|
29563
29548
|
handleCreateChat = _ref.handleCreateChat,
|
|
29564
|
-
messageTextRef = _ref.messageTextRef
|
|
29549
|
+
messageTextRef = _ref.messageTextRef,
|
|
29550
|
+
handleOpenUserProfile = _ref.handleOpenUserProfile,
|
|
29551
|
+
shouldOpenUserProfileForMention = _ref.shouldOpenUserProfileForMention;
|
|
29565
29552
|
var _useColor = useColors(),
|
|
29566
29553
|
accentColor = _useColor[THEME_COLORS.ACCENT],
|
|
29567
29554
|
textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
|
|
@@ -29762,7 +29749,9 @@ var MessageBody = function MessageBody(_ref) {
|
|
|
29762
29749
|
contactsMap: contactsMap,
|
|
29763
29750
|
getFromContacts: getFromContacts,
|
|
29764
29751
|
accentColor: accentColor,
|
|
29765
|
-
textSecondary: textSecondary
|
|
29752
|
+
textSecondary: textSecondary,
|
|
29753
|
+
onMentionNameClick: handleOpenUserProfile,
|
|
29754
|
+
shouldOpenUserProfileForMention: !!shouldOpenUserProfileForMention
|
|
29766
29755
|
})), !withAttachments && message.state === MESSAGE_STATUS.DELETE ? (/*#__PURE__*/React__default.createElement(MessageStatusDeleted$1, {
|
|
29767
29756
|
color: textSecondary
|
|
29768
29757
|
}, " Message was deleted. ")) : '', messageStatusAndTimePosition === 'onMessage' && !notLinkAttachment && (messageStatusVisible || messageTimeVisible) ? (/*#__PURE__*/React__default.createElement(MessageStatusAndTime$1, {
|
|
@@ -30048,7 +30037,8 @@ var Message$1 = function Message(_ref) {
|
|
|
30048
30037
|
theme = _ref.theme,
|
|
30049
30038
|
messageTextFontSize = _ref.messageTextFontSize,
|
|
30050
30039
|
messageTextLineHeight = _ref.messageTextLineHeight,
|
|
30051
|
-
messageTimeColorOnAttachment = _ref.messageTimeColorOnAttachment
|
|
30040
|
+
messageTimeColorOnAttachment = _ref.messageTimeColorOnAttachment,
|
|
30041
|
+
shouldOpenUserProfileForMention = _ref.shouldOpenUserProfileForMention;
|
|
30052
30042
|
var _useColor = useColors(),
|
|
30053
30043
|
accentColor = _useColor[THEME_COLORS.ACCENT],
|
|
30054
30044
|
backgroundSections = _useColor[THEME_COLORS.BACKGROUND_SECTIONS],
|
|
@@ -30312,6 +30302,21 @@ var Message$1 = function Message(_ref) {
|
|
|
30312
30302
|
document.removeEventListener('mousedown', handleClick);
|
|
30313
30303
|
};
|
|
30314
30304
|
}, []);
|
|
30305
|
+
var handleOpenChannelDetails = function handleOpenChannelDetails() {
|
|
30306
|
+
dispatch(switchChannelInfoAC(true));
|
|
30307
|
+
};
|
|
30308
|
+
var handleOpenUserProfile = function handleOpenUserProfile(user) {
|
|
30309
|
+
if (getOpenChatOnUserInteraction() && user && !selectionIsActive) {
|
|
30310
|
+
dispatch(createChannelAC({
|
|
30311
|
+
metadata: '',
|
|
30312
|
+
type: DEFAULT_CHANNEL_TYPE.DIRECT,
|
|
30313
|
+
members: [_extends({}, user, {
|
|
30314
|
+
role: 'owner'
|
|
30315
|
+
})]
|
|
30316
|
+
}, true));
|
|
30317
|
+
handleOpenChannelDetails();
|
|
30318
|
+
}
|
|
30319
|
+
};
|
|
30315
30320
|
return /*#__PURE__*/React__default.createElement(MessageItem, {
|
|
30316
30321
|
className: 'message_item',
|
|
30317
30322
|
rtl: ownMessageOnRightSide && !message.incoming,
|
|
@@ -30380,7 +30385,8 @@ var Message$1 = function Message(_ref) {
|
|
|
30380
30385
|
handleReactionAddDelete: handleReactionAddDelete,
|
|
30381
30386
|
handleScrollToRepliedMessage: handleScrollToRepliedMessage,
|
|
30382
30387
|
handleMediaItemClick: handleMediaItemClick,
|
|
30383
|
-
isThreadMessage: isThreadMessage
|
|
30388
|
+
isThreadMessage: isThreadMessage,
|
|
30389
|
+
handleOpenUserProfile: handleOpenUserProfile
|
|
30384
30390
|
})) : (/*#__PURE__*/React__default.createElement(MessageBody$1, {
|
|
30385
30391
|
message: message,
|
|
30386
30392
|
channel: channel,
|
|
@@ -30500,7 +30506,9 @@ var Message$1 = function Message(_ref) {
|
|
|
30500
30506
|
handleDeletePendingMessage: handleDeletePendingMessage,
|
|
30501
30507
|
handleCreateChat: handleCreateChat,
|
|
30502
30508
|
messageTextRef: messageTextRef,
|
|
30503
|
-
messageTimeColorOnAttachment: messageTimeColorOnAttachment || textOnPrimary
|
|
30509
|
+
messageTimeColorOnAttachment: messageTimeColorOnAttachment || textOnPrimary,
|
|
30510
|
+
handleOpenUserProfile: handleOpenUserProfile,
|
|
30511
|
+
shouldOpenUserProfileForMention: shouldOpenUserProfileForMention
|
|
30504
30512
|
})), messageStatusAndTimePosition === 'bottomOfMessage' && (messageStatusVisible || messageTimeVisible) && (/*#__PURE__*/React__default.createElement(MessageStatusAndTime$1, {
|
|
30505
30513
|
message: message,
|
|
30506
30514
|
showMessageTimeAndStatusOnlyOnHover: showMessageTimeAndStatusOnlyOnHover,
|
|
@@ -30748,7 +30756,7 @@ var CreateMessageDateDivider = function CreateMessageDateDivider(_ref) {
|
|
|
30748
30756
|
}));
|
|
30749
30757
|
};
|
|
30750
30758
|
var MessageList = function MessageList(_ref2) {
|
|
30751
|
-
var _channel$lastMessage, _channel$
|
|
30759
|
+
var _channel$lastMessage, _channel$lastMessage3, _scrollRef$current;
|
|
30752
30760
|
var messages = _ref2.messages,
|
|
30753
30761
|
fontFamily = _ref2.fontFamily,
|
|
30754
30762
|
_ref2$ownMessageOnRig = _ref2.ownMessageOnRightSide,
|
|
@@ -30889,7 +30897,8 @@ var MessageList = function MessageList(_ref2) {
|
|
|
30889
30897
|
messageTimeFontSize = _ref2.messageTimeFontSize,
|
|
30890
30898
|
messageTimeColor = _ref2.messageTimeColor,
|
|
30891
30899
|
messageStatusAndTimeLineHeight = _ref2.messageStatusAndTimeLineHeight,
|
|
30892
|
-
hiddenMessagesProperties = _ref2.hiddenMessagesProperties
|
|
30900
|
+
hiddenMessagesProperties = _ref2.hiddenMessagesProperties,
|
|
30901
|
+
shouldOpenUserProfileForMention = _ref2.shouldOpenUserProfileForMention;
|
|
30893
30902
|
var _useColor = useColors(),
|
|
30894
30903
|
outgoingMessageBackground = _useColor[THEME_COLORS.OUTGOING_MESSAGE_BACKGROUND],
|
|
30895
30904
|
themeBackgroundColor = _useColor[THEME_COLORS.BACKGROUND],
|
|
@@ -31186,10 +31195,11 @@ var MessageList = function MessageList(_ref2) {
|
|
|
31186
31195
|
}
|
|
31187
31196
|
};
|
|
31188
31197
|
useEffect(function () {
|
|
31189
|
-
|
|
31198
|
+
var _messages, _channel$lastMessage2;
|
|
31199
|
+
if (messages.length > 0 && ((_messages = messages[messages.length - 1]) === null || _messages === void 0 ? void 0 : _messages.id) === ((_channel$lastMessage2 = channel.lastMessage) === null || _channel$lastMessage2 === void 0 ? void 0 : _channel$lastMessage2.id) && scrollRef.current && scrollRef.current.scrollTop > -50 && !showScrollToNewMessageButton) {
|
|
31190
31200
|
dispatch(showScrollToNewMessageButtonAC(false));
|
|
31191
31201
|
}
|
|
31192
|
-
}, [messages, channel === null || channel === void 0 ? void 0 : (_channel$
|
|
31202
|
+
}, [messages, channel === null || channel === void 0 ? void 0 : (_channel$lastMessage3 = channel.lastMessage) === null || _channel$lastMessage3 === void 0 ? void 0 : _channel$lastMessage3.id, scrollRef === null || scrollRef === void 0 ? void 0 : (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollTop, showScrollToNewMessageButton]);
|
|
31193
31203
|
useEffect(function () {
|
|
31194
31204
|
if (scrollToRepliedMessage) {
|
|
31195
31205
|
loading = false;
|
|
@@ -31633,7 +31643,8 @@ var MessageList = function MessageList(_ref2) {
|
|
|
31633
31643
|
messageStateColor: messageStateColor,
|
|
31634
31644
|
messageTimeFontSize: messageTimeFontSize,
|
|
31635
31645
|
messageTimeColor: messageTimeColor,
|
|
31636
|
-
messageStatusAndTimeLineHeight: messageStatusAndTimeLineHeight
|
|
31646
|
+
messageStatusAndTimeLineHeight: messageStatusAndTimeLineHeight,
|
|
31647
|
+
shouldOpenUserProfileForMention: shouldOpenUserProfileForMention
|
|
31637
31648
|
}))), isUnreadMessage ? (/*#__PURE__*/React__default.createElement(MessageDivider, {
|
|
31638
31649
|
theme: theme,
|
|
31639
31650
|
newMessagesSeparatorTextColor: newMessagesSeparatorTextColor,
|
|
@@ -31868,7 +31879,8 @@ var MessagesContainer = function MessagesContainer(_ref) {
|
|
|
31868
31879
|
messageTimeColor = _ref.messageTimeColor,
|
|
31869
31880
|
messageStatusAndTimeLineHeight = _ref.messageStatusAndTimeLineHeight,
|
|
31870
31881
|
_ref$hiddenMessagesPr = _ref.hiddenMessagesProperties,
|
|
31871
|
-
hiddenMessagesProperties = _ref$hiddenMessagesPr === void 0 ? [] : _ref$hiddenMessagesPr
|
|
31882
|
+
hiddenMessagesProperties = _ref$hiddenMessagesPr === void 0 ? [] : _ref$hiddenMessagesPr,
|
|
31883
|
+
shouldOpenUserProfileForMention = _ref.shouldOpenUserProfileForMention;
|
|
31872
31884
|
var messages = useSelector(activeChannelMessagesSelector) || [];
|
|
31873
31885
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MessageList, {
|
|
31874
31886
|
messages: messages,
|
|
@@ -31996,7 +32008,8 @@ var MessagesContainer = function MessagesContainer(_ref) {
|
|
|
31996
32008
|
messageTimeFontSize: messageTimeFontSize,
|
|
31997
32009
|
messageTimeColor: messageTimeColor,
|
|
31998
32010
|
messageStatusAndTimeLineHeight: messageStatusAndTimeLineHeight,
|
|
31999
|
-
hiddenMessagesProperties: hiddenMessagesProperties
|
|
32011
|
+
hiddenMessagesProperties: hiddenMessagesProperties,
|
|
32012
|
+
shouldOpenUserProfileForMention: shouldOpenUserProfileForMention
|
|
32000
32013
|
}));
|
|
32001
32014
|
};
|
|
32002
32015
|
|
|
@@ -34810,7 +34823,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
34810
34823
|
fileChecksum = "" + reader.result;
|
|
34811
34824
|
}
|
|
34812
34825
|
return Promise.resolve(hashString(fileChecksum || '')).then(function (checksumHash) {
|
|
34813
|
-
function
|
|
34826
|
+
function _temp12() {
|
|
34814
34827
|
if (dataFromDb) {
|
|
34815
34828
|
cachedUrl = dataFromDb.url;
|
|
34816
34829
|
setPendingAttachment(tid, {
|
|
@@ -34822,60 +34835,85 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
34822
34835
|
checksum: checksumHash
|
|
34823
34836
|
});
|
|
34824
34837
|
}
|
|
34825
|
-
var
|
|
34838
|
+
var _temp10 = function () {
|
|
34826
34839
|
if (customUploader) {
|
|
34827
|
-
|
|
34828
|
-
|
|
34829
|
-
|
|
34830
|
-
|
|
34831
|
-
return
|
|
34832
|
-
|
|
34833
|
-
|
|
34834
|
-
|
|
34835
|
-
|
|
34836
|
-
|
|
34837
|
-
|
|
34838
|
-
|
|
34839
|
-
|
|
34840
|
-
|
|
34841
|
-
|
|
34842
|
-
|
|
34843
|
-
|
|
34844
|
-
|
|
34845
|
-
|
|
34846
|
-
|
|
34847
|
-
|
|
34848
|
-
|
|
34849
|
-
|
|
34850
|
-
|
|
34851
|
-
|
|
34852
|
-
|
|
34853
|
-
|
|
34854
|
-
|
|
34855
|
-
|
|
34856
|
-
|
|
34857
|
-
|
|
34858
|
-
|
|
34859
|
-
|
|
34860
|
-
|
|
34861
|
-
|
|
34862
|
-
|
|
34863
|
-
|
|
34864
|
-
|
|
34865
|
-
|
|
34866
|
-
|
|
34867
|
-
|
|
34868
|
-
|
|
34869
|
-
|
|
34870
|
-
|
|
34871
|
-
|
|
34872
|
-
|
|
34840
|
+
var _temp2 = function () {
|
|
34841
|
+
if (fileType === 'image') {
|
|
34842
|
+
resizeImage(file).then(function (resizedFile) {
|
|
34843
|
+
try {
|
|
34844
|
+
return Promise.resolve(createImageThumbnail(file)).then(function (_ref4) {
|
|
34845
|
+
var thumbnail = _ref4.thumbnail,
|
|
34846
|
+
imageWidth = _ref4.imageWidth,
|
|
34847
|
+
imageHeight = _ref4.imageHeight;
|
|
34848
|
+
setAttachments(function (prevState) {
|
|
34849
|
+
return [].concat(prevState, [{
|
|
34850
|
+
data: file,
|
|
34851
|
+
cachedUrl: cachedUrl,
|
|
34852
|
+
upload: false,
|
|
34853
|
+
type: isMediaAttachment ? fileType : 'file',
|
|
34854
|
+
attachmentUrl: URL.createObjectURL(resizedFile.blob),
|
|
34855
|
+
tid: tid,
|
|
34856
|
+
size: dataFromDb ? dataFromDb.size : file.size,
|
|
34857
|
+
metadata: _extends({}, dataFromDb && dataFromDb.metadata, {
|
|
34858
|
+
szw: imageWidth,
|
|
34859
|
+
szh: imageHeight,
|
|
34860
|
+
tmb: thumbnail
|
|
34861
|
+
})
|
|
34862
|
+
}]);
|
|
34863
|
+
});
|
|
34864
|
+
});
|
|
34865
|
+
} catch (e) {
|
|
34866
|
+
return Promise.reject(e);
|
|
34867
|
+
}
|
|
34868
|
+
});
|
|
34869
|
+
} else {
|
|
34870
|
+
var _temp13 = function () {
|
|
34871
|
+
if (fileType === 'video') {
|
|
34872
|
+
return Promise.resolve(getFrame(URL.createObjectURL(file), 0)).then(function (_ref5) {
|
|
34873
|
+
var thumb = _ref5.thumb,
|
|
34874
|
+
width = _ref5.width,
|
|
34875
|
+
height = _ref5.height;
|
|
34876
|
+
setAttachments(function (prevState) {
|
|
34877
|
+
return [].concat(prevState, [{
|
|
34878
|
+
data: file,
|
|
34879
|
+
cachedUrl: cachedUrl,
|
|
34880
|
+
upload: false,
|
|
34881
|
+
type: isMediaAttachment ? fileType : 'file',
|
|
34882
|
+
attachmentUrl: URL.createObjectURL(file),
|
|
34883
|
+
tid: tid,
|
|
34884
|
+
size: dataFromDb ? dataFromDb.size : file.size,
|
|
34885
|
+
metadata: _extends({}, dataFromDb && dataFromDb.metadata, {
|
|
34886
|
+
szw: width,
|
|
34887
|
+
szh: height,
|
|
34888
|
+
tmb: thumb
|
|
34889
|
+
})
|
|
34890
|
+
}]);
|
|
34891
|
+
});
|
|
34892
|
+
});
|
|
34893
|
+
} else {
|
|
34894
|
+
setAttachments(function (prevState) {
|
|
34895
|
+
return [].concat(prevState, [{
|
|
34896
|
+
data: file,
|
|
34897
|
+
cachedUrl: cachedUrl,
|
|
34898
|
+
upload: false,
|
|
34899
|
+
type: 'file',
|
|
34900
|
+
tid: tid,
|
|
34901
|
+
size: dataFromDb ? dataFromDb.size : file.size,
|
|
34902
|
+
metadata: dataFromDb && dataFromDb.metadata
|
|
34903
|
+
}]);
|
|
34904
|
+
});
|
|
34905
|
+
}
|
|
34906
|
+
}();
|
|
34907
|
+
if (_temp13 && _temp13.then) return _temp13.then(function () {});
|
|
34908
|
+
}
|
|
34909
|
+
}();
|
|
34910
|
+
if (_temp2 && _temp2.then) return _temp2.then(function () {});
|
|
34873
34911
|
} else {
|
|
34874
|
-
var
|
|
34912
|
+
var _temp1 = function () {
|
|
34875
34913
|
if (fileType === 'image') {
|
|
34876
|
-
var
|
|
34914
|
+
var _temp7 = function () {
|
|
34877
34915
|
if (isMediaAttachment) {
|
|
34878
|
-
var
|
|
34916
|
+
var _temp4 = function _temp4() {
|
|
34879
34917
|
if (file.type === 'image/gif') {
|
|
34880
34918
|
setAttachments(function (prevState) {
|
|
34881
34919
|
return [].concat(prevState, [{
|
|
@@ -34935,23 +34973,23 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
34935
34973
|
}
|
|
34936
34974
|
};
|
|
34937
34975
|
var metas = {};
|
|
34938
|
-
var
|
|
34976
|
+
var _temp3 = function () {
|
|
34939
34977
|
if (dataFromDb) {
|
|
34940
34978
|
metas = dataFromDb.metadata;
|
|
34941
34979
|
} else {
|
|
34942
|
-
return Promise.resolve(createImageThumbnail(file)).then(function (
|
|
34943
|
-
var thumbnail =
|
|
34944
|
-
imageWidth =
|
|
34945
|
-
imageHeight =
|
|
34980
|
+
return Promise.resolve(createImageThumbnail(file)).then(function (_ref6) {
|
|
34981
|
+
var thumbnail = _ref6.thumbnail,
|
|
34982
|
+
imageWidth = _ref6.imageWidth,
|
|
34983
|
+
imageHeight = _ref6.imageHeight;
|
|
34946
34984
|
metas.imageHeight = imageHeight;
|
|
34947
34985
|
metas.imageWidth = imageWidth;
|
|
34948
34986
|
metas.thumbnail = thumbnail;
|
|
34949
34987
|
});
|
|
34950
34988
|
}
|
|
34951
34989
|
}();
|
|
34952
|
-
return
|
|
34990
|
+
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
|
34953
34991
|
} else {
|
|
34954
|
-
var
|
|
34992
|
+
var _temp6 = function _temp6() {
|
|
34955
34993
|
setAttachments(function (prevState) {
|
|
34956
34994
|
return [].concat(prevState, [{
|
|
34957
34995
|
data: file,
|
|
@@ -34968,24 +35006,24 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
34968
35006
|
});
|
|
34969
35007
|
};
|
|
34970
35008
|
var _metas = {};
|
|
34971
|
-
var
|
|
35009
|
+
var _temp5 = function () {
|
|
34972
35010
|
if (dataFromDb) {
|
|
34973
35011
|
_metas = dataFromDb.metadata;
|
|
34974
35012
|
} else {
|
|
34975
|
-
return Promise.resolve(createImageThumbnail(file, undefined, 50, 50)).then(function (
|
|
34976
|
-
var thumbnail =
|
|
35013
|
+
return Promise.resolve(createImageThumbnail(file, undefined, 50, 50)).then(function (_ref7) {
|
|
35014
|
+
var thumbnail = _ref7.thumbnail;
|
|
34977
35015
|
_metas.thumbnail = thumbnail;
|
|
34978
35016
|
});
|
|
34979
35017
|
}
|
|
34980
35018
|
}();
|
|
34981
|
-
return
|
|
35019
|
+
return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
|
|
34982
35020
|
}
|
|
34983
35021
|
}();
|
|
34984
|
-
if (
|
|
35022
|
+
if (_temp7 && _temp7.then) return _temp7.then(function () {});
|
|
34985
35023
|
} else {
|
|
34986
|
-
var
|
|
35024
|
+
var _temp14 = function () {
|
|
34987
35025
|
if (fileType === 'video') {
|
|
34988
|
-
var
|
|
35026
|
+
var _temp9 = function _temp9() {
|
|
34989
35027
|
setAttachments(function (prevState) {
|
|
34990
35028
|
return [].concat(prevState, [{
|
|
34991
35029
|
data: file,
|
|
@@ -35000,14 +35038,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
35000
35038
|
});
|
|
35001
35039
|
};
|
|
35002
35040
|
var metas = {};
|
|
35003
|
-
var
|
|
35041
|
+
var _temp8 = function () {
|
|
35004
35042
|
if (dataFromDb) {
|
|
35005
35043
|
metas = dataFromDb.metadata;
|
|
35006
35044
|
} else {
|
|
35007
|
-
return Promise.resolve(getFrame(URL.createObjectURL(file), 0)).then(function (
|
|
35008
|
-
var thumb =
|
|
35009
|
-
width =
|
|
35010
|
-
height =
|
|
35045
|
+
return Promise.resolve(getFrame(URL.createObjectURL(file), 0)).then(function (_ref8) {
|
|
35046
|
+
var thumb = _ref8.thumb,
|
|
35047
|
+
width = _ref8.width,
|
|
35048
|
+
height = _ref8.height;
|
|
35011
35049
|
metas.tmb = thumb;
|
|
35012
35050
|
metas.width = width;
|
|
35013
35051
|
metas.height = height;
|
|
@@ -35015,7 +35053,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
35015
35053
|
});
|
|
35016
35054
|
}
|
|
35017
35055
|
}();
|
|
35018
|
-
return
|
|
35056
|
+
return _temp8 && _temp8.then ? _temp8.then(_temp9) : _temp9(_temp8);
|
|
35019
35057
|
} else {
|
|
35020
35058
|
setAttachments(function (prevState) {
|
|
35021
35059
|
return [].concat(prevState, [{
|
|
@@ -35030,23 +35068,23 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
35030
35068
|
});
|
|
35031
35069
|
}
|
|
35032
35070
|
}();
|
|
35033
|
-
if (
|
|
35071
|
+
if (_temp14 && _temp14.then) return _temp14.then(function () {});
|
|
35034
35072
|
}
|
|
35035
35073
|
}();
|
|
35036
|
-
if (
|
|
35074
|
+
if (_temp1 && _temp1.then) return _temp1.then(function () {});
|
|
35037
35075
|
}
|
|
35038
35076
|
}();
|
|
35039
|
-
if (
|
|
35077
|
+
if (_temp10 && _temp10.then) return _temp10.then(function () {});
|
|
35040
35078
|
}
|
|
35041
35079
|
var dataFromDb;
|
|
35042
|
-
var
|
|
35080
|
+
var _temp11 = _catch(function () {
|
|
35043
35081
|
return Promise.resolve(_getDataFromDB(DB_NAMES.FILES_STORAGE, DB_STORE_NAMES.ATTACHMENTS, checksumHash, 'checksum')).then(function (_getDataFromDB) {
|
|
35044
35082
|
dataFromDb = _getDataFromDB;
|
|
35045
35083
|
});
|
|
35046
35084
|
}, function (e) {
|
|
35047
35085
|
log.error('error in get data from db . . . . ', e);
|
|
35048
35086
|
});
|
|
35049
|
-
return
|
|
35087
|
+
return _temp11 && _temp11.then ? _temp11.then(_temp12) : _temp12(_temp11);
|
|
35050
35088
|
});
|
|
35051
35089
|
} catch (e) {
|
|
35052
35090
|
return Promise.reject(e);
|
package/messageUtils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IContactsMap } from '../types';
|
|
2
|
+
import { IContactsMap, IUser } from '../types';
|
|
3
3
|
declare const MessageStatusIcon: ({ messageStatus, messageStatusDisplayingType, color, readIconColor, size, accentColor }: {
|
|
4
4
|
messageStatus: string;
|
|
5
5
|
messageStatusDisplayingType?: string | undefined;
|
|
@@ -8,7 +8,7 @@ declare const MessageStatusIcon: ({ messageStatus, messageStatusDisplayingType,
|
|
|
8
8
|
readIconColor?: string | undefined;
|
|
9
9
|
accentColor?: string | undefined;
|
|
10
10
|
}) => React.JSX.Element;
|
|
11
|
-
declare const MessageTextFormat: ({ text, message, contactsMap, getFromContacts, isLastMessage, asSampleText, accentColor, textSecondary }: {
|
|
11
|
+
declare const MessageTextFormat: ({ text, message, contactsMap, getFromContacts, isLastMessage, asSampleText, accentColor, textSecondary, onMentionNameClick, shouldOpenUserProfileForMention }: {
|
|
12
12
|
text: string;
|
|
13
13
|
message: any;
|
|
14
14
|
contactsMap?: IContactsMap | undefined;
|
|
@@ -17,5 +17,7 @@ declare const MessageTextFormat: ({ text, message, contactsMap, getFromContacts,
|
|
|
17
17
|
asSampleText?: boolean | undefined;
|
|
18
18
|
accentColor: string;
|
|
19
19
|
textSecondary: string;
|
|
20
|
+
onMentionNameClick?: ((user: IUser) => void) | undefined;
|
|
21
|
+
shouldOpenUserProfileForMention?: boolean | undefined;
|
|
20
22
|
}) => any;
|
|
21
23
|
export { MessageStatusIcon, MessageTextFormat };
|