sceyt-chat-react-uikit 1.7.5-beta.12 → 1.7.5-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Message/Message.types.d.ts +2 -22
- package/components/Message/MessageBody/index.d.ts +2 -22
- package/components/Message/OGMetadata/index.d.ts +2 -1
- package/components/Messages/MessageList/index.d.ts +2 -17
- package/components/Messages/index.d.ts +2 -17
- package/index.js +231 -215
- package/index.modern.js +231 -215
- package/messageUtils/index.d.ts +2 -1
- package/package.json +1 -1
- package/types/index.d.ts +22 -0
package/index.modern.js
CHANGED
|
@@ -13651,6 +13651,12 @@ var CopiedTooltip = styled.span(_templateObject41 || (_templateObject41 = _tagge
|
|
|
13651
13651
|
return p.color;
|
|
13652
13652
|
});
|
|
13653
13653
|
|
|
13654
|
+
var SceytReduxContext = /*#__PURE__*/React__default.createContext(null);
|
|
13655
|
+
|
|
13656
|
+
var useSelector = createSelectorHook(SceytReduxContext);
|
|
13657
|
+
var useDispatch = createDispatchHook(SceytReduxContext);
|
|
13658
|
+
var useStore = createStoreHook(SceytReduxContext);
|
|
13659
|
+
|
|
13654
13660
|
var _templateObject$1, _templateObject2$1, _templateObject3$1, _templateObject4$1, _templateObject5$1;
|
|
13655
13661
|
var StatusText = styled.span(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n color: ", ";\n font-weight: 400;\n font-size: ", ";\n"])), function (props) {
|
|
13656
13662
|
return props.color;
|
|
@@ -13726,7 +13732,7 @@ var MessageStatusIcon = function MessageStatusIcon(_ref) {
|
|
|
13726
13732
|
});
|
|
13727
13733
|
}
|
|
13728
13734
|
};
|
|
13729
|
-
var linkifyTextPart = function linkifyTextPart(textPart, match, target) {
|
|
13735
|
+
var linkifyTextPart = function linkifyTextPart(textPart, match, target, isInviteLink, onInviteLinkClick) {
|
|
13730
13736
|
if (target === void 0) {
|
|
13731
13737
|
target = '_blank';
|
|
13732
13738
|
}
|
|
@@ -13737,18 +13743,29 @@ var linkifyTextPart = function linkifyTextPart(textPart, match, target) {
|
|
|
13737
13743
|
var matchIndex = textPart.indexOf(matchItem.text, lastFoundIndex);
|
|
13738
13744
|
lastFoundIndex = matchIndex + matchItem.text.length;
|
|
13739
13745
|
if (index === 0) {
|
|
13740
|
-
newMessageText = [textPart.substring(0, matchIndex), /*#__PURE__*/React__default.createElement("a", {
|
|
13746
|
+
newMessageText = [textPart.substring(0, matchIndex), /*#__PURE__*/React__default.createElement("a", Object.assign({
|
|
13741
13747
|
draggable: false,
|
|
13742
13748
|
key: index,
|
|
13743
|
-
href: matchItem.url,
|
|
13749
|
+
href: isInviteLink ? undefined : matchItem.url,
|
|
13744
13750
|
target: target,
|
|
13745
|
-
rel: 'noreferrer'
|
|
13746
|
-
|
|
13751
|
+
rel: 'noreferrer',
|
|
13752
|
+
style: {
|
|
13753
|
+
cursor: 'pointer'
|
|
13754
|
+
}
|
|
13755
|
+
}, isInviteLink ? {
|
|
13756
|
+
onClick: function onClick() {
|
|
13757
|
+
var splitedKey = matchItem.url.split('/');
|
|
13758
|
+
var key = splitedKey[splitedKey.length - 1];
|
|
13759
|
+
if (key) {
|
|
13760
|
+
onInviteLinkClick === null || onInviteLinkClick === void 0 ? void 0 : onInviteLinkClick(key);
|
|
13761
|
+
}
|
|
13762
|
+
}
|
|
13763
|
+
} : {}), "" + matchItem.text)];
|
|
13747
13764
|
} else {
|
|
13748
13765
|
newMessageText.push(textPart.substring(prevMatchEnd, matchIndex), /*#__PURE__*/React__default.createElement("a", {
|
|
13749
13766
|
draggable: false,
|
|
13750
13767
|
key: index,
|
|
13751
|
-
href: matchItem.url,
|
|
13768
|
+
href: isInviteLink ? undefined : matchItem.url,
|
|
13752
13769
|
target: target,
|
|
13753
13770
|
rel: 'noreferrer'
|
|
13754
13771
|
}, "" + matchItem.text));
|
|
@@ -13773,7 +13790,13 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
13773
13790
|
shouldOpenUserProfileForMention = _ref2.shouldOpenUserProfileForMention,
|
|
13774
13791
|
unsupportedMessage = _ref2.unsupportedMessage,
|
|
13775
13792
|
_ref2$target = _ref2.target,
|
|
13776
|
-
target = _ref2$target === void 0 ? '_blank' : _ref2$target
|
|
13793
|
+
target = _ref2$target === void 0 ? '_blank' : _ref2$target,
|
|
13794
|
+
_ref2$isInviteLink = _ref2.isInviteLink,
|
|
13795
|
+
isInviteLink = _ref2$isInviteLink === void 0 ? false : _ref2$isInviteLink;
|
|
13796
|
+
var dispatch = useDispatch();
|
|
13797
|
+
var onInviteLinkClick = function onInviteLinkClick(key) {
|
|
13798
|
+
dispatch(getChannelByInviteKeyAC(key));
|
|
13799
|
+
};
|
|
13777
13800
|
try {
|
|
13778
13801
|
var messageText = [];
|
|
13779
13802
|
var linkify = new LinkifyIt();
|
|
@@ -13791,12 +13814,12 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
13791
13814
|
var firstPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(nextPartIndex || 0, attributeOffset) : '');
|
|
13792
13815
|
var firstPartMatch = firstPart ? linkify.match(firstPart) : '';
|
|
13793
13816
|
if (!isLastMessage && !asSampleText && firstPartMatch) {
|
|
13794
|
-
firstPart = linkifyTextPart(firstPart, firstPartMatch, target);
|
|
13817
|
+
firstPart = linkifyTextPart(firstPart, firstPartMatch, target, isInviteLink, onInviteLinkClick);
|
|
13795
13818
|
}
|
|
13796
13819
|
var secondPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(attributeOffset + attribute.length) : '');
|
|
13797
13820
|
var secondPartMatch = secondPart ? linkify.match(secondPart) : '';
|
|
13798
13821
|
if (!isLastMessage && !asSampleText && secondPartMatch) {
|
|
13799
|
-
secondPart = linkifyTextPart(secondPart, secondPartMatch, target);
|
|
13822
|
+
secondPart = linkifyTextPart(secondPart, secondPartMatch, target, isInviteLink, onInviteLinkClick);
|
|
13800
13823
|
}
|
|
13801
13824
|
if (attribute.type.includes('mention')) {
|
|
13802
13825
|
var mentionDisplay = message.mentionedUsers && message.mentionedUsers.find(function (men) {
|
|
@@ -13865,7 +13888,7 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
|
|
|
13865
13888
|
} else {
|
|
13866
13889
|
var match = linkify.match(text);
|
|
13867
13890
|
if (!isLastMessage && !asSampleText && match) {
|
|
13868
|
-
messageText = linkifyTextPart(text, match, target);
|
|
13891
|
+
messageText = linkifyTextPart(text, match, target, isInviteLink, onInviteLinkClick);
|
|
13869
13892
|
}
|
|
13870
13893
|
}
|
|
13871
13894
|
return messageText.length > 1 ? asSampleText ? messageText.join('') : messageText : text;
|
|
@@ -17659,6 +17682,7 @@ function getChannelByInviteKey(action) {
|
|
|
17659
17682
|
_context33.n = 2;
|
|
17660
17683
|
return put(setJoinableChannelAC(JSON.parse(JSON.stringify(channel[0]))));
|
|
17661
17684
|
case 2:
|
|
17685
|
+
window.history.pushState({}, '', window.location.pathname + '?join=' + key);
|
|
17662
17686
|
_context33.n = 5;
|
|
17663
17687
|
break;
|
|
17664
17688
|
case 3:
|
|
@@ -22292,12 +22316,6 @@ var store = configureStore({
|
|
|
22292
22316
|
});
|
|
22293
22317
|
sagaMiddleware.run(rootSaga);
|
|
22294
22318
|
|
|
22295
|
-
var SceytReduxContext = /*#__PURE__*/React__default.createContext(null);
|
|
22296
|
-
|
|
22297
|
-
var useSelector = createSelectorHook(SceytReduxContext);
|
|
22298
|
-
var useDispatch = createDispatchHook(SceytReduxContext);
|
|
22299
|
-
var useStore = createStoreHook(SceytReduxContext);
|
|
22300
|
-
|
|
22301
22319
|
var channelsSelector = function channelsSelector(store) {
|
|
22302
22320
|
return store.ChannelReducer.channels;
|
|
22303
22321
|
};
|
|
@@ -22883,6 +22901,7 @@ function JoinGroupPopup(_ref) {
|
|
|
22883
22901
|
height: '12px',
|
|
22884
22902
|
width: '12px'
|
|
22885
22903
|
}), /*#__PURE__*/React__default.createElement(TopAvatar, null, /*#__PURE__*/React__default.createElement(Avatar, {
|
|
22904
|
+
key: channel.id,
|
|
22886
22905
|
name: channel.subject || '',
|
|
22887
22906
|
image: channel.avatar || '',
|
|
22888
22907
|
size: 90,
|
|
@@ -22894,7 +22913,7 @@ function JoinGroupPopup(_ref) {
|
|
|
22894
22913
|
color: textPrimary
|
|
22895
22914
|
}, subtitleText), showMembersAvatars && (/*#__PURE__*/React__default.createElement(MembersRow, null, firstMembers.map(function (m, idx) {
|
|
22896
22915
|
return /*#__PURE__*/React__default.createElement(MemberAvatar, {
|
|
22897
|
-
key: m.id,
|
|
22916
|
+
key: m.id || "member-" + idx,
|
|
22898
22917
|
index: idx,
|
|
22899
22918
|
borderColor: background
|
|
22900
22919
|
}, /*#__PURE__*/React__default.createElement(Avatar, {
|
|
@@ -34410,6 +34429,8 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
34410
34429
|
ogContainerMargin = _ref.ogContainerMargin,
|
|
34411
34430
|
_ref$target = _ref.target,
|
|
34412
34431
|
target = _ref$target === void 0 ? '_blank' : _ref$target,
|
|
34432
|
+
_ref$isInviteLink = _ref.isInviteLink,
|
|
34433
|
+
isInviteLink = _ref$isInviteLink === void 0 ? false : _ref$isInviteLink,
|
|
34413
34434
|
metadataGetSuccessCallback = _ref.metadataGetSuccessCallback;
|
|
34414
34435
|
var dispatch = useDispatch();
|
|
34415
34436
|
var oGMetadata = useSelector(function (state) {
|
|
@@ -34687,7 +34708,14 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
34687
34708
|
alt: ''
|
|
34688
34709
|
})))) : textContent;
|
|
34689
34710
|
}, [hasImage, elements, shouldAnimate, ogContainerShowBackground, ogShowFavicon, faviconUrl, textContent]);
|
|
34690
|
-
|
|
34711
|
+
var getChannel = useCallback(function () {
|
|
34712
|
+
var splitedKey = attachment === null || attachment === void 0 ? void 0 : attachment.url.split('/');
|
|
34713
|
+
var key = splitedKey[splitedKey.length - 1];
|
|
34714
|
+
if (key) {
|
|
34715
|
+
dispatch(getChannelByInviteKeyAC(key));
|
|
34716
|
+
}
|
|
34717
|
+
}, [attachment === null || attachment === void 0 ? void 0 : attachment.url]);
|
|
34718
|
+
return /*#__PURE__*/React__default.createElement(OGMetadataContainer, Object.assign({
|
|
34691
34719
|
showOGMetadata: !!showOGMetadata,
|
|
34692
34720
|
bgColor: incoming ? incomingMessageBackgroundX : outgoingMessageBackgroundX,
|
|
34693
34721
|
showBackground: ogContainerShowBackground,
|
|
@@ -34695,12 +34723,18 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
34695
34723
|
borderRadius: ogContainerBorderRadius,
|
|
34696
34724
|
padding: ogContainerPadding,
|
|
34697
34725
|
className: ogContainerClassName,
|
|
34698
|
-
containerMargin: ogContainerMargin
|
|
34726
|
+
containerMargin: ogContainerMargin
|
|
34727
|
+
}, isInviteLink ? {
|
|
34728
|
+
as: 'div',
|
|
34729
|
+
onClick: function onClick() {
|
|
34730
|
+
getChannel();
|
|
34731
|
+
}
|
|
34732
|
+
} : {
|
|
34699
34733
|
as: 'a',
|
|
34700
34734
|
href: attachment === null || attachment === void 0 ? void 0 : attachment.url,
|
|
34701
34735
|
target: target,
|
|
34702
34736
|
rel: target === '_blank' ? 'noopener noreferrer' : undefined
|
|
34703
|
-
}, content);
|
|
34737
|
+
}), content);
|
|
34704
34738
|
};
|
|
34705
34739
|
var sharedKeyframes = "\n @keyframes fadeInSlideUp {\n from {\n opacity: 0;\n transform: translateY(10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n @keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n @keyframes expandHeight {\n from {\n max-height: 0;\n opacity: 0;\n }\n to {\n max-height: 1000px;\n opacity: 1;\n }\n }\n";
|
|
34706
34740
|
var OGMetadataContainer = styled.div(_templateObject$F || (_templateObject$F = _taggedTemplateLiteralLoose(["\n min-width: inherit;\n max-width: inherit;\n width: 100%;\n display: grid;\n grid-template-columns: 1fr;\n background-color: ", ";\n border-radius: ", ";\n margin: ", ";\n // margin-bottom: ", ";\n padding: ", ";\n text-decoration: none;\n color: inherit;\n &:hover {\n opacity: 0.9;\n cursor: pointer;\n }\n"])), function (_ref2) {
|
|
@@ -35237,7 +35271,8 @@ var MessageBody = function MessageBody(_ref) {
|
|
|
35237
35271
|
ogContainerClassName: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.ogContainerClassName,
|
|
35238
35272
|
ogContainerShowBackground: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.ogContainerShowBackground,
|
|
35239
35273
|
ogContainerBackground: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.ogContainerBackground,
|
|
35240
|
-
infoPadding: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.infoPadding
|
|
35274
|
+
infoPadding: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.infoPadding,
|
|
35275
|
+
isInviteLink: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.isInviteLink
|
|
35241
35276
|
})), messageStatusAndTimePosition === 'onMessage' && !notLinkAttachment && (messageStatusVisible || messageTimeVisible) ? (/*#__PURE__*/React__default.createElement(MessageStatusAndTime$1, {
|
|
35242
35277
|
message: message,
|
|
35243
35278
|
showMessageTimeAndStatusOnlyOnHover: showMessageTimeAndStatusOnlyOnHover,
|
|
@@ -35969,23 +36004,7 @@ var Message$1 = function Message(_ref) {
|
|
|
35969
36004
|
messageTextLineHeight = _ref.messageTextLineHeight,
|
|
35970
36005
|
messageTimeColorOnAttachment = _ref.messageTimeColorOnAttachment,
|
|
35971
36006
|
shouldOpenUserProfileForMention = _ref.shouldOpenUserProfileForMention,
|
|
35972
|
-
|
|
35973
|
-
ogMetadataProps = _ref$ogMetadataProps === void 0 ? {
|
|
35974
|
-
maxWidth: 400,
|
|
35975
|
-
maxHeight: undefined,
|
|
35976
|
-
ogLayoutOrder: 'link-first',
|
|
35977
|
-
ogShowUrl: false,
|
|
35978
|
-
ogShowTitle: true,
|
|
35979
|
-
ogShowDescription: true,
|
|
35980
|
-
ogShowFavicon: true,
|
|
35981
|
-
order: {
|
|
35982
|
-
image: 1,
|
|
35983
|
-
title: 2,
|
|
35984
|
-
description: 3,
|
|
35985
|
-
link: 4
|
|
35986
|
-
},
|
|
35987
|
-
infoPadding: '0 8px'
|
|
35988
|
-
} : _ref$ogMetadataProps,
|
|
36007
|
+
ogMetadataProps = _ref.ogMetadataProps,
|
|
35989
36008
|
_ref$showInfoMessageP = _ref.showInfoMessageProps,
|
|
35990
36009
|
showInfoMessageProps = _ref$showInfoMessageP === void 0 ? {} : _ref$showInfoMessageP;
|
|
35991
36010
|
var _useColor = useColors(),
|
|
@@ -36917,23 +36936,7 @@ var MessageList = function MessageList(_ref2) {
|
|
|
36917
36936
|
shouldOpenUserProfileForMention = _ref2.shouldOpenUserProfileForMention,
|
|
36918
36937
|
_ref2$showInfoMessage = _ref2.showInfoMessageProps,
|
|
36919
36938
|
showInfoMessageProps = _ref2$showInfoMessage === void 0 ? {} : _ref2$showInfoMessage,
|
|
36920
|
-
|
|
36921
|
-
ogMetadataProps = _ref2$ogMetadataProps === void 0 ? {
|
|
36922
|
-
maxWidth: 400,
|
|
36923
|
-
maxHeight: undefined,
|
|
36924
|
-
ogLayoutOrder: 'link-first',
|
|
36925
|
-
ogShowUrl: false,
|
|
36926
|
-
ogShowTitle: true,
|
|
36927
|
-
ogShowDescription: true,
|
|
36928
|
-
ogShowFavicon: true,
|
|
36929
|
-
order: {
|
|
36930
|
-
image: 1,
|
|
36931
|
-
title: 2,
|
|
36932
|
-
description: 3,
|
|
36933
|
-
link: 4
|
|
36934
|
-
},
|
|
36935
|
-
infoPadding: '0 8px'
|
|
36936
|
-
} : _ref2$ogMetadataProps;
|
|
36939
|
+
ogMetadataProps = _ref2.ogMetadataProps;
|
|
36937
36940
|
var _useColor = useColors(),
|
|
36938
36941
|
outgoingMessageBackground = _useColor[THEME_COLORS.OUTGOING_MESSAGE_BACKGROUND],
|
|
36939
36942
|
themeBackgroundColor = _useColor[THEME_COLORS.BACKGROUND],
|
|
@@ -38026,7 +38029,8 @@ var MessagesContainer = function MessagesContainer(_ref) {
|
|
|
38026
38029
|
description: 3,
|
|
38027
38030
|
link: 4
|
|
38028
38031
|
},
|
|
38029
|
-
infoPadding: '0 8px'
|
|
38032
|
+
infoPadding: '0 8px',
|
|
38033
|
+
isInviteLink: false
|
|
38030
38034
|
} : _ref$ogMetadataProps;
|
|
38031
38035
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MessageList, {
|
|
38032
38036
|
fontFamily: fontFamily,
|
|
@@ -43689,145 +43693,24 @@ function InviteLinkModal(_ref) {
|
|
|
43689
43693
|
};
|
|
43690
43694
|
var handleForwardChannels = function handleForwardChannels(channelIds) {
|
|
43691
43695
|
try {
|
|
43692
|
-
|
|
43693
|
-
|
|
43694
|
-
|
|
43695
|
-
|
|
43696
|
-
|
|
43697
|
-
|
|
43698
|
-
|
|
43699
|
-
|
|
43700
|
-
|
|
43701
|
-
|
|
43702
|
-
|
|
43703
|
-
|
|
43704
|
-
|
|
43705
|
-
body: inviteUrl,
|
|
43706
|
-
mentionedUsers: [],
|
|
43707
|
-
type: 'text',
|
|
43708
|
-
attachments: [linkAttachmentToSend]
|
|
43709
|
-
};
|
|
43710
|
-
dispatch(forwardMessageAC(message, channelId, connectionStatus, false));
|
|
43711
|
-
} else {
|
|
43712
|
-
var _temp2 = _catch(function () {
|
|
43713
|
-
var toPngBlob = function toPngBlob() {
|
|
43714
|
-
try {
|
|
43715
|
-
var dpr = 4;
|
|
43716
|
-
var baseQrSize = 200;
|
|
43717
|
-
var qrSize = baseQrSize * dpr;
|
|
43718
|
-
var qrUrl = "https://api.qrserver.com/v1/create-qr-code/?data=" + encodeURIComponent(inviteUrl) + "&size=" + qrSize + "x" + qrSize + "&ecc=H&margin=32&color=000000&bgcolor=FFFFFF";
|
|
43719
|
-
return Promise.resolve(fetch(qrUrl, {
|
|
43720
|
-
cache: 'no-store'
|
|
43721
|
-
})).then(function (qrResp) {
|
|
43722
|
-
return Promise.resolve(qrResp.blob()).then(function (qrBlob) {
|
|
43723
|
-
var qrObjectUrl = URL.createObjectURL(qrBlob);
|
|
43724
|
-
var boxWidth = qrSize;
|
|
43725
|
-
var boxHeight = qrSize;
|
|
43726
|
-
var canvas = document.createElement('canvas');
|
|
43727
|
-
canvas.width = boxWidth;
|
|
43728
|
-
canvas.height = boxHeight;
|
|
43729
|
-
var ctx = canvas.getContext('2d');
|
|
43730
|
-
var img = new Image();
|
|
43731
|
-
img.src = qrObjectUrl;
|
|
43732
|
-
return Promise.resolve(new Promise(function (resolve, reject) {
|
|
43733
|
-
img.onload = function () {
|
|
43734
|
-
return resolve(null);
|
|
43735
|
-
};
|
|
43736
|
-
img.onerror = reject;
|
|
43737
|
-
})).then(function () {
|
|
43738
|
-
var _logoRef$current;
|
|
43739
|
-
function _temp6() {
|
|
43740
|
-
URL.revokeObjectURL(qrObjectUrl);
|
|
43741
|
-
return Promise.resolve(new Promise(function (resolve) {
|
|
43742
|
-
return canvas.toBlob(function (b) {
|
|
43743
|
-
return resolve(b);
|
|
43744
|
-
}, 'image/png');
|
|
43745
|
-
}));
|
|
43746
|
-
}
|
|
43747
|
-
ctx.imageSmoothingEnabled = false;
|
|
43748
|
-
ctx.drawImage(img, 0, 0, qrSize, qrSize);
|
|
43749
|
-
var overlaySize = qrSize * 22 / 100;
|
|
43750
|
-
var overlayX = (boxWidth - overlaySize) / 2;
|
|
43751
|
-
var overlayY = (boxHeight - overlaySize) / 2;
|
|
43752
|
-
var roundedPath = function roundedPath(x, y, w, h, r) {
|
|
43753
|
-
ctx.beginPath();
|
|
43754
|
-
ctx.moveTo(x + r, y);
|
|
43755
|
-
ctx.lineTo(x + w - r, y);
|
|
43756
|
-
ctx.quadraticCurveTo(x + w, y, x + w, y + r);
|
|
43757
|
-
ctx.lineTo(x + w, y + h - r);
|
|
43758
|
-
ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
|
|
43759
|
-
ctx.lineTo(x + r, y + h);
|
|
43760
|
-
ctx.quadraticCurveTo(x, y + h, x, y + h - r);
|
|
43761
|
-
ctx.lineTo(x, y + r);
|
|
43762
|
-
ctx.quadraticCurveTo(x, y, x + r, y);
|
|
43763
|
-
ctx.closePath();
|
|
43764
|
-
};
|
|
43765
|
-
var cornerRadius = 8 * dpr;
|
|
43766
|
-
var imgElement = (_logoRef$current = logoRef.current) === null || _logoRef$current === void 0 ? void 0 : _logoRef$current.querySelector('img');
|
|
43767
|
-
var _temp5 = function () {
|
|
43768
|
-
if (imgElement && (imgElement.currentSrc || imgElement.src)) {
|
|
43769
|
-
var logoUrl = imgElement.currentSrc || imgElement.src;
|
|
43770
|
-
var logoImg = new Image();
|
|
43771
|
-
logoImg.src = logoUrl;
|
|
43772
|
-
return Promise.resolve(new Promise(function (resolve, reject) {
|
|
43773
|
-
logoImg.onload = function () {
|
|
43774
|
-
return resolve(null);
|
|
43775
|
-
};
|
|
43776
|
-
logoImg.onerror = reject;
|
|
43777
|
-
})).then(function () {
|
|
43778
|
-
ctx.save();
|
|
43779
|
-
roundedPath(overlayX, overlayY, overlaySize, overlaySize, cornerRadius);
|
|
43780
|
-
ctx.clip();
|
|
43781
|
-
ctx.drawImage(logoImg, overlayX, overlayY, overlaySize, overlaySize);
|
|
43782
|
-
ctx.restore();
|
|
43783
|
-
});
|
|
43784
|
-
} else {
|
|
43785
|
-
var _logoRef$current2;
|
|
43786
|
-
var svgElement = (_logoRef$current2 = logoRef.current) === null || _logoRef$current2 === void 0 ? void 0 : _logoRef$current2.querySelector('svg');
|
|
43787
|
-
var _temp4 = function () {
|
|
43788
|
-
if (svgElement) {
|
|
43789
|
-
var serializer = new XMLSerializer();
|
|
43790
|
-
var svgString = serializer.serializeToString(svgElement);
|
|
43791
|
-
if (!/^<svg[^>]+xmlns=/.test(svgString)) {
|
|
43792
|
-
svgString = svgString.replace('<svg', '<svg xmlns="http://www.w3.org/2000/svg"');
|
|
43793
|
-
}
|
|
43794
|
-
var svgBlob = new Blob([svgString], {
|
|
43795
|
-
type: 'image/svg+xml;charset=utf-8'
|
|
43796
|
-
});
|
|
43797
|
-
var svgUrl = URL.createObjectURL(svgBlob);
|
|
43798
|
-
var _logoImg = new Image();
|
|
43799
|
-
_logoImg.src = svgUrl;
|
|
43800
|
-
return Promise.resolve(new Promise(function (resolve, reject) {
|
|
43801
|
-
_logoImg.onload = function () {
|
|
43802
|
-
return resolve(null);
|
|
43803
|
-
};
|
|
43804
|
-
_logoImg.onerror = reject;
|
|
43805
|
-
})).then(function () {
|
|
43806
|
-
ctx.save();
|
|
43807
|
-
roundedPath(overlayX, overlayY, overlaySize, overlaySize, cornerRadius);
|
|
43808
|
-
ctx.clip();
|
|
43809
|
-
ctx.drawImage(_logoImg, overlayX, overlayY, overlaySize, overlaySize);
|
|
43810
|
-
ctx.restore();
|
|
43811
|
-
URL.revokeObjectURL(svgUrl);
|
|
43812
|
-
});
|
|
43813
|
-
}
|
|
43814
|
-
}();
|
|
43815
|
-
if (_temp4 && _temp4.then) return _temp4.then(function () {});
|
|
43816
|
-
}
|
|
43817
|
-
}();
|
|
43818
|
-
return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
|
|
43819
|
-
});
|
|
43820
|
-
});
|
|
43821
|
-
});
|
|
43822
|
-
} catch (e) {
|
|
43823
|
-
return Promise.reject(e);
|
|
43824
|
-
}
|
|
43696
|
+
var _temp5 = function _temp5() {
|
|
43697
|
+
return _forOf(channelIds, function (channelId) {
|
|
43698
|
+
var channel = getChannelFromMap(channelId);
|
|
43699
|
+
var _temp3 = function () {
|
|
43700
|
+
if (shareMode === 'link') {
|
|
43701
|
+
var linkAttachmentBuilder = channel.createAttachmentBuilder(inviteUrl, attachmentTypes.link);
|
|
43702
|
+
var linkAttachmentToSend = linkAttachmentBuilder.setName('Invite link').setUpload(false).create();
|
|
43703
|
+
var message = {
|
|
43704
|
+
metadata: '',
|
|
43705
|
+
body: inviteUrl,
|
|
43706
|
+
mentionedUsers: [],
|
|
43707
|
+
type: 'text',
|
|
43708
|
+
attachments: [linkAttachmentToSend]
|
|
43825
43709
|
};
|
|
43826
|
-
|
|
43827
|
-
|
|
43828
|
-
|
|
43829
|
-
|
|
43830
|
-
var localUrl = URL.createObjectURL(file);
|
|
43710
|
+
dispatch(forwardMessageAC(message, channelId, connectionStatus, false));
|
|
43711
|
+
} else {
|
|
43712
|
+
var _temp2 = _catch(function () {
|
|
43713
|
+
var _file, _file2, _file3, _file4;
|
|
43831
43714
|
var message = {
|
|
43832
43715
|
metadata: '',
|
|
43833
43716
|
body: '',
|
|
@@ -43837,16 +43720,16 @@ function InviteLinkModal(_ref) {
|
|
|
43837
43720
|
name: 'invite-qr.png',
|
|
43838
43721
|
data: file,
|
|
43839
43722
|
upload: false,
|
|
43840
|
-
type: "" + file.type,
|
|
43723
|
+
type: "" + ((_file = file) === null || _file === void 0 ? void 0 : _file.type),
|
|
43841
43724
|
url: {
|
|
43842
|
-
type: "" + file.type,
|
|
43725
|
+
type: "" + ((_file2 = file) === null || _file2 === void 0 ? void 0 : _file2.type),
|
|
43843
43726
|
data: file
|
|
43844
43727
|
},
|
|
43845
43728
|
createdAt: new Date(),
|
|
43846
43729
|
progress: 0,
|
|
43847
43730
|
completion: 0,
|
|
43848
43731
|
messageId: '',
|
|
43849
|
-
size: file.size,
|
|
43732
|
+
size: (_file3 = file) === null || _file3 === void 0 ? void 0 : _file3.size,
|
|
43850
43733
|
attachmentUrl: localUrl
|
|
43851
43734
|
}]
|
|
43852
43735
|
};
|
|
@@ -43860,32 +43743,165 @@ function InviteLinkModal(_ref) {
|
|
|
43860
43743
|
progress: 0,
|
|
43861
43744
|
completion: 0,
|
|
43862
43745
|
messageId: '',
|
|
43863
|
-
size: file.size,
|
|
43746
|
+
size: ((_file4 = file) === null || _file4 === void 0 ? void 0 : _file4.size) || 0,
|
|
43864
43747
|
attachmentUrl: localUrl
|
|
43865
43748
|
}], message, channel)).then(function (attachmentsToSend) {
|
|
43866
43749
|
dispatch(forwardMessageAC(_extends({}, message, {
|
|
43867
43750
|
attachments: attachmentsToSend
|
|
43868
43751
|
}), channelId, connectionStatus, false));
|
|
43869
43752
|
});
|
|
43753
|
+
}, function (e) {
|
|
43754
|
+
console.log('error', e);
|
|
43755
|
+
var linkAttachmentBuilder = channel.createAttachmentBuilder(inviteUrl, attachmentTypes.link);
|
|
43756
|
+
var linkAttachmentToSend = linkAttachmentBuilder.setName('Invite link').setUpload(false).create();
|
|
43757
|
+
var message = {
|
|
43758
|
+
metadata: '',
|
|
43759
|
+
body: inviteUrl,
|
|
43760
|
+
mentionedUsers: [],
|
|
43761
|
+
type: 'text',
|
|
43762
|
+
attachments: [linkAttachmentToSend]
|
|
43763
|
+
};
|
|
43764
|
+
dispatch(forwardMessageAC(message, channelId, connectionStatus, false));
|
|
43870
43765
|
});
|
|
43871
|
-
|
|
43872
|
-
|
|
43873
|
-
|
|
43874
|
-
|
|
43875
|
-
|
|
43876
|
-
|
|
43877
|
-
|
|
43878
|
-
|
|
43879
|
-
|
|
43880
|
-
|
|
43881
|
-
|
|
43882
|
-
|
|
43766
|
+
if (_temp2 && _temp2.then) return _temp2.then(function () {});
|
|
43767
|
+
}
|
|
43768
|
+
}();
|
|
43769
|
+
if (_temp3 && _temp3.then) return _temp3.then(function () {});
|
|
43770
|
+
});
|
|
43771
|
+
};
|
|
43772
|
+
if (!(channelIds !== null && channelIds !== void 0 && channelIds.length)) {
|
|
43773
|
+
setOpenForwardPopup(false);
|
|
43774
|
+
return Promise.resolve();
|
|
43775
|
+
}
|
|
43776
|
+
setOpenForwardPopup(false);
|
|
43777
|
+
var file = null;
|
|
43778
|
+
var blob = null;
|
|
43779
|
+
var localUrl = '';
|
|
43780
|
+
var _temp4 = function () {
|
|
43781
|
+
if (shareMode === 'qr') {
|
|
43782
|
+
var toPngBlob = function toPngBlob() {
|
|
43783
|
+
try {
|
|
43784
|
+
var dpr = 4;
|
|
43785
|
+
var baseQrSize = 200;
|
|
43786
|
+
var qrSize = baseQrSize * dpr;
|
|
43787
|
+
var qrUrl = "https://api.qrserver.com/v1/create-qr-code/?data=" + encodeURIComponent(inviteUrl) + "&size=" + qrSize + "x" + qrSize + "&ecc=H&margin=32&color=000000&bgcolor=FFFFFF";
|
|
43788
|
+
return Promise.resolve(fetch(qrUrl, {
|
|
43789
|
+
cache: 'no-store'
|
|
43790
|
+
})).then(function (qrResp) {
|
|
43791
|
+
return Promise.resolve(qrResp.blob()).then(function (qrBlob) {
|
|
43792
|
+
var qrObjectUrl = URL.createObjectURL(qrBlob);
|
|
43793
|
+
var boxWidth = qrSize;
|
|
43794
|
+
var boxHeight = qrSize;
|
|
43795
|
+
var canvas = document.createElement('canvas');
|
|
43796
|
+
canvas.width = boxWidth;
|
|
43797
|
+
canvas.height = boxHeight;
|
|
43798
|
+
var ctx = canvas.getContext('2d');
|
|
43799
|
+
var img = new Image();
|
|
43800
|
+
img.src = qrObjectUrl;
|
|
43801
|
+
return Promise.resolve(new Promise(function (resolve, reject) {
|
|
43802
|
+
img.onload = function () {
|
|
43803
|
+
return resolve(null);
|
|
43804
|
+
};
|
|
43805
|
+
img.onerror = reject;
|
|
43806
|
+
})).then(function () {
|
|
43807
|
+
var _logoRef$current;
|
|
43808
|
+
function _temp8() {
|
|
43809
|
+
URL.revokeObjectURL(qrObjectUrl);
|
|
43810
|
+
return Promise.resolve(new Promise(function (resolve) {
|
|
43811
|
+
return canvas.toBlob(function (b) {
|
|
43812
|
+
return resolve(b);
|
|
43813
|
+
}, 'image/png');
|
|
43814
|
+
}));
|
|
43815
|
+
}
|
|
43816
|
+
ctx.imageSmoothingEnabled = false;
|
|
43817
|
+
ctx.drawImage(img, 0, 0, qrSize, qrSize);
|
|
43818
|
+
var overlaySize = qrSize * 22 / 100;
|
|
43819
|
+
var overlayX = (boxWidth - overlaySize) / 2;
|
|
43820
|
+
var overlayY = (boxHeight - overlaySize) / 2;
|
|
43821
|
+
var roundedPath = function roundedPath(x, y, w, h, r) {
|
|
43822
|
+
ctx.beginPath();
|
|
43823
|
+
ctx.moveTo(x + r, y);
|
|
43824
|
+
ctx.lineTo(x + w - r, y);
|
|
43825
|
+
ctx.quadraticCurveTo(x + w, y, x + w, y + r);
|
|
43826
|
+
ctx.lineTo(x + w, y + h - r);
|
|
43827
|
+
ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
|
|
43828
|
+
ctx.lineTo(x + r, y + h);
|
|
43829
|
+
ctx.quadraticCurveTo(x, y + h, x, y + h - r);
|
|
43830
|
+
ctx.lineTo(x, y + r);
|
|
43831
|
+
ctx.quadraticCurveTo(x, y, x + r, y);
|
|
43832
|
+
ctx.closePath();
|
|
43833
|
+
};
|
|
43834
|
+
var cornerRadius = 8 * dpr;
|
|
43835
|
+
var imgElement = (_logoRef$current = logoRef.current) === null || _logoRef$current === void 0 ? void 0 : _logoRef$current.querySelector('img');
|
|
43836
|
+
var _temp7 = function () {
|
|
43837
|
+
if (imgElement && (imgElement.currentSrc || imgElement.src)) {
|
|
43838
|
+
var logoUrl = imgElement.currentSrc || imgElement.src;
|
|
43839
|
+
var logoImg = new Image();
|
|
43840
|
+
logoImg.src = logoUrl;
|
|
43841
|
+
return Promise.resolve(new Promise(function (resolve, reject) {
|
|
43842
|
+
logoImg.onload = function () {
|
|
43843
|
+
return resolve(null);
|
|
43844
|
+
};
|
|
43845
|
+
logoImg.onerror = reject;
|
|
43846
|
+
})).then(function () {
|
|
43847
|
+
ctx.save();
|
|
43848
|
+
roundedPath(overlayX, overlayY, overlaySize, overlaySize, cornerRadius);
|
|
43849
|
+
ctx.clip();
|
|
43850
|
+
ctx.drawImage(logoImg, overlayX, overlayY, overlaySize, overlaySize);
|
|
43851
|
+
ctx.restore();
|
|
43852
|
+
});
|
|
43853
|
+
} else {
|
|
43854
|
+
var _logoRef$current2;
|
|
43855
|
+
var svgElement = (_logoRef$current2 = logoRef.current) === null || _logoRef$current2 === void 0 ? void 0 : _logoRef$current2.querySelector('svg');
|
|
43856
|
+
var _temp6 = function () {
|
|
43857
|
+
if (svgElement) {
|
|
43858
|
+
var serializer = new XMLSerializer();
|
|
43859
|
+
var svgString = serializer.serializeToString(svgElement);
|
|
43860
|
+
if (!/^<svg[^>]+xmlns=/.test(svgString)) {
|
|
43861
|
+
svgString = svgString.replace('<svg', '<svg xmlns="http://www.w3.org/2000/svg"');
|
|
43862
|
+
}
|
|
43863
|
+
var svgBlob = new Blob([svgString], {
|
|
43864
|
+
type: 'image/svg+xml;charset=utf-8'
|
|
43865
|
+
});
|
|
43866
|
+
var svgUrl = URL.createObjectURL(svgBlob);
|
|
43867
|
+
var _logoImg = new Image();
|
|
43868
|
+
_logoImg.src = svgUrl;
|
|
43869
|
+
return Promise.resolve(new Promise(function (resolve, reject) {
|
|
43870
|
+
_logoImg.onload = function () {
|
|
43871
|
+
return resolve(null);
|
|
43872
|
+
};
|
|
43873
|
+
_logoImg.onerror = reject;
|
|
43874
|
+
})).then(function () {
|
|
43875
|
+
ctx.save();
|
|
43876
|
+
roundedPath(overlayX, overlayY, overlaySize, overlaySize, cornerRadius);
|
|
43877
|
+
ctx.clip();
|
|
43878
|
+
ctx.drawImage(_logoImg, overlayX, overlayY, overlaySize, overlaySize);
|
|
43879
|
+
ctx.restore();
|
|
43880
|
+
URL.revokeObjectURL(svgUrl);
|
|
43881
|
+
});
|
|
43882
|
+
}
|
|
43883
|
+
}();
|
|
43884
|
+
if (_temp6 && _temp6.then) return _temp6.then(function () {});
|
|
43885
|
+
}
|
|
43886
|
+
}();
|
|
43887
|
+
return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
|
|
43888
|
+
});
|
|
43889
|
+
});
|
|
43890
|
+
});
|
|
43891
|
+
} catch (e) {
|
|
43892
|
+
return Promise.reject(e);
|
|
43893
|
+
}
|
|
43894
|
+
};
|
|
43895
|
+
return Promise.resolve(toPngBlob()).then(function (_toPngBlob) {
|
|
43896
|
+
blob = _toPngBlob;
|
|
43897
|
+
file = new File([blob], 'invite-qr.png', {
|
|
43898
|
+
type: 'image/png'
|
|
43883
43899
|
});
|
|
43884
|
-
|
|
43885
|
-
}
|
|
43886
|
-
}
|
|
43887
|
-
|
|
43888
|
-
|
|
43900
|
+
localUrl = URL.createObjectURL(file);
|
|
43901
|
+
});
|
|
43902
|
+
}
|
|
43903
|
+
}();
|
|
43904
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
|
|
43889
43905
|
} catch (e) {
|
|
43890
43906
|
return Promise.reject(e);
|
|
43891
43907
|
}
|
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 }: {
|
|
11
|
+
declare const MessageTextFormat: ({ text, message, contactsMap, getFromContacts, isLastMessage, asSampleText, accentColor, textSecondary, onMentionNameClick, shouldOpenUserProfileForMention, unsupportedMessage, target, isInviteLink }: {
|
|
12
12
|
text: string;
|
|
13
13
|
message: any;
|
|
14
14
|
contactsMap?: IContactsMap | undefined;
|
|
@@ -21,5 +21,6 @@ declare const MessageTextFormat: ({ text, message, contactsMap, getFromContacts,
|
|
|
21
21
|
shouldOpenUserProfileForMention?: boolean | undefined;
|
|
22
22
|
unsupportedMessage?: boolean | undefined;
|
|
23
23
|
target?: string | undefined;
|
|
24
|
+
isInviteLink?: boolean | undefined;
|
|
24
25
|
}) => any;
|
|
25
26
|
export { MessageStatusIcon, MessageTextFormat };
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -325,4 +325,26 @@ export interface ILabels {
|
|
|
325
325
|
receivedBy?: string;
|
|
326
326
|
displayedBy?: string;
|
|
327
327
|
}
|
|
328
|
+
export interface OGMetadataProps {
|
|
329
|
+
maxWidth?: number;
|
|
330
|
+
maxHeight?: number;
|
|
331
|
+
ogLayoutOrder?: 'link-first' | 'og-first';
|
|
332
|
+
ogShowUrl?: boolean;
|
|
333
|
+
ogShowTitle?: boolean;
|
|
334
|
+
ogShowDescription?: boolean;
|
|
335
|
+
ogShowFavicon?: boolean;
|
|
336
|
+
order?: {
|
|
337
|
+
image?: number;
|
|
338
|
+
title?: number;
|
|
339
|
+
description?: number;
|
|
340
|
+
link?: number;
|
|
341
|
+
};
|
|
342
|
+
ogContainerBorderRadius?: string | number;
|
|
343
|
+
ogContainerPadding?: string;
|
|
344
|
+
ogContainerClassName?: string;
|
|
345
|
+
ogContainerShowBackground?: boolean;
|
|
346
|
+
ogContainerBackground?: string;
|
|
347
|
+
infoPadding?: string;
|
|
348
|
+
isInviteLink?: boolean;
|
|
349
|
+
}
|
|
328
350
|
export {};
|