sceyt-chat-react-uikit 1.8.8-beta.2 → 1.8.8-beta.4

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.modern.js CHANGED
@@ -10467,17 +10467,21 @@ function setMessageToEditAC(message) {
10467
10467
  message: message
10468
10468
  });
10469
10469
  }
10470
- function loadLatestMessagesAC(channel, messageId, networkChanged, applyVisibleWindow) {
10470
+ function loadLatestMessagesAC(channel, messageId, networkChanged, applyVisibleWindow, forceLatestWindow) {
10471
10471
  if (applyVisibleWindow === void 0) {
10472
10472
  applyVisibleWindow = true;
10473
10473
  }
10474
+ if (forceLatestWindow === void 0) {
10475
+ forceLatestWindow = false;
10476
+ }
10474
10477
  return {
10475
10478
  type: LOAD_LATEST_MESSAGES,
10476
10479
  payload: {
10477
10480
  channel: channel,
10478
10481
  messageId: messageId,
10479
10482
  networkChanged: networkChanged,
10480
- applyVisibleWindow: applyVisibleWindow
10483
+ applyVisibleWindow: applyVisibleWindow,
10484
+ forceLatestWindow: forceLatestWindow
10481
10485
  }
10482
10486
  };
10483
10487
  }
@@ -16162,6 +16166,9 @@ function sendMessage(action) {
16162
16166
  }
16163
16167
  _messageBuilder = channel.createMessageBuilder();
16164
16168
  _messageBuilder.setBody(i === 0 ? message.body : '').setAttachments([]).setBodyAttributes(i === 0 ? message.bodyAttributes : {}).setMentionUserIds(i === 0 ? mentionedUserIds : []).setType(message.type).setDisplayCount(message.type === MESSAGE_TYPE.SYSTEM ? 0 : 1).setSilent(message.type === MESSAGE_TYPE.SYSTEM).setMetadata(i === 0 ? JSON.stringify(message.metadata) : '');
16169
+ if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
16170
+ _messageBuilder.setDisableMentionsCount(true);
16171
+ }
16165
16172
  if (message.parentMessage) {
16166
16173
  _messageBuilder.setParentMessageId(message.parentMessage ? message.parentMessage.id : null);
16167
16174
  }
@@ -16233,6 +16240,9 @@ function sendMessage(action) {
16233
16240
  }
16234
16241
  messageBuilder = channel.createMessageBuilder();
16235
16242
  messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(message.attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisplayCount(message.type === MESSAGE_TYPE.SYSTEM ? 0 : 1).setSilent(message.type === MESSAGE_TYPE.SYSTEM).setMetadata(JSON.stringify(message.metadata));
16243
+ if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
16244
+ messageBuilder.setDisableMentionsCount(true);
16245
+ }
16236
16246
  if (message.parentMessage) {
16237
16247
  messageBuilder.setParentMessageId(message.parentMessage ? message.parentMessage.id : null);
16238
16248
  }
@@ -16529,6 +16539,9 @@ function sendTextMessage(action) {
16529
16539
  }
16530
16540
  messageBuilder = channel.createMessageBuilder();
16531
16541
  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 === MESSAGE_TYPE.SYSTEM ? 0 : 1).setSilent((message === null || message === void 0 ? void 0 : message.silent) !== undefined ? message.silent : message.type === MESSAGE_TYPE.SYSTEM).setMetadata(JSON.stringify(message.metadata)).setPollDetails(message.pollDetails ? message.pollDetails : null);
16542
+ if (channel.type === DEFAULT_CHANNEL_TYPE.DIRECT) {
16543
+ messageBuilder.setDisableMentionsCount(true);
16544
+ }
16532
16545
  if (message.parentMessage) {
16533
16546
  messageBuilder.setParentMessageId(message.parentMessage ? message.parentMessage.id : null);
16534
16547
  }
@@ -18648,7 +18661,7 @@ function loadDefaultMessages(action) {
18648
18661
  }, _marked26, null, [[0, 34, 35, 37]]);
18649
18662
  }
