sceyt-chat-react-uikit 1.8.7-beta.4 → 1.8.7-beta.5

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.
@@ -65,6 +65,7 @@ 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;
68
69
  ifLatestAndHasNotPreview: boolean;
69
70
  }
70
71
  export interface IMessageProps {
@@ -229,5 +230,6 @@ export interface IMessageProps {
229
230
  collapsedLinesLimit?: number;
230
231
  createChatOnAvatarTap?: boolean;
231
232
  ifLatestAndHasNotPreview: boolean;
233
+ onPhoneNumberClick?: (phoneNumber: string, dataPhone: string) => void;
232
234
  }
233
235
  export {};
@@ -138,8 +138,9 @@ interface IMessageBodyProps {
138
138
  ogMetadataProps?: OGMetadataProps;
139
139
  unsupportedMessage: boolean;
140
140
  onInviteLinkClick?: (key: string) => void;
141
+ onPhoneNumberClick?: (phoneNumber: string, dataPhone: string) => void;
141
142
  ifLatestAndHasNotPreview: boolean;
142
143
  collapsedLinesLimit?: number;
143
144
  }
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>;
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, onPhoneNumberClick, collapsedLinesLimit, ifLatestAndHasNotPreview }: IMessageBodyProps) => React.JSX.Element>;
145
146
  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 }: IMessageProps) => React.JSX.Element>;
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, onPhoneNumberClick }: IMessageProps) => React.JSX.Element>;
4
4
  export default _default;
@@ -208,6 +208,7 @@ interface MessagesProps {
208
208
  collapsedLinesLimit?: number;
209
209
  createChatOnAvatarTap?: boolean;
210
210
  allowSendAttachment?: boolean;
211
+ onPhoneNumberClick?: (phoneNumber: string, dataPhone: string) => void;
211
212
  }
212
213
  declare const MessageList: React.FC<MessagesProps>;
213
214
  export default MessageList;
@@ -206,6 +206,7 @@ interface MessagesProps {
206
206
  collapsedLinesLimit?: number;
207
207
  createChatOnAvatarTap?: boolean;
208
208
  allowSendAttachment?: boolean;
209
+ onPhoneNumberClick?: (phoneNumber: string, dataPhone: string) => void;
209
210
  }
210
211
  declare const MessagesContainer: React.FC<MessagesProps>;
211
212
  export default MessagesContainer;
package/index.js CHANGED
@@ -12,6 +12,7 @@ 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');
15
16
  var Pica = _interopDefault(require('pica'));
16
17
  var reactDom = require('react-dom');
17
18
  var Cropper = _interopDefault(require('react-easy-crop'));
@@ -15147,7 +15148,7 @@ var UploadAvatarButton = styled__default.button(_templateObject23 || (_templateO
15147
15148
  var UploadAvatarHandler = styled__default.div(_templateObject24 || (_templateObject24 = _taggedTemplateLiteralLoose(["\n margin-left: 18px;\n font-size: 13px;\n color: ", ";\n"])), function (props) {
15148
15149
  return props.color;
15149
15150
  });
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) {
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 &.phone-number {\n color: ", ";\n cursor: pointer;\n }\n &:hover {\n &.phone-number {\n text-decoration: underline;\n }\n }\n"])), function (props) {
15151
15152
  return props.fontWeight || props.isLastMessage && '500';
15152
15153
  }, function (props) {
15153
15154
  return props.fontFamily;
@@ -15163,6 +15164,8 @@ var StyledText = styled__default.span(_templateObject25 || (_templateObject25 =
15163
15164
  return props.isLastMessage && '500';
15164
15165
  }, function (props) {
15165
15166
  return props.shouldOpenUserProfileForMention && 'pointer';
15167
+ }, function (props) {
15168
+ return props.color;
15166
15169
  });
15167
15170
  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) {
15168
15171
  return props.color;
@@ -15443,6 +15446,103 @@ var linkifyTextPart = function linkifyTextPart(textPart, match, target, isInvite
15443
15446
  });
15444
15447
  return newMessageText || textPart;
15445
15448
  };
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
+ };
15446
15546
  var MessageTextFormat = function MessageTextFormat(_ref2) {
15447
15547
  var text = _ref2.text,
15448
15548
  message = _ref2.message,
@@ -15459,7 +15559,8 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
15459
15559
  target = _ref2$target === void 0 ? '_blank' : _ref2$target,
15460
15560
  _ref2$isInviteLink = _ref2.isInviteLink,
15461
15561
  isInviteLink = _ref2$isInviteLink === void 0 ? false : _ref2$isInviteLink,
15462
- onInviteLinkClick = _ref2.onInviteLinkClick;
15562
+ onInviteLinkClick = _ref2.onInviteLinkClick,
15563
+ onPhoneNumberClick = _ref2.onPhoneNumberClick;
15463
15564
  try {
15464
15565
  var messageText = [];
15465
15566
  var linkify = new LinkifyIt();
@@ -15479,11 +15580,17 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
15479
15580
  if (!isLastMessage && !asSampleText && firstPartMatch) {
15480
15581
  firstPart = linkifyTextPart(firstPart, firstPartMatch, target, isInviteLink, onInviteLinkClick);
15481
15582
  }
15583
+ if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
15584
+ firstPart = linkifyPhoneNumbers(firstPart, onPhoneNumberClick, '#438ced', message.id);
15585
+ }
15482
15586
  var secondPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(attributeOffset + attribute.length) : '');
