sceyt-chat-react-uikit 1.7.1-beta.5 → 1.7.1-beta.7

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.
Files changed (3) hide show
  1. package/index.js +128 -97
  2. package/index.modern.js +128 -97
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -10073,11 +10073,14 @@ function updateMessageOnMap(channelId, updatedMessage) {
10073
10073
  }
10074
10074
  var updatedMessageData = null;
10075
10075
  if (messagesMap[channelId]) {
10076
- messagesMap[channelId].map(function (mes) {
10076
+ var messagesList = [];
10077
+ for (var _iterator = _createForOfIteratorHelperLoose(messagesMap[channelId]), _step; !(_step = _iterator()).done;) {
10078
+ var mes = _step.value;
10077
10079
  if (mes.tid === updatedMessage.messageId || mes.id === updatedMessage.messageId) {
10078
10080
  if (updatedMessage.params.state === MESSAGE_STATUS.DELETE) {
10079
10081
  updatedMessageData = _extends({}, updatedMessage.params);
10080
- return updatedMessageData;
10082
+ messagesList.push(_extends({}, mes, updatedMessageData));
10083
+ continue;
10081
10084
  } else {
10082
10085
  var _updatedMessage$param;
10083
10086
  updatedMessageData = _extends({}, mes, updatedMessage.params, {
@@ -10087,11 +10090,13 @@ function updateMessageOnMap(channelId, updatedMessage) {
10087
10090
  });
10088
10091
  })
10089
10092
  });
10090
- return updatedMessage;
10093
+ messagesList.push(_extends({}, mes, updatedMessageData));
10094
+ continue;
10091
10095
  }
10092
10096
  }
10093
- return mes;
10094
- });
10097
+ messagesList.push(mes);
10098
+ }
10099
+ messagesMap[channelId] = messagesList;
10095
10100
  }
10096
10101
  return updatedMessageData;
10097
10102
  }
