sceyt-chat-react-uikit 1.8.3-beta.3 → 1.8.3-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.
- package/components/index.d.ts +2 -2
- package/index.js +109 -11
- package/index.modern.js +108 -12
- package/package.json +1 -1
package/components/index.d.ts
CHANGED
|
@@ -18,9 +18,9 @@ import DropDown from '../common/dropdown';
|
|
|
18
18
|
import { THEME_COLORS } from '../UIHelper/constants';
|
|
19
19
|
import { OGMetadata } from './Message/OGMetadata';
|
|
20
20
|
import PollMessage from './Message/PollMessage';
|
|
21
|
-
import { createOrGetDirectChannel, switchChannelActiveChannel, handleSendMessage, handleGetMessage } from 'helpers/methods';
|
|
21
|
+
import { createOrGetDirectChannel, switchChannelActiveChannel, handleSendMessage, handleGetMessage, blockUsers, unBlockUsers } from 'helpers/methods';
|
|
22
22
|
import { MESSAGE_TYPE } from 'types/enum';
|
|
23
|
-
export { SceytChat, ChannelList, Channel, Chat, ChatHeader, MessageList, SendMessage, ChannelDetails, MessagesScrollToBottomButton, MessagesScrollToUnreadMentionsButton, CreateChannel, ChannelSearch, Avatar, DropDown, Attachment, PollMessage, OGMetadata, EmojisPopup, FrequentlyEmojis, SceytChatUIKitTheme, ThemeMode, THEME_COLORS, MESSAGE_TYPE, handleSendMessage, handleGetMessage, createOrGetDirectChannel, switchChannelActiveChannel };
|
|
23
|
+
export { SceytChat, ChannelList, Channel, Chat, ChatHeader, MessageList, SendMessage, ChannelDetails, MessagesScrollToBottomButton, MessagesScrollToUnreadMentionsButton, CreateChannel, ChannelSearch, Avatar, DropDown, Attachment, PollMessage, OGMetadata, EmojisPopup, FrequentlyEmojis, SceytChatUIKitTheme, ThemeMode, THEME_COLORS, MESSAGE_TYPE, handleSendMessage, handleGetMessage, createOrGetDirectChannel, switchChannelActiveChannel, blockUsers, unBlockUsers };
|
|
24
24
|
declare global {
|
|
25
25
|
interface Window {
|
|
26
26
|
sceytTabNotifications: any;
|
package/index.js
CHANGED
|
@@ -10389,6 +10389,7 @@ var queryDirection = {
|
|
|
10389
10389
|
};
|
|
10390
10390
|
|
|
10391
10391
|
var ATTACHMENTS_CACHE = 'attachments-cache';
|
|
10392
|
+
var ATTACHMENT_VERSION_KEY = 'sceyt_attachment_cache_version';
|
|
10392
10393
|
var isBrowser = typeof window !== 'undefined';
|
|
10393
10394
|
var cacheAvailable;
|
|
10394
10395
|
if (isBrowser) {
|
|
@@ -10396,7 +10397,7 @@ if (isBrowser) {
|
|
|
10396
10397
|
} else {
|
|
10397
10398
|
cacheAvailable = 'caches' in global;
|
|
10398
10399
|
}
|
|
10399
|
-
var ATTACHMENT_VERSION = "
|
|
10400
|
+
var ATTACHMENT_VERSION = "_1_0_1";
|
|
10400
10401
|
var setAttachmentToCache = function setAttachmentToCache(attachmentUrl, attachmentResponse) {
|
|
10401
10402
|
try {
|
|
10402
10403
|
var attachmentURLVersion = attachmentUrl + ATTACHMENT_VERSION;
|
|
@@ -10475,6 +10476,49 @@ var getAttachmentUrlFromCache = function getAttachmentUrlFromCache(attachmentUrl
|
|
|
10475
10476
|
var getAttachmentURLWithVersion = function getAttachmentURLWithVersion(attachmentUrl) {
|
|
10476
10477
|
return attachmentUrl + ATTACHMENT_VERSION;
|
|
10477
10478
|
};
|
|
10479
|
+
var cleanupOldAttachmentCache = function cleanupOldAttachmentCache() {
|
|
10480
|
+
try {
|
|
10481
|
+
if (!cacheAvailable || !isBrowser) {
|
|
10482
|
+
return Promise.resolve();
|
|
10483
|
+
}
|
|
10484
|
+
return Promise.resolve(_catch(function () {
|
|
10485
|
+
function _temp0() {
|
|
10486
|
+
localStorage.setItem(ATTACHMENT_VERSION_KEY, ATTACHMENT_VERSION);
|
|
10487
|
+
}
|
|
10488
|
+
var storedVersion = localStorage.getItem(ATTACHMENT_VERSION_KEY) || '_1_0_0';
|
|
10489
|
+
var _temp9 = function () {
|
|
10490
|
+
if (storedVersion && storedVersion !== ATTACHMENT_VERSION) {
|
|
10491
|
+
log.info("Attachment cache version changed from " + storedVersion + " to " + ATTACHMENT_VERSION + ", cleaning up old cache...");
|
|
10492
|
+
return Promise.resolve(caches.open(ATTACHMENTS_CACHE)).then(function (cache) {
|
|
10493
|
+
return Promise.resolve(cache.keys()).then(function (requests) {
|
|
10494
|
+
function _temp8() {
|
|
10495
|
+
log.info("Cleaned up " + deletedCount + " old cached attachments");
|
|
10496
|
+
}
|
|
10497
|
+
var deletedCount = 0;
|
|
10498
|
+
var _temp7 = _forOf(requests, function (request) {
|
|
10499
|
+
var url = request.url;
|
|
10500
|
+
var _temp6 = function () {
|
|
10501
|
+
if (url.includes(storedVersion)) {
|
|
10502
|
+
return Promise.resolve(cache["delete"](request)).then(function () {
|
|
10503
|
+
deletedCount++;
|
|
10504
|
+
});
|
|
10505
|
+
}
|
|
10506
|
+
}();
|
|
10507
|
+
if (_temp6 && _temp6.then) return _temp6.then(function () {});
|
|
10508
|
+
});
|
|
10509
|
+
return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
|
|
10510
|
+
});
|
|
10511
|
+
});
|
|
10512
|
+
}
|
|
10513
|
+
}();
|
|
10514
|
+
return _temp9 && _temp9.then ? _temp9.then(_temp0) : _temp0(_temp9);
|
|
10515
|
+
}, function (error) {
|
|
10516
|
+
log.error('Error cleaning up old attachment cache:', error);
|
|
10517
|
+
}));
|
|
10518
|
+
} catch (e) {
|
|
10519
|
+
return Promise.reject(e);
|
|
10520
|
+
}
|
|
10521
|
+
};
|
|
10478
10522
|
|
|
10479
10523
|
function sendMessageAC(message, channelId, connectionState, sendAttachmentsAsSeparateMessage, isResend) {
|
|
10480
10524
|
return {
|
|
@@ -13405,19 +13449,21 @@ var getContactsAC = function getContactsAC() {
|
|
|
13405
13449
|
payload: {}
|
|
13406
13450
|
};
|
|
13407
13451
|
};
|
|
13408
|
-
var blockUserAC = function blockUserAC(userIds) {
|
|
13452
|
+
var blockUserAC = function blockUserAC(userIds, callback) {
|
|
13409
13453
|
return {
|
|
13410
13454
|
type: BLOCK_USERS,
|
|
13411
13455
|
payload: {
|
|
13412
|
-
userIds: userIds
|
|
13456
|
+
userIds: userIds,
|
|
13457
|
+
callback: callback
|
|
13413
13458
|
}
|
|
13414
13459
|
};
|
|
13415
13460
|
};
|
|
13416
|
-
var unblockUserAC = function unblockUserAC(userIds) {
|
|
13461
|
+
var unblockUserAC = function unblockUserAC(userIds, callback) {
|
|
13417
13462
|
return {
|
|
13418
13463
|
type: UNBLOCK_USERS,
|
|
13419
13464
|
payload: {
|
|
13420
|
-
userIds: userIds
|
|
13465
|
+
userIds: userIds,
|
|
13466
|
+
callback: callback
|
|
13421
13467
|
}
|
|
13422
13468
|
};
|
|
13423
13469
|
};
|
|
@@ -20071,16 +20117,21 @@ var resizeImageWithPica = function resizeImageWithPica(file, maxWidth, maxHeight
|
|
|
20071
20117
|
newHeight: img.height
|
|
20072
20118
|
};
|
|
20073
20119
|
}
|
|
20120
|
+
var srcCanvas = document.createElement('canvas');
|
|
20121
|
+
srcCanvas.width = img.width;
|
|
20122
|
+
srcCanvas.height = img.height;
|
|
20123
|
+
var srcCtx = srcCanvas.getContext('2d');
|
|
20124
|
+
srcCtx.drawImage(img, 0, 0);
|
|
20125
|
+
URL.revokeObjectURL(url);
|
|
20074
20126
|
var canvas = document.createElement('canvas');
|
|
20075
20127
|
canvas.width = newWidth;
|
|
20076
20128
|
canvas.height = newHeight;
|
|
20077
|
-
return Promise.resolve(pica.resize(
|
|
20129
|
+
return Promise.resolve(pica.resize(srcCanvas, canvas, {
|
|
20078
20130
|
quality: 3,
|
|
20079
20131
|
unsharpAmount: 80,
|
|
20080
20132
|
unsharpRadius: 0.6,
|
|
20081
20133
|
unsharpThreshold: 2
|
|
20082
20134
|
})).then(function () {
|
|
20083
|
-
URL.revokeObjectURL(url);
|
|
20084
20135
|
var originalType = file.type || 'image/jpeg';
|
|
20085
20136
|
var outputType = type || 'image/webp';
|
|
20086
20137
|
if (outputType === 'image/webp' && !canvas.toDataURL('image/webp').includes('webp')) {
|
|
@@ -24583,14 +24634,14 @@ function getContacts() {
|
|
|
24583
24634
|
}, _marked$5, null, [[0, 4]]);
|
|
24584
24635
|
}
|
|
24585
24636
|
function blockUser(action) {
|
|
24586
|
-
var SceytChatClient, payload, userIds, blockedUsers, activeChannelId, activeChannel, isDirectChannel, directChannelUser, _iterator, _step, _updateUserStatusOnMa, _updateMembersPresenc, _updateUserStatusOnCh, user, _t2;
|
|
24637
|
+
var SceytChatClient, payload, userIds, callback, blockedUsers, activeChannelId, activeChannel, isDirectChannel, directChannelUser, _iterator, _step, _updateUserStatusOnMa, _updateMembersPresenc, _updateUserStatusOnCh, user, _payload, _callback, _t2;
|
|
24587
24638
|
return _regenerator().w(function (_context2) {
|
|
24588
24639
|
while (1) switch (_context2.p = _context2.n) {
|
|
24589
24640
|
case 0:
|
|
24590
24641
|
_context2.p = 0;
|
|
24591
24642
|
SceytChatClient = getClient();
|
|
24592
24643
|
payload = action.payload;
|
|
24593
|
-
userIds = payload.userIds;
|
|
24644
|
+
userIds = payload.userIds, callback = payload.callback;
|
|
24594
24645
|
_context2.n = 1;
|
|
24595
24646
|
return effects.call(SceytChatClient.blockUsers, userIds);
|
|
24596
24647
|
case 1:
|
|
@@ -24669,26 +24720,34 @@ function blockUser(action) {
|
|
|
24669
24720
|
_context2.n = 6;
|
|
24670
24721
|
break;
|
|
24671
24722
|
case 12:
|
|
24723
|
+
if (callback) {
|
|
24724
|
+
callback(blockedUsers);
|
|
24725
|
+
}
|
|
24672
24726
|
_context2.n = 14;
|
|
24673
24727
|
break;
|
|
24674
24728
|
case 13:
|
|
24675
24729
|
_context2.p = 13;
|
|
24676
24730
|
_t2 = _context2.v;
|
|
24677
24731
|
log.error('error in block users', _t2.message);
|
|
24732
|
+
_payload = action.payload;
|
|
24733
|
+
_callback = _payload.callback;
|
|
24734
|
+
if (_callback) {
|
|
24735
|
+
_callback(null, _t2);
|
|
24736
|
+
}
|
|
24678
24737
|
case 14:
|
|
24679
24738
|
return _context2.a(2);
|
|
24680
24739
|
}
|
|
24681
24740
|
}, _marked2$4, null, [[0, 13]]);
|
|
24682
24741
|
}
|
|
24683
24742
|
function unblockUser(action) {
|
|
24684
|
-
var SceytChatClient, payload, userIds, unblockedUsers, activeChannelId, activeChannel, isDirectChannel, directChannelUser, _iterator2, _step2, _updateUserStatusOnMa2, _updateMembersPresenc2, _updateUserStatusOnCh2, user, updateData, _t3;
|
|
24743
|
+
var SceytChatClient, payload, userIds, callback, unblockedUsers, activeChannelId, activeChannel, isDirectChannel, directChannelUser, _iterator2, _step2, _updateUserStatusOnMa2, _updateMembersPresenc2, _updateUserStatusOnCh2, user, updateData, _payload2, _callback2, _t3;
|
|
24685
24744
|
return _regenerator().w(function (_context3) {
|
|
24686
24745
|
while (1) switch (_context3.p = _context3.n) {
|
|
24687
24746
|
case 0:
|
|
24688
24747
|
_context3.p = 0;
|
|
24689
24748
|
SceytChatClient = getClient();
|
|
24690
24749
|
payload = action.payload;
|
|
24691
|
-
userIds = payload.userIds;
|
|
24750
|
+
userIds = payload.userIds, callback = payload.callback;
|
|
24692
24751
|
_context3.n = 1;
|
|
24693
24752
|
return effects.call(SceytChatClient.unblockUsers, userIds);
|
|
24694
24753
|
case 1:
|
|
@@ -24768,12 +24827,20 @@ function unblockUser(action) {
|
|
|
24768
24827
|
_context3.n = 6;
|
|
24769
24828
|
break;
|
|
24770
24829
|
case 12:
|
|
24830
|
+
if (callback) {
|
|
24831
|
+
callback(unblockedUsers);
|
|
24832
|
+
}
|
|
24771
24833
|
_context3.n = 14;
|
|
24772
24834
|
break;
|
|
24773
24835
|
case 13:
|
|
24774
24836
|
_context3.p = 13;
|
|
24775
24837
|
_t3 = _context3.v;
|
|
24776
24838
|
log.error('error in unblock users', _t3.message);
|
|
24839
|
+
_payload2 = action.payload;
|
|
24840
|
+
_callback2 = _payload2.callback;
|
|
24841
|
+
if (_callback2) {
|
|
24842
|
+
_callback2(null, _t3);
|
|
24843
|
+
}
|
|
24777
24844
|
case 14:
|
|
24778
24845
|
return _context3.a(2);
|
|
24779
24846
|
}
|
|
@@ -25986,6 +26053,7 @@ var SceytChat = function SceytChat(_ref) {
|
|
|
25986
26053
|
React.useEffect(function () {
|
|
25987
26054
|
log.info('client is changed.... ', client);
|
|
25988
26055
|
if (client) {
|
|
26056
|
+
cleanupOldAttachmentCache();
|
|
25989
26057
|
setClient(client);
|
|
25990
26058
|
setSceytChatClient(client);
|
|
25991
26059
|
dispatch(setUserAC(client.user));
|
|
@@ -52973,6 +53041,34 @@ var handleSendMessage = function handleSendMessage(message, channelId, connectio
|
|
|
52973
53041
|
var handleGetMessage = function handleGetMessage(channelId, messageId) {
|
|
52974
53042
|
return store.dispatch(getMessageAC(channelId, messageId));
|
|
52975
53043
|
};
|
|
53044
|
+
var blockUsers = function blockUsers(userIds, callback) {
|
|
53045
|
+
return new Promise(function (resolve, reject) {
|
|
53046
|
+
store.dispatch(blockUserAC(userIds, function (users, error) {
|
|
53047
|
+
if (error) {
|
|
53048
|
+
reject(error);
|
|
53049
|
+
} else {
|
|
53050
|
+
if (callback) {
|
|
53051
|
+
callback(users);
|
|
53052
|
+
}
|
|
53053
|
+
resolve(users);
|
|
53054
|
+
}
|
|
53055
|
+
}));
|
|
53056
|
+
});
|
|
53057
|
+
};
|
|
53058
|
+
var unBlockUsers = function unBlockUsers(userIds, callback) {
|
|
53059
|
+
return new Promise(function (resolve, reject) {
|
|
53060
|
+
store.dispatch(unblockUserAC(userIds, function (users, error) {
|
|
53061
|
+
if (error) {
|
|
53062
|
+
reject(error);
|
|
53063
|
+
} else {
|
|
53064
|
+
if (callback) {
|
|
53065
|
+
callback(users);
|
|
53066
|
+
}
|
|
53067
|
+
resolve(users);
|
|
53068
|
+
}
|
|
53069
|
+
}));
|
|
53070
|
+
});
|
|
53071
|
+
};
|
|
52976
53072
|
|
|
52977
53073
|
exports.Attachment = Attachment$1;
|
|
52978
53074
|
exports.Avatar = Avatar;
|
|
@@ -52996,9 +53092,11 @@ exports.PollMessage = PollMessage;
|
|
|
52996
53092
|
exports.SceytChat = SceytChatContainer;
|
|
52997
53093
|
exports.SendMessage = SendMessageInput;
|
|
52998
53094
|
exports.THEME_COLORS = THEME_COLORS;
|
|
53095
|
+
exports.blockUsers = blockUsers;
|
|
52999
53096
|
exports.createOrGetDirectChannel = createOrGetDirectChannel;
|
|
53000
53097
|
exports.handleGetMessage = handleGetMessage;
|
|
53001
53098
|
exports.handleSendMessage = handleSendMessage;
|
|
53002
53099
|
exports.switchChannelActiveChannel = switchChannelActiveChannel;
|
|
53003
53100
|
exports.trimReactMessage = trimReactMessage;
|
|
53101
|
+
exports.unBlockUsers = unBlockUsers;
|
|
53004
53102
|
//# sourceMappingURL=index.js.map
|
package/index.modern.js
CHANGED
|
@@ -10388,6 +10388,7 @@ var queryDirection = {
|
|
|
10388
10388
|
};
|
|
10389
10389
|
|
|
10390
10390
|
var ATTACHMENTS_CACHE = 'attachments-cache';
|
|
10391
|
+
var ATTACHMENT_VERSION_KEY = 'sceyt_attachment_cache_version';
|
|
10391
10392
|
var isBrowser = typeof window !== 'undefined';
|
|
10392
10393
|
var cacheAvailable;
|
|
10393
10394
|
if (isBrowser) {
|
|
@@ -10395,7 +10396,7 @@ if (isBrowser) {
|
|
|
10395
10396
|
} else {
|
|
10396
10397
|
cacheAvailable = 'caches' in global;
|
|
10397
10398
|
}
|
|
10398
|
-
var ATTACHMENT_VERSION = "
|
|
10399
|
+
var ATTACHMENT_VERSION = "_1_0_1";
|
|
10399
10400
|
var setAttachmentToCache = function setAttachmentToCache(attachmentUrl, attachmentResponse) {
|
|
10400
10401
|
try {
|
|
10401
10402
|
var attachmentURLVersion = attachmentUrl + ATTACHMENT_VERSION;
|
|
@@ -10474,6 +10475,49 @@ var getAttachmentUrlFromCache = function getAttachmentUrlFromCache(attachmentUrl
|
|
|
10474
10475
|
var getAttachmentURLWithVersion = function getAttachmentURLWithVersion(attachmentUrl) {
|
|
10475
10476
|
return attachmentUrl + ATTACHMENT_VERSION;
|
|
10476
10477
|
};
|
|
10478
|
+
var cleanupOldAttachmentCache = function cleanupOldAttachmentCache() {
|
|
10479
|
+
try {
|
|
10480
|
+
if (!cacheAvailable || !isBrowser) {
|
|
10481
|
+
return Promise.resolve();
|
|
10482
|
+
}
|
|
10483
|
+
return Promise.resolve(_catch(function () {
|
|
10484
|
+
function _temp0() {
|
|
10485
|
+
localStorage.setItem(ATTACHMENT_VERSION_KEY, ATTACHMENT_VERSION);
|
|
10486
|
+
}
|
|
10487
|
+
var storedVersion = localStorage.getItem(ATTACHMENT_VERSION_KEY) || '_1_0_0';
|
|
10488
|
+
var _temp9 = function () {
|
|
10489
|
+
if (storedVersion && storedVersion !== ATTACHMENT_VERSION) {
|
|
10490
|
+
log.info("Attachment cache version changed from " + storedVersion + " to " + ATTACHMENT_VERSION + ", cleaning up old cache...");
|
|
10491
|
+
return Promise.resolve(caches.open(ATTACHMENTS_CACHE)).then(function (cache) {
|
|
10492
|
+
return Promise.resolve(cache.keys()).then(function (requests) {
|
|
10493
|
+
function _temp8() {
|
|
10494
|
+
log.info("Cleaned up " + deletedCount + " old cached attachments");
|
|
10495
|
+
}
|
|
10496
|
+
var deletedCount = 0;
|
|
10497
|
+
var _temp7 = _forOf(requests, function (request) {
|
|
10498
|
+
var url = request.url;
|
|
10499
|
+
var _temp6 = function () {
|
|
10500
|
+
if (url.includes(storedVersion)) {
|
|
10501
|
+
return Promise.resolve(cache["delete"](request)).then(function () {
|
|
10502
|
+
deletedCount++;
|
|
10503
|
+
});
|
|
10504
|
+
}
|
|
10505
|
+
}();
|
|
10506
|
+
if (_temp6 && _temp6.then) return _temp6.then(function () {});
|
|
10507
|
+
});
|
|
10508
|
+
return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
|
|
10509
|
+
});
|
|
10510
|
+
});
|
|
10511
|
+
}
|
|
10512
|
+
}();
|
|
10513
|
+
return _temp9 && _temp9.then ? _temp9.then(_temp0) : _temp0(_temp9);
|
|
10514
|
+
}, function (error) {
|
|
10515
|
+
log.error('Error cleaning up old attachment cache:', error);
|
|
10516
|
+
}));
|
|
10517
|
+
} catch (e) {
|
|
10518
|
+
return Promise.reject(e);
|
|
10519
|
+
}
|
|
10520
|
+
};
|
|
10477
10521
|
|
|
10478
10522
|
function sendMessageAC(message, channelId, connectionState, sendAttachmentsAsSeparateMessage, isResend) {
|
|
10479
10523
|
return {
|
|
@@ -13404,19 +13448,21 @@ var getContactsAC = function getContactsAC() {
|
|
|
13404
13448
|
payload: {}
|
|
13405
13449
|
};
|
|
13406
13450
|
};
|
|
13407
|
-
var blockUserAC = function blockUserAC(userIds) {
|
|
13451
|
+
var blockUserAC = function blockUserAC(userIds, callback) {
|
|
13408
13452
|
return {
|
|
13409
13453
|
type: BLOCK_USERS,
|
|
13410
13454
|
payload: {
|
|
13411
|
-
userIds: userIds
|
|
13455
|
+
userIds: userIds,
|
|
13456
|
+
callback: callback
|
|
13412
13457
|
}
|
|
13413
13458
|
};
|
|
13414
13459
|
};
|
|
13415
|
-
var unblockUserAC = function unblockUserAC(userIds) {
|
|
13460
|
+
var unblockUserAC = function unblockUserAC(userIds, callback) {
|
|
13416
13461
|
return {
|
|
13417
13462
|
type: UNBLOCK_USERS,
|
|
13418
13463
|
payload: {
|
|
13419
|
-
userIds: userIds
|
|
13464
|
+
userIds: userIds,
|
|
13465
|
+
callback: callback
|
|
13420
13466
|
}
|
|
13421
13467
|
};
|
|
13422
13468
|
};
|
|
@@ -20070,16 +20116,21 @@ var resizeImageWithPica = function resizeImageWithPica(file, maxWidth, maxHeight
|
|
|
20070
20116
|
newHeight: img.height
|
|
20071
20117
|
};
|
|
20072
20118
|
}
|
|
20119
|
+
var srcCanvas = document.createElement('canvas');
|
|
20120
|
+
srcCanvas.width = img.width;
|
|
20121
|
+
srcCanvas.height = img.height;
|
|
20122
|
+
var srcCtx = srcCanvas.getContext('2d');
|
|
20123
|
+
srcCtx.drawImage(img, 0, 0);
|
|
20124
|
+
URL.revokeObjectURL(url);
|
|
20073
20125
|
var canvas = document.createElement('canvas');
|
|
20074
20126
|
canvas.width = newWidth;
|
|
20075
20127
|
canvas.height = newHeight;
|
|
20076
|
-
return Promise.resolve(pica.resize(
|
|
20128
|
+
return Promise.resolve(pica.resize(srcCanvas, canvas, {
|
|
20077
20129
|
quality: 3,
|
|
20078
20130
|
unsharpAmount: 80,
|
|
20079
20131
|
unsharpRadius: 0.6,
|
|
20080
20132
|
unsharpThreshold: 2
|
|
20081
20133
|
})).then(function () {
|
|
20082
|
-
URL.revokeObjectURL(url);
|
|
20083
20134
|
var originalType = file.type || 'image/jpeg';
|
|
20084
20135
|
var outputType = type || 'image/webp';
|
|
20085
20136
|
if (outputType === 'image/webp' && !canvas.toDataURL('image/webp').includes('webp')) {
|
|
@@ -24582,14 +24633,14 @@ function getContacts() {
|
|
|
24582
24633
|
}, _marked$5, null, [[0, 4]]);
|
|
24583
24634
|
}
|
|
24584
24635
|
function blockUser(action) {
|
|
24585
|
-
var SceytChatClient, payload, userIds, blockedUsers, activeChannelId, activeChannel, isDirectChannel, directChannelUser, _iterator, _step, _updateUserStatusOnMa, _updateMembersPresenc, _updateUserStatusOnCh, user, _t2;
|
|
24636
|
+
var SceytChatClient, payload, userIds, callback, blockedUsers, activeChannelId, activeChannel, isDirectChannel, directChannelUser, _iterator, _step, _updateUserStatusOnMa, _updateMembersPresenc, _updateUserStatusOnCh, user, _payload, _callback, _t2;
|
|
24586
24637
|
return _regenerator().w(function (_context2) {
|
|
24587
24638
|
while (1) switch (_context2.p = _context2.n) {
|
|
24588
24639
|
case 0:
|
|
24589
24640
|
_context2.p = 0;
|
|
24590
24641
|
SceytChatClient = getClient();
|
|
24591
24642
|
payload = action.payload;
|
|
24592
|
-
userIds = payload.userIds;
|
|
24643
|
+
userIds = payload.userIds, callback = payload.callback;
|
|
24593
24644
|
_context2.n = 1;
|
|
24594
24645
|
return call(SceytChatClient.blockUsers, userIds);
|
|
24595
24646
|
case 1:
|
|
@@ -24668,26 +24719,34 @@ function blockUser(action) {
|
|
|
24668
24719
|
_context2.n = 6;
|
|
24669
24720
|
break;
|
|
24670
24721
|
case 12:
|
|
24722
|
+
if (callback) {
|
|
24723
|
+
callback(blockedUsers);
|
|
24724
|
+
}
|
|
24671
24725
|
_context2.n = 14;
|
|
24672
24726
|
break;
|
|
24673
24727
|
case 13:
|
|
24674
24728
|
_context2.p = 13;
|
|
24675
24729
|
_t2 = _context2.v;
|
|
24676
24730
|
log.error('error in block users', _t2.message);
|
|
24731
|
+
_payload = action.payload;
|
|
24732
|
+
_callback = _payload.callback;
|
|
24733
|
+
if (_callback) {
|
|
24734
|
+
_callback(null, _t2);
|
|
24735
|
+
}
|
|
24677
24736
|
case 14:
|
|
24678
24737
|
return _context2.a(2);
|
|
24679
24738
|
}
|
|
24680
24739
|
}, _marked2$4, null, [[0, 13]]);
|
|
24681
24740
|
}
|
|
24682
24741
|
function unblockUser(action) {
|
|
24683
|
-
var SceytChatClient, payload, userIds, unblockedUsers, activeChannelId, activeChannel, isDirectChannel, directChannelUser, _iterator2, _step2, _updateUserStatusOnMa2, _updateMembersPresenc2, _updateUserStatusOnCh2, user, updateData, _t3;
|
|
24742
|
+
var SceytChatClient, payload, userIds, callback, unblockedUsers, activeChannelId, activeChannel, isDirectChannel, directChannelUser, _iterator2, _step2, _updateUserStatusOnMa2, _updateMembersPresenc2, _updateUserStatusOnCh2, user, updateData, _payload2, _callback2, _t3;
|
|
24684
24743
|
return _regenerator().w(function (_context3) {
|
|
24685
24744
|
while (1) switch (_context3.p = _context3.n) {
|
|
24686
24745
|
case 0:
|
|
24687
24746
|
_context3.p = 0;
|
|
24688
24747
|
SceytChatClient = getClient();
|
|
24689
24748
|
payload = action.payload;
|
|
24690
|
-
userIds = payload.userIds;
|
|
24749
|
+
userIds = payload.userIds, callback = payload.callback;
|
|
24691
24750
|
_context3.n = 1;
|
|
24692
24751
|
return call(SceytChatClient.unblockUsers, userIds);
|
|
24693
24752
|
case 1:
|
|
@@ -24767,12 +24826,20 @@ function unblockUser(action) {
|
|
|
24767
24826
|
_context3.n = 6;
|
|
24768
24827
|
break;
|
|
24769
24828
|
case 12:
|
|
24829
|
+
if (callback) {
|
|
24830
|
+
callback(unblockedUsers);
|
|
24831
|
+
}
|
|
24770
24832
|
_context3.n = 14;
|
|
24771
24833
|
break;
|
|
24772
24834
|
case 13:
|
|
24773
24835
|
_context3.p = 13;
|
|
24774
24836
|
_t3 = _context3.v;
|
|
24775
24837
|
log.error('error in unblock users', _t3.message);
|
|
24838
|
+
_payload2 = action.payload;
|
|
24839
|
+
_callback2 = _payload2.callback;
|
|
24840
|
+
if (_callback2) {
|
|
24841
|
+
_callback2(null, _t3);
|
|
24842
|
+
}
|
|
24776
24843
|
case 14:
|
|
24777
24844
|
return _context3.a(2);
|
|
24778
24845
|
}
|
|
@@ -25985,6 +26052,7 @@ var SceytChat = function SceytChat(_ref) {
|
|
|
25985
26052
|
useEffect(function () {
|
|
25986
26053
|
log.info('client is changed.... ', client);
|
|
25987
26054
|
if (client) {
|
|
26055
|
+
cleanupOldAttachmentCache();
|
|
25988
26056
|
setClient(client);
|
|
25989
26057
|
setSceytChatClient(client);
|
|
25990
26058
|
dispatch(setUserAC(client.user));
|
|
@@ -52972,6 +53040,34 @@ var handleSendMessage = function handleSendMessage(message, channelId, connectio
|
|
|
52972
53040
|
var handleGetMessage = function handleGetMessage(channelId, messageId) {
|
|
52973
53041
|
return store.dispatch(getMessageAC(channelId, messageId));
|
|
52974
53042
|
};
|
|
53043
|
+
var blockUsers = function blockUsers(userIds, callback) {
|
|
53044
|
+
return new Promise(function (resolve, reject) {
|
|
53045
|
+
store.dispatch(blockUserAC(userIds, function (users, error) {
|
|
53046
|
+
if (error) {
|
|
53047
|
+
reject(error);
|
|
53048
|
+
} else {
|
|
53049
|
+
if (callback) {
|
|
53050
|
+
callback(users);
|
|
53051
|
+
}
|
|
53052
|
+
resolve(users);
|
|
53053
|
+
}
|
|
53054
|
+
}));
|
|
53055
|
+
});
|
|
53056
|
+
};
|
|
53057
|
+
var unBlockUsers = function unBlockUsers(userIds, callback) {
|
|
53058
|
+
return new Promise(function (resolve, reject) {
|
|
53059
|
+
store.dispatch(unblockUserAC(userIds, function (users, error) {
|
|
53060
|
+
if (error) {
|
|
53061
|
+
reject(error);
|
|
53062
|
+
} else {
|
|
53063
|
+
if (callback) {
|
|
53064
|
+
callback(users);
|
|
53065
|
+
}
|
|
53066
|
+
resolve(users);
|
|
53067
|
+
}
|
|
53068
|
+
}));
|
|
53069
|
+
});
|
|
53070
|
+
};
|
|
52975
53071
|
|
|
52976
|
-
export { Attachment$1 as Attachment, Avatar, Channel, ChannelDetailsContainer as ChannelDetails, ChannelList, ChannelSearch, Chat, ChatHeader, CreateChannel, DropDown, EmojisPopup, FrequentlyEmojis, MESSAGE_TYPE, MessagesContainer as MessageList, MessageStatusIcon, MessageTextFormat, MessagesScrollToBottomButton, MessagesScrollToUnreadMentionsButton, OGMetadata, PollMessage, SceytChatContainer as SceytChat, SendMessageInput as SendMessage, THEME_COLORS, createOrGetDirectChannel, handleGetMessage, handleSendMessage, switchChannelActiveChannel, trimReactMessage };
|
|
53072
|
+
export { Attachment$1 as Attachment, Avatar, Channel, ChannelDetailsContainer as ChannelDetails, ChannelList, ChannelSearch, Chat, ChatHeader, CreateChannel, DropDown, EmojisPopup, FrequentlyEmojis, MESSAGE_TYPE, MessagesContainer as MessageList, MessageStatusIcon, MessageTextFormat, MessagesScrollToBottomButton, MessagesScrollToUnreadMentionsButton, OGMetadata, PollMessage, SceytChatContainer as SceytChat, SendMessageInput as SendMessage, THEME_COLORS, blockUsers, createOrGetDirectChannel, handleGetMessage, handleSendMessage, switchChannelActiveChannel, trimReactMessage, unBlockUsers };
|
|
52977
53073
|
//# sourceMappingURL=index.modern.js.map
|