18650
18663
  function getMessagesQuery(action) {
18651
- var _action$payload5, channel, limit, networkChanged, _action$payload5$appl, applyVisibleWindow, channelNewMessageCount, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, result, appliedMessages, firstConfirmedMessageId, lastConfirmedMessageId, _channel$lastMessage1, cachedMessages, cacheIsCurrent, _firstConfirmedMessageId2, _lastConfirmedMessageId2, activeMessages, activeConfirmedMessages, sameVisibleWindow, filteredPendingMessages, activeById, changedMessages, waitToSendPendingMessages, _t28, _t29, _t30, _t31;
18664
+ var _action$payload5, channel, limit, networkChanged, _action$payload5$appl, applyVisibleWindow, _action$payload5$forc, forceLatestWindow, channelNewMessageCount, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, result, appliedMessages, firstConfirmedMessageId, lastConfirmedMessageId, _channel$lastMessage1, cachedMessages, cacheIsCurrent, _firstConfirmedMessageId2, _lastConfirmedMessageId2, activeMessages, activeConfirmedMessages, sameVisibleWindow, filteredPendingMessages, activeById, changedMessages, waitToSendPendingMessages, _t28, _t29, _t30, _t31;
18652
18665
  return _regenerator().w(function (_context33) {
18653
18666
  while (1) switch (_context33.p = _context33.n) {
18654
18667
  case 0:
@@ -18656,7 +18669,7 @@ function getMessagesQuery(action) {
18656
18669
  _context33.n = 1;
18657
18670
  return call(setMessageListLoading, 'both', LOADING_STATE.LOADING);
18658
18671
  case 1:
18659
- _action$payload5 = action.payload, channel = _action$payload5.channel, limit = _action$payload5.limit, networkChanged = _action$payload5.networkChanged, _action$payload5$appl = _action$payload5.applyVisibleWindow, applyVisibleWindow = _action$payload5$appl === void 0 ? true : _action$payload5$appl;
18672
+ _action$payload5 = action.payload, channel = _action$payload5.channel, limit = _action$payload5.limit, networkChanged = _action$payload5.networkChanged, _action$payload5$appl = _action$payload5.applyVisibleWindow, applyVisibleWindow = _action$payload5$appl === void 0 ? true : _action$payload5$appl, _action$payload5$forc = _action$payload5.forceLatestWindow, forceLatestWindow = _action$payload5$forc === void 0 ? false : _action$payload5$forc;
18660
18673
  channelNewMessageCount = (channel === null || channel === void 0 ? void 0 : channel.newMessageCount) || 0;
18661
18674
  connectionState = store.getState().UserReducer.connectionStatus;
18662
18675
  if (!(channel !== null && channel !== void 0 && channel.id && !(channel !== null && channel !== void 0 && channel.isMockChannel))) {
@@ -18698,7 +18711,7 @@ function getMessagesQuery(action) {
18698
18711
  hasNext: false
18699
18712
  };
18700
18713
  appliedMessages = [];
18701
- if (!(!networkChanged && channelNewMessageCount && channelNewMessageCount > 0)) {
18714
+ if (!(!networkChanged && !forceLatestWindow && channelNewMessageCount && channelNewMessageCount > 0)) {
18702
18715
  _context33.n = 17;
18703
18716
  break;
18704
18717
  }
@@ -22211,10 +22224,11 @@ function updateActiveChannelMembersRemove(removedMembers, channelId) {
22211
22224
 
22212
22225
  var _marked$2 = /*#__PURE__*/_regenerator().m(handleChannelMessageEvent),
22213
22226
  _marked2$2 = /*#__PURE__*/_regenerator().m(handleUnreadMessagesInfoEvent),
22214
- _marked3$1 = /*#__PURE__*/_regenerator().m(handleMessageMarkersReceivedEvent),
22215
- _marked4$1 = /*#__PURE__*/_regenerator().m(handleDeleteMessageEvent),
22216
- _marked5$1 = /*#__PURE__*/_regenerator().m(handleEditMessageEvent),
22217
- _marked6$1 = /*#__PURE__*/_regenerator().m(watchForEvents);
22227
+ _marked3$1 = /*#__PURE__*/_regenerator().m(handleChannelMarkedAsReadEvent),
22228
+ _marked4$1 = /*#__PURE__*/_regenerator().m(handleMessageMarkersReceivedEvent),
22229
+ _marked5$1 = /*#__PURE__*/_regenerator().m(handleDeleteMessageEvent),
22230
+ _marked6$1 = /*#__PURE__*/_regenerator().m(handleEditMessageEvent),
22231
+ _marked7$1 = /*#__PURE__*/_regenerator().m(watchForEvents);
22218
22232
  var getStoredChannel$1 = function getStoredChannel(channelId) {
22219
22233
  return getChannelFromMap(channelId) || getChannelFromAllChannels(channelId) || getChannelFromAllChannelsMap(channelId) || null;
22220
22234
  };
@@ -22462,26 +22476,62 @@ function handleUnreadMessagesInfoEvent(args) {
22462
22476
  }
22463
22477
  }, _marked2$2);
22464
22478
  }
22479
+ function handleChannelMarkedAsReadEvent(args) {
22480
+ var channel, channelUpdateParams, groupName;
22481
+ return _regenerator().w(function (_context3) {
22482
+ while (1) switch (_context3.n) {
22483
+ case 0:
22484
+ channel = args.channel;
22485
+ if (channel) {
22486
+ _context3.n = 1;
22487
+ break;
22488
+ }
22489
+ return _context3.a(2);
22490
+ case 1:
22491
+ channelUpdateParams = _extends({
22492
+ unread: false,
22493
+ newMessageCount: 0,
22494
+ newMentionCount: 0,
22495
+ muted: channel.muted,
22496
+ mutedTill: channel.mutedTill
22497
+ }, channel.lastReceivedMsgId ? {
22498
+ lastReceivedMsgId: channel.lastReceivedMsgId
22499
+ } : {}, channel.lastDisplayedMessageId ? {
22500
+ lastDisplayedMessageId: channel.lastDisplayedMessageId
22501
+ } : {});
22502
+ _context3.n = 2;
22503
+ return put(updateChannelDataAC(channel.id, channelUpdateParams));
22504
+ case 2:
22505
+ groupName = getChannelGroupName(channel);
22506
+ _context3.n = 3;
22507
+ return put(updateSearchedChannelDataAC(channel.id, channelUpdateParams, groupName));
22508
+ case 3:
22509
+ updateChannelOnAllChannels(channel.id, channelUpdateParams);
22510
+ case 4:
22511
+ return _context3.a(2);
22512
+ }
22513
+ }, _marked3$1);
22514
+ }
22465
22515
  function handleMessageMarkersReceivedEvent(args, SceytChatClient) {
22466
22516
  var _markerList$user;
22467
22517
  var channelId, markerList, channel, isOwnMarker, activeChannelId, updateLastMessage, markersMap, markerUpdateParams, _iterator, _step, messageId, lastMessage;
22468
- return _regenerator().w(function (_context3) {
22469
- while (1) switch (_context3.n) {
22518
+ return _regenerator().w(function (_context4) {
22519
+ while (1) switch (_context4.n) {
22470
22520
  case 0:
22471
22521
  channelId = args.channelId, markerList = args.markerList;
22472
22522
  channel = getStoredChannel$1(channelId);
22473
22523
  log.info('channel MESSAGE_MARKERS_RECEIVED ... channel: ', channel, 'markers list: ', markerList);
22474
22524
  if (channel) {
22475
- _context3.n = 1;
22525
+ _context4.n = 1;
22476
22526
  break;
22477
22527
  }
22478
- return _context3.a(2);
22528
+ return _context4.a(2);
22479
22529
  case 1:
22480
22530
  isOwnMarker = ((_markerList$user = markerList.user) === null || _markerList$user === void 0 ? void 0 : _markerList$user.id) === SceytChatClient.user.id;
22481
- _context3.n = 2;
22531
+ _context4.n = 2;
22482
22532
  return call(getActiveChannelId);
22483
22533
  case 2:
22484
- activeChannelId = _context3.v;
22534
+ activeChannelId = _context4.v;
22485
22535
  updateLastMessage = false;
22486
22536
  markersMap = {};
22487
22537
  markerUpdateParams = {
@@ -22496,19 +22546,19 @@ function handleMessageMarkersReceivedEvent(args, SceytChatClient) {
22496
22546
  }
22497
22547
  }
22498
22548
  if (!updateLastMessage) {
22499
- _context3.n = 3;
22549
+ _context4.n = 3;
22500
22550
  break;
22501
22551
  }
22502
22552
  lastMessage = _extends({}, channel.lastMessage, updateMessageDeliveryStatusAndMarkers(channel.lastMessage, markerUpdateParams, isOwnMarker));
22503
22553
  updateChannelLastMessageOnAllChannels(channel.id, lastMessage);
22504
- _context3.n = 3;
22554
+ _context4.n = 3;
22505
22555
  return put(updateChannelLastMessageStatusAC(lastMessage, channel));
22506
22556
  case 3:
22507
22557
  if (!(activeChannelId === channelId)) {
22508
- _context3.n = 4;
22558
+ _context4.n = 4;
22509
22559
  break;
22510
22560
  }
22511
- _context3.n = 4;
22561
+ _context4.n = 4;
22512
22562
  return put(updateMessagesStatusAC(markerList.name, markersMap, isOwnMarker, markerList));
22513
22563
  case 4:
22514
22564
  updateMessageStatusOnMap(channel.id, {
@@ -22517,32 +22567,32 @@ function handleMessageMarkersReceivedEvent(args, SceytChatClient) {
22517
22567
  marker: markerList
22518
22568
  }, isOwnMarker);
22519
22569
  if (isOwnMarker) {
22520
- _context3.n = 5;
22570
+ _context4.n = 5;
22521
22571
  break;
22522
22572
  }
22523
- _context3.n = 5;
22573
+ _context4.n = 5;
22524
22574
  return put(updateMessagesMarkersAC(channelId, markerList.name, markerList));
22525
22575
  case 5:
22526
- return _context3.a(2);
22576
+ return _context4.a(2);
22527
22577
  }
22528
- }, _marked3$1);
22578
+ }, _marked4$1);
22529
22579
  }
22530
22580
  function handleDeleteMessageEvent(args) {
22531
22581
  var channel, deletedMessage, activeChannelId, channelExists;
22532
- return _regenerator().w(function (_context4) {
22533
- while (1) switch (_context4.n) {
22582
+ return _regenerator().w(function (_context5) {
22583
+ while (1) switch (_context5.n) {
22534
22584
  case 0:
22535
22585
  channel = args.channel, deletedMessage = args.deletedMessage;
22536
- _context4.n = 1;
22586
+ _context5.n = 1;
22537
22587
  return call(getActiveChannelId);
22538
22588
  case 1:
22539
- activeChannelId = _context4.v;
22589
+ activeChannelId = _context5.v;
22540
22590
  channelExists = checkChannelExists(channel.id);
22541
22591
  if (!(channel.id === activeChannelId)) {
22542
- _context4.n = 2;
22592
+ _context5.n = 2;
22543
22593
  break;
22544
22594
  }
22545
- _context4.n = 2;
22595
+ _context5.n = 2;
22546
22596
  return put(updateMessageAC(deletedMessage.id, deletedMessage));
22547
22597
  case 2:
22548
22598
  updateMessageOnMap(channel.id, {
@@ -22550,10 +22600,10 @@ function handleDeleteMessageEvent(args) {
22550
22600
  params: deletedMessage
22551
22601
  });
22552
22602
  if (!channelExists) {
22553
- _context4.n = 4;
22603
+ _context5.n = 4;
22554
22604
  break;
22555
22605
  }
22556
- _context4.n = 3;
22606
+ _context5.n = 3;
22557
22607
  return put(updateChannelDataAC(channel.id, {
22558
22608
  newMessageCount: channel.newMessageCount,
22559
22609
  muted: channel.muted,
@@ -22561,10 +22611,10 @@ function handleDeleteMessageEvent(args) {
22561
22611
  }));
22562
22612
  case 3:
22563
22613
  if (!(channel.lastMessage.id === deletedMessage.id)) {
22564
- _context4.n = 4;
22614
+ _context5.n = 4;
22565
22615
  break;
22566
22616
  }
22567
- _context4.n = 4;
22617
+ _context5.n = 4;
22568
22618
  return put(updateChannelLastMessageAC(deletedMessage, channel));
22569
22619
  case 4:
22570
22620
  updateChannelOnAllChannels(channel.id, {
@@ -22572,29 +22622,29 @@ function handleDeleteMessageEvent(args) {
22572
22622
  muted: channel.muted,
22573
22623
  mutedTill: channel.mutedTill
22574
22624
  }, deletedMessage);
22575
- _context4.n = 5;
22625
+ _context5.n = 5;
22576
22626
  return put(removePendingMessageMutationAC(deletedMessage.id));
22577
22627
  case 5:
22578
- return _context4.a(2);
22628
+ return _context5.a(2);
22579
22629
  }
22580
- }, _marked4$1);
22630
+ }, _marked5$1);
22581
22631
  }
22582
22632
  function handleEditMessageEvent(args) {
22583
22633
  var channel, message, activeChannelId, channelExists;
22584
- return _regenerator().w(function (_context5) {
22585
- while (1) switch (_context5.n) {
22634
+ return _regenerator().w(function (_context6) {
22635
+ while (1) switch (_context6.n) {
22586
22636
  case 0:
22587
22637
  channel = args.channel, message = args.message;
22588
- _context5.n = 1;
22638
+ _context6.n = 1;
22589
22639
  return call(getActiveChannelId);
22590
22640
  case 1:
22591
- activeChannelId = _context5.v;
22641
+ activeChannelId = _context6.v;
22592
22642
  channelExists = checkChannelExists(channel.id);
22593
22643
  if (!(channel.id === activeChannelId)) {
22594
- _context5.n = 2;
22644
+ _context6.n = 2;
22595
22645
  break;
22596
22646
  }
22597
- _context5.n = 2;
22647
+ _context6.n = 2;
22598
22648
  return put(updateMessageAC(message.id, {
22599
22649
  body: message.body,
22600
22650
  state: message.state,
@@ -22605,14 +22655,14 @@ function handleEditMessageEvent(args) {
22605
22655
  }));
22606
22656
  case 2:
22607
22657
  if (!channelExists) {
22608
- _context5.n = 3;
22658
+ _context6.n = 3;
22609
22659
  break;
22610
22660
  }
22611
22661
  if (!(channel.lastMessage.id === message.id)) {
22612
- _context5.n = 3;
22662
+ _context6.n = 3;
22613
22663
  break;
22614
22664
  }
22615
- _context5.n = 3;
22665
+ _context6.n = 3;
22616
22666
  return put(updateChannelLastMessageAC(message, channel));
22617
22667
  case 3:
22618
22668
  if (checkChannelExistsOnMessagesMap(channel.id)) {
@@ -22622,17 +22672,17 @@ function handleEditMessageEvent(args) {
22622
22672
  });
22623
22673
  }
22624
22674
  updateChannelOnAllChannels(channel.id, {}, message);
22625
- _context5.n = 4;
22675
+ _context6.n = 4;
22626
22676
  return put(removePendingMessageMutationAC(message.id));
22627
22677
  case 4:
22628
- return _context5.a(2);
22678
+ return _context6.a(2);
22629
22679
  }
22630
- }, _marked5$1);
22680
+ }, _marked6$1);
22631
22681
  }
22632
22682
  function watchForEvents() {
22633
22683
  var SceytChatClient, channelListener, connectionListener, usersTimeout, chan, _loop;
22634
- return _regenerator().w(function (_context9) {
22635
- while (1) switch (_context9.n) {
22684
+ return _regenerator().w(function (_context0) {
22685
+ while (1) switch (_context0.n) {
22636
22686
  case 0:
22637
22687
  SceytChatClient = getClient();
22638
22688
  channelListener = new SceytChatClient.ChannelListener();
@@ -23032,45 +23082,45 @@ function watchForEvents() {
23032
23082
  };
23033
23083
  });
23034
23084
  _loop = /*#__PURE__*/_regenerator().m(function _callee3() {
23035
- var _yield$take, type, args, createdChannel, channelFilterTypes, getFromContacts, channelExists, _chan, channel, joinedMember, _chan2, customLoadMembersFunctions, joinMembersEvent, membersList, updateChannelData, _channel, member, _channelExists, activeChannelId, groupName, _updateChannelData, users, blockedUsers, allChannels, _loop2, _iterator2, _step2, _users, unblockedUsers, _allChannels, _loop3, _iterator3, _step3, _channel2, removedMembers, _activeChannelId, _channelExists2, activeChannel, _updateChannelData2, _groupName, _channel3, addedMembers, _activeChannelId2, _channelExists3, _updateChannelData3, _customLoadMembersFunctions, addMembersEvent, _membersList, _groupName2, onUpdateChannel, updatedChannel, _channelExists4, subject, avatarUrl, muted, mutedTill, metadata, _channel4, fields, parsedChannelMeta, parsedMeta, _activeChannelId3, _groupName3, channelId, _channel5, _channel6, user, message, reaction, isSelf, _activeChannelId4, _state$ThemeReducer$n7, _state$ThemeReducer$n8, _state$ThemeReducer$n9, _state$ThemeReducer$n0, _state$ThemeReducer$n1, _state$ThemeReducer$n10, contactsMap, _getFromContacts, state, theme, accentColor, textSecondary, messageBody, channelUpdateParams, _pollDetailsData$chan, _pollDetailsData$chan2, _channel7, pollDetails, messageId, pollDetailsData, _activeChannelId5, addedVotes, deletedVotes, objs, _iterator4, _step4, vote, _iterator5, _step5, _vote, _i, _objs, obj, _store$getState$Messa3, key, hasNext, _i2, _objs2, _obj, _pollDetailsData$chan3, _channel8, _pollDetails, _messageId, _pollDetailsData, _activeChannelId6, _deletedVotes, _objs3, _iterator6, _step6, _vote2, _i3, _objs4, _obj2, _i4, _objs5, _obj3, _pollDetailsData2$cha, _channel9, _pollDetails2, _messageId2, _activeChannelId7, _pollDetailsData2, retractedVotes, _objs6, _iterator7, _step7, _vote4, _i5, _objs7, _obj4, _iterator8, _step8, _vote3, _channel0, _messageId3, _activeChannelId8, _obj5, _channel1, _user, _message, _reaction, channelFromMap, _isSelf, _activeChannelId9, _channelUpdateParams, _channel10, _activeChannelId0, channelExist, _channel11, _channel12, _channel13, _channel14, _channel15, _activeChannelId1, lastChannel, _channel16, _channel17, _groupName4, _channel18, _groupName5, _channel19, members, _activeChannelId10, _customLoadMembersFunctions2, updateMembersEvent, _membersList2, i, _channel20, _channel21, _channelId, from, name, status, _t, _t2, _t3, _t4;
23036
- return _regenerator().w(function (_context8) {
23037
- while (1) switch (_context8.p = _context8.n) {
23085
+ var _yield$take, type, args, createdChannel, channelFilterTypes, getFromContacts, channelExists, _chan, channel, joinedMember, _chan2, customLoadMembersFunctions, joinMembersEvent, membersList, updateChannelData, _channel, member, _channelExists, activeChannelId, groupName, _updateChannelData, users, blockedUsers, allChannels, _loop2, _iterator2, _step2, _users, unblockedUsers, _allChannels, _loop3, _iterator3, _step3, _channel2, removedMembers, _activeChannelId, _channelExists2, activeChannel, _updateChannelData2, _groupName, _channel3, addedMembers, _activeChannelId2, _channelExists3, _updateChannelData3, _customLoadMembersFunctions, addMembersEvent, _membersList, _groupName2, onUpdateChannel, updatedChannel, _channelExists4, subject, avatarUrl, muted, mutedTill, metadata, _channel4, fields, parsedChannelMeta, parsedMeta, _activeChannelId3, _groupName3, channelId, _channel5, _channel6, user, message, reaction, isSelf, _activeChannelId4, _state$ThemeReducer$n7, _state$ThemeReducer$n8, _state$ThemeReducer$n9, _state$ThemeReducer$n0, _state$ThemeReducer$n1, _state$ThemeReducer$n10, contactsMap, _getFromContacts, state, theme, accentColor, textSecondary, messageBody, channelUpdateParams, _pollDetailsData$chan, _pollDetailsData$chan2, _channel7, pollDetails, messageId, pollDetailsData, _activeChannelId5, addedVotes, deletedVotes, objs, _iterator4, _step4, vote, _iterator5, _step5, _vote, _i, _objs, obj, _store$getState$Messa3, key, hasNext, _i2, _objs2, _obj, _pollDetailsData$chan3, _channel8, _pollDetails, _messageId, _pollDetailsData, _activeChannelId6, _deletedVotes, _objs3, _iterator6, _step6, _vote2, _i3, _objs4, _obj2, _i4, _objs5, _obj3, _pollDetailsData2$cha, _channel9, _pollDetails2, _messageId2, _activeChannelId7, _pollDetailsData2, retractedVotes, _objs6, _iterator7, _step7, _vote4, _i5, _objs7, _obj4, _iterator8, _step8, _vote3, _channel0, _messageId3, _activeChannelId8, _obj5, _channel1, _user, _message, _reaction, channelFromMap, _isSelf, _activeChannelId9, _channelUpdateParams, _channel10, _activeChannelId0, channelExist, _channel11, _channel12, _channel13, _channel14, _channel15, _activeChannelId1, lastChannel, _channel16, _channel17, _groupName4, _channel18, members, _activeChannelId10, _customLoadMembersFunctions2, updateMembersEvent, _membersList2, i, _channel19, _channel20, _channelId, from, name, status, _t, _t2, _t3, _t4;
23086
+ return _regenerator().w(function (_context9) {
23087
+ while (1) switch (_context9.p = _context9.n) {
23038
23088
  case 0:
23039
- _context8.p = 0;
23040
- _context8.n = 1;
23089
+ _context9.p = 0;
23090
+ _context9.n = 1;
23041
23091
  return take(chan);
23042
23092
  case 1:
23043
- _yield$take = _context8.v;
23093
+ _yield$take = _context9.v;
23044
23094
  type = _yield$take.type;
23045
23095
  args = _yield$take.args;
23046
23096
  _t = type;
23047
- _context8.n = _t === CHANNEL_EVENT_TYPES.CREATE ? 2 : _t === CHANNEL_EVENT_TYPES.JOIN ? 7 : _t === CHANNEL_EVENT_TYPES.LEAVE ? 17 : _t === CHANNEL_EVENT_TYPES.BLOCK ? 30 : _t === CHANNEL_EVENT_TYPES.UNBLOCK ? 34 : _t === CHANNEL_EVENT_TYPES.KICK_MEMBERS ? 38 : _t === CHANNEL_EVENT_TYPES.ADD_MEMBERS ? 49 : _t === CHANNEL_EVENT_TYPES.UPDATE_CHANNEL ? 64 : _t === CHANNEL_EVENT_TYPES.MESSAGE ? 69 : _t === CHANNEL_EVENT_TYPES.MESSAGE_MARKERS_RECEIVED ? 71 : _t === CHANNEL_EVENT_TYPES.DELETE ? 73 : _t === CHANNEL_EVENT_TYPES.DELETE_MESSAGE ? 75 : _t === CHANNEL_EVENT_TYPES.EDIT_MESSAGE ? 77 : _t === CHANNEL_EVENT_TYPES.REACTION_ADDED ? 79 : _t === CHANNEL_EVENT_TYPES.POLL_ADDED ? 86 : _t === CHANNEL_EVENT_TYPES.POLL_DELETED ? 96 : _t === CHANNEL_EVENT_TYPES.POLL_RETRACTED ? 104 : _t === CHANNEL_EVENT_TYPES.POLL_CLOSED ? 112 : _t === CHANNEL_EVENT_TYPES.REACTION_DELETED ? 116 : _t === CHANNEL_EVENT_TYPES.UNREAD_MESSAGES_INFO ? 120 : _t === CHANNEL_EVENT_TYPES.CLEAR_HISTORY ? 122 : _t === CHANNEL_EVENT_TYPES.MUTE ? 128 : _t === CHANNEL_EVENT_TYPES.UNMUTE ? 130 : _t === CHANNEL_EVENT_TYPES.PINED ? 132 : _t === CHANNEL_EVENT_TYPES.UNPINED ? 134 : _t === CHANNEL_EVENT_TYPES.HIDE ? 136 : _t === CHANNEL_EVENT_TYPES.UNHIDE ? 141 : _t === CHANNEL_EVENT_TYPES.CHANNEL_MARKED_AS_UNREAD ? 143 : _t === CHANNEL_EVENT_TYPES.CHANNEL_MARKED_AS_READ ? 146 : _t === CHANNEL_EVENT_TYPES.CHANGE_ROLE ? 149 : _t === CHANNEL_EVENT_TYPES.FROZEN ? 159 : _t === CHANNEL_EVENT_TYPES.UNFROZEN ? 160 : _t === CHANNEL_EVENT_TYPES.CHANNEL_EVENT ? 161 : _t === CONNECTION_EVENT_TYPES.CONNECTION_STATUS_CHANGED ? 170 : 174;
23097
+ _context9.n = _t === CHANNEL_EVENT_TYPES.CREATE ? 2 : _t === CHANNEL_EVENT_TYPES.JOIN ? 7 : _t === CHANNEL_EVENT_TYPES.LEAVE ? 17 : _t === CHANNEL_EVENT_TYPES.BLOCK ? 30 : _t === CHANNEL_EVENT_TYPES.UNBLOCK ? 34 : _t === CHANNEL_EVENT_TYPES.KICK_MEMBERS ? 38 : _t === CHANNEL_EVENT_TYPES.ADD_MEMBERS ? 49 : _t === CHANNEL_EVENT_TYPES.UPDATE_CHANNEL ? 64 : _t === CHANNEL_EVENT_TYPES.MESSAGE ? 69 : _t === CHANNEL_EVENT_TYPES.MESSAGE_MARKERS_RECEIVED ? 71 : _t === CHANNEL_EVENT_TYPES.DELETE ? 73 : _t === CHANNEL_EVENT_TYPES.DELETE_MESSAGE ? 75 : _t === CHANNEL_EVENT_TYPES.EDIT_MESSAGE ? 77 : _t === CHANNEL_EVENT_TYPES.REACTION_ADDED ? 79 : _t === CHANNEL_EVENT_TYPES.POLL_ADDED ? 86 : _t === CHANNEL_EVENT_TYPES.POLL_DELETED ? 96 : _t === CHANNEL_EVENT_TYPES.POLL_RETRACTED ? 104 : _t === CHANNEL_EVENT_TYPES.POLL_CLOSED ? 112 : _t === CHANNEL_EVENT_TYPES.REACTION_DELETED ? 116 : _t === CHANNEL_EVENT_TYPES.UNREAD_MESSAGES_INFO ? 120 : _t === CHANNEL_EVENT_TYPES.CLEAR_HISTORY ? 122 : _t === CHANNEL_EVENT_TYPES.MUTE ? 128 : _t === CHANNEL_EVENT_TYPES.UNMUTE ? 130 : _t === CHANNEL_EVENT_TYPES.PINED ? 132 : _t === CHANNEL_EVENT_TYPES.UNPINED ? 134 : _t === CHANNEL_EVENT_TYPES.HIDE ? 136 : _t === CHANNEL_EVENT_TYPES.UNHIDE ? 141 : _t === CHANNEL_EVENT_TYPES.CHANNEL_MARKED_AS_UNREAD ? 143 : _t === CHANNEL_EVENT_TYPES.CHANNEL_MARKED_AS_READ ? 146 : _t === CHANNEL_EVENT_TYPES.CHANGE_ROLE ? 148 : _t === CHANNEL_EVENT_TYPES.FROZEN ? 158 : _t === CHANNEL_EVENT_TYPES.UNFROZEN ? 159 : _t === CHANNEL_EVENT_TYPES.CHANNEL_EVENT ? 160 : _t === CONNECTION_EVENT_TYPES.CONNECTION_STATUS_CHANGED ? 169 : 173;
23048
23098
  break;
23049
23099
  case 2:
23050
23100
  createdChannel = args.createdChannel;
23051
23101
  log.info('CHANNEL_EVENT_CREATE ... ', createdChannel);
23052
23102
  channelFilterTypes = getChannelTypesFilter();
23053
23103
  if (!(channelFilterTypes !== null && channelFilterTypes !== void 0 && channelFilterTypes.length ? channelFilterTypes.includes(createdChannel.type) : true)) {
23054
- _context8.n = 6;
23104
+ _context9.n = 6;
23055
23105
  break;
23056
23106
  }
23057
23107
  getFromContacts = getShowOnlyContactUsers();
23058
23108
  channelExists = checkChannelExists(createdChannel.id);
23059
23109
  if (channelExists) {
23060
- _context8.n = 5;
23110
+ _context9.n = 5;
23061
23111
  break;
23062
23112
  }
23063
23113
  if (!getFromContacts) {
23064
- _context8.n = 3;
23114
+ _context9.n = 3;
23065
23115
  break;
23066
23116
  }
23067
- _context8.n = 3;
23117
+ _context9.n = 3;
23068
23118
  return put(getContactsAC());
23069
23119
  case 3:
23070
- _context8.n = 4;
23120
+ _context9.n = 4;
23071
23121
  return call(setChannelInMap, createdChannel);
23072
23122
  case 4:
23073
- _context8.n = 5;
23123
+ _context9.n = 5;
23074
23124
  return put(setChannelToAddAC(JSON.parse(JSON.stringify(createdChannel))));
23075
23125
  case 5:
23076
23126
  _chan = getChannelFromAllChannels(createdChannel.id);
@@ -23078,7 +23128,7 @@ function watchForEvents() {
23078
23128
  addChannelToAllChannels(createdChannel);
23079
23129
  }
23080
23130
  case 6:
23081
- return _context8.a(3, 175);
23131
+ return _context9.a(3, 174);
23082
23132
  case 7:
23083
23133
  channel = args.channel, joinedMember = args.joinedMember;
23084
23134
  log.info('channel JOIN ... . ', channel);
@@ -23088,114 +23138,114 @@ function watchForEvents() {
23088
23138
  _chan2 = getChannelFromAllChannels(channel.id);
23089
23139
  }
23090
23140
  if (!_chan2) {
23091
- _context8.n = 16;
23141
+ _context9.n = 16;
23092
23142
  break;
23093
23143
  }
23094
23144
  customLoadMembersFunctions = getCustomLoadMembersFunctions();
23095
23145
  joinMembersEvent = customLoadMembersFunctions === null || customLoadMembersFunctions === void 0 ? void 0 : customLoadMembersFunctions.joinMembersEvent;
23096
23146
  membersList = [];
23097
23147
  if (!joinMembersEvent) {
23098
- _context8.n = 10;
23148
+ _context9.n = 10;
23099
23149
  break;
23100
23150
  }
23101
- _context8.n = 8;
23151
+ _context9.n = 8;
23102
23152
  return call(joinMembersEvent, _chan2.id, [joinedMember], store.getState().MembersReducer.channelsMembersMap[_chan2.id] || []);
23103
23153
  case 8:
23104
- membersList = _context8.v;
23105
- _context8.n = 9;
23154
+ membersList = _context9.v;
23155
+ _context9.n = 9;
23106
23156
  return put(setMembersToListAC(membersList, _chan2.id));
23107
23157
  case 9:
23108
- _context8.n = 11;
23158
+ _context9.n = 11;
23109
23159
  break;
23110
23160
  case 10:
23111
- _context8.n = 11;
23161
+ _context9.n = 11;
23112
23162
  return put(addMembersToListAC([joinedMember], _chan2.id));
23113
23163
  case 11:
23114
23164
  updateChannelOnAllChannels(_chan2.id, {
23115
23165
  memberCount: _chan2.memberCount + 1
23116
23166
  });
23117
23167
  if (!joinMembersEvent) {
23118
- _context8.n = 12;
23168
+ _context9.n = 12;
23119
23169
  break;
23120
23170
  }
23121
23171
  _t2 = {
23122
23172
  members: membersList
23123
23173
  };
23124
- _context8.n = 14;
23174
+ _context9.n = 14;
23125
23175
  break;
23126
23176
  case 12:
23127
- _context8.n = 13;
23177
+ _context9.n = 13;
23128
23178
  return call(updateActiveChannelMembersAdd, [joinedMember], _chan2.id) || {};
23129
23179
  case 13:
23130
- _t2 = _context8.v;
23180
+ _t2 = _context9.v;
23131
23181
  case 14:
23132
23182
  updateChannelData = _t2;
23133
- _context8.n = 15;
23183
+ _context9.n = 15;
23134
23184
  return put(updateChannelDataAC(_chan2.id, _extends({
23135
23185
  memberCount: _chan2.memberCount + 1
23136
23186
  }, updateChannelData)));
23137
23187
  case 15:
23138
- _context8.n = 16;
23188
+ _context9.n = 16;
23139
23189
  return put(updateSearchedChannelDataAC(_chan2.id, {
23140
23190
  memberCount: _chan2.memberCount + 1
23141
23191
  }, getChannelGroupName(_chan2)));
23142
23192
  case 16:
23143
- return _context8.a(3, 175);
23193
+ return _context9.a(3, 174);
23144
23194
  case 17:
23145
23195
  _channel = args.channel, member = args.member;
23146
23196
  log.info('channel LEAVE ... ', _channel, member);
23147
23197
  _channelExists = checkChannelExists(_channel.id);
23148
- _context8.n = 18;
23198
+ _context9.n = 18;
23149
23199
  return call(getActiveChannelId);
23150
23200
  case 18:
23151
- activeChannelId = _context8.v;
23201
+ activeChannelId = _context9.v;
23152
23202
  if (!(member.id === SceytChatClient.user.id)) {
23153
- _context8.n = 23;
23203
+ _context9.n = 23;
23154
23204
  break;
23155
23205
  }
23156
- _context8.n = 19;
23206
+ _context9.n = 19;
23157
23207
  return put(switchChannelActionAC(null));
23158
23208
  case 19:
23159
- _context8.n = 20;
23209
+ _context9.n = 20;
23160
23210
  return put(removeChannelAC(_channel.id));
23161
23211
  case 20:
23162
23212
  removeChannelFromMap(_channel.id);
23163
23213
  deleteChannelFromAllChannels(_channel.id);
23164
- _context8.n = 21;
23214
+ _context9.n = 21;
23165
23215
  return put(setChannelToRemoveAC(_channel));
23166
23216
  case 21:
23167
- _context8.n = 22;
23217
+ _context9.n = 22;
23168
23218
  return put(removeChannelCachesAC(_channel.id));
23169
23219
  case 22:
23170
- _context8.n = 29;
23220
+ _context9.n = 29;
23171
23221
  break;
23172
23222
  case 23:
23173
23223
  groupName = getChannelGroupName(_channel);
23174
23224
  if (!_channelExists) {
23175
- _context8.n = 27;
23225
+ _context9.n = 27;
23176
23226
  break;
23177
23227
  }
23178
23228
  _updateChannelData = {};
23179
23229
  if (!(activeChannelId === _channel.id)) {
23180
- _context8.n = 26;
23230
+ _context9.n = 26;
23181
23231
  break;
23182
23232
  }
23183
- _context8.n = 24;
23233
+ _context9.n = 24;
23184
23234
  return put(removeMemberFromListAC([member], _channel.id));
23185
23235
  case 24:
23186
- _context8.n = 25;
23236
+ _context9.n = 25;
23187
23237
  return call(updateActiveChannelMembersRemove, [member], _channel.id) || {};
23188
23238
  case 25:
23189
- _updateChannelData = _context8.v;
23239
+ _updateChannelData = _context9.v;
23190
23240
  case 26:
23191
- _context8.n = 27;
23241
+ _context9.n = 27;
23192
23242
  return put(updateChannelDataAC(_channel.id, _extends({
23193
23243
  memberCount: _channel.memberCount,
23194
23244
  muted: _channel.muted,
23195
23245
  mutedTill: _channel.mutedTill
23196
23246
  }, _updateChannelData)));
23197
23247
  case 27:
23198
- _context8.n = 28;
23248
+ _context9.n = 28;
23199
23249
  return put(updateSearchedChannelDataAC(_channel.id, {
23200
23250
  memberCount: _channel.memberCount,
23201
23251
  muted: _channel.muted,
@@ -23208,7 +23258,7 @@ function watchForEvents() {
23208
23258
  mutedTill: _channel.mutedTill
23209
23259
  });
23210
23260
  case 29:
23211
- return _context8.a(3, 175);
23261
+ return _context9.a(3, 174);
23212
23262
  case 30:
23213
23263
  log.info('user BLOCK ... ');
23214
23264
  users = args.users;
@@ -23221,8 +23271,8 @@ function watchForEvents() {
23221
23271
  allChannels = store.getState().ChannelReducer.channels;
23222
23272
  _loop2 = /*#__PURE__*/_regenerator().m(function _callee() {
23223
23273
  var user, directChannel, _directChannel$member, updatedMembers;
23224
- return _regenerator().w(function (_context6) {
23225
- while (1) switch (_context6.n) {
23274
+ return _regenerator().w(function (_context7) {
23275
+ while (1) switch (_context7.n) {
23226
23276
  case 0:
23227
23277
  user = _step2.value;
23228
23278
  directChannel = allChannels.find(function (ch) {
@@ -23232,7 +23282,7 @@ function watchForEvents() {
23232
23282
  }));
23233
23283
  });
23234
23284
  if (!directChannel) {
23235
- _context6.n = 1;
23285
+ _context7.n = 1;
23236
23286
  break;
23237
23287
  }
23238
23288
  updatedMembers = (_directChannel$member = directChannel.members) === null || _directChannel$member === void 0 ? void 0 : _directChannel$member.map(function (m) {
@@ -23240,27 +23290,27 @@ function watchForEvents() {
23240
23290
  blocked: true
23241
23291
  }) : m;
23242
23292
  });
23243
- _context6.n = 1;
23293
+ _context7.n = 1;
23244
23294
  return put(updateChannelDataAC(directChannel.id, {
23245
23295
  members: updatedMembers
23246
23296
  }));
23247
23297
  case 1:
23248
- return _context6.a(2);
23298
+ return _context7.a(2);
23249
23299
  }
23250
23300
  }, _callee);
23251
23301
  });
23252
23302
  _iterator2 = _createForOfIteratorHelperLoose(blockedUsers);
23253
23303
  case 31:
23254
23304
  if ((_step2 = _iterator2()).done) {
23255
- _context8.n = 33;
23305
+ _context9.n = 33;
23256
23306
  break;
23257
23307
  }
23258
- return _context8.d(_regeneratorValues(_loop2()), 32);
23308
+ return _context9.d(_regeneratorValues(_loop2()), 32);
23259
23309
  case 32:
23260
- _context8.n = 31;
23310
+ _context9.n = 31;
23261
23311
  break;
23262
23312
  case 33:
23263
- return _context8.a(3, 175);
23313
+ return _context9.a(3, 174);
23264
23314
  case 34:
23265
23315
  log.info('user UNBLOCK ... ');
23266
23316
  _users = args.users;
@@ -23273,8 +23323,8 @@ function watchForEvents() {
23273
23323
  _allChannels = store.getState().ChannelReducer.channels;
23274
23324
  _loop3 = /*#__PURE__*/_regenerator().m(function _callee2() {
23275
23325
  var user, directChannel, _directChannel$member2, updatedMembers;
23276
- return _regenerator().w(function (_context7) {
23277
- while (1) switch (_context7.n) {
23326
+ return _regenerator().w(function (_context8) {
23327
+ while (1) switch (_context8.n) {
23278
23328
  case 0:
23279
23329
  user = _step3.value;
23280
23330
  directChannel = _allChannels.find(function (ch) {
@@ -23284,7 +23334,7 @@ function watchForEvents() {
23284
23334
  }));
23285
23335
  });
23286
23336
  if (!directChannel) {
23287
- _context7.n = 1;
23337
+ _context8.n = 1;
23288
23338
  break;
23289
23339
  }
23290
23340
  updatedMembers = (_directChannel$member2 = directChannel.members) === null || _directChannel$member2 === void 0 ? void 0 : _directChannel$member2.map(function (m) {
@@ -23292,85 +23342,85 @@ function watchForEvents() {
23292
23342
  blocked: false
23293
23343
  }) : m;
23294
23344
  });
23295
- _context7.n = 1;
23345
+ _context8.n = 1;
23296
23346
  return put(updateChannelDataAC(directChannel.id, {
23297
23347
  members: updatedMembers
23298
23348
  }));
23299
23349
  case 1:
23300
- return _context7.a(2);
23350
+ return _context8.a(2);
23301
23351
  }
23302
23352
  }, _callee2);
23303
23353
  });
23304
23354
  _iterator3 = _createForOfIteratorHelperLoose(unblockedUsers);
23305
23355
  case 35:
23306
23356
  if ((_step3 = _iterator3()).done) {
23307
- _context8.n = 37;
23357
+ _context9.n = 37;
23308
23358
  break;
23309
23359
  }
23310
- return _context8.d(_regeneratorValues(_loop3()), 36);
23360
+ return _context9.d(_regeneratorValues(_loop3()), 36);
23311
23361
  case 36:
23312
- _context8.n = 35;
23362
+ _context9.n = 35;
23313
23363
  break;
23314
23364
  case 37:
23315
- return _context8.a(3, 175);
23365
+ return _context9.a(3, 174);
23316
23366
  case 38:
23317
23367
  _channel2 = args.channel, removedMembers = args.removedMembers;
23318
23368
  log.info('channel KICK_MEMBERS ... ', removedMembers);
23319
- _context8.n = 39;
23369
+ _context9.n = 39;
23320
23370
  return call(getActiveChannelId);
23321
23371
  case 39:
23322
- _activeChannelId = _context8.v;
23372
+ _activeChannelId = _context9.v;
23323
23373
  _channelExists2 = checkChannelExists(_channel2.id);
23324
23374
  if (!_channelExists2) {
23325
- _context8.n = 48;
23375
+ _context9.n = 48;
23326
23376
  break;
23327
23377
  }
23328
23378
  if (!removedMembers.find(function (mem) {
23329
23379
  return mem.id === SceytChatClient.user.id;
23330
23380
  })) {
23331
- _context8.n = 43;
23381
+ _context9.n = 43;
23332
23382
  break;
23333
23383
  }
23334
23384
  removeChannelFromMap(_channel2.id);
23335
- _context8.n = 40;
23385
+ _context9.n = 40;
23336
23386
  return put(removeChannelAC(_channel2.id));
23337
23387
  case 40:
23338
- _context8.n = 41;
23388
+ _context9.n = 41;
23339
23389
  return call(getLastChannelFromMap);
23340
23390
  case 41:
23341
- activeChannel = _context8.v;
23391
+ activeChannel = _context9.v;
23342
23392
  if (!activeChannel) {
23343
- _context8.n = 42;
23393
+ _context9.n = 42;
23344
23394
  break;
23345
23395
  }
23346
- _context8.n = 42;
23396
+ _context9.n = 42;
23347
23397
  return put(switchChannelActionAC(JSON.parse(JSON.stringify(activeChannel))));
23348
23398
  case 42:
23349
- _context8.n = 48;
23399
+ _context9.n = 48;
23350
23400
  break;
23351
23401
  case 43:
23352
23402
  _updateChannelData2 = {};
23353
23403
  if (!(_activeChannelId === _channel2.id)) {
23354
- _context8.n = 46;
23404
+ _context9.n = 46;
23355
23405
  break;
23356
23406
  }
23357
- _context8.n = 44;
23407
+ _context9.n = 44;
23358
23408
  return put(removeMemberFromListAC(removedMembers, _channel2.id));
23359
23409
  case 44:
23360
- _context8.n = 45;
23410
+ _context9.n = 45;
23361
23411
  return call(updateActiveChannelMembersRemove, removedMembers, _channel2.id) || {};
23362
23412
  case 45:
23363
- _updateChannelData2 = _context8.v;
23413
+ _updateChannelData2 = _context9.v;
23364
23414
  case 46:
23365
23415
  _groupName = getChannelGroupName(_channel2);
23366
- _context8.n = 47;
23416
+ _context9.n = 47;
23367
23417
  return put(updateSearchedChannelDataAC(_channel2.id, {
23368
23418
  memberCount: _channel2.memberCount,
23369
23419
  muted: _channel2.muted,
23370
23420
  mutedTill: _channel2.mutedTill
23371
23421
  }, _groupName));
23372
23422
  case 47:
23373
- _context8.n = 48;
23423
+ _context9.n = 48;
23374
23424
  return put(updateChannelDataAC(_channel2.id, _extends({
23375
23425
  memberCount: _channel2.memberCount,
23376
23426
  muted: _channel2.muted,
@@ -23382,79 +23432,79 @@ function watchForEvents() {
23382
23432
  muted: _channel2.muted,
23383
23433
  mutedTill: _channel2.mutedTill
23384
23434
  });
23385
- return _context8.a(3, 175);
23435
+ return _context9.a(3, 174);
23386
23436
  case 49:
23387
23437
  _channel3 = args.channel, addedMembers = args.addedMembers;
23388
23438
  log.info('channel ADD_MEMBERS ... ', addedMembers);
23389
- _context8.n = 50;
23439
+ _context9.n = 50;
23390
23440
  return call(getActiveChannelId);
23391
23441
  case 50:
23392
- _activeChannelId2 = _context8.v;
23442
+ _activeChannelId2 = _context9.v;
23393
23443
  _channelExists3 = checkChannelExists(_channel3.id);
23394
23444
  if (!_channelExists3) {
23395
- _context8.n = 60;
23445
+ _context9.n = 60;
23396
23446
  break;
23397
23447
  }
23398
23448
  _updateChannelData3 = {};
23399
23449
  if (!(_activeChannelId2 === _channel3.id)) {
23400
- _context8.n = 58;
23450
+ _context9.n = 58;
23401
23451
  break;
23402
23452
  }
23403
23453
  _customLoadMembersFunctions = getCustomLoadMembersFunctions();
23404
23454
  addMembersEvent = _customLoadMembersFunctions === null || _customLoadMembersFunctions === void 0 ? void 0 : _customLoadMembersFunctions.addMembersEvent;
23405
23455
  _membersList = [];
23406
23456
  if (!addMembersEvent) {
23407
- _context8.n = 53;
23457
+ _context9.n = 53;
23408
23458
  break;
23409
23459
  }
23410
- _context8.n = 51;
23460
+ _context9.n = 51;
23411
23461
  return call(addMembersEvent, _channel3.id, addedMembers, store.getState().MembersReducer.channelsMembersMap[_channel3.id] || []);
23412
23462
  case 51:
23413
- _membersList = _context8.v;
23414
- _context8.n = 52;
23463
+ _membersList = _context9.v;
23464
+ _context9.n = 52;
23415
23465
  return put(setMembersToListAC(_membersList, _channel3.id));
23416
23466
  case 52:
23417
- _context8.n = 54;
23467
+ _context9.n = 54;
23418
23468
  break;
23419
23469
  case 53:
23420
- _context8.n = 54;
23470
+ _context9.n = 54;
23421
23471
  return put(addMembersToListAC(addedMembers, _channel3.id));
23422
23472
  case 54:
23423
23473
  if (!addMembersEvent) {
23424
- _context8.n = 55;
23474
+ _context9.n = 55;
23425
23475
  break;
23426
23476
  }
23427
23477
  _t3 = {
23428
23478
  members: _membersList
23429
23479
  };
23430
- _context8.n = 57;
23480
+ _context9.n = 57;
23431
23481
  break;
23432
23482
  case 55:
23433
- _context8.n = 56;
23483
+ _context9.n = 56;
23434
23484
  return call(updateActiveChannelMembersAdd, addedMembers, _channel3.id) || {};
23435
23485
  case 56:
23436
- _t3 = _context8.v;
23486
+ _t3 = _context9.v;
23437
23487
  case 57:
23438
23488
  _updateChannelData3 = _t3;
23439
23489
  case 58:
23440
- _context8.n = 59;
23490
+ _context9.n = 59;
23441
23491
  return put(updateChannelDataAC(_channel3.id, _extends({
23442
23492
  memberCount: _channel3.memberCount,
23443
23493
  muted: _channel3.muted,
23444
23494
  mutedTill: _channel3.mutedTill
23445
23495
  }, _updateChannelData3)));
23446
23496
  case 59:
23447
- _context8.n = 62;
23497
+ _context9.n = 62;
23448
23498
  break;
23449
23499
  case 60:
23450
- _context8.n = 61;
23500
+ _context9.n = 61;
23451
23501
  return call(setChannelInMap, _channel3);
23452
23502
  case 61:
23453
- _context8.n = 62;
23503
+ _context9.n = 62;
23454
23504
  return put(setAddedToChannelAC(JSON.parse(JSON.stringify(_channel3))));
23455
23505
  case 62:
23456
23506
  _groupName2 = getChannelGroupName(_channel3);
23457
- _context8.n = 63;
23507
+ _context9.n = 63;
23458
23508
  return put(updateSearchedChannelDataAC(_channel3.id, {
23459
23509
  memberCount: _channel3.memberCount,
23460
23510
  muted: _channel3.muted,
@@ -23466,7 +23516,7 @@ function watchForEvents() {
23466
23516
  muted: _channel3.muted,
23467
23517
  mutedTill: _channel3.mutedTill
23468
23518
  });
23469
- return _context8.a(3, 175);
23519
+ return _context9.a(3, 174);
23470
23520
  case 64:
23471
23521
  onUpdateChannel = getOnUpdateChannel();
23472
23522
  log.info('channel UPDATE_CHANNEL ... ');
@@ -23498,10 +23548,10 @@ function watchForEvents() {
23498
23548
  onUpdateChannel(updatedChannel, fields);
23499
23549
  }
23500
23550
  if (!_channelExists4) {
23501
- _context8.n = 67;
23551
+ _context9.n = 67;
23502
23552
  break;
23503
23553
  }
23504
- _context8.n = 65;
23554
+ _context9.n = 65;
23505
23555
  return put(updateChannelDataAC(updatedChannel.id, {
23506
23556
  subject: subject,
23507
23557
  avatarUrl: avatarUrl,
@@ -23509,21 +23559,21 @@ function watchForEvents() {
23509
23559
  mutedTill: mutedTill
23510
23560
  }));
23511
23561
  case 65:
23512
- _context8.n = 66;
23562
+ _context9.n = 66;
23513
23563
  return call(getActiveChannelId);
23514
23564
  case 66:
23515
- _activeChannelId3 = _context8.v;
23565
+ _activeChannelId3 = _context9.v;
23516
23566
  if (!(_activeChannelId3 === updatedChannel.id)) {
23517
- _context8.n = 67;
23567
+ _context9.n = 67;
23518
23568
  break;
23519
23569
  }
23520
- _context8.n = 67;
23570
+ _context9.n = 67;
23521
23571
  return put(setActiveChannelAC(_extends({}, updatedChannel, {
23522
23572
  metadata: isJSON(metadata) ? JSON.parse(metadata) : metadata
23523
23573
  })));
23524
23574
  case 67:
23525
23575
  _groupName3 = getChannelGroupName(updatedChannel);
23526
- _context8.n = 68;
23576
+ _context9.n = 68;
23527
23577
  return put(updateSearchedChannelDataAC(updatedChannel.id, {
23528
23578
  subject: subject,
23529
23579
  avatarUrl: avatarUrl,
@@ -23538,67 +23588,67 @@ function watchForEvents() {
23538
23588
  mutedTill: mutedTill,
23539
23589
  metadata: isJSON(metadata) ? JSON.parse(metadata) : metadata
23540
23590
  });
23541
- return _context8.a(3, 175);
23591
+ return _context9.a(3, 174);
23542
23592
  case 69:
23543
- _context8.n = 70;
23593
+ _context9.n = 70;
23544
23594
  return call(handleChannelMessageEvent, args, SceytChatClient);
23545
23595
  case 70:
23546
- return _context8.a(3, 175);
23596
+ return _context9.a(3, 174);
23547
23597
  case 71:
23548
- _context8.n = 72;
23598
+ _context9.n = 72;
23549
23599
  return call(handleMessageMarkersReceivedEvent, args, SceytChatClient);
23550
23600
  case 72:
23551
- return _context8.a(3, 175);
23601
+ return _context9.a(3, 174);
23552
23602
  case 73:
23553
23603
  channelId = args.channelId;
23554
23604
  log.info('channel DELETE ... ');
23555
23605
  _channel5 = getChannelFromMap(channelId);
23556
- _context8.n = 74;
23606
+ _context9.n = 74;
23557
23607
  return put(setChannelToRemoveAC(_channel5));
23558
23608
  case 74:
23559
23609
  deleteChannelFromAllChannels(channelId);
23560
- return _context8.a(3, 175);
23610
+ return _context9.a(3, 174);
23561
23611
  case 75:
23562
23612
  log.info('channel DELETE_MESSAGE ... ');
23563
- _context8.n = 76;
23613
+ _context9.n = 76;
23564
23614
  return call(handleDeleteMessageEvent, args);
23565
23615
  case 76:
23566
- return _context8.a(3, 175);
23616
+ return _context9.a(3, 174);
23567
23617
  case 77:
23568
- _context8.n = 78;
23618
+ _context9.n = 78;
23569
23619
  return call(handleEditMessageEvent, args);
23570
23620
  case 78:
23571
- return _context8.a(3, 175);
23621
+ return _context9.a(3, 174);
23572
23622
  case 79:
23573
23623
  _channel6 = args.channel, user = args.user, message = args.message, reaction = args.reaction;
23574
23624
  isSelf = user.id === SceytChatClient.user.id;
23575
- _context8.n = 80;
23625
+ _context9.n = 80;
23576
23626
  return call(getActiveChannelId);
23577
23627
  case 80:
23578
- _activeChannelId4 = _context8.v;
23628
+ _activeChannelId4 = _context9.v;
23579
23629
  if (!(_channel6.id === _activeChannelId4)) {
23580
- _context8.n = 81;
23630
+ _context9.n = 81;
23581
23631
  break;
23582
23632
  }
23583
- _context8.n = 81;
23633
+ _context9.n = 81;
23584
23634
  return put(addReactionToMessageAC(message, reaction, isSelf));
23585
23635
  case 81:
23586
23636
  if (!(message.user.id === SceytChatClient.user.id)) {
23587
- _context8.n = 85;
23637
+ _context9.n = 85;
23588
23638
  break;
23589
23639
  }
23590
23640
  if (!(!isSelf && Notification.permission === 'granted')) {
23591
- _context8.n = 83;
23641
+ _context9.n = 83;
23592
23642
  break;
23593
23643
  }
23594
23644
  if (!(document.visibilityState !== 'visible' || _channel6.id !== _activeChannelId4)) {
23595
- _context8.n = 83;
23645
+ _context9.n = 83;
23596
23646
  break;
23597
23647
  }
23598
- _context8.n = 82;
23648
+ _context9.n = 82;
23599
23649
  return select(contactsMapSelector);
23600
23650
  case 82:
23601
- contactsMap = _context8.v;
23651
+ contactsMap = _context9.v;
23602
23652
  _getFromContacts = getShowOnlyContactUsers();
23603
23653
  state = store.getState();
23604
23654
  theme = state.ThemeReducer.theme || 'light';
@@ -23619,7 +23669,7 @@ function watchForEvents() {
23619
23669
  }) : undefined);
23620
23670
  case 83:
23621
23671
  if (!(_channel6.newReactions && _channel6.newReactions.length)) {
23622
- _context8.n = 84;
23672
+ _context9.n = 84;
23623
23673
  break;
23624
23674
  }
23625
23675
  channelUpdateParams = {
@@ -23629,7 +23679,7 @@ function watchForEvents() {
23629
23679
  muted: _channel6.muted,
23630
23680
  mutedTill: _channel6.mutedTill
23631
23681
  };
23632
- _context8.n = 84;
23682
+ _context9.n = 84;
23633
23683
  return put(updateChannelDataAC(_channel6.id, channelUpdateParams));
23634
23684
  case 84:
23635
23685
  updateChannelOnAllChannels(_channel6.id, {
@@ -23643,15 +23693,15 @@ function watchForEvents() {
23643
23693
  if (checkChannelExistsOnMessagesMap(_channel6.id)) {
23644
23694
  addReactionToMessageOnMap(_channel6.id, message, reaction, true);
23645
23695
  }
23646
- return _context8.a(3, 175);
23696
+ return _context9.a(3, 174);
23647
23697
  case 86:
23648
23698
  log.info('CHANNEL_EVENT_TYPES.POLL_ADDED ... ');
23649
23699
  _channel7 = args.channel, pollDetails = args.pollDetails, messageId = args.messageId;
23650
23700
  pollDetailsData = pollDetails;
23651
- _context8.n = 87;
23701
+ _context9.n = 87;
23652
23702
  return call(getActiveChannelId);
23653
23703
  case 87:
23654
- _activeChannelId5 = _context8.v;
23704
+ _activeChannelId5 = _context9.v;
23655
23705
  addedVotes = (pollDetailsData === null || pollDetailsData === void 0 ? void 0 : (_pollDetailsData$chan = pollDetailsData.changedVotes) === null || _pollDetailsData$chan === void 0 ? void 0 : _pollDetailsData$chan.addedVotes) || [];
23656
23706
  deletedVotes = (pollDetailsData === null || pollDetailsData === void 0 ? void 0 : (_pollDetailsData$chan2 = pollDetailsData.changedVotes) === null || _pollDetailsData$chan2 === void 0 ? void 0 : _pollDetailsData$chan2.removedVotes) || [];
23657
23707
  objs = [];
@@ -23672,37 +23722,37 @@ function watchForEvents() {
23672
23722
  _i = 0, _objs = objs;
23673
23723
  case 88:
23674
23724
  if (!(_i < _objs.length)) {
23675
- _context8.n = 92;
23725
+ _context9.n = 92;
23676
23726
  break;
23677
23727
  }
23678
23728
  obj = _objs[_i];
23679
23729
  if (!(pollDetailsData !== null && pollDetailsData !== void 0 && pollDetailsData.id && obj.vote)) {
23680
- _context8.n = 91;
23730
+ _context9.n = 91;
23681
23731
  break;
23682
23732
  }
23683
23733
  key = pollDetailsData.id + "_" + obj.vote.optionId;
23684
23734
  hasNext = ((_store$getState$Messa3 = store.getState().MessageReducer.pollVotesHasMore) === null || _store$getState$Messa3 === void 0 ? void 0 : _store$getState$Messa3[key]) || false;
23685
23735
  if (!(obj.type === 'addOwn')) {
23686
- _context8.n = 90;
23736
+ _context9.n = 90;
23687
23737
  break;
23688
23738
  }
23689
- _context8.n = 89;
23739
+ _context9.n = 89;
23690
23740
  return put(addPollVotesToListAC(pollDetailsData.id, obj.vote.optionId, [obj.vote], hasNext, undefined));
23691
23741
  case 89:
23692
- _context8.n = 91;
23742
+ _context9.n = 91;
23693
23743
  break;
23694
23744
  case 90:
23695
- _context8.n = 91;
23745
+ _context9.n = 91;
23696
23746
  return put(deletePollVotesFromListAC(pollDetailsData.id, obj.vote.optionId, [obj.vote], messageId));
23697
23747
  case 91:
23698
23748
  _i++;
23699
- _context8.n = 88;
23749
+ _context9.n = 88;
23700
23750
  break;
23701
23751
  case 92:
23702
23752
  _i2 = 0, _objs2 = objs;
23703
23753
  case 93:
23704
23754
  if (!(_i2 < _objs2.length)) {
23705
- _context8.n = 95;
23755
+ _context9.n = 95;
23706
23756
  break;
23707
23757
  }
23708
23758
  _obj = _objs2[_i2];
@@ -23714,25 +23764,25 @@ function watchForEvents() {
23714
23764
  vote: _obj.vote
23715
23765
  });
23716
23766
  if (!(_channel7.id === _activeChannelId5)) {
23717
- _context8.n = 94;
23767
+ _context9.n = 94;
23718
23768
  break;
23719
23769
  }
23720
- _context8.n = 94;
23770
+ _context9.n = 94;
23721
23771
  return put(updateMessageAC(messageId, {}, undefined, _obj));
23722
23772
  case 94:
23723
23773
  _i2++;
23724
- _context8.n = 93;
23774
+ _context9.n = 93;
23725
23775
  break;
23726
23776
  case 95:
23727
- return _context8.a(3, 175);
23777
+ return _context9.a(3, 174);
23728
23778
  case 96:
23729
23779
  log.info('CHANNEL_EVENT_TYPES.POLL_DELETED ... ');
23730
23780
  _channel8 = args.channel, _pollDetails = args.pollDetails, _messageId = args.messageId;
23731
23781
  _pollDetailsData = _pollDetails;
23732
- _context8.n = 97;
23782
+ _context9.n = 97;
23733
23783
  return call(getActiveChannelId);
23734
23784
  case 97:
23735
- _activeChannelId6 = _context8.v;
23785
+ _activeChannelId6 = _context9.v;
23736
23786
  _deletedVotes = (_pollDetailsData === null || _pollDetailsData === void 0 ? void 0 : (_pollDetailsData$chan3 = _pollDetailsData.changedVotes) === null || _pollDetailsData$chan3 === void 0 ? void 0 : _pollDetailsData$chan3.removedVotes) || [];
23737
23787
  _objs3 = [];
23738
23788
  for (_iterator6 = _createForOfIteratorHelperLoose(_deletedVotes); !(_step6 = _iterator6()).done;) {
@@ -23745,25 +23795,25 @@ function watchForEvents() {
23745
23795
  _i3 = 0, _objs4 = _objs3;
23746
23796
  case 98:
23747
23797
  if (!(_i3 < _objs4.length)) {
23748
- _context8.n = 100;
23798
+ _context9.n = 100;
23749
23799
  break;
23750
23800
  }
23751
23801
  _obj2 = _objs4[_i3];
23752
23802
  if (!(_pollDetailsData !== null && _pollDetailsData !== void 0 && _pollDetailsData.id && _obj2.vote)) {
23753
- _context8.n = 99;
23803
+ _context9.n = 99;
23754
23804
  break;
23755
23805
  }
23756
- _context8.n = 99;
23806
+ _context9.n = 99;
23757
23807
  return put(deletePollVotesFromListAC(_pollDetailsData.id, _obj2.vote.optionId, [_obj2.vote], _messageId));
23758
23808
  case 99:
23759
23809
  _i3++;
23760
- _context8.n = 98;
23810
+ _context9.n = 98;
23761
23811
  break;
23762
23812
  case 100:
23763
23813
  _i4 = 0, _objs5 = _objs3;
23764
23814
  case 101:
23765
23815
  if (!(_i4 < _objs5.length)) {
23766
- _context8.n = 103;
23816
+ _context9.n = 103;
23767
23817
  break;
23768
23818
  }
23769
23819
  _obj3 = _objs5[_i4];
@@ -23772,24 +23822,24 @@ function watchForEvents() {
23772
23822
  params: {}
23773
23823
  }, _obj3);
23774
23824
  if (!(_channel8.id === _activeChannelId6)) {
23775
- _context8.n = 102;
23825
+ _context9.n = 102;
23776
23826
  break;
23777
23827
  }
23778
- _context8.n = 102;
23828
+ _context9.n = 102;
23779
23829
  return put(updateMessageAC(_messageId, {}, undefined, _obj3));
23780
23830
  case 102:
23781
23831
  _i4++;
23782
- _context8.n = 101;
23832
+ _context9.n = 101;
23783
23833
  break;
23784
23834
  case 103:
23785
- return _context8.a(3, 175);
23835
+ return _context9.a(3, 174);
23786
23836
  case 104:
23787
23837
  log.info('CHANNEL_EVENT_TYPES.POLL_RETRACTED ... ');
23788
23838
  _channel9 = args.channel, _pollDetails2 = args.pollDetails, _messageId2 = args.messageId;
23789
- _context8.n = 105;
23839
+ _context9.n = 105;
23790
23840
  return call(getActiveChannelId);
23791
23841
  case 105:
23792
- _activeChannelId7 = _context8.v;
23842
+ _activeChannelId7 = _context9.v;
23793
23843
  _pollDetailsData2 = _pollDetails2;
23794
23844
  retractedVotes = (_pollDetailsData2 === null || _pollDetailsData2 === void 0 ? void 0 : (_pollDetailsData2$cha = _pollDetailsData2.changedVotes) === null || _pollDetailsData2$cha === void 0 ? void 0 : _pollDetailsData2$cha.removedVotes) || [];
23795
23845
  _objs6 = [];
@@ -23803,7 +23853,7 @@ function watchForEvents() {
23803
23853
  _i5 = 0, _objs7 = _objs6;
23804
23854
  case 106:
23805
23855
  if (!(_i5 < _objs7.length)) {
23806
- _context8.n = 111;
23856
+ _context9.n = 111;
23807
23857
  break;
23808
23858
  }
23809
23859
  _obj4 = _objs7[_i5];
@@ -23812,41 +23862,41 @@ function watchForEvents() {
23812
23862
  params: {}
23813
23863
  }, _obj4);
23814
23864
  if (!(_pollDetailsData2 !== null && _pollDetailsData2 !== void 0 && _pollDetailsData2.id && retractedVotes.length > 0)) {
23815
- _context8.n = 109;
23865
+ _context9.n = 109;
23816
23866
  break;
23817
23867
  }
23818
23868
  _iterator8 = _createForOfIteratorHelperLoose(retractedVotes);
23819
23869
  case 107:
23820
23870
  if ((_step8 = _iterator8()).done) {
23821
- _context8.n = 109;
23871
+ _context9.n = 109;
23822
23872
  break;
23823
23873
  }
23824
23874
  _vote3 = _step8.value;
23825
- _context8.n = 108;
23875
+ _context9.n = 108;
23826
23876
  return put(deletePollVotesFromListAC(_pollDetailsData2.id, _vote3.optionId, [_vote3], _messageId2));
23827
23877
  case 108:
23828
- _context8.n = 107;
23878
+ _context9.n = 107;
23829
23879
  break;
23830
23880
  case 109:
23831
23881
  if (!(_channel9.id === _activeChannelId7)) {
23832
- _context8.n = 110;
23882
+ _context9.n = 110;
23833
23883
  break;
23834
23884
  }
23835
- _context8.n = 110;
23885
+ _context9.n = 110;
23836
23886
  return put(updateMessageAC(_messageId2, {}, undefined, _obj4));
23837
23887
  case 110:
23838
23888
  _i5++;
23839
- _context8.n = 106;
23889
+ _context9.n = 106;
23840
23890
  break;
23841
23891
  case 111:
23842
- return _context8.a(3, 175);
23892
+ return _context9.a(3, 174);
23843
23893
  case 112:
23844
23894
  log.info('CHANNEL_EVENT_TYPES.POLL_CLOSED ... ');
23845
23895
  _channel0 = args.channel, _messageId3 = args.messageId;
23846
- _context8.n = 113;
23896
+ _context9.n = 113;
23847
23897
  return call(getActiveChannelId);
23848
23898
  case 113:
23849
- _activeChannelId8 = _context8.v;
23899
+ _activeChannelId8 = _context9.v;
23850
23900
  _obj5 = {
23851
23901
  type: 'close'
23852
23902
  };
@@ -23855,74 +23905,74 @@ function watchForEvents() {
23855
23905
  params: {}
23856
23906
  }, _obj5);
23857
23907
  if (!(_channel0.id === _activeChannelId8)) {
23858
- _context8.n = 115;
23908
+ _context9.n = 115;
23859
23909
  break;
23860
23910
  }
23861
- _context8.n = 114;
23911
+ _context9.n = 114;
23862
23912
  return put(updateMessageAC(_messageId3, {}, undefined, _obj5));
23863
23913
  case 114:
23864
- return _context8.a(3, 175);
23914
+ return _context9.a(3, 174);
23865
23915
  case 115:
23866
- return _context8.a(3, 175);
23916
+ return _context9.a(3, 174);
23867
23917
  case 116:
23868
23918
  _channel1 = args.channel, _user = args.user, _message = args.message, _reaction = args.reaction;
23869
23919
  log.info('channel REACTION_DELETED ... ', _channel1);
23870
23920
  channelFromMap = getChannelFromMap(_channel1.id);
23871
23921
  _isSelf = _user.id === SceytChatClient.user.id;
23872
- _context8.n = 117;
23922
+ _context9.n = 117;
23873
23923
  return call(getActiveChannelId);
23874
23924
  case 117:
23875
- _activeChannelId9 = _context8.v;
23925
+ _activeChannelId9 = _context9.v;
23876
23926
  if (!(_channel1.id === _activeChannelId9)) {
23877
- _context8.n = 118;
23927
+ _context9.n = 118;
23878
23928
  break;
23879
23929
  }
23880
- _context8.n = 118;
23930
+ _context9.n = 118;
23881
23931
  return put(deleteReactionFromMessageAC(_message, _reaction, _isSelf));
23882
23932
  case 118:
23883
23933
  _channelUpdateParams = JSON.parse(JSON.stringify(_channel1));
23884
23934
  if (channelFromMap && channelFromMap.lastReactedMessage && channelFromMap.lastReactedMessage.id === _message.id) {
23885
23935
  _channelUpdateParams.lastReactedMessage = null;
23886
23936
  }
23887
- _context8.n = 119;
23937
+ _context9.n = 119;
23888
23938
  return put(updateChannelDataAC(_channel1.id, _channelUpdateParams));
23889
23939
  case 119:
23890
23940
  updateChannelOnAllChannels(_channel1.id, _channelUpdateParams);
23891
23941
  if (checkChannelExistsOnMessagesMap(_channel1.id)) {
23892
23942
  removeReactionToMessageOnMap(_channel1.id, _message, _reaction, true);
23893
23943
  }
23894
- return _context8.a(3, 175);
23944
+ return _context9.a(3, 174);
23895
23945
  case 120:
23896
- _context8.n = 121;
23946
+ _context9.n = 121;
23897
23947
  return call(handleUnreadMessagesInfoEvent, args);
23898
23948
  case 121:
23899
- return _context8.a(3, 175);
23949
+ return _context9.a(3, 174);
23900
23950
  case 122:
23901
23951
  _channel10 = args.channel;
23902
23952
  log.info('CLEAR_HISTORY: ', _channel10);
23903
- _context8.n = 123;
23953
+ _context9.n = 123;
23904
23954
  return call(getActiveChannelId);
23905
23955
  case 123:
23906
- _activeChannelId0 = _context8.v;
23907
- _context8.n = 124;
23956
+ _activeChannelId0 = _context9.v;
23957
+ _context9.n = 124;
23908
23958
  return call(checkChannelExists, _channel10.id);
23909
23959
  case 124:
23910
- channelExist = _context8.v;
23960
+ channelExist = _context9.v;
23911
23961
  if (!(_channel10.id === _activeChannelId0)) {
23912
- _context8.n = 126;
23962
+ _context9.n = 126;
23913
23963
  break;
23914
23964
  }
23915
- _context8.n = 125;
23965
+ _context9.n = 125;
23916
23966
  return put(clearMessagesAC());
23917
23967
  case 125:
23918
23968
  removeAllMessages();
23919
23969
  case 126:
23920
23970
  removeMessagesFromMap(_channel10.id);
23921
23971
  if (!channelExist) {
23922
- _context8.n = 127;
23972
+ _context9.n = 127;
23923
23973
  break;
23924
23974
  }
23925
- _context8.n = 127;
23975
+ _context9.n = 127;
23926
23976
  return put(updateChannelDataAC(_channel10.id, {
23927
23977
  lastMessage: null,
23928
23978
  newMessageCount: 0,
@@ -23938,11 +23988,11 @@ function watchForEvents() {
23938
23988
  muted: _channel10.muted,
23939
23989
  mutedTill: _channel10.mutedTill
23940
23990
  });
23941
- return _context8.a(3, 175);
23991
+ return _context9.a(3, 174);
23942
23992
  case 128:
23943
23993
  _channel11 = args.channel;
23944
23994
  log.info('channel MUTE ... ');
23945
- _context8.n = 129;
23995
+ _context9.n = 129;
23946
23996
  return put(updateChannelDataAC(_channel11.id, {
23947
23997
  muted: _channel11.muted,
23948
23998
  mutedTill: _channel11.mutedTill
@@ -23952,11 +24002,11 @@ function watchForEvents() {
23952
24002
  muted: _channel11.muted,
23953
24003
  mutedTill: _channel11.mutedTill
23954
24004
  });
23955
- return _context8.a(3, 175);
24005
+ return _context9.a(3, 174);
23956
24006
  case 130:
23957
24007
  _channel12 = args.channel;
23958
24008
  log.info('channel UNMUTE ... ');
23959
- _context8.n = 131;
24009
+ _context9.n = 131;
23960
24010
  return put(updateChannelDataAC(_channel12.id, {
23961
24011
  muted: _channel12.muted,
23962
24012
  mutedTill: _channel12.mutedTill
@@ -23966,11 +24016,11 @@ function watchForEvents() {
23966
24016
  muted: _channel12.muted,
23967
24017
  mutedTill: _channel12.mutedTill
23968
24018
  });
23969
- return _context8.a(3, 175);
24019
+ return _context9.a(3, 174);
23970
24020
  case 132:
23971
24021
  _channel13 = args.channel;
23972
24022
  log.info('channel PINED ... ');
23973
- _context8.n = 133;
24023
+ _context9.n = 133;
23974
24024
  return put(updateChannelDataAC(_channel13.id, {
23975
24025
  pinnedAt: _channel13.pinnedAt
23976
24026
  }, true));
@@ -23978,11 +24028,11 @@ function watchForEvents() {
23978
24028
  updateChannelOnAllChannels(_channel13.id, {
23979
24029
  pinnedAt: _channel13.pinnedAt
23980
24030
  });
23981
- return _context8.a(3, 175);
24031
+ return _context9.a(3, 174);
23982
24032
  case 134:
23983
24033
  _channel14 = args.channel;
23984
24034
  log.info('channel UNPINED ... ');
23985
- _context8.n = 135;
24035
+ _context9.n = 135;
23986
24036
  return put(updateChannelDataAC(_channel14.id, {
23987
24037
  pinnedAt: _channel14.pinnedAt
23988
24038
  }, false, true));
@@ -23990,39 +24040,39 @@ function watchForEvents() {
23990
24040
  updateChannelOnAllChannels(_channel14.id, {
23991
24041
  pinnedAt: _channel14.pinnedAt
23992
24042
  });
23993
- return _context8.a(3, 175);
24043
+ return _context9.a(3, 174);
23994
24044
  case 136:
23995
24045
  _channel15 = args.channel;
23996
24046
  log.info('channel HIDE ... ');
23997
- _context8.n = 137;
24047
+ _context9.n = 137;
23998
24048
  return put(setChannelToHideAC(_channel15));
23999
24049
  case 137:
24000
- _context8.n = 138;
24050
+ _context9.n = 138;
24001
24051
  return call(getActiveChannelId);
24002
24052
  case 138:
24003
- _activeChannelId1 = _context8.v;
24053
+ _activeChannelId1 = _context9.v;
24004
24054
  if (!(_activeChannelId1 === _channel15.id)) {
24005
- _context8.n = 140;
24055
+ _context9.n = 140;
24006
24056
  break;
24007
24057
  }
24008
- _context8.n = 139;
24058
+ _context9.n = 139;
24009
24059
  return call(getLastChannelFromMap, true);
24010
24060
  case 139:
24011
- lastChannel = _context8.v;
24012
- _context8.n = 140;
24061
+ lastChannel = _context9.v;
24062
+ _context9.n = 140;
24013
24063
  return put(switchChannelActionAC(lastChannel || null));
24014
24064
  case 140:
24015
- return _context8.a(3, 175);
24065
+ return _context9.a(3, 174);
24016
24066
  case 141:
24017
24067
  _channel16 = args.channel;
24018
24068
  log.info('channel UNHIDE ... ');
24019
- _context8.n = 142;
24069
+ _context9.n = 142;
24020
24070
  return put(setChannelToUnHideAC(_channel16));
24021
24071
  case 142:
24022
- return _context8.a(3, 175);
24072
+ return _context9.a(3, 174);
24023
24073
  case 143:
24024
24074
  _channel17 = args.channel;
24025
- _context8.n = 144;
24075
+ _context9.n = 144;
24026
24076
  return put(updateChannelDataAC(_channel17.id, {
24027
24077
  unread: _channel17.unread,
24028
24078
  muted: _channel17.muted,
@@ -24030,7 +24080,7 @@ function watchForEvents() {
24030
24080
  }));
24031
24081
  case 144:
24032
24082
  _groupName4 = getChannelGroupName(_channel17);
24033
- _context8.n = 145;
24083
+ _context9.n = 145;
24034
24084
  return put(updateSearchedChannelDataAC(_channel17.id, {
24035
24085
  unread: _channel17.unread
24036
24086
  }, _groupName4));
@@ -24038,104 +24088,90 @@ function watchForEvents() {
24038
24088
  updateChannelOnAllChannels(_channel17.id, {
24039
24089
  unread: _channel17.unread
24040
24090
  });
24041
- return _context8.a(3, 175);
24091
+ return _context9.a(3, 174);
24042
24092
  case 146:
24043
- _channel18 = args.channel;
24044
- _context8.n = 147;
24045
- return put(updateChannelDataAC(_channel18.id, {
24046
- unread: _channel18.unread,
24047
- muted: _channel18.muted,
24048
- mutedTill: _channel18.mutedTill
24049
- }));
24093
+ _context9.n = 147;
24094
+ return call(handleChannelMarkedAsReadEvent, args);
24050
24095
  case 147:
24051
- _groupName5 = getChannelGroupName(_channel18);
24052
- _context8.n = 148;
24053
- return put(updateSearchedChannelDataAC(_channel18.id, {
24054
- unread: _channel18.unread
24055
- }, _groupName5));
24096
+ return _context9.a(3, 174);
24056
24097
  case 148:
24057
- updateChannelOnAllChannels(_channel18.id, {
24058
- unread: _channel18.unread
24059
- });
24060
- return _context8.a(3, 175);
24061
- case 149:
24062
- _channel19 = args.channel, members = args.members;
24063
- log.info('channel CHANGE_ROLE channel ... ', _channel19);
24098
+ _channel18 = args.channel, members = args.members;
24099
+ log.info('channel CHANGE_ROLE channel ... ', _channel18);
24064
24100
  log.info('channel CHANGE_ROLE member ... ', members);
24065
- _context8.n = 150;
24101
+ _context9.n = 149;
24066
24102
  return call(getActiveChannelId);
24067
- case 150:
24068
- _activeChannelId10 = _context8.v;
24069
- if (!(_channel19.id === _activeChannelId10)) {
24070
- _context8.n = 154;
24103
+ case 149:
24104
+ _activeChannelId10 = _context9.v;
24105
+ if (!(_channel18.id === _activeChannelId10)) {
24106
+ _context9.n = 153;
24071
24107
  break;
24072
24108
  }
24073
24109
  _customLoadMembersFunctions2 = getCustomLoadMembersFunctions();
24074
24110
  updateMembersEvent = _customLoadMembersFunctions2 === null || _customLoadMembersFunctions2 === void 0 ? void 0 : _customLoadMembersFunctions2.updateMembersEvent;
24075
24111
  if (!updateMembersEvent) {
24076
- _context8.n = 153;
24112
+ _context9.n = 152;
24077
24113
  break;
24078
24114
  }
24079
- _context8.n = 151;
24080
- return call(updateMembersEvent, _channel19.id, members, store.getState().MembersReducer.channelsMembersMap[_channel19.id] || []);
24115
+ _context9.n = 150;
24116
+ return call(updateMembersEvent, _channel18.id, members, store.getState().MembersReducer.channelsMembersMap[_channel18.id] || []);
24117
+ case 150:
24118
+ _membersList2 = _context9.v;
24119
+ _context9.n = 151;
24120
+ return put(setMembersToListAC(_membersList2, _channel18.id));
24081
24121
  case 151:
24082
- _membersList2 = _context8.v;
24083
- _context8.n = 152;
24084
- return put(setMembersToListAC(_membersList2, _channel19.id));
24085
- case 152:
24086
- _context8.n = 154;
24122
+ _context9.n = 153;
24087
24123
  break;
24124
+ case 152:
24125
+ _context9.n = 153;
24126
+ return put(updateMembersAC(members, _channel18.id));
24088
24127
  case 153:
24089
- _context8.n = 154;
24090
- return put(updateMembersAC(members, _channel19.id));
24091
- case 154:
24092
24128
  i = 0;
24093
- case 155:
24129
+ case 154:
24094
24130
  if (!(i < members.length)) {
24095
- _context8.n = 158;
24131
+ _context9.n = 157;
24096
24132
  break;
24097
24133
  }
24098
24134
  if (!(members[i].id === SceytChatClient.user.id)) {
24099
- _context8.n = 157;
24135
+ _context9.n = 156;
24100
24136
  break;
24101
24137
  }
24102
- _context8.n = 156;
24103
- return put(updateChannelDataAC(_channel19.id, {
24138
+ _context9.n = 155;
24139
+ return put(updateChannelDataAC(_channel18.id, {
24104
24140
  userRole: members[i].role,
24105
- muted: _channel19.muted,
24106
- mutedTill: _channel19.mutedTill
24141
+ muted: _channel18.muted,
24142
+ mutedTill: _channel18.mutedTill
24107
24143
  }));
24108
- case 156:
24109
- updateChannelOnAllChannels(_channel19.id, {
24144
+ case 155:
24145
+ updateChannelOnAllChannels(_channel18.id, {
24110
24146
  userRole: members[i].role,
24111
- muted: _channel19.muted,
24112
- mutedTill: _channel19.mutedTill
24147
+ muted: _channel18.muted,
24148
+ mutedTill: _channel18.mutedTill
24113
24149
  });
24114
- case 157:
24150
+ case 156:
24115
24151
  i++;
24116
- _context8.n = 155;
24152
+ _context9.n = 154;
24117
24153
  break;
24154
+ case 157:
24155
+ return _context9.a(3, 174);
24118
24156
  case 158:
24119
- return _context8.a(3, 175);
24157
+ _channel19 = args.channel;
24158
+ log.info('channel frozen channel ... ', _channel19);
24159
+ return _context9.a(3, 174);
24120
24160
  case 159:
24121
24161
  _channel20 = args.channel;
24122
- log.info('channel frozen channel ... ', _channel20);
24123
- return _context8.a(3, 175);
24162
+ log.info('channel unfrozen channel ... ', _channel20);
24163
+ return _context9.a(3, 174);
24124
24164
  case 160:
24125
- _channel21 = args.channel;
24126
- log.info('channel unfrozen channel ... ', _channel21);
24127
- return _context8.a(3, 175);
24128
- case 161:
24129
24165
  _channelId = args.channelId, from = args.from, name = args.name;
24130
24166
  log.info('channel event received >>>... . . . . . ', args);
24131
24167
  if (!(from.id === SceytChatClient.user.id)) {
24132
- _context8.n = 162;
24168
+ _context9.n = 161;
24133
24169
  break;
24134
24170
  }
24135
- return _context8.a(3, 175);
24136
- case 162:
24171
+ return _context9.a(3, 174);
24172
+ case 161:
24137
24173
  if (!(name === 'start_typing')) {
24138
- _context8.n = 164;
24174
+ _context9.n = 163;
24139
24175
  break;
24140
24176
  }
24141
24177
  if (!usersTimeout.typingTimeout[_channelId]) {
@@ -24147,27 +24183,27 @@ function watchForEvents() {
24147
24183
  usersTimeout.typingTimeout[_channelId][from.id] = setTimeout(function () {
24148
24184
  channelListener.onReceivedChannelEvent(_channelId, from, 'stop_typing');
24149
24185
  }, 5000);
24150
- _context8.n = 163;
24186
+ _context9.n = 162;
24151
24187
  return put(switchTypingIndicatorAC(true, _channelId, from));
24152
- case 163:
24153
- _context8.n = 169;
24188
+ case 162:
24189
+ _context9.n = 168;
24154
24190
  break;
24155
- case 164:
24191
+ case 163:
24156
24192
  if (!(name === 'stop_typing')) {
24157
- _context8.n = 166;
24193
+ _context9.n = 165;
24158
24194
  break;
24159
24195
  }
24160
24196
  if (usersTimeout.typingTimeout[_channelId] && usersTimeout.typingTimeout[_channelId][from.id]) {
24161
24197
  clearTimeout(usersTimeout.typingTimeout[_channelId][from.id]);
24162
24198
  }
24163
- _context8.n = 165;
24199
+ _context9.n = 164;
24164
24200
  return put(switchTypingIndicatorAC(false, _channelId, from));
24165
- case 165:
24166
- _context8.n = 169;
24201
+ case 164:
24202
+ _context9.n = 168;
24167
24203
  break;
24168
- case 166:
24204
+ case 165:
24169
24205
  if (!(name === 'start_recording')) {
24170
- _context8.n = 168;
24206
+ _context9.n = 167;
24171
24207
  break;
24172
24208
  }
24173
24209
  if (!usersTimeout.recordingTimeout[_channelId]) {
@@ -24179,63 +24215,63 @@ function watchForEvents() {
24179
24215
  usersTimeout.recordingTimeout[_channelId][from.id] = setTimeout(function () {
24180
24216
  channelListener.onReceivedChannelEvent(_channelId, from, 'stop_recording');
24181
24217
  }, 5000);
24182
- _context8.n = 167;
24218
+ _context9.n = 166;
24183
24219
  return put(switchRecordingIndicatorAC(true, _channelId, from));
24184
- case 167:
24185
- _context8.n = 169;
24220
+ case 166:
24221
+ _context9.n = 168;
24186
24222
  break;
24187
- case 168:
24223
+ case 167:
24188
24224
  if (!(name === 'stop_recording')) {
24189
- _context8.n = 169;
24225
+ _context9.n = 168;
24190
24226
  break;
24191
24227
  }
24192
24228
  if (usersTimeout.recordingTimeout[_channelId] && usersTimeout.recordingTimeout[_channelId][from.id]) {
24193
24229
  clearTimeout(usersTimeout.recordingTimeout[_channelId][from.id]);
24194
24230
  }
24195
- _context8.n = 169;
24231
+ _context9.n = 168;
24196
24232
  return put(switchRecordingIndicatorAC(false, _channelId, from));
24233
+ case 168:
24234
+ return _context9.a(3, 174);
24197
24235
  case 169:
24198
- return _context8.a(3, 175);
24199
- case 170:
24200
24236
  status = args.status;
24201
24237
  log.info('connection status changed . . . . . ', status);
24202
- _context8.n = 171;
24238
+ _context9.n = 170;
24203
24239
  return put(setConnectionStatusAC(status));
24204
- case 171:
24240
+ case 170:
24205
24241
  if (!(status === CONNECTION_STATUS.CONNECTED)) {
24206
- _context8.n = 173;
24242
+ _context9.n = 172;
24207
24243
  break;
24208
24244
  }
24209
- _context8.n = 172;
24245
+ _context9.n = 171;
24210
24246
  return put(getRolesAC());
24211
- case 172:
24212
- _context8.n = 173;
24247
+ case 171:
24248
+ _context9.n = 172;
24213
24249
  return put(resendPendingMessageMutationsAC(status));
24250
+ case 172:
24251
+ return _context9.a(3, 174);
24214
24252
  case 173:
24215
- return _context8.a(3, 175);
24216
- case 174:
24217
24253
  log.warn('UNHANDLED EVENT FROM REDUX-SAGA EVENT-CHANNEL');
24218
- case 175:
24219
- _context8.n = 177;
24254
+ case 174:
24255
+ _context9.n = 176;
24220
24256
  break;
24221
- case 176:
24222
- _context8.p = 176;
24223
- _t4 = _context8.v;
24257
+ case 175:
24258
+ _context9.p = 175;
24259
+ _t4 = _context9.v;
24224
24260
  log.error('Error in watchForEvents:', _t4);
24225
- case 177:
24226
- return _context8.a(2);
24261
+ case 176:
24262
+ return _context9.a(2);
24227
24263
  }
24228
- }, _callee3, null, [[0, 176]]);
24264
+ }, _callee3, null, [[0, 175]]);
24229
24265
  });
24230
24266
  case 1:
24231
- return _context9.d(_regeneratorValues(_loop()), 2);
24267
+ return _context0.d(_regeneratorValues(_loop()), 2);
24232
24268
  case 2:
24233
- _context9.n = 1;
24269
+ _context0.n = 1;
24234
24270
  break;
24235
24271
  case 3:
24236
- return _context9.a(2);
24272
+ return _context0.a(2);
24237
24273
  }
24238
- }, _marked6$1);
24274
+ }, _marked7$1);
24239
24275
  }
24240
24276
 
24241
24277
  var _marked$3 = /*#__PURE__*/_regenerator().m(createChannel),
@@ -24244,7 +24280,7 @@ var _marked$3 = /*#__PURE__*/_regenerator().m(createChannel),
24244
24280
  _marked4$2 = /*#__PURE__*/_regenerator().m(getChannelsForForward),
24245
24281
  _marked5$2 = /*#__PURE__*/_regenerator().m(searchChannelsForForward),
24246
24282
  _marked6$2 = /*#__PURE__*/_regenerator().m(channelsLoadMore),
24247
- _marked7$1 = /*#__PURE__*/_regenerator().m(getChannelMentions),
24283
+ _marked7$2 = /*#__PURE__*/_regenerator().m(getChannelMentions),
24248
24284
  _marked8$1 = /*#__PURE__*/_regenerator().m(channelsForForwardLoadMore),
24249
24285
  _marked9$1 = /*#__PURE__*/_regenerator().m(markMessagesRead),
24250
24286
  _marked0$1 = /*#__PURE__*/_regenerator().m(markVoiceMessageAsPlayed),
@@ -24281,6 +24317,34 @@ var _marked$3 = /*#__PURE__*/_regenerator().m(createChannel),
24281
24317
  _marked39$1 = /*#__PURE__*/_regenerator().m(getChannelsWithUser),
24282
24318
  _marked40$1 = /*#__PURE__*/_regenerator().m(loadMoreMutualChannels),
24283
24319
  _marked41$1 = /*#__PURE__*/_regenerator().m(ChannelsSaga);
24320
+ var getUniqueMessageIds = function getUniqueMessageIds(messageIds) {
24321
+ if (messageIds === void 0) {
24322
+ messageIds = [];
24323
+ }
24324
+ return Array.from(new Set(messageIds.filter(Boolean)));
24325
+ };
24326
+ var getNewestMessageId = function getNewestMessageId(messageIds) {
24327
+ return getUniqueMessageIds(messageIds).reduce(function (latestMessageId, messageId) {
24328
+ return compareMessageIds(messageId, latestMessageId) > 0 ? messageId : latestMessageId;
24329
+ }, '');
24330
+ };
24331
+ var getLatestIncomingConfirmedMessageId = function getLatestIncomingConfirmedMessageId(channel) {
24332
+ var _channel$lastMessage, _channel$lastMessage2;
24333
+ if (!(channel !== null && channel !== void 0 && channel.id)) {
24334
+ return '';
24335
+ }
24336
+ var latestIncomingConfirmedMessageId = (_channel$lastMessage = channel.lastMessage) !== null && _channel$lastMessage !== void 0 && _channel$lastMessage.incoming && (_channel$lastMessage2 = channel.lastMessage) !== null && _channel$lastMessage2 !== void 0 && _channel$lastMessage2.id ? channel.lastMessage.id : '';
24337
+ var cachedMessages = Object.values(getMessagesFromMap(channel.id) || {});
24338
+ cachedMessages.forEach(function (message) {
24339
+ if (message !== null && message !== void 0 && message.incoming && message.id && compareMessageIds(message.id, latestIncomingConfirmedMessageId) > 0) {
24340
+ latestIncomingConfirmedMessageId = message.id;
24341
+ }
24342
+ });
24343
+ return latestIncomingConfirmedMessageId;
24344
+ };
24345
+ var getLatestUnreadBoundaryId = function getLatestUnreadBoundaryId(channel) {
24346
+ return (channel === null || channel === void 0 ? void 0 : channel.lastReceivedMsgId) || getLatestIncomingConfirmedMessageId(channel);
24347
+ };
24284
24348
  function createChannel(action) {
24285
24349
  var payload, channelData, dontCreateIfNotExists, callback, SceytChatClient, createChannelData, fileToUpload, isSelfChannel, channelIsExistOnAllChannels, createdChannel, allChannels, memberId, whoDoesNotAdded, checkChannelExist, messageToSend, _allChannels, _memberId, _t;
24286
24350
  return _regenerator().w(function (_context) {
@@ -25277,7 +25341,7 @@ function getChannelMentions(action) {
25277
25341
  case 5:
25278
25342
  return _context8.a(2);
25279
25343
  }
25280
- }, _marked7$1, null, [[0, 4]]);
25344
+ }, _marked7$2, null, [[0, 4]]);
25281
25345
  }
25282
25346
  function channelsForForwardLoadMore(action) {
25283
25347
  var payload, limit, _SceytChatClient4, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels, _t0;
@@ -25331,17 +25395,19 @@ function channelsForForwardLoadMore(action) {
25331
25395
  }, _marked8$1, null, [[0, 7]]);
25332
25396
  }
25333
25397
  function markMessagesRead(action) {
25334
- var payload, channelId, messageIds, connectionStatus, channel, messageListMarker, _iterator6, _step6, messageId, updateParams, _t1;
25398
+ var payload, channelId, messageIds, connectionStatus, channel, previousLastDisplayedMessageId, latestUnreadBoundaryId, messageListMarker, readMessageIds, nextLastDisplayedMessageId, newlyCoveredUnreadCount, nextNewMessageCount, reachedLatestUnreadBoundary, updateData, _iterator6, _step6, messageId, updateParams, _t1;
25335
25399
  return _regenerator().w(function (_context0) {
25336
25400
  while (1) switch (_context0.p = _context0.n) {
25337
25401
  case 0:
25338
25402
  payload = action.payload;
25339
25403
  channelId = payload.channelId, messageIds = payload.messageIds;
25404
+ log.info("[READ_MESSAGE] saga ch=" + channelId + " ids=[" + messageIds.join(',') + "]");
25340
25405
  connectionStatus = store.getState().UserReducer.connectionStatus;
25341
25406
  if (!(connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
25342
25407
  _context0.n = 1;
25343
25408
  break;
25344
25409
  }
25410
+ log.warn("[READ_MESSAGE] saga skip \u2014 not connected (" + connectionStatus + ")");
25345
25411
  return _context0.a(2);
25346
25412
  case 1:
25347
25413
  _context0.n = 2;
@@ -25356,22 +25422,42 @@ function markMessagesRead(action) {
25356
25422
  }
25357
25423
  }
25358
25424
  if (!channel) {
25359
- _context0.n = 9;
25425
+ _context0.n = 10;
25360
25426
  break;
25361
25427
  }
25428
+ previousLastDisplayedMessageId = channel.lastDisplayedMessageId || '';
25429
+ latestUnreadBoundaryId = getLatestUnreadBoundaryId(channel);
25430
+ log.info("[READ_MESSAGE] calling markMessagesAsDisplayed ch=" + channelId);
25362
25431
  _context0.n = 4;
25363
25432
  return call(channel.markMessagesAsDisplayed, messageIds);
25364
25433
  case 4:
25365
25434
  messageListMarker = _context0.v;
25435
+ readMessageIds = getUniqueMessageIds((messageListMarker === null || messageListMarker === void 0 ? void 0 : messageListMarker.messageIds) || messageIds);
25436
+ nextLastDisplayedMessageId = getNewestMessageId([previousLastDisplayedMessageId].concat(readMessageIds)) || previousLastDisplayedMessageId;
25437
+ newlyCoveredUnreadCount = readMessageIds.filter(function (messageId) {
25438
+ if (compareMessageIds(messageId, previousLastDisplayedMessageId) <= 0) {
25439
+ return false;
25440
+ }
25441
+ return !latestUnreadBoundaryId || compareMessageIds(messageId, latestUnreadBoundaryId) <= 0;
25442
+ }).length;
25443
+ nextNewMessageCount = Math.max(0, (channel.newMessageCount || 0) - newlyCoveredUnreadCount);
25444
+ reachedLatestUnreadBoundary = !!latestUnreadBoundaryId && compareMessageIds(nextLastDisplayedMessageId, latestUnreadBoundaryId) >= 0;
25445
+ updateData = reachedLatestUnreadBoundary || readMessageIds.length > 0 && nextNewMessageCount === 0 ? {
25446
+ lastDisplayedMessageId: nextLastDisplayedMessageId,
25447
+ unread: false,
25448
+ newMessageCount: 0,
25449
+ newMentionCount: 0
25450
+ } : _extends({
25451
+ lastDisplayedMessageId: nextLastDisplayedMessageId
25452
+ }, newlyCoveredUnreadCount > 0 ? {
25453
+ newMessageCount: nextNewMessageCount
25454
+ } : {});
25455
+ log.info("[READ_MESSAGE] marked " + readMessageIds.length + " msgs, newCount=" + nextNewMessageCount);
25366
25456
  _context0.n = 5;
25367
- return put(updateChannelDataAC(channel.id, {
25368
- lastDisplayedMessageId: channel.lastDisplayedMessageId
25369
- }));
25457
+ return put(updateChannelDataAC(channel.id, updateData));
25370
25458
  case 5:
25371
- updateChannelOnAllChannels(channel.id, {
25372
- lastDisplayedMessageId: channel.lastDisplayedMessageId
25373
- });
25374
- _iterator6 = _createForOfIteratorHelperLoose(messageListMarker.messageIds);
25459
+ updateChannelOnAllChannels(channel.id, updateData);
25460
+ _iterator6 = _createForOfIteratorHelperLoose(readMessageIds);
25375
25461
  case 6:
25376
25462
  if ((_step6 = _iterator6()).done) {
25377
25463
  _context0.n = 9;
@@ -25381,8 +25467,8 @@ function markMessagesRead(action) {
25381
25467
  updateParams = {
25382
25468
  deliveryStatus: MESSAGE_DELIVERY_STATUS.READ,
25383
25469
  userMarkers: [{
25384
- user: messageListMarker.user,
25385
- createdAt: messageListMarker.createdAt,
25470
+ user: (messageListMarker === null || messageListMarker === void 0 ? void 0 : messageListMarker.user) || null,
25471
+ createdAt: (messageListMarker === null || messageListMarker === void 0 ? void 0 : messageListMarker.createdAt) || new Date(),
25386
25472
  messageId: messageId,
25387
25473
  name: MESSAGE_DELIVERY_STATUS.READ
25388
25474
  }]
@@ -25401,13 +25487,18 @@ function markMessagesRead(action) {
25401
25487
  _context0.n = 11;
25402
25488
  break;
25403
25489
  case 10:
25404
- _context0.p = 10;
25405
- _t1 = _context0.v;
25406
- log.error(_t1, 'Error on mark messages read');
25490
+ log.warn("[READ_MESSAGE] saga skip \u2014 channel not found ch=" + channelId);
25407
25491
  case 11:
25492
+ _context0.n = 13;
25493
+ break;
25494
+ case 12:
25495
+ _context0.p = 12;
25496
+ _t1 = _context0.v;
25497
+ log.error(_t1, '[READ_MESSAGE] Error on mark messages read');
25498
+ case 13:
25408
25499
  return _context0.a(2);
25409
25500
  }
25410
- }, _marked9$1, null, [[3, 10]]);
25501
+ }, _marked9$1, null, [[3, 12]]);
25411
25502
  }
25412
25503
  function markVoiceMessageAsPlayed(action) {
25413
25504
  var payload, channelId, messageIds, connectionStatus, channel, messageListMarker, _iterator7, _step7, messageId, updateParams, _t10;
@@ -25830,7 +25921,7 @@ function notificationsTurnOn() {
25830
25921
  }, _marked14$1, null, [[3, 6]]);
25831
25922
  }
25832
25923
  function markChannelAsRead(action) {
25833
- var channelId, channel, updatedChannel, updateData, _t16;
25924
+ var channelId, channel, updatedChannel, latestUnreadBoundaryId, lastDisplayedCandidates, nextLastDisplayedMessageId, updateData, _t16;
25834
25925
  return _regenerator().w(function (_context16) {
25835
25926
  while (1) switch (_context16.p = _context16.n) {
25836
25927
  case 0:
@@ -25847,11 +25938,14 @@ function markChannelAsRead(action) {
25847
25938
  return call(channel.markAsRead);
25848
25939
  case 2:
25849
25940
  updatedChannel = _context16.v;
25941
+ latestUnreadBoundaryId = getLatestUnreadBoundaryId(channel);
25942
+ lastDisplayedCandidates = [channel.lastDisplayedMessageId || '', (updatedChannel === null || updatedChannel === void 0 ? void 0 : updatedChannel.lastDisplayedMessageId) || '', latestUnreadBoundaryId].filter(Boolean);
25943
+ nextLastDisplayedMessageId = getNewestMessageId(lastDisplayedCandidates) || (updatedChannel === null || updatedChannel === void 0 ? void 0 : updatedChannel.lastDisplayedMessageId) || channel.lastDisplayedMessageId;
25850
25944
  updateData = {
25851
25945
  unread: false,
25852
25946
  newMessageCount: 0,
25853
25947
  newMentionCount: 0,
25854
- lastDisplayedMessageId: updatedChannel === null || updatedChannel === void 0 ? void 0 : updatedChannel.lastDisplayedMessageId
25948
+ lastDisplayedMessageId: nextLastDisplayedMessageId
25855
25949
  };
25856
25950
  updateChannelOnAllChannels(channel.id, updateData);
25857
25951
  _context16.n = 3;
@@ -27258,7 +27352,7 @@ var _marked$4 = /*#__PURE__*/_regenerator().m(getMembers),
27258
27352
  _marked4$3 = /*#__PURE__*/_regenerator().m(kickMemberFromChannel),
27259
27353
  _marked5$3 = /*#__PURE__*/_regenerator().m(blockMember),
27260
27354
  _marked6$3 = /*#__PURE__*/_regenerator().m(changeMemberRole),
27261
- _marked7$2 = /*#__PURE__*/_regenerator().m(reportMember),
27355
+ _marked7$3 = /*#__PURE__*/_regenerator().m(reportMember),
27262
27356
  _marked8$2 = /*#__PURE__*/_regenerator().m(getRoles),
27263
27357
  _marked9$2 = /*#__PURE__*/_regenerator().m(MembersSaga);
27264
27358
  function getMembers(action) {
@@ -27721,7 +27815,7 @@ function reportMember(action) {
27721
27815
  case 4:
27722
27816
  return _context7.a(2);
27723
27817
  }
27724
- }, _marked7$2, null, [[1, 3]]);
27818
+ }, _marked7$3, null, [[1, 3]]);
27725
27819
  }
27726
27820
  function getRoles(action) {
27727
27821
  var _action$payload, timeout, attempts, SceytChatClient, roles, _t1;
@@ -27799,7 +27893,7 @@ var _marked$5 = /*#__PURE__*/_regenerator().m(getContacts),
27799
27893
  _marked4$4 = /*#__PURE__*/_regenerator().m(updateProfile),
27800
27894
  _marked5$4 = /*#__PURE__*/_regenerator().m(getUsers),
27801
27895
  _marked6$4 = /*#__PURE__*/_regenerator().m(loadMoreUsers),
27802
- _marked7$3 = /*#__PURE__*/_regenerator().m(MembersSaga$1);
27896
+ _marked7$4 = /*#__PURE__*/_regenerator().m(MembersSaga$1);
27803
27897
  function getContacts() {
27804
27898
  var SceytChatClient, contactsData, _t;
27805
27899
  return _regenerator().w(function (_context) {
@@ -28238,7 +28332,7 @@ function MembersSaga$1() {
28238
28332
  case 6:
28239
28333
  return _context7.a(2);
28240
28334
  }
28241
- }, _marked7$3);
28335
+ }, _marked7$4);
28242
28336
  }
28243
28337
 
28244
28338
  var _marked$6 = /*#__PURE__*/_regenerator().m(rootSaga);
@@ -40445,7 +40539,8 @@ var OGMetadata = function OGMetadata(_ref) {
40445
40539
  incomingMessageBackgroundX = _useColor[THEME_COLORS.INCOMING_MESSAGE_BACKGROUND_X],
40446
40540
  outgoingMessageBackgroundX = _useColor[THEME_COLORS.OUTGOING_MESSAGE_BACKGROUND_X],
40447
40541
  textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY],
40448
- textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY];
40542
+ textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
40543
+ background = _useColor[THEME_COLORS.BACKGROUND];
40449
40544
  var attachment = useMemo(function () {
40450
40545
  return attachments.find(function (attachment) {
40451
40546
  return attachment.type === attachmentTypes.link;
@@ -40552,7 +40647,8 @@ var OGMetadata = function OGMetadata(_ref) {
40552
40647
  onLoad: onImageLoad,
40553
40648
  onError: function onError() {
40554
40649
  setImageLoadError(true);
40555
- }
40650
+ },
40651
+ bgColor: background
40556
40652
  })))
40557
40653
  } : null, {
40558
40654
  key: 'title',
@@ -40704,7 +40800,9 @@ var Url = styled.p(_templateObject6$j || (_templateObject6$j = _taggedTemplateLi
40704
40800
  var maxWidth = _ref15.maxWidth;
40705
40801
  return maxWidth && "\n max-width: " + maxWidth + "px;\n ";
40706
40802
  });
40707
- var Img = styled.img(_templateObject7$i || (_templateObject7$i = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: 100%;\n object-fit: cover;\n display: block;\n border-radius: inherit;\n"])));
40803
+ var Img = styled.img(_templateObject7$i || (_templateObject7$i = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: 100%;\n object-fit: cover;\n display: block;\n border-radius: inherit;\n background: ", ";\n"])), function (props) {
40804
+ return props.bgColor;
40805
+ });
40708
40806
  var OGRow = styled.div(_templateObject8$g || (_templateObject8$g = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n padding: 0;\n"])));
40709
40807
  var OGTextWrapper = styled.div(_templateObject9$d || (_templateObject9$d = _taggedTemplateLiteralLoose(["\n flex: 1 1 auto;\n"])));
40710
40808
  var FaviconContainer = styled.div(_templateObject0$c || (_templateObject0$c = _taggedTemplateLiteralLoose(["\n width: 52px;\n height: 52px;\n border-radius: 8px;\n overflow: hidden;\n margin: 8px;\n flex: 0 0 52px;\n"])));
@@ -43246,14 +43344,18 @@ var Message$1 = function Message(_ref) {
43246
43344
  dispatch(markMessagesAsDeliveredAC(channel.id, [message.id]));
43247
43345
  }
43248
43346
  }
43249
- if (isVisible && message.incoming && !(message.userMarkers && message.userMarkers.length && message.userMarkers.find(function (marker) {
43347
+ var alreadyRead = !!(message.userMarkers && message.userMarkers.length && message.userMarkers.find(function (marker) {
43250
43348
  return marker.name === MESSAGE_DELIVERY_STATUS.READ;
43251
- })) && !disableAutoReadTracking && isTabActive && channel.newMessageCount && channel.newMessageCount > 0 && connectionStatus === CONNECTION_STATUS.CONNECTED) {
43349
+ }));
43350
+ if (isVisible && message.incoming && !alreadyRead && !disableAutoReadTracking && isTabActive && channel.newMessageCount && channel.newMessageCount > 0 && connectionStatus === CONNECTION_STATUS.CONNECTED) {
43351
+ console.log("[READ_MESSAGE] queuing msgId=" + message.id + " ch=" + channel.id);
43252
43352
  if (queueReadMarker) {
43253
43353
  queueReadMarker(channel.id, message.id);
43254
43354
  } else {
43255
43355
  dispatch(markMessagesAsReadAC(channel.id, [message.id]));
43256
43356
  }
43357
+ } else if (isVisible && message.incoming && !alreadyRead) {
43358
+ console.log("[READ_MESSAGE] skip msgId=" + message.id, "disabledTracking=" + disableAutoReadTracking + " tabActive=" + isTabActive, "newMsgCount=" + channel.newMessageCount + " conn=" + connectionStatus);
43257
43359
  }
43258
43360
  }, [dispatch, message.incoming, message.userMarkers, message.id, isVisible, channel.id, channel.newMessageCount, connectionStatus, queueReadMarker, queueDeliveredMarker, disableAutoReadTracking, isTabActive]);
43259
43361
  var handleForwardMessage = useCallback(function (channelIds) {
@@ -44285,6 +44387,7 @@ function useChatController(_ref5) {
44285
44387
  }, [clearJumpScrollingLock]);
44286
44388
  var queueVisibleUnreadCheck = useCallback(function () {
44287
44389
  if (pendingVisibleUnreadFrameRef.current !== null || unreadScrollTo || !tabIsActive) {
44390
+ console.log("[READ_MESSAGE] queueVisibleUnreadCheck blocked", "pendingRaf=" + (pendingVisibleUnreadFrameRef.current !== null) + " unreadScrollTo=" + unreadScrollTo + " tabActive=" + tabIsActive);
44288
44391
  return;
44289
44392
  }
44290
44393
  pendingVisibleUnreadFrameRef.current = requestAnimationFrame(function () {
@@ -44295,6 +44398,7 @@ function useChatController(_ref5) {
44295
44398
  }
44296
44399
  var unreadStartIndex = getUnreadTrackingStartIndex(messages);
44297
44400
  if (unreadStartIndex < 0) {
44401
+ console.log('[READ_MESSAGE] queueVisibleUnreadCheck: no unread start index, skip');
44298
44402
  return;
44299
44403
  }
44300
44404
  var candidateUnreadMessages = messages.slice(unreadStartIndex);
@@ -44320,8 +44424,10 @@ function useChatController(_ref5) {
44320
44424
  return message.id;
44321
44425
  });
44322
44426
  if (!ids.length || !channel.id || !channel.newMessageCount) {
44427
+ console.log("[READ_MESSAGE] queueVisibleUnreadCheck: nothing to mark ids=" + ids.length + " newMsgCount=" + channel.newMessageCount);
44323
44428
  return;
44324
44429
  }
44430
+ console.log("[READ_MESSAGE] queueVisibleUnreadCheck: marking ch=" + channel.id + " ids=[" + ids.join(',') + "]");
44325
44431
  ids.forEach(function (id) {
44326
44432
  visibleUnreadReportedRef.current.add(id);
44327
44433
  });
@@ -44599,7 +44705,7 @@ function useChatController(_ref5) {
44599
44705
  };
44600
44706
  return Promise.resolve(beginWindowPagedRequest(function () {
44601
44707
  if (connectionStatus === CONNECTION_STATUS.CONNECTED) {
44602
- dispatch(loadLatestMessagesAC(channelRef.current));
44708
+ dispatch(loadLatestMessagesAC(channelRef.current, undefined, undefined, true, true));
44603
44709
  return;
44604
44710
  }
44605
44711
  dispatch(loadDefaultMessagesAC(channelRef.current));
@@ -45034,8 +45140,6 @@ function useChatController(_ref5) {
45034
45140
  }
45035
45141
  if (currentScrollTop <= historyEdgeScrollTop + PRELOAD_TRIGGER_PX) {
45036
45142
  currentScrollTop = historyEdgeScrollTop;
45037
- } else if (currentScrollTop >= latestEdgeScrollTop - PRELOAD_TRIGGER_PX) {
45038
- currentScrollTop = latestEdgeScrollTop;
45039
45143
  }
45040
45144
  if (currentScrollTop !== container.scrollTop) {
45041
45145
  setScrollTop(container, currentScrollTop, 'auto');
@@ -45979,7 +46083,9 @@ var createMessageMarkerBatcher = function createMessageMarkerBatcher(_ref) {
45979
46083
  onFlushDelivered(channelId, Array.from(queue.deliveredIds));
45980
46084
  }
45981
46085
  if (queue.readIds.size > 0) {
45982
- onFlushRead(channelId, Array.from(queue.readIds));
46086
+ var ids = Array.from(queue.readIds);
46087
+ console.log("[READ_MESSAGE] flush ch=" + channelId + " ids=[" + ids.join(',') + "]");
46088
+ onFlushRead(channelId, ids);
45983
46089
  }
45984
46090
  channelQueues["delete"](channelId);
45985
46091
  };
@@ -45996,6 +46102,7 @@ var createMessageMarkerBatcher = function createMessageMarkerBatcher(_ref) {
45996
46102
  }
45997
46103
  var queue = getQueue(channelId);
45998
46104
  queue.readIds.add(messageId);
46105
+ console.log("[READ_MESSAGE] enqueue msgId=" + messageId + " ch=" + channelId + " queueSize=" + queue.readIds.size);
45999
46106
  scheduleFlush(channelId);
46000
46107
  };
46001
46108
  var enqueueDelivered = function enqueueDelivered(channelId, messageId) {
@@ -46232,6 +46339,7 @@ var MessageList = function MessageList(_ref) {
46232
46339
  markerBatcherRef.current = createMessageMarkerBatcher({
46233
46340
  debounceMs: DEFAULT_MARKER_BATCH_DEBOUNCE_MS,
46234
46341
  onFlushRead: function onFlushRead(channelId, messageIds) {
46342
+ console.log("[READ_MESSAGE] dispatch markAsRead ch=" + channelId + " ids=[" + messageIds.join(',') + "]");
46235
46343
  dispatch(markMessagesAsReadAC(channelId, messageIds));
46236
46344
  },
46237
46345
  onFlushDelivered: function onFlushDelivered(channelId, messageIds) {
@@ -46279,6 +46387,7 @@ var MessageList = function MessageList(_ref) {
46279
46387
  }, [browserTabIsActive]);
46280
46388
  var queueReadMarker = useCallback(function (channelId, messageId) {
46281
46389
  var _markerBatcherRef$cur;
46390
+ console.log("[READ_MESSAGE] queueReadMarker ch=" + channelId + " msgId=" + messageId);
46282
46391
  (_markerBatcherRef$cur = markerBatcherRef.current) === null || _markerBatcherRef$cur === void 0 ? void 0 : _markerBatcherRef$cur.enqueueRead(channelId, messageId);
46283
46392
  }, []);
46284
46393
  var queueDeliveredMarker = useCallback(function (channelId, messageId) {
@@ -46342,6 +46451,7 @@ var MessageList = function MessageList(_ref) {
46342
46451
  }
46343
46452
  if (channel.lastMessage.id && String(channel.lastMessage.user.id) !== currentUserId) {
46344
46453
  var _markerBatcherRef$cur5;
46454
+ console.log("[READ_MESSAGE] scrollToBottom enqueue ch=" + channel.id + " msgId=" + channel.lastMessage.id);
46345
46455
  (_markerBatcherRef$cur5 = markerBatcherRef.current) === null || _markerBatcherRef$cur5 === void 0 ? void 0 : _markerBatcherRef$cur5.enqueueRead(channel.id, channel.lastMessage.id);
46346
46456
  }
46347
46457
  jumpToLatest(true);
@@ -48529,28 +48639,24 @@ function useFormatMessage(editor, editorState, setMessageBodyAttributes, setMess
48529
48639
  var member = activeChannelMembers.find(function (m) {
48530
48640
  return m.id === segment.mentionUserId;
48531
48641
  });
48532
- if (member) {
48533
- setMentionedMember(member);
48534
- var mentionNode = $createMentionNode(_extends({}, member, {
48535
- name: segment.text
48536
- }));
48537
- if (segment.format > 0) {
48538
- mentionNode.setFormat(segment.format);
48539
- }
48540
- nodes.push(mentionNode);
48541
- } else {
48542
- var textNode = $createTextNode(segment.text);
48543
- if (segment.format > 0) {
48544
- textNode.setFormat(segment.format);
48545
- }
48546
- nodes.push(textNode);
48642
+ var mentionData = member ? _extends({}, member, {
48643
+ name: segment.text
48644
+ }) : {
48645
+ id: segment.mentionUserId,
48646
+ name: segment.text
48647
+ };
48648
+ setMentionedMember(mentionData);
48649
+ var mentionNode = $createMentionNode(mentionData);
48650
+ if (segment.format > 0) {
48651
+ mentionNode.setFormat(segment.format);
48547
48652
  }
48653
+ nodes.push(mentionNode);
48548
48654
  } else {
48549
- var _textNode = $createTextNode(segment.text);
48655
+ var textNode = $createTextNode(segment.text);
48550
48656
  if (segment.format > 0) {
48551
- _textNode.setFormat(segment.format);
48657
+ textNode.setFormat(segment.format);
48552
48658
  }
48553
- nodes.push(_textNode);
48659
+ nodes.push(textNode);
48554
48660
  }
48555
48661
  });
48556
48662
  if (nodes.length > 0) {