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.js
CHANGED
|
@@ -12329,9 +12329,12 @@ function updateMessageOnMap(channelId, updatedMessage, voteDetails) {
|
|
|
12329
12329
|
updatedMessageData = _extends({}, updatedMessage.params);
|
|
12330
12330
|
nextMessage = _extends({}, mes, updatedMessageData);
|
|
12331
12331
|
} else {
|
|
12332
|
-
var _updatedMessage$param6;
|
|
12332
|
+
var _updatedMessage$param6, _updatedMessage$param7;
|
|
12333
12333
|
var statusUpdatedMessage = (_updatedMessage$param6 = updatedMessage.params) !== null && _updatedMessage$param6 !== void 0 && _updatedMessage$param6.deliveryStatus ? updateMessageDeliveryStatusAndMarkers(mes, updatedMessage.params) : {};
|
|
12334
|
-
|
|
12334
|
+
var forwardingDetails = mes.forwardingDetails && (_updatedMessage$param7 = updatedMessage.params) !== null && _updatedMessage$param7 !== void 0 && _updatedMessage$param7.forwardingDetails ? _extends({}, mes.forwardingDetails, updatedMessage.params.forwardingDetails) : undefined;
|
|
12335
|
+
updatedMessageData = _extends({}, mes, updatedMessage.params, forwardingDetails ? {
|
|
12336
|
+
forwardingDetails: forwardingDetails
|
|
12337
|
+
} : {}, statusUpdatedMessage);
|
|
12335
12338
|
var voteDetailsData = mes === null || mes === void 0 ? void 0 : mes.pollDetails;
|
|
12336
12339
|
if (voteDetails) {
|
|
12337
12340
|
voteDetailsData = handleVoteDetails(voteDetails, updatedMessageData);
|
|
@@ -13044,7 +13047,10 @@ var messageSlice = createSlice({
|
|
|
13044
13047
|
if (params !== null && params !== void 0 && params.deliveryStatus) {
|
|
13045
13048
|
statusUpdatedMessage = updateMessageDeliveryStatusAndMarkers(message, params);
|
|
13046
13049
|
}
|
|
13047
|
-
var
|
|
13050
|
+
var forwardingDetails = message.forwardingDetails && params.forwardingDetails ? _extends({}, message.forwardingDetails, params.forwardingDetails) : undefined;
|
|
13051
|
+
var messageOldData = _extends({}, message, params, forwardingDetails ? {
|
|
13052
|
+
forwardingDetails: forwardingDetails
|
|
13053
|
+
} : {}, {
|
|
13048
13054
|
userMarkers: [].concat(message.userMarkers || [], params.userMarkers || [])
|
|
13049
13055
|
}, statusUpdatedMessage);
|
|
13050
13056
|
var messageData = _extends({}, messageOldData);
|
|
@@ -16795,12 +16801,15 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
|
|
|
16795
16801
|
return Promise.reject(e);
|
|
16796
16802
|
}
|
|
16797
16803
|
};
|
|
16798
|
-
var addPendingMessage = function addPendingMessage(message, messageCopy, channelId) {
|
|
16804
|
+
var addPendingMessage = function addPendingMessage(message, messageCopy, channelId, preserveParentMessage) {
|
|
16799
16805
|
var _getStoredChannel;
|
|
16806
|
+
if (preserveParentMessage === void 0) {
|
|
16807
|
+
preserveParentMessage = true;
|
|
16808
|
+
}
|
|
16800
16809
|
var messageToAdd = _extends({}, messageCopy, {
|
|
16801
16810
|
createdAt: new Date(Date.now()),
|
|
16802
16811
|
mentionedUsers: message.mentionedUsers,
|
|
16803
|
-
parentMessage: message.parentMessage
|
|
16812
|
+
parentMessage: preserveParentMessage ? message.parentMessage : null
|
|
16804
16813
|
});
|
|
16805
16814
|
addMessageToMap(channelId, messageToAdd);
|
|
16806
16815
|
var currentLastMessage = ((_getStoredChannel = getStoredChannel(channelId)) === null || _getStoredChannel === void 0 ? void 0 : _getStoredChannel.lastMessage) || null;
|
|
@@ -17111,10 +17120,13 @@ function executeEditMessageMutation(channel, message) {
|
|
|
17111
17120
|
}
|
|
17112
17121
|
}, _marked0);
|
|
17113
17122
|
}
|
|
17114
|
-
var updateMessage$1 = function updateMessage(actionType, pending, channelId, scrollToNewMessage, message, _isNotShowOwnMessageForward) {
|
|
17123
|
+
var updateMessage$1 = function updateMessage(actionType, pending, channelId, scrollToNewMessage, message, _isNotShowOwnMessageForward, preserveParentMessage) {
|
|
17115
17124
|
if (scrollToNewMessage === void 0) {
|
|
17116
17125
|
scrollToNewMessage = true;
|
|
17117
17126
|
}
|
|
17127
|
+
if (preserveParentMessage === void 0) {
|
|
17128
|
+
preserveParentMessage = true;
|
|
17129
|
+
}
|
|
17118
17130
|
return /*#__PURE__*/_regenerator().m(function _callee() {
|
|
17119
17131
|
return _regenerator().w(function (_context1) {
|
|
17120
17132
|
while (1) switch (_context1.n) {
|
|
@@ -17123,7 +17135,7 @@ var updateMessage$1 = function updateMessage(actionType, pending, channelId, scr
|
|
|
17123
17135
|
_context1.n = 2;
|
|
17124
17136
|
break;
|
|
17125
17137
|
}
|
|
17126
|
-
addPendingMessage(message, pending, channelId);
|
|
17138
|
+
addPendingMessage(message, pending, channelId, preserveParentMessage);
|
|
17127
17139
|
if (!(getActiveChannelId() === channelId)) {
|
|
17128
17140
|
_context1.n = 2;
|
|
17129
17141
|
break;
|
|
@@ -17931,7 +17943,7 @@ function sendTextMessage(action) {
|
|
|
17931
17943
|
}
|
|
17932
17944
|
function forwardMessage(action) {
|
|
17933
17945
|
var _message$user;
|
|
17934
|
-
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;
|
|
17946
|
+
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;
|
|
17935
17947
|
return _regenerator().w(function (_context15) {
|
|
17936
17948
|
while (1) switch (_context15.p = _context15.n) {
|
|
17937
17949
|
case 0:
|
|
@@ -18028,7 +18040,7 @@ function forwardMessage(action) {
|
|
|
18028
18040
|
messageTid = messageToSend.tid;
|
|
18029
18041
|
pendingMessage = _extends({}, messageToSend, {
|
|
18030
18042
|
createdAt: new Date(Date.now()),
|
|
18031
|
-
user:
|
|
18043
|
+
user: SceytChatClient.user
|
|
18032
18044
|
});
|
|
18033
18045
|
if (isForward && pendingMessage && action.type !== RESEND_MESSAGE) {
|
|
18034
18046
|
if (message.forwardingDetails) {
|
|
@@ -18052,7 +18064,7 @@ function forwardMessage(action) {
|
|
|
18052
18064
|
return effects.call(loadOGMetadataForLinkMessages, [pendingMessage], true);
|
|
18053
18065
|
case 9:
|
|
18054
18066
|
_context15.n = 10;
|
|
18055
|
-
return effects.call(updateMessage$1, action.type, pendingMessage, channel.id, channelId === activeChannelId, message, isNotShowOwnMessageForward);
|
|
18067
|
+
return effects.call(updateMessage$1, action.type, pendingMessage, channel.id, channelId === activeChannelId, message, isNotShowOwnMessageForward, false);
|
|
18056
18068
|
case 10:
|
|
18057
18069
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
18058
18070
|
_context15.n = 16;
|
|
@@ -18065,7 +18077,9 @@ function forwardMessage(action) {
|
|
|
18065
18077
|
case 11:
|
|
18066
18078
|
messageResponse = _context15.v;
|
|
18067
18079
|
messageUpdateData = _extends({}, messageResponse, {
|
|
18068
|
-
channelId: channel.id
|
|
18080
|
+
channelId: channel.id,
|
|
18081
|
+
forwardingDetails: isForward && (_pendingMessage = pendingMessage) !== null && _pendingMessage !== void 0 && _pendingMessage.forwardingDetails ? _extends({}, pendingMessage.forwardingDetails, messageResponse.forwardingDetails) : messageResponse.forwardingDetails,
|
|
18082
|
+
parentMessage: isForward ? null : messageResponse.parentMessage
|
|
18069
18083
|
});
|
|
18070
18084
|
if (!(channelId === activeChannelId)) {
|
|
18071
18085
|
_context15.n = 12;
|
|
@@ -18075,7 +18089,7 @@ function forwardMessage(action) {
|
|
|
18075
18089
|
return effects.put(updateMessageAC(messageToSend.tid, JSON.parse(JSON.stringify(messageUpdateData)), true));
|
|
18076
18090
|
case 12:
|
|
18077
18091
|
addConfirmedMessageToCache(channel.id, JSON.parse(JSON.stringify(messageUpdateData)));
|
|
18078
|
-
messageToUpdate = JSON.parse(JSON.stringify(
|
|
18092
|
+
messageToUpdate = JSON.parse(JSON.stringify(messageUpdateData));
|
|
18079
18093
|
if (!channel.unread) {
|
|
18080
18094
|
_context15.n = 13;
|
|
18081
18095
|
break;
|
|
@@ -23721,13 +23735,13 @@ function handleChannelMessageEvent(args, SceytChatClient) {
|
|
|
23721
23735
|
return visibleMessage.id === ((_storedChannel$lastMe8 = storedChannel.lastMessage) === null || _storedChannel$lastMe8 === void 0 ? void 0 : _storedChannel$lastMe8.id);
|
|
23722
23736
|
}) : false;
|
|
23723
23737
|
messagesHasNext = store.getState().MessageReducer.messagesHasNext;
|
|
23724
|
-
if (!(!messagesHasNext && lastMessageIsInActiveWindow || !messages.length || !messages)) {
|
|
23725
|
-
_context2.n = 10;
|
|
23726
|
-
break;
|
|
23727
|
-
}
|
|
23728
23738
|
existingMessage = store.getState().MessageReducer.activeChannelMessages.find(function (m) {
|
|
23729
23739
|
return message.id && m.id === message.id || message.tid && m.tid === message.tid;
|
|
23730
23740
|
});
|
|
23741
|
+
if (!(existingMessage || !messagesHasNext && lastMessageIsInActiveWindow || !messages.length || !messages)) {
|
|
23742
|
+
_context2.n = 10;
|
|
23743
|
+
break;
|
|
23744
|
+
}
|
|
23731
23745
|
if (!existingMessage) {
|
|
23732
23746
|
_context2.n = 6;
|
|
23733
23747
|
break;
|
|
@@ -51007,6 +51021,23 @@ var Emoji$1 = styled__default.li(_templateObject8$l || (_templateObject8$l = _ta
|
|
|
51007
51021
|
return props.hoverBackgroundColor;
|
|
51008
51022
|
});
|
|
51009
51023
|
|
|
51024
|
+
var waitForImageAttachmentPreparation = function waitForImageAttachmentPreparation(attachments, preparations) {
|
|
51025
|
+
try {
|
|
51026
|
+
return Promise.resolve(Promise.all(attachments.filter(function (attachment) {
|
|
51027
|
+
return attachment.type === attachmentTypes.image;
|
|
51028
|
+
}).map(function (attachment) {
|
|
51029
|
+
return attachment.tid ? preparations.get(attachment.tid) : undefined;
|
|
51030
|
+
}))).then(function () {});
|
|
51031
|
+
} catch (e) {
|
|
51032
|
+
return Promise.reject(e);
|
|
51033
|
+
}
|
|
51034
|
+
};
|
|
51035
|
+
var mergePreparedAttachmentPatches = function mergePreparedAttachmentPatches(attachments, patches) {
|
|
51036
|
+
return attachments.map(function (attachment) {
|
|
51037
|
+
return _extends({}, attachment, attachment.tid ? patches.get(attachment.tid) : undefined);
|
|
51038
|
+
});
|
|
51039
|
+
};
|
|
51040
|
+
|
|
51010
51041
|
var getReplyLinkPreviewImage = function getReplyLinkPreviewImage(attachments) {
|
|
51011
51042
|
var _attachments$;
|
|
51012
51043
|
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;
|
|
@@ -52740,6 +52771,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
52740
52771
|
var emojiBtnRef = React.useRef(null);
|
|
52741
52772
|
var addAttachmentsBtnRef = React.useRef(null);
|
|
52742
52773
|
var metadataDebounceRef = React.useRef(null);
|
|
52774
|
+
var attachmentPreparationPromisesRef = React.useRef(new Map());
|
|
52775
|
+
var preparedAttachmentPatchesRef = React.useRef(new Map());
|
|
52743
52776
|
var sendMessageWrapperRef = React.useRef(null);
|
|
52744
52777
|
var restoringDraftRef = React.useRef(false);
|
|
52745
52778
|
var restoredDraftChannelIdRef = React.useRef(null);
|
|
@@ -52961,168 +52994,196 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
52961
52994
|
}
|
|
52962
52995
|
};
|
|
52963
52996
|
var handleSendEditMessage = function handleSendEditMessage(event, pollDetails) {
|
|
52964
|
-
|
|
52965
|
-
|
|
52966
|
-
|
|
52967
|
-
|
|
52968
|
-
|
|
52969
|
-
|
|
52970
|
-
|
|
52971
|
-
|
|
52972
|
-
|
|
52973
|
-
|
|
52974
|
-
|
|
52975
|
-
|
|
52976
|
-
|
|
52977
|
-
}
|
|
52978
|
-
}
|
|
52979
|
-
if (shouldSend && !mentionsIsOpen) {
|
|
52980
|
-
event.preventDefault();
|
|
52981
|
-
event.stopPropagation();
|
|
52982
|
-
if (messageToEdit) {
|
|
52983
|
-
handleEditMessage();
|
|
52984
|
-
} else if (messageTextForSend !== null && messageTextForSend !== void 0 && messageTextForSend.trim() || attachments.length && attachments.length > 0) {
|
|
52985
|
-
var _trimMessageBodyWithA = trimMessageBodyWithAttributes(messageText, messageBodyAttributes),
|
|
52986
|
-
messageTexToSend = _trimMessageBodyWithA.body,
|
|
52987
|
-
adjustedBodyAttributes = _trimMessageBodyWithA.bodyAttributes;
|
|
52988
|
-
var messageToSend = {
|
|
52989
|
-
body: messageTexToSend,
|
|
52990
|
-
bodyAttributes: adjustedBodyAttributes,
|
|
52991
|
-
mentionedUsers: [],
|
|
52992
|
-
attachments: [],
|
|
52993
|
-
type: 'text'
|
|
52994
|
-
};
|
|
52995
|
-
var mentionUsersToSend = [];
|
|
52996
|
-
if (adjustedBodyAttributes && adjustedBodyAttributes.length) {
|
|
52997
|
-
adjustedBodyAttributes.forEach(function (att) {
|
|
52998
|
-
if (att.type === 'mention') {
|
|
52999
|
-
var mentionsToFind = [].concat(mentionedUsers);
|
|
53000
|
-
var draftMessage = getDraftMessageFromMap(activeChannel.id);
|
|
53001
|
-
if (draftMessage) {
|
|
53002
|
-
mentionsToFind = [].concat(draftMessage.mentionedUsers, mentionedUsers);
|
|
53003
|
-
}
|
|
53004
|
-
var mentionToAdd = mentionsToFind.find(function (mention) {
|
|
53005
|
-
return mention.id === att.metadata;
|
|
53006
|
-
});
|
|
53007
|
-
mentionUsersToSend.push(mentionToAdd || {
|
|
53008
|
-
id: att.metadata
|
|
53009
|
-
});
|
|
53010
|
-
}
|
|
52997
|
+
try {
|
|
52998
|
+
var shiftKey = event.shiftKey,
|
|
52999
|
+
type = event.type,
|
|
53000
|
+
code = event.code;
|
|
53001
|
+
var isEnter = (code === 'Enter' || code === 'NumpadEnter') && shiftKey === false;
|
|
53002
|
+
var isPoll = pollDetails && pollDetails.options.length > 0 && pollDetails.name.trim();
|
|
53003
|
+
var messageTextForSend = isPoll ? pollDetails === null || pollDetails === void 0 ? void 0 : pollDetails.name.trim() : messageText.trim();
|
|
53004
|
+
var shouldSend = (isEnter || type === 'click') && (messageToEdit || messageTextForSend || attachments.length && attachments.length > 0);
|
|
53005
|
+
if (isEnter) {
|
|
53006
|
+
event.preventDefault();
|
|
53007
|
+
if (!(messageTextForSend !== null && messageTextForSend !== void 0 && messageTextForSend.trim()) && !attachments.length && !messageToEdit) {
|
|
53008
|
+
setShouldClearEditor({
|
|
53009
|
+
clear: true
|
|
53011
53010
|
});
|
|
53012
53011
|
}
|
|
53013
|
-
|
|
53014
|
-
|
|
53015
|
-
|
|
53016
|
-
|
|
53017
|
-
|
|
53018
|
-
|
|
53019
|
-
|
|
53020
|
-
|
|
53021
|
-
|
|
53022
|
-
|
|
53023
|
-
|
|
53024
|
-
|
|
53025
|
-
|
|
53026
|
-
|
|
53027
|
-
|
|
53028
|
-
|
|
53029
|
-
|
|
53030
|
-
|
|
53031
|
-
|
|
53032
|
-
|
|
53033
|
-
|
|
53012
|
+
}
|
|
53013
|
+
var _temp6 = function () {
|
|
53014
|
+
if (shouldSend && !mentionsIsOpen) {
|
|
53015
|
+
var _temp5 = function _temp5() {
|
|
53016
|
+
setAttachments([]);
|
|
53017
|
+
attachmentsUpdate = [];
|
|
53018
|
+
removeDraftMessageFromMap(activeChannel.id);
|
|
53019
|
+
dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
|
|
53020
|
+
setViewOnce(false);
|
|
53021
|
+
handleCloseReply();
|
|
53022
|
+
setShouldClearEditor({
|
|
53023
|
+
clear: true
|
|
53024
|
+
});
|
|
53025
|
+
setMentionedUsers([]);
|
|
53026
|
+
setMessageBodyAttributes([]);
|
|
53027
|
+
closePreviewWithAnimation(function () {
|
|
53028
|
+
setDetectedUrl(null);
|
|
53029
|
+
setDismissedUrls(new Set());
|
|
53030
|
+
});
|
|
53031
|
+
dispatch(setCloseSearchChannelsAC(true));
|
|
53032
|
+
};
|
|
53033
|
+
event.preventDefault();
|
|
53034
|
+
event.stopPropagation();
|
|
53035
|
+
var _temp4 = function () {
|
|
53036
|
+
if (messageToEdit) {
|
|
53037
|
+
handleEditMessage();
|
|
53038
|
+
} else {
|
|
53039
|
+
var _temp7 = function () {
|
|
53040
|
+
if (messageTextForSend !== null && messageTextForSend !== void 0 && messageTextForSend.trim() || attachments.length && attachments.length > 0) {
|
|
53041
|
+
var _temp2 = function _temp2() {
|
|
53042
|
+
setMessageText('');
|
|
53043
|
+
fileUploader.current.value = '';
|
|
53044
|
+
if (inTypingState) {
|
|
53045
|
+
handleSendTypingState(false);
|
|
53046
|
+
}
|
|
53047
|
+
clearTimeout(typingTimout);
|
|
53048
|
+
setTypingTimout(undefined);
|
|
53049
|
+
};
|
|
53050
|
+
var _trimMessageBodyWithA = trimMessageBodyWithAttributes(messageText, messageBodyAttributes),
|
|
53051
|
+
messageTexToSend = _trimMessageBodyWithA.body,
|
|
53052
|
+
adjustedBodyAttributes = _trimMessageBodyWithA.bodyAttributes;
|
|
53053
|
+
var messageToSend = {
|
|
53054
|
+
body: messageTexToSend,
|
|
53055
|
+
bodyAttributes: adjustedBodyAttributes,
|
|
53056
|
+
mentionedUsers: [],
|
|
53057
|
+
attachments: [],
|
|
53058
|
+
type: 'text'
|
|
53059
|
+
};
|
|
53060
|
+
var mentionUsersToSend = [];
|
|
53061
|
+
if (adjustedBodyAttributes && adjustedBodyAttributes.length) {
|
|
53062
|
+
adjustedBodyAttributes.forEach(function (att) {
|
|
53063
|
+
if (att.type === 'mention') {
|
|
53064
|
+
var mentionsToFind = [].concat(mentionedUsers);
|
|
53065
|
+
var draftMessage = getDraftMessageFromMap(activeChannel.id);
|
|
53066
|
+
if (draftMessage) {
|
|
53067
|
+
mentionsToFind = [].concat(draftMessage.mentionedUsers, mentionedUsers);
|
|
53068
|
+
}
|
|
53069
|
+
var mentionToAdd = mentionsToFind.find(function (mention) {
|
|
53070
|
+
return mention.id === att.metadata;
|
|
53071
|
+
});
|
|
53072
|
+
mentionUsersToSend.push(mentionToAdd || {
|
|
53073
|
+
id: att.metadata
|
|
53074
|
+
});
|
|
53075
|
+
}
|
|
53076
|
+
});
|
|
53077
|
+
}
|
|
53078
|
+
messageToSend.mentionedUsers = mentionUsersToSend;
|
|
53079
|
+
if (messageForReply) {
|
|
53080
|
+
messageToSend.parentMessage = messageForReply;
|
|
53081
|
+
}
|
|
53082
|
+
var linkAttachment;
|
|
53083
|
+
if (messageTexToSend) {
|
|
53084
|
+
var _LinkifyIt$match;
|
|
53085
|
+
var protocolMatch = /https?:\/\/\S+/.exec(messageTexToSend);
|
|
53086
|
+
var linkifyMatchResult = !protocolMatch ? (_LinkifyIt$match = new LinkifyIt().match(messageTexToSend)) === null || _LinkifyIt$match === void 0 ? void 0 : _LinkifyIt$match[0] : null;
|
|
53087
|
+
var url = protocolMatch ? protocolMatch[0] : linkifyMatchResult ? linkifyMatchResult.schema === '' ? linkifyMatchResult.url.replace(/^http:\/\//, 'https://') : linkifyMatchResult.url : null;
|
|
53088
|
+
if (url) {
|
|
53089
|
+
var urlMetadata = oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[url];
|
|
53090
|
+
var metadata = {};
|
|
53091
|
+
if (urlMetadata) {
|
|
53092
|
+
var _urlMetadata$og, _urlMetadata$og$favic, _urlMetadata$og2, _urlMetadata$og$descr, _urlMetadata$og3, _urlMetadata$og3$imag, _urlMetadata$og3$imag2, _urlMetadata$og4, _urlMetadata$og$title;
|
|
53093
|
+
if (urlMetadata.imageWidth) metadata.szw = urlMetadata.imageWidth;
|
|
53094
|
+
if (urlMetadata.imageHeight) metadata.szh = urlMetadata.imageHeight;
|
|
53095
|
+
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;
|
|
53096
|
+
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);
|
|
53097
|
+
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;
|
|
53098
|
+
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);
|
|
53099
|
+
}
|
|
53100
|
+
if (dismissedUrls.has(url)) {
|
|
53101
|
+
metadata.hld = true;
|
|
53102
|
+
}
|
|
53103
|
+
linkAttachment = _extends({
|
|
53104
|
+
type: attachmentTypes.link,
|
|
53105
|
+
data: url,
|
|
53106
|
+
upload: false
|
|
53107
|
+
}, Object.keys(metadata).length > 0 ? {
|
|
53108
|
+
metadata: metadata,
|
|
53109
|
+
name: metadata.ttl
|
|
53110
|
+
} : {
|
|
53111
|
+
metadata: {
|
|
53112
|
+
hld: true
|
|
53113
|
+
}
|
|
53114
|
+
});
|
|
53115
|
+
}
|
|
53116
|
+
}
|
|
53117
|
+
if (messageTexToSend !== null && messageTexToSend !== void 0 && messageTexToSend.trim() && !attachments.length) {
|
|
53118
|
+
if (linkAttachment) {
|
|
53119
|
+
messageToSend.attachments = [linkAttachment];
|
|
53120
|
+
}
|
|
53121
|
+
if (isPoll) {
|
|
53122
|
+
messageToSend.pollDetails = pollDetails;
|
|
53123
|
+
messageToSend.type = 'poll';
|
|
53124
|
+
messageToSend.body = messageTextForSend === null || messageTextForSend === void 0 ? void 0 : messageTextForSend.trim();
|
|
53125
|
+
}
|
|
53126
|
+
dispatch(sendTextMessageAC(messageToSend, activeChannel.id, connectionStatus));
|
|
53127
|
+
}
|
|
53128
|
+
var _temp = function () {
|
|
53129
|
+
if (attachments.length) {
|
|
53130
|
+
return Promise.resolve(waitForImageAttachmentPreparation(attachments, attachmentPreparationPromisesRef.current)).then(function () {
|
|
53131
|
+
var sendAsSeparateMessage = getSendAttachmentsAsSeparateMessages();
|
|
53132
|
+
messageToSend.attachments = mergePreparedAttachmentPatches(attachments, preparedAttachmentPatchesRef.current).map(function (preparedAttachment) {
|
|
53133
|
+
return {
|
|
53134
|
+
name: preparedAttachment.data.name,
|
|
53135
|
+
data: preparedAttachment.data,
|
|
53136
|
+
attachmentUrl: preparedAttachment.attachmentUrl,
|
|
53137
|
+
tid: preparedAttachment.tid,
|
|
53138
|
+
cachedUrl: preparedAttachment.cachedUrl,
|
|
53139
|
+
upload: preparedAttachment.upload,
|
|
53140
|
+
metadata: preparedAttachment.metadata,
|
|
53141
|
+
type: preparedAttachment.type,
|
|
53142
|
+
size: preparedAttachment.size,
|
|
53143
|
+
thumbnailState: preparedAttachment.thumbnailState
|
|
53144
|
+
};
|
|
53145
|
+
});
|
|
53146
|
+
if (viewOnce && canShowViewOnceToggle) {
|
|
53147
|
+
messageToSend.viewOnce = true;
|
|
53148
|
+
}
|
|
53149
|
+
var attachmentsToSent = [].concat(messageToSend.attachments);
|
|
53150
|
+
if (linkAttachment && !messageToSend.viewOnce) {
|
|
53151
|
+
attachmentsToSent.push(linkAttachment);
|
|
53152
|
+
}
|
|
53153
|
+
dispatch(sendMessageAC(_extends({}, messageToSend, {
|
|
53154
|
+
attachments: attachmentsToSent
|
|
53155
|
+
}), activeChannel.id, connectionStatus, sendAsSeparateMessage));
|
|
53156
|
+
attachments.forEach(function (attachment) {
|
|
53157
|
+
attachmentPreparationPromisesRef.current["delete"](attachment.tid);
|
|
53158
|
+
preparedAttachmentPatchesRef.current["delete"](attachment.tid);
|
|
53159
|
+
});
|
|
53160
|
+
});
|
|
53161
|
+
}
|
|
53162
|
+
}();
|
|
53163
|
+
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
|
53164
|
+
}
|
|
53165
|
+
}();
|
|
53166
|
+
if (_temp7 && _temp7.then) return _temp7.then(function () {});
|
|
53034
53167
|
}
|
|
53035
|
-
|
|
53036
|
-
|
|
53168
|
+
}();
|
|
53169
|
+
return _temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4);
|
|
53170
|
+
} else {
|
|
53171
|
+
if (typingTimout) {
|
|
53172
|
+
if (!inTypingStateTimout) {
|
|
53173
|
+
handleSendTypingState(true, code);
|
|
53037
53174
|
}
|
|
53038
|
-
|
|
53039
|
-
|
|
53040
|
-
|
|
53041
|
-
upload: false
|
|
53042
|
-
}, Object.keys(metadata).length > 0 ? {
|
|
53043
|
-
metadata: metadata,
|
|
53044
|
-
name: metadata.ttl
|
|
53045
|
-
} : {
|
|
53046
|
-
metadata: {
|
|
53047
|
-
hld: true
|
|
53048
|
-
}
|
|
53049
|
-
});
|
|
53050
|
-
}
|
|
53051
|
-
}
|
|
53052
|
-
if (messageTexToSend !== null && messageTexToSend !== void 0 && messageTexToSend.trim() && !attachments.length) {
|
|
53053
|
-
if (linkAttachment) {
|
|
53054
|
-
messageToSend.attachments = [linkAttachment];
|
|
53055
|
-
}
|
|
53056
|
-
if (isPoll) {
|
|
53057
|
-
messageToSend.pollDetails = pollDetails;
|
|
53058
|
-
messageToSend.type = 'poll';
|
|
53059
|
-
messageToSend.body = messageTextForSend === null || messageTextForSend === void 0 ? void 0 : messageTextForSend.trim();
|
|
53060
|
-
}
|
|
53061
|
-
dispatch(sendTextMessageAC(messageToSend, activeChannel.id, connectionStatus));
|
|
53062
|
-
}
|
|
53063
|
-
if (attachments.length) {
|
|
53064
|
-
var sendAsSeparateMessage = getSendAttachmentsAsSeparateMessages();
|
|
53065
|
-
messageToSend.attachments = attachments.map(function (attachment) {
|
|
53066
|
-
return {
|
|
53067
|
-
name: attachment.data.name,
|
|
53068
|
-
data: attachment.data,
|
|
53069
|
-
attachmentUrl: attachment.attachmentUrl,
|
|
53070
|
-
tid: attachment.tid,
|
|
53071
|
-
cachedUrl: attachment.cachedUrl,
|
|
53072
|
-
upload: attachment.upload,
|
|
53073
|
-
metadata: attachment.metadata,
|
|
53074
|
-
type: attachment.type,
|
|
53075
|
-
size: attachment.size,
|
|
53076
|
-
thumbnailState: attachment.thumbnailState
|
|
53077
|
-
};
|
|
53078
|
-
});
|
|
53079
|
-
if (viewOnce && canShowViewOnceToggle) {
|
|
53080
|
-
messageToSend.viewOnce = true;
|
|
53081
|
-
}
|
|
53082
|
-
var attachmentsToSent = [].concat(messageToSend.attachments);
|
|
53083
|
-
if (linkAttachment && !messageToSend.viewOnce) {
|
|
53084
|
-
attachmentsToSent.push(linkAttachment);
|
|
53175
|
+
clearTimeout(typingTimout);
|
|
53176
|
+
} else {
|
|
53177
|
+
handleSendTypingState(true, code);
|
|
53085
53178
|
}
|
|
53086
|
-
|
|
53087
|
-
|
|
53088
|
-
}
|
|
53089
|
-
}
|
|
53090
|
-
setMessageText('');
|
|
53091
|
-
fileUploader.current.value = '';
|
|
53092
|
-
if (inTypingState) {
|
|
53093
|
-
handleSendTypingState(false);
|
|
53179
|
+
setTypingTimout(setTimeout(function () {
|
|
53180
|
+
setTypingTimout(0);
|
|
53181
|
+
}, 2000));
|
|
53094
53182
|
}
|
|
53095
|
-
|
|
53096
|
-
|
|
53097
|
-
|
|
53098
|
-
|
|
53099
|
-
attachmentsUpdate = [];
|
|
53100
|
-
removeDraftMessageFromMap(activeChannel.id);
|
|
53101
|
-
dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
|
|
53102
|
-
setViewOnce(false);
|
|
53103
|
-
handleCloseReply();
|
|
53104
|
-
setShouldClearEditor({
|
|
53105
|
-
clear: true
|
|
53106
|
-
});
|
|
53107
|
-
setMentionedUsers([]);
|
|
53108
|
-
setMessageBodyAttributes([]);
|
|
53109
|
-
closePreviewWithAnimation(function () {
|
|
53110
|
-
setDetectedUrl(null);
|
|
53111
|
-
setDismissedUrls(new Set());
|
|
53112
|
-
});
|
|
53113
|
-
dispatch(setCloseSearchChannelsAC(true));
|
|
53114
|
-
} else {
|
|
53115
|
-
if (typingTimout) {
|
|
53116
|
-
if (!inTypingStateTimout) {
|
|
53117
|
-
handleSendTypingState(true, code);
|
|
53118
|
-
}
|
|
53119
|
-
clearTimeout(typingTimout);
|
|
53120
|
-
} else {
|
|
53121
|
-
handleSendTypingState(true, code);
|
|
53122
|
-
}
|
|
53123
|
-
setTypingTimout(setTimeout(function () {
|
|
53124
|
-
setTypingTimout(0);
|
|
53125
|
-
}, 2000));
|
|
53183
|
+
}();
|
|
53184
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
|
|
53185
|
+
} catch (e) {
|
|
53186
|
+
return Promise.reject(e);
|
|
53126
53187
|
}
|
|
53127
53188
|
};
|
|
53128
53189
|
var handleEditMessage = function handleEditMessage() {
|
|
@@ -53228,6 +53289,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53228
53289
|
return item.tid !== attachmentId;
|
|
53229
53290
|
});
|
|
53230
53291
|
clearVideoPreparation(attachmentId);
|
|
53292
|
+
attachmentPreparationPromisesRef.current["delete"](attachmentId);
|
|
53293
|
+
preparedAttachmentPatchesRef.current["delete"](attachmentId);
|
|
53231
53294
|
releaseBlobUrls(["compose_" + attachmentId]);
|
|
53232
53295
|
setAttachments(updatedAttachments);
|
|
53233
53296
|
attachmentsUpdate = updatedAttachments;
|
|
@@ -53235,6 +53298,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53235
53298
|
attachmentsUpdate.forEach(function (attachment) {
|
|
53236
53299
|
return clearVideoPreparation(attachment.tid);
|
|
53237
53300
|
});
|
|
53301
|
+
attachmentPreparationPromisesRef.current.clear();
|
|
53302
|
+
preparedAttachmentPatchesRef.current.clear();
|
|
53238
53303
|
releaseBlobUrls(attachmentsUpdate.map(function (item) {
|
|
53239
53304
|
return "compose_" + item.tid;
|
|
53240
53305
|
}));
|
|
@@ -53311,14 +53376,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53311
53376
|
}
|
|
53312
53377
|
}
|
|
53313
53378
|
}
|
|
53314
|
-
var
|
|
53379
|
+
var _temp8 = function () {
|
|
53315
53380
|
if (allowUpload) {
|
|
53316
53381
|
return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, isMediaAttachment)).then(function () {});
|
|
53317
53382
|
} else {
|
|
53318
53383
|
showFileUploadError(errorMessage);
|
|
53319
53384
|
}
|
|
53320
53385
|
}();
|
|
53321
|
-
return Promise.resolve(
|
|
53386
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
|
|
53322
53387
|
} catch (e) {
|
|
53323
53388
|
return Promise.reject(e);
|
|
53324
53389
|
}
|
|
@@ -53369,14 +53434,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53369
53434
|
errorMessage = allowedMediaExtensionsErrorMessage != null ? allowedMediaExtensionsErrorMessage : "Invalid file type. Allowed extensions are: " + allowedMediaExtensions.join(', ') + ".";
|
|
53370
53435
|
}
|
|
53371
53436
|
}
|
|
53372
|
-
var
|
|
53437
|
+
var _temp9 = function () {
|
|
53373
53438
|
if (allowUpload) {
|
|
53374
53439
|
return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, true)).then(function () {});
|
|
53375
53440
|
} else {
|
|
53376
53441
|
showFileUploadError(errorMessage);
|
|
53377
53442
|
}
|
|
53378
53443
|
}();
|
|
53379
|
-
return Promise.resolve(
|
|
53444
|
+
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
|
|
53380
53445
|
} catch (e) {
|
|
53381
53446
|
return Promise.reject(e);
|
|
53382
53447
|
}
|
|
@@ -53515,160 +53580,172 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53515
53580
|
return [].concat(prevState, [attachment]);
|
|
53516
53581
|
});
|
|
53517
53582
|
var updateAttachment = function updateAttachment(patch) {
|
|
53583
|
+
preparedAttachmentPatchesRef.current.set(tid, _extends({}, preparedAttachmentPatchesRef.current.get(tid), patch));
|
|
53518
53584
|
setAttachments(function (prevState) {
|
|
53519
53585
|
return prevState.map(function (current) {
|
|
53520
53586
|
return current.tid === tid ? _extends({}, current, patch) : current;
|
|
53521
53587
|
});
|
|
53522
53588
|
});
|
|
53523
53589
|
};
|
|
53524
|
-
|
|
53525
|
-
|
|
53526
|
-
|
|
53527
|
-
|
|
53528
|
-
var
|
|
53529
|
-
|
|
53530
|
-
var
|
|
53531
|
-
|
|
53532
|
-
|
|
53533
|
-
|
|
53534
|
-
|
|
53535
|
-
|
|
53536
|
-
|
|
53537
|
-
|
|
53538
|
-
metadata: {
|
|
53539
|
-
szw: imageWidth,
|
|
53540
|
-
szh: imageHeight,
|
|
53541
|
-
tmb: thumbnail
|
|
53542
|
-
}
|
|
53543
|
-
};
|
|
53544
|
-
updateAttachment(patch);
|
|
53545
|
-
handleAttachmentImageForCache(_extends({}, attachment, patch));
|
|
53546
|
-
});
|
|
53547
|
-
} else {
|
|
53548
|
-
var _temp10 = function () {
|
|
53549
|
-
if (isMediaAttachment && file.type !== 'image/gif') {
|
|
53550
|
-
return Promise.resolve(resizeImage(file)).then(function (resizedFileData) {
|
|
53551
|
-
var resizedFile = resizedFileData.blob ? new File([resizedFileData.blob], resizedFileData.file.name, {
|
|
53552
|
-
type: file.type
|
|
53553
|
-
}) : file;
|
|
53590
|
+
var preparationPromise = new Promise(function (resolve) {
|
|
53591
|
+
return setTimeout(function () {
|
|
53592
|
+
try {
|
|
53593
|
+
return Promise.resolve(_finallyRethrows(function () {
|
|
53594
|
+
var _temp16 = function () {
|
|
53595
|
+
if (fileType === 'image') {
|
|
53596
|
+
var _temp10 = _catch(function () {
|
|
53597
|
+
return Promise.resolve(createImageThumbnail(file)).then(function (_ref5) {
|
|
53598
|
+
var thumbnail = _ref5.thumbnail,
|
|
53599
|
+
imageWidth = _ref5.imageWidth,
|
|
53600
|
+
imageHeight = _ref5.imageHeight;
|
|
53601
|
+
var _temp1 = function () {
|
|
53602
|
+
if (customUploader) {
|
|
53603
|
+
return Promise.resolve(resizeImage(file)).then(function (resizedFile) {
|
|
53554
53604
|
var patch = {
|
|
53555
|
-
|
|
53556
|
-
|
|
53557
|
-
|
|
53558
|
-
|
|
53559
|
-
|
|
53560
|
-
|
|
53561
|
-
})
|
|
53605
|
+
size: isMediaAttachment && resizedFile !== null && resizedFile !== void 0 && resizedFile.blob ? resizedFile.blob.size : file.size,
|
|
53606
|
+
metadata: {
|
|
53607
|
+
szw: imageWidth,
|
|
53608
|
+
szh: imageHeight,
|
|
53609
|
+
tmb: thumbnail
|
|
53610
|
+
}
|
|
53562
53611
|
};
|
|
53563
53612
|
updateAttachment(patch);
|
|
53564
|
-
setPendingAttachment(tid, {
|
|
53565
|
-
file: resizedFile
|
|
53566
|
-
});
|
|
53567
53613
|
handleAttachmentImageForCache(_extends({}, attachment, patch));
|
|
53568
53614
|
});
|
|
53569
53615
|
} else {
|
|
53570
|
-
|
|
53571
|
-
|
|
53572
|
-
|
|
53573
|
-
|
|
53574
|
-
|
|
53575
|
-
|
|
53576
|
-
|
|
53616
|
+
var _temp17 = function () {
|
|
53617
|
+
if (isMediaAttachment && file.type !== 'image/gif') {
|
|
53618
|
+
return Promise.resolve(resizeImage(file)).then(function (resizedFileData) {
|
|
53619
|
+
var resizedFile = resizedFileData.blob ? new File([resizedFileData.blob], resizedFileData.file.name, {
|
|
53620
|
+
type: file.type
|
|
53621
|
+
}) : file;
|
|
53622
|
+
var patch = {
|
|
53623
|
+
data: resizedFile,
|
|
53624
|
+
size: resizedFile.size,
|
|
53625
|
+
metadata: JSON.stringify({
|
|
53626
|
+
tmb: thumbnail,
|
|
53627
|
+
szw: resizedFileData.newWidth,
|
|
53628
|
+
szh: resizedFileData.newHeight
|
|
53629
|
+
})
|
|
53630
|
+
};
|
|
53631
|
+
updateAttachment(patch);
|
|
53632
|
+
setPendingAttachment(tid, {
|
|
53633
|
+
file: resizedFile
|
|
53634
|
+
});
|
|
53635
|
+
handleAttachmentImageForCache(_extends({}, attachment, patch));
|
|
53636
|
+
});
|
|
53637
|
+
} else {
|
|
53638
|
+
updateAttachment({
|
|
53639
|
+
metadata: JSON.stringify({
|
|
53640
|
+
tmb: thumbnail,
|
|
53641
|
+
szw: imageWidth,
|
|
53642
|
+
szh: imageHeight
|
|
53643
|
+
})
|
|
53644
|
+
});
|
|
53645
|
+
}
|
|
53646
|
+
}();
|
|
53647
|
+
if (_temp17 && _temp17.then) return _temp17.then(function () {});
|
|
53577
53648
|
}
|
|
53578
53649
|
}();
|
|
53579
|
-
if (
|
|
53580
|
-
}
|
|
53581
|
-
}()
|
|
53582
|
-
|
|
53583
|
-
|
|
53584
|
-
|
|
53585
|
-
|
|
53586
|
-
|
|
53587
|
-
|
|
53588
|
-
|
|
53589
|
-
|
|
53590
|
-
|
|
53591
|
-
|
|
53592
|
-
|
|
53593
|
-
|
|
53594
|
-
|
|
53595
|
-
|
|
53596
|
-
|
|
53597
|
-
|
|
53598
|
-
|
|
53599
|
-
|
|
53600
|
-
|
|
53601
|
-
|
|
53602
|
-
|
|
53603
|
-
|
|
53604
|
-
|
|
53605
|
-
|
|
53650
|
+
if (_temp1 && _temp1.then) return _temp1.then(function () {});
|
|
53651
|
+
});
|
|
53652
|
+
}, function (error) {
|
|
53653
|
+
log.warn('Unable to prepare image attachment preview:', error);
|
|
53654
|
+
});
|
|
53655
|
+
if (_temp10 && _temp10.then) return _temp10.then(function () {});
|
|
53656
|
+
} else {
|
|
53657
|
+
var _temp18 = function () {
|
|
53658
|
+
if (fileType === 'video') {
|
|
53659
|
+
var _temp14 = function _temp14() {
|
|
53660
|
+
return Promise.resolve(remuxPromise).then(function (uploadFile) {
|
|
53661
|
+
if (uploadFile !== file) {
|
|
53662
|
+
updateAttachment({
|
|
53663
|
+
data: uploadFile,
|
|
53664
|
+
size: uploadFile.size
|
|
53665
|
+
});
|
|
53666
|
+
setPendingAttachment(tid, {
|
|
53667
|
+
file: uploadFile
|
|
53668
|
+
});
|
|
53669
|
+
}
|
|
53670
|
+
if (metadata) {
|
|
53671
|
+
completeVideoPreparation(tid, {
|
|
53672
|
+
file: uploadFile,
|
|
53673
|
+
metadata: metadata
|
|
53674
|
+
});
|
|
53675
|
+
} else {
|
|
53676
|
+
failVideoPreparation(tid);
|
|
53677
|
+
updateAttachment({
|
|
53678
|
+
thumbnailState: 'failed'
|
|
53679
|
+
});
|
|
53680
|
+
}
|
|
53606
53681
|
});
|
|
53607
|
-
}
|
|
53608
|
-
|
|
53609
|
-
|
|
53610
|
-
|
|
53682
|
+
};
|
|
53683
|
+
var remuxPromise = remuxVideoFileForUpload(file);
|
|
53684
|
+
var thumbnailSource = file;
|
|
53685
|
+
var metadata;
|
|
53686
|
+
var _temp13 = _catch(function () {
|
|
53687
|
+
function _temp12() {
|
|
53688
|
+
var _frame = frame,
|
|
53689
|
+
thumb = _frame.thumb,
|
|
53690
|
+
width = _frame.width,
|
|
53691
|
+
height = _frame.height,
|
|
53692
|
+
duration = _frame.duration;
|
|
53693
|
+
metadata = customUploader ? {
|
|
53694
|
+
szw: width,
|
|
53695
|
+
szh: height,
|
|
53696
|
+
tmb: thumb,
|
|
53697
|
+
dur: duration
|
|
53698
|
+
} : JSON.stringify({
|
|
53699
|
+
tmb: thumb,
|
|
53700
|
+
szw: width,
|
|
53701
|
+
szh: height,
|
|
53702
|
+
dur: duration
|
|
53703
|
+
});
|
|
53704
|
+
updateAttachment({
|
|
53705
|
+
metadata: metadata,
|
|
53706
|
+
thumbnailState: 'ready'
|
|
53707
|
+
});
|
|
53708
|
+
handleAttachmentVideoForCache(_extends({}, attachment, {
|
|
53709
|
+
metadata: metadata
|
|
53710
|
+
}));
|
|
53711
|
+
}
|
|
53712
|
+
var frame;
|
|
53713
|
+
var _temp11 = _catch(function () {
|
|
53714
|
+
return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame) {
|
|
53715
|
+
frame = _getFrame;
|
|
53716
|
+
});
|
|
53717
|
+
}, function () {
|
|
53718
|
+
return Promise.resolve(remuxPromise).then(function (_remuxPromise) {
|
|
53719
|
+
thumbnailSource = _remuxPromise;
|
|
53720
|
+
return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame2) {
|
|
53721
|
+
frame = _getFrame2;
|
|
53722
|
+
});
|
|
53723
|
+
});
|
|
53611
53724
|
});
|
|
53612
|
-
|
|
53613
|
-
|
|
53614
|
-
|
|
53615
|
-
var remuxPromise = remuxVideoFileForUpload(file);
|
|
53616
|
-
var thumbnailSource = file;
|
|
53617
|
-
var metadata;
|
|
53618
|
-
var _temp8 = _catch(function () {
|
|
53619
|
-
function _temp7() {
|
|
53620
|
-
var _frame = frame,
|
|
53621
|
-
thumb = _frame.thumb,
|
|
53622
|
-
width = _frame.width,
|
|
53623
|
-
height = _frame.height,
|
|
53624
|
-
duration = _frame.duration;
|
|
53625
|
-
metadata = customUploader ? {
|
|
53626
|
-
szw: width,
|
|
53627
|
-
szh: height,
|
|
53628
|
-
tmb: thumb,
|
|
53629
|
-
dur: duration
|
|
53630
|
-
} : JSON.stringify({
|
|
53631
|
-
tmb: thumb,
|
|
53632
|
-
szw: width,
|
|
53633
|
-
szh: height,
|
|
53634
|
-
dur: duration
|
|
53635
|
-
});
|
|
53636
|
-
updateAttachment({
|
|
53637
|
-
metadata: metadata,
|
|
53638
|
-
thumbnailState: 'ready'
|
|
53725
|
+
return _temp11 && _temp11.then ? _temp11.then(_temp12) : _temp12(_temp11);
|
|
53726
|
+
}, function (error) {
|
|
53727
|
+
log.warn('Unable to generate video thumbnail:', error);
|
|
53639
53728
|
});
|
|
53640
|
-
|
|
53641
|
-
metadata: metadata
|
|
53642
|
-
}));
|
|
53729
|
+
return _temp13 && _temp13.then ? _temp13.then(_temp14) : _temp14(_temp13);
|
|
53643
53730
|
}
|
|
53644
|
-
|
|
53645
|
-
|
|
53646
|
-
return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame) {
|
|
53647
|
-
frame = _getFrame;
|
|
53648
|
-
});
|
|
53649
|
-
}, function () {
|
|
53650
|
-
return Promise.resolve(remuxPromise).then(function (_remuxPromise) {
|
|
53651
|
-
thumbnailSource = _remuxPromise;
|
|
53652
|
-
return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame2) {
|
|
53653
|
-
frame = _getFrame2;
|
|
53654
|
-
});
|
|
53655
|
-
});
|
|
53656
|
-
});
|
|
53657
|
-
return _temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6);
|
|
53658
|
-
}, function (error) {
|
|
53659
|
-
log.warn('Unable to generate video thumbnail:', error);
|
|
53660
|
-
});
|
|
53661
|
-
return _temp8 && _temp8.then ? _temp8.then(_temp9) : _temp9(_temp8);
|
|
53731
|
+
}();
|
|
53732
|
+
if (_temp18 && _temp18.then) return _temp18.then(function () {});
|
|
53662
53733
|
}
|
|
53663
53734
|
}();
|
|
53664
|
-
if (
|
|
53665
|
-
}
|
|
53666
|
-
|
|
53667
|
-
|
|
53668
|
-
|
|
53669
|
-
|
|
53670
|
-
|
|
53671
|
-
|
|
53735
|
+
if (_temp16 && _temp16.then) return _temp16.then(function () {});
|
|
53736
|
+
}, function (_wasThrown, _result) {
|
|
53737
|
+
resolve();
|
|
53738
|
+
if (_wasThrown) throw _result;
|
|
53739
|
+
return _result;
|
|
53740
|
+
}));
|
|
53741
|
+
} catch (e) {
|
|
53742
|
+
return Promise.reject(e);
|
|
53743
|
+
}
|
|
53744
|
+
}, 0);
|
|
53745
|
+
});
|
|
53746
|
+
if (fileType === 'image') {
|
|
53747
|
+
attachmentPreparationPromisesRef.current.set(tid, preparationPromise);
|
|
53748
|
+
}
|
|
53672
53749
|
return Promise.resolve();
|
|
53673
53750
|
} catch (e) {
|
|
53674
53751
|
return Promise.reject(e);
|
|
@@ -53728,14 +53805,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
53728
53805
|
}
|
|
53729
53806
|
}
|
|
53730
53807
|
}
|
|
53731
|
-
var
|
|
53808
|
+
var _temp19 = function () {
|
|
53732
53809
|
if (allowUpload) {
|
|
53733
53810
|
return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, isMediaAttachment)).then(function () {});
|
|
53734
53811
|
} else {
|
|
53735
53812
|
showFileUploadError(errorMessage);
|
|
53736
53813
|
}
|
|
53737
53814
|
}();
|
|
53738
|
-
return Promise.resolve(
|
|
53815
|
+
return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
|
|
53739
53816
|
} catch (e) {
|
|
53740
53817
|
return Promise.reject(e);
|
|
53741
53818
|
}
|
|
@@ -54748,7 +54825,7 @@ var LinkPreviewContainer = styled__default.div(_templateObject39$1 || (_template
|
|
|
54748
54825
|
}, function (props) {
|
|
54749
54826
|
return props.isClosing ? linkPreviewSlideOut : linkPreviewSlideIn;
|
|
54750
54827
|
});
|
|
54751
|
-
var LinkPreviewContent = styled__default.div(_templateObject40$1 || (_templateObject40$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n
|
|
54828
|
+
var LinkPreviewContent = styled__default.div(_templateObject40$1 || (_templateObject40$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex: 1;\n overflow: hidden;\n"])));
|
|
54752
54829
|
var LinkPreviewImage = styled__default.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) {
|
|
54753
54830
|
return props.bg;
|
|
54754
54831
|
});
|