15483
15587
  var secondPartMatch = secondPart ? linkify.match(secondPart) : '';
15484
15588
  if (!isLastMessage && !asSampleText && secondPartMatch) {
15485
15589
  secondPart = linkifyTextPart(secondPart, secondPartMatch, target, isInviteLink, onInviteLinkClick);
15486
15590
  }
15591
+ if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
15592
+ secondPart = linkifyPhoneNumbers(secondPart, onPhoneNumberClick, '#438ced', message.id);
15593
+ }
15487
15594
  if (attribute.type.includes('mention')) {
15488
15595
  var mentionDisplay = message.mentionedUsers && message.mentionedUsers.find(function (men) {
15489
15596
  return men.id === attribute.metadata;
@@ -15545,6 +15652,9 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
15545
15652
  if (!isLastMessage && !asSampleText && match) {
15546
15653
  newTextPart = linkifyTextPart(_textPart, match, target, isInviteLink, onInviteLinkClick);
15547
15654
  }
15655
+ if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
15656
+ newTextPart = linkifyPhoneNumbers(newTextPart, onPhoneNumberClick, '#438ced', message.id);
15657
+ }
15548
15658
  messageText.push(firstPart, asSampleText ? newTextPart : (/*#__PURE__*/React__default.createElement(StyledText, {
15549
15659
  isLastMessage: isLastMessage,
15550
15660
  className: attribute.type,
@@ -15561,6 +15671,9 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
15561
15671
  if (!isLastMessage && !asSampleText && match) {
15562
15672
  messageText = linkifyTextPart(text, match, target, isInviteLink, onInviteLinkClick);
15563
15673
  }
15674
+ if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
15675
+ messageText = linkifyPhoneNumbers(messageText.length > 0 ? messageText : text, onPhoneNumberClick, '#438ced', message.id);
15676
+ }
15564
15677
  }
15565
15678
  return messageText.length > 1 ? asSampleText ? messageText.join('') : messageText : text;
15566
15679
  } catch (e) {
@@ -40985,6 +41098,7 @@ var MessageBody = function MessageBody(_ref) {
40985
41098
  ogMetadataProps = _ref.ogMetadataProps,
40986
41099
  unsupportedMessage = _ref.unsupportedMessage,
40987
41100
  onInviteLinkClick = _ref.onInviteLinkClick,
41101
+ onPhoneNumberClick = _ref.onPhoneNumberClick,
40988
41102
  collapsedLinesLimit = _ref.collapsedLinesLimit,
40989
41103
  ifLatestAndHasNotPreview = _ref.ifLatestAndHasNotPreview;
40990
41104
  var _useColor = useColors(),
@@ -41022,9 +41136,10 @@ var MessageBody = function MessageBody(_ref) {
41022
41136
  unsupportedMessage: unsupportedMessage,
41023
41137
  target: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.target,
41024
41138
  isInviteLink: (ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.isInviteLink) || false,
41025
- onInviteLinkClick: onInviteLinkClick
41139
+ onInviteLinkClick: onInviteLinkClick,
41140
+ onPhoneNumberClick: onPhoneNumberClick
41026
41141
  });
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]);
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, onPhoneNumberClick]);
41028
41143
  var viewOnce = React.useMemo(function () {
41029
41144
  return message.viewOnce;
41030
41145
  }, [message === null || message === void 0 ? void 0 : message.viewOnce]);
