sceyt-chat-react-uikit 1.8.7-beta.5 → 1.8.7-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Message/Message.types.d.ts +0 -2
- package/components/Message/MessageBody/index.d.ts +1 -2
- package/components/Message/index.d.ts +1 -1
- package/components/Messages/MessageList/index.d.ts +0 -1
- package/components/Messages/index.d.ts +0 -1
- package/index.js +9 -130
- package/index.modern.js +9 -130
- package/messageUtils/index.d.ts +1 -2
- package/package.json +1 -2
|
@@ -65,7 +65,6 @@ interface ICustomMessageItem {
|
|
|
65
65
|
handleOpenUserProfile: (user: IUser) => void;
|
|
66
66
|
unsupportedMessage: boolean;
|
|
67
67
|
onInviteLinkClick?: (key: string) => void;
|
|
68
|
-
onPhoneNumberClick?: (phoneNumber: string, dataPhone: string) => void;
|
|
69
68
|
ifLatestAndHasNotPreview: boolean;
|
|
70
69
|
}
|
|
71
70
|
export interface IMessageProps {
|
|
@@ -230,6 +229,5 @@ export interface IMessageProps {
|
|
|
230
229
|
collapsedLinesLimit?: number;
|
|
231
230
|
createChatOnAvatarTap?: boolean;
|
|
232
231
|
ifLatestAndHasNotPreview: boolean;
|
|
233
|
-
onPhoneNumberClick?: (phoneNumber: string, dataPhone: string) => void;
|
|
234
232
|
}
|
|
235
233
|
export {};
|
|
@@ -138,9 +138,8 @@ interface IMessageBodyProps {
|
|
|
138
138
|
ogMetadataProps?: OGMetadataProps;
|
|
139
139
|
unsupportedMessage: boolean;
|
|
140
140
|
onInviteLinkClick?: (key: string) => void;
|
|
141
|
-
onPhoneNumberClick?: (phoneNumber: string, dataPhone: string) => void;
|
|
142
141
|
ifLatestAndHasNotPreview: boolean;
|
|
143
142
|
collapsedLinesLimit?: number;
|
|
144
143
|
}
|
|
145
|
-
declare const _default: React.MemoExoticComponent<({ message, channel, MessageActionsMenu, handleScrollToRepliedMessage, handleMediaItemClick, isPendingMessage, prevMessage, nextMessage, unreadMessageId, isThreadMessage, fontFamily, ownMessageOnRightSide, showSenderNameOnDirectChannel, showSenderNameOnGroupChannel, showSenderNameOnOwnMessages, messageStatusAndTimePosition, messageStatusDisplayingType, outgoingMessageStyles, incomingMessageStyles, ownRepliedMessageBackground, incomingRepliedMessageBackground, showMessageStatus, showMessageTimeAndStatusOnlyOnHover, showMessageTime, showMessageStatusForEachMessage, showMessageTimeForEachMessage, messageReaction, editMessage, copyMessage, replyMessage, replyMessageInThread, deleteMessage, selectMessage, showInfoMessage, allowEditDeleteIncomingMessage, forwardMessage, reportMessage, reactionIcon, editIcon, copyIcon, replyIcon, replyInThreadIcon, forwardIcon, deleteIcon, infoIcon, selectIcon, retractVoteIcon, endVoteIcon, starIcon, staredIcon, reportIcon, reactionIconOrder, editIconOrder, copyIconOrder, replyIconOrder, replyInThreadIconOrder, forwardIconOrder, deleteIconOrder, infoIconOrder, selectIconOrder, starIconOrder, reportIconOrder, reactionIconTooltipText, editIconTooltipText, copyIconTooltipText, replyIconTooltipText, replyInThreadIconTooltipText, forwardIconTooltipText, deleteIconTooltipText, selectIconTooltipText, starIconTooltipText, reportIconTooltipText, infoIconTooltipText, messageActionIconsColor, messageStatusSize, messageStatusColor, messageReadStatusColor, messageStateFontSize, messageStateColor, messageTimeFontSize, messageTimeColor, messageStatusAndTimeLineHeight, messageTimeColorOnAttachment, fileAttachmentsIcon, fileAttachmentsBoxWidth, fileAttachmentsBoxBorder, fileAttachmentsTitleColor, fileAttachmentsSizeColor, imageAttachmentMaxWidth, imageAttachmentMaxHeight, videoAttachmentMaxWidth, videoAttachmentMaxHeight, emojisCategoryIconsPosition, emojisContainerBorderRadius, fixEmojiCategoriesTitleOnTop, selectedMessagesMap, contactsMap, messageTextFontSize, messageTextLineHeight, handleToggleForwardMessagePopup, handleToggleInfoMessagePopupOpen, messageActionsShow, handleRetractVote, handleEndVote, closeMessageActions, handleDeletePendingMessage, handleReplyMessage, handleToggleDeleteMessagePopup, handleToggleReportPopupOpen, handleResendMessage, handleOpenEmojis, emojisPopupOpen, setEmojisPopupOpen, emojisPopupPosition, frequentlyEmojisOpen, handleCopyMessage, toggleEditMode, handleSelectMessage, handleMouseEnter, handleMouseLeave, handleReactionAddDelete, handleCreateChat, messageTextRef, handleOpenUserProfile, shouldOpenUserProfileForMention, ogMetadataProps, unsupportedMessage, onInviteLinkClick,
|
|
144
|
+
declare const _default: React.MemoExoticComponent<({ message, channel, MessageActionsMenu, handleScrollToRepliedMessage, handleMediaItemClick, isPendingMessage, prevMessage, nextMessage, unreadMessageId, isThreadMessage, fontFamily, ownMessageOnRightSide, showSenderNameOnDirectChannel, showSenderNameOnGroupChannel, showSenderNameOnOwnMessages, messageStatusAndTimePosition, messageStatusDisplayingType, outgoingMessageStyles, incomingMessageStyles, ownRepliedMessageBackground, incomingRepliedMessageBackground, showMessageStatus, showMessageTimeAndStatusOnlyOnHover, showMessageTime, showMessageStatusForEachMessage, showMessageTimeForEachMessage, messageReaction, editMessage, copyMessage, replyMessage, replyMessageInThread, deleteMessage, selectMessage, showInfoMessage, allowEditDeleteIncomingMessage, forwardMessage, reportMessage, reactionIcon, editIcon, copyIcon, replyIcon, replyInThreadIcon, forwardIcon, deleteIcon, infoIcon, selectIcon, retractVoteIcon, endVoteIcon, starIcon, staredIcon, reportIcon, reactionIconOrder, editIconOrder, copyIconOrder, replyIconOrder, replyInThreadIconOrder, forwardIconOrder, deleteIconOrder, infoIconOrder, selectIconOrder, starIconOrder, reportIconOrder, reactionIconTooltipText, editIconTooltipText, copyIconTooltipText, replyIconTooltipText, replyInThreadIconTooltipText, forwardIconTooltipText, deleteIconTooltipText, selectIconTooltipText, starIconTooltipText, reportIconTooltipText, infoIconTooltipText, messageActionIconsColor, messageStatusSize, messageStatusColor, messageReadStatusColor, messageStateFontSize, messageStateColor, messageTimeFontSize, messageTimeColor, messageStatusAndTimeLineHeight, messageTimeColorOnAttachment, fileAttachmentsIcon, fileAttachmentsBoxWidth, fileAttachmentsBoxBorder, fileAttachmentsTitleColor, fileAttachmentsSizeColor, imageAttachmentMaxWidth, imageAttachmentMaxHeight, videoAttachmentMaxWidth, videoAttachmentMaxHeight, emojisCategoryIconsPosition, emojisContainerBorderRadius, fixEmojiCategoriesTitleOnTop, selectedMessagesMap, contactsMap, messageTextFontSize, messageTextLineHeight, handleToggleForwardMessagePopup, handleToggleInfoMessagePopupOpen, messageActionsShow, handleRetractVote, handleEndVote, closeMessageActions, handleDeletePendingMessage, handleReplyMessage, handleToggleDeleteMessagePopup, handleToggleReportPopupOpen, handleResendMessage, handleOpenEmojis, emojisPopupOpen, setEmojisPopupOpen, emojisPopupPosition, frequentlyEmojisOpen, handleCopyMessage, toggleEditMode, handleSelectMessage, handleMouseEnter, handleMouseLeave, handleReactionAddDelete, handleCreateChat, messageTextRef, handleOpenUserProfile, shouldOpenUserProfileForMention, ogMetadataProps, unsupportedMessage, onInviteLinkClick, collapsedLinesLimit, ifLatestAndHasNotPreview }: IMessageBodyProps) => React.JSX.Element>;
|
|
146
145
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IMessageProps } from './Message.types';
|
|
3
|
-
declare const _default: React.MemoExoticComponent<({ message, channel, MessageActionsMenu, CustomMessageItem, handleScrollToRepliedMessage, handleMediaItemClick, stopScrolling, isPendingMessage, prevMessage, nextMessage, setLastVisibleMessageId, queueReadMarker, queueDeliveredMarker, disableAutoReadTracking, isUnreadMessage, nextMessageStartsUnreadSection, unreadMessageId, isThreadMessage, fontFamily, ownMessageOnRightSide, messageWidthPercent, showSenderNameOnDirectChannel, showSenderNameOnGroupChannel, showSenderNameOnOwnMessages, messageStatusAndTimePosition, messageStatusDisplayingType, outgoingMessageStyles, incomingMessageStyles, ownRepliedMessageBackground, incomingRepliedMessageBackground, showOwnAvatar, showMessageStatus, showMessageTimeAndStatusOnlyOnHover, showMessageTime, showMessageStatusForEachMessage, showMessageTimeForEachMessage, hoverBackground, messageReaction, editMessage, copyMessage, replyMessage, replyMessageInThread, deleteMessage, selectMessage, showInfoMessage, allowEditDeleteIncomingMessage, forwardMessage, reportMessage, reactionIcon, editIcon, copyIcon, replyIcon, replyInThreadIcon, forwardIcon, deleteIcon, selectIcon, starIcon, staredIcon, reportIcon, retractVoteIcon, endVoteIcon, reactionIconOrder, openFrequentlyUsedReactions, editIconOrder, copyIconOrder, replyIconOrder, replyInThreadIconOrder, forwardIconOrder, deleteIconOrder, selectIconOrder, starIconOrder, reportIconOrder, infoIconOrder, reactionIconTooltipText, editIconTooltipText, copyIconTooltipText, replyIconTooltipText, replyInThreadIconTooltipText, forwardIconTooltipText, deleteIconTooltipText, selectIconTooltipText, starIconTooltipText, reportIconTooltipText, infoIconTooltipText, messageActionIconsColor, messageStatusSize, messageStatusColor, messageReadStatusColor, messageStateFontSize, messageStateColor, messageTimeFontSize, messageTimeColor, messageStatusAndTimeLineHeight, fileAttachmentsIcon, reactionsDisplayCount, showEachReactionCount, showTotalReactionCount, reactionItemBorder, reactionItemBorderRadius, reactionItemBackground, reactionItemPadding, reactionItemMargin, reactionsFontSize, reactionsContainerBoxShadow, reactionsContainerBorder, reactionsContainerBorderRadius, reactionsContainerBackground, reactionsContainerPadding, reactionsContainerTopPosition, reactionsDetailsPopupBorderRadius, reactionsDetailsPopupHeaderItemsStyle, fileAttachmentsBoxWidth, fileAttachmentsBoxBorder, fileAttachmentsTitleColor, fileAttachmentsSizeColor, imageAttachmentMaxWidth, imageAttachmentMaxHeight, videoAttachmentMaxWidth, videoAttachmentMaxHeight, emojisCategoryIconsPosition, emojisContainerBorderRadius, fixEmojiCategoriesTitleOnTop, sameUserMessageSpacing, differentUserMessageSpacing, selectedMessagesMap, contactsMap, openedMessageMenuId, tabIsActive, tabIsActiveRef, connectionStatus, messageTextFontSize, messageTextLineHeight, messageTimeColorOnAttachment, shouldOpenUserProfileForMention, ogMetadataProps, showInfoMessageProps, collapsedLinesLimit, createChatOnAvatarTap, ifLatestAndHasNotPreview
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ message, channel, MessageActionsMenu, CustomMessageItem, handleScrollToRepliedMessage, handleMediaItemClick, stopScrolling, isPendingMessage, prevMessage, nextMessage, setLastVisibleMessageId, queueReadMarker, queueDeliveredMarker, disableAutoReadTracking, isUnreadMessage, nextMessageStartsUnreadSection, unreadMessageId, isThreadMessage, fontFamily, ownMessageOnRightSide, messageWidthPercent, showSenderNameOnDirectChannel, showSenderNameOnGroupChannel, showSenderNameOnOwnMessages, messageStatusAndTimePosition, messageStatusDisplayingType, outgoingMessageStyles, incomingMessageStyles, ownRepliedMessageBackground, incomingRepliedMessageBackground, showOwnAvatar, showMessageStatus, showMessageTimeAndStatusOnlyOnHover, showMessageTime, showMessageStatusForEachMessage, showMessageTimeForEachMessage, hoverBackground, messageReaction, editMessage, copyMessage, replyMessage, replyMessageInThread, deleteMessage, selectMessage, showInfoMessage, allowEditDeleteIncomingMessage, forwardMessage, reportMessage, reactionIcon, editIcon, copyIcon, replyIcon, replyInThreadIcon, forwardIcon, deleteIcon, selectIcon, starIcon, staredIcon, reportIcon, retractVoteIcon, endVoteIcon, reactionIconOrder, openFrequentlyUsedReactions, editIconOrder, copyIconOrder, replyIconOrder, replyInThreadIconOrder, forwardIconOrder, deleteIconOrder, selectIconOrder, starIconOrder, reportIconOrder, infoIconOrder, reactionIconTooltipText, editIconTooltipText, copyIconTooltipText, replyIconTooltipText, replyInThreadIconTooltipText, forwardIconTooltipText, deleteIconTooltipText, selectIconTooltipText, starIconTooltipText, reportIconTooltipText, infoIconTooltipText, messageActionIconsColor, messageStatusSize, messageStatusColor, messageReadStatusColor, messageStateFontSize, messageStateColor, messageTimeFontSize, messageTimeColor, messageStatusAndTimeLineHeight, fileAttachmentsIcon, reactionsDisplayCount, showEachReactionCount, showTotalReactionCount, reactionItemBorder, reactionItemBorderRadius, reactionItemBackground, reactionItemPadding, reactionItemMargin, reactionsFontSize, reactionsContainerBoxShadow, reactionsContainerBorder, reactionsContainerBorderRadius, reactionsContainerBackground, reactionsContainerPadding, reactionsContainerTopPosition, reactionsDetailsPopupBorderRadius, reactionsDetailsPopupHeaderItemsStyle, fileAttachmentsBoxWidth, fileAttachmentsBoxBorder, fileAttachmentsTitleColor, fileAttachmentsSizeColor, imageAttachmentMaxWidth, imageAttachmentMaxHeight, videoAttachmentMaxWidth, videoAttachmentMaxHeight, emojisCategoryIconsPosition, emojisContainerBorderRadius, fixEmojiCategoriesTitleOnTop, sameUserMessageSpacing, differentUserMessageSpacing, selectedMessagesMap, contactsMap, openedMessageMenuId, tabIsActive, tabIsActiveRef, connectionStatus, messageTextFontSize, messageTextLineHeight, messageTimeColorOnAttachment, shouldOpenUserProfileForMention, ogMetadataProps, showInfoMessageProps, collapsedLinesLimit, createChatOnAvatarTap, ifLatestAndHasNotPreview }: IMessageProps) => React.JSX.Element>;
|
|
4
4
|
export default _default;
|
|
@@ -208,7 +208,6 @@ interface MessagesProps {
|
|
|
208
208
|
collapsedLinesLimit?: number;
|
|
209
209
|
createChatOnAvatarTap?: boolean;
|
|
210
210
|
allowSendAttachment?: boolean;
|
|
211
|
-
onPhoneNumberClick?: (phoneNumber: string, dataPhone: string) => void;
|
|
212
211
|
}
|
|
213
212
|
declare const MessageList: React.FC<MessagesProps>;
|
|
214
213
|
export default MessageList;
|
|
@@ -206,7 +206,6 @@ interface MessagesProps {
|
|
|
206
206
|
collapsedLinesLimit?: number;
|
|
207
207
|
createChatOnAvatarTap?: boolean;
|
|
208
208
|
allowSendAttachment?: boolean;
|
|
209
|
-
onPhoneNumberClick?: (phoneNumber: string, dataPhone: string) => void;
|
|
210
209
|
}
|
|
211
210
|
declare const MessagesContainer: React.FC<MessagesProps>;
|
|
212
211
|
export default MessagesContainer;
|
package/index.js
CHANGED
|
@@ -12,7 +12,6 @@ var uuid = require('uuid');
|
|
|
12
12
|
var styled = require('styled-components');
|
|
13
13
|
var styled__default = _interopDefault(styled);
|
|
14
14
|
var LinkifyIt = _interopDefault(require('linkify-it'));
|
|
15
|
-
var libphonenumberJs = require('libphonenumber-js');
|
|
16
15
|
var Pica = _interopDefault(require('pica'));
|
|
17
16
|
var reactDom = require('react-dom');
|
|
18
17
|
var Cropper = _interopDefault(require('react-easy-crop'));
|
|
@@ -15148,7 +15147,7 @@ var UploadAvatarButton = styled__default.button(_templateObject23 || (_templateO
|
|
|
15148
15147
|
var UploadAvatarHandler = styled__default.div(_templateObject24 || (_templateObject24 = _taggedTemplateLiteralLoose(["\n margin-left: 18px;\n font-size: 13px;\n color: ", ";\n"])), function (props) {
|
|
15149
15148
|
return props.color;
|
|
15150
15149
|
});
|
|
15151
|
-
var StyledText = styled__default.span(_templateObject25 || (_templateObject25 = _taggedTemplateLiteralLoose(["\n font-weight: ", ";\n font-family: ", ";\n font-style: ", ";\n text-decoration: ", ";\n letter-spacing: ", ";\n\n &.mention {\n color: ", ";\n font-weight: ", ";\n cursor: ", ";\n }\n &.bold {\n font-weight: 600;\n }\n &.italic {\n font-style: italic;\n }\n &.underline {\n text-decoration: underline;\n }\n &.strikethrough {\n text-decoration: line-through;\n }\n &.underline.strikethrough {\n text-decoration: underline line-through;\n }\n &.monospace {\n letter-spacing: 4px;\n }\n
|
|
15150
|
+
var StyledText = styled__default.span(_templateObject25 || (_templateObject25 = _taggedTemplateLiteralLoose(["\n font-weight: ", ";\n font-family: ", ";\n font-style: ", ";\n text-decoration: ", ";\n letter-spacing: ", ";\n\n &.mention {\n color: ", ";\n font-weight: ", ";\n cursor: ", ";\n }\n &.bold {\n font-weight: 600;\n }\n &.italic {\n font-style: italic;\n }\n &.underline {\n text-decoration: underline;\n }\n &.strikethrough {\n text-decoration: line-through;\n }\n &.underline.strikethrough {\n text-decoration: underline line-through;\n }\n &.monospace {\n letter-spacing: 4px;\n }\n"])), function (props) {
|
|
15152
15151
|
return props.fontWeight || props.isLastMessage && '500';
|
|
15153
15152
|
}, function (props) {
|
|
15154
15153
|
return props.fontFamily;
|
|
@@ -15164,8 +15163,6 @@ var StyledText = styled__default.span(_templateObject25 || (_templateObject25 =
|
|
|
15164
15163
|
return props.isLastMessage && '500';
|
|
15165
15164
|
}, function (props) {
|
|
15166
15165
|
return props.shouldOpenUserProfileForMention && 'pointer';
|
|
15167
|
-
}, function (props) {
|
|
15168
|
-
return props.color;
|
|
15169
15166
|
});
|
|
15170
15167
|
var MessageOwner = styled__default.h3(_templateObject26 || (_templateObject26 = _taggedTemplateLiteralLoose(["\n margin: 0 12px 4px 0;\n white-space: nowrap;\n color: ", ";\n margin-left: ", ";\n font-weight: 500;\n font-size: ", ";\n line-height: ", ";\n cursor: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n"])), function (props) {
|
|
15171
15168
|
return props.color;
|
|
@@ -15446,103 +15443,6 @@ var linkifyTextPart = function linkifyTextPart(textPart, match, target, isInvite
|
|
|
15446
15443
|
});
|
|
15447
15444
|
return newMessageText || textPart;
|
|
15448
15445
|
};
|
|
15449
|
-
var linkifyPhoneNumbers = function linkifyPhoneNumbers(parts, onPhoneNumberClick, accentColor, messageId) {
|
|
15450
|
-
var defaultCountry = function () {
|
|
15451
|
-
try {
|
|
15452
|
-
var _getClient$user;
|
|
15453
|
-
var userId = (_getClient$user = getClient().user) === null || _getClient$user === void 0 ? void 0 : _getClient$user.id;
|
|
15454
|
-
if (userId) return libphonenumberJs.parsePhoneNumber('+' + userId).country;
|
|
15455
|
-
} catch (_unused) {}
|
|
15456
|
-
return undefined;
|
|
15457
|
-
}();
|
|
15458
|
-
var processString = function processString(str, keyPrefix) {
|
|
15459
|
-
var libMatches = libphonenumberJs.findPhoneNumbersInText(str, defaultCountry);
|
|
15460
|
-
var BARE_REGEX = /(?<![+\d])((?:\d[-\s.()]?){6,}\d)/g;
|
|
15461
|
-
var allMatches = libMatches.map(function (m) {
|
|
15462
|
-
return {
|
|
15463
|
-
startsAt: m.startsAt,
|
|
15464
|
-
endsAt: m.endsAt,
|
|
15465
|
-
e164: m.number.number
|
|
15466
|
-
};
|
|
15467
|
-
});
|
|
15468
|
-
var bareMatch;
|
|
15469
|
-
BARE_REGEX.lastIndex = 0;
|
|
15470
|
-
var _loop = function _loop() {
|
|
15471
|
-
var start = bareMatch.index;
|
|
15472
|
-
var end = start + bareMatch[0].length;
|
|
15473
|
-
if (allMatches.some(function (m) {
|
|
15474
|
-
return start >= m.startsAt && end <= m.endsAt;
|
|
15475
|
-
})) return 1;
|
|
15476
|
-
try {
|
|
15477
|
-
var phone;
|
|
15478
|
-
try {
|
|
15479
|
-
phone = libphonenumberJs.parsePhoneNumber('+' + bareMatch[0].replace(/\D/g, ''));
|
|
15480
|
-
} catch (_unused2) {
|
|
15481
|
-
if (defaultCountry) {
|
|
15482
|
-
phone = libphonenumberJs.parsePhoneNumber(bareMatch[0], defaultCountry);
|
|
15483
|
-
}
|
|
15484
|
-
}
|
|
15485
|
-
if (phone && phone.isValid()) {
|
|
15486
|
-
allMatches.push({
|
|
15487
|
-
startsAt: start,
|
|
15488
|
-
endsAt: end,
|
|
15489
|
-
e164: phone.number
|
|
15490
|
-
});
|
|
15491
|
-
}
|
|
15492
|
-
} catch (_unused3) {}
|
|
15493
|
-
};
|
|
15494
|
-
while ((bareMatch = BARE_REGEX.exec(str)) !== null) {
|
|
15495
|
-
if (_loop()) continue;
|
|
15496
|
-
}
|
|
15497
|
-
if (allMatches.length === 0) return str;
|
|
15498
|
-
allMatches.sort(function (a, b) {
|
|
15499
|
-
return a.startsAt - b.startsAt;
|
|
15500
|
-
});
|
|
15501
|
-
var result = [];
|
|
15502
|
-
var lastIndex = 0;
|
|
15503
|
-
allMatches.forEach(function (match, i) {
|
|
15504
|
-
var _match$e;
|
|
15505
|
-
result.push(str.substring(lastIndex, match.startsAt));
|
|
15506
|
-
var dataPhone = "" + (messageId ? messageId + "_" : '') + ((_match$e = match.e164) === null || _match$e === void 0 ? void 0 : _match$e.replace('+', '')) + "_" + i;
|
|
15507
|
-
result.push(/*#__PURE__*/React__default.createElement(StyledText, {
|
|
15508
|
-
className: 'phone-number',
|
|
15509
|
-
key: keyPrefix + "-phone-" + i,
|
|
15510
|
-
color: accentColor,
|
|
15511
|
-
style: {
|
|
15512
|
-
cursor: 'pointer'
|
|
15513
|
-
},
|
|
15514
|
-
"data-phone": dataPhone,
|
|
15515
|
-
onClick: function onClick() {
|
|
15516
|
-
onPhoneNumberClick(match.e164, dataPhone);
|
|
15517
|
-
}
|
|
15518
|
-
}, str.substring(match.startsAt, match.endsAt)));
|
|
15519
|
-
lastIndex = match.endsAt;
|
|
15520
|
-
});
|
|
15521
|
-
result.push(str.substring(lastIndex));
|
|
15522
|
-
return result;
|
|
15523
|
-
};
|
|
15524
|
-
if (typeof parts === 'string') {
|
|
15525
|
-
return processString(parts, 'root');
|
|
15526
|
-
}
|
|
15527
|
-
if (Array.isArray(parts)) {
|
|
15528
|
-
var changed = false;
|
|
15529
|
-
var mapped = parts.map(function (part, index) {
|
|
15530
|
-
if (typeof part === 'string') {
|
|
15531
|
-
var processed = processString(part, String(index));
|
|
15532
|
-
if (processed !== part) {
|
|
15533
|
-
changed = true;
|
|
15534
|
-
return processed;
|
|
15535
|
-
}
|
|
15536
|
-
}
|
|
15537
|
-
return part;
|
|
15538
|
-
});
|
|
15539
|
-
if (!changed) return parts;
|
|
15540
|
-
return mapped.flatMap(function (item) {
|
|
15541
|
-
return Array.isArray(item) ? item : [item];
|
|
15542
|
-
});
|
|
15543
|
-
}
|
|
15544
|
-
return parts;
|
|
15545
|
-
};
|
|
15546
15446
|
var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
15547
15447
|
var text = _ref2.text,
|
|
15548
15448
|
message = _ref2.message,
|
|
@@ -15559,8 +15459,7 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
15559
15459
|
target = _ref2$target === void 0 ? '_blank' : _ref2$target,
|
|
15560
15460
|
_ref2$isInviteLink = _ref2.isInviteLink,
|
|
15561
15461
|
isInviteLink = _ref2$isInviteLink === void 0 ? false : _ref2$isInviteLink,
|
|
15562
|
-
onInviteLinkClick = _ref2.onInviteLinkClick
|
|
15563
|
-
onPhoneNumberClick = _ref2.onPhoneNumberClick;
|
|
15462
|
+
onInviteLinkClick = _ref2.onInviteLinkClick;
|
|
15564
15463
|
try {
|
|
15565
15464
|
var messageText = [];
|
|
15566
15465
|
var linkify = new LinkifyIt();
|
|
@@ -15580,17 +15479,11 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
15580
15479
|
if (!isLastMessage && !asSampleText && firstPartMatch) {
|
|
15581
15480
|
firstPart = linkifyTextPart(firstPart, firstPartMatch, target, isInviteLink, onInviteLinkClick);
|
|
15582
15481
|
}
|
|
15583
|
-
if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
|
|
15584
|
-
firstPart = linkifyPhoneNumbers(firstPart, onPhoneNumberClick, '#438ced', message.id);
|
|
15585
|
-
}
|
|
15586
15482
|
var secondPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(attributeOffset + attribute.length) : '');
|
|
15587
15483
|
var secondPartMatch = secondPart ? linkify.match(secondPart) : '';
|
|
15588
15484
|
if (!isLastMessage && !asSampleText && secondPartMatch) {
|
|
15589
15485
|
secondPart = linkifyTextPart(secondPart, secondPartMatch, target, isInviteLink, onInviteLinkClick);
|
|
15590
15486
|
}
|
|
15591
|
-
if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
|
|
15592
|
-
secondPart = linkifyPhoneNumbers(secondPart, onPhoneNumberClick, '#438ced', message.id);
|
|
15593
|
-
}
|
|
15594
15487
|
if (attribute.type.includes('mention')) {
|
|
15595
15488
|
var mentionDisplay = message.mentionedUsers && message.mentionedUsers.find(function (men) {
|
|
15596
15489
|
return men.id === attribute.metadata;
|
|
@@ -15652,9 +15545,6 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
15652
15545
|
if (!isLastMessage && !asSampleText && match) {
|
|
15653
15546
|
newTextPart = linkifyTextPart(_textPart, match, target, isInviteLink, onInviteLinkClick);
|
|
15654
15547
|
}
|
|
15655
|
-
if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
|
|
15656
|
-
newTextPart = linkifyPhoneNumbers(newTextPart, onPhoneNumberClick, '#438ced', message.id);
|
|
15657
|
-
}
|
|
15658
15548
|
messageText.push(firstPart, asSampleText ? newTextPart : (/*#__PURE__*/React__default.createElement(StyledText, {
|
|
15659
15549
|
isLastMessage: isLastMessage,
|
|
15660
15550
|
className: attribute.type,
|
|
@@ -15671,9 +15561,6 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
15671
15561
|
if (!isLastMessage && !asSampleText && match) {
|
|
15672
15562
|
messageText = linkifyTextPart(text, match, target, isInviteLink, onInviteLinkClick);
|
|
15673
15563
|
}
|
|
15674
|
-
if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
|
|
15675
|
-
messageText = linkifyPhoneNumbers(messageText.length > 0 ? messageText : text, onPhoneNumberClick, '#438ced', message.id);
|
|
15676
|
-
}
|
|
15677
15564
|
}
|
|
15678
15565
|
return messageText.length > 1 ? asSampleText ? messageText.join('') : messageText : text;
|
|
15679
15566
|
} catch (e) {
|
|
@@ -41098,7 +40985,6 @@ var MessageBody = function MessageBody(_ref) {
|
|
|
41098
40985
|
ogMetadataProps = _ref.ogMetadataProps,
|
|
41099
40986
|
unsupportedMessage = _ref.unsupportedMessage,
|
|
41100
40987
|
onInviteLinkClick = _ref.onInviteLinkClick,
|
|
41101
|
-
onPhoneNumberClick = _ref.onPhoneNumberClick,
|
|
41102
40988
|
collapsedLinesLimit = _ref.collapsedLinesLimit,
|
|
41103
40989
|
ifLatestAndHasNotPreview = _ref.ifLatestAndHasNotPreview;
|
|
41104
40990
|
var _useColor = useColors(),
|
|
@@ -41136,10 +41022,9 @@ var MessageBody = function MessageBody(_ref) {
|
|
|
41136
41022
|
unsupportedMessage: unsupportedMessage,
|
|
41137
41023
|
target: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.target,
|
|
41138
41024
|
isInviteLink: (ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.isInviteLink) || false,
|
|
41139
|
-
onInviteLinkClick: onInviteLinkClick
|
|
41140
|
-
onPhoneNumberClick: onPhoneNumberClick
|
|
41025
|
+
onInviteLinkClick: onInviteLinkClick
|
|
41141
41026
|
});
|
|
41142
|
-
}, [message, contactsMap, getFromContacts, accentColor, textSecondary, shouldOpenUserProfileForMention, unsupportedMessage, ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.target, ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.isInviteLink, onInviteLinkClick
|
|
41027
|
+
}, [message, contactsMap, getFromContacts, accentColor, textSecondary, shouldOpenUserProfileForMention, unsupportedMessage, ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.target, ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.isInviteLink, onInviteLinkClick]);
|
|
41143
41028
|
var viewOnce = React.useMemo(function () {
|
|
41144
41029
|
return message.viewOnce;
|
|
41145
41030
|
}, [message === null || message === void 0 ? void 0 : message.viewOnce]);
|
|
@@ -43234,8 +43119,7 @@ var Message$1 = function Message(_ref) {
|
|
|
43234
43119
|
collapsedLinesLimit = _ref.collapsedLinesLimit,
|
|
43235
43120
|
_ref$createChatOnAvat = _ref.createChatOnAvatarTap,
|
|
43236
43121
|
createChatOnAvatarTap = _ref$createChatOnAvat === void 0 ? true : _ref$createChatOnAvat,
|
|
43237
|
-
ifLatestAndHasNotPreview = _ref.ifLatestAndHasNotPreview
|
|
43238
|
-
onPhoneNumberClick = _ref.onPhoneNumberClick;
|
|
43122
|
+
ifLatestAndHasNotPreview = _ref.ifLatestAndHasNotPreview;
|
|
43239
43123
|
var isTabActive = (_tabIsActiveRef$curre = tabIsActiveRef === null || tabIsActiveRef === void 0 ? void 0 : tabIsActiveRef.current) != null ? _tabIsActiveRef$curre : tabIsActive;
|
|
43240
43124
|
var getComparableUserId = function getComparableUserId(messageUser) {
|
|
43241
43125
|
return messageUser !== null && messageUser !== void 0 && messageUser.id ? String(messageUser.id) : 'deleted';
|
|
@@ -43701,7 +43585,6 @@ var Message$1 = function Message(_ref) {
|
|
|
43701
43585
|
})) : (/*#__PURE__*/React__default.createElement(MessageBody$1, {
|
|
43702
43586
|
ifLatestAndHasNotPreview: ifLatestAndHasNotPreview,
|
|
43703
43587
|
onInviteLinkClick: onInviteLinkClick,
|
|
43704
|
-
onPhoneNumberClick: onPhoneNumberClick,
|
|
43705
43588
|
handleRetractVote: handleRetractVote,
|
|
43706
43589
|
handleEndVote: handleEndVote,
|
|
43707
43590
|
message: message,
|
|
@@ -46380,8 +46263,7 @@ var MessageList = function MessageList(_ref) {
|
|
|
46380
46263
|
_ref$createChatOnAvat = _ref.createChatOnAvatarTap,
|
|
46381
46264
|
createChatOnAvatarTap = _ref$createChatOnAvat === void 0 ? true : _ref$createChatOnAvat,
|
|
46382
46265
|
_ref$allowSendAttachm = _ref.allowSendAttachment,
|
|
46383
|
-
allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm
|
|
46384
|
-
onPhoneNumberClick = _ref.onPhoneNumberClick;
|
|
46266
|
+
allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm;
|
|
46385
46267
|
var _useColor = useColors(),
|
|
46386
46268
|
outgoingMessageBackground = _useColor[THEME_COLORS.OUTGOING_MESSAGE_BACKGROUND],
|
|
46387
46269
|
themeBackgroundColor = _useColor[THEME_COLORS.BACKGROUND],
|
|
@@ -46871,8 +46753,7 @@ var MessageList = function MessageList(_ref) {
|
|
|
46871
46753
|
showInfoMessageProps: showInfoMessageProps,
|
|
46872
46754
|
ogMetadataProps: ogMetadataProps,
|
|
46873
46755
|
collapsedLinesLimit: collapsedLinesLimit,
|
|
46874
|
-
createChatOnAvatarTap: createChatOnAvatarTap
|
|
46875
|
-
onPhoneNumberClick: onPhoneNumberClick
|
|
46756
|
+
createChatOnAvatarTap: createChatOnAvatarTap
|
|
46876
46757
|
}));
|
|
46877
46758
|
};
|
|
46878
46759
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, allowSendAttachment && isDragging && !(attachmentsPreview !== null && attachmentsPreview !== void 0 && attachmentsPreview.show && mediaFile) && (/*#__PURE__*/React__default.createElement(DragAndDropContainer, {
|
|
@@ -47250,8 +47131,7 @@ var MessagesContainer = function MessagesContainer(_ref) {
|
|
|
47250
47131
|
_ref$createChatOnAvat = _ref.createChatOnAvatarTap,
|
|
47251
47132
|
createChatOnAvatarTap = _ref$createChatOnAvat === void 0 ? true : _ref$createChatOnAvat,
|
|
47252
47133
|
_ref$allowSendAttachm = _ref.allowSendAttachment,
|
|
47253
|
-
allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm
|
|
47254
|
-
onPhoneNumberClick = _ref.onPhoneNumberClick;
|
|
47134
|
+
allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm;
|
|
47255
47135
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MessageList, {
|
|
47256
47136
|
fontFamily: fontFamily,
|
|
47257
47137
|
ownMessageOnRightSide: ownMessageOnRightSide,
|
|
@@ -47388,8 +47268,7 @@ var MessagesContainer = function MessagesContainer(_ref) {
|
|
|
47388
47268
|
ogMetadataProps: ogMetadataProps,
|
|
47389
47269
|
collapsedLinesLimit: collapsedLinesLimit,
|
|
47390
47270
|
createChatOnAvatarTap: createChatOnAvatarTap,
|
|
47391
|
-
allowSendAttachment: allowSendAttachment
|
|
47392
|
-
onPhoneNumberClick: onPhoneNumberClick
|
|
47271
|
+
allowSendAttachment: allowSendAttachment
|
|
47393
47272
|
}));
|
|
47394
47273
|
};
|
|
47395
47274
|
|
package/index.modern.js
CHANGED
|
@@ -7,7 +7,6 @@ import { select, put, call, take, takeLatest, takeEvery, delay, spawn, race, all
|
|
|
7
7
|
import { v4 } from 'uuid';
|
|
8
8
|
import styled, { createGlobalStyle, keyframes } from 'styled-components';
|
|
9
9
|
import LinkifyIt from 'linkify-it';
|
|
10
|
-
import { parsePhoneNumber, findPhoneNumbersInText } from 'libphonenumber-js';
|
|
11
10
|
import Pica from 'pica';
|
|
12
11
|
import { createPortal } from 'react-dom';
|
|
13
12
|
import Cropper from 'react-easy-crop';
|
|
@@ -15147,7 +15146,7 @@ var UploadAvatarButton = styled.button(_templateObject23 || (_templateObject23 =
|
|
|
15147
15146
|
var UploadAvatarHandler = styled.div(_templateObject24 || (_templateObject24 = _taggedTemplateLiteralLoose(["\n margin-left: 18px;\n font-size: 13px;\n color: ", ";\n"])), function (props) {
|
|
15148
15147
|
return props.color;
|
|
15149
15148
|
});
|
|
15150
|
-
var StyledText = styled.span(_templateObject25 || (_templateObject25 = _taggedTemplateLiteralLoose(["\n font-weight: ", ";\n font-family: ", ";\n font-style: ", ";\n text-decoration: ", ";\n letter-spacing: ", ";\n\n &.mention {\n color: ", ";\n font-weight: ", ";\n cursor: ", ";\n }\n &.bold {\n font-weight: 600;\n }\n &.italic {\n font-style: italic;\n }\n &.underline {\n text-decoration: underline;\n }\n &.strikethrough {\n text-decoration: line-through;\n }\n &.underline.strikethrough {\n text-decoration: underline line-through;\n }\n &.monospace {\n letter-spacing: 4px;\n }\n
|
|
15149
|
+
var StyledText = styled.span(_templateObject25 || (_templateObject25 = _taggedTemplateLiteralLoose(["\n font-weight: ", ";\n font-family: ", ";\n font-style: ", ";\n text-decoration: ", ";\n letter-spacing: ", ";\n\n &.mention {\n color: ", ";\n font-weight: ", ";\n cursor: ", ";\n }\n &.bold {\n font-weight: 600;\n }\n &.italic {\n font-style: italic;\n }\n &.underline {\n text-decoration: underline;\n }\n &.strikethrough {\n text-decoration: line-through;\n }\n &.underline.strikethrough {\n text-decoration: underline line-through;\n }\n &.monospace {\n letter-spacing: 4px;\n }\n"])), function (props) {
|
|
15151
15150
|
return props.fontWeight || props.isLastMessage && '500';
|
|
15152
15151
|
}, function (props) {
|
|
15153
15152
|
return props.fontFamily;
|
|
@@ -15163,8 +15162,6 @@ var StyledText = styled.span(_templateObject25 || (_templateObject25 = _taggedTe
|
|
|
15163
15162
|
return props.isLastMessage && '500';
|
|
15164
15163
|
}, function (props) {
|
|
15165
15164
|
return props.shouldOpenUserProfileForMention && 'pointer';
|
|
15166
|
-
}, function (props) {
|
|
15167
|
-
return props.color;
|
|
15168
15165
|
});
|
|
15169
15166
|
var MessageOwner = styled.h3(_templateObject26 || (_templateObject26 = _taggedTemplateLiteralLoose(["\n margin: 0 12px 4px 0;\n white-space: nowrap;\n color: ", ";\n margin-left: ", ";\n font-weight: 500;\n font-size: ", ";\n line-height: ", ";\n cursor: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n"])), function (props) {
|
|
15170
15167
|
return props.color;
|
|
@@ -15445,103 +15442,6 @@ var linkifyTextPart = function linkifyTextPart(textPart, match, target, isInvite
|
|
|
15445
15442
|
});
|
|
15446
15443
|
return newMessageText || textPart;
|
|
15447
15444
|
};
|
|
15448
|
-
var linkifyPhoneNumbers = function linkifyPhoneNumbers(parts, onPhoneNumberClick, accentColor, messageId) {
|
|
15449
|
-
var defaultCountry = function () {
|
|
15450
|
-
try {
|
|
15451
|
-
var _getClient$user;
|
|
15452
|
-
var userId = (_getClient$user = getClient().user) === null || _getClient$user === void 0 ? void 0 : _getClient$user.id;
|
|
15453
|
-
if (userId) return parsePhoneNumber('+' + userId).country;
|
|
15454
|
-
} catch (_unused) {}
|
|
15455
|
-
return undefined;
|
|
15456
|
-
}();
|
|
15457
|
-
var processString = function processString(str, keyPrefix) {
|
|
15458
|
-
var libMatches = findPhoneNumbersInText(str, defaultCountry);
|
|
15459
|
-
var BARE_REGEX = /(?<![+\d])((?:\d[-\s.()]?){6,}\d)/g;
|
|
15460
|
-
var allMatches = libMatches.map(function (m) {
|
|
15461
|
-
return {
|
|
15462
|
-
startsAt: m.startsAt,
|
|
15463
|
-
endsAt: m.endsAt,
|
|
15464
|
-
e164: m.number.number
|
|
15465
|
-
};
|
|
15466
|
-
});
|
|
15467
|
-
var bareMatch;
|
|
15468
|
-
BARE_REGEX.lastIndex = 0;
|
|
15469
|
-
var _loop = function _loop() {
|
|
15470
|
-
var start = bareMatch.index;
|
|
15471
|
-
var end = start + bareMatch[0].length;
|
|
15472
|
-
if (allMatches.some(function (m) {
|
|
15473
|
-
return start >= m.startsAt && end <= m.endsAt;
|
|
15474
|
-
})) return 1;
|
|
15475
|
-
try {
|
|
15476
|
-
var phone;
|
|
15477
|
-
try {
|
|
15478
|
-
phone = parsePhoneNumber('+' + bareMatch[0].replace(/\D/g, ''));
|
|
15479
|
-
} catch (_unused2) {
|
|
15480
|
-
if (defaultCountry) {
|
|
15481
|
-
phone = parsePhoneNumber(bareMatch[0], defaultCountry);
|
|
15482
|
-
}
|
|
15483
|
-
}
|
|
15484
|
-
if (phone && phone.isValid()) {
|
|
15485
|
-
allMatches.push({
|
|
15486
|
-
startsAt: start,
|
|
15487
|
-
endsAt: end,
|
|
15488
|
-
e164: phone.number
|
|
15489
|
-
});
|
|
15490
|
-
}
|
|
15491
|
-
} catch (_unused3) {}
|
|
15492
|
-
};
|
|
15493
|
-
while ((bareMatch = BARE_REGEX.exec(str)) !== null) {
|
|
15494
|
-
if (_loop()) continue;
|
|
15495
|
-
}
|
|
15496
|
-
if (allMatches.length === 0) return str;
|
|
15497
|
-
allMatches.sort(function (a, b) {
|
|
15498
|
-
return a.startsAt - b.startsAt;
|
|
15499
|
-
});
|
|
15500
|
-
var result = [];
|
|
15501
|
-
var lastIndex = 0;
|
|
15502
|
-
allMatches.forEach(function (match, i) {
|
|
15503
|
-
var _match$e;
|
|
15504
|
-
result.push(str.substring(lastIndex, match.startsAt));
|
|
15505
|
-
var dataPhone = "" + (messageId ? messageId + "_" : '') + ((_match$e = match.e164) === null || _match$e === void 0 ? void 0 : _match$e.replace('+', '')) + "_" + i;
|
|
15506
|
-
result.push(/*#__PURE__*/React__default.createElement(StyledText, {
|
|
15507
|
-
className: 'phone-number',
|
|
15508
|
-
key: keyPrefix + "-phone-" + i,
|
|
15509
|
-
color: accentColor,
|
|
15510
|
-
style: {
|
|
15511
|
-
cursor: 'pointer'
|
|
15512
|
-
},
|
|
15513
|
-
"data-phone": dataPhone,
|
|
15514
|
-
onClick: function onClick() {
|
|
15515
|
-
onPhoneNumberClick(match.e164, dataPhone);
|
|
15516
|
-
}
|
|
15517
|
-
}, str.substring(match.startsAt, match.endsAt)));
|
|
15518
|
-
lastIndex = match.endsAt;
|
|
15519
|
-
});
|
|
15520
|
-
result.push(str.substring(lastIndex));
|
|
15521
|
-
return result;
|
|
15522
|
-
};
|
|
15523
|
-
if (typeof parts === 'string') {
|
|
15524
|
-
return processString(parts, 'root');
|
|
15525
|
-
}
|
|
15526
|
-
if (Array.isArray(parts)) {
|
|
15527
|
-
var changed = false;
|
|
15528
|
-
var mapped = parts.map(function (part, index) {
|
|
15529
|
-
if (typeof part === 'string') {
|
|
15530
|
-
var processed = processString(part, String(index));
|
|
15531
|
-
if (processed !== part) {
|
|
15532
|
-
changed = true;
|
|
15533
|
-
return processed;
|
|
15534
|
-
}
|
|
15535
|
-
}
|
|
15536
|
-
return part;
|
|
15537
|
-
});
|
|
15538
|
-
if (!changed) return parts;
|
|
15539
|
-
return mapped.flatMap(function (item) {
|
|
15540
|
-
return Array.isArray(item) ? item : [item];
|
|
15541
|
-
});
|
|
15542
|
-
}
|
|
15543
|
-
return parts;
|
|
15544
|
-
};
|
|
15545
15445
|
var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
15546
15446
|
var text = _ref2.text,
|
|
15547
15447
|
message = _ref2.message,
|
|
@@ -15558,8 +15458,7 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
15558
15458
|
target = _ref2$target === void 0 ? '_blank' : _ref2$target,
|
|
15559
15459
|
_ref2$isInviteLink = _ref2.isInviteLink,
|
|
15560
15460
|
isInviteLink = _ref2$isInviteLink === void 0 ? false : _ref2$isInviteLink,
|
|
15561
|
-
onInviteLinkClick = _ref2.onInviteLinkClick
|
|
15562
|
-
onPhoneNumberClick = _ref2.onPhoneNumberClick;
|
|
15461
|
+
onInviteLinkClick = _ref2.onInviteLinkClick;
|
|
15563
15462
|
try {
|
|
15564
15463
|
var messageText = [];
|
|
15565
15464
|
var linkify = new LinkifyIt();
|
|
@@ -15579,17 +15478,11 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
15579
15478
|
if (!isLastMessage && !asSampleText && firstPartMatch) {
|
|
15580
15479
|
firstPart = linkifyTextPart(firstPart, firstPartMatch, target, isInviteLink, onInviteLinkClick);
|
|
15581
15480
|
}
|
|
15582
|
-
if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
|
|
15583
|
-
firstPart = linkifyPhoneNumbers(firstPart, onPhoneNumberClick, '#438ced', message.id);
|
|
15584
|
-
}
|
|
15585
15481
|
var secondPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(attributeOffset + attribute.length) : '');
|
|
15586
15482
|
var secondPartMatch = secondPart ? linkify.match(secondPart) : '';
|
|
15587
15483
|
if (!isLastMessage && !asSampleText && secondPartMatch) {
|
|
15588
15484
|
secondPart = linkifyTextPart(secondPart, secondPartMatch, target, isInviteLink, onInviteLinkClick);
|
|
15589
15485
|
}
|
|
15590
|
-
if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
|
|
15591
|
-
secondPart = linkifyPhoneNumbers(secondPart, onPhoneNumberClick, '#438ced', message.id);
|
|
15592
|
-
}
|
|
15593
15486
|
if (attribute.type.includes('mention')) {
|
|
15594
15487
|
var mentionDisplay = message.mentionedUsers && message.mentionedUsers.find(function (men) {
|
|
15595
15488
|
return men.id === attribute.metadata;
|
|
@@ -15651,9 +15544,6 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
15651
15544
|
if (!isLastMessage && !asSampleText && match) {
|
|
15652
15545
|
newTextPart = linkifyTextPart(_textPart, match, target, isInviteLink, onInviteLinkClick);
|
|
15653
15546
|
}
|
|
15654
|
-
if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
|
|
15655
|
-
newTextPart = linkifyPhoneNumbers(newTextPart, onPhoneNumberClick, '#438ced', message.id);
|
|
15656
|
-
}
|
|
15657
15547
|
messageText.push(firstPart, asSampleText ? newTextPart : (/*#__PURE__*/React__default.createElement(StyledText, {
|
|
15658
15548
|
isLastMessage: isLastMessage,
|
|
15659
15549
|
className: attribute.type,
|
|
@@ -15670,9 +15560,6 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
15670
15560
|
if (!isLastMessage && !asSampleText && match) {
|
|
15671
15561
|
messageText = linkifyTextPart(text, match, target, isInviteLink, onInviteLinkClick);
|
|
15672
15562
|
}
|
|
15673
|
-
if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
|
|
15674
|
-
messageText = linkifyPhoneNumbers(messageText.length > 0 ? messageText : text, onPhoneNumberClick, '#438ced', message.id);
|
|
15675
|
-
}
|
|
15676
15563
|
}
|
|
15677
15564
|
return messageText.length > 1 ? asSampleText ? messageText.join('') : messageText : text;
|
|
15678
15565
|
} catch (e) {
|
|
@@ -41097,7 +40984,6 @@ var MessageBody = function MessageBody(_ref) {
|
|
|
41097
40984
|
ogMetadataProps = _ref.ogMetadataProps,
|
|
41098
40985
|
unsupportedMessage = _ref.unsupportedMessage,
|
|
41099
40986
|
onInviteLinkClick = _ref.onInviteLinkClick,
|
|
41100
|
-
onPhoneNumberClick = _ref.onPhoneNumberClick,
|
|
41101
40987
|
collapsedLinesLimit = _ref.collapsedLinesLimit,
|
|
41102
40988
|
ifLatestAndHasNotPreview = _ref.ifLatestAndHasNotPreview;
|
|
41103
40989
|
var _useColor = useColors(),
|
|
@@ -41135,10 +41021,9 @@ var MessageBody = function MessageBody(_ref) {
|
|
|
41135
41021
|
unsupportedMessage: unsupportedMessage,
|
|
41136
41022
|
target: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.target,
|
|
41137
41023
|
isInviteLink: (ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.isInviteLink) || false,
|
|
41138
|
-
onInviteLinkClick: onInviteLinkClick
|
|
41139
|
-
onPhoneNumberClick: onPhoneNumberClick
|
|
41024
|
+
onInviteLinkClick: onInviteLinkClick
|
|
41140
41025
|
});
|
|
41141
|
-
}, [message, contactsMap, getFromContacts, accentColor, textSecondary, shouldOpenUserProfileForMention, unsupportedMessage, ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.target, ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.isInviteLink, onInviteLinkClick
|
|
41026
|
+
}, [message, contactsMap, getFromContacts, accentColor, textSecondary, shouldOpenUserProfileForMention, unsupportedMessage, ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.target, ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.isInviteLink, onInviteLinkClick]);
|
|
41142
41027
|
var viewOnce = useMemo(function () {
|
|
41143
41028
|
return message.viewOnce;
|
|
41144
41029
|
}, [message === null || message === void 0 ? void 0 : message.viewOnce]);
|
|
@@ -43233,8 +43118,7 @@ var Message$1 = function Message(_ref) {
|
|
|
43233
43118
|
collapsedLinesLimit = _ref.collapsedLinesLimit,
|
|
43234
43119
|
_ref$createChatOnAvat = _ref.createChatOnAvatarTap,
|
|
43235
43120
|
createChatOnAvatarTap = _ref$createChatOnAvat === void 0 ? true : _ref$createChatOnAvat,
|
|
43236
|
-
ifLatestAndHasNotPreview = _ref.ifLatestAndHasNotPreview
|
|
43237
|
-
onPhoneNumberClick = _ref.onPhoneNumberClick;
|
|
43121
|
+
ifLatestAndHasNotPreview = _ref.ifLatestAndHasNotPreview;
|
|
43238
43122
|
var isTabActive = (_tabIsActiveRef$curre = tabIsActiveRef === null || tabIsActiveRef === void 0 ? void 0 : tabIsActiveRef.current) != null ? _tabIsActiveRef$curre : tabIsActive;
|
|
43239
43123
|
var getComparableUserId = function getComparableUserId(messageUser) {
|
|
43240
43124
|
return messageUser !== null && messageUser !== void 0 && messageUser.id ? String(messageUser.id) : 'deleted';
|
|
@@ -43700,7 +43584,6 @@ var Message$1 = function Message(_ref) {
|
|
|
43700
43584
|
})) : (/*#__PURE__*/React__default.createElement(MessageBody$1, {
|
|
43701
43585
|
ifLatestAndHasNotPreview: ifLatestAndHasNotPreview,
|
|
43702
43586
|
onInviteLinkClick: onInviteLinkClick,
|
|
43703
|
-
onPhoneNumberClick: onPhoneNumberClick,
|
|
43704
43587
|
handleRetractVote: handleRetractVote,
|
|
43705
43588
|
handleEndVote: handleEndVote,
|
|
43706
43589
|
message: message,
|
|
@@ -46379,8 +46262,7 @@ var MessageList = function MessageList(_ref) {
|
|
|
46379
46262
|
_ref$createChatOnAvat = _ref.createChatOnAvatarTap,
|
|
46380
46263
|
createChatOnAvatarTap = _ref$createChatOnAvat === void 0 ? true : _ref$createChatOnAvat,
|
|
46381
46264
|
_ref$allowSendAttachm = _ref.allowSendAttachment,
|
|
46382
|
-
allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm
|
|
46383
|
-
onPhoneNumberClick = _ref.onPhoneNumberClick;
|
|
46265
|
+
allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm;
|
|
46384
46266
|
var _useColor = useColors(),
|
|
46385
46267
|
outgoingMessageBackground = _useColor[THEME_COLORS.OUTGOING_MESSAGE_BACKGROUND],
|
|
46386
46268
|
themeBackgroundColor = _useColor[THEME_COLORS.BACKGROUND],
|
|
@@ -46870,8 +46752,7 @@ var MessageList = function MessageList(_ref) {
|
|
|
46870
46752
|
showInfoMessageProps: showInfoMessageProps,
|
|
46871
46753
|
ogMetadataProps: ogMetadataProps,
|
|
46872
46754
|
collapsedLinesLimit: collapsedLinesLimit,
|
|
46873
|
-
createChatOnAvatarTap: createChatOnAvatarTap
|
|
46874
|
-
onPhoneNumberClick: onPhoneNumberClick
|
|
46755
|
+
createChatOnAvatarTap: createChatOnAvatarTap
|
|
46875
46756
|
}));
|
|
46876
46757
|
};
|
|
46877
46758
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, allowSendAttachment && isDragging && !(attachmentsPreview !== null && attachmentsPreview !== void 0 && attachmentsPreview.show && mediaFile) && (/*#__PURE__*/React__default.createElement(DragAndDropContainer, {
|
|
@@ -47249,8 +47130,7 @@ var MessagesContainer = function MessagesContainer(_ref) {
|
|
|
47249
47130
|
_ref$createChatOnAvat = _ref.createChatOnAvatarTap,
|
|
47250
47131
|
createChatOnAvatarTap = _ref$createChatOnAvat === void 0 ? true : _ref$createChatOnAvat,
|
|
47251
47132
|
_ref$allowSendAttachm = _ref.allowSendAttachment,
|
|
47252
|
-
allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm
|
|
47253
|
-
onPhoneNumberClick = _ref.onPhoneNumberClick;
|
|
47133
|
+
allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm;
|
|
47254
47134
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MessageList, {
|
|
47255
47135
|
fontFamily: fontFamily,
|
|
47256
47136
|
ownMessageOnRightSide: ownMessageOnRightSide,
|
|
@@ -47387,8 +47267,7 @@ var MessagesContainer = function MessagesContainer(_ref) {
|
|
|
47387
47267
|
ogMetadataProps: ogMetadataProps,
|
|
47388
47268
|
collapsedLinesLimit: collapsedLinesLimit,
|
|
47389
47269
|
createChatOnAvatarTap: createChatOnAvatarTap,
|
|
47390
|
-
allowSendAttachment: allowSendAttachment
|
|
47391
|
-
onPhoneNumberClick: onPhoneNumberClick
|
|
47270
|
+
allowSendAttachment: allowSendAttachment
|
|
47392
47271
|
}));
|
|
47393
47272
|
};
|
|
47394
47273
|
|
package/messageUtils/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ declare const MessageStatusIcon: ({ messageStatus, messageStatusDisplayingType,
|
|
|
8
8
|
readIconColor?: string | undefined;
|
|
9
9
|
accentColor?: string | undefined;
|
|
10
10
|
}) => React.JSX.Element;
|
|
11
|
-
declare const MessageTextFormat: ({ text, message, contactsMap, getFromContacts, isLastMessage, asSampleText, accentColor, textSecondary, onMentionNameClick, shouldOpenUserProfileForMention, unsupportedMessage, target, isInviteLink, onInviteLinkClick
|
|
11
|
+
declare const MessageTextFormat: ({ text, message, contactsMap, getFromContacts, isLastMessage, asSampleText, accentColor, textSecondary, onMentionNameClick, shouldOpenUserProfileForMention, unsupportedMessage, target, isInviteLink, onInviteLinkClick }: {
|
|
12
12
|
text: string;
|
|
13
13
|
message: any;
|
|
14
14
|
contactsMap?: IContactsMap | undefined;
|
|
@@ -23,6 +23,5 @@ declare const MessageTextFormat: ({ text, message, contactsMap, getFromContacts,
|
|
|
23
23
|
target?: string | undefined;
|
|
24
24
|
isInviteLink?: boolean | undefined;
|
|
25
25
|
onInviteLinkClick?: ((key: string) => void) | undefined;
|
|
26
|
-
onPhoneNumberClick?: ((phoneNumber: string, dataPhone: string) => void) | undefined;
|
|
27
26
|
}) => any;
|
|
28
27
|
export { MessageStatusIcon, MessageTextFormat };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sceyt-chat-react-uikit",
|
|
3
|
-
"version": "1.8.7-beta.
|
|
3
|
+
"version": "1.8.7-beta.6",
|
|
4
4
|
"description": "Interactive React UI Components for Sceyt Chat.",
|
|
5
5
|
"author": "Sceyt",
|
|
6
6
|
"license": "MIT",
|
|
@@ -85,7 +85,6 @@
|
|
|
85
85
|
"@lexical/offset": "^0.12.2",
|
|
86
86
|
"@lexical/react": "^0.12.2",
|
|
87
87
|
"lexical": "^0.12.2",
|
|
88
|
-
"libphonenumber-js": "^1.13.1",
|
|
89
88
|
"linkify-it": "^4.0.1",
|
|
90
89
|
"loglevel": "^1.9.2",
|
|
91
90
|
"@ffmpeg/ffmpeg": "^0.12.10",
|