sceyt-chat-react-uikit 1.8.8-beta.6 → 1.8.8-beta.7
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 +105 -57
- package/index.modern.js +105 -58
- package/messageUtils/index.d.ts +5 -1
- package/messageUtils/index.test.d.ts +1 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -20943,7 +20943,7 @@ function loadMorePollVotes(action) {
|
|
|
20943
20943
|
}
|
|
20944
20944
|
var REFRESH_WINDOW_HALF = 30;
|
|
20945
20945
|
function refreshCacheAroundMessage(action) {
|
|
20946
|
-
var _action$payload0, channelId, messageId, _action$payload0$appl, applyVisibleWindow, connectionState, activeChannelId, activeMessages, activeConfirmedMessages, centerMessageIndex, refreshAnchorId, previousLimit, nextLimit, SceytChatClient, messageQueryBuilder, messageQuery, prevResult, pivotId, nextResult, loadedMessages, firstId, lastId, activeById, changed, filteredPendingMessages, _t53, _t54, _t55;
|
|
20946
|
+
var _action$payload0, channelId, messageId, _action$payload0$appl, applyVisibleWindow, connectionState, activeChannelId, activeMessages, activeConfirmedMessages, centerMessageIndex, refreshAnchorId, previousLimit, nextLimit, SceytChatClient, messageQueryBuilder, messageQuery, prevResult, pivotId, nextResult, loadedMessages, firstId, lastId, currentActiveMessages, currentActiveConfirmedMessages, activeById, changed, filteredPendingMessages, _t53, _t54, _t55;
|
|
20947
20947
|
return _regenerator().w(function (_context63) {
|
|
20948
20948
|
while (1) switch (_context63.p = _context63.n) {
|
|
20949
20949
|
case 0:
|
|
@@ -21045,8 +21045,18 @@ function refreshCacheAroundMessage(action) {
|
|
|
21045
21045
|
_context63.n = 13;
|
|
21046
21046
|
return effects.call(loadOGMetadataForLinkMessages, loadedMessages, true);
|
|
21047
21047
|
case 13:
|
|
21048
|
+
currentActiveMessages = store.getState().MessageReducer.activeChannelMessages || [];
|
|
21049
|
+
currentActiveConfirmedMessages = currentActiveMessages.filter(function (message) {
|
|
21050
|
+
return !!message.id;
|
|
21051
|
+
});
|
|
21052
|
+
if (sameConfirmedWindow(currentActiveConfirmedMessages, activeConfirmedMessages)) {
|
|
21053
|
+
_context63.n = 14;
|
|
21054
|
+
break;
|
|
21055
|
+
}
|
|
21056
|
+
return _context63.a(2);
|
|
21057
|
+
case 14:
|
|
21048
21058
|
if (!sameConfirmedWindow(activeConfirmedMessages, loadedMessages)) {
|
|
21049
|
-
_context63.n =
|
|
21059
|
+
_context63.n = 16;
|
|
21050
21060
|
break;
|
|
21051
21061
|
}
|
|
21052
21062
|
activeById = new Map(activeConfirmedMessages.map(function (currentMessage) {
|
|
@@ -21059,44 +21069,44 @@ function refreshCacheAroundMessage(action) {
|
|
|
21059
21069
|
return JSON.stringify(existing) !== JSON.stringify(loaded);
|
|
21060
21070
|
});
|
|
21061
21071
|
if (!(changed.length > 0)) {
|
|
21062
|
-
_context63.n =
|
|
21072
|
+
_context63.n = 15;
|
|
21063
21073
|
break;
|
|
21064
21074
|
}
|
|
21065
|
-
_context63.n =
|
|
21075
|
+
_context63.n = 15;
|
|
21066
21076
|
return effects.put(patchMessagesAC(changed));
|
|
21067
|
-
case 14:
|
|
21068
|
-
return _context63.a(2);
|
|
21069
21077
|
case 15:
|
|
21078
|
+
return _context63.a(2);
|
|
21079
|
+
case 16:
|
|
21070
21080
|
if (applyVisibleWindow) {
|
|
21071
|
-
_context63.n =
|
|
21081
|
+
_context63.n = 17;
|
|
21072
21082
|
break;
|
|
21073
21083
|
}
|
|
21074
21084
|
return _context63.a(2);
|
|
21075
|
-
case 16:
|
|
21076
|
-
_context63.n = 17;
|
|
21077
|
-
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(loadedMessages)), channelId));
|
|
21078
21085
|
case 17:
|
|
21086
|
+
_context63.n = 18;
|
|
21087
|
+
return effects.put(setMessagesAC(JSON.parse(JSON.stringify(loadedMessages)), channelId));
|
|
21088
|
+
case 18:
|
|
21079
21089
|
filteredPendingMessages = getFilteredPendingMessages(channelId, loadedMessages);
|
|
21080
21090
|
if (!(filteredPendingMessages.length > 0)) {
|
|
21081
|
-
_context63.n =
|
|
21091
|
+
_context63.n = 20;
|
|
21082
21092
|
break;
|
|
21083
21093
|
}
|
|
21084
|
-
_context63.n = 18;
|
|
21085
|
-
return effects.put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
21086
|
-
case 18:
|
|
21087
21094
|
_context63.n = 19;
|
|
21088
|
-
return effects.
|
|
21095
|
+
return effects.put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
21089
21096
|
case 19:
|
|
21090
|
-
_context63.n =
|
|
21091
|
-
|
|
21097
|
+
_context63.n = 20;
|
|
21098
|
+
return effects.call(loadOGMetadataForLinkMessages, filteredPendingMessages, true);
|
|
21092
21099
|
case 20:
|
|
21093
|
-
_context63.
|
|
21100
|
+
_context63.n = 22;
|
|
21101
|
+
break;
|
|
21102
|
+
case 21:
|
|
21103
|
+
_context63.p = 21;
|
|
21094
21104
|
_t55 = _context63.v;
|
|
21095
21105
|
log.error('error in refreshCacheAroundMessage', _t55);
|
|
21096
|
-
case
|
|
21106
|
+
case 22:
|
|
21097
21107
|
return _context63.a(2);
|
|
21098
21108
|
}
|
|
21099
|
-
}, _marked57, null, [[0,
|
|
21109
|
+
}, _marked57, null, [[0, 21]]);
|
|
21100
21110
|
}
|
|
21101
21111
|
function MessageSaga() {
|
|
21102
21112
|
return _regenerator().w(function (_context64) {
|
|
@@ -21989,6 +21999,42 @@ var MessageStatusIcon = function MessageStatusIcon(_ref) {
|
|
|
21989
21999
|
});
|
|
21990
22000
|
}
|
|
21991
22001
|
};
|
|
22002
|
+
function extractUrlMatches(text) {
|
|
22003
|
+
var results = [];
|
|
22004
|
+
var protocolRegex = /https?:\/\/\S+/g;
|
|
22005
|
+
var m;
|
|
22006
|
+
while ((m = protocolRegex.exec(text)) !== null) {
|
|
22007
|
+
results.push({
|
|
22008
|
+
text: m[0],
|
|
22009
|
+
url: m[0],
|
|
22010
|
+
index: m.index
|
|
22011
|
+
});
|
|
22012
|
+
}
|
|
22013
|
+
var linkifyResults = new LinkifyIt().match(text);
|
|
22014
|
+
if (linkifyResults) {
|
|
22015
|
+
for (var _iterator = _createForOfIteratorHelperLoose(linkifyResults), _step; !(_step = _iterator()).done;) {
|
|
22016
|
+
var lm = _step.value;
|
|
22017
|
+
if (lm.schema === '') {
|
|
22018
|
+
results.push({
|
|
22019
|
+
text: lm.text,
|
|
22020
|
+
url: lm.url.replace(/^http:\/\//, 'https://'),
|
|
22021
|
+
index: lm.index
|
|
22022
|
+
});
|
|
22023
|
+
}
|
|
22024
|
+
}
|
|
22025
|
+
}
|
|
22026
|
+
results.sort(function (a, b) {
|
|
22027
|
+
return a.index - b.index;
|
|
22028
|
+
});
|
|
22029
|
+
return results.length > 0 ? results.map(function (_ref2) {
|
|
22030
|
+
var text = _ref2.text,
|
|
22031
|
+
url = _ref2.url;
|
|
22032
|
+
return {
|
|
22033
|
+
text: text,
|
|
22034
|
+
url: url
|
|
22035
|
+
};
|
|
22036
|
+
}) : null;
|
|
22037
|
+
}
|
|
21992
22038
|
var linkifyTextPart = function linkifyTextPart(textPart, match, target, isInviteLink, onInviteLinkClick) {
|
|
21993
22039
|
if (target === void 0) {
|
|
21994
22040
|
target = '_blank';
|
|
@@ -22037,26 +22083,25 @@ var linkifyTextPart = function linkifyTextPart(textPart, match, target, isInvite
|
|
|
22037
22083
|
});
|
|
22038
22084
|
return newMessageText || textPart;
|
|
22039
22085
|
};
|
|
22040
|
-
var MessageTextFormat = function MessageTextFormat(
|
|
22041
|
-
var text =
|
|
22042
|
-
message =
|
|
22043
|
-
contactsMap =
|
|
22044
|
-
getFromContacts =
|
|
22045
|
-
isLastMessage =
|
|
22046
|
-
asSampleText =
|
|
22047
|
-
accentColor =
|
|
22048
|
-
textSecondary =
|
|
22049
|
-
onMentionNameClick =
|
|
22050
|
-
shouldOpenUserProfileForMention =
|
|
22051
|
-
unsupportedMessage =
|
|
22052
|
-
|
|
22053
|
-
target =
|
|
22054
|
-
|
|
22055
|
-
isInviteLink =
|
|
22056
|
-
onInviteLinkClick =
|
|
22086
|
+
var MessageTextFormat = function MessageTextFormat(_ref3) {
|
|
22087
|
+
var text = _ref3.text,
|
|
22088
|
+
message = _ref3.message,
|
|
22089
|
+
contactsMap = _ref3.contactsMap,
|
|
22090
|
+
getFromContacts = _ref3.getFromContacts,
|
|
22091
|
+
isLastMessage = _ref3.isLastMessage,
|
|
22092
|
+
asSampleText = _ref3.asSampleText,
|
|
22093
|
+
accentColor = _ref3.accentColor,
|
|
22094
|
+
textSecondary = _ref3.textSecondary,
|
|
22095
|
+
onMentionNameClick = _ref3.onMentionNameClick,
|
|
22096
|
+
shouldOpenUserProfileForMention = _ref3.shouldOpenUserProfileForMention,
|
|
22097
|
+
unsupportedMessage = _ref3.unsupportedMessage,
|
|
22098
|
+
_ref3$target = _ref3.target,
|
|
22099
|
+
target = _ref3$target === void 0 ? '_blank' : _ref3$target,
|
|
22100
|
+
_ref3$isInviteLink = _ref3.isInviteLink,
|
|
22101
|
+
isInviteLink = _ref3$isInviteLink === void 0 ? false : _ref3$isInviteLink,
|
|
22102
|
+
onInviteLinkClick = _ref3.onInviteLinkClick;
|
|
22057
22103
|
try {
|
|
22058
22104
|
var messageText = [];
|
|
22059
|
-
var linkify = new LinkifyIt();
|
|
22060
22105
|
var messageBodyAttributes = message.bodyAttributes && JSON.parse(JSON.stringify(message.bodyAttributes));
|
|
22061
22106
|
if (unsupportedMessage) {
|
|
22062
22107
|
return 'This message is not supported. Update your app to view this message.';
|
|
@@ -22069,12 +22114,12 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
22069
22114
|
var attributeOffset = attribute.offset;
|
|
22070
22115
|
try {
|
|
22071
22116
|
var firstPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(nextPartIndex || 0, attributeOffset) : '');
|
|
22072
|
-
var firstPartMatch = firstPart ?
|
|
22117
|
+
var firstPartMatch = firstPart ? extractUrlMatches(firstPart) : null;
|
|
22073
22118
|
if (!isLastMessage && !asSampleText && firstPartMatch) {
|
|
22074
22119
|
firstPart = linkifyTextPart(firstPart, firstPartMatch, target, isInviteLink, onInviteLinkClick);
|
|
22075
22120
|
}
|
|
22076
22121
|
var secondPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(attributeOffset + attribute.length) : '');
|
|
22077
|
-
var secondPartMatch = secondPart ?
|
|
22122
|
+
var secondPartMatch = secondPart ? extractUrlMatches(secondPart) : null;
|
|
22078
22123
|
if (!isLastMessage && !asSampleText && secondPartMatch) {
|
|
22079
22124
|
secondPart = linkifyTextPart(secondPart, secondPartMatch, target, isInviteLink, onInviteLinkClick);
|
|
22080
22125
|
}
|
|
@@ -22134,7 +22179,7 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
22134
22179
|
} else {
|
|
22135
22180
|
nextPartIndex = attributeOffset + attribute.length;
|
|
22136
22181
|
var _textPart = "" + text.slice(attributeOffset, attributeOffset + attribute.length);
|
|
22137
|
-
var match =
|
|
22182
|
+
var match = extractUrlMatches(_textPart);
|
|
22138
22183
|
var newTextPart = _textPart;
|
|
22139
22184
|
if (!isLastMessage && !asSampleText && match) {
|
|
22140
22185
|
newTextPart = linkifyTextPart(_textPart, match, target, isInviteLink, onInviteLinkClick);
|
|
@@ -22151,7 +22196,7 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
22151
22196
|
}
|
|
22152
22197
|
});
|
|
22153
22198
|
} else {
|
|
22154
|
-
var match =
|
|
22199
|
+
var match = extractUrlMatches(text);
|
|
22155
22200
|
if (!isLastMessage && !asSampleText && match) {
|
|
22156
22201
|
messageText = linkifyTextPart(text, match, target, isInviteLink, onInviteLinkClick);
|
|
22157
22202
|
}
|
|
@@ -44670,6 +44715,7 @@ function useChatController(_ref5) {
|
|
|
44670
44715
|
restoreRef.current = null;
|
|
44671
44716
|
pendingNewestCountRef.current = 0;
|
|
44672
44717
|
setPendingNewestCount(0);
|
|
44718
|
+
unreadRestoreCompletedRef.current = true;
|
|
44673
44719
|
var container = scrollRef.current;
|
|
44674
44720
|
var currentChannelId = (_channelRef$current = channelRef.current) === null || _channelRef$current === void 0 ? void 0 : _channelRef$current.id;
|
|
44675
44721
|
var pendingLatestServerSync = ((_pendingLatestJumpRef = pendingLatestJumpRef.current) === null || _pendingLatestJumpRef === void 0 ? void 0 : _pendingLatestJumpRef.channelId) === currentChannelId && ((_pendingLatestJumpRef2 = pendingLatestJumpRef.current) === null || _pendingLatestJumpRef2 === void 0 ? void 0 : _pendingLatestJumpRef2.needsServerSync);
|
|
@@ -45536,6 +45582,7 @@ function useChatController(_ref5) {
|
|
|
45536
45582
|
restoreRef.current = null;
|
|
45537
45583
|
viewIsAtLatestRef.current = true;
|
|
45538
45584
|
setIsViewingLatest(true);
|
|
45585
|
+
lockJumpScrolling(true, 'latest');
|
|
45539
45586
|
scrollToLatestEdge(container, 'smooth');
|
|
45540
45587
|
rememberLatestEdge();
|
|
45541
45588
|
return;
|
|
@@ -45596,7 +45643,7 @@ function useChatController(_ref5) {
|
|
|
45596
45643
|
}
|
|
45597
45644
|
rememberLatestEdge();
|
|
45598
45645
|
}
|
|
45599
|
-
}, [channel.id, unreadMessageId, isActiveEdgeRequestCurrent, dispatch, messages, unreadScrollTo, clearJumpBlur, hasNext, isScrollInteractionActive]);
|
|
45646
|
+
}, [channel.id, unreadMessageId, isActiveEdgeRequestCurrent, dispatch, messages, unreadScrollTo, clearJumpBlur, hasNext, isScrollInteractionActive, lockJumpScrolling]);
|
|
45600
45647
|
React.useEffect(function () {
|
|
45601
45648
|
if (!unreadScrollTo || !unreadMessageId || !messages.length || unreadRestoreCompletedRef.current) {
|
|
45602
45649
|
return;
|
|
@@ -50751,10 +50798,10 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
50751
50798
|
editorState.read(function () {
|
|
50752
50799
|
var root = lexical.$getRoot();
|
|
50753
50800
|
var textContent = root.getTextContent();
|
|
50754
|
-
var
|
|
50755
|
-
|
|
50756
|
-
|
|
50757
|
-
|
|
50801
|
+
var protocolMatch = /https?:\/\/\S+/.exec(textContent);
|
|
50802
|
+
var linkifyMatchResult = !protocolMatch ? linkify.match(textContent) : null;
|
|
50803
|
+
var firstUrl = protocolMatch ? protocolMatch[0] : linkifyMatchResult !== null && linkifyMatchResult !== void 0 && linkifyMatchResult[0] ? linkifyMatchResult[0].schema === '' ? linkifyMatchResult[0].url.replace(/^http:\/\//, 'https://') : linkifyMatchResult[0].url : null;
|
|
50804
|
+
if (firstUrl) {
|
|
50758
50805
|
if (firstUrl !== detectedUrl) {
|
|
50759
50806
|
closePreviewWithAnimation(function () {
|
|
50760
50807
|
if (!dismissedUrls.has(firstUrl)) {
|
|
@@ -50914,11 +50961,11 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
50914
50961
|
}
|
|
50915
50962
|
var linkAttachment;
|
|
50916
50963
|
if (messageTexToSend) {
|
|
50917
|
-
var
|
|
50918
|
-
var
|
|
50919
|
-
|
|
50920
|
-
|
|
50921
|
-
|
|
50964
|
+
var _LinkifyIt$match;
|
|
50965
|
+
var protocolMatch = /https?:\/\/\S+/.exec(messageTexToSend);
|
|
50966
|
+
var linkifyMatchResult = !protocolMatch ? (_LinkifyIt$match = new LinkifyIt().match(messageTexToSend)) === null || _LinkifyIt$match === void 0 ? void 0 : _LinkifyIt$match[0] : null;
|
|
50967
|
+
var url = protocolMatch ? protocolMatch[0] : linkifyMatchResult ? linkifyMatchResult.schema === '' ? linkifyMatchResult.url.replace(/^http:\/\//, 'https://') : linkifyMatchResult.url : null;
|
|
50968
|
+
if (url) {
|
|
50922
50969
|
var urlMetadata = oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[url];
|
|
50923
50970
|
var metadata = {};
|
|
50924
50971
|
if (urlMetadata) {
|
|
@@ -51033,11 +51080,11 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
51033
51080
|
if (messageTexToSend) {
|
|
51034
51081
|
var linkAttachment;
|
|
51035
51082
|
if (messageTexToSend) {
|
|
51036
|
-
var
|
|
51037
|
-
var
|
|
51038
|
-
|
|
51039
|
-
|
|
51040
|
-
|
|
51083
|
+
var _LinkifyIt$match2;
|
|
51084
|
+
var protocolMatch = /https?:\/\/\S+/.exec(messageTexToSend);
|
|
51085
|
+
var linkifyMatchResult = !protocolMatch ? (_LinkifyIt$match2 = new LinkifyIt().match(messageTexToSend)) === null || _LinkifyIt$match2 === void 0 ? void 0 : _LinkifyIt$match2[0] : null;
|
|
51086
|
+
var url = protocolMatch ? protocolMatch[0] : linkifyMatchResult ? linkifyMatchResult.schema === '' ? linkifyMatchResult.url.replace(/^http:\/\//, 'https://') : linkifyMatchResult.url : null;
|
|
51087
|
+
if (url) {
|
|
51041
51088
|
var urlMetadata = oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[url];
|
|
51042
51089
|
var metadata = {};
|
|
51043
51090
|
if (urlMetadata) {
|
|
@@ -58018,6 +58065,7 @@ exports.SendMessage = SendMessageInput;
|
|
|
58018
58065
|
exports.THEME_COLORS = THEME_COLORS;
|
|
58019
58066
|
exports.blockUsers = blockUsers;
|
|
58020
58067
|
exports.createOrGetDirectChannel = createOrGetDirectChannel;
|
|
58068
|
+
exports.extractUrlMatches = extractUrlMatches;
|
|
58021
58069
|
exports.handleGetMessage = handleGetMessage;
|
|
58022
58070
|
exports.handleSendMessage = handleSendMessage;
|
|
58023
58071
|
exports.switchChannelActiveChannel = switchChannelActiveChannel;
|
package/index.modern.js
CHANGED
|
@@ -20942,7 +20942,7 @@ function loadMorePollVotes(action) {
|
|
|
20942
20942
|
}
|
|
20943
20943
|
var REFRESH_WINDOW_HALF = 30;
|
|
20944
20944
|
function refreshCacheAroundMessage(action) {
|
|
20945
|
-
var _action$payload0, channelId, messageId, _action$payload0$appl, applyVisibleWindow, connectionState, activeChannelId, activeMessages, activeConfirmedMessages, centerMessageIndex, refreshAnchorId, previousLimit, nextLimit, SceytChatClient, messageQueryBuilder, messageQuery, prevResult, pivotId, nextResult, loadedMessages, firstId, lastId, activeById, changed, filteredPendingMessages, _t53, _t54, _t55;
|
|
20945
|
+
var _action$payload0, channelId, messageId, _action$payload0$appl, applyVisibleWindow, connectionState, activeChannelId, activeMessages, activeConfirmedMessages, centerMessageIndex, refreshAnchorId, previousLimit, nextLimit, SceytChatClient, messageQueryBuilder, messageQuery, prevResult, pivotId, nextResult, loadedMessages, firstId, lastId, currentActiveMessages, currentActiveConfirmedMessages, activeById, changed, filteredPendingMessages, _t53, _t54, _t55;
|
|
20946
20946
|
return _regenerator().w(function (_context63) {
|
|
20947
20947
|
while (1) switch (_context63.p = _context63.n) {
|
|
20948
20948
|
case 0:
|
|
@@ -21044,8 +21044,18 @@ function refreshCacheAroundMessage(action) {
|
|
|
21044
21044
|
_context63.n = 13;
|
|
21045
21045
|
return call(loadOGMetadataForLinkMessages, loadedMessages, true);
|
|
21046
21046
|
case 13:
|
|
21047
|
+
currentActiveMessages = store.getState().MessageReducer.activeChannelMessages || [];
|
|
21048
|
+
currentActiveConfirmedMessages = currentActiveMessages.filter(function (message) {
|
|
21049
|
+
return !!message.id;
|
|
21050
|
+
});
|
|
21051
|
+
if (sameConfirmedWindow(currentActiveConfirmedMessages, activeConfirmedMessages)) {
|
|
21052
|
+
_context63.n = 14;
|
|
21053
|
+
break;
|
|
21054
|
+
}
|
|
21055
|
+
return _context63.a(2);
|
|
21056
|
+
case 14:
|
|
21047
21057
|
if (!sameConfirmedWindow(activeConfirmedMessages, loadedMessages)) {
|
|
21048
|
-
_context63.n =
|
|
21058
|
+
_context63.n = 16;
|
|
21049
21059
|
break;
|
|
21050
21060
|
}
|
|
21051
21061
|
activeById = new Map(activeConfirmedMessages.map(function (currentMessage) {
|
|
@@ -21058,44 +21068,44 @@ function refreshCacheAroundMessage(action) {
|
|
|
21058
21068
|
return JSON.stringify(existing) !== JSON.stringify(loaded);
|
|
21059
21069
|
});
|
|
21060
21070
|
if (!(changed.length > 0)) {
|
|
21061
|
-
_context63.n =
|
|
21071
|
+
_context63.n = 15;
|
|
21062
21072
|
break;
|
|
21063
21073
|
}
|
|
21064
|
-
_context63.n =
|
|
21074
|
+
_context63.n = 15;
|
|
21065
21075
|
return put(patchMessagesAC(changed));
|
|
21066
|
-
case 14:
|
|
21067
|
-
return _context63.a(2);
|
|
21068
21076
|
case 15:
|
|
21077
|
+
return _context63.a(2);
|
|
21078
|
+
case 16:
|
|
21069
21079
|
if (applyVisibleWindow) {
|
|
21070
|
-
_context63.n =
|
|
21080
|
+
_context63.n = 17;
|
|
21071
21081
|
break;
|
|
21072
21082
|
}
|
|
21073
21083
|
return _context63.a(2);
|
|
21074
|
-
case 16:
|
|
21075
|
-
_context63.n = 17;
|
|
21076
|
-
return put(setMessagesAC(JSON.parse(JSON.stringify(loadedMessages)), channelId));
|
|
21077
21084
|
case 17:
|
|
21085
|
+
_context63.n = 18;
|
|
21086
|
+
return put(setMessagesAC(JSON.parse(JSON.stringify(loadedMessages)), channelId));
|
|
21087
|
+
case 18:
|
|
21078
21088
|
filteredPendingMessages = getFilteredPendingMessages(channelId, loadedMessages);
|
|
21079
21089
|
if (!(filteredPendingMessages.length > 0)) {
|
|
21080
|
-
_context63.n =
|
|
21090
|
+
_context63.n = 20;
|
|
21081
21091
|
break;
|
|
21082
21092
|
}
|
|
21083
|
-
_context63.n = 18;
|
|
21084
|
-
return put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
21085
|
-
case 18:
|
|
21086
21093
|
_context63.n = 19;
|
|
21087
|
-
return
|
|
21094
|
+
return put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
|
|
21088
21095
|
case 19:
|
|
21089
|
-
_context63.n =
|
|
21090
|
-
|
|
21096
|
+
_context63.n = 20;
|
|
21097
|
+
return call(loadOGMetadataForLinkMessages, filteredPendingMessages, true);
|
|
21091
21098
|
case 20:
|
|
21092
|
-
_context63.
|
|
21099
|
+
_context63.n = 22;
|
|
21100
|
+
break;
|
|
21101
|
+
case 21:
|
|
21102
|
+
_context63.p = 21;
|
|
21093
21103
|
_t55 = _context63.v;
|
|
21094
21104
|
log.error('error in refreshCacheAroundMessage', _t55);
|
|
21095
|
-
case
|
|
21105
|
+
case 22:
|
|
21096
21106
|
return _context63.a(2);
|
|
21097
21107
|
}
|
|
21098
|
-
}, _marked57, null, [[0,
|
|
21108
|
+
}, _marked57, null, [[0, 21]]);
|
|
21099
21109
|
}
|
|
21100
21110
|
function MessageSaga() {
|
|
21101
21111
|
return _regenerator().w(function (_context64) {
|
|
@@ -21988,6 +21998,42 @@ var MessageStatusIcon = function MessageStatusIcon(_ref) {
|
|
|
21988
21998
|
});
|
|
21989
21999
|
}
|
|
21990
22000
|
};
|
|
22001
|
+
function extractUrlMatches(text) {
|
|
22002
|
+
var results = [];
|
|
22003
|
+
var protocolRegex = /https?:\/\/\S+/g;
|
|
22004
|
+
var m;
|
|
22005
|
+
while ((m = protocolRegex.exec(text)) !== null) {
|
|
22006
|
+
results.push({
|
|
22007
|
+
text: m[0],
|
|
22008
|
+
url: m[0],
|
|
22009
|
+
index: m.index
|
|
22010
|
+
});
|
|
22011
|
+
}
|
|
22012
|
+
var linkifyResults = new LinkifyIt().match(text);
|
|
22013
|
+
if (linkifyResults) {
|
|
22014
|
+
for (var _iterator = _createForOfIteratorHelperLoose(linkifyResults), _step; !(_step = _iterator()).done;) {
|
|
22015
|
+
var lm = _step.value;
|
|
22016
|
+
if (lm.schema === '') {
|
|
22017
|
+
results.push({
|
|
22018
|
+
text: lm.text,
|
|
22019
|
+
url: lm.url.replace(/^http:\/\//, 'https://'),
|
|
22020
|
+
index: lm.index
|
|
22021
|
+
});
|
|
22022
|
+
}
|
|
22023
|
+
}
|
|
22024
|
+
}
|
|
22025
|
+
results.sort(function (a, b) {
|
|
22026
|
+
return a.index - b.index;
|
|
22027
|
+
});
|
|
22028
|
+
return results.length > 0 ? results.map(function (_ref2) {
|
|
22029
|
+
var text = _ref2.text,
|
|
22030
|
+
url = _ref2.url;
|
|
22031
|
+
return {
|
|
22032
|
+
text: text,
|
|
22033
|
+
url: url
|
|
22034
|
+
};
|
|
22035
|
+
}) : null;
|
|
22036
|
+
}
|
|
21991
22037
|
var linkifyTextPart = function linkifyTextPart(textPart, match, target, isInviteLink, onInviteLinkClick) {
|
|
21992
22038
|
if (target === void 0) {
|
|
21993
22039
|
target = '_blank';
|
|
@@ -22036,26 +22082,25 @@ var linkifyTextPart = function linkifyTextPart(textPart, match, target, isInvite
|
|
|
22036
22082
|
});
|
|
22037
22083
|
return newMessageText || textPart;
|
|
22038
22084
|
};
|
|
22039
|
-
var MessageTextFormat = function MessageTextFormat(
|
|
22040
|
-
var text =
|
|
22041
|
-
message =
|
|
22042
|
-
contactsMap =
|
|
22043
|
-
getFromContacts =
|
|
22044
|
-
isLastMessage =
|
|
22045
|
-
asSampleText =
|
|
22046
|
-
accentColor =
|
|
22047
|
-
textSecondary =
|
|
22048
|
-
onMentionNameClick =
|
|
22049
|
-
shouldOpenUserProfileForMention =
|
|
22050
|
-
unsupportedMessage =
|
|
22051
|
-
|
|
22052
|
-
target =
|
|
22053
|
-
|
|
22054
|
-
isInviteLink =
|
|
22055
|
-
onInviteLinkClick =
|
|
22085
|
+
var MessageTextFormat = function MessageTextFormat(_ref3) {
|
|
22086
|
+
var text = _ref3.text,
|
|
22087
|
+
message = _ref3.message,
|
|
22088
|
+
contactsMap = _ref3.contactsMap,
|
|
22089
|
+
getFromContacts = _ref3.getFromContacts,
|
|
22090
|
+
isLastMessage = _ref3.isLastMessage,
|
|
22091
|
+
asSampleText = _ref3.asSampleText,
|
|
22092
|
+
accentColor = _ref3.accentColor,
|
|
22093
|
+
textSecondary = _ref3.textSecondary,
|
|
22094
|
+
onMentionNameClick = _ref3.onMentionNameClick,
|
|
22095
|
+
shouldOpenUserProfileForMention = _ref3.shouldOpenUserProfileForMention,
|
|
22096
|
+
unsupportedMessage = _ref3.unsupportedMessage,
|
|
22097
|
+
_ref3$target = _ref3.target,
|
|
22098
|
+
target = _ref3$target === void 0 ? '_blank' : _ref3$target,
|
|
22099
|
+
_ref3$isInviteLink = _ref3.isInviteLink,
|
|
22100
|
+
isInviteLink = _ref3$isInviteLink === void 0 ? false : _ref3$isInviteLink,
|
|
22101
|
+
onInviteLinkClick = _ref3.onInviteLinkClick;
|
|
22056
22102
|
try {
|
|
22057
22103
|
var messageText = [];
|
|
22058
|
-
var linkify = new LinkifyIt();
|
|
22059
22104
|
var messageBodyAttributes = message.bodyAttributes && JSON.parse(JSON.stringify(message.bodyAttributes));
|
|
22060
22105
|
if (unsupportedMessage) {
|
|
22061
22106
|
return 'This message is not supported. Update your app to view this message.';
|
|
@@ -22068,12 +22113,12 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
22068
22113
|
var attributeOffset = attribute.offset;
|
|
22069
22114
|
try {
|
|
22070
22115
|
var firstPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(nextPartIndex || 0, attributeOffset) : '');
|
|
22071
|
-
var firstPartMatch = firstPart ?
|
|
22116
|
+
var firstPartMatch = firstPart ? extractUrlMatches(firstPart) : null;
|
|
22072
22117
|
if (!isLastMessage && !asSampleText && firstPartMatch) {
|
|
22073
22118
|
firstPart = linkifyTextPart(firstPart, firstPartMatch, target, isInviteLink, onInviteLinkClick);
|
|
22074
22119
|
}
|
|
22075
22120
|
var secondPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(attributeOffset + attribute.length) : '');
|
|
22076
|
-
var secondPartMatch = secondPart ?
|
|
22121
|
+
var secondPartMatch = secondPart ? extractUrlMatches(secondPart) : null;
|
|
22077
22122
|
if (!isLastMessage && !asSampleText && secondPartMatch) {
|
|
22078
22123
|
secondPart = linkifyTextPart(secondPart, secondPartMatch, target, isInviteLink, onInviteLinkClick);
|
|
22079
22124
|
}
|
|
@@ -22133,7 +22178,7 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
22133
22178
|
} else {
|
|
22134
22179
|
nextPartIndex = attributeOffset + attribute.length;
|
|
22135
22180
|
var _textPart = "" + text.slice(attributeOffset, attributeOffset + attribute.length);
|
|
22136
|
-
var match =
|
|
22181
|
+
var match = extractUrlMatches(_textPart);
|
|
22137
22182
|
var newTextPart = _textPart;
|
|
22138
22183
|
if (!isLastMessage && !asSampleText && match) {
|
|
22139
22184
|
newTextPart = linkifyTextPart(_textPart, match, target, isInviteLink, onInviteLinkClick);
|
|
@@ -22150,7 +22195,7 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
22150
22195
|
}
|
|
22151
22196
|
});
|
|
22152
22197
|
} else {
|
|
22153
|
-
var match =
|
|
22198
|
+
var match = extractUrlMatches(text);
|
|
22154
22199
|
if (!isLastMessage && !asSampleText && match) {
|
|
22155
22200
|
messageText = linkifyTextPart(text, match, target, isInviteLink, onInviteLinkClick);
|
|
22156
22201
|
}
|
|
@@ -44669,6 +44714,7 @@ function useChatController(_ref5) {
|
|
|
44669
44714
|
restoreRef.current = null;
|
|
44670
44715
|
pendingNewestCountRef.current = 0;
|
|
44671
44716
|
setPendingNewestCount(0);
|
|
44717
|
+
unreadRestoreCompletedRef.current = true;
|
|
44672
44718
|
var container = scrollRef.current;
|
|
44673
44719
|
var currentChannelId = (_channelRef$current = channelRef.current) === null || _channelRef$current === void 0 ? void 0 : _channelRef$current.id;
|
|
44674
44720
|
var pendingLatestServerSync = ((_pendingLatestJumpRef = pendingLatestJumpRef.current) === null || _pendingLatestJumpRef === void 0 ? void 0 : _pendingLatestJumpRef.channelId) === currentChannelId && ((_pendingLatestJumpRef2 = pendingLatestJumpRef.current) === null || _pendingLatestJumpRef2 === void 0 ? void 0 : _pendingLatestJumpRef2.needsServerSync);
|
|
@@ -45535,6 +45581,7 @@ function useChatController(_ref5) {
|
|
|
45535
45581
|
restoreRef.current = null;
|
|
45536
45582
|
viewIsAtLatestRef.current = true;
|
|
45537
45583
|
setIsViewingLatest(true);
|
|
45584
|
+
lockJumpScrolling(true, 'latest');
|
|
45538
45585
|
scrollToLatestEdge(container, 'smooth');
|
|
45539
45586
|
rememberLatestEdge();
|
|
45540
45587
|
return;
|
|
@@ -45595,7 +45642,7 @@ function useChatController(_ref5) {
|
|
|
45595
45642
|
}
|
|
45596
45643
|
rememberLatestEdge();
|
|
45597
45644
|
}
|
|
45598
|
-
}, [channel.id, unreadMessageId, isActiveEdgeRequestCurrent, dispatch, messages, unreadScrollTo, clearJumpBlur, hasNext, isScrollInteractionActive]);
|
|
45645
|
+
}, [channel.id, unreadMessageId, isActiveEdgeRequestCurrent, dispatch, messages, unreadScrollTo, clearJumpBlur, hasNext, isScrollInteractionActive, lockJumpScrolling]);
|
|
45599
45646
|
useEffect(function () {
|
|
45600
45647
|
if (!unreadScrollTo || !unreadMessageId || !messages.length || unreadRestoreCompletedRef.current) {
|
|
45601
45648
|
return;
|
|
@@ -50750,10 +50797,10 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
50750
50797
|
editorState.read(function () {
|
|
50751
50798
|
var root = $getRoot();
|
|
50752
50799
|
var textContent = root.getTextContent();
|
|
50753
|
-
var
|
|
50754
|
-
|
|
50755
|
-
|
|
50756
|
-
|
|
50800
|
+
var protocolMatch = /https?:\/\/\S+/.exec(textContent);
|
|
50801
|
+
var linkifyMatchResult = !protocolMatch ? linkify.match(textContent) : null;
|
|
50802
|
+
var firstUrl = protocolMatch ? protocolMatch[0] : linkifyMatchResult !== null && linkifyMatchResult !== void 0 && linkifyMatchResult[0] ? linkifyMatchResult[0].schema === '' ? linkifyMatchResult[0].url.replace(/^http:\/\//, 'https://') : linkifyMatchResult[0].url : null;
|
|
50803
|
+
if (firstUrl) {
|
|
50757
50804
|
if (firstUrl !== detectedUrl) {
|
|
50758
50805
|
closePreviewWithAnimation(function () {
|
|
50759
50806
|
if (!dismissedUrls.has(firstUrl)) {
|
|
@@ -50913,11 +50960,11 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
50913
50960
|
}
|
|
50914
50961
|
var linkAttachment;
|
|
50915
50962
|
if (messageTexToSend) {
|
|
50916
|
-
var
|
|
50917
|
-
var
|
|
50918
|
-
|
|
50919
|
-
|
|
50920
|
-
|
|
50963
|
+
var _LinkifyIt$match;
|
|
50964
|
+
var protocolMatch = /https?:\/\/\S+/.exec(messageTexToSend);
|
|
50965
|
+
var linkifyMatchResult = !protocolMatch ? (_LinkifyIt$match = new LinkifyIt().match(messageTexToSend)) === null || _LinkifyIt$match === void 0 ? void 0 : _LinkifyIt$match[0] : null;
|
|
50966
|
+
var url = protocolMatch ? protocolMatch[0] : linkifyMatchResult ? linkifyMatchResult.schema === '' ? linkifyMatchResult.url.replace(/^http:\/\//, 'https://') : linkifyMatchResult.url : null;
|
|
50967
|
+
if (url) {
|
|
50921
50968
|
var urlMetadata = oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[url];
|
|
50922
50969
|
var metadata = {};
|
|
50923
50970
|
if (urlMetadata) {
|
|
@@ -51032,11 +51079,11 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
51032
51079
|
if (messageTexToSend) {
|
|
51033
51080
|
var linkAttachment;
|
|
51034
51081
|
if (messageTexToSend) {
|
|
51035
|
-
var
|
|
51036
|
-
var
|
|
51037
|
-
|
|
51038
|
-
|
|
51039
|
-
|
|
51082
|
+
var _LinkifyIt$match2;
|
|
51083
|
+
var protocolMatch = /https?:\/\/\S+/.exec(messageTexToSend);
|
|
51084
|
+
var linkifyMatchResult = !protocolMatch ? (_LinkifyIt$match2 = new LinkifyIt().match(messageTexToSend)) === null || _LinkifyIt$match2 === void 0 ? void 0 : _LinkifyIt$match2[0] : null;
|
|
51085
|
+
var url = protocolMatch ? protocolMatch[0] : linkifyMatchResult ? linkifyMatchResult.schema === '' ? linkifyMatchResult.url.replace(/^http:\/\//, 'https://') : linkifyMatchResult.url : null;
|
|
51086
|
+
if (url) {
|
|
51040
51087
|
var urlMetadata = oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[url];
|
|
51041
51088
|
var metadata = {};
|
|
51042
51089
|
if (urlMetadata) {
|
|
@@ -57991,5 +58038,5 @@ var unBlockUsers = function unBlockUsers(userIds, callback) {
|
|
|
57991
58038
|
});
|
|
57992
58039
|
};
|
|
57993
58040
|
|
|
57994
|
-
export { Attachment$1 as Attachment, Avatar, Channel, ChannelDetailsContainer as ChannelDetails, ChannelList, ChannelSearch, Chat, ChatHeader, CreateChannel, DropDown, EmojisPopup, ForwardMessagePopup, FrequentlyEmojis, MESSAGE_TYPE, MessagesContainer as MessageList, MessageStatusIcon, MessageTextFormat, MessagesScrollToBottomButton, MessagesScrollToUnreadMentionsButton, MessagesSearch, OGMetadata, PollMessage, SceytChatContainer as SceytChat, SendMessageInput as SendMessage, THEME_COLORS, blockUsers, createOrGetDirectChannel, handleGetMessage, handleSendMessage, switchChannelActiveChannel, unBlockUsers };
|
|
58041
|
+
export { Attachment$1 as Attachment, Avatar, Channel, ChannelDetailsContainer as ChannelDetails, ChannelList, ChannelSearch, Chat, ChatHeader, CreateChannel, DropDown, EmojisPopup, ForwardMessagePopup, FrequentlyEmojis, MESSAGE_TYPE, MessagesContainer as MessageList, MessageStatusIcon, MessageTextFormat, MessagesScrollToBottomButton, MessagesScrollToUnreadMentionsButton, MessagesSearch, OGMetadata, PollMessage, SceytChatContainer as SceytChat, SendMessageInput as SendMessage, THEME_COLORS, blockUsers, createOrGetDirectChannel, extractUrlMatches, handleGetMessage, handleSendMessage, switchChannelActiveChannel, unBlockUsers };
|
|
57995
58042
|
//# sourceMappingURL=index.modern.js.map
|
package/messageUtils/index.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ declare const MessageStatusIcon: ({ messageStatus, messageStatusDisplayingType,
|
|
|
8
8
|
readIconColor?: string | undefined;
|
|
9
9
|
accentColor?: string | undefined;
|
|
10
10
|
}) => React.JSX.Element;
|
|
11
|
+
declare function extractUrlMatches(text: string): Array<{
|
|
12
|
+
text: string;
|
|
13
|
+
url: string;
|
|
14
|
+
}> | null;
|
|
11
15
|
declare const MessageTextFormat: ({ text, message, contactsMap, getFromContacts, isLastMessage, asSampleText, accentColor, textSecondary, onMentionNameClick, shouldOpenUserProfileForMention, unsupportedMessage, target, isInviteLink, onInviteLinkClick }: {
|
|
12
16
|
text: string;
|
|
13
17
|
message: any;
|
|
@@ -24,4 +28,4 @@ declare const MessageTextFormat: ({ text, message, contactsMap, getFromContacts,
|
|
|
24
28
|
isInviteLink?: boolean | undefined;
|
|
25
29
|
onInviteLinkClick?: ((key: string) => void) | undefined;
|
|
26
30
|
}) => any;
|
|
27
|
-
export { MessageStatusIcon, MessageTextFormat };
|
|
31
|
+
export { MessageStatusIcon, MessageTextFormat, extractUrlMatches };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|