sceyt-chat-react-uikit 1.7.1-beta.6 → 1.7.1-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +121 -97
- package/index.modern.js +121 -97
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -10082,14 +10082,7 @@ function updateMessageOnMap(channelId, updatedMessage) {
|
|
|
10082
10082
|
messagesList.push(_extends({}, mes, updatedMessageData));
|
|
10083
10083
|
continue;
|
|
10084
10084
|
} else {
|
|
10085
|
-
|
|
10086
|
-
updatedMessageData = _extends({}, mes, updatedMessage.params, {
|
|
10087
|
-
attachments: [].concat(mes.attachments, ((_updatedMessage$param = updatedMessage.params) === null || _updatedMessage$param === void 0 ? void 0 : _updatedMessage$param.attachments) || []).filter(function (att, index, self) {
|
|
10088
|
-
return index === self.findIndex(function (t) {
|
|
10089
|
-
return t.url === att.url && t.type === att.type && t.name === att.name;
|
|
10090
|
-
});
|
|
10091
|
-
})
|
|
10092
|
-
});
|
|
10085
|
+
updatedMessageData = _extends({}, mes, updatedMessage.params);
|
|
10093
10086
|
messagesList.push(_extends({}, mes, updatedMessageData));
|
|
10094
10087
|
continue;
|
|
10095
10088
|
}
|
|
@@ -15147,7 +15140,7 @@ function getChannels(action) {
|
|
|
15147
15140
|
}, _marked2$1, null, [[18, 20], [0, 23]]);
|
|
15148
15141
|
}
|
|
15149
15142
|
function searchChannels(action) {
|
|
15150
|
-
var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter2, _types2, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, channelQuery, channelsData, channelsToAdd, _t5;
|
|
15143
|
+
var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter2, _types2, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, handleChannels, channelsMap, _iterator, _step, channel, channelQuery, channelsData, _iterator2, _step2, _channel, channelsToAdd, _t5;
|
|
15151
15144
|
return _regenerator().w(function (_context3) {
|
|
15152
15145
|
while (1) switch (_context3.p = _context3.n) {
|
|
15153
15146
|
case 0:
|
|
@@ -15186,31 +15179,39 @@ function searchChannels(action) {
|
|
|
15186
15179
|
contactsList = [];
|
|
15187
15180
|
contactsWithChannelsMap = {};
|
|
15188
15181
|
lowerCaseSearchBy = searchBy.toLowerCase();
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
|
|
15195
|
-
|
|
15196
|
-
|
|
15197
|
-
|
|
15198
|
-
|
|
15199
|
-
|
|
15200
|
-
|
|
15201
|
-
|
|
15202
|
-
|
|
15203
|
-
}
|
|
15204
|
-
} else {
|
|
15205
|
-
if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
|
|
15206
|
-
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15207
|
-
publicChannels.push(channel);
|
|
15208
|
-
} else {
|
|
15182
|
+
handleChannels = function handleChannels(channels) {
|
|
15183
|
+
channels.forEach(function (channel) {
|
|
15184
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
|
|
15185
|
+
var _channel$metadata;
|
|
15186
|
+
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15187
|
+
var isSelfChannel = (_channel$metadata = channel.metadata) === null || _channel$metadata === void 0 ? void 0 : _channel$metadata.s;
|
|
15188
|
+
var directChannelUser = isSelfChannel ? SceytChatClient.user : channel.members.find(function (member) {
|
|
15189
|
+
return member.id !== SceytChatClient.user.id;
|
|
15190
|
+
});
|
|
15191
|
+
if (directChannelUser && contactsMap[directChannelUser.id]) {
|
|
15192
|
+
contactsWithChannelsMap[directChannelUser.id] = true;
|
|
15193
|
+
}
|
|
15194
|
+
var userName = makeUsername(directChannelUser && contactsMap[directChannelUser.id], directChannelUser, getFromContacts).toLowerCase();
|
|
15195
|
+
if (userName.includes(lowerCaseSearchBy) || isSelfChannel && 'me'.includes(lowerCaseSearchBy)) {
|
|
15209
15196
|
chatsGroups.push(channel);
|
|
15210
15197
|
}
|
|
15198
|
+
} else {
|
|
15199
|
+
if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
|
|
15200
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15201
|
+
publicChannels.push(channel);
|
|
15202
|
+
} else {
|
|
15203
|
+
chatsGroups.push(channel);
|
|
15204
|
+
}
|
|
15205
|
+
}
|
|
15211
15206
|
}
|
|
15212
|
-
}
|
|
15213
|
-
}
|
|
15207
|
+
});
|
|
15208
|
+
};
|
|
15209
|
+
channelsMap = {};
|
|
15210
|
+
for (_iterator = _createForOfIteratorHelperLoose(allChannels); !(_step = _iterator()).done;) {
|
|
15211
|
+
channel = _step.value;
|
|
15212
|
+
channelsMap[channel.id] = channel;
|
|
15213
|
+
}
|
|
15214
|
+
handleChannels(allChannels);
|
|
15214
15215
|
if (getFromContacts) {
|
|
15215
15216
|
Object.values(contactsMap).forEach(function (contact) {
|
|
15216
15217
|
if (!contactsWithChannelsMap[contact.id]) {
|
|
@@ -15244,6 +15245,13 @@ function searchChannels(action) {
|
|
|
15244
15245
|
return effects.call(channelQuery.loadNextPage);
|
|
15245
15246
|
case 5:
|
|
15246
15247
|
channelsData = _context3.v;
|
|
15248
|
+
for (_iterator2 = _createForOfIteratorHelperLoose(channelsData.channels); !(_step2 = _iterator2()).done;) {
|
|
15249
|
+
_channel = _step2.value;
|
|
15250
|
+
channelsMap[_channel.id] = _channel;
|
|
15251
|
+
}
|
|
15252
|
+
chatsGroups = [];
|
|
15253
|
+
publicChannels = [];
|
|
15254
|
+
handleChannels(Object.values(channelsMap));
|
|
15247
15255
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15248
15256
|
return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
|
|
15249
15257
|
});
|
|
@@ -15266,16 +15274,16 @@ function searchChannels(action) {
|
|
|
15266
15274
|
}, _marked3, null, [[0, 7]]);
|
|
15267
15275
|
}
|
|
15268
15276
|
function getChannelsForForward() {
|
|
15269
|
-
var
|
|
15277
|
+
var _SceytChatClient, channelQueryBuilder, channelTypesFilter, channelQuery, channelsData, channelsToAdd, _yield$call2, mappedChannels, _t6;
|
|
15270
15278
|
return _regenerator().w(function (_context4) {
|
|
15271
15279
|
while (1) switch (_context4.p = _context4.n) {
|
|
15272
15280
|
case 0:
|
|
15273
15281
|
_context4.p = 0;
|
|
15274
|
-
|
|
15282
|
+
_SceytChatClient = getClient();
|
|
15275
15283
|
_context4.n = 1;
|
|
15276
15284
|
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADING, true));
|
|
15277
15285
|
case 1:
|
|
15278
|
-
channelQueryBuilder = new
|
|
15286
|
+
channelQueryBuilder = new _SceytChatClient.ChannelListQueryBuilder();
|
|
15279
15287
|
channelTypesFilter = getChannelTypesFilter();
|
|
15280
15288
|
channelQueryBuilder.order('lastMessage');
|
|
15281
15289
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
@@ -15298,7 +15306,7 @@ function getChannelsForForward() {
|
|
|
15298
15306
|
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15299
15307
|
var isSelfChannel = (_channel$metadata2 = channel.metadata) === null || _channel$metadata2 === void 0 ? void 0 : _channel$metadata2.s;
|
|
15300
15308
|
return channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? channel.userRole === 'admin' || channel.userRole === 'owner' : channel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? isSelfChannel || channel.members.find(function (member) {
|
|
15301
|
-
return member.id && member.id !==
|
|
15309
|
+
return member.id && member.id !== _SceytChatClient.user.id;
|
|
15302
15310
|
}) : true;
|
|
15303
15311
|
});
|
|
15304
15312
|
_context4.n = 5;
|
|
@@ -15325,15 +15333,15 @@ function getChannelsForForward() {
|
|
|
15325
15333
|
}, _marked4, null, [[0, 8]]);
|
|
15326
15334
|
}
|
|
15327
15335
|
function searchChannelsForForward(action) {
|
|
15328
|
-
var payload, params,
|
|
15336
|
+
var payload, params, _contactsMap, _SceytChatClient2, _getFromContacts, searchBy, _params$filter3, _types3, channelQueryBuilder, channelTypesFilter, types, allChannels, _publicChannels, _chatsGroups, contactsList, _contactsWithChannelsMap, _lowerCaseSearchBy, handleChannels, channelsMap, _iterator3, _step3, channel, channelQuery, channelsData, _iterator4, _step4, _channel2, channelsToAdd, _t7;
|
|
15329
15337
|
return _regenerator().w(function (_context5) {
|
|
15330
15338
|
while (1) switch (_context5.p = _context5.n) {
|
|
15331
15339
|
case 0:
|
|
15332
15340
|
_context5.p = 0;
|
|
15333
15341
|
payload = action.payload;
|
|
15334
|
-
params = payload.params,
|
|
15335
|
-
|
|
15336
|
-
|
|
15342
|
+
params = payload.params, _contactsMap = payload.contactsMap;
|
|
15343
|
+
_SceytChatClient2 = getClient();
|
|
15344
|
+
_getFromContacts = getShowOnlyContactUsers();
|
|
15337
15345
|
_context5.n = 1;
|
|
15338
15346
|
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADING, true));
|
|
15339
15347
|
case 1:
|
|
@@ -15342,7 +15350,7 @@ function searchChannelsForForward(action) {
|
|
|
15342
15350
|
_context5.n = 6;
|
|
15343
15351
|
break;
|
|
15344
15352
|
}
|
|
15345
|
-
channelQueryBuilder = new
|
|
15353
|
+
channelQueryBuilder = new _SceytChatClient2.ChannelListQueryBuilder();
|
|
15346
15354
|
channelTypesFilter = getChannelTypesFilter();
|
|
15347
15355
|
types = [];
|
|
15348
15356
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
@@ -15355,41 +15363,49 @@ function searchChannelsForForward(action) {
|
|
|
15355
15363
|
channelQueryBuilder.types(types);
|
|
15356
15364
|
}
|
|
15357
15365
|
allChannels = getAllChannels();
|
|
15358
|
-
|
|
15359
|
-
|
|
15366
|
+
_publicChannels = [];
|
|
15367
|
+
_chatsGroups = [];
|
|
15360
15368
|
contactsList = [];
|
|
15361
|
-
|
|
15362
|
-
|
|
15363
|
-
|
|
15364
|
-
|
|
15365
|
-
|
|
15366
|
-
|
|
15367
|
-
|
|
15368
|
-
|
|
15369
|
-
|
|
15370
|
-
|
|
15371
|
-
|
|
15372
|
-
|
|
15373
|
-
|
|
15374
|
-
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
if (channel.
|
|
15381
|
-
|
|
15382
|
-
|
|
15383
|
-
|
|
15369
|
+
_contactsWithChannelsMap = {};
|
|
15370
|
+
_lowerCaseSearchBy = searchBy.toLowerCase();
|
|
15371
|
+
handleChannels = function handleChannels(channels) {
|
|
15372
|
+
channels.forEach(function (channel) {
|
|
15373
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
|
|
15374
|
+
var _channel$metadata3;
|
|
15375
|
+
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15376
|
+
var isSelfChannel = (_channel$metadata3 = channel.metadata) === null || _channel$metadata3 === void 0 ? void 0 : _channel$metadata3.s;
|
|
15377
|
+
var directChannelUser = isSelfChannel ? _SceytChatClient2.user : channel.members.find(function (member) {
|
|
15378
|
+
return member.id !== _SceytChatClient2.user.id;
|
|
15379
|
+
});
|
|
15380
|
+
if (directChannelUser && _contactsMap[directChannelUser.id]) {
|
|
15381
|
+
_contactsWithChannelsMap[directChannelUser.id] = true;
|
|
15382
|
+
}
|
|
15383
|
+
var userName = makeUsername(directChannelUser && _contactsMap[directChannelUser.id], directChannelUser, _getFromContacts).toLowerCase();
|
|
15384
|
+
if (userName.includes(_lowerCaseSearchBy) || isSelfChannel && 'me'.includes(_lowerCaseSearchBy)) {
|
|
15385
|
+
_chatsGroups.push(channel);
|
|
15386
|
+
}
|
|
15387
|
+
} else {
|
|
15388
|
+
if (channel.subject && channel.subject.toLowerCase().includes(_lowerCaseSearchBy)) {
|
|
15389
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15390
|
+
_publicChannels.push(channel);
|
|
15391
|
+
} else {
|
|
15392
|
+
_chatsGroups.push(channel);
|
|
15393
|
+
}
|
|
15384
15394
|
}
|
|
15385
15395
|
}
|
|
15386
|
-
}
|
|
15387
|
-
}
|
|
15388
|
-
|
|
15389
|
-
|
|
15390
|
-
|
|
15396
|
+
});
|
|
15397
|
+
};
|
|
15398
|
+
channelsMap = {};
|
|
15399
|
+
for (_iterator3 = _createForOfIteratorHelperLoose(allChannels); !(_step3 = _iterator3()).done;) {
|
|
15400
|
+
channel = _step3.value;
|
|
15401
|
+
channelsMap[channel.id] = channel;
|
|
15402
|
+
}
|
|
15403
|
+
handleChannels(allChannels);
|
|
15404
|
+
if (_getFromContacts) {
|
|
15405
|
+
Object.values(_contactsMap).forEach(function (contact) {
|
|
15406
|
+
if (!_contactsWithChannelsMap[contact.id]) {
|
|
15391
15407
|
var userName = makeUsername(contact, undefined, true).toLowerCase();
|
|
15392
|
-
if (userName.includes(
|
|
15408
|
+
if (userName.includes(_lowerCaseSearchBy)) {
|
|
15393
15409
|
contactsList.push(contact);
|
|
15394
15410
|
}
|
|
15395
15411
|
}
|
|
@@ -15397,15 +15413,15 @@ function searchChannelsForForward(action) {
|
|
|
15397
15413
|
}
|
|
15398
15414
|
_context5.n = 2;
|
|
15399
15415
|
return effects.put(setSearchedChannelsForForwardAC({
|
|
15400
|
-
chats_groups: JSON.parse(JSON.stringify(
|
|
15401
|
-
channels: JSON.parse(JSON.stringify(
|
|
15416
|
+
chats_groups: JSON.parse(JSON.stringify(_chatsGroups)),
|
|
15417
|
+
channels: JSON.parse(JSON.stringify(_publicChannels)),
|
|
15402
15418
|
contacts: JSON.parse(JSON.stringify(contactsList))
|
|
15403
15419
|
}));
|
|
15404
15420
|
case 2:
|
|
15405
15421
|
_context5.n = 3;
|
|
15406
15422
|
return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADED, true));
|
|
15407
15423
|
case 3:
|
|
15408
|
-
channelQueryBuilder.query(
|
|
15424
|
+
channelQueryBuilder.query(_lowerCaseSearchBy);
|
|
15409
15425
|
channelQueryBuilder.limit(params.limit || 50);
|
|
15410
15426
|
channelQueryBuilder.order('lastMessage');
|
|
15411
15427
|
channelQueryBuilder.filterKey(['subject']);
|
|
@@ -15418,12 +15434,19 @@ function searchChannelsForForward(action) {
|
|
|
15418
15434
|
return effects.call(channelQuery.loadNextPage);
|
|
15419
15435
|
case 5:
|
|
15420
15436
|
channelsData = _context5.v;
|
|
15437
|
+
for (_iterator4 = _createForOfIteratorHelperLoose(channelsData.channels); !(_step4 = _iterator4()).done;) {
|
|
15438
|
+
_channel2 = _step4.value;
|
|
15439
|
+
channelsMap[_channel2.id] = _channel2;
|
|
15440
|
+
}
|
|
15441
|
+
_chatsGroups = [];
|
|
15442
|
+
_publicChannels = [];
|
|
15443
|
+
handleChannels(Object.values(channelsMap));
|
|
15421
15444
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15422
15445
|
return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
|
|
15423
15446
|
});
|
|
15424
15447
|
_context5.n = 6;
|
|
15425
15448
|
return effects.put(setSearchedChannelsForForwardAC({
|
|
15426
|
-
chats_groups: JSON.parse(JSON.stringify(
|
|
15449
|
+
chats_groups: JSON.parse(JSON.stringify(_chatsGroups)),
|
|
15427
15450
|
channels: JSON.parse(JSON.stringify(channelsToAdd)),
|
|
15428
15451
|
contacts: JSON.parse(JSON.stringify(contactsList))
|
|
15429
15452
|
}));
|
|
@@ -15520,15 +15543,15 @@ function channelsLoadMore(action) {
|
|
|
15520
15543
|
}, _marked6, null, [[0, 9]]);
|
|
15521
15544
|
}
|
|
15522
15545
|
function getChannelMentions(action) {
|
|
15523
|
-
var payload, channelId,
|
|
15546
|
+
var payload, channelId, _SceytChatClient3, mentionsQueryBuilder, mentionsQuery, mentions, _t9;
|
|
15524
15547
|
return _regenerator().w(function (_context7) {
|
|
15525
15548
|
while (1) switch (_context7.p = _context7.n) {
|
|
15526
15549
|
case 0:
|
|
15527
15550
|
_context7.p = 0;
|
|
15528
15551
|
payload = action.payload;
|
|
15529
15552
|
channelId = payload.channelId;
|
|
15530
|
-
|
|
15531
|
-
mentionsQueryBuilder = new
|
|
15553
|
+
_SceytChatClient3 = getClient();
|
|
15554
|
+
mentionsQueryBuilder = new _SceytChatClient3.MentionsListQueryBuilder();
|
|
15532
15555
|
mentionsQueryBuilder.setChannelId(channelId);
|
|
15533
15556
|
mentionsQueryBuilder.limit(10);
|
|
15534
15557
|
mentionsQueryBuilder.setDirection(queryDirection.NEXT);
|
|
@@ -15557,14 +15580,14 @@ function getChannelMentions(action) {
|
|
|
15557
15580
|
}, _marked7, null, [[0, 4]]);
|
|
15558
15581
|
}
|
|
15559
15582
|
function channelsForForwardLoadMore(action) {
|
|
15560
|
-
var payload, limit,
|
|
15583
|
+
var payload, limit, _SceytChatClient4, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels, _t0;
|
|
15561
15584
|
return _regenerator().w(function (_context8) {
|
|
15562
15585
|
while (1) switch (_context8.p = _context8.n) {
|
|
15563
15586
|
case 0:
|
|
15564
15587
|
_context8.p = 0;
|
|
15565
15588
|
payload = action.payload;
|
|
15566
15589
|
limit = payload.limit;
|
|
15567
|
-
|
|
15590
|
+
_SceytChatClient4 = getClient();
|
|
15568
15591
|
channelQueryForward = query.channelQueryForward;
|
|
15569
15592
|
if (limit) {
|
|
15570
15593
|
channelQueryForward.limit = limit;
|
|
@@ -15581,7 +15604,7 @@ function channelsForForwardLoadMore(action) {
|
|
|
15581
15604
|
case 3:
|
|
15582
15605
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15583
15606
|
return channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? channel.userRole === 'admin' || channel.userRole === 'owner' : channel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? channel.members.find(function (member) {
|
|
15584
|
-
return member.id && member.id !==
|
|
15607
|
+
return member.id && member.id !== _SceytChatClient4.user.id;
|
|
15585
15608
|
}) : true;
|
|
15586
15609
|
});
|
|
15587
15610
|
_context8.n = 4;
|
|
@@ -15607,7 +15630,7 @@ function channelsForForwardLoadMore(action) {
|
|
|
15607
15630
|
}, _marked8, null, [[0, 7]]);
|
|
15608
15631
|
}
|
|
15609
15632
|
function markMessagesRead(action) {
|
|
15610
|
-
var payload, channelId, messageIds, channel, messageListMarker,
|
|
15633
|
+
var payload, channelId, messageIds, channel, messageListMarker, _iterator5, _step5, messageId, updateParams, _t1;
|
|
15611
15634
|
return _regenerator().w(function (_context9) {
|
|
15612
15635
|
while (1) switch (_context9.p = _context9.n) {
|
|
15613
15636
|
case 0:
|
|
@@ -15640,13 +15663,13 @@ function markMessagesRead(action) {
|
|
|
15640
15663
|
updateChannelOnAllChannels(channel.id, {
|
|
15641
15664
|
lastReadMessageId: channel.lastDisplayedMessageId
|
|
15642
15665
|
});
|
|
15643
|
-
|
|
15666
|
+
_iterator5 = _createForOfIteratorHelperLoose(messageListMarker.messageIds);
|
|
15644
15667
|
case 5:
|
|
15645
|
-
if ((
|
|
15668
|
+
if ((_step5 = _iterator5()).done) {
|
|
15646
15669
|
_context9.n = 8;
|
|
15647
15670
|
break;
|
|
15648
15671
|
}
|
|
15649
|
-
messageId =
|
|
15672
|
+
messageId = _step5.value;
|
|
15650
15673
|
updateParams = {
|
|
15651
15674
|
deliveryStatus: MESSAGE_DELIVERY_STATUS.READ,
|
|
15652
15675
|
userMarkers: [{
|
|
@@ -15717,7 +15740,7 @@ function markMessagesDelivered(action) {
|
|
|
15717
15740
|
}, _marked0, null, [[1, 4]]);
|
|
15718
15741
|
}
|
|
15719
15742
|
function switchChannel(action) {
|
|
15720
|
-
var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel,
|
|
15743
|
+
var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel, _SceytChatClient5, fetchedChannel, channelFromMap, currentActiveChannel, _t11;
|
|
15721
15744
|
return _regenerator().w(function (_context1) {
|
|
15722
15745
|
while (1) switch (_context1.p = _context1.n) {
|
|
15723
15746
|
case 0:
|
|
@@ -15755,9 +15778,9 @@ function switchChannel(action) {
|
|
|
15755
15778
|
_context1.n = 8;
|
|
15756
15779
|
break;
|
|
15757
15780
|
case 5:
|
|
15758
|
-
|
|
15781
|
+
_SceytChatClient5 = getClient();
|
|
15759
15782
|
_context1.n = 6;
|
|
15760
|
-
return effects.call(
|
|
15783
|
+
return effects.call(_SceytChatClient5.getChannel, channel.id);
|
|
15761
15784
|
case 6:
|
|
15762
15785
|
fetchedChannel = _context1.v;
|
|
15763
15786
|
addChannelToAllChannels(fetchedChannel);
|
|
@@ -16193,14 +16216,14 @@ function blockChannel(action) {
|
|
|
16193
16216
|
}, _marked19, null, [[0, 5]]);
|
|
16194
16217
|
}
|
|
16195
16218
|
function updateChannel(action) {
|
|
16196
|
-
var payload, channelId, config,
|
|
16219
|
+
var payload, channelId, config, _SceytChatClient6, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata, _t21;
|
|
16197
16220
|
return _regenerator().w(function (_context20) {
|
|
16198
16221
|
while (1) switch (_context20.p = _context20.n) {
|
|
16199
16222
|
case 0:
|
|
16200
16223
|
_context20.p = 0;
|
|
16201
16224
|
payload = action.payload;
|
|
16202
16225
|
channelId = payload.channelId, config = payload.config;
|
|
16203
|
-
|
|
16226
|
+
_SceytChatClient6 = getClient();
|
|
16204
16227
|
_context20.n = 1;
|
|
16205
16228
|
return effects.call(getChannelFromMap, channelId);
|
|
16206
16229
|
case 1:
|
|
@@ -16225,7 +16248,7 @@ function updateChannel(action) {
|
|
|
16225
16248
|
}
|
|
16226
16249
|
};
|
|
16227
16250
|
_context20.n = 2;
|
|
16228
|
-
return effects.call(
|
|
16251
|
+
return effects.call(_SceytChatClient6.uploadFile, fileToUpload);
|
|
16229
16252
|
case 2:
|
|
16230
16253
|
paramsToUpdate.avatarUrl = _context20.v;
|
|
16231
16254
|
case 3:
|
|
@@ -16269,15 +16292,15 @@ function updateChannel(action) {
|
|
|
16269
16292
|
}, _marked20, null, [[0, 6]]);
|
|
16270
16293
|
}
|
|
16271
16294
|
function checkUsersStatus() {
|
|
16272
|
-
var
|
|
16295
|
+
var _SceytChatClient7, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData, _t22;
|
|
16273
16296
|
return _regenerator().w(function (_context21) {
|
|
16274
16297
|
while (1) switch (_context21.p = _context21.n) {
|
|
16275
16298
|
case 0:
|
|
16276
16299
|
_context21.p = 0;
|
|
16277
|
-
|
|
16300
|
+
_SceytChatClient7 = getClient();
|
|
16278
16301
|
usersForUpdate = Object.keys(usersMap);
|
|
16279
16302
|
_context21.n = 1;
|
|
16280
|
-
return effects.call(
|
|
16303
|
+
return effects.call(_SceytChatClient7.getUsers, usersForUpdate);
|
|
16281
16304
|
case 1:
|
|
16282
16305
|
updatedUsers = _context21.v;
|
|
16283
16306
|
usersToUpdateMap = {};
|
|
@@ -16535,14 +16558,14 @@ function deleteAllMessages(action) {
|
|
|
16535
16558
|
}, _marked25, null, [[0, 9]]);
|
|
16536
16559
|
}
|
|
16537
16560
|
function joinChannel(action) {
|
|
16538
|
-
var payload, channelId,
|
|
16561
|
+
var payload, channelId, _SceytChatClient8, channel, joinedChannel, _t27;
|
|
16539
16562
|
return _regenerator().w(function (_context26) {
|
|
16540
16563
|
while (1) switch (_context26.p = _context26.n) {
|
|
16541
16564
|
case 0:
|
|
16542
16565
|
_context26.p = 0;
|
|
16543
16566
|
payload = action.payload;
|
|
16544
16567
|
channelId = payload.channelId;
|
|
16545
|
-
|
|
16568
|
+
_SceytChatClient8 = getClient();
|
|
16546
16569
|
_context26.n = 1;
|
|
16547
16570
|
return effects.call(getChannelFromMap, channelId);
|
|
16548
16571
|
case 1:
|
|
@@ -16555,7 +16578,7 @@ function joinChannel(action) {
|
|
|
16555
16578
|
break;
|
|
16556
16579
|
}
|
|
16557
16580
|
_context26.n = 2;
|
|
16558
|
-
return effects.call(
|
|
16581
|
+
return effects.call(_SceytChatClient8.getChannel, channelId);
|
|
16559
16582
|
case 2:
|
|
16560
16583
|
channel = _context26.v;
|
|
16561
16584
|
case 3:
|
|
@@ -31200,6 +31223,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
31200
31223
|
});
|
|
31201
31224
|
}, function () {
|
|
31202
31225
|
console.log('Failed to fetch OG metadata');
|
|
31226
|
+
setMetadata(null);
|
|
31203
31227
|
});
|
|
31204
31228
|
if (_temp && _temp.then) return _temp.then(function () {});
|
|
31205
31229
|
}
|
package/index.modern.js
CHANGED
|
@@ -10061,14 +10061,7 @@ function updateMessageOnMap(channelId, updatedMessage) {
|
|
|
10061
10061
|
messagesList.push(_extends({}, mes, updatedMessageData));
|
|
10062
10062
|
continue;
|
|
10063
10063
|
} else {
|
|
10064
|
-
|
|
10065
|
-
updatedMessageData = _extends({}, mes, updatedMessage.params, {
|
|
10066
|
-
attachments: [].concat(mes.attachments, ((_updatedMessage$param = updatedMessage.params) === null || _updatedMessage$param === void 0 ? void 0 : _updatedMessage$param.attachments) || []).filter(function (att, index, self) {
|
|
10067
|
-
return index === self.findIndex(function (t) {
|
|
10068
|
-
return t.url === att.url && t.type === att.type && t.name === att.name;
|
|
10069
|
-
});
|
|
10070
|
-
})
|
|
10071
|
-
});
|
|
10064
|
+
updatedMessageData = _extends({}, mes, updatedMessage.params);
|
|
10072
10065
|
messagesList.push(_extends({}, mes, updatedMessageData));
|
|
10073
10066
|
continue;
|
|
10074
10067
|
}
|
|
@@ -15126,7 +15119,7 @@ function getChannels(action) {
|
|
|
15126
15119
|
}, _marked2$1, null, [[18, 20], [0, 23]]);
|
|
15127
15120
|
}
|
|
15128
15121
|
function searchChannels(action) {
|
|
15129
|
-
var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter2, _types2, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, channelQuery, channelsData, channelsToAdd, _t5;
|
|
15122
|
+
var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter2, _types2, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, handleChannels, channelsMap, _iterator, _step, channel, channelQuery, channelsData, _iterator2, _step2, _channel, channelsToAdd, _t5;
|
|
15130
15123
|
return _regenerator().w(function (_context3) {
|
|
15131
15124
|
while (1) switch (_context3.p = _context3.n) {
|
|
15132
15125
|
case 0:
|
|
@@ -15165,31 +15158,39 @@ function searchChannels(action) {
|
|
|
15165
15158
|
contactsList = [];
|
|
15166
15159
|
contactsWithChannelsMap = {};
|
|
15167
15160
|
lowerCaseSearchBy = searchBy.toLowerCase();
|
|
15168
|
-
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
}
|
|
15183
|
-
} else {
|
|
15184
|
-
if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
|
|
15185
|
-
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15186
|
-
publicChannels.push(channel);
|
|
15187
|
-
} else {
|
|
15161
|
+
handleChannels = function handleChannels(channels) {
|
|
15162
|
+
channels.forEach(function (channel) {
|
|
15163
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
|
|
15164
|
+
var _channel$metadata;
|
|
15165
|
+
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15166
|
+
var isSelfChannel = (_channel$metadata = channel.metadata) === null || _channel$metadata === void 0 ? void 0 : _channel$metadata.s;
|
|
15167
|
+
var directChannelUser = isSelfChannel ? SceytChatClient.user : channel.members.find(function (member) {
|
|
15168
|
+
return member.id !== SceytChatClient.user.id;
|
|
15169
|
+
});
|
|
15170
|
+
if (directChannelUser && contactsMap[directChannelUser.id]) {
|
|
15171
|
+
contactsWithChannelsMap[directChannelUser.id] = true;
|
|
15172
|
+
}
|
|
15173
|
+
var userName = makeUsername(directChannelUser && contactsMap[directChannelUser.id], directChannelUser, getFromContacts).toLowerCase();
|
|
15174
|
+
if (userName.includes(lowerCaseSearchBy) || isSelfChannel && 'me'.includes(lowerCaseSearchBy)) {
|
|
15188
15175
|
chatsGroups.push(channel);
|
|
15189
15176
|
}
|
|
15177
|
+
} else {
|
|
15178
|
+
if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
|
|
15179
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15180
|
+
publicChannels.push(channel);
|
|
15181
|
+
} else {
|
|
15182
|
+
chatsGroups.push(channel);
|
|
15183
|
+
}
|
|
15184
|
+
}
|
|
15190
15185
|
}
|
|
15191
|
-
}
|
|
15192
|
-
}
|
|
15186
|
+
});
|
|
15187
|
+
};
|
|
15188
|
+
channelsMap = {};
|
|
15189
|
+
for (_iterator = _createForOfIteratorHelperLoose(allChannels); !(_step = _iterator()).done;) {
|
|
15190
|
+
channel = _step.value;
|
|
15191
|
+
channelsMap[channel.id] = channel;
|
|
15192
|
+
}
|
|
15193
|
+
handleChannels(allChannels);
|
|
15193
15194
|
if (getFromContacts) {
|
|
15194
15195
|
Object.values(contactsMap).forEach(function (contact) {
|
|
15195
15196
|
if (!contactsWithChannelsMap[contact.id]) {
|
|
@@ -15223,6 +15224,13 @@ function searchChannels(action) {
|
|
|
15223
15224
|
return call(channelQuery.loadNextPage);
|
|
15224
15225
|
case 5:
|
|
15225
15226
|
channelsData = _context3.v;
|
|
15227
|
+
for (_iterator2 = _createForOfIteratorHelperLoose(channelsData.channels); !(_step2 = _iterator2()).done;) {
|
|
15228
|
+
_channel = _step2.value;
|
|
15229
|
+
channelsMap[_channel.id] = _channel;
|
|
15230
|
+
}
|
|
15231
|
+
chatsGroups = [];
|
|
15232
|
+
publicChannels = [];
|
|
15233
|
+
handleChannels(Object.values(channelsMap));
|
|
15226
15234
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15227
15235
|
return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
|
|
15228
15236
|
});
|
|
@@ -15245,16 +15253,16 @@ function searchChannels(action) {
|
|
|
15245
15253
|
}, _marked3, null, [[0, 7]]);
|
|
15246
15254
|
}
|
|
15247
15255
|
function getChannelsForForward() {
|
|
15248
|
-
var
|
|
15256
|
+
var _SceytChatClient, channelQueryBuilder, channelTypesFilter, channelQuery, channelsData, channelsToAdd, _yield$call2, mappedChannels, _t6;
|
|
15249
15257
|
return _regenerator().w(function (_context4) {
|
|
15250
15258
|
while (1) switch (_context4.p = _context4.n) {
|
|
15251
15259
|
case 0:
|
|
15252
15260
|
_context4.p = 0;
|
|
15253
|
-
|
|
15261
|
+
_SceytChatClient = getClient();
|
|
15254
15262
|
_context4.n = 1;
|
|
15255
15263
|
return put(setChannelsLoadingStateAC(LOADING_STATE.LOADING, true));
|
|
15256
15264
|
case 1:
|
|
15257
|
-
channelQueryBuilder = new
|
|
15265
|
+
channelQueryBuilder = new _SceytChatClient.ChannelListQueryBuilder();
|
|
15258
15266
|
channelTypesFilter = getChannelTypesFilter();
|
|
15259
15267
|
channelQueryBuilder.order('lastMessage');
|
|
15260
15268
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
@@ -15277,7 +15285,7 @@ function getChannelsForForward() {
|
|
|
15277
15285
|
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15278
15286
|
var isSelfChannel = (_channel$metadata2 = channel.metadata) === null || _channel$metadata2 === void 0 ? void 0 : _channel$metadata2.s;
|
|
15279
15287
|
return channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? channel.userRole === 'admin' || channel.userRole === 'owner' : channel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? isSelfChannel || channel.members.find(function (member) {
|
|
15280
|
-
return member.id && member.id !==
|
|
15288
|
+
return member.id && member.id !== _SceytChatClient.user.id;
|
|
15281
15289
|
}) : true;
|
|
15282
15290
|
});
|
|
15283
15291
|
_context4.n = 5;
|
|
@@ -15304,15 +15312,15 @@ function getChannelsForForward() {
|
|
|
15304
15312
|
}, _marked4, null, [[0, 8]]);
|
|
15305
15313
|
}
|
|
15306
15314
|
function searchChannelsForForward(action) {
|
|
15307
|
-
var payload, params,
|
|
15315
|
+
var payload, params, _contactsMap, _SceytChatClient2, _getFromContacts, searchBy, _params$filter3, _types3, channelQueryBuilder, channelTypesFilter, types, allChannels, _publicChannels, _chatsGroups, contactsList, _contactsWithChannelsMap, _lowerCaseSearchBy, handleChannels, channelsMap, _iterator3, _step3, channel, channelQuery, channelsData, _iterator4, _step4, _channel2, channelsToAdd, _t7;
|
|
15308
15316
|
return _regenerator().w(function (_context5) {
|
|
15309
15317
|
while (1) switch (_context5.p = _context5.n) {
|
|
15310
15318
|
case 0:
|
|
15311
15319
|
_context5.p = 0;
|
|
15312
15320
|
payload = action.payload;
|
|
15313
|
-
params = payload.params,
|
|
15314
|
-
|
|
15315
|
-
|
|
15321
|
+
params = payload.params, _contactsMap = payload.contactsMap;
|
|
15322
|
+
_SceytChatClient2 = getClient();
|
|
15323
|
+
_getFromContacts = getShowOnlyContactUsers();
|
|
15316
15324
|
_context5.n = 1;
|
|
15317
15325
|
return put(setChannelsLoadingStateAC(LOADING_STATE.LOADING, true));
|
|
15318
15326
|
case 1:
|
|
@@ -15321,7 +15329,7 @@ function searchChannelsForForward(action) {
|
|
|
15321
15329
|
_context5.n = 6;
|
|
15322
15330
|
break;
|
|
15323
15331
|
}
|
|
15324
|
-
channelQueryBuilder = new
|
|
15332
|
+
channelQueryBuilder = new _SceytChatClient2.ChannelListQueryBuilder();
|
|
15325
15333
|
channelTypesFilter = getChannelTypesFilter();
|
|
15326
15334
|
types = [];
|
|
15327
15335
|
if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
|
|
@@ -15334,41 +15342,49 @@ function searchChannelsForForward(action) {
|
|
|
15334
15342
|
channelQueryBuilder.types(types);
|
|
15335
15343
|
}
|
|
15336
15344
|
allChannels = getAllChannels();
|
|
15337
|
-
|
|
15338
|
-
|
|
15345
|
+
_publicChannels = [];
|
|
15346
|
+
_chatsGroups = [];
|
|
15339
15347
|
contactsList = [];
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
|
|
15351
|
-
|
|
15352
|
-
|
|
15353
|
-
|
|
15354
|
-
|
|
15355
|
-
|
|
15356
|
-
|
|
15357
|
-
|
|
15358
|
-
|
|
15359
|
-
if (channel.
|
|
15360
|
-
|
|
15361
|
-
|
|
15362
|
-
|
|
15348
|
+
_contactsWithChannelsMap = {};
|
|
15349
|
+
_lowerCaseSearchBy = searchBy.toLowerCase();
|
|
15350
|
+
handleChannels = function handleChannels(channels) {
|
|
15351
|
+
channels.forEach(function (channel) {
|
|
15352
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
|
|
15353
|
+
var _channel$metadata3;
|
|
15354
|
+
channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
|
|
15355
|
+
var isSelfChannel = (_channel$metadata3 = channel.metadata) === null || _channel$metadata3 === void 0 ? void 0 : _channel$metadata3.s;
|
|
15356
|
+
var directChannelUser = isSelfChannel ? _SceytChatClient2.user : channel.members.find(function (member) {
|
|
15357
|
+
return member.id !== _SceytChatClient2.user.id;
|
|
15358
|
+
});
|
|
15359
|
+
if (directChannelUser && _contactsMap[directChannelUser.id]) {
|
|
15360
|
+
_contactsWithChannelsMap[directChannelUser.id] = true;
|
|
15361
|
+
}
|
|
15362
|
+
var userName = makeUsername(directChannelUser && _contactsMap[directChannelUser.id], directChannelUser, _getFromContacts).toLowerCase();
|
|
15363
|
+
if (userName.includes(_lowerCaseSearchBy) || isSelfChannel && 'me'.includes(_lowerCaseSearchBy)) {
|
|
15364
|
+
_chatsGroups.push(channel);
|
|
15365
|
+
}
|
|
15366
|
+
} else {
|
|
15367
|
+
if (channel.subject && channel.subject.toLowerCase().includes(_lowerCaseSearchBy)) {
|
|
15368
|
+
if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
|
|
15369
|
+
_publicChannels.push(channel);
|
|
15370
|
+
} else {
|
|
15371
|
+
_chatsGroups.push(channel);
|
|
15372
|
+
}
|
|
15363
15373
|
}
|
|
15364
15374
|
}
|
|
15365
|
-
}
|
|
15366
|
-
}
|
|
15367
|
-
|
|
15368
|
-
|
|
15369
|
-
|
|
15375
|
+
});
|
|
15376
|
+
};
|
|
15377
|
+
channelsMap = {};
|
|
15378
|
+
for (_iterator3 = _createForOfIteratorHelperLoose(allChannels); !(_step3 = _iterator3()).done;) {
|
|
15379
|
+
channel = _step3.value;
|
|
15380
|
+
channelsMap[channel.id] = channel;
|
|
15381
|
+
}
|
|
15382
|
+
handleChannels(allChannels);
|
|
15383
|
+
if (_getFromContacts) {
|
|
15384
|
+
Object.values(_contactsMap).forEach(function (contact) {
|
|
15385
|
+
if (!_contactsWithChannelsMap[contact.id]) {
|
|
15370
15386
|
var userName = makeUsername(contact, undefined, true).toLowerCase();
|
|
15371
|
-
if (userName.includes(
|
|
15387
|
+
if (userName.includes(_lowerCaseSearchBy)) {
|
|
15372
15388
|
contactsList.push(contact);
|
|
15373
15389
|
}
|
|
15374
15390
|
}
|
|
@@ -15376,15 +15392,15 @@ function searchChannelsForForward(action) {
|
|
|
15376
15392
|
}
|
|
15377
15393
|
_context5.n = 2;
|
|
15378
15394
|
return put(setSearchedChannelsForForwardAC({
|
|
15379
|
-
chats_groups: JSON.parse(JSON.stringify(
|
|
15380
|
-
channels: JSON.parse(JSON.stringify(
|
|
15395
|
+
chats_groups: JSON.parse(JSON.stringify(_chatsGroups)),
|
|
15396
|
+
channels: JSON.parse(JSON.stringify(_publicChannels)),
|
|
15381
15397
|
contacts: JSON.parse(JSON.stringify(contactsList))
|
|
15382
15398
|
}));
|
|
15383
15399
|
case 2:
|
|
15384
15400
|
_context5.n = 3;
|
|
15385
15401
|
return put(setChannelsLoadingStateAC(LOADING_STATE.LOADED, true));
|
|
15386
15402
|
case 3:
|
|
15387
|
-
channelQueryBuilder.query(
|
|
15403
|
+
channelQueryBuilder.query(_lowerCaseSearchBy);
|
|
15388
15404
|
channelQueryBuilder.limit(params.limit || 50);
|
|
15389
15405
|
channelQueryBuilder.order('lastMessage');
|
|
15390
15406
|
channelQueryBuilder.filterKey(['subject']);
|
|
@@ -15397,12 +15413,19 @@ function searchChannelsForForward(action) {
|
|
|
15397
15413
|
return call(channelQuery.loadNextPage);
|
|
15398
15414
|
case 5:
|
|
15399
15415
|
channelsData = _context5.v;
|
|
15416
|
+
for (_iterator4 = _createForOfIteratorHelperLoose(channelsData.channels); !(_step4 = _iterator4()).done;) {
|
|
15417
|
+
_channel2 = _step4.value;
|
|
15418
|
+
channelsMap[_channel2.id] = _channel2;
|
|
15419
|
+
}
|
|
15420
|
+
_chatsGroups = [];
|
|
15421
|
+
_publicChannels = [];
|
|
15422
|
+
handleChannels(Object.values(channelsMap));
|
|
15400
15423
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15401
15424
|
return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
|
|
15402
15425
|
});
|
|
15403
15426
|
_context5.n = 6;
|
|
15404
15427
|
return put(setSearchedChannelsForForwardAC({
|
|
15405
|
-
chats_groups: JSON.parse(JSON.stringify(
|
|
15428
|
+
chats_groups: JSON.parse(JSON.stringify(_chatsGroups)),
|
|
15406
15429
|
channels: JSON.parse(JSON.stringify(channelsToAdd)),
|
|
15407
15430
|
contacts: JSON.parse(JSON.stringify(contactsList))
|
|
15408
15431
|
}));
|
|
@@ -15499,15 +15522,15 @@ function channelsLoadMore(action) {
|
|
|
15499
15522
|
}, _marked6, null, [[0, 9]]);
|
|
15500
15523
|
}
|
|
15501
15524
|
function getChannelMentions(action) {
|
|
15502
|
-
var payload, channelId,
|
|
15525
|
+
var payload, channelId, _SceytChatClient3, mentionsQueryBuilder, mentionsQuery, mentions, _t9;
|
|
15503
15526
|
return _regenerator().w(function (_context7) {
|
|
15504
15527
|
while (1) switch (_context7.p = _context7.n) {
|
|
15505
15528
|
case 0:
|
|
15506
15529
|
_context7.p = 0;
|
|
15507
15530
|
payload = action.payload;
|
|
15508
15531
|
channelId = payload.channelId;
|
|
15509
|
-
|
|
15510
|
-
mentionsQueryBuilder = new
|
|
15532
|
+
_SceytChatClient3 = getClient();
|
|
15533
|
+
mentionsQueryBuilder = new _SceytChatClient3.MentionsListQueryBuilder();
|
|
15511
15534
|
mentionsQueryBuilder.setChannelId(channelId);
|
|
15512
15535
|
mentionsQueryBuilder.limit(10);
|
|
15513
15536
|
mentionsQueryBuilder.setDirection(queryDirection.NEXT);
|
|
@@ -15536,14 +15559,14 @@ function getChannelMentions(action) {
|
|
|
15536
15559
|
}, _marked7, null, [[0, 4]]);
|
|
15537
15560
|
}
|
|
15538
15561
|
function channelsForForwardLoadMore(action) {
|
|
15539
|
-
var payload, limit,
|
|
15562
|
+
var payload, limit, _SceytChatClient4, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels, _t0;
|
|
15540
15563
|
return _regenerator().w(function (_context8) {
|
|
15541
15564
|
while (1) switch (_context8.p = _context8.n) {
|
|
15542
15565
|
case 0:
|
|
15543
15566
|
_context8.p = 0;
|
|
15544
15567
|
payload = action.payload;
|
|
15545
15568
|
limit = payload.limit;
|
|
15546
|
-
|
|
15569
|
+
_SceytChatClient4 = getClient();
|
|
15547
15570
|
channelQueryForward = query.channelQueryForward;
|
|
15548
15571
|
if (limit) {
|
|
15549
15572
|
channelQueryForward.limit = limit;
|
|
@@ -15560,7 +15583,7 @@ function channelsForForwardLoadMore(action) {
|
|
|
15560
15583
|
case 3:
|
|
15561
15584
|
channelsToAdd = channelsData.channels.filter(function (channel) {
|
|
15562
15585
|
return channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? channel.userRole === 'admin' || channel.userRole === 'owner' : channel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? channel.members.find(function (member) {
|
|
15563
|
-
return member.id && member.id !==
|
|
15586
|
+
return member.id && member.id !== _SceytChatClient4.user.id;
|
|
15564
15587
|
}) : true;
|
|
15565
15588
|
});
|
|
15566
15589
|
_context8.n = 4;
|
|
@@ -15586,7 +15609,7 @@ function channelsForForwardLoadMore(action) {
|
|
|
15586
15609
|
}, _marked8, null, [[0, 7]]);
|
|
15587
15610
|
}
|
|
15588
15611
|
function markMessagesRead(action) {
|
|
15589
|
-
var payload, channelId, messageIds, channel, messageListMarker,
|
|
15612
|
+
var payload, channelId, messageIds, channel, messageListMarker, _iterator5, _step5, messageId, updateParams, _t1;
|
|
15590
15613
|
return _regenerator().w(function (_context9) {
|
|
15591
15614
|
while (1) switch (_context9.p = _context9.n) {
|
|
15592
15615
|
case 0:
|
|
@@ -15619,13 +15642,13 @@ function markMessagesRead(action) {
|
|
|
15619
15642
|
updateChannelOnAllChannels(channel.id, {
|
|
15620
15643
|
lastReadMessageId: channel.lastDisplayedMessageId
|
|
15621
15644
|
});
|
|
15622
|
-
|
|
15645
|
+
_iterator5 = _createForOfIteratorHelperLoose(messageListMarker.messageIds);
|
|
15623
15646
|
case 5:
|
|
15624
|
-
if ((
|
|
15647
|
+
if ((_step5 = _iterator5()).done) {
|
|
15625
15648
|
_context9.n = 8;
|
|
15626
15649
|
break;
|
|
15627
15650
|
}
|
|
15628
|
-
messageId =
|
|
15651
|
+
messageId = _step5.value;
|
|
15629
15652
|
updateParams = {
|
|
15630
15653
|
deliveryStatus: MESSAGE_DELIVERY_STATUS.READ,
|
|
15631
15654
|
userMarkers: [{
|
|
@@ -15696,7 +15719,7 @@ function markMessagesDelivered(action) {
|
|
|
15696
15719
|
}, _marked0, null, [[1, 4]]);
|
|
15697
15720
|
}
|
|
15698
15721
|
function switchChannel(action) {
|
|
15699
|
-
var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel,
|
|
15722
|
+
var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel, _SceytChatClient5, fetchedChannel, channelFromMap, currentActiveChannel, _t11;
|
|
15700
15723
|
return _regenerator().w(function (_context1) {
|
|
15701
15724
|
while (1) switch (_context1.p = _context1.n) {
|
|
15702
15725
|
case 0:
|
|
@@ -15734,9 +15757,9 @@ function switchChannel(action) {
|
|
|
15734
15757
|
_context1.n = 8;
|
|
15735
15758
|
break;
|
|
15736
15759
|
case 5:
|
|
15737
|
-
|
|
15760
|
+
_SceytChatClient5 = getClient();
|
|
15738
15761
|
_context1.n = 6;
|
|
15739
|
-
return call(
|
|
15762
|
+
return call(_SceytChatClient5.getChannel, channel.id);
|
|
15740
15763
|
case 6:
|
|
15741
15764
|
fetchedChannel = _context1.v;
|
|
15742
15765
|
addChannelToAllChannels(fetchedChannel);
|
|
@@ -16172,14 +16195,14 @@ function blockChannel(action) {
|
|
|
16172
16195
|
}, _marked19, null, [[0, 5]]);
|
|
16173
16196
|
}
|
|
16174
16197
|
function updateChannel(action) {
|
|
16175
|
-
var payload, channelId, config,
|
|
16198
|
+
var payload, channelId, config, _SceytChatClient6, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata, _t21;
|
|
16176
16199
|
return _regenerator().w(function (_context20) {
|
|
16177
16200
|
while (1) switch (_context20.p = _context20.n) {
|
|
16178
16201
|
case 0:
|
|
16179
16202
|
_context20.p = 0;
|
|
16180
16203
|
payload = action.payload;
|
|
16181
16204
|
channelId = payload.channelId, config = payload.config;
|
|
16182
|
-
|
|
16205
|
+
_SceytChatClient6 = getClient();
|
|
16183
16206
|
_context20.n = 1;
|
|
16184
16207
|
return call(getChannelFromMap, channelId);
|
|
16185
16208
|
case 1:
|
|
@@ -16204,7 +16227,7 @@ function updateChannel(action) {
|
|
|
16204
16227
|
}
|
|
16205
16228
|
};
|
|
16206
16229
|
_context20.n = 2;
|
|
16207
|
-
return call(
|
|
16230
|
+
return call(_SceytChatClient6.uploadFile, fileToUpload);
|
|
16208
16231
|
case 2:
|
|
16209
16232
|
paramsToUpdate.avatarUrl = _context20.v;
|
|
16210
16233
|
case 3:
|
|
@@ -16248,15 +16271,15 @@ function updateChannel(action) {
|
|
|
16248
16271
|
}, _marked20, null, [[0, 6]]);
|
|
16249
16272
|
}
|
|
16250
16273
|
function checkUsersStatus() {
|
|
16251
|
-
var
|
|
16274
|
+
var _SceytChatClient7, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData, _t22;
|
|
16252
16275
|
return _regenerator().w(function (_context21) {
|
|
16253
16276
|
while (1) switch (_context21.p = _context21.n) {
|
|
16254
16277
|
case 0:
|
|
16255
16278
|
_context21.p = 0;
|
|
16256
|
-
|
|
16279
|
+
_SceytChatClient7 = getClient();
|
|
16257
16280
|
usersForUpdate = Object.keys(usersMap);
|
|
16258
16281
|
_context21.n = 1;
|
|
16259
|
-
return call(
|
|
16282
|
+
return call(_SceytChatClient7.getUsers, usersForUpdate);
|
|
16260
16283
|
case 1:
|
|
16261
16284
|
updatedUsers = _context21.v;
|
|
16262
16285
|
usersToUpdateMap = {};
|
|
@@ -16514,14 +16537,14 @@ function deleteAllMessages(action) {
|
|
|
16514
16537
|
}, _marked25, null, [[0, 9]]);
|
|
16515
16538
|
}
|
|
16516
16539
|
function joinChannel(action) {
|
|
16517
|
-
var payload, channelId,
|
|
16540
|
+
var payload, channelId, _SceytChatClient8, channel, joinedChannel, _t27;
|
|
16518
16541
|
return _regenerator().w(function (_context26) {
|
|
16519
16542
|
while (1) switch (_context26.p = _context26.n) {
|
|
16520
16543
|
case 0:
|
|
16521
16544
|
_context26.p = 0;
|
|
16522
16545
|
payload = action.payload;
|
|
16523
16546
|
channelId = payload.channelId;
|
|
16524
|
-
|
|
16547
|
+
_SceytChatClient8 = getClient();
|
|
16525
16548
|
_context26.n = 1;
|
|
16526
16549
|
return call(getChannelFromMap, channelId);
|
|
16527
16550
|
case 1:
|
|
@@ -16534,7 +16557,7 @@ function joinChannel(action) {
|
|
|
16534
16557
|
break;
|
|
16535
16558
|
}
|
|
16536
16559
|
_context26.n = 2;
|
|
16537
|
-
return call(
|
|
16560
|
+
return call(_SceytChatClient8.getChannel, channelId);
|
|
16538
16561
|
case 2:
|
|
16539
16562
|
channel = _context26.v;
|
|
16540
16563
|
case 3:
|
|
@@ -31179,6 +31202,7 @@ var OGMetadata = function OGMetadata(_ref) {
|
|
|
31179
31202
|
});
|
|
31180
31203
|
}, function () {
|
|
31181
31204
|
console.log('Failed to fetch OG metadata');
|
|
31205
|
+
setMetadata(null);
|
|
31182
31206
|
});
|
|
31183
31207
|
if (_temp && _temp.then) return _temp.then(function () {});
|
|
31184
31208
|
}
|