@@ -14819,8 +14824,8 @@ function createChannel(action) {
14819
14824
  allChannels.forEach(function (channel) {
14820
14825
  if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
14821
14826
  if (isSelfChannel) {
14822
- var meta = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
14823
- if (meta !== null && meta !== void 0 && meta.s) {
14827
+ var _channel$members;
14828
+ if (((_channel$members = channel.members) === null || _channel$members === void 0 ? void 0 : _channel$members.length) === 1 && channel.members[0].id === memberId) {
14824
14829
  channelIsExistOnAllChannels = true;
14825
14830
  }
14826
14831
  } else {
@@ -15142,7 +15147,7 @@ function getChannels(action) {
15142
15147
  }, _marked2$1, null, [[18, 20], [0, 23]]);
15143
15148
  }
15144
15149
  function searchChannels(action) {
15145
- var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter2, _types2, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, channelQuery, channelsData, channelsToAdd, _t5;
15150
+ 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;
15146
15151
  return _regenerator().w(function (_context3) {
15147
15152
  while (1) switch (_context3.p = _context3.n) {
15148
15153
  case 0:
@@ -15181,31 +15186,39 @@ function searchChannels(action) {
15181
15186
  contactsList = [];
15182
15187
  contactsWithChannelsMap = {};
15183
15188
  lowerCaseSearchBy = searchBy.toLowerCase();
15184
- allChannels.forEach(function (channel) {
15185
- if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
15186
- var _channel$metadata;
15187
- channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
15188
- var isSelfChannel = (_channel$metadata = channel.metadata) === null || _channel$metadata === void 0 ? void 0 : _channel$metadata.s;
15189
- var directChannelUser = isSelfChannel ? SceytChatClient.user : channel.members.find(function (member) {
15190
- return member.id !== SceytChatClient.user.id;
15191
- });
15192
- if (directChannelUser && contactsMap[directChannelUser.id]) {
15193
- contactsWithChannelsMap[directChannelUser.id] = true;
15194
- }
15195
- var userName = makeUsername(directChannelUser && contactsMap[directChannelUser.id], directChannelUser, getFromContacts).toLowerCase();
15196
- if (userName.includes(lowerCaseSearchBy) || isSelfChannel && 'me'.includes(lowerCaseSearchBy)) {
15197
- chatsGroups.push(channel);
15198
- }
15199
- } else {
15200
- if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
15201
- if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
15202
- publicChannels.push(channel);
15203
- } else {
15189
+ handleChannels = function handleChannels(channels) {
15190
+ channels.forEach(function (channel) {
15191
+ if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
15192
+ var _channel$metadata;
15193
+ channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
15194
+ var isSelfChannel = (_channel$metadata = channel.metadata) === null || _channel$metadata === void 0 ? void 0 : _channel$metadata.s;
15195
+ var directChannelUser = isSelfChannel ? SceytChatClient.user : channel.members.find(function (member) {
15196
+ return member.id !== SceytChatClient.user.id;
15197
+ });
15198
+ if (directChannelUser && contactsMap[directChannelUser.id]) {
15199
+ contactsWithChannelsMap[directChannelUser.id] = true;
15200
+ }
15201
+ var userName = makeUsername(directChannelUser && contactsMap[directChannelUser.id], directChannelUser, getFromContacts).toLowerCase();
15202
+ if (userName.includes(lowerCaseSearchBy) || isSelfChannel && 'me'.includes(lowerCaseSearchBy)) {
15204
15203
  chatsGroups.push(channel);
15205
15204
  }
15205
+ } else {
15206
+ if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
15207
+ if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
15208
+ publicChannels.push(channel);
15209
+ } else {
15210
+ chatsGroups.push(channel);
15211
+ }
15212
+ }
15206
15213
  }
15207
- }
15208
- });
15214
+ });
15215
+ };
15216
+ channelsMap = {};
15217
+ for (_iterator = _createForOfIteratorHelperLoose(allChannels); !(_step = _iterator()).done;) {
15218
+ channel = _step.value;
15219
+ channelsMap[channel.id] = channel;
15220
+ }
15221
+ handleChannels(allChannels);
15209
15222
  if (getFromContacts) {
15210
15223
  Object.values(contactsMap).forEach(function (contact) {
15211
15224
  if (!contactsWithChannelsMap[contact.id]) {
@@ -15239,6 +15252,11 @@ function searchChannels(action) {
15239
15252
  return effects.call(channelQuery.loadNextPage);
15240
15253
  case 5:
15241
15254
  channelsData = _context3.v;
15255
+ for (_iterator2 = _createForOfIteratorHelperLoose(channelsData.channels); !(_step2 = _iterator2()).done;) {
15256
+ _channel = _step2.value;
15257
+ channelsMap[_channel.id] = _channel;
15258
+ }
15259
+ handleChannels(Object.values(channelsMap));
15242
15260
  channelsToAdd = channelsData.channels.filter(function (channel) {
15243
15261
  return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
15244
15262
  });
@@ -15261,16 +15279,16 @@ function searchChannels(action) {
15261
15279
  }, _marked3, null, [[0, 7]]);
15262
15280
  }
15263
15281
  function getChannelsForForward() {
15264
- var SceytChatClient, channelQueryBuilder, channelTypesFilter, channelQuery, channelsData, channelsToAdd, _yield$call2, mappedChannels, _t6;
15282
+ var _SceytChatClient, channelQueryBuilder, channelTypesFilter, channelQuery, channelsData, channelsToAdd, _yield$call2, mappedChannels, _t6;
15265
15283
  return _regenerator().w(function (_context4) {
15266
15284
  while (1) switch (_context4.p = _context4.n) {
15267
15285
  case 0:
15268
15286
  _context4.p = 0;
15269
- SceytChatClient = getClient();
15287
+ _SceytChatClient = getClient();
15270
15288
  _context4.n = 1;
15271
15289
  return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADING, true));
15272
15290
  case 1:
15273
- channelQueryBuilder = new SceytChatClient.ChannelListQueryBuilder();
15291
+ channelQueryBuilder = new _SceytChatClient.ChannelListQueryBuilder();
15274
15292
  channelTypesFilter = getChannelTypesFilter();
15275
15293
  channelQueryBuilder.order('lastMessage');
15276
15294
  if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
@@ -15293,7 +15311,7 @@ function getChannelsForForward() {
15293
15311
  channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
15294
15312
  var isSelfChannel = (_channel$metadata2 = channel.metadata) === null || _channel$metadata2 === void 0 ? void 0 : _channel$metadata2.s;
15295
15313
  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) {
15296
- return member.id && member.id !== SceytChatClient.user.id;
15314
+ return member.id && member.id !== _SceytChatClient.user.id;
15297
15315
  }) : true;
15298
15316
  });
15299
15317
  _context4.n = 5;
@@ -15320,15 +15338,15 @@ function getChannelsForForward() {
15320
15338
  }, _marked4, null, [[0, 8]]);
15321
15339
  }
15322
15340
  function searchChannelsForForward(action) {
15323
- var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter3, _types3, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, channelQuery, channelsData, channelsToAdd, _t7;
15341
+ 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;
15324
15342
  return _regenerator().w(function (_context5) {
15325
15343
  while (1) switch (_context5.p = _context5.n) {
15326
15344
  case 0:
15327
15345
  _context5.p = 0;
15328
15346
  payload = action.payload;
15329
- params = payload.params, contactsMap = payload.contactsMap;
15330
- SceytChatClient = getClient();
15331
- getFromContacts = getShowOnlyContactUsers();
15347
+ params = payload.params, _contactsMap = payload.contactsMap;
15348
+ _SceytChatClient2 = getClient();
15349
+ _getFromContacts = getShowOnlyContactUsers();
15332
15350
  _context5.n = 1;
15333
15351
  return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADING, true));
15334
15352
  case 1:
@@ -15337,7 +15355,7 @@ function searchChannelsForForward(action) {
15337
15355
  _context5.n = 6;
15338
15356
  break;
15339
15357
  }
15340
- channelQueryBuilder = new SceytChatClient.ChannelListQueryBuilder();
15358
+ channelQueryBuilder = new _SceytChatClient2.ChannelListQueryBuilder();
15341
15359
  channelTypesFilter = getChannelTypesFilter();
15342
15360
  types = [];
15343
15361
  if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
@@ -15350,41 +15368,49 @@ function searchChannelsForForward(action) {
15350
15368
  channelQueryBuilder.types(types);
15351
15369
  }
15352
15370
  allChannels = getAllChannels();
15353
- publicChannels = [];
15354
- chatsGroups = [];
15371
+ _publicChannels = [];
15372
+ _chatsGroups = [];
15355
15373
  contactsList = [];
15356
- contactsWithChannelsMap = {};
15357
- lowerCaseSearchBy = searchBy.toLowerCase();
15358
- allChannels.forEach(function (channel) {
15359
- if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
15360
- var _channel$metadata3;
15361
- channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
15362
- var isSelfChannel = (_channel$metadata3 = channel.metadata) === null || _channel$metadata3 === void 0 ? void 0 : _channel$metadata3.s;
15363
- var directChannelUser = isSelfChannel ? SceytChatClient.user : channel.members.find(function (member) {
15364
- return member.id !== SceytChatClient.user.id;
15365
- });
15366
- if (directChannelUser && contactsMap[directChannelUser.id]) {
15367
- contactsWithChannelsMap[directChannelUser.id] = true;
15368
- }
15369
- var userName = makeUsername(directChannelUser && contactsMap[directChannelUser.id], directChannelUser, getFromContacts).toLowerCase();
15370
- if (userName.includes(lowerCaseSearchBy) || isSelfChannel && 'me'.includes(lowerCaseSearchBy)) {
15371
- chatsGroups.push(channel);
15372
- }
15373
- } else {
15374
- if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
15375
- if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
15376
- publicChannels.push(channel);
15377
- } else {
15378
- chatsGroups.push(channel);
15374
+ _contactsWithChannelsMap = {};
15375
+ _lowerCaseSearchBy = searchBy.toLowerCase();
15376
+ handleChannels = function handleChannels(channels) {
15377
+ channels.forEach(function (channel) {
15378
+ if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
15379
+ var _channel$metadata3;
15380
+ channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
15381
+ var isSelfChannel = (_channel$metadata3 = channel.metadata) === null || _channel$metadata3 === void 0 ? void 0 : _channel$metadata3.s;
15382
+ var directChannelUser = isSelfChannel ? _SceytChatClient2.user : channel.members.find(function (member) {
15383
+ return member.id !== _SceytChatClient2.user.id;
15384
+ });
15385
+ if (directChannelUser && _contactsMap[directChannelUser.id]) {
15386
+ _contactsWithChannelsMap[directChannelUser.id] = true;
15387
+ }
15388
+ var userName = makeUsername(directChannelUser && _contactsMap[directChannelUser.id], directChannelUser, _getFromContacts).toLowerCase();
15389
+ if (userName.includes(_lowerCaseSearchBy) || isSelfChannel && 'me'.includes(_lowerCaseSearchBy)) {
15390
+ _chatsGroups.push(channel);
15391
+ }
15392
+ } else {
15393
+ if (channel.subject && channel.subject.toLowerCase().includes(_lowerCaseSearchBy)) {
15394
+ if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
15395
+ _publicChannels.push(channel);
15396
+ } else {
15397
+ _chatsGroups.push(channel);
15398
+ }
15379
15399
  }
15380
15400
  }
15381
- }
15382
- });
15383
- if (getFromContacts) {
15384
- Object.values(contactsMap).forEach(function (contact) {
15385
- if (!contactsWithChannelsMap[contact.id]) {
15401
+ });
15402
+ };
15403
+ channelsMap = {};
15404
+ for (_iterator3 = _createForOfIteratorHelperLoose(allChannels); !(_step3 = _iterator3()).done;) {
15405
+ channel = _step3.value;
15406
+ channelsMap[channel.id] = channel;
15407
+ }
15408
+ handleChannels(allChannels);
15409
+ if (_getFromContacts) {
15410
+ Object.values(_contactsMap).forEach(function (contact) {
15411
+ if (!_contactsWithChannelsMap[contact.id]) {
15386
15412
  var userName = makeUsername(contact, undefined, true).toLowerCase();
15387
- if (userName.includes(lowerCaseSearchBy)) {
15413
+ if (userName.includes(_lowerCaseSearchBy)) {
15388
15414
  contactsList.push(contact);
15389
15415
  }
15390
15416
  }
@@ -15392,15 +15418,15 @@ function searchChannelsForForward(action) {
15392
15418
  }
15393
15419
  _context5.n = 2;
15394
15420
  return effects.put(setSearchedChannelsForForwardAC({
15395
- chats_groups: JSON.parse(JSON.stringify(chatsGroups)),
15396
- channels: JSON.parse(JSON.stringify(publicChannels)),
15421
+ chats_groups: JSON.parse(JSON.stringify(_chatsGroups)),
15422
+ channels: JSON.parse(JSON.stringify(_publicChannels)),
15397
15423
  contacts: JSON.parse(JSON.stringify(contactsList))
15398
15424
  }));
15399
15425
  case 2:
15400
15426
  _context5.n = 3;
15401
15427
  return effects.put(setChannelsLoadingStateAC(LOADING_STATE.LOADED, true));
15402
15428
  case 3:
15403
- channelQueryBuilder.query(lowerCaseSearchBy);
15429
+ channelQueryBuilder.query(_lowerCaseSearchBy);
15404
15430
  channelQueryBuilder.limit(params.limit || 50);
15405
15431
  channelQueryBuilder.order('lastMessage');
15406
15432
  channelQueryBuilder.filterKey(['subject']);
@@ -15413,12 +15439,17 @@ function searchChannelsForForward(action) {
15413
15439
  return effects.call(channelQuery.loadNextPage);
15414
15440
  case 5:
15415
15441
  channelsData = _context5.v;
15442
+ for (_iterator4 = _createForOfIteratorHelperLoose(channelsData.channels); !(_step4 = _iterator4()).done;) {
15443
+ _channel2 = _step4.value;
15444
+ channelsMap[_channel2.id] = _channel2;
15445
+ }
15446
+ handleChannels(Object.values(channelsMap));
15416
15447
  channelsToAdd = channelsData.channels.filter(function (channel) {
15417
15448
  return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
15418
15449
  });
15419
15450
  _context5.n = 6;
15420
15451
  return effects.put(setSearchedChannelsForForwardAC({
15421
- chats_groups: JSON.parse(JSON.stringify(chatsGroups)),
15452
+ chats_groups: JSON.parse(JSON.stringify(_chatsGroups)),
15422
15453
  channels: JSON.parse(JSON.stringify(channelsToAdd)),
15423
15454
  contacts: JSON.parse(JSON.stringify(contactsList))
15424
15455
  }));
@@ -15515,15 +15546,15 @@ function channelsLoadMore(action) {
15515
15546
  }, _marked6, null, [[0, 9]]);
15516
15547
  }
15517
15548
  function getChannelMentions(action) {
15518
- var payload, channelId, SceytChatClient, mentionsQueryBuilder, mentionsQuery, mentions, _t9;
15549
+ var payload, channelId, _SceytChatClient3, mentionsQueryBuilder, mentionsQuery, mentions, _t9;
15519
15550
  return _regenerator().w(function (_context7) {
15520
15551
  while (1) switch (_context7.p = _context7.n) {
15521
15552
  case 0:
15522
15553
  _context7.p = 0;
15523
15554
  payload = action.payload;
15524
15555
  channelId = payload.channelId;
15525
- SceytChatClient = getClient();
15526
- mentionsQueryBuilder = new SceytChatClient.MentionsListQueryBuilder();
15556
+ _SceytChatClient3 = getClient();
15557
+ mentionsQueryBuilder = new _SceytChatClient3.MentionsListQueryBuilder();
15527
15558
  mentionsQueryBuilder.setChannelId(channelId);
15528
15559
  mentionsQueryBuilder.limit(10);
15529
15560
  mentionsQueryBuilder.setDirection(queryDirection.NEXT);
@@ -15552,14 +15583,14 @@ function getChannelMentions(action) {
15552
15583
  }, _marked7, null, [[0, 4]]);
15553
15584
  }
15554
15585
  function channelsForForwardLoadMore(action) {
15555
- var payload, limit, SceytChatClient, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels, _t0;
15586
+ var payload, limit, _SceytChatClient4, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels, _t0;
15556
15587
  return _regenerator().w(function (_context8) {
15557
15588
  while (1) switch (_context8.p = _context8.n) {
15558
15589
  case 0:
15559
15590
  _context8.p = 0;
15560
15591
  payload = action.payload;
15561
15592
  limit = payload.limit;
15562
- SceytChatClient = getClient();
15593
+ _SceytChatClient4 = getClient();
15563
15594
  channelQueryForward = query.channelQueryForward;
15564
15595
  if (limit) {
15565
15596
  channelQueryForward.limit = limit;
@@ -15576,7 +15607,7 @@ function channelsForForwardLoadMore(action) {
15576
15607
  case 3:
15577
15608
  channelsToAdd = channelsData.channels.filter(function (channel) {
15578
15609
  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) {
15579
- return member.id && member.id !== SceytChatClient.user.id;
15610
+ return member.id && member.id !== _SceytChatClient4.user.id;
15580
15611
  }) : true;
15581
15612
  });
15582
15613
  _context8.n = 4;
@@ -15602,7 +15633,7 @@ function channelsForForwardLoadMore(action) {
15602
15633
  }, _marked8, null, [[0, 7]]);
15603
15634
  }
15604
15635
  function markMessagesRead(action) {
15605
- var payload, channelId, messageIds, channel, messageListMarker, _iterator, _step, messageId, updateParams, _t1;
15636
+ var payload, channelId, messageIds, channel, messageListMarker, _iterator5, _step5, messageId, updateParams, _t1;
15606
15637
  return _regenerator().w(function (_context9) {
15607
15638
  while (1) switch (_context9.p = _context9.n) {
15608
15639
  case 0:
@@ -15635,13 +15666,13 @@ function markMessagesRead(action) {
15635
15666
  updateChannelOnAllChannels(channel.id, {
15636
15667
  lastReadMessageId: channel.lastDisplayedMessageId
15637
15668
  });
15638
- _iterator = _createForOfIteratorHelperLoose(messageListMarker.messageIds);
15669
+ _iterator5 = _createForOfIteratorHelperLoose(messageListMarker.messageIds);
15639
15670
  case 5:
15640
- if ((_step = _iterator()).done) {
15671
+ if ((_step5 = _iterator5()).done) {
15641
15672
  _context9.n = 8;
15642
15673
  break;
15643
15674
  }
15644
- messageId = _step.value;
15675
+ messageId = _step5.value;
15645
15676
  updateParams = {
15646
15677
  deliveryStatus: MESSAGE_DELIVERY_STATUS.READ,
15647
15678
  userMarkers: [{
@@ -15712,7 +15743,7 @@ function markMessagesDelivered(action) {
15712
15743
  }, _marked0, null, [[1, 4]]);
15713
15744
  }
15714
15745
  function switchChannel(action) {
15715
- var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel, SceytChatClient, fetchedChannel, channelFromMap, currentActiveChannel, _t11;
15746
+ var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel, _SceytChatClient5, fetchedChannel, channelFromMap, currentActiveChannel, _t11;
15716
15747
  return _regenerator().w(function (_context1) {
15717
15748
  while (1) switch (_context1.p = _context1.n) {
15718
15749
  case 0:
@@ -15750,9 +15781,9 @@ function switchChannel(action) {
15750
15781
  _context1.n = 8;
15751
15782
  break;
15752
15783
  case 5:
15753
- SceytChatClient = getClient();
15784
+ _SceytChatClient5 = getClient();
15754
15785
  _context1.n = 6;
15755
- return effects.call(SceytChatClient.getChannel, channel.id);
15786
+ return effects.call(_SceytChatClient5.getChannel, channel.id);
15756
15787
  case 6:
15757
15788
  fetchedChannel = _context1.v;
15758
15789
  addChannelToAllChannels(fetchedChannel);
@@ -16188,14 +16219,14 @@ function blockChannel(action) {
16188
16219
  }, _marked19, null, [[0, 5]]);
16189
16220
  }
16190
16221
  function updateChannel(action) {
16191
- var payload, channelId, config, SceytChatClient, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata, _t21;
16222
+ var payload, channelId, config, _SceytChatClient6, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata, _t21;
16192
16223
  return _regenerator().w(function (_context20) {
16193
16224
  while (1) switch (_context20.p = _context20.n) {
16194
16225
  case 0:
16195
16226
  _context20.p = 0;
16196
16227
  payload = action.payload;
16197
16228
  channelId = payload.channelId, config = payload.config;
16198
- SceytChatClient = getClient();
16229
+ _SceytChatClient6 = getClient();
16199
16230
  _context20.n = 1;
16200
16231
  return effects.call(getChannelFromMap, channelId);
16201
16232
  case 1:
@@ -16220,7 +16251,7 @@ function updateChannel(action) {
16220
16251
  }
16221
16252
  };
16222
16253
  _context20.n = 2;
16223
- return effects.call(SceytChatClient.uploadFile, fileToUpload);
16254
+ return effects.call(_SceytChatClient6.uploadFile, fileToUpload);
16224
16255
  case 2:
16225
16256
  paramsToUpdate.avatarUrl = _context20.v;
16226
16257
  case 3:
@@ -16264,15 +16295,15 @@ function updateChannel(action) {
16264
16295
  }, _marked20, null, [[0, 6]]);
16265
16296
  }
16266
16297
  function checkUsersStatus() {
16267
- var SceytChatClient, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData, _t22;
16298
+ var _SceytChatClient7, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData, _t22;
16268
16299
  return _regenerator().w(function (_context21) {
16269
16300
  while (1) switch (_context21.p = _context21.n) {
16270
16301
  case 0:
16271
16302
  _context21.p = 0;
16272
- SceytChatClient = getClient();
16303
+ _SceytChatClient7 = getClient();
16273
16304
  usersForUpdate = Object.keys(usersMap);
16274
16305
  _context21.n = 1;
16275
- return effects.call(SceytChatClient.getUsers, usersForUpdate);
16306
+ return effects.call(_SceytChatClient7.getUsers, usersForUpdate);
16276
16307
  case 1:
16277
16308
  updatedUsers = _context21.v;
16278
16309
  usersToUpdateMap = {};
@@ -16530,14 +16561,14 @@ function deleteAllMessages(action) {
16530
16561
  }, _marked25, null, [[0, 9]]);
16531
16562
  }
16532
16563
  function joinChannel(action) {
16533
- var payload, channelId, SceytChatClient, channel, joinedChannel, _t27;
16564
+ var payload, channelId, _SceytChatClient8, channel, joinedChannel, _t27;
16534
16565
  return _regenerator().w(function (_context26) {
16535
16566
  while (1) switch (_context26.p = _context26.n) {
16536
16567
  case 0:
16537
16568
  _context26.p = 0;
16538
16569
  payload = action.payload;
16539
16570
  channelId = payload.channelId;
16540
- SceytChatClient = getClient();
16571
+ _SceytChatClient8 = getClient();
16541
16572
  _context26.n = 1;
16542
16573
  return effects.call(getChannelFromMap, channelId);
16543
16574
  case 1:
@@ -16550,7 +16581,7 @@ function joinChannel(action) {
16550
16581
  break;
16551
16582
  }
16552
16583
  _context26.n = 2;
16553
- return effects.call(SceytChatClient.getChannel, channelId);
16584
+ return effects.call(_SceytChatClient8.getChannel, channelId);
16554
16585
  case 2:
16555
16586
  channel = _context26.v;
16556
16587
  case 3:
@@ -17708,7 +17739,7 @@ function sendTextMessage(action) {
17708
17739
  attachments = [att];
17709
17740
  }
17710
17741
  messageBuilder = channel.createMessageBuilder();
17711
- messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisplayCount(message.type === 'system' ? 0 : 1).setSilent(message.type === 'system').setMetadata(JSON.stringify(message.metadata));
17742
+ messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisplayCount((message === null || message === void 0 ? void 0 : message.displayCount) !== undefined ? message.displayCount : message.type === 'system' ? 0 : 1).setSilent((message === null || message === void 0 ? void 0 : message.silent) !== undefined ? message.silent : message.type === 'system').setMetadata(JSON.stringify(message.metadata));
17712
17743
  if (message.parentMessage) {
17713
17744
  messageBuilder.setParentMessageId(message.parentMessage ? message.parentMessage.id : null);
17714
17745
  }
package/index.modern.js CHANGED
@@ -10052,11 +10052,14 @@ function updateMessageOnMap(channelId, updatedMessage) {
10052
10052
  }
10053
10053
  var updatedMessageData = null;
10054
10054
  if (messagesMap[channelId]) {
10055
- messagesMap[channelId].map(function (mes) {
10055
+ var messagesList = [];
10056
+ for (var _iterator = _createForOfIteratorHelperLoose(messagesMap[channelId]), _step; !(_step = _iterator()).done;) {
10057
+ var mes = _step.value;
10056
10058
  if (mes.tid === updatedMessage.messageId || mes.id === updatedMessage.messageId) {
10057
10059
  if (updatedMessage.params.state === MESSAGE_STATUS.DELETE) {
10058
10060
  updatedMessageData = _extends({}, updatedMessage.params);
10059
- return updatedMessageData;
10061
+ messagesList.push(_extends({}, mes, updatedMessageData));
10062
+ continue;
10060
10063
  } else {
10061
10064
  var _updatedMessage$param;
10062
10065
  updatedMessageData = _extends({}, mes, updatedMessage.params, {
@@ -10066,11 +10069,13 @@ function updateMessageOnMap(channelId, updatedMessage) {
10066
10069
  });
10067
10070
  })
10068
10071
  });
10069
- return updatedMessage;
10072
+ messagesList.push(_extends({}, mes, updatedMessageData));
10073
+ continue;
10070
10074
  }
10071
10075
  }
10072
- return mes;
10073
- });
10076
+ messagesList.push(mes);
10077
+ }
10078
+ messagesMap[channelId] = messagesList;
10074
10079
  }
10075
10080
  return updatedMessageData;
10076
10081
  }
@@ -14798,8 +14803,8 @@ function createChannel(action) {
14798
14803
  allChannels.forEach(function (channel) {
14799
14804
  if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
14800
14805
  if (isSelfChannel) {
14801
- var meta = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
14802
- if (meta !== null && meta !== void 0 && meta.s) {
14806
+ var _channel$members;
14807
+ if (((_channel$members = channel.members) === null || _channel$members === void 0 ? void 0 : _channel$members.length) === 1 && channel.members[0].id === memberId) {
14803
14808
  channelIsExistOnAllChannels = true;
14804
14809
  }
14805
14810
  } else {
@@ -15121,7 +15126,7 @@ function getChannels(action) {
15121
15126
  }, _marked2$1, null, [[18, 20], [0, 23]]);
15122
15127
  }
15123
15128
  function searchChannels(action) {
15124
- var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter2, _types2, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, channelQuery, channelsData, channelsToAdd, _t5;
15129
+ 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;
15125
15130
  return _regenerator().w(function (_context3) {
15126
15131
  while (1) switch (_context3.p = _context3.n) {
15127
15132
  case 0:
@@ -15160,31 +15165,39 @@ function searchChannels(action) {
15160
15165
  contactsList = [];
15161
15166
  contactsWithChannelsMap = {};
15162
15167
  lowerCaseSearchBy = searchBy.toLowerCase();
15163
- allChannels.forEach(function (channel) {
15164
- if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
15165
- var _channel$metadata;
15166
- channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
15167
- var isSelfChannel = (_channel$metadata = channel.metadata) === null || _channel$metadata === void 0 ? void 0 : _channel$metadata.s;
15168
- var directChannelUser = isSelfChannel ? SceytChatClient.user : channel.members.find(function (member) {
15169
- return member.id !== SceytChatClient.user.id;
15170
- });
15171
- if (directChannelUser && contactsMap[directChannelUser.id]) {
15172
- contactsWithChannelsMap[directChannelUser.id] = true;
15173
- }
15174
- var userName = makeUsername(directChannelUser && contactsMap[directChannelUser.id], directChannelUser, getFromContacts).toLowerCase();
15175
- if (userName.includes(lowerCaseSearchBy) || isSelfChannel && 'me'.includes(lowerCaseSearchBy)) {
15176
- chatsGroups.push(channel);
15177
- }
15178
- } else {
15179
- if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
15180
- if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
15181
- publicChannels.push(channel);
15182
- } else {
15168
+ handleChannels = function handleChannels(channels) {
15169
+ channels.forEach(function (channel) {
15170
+ if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
15171
+ var _channel$metadata;
15172
+ channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
15173
+ var isSelfChannel = (_channel$metadata = channel.metadata) === null || _channel$metadata === void 0 ? void 0 : _channel$metadata.s;
15174
+ var directChannelUser = isSelfChannel ? SceytChatClient.user : channel.members.find(function (member) {
15175
+ return member.id !== SceytChatClient.user.id;
15176
+ });
15177
+ if (directChannelUser && contactsMap[directChannelUser.id]) {
15178
+ contactsWithChannelsMap[directChannelUser.id] = true;
15179
+ }
15180
+ var userName = makeUsername(directChannelUser && contactsMap[directChannelUser.id], directChannelUser, getFromContacts).toLowerCase();
15181
+ if (userName.includes(lowerCaseSearchBy) || isSelfChannel && 'me'.includes(lowerCaseSearchBy)) {
15183
15182
  chatsGroups.push(channel);
15184
15183
  }
15184
+ } else {
15185
+ if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
15186
+ if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
15187
+ publicChannels.push(channel);
15188
+ } else {
15189
+ chatsGroups.push(channel);
15190
+ }
15191
+ }
15185
15192
  }
15186
- }
15187
- });
15193
+ });
15194
+ };
15195
+ channelsMap = {};
15196
+ for (_iterator = _createForOfIteratorHelperLoose(allChannels); !(_step = _iterator()).done;) {
15197
+ channel = _step.value;
15198
+ channelsMap[channel.id] = channel;
15199
+ }
15200
+ handleChannels(allChannels);
15188
15201
  if (getFromContacts) {
15189
15202
  Object.values(contactsMap).forEach(function (contact) {
15190
15203
  if (!contactsWithChannelsMap[contact.id]) {
@@ -15218,6 +15231,11 @@ function searchChannels(action) {
15218
15231
  return call(channelQuery.loadNextPage);
15219
15232
  case 5:
15220
15233
  channelsData = _context3.v;
15234
+ for (_iterator2 = _createForOfIteratorHelperLoose(channelsData.channels); !(_step2 = _iterator2()).done;) {
15235
+ _channel = _step2.value;
15236
+ channelsMap[_channel.id] = _channel;
15237
+ }
15238
+ handleChannels(Object.values(channelsMap));
15221
15239
  channelsToAdd = channelsData.channels.filter(function (channel) {
15222
15240
  return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
15223
15241
  });
@@ -15240,16 +15258,16 @@ function searchChannels(action) {
15240
15258
  }, _marked3, null, [[0, 7]]);
15241
15259
  }
15242
15260
  function getChannelsForForward() {
15243
- var SceytChatClient, channelQueryBuilder, channelTypesFilter, channelQuery, channelsData, channelsToAdd, _yield$call2, mappedChannels, _t6;
15261
+ var _SceytChatClient, channelQueryBuilder, channelTypesFilter, channelQuery, channelsData, channelsToAdd, _yield$call2, mappedChannels, _t6;
15244
15262
  return _regenerator().w(function (_context4) {
15245
15263
  while (1) switch (_context4.p = _context4.n) {
15246
15264
  case 0:
15247
15265
  _context4.p = 0;
15248
- SceytChatClient = getClient();
15266
+ _SceytChatClient = getClient();
15249
15267
  _context4.n = 1;
15250
15268
  return put(setChannelsLoadingStateAC(LOADING_STATE.LOADING, true));
15251
15269
  case 1:
15252
- channelQueryBuilder = new SceytChatClient.ChannelListQueryBuilder();
15270
+ channelQueryBuilder = new _SceytChatClient.ChannelListQueryBuilder();
15253
15271
  channelTypesFilter = getChannelTypesFilter();
15254
15272
  channelQueryBuilder.order('lastMessage');
15255
15273
  if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
@@ -15272,7 +15290,7 @@ function getChannelsForForward() {
15272
15290
  channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
15273
15291
  var isSelfChannel = (_channel$metadata2 = channel.metadata) === null || _channel$metadata2 === void 0 ? void 0 : _channel$metadata2.s;
15274
15292
  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) {
15275
- return member.id && member.id !== SceytChatClient.user.id;
15293
+ return member.id && member.id !== _SceytChatClient.user.id;
15276
15294
  }) : true;
15277
15295
  });
15278
15296
  _context4.n = 5;
@@ -15299,15 +15317,15 @@ function getChannelsForForward() {
15299
15317
  }, _marked4, null, [[0, 8]]);
15300
15318
  }
15301
15319
  function searchChannelsForForward(action) {
15302
- var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter3, _types3, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, channelQuery, channelsData, channelsToAdd, _t7;
15320
+ 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;
15303
15321
  return _regenerator().w(function (_context5) {
15304
15322
  while (1) switch (_context5.p = _context5.n) {
15305
15323
  case 0:
15306
15324
  _context5.p = 0;
15307
15325
  payload = action.payload;
15308
- params = payload.params, contactsMap = payload.contactsMap;
15309
- SceytChatClient = getClient();
15310
- getFromContacts = getShowOnlyContactUsers();
15326
+ params = payload.params, _contactsMap = payload.contactsMap;
15327
+ _SceytChatClient2 = getClient();
15328
+ _getFromContacts = getShowOnlyContactUsers();
15311
15329
  _context5.n = 1;
15312
15330
  return put(setChannelsLoadingStateAC(LOADING_STATE.LOADING, true));
15313
15331
  case 1:
@@ -15316,7 +15334,7 @@ function searchChannelsForForward(action) {
15316
15334
  _context5.n = 6;
15317
15335
  break;
15318
15336
  }
15319
- channelQueryBuilder = new SceytChatClient.ChannelListQueryBuilder();
15337
+ channelQueryBuilder = new _SceytChatClient2.ChannelListQueryBuilder();
15320
15338
  channelTypesFilter = getChannelTypesFilter();
15321
15339
  types = [];
15322
15340
  if (channelTypesFilter !== null && channelTypesFilter !== void 0 && channelTypesFilter.length) {
@@ -15329,41 +15347,49 @@ function searchChannelsForForward(action) {
15329
15347
  channelQueryBuilder.types(types);
15330
15348
  }
15331
15349
  allChannels = getAllChannels();
15332
- publicChannels = [];
15333
- chatsGroups = [];
15350
+ _publicChannels = [];
15351
+ _chatsGroups = [];
15334
15352
  contactsList = [];
15335
- contactsWithChannelsMap = {};
15336
- lowerCaseSearchBy = searchBy.toLowerCase();
15337
- allChannels.forEach(function (channel) {
15338
- if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
15339
- var _channel$metadata3;
15340
- channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
15341
- var isSelfChannel = (_channel$metadata3 = channel.metadata) === null || _channel$metadata3 === void 0 ? void 0 : _channel$metadata3.s;
15342
- var directChannelUser = isSelfChannel ? SceytChatClient.user : channel.members.find(function (member) {
15343
- return member.id !== SceytChatClient.user.id;
15344
- });
15345
- if (directChannelUser && contactsMap[directChannelUser.id]) {
15346
- contactsWithChannelsMap[directChannelUser.id] = true;
15347
- }
15348
- var userName = makeUsername(directChannelUser && contactsMap[directChannelUser.id], directChannelUser, getFromContacts).toLowerCase();
15349
- if (userName.includes(lowerCaseSearchBy) || isSelfChannel && 'me'.includes(lowerCaseSearchBy)) {
15350
- chatsGroups.push(channel);
15351
- }
15352
- } else {
15353
- if (channel.subject && channel.subject.toLowerCase().includes(lowerCaseSearchBy)) {
15354
- if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
15355
- publicChannels.push(channel);
15356
- } else {
15357
- chatsGroups.push(channel);
15353
+ _contactsWithChannelsMap = {};
15354
+ _lowerCaseSearchBy = searchBy.toLowerCase();
15355
+ handleChannels = function handleChannels(channels) {
15356
+ channels.forEach(function (channel) {
15357
+ if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
15358
+ var _channel$metadata3;
15359
+ channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
15360
+ var isSelfChannel = (_channel$metadata3 = channel.metadata) === null || _channel$metadata3 === void 0 ? void 0 : _channel$metadata3.s;
15361
+ var directChannelUser = isSelfChannel ? _SceytChatClient2.user : channel.members.find(function (member) {
15362
+ return member.id !== _SceytChatClient2.user.id;
15363
+ });
15364
+ if (directChannelUser && _contactsMap[directChannelUser.id]) {
15365
+ _contactsWithChannelsMap[directChannelUser.id] = true;
15366
+ }
15367
+ var userName = makeUsername(directChannelUser && _contactsMap[directChannelUser.id], directChannelUser, _getFromContacts).toLowerCase();
15368
+ if (userName.includes(_lowerCaseSearchBy) || isSelfChannel && 'me'.includes(_lowerCaseSearchBy)) {
15369
+ _chatsGroups.push(channel);
15370
+ }
15371
+ } else {
15372
+ if (channel.subject && channel.subject.toLowerCase().includes(_lowerCaseSearchBy)) {
15373
+ if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
15374
+ _publicChannels.push(channel);
15375
+ } else {
15376
+ _chatsGroups.push(channel);
15377
+ }
15358
15378
  }
15359
15379
  }
15360
- }
15361
- });
15362
- if (getFromContacts) {
15363
- Object.values(contactsMap).forEach(function (contact) {
15364
- if (!contactsWithChannelsMap[contact.id]) {
15380
+ });
15381
+ };
15382
+ channelsMap = {};
15383
+ for (_iterator3 = _createForOfIteratorHelperLoose(allChannels); !(_step3 = _iterator3()).done;) {
15384
+ channel = _step3.value;
15385
+ channelsMap[channel.id] = channel;
15386
+ }
15387
+ handleChannels(allChannels);
15388
+ if (_getFromContacts) {
15389
+ Object.values(_contactsMap).forEach(function (contact) {
15390
+ if (!_contactsWithChannelsMap[contact.id]) {
15365
15391
  var userName = makeUsername(contact, undefined, true).toLowerCase();
15366
- if (userName.includes(lowerCaseSearchBy)) {
15392
+ if (userName.includes(_lowerCaseSearchBy)) {
15367
15393
  contactsList.push(contact);
15368
15394
  }
15369
15395
  }
@@ -15371,15 +15397,15 @@ function searchChannelsForForward(action) {
15371
15397
  }
15372
15398
  _context5.n = 2;
15373
15399
  return put(setSearchedChannelsForForwardAC({
15374
- chats_groups: JSON.parse(JSON.stringify(chatsGroups)),
15375
- channels: JSON.parse(JSON.stringify(publicChannels)),
15400
+ chats_groups: JSON.parse(JSON.stringify(_chatsGroups)),
15401
+ channels: JSON.parse(JSON.stringify(_publicChannels)),
15376
15402
  contacts: JSON.parse(JSON.stringify(contactsList))
15377
15403
  }));
15378
15404
  case 2:
15379
15405
  _context5.n = 3;
15380
15406
  return put(setChannelsLoadingStateAC(LOADING_STATE.LOADED, true));
15381
15407
  case 3:
15382
- channelQueryBuilder.query(lowerCaseSearchBy);
15408
+ channelQueryBuilder.query(_lowerCaseSearchBy);
15383
15409
  channelQueryBuilder.limit(params.limit || 50);
15384
15410
  channelQueryBuilder.order('lastMessage');
15385
15411
  channelQueryBuilder.filterKey(['subject']);
@@ -15392,12 +15418,17 @@ function searchChannelsForForward(action) {
15392
15418
  return call(channelQuery.loadNextPage);
15393
15419
  case 5:
15394
15420
  channelsData = _context5.v;
15421
+ for (_iterator4 = _createForOfIteratorHelperLoose(channelsData.channels); !(_step4 = _iterator4()).done;) {
15422
+ _channel2 = _step4.value;
15423
+ channelsMap[_channel2.id] = _channel2;
15424
+ }
15425
+ handleChannels(Object.values(channelsMap));
15395
15426
  channelsToAdd = channelsData.channels.filter(function (channel) {
15396
15427
  return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
15397
15428
  });
15398
15429
  _context5.n = 6;
15399
15430
  return put(setSearchedChannelsForForwardAC({
15400
- chats_groups: JSON.parse(JSON.stringify(chatsGroups)),
15431
+ chats_groups: JSON.parse(JSON.stringify(_chatsGroups)),
15401
15432
  channels: JSON.parse(JSON.stringify(channelsToAdd)),
15402
15433
  contacts: JSON.parse(JSON.stringify(contactsList))
15403
15434
  }));
@@ -15494,15 +15525,15 @@ function channelsLoadMore(action) {
15494
15525
  }, _marked6, null, [[0, 9]]);
15495
15526
  }
15496
15527
  function getChannelMentions(action) {
15497
- var payload, channelId, SceytChatClient, mentionsQueryBuilder, mentionsQuery, mentions, _t9;
15528
+ var payload, channelId, _SceytChatClient3, mentionsQueryBuilder, mentionsQuery, mentions, _t9;
15498
15529
  return _regenerator().w(function (_context7) {
15499
15530
  while (1) switch (_context7.p = _context7.n) {
15500
15531
  case 0:
15501
15532
  _context7.p = 0;
15502
15533
  payload = action.payload;
15503
15534
  channelId = payload.channelId;
15504
- SceytChatClient = getClient();
15505
- mentionsQueryBuilder = new SceytChatClient.MentionsListQueryBuilder();
15535
+ _SceytChatClient3 = getClient();
15536
+ mentionsQueryBuilder = new _SceytChatClient3.MentionsListQueryBuilder();
15506
15537
  mentionsQueryBuilder.setChannelId(channelId);
15507
15538
  mentionsQueryBuilder.limit(10);
15508
15539
  mentionsQueryBuilder.setDirection(queryDirection.NEXT);
@@ -15531,14 +15562,14 @@ function getChannelMentions(action) {
15531
15562
  }, _marked7, null, [[0, 4]]);
15532
15563
  }
15533
15564
  function channelsForForwardLoadMore(action) {
15534
- var payload, limit, SceytChatClient, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels, _t0;
15565
+ var payload, limit, _SceytChatClient4, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels, _t0;
15535
15566
  return _regenerator().w(function (_context8) {
15536
15567
  while (1) switch (_context8.p = _context8.n) {
15537
15568
  case 0:
15538
15569
  _context8.p = 0;
15539
15570
  payload = action.payload;
15540
15571
  limit = payload.limit;
15541
- SceytChatClient = getClient();
15572
+ _SceytChatClient4 = getClient();
15542
15573
  channelQueryForward = query.channelQueryForward;
15543
15574
  if (limit) {
15544
15575
  channelQueryForward.limit = limit;
@@ -15555,7 +15586,7 @@ function channelsForForwardLoadMore(action) {
15555
15586
  case 3:
15556
15587
  channelsToAdd = channelsData.channels.filter(function (channel) {
15557
15588
  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) {
15558
- return member.id && member.id !== SceytChatClient.user.id;
15589
+ return member.id && member.id !== _SceytChatClient4.user.id;
15559
15590
  }) : true;
15560
15591
  });
15561
15592
  _context8.n = 4;
@@ -15581,7 +15612,7 @@ function channelsForForwardLoadMore(action) {
15581
15612
  }, _marked8, null, [[0, 7]]);
15582
15613
  }
15583
15614
  function markMessagesRead(action) {
15584
- var payload, channelId, messageIds, channel, messageListMarker, _iterator, _step, messageId, updateParams, _t1;
15615
+ var payload, channelId, messageIds, channel, messageListMarker, _iterator5, _step5, messageId, updateParams, _t1;
15585
15616
  return _regenerator().w(function (_context9) {
15586
15617
  while (1) switch (_context9.p = _context9.n) {
15587
15618
  case 0:
@@ -15614,13 +15645,13 @@ function markMessagesRead(action) {
15614
15645
  updateChannelOnAllChannels(channel.id, {
15615
15646
  lastReadMessageId: channel.lastDisplayedMessageId
15616
15647
  });
15617
- _iterator = _createForOfIteratorHelperLoose(messageListMarker.messageIds);
15648
+ _iterator5 = _createForOfIteratorHelperLoose(messageListMarker.messageIds);
15618
15649
  case 5:
15619
- if ((_step = _iterator()).done) {
15650
+ if ((_step5 = _iterator5()).done) {
15620
15651
  _context9.n = 8;
15621
15652
  break;
15622
15653
  }
15623
- messageId = _step.value;
15654
+ messageId = _step5.value;
15624
15655
  updateParams = {
15625
15656
  deliveryStatus: MESSAGE_DELIVERY_STATUS.READ,
15626
15657
  userMarkers: [{
@@ -15691,7 +15722,7 @@ function markMessagesDelivered(action) {
15691
15722
  }, _marked0, null, [[1, 4]]);
15692
15723
  }
15693
15724
  function switchChannel(action) {
15694
- var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel, SceytChatClient, fetchedChannel, channelFromMap, currentActiveChannel, _t11;
15725
+ var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel, _SceytChatClient5, fetchedChannel, channelFromMap, currentActiveChannel, _t11;
15695
15726
  return _regenerator().w(function (_context1) {
15696
15727
  while (1) switch (_context1.p = _context1.n) {
15697
15728
  case 0:
@@ -15729,9 +15760,9 @@ function switchChannel(action) {
15729
15760
  _context1.n = 8;
15730
15761
  break;
15731
15762
  case 5:
15732
- SceytChatClient = getClient();
15763
+ _SceytChatClient5 = getClient();
15733
15764
  _context1.n = 6;
15734
- return call(SceytChatClient.getChannel, channel.id);
15765
+ return call(_SceytChatClient5.getChannel, channel.id);
15735
15766
  case 6:
15736
15767
  fetchedChannel = _context1.v;
15737
15768
  addChannelToAllChannels(fetchedChannel);
@@ -16167,14 +16198,14 @@ function blockChannel(action) {
16167
16198
  }, _marked19, null, [[0, 5]]);
16168
16199
  }
16169
16200
  function updateChannel(action) {
16170
- var payload, channelId, config, SceytChatClient, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata, _t21;
16201
+ var payload, channelId, config, _SceytChatClient6, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata, _t21;
16171
16202
  return _regenerator().w(function (_context20) {
16172
16203
  while (1) switch (_context20.p = _context20.n) {
16173
16204
  case 0:
16174
16205
  _context20.p = 0;
16175
16206
  payload = action.payload;
16176
16207
  channelId = payload.channelId, config = payload.config;
16177
- SceytChatClient = getClient();
16208
+ _SceytChatClient6 = getClient();
16178
16209
  _context20.n = 1;
16179
16210
  return call(getChannelFromMap, channelId);
16180
16211
  case 1:
@@ -16199,7 +16230,7 @@ function updateChannel(action) {
16199
16230
  }
16200
16231
  };
16201
16232
  _context20.n = 2;
16202
- return call(SceytChatClient.uploadFile, fileToUpload);
16233
+ return call(_SceytChatClient6.uploadFile, fileToUpload);
16203
16234
  case 2:
16204
16235
  paramsToUpdate.avatarUrl = _context20.v;
16205
16236
  case 3:
@@ -16243,15 +16274,15 @@ function updateChannel(action) {
16243
16274
  }, _marked20, null, [[0, 6]]);
16244
16275
  }
16245
16276
  function checkUsersStatus() {
16246
- var SceytChatClient, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData, _t22;
16277
+ var _SceytChatClient7, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData, _t22;
16247
16278
  return _regenerator().w(function (_context21) {
16248
16279
  while (1) switch (_context21.p = _context21.n) {
16249
16280
  case 0:
16250
16281
  _context21.p = 0;
16251
- SceytChatClient = getClient();
16282
+ _SceytChatClient7 = getClient();
16252
16283
  usersForUpdate = Object.keys(usersMap);
16253
16284
  _context21.n = 1;
16254
- return call(SceytChatClient.getUsers, usersForUpdate);
16285
+ return call(_SceytChatClient7.getUsers, usersForUpdate);
16255
16286
  case 1:
16256
16287
  updatedUsers = _context21.v;
16257
16288
  usersToUpdateMap = {};
@@ -16509,14 +16540,14 @@ function deleteAllMessages(action) {
16509
16540
  }, _marked25, null, [[0, 9]]);
16510
16541
  }
16511
16542
  function joinChannel(action) {
16512
- var payload, channelId, SceytChatClient, channel, joinedChannel, _t27;
16543
+ var payload, channelId, _SceytChatClient8, channel, joinedChannel, _t27;
16513
16544
  return _regenerator().w(function (_context26) {
16514
16545
  while (1) switch (_context26.p = _context26.n) {
16515
16546
  case 0:
16516
16547
  _context26.p = 0;
16517
16548
  payload = action.payload;
16518
16549
  channelId = payload.channelId;
16519
- SceytChatClient = getClient();
16550
+ _SceytChatClient8 = getClient();
16520
16551
  _context26.n = 1;
16521
16552
  return call(getChannelFromMap, channelId);
16522
16553
  case 1:
@@ -16529,7 +16560,7 @@ function joinChannel(action) {
16529
16560
  break;
16530
16561
  }
16531
16562
  _context26.n = 2;
16532
- return call(SceytChatClient.getChannel, channelId);
16563
+ return call(_SceytChatClient8.getChannel, channelId);
16533
16564
  case 2:
16534
16565
  channel = _context26.v;
16535
16566
  case 3:
@@ -17687,7 +17718,7 @@ function sendTextMessage(action) {
17687
17718
  attachments = [att];
17688
17719
  }
17689
17720
  messageBuilder = channel.createMessageBuilder();
17690
- messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisplayCount(message.type === 'system' ? 0 : 1).setSilent(message.type === 'system').setMetadata(JSON.stringify(message.metadata));
17721
+ messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisplayCount((message === null || message === void 0 ? void 0 : message.displayCount) !== undefined ? message.displayCount : message.type === 'system' ? 0 : 1).setSilent((message === null || message === void 0 ? void 0 : message.silent) !== undefined ? message.silent : message.type === 'system').setMetadata(JSON.stringify(message.metadata));
17691
17722
  if (message.parentMessage) {
17692
17723
  messageBuilder.setParentMessageId(message.parentMessage ? message.parentMessage.id : null);
17693
17724
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sceyt-chat-react-uikit",
3
- "version": "1.7.1-beta.5",
3
+ "version": "1.7.1-beta.7",
4
4
  "description": "Interactive React UI Components for Sceyt Chat.",
5
5
  "author": "Sceyt",
6
6
  "license": "MIT",