@@ -43119,7 +43234,8 @@ var Message$1 = function Message(_ref) {
43119
43234
  collapsedLinesLimit = _ref.collapsedLinesLimit,
43120
43235
  _ref$createChatOnAvat = _ref.createChatOnAvatarTap,
43121
43236
  createChatOnAvatarTap = _ref$createChatOnAvat === void 0 ? true : _ref$createChatOnAvat,
43122
- ifLatestAndHasNotPreview = _ref.ifLatestAndHasNotPreview;
43237
+ ifLatestAndHasNotPreview = _ref.ifLatestAndHasNotPreview,
43238
+ onPhoneNumberClick = _ref.onPhoneNumberClick;
43123
43239
  var isTabActive = (_tabIsActiveRef$curre = tabIsActiveRef === null || tabIsActiveRef === void 0 ? void 0 : tabIsActiveRef.current) != null ? _tabIsActiveRef$curre : tabIsActive;
43124
43240
  var getComparableUserId = function getComparableUserId(messageUser) {
43125
43241
  return messageUser !== null && messageUser !== void 0 && messageUser.id ? String(messageUser.id) : 'deleted';
@@ -43585,6 +43701,7 @@ var Message$1 = function Message(_ref) {
43585
43701
  })) : (/*#__PURE__*/React__default.createElement(MessageBody$1, {
43586
43702
  ifLatestAndHasNotPreview: ifLatestAndHasNotPreview,
43587
43703
  onInviteLinkClick: onInviteLinkClick,
43704
+ onPhoneNumberClick: onPhoneNumberClick,
43588
43705
  handleRetractVote: handleRetractVote,
43589
43706
  handleEndVote: handleEndVote,
43590
43707
  message: message,
@@ -46263,7 +46380,8 @@ var MessageList = function MessageList(_ref) {
46263
46380
  _ref$createChatOnAvat = _ref.createChatOnAvatarTap,
46264
46381
  createChatOnAvatarTap = _ref$createChatOnAvat === void 0 ? true : _ref$createChatOnAvat,
46265
46382
  _ref$allowSendAttachm = _ref.allowSendAttachment,
46266
- allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm;
46383
+ allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm,
46384
+ onPhoneNumberClick = _ref.onPhoneNumberClick;
46267
46385
  var _useColor = useColors(),
46268
46386
  outgoingMessageBackground = _useColor[THEME_COLORS.OUTGOING_MESSAGE_BACKGROUND],
46269
46387
  themeBackgroundColor = _useColor[THEME_COLORS.BACKGROUND],
@@ -46753,7 +46871,8 @@ var MessageList = function MessageList(_ref) {
46753
46871
  showInfoMessageProps: showInfoMessageProps,
46754
46872
  ogMetadataProps: ogMetadataProps,
46755
46873
  collapsedLinesLimit: collapsedLinesLimit,
46756
- createChatOnAvatarTap: createChatOnAvatarTap
46874
+ createChatOnAvatarTap: createChatOnAvatarTap,
46875
+ onPhoneNumberClick: onPhoneNumberClick
46757
46876
  }));
46758
46877
  };
46759
46878
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, allowSendAttachment && isDragging && !(attachmentsPreview !== null && attachmentsPreview !== void 0 && attachmentsPreview.show && mediaFile) && (/*#__PURE__*/React__default.createElement(DragAndDropContainer, {
@@ -47131,7 +47250,8 @@ var MessagesContainer = function MessagesContainer(_ref) {
47131
47250
  _ref$createChatOnAvat = _ref.createChatOnAvatarTap,
47132
47251
  createChatOnAvatarTap = _ref$createChatOnAvat === void 0 ? true : _ref$createChatOnAvat,
47133
47252
  _ref$allowSendAttachm = _ref.allowSendAttachment,
47134
- allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm;
47253
+ allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm,
47254
+ onPhoneNumberClick = _ref.onPhoneNumberClick;
47135
47255
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MessageList, {
47136
47256
  fontFamily: fontFamily,
47137
47257
  ownMessageOnRightSide: ownMessageOnRightSide,
@@ -47268,7 +47388,8 @@ var MessagesContainer = function MessagesContainer(_ref) {
47268
47388
  ogMetadataProps: ogMetadataProps,
47269
47389
  collapsedLinesLimit: collapsedLinesLimit,
47270
47390
  createChatOnAvatarTap: createChatOnAvatarTap,
47271
- allowSendAttachment: allowSendAttachment
47391
+ allowSendAttachment: allowSendAttachment,
47392
+ onPhoneNumberClick: onPhoneNumberClick
47272
47393
  }));
47273
47394
  };
47274
47395
 
package/index.modern.js CHANGED
@@ -7,6 +7,7 @@ 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';
10
11
  import Pica from 'pica';
11
12
  import { createPortal } from 'react-dom';
12
13
  import Cropper from 'react-easy-crop';
@@ -15146,7 +15147,7 @@ var UploadAvatarButton = styled.button(_templateObject23 || (_templateObject23 =
15146
15147
  var UploadAvatarHandler = styled.div(_templateObject24 || (_templateObject24 = _taggedTemplateLiteralLoose(["\n margin-left: 18px;\n font-size: 13px;\n color: ", ";\n"])), function (props) {
15147
15148
  return props.color;
15148
15149
  });
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) {
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 &.phone-number {\n color: ", ";\n cursor: pointer;\n }\n &:hover {\n &.phone-number {\n text-decoration: underline;\n }\n }\n"])), function (props) {
15150
15151
  return props.fontWeight || props.isLastMessage && '500';
15151
15152
  }, function (props) {
15152
15153
  return props.fontFamily;
@@ -15162,6 +15163,8 @@ var StyledText = styled.span(_templateObject25 || (_templateObject25 = _taggedTe
15162
15163
  return props.isLastMessage && '500';
15163
15164
  }, function (props) {
15164
15165
  return props.shouldOpenUserProfileForMention && 'pointer';
15166
+ }, function (props) {
15167
+ return props.color;
15165
15168
  });
15166
15169
  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) {
15167
15170
  return props.color;
@@ -15442,6 +15445,103 @@ var linkifyTextPart = function linkifyTextPart(textPart, match, target, isInvite
15442
15445
  });
15443
15446
  return newMessageText || textPart;
15444
15447
  };
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
+ };
15445
15545
  var MessageTextFormat = function MessageTextFormat(_ref2) {
15446
15546
  var text = _ref2.text,
15447
15547
  message = _ref2.message,
@@ -15458,7 +15558,8 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
15458
15558
  target = _ref2$target === void 0 ? '_blank' : _ref2$target,
15459
15559
  _ref2$isInviteLink = _ref2.isInviteLink,
15460
15560
  isInviteLink = _ref2$isInviteLink === void 0 ? false : _ref2$isInviteLink,
15461
- onInviteLinkClick = _ref2.onInviteLinkClick;
15561
+ onInviteLinkClick = _ref2.onInviteLinkClick,
15562
+ onPhoneNumberClick = _ref2.onPhoneNumberClick;
15462
15563
  try {
15463
15564
  var messageText = [];
15464
15565
  var linkify = new LinkifyIt();
@@ -15478,11 +15579,17 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
15478
15579
  if (!isLastMessage && !asSampleText && firstPartMatch) {
15479
15580
  firstPart = linkifyTextPart(firstPart, firstPartMatch, target, isInviteLink, onInviteLinkClick);
15480
15581
  }
15582
+ if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
15583
+ firstPart = linkifyPhoneNumbers(firstPart, onPhoneNumberClick, '#438ced', message.id);
15584
+ }
15481
15585
  var secondPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(attributeOffset + attribute.length) : '');
15482
15586
  var secondPartMatch = secondPart ? linkify.match(secondPart) : '';
15483
15587
  if (!isLastMessage && !asSampleText && secondPartMatch) {
15484
15588
  secondPart = linkifyTextPart(secondPart, secondPartMatch, target, isInviteLink, onInviteLinkClick);
15485
15589
  }
15590
+ if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
15591
+ secondPart = linkifyPhoneNumbers(secondPart, onPhoneNumberClick, '#438ced', message.id);
15592
+ }
15486
15593
  if (attribute.type.includes('mention')) {
15487
15594
  var mentionDisplay = message.mentionedUsers && message.mentionedUsers.find(function (men) {
15488
15595
  return men.id === attribute.metadata;
@@ -15544,6 +15651,9 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
15544
15651
  if (!isLastMessage && !asSampleText && match) {
15545
15652
  newTextPart = linkifyTextPart(_textPart, match, target, isInviteLink, onInviteLinkClick);
15546
15653
  }
15654
+ if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
15655
+ newTextPart = linkifyPhoneNumbers(newTextPart, onPhoneNumberClick, '#438ced', message.id);
15656
+ }
15547
15657
  messageText.push(firstPart, asSampleText ? newTextPart : (/*#__PURE__*/React__default.createElement(StyledText, {
15548
15658
  isLastMessage: isLastMessage,
15549
15659
  className: attribute.type,
@@ -15560,6 +15670,9 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
15560
15670
  if (!isLastMessage && !asSampleText && match) {
15561
15671
  messageText = linkifyTextPart(text, match, target, isInviteLink, onInviteLinkClick);
15562
15672
  }
15673
+ if (!isLastMessage && !asSampleText && onPhoneNumberClick) {
15674
+ messageText = linkifyPhoneNumbers(messageText.length > 0 ? messageText : text, onPhoneNumberClick, '#438ced', message.id);
15675
+ }
15563
15676
  }
15564
15677
  return messageText.length > 1 ? asSampleText ? messageText.join('') : messageText : text;
15565
15678
  } catch (e) {
@@ -40984,6 +41097,7 @@ var MessageBody = function MessageBody(_ref) {
40984
41097
  ogMetadataProps = _ref.ogMetadataProps,
40985
41098
  unsupportedMessage = _ref.unsupportedMessage,
40986
41099
  onInviteLinkClick = _ref.onInviteLinkClick,
41100
+ onPhoneNumberClick = _ref.onPhoneNumberClick,
40987
41101
  collapsedLinesLimit = _ref.collapsedLinesLimit,
40988
41102
  ifLatestAndHasNotPreview = _ref.ifLatestAndHasNotPreview;
40989
41103
  var _useColor = useColors(),
@@ -41021,9 +41135,10 @@ var MessageBody = function MessageBody(_ref) {
41021
41135
  unsupportedMessage: unsupportedMessage,
41022
41136
  target: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.target,
41023
41137
  isInviteLink: (ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.isInviteLink) || false,
41024
- onInviteLinkClick: onInviteLinkClick
41138
+ onInviteLinkClick: onInviteLinkClick,
41139
+ onPhoneNumberClick: onPhoneNumberClick
41025
41140
  });
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]);
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, onPhoneNumberClick]);
41027
41142
  var viewOnce = useMemo(function () {
41028
41143
  return message.viewOnce;
41029
41144
  }, [message === null || message === void 0 ? void 0 : message.viewOnce]);
@@ -43118,7 +43233,8 @@ var Message$1 = function Message(_ref) {
43118
43233
  collapsedLinesLimit = _ref.collapsedLinesLimit,
43119
43234
  _ref$createChatOnAvat = _ref.createChatOnAvatarTap,
43120
43235
  createChatOnAvatarTap = _ref$createChatOnAvat === void 0 ? true : _ref$createChatOnAvat,
43121
- ifLatestAndHasNotPreview = _ref.ifLatestAndHasNotPreview;
43236
+ ifLatestAndHasNotPreview = _ref.ifLatestAndHasNotPreview,
43237
+ onPhoneNumberClick = _ref.onPhoneNumberClick;
43122
43238
  var isTabActive = (_tabIsActiveRef$curre = tabIsActiveRef === null || tabIsActiveRef === void 0 ? void 0 : tabIsActiveRef.current) != null ? _tabIsActiveRef$curre : tabIsActive;
43123
43239
  var getComparableUserId = function getComparableUserId(messageUser) {
43124
43240
  return messageUser !== null && messageUser !== void 0 && messageUser.id ? String(messageUser.id) : 'deleted';
@@ -43584,6 +43700,7 @@ var Message$1 = function Message(_ref) {
43584
43700
  })) : (/*#__PURE__*/React__default.createElement(MessageBody$1, {
43585
43701
  ifLatestAndHasNotPreview: ifLatestAndHasNotPreview,
43586
43702
  onInviteLinkClick: onInviteLinkClick,
43703
+ onPhoneNumberClick: onPhoneNumberClick,
43587
43704
  handleRetractVote: handleRetractVote,
43588
43705
  handleEndVote: handleEndVote,
43589
43706
  message: message,
@@ -46262,7 +46379,8 @@ var MessageList = function MessageList(_ref) {
46262
46379
  _ref$createChatOnAvat = _ref.createChatOnAvatarTap,
46263
46380
  createChatOnAvatarTap = _ref$createChatOnAvat === void 0 ? true : _ref$createChatOnAvat,
46264
46381
  _ref$allowSendAttachm = _ref.allowSendAttachment,
46265
- allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm;
46382
+ allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm,
46383
+ onPhoneNumberClick = _ref.onPhoneNumberClick;
46266
46384
  var _useColor = useColors(),
46267
46385
  outgoingMessageBackground = _useColor[THEME_COLORS.OUTGOING_MESSAGE_BACKGROUND],
46268
46386
  themeBackgroundColor = _useColor[THEME_COLORS.BACKGROUND],
@@ -46752,7 +46870,8 @@ var MessageList = function MessageList(_ref) {
46752
46870
  showInfoMessageProps: showInfoMessageProps,
46753
46871
  ogMetadataProps: ogMetadataProps,
46754
46872
  collapsedLinesLimit: collapsedLinesLimit,
46755
- createChatOnAvatarTap: createChatOnAvatarTap
46873
+ createChatOnAvatarTap: createChatOnAvatarTap,
46874
+ onPhoneNumberClick: onPhoneNumberClick
46756
46875
  }));
46757
46876
  };
46758
46877
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, allowSendAttachment && isDragging && !(attachmentsPreview !== null && attachmentsPreview !== void 0 && attachmentsPreview.show && mediaFile) && (/*#__PURE__*/React__default.createElement(DragAndDropContainer, {
@@ -47130,7 +47249,8 @@ var MessagesContainer = function MessagesContainer(_ref) {
47130
47249
  _ref$createChatOnAvat = _ref.createChatOnAvatarTap,
47131
47250
  createChatOnAvatarTap = _ref$createChatOnAvat === void 0 ? true : _ref$createChatOnAvat,
47132
47251
  _ref$allowSendAttachm = _ref.allowSendAttachment,
47133
- allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm;
47252
+ allowSendAttachment = _ref$allowSendAttachm === void 0 ? true : _ref$allowSendAttachm,
47253
+ onPhoneNumberClick = _ref.onPhoneNumberClick;
47134
47254
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MessageList, {
47135
47255
  fontFamily: fontFamily,
47136
47256
  ownMessageOnRightSide: ownMessageOnRightSide,
@@ -47267,7 +47387,8 @@ var MessagesContainer = function MessagesContainer(_ref) {
47267
47387
  ogMetadataProps: ogMetadataProps,
47268
47388
  collapsedLinesLimit: collapsedLinesLimit,
47269
47389
  createChatOnAvatarTap: createChatOnAvatarTap,
47270
- allowSendAttachment: allowSendAttachment
47390
+ allowSendAttachment: allowSendAttachment,
47391
+ onPhoneNumberClick: onPhoneNumberClick
47271
47392
  }));
47272
47393
  };
47273
47394
 
@@ -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, onPhoneNumberClick }: {
12
12
  text: string;
13
13
  message: any;
14
14
  contactsMap?: IContactsMap | undefined;
@@ -23,5 +23,6 @@ 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;
26
27
  }) => any;
27
28
  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.4",
3
+ "version": "1.8.7-beta.5",
4
4
  "description": "Interactive React UI Components for Sceyt Chat.",
5
5
  "author": "Sceyt",
6
6
  "license": "MIT",
@@ -85,6 +85,7 @@
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",
88
89
  "linkify-it": "^4.0.1",
89
90
  "loglevel": "^1.9.2",
90
91
  "@ffmpeg/ffmpeg": "^0.12.10",