sceyt-chat-react-uikit 1.8.9-beta.11 → 1.8.9-beta.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.
- package/index.js +390 -313
- package/index.modern.js +390 -313
- package/package.json +1 -1
package/index.modern.js
CHANGED
|
@@ -12309,9 +12309,12 @@ function updateMessageOnMap(channelId, updatedMessage, voteDetails) {
|
|
|
12309
12309
|
updatedMessageData = _extends({}, updatedMessage.params);
|
|
12310
12310
|
nextMessage = _extends({}, mes, updatedMessageData);
|
|
12311
12311
|
} else {
|
|
12312
|
-
var _updatedMessage$param6;
|
|
12312
|
+
var _updatedMessage$param6, _updatedMessage$param7;
|
|
12313
12313
|
var statusUpdatedMessage = (_updatedMessage$param6 = updatedMessage.params) !== null && _updatedMessage$param6 !== void 0 && _updatedMessage$param6.deliveryStatus ? updateMessageDeliveryStatusAndMarkers(mes, updatedMessage.params) : {};
|
|
12314
|
-
|
|
12314
|
+
var forwardingDetails = mes.forwardingDetails && (_updatedMessage$param7 = updatedMessage.params) !== null && _updatedMessage$param7 !== void 0 && _updatedMessage$param7.forwardingDetails ? _extends({}, mes.forwardingDetails, updatedMessage.params.forwardingDetails) : undefined;
|
|
12315
|
+
updatedMessageData = _extends({}, mes, updatedMessage.params, forwardingDetails ? {
|
|
12316
|
+
forwardingDetails: forwardingDetails
|
|
12317
|
+
} : {}, statusUpdatedMessage);
|
|
12315
12318
|
var voteDetailsData = mes === null || mes === void 0 ? void 0 : mes.pollDetails;
|
|
12316
12319
|
if (voteDetails) {
|
|
12317
12320
|
voteDetailsData = handleVoteDetails(voteDetails, updatedMessageData);
|
|
@@ -13024,7 +13027,10 @@ var messageSlice = createSlice({
|
|
|
13024
13027
|
if (params !== null && params !== void 0 && params.deliveryStatus) {
|
|
13025
13028
|
statusUpdatedMessage = updateMessageDeliveryStatusAndMarkers(message, params);
|
|
13026
13029
|
}
|
|
13027
|
-
var
|
|
13030
|
+
var forwardingDetails = message.forwardingDetails && params.forwardingDetails ? _extends({}, message.forwardingDetails, params.forwardingDetails) : undefined;
|
|
13031
|
+
var messageOldData = _extends({}, message, params, forwardingDetails ? {
|
|
13032
|
+
forwardingDetails: forwardingDetails
|
|
13033
|
+
} : {}, {
|
|
13028
13034
|
userMarkers: [].concat(message.userMarkers || [], params.userMarkers || [])
|
|
13029
13035
|
}, statusUpdatedMessage);
|
|
13030
13036
|
var messageData = _extends({}, messageOldData);
|
|
@@ -16775,12 +16781,15 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
|
|
|
16775
16781
|
return Promise.reject(e);
|
|
16776
16782
|
}
|
|
16777
16783
|
};
|
|
16778
|
-
var addPendingMessage = function addPendingMessage(message, messageCopy, channelId) {
|
|
16784
|
+
var addPendingMessage = function addPendingMessage(message, messageCopy, channelId, preserveParentMessage) {
|
|
16779
16785
|
var _getStoredChannel;
|
|
16786
|
+
if (preserveParentMessage === void 0) {
|
|
16787
|
+
preserveParentMessage = true;
|
|
16788
|
+
}
|
|
16780
16789
|
var messageToAdd = _extends({}, messageCopy, {
|
|
16781
16790
|
createdAt: new Date(Date.now()),
|
|
16782
16791
|
mentionedUsers: message.mentionedUsers,
|
|
16783
|
-
parentMessage: message.parentMessage
|
|
16792
|
+
parentMessage: preserveParentMessage ? message.parentMessage : null
|
|
16784
16793
|
});
|
|
16785
16794
|
addMessageToMap(channelId, messageToAdd);
|
|
16786
16795
|
var currentLastMessage = ((_getStoredChannel = getStoredChannel(channelId)) === null || _getStoredChannel === void 0 ? void 0 : _getStoredChannel.lastMessage) || null;
|
|
@@ -17091,10 +17100,13 @@ function executeEditMessageMutation(channel, message) {
|
|
|
17091
17100
|
}
|
|
17092
17101
|
}, _marked0);
|
|
17093
17102
|
}
|
|
17094
|
-
var updateMessage$1 = function updateMessage(actionType, pending, channelId, scrollToNewMessage, message, _isNotShowOwnMessageForward) {
|
|
17103
|
+
var updateMessage$1 = function updateMessage(actionType, pending, channelId, scrollToNewMessage, message, _isNotShowOwnMessageForward, preserveParentMessage) {
|
|
17095
17104
|
if (scrollToNewMessage === void 0) {
|
|
17096
17105
|
scrollToNewMessage = true;
|
|
17097
17106
|
}
|
|
17107
|
+
if (preserveParentMessage === void 0) {
|
|
17108
|
+
preserveParentMessage = true;
|
|
17109
|
+
}
|
|
17098
17110
|
return /*#__PURE__*/_regenerator().m(function _callee() {
|
|
17099
17111
|
return _regenerator().w(function (_context1) {
|
|
17100
17112
|
while (1) switch (_context1.n) {
|
|
@@ -17103,7 +17115,7 @@ var updateMessage$1 = function updateMessage(actionType, pending, channelId, scr
|
|
|
17103
17115
|
_context1.n = 2;
|
|
17104
17116
|
break;
|
|
17105
17117
|
}
|
|
17106
|
-
addPendingMessage(message, pending, channelId);
|
|
17118
|
+
addPendingMessage(message, pending, channelId, preserveParentMessage);
|
|
17107
17119
|
if (!(getActiveChannelId() === channelId)) {
|
|
17108
17120
|
_context1.n = 2;
|
|
17109
17121
|
break;
|
|
@@ -17911,7 +17923,7 @@ function sendTextMessage(action) {
|
|
|
17911
17923
|
}
|
|
17912
17924
|
function forwardMessage(action) {
|
|
17913
17925
|
var _message$user;
|
|
17914
|
-
var payload, message, channelId, connectionState, isForward, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, parsedChannel, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, _getStoredChannel8, messageResponse, messageUpdateData, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel5, isErrorResendable, _t4;
|
|
17926
|
+
var payload, message, channelId, connectionState, isForward, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, parsedChannel, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, _pendingMessage, _getStoredChannel8, messageResponse, messageUpdateData, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel5, isErrorResendable, _t4;
|
|
17915
17927
|
return _regenerator().w(function (_context15) {
|
|
17916
17928
|
while (1) switch (_context15.p = _context15.n) {
|
|
17917
17929
|
case 0:
|
|
@@ -18008,7 +18020,7 @@ function forwardMessage(action) {
|
|
|
18008
18020
|
messageTid = messageToSend.tid;
|
|
18009
18021
|
pendingMessage = _extends({}, messageToSend, {
|
|
18010
18022
|
createdAt: new Date(Date.now()),
|
|
18011
|
-
user:
|
|
18023
|
+
user: SceytChatClient.user
|
|
18012
18024
|
});
|
|
18013
18025
|
if (isForward && pendingMessage && action.type !== RESEND_MESSAGE) {
|
|
18014
18026
|
if (message.forwardingDetails) {
|
|
@@ -18032,7 +18044,7 @@ function forwardMessage(action) {
|
|
|
18032
18044
|
return call(loadOGMetadataForLinkMessages, [pendingMessage], true);
|
|
18033
18045
|
case 9:
|
|
18034
18046
|
_context15.n = 10;
|
|
18035
|
-
return call(updateMessage$1, action.type, pendingMessage, channel.id, channelId === activeChannelId, message, isNotShowOwnMessageForward);
|
|
18047
|
+
return call(updateMessage$1, action.type, pendingMessage, channel.id, channelId === activeChannelId, message, isNotShowOwnMessageForward, false);
|
|
18036
18048
|
case 10:
|
|
18037
18049
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
18038
18050
|
_context15.n = 16;
|
|
@@ -18045,7 +18057,9 @@ function forwardMessage(action) {
|
|
|
18045
18057
|
case 11:
|
|
18046
18058
|
messageResponse = _context15.v;
|
|
18047
18059
|
messageUpdateData = _extends({}, messageResponse, {
|
|
18048
|
-
channelId: channel.id
|
|
18060
|
+
channelId: channel.id,
|
|
18061
|
+
forwardingDetails: isForward && (_pendingMessage = pendingMessage) !== null && _pendingMessage !== void 0 && _pendingMessage.forwardingDetails ? _extends({}, pendingMessage.forwardingDetails, messageResponse.forwardingDetails) : messageResponse.forwardingDetails,
|
|
18062
|
+
parentMessage: isForward ? null : messageResponse.parentMessage
|
|
18049
18063
|
});
|
|
18050
18064
|
if (!(channelId === activeChannelId)) {
|
|
18051
18065
|
_context15.n = 12;
|
|
@@ -18055,7 +18069,7 @@ function forwardMessage(action) {
|
|
|
18055
18069
|
return put(updateMessageAC(messageToSend.tid, JSON.parse(JSON.stringify(messageUpdateData)), true));
|
|
18056
18070
|
case 12:
|
|
18057
18071
|
addConfirmedMessageToCache(channel.id, JSON.parse(JSON.stringify(messageUpdateData)));
|
|
18058
|
-
messageToUpdate = JSON.parse(JSON.stringify(
|
|
18072
|
+
messageToUpdate = JSON.parse(JSON.stringify(messageUpdateData));
|
|
18059
18073
|
if (!channel.unread) {
|
|
18060
18074
|
_context15.n = 13;
|
|
18061
18075
|
break;
|
|
@@ -23701,13 +23715,13 @@ function handleChannelMessageEvent(args, SceytChatClient) {
|
|
|
23701
23715
|
return visibleMessage.id === ((_storedChannel$lastMe8 = storedChannel.lastMessage) === null || _storedChannel$lastMe8 === void 0 ? void 0 : _storedChannel$lastMe8.id);
|
|
23702
23716
|
}) : false;
|
|
23703
23717
|
messagesHasNext = store.getState().MessageReducer.messagesHasNext;
|
|
23704
|
-
if (!(!messagesHasNext && lastMessageIsInActiveWindow || !messages.length || !messages)) {
|
|
23705
|
-
_context2.n = 10;
|
|
23706
|
-
break;
|
|
23707
|
-
}
|
|
23708
23718
|
existingMessage = store.getState().MessageReducer.activeChannelMessages.find(function (m) {
|
|
23709
23719
|
return message.id && m.id === message.id || message.tid && m.tid === message.tid;
|
|
23710
23720
|
});
|
|
23721
|
+
if (!(existingMessage || !messagesHasNext && lastMessageIsInActiveWindow || !messages.length || !messages)) {
|
|
23722
|
+
_context2.n = 10;
|
|
23723
|
+
break;
|
|
23724
|
+
}
|
|
23711
23725
|
if (!existingMessage) {
|
|
23712
23726
|
_context2.n = 6;
|
|
23713
23727
|
break;
|
|
@@ -50987,6 +51001,23 @@ var Emoji$1 = styled.li(_templateObject8$l || (_templateObject8$l = _taggedTempl
|
|
|
50987
51001
|
return props.hoverBackgroundColor;
|
|
50988
51002
|
});
|
|
50989
51003
|
|
|
51004
|
+
var waitForImageAttachmentPreparation = function waitForImageAttachmentPreparation(attachments, preparations) {
|
|
51005
|
+
try {
|
|
51006
|
+
return Promise.resolve(Promise.all(attachments.filter(function (attachment) {
|
|
51007
|
+
return attachment.type === attachmentTypes.image;
|
|
51008
|
+
}).map(function (attachment) {
|
|
51009
|
+
return attachment.tid ? preparations.get(attachment.tid) : undefined;
|
|
51010
|
+
}))).then(function () {});
|
|
51011
|
+
} catch (e) {
|
|
51012
|
+
return Promise.reject(e);
|
|
51013
|
+
}
|
|
51014
|
+
};
|
|
51015
|
+
var mergePreparedAttachmentPatches = function mergePreparedAttachmentPatches(attachments, patches) {
|
|
51016
|
+
return attachments.map(function (attachment) {
|
|
51017
|
+
return _extends({}, attachment, attachment.tid ? patches.get(attachment.tid) : undefined);
|
|
51018
|
+
});
|
|
51019
|
+
};
|
|
51020
|
+
|
|
50990
51021
|
var getReplyLinkPreviewImage = function getReplyLinkPreviewImage(attachments) {
|
|
50991
51022
|
var _attachments$;
|
|
50992
51023
|
var attachment = attachments !== null && attachments !== void 0 && attachments.length && ((_attachments$ = attachments[0]) === null || _attachments$ === void 0 ? void 0 : _attachments$.type) === attachmentTypes.link ? attachments[0] : null;
|
|
@@ -52720,6 +52751,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
52720
52751
|
var emojiBtnRef = useRef(null);
|
|
52721
52752
|
var addAttachmentsBtnRef = useRef(null);
|
|
52722
52753
|
var metadataDebounceRef = useRef(null);
|
|
52754
|
+
var attachmentPreparationPromisesRef = useRef(new Map());
|
|
52755
|
+
var preparedAttachmentPatchesRef = useRef(new Map());
|
|
52723
52756
|
var sendMessageWrapperRef = useRef(null);
|
|
52724
52757
|
var restoringDraftRef = useRef(false);
|
|
52725
52758
|
var restoredDraftChannelIdRef = useRef(null);
|
|
@@ -52941,168 +52974,196 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
52941
52974
|
}
|
|
52942
52975
|
};
|
|
52943
52976
|
var handleSendEditMessage = function handleSendEditMessage(event, pollDetails) {
|
|
52944
|
-
|
|
52945
|
-
|
|
52946
|
-
|
|
52947
|
-
|
|
52948
|
-
|
|
52949
|
-
|
|
52950
|
-
|
|
52951
|
-
|
|
52952
|
-
|
|
52953
|
-
|
|
52954
|
-
|
|
52955
|
-
|
|
52956
|
-
|
|
52957
|
-
}
|
|
52958
|
-
}
|
|
52959
|
-
if (shouldSend && !mentionsIsOpen) {
|
|
52960
|
-
event.preventDefault();
|
|
52961
|
-
event.stopPropagation();
|
|
52962
|
-
if (messageToEdit) {
|
|
52963
|
-
handleEditMessage();
|
|
52964
|
-
} else if (messageTextForSend !== null && messageTextForSend !== void 0 && messageTextForSend.trim() || attachments.length && attachments.length > 0) {
|
|
52965
|
-
var _trimMessageBodyWithA = trimMessageBodyWithAttributes(messageText, messageBodyAttributes),
|
|
52966
|
-
messageTexToSend = _trimMessageBodyWithA.body,
|
|
52967
|
-
adjustedBodyAttributes = _trimMessageBodyWithA.bodyAttributes;
|
|
52968
|
-
var messageToSend = {
|
|
52969
|
-
body: messageTexToSend,
|
|
52970
|
-
bodyAttributes: adjustedBodyAttributes,
|
|
52971
|
-
mentionedUsers: [],
|
|
52972
|
-
attachments: [],
|
|
52973
|
-
type: 'text'
|
|
52974
|
-
};
|
|
52975
|
-
var mentionUsersToSend = [];
|
|
52976
|
-
if (adjustedBodyAttributes && adjustedBodyAttributes.length) {
|
|
52977
|
-
adjustedBodyAttributes.forEach(function (att) {
|
|
52978
|
-
if (att.type === 'mention') {
|
|
52979
|
-
var mentionsToFind = [].concat(mentionedUsers);
|
|
52980
|
-
var draftMessage = getDraftMessageFromMap(activeChannel.id);
|
|
52981
|
-
if (draftMessage) {
|
|
52982
|
-
mentionsToFind = [].concat(draftMessage.mentionedUsers, mentionedUsers);
|
|
52983
|
-
}
|
|
52984
|
-
var mentionToAdd = mentionsToFind.find(function (mention) {
|
|
52985
|
-
return mention.id === att.metadata;
|
|
52986
|
-
});
|
|
52987
|
-
mentionUsersToSend.push(mentionToAdd || {
|
|
52988
|
-
id: att.metadata
|
|
52989
|
-
});
|
|
52990
|
-
}
|
|
52977
|
+
try {
|
|
52978
|
+
var shiftKey = event.shiftKey,
|
|
52979
|
+
type = event.type,
|
|
52980
|
+
code = event.code;
|
|
52981
|
+
var isEnter = (code === 'Enter' || code === 'NumpadEnter') && shiftKey === false;
|
|
52982
|
+
var isPoll = pollDetails && pollDetails.options.length > 0 && pollDetails.name.trim();
|
|
52983
|
+
var messageTextForSend = isPoll ? pollDetails === null || pollDetails === void 0 ? void 0 : pollDetails.name.trim() : messageText.trim();
|
|
52984
|
+
var shouldSend = (isEnter || type === 'click') && (messageToEdit || messageTextForSend || attachments.length && attachments.length > 0);
|
|
52985
|
+
if (isEnter) {
|
|
52986
|
+
event.preventDefault();
|
|
52987
|
+
if (!(messageTextForSend !== null && messageTextForSend !== void 0 && messageTextForSend.trim()) && !attachments.length && !messageToEdit) {
|
|
52988
|
+
setShouldClearEditor({
|
|
52989
|
+
clear: true
|
|
52991
52990
|
});
|
|
52992
52991
|
}
|
|
52993
|
-
|
|
52994
|
-
|
|
52995
|
-
|
|
52996
|
-
|
|
52997
|
-
|
|
52998
|
-
|
|
52999
|
-
|
|
53000
|
-
|
|
53001
|
-
|
|
53002
|
-
|
|
53003
|
-
|
|
53004
|
-
|
|
53005
|
-
|
|
53006
|
-
|
|
53007
|
-
|
|
53008
|
-
|
|
53009
|
-
|
|
53010
|
-
|
|
53011
|
-
|
|
53012
|
-
|
|
53013
|
-
|
|
52992
|
+
}
|
|
52993
|
+
var _temp6 = function () {
|
|
52994
|
+
if (shouldSend && !mentionsIsOpen) {
|
|
52995
|
+
var _temp5 = function _temp5() {
|
|
52996
|
+
setAttachments([]);
|
|
52997
|
+
attachmentsUpdate = [];
|
|
52998
|
+
removeDraftMessageFromMap(activeChannel.id);
|
|
52999
|
+
dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
|
|
53000
|
+
setViewOnce(false);
|
|
53001
|
+
handleCloseReply();
|
|
53002
|
+
setShouldClearEditor({
|
|
53003
|
+
clear: true
|
|
53004
|
+
});
|
|
53005
|
+
setMentionedUsers([]);
|
|
53006
|
+
setMessageBodyAttributes([]);
|
|
53007
|
+
closePreviewWithAnimation(function () {
|
|
53008
|
+
setDetectedUrl(null);
|
|
53009
|
+
setDismissedUrls(new Set());
|
|
53010
|
+
});
|
|
53011
|
+
dispatch(setCloseSearchChannelsAC(true));
|
|
53012
|
+
};
|
|
53013
|
+
event.preventDefault();
|
|
53014
|
+
event.stopPropagation();
|
|
53015
|
+
var _temp4 = function () {
|
|
53016
|
+
if (messageToEdit) {
|
|
53017
|
+
handleEditMessage();
|
|
53018
|
+
} else {
|
|
53019
|
+
var _temp7 = function () {
|
|
53020
|
+
if (messageTextForSend !== null && messageTextForSend !== void 0 && messageTextForSend.trim() || attachments.length && attachments.length > 0) {
|
|
53021
|
+
var _temp2 = function _temp2() {
|
|
53022
|
+
setMessageText('');
|
|
53023
|
+
fileUploader.current.value = '';
|
|
53024
|
+
if (inTypingState) {
|
|
53025
|
+
handleSendTypingState(false);
|
|
53026
|
+
}
|
|
53027
|
+
clearTimeout(typingTimout);
|
|
53028
|
+
setTypingTimout(undefined);
|
|
53029
|
+
};
|
|
53030
|
+
var _trimMessageBodyWithA = trimMessageBodyWithAttributes(messageText, messageBodyAttributes),
|
|
53031
|
+
messageTexToSend = _trimMessageBodyWithA.body,
|
|
53032
|
+
adjustedBodyAttributes = _trimMessageBodyWithA.bodyAttributes;
|
|
53033
|
+
var messageToSend = {
|
|
53034
|
+
body: messageTexToSend,
|
|
53035
|
+
bodyAttributes: adjustedBodyAttributes,
|
|
53036
|
+
mentionedUsers: [],
|
|
53037
|
+
attachments: [],
|
|
53038
|
+
type: 'text'
|
|
53039
|
+
};
|
|
53040
|
+
var mentionUsersToSend = [];
|
|
53041
|
+
if (adjustedBodyAttributes && adjustedBodyAttributes.length) {
|
|
53042
|
+
adjustedBodyAttributes.forEach(function (att) {
|
|
53043
|
+
if (att.type === 'mention') {
|
|
53044
|
+
var mentionsToFind = [].concat(mentionedUsers);
|
|
53045
|
+
var draftMessage = getDraftMessageFromMap(activeChannel.id);
|
|
53046
|
+
if (draftMessage) {
|
|
53047
|
+
mentionsToFind = [].concat(draftMessage.mentionedUsers, mentionedUsers);
|
|
53048
|
+
}
|
|
53049
|
+
var mentionToAdd = mentionsToFind.find(function (mention) {
|
|
53050
|
+
return mention.id === att.metadata;
|
|
53051
|
+
});
|
|
53052
|
+
mentionUsersToSend.push(mentionToAdd || {
|
|
53053
|
+
id: att.metadata
|
|
53054
|
+
});
|
|
53055
|
+
}
|
|
53056
|
+
});
|
|
53057
|
+
}
|
|
53058
|
+
messageToSend.mentionedUsers = mentionUsersToSend;
|
|
53059
|
+
if (messageForReply) {
|
|
53060
|
+
messageToSend.parentMessage = messageForReply;
|
|
53061
|
+
}
|
|
53062
|
+
var linkAttachment;
|
|
53063
|
+
if (messageTexToSend) {
|
|
53064
|
+
var _LinkifyIt$match;
|
|
53065
|
+
var protocolMatch = /https?:\/\/\S+/.exec(messageTexToSend);
|
|
53066
|
+
var linkifyMatchResult = !protocolMatch ? (_LinkifyIt$match = new LinkifyIt().match(messageTexToSend)) === null || _LinkifyIt$match === void 0 ? void 0 : _LinkifyIt$match[0] : null;
|
|
53067
|
+
var url = protocolMatch ? protocolMatch[0] : linkifyMatchResult ? linkifyMatchResult.schema === '' ? linkifyMatchResult.url.replace(/^http:\/\//, 'https://') : linkifyMatchResult.url : null;
|
|
53068
|
+
if (url) {
|
|
53069
|
+
var urlMetadata = oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[url];
|
|
53070
|
+
var metadata = {};
|
|
53071
|
+
if (urlMetadata) {
|
|
53072
|
+
var _urlMetadata$og, _urlMetadata$og$favic, _urlMetadata$og2, _urlMetadata$og$descr, _urlMetadata$og3, _urlMetadata$og3$imag, _urlMetadata$og3$imag2, _urlMetadata$og4, _urlMetadata$og$title;
|
|
53073
|
+
if (urlMetadata.imageWidth) metadata.szw = urlMetadata.imageWidth;
|
|
53074
|
+
if (urlMetadata.imageHeight) metadata.szh = urlMetadata.imageHeight;
|
|
53075
|
+
if ((_urlMetadata$og = urlMetadata.og) !== null && _urlMetadata$og !== void 0 && (_urlMetadata$og$favic = _urlMetadata$og.favicon) !== null && _urlMetadata$og$favic !== void 0 && _urlMetadata$og$favic.url) metadata.tur = urlMetadata.og.favicon.url;
|
|
53076
|
+
if ((_urlMetadata$og2 = urlMetadata.og) !== null && _urlMetadata$og2 !== void 0 && _urlMetadata$og2.description) metadata.dsc = (_urlMetadata$og$descr = urlMetadata.og.description) === null || _urlMetadata$og$descr === void 0 ? void 0 : _urlMetadata$og$descr.slice(0, 200);
|
|
53077
|
+
if ((_urlMetadata$og3 = urlMetadata.og) !== null && _urlMetadata$og3 !== void 0 && (_urlMetadata$og3$imag = _urlMetadata$og3.image) !== null && _urlMetadata$og3$imag !== void 0 && (_urlMetadata$og3$imag2 = _urlMetadata$og3$imag[0]) !== null && _urlMetadata$og3$imag2 !== void 0 && _urlMetadata$og3$imag2.url) metadata.iur = urlMetadata.og.image[0].url;
|
|
53078
|
+
if ((_urlMetadata$og4 = urlMetadata.og) !== null && _urlMetadata$og4 !== void 0 && _urlMetadata$og4.title) metadata.ttl = (_urlMetadata$og$title = urlMetadata.og.title) === null || _urlMetadata$og$title === void 0 ? void 0 : _urlMetadata$og$title.slice(0, 100);
|
|
53079
|
+
}
|
|
53080
|
+
if (dismissedUrls.has(url)) {
|
|
53081
|
+
metadata.hld = true;
|
|
53082
|
+
}
|
|
53083
|
+
linkAttachment = _extends({
|
|
53084
|
+
type: attachmentTypes.link,
|
|
53085
|
+
data: url,
|
|
53086
|
+
upload: false
|
|
53087
|
+
}, Object.keys(metadata).length > 0 ? {
|
|
53088
|
+
metadata: metadata,
|
|
53089
|
+
name: metadata.ttl
|
|
53090
|
+
} : {
|
|
53091
|
+
metadata: {
|
|
53092
|
+
hld: true
|
|
53093
|
+
}
|
|
53094
|
+
});
|
|
53095
|
+
}
|
|
53096
|
+
}
|
|
53097
|
+
if (messageTexToSend !== null && messageTexToSend !== void 0 && messageTexToSend.trim() && !attachments.length) {
|
|
53098
|
+
if (linkAttachment) {
|
|
53099
|
+
messageToSend.attachments = [linkAttachment];
|
|
53100
|
+
}
|
|
53101
|
+
if (isPoll) {
|
|
53102
|
+
messageToSend.pollDetails = pollDetails;
|
|
53103
|
+
messageToSend.type = 'poll';
|
|
53104
|
+
messageToSend.body = messageTextForSend === null || messageTextForSend === void 0 ? void 0 : messageTextForSend.trim();
|
|
53105
|
+
}
|
|
53106
|
+
dispatch(sendTextMessageAC(messageToSend, activeChannel.id, connectionStatus));
|
|
53107
|
+
}
|
|
53108
|
+
var _temp = function () {
|
|
53109
|
+
if (attachments.length) {
|
|
53110
|
+
return Promise.resolve(waitForImageAttachmentPreparation(attachments, attachmentPreparationPromisesRef.current)).then(function () {
|
|
53111
|
+
var sendAsSeparateMessage = getSendAttachmentsAsSeparateMessages();
|
|
53112
|
+
messageToSend.attachments = mergePreparedAttachmentPatches(attachments, preparedAttachmentPatchesRef.current).map(function (preparedAttachment) {
|
|
53113
|
+
return {
|
|
53114
|
+
name: preparedAttachment.data.name,
|
|
53115
|
+
data: preparedAttachment.data,
|
|
53116
|
+
attachmentUrl: preparedAttachment.attachmentUrl,
|
|
53117
|
+
tid: preparedAttachment.tid,
|
|
53118
|
+
cachedUrl: preparedAttachment.cachedUrl,
|
|
53119
|
+
upload: preparedAttachment.upload,
|
|
53120
|
+
metadata: preparedAttachment.metadata,
|
|
53121
|
+
type: preparedAttachment.type,
|
|
53122
|
+
size: preparedAttachment.size,
|
|
53123
|
+
thumbnailState: preparedAttachment.thumbnailState
|
|
53124
|
+
};
|
|
53125
|
+
});
|
|
53126
|
+
if (viewOnce && canShowViewOnceToggle) {
|
|
53127
|
+
messageToSend.viewOnce = true;
|
|
53128
|
+
}
|
|
53129
|
+
var attachmentsToSent = [].concat(messageToSend.attachments);
|
|
53130
|
+
if (linkAttachment && !messageToSend.viewOnce) {
|
|
53131
|
+
attachmentsToSent.push(linkAttachment);
|
|
53132
|
+
}
|
|
53133
|
+
dispatch(sendMessageAC(_extends({}, messageToSend, {
|
|
53134
|
+
attachments: attachmentsToSent
|
|
53135
|
+
}), activeChannel.id, connectionStatus, sendAsSeparateMessage));
|
|
53136
|
+
attachments.forEach(function (attachment) {
|
|
53137
|
+
attachmentPreparationPromisesRef.current["delete"](attachment.tid);
|
|
53138
|
+
preparedAttachmentPatchesRef.current["delete"](attachment.tid);
|
|
53139
|
+
});
|
|
53140
|
+
});
|
|
53141
|
+
}
|
|
53142
|
+
}();
|
|
53143
|
+
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
|
53144
|
+
}
|
|
53145
|
+
}();
|
|
53146
|
+
if (_temp7 && _temp7.then) return _temp7.then(function () {});
|
|
53014
53147
|
}
|
|
53015
|
-
|
|
53016
|
-
|
|
53148
|
+
}();
|
|
53149
|
+
return _temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4);
|
|
53150
|
+
} else {
|
|
53151
|
+
if (typingTimout) {
|
|
53152
|
+
if (!inTypingStateTimout) {
|
|
53153
|
+
handleSendTypingState(true, code);
|
|
53017
53154
|
}
|
|
53018
|
-
|
|
53019
|
-
|
|
53020
|
-
|
|
53021
|
-
upload: false
|
|
53022
|
-
}, Object.keys(metadata).length > 0 ? {
|
|
53023
|
-
metadata: metadata,
|
|
53024
|
-
name: metadata.ttl
|
|
53025
|
-
} : {
|
|
53026
|
-
metadata: {
|
|
53027
|
-
hld: true
|
|
53028
|
-
}
|
|
53029
|
-
});
|
|
53030
|
-
}
|
|
53031
|
-
}
|
|
53032
|
-
if (messageTexToSend !== null && messageTexToSend !== void 0 && messageTexToSend.trim() && !attachments.length) {
|
|
53033
|
-
if (linkAttachment) {
|
|
53034
|
-
messageToSend.attachments = [linkAttachment];
|
|
53035
|
-
}
|
|
53036
|
-
if (isPoll) {
|
|
53037
|
-
messageToSend.pollDetails = pollDetails;
|
|
53038
|
-
messageToSend.type = 'poll';
|
|
53039
|
-
messageToSend.body = messageTextForSend === null || messageTextForSend === void 0 ? void 0 : messageTextForSend.trim();
|
|
53040
|
-
}
|
|
53041
|
-
dispatch(sendTextMessageAC(messageToSend, activeChannel.id, connectionStatus));
|
|
53042
|
-
}
|
|
53043
|
-
if (attachments.length) {
|
|
53044
|
-
var sendAsSeparateMessage = getSendAttachmentsAsSeparateMessages();
|
|
53045
|
-
messageToSend.attachments = attachments.map(function (attachment) {
|
|
53046
|
-
return {
|
|
53047
|
-
name: attachment.data.name,
|
|
53048
|
-
data: attachment.data,
|
|
53049
|
-
attachmentUrl: attachment.attachmentUrl,
|
|
53050
|
-
tid: attachment.tid,
|
|
53051
|
-
cachedUrl: attachment.cachedUrl,
|
|
53052
|
-
upload: attachment.upload,
|
|
53053
|
-
metadata: attachment.metadata,
|
|
53054
|
-
type: attachment.type,
|
|
53055
|
-
size: attachment.size,
|
|
53056
|
-
thumbnailState: attachment.thumbnailState
|
|
53057
|
-
};
|
|
53058
|
-
});
|
|
53059
|
-
if (viewOnce && canShowViewOnceToggle) {
|
|
53060
|
-
messageToSend.viewOnce = true;
|
|
53061
|
-
}
|
|
53062
|
-
var attachmentsToSent = [].concat(messageToSend.attachments);
|
|
53063
|
-
if (linkAttachment && !messageToSend.viewOnce) {
|
|
53064
|
-
attachmentsToSent.push(linkAttachment);
|
|
53155
|
+
clearTimeout(typingTimout);
|
|
53156
|
+
} else {
|
|
53157
|
+
handleSendTypingState(true, code);
|
|
53065
53158
|
}
|
|
53066
|
-
|
|
53067
|
-
|
|
53068
|
-
}
|
|
53069
|
-
}
|
|
53070
|
-
setMessageText('');
|
|
53071
|
-
fileUploader.current.value = '';
|
|
53072
|
-
if (inTypingState) {
|
|
53073
|
-
handleSendTypingState(false);
|
|
53159
|
+
setTypingTimout(setTimeout(function () {
|
|
53160
|
+
setTypingTimout(0);
|
|
53161
|
+
}, 2000));
|
|
53074
53162
|
}
|
|
53075
|
-
|
|
53076
|
-
|
|
53077
|
-
|
|
53078
|
-
|
|
53079
|
-
attachmentsUpdate = [];
|
|
53080
|
-
removeDraftMessageFromMap(activeChannel.id);
|
|
53081
|
-
dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
|
|
53082
|
-
setViewOnce(false);
|
|
53083
|
-
handleCloseReply();
|
|
53084
|
-
setShouldClearEditor({
|
|
53085
|
-
clear: true
|
|
53086
|
-
});
|
|
53087
|
-
setMentionedUsers([]);
|
|
53088
|
-
setMessageBodyAttributes([]);
|
|
53089
|
-
closePreviewWithAnimation(function () {
|
|
53090
|
-
setDetectedUrl(null);
|
|
53091
|
-
setDismissedUrls(new Set());
|
|
53092
|
-
});
|
|
53093
|
-
dispatch(setCloseSearchChannelsAC(true));
|
|
53094
|
-
} else {
|
|
53095
|
-
if (typingTimout) {
|
|
53096
|
-
if (!inTypingStateTimout) {
|
|
53097
|
-
handleSendTypingState(true, code);
|
|
53098
|
-
}
|
|
53099
|
-
clearTimeout(typingTimout);
|
|
53100
|
-
} else {
|
|
53101
|
-
handleSendTypingState(true, code);
|
|
53102
|
-
}
|
|
53103
|
-
setTypingTimout(setTimeout(function () {
|
|
53104
|
-
setTypingTimout(0);
|
|
53105
|
-
}, 2000));
|
|
53163
|
+
}();
|
|
53164
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
|
|
53165
|
+
} catch (e) {
|
|
53166
|
+
return Promise.reject(e);
|
|
53106
53167
|
}
|
|
53107
53168
|
};
|
|
53108
53169
|
var handleEditMessage = function handleEditMessage() {
|
|
@@ -53208,6 +53269,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53208
53269
|
return item.tid !== attachmentId;
|
|
53209
53270
|
});
|
|
53210
53271
|
clearVideoPreparation(attachmentId);
|
|
53272
|
+
attachmentPreparationPromisesRef.current["delete"](attachmentId);
|
|
53273
|
+
preparedAttachmentPatchesRef.current["delete"](attachmentId);
|
|
53211
53274
|
releaseBlobUrls(["compose_" + attachmentId]);
|
|
53212
53275
|
setAttachments(updatedAttachments);
|
|
53213
53276
|
attachmentsUpdate = updatedAttachments;
|
|
@@ -53215,6 +53278,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53215
53278
|
attachmentsUpdate.forEach(function (attachment) {
|
|
53216
53279
|
return clearVideoPreparation(attachment.tid);
|
|
53217
53280
|
});
|
|
53281
|
+
attachmentPreparationPromisesRef.current.clear();
|
|
53282
|
+
preparedAttachmentPatchesRef.current.clear();
|
|
53218
53283
|
releaseBlobUrls(attachmentsUpdate.map(function (item) {
|
|
53219
53284
|
return "compose_" + item.tid;
|
|
53220
53285
|
}));
|
|
@@ -53291,14 +53356,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53291
53356
|
}
|
|
53292
53357
|
}
|
|
53293
53358
|
}
|
|
53294
|
-
var
|
|
53359
|
+
var _temp8 = function () {
|
|
53295
53360
|
if (allowUpload) {
|
|
53296
53361
|
return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, isMediaAttachment)).then(function () {});
|
|
53297
53362
|
} else {
|
|
53298
53363
|
showFileUploadError(errorMessage);
|
|
53299
53364
|
}
|
|
53300
53365
|
}();
|
|
53301
|
-
return Promise.resolve(
|
|
53366
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
|
|
53302
53367
|
} catch (e) {
|
|
53303
53368
|
return Promise.reject(e);
|
|
53304
53369
|
}
|
|
@@ -53349,14 +53414,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53349
53414
|
errorMessage = allowedMediaExtensionsErrorMessage != null ? allowedMediaExtensionsErrorMessage : "Invalid file type. Allowed extensions are: " + allowedMediaExtensions.join(', ') + ".";
|
|
53350
53415
|
}
|
|
53351
53416
|
}
|
|
53352
|
-
var
|
|
53417
|
+
var _temp9 = function () {
|
|
53353
53418
|
if (allowUpload) {
|
|
53354
53419
|
return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, true)).then(function () {});
|
|
53355
53420
|
} else {
|
|
53356
53421
|
showFileUploadError(errorMessage);
|
|
53357
53422
|
}
|
|
53358
53423
|
}();
|
|
53359
|
-
return Promise.resolve(
|
|
53424
|
+
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
|
|
53360
53425
|
} catch (e) {
|
|
53361
53426
|
return Promise.reject(e);
|
|
53362
53427
|
}
|
|
@@ -53495,160 +53560,172 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53495
53560
|
return [].concat(prevState, [attachment]);
|
|
53496
53561
|
});
|
|
53497
53562
|
var updateAttachment = function updateAttachment(patch) {
|
|
53563
|
+
preparedAttachmentPatchesRef.current.set(tid, _extends({}, preparedAttachmentPatchesRef.current.get(tid), patch));
|
|
53498
53564
|
setAttachments(function (prevState) {
|
|
53499
53565
|
return prevState.map(function (current) {
|
|
53500
53566
|
return current.tid === tid ? _extends({}, current, patch) : current;
|
|
53501
53567
|
});
|
|
53502
53568
|
});
|
|
53503
53569
|
};
|
|
53504
|
-
|
|
53505
|
-
|
|
53506
|
-
|
|
53507
|
-
|
|
53508
|
-
var
|
|
53509
|
-
|
|
53510
|
-
var
|
|
53511
|
-
|
|
53512
|
-
|
|
53513
|
-
|
|
53514
|
-
|
|
53515
|
-
|
|
53516
|
-
|
|
53517
|
-
|
|
53518
|
-
metadata: {
|
|
53519
|
-
szw: imageWidth,
|
|
53520
|
-
szh: imageHeight,
|
|
53521
|
-
tmb: thumbnail
|
|
53522
|
-
}
|
|
53523
|
-
};
|
|
53524
|
-
updateAttachment(patch);
|
|
53525
|
-
handleAttachmentImageForCache(_extends({}, attachment, patch));
|
|
53526
|
-
});
|
|
53527
|
-
} else {
|
|
53528
|
-
var _temp10 = function () {
|
|
53529
|
-
if (isMediaAttachment && file.type !== 'image/gif') {
|
|
53530
|
-
return Promise.resolve(resizeImage(file)).then(function (resizedFileData) {
|
|
53531
|
-
var resizedFile = resizedFileData.blob ? new File([resizedFileData.blob], resizedFileData.file.name, {
|
|
53532
|
-
type: file.type
|
|
53533
|
-
}) : file;
|
|
53570
|
+
var preparationPromise = new Promise(function (resolve) {
|
|
53571
|
+
return setTimeout(function () {
|
|
53572
|
+
try {
|
|
53573
|
+
return Promise.resolve(_finallyRethrows(function () {
|
|
53574
|
+
var _temp16 = function () {
|
|
53575
|
+
if (fileType === 'image') {
|
|
53576
|
+
var _temp10 = _catch(function () {
|
|
53577
|
+
return Promise.resolve(createImageThumbnail(file)).then(function (_ref5) {
|
|
53578
|
+
var thumbnail = _ref5.thumbnail,
|
|
53579
|
+
imageWidth = _ref5.imageWidth,
|
|
53580
|
+
imageHeight = _ref5.imageHeight;
|
|
53581
|
+
var _temp1 = function () {
|
|
53582
|
+
if (customUploader) {
|
|
53583
|
+
return Promise.resolve(resizeImage(file)).then(function (resizedFile) {
|
|
53534
53584
|
var patch = {
|
|
53535
|
-
|
|
53536
|
-
|
|
53537
|
-
|
|
53538
|
-
|
|
53539
|
-
|
|
53540
|
-
|
|
53541
|
-
})
|
|
53585
|
+
size: isMediaAttachment && resizedFile !== null && resizedFile !== void 0 && resizedFile.blob ? resizedFile.blob.size : file.size,
|
|
53586
|
+
metadata: {
|
|
53587
|
+
szw: imageWidth,
|
|
53588
|
+
szh: imageHeight,
|
|
53589
|
+
tmb: thumbnail
|
|
53590
|
+
}
|
|
53542
53591
|
};
|
|
53543
53592
|
updateAttachment(patch);
|
|
53544
|
-
setPendingAttachment(tid, {
|
|
53545
|
-
file: resizedFile
|
|
53546
|
-
});
|
|
53547
53593
|
handleAttachmentImageForCache(_extends({}, attachment, patch));
|
|
53548
53594
|
});
|
|
53549
53595
|
} else {
|
|
53550
|
-
|
|
53551
|
-
|
|
53552
|
-
|
|
53553
|
-
|
|
53554
|
-
|
|
53555
|
-
|
|
53556
|
-
|
|
53596
|
+
var _temp17 = function () {
|
|
53597
|
+
if (isMediaAttachment && file.type !== 'image/gif') {
|
|
53598
|
+
return Promise.resolve(resizeImage(file)).then(function (resizedFileData) {
|
|
53599
|
+
var resizedFile = resizedFileData.blob ? new File([resizedFileData.blob], resizedFileData.file.name, {
|
|
53600
|
+
type: file.type
|
|
53601
|
+
}) : file;
|
|
53602
|
+
var patch = {
|
|
53603
|
+
data: resizedFile,
|
|
53604
|
+
size: resizedFile.size,
|
|
53605
|
+
metadata: JSON.stringify({
|
|
53606
|
+
tmb: thumbnail,
|
|
53607
|
+
szw: resizedFileData.newWidth,
|
|
53608
|
+
szh: resizedFileData.newHeight
|
|
53609
|
+
})
|
|
53610
|
+
};
|
|
53611
|
+
updateAttachment(patch);
|
|
53612
|
+
setPendingAttachment(tid, {
|
|
53613
|
+
file: resizedFile
|
|
53614
|
+
});
|
|
53615
|
+
handleAttachmentImageForCache(_extends({}, attachment, patch));
|
|
53616
|
+
});
|
|
53617
|
+
} else {
|
|
53618
|
+
updateAttachment({
|
|
53619
|
+
metadata: JSON.stringify({
|
|
53620
|
+
tmb: thumbnail,
|
|
53621
|
+
szw: imageWidth,
|
|
53622
|
+
szh: imageHeight
|
|
53623
|
+
})
|
|
53624
|
+
});
|
|
53625
|
+
}
|
|
53626
|
+
}();
|
|
53627
|
+
if (_temp17 && _temp17.then) return _temp17.then(function () {});
|
|
53557
53628
|
}
|
|
53558
53629
|
}();
|
|
53559
|
-
if (
|
|
53560
|
-
}
|
|
53561
|
-
}()
|
|
53562
|
-
|
|
53563
|
-
|
|
53564
|
-
|
|
53565
|
-
|
|
53566
|
-
|
|
53567
|
-
|
|
53568
|
-
|
|
53569
|
-
|
|
53570
|
-
|
|
53571
|
-
|
|
53572
|
-
|
|
53573
|
-
|
|
53574
|
-
|
|
53575
|
-
|
|
53576
|
-
|
|
53577
|
-
|
|
53578
|
-
|
|
53579
|
-
|
|
53580
|
-
|
|
53581
|
-
|
|
53582
|
-
|
|
53583
|
-
|
|
53584
|
-
|
|
53585
|
-
|
|
53630
|
+
if (_temp1 && _temp1.then) return _temp1.then(function () {});
|
|
53631
|
+
});
|
|
53632
|
+
}, function (error) {
|
|
53633
|
+
log.warn('Unable to prepare image attachment preview:', error);
|
|
53634
|
+
});
|
|
53635
|
+
if (_temp10 && _temp10.then) return _temp10.then(function () {});
|
|
53636
|
+
} else {
|
|
53637
|
+
var _temp18 = function () {
|
|
53638
|
+
if (fileType === 'video') {
|
|
53639
|
+
var _temp14 = function _temp14() {
|
|
53640
|
+
return Promise.resolve(remuxPromise).then(function (uploadFile) {
|
|
53641
|
+
if (uploadFile !== file) {
|
|
53642
|
+
updateAttachment({
|
|
53643
|
+
data: uploadFile,
|
|
53644
|
+
size: uploadFile.size
|
|
53645
|
+
});
|
|
53646
|
+
setPendingAttachment(tid, {
|
|
53647
|
+
file: uploadFile
|
|
53648
|
+
});
|
|
53649
|
+
}
|
|
53650
|
+
if (metadata) {
|
|
53651
|
+
completeVideoPreparation(tid, {
|
|
53652
|
+
file: uploadFile,
|
|
53653
|
+
metadata: metadata
|
|
53654
|
+
});
|
|
53655
|
+
} else {
|
|
53656
|
+
failVideoPreparation(tid);
|
|
53657
|
+
updateAttachment({
|
|
53658
|
+
thumbnailState: 'failed'
|
|
53659
|
+
});
|
|
53660
|
+
}
|
|
53586
53661
|
});
|
|
53587
|
-
}
|
|
53588
|
-
|
|
53589
|
-
|
|
53590
|
-
|
|
53662
|
+
};
|
|
53663
|
+
var remuxPromise = remuxVideoFileForUpload(file);
|
|
53664
|
+
var thumbnailSource = file;
|
|
53665
|
+
var metadata;
|
|
53666
|
+
var _temp13 = _catch(function () {
|
|
53667
|
+
function _temp12() {
|
|
53668
|
+
var _frame = frame,
|
|
53669
|
+
thumb = _frame.thumb,
|
|
53670
|
+
width = _frame.width,
|
|
53671
|
+
height = _frame.height,
|
|
53672
|
+
duration = _frame.duration;
|
|
53673
|
+
metadata = customUploader ? {
|
|
53674
|
+
szw: width,
|
|
53675
|
+
szh: height,
|
|
53676
|
+
tmb: thumb,
|
|
53677
|
+
dur: duration
|
|
53678
|
+
} : JSON.stringify({
|
|
53679
|
+
tmb: thumb,
|
|
53680
|
+
szw: width,
|
|
53681
|
+
szh: height,
|
|
53682
|
+
dur: duration
|
|
53683
|
+
});
|
|
53684
|
+
updateAttachment({
|
|
53685
|
+
metadata: metadata,
|
|
53686
|
+
thumbnailState: 'ready'
|
|
53687
|
+
});
|
|
53688
|
+
handleAttachmentVideoForCache(_extends({}, attachment, {
|
|
53689
|
+
metadata: metadata
|
|
53690
|
+
}));
|
|
53691
|
+
}
|
|
53692
|
+
var frame;
|
|
53693
|
+
var _temp11 = _catch(function () {
|
|
53694
|
+
return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame) {
|
|
53695
|
+
frame = _getFrame;
|
|
53696
|
+
});
|
|
53697
|
+
}, function () {
|
|
53698
|
+
return Promise.resolve(remuxPromise).then(function (_remuxPromise) {
|
|
53699
|
+
thumbnailSource = _remuxPromise;
|
|
53700
|
+
return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame2) {
|
|
53701
|
+
frame = _getFrame2;
|
|
53702
|
+
});
|
|
53703
|
+
});
|
|
53591
53704
|
});
|
|
53592
|
-
|
|
53593
|
-
|
|
53594
|
-
|
|
53595
|
-
var remuxPromise = remuxVideoFileForUpload(file);
|
|
53596
|
-
var thumbnailSource = file;
|
|
53597
|
-
var metadata;
|
|
53598
|
-
var _temp8 = _catch(function () {
|
|
53599
|
-
function _temp7() {
|
|
53600
|
-
var _frame = frame,
|
|
53601
|
-
thumb = _frame.thumb,
|
|
53602
|
-
width = _frame.width,
|
|
53603
|
-
height = _frame.height,
|
|
53604
|
-
duration = _frame.duration;
|
|
53605
|
-
metadata = customUploader ? {
|
|
53606
|
-
szw: width,
|
|
53607
|
-
szh: height,
|
|
53608
|
-
tmb: thumb,
|
|
53609
|
-
dur: duration
|
|
53610
|
-
} : JSON.stringify({
|
|
53611
|
-
tmb: thumb,
|
|
53612
|
-
szw: width,
|
|
53613
|
-
szh: height,
|
|
53614
|
-
dur: duration
|
|
53615
|
-
});
|
|
53616
|
-
updateAttachment({
|
|
53617
|
-
metadata: metadata,
|
|
53618
|
-
thumbnailState: 'ready'
|
|
53705
|
+
return _temp11 && _temp11.then ? _temp11.then(_temp12) : _temp12(_temp11);
|
|
53706
|
+
}, function (error) {
|
|
53707
|
+
log.warn('Unable to generate video thumbnail:', error);
|
|
53619
53708
|
});
|
|
53620
|
-
|
|
53621
|
-
metadata: metadata
|
|
53622
|
-
}));
|
|
53709
|
+
return _temp13 && _temp13.then ? _temp13.then(_temp14) : _temp14(_temp13);
|
|
53623
53710
|
}
|
|
53624
|
-
|
|
53625
|
-
|
|
53626
|
-
return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame) {
|
|
53627
|
-
frame = _getFrame;
|
|
53628
|
-
});
|
|
53629
|
-
}, function () {
|
|
53630
|
-
return Promise.resolve(remuxPromise).then(function (_remuxPromise) {
|
|
53631
|
-
thumbnailSource = _remuxPromise;
|
|
53632
|
-
return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame2) {
|
|
53633
|
-
frame = _getFrame2;
|
|
53634
|
-
});
|
|
53635
|
-
});
|
|
53636
|
-
});
|
|
53637
|
-
return _temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6);
|
|
53638
|
-
}, function (error) {
|
|
53639
|
-
log.warn('Unable to generate video thumbnail:', error);
|
|
53640
|
-
});
|
|
53641
|
-
return _temp8 && _temp8.then ? _temp8.then(_temp9) : _temp9(_temp8);
|
|
53711
|
+
}();
|
|
53712
|
+
if (_temp18 && _temp18.then) return _temp18.then(function () {});
|
|
53642
53713
|
}
|
|
53643
53714
|
}();
|
|
53644
|
-
if (
|
|
53645
|
-
}
|
|
53646
|
-
|
|
53647
|
-
|
|
53648
|
-
|
|
53649
|
-
|
|
53650
|
-
|
|
53651
|
-
|
|
53715
|
+
if (_temp16 && _temp16.then) return _temp16.then(function () {});
|
|
53716
|
+
}, function (_wasThrown, _result) {
|
|
53717
|
+
resolve();
|
|
53718
|
+
if (_wasThrown) throw _result;
|
|
53719
|
+
return _result;
|
|
53720
|
+
}));
|
|
53721
|
+
} catch (e) {
|
|
53722
|
+
return Promise.reject(e);
|
|
53723
|
+
}
|
|
53724
|
+
}, 0);
|
|
53725
|
+
});
|
|
53726
|
+
if (fileType === 'image') {
|
|
53727
|
+
attachmentPreparationPromisesRef.current.set(tid, preparationPromise);
|
|
53728
|
+
}
|
|
53652
53729
|
return Promise.resolve();
|
|
53653
53730
|
} catch (e) {
|
|
53654
53731
|
return Promise.reject(e);
|
|
@@ -53708,14 +53785,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53708
53785
|
}
|
|
53709
53786
|
}
|
|
53710
53787
|
}
|
|
53711
|
-
var
|
|
53788
|
+
var _temp19 = function () {
|
|
53712
53789
|
if (allowUpload) {
|
|
53713
53790
|
return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, isMediaAttachment)).then(function () {});
|
|
53714
53791
|
} else {
|
|
53715
53792
|
showFileUploadError(errorMessage);
|
|
53716
53793
|
}
|
|
53717
53794
|
}();
|
|
53718
|
-
return Promise.resolve(
|
|
53795
|
+
return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
|
|
53719
53796
|
} catch (e) {
|
|
53720
53797
|
return Promise.reject(e);
|
|
53721
53798
|
}
|
|
@@ -54728,7 +54805,7 @@ var LinkPreviewContainer = styled.div(_templateObject39$1 || (_templateObject39$
|
|
|
54728
54805
|
}, function (props) {
|
|
54729
54806
|
return props.isClosing ? linkPreviewSlideOut : linkPreviewSlideIn;
|
|
54730
54807
|
});
|
|
54731
|
-
var LinkPreviewContent = styled.div(_templateObject40$1 || (_templateObject40$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n
|
|
54808
|
+
var LinkPreviewContent = styled.div(_templateObject40$1 || (_templateObject40$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex: 1;\n overflow: hidden;\n"])));
|
|
54732
54809
|
var LinkPreviewImage = styled.img(_templateObject41$1 || (_templateObject41$1 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n object-fit: cover;\n border-radius: 4px;\n flex-shrink: 0;\n margin-right: 8px;\n background: ", ";\n"])), function (props) {
|
|
54733
54810
|
return props.bg;
|
|
54734
54811
|
});
|