sceyt-chat-react-uikit 1.8.9-beta.10 → 1.8.9-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +418 -313
  2. package/index.modern.js +418 -313
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -11456,13 +11456,41 @@ var requestToPromise = function requestToPromise(request) {
11456
11456
  };
11457
11457
  });
11458
11458
  };
11459
+ var _toStructuredCloneSafeValue = function toStructuredCloneSafeValue(value, seen) {
11460
+ if (seen === void 0) {
11461
+ seen = new WeakSet();
11462
+ }
11463
+ if (value === null || typeof value !== 'object') {
11464
+ return typeof value === 'function' || typeof value === 'symbol' ? undefined : value;
11465
+ }
11466
+ if (value instanceof Date) {
11467
+ return new Date(value.getTime());
11468
+ }
11469
+ if (seen.has(value)) {
11470
+ return undefined;
11471
+ }
11472
+ seen.add(value);
11473
+ if (Array.isArray(value)) {
11474
+ return value.map(function (item) {
11475
+ return _toStructuredCloneSafeValue(item, seen);
11476
+ });
11477
+ }
11478
+ return Object.keys(value).reduce(function (snapshot, key) {
11479
+ var safeValue = _toStructuredCloneSafeValue(value[key], seen);
11480
+ if (safeValue !== undefined) {
11481
+ snapshot[key] = safeValue;
11482
+ }
11483
+ return snapshot;
11484
+ }, {});
11485
+ };
11459
11486
  var sanitizeMessageForPersist = function sanitizeMessageForPersist(message) {
11460
- var _message$attachments;
11461
- if (!(message !== null && message !== void 0 && (_message$attachments = message.attachments) !== null && _message$attachments !== void 0 && _message$attachments.length)) {
11462
- return message;
11487
+ var _sanitizedMessage$att;
11488
+ var sanitizedMessage = _toStructuredCloneSafeValue(message);
11489
+ if (!(sanitizedMessage !== null && sanitizedMessage !== void 0 && (_sanitizedMessage$att = sanitizedMessage.attachments) !== null && _sanitizedMessage$att !== void 0 && _sanitizedMessage$att.length)) {
11490
+ return sanitizedMessage;
11463
11491
  }
11464
- return _extends({}, message, {
11465
- attachments: message.attachments.map(function (attachment) {
11492
+ return _extends({}, sanitizedMessage, {
11493
+ attachments: sanitizedMessage.attachments.map(function (attachment) {
11466
11494
  var rest = _extends({}, attachment || {});
11467
11495
  delete rest.data;
11468
11496
  if (rest.attachmentUrl && String(rest.attachmentUrl).startsWith('blob:')) {
@@ -12301,9 +12329,12 @@ function updateMessageOnMap(channelId, updatedMessage, voteDetails) {
12301
12329
  updatedMessageData = _extends({}, updatedMessage.params);
12302
12330
  nextMessage = _extends({}, mes, updatedMessageData);
12303
12331
  } else {
12304
- var _updatedMessage$param6;
12332
+ var _updatedMessage$param6, _updatedMessage$param7;
12305
12333
  var statusUpdatedMessage = (_updatedMessage$param6 = updatedMessage.params) !== null && _updatedMessage$param6 !== void 0 && _updatedMessage$param6.deliveryStatus ? updateMessageDeliveryStatusAndMarkers(mes, updatedMessage.params) : {};
12306
- updatedMessageData = _extends({}, mes, updatedMessage.params, statusUpdatedMessage);
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);
12307
12338
  var voteDetailsData = mes === null || mes === void 0 ? void 0 : mes.pollDetails;
12308
12339
  if (voteDetails) {
12309
12340
  voteDetailsData = handleVoteDetails(voteDetails, updatedMessageData);
@@ -13016,7 +13047,10 @@ var messageSlice = createSlice({
13016
13047
  if (params !== null && params !== void 0 && params.deliveryStatus) {
13017
13048
  statusUpdatedMessage = updateMessageDeliveryStatusAndMarkers(message, params);
13018
13049
  }
13019
- var messageOldData = _extends({}, message, params, {
13050
+ var forwardingDetails = message.forwardingDetails && params.forwardingDetails ? _extends({}, message.forwardingDetails, params.forwardingDetails) : undefined;
13051
+ var messageOldData = _extends({}, message, params, forwardingDetails ? {
13052
+ forwardingDetails: forwardingDetails
13053
+ } : {}, {
13020
13054
  userMarkers: [].concat(message.userMarkers || [], params.userMarkers || [])
13021
13055
  }, statusUpdatedMessage);
13022
13056
  var messageData = _extends({}, messageOldData);
@@ -16767,12 +16801,15 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
16767
16801
  return Promise.reject(e);
16768
16802
  }
16769
16803
  };
16770
- var addPendingMessage = function addPendingMessage(message, messageCopy, channelId) {
16804
+ var addPendingMessage = function addPendingMessage(message, messageCopy, channelId, preserveParentMessage) {
16771
16805
  var _getStoredChannel;
16806
+ if (preserveParentMessage === void 0) {
16807
+ preserveParentMessage = true;
16808
+ }
16772
16809
  var messageToAdd = _extends({}, messageCopy, {
16773
16810
  createdAt: new Date(Date.now()),
16774
16811
  mentionedUsers: message.mentionedUsers,
16775
- parentMessage: message.parentMessage
16812
+ parentMessage: preserveParentMessage ? message.parentMessage : null
16776
16813
  });
16777
16814
  addMessageToMap(channelId, messageToAdd);
16778
16815
  var currentLastMessage = ((_getStoredChannel = getStoredChannel(channelId)) === null || _getStoredChannel === void 0 ? void 0 : _getStoredChannel.lastMessage) || null;
@@ -17083,10 +17120,13 @@ function executeEditMessageMutation(channel, message) {
17083
17120
  }
17084
17121
  }, _marked0);
17085
17122
  }
17086
- var updateMessage$1 = function updateMessage(actionType, pending, channelId, scrollToNewMessage, message, _isNotShowOwnMessageForward) {
17123
+ var updateMessage$1 = function updateMessage(actionType, pending, channelId, scrollToNewMessage, message, _isNotShowOwnMessageForward, preserveParentMessage) {
17087
17124
  if (scrollToNewMessage === void 0) {
17088
17125
  scrollToNewMessage = true;
17089
17126
  }
17127
+ if (preserveParentMessage === void 0) {
17128
+ preserveParentMessage = true;
17129
+ }
17090
17130
  return /*#__PURE__*/_regenerator().m(function _callee() {
17091
17131
  return _regenerator().w(function (_context1) {
17092
17132
  while (1) switch (_context1.n) {
@@ -17095,7 +17135,7 @@ var updateMessage$1 = function updateMessage(actionType, pending, channelId, scr
17095
17135
  _context1.n = 2;
17096
17136
  break;
17097
17137
  }
17098
- addPendingMessage(message, pending, channelId);
17138
+ addPendingMessage(message, pending, channelId, preserveParentMessage);
17099
17139
  if (!(getActiveChannelId() === channelId)) {
17100
17140
  _context1.n = 2;
17101
17141
  break;
@@ -17903,7 +17943,7 @@ function sendTextMessage(action) {
17903
17943
  }
17904
17944
  function forwardMessage(action) {
17905
17945
  var _message$user;
17906
- 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;
17907
17947
  return _regenerator().w(function (_context15) {
17908
17948
  while (1) switch (_context15.p = _context15.n) {
17909
17949
  case 0:
@@ -18000,7 +18040,7 @@ function forwardMessage(action) {
18000
18040
  messageTid = messageToSend.tid;
18001
18041
  pendingMessage = _extends({}, messageToSend, {
18002
18042
  createdAt: new Date(Date.now()),
18003
- user: message.user
18043
+ user: SceytChatClient.user
18004
18044
  });
18005
18045
  if (isForward && pendingMessage && action.type !== RESEND_MESSAGE) {
18006
18046
  if (message.forwardingDetails) {
@@ -18024,7 +18064,7 @@ function forwardMessage(action) {
18024
18064
  return effects.call(loadOGMetadataForLinkMessages, [pendingMessage], true);
18025
18065
  case 9:
18026
18066
  _context15.n = 10;
18027
- 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);
18028
18068
  case 10:
18029
18069
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
18030
18070
  _context15.n = 16;
@@ -18037,7 +18077,9 @@ function forwardMessage(action) {
18037
18077
  case 11:
18038
18078
  messageResponse = _context15.v;
18039
18079
  messageUpdateData = _extends({}, messageResponse, {
18040
- 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
18041
18083
  });
18042
18084
  if (!(channelId === activeChannelId)) {
18043
18085
  _context15.n = 12;
@@ -18047,7 +18089,7 @@ function forwardMessage(action) {
18047
18089
  return effects.put(updateMessageAC(messageToSend.tid, JSON.parse(JSON.stringify(messageUpdateData)), true));
18048
18090
  case 12:
18049
18091
  addConfirmedMessageToCache(channel.id, JSON.parse(JSON.stringify(messageUpdateData)));
18050
- messageToUpdate = JSON.parse(JSON.stringify(messageResponse));
18092
+ messageToUpdate = JSON.parse(JSON.stringify(messageUpdateData));
18051
18093
  if (!channel.unread) {
18052
18094
  _context15.n = 13;
18053
18095
  break;
@@ -50979,6 +51021,23 @@ var Emoji$1 = styled__default.li(_templateObject8$l || (_templateObject8$l = _ta
50979
51021
  return props.hoverBackgroundColor;
50980
51022
  });
50981
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
+
50982
51041
  var getReplyLinkPreviewImage = function getReplyLinkPreviewImage(attachments) {
50983
51042
  var _attachments$;
50984
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;
@@ -52712,6 +52771,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52712
52771
  var emojiBtnRef = React.useRef(null);
52713
52772
  var addAttachmentsBtnRef = React.useRef(null);
52714
52773
  var metadataDebounceRef = React.useRef(null);
52774
+ var attachmentPreparationPromisesRef = React.useRef(new Map());
52775
+ var preparedAttachmentPatchesRef = React.useRef(new Map());
52715
52776
  var sendMessageWrapperRef = React.useRef(null);
52716
52777
  var restoringDraftRef = React.useRef(false);
52717
52778
  var restoredDraftChannelIdRef = React.useRef(null);
@@ -52933,168 +52994,196 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52933
52994
  }
52934
52995
  };
52935
52996
  var handleSendEditMessage = function handleSendEditMessage(event, pollDetails) {
52936
- var shiftKey = event.shiftKey,
52937
- type = event.type,
52938
- code = event.code;
52939
- var isEnter = (code === 'Enter' || code === 'NumpadEnter') && shiftKey === false;
52940
- var isPoll = pollDetails && pollDetails.options.length > 0 && pollDetails.name.trim();
52941
- var messageTextForSend = isPoll ? pollDetails === null || pollDetails === void 0 ? void 0 : pollDetails.name.trim() : messageText.trim();
52942
- var shouldSend = (isEnter || type === 'click') && (messageToEdit || messageTextForSend || attachments.length && attachments.length > 0);
52943
- if (isEnter) {
52944
- event.preventDefault();
52945
- if (!(messageTextForSend !== null && messageTextForSend !== void 0 && messageTextForSend.trim()) && !attachments.length && !messageToEdit) {
52946
- setShouldClearEditor({
52947
- clear: true
52948
- });
52949
- }
52950
- }
52951
- if (shouldSend && !mentionsIsOpen) {
52952
- event.preventDefault();
52953
- event.stopPropagation();
52954
- if (messageToEdit) {
52955
- handleEditMessage();
52956
- } else if (messageTextForSend !== null && messageTextForSend !== void 0 && messageTextForSend.trim() || attachments.length && attachments.length > 0) {
52957
- var _trimMessageBodyWithA = trimMessageBodyWithAttributes(messageText, messageBodyAttributes),
52958
- messageTexToSend = _trimMessageBodyWithA.body,
52959
- adjustedBodyAttributes = _trimMessageBodyWithA.bodyAttributes;
52960
- var messageToSend = {
52961
- body: messageTexToSend,
52962
- bodyAttributes: adjustedBodyAttributes,
52963
- mentionedUsers: [],
52964
- attachments: [],
52965
- type: 'text'
52966
- };
52967
- var mentionUsersToSend = [];
52968
- if (adjustedBodyAttributes && adjustedBodyAttributes.length) {
52969
- adjustedBodyAttributes.forEach(function (att) {
52970
- if (att.type === 'mention') {
52971
- var mentionsToFind = [].concat(mentionedUsers);
52972
- var draftMessage = getDraftMessageFromMap(activeChannel.id);
52973
- if (draftMessage) {
52974
- mentionsToFind = [].concat(draftMessage.mentionedUsers, mentionedUsers);
52975
- }
52976
- var mentionToAdd = mentionsToFind.find(function (mention) {
52977
- return mention.id === att.metadata;
52978
- });
52979
- mentionUsersToSend.push(mentionToAdd || {
52980
- id: att.metadata
52981
- });
52982
- }
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
52983
53010
  });
52984
53011
  }
52985
- messageToSend.mentionedUsers = mentionUsersToSend;
52986
- if (messageForReply) {
52987
- messageToSend.parentMessage = messageForReply;
52988
- }
52989
- var linkAttachment;
52990
- if (messageTexToSend) {
52991
- var _LinkifyIt$match;
52992
- var protocolMatch = /https?:\/\/\S+/.exec(messageTexToSend);
52993
- var linkifyMatchResult = !protocolMatch ? (_LinkifyIt$match = new LinkifyIt().match(messageTexToSend)) === null || _LinkifyIt$match === void 0 ? void 0 : _LinkifyIt$match[0] : null;
52994
- var url = protocolMatch ? protocolMatch[0] : linkifyMatchResult ? linkifyMatchResult.schema === '' ? linkifyMatchResult.url.replace(/^http:\/\//, 'https://') : linkifyMatchResult.url : null;
52995
- if (url) {
52996
- var urlMetadata = oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[url];
52997
- var metadata = {};
52998
- if (urlMetadata) {
52999
- var _urlMetadata$og, _urlMetadata$og$favic, _urlMetadata$og2, _urlMetadata$og$descr, _urlMetadata$og3, _urlMetadata$og3$imag, _urlMetadata$og3$imag2, _urlMetadata$og4, _urlMetadata$og$title;
53000
- if (urlMetadata.imageWidth) metadata.szw = urlMetadata.imageWidth;
53001
- if (urlMetadata.imageHeight) metadata.szh = urlMetadata.imageHeight;
53002
- 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;
53003
- 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);
53004
- 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;
53005
- 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);
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 () {});
53006
53167
  }
53007
- if (dismissedUrls.has(url)) {
53008
- metadata.hld = true;
53168
+ }();
53169
+ return _temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4);
53170
+ } else {
53171
+ if (typingTimout) {
53172
+ if (!inTypingStateTimout) {
53173
+ handleSendTypingState(true, code);
53009
53174
  }
53010
- linkAttachment = _extends({
53011
- type: attachmentTypes.link,
53012
- data: url,
53013
- upload: false
53014
- }, Object.keys(metadata).length > 0 ? {
53015
- metadata: metadata,
53016
- name: metadata.ttl
53017
- } : {
53018
- metadata: {
53019
- hld: true
53020
- }
53021
- });
53022
- }
53023
- }
53024
- if (messageTexToSend !== null && messageTexToSend !== void 0 && messageTexToSend.trim() && !attachments.length) {
53025
- if (linkAttachment) {
53026
- messageToSend.attachments = [linkAttachment];
53027
- }
53028
- if (isPoll) {
53029
- messageToSend.pollDetails = pollDetails;
53030
- messageToSend.type = 'poll';
53031
- messageToSend.body = messageTextForSend === null || messageTextForSend === void 0 ? void 0 : messageTextForSend.trim();
53032
- }
53033
- dispatch(sendTextMessageAC(messageToSend, activeChannel.id, connectionStatus));
53034
- }
53035
- if (attachments.length) {
53036
- var sendAsSeparateMessage = getSendAttachmentsAsSeparateMessages();
53037
- messageToSend.attachments = attachments.map(function (attachment) {
53038
- return {
53039
- name: attachment.data.name,
53040
- data: attachment.data,
53041
- attachmentUrl: attachment.attachmentUrl,
53042
- tid: attachment.tid,
53043
- cachedUrl: attachment.cachedUrl,
53044
- upload: attachment.upload,
53045
- metadata: attachment.metadata,
53046
- type: attachment.type,
53047
- size: attachment.size,
53048
- thumbnailState: attachment.thumbnailState
53049
- };
53050
- });
53051
- if (viewOnce && canShowViewOnceToggle) {
53052
- messageToSend.viewOnce = true;
53053
- }
53054
- var attachmentsToSent = [].concat(messageToSend.attachments);
53055
- if (linkAttachment && !messageToSend.viewOnce) {
53056
- attachmentsToSent.push(linkAttachment);
53175
+ clearTimeout(typingTimout);
53176
+ } else {
53177
+ handleSendTypingState(true, code);
53057
53178
  }
53058
- dispatch(sendMessageAC(_extends({}, messageToSend, {
53059
- attachments: attachmentsToSent
53060
- }), activeChannel.id, connectionStatus, sendAsSeparateMessage));
53061
- }
53062
- setMessageText('');
53063
- fileUploader.current.value = '';
53064
- if (inTypingState) {
53065
- handleSendTypingState(false);
53179
+ setTypingTimout(setTimeout(function () {
53180
+ setTypingTimout(0);
53181
+ }, 2000));
53066
53182
  }
53067
- clearTimeout(typingTimout);
53068
- setTypingTimout(undefined);
53069
- }
53070
- setAttachments([]);
53071
- attachmentsUpdate = [];
53072
- removeDraftMessageFromMap(activeChannel.id);
53073
- dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
53074
- setViewOnce(false);
53075
- handleCloseReply();
53076
- setShouldClearEditor({
53077
- clear: true
53078
- });
53079
- setMentionedUsers([]);
53080
- setMessageBodyAttributes([]);
53081
- closePreviewWithAnimation(function () {
53082
- setDetectedUrl(null);
53083
- setDismissedUrls(new Set());
53084
- });
53085
- dispatch(setCloseSearchChannelsAC(true));
53086
- } else {
53087
- if (typingTimout) {
53088
- if (!inTypingStateTimout) {
53089
- handleSendTypingState(true, code);
53090
- }
53091
- clearTimeout(typingTimout);
53092
- } else {
53093
- handleSendTypingState(true, code);
53094
- }
53095
- setTypingTimout(setTimeout(function () {
53096
- setTypingTimout(0);
53097
- }, 2000));
53183
+ }();
53184
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
53185
+ } catch (e) {
53186
+ return Promise.reject(e);
53098
53187
  }
53099
53188
  };
53100
53189
  var handleEditMessage = function handleEditMessage() {
@@ -53200,6 +53289,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53200
53289
  return item.tid !== attachmentId;
53201
53290
  });
53202
53291
  clearVideoPreparation(attachmentId);
53292
+ attachmentPreparationPromisesRef.current["delete"](attachmentId);
53293
+ preparedAttachmentPatchesRef.current["delete"](attachmentId);
53203
53294
  releaseBlobUrls(["compose_" + attachmentId]);
53204
53295
  setAttachments(updatedAttachments);
53205
53296
  attachmentsUpdate = updatedAttachments;
@@ -53207,6 +53298,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53207
53298
  attachmentsUpdate.forEach(function (attachment) {
53208
53299
  return clearVideoPreparation(attachment.tid);
53209
53300
  });
53301
+ attachmentPreparationPromisesRef.current.clear();
53302
+ preparedAttachmentPatchesRef.current.clear();
53210
53303
  releaseBlobUrls(attachmentsUpdate.map(function (item) {
53211
53304
  return "compose_" + item.tid;
53212
53305
  }));
@@ -53283,14 +53376,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53283
53376
  }
53284
53377
  }
53285
53378
  }
53286
- var _temp = function () {
53379
+ var _temp8 = function () {
53287
53380
  if (allowUpload) {
53288
53381
  return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, isMediaAttachment)).then(function () {});
53289
53382
  } else {
53290
53383
  showFileUploadError(errorMessage);
53291
53384
  }
53292
53385
  }();
53293
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
53386
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
53294
53387
  } catch (e) {
53295
53388
  return Promise.reject(e);
53296
53389
  }
@@ -53341,14 +53434,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53341
53434
  errorMessage = allowedMediaExtensionsErrorMessage != null ? allowedMediaExtensionsErrorMessage : "Invalid file type. Allowed extensions are: " + allowedMediaExtensions.join(', ') + ".";
53342
53435
  }
53343
53436
  }
53344
- var _temp2 = function () {
53437
+ var _temp9 = function () {
53345
53438
  if (allowUpload) {
53346
53439
  return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, true)).then(function () {});
53347
53440
  } else {
53348
53441
  showFileUploadError(errorMessage);
53349
53442
  }
53350
53443
  }();
53351
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
53444
+ return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
53352
53445
  } catch (e) {
53353
53446
  return Promise.reject(e);
53354
53447
  }
@@ -53487,160 +53580,172 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53487
53580
  return [].concat(prevState, [attachment]);
53488
53581
  });
53489
53582
  var updateAttachment = function updateAttachment(patch) {
53583
+ preparedAttachmentPatchesRef.current.set(tid, _extends({}, preparedAttachmentPatchesRef.current.get(tid), patch));
53490
53584
  setAttachments(function (prevState) {
53491
53585
  return prevState.map(function (current) {
53492
53586
  return current.tid === tid ? _extends({}, current, patch) : current;
53493
53587
  });
53494
53588
  });
53495
53589
  };
53496
- setTimeout(function () {
53497
- try {
53498
- var _temp1 = function () {
53499
- if (fileType === 'image') {
53500
- var _temp5 = _catch(function () {
53501
- return Promise.resolve(createImageThumbnail(file)).then(function (_ref5) {
53502
- var thumbnail = _ref5.thumbnail,
53503
- imageWidth = _ref5.imageWidth,
53504
- imageHeight = _ref5.imageHeight;
53505
- var _temp4 = function () {
53506
- if (customUploader) {
53507
- return Promise.resolve(resizeImage(file)).then(function (resizedFile) {
53508
- var patch = {
53509
- size: isMediaAttachment && resizedFile !== null && resizedFile !== void 0 && resizedFile.blob ? resizedFile.blob.size : file.size,
53510
- metadata: {
53511
- szw: imageWidth,
53512
- szh: imageHeight,
53513
- tmb: thumbnail
53514
- }
53515
- };
53516
- updateAttachment(patch);
53517
- handleAttachmentImageForCache(_extends({}, attachment, patch));
53518
- });
53519
- } else {
53520
- var _temp10 = function () {
53521
- if (isMediaAttachment && file.type !== 'image/gif') {
53522
- return Promise.resolve(resizeImage(file)).then(function (resizedFileData) {
53523
- var resizedFile = resizedFileData.blob ? new File([resizedFileData.blob], resizedFileData.file.name, {
53524
- type: file.type
53525
- }) : 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) {
53526
53604
  var patch = {
53527
- data: resizedFile,
53528
- size: resizedFile.size,
53529
- metadata: JSON.stringify({
53530
- tmb: thumbnail,
53531
- szw: resizedFileData.newWidth,
53532
- szh: resizedFileData.newHeight
53533
- })
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
+ }
53534
53611
  };
53535
53612
  updateAttachment(patch);
53536
- setPendingAttachment(tid, {
53537
- file: resizedFile
53538
- });
53539
53613
  handleAttachmentImageForCache(_extends({}, attachment, patch));
53540
53614
  });
53541
53615
  } else {
53542
- updateAttachment({
53543
- metadata: JSON.stringify({
53544
- tmb: thumbnail,
53545
- szw: imageWidth,
53546
- szh: imageHeight
53547
- })
53548
- });
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 () {});
53549
53648
  }
53550
53649
  }();
53551
- if (_temp10 && _temp10.then) return _temp10.then(function () {});
53552
- }
53553
- }();
53554
- if (_temp4 && _temp4.then) return _temp4.then(function () {});
53555
- });
53556
- }, function (error) {
53557
- log.warn('Unable to prepare image attachment preview:', error);
53558
- });
53559
- if (_temp5 && _temp5.then) return _temp5.then(function () {});
53560
- } else {
53561
- var _temp11 = function () {
53562
- if (fileType === 'video') {
53563
- var _temp9 = function _temp9() {
53564
- return Promise.resolve(remuxPromise).then(function (uploadFile) {
53565
- if (uploadFile !== file) {
53566
- updateAttachment({
53567
- data: uploadFile,
53568
- size: uploadFile.size
53569
- });
53570
- setPendingAttachment(tid, {
53571
- file: uploadFile
53572
- });
53573
- }
53574
- if (metadata) {
53575
- completeVideoPreparation(tid, {
53576
- file: uploadFile,
53577
- metadata: metadata
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
+ }
53578
53681
  });
53579
- } else {
53580
- failVideoPreparation(tid);
53581
- updateAttachment({
53582
- thumbnailState: 'failed'
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
+ });
53583
53724
  });
53584
- }
53585
- });
53586
- };
53587
- var remuxPromise = remuxVideoFileForUpload(file);
53588
- var thumbnailSource = file;
53589
- var metadata;
53590
- var _temp8 = _catch(function () {
53591
- function _temp7() {
53592
- var _frame = frame,
53593
- thumb = _frame.thumb,
53594
- width = _frame.width,
53595
- height = _frame.height,
53596
- duration = _frame.duration;
53597
- metadata = customUploader ? {
53598
- szw: width,
53599
- szh: height,
53600
- tmb: thumb,
53601
- dur: duration
53602
- } : JSON.stringify({
53603
- tmb: thumb,
53604
- szw: width,
53605
- szh: height,
53606
- dur: duration
53725
+ return _temp11 && _temp11.then ? _temp11.then(_temp12) : _temp12(_temp11);
53726
+ }, function (error) {
53727
+ log.warn('Unable to generate video thumbnail:', error);
53607
53728
  });
53608
- updateAttachment({
53609
- metadata: metadata,
53610
- thumbnailState: 'ready'
53611
- });
53612
- handleAttachmentVideoForCache(_extends({}, attachment, {
53613
- metadata: metadata
53614
- }));
53729
+ return _temp13 && _temp13.then ? _temp13.then(_temp14) : _temp14(_temp13);
53615
53730
  }
53616
- var frame;
53617
- var _temp6 = _catch(function () {
53618
- return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame) {
53619
- frame = _getFrame;
53620
- });
53621
- }, function () {
53622
- return Promise.resolve(remuxPromise).then(function (_remuxPromise) {
53623
- thumbnailSource = _remuxPromise;
53624
- return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame2) {
53625
- frame = _getFrame2;
53626
- });
53627
- });
53628
- });
53629
- return _temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6);
53630
- }, function (error) {
53631
- log.warn('Unable to generate video thumbnail:', error);
53632
- });
53633
- return _temp8 && _temp8.then ? _temp8.then(_temp9) : _temp9(_temp8);
53731
+ }();
53732
+ if (_temp18 && _temp18.then) return _temp18.then(function () {});
53634
53733
  }
53635
53734
  }();
53636
- if (_temp11 && _temp11.then) return _temp11.then(function () {});
53637
- }
53638
- }();
53639
- return Promise.resolve(_temp1 && _temp1.then ? _temp1.then(function () {}) : void 0);
53640
- } catch (e) {
53641
- return Promise.reject(e);
53642
- }
53643
- }, 0);
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
+ }
53644
53749
  return Promise.resolve();
53645
53750
  } catch (e) {
53646
53751
  return Promise.reject(e);
@@ -53700,14 +53805,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53700
53805
  }
53701
53806
  }
53702
53807
  }
53703
- var _temp12 = function () {
53808
+ var _temp19 = function () {
53704
53809
  if (allowUpload) {
53705
53810
  return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, isMediaAttachment)).then(function () {});
53706
53811
  } else {
53707
53812
  showFileUploadError(errorMessage);
53708
53813
  }
53709
53814
  }();
53710
- return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
53815
+ return Promise.resolve(_temp19 && _temp19.then ? _temp19.then(function () {}) : void 0);
53711
53816
  } catch (e) {
53712
53817
  return Promise.reject(e);
53713
53818
  }