sceyt-chat-react-uikit 1.6.8-beta.7 → 1.6.8-beta.9

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
@@ -1030,6 +1030,7 @@ var UPDATE_USER_STATUS_ON_CHANNEL = 'UPDATE_USER_STATUS_ON_CHANNEL';
1030
1030
  var SET_CHANNEL_LIST_WIDTH = 'SET_CHANNEL_LIST_WIDTH';
1031
1031
  var CLEAR_HISTORY = 'CLEAR_HISTORY';
1032
1032
  var DELETE_ALL_MESSAGES = 'DELETE_ALL_MESSAGES';
1033
+ var GET_CHANNEL_MENTIONS = 'GET_CHANNEL_MENTIONS';
1033
1034
  var DESTROY_SESSION = 'DESTROY_SESSION';
1034
1035
  var SET_TAB_IS_ACTIVE = 'SET_TAB_IS_ACTIVE';
1035
1036
  var SET_HIDE_CHANNEL_LIST = 'SET_HIDE_CHANNEL_LIST';
@@ -9734,6 +9735,14 @@ function destroySession() {
9734
9735
  type: DESTROY_SESSION
9735
9736
  };
9736
9737
  }
9738
+ function getChannelMentionsAC(channelId) {
9739
+ return {
9740
+ type: GET_CHANNEL_MENTIONS,
9741
+ payload: {
9742
+ channelId: channelId
9743
+ }
9744
+ };
9745
+ }
9737
9746
 
9738
9747
  function sendMessageAC(message, channelId, connectionState, sendAttachmentsAsSeparateMessage, isResend) {
9739
9748
  return {
@@ -12641,7 +12650,18 @@ function watchForEvents() {
12641
12650
  }
12642
12651
  _updatedChannel = JSON.parse(JSON.stringify(_channel10));
12643
12652
  _context.next = 327;
12644
- return put(updateChannelDataAC(_channel10.id, _updatedChannel));
12653
+ return put(updateChannelDataAC(_channel10.id, {
12654
+ lastMessage: _channel10.lastMessage,
12655
+ newMessageCount: _channel10.newMessageCount,
12656
+ newMentionCount: _channel10.newMentionCount,
12657
+ unread: _channel10.unread,
12658
+ newReactedMessageCount: _channel10.newReactedMessageCount,
12659
+ newReactions: _channel10.newReactions,
12660
+ lastReactedMessage: _channel10.lastReactedMessage,
12661
+ lastReceivedMsgId: _channel10.lastReceivedMsgId,
12662
+ lastDisplayedMessageId: _channel10.lastDisplayedMessageId,
12663
+ messageRetentionPeriod: _channel10.messageRetentionPeriod
12664
+ }));
12645
12665
  case 327:
12646
12666
  updateChannelOnAllChannels(_channel10.id, _updatedChannel);
12647
12667
  case 328:
@@ -13029,29 +13049,30 @@ var _marked$2 = /*#__PURE__*/_regeneratorRuntime().mark(createChannel),
13029
13049
  _marked4 = /*#__PURE__*/_regeneratorRuntime().mark(getChannelsForForward),
13030
13050
  _marked5 = /*#__PURE__*/_regeneratorRuntime().mark(searchChannelsForForward),
13031
13051
  _marked6 = /*#__PURE__*/_regeneratorRuntime().mark(channelsLoadMore),
13032
- _marked7 = /*#__PURE__*/_regeneratorRuntime().mark(channelsForForwardLoadMore),
13033
- _marked8 = /*#__PURE__*/_regeneratorRuntime().mark(markMessagesRead),
13034
- _marked9 = /*#__PURE__*/_regeneratorRuntime().mark(markMessagesDelivered),
13035
- _marked0 = /*#__PURE__*/_regeneratorRuntime().mark(switchChannel),
13036
- _marked1 = /*#__PURE__*/_regeneratorRuntime().mark(notificationsTurnOff),
13037
- _marked10 = /*#__PURE__*/_regeneratorRuntime().mark(notificationsTurnOn),
13038
- _marked11 = /*#__PURE__*/_regeneratorRuntime().mark(markChannelAsRead),
13039
- _marked12 = /*#__PURE__*/_regeneratorRuntime().mark(markChannelAsUnRead),
13040
- _marked13 = /*#__PURE__*/_regeneratorRuntime().mark(pinChannel),
13041
- _marked14 = /*#__PURE__*/_regeneratorRuntime().mark(unpinChannel),
13042
- _marked15 = /*#__PURE__*/_regeneratorRuntime().mark(removeChannelCaches),
13043
- _marked16 = /*#__PURE__*/_regeneratorRuntime().mark(leaveChannel),
13044
- _marked17 = /*#__PURE__*/_regeneratorRuntime().mark(deleteChannel),
13045
- _marked18 = /*#__PURE__*/_regeneratorRuntime().mark(blockChannel),
13046
- _marked19 = /*#__PURE__*/_regeneratorRuntime().mark(updateChannel),
13047
- _marked20 = /*#__PURE__*/_regeneratorRuntime().mark(checkUsersStatus),
13048
- _marked21 = /*#__PURE__*/_regeneratorRuntime().mark(sendTyping),
13049
- _marked22 = /*#__PURE__*/_regeneratorRuntime().mark(sendRecording),
13050
- _marked23 = /*#__PURE__*/_regeneratorRuntime().mark(clearHistory),
13051
- _marked24 = /*#__PURE__*/_regeneratorRuntime().mark(deleteAllMessages),
13052
- _marked25 = /*#__PURE__*/_regeneratorRuntime().mark(joinChannel),
13053
- _marked26 = /*#__PURE__*/_regeneratorRuntime().mark(watchForChannelEvents),
13054
- _marked27 = /*#__PURE__*/_regeneratorRuntime().mark(ChannelsSaga);
13052
+ _marked7 = /*#__PURE__*/_regeneratorRuntime().mark(getChannelMentions),
13053
+ _marked8 = /*#__PURE__*/_regeneratorRuntime().mark(channelsForForwardLoadMore),
13054
+ _marked9 = /*#__PURE__*/_regeneratorRuntime().mark(markMessagesRead),
13055
+ _marked0 = /*#__PURE__*/_regeneratorRuntime().mark(markMessagesDelivered),
13056
+ _marked1 = /*#__PURE__*/_regeneratorRuntime().mark(switchChannel),
13057
+ _marked10 = /*#__PURE__*/_regeneratorRuntime().mark(notificationsTurnOff),
13058
+ _marked11 = /*#__PURE__*/_regeneratorRuntime().mark(notificationsTurnOn),
13059
+ _marked12 = /*#__PURE__*/_regeneratorRuntime().mark(markChannelAsRead),
13060
+ _marked13 = /*#__PURE__*/_regeneratorRuntime().mark(markChannelAsUnRead),
13061
+ _marked14 = /*#__PURE__*/_regeneratorRuntime().mark(pinChannel),
13062
+ _marked15 = /*#__PURE__*/_regeneratorRuntime().mark(unpinChannel),
13063
+ _marked16 = /*#__PURE__*/_regeneratorRuntime().mark(removeChannelCaches),
13064
+ _marked17 = /*#__PURE__*/_regeneratorRuntime().mark(leaveChannel),
13065
+ _marked18 = /*#__PURE__*/_regeneratorRuntime().mark(deleteChannel),
13066
+ _marked19 = /*#__PURE__*/_regeneratorRuntime().mark(blockChannel),
13067
+ _marked20 = /*#__PURE__*/_regeneratorRuntime().mark(updateChannel),
13068
+ _marked21 = /*#__PURE__*/_regeneratorRuntime().mark(checkUsersStatus),
13069
+ _marked22 = /*#__PURE__*/_regeneratorRuntime().mark(sendTyping),
13070
+ _marked23 = /*#__PURE__*/_regeneratorRuntime().mark(sendRecording),
13071
+ _marked24 = /*#__PURE__*/_regeneratorRuntime().mark(clearHistory),
13072
+ _marked25 = /*#__PURE__*/_regeneratorRuntime().mark(deleteAllMessages),
13073
+ _marked26 = /*#__PURE__*/_regeneratorRuntime().mark(joinChannel),
13074
+ _marked27 = /*#__PURE__*/_regeneratorRuntime().mark(watchForChannelEvents),
13075
+ _marked28 = /*#__PURE__*/_regeneratorRuntime().mark(ChannelsSaga);
13055
13076
  function createChannel(action) {
13056
13077
  var payload, channelData, dontCreateIfNotExists, SceytChatClient, createChannelData, fileToUpload, isSelfChannel, channelIsExistOnAllChannels, createdChannel, allChannels, memberId, checkChannelExist, messageToSend, _allChannels, _memberId;
13057
13078
  return _regeneratorRuntime().wrap(function createChannel$(_context) {
@@ -13791,27 +13812,64 @@ function channelsLoadMore(action) {
13791
13812
  }
13792
13813
  }, _marked6, null, [[0, 28]]);
13793
13814
  }
13794
- function channelsForForwardLoadMore(action) {
13795
- var payload, limit, SceytChatClient, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels;
13796
- return _regeneratorRuntime().wrap(function channelsForForwardLoadMore$(_context7) {
13815
+ function getChannelMentions(action) {
13816
+ var payload, channelId, SceytChatClient, mentionsQueryBuilder, mentionsQuery, mentions;
13817
+ return _regeneratorRuntime().wrap(function getChannelMentions$(_context7) {
13797
13818
  while (1) switch (_context7.prev = _context7.next) {
13798
13819
  case 0:
13799
13820
  _context7.prev = 0;
13800
13821
  payload = action.payload;
13822
+ channelId = payload.channelId;
13823
+ SceytChatClient = getClient();
13824
+ mentionsQueryBuilder = new SceytChatClient.MentionsListQueryBuilder();
13825
+ mentionsQueryBuilder.setChannelId(channelId);
13826
+ mentionsQueryBuilder.limit(10);
13827
+ _context7.next = 9;
13828
+ return call(mentionsQueryBuilder.build);
13829
+ case 9:
13830
+ mentionsQuery = _context7.sent;
13831
+ _context7.next = 12;
13832
+ return call(mentionsQuery.loadNext);
13833
+ case 12:
13834
+ mentions = _context7.sent;
13835
+ _context7.next = 15;
13836
+ return put(updateChannelDataAC(channelId, {
13837
+ mentionsIds: mentions.mentions
13838
+ }));
13839
+ case 15:
13840
+ _context7.next = 20;
13841
+ break;
13842
+ case 17:
13843
+ _context7.prev = 17;
13844
+ _context7.t0 = _context7["catch"](0);
13845
+ log.error(_context7.t0, 'Error in get channel mentions');
13846
+ case 20:
13847
+ case "end":
13848
+ return _context7.stop();
13849
+ }
13850
+ }, _marked7, null, [[0, 17]]);
13851
+ }
13852
+ function channelsForForwardLoadMore(action) {
13853
+ var payload, limit, SceytChatClient, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels;
13854
+ return _regeneratorRuntime().wrap(function channelsForForwardLoadMore$(_context8) {
13855
+ while (1) switch (_context8.prev = _context8.next) {
13856
+ case 0:
13857
+ _context8.prev = 0;
13858
+ payload = action.payload;
13801
13859
  limit = payload.limit;
13802
13860
  SceytChatClient = getClient();
13803
13861
  channelQueryForward = query.channelQueryForward;
13804
13862
  if (limit) {
13805
13863
  channelQueryForward.limit = limit;
13806
13864
  }
13807
- _context7.next = 8;
13865
+ _context8.next = 8;
13808
13866
  return put(setChannelsLoadingStateAC(LOADING_STATE.LOADING));
13809
13867
  case 8:
13810
- _context7.next = 10;
13868
+ _context8.next = 10;
13811
13869
  return call(channelQueryForward.loadNextPage);
13812
13870
  case 10:
13813
- channelsData = _context7.sent;
13814
- _context7.next = 13;
13871
+ channelsData = _context8.sent;
13872
+ _context8.next = 13;
13815
13873
  return put(channelHasNextAC(channelsData.hasNext, true));
13816
13874
  case 13:
13817
13875
  channelsToAdd = channelsData.channels.filter(function (channel) {
@@ -13819,41 +13877,41 @@ function channelsForForwardLoadMore(action) {
13819
13877
  return member.id && member.id !== SceytChatClient.user.id;
13820
13878
  }) : true;
13821
13879
  });
13822
- _context7.next = 16;
13880
+ _context8.next = 16;
13823
13881
  return call(setChannelsInMap, channelsToAdd);
13824
13882
  case 16:
13825
- _yield$call4 = _context7.sent;
13883
+ _yield$call4 = _context8.sent;
13826
13884
  mappedChannels = _yield$call4.channels;
13827
- _context7.next = 20;
13885
+ _context8.next = 20;
13828
13886
  return put(addChannelsForForwardAC(mappedChannels));
13829
13887
  case 20:
13830
- _context7.next = 22;
13888
+ _context8.next = 22;
13831
13889
  return put(setChannelsLoadingStateAC(LOADING_STATE.LOADED));
13832
13890
  case 22:
13833
- _context7.next = 27;
13891
+ _context8.next = 27;
13834
13892
  break;
13835
13893
  case 24:
13836
- _context7.prev = 24;
13837
- _context7.t0 = _context7["catch"](0);
13838
- log.error(_context7.t0, 'Error in load more channels for forward');
13894
+ _context8.prev = 24;
13895
+ _context8.t0 = _context8["catch"](0);
13896
+ log.error(_context8.t0, 'Error in load more channels for forward');
13839
13897
  case 27:
13840
13898
  case "end":
13841
- return _context7.stop();
13899
+ return _context8.stop();
13842
13900
  }
13843
- }, _marked7, null, [[0, 24]]);
13901
+ }, _marked8, null, [[0, 24]]);
13844
13902
  }
13845
13903
  function markMessagesRead(action) {
13846
13904
  var payload, channelId, messageIds, channel, messageListMarker, _iterator, _step, messageId, updateParams;
13847
- return _regeneratorRuntime().wrap(function markMessagesRead$(_context8) {
13848
- while (1) switch (_context8.prev = _context8.next) {
13905
+ return _regeneratorRuntime().wrap(function markMessagesRead$(_context9) {
13906
+ while (1) switch (_context9.prev = _context9.next) {
13849
13907
  case 0:
13850
13908
  payload = action.payload;
13851
13909
  channelId = payload.channelId, messageIds = payload.messageIds;
13852
- _context8.next = 4;
13910
+ _context9.next = 4;
13853
13911
  return call(getChannelFromMap, channelId);
13854
13912
  case 4:
13855
- channel = _context8.sent;
13856
- _context8.prev = 5;
13913
+ channel = _context9.sent;
13914
+ _context9.prev = 5;
13857
13915
  if (!channel) {
13858
13916
  channel = getChannelFromAllChannels(channelId);
13859
13917
  if (channel) {
@@ -13861,14 +13919,14 @@ function markMessagesRead(action) {
13861
13919
  }
13862
13920
  }
13863
13921
  if (!channel) {
13864
- _context8.next = 24;
13922
+ _context9.next = 24;
13865
13923
  break;
13866
13924
  }
13867
- _context8.next = 10;
13925
+ _context9.next = 10;
13868
13926
  return call(channel.markMessagesAsDisplayed, messageIds);
13869
13927
  case 10:
13870
- messageListMarker = _context8.sent;
13871
- _context8.next = 13;
13928
+ messageListMarker = _context9.sent;
13929
+ _context9.next = 13;
13872
13930
  return put(updateChannelDataAC(channel.id, {
13873
13931
  lastReadMessageId: channel.lastDisplayedMessageId
13874
13932
  }));
@@ -13879,7 +13937,7 @@ function markMessagesRead(action) {
13879
13937
  _iterator = _createForOfIteratorHelperLoose(messageListMarker.messageIds);
13880
13938
  case 15:
13881
13939
  if ((_step = _iterator()).done) {
13882
- _context8.next = 24;
13940
+ _context9.next = 24;
13883
13941
  break;
13884
13942
  }
13885
13943
  messageId = _step.value;
@@ -13892,7 +13950,7 @@ function markMessagesRead(action) {
13892
13950
  name: MESSAGE_DELIVERY_STATUS.READ
13893
13951
  }]
13894
13952
  };
13895
- _context8.next = 20;
13953
+ _context9.next = 20;
13896
13954
  return put(updateMessageAC(messageId, updateParams));
13897
13955
  case 20:
13898
13956
  updateMessageOnMap(channel.id, {
@@ -13901,33 +13959,33 @@ function markMessagesRead(action) {
13901
13959
  });
13902
13960
  updateMessageOnAllMessages(messageId, updateParams);
13903
13961
  case 22:
13904
- _context8.next = 15;
13962
+ _context9.next = 15;
13905
13963
  break;
13906
13964
  case 24:
13907
- _context8.next = 29;
13965
+ _context9.next = 29;
13908
13966
  break;
13909
13967
  case 26:
13910
- _context8.prev = 26;
13911
- _context8.t0 = _context8["catch"](5);
13912
- log.error(_context8.t0, 'Error on mark messages read');
13968
+ _context9.prev = 26;
13969
+ _context9.t0 = _context9["catch"](5);
13970
+ log.error(_context9.t0, 'Error on mark messages read');
13913
13971
  case 29:
13914
13972
  case "end":
13915
- return _context8.stop();
13973
+ return _context9.stop();
13916
13974
  }
13917
- }, _marked8, null, [[5, 26]]);
13975
+ }, _marked9, null, [[5, 26]]);
13918
13976
  }
13919
13977
  function markMessagesDelivered(action) {
13920
13978
  var payload, channelId, messageIds, channel;
13921
- return _regeneratorRuntime().wrap(function markMessagesDelivered$(_context9) {
13922
- while (1) switch (_context9.prev = _context9.next) {
13979
+ return _regeneratorRuntime().wrap(function markMessagesDelivered$(_context0) {
13980
+ while (1) switch (_context0.prev = _context0.next) {
13923
13981
  case 0:
13924
13982
  payload = action.payload;
13925
13983
  channelId = payload.channelId, messageIds = payload.messageIds;
13926
- _context9.prev = 2;
13927
- _context9.next = 5;
13984
+ _context0.prev = 2;
13985
+ _context0.next = 5;
13928
13986
  return call(getChannelFromMap, channelId);
13929
13987
  case 5:
13930
- channel = _context9.sent;
13988
+ channel = _context0.sent;
13931
13989
  if (!channel) {
13932
13990
  channel = getChannelFromAllChannels(channelId);
13933
13991
  if (channel) {
@@ -13935,203 +13993,203 @@ function markMessagesDelivered(action) {
13935
13993
  }
13936
13994
  }
13937
13995
  if (!channel) {
13938
- _context9.next = 11;
13996
+ _context0.next = 11;
13939
13997
  break;
13940
13998
  }
13941
13999
  log.info('send delivered marker ', messageIds);
13942
- _context9.next = 11;
14000
+ _context0.next = 11;
13943
14001
  return call(channel.markMessagesAsReceived, messageIds);
13944
14002
  case 11:
13945
- _context9.next = 16;
14003
+ _context0.next = 16;
13946
14004
  break;
13947
14005
  case 13:
13948
- _context9.prev = 13;
13949
- _context9.t0 = _context9["catch"](2);
13950
- log.error(_context9.t0, 'Error on mark messages delivered');
14006
+ _context0.prev = 13;
14007
+ _context0.t0 = _context0["catch"](2);
14008
+ log.error(_context0.t0, 'Error on mark messages delivered');
13951
14009
  case 16:
13952
14010
  case "end":
13953
- return _context9.stop();
14011
+ return _context0.stop();
13954
14012
  }
13955
- }, _marked9, null, [[2, 13]]);
14013
+ }, _marked0, null, [[2, 13]]);
13956
14014
  }
13957
14015
  function switchChannel(action) {
13958
14016
  var payload, channel, channelToSwitch, existingChannel, addChannel, SceytChatClient, fetchedChannel, channelFromMap, currentActiveChannel;
13959
- return _regeneratorRuntime().wrap(function switchChannel$(_context0) {
13960
- while (1) switch (_context0.prev = _context0.next) {
14017
+ return _regeneratorRuntime().wrap(function switchChannel$(_context1) {
14018
+ while (1) switch (_context1.prev = _context1.next) {
13961
14019
  case 0:
13962
- _context0.prev = 0;
14020
+ _context1.prev = 0;
13963
14021
  payload = action.payload;
13964
14022
  channel = payload.channel;
13965
14023
  channelToSwitch = channel;
13966
14024
  if (channel !== null && channel !== void 0 && channel.id) {
13967
- _context0.next = 10;
14025
+ _context1.next = 10;
13968
14026
  break;
13969
14027
  }
13970
- _context0.next = 7;
14028
+ _context1.next = 7;
13971
14029
  return call(setActiveChannelId, '');
13972
14030
  case 7:
13973
- _context0.next = 9;
14031
+ _context1.next = 9;
13974
14032
  return put(setActiveChannelAC({}));
13975
14033
  case 9:
13976
- return _context0.abrupt("return");
14034
+ return _context1.abrupt("return");
13977
14035
  case 10:
13978
14036
  existingChannel = checkChannelExists(channel.id);
13979
14037
  if (existingChannel) {
13980
- _context0.next = 31;
14038
+ _context1.next = 31;
13981
14039
  break;
13982
14040
  }
13983
14041
  addChannel = getChannelFromAllChannels(channel.id);
13984
14042
  if (!addChannel) {
13985
- _context0.next = 20;
14043
+ _context1.next = 20;
13986
14044
  break;
13987
14045
  }
13988
14046
  setChannelInMap(addChannel);
13989
- _context0.next = 17;
14047
+ _context1.next = 17;
13990
14048
  return put(addChannelAC(JSON.parse(JSON.stringify(addChannel))));
13991
14049
  case 17:
13992
14050
  channelToSwitch = _extends({}, channelToSwitch, addChannel);
13993
- _context0.next = 29;
14051
+ _context1.next = 29;
13994
14052
  break;
13995
14053
  case 20:
13996
14054
  SceytChatClient = getClient();
13997
- _context0.next = 23;
14055
+ _context1.next = 23;
13998
14056
  return call(SceytChatClient.getChannel, channel.id);
13999
14057
  case 23:
14000
- fetchedChannel = _context0.sent;
14058
+ fetchedChannel = _context1.sent;
14001
14059
  addChannelToAllChannels(fetchedChannel);
14002
14060
  setChannelInMap(fetchedChannel);
14003
- _context0.next = 28;
14061
+ _context1.next = 28;
14004
14062
  return put(addChannelAC(JSON.parse(JSON.stringify(fetchedChannel))));
14005
14063
  case 28:
14006
14064
  channelToSwitch = _extends({}, channelToSwitch, fetchedChannel);
14007
14065
  case 29:
14008
- _context0.next = 33;
14066
+ _context1.next = 33;
14009
14067
  break;
14010
14068
  case 31:
14011
14069
  channelFromMap = getChannelFromMap(channel.id);
14012
14070
  channelToSwitch = _extends({}, channelToSwitch, channelFromMap);
14013
14071
  case 33:
14014
14072
  currentActiveChannel = getChannelFromMap(getActiveChannelId());
14015
- _context0.next = 36;
14073
+ _context1.next = 36;
14016
14074
  return call(setUnreadScrollTo, true);
14017
14075
  case 36:
14018
- _context0.next = 38;
14076
+ _context1.next = 38;
14019
14077
  return call(setActiveChannelId, channel && channel.id);
14020
14078
  case 38:
14021
14079
  if (channel.isLinkedChannel) {
14022
14080
  channelToSwitch.linkedFrom = currentActiveChannel;
14023
14081
  }
14024
- _context0.next = 41;
14082
+ _context1.next = 41;
14025
14083
  return put(setActiveChannelAC(_extends({}, channelToSwitch)));
14026
14084
  case 41:
14027
- _context0.next = 47;
14085
+ _context1.next = 47;
14028
14086
  break;
14029
14087
  case 44:
14030
- _context0.prev = 44;
14031
- _context0.t0 = _context0["catch"](0);
14032
- log.error('error in switch channel', _context0.t0);
14088
+ _context1.prev = 44;
14089
+ _context1.t0 = _context1["catch"](0);
14090
+ log.error('error in switch channel', _context1.t0);
14033
14091
  case 47:
14034
14092
  case "end":
14035
- return _context0.stop();
14093
+ return _context1.stop();
14036
14094
  }
14037
- }, _marked0, null, [[0, 44]]);
14095
+ }, _marked1, null, [[0, 44]]);
14038
14096
  }
14039
14097
  function notificationsTurnOff(action) {
14040
14098
  var expireTime, activeChannelId, channel, updatedChannel;
14041
- return _regeneratorRuntime().wrap(function notificationsTurnOff$(_context1) {
14042
- while (1) switch (_context1.prev = _context1.next) {
14099
+ return _regeneratorRuntime().wrap(function notificationsTurnOff$(_context10) {
14100
+ while (1) switch (_context10.prev = _context10.next) {
14043
14101
  case 0:
14044
14102
  expireTime = action.payload.expireTime;
14045
- _context1.next = 3;
14103
+ _context10.next = 3;
14046
14104
  return call(getActiveChannelId);
14047
14105
  case 3:
14048
- activeChannelId = _context1.sent;
14049
- _context1.next = 6;
14106
+ activeChannelId = _context10.sent;
14107
+ _context10.next = 6;
14050
14108
  return call(getChannelFromMap, activeChannelId);
14051
14109
  case 6:
14052
- channel = _context1.sent;
14053
- _context1.prev = 7;
14054
- _context1.next = 10;
14110
+ channel = _context10.sent;
14111
+ _context10.prev = 7;
14112
+ _context10.next = 10;
14055
14113
  return call(channel.mute, expireTime);
14056
14114
  case 10:
14057
- updatedChannel = _context1.sent;
14115
+ updatedChannel = _context10.sent;
14058
14116
  updateChannelOnAllChannels(channel.id, {
14059
14117
  muted: updatedChannel.muted,
14060
14118
  mutedTill: updatedChannel.mutedTill
14061
14119
  });
14062
- _context1.next = 14;
14120
+ _context10.next = 14;
14063
14121
  return put(updateChannelDataAC(updatedChannel.id, {
14064
14122
  muted: updatedChannel.muted,
14065
14123
  mutedTill: updatedChannel.mutedTill
14066
14124
  }));
14067
14125
  case 14:
14068
- _context1.next = 19;
14126
+ _context10.next = 19;
14069
14127
  break;
14070
14128
  case 16:
14071
- _context1.prev = 16;
14072
- _context1.t0 = _context1["catch"](7);
14073
- log.error('ERROR turn off notifications', _context1.t0.message);
14129
+ _context10.prev = 16;
14130
+ _context10.t0 = _context10["catch"](7);
14131
+ log.error('ERROR turn off notifications', _context10.t0.message);
14074
14132
  case 19:
14075
14133
  case "end":
14076
- return _context1.stop();
14134
+ return _context10.stop();
14077
14135
  }
14078
- }, _marked1, null, [[7, 16]]);
14136
+ }, _marked10, null, [[7, 16]]);
14079
14137
  }
14080
14138
  function notificationsTurnOn() {
14081
14139
  var activeChannelId, channel, updatedChannel;
14082
- return _regeneratorRuntime().wrap(function notificationsTurnOn$(_context10) {
14083
- while (1) switch (_context10.prev = _context10.next) {
14140
+ return _regeneratorRuntime().wrap(function notificationsTurnOn$(_context11) {
14141
+ while (1) switch (_context11.prev = _context11.next) {
14084
14142
  case 0:
14085
- _context10.next = 2;
14143
+ _context11.next = 2;
14086
14144
  return call(getActiveChannelId);
14087
14145
  case 2:
14088
- activeChannelId = _context10.sent;
14089
- _context10.next = 5;
14146
+ activeChannelId = _context11.sent;
14147
+ _context11.next = 5;
14090
14148
  return call(getChannelFromMap, activeChannelId);
14091
14149
  case 5:
14092
- channel = _context10.sent;
14093
- _context10.prev = 6;
14094
- _context10.next = 9;
14150
+ channel = _context11.sent;
14151
+ _context11.prev = 6;
14152
+ _context11.next = 9;
14095
14153
  return call(channel.unmute);
14096
14154
  case 9:
14097
- updatedChannel = _context10.sent;
14155
+ updatedChannel = _context11.sent;
14098
14156
  updateChannelOnAllChannels(channel.id, {
14099
14157
  muted: updatedChannel.muted,
14100
14158
  mutedTill: updatedChannel.mutedTill
14101
14159
  });
14102
- _context10.next = 13;
14160
+ _context11.next = 13;
14103
14161
  return put(updateChannelDataAC(updatedChannel.id, {
14104
14162
  muted: updatedChannel.muted,
14105
14163
  mutedTill: updatedChannel.mutedTill
14106
14164
  }));
14107
14165
  case 13:
14108
- _context10.next = 18;
14166
+ _context11.next = 18;
14109
14167
  break;
14110
14168
  case 15:
14111
- _context10.prev = 15;
14112
- _context10.t0 = _context10["catch"](6);
14113
- log.error('ERROR turn on notifications: ', _context10.t0.message);
14169
+ _context11.prev = 15;
14170
+ _context11.t0 = _context11["catch"](6);
14171
+ log.error('ERROR turn on notifications: ', _context11.t0.message);
14114
14172
  case 18:
14115
14173
  case "end":
14116
- return _context10.stop();
14174
+ return _context11.stop();
14117
14175
  }
14118
- }, _marked10, null, [[6, 15]]);
14176
+ }, _marked11, null, [[6, 15]]);
14119
14177
  }
14120
14178
  function markChannelAsRead(action) {
14121
14179
  var channelId, channel, updateData;
14122
- return _regeneratorRuntime().wrap(function markChannelAsRead$(_context11) {
14123
- while (1) switch (_context11.prev = _context11.next) {
14180
+ return _regeneratorRuntime().wrap(function markChannelAsRead$(_context12) {
14181
+ while (1) switch (_context12.prev = _context12.next) {
14124
14182
  case 0:
14125
- _context11.prev = 0;
14183
+ _context12.prev = 0;
14126
14184
  channelId = action.payload.channelId;
14127
- _context11.next = 4;
14185
+ _context12.next = 4;
14128
14186
  return call(getChannelFromMap, channelId);
14129
14187
  case 4:
14130
- channel = _context11.sent;
14188
+ channel = _context12.sent;
14131
14189
  if (!channel) {
14132
14190
  channel = getChannelFromAllChannels(channelId);
14133
14191
  }
14134
- _context11.next = 8;
14192
+ _context12.next = 8;
14135
14193
  return call(channel.markAsRead);
14136
14194
  case 8:
14137
14195
  updateData = {
@@ -14140,316 +14198,316 @@ function markChannelAsRead(action) {
14140
14198
  newMentionCount: 0
14141
14199
  };
14142
14200
  updateChannelOnAllChannels(channel.id, updateData);
14143
- _context11.next = 12;
14201
+ _context12.next = 12;
14144
14202
  return put(updateChannelDataAC(channel.id, updateData));
14145
14203
  case 12:
14146
- _context11.next = 17;
14204
+ _context12.next = 17;
14147
14205
  break;
14148
14206
  case 14:
14149
- _context11.prev = 14;
14150
- _context11.t0 = _context11["catch"](0);
14151
- log.error(_context11.t0, 'Error in set channel unread');
14207
+ _context12.prev = 14;
14208
+ _context12.t0 = _context12["catch"](0);
14209
+ log.error(_context12.t0, 'Error in set channel unread');
14152
14210
  case 17:
14153
14211
  case "end":
14154
- return _context11.stop();
14212
+ return _context12.stop();
14155
14213
  }
14156
- }, _marked11, null, [[0, 14]]);
14214
+ }, _marked12, null, [[0, 14]]);
14157
14215
  }
14158
14216
  function markChannelAsUnRead(action) {
14159
14217
  var channelId, channel;
14160
- return _regeneratorRuntime().wrap(function markChannelAsUnRead$(_context12) {
14161
- while (1) switch (_context12.prev = _context12.next) {
14218
+ return _regeneratorRuntime().wrap(function markChannelAsUnRead$(_context13) {
14219
+ while (1) switch (_context13.prev = _context13.next) {
14162
14220
  case 0:
14163
- _context12.prev = 0;
14221
+ _context13.prev = 0;
14164
14222
  channelId = action.payload.channelId;
14165
- _context12.next = 4;
14223
+ _context13.next = 4;
14166
14224
  return call(getChannelFromMap, channelId);
14167
14225
  case 4:
14168
- channel = _context12.sent;
14226
+ channel = _context13.sent;
14169
14227
  if (!channel) {
14170
14228
  channel = getChannelFromAllChannels(channelId);
14171
14229
  }
14172
- _context12.next = 8;
14230
+ _context13.next = 8;
14173
14231
  return call(channel.markAsUnRead);
14174
14232
  case 8:
14175
14233
  updateChannelOnAllChannels(channel.id, {
14176
14234
  unread: true
14177
14235
  });
14178
- _context12.next = 11;
14236
+ _context13.next = 11;
14179
14237
  return put(updateChannelDataAC(channel.id, {
14180
14238
  unread: true
14181
14239
  }));
14182
14240
  case 11:
14183
- _context12.next = 16;
14241
+ _context13.next = 16;
14184
14242
  break;
14185
14243
  case 13:
14186
- _context12.prev = 13;
14187
- _context12.t0 = _context12["catch"](0);
14188
- log.error(_context12.t0, 'Error in set channel unread');
14244
+ _context13.prev = 13;
14245
+ _context13.t0 = _context13["catch"](0);
14246
+ log.error(_context13.t0, 'Error in set channel unread');
14189
14247
  case 16:
14190
14248
  case "end":
14191
- return _context12.stop();
14249
+ return _context13.stop();
14192
14250
  }
14193
- }, _marked12, null, [[0, 13]]);
14251
+ }, _marked13, null, [[0, 13]]);
14194
14252
  }
14195
14253
  function pinChannel(action) {
14196
14254
  var channelId, channel, updatedChannel;
14197
- return _regeneratorRuntime().wrap(function pinChannel$(_context13) {
14198
- while (1) switch (_context13.prev = _context13.next) {
14255
+ return _regeneratorRuntime().wrap(function pinChannel$(_context14) {
14256
+ while (1) switch (_context14.prev = _context14.next) {
14199
14257
  case 0:
14200
- _context13.prev = 0;
14258
+ _context14.prev = 0;
14201
14259
  channelId = action.payload.channelId;
14202
- _context13.next = 4;
14260
+ _context14.next = 4;
14203
14261
  return call(getChannelFromMap, channelId);
14204
14262
  case 4:
14205
- channel = _context13.sent;
14263
+ channel = _context14.sent;
14206
14264
  if (!channel) {
14207
14265
  channel = getChannelFromAllChannels(channelId);
14208
14266
  }
14209
- _context13.next = 8;
14267
+ _context14.next = 8;
14210
14268
  return call(channel.pin);
14211
14269
  case 8:
14212
- updatedChannel = _context13.sent;
14270
+ updatedChannel = _context14.sent;
14213
14271
  updateChannelOnAllChannels(channel.id, {
14214
14272
  pinnedAt: updatedChannel.pinnedAt
14215
14273
  });
14216
- _context13.next = 12;
14274
+ _context14.next = 12;
14217
14275
  return put(updateChannelDataAC(updatedChannel.id, {
14218
14276
  pinnedAt: updatedChannel.pinnedAt
14219
14277
  }, true));
14220
14278
  case 12:
14221
- _context13.next = 17;
14279
+ _context14.next = 17;
14222
14280
  break;
14223
14281
  case 14:
14224
- _context13.prev = 14;
14225
- _context13.t0 = _context13["catch"](0);
14226
- log.error(_context13.t0, 'Error in pinChannel');
14282
+ _context14.prev = 14;
14283
+ _context14.t0 = _context14["catch"](0);
14284
+ log.error(_context14.t0, 'Error in pinChannel');
14227
14285
  case 17:
14228
14286
  case "end":
14229
- return _context13.stop();
14287
+ return _context14.stop();
14230
14288
  }
14231
- }, _marked13, null, [[0, 14]]);
14289
+ }, _marked14, null, [[0, 14]]);
14232
14290
  }
14233
14291
  function unpinChannel(action) {
14234
14292
  var channelId, channel, updatedChannel;
14235
- return _regeneratorRuntime().wrap(function unpinChannel$(_context14) {
14236
- while (1) switch (_context14.prev = _context14.next) {
14293
+ return _regeneratorRuntime().wrap(function unpinChannel$(_context15) {
14294
+ while (1) switch (_context15.prev = _context15.next) {
14237
14295
  case 0:
14238
- _context14.prev = 0;
14296
+ _context15.prev = 0;
14239
14297
  channelId = action.payload.channelId;
14240
- _context14.next = 4;
14298
+ _context15.next = 4;
14241
14299
  return call(getChannelFromMap, channelId);
14242
14300
  case 4:
14243
- channel = _context14.sent;
14301
+ channel = _context15.sent;
14244
14302
  if (!channel) {
14245
14303
  channel = getChannelFromAllChannels(channelId);
14246
14304
  }
14247
- _context14.next = 8;
14305
+ _context15.next = 8;
14248
14306
  return call(channel.unpin);
14249
14307
  case 8:
14250
- updatedChannel = _context14.sent;
14308
+ updatedChannel = _context15.sent;
14251
14309
  updateChannelOnAllChannels(channel.id, {
14252
14310
  pinnedAt: updatedChannel.pinnedAt
14253
14311
  });
14254
- _context14.next = 12;
14312
+ _context15.next = 12;
14255
14313
  return put(updateChannelDataAC(updatedChannel.id, {
14256
14314
  pinnedAt: updatedChannel.pinnedAt
14257
14315
  }, false, true));
14258
14316
  case 12:
14259
- _context14.next = 17;
14317
+ _context15.next = 17;
14260
14318
  break;
14261
14319
  case 14:
14262
- _context14.prev = 14;
14263
- _context14.t0 = _context14["catch"](0);
14264
- log.error(_context14.t0, 'Error in unpinChannel');
14320
+ _context15.prev = 14;
14321
+ _context15.t0 = _context15["catch"](0);
14322
+ log.error(_context15.t0, 'Error in unpinChannel');
14265
14323
  case 17:
14266
14324
  case "end":
14267
- return _context14.stop();
14325
+ return _context15.stop();
14268
14326
  }
14269
- }, _marked14, null, [[0, 14]]);
14327
+ }, _marked15, null, [[0, 14]]);
14270
14328
  }
14271
14329
  function removeChannelCaches(action) {
14272
14330
  var payload, channelId, activeChannelId, activeChannel;
14273
- return _regeneratorRuntime().wrap(function removeChannelCaches$(_context15) {
14274
- while (1) switch (_context15.prev = _context15.next) {
14331
+ return _regeneratorRuntime().wrap(function removeChannelCaches$(_context16) {
14332
+ while (1) switch (_context16.prev = _context16.next) {
14275
14333
  case 0:
14276
14334
  payload = action.payload;
14277
14335
  channelId = payload.channelId;
14278
- _context15.next = 4;
14336
+ _context16.next = 4;
14279
14337
  return call(getActiveChannelId);
14280
14338
  case 4:
14281
- activeChannelId = _context15.sent;
14339
+ activeChannelId = _context16.sent;
14282
14340
  removeChannelFromMap(channelId);
14283
14341
  removeMessagesFromMap(channelId);
14284
14342
  if (!(activeChannelId === channelId)) {
14285
- _context15.next = 14;
14343
+ _context16.next = 14;
14286
14344
  break;
14287
14345
  }
14288
- _context15.next = 10;
14346
+ _context16.next = 10;
14289
14347
  return call(getLastChannelFromMap);
14290
14348
  case 10:
14291
- activeChannel = _context15.sent;
14349
+ activeChannel = _context16.sent;
14292
14350
  if (!activeChannel) {
14293
- _context15.next = 14;
14351
+ _context16.next = 14;
14294
14352
  break;
14295
14353
  }
14296
- _context15.next = 14;
14354
+ _context16.next = 14;
14297
14355
  return put(switchChannelActionAC(JSON.parse(JSON.stringify(activeChannel))));
14298
14356
  case 14:
14299
14357
  case "end":
14300
- return _context15.stop();
14358
+ return _context16.stop();
14301
14359
  }
14302
- }, _marked15);
14360
+ }, _marked16);
14303
14361
  }
14304
14362
  function leaveChannel(action) {
14305
14363
  var payload, channelId, channel, messageBuilder, messageToSend;
14306
- return _regeneratorRuntime().wrap(function leaveChannel$(_context16) {
14307
- while (1) switch (_context16.prev = _context16.next) {
14364
+ return _regeneratorRuntime().wrap(function leaveChannel$(_context17) {
14365
+ while (1) switch (_context17.prev = _context17.next) {
14308
14366
  case 0:
14309
- _context16.prev = 0;
14367
+ _context17.prev = 0;
14310
14368
  payload = action.payload;
14311
14369
  channelId = payload.channelId;
14312
- _context16.next = 5;
14370
+ _context17.next = 5;
14313
14371
  return call(getChannelFromMap, channelId);
14314
14372
  case 5:
14315
- channel = _context16.sent;
14373
+ channel = _context17.sent;
14316
14374
  if (!channel) {
14317
14375
  channel = getChannelFromAllChannels(channelId);
14318
14376
  }
14319
14377
  if (!channel) {
14320
- _context16.next = 24;
14378
+ _context17.next = 24;
14321
14379
  break;
14322
14380
  }
14323
14381
  if (!(channel.type === DEFAULT_CHANNEL_TYPE.GROUP || channel.type === DEFAULT_CHANNEL_TYPE.PRIVATE)) {
14324
- _context16.next = 16;
14382
+ _context17.next = 16;
14325
14383
  break;
14326
14384
  }
14327
14385
  messageBuilder = channel.createMessageBuilder();
14328
14386
  messageBuilder.setBody('LG').setType('system').setDisplayCount(0).setSilent(true);
14329
14387
  messageToSend = messageBuilder.create();
14330
14388
  log.info('send message for left');
14331
- _context16.next = 16;
14389
+ _context17.next = 16;
14332
14390
  return call(channel.sendMessage, messageToSend);
14333
14391
  case 16:
14334
14392
  log.info('leave');
14335
- _context16.next = 19;
14393
+ _context17.next = 19;
14336
14394
  return call(channel.leave);
14337
14395
  case 19:
14338
- _context16.next = 21;
14396
+ _context17.next = 21;
14339
14397
  return put(removeChannelAC(channelId));
14340
14398
  case 21:
14341
14399
  deleteChannelFromAllChannels(channelId);
14342
- _context16.next = 24;
14400
+ _context17.next = 24;
14343
14401
  return put(removeChannelCachesAC(channelId));
14344
14402
  case 24:
14345
- _context16.next = 29;
14403
+ _context17.next = 29;
14346
14404
  break;
14347
14405
  case 26:
14348
- _context16.prev = 26;
14349
- _context16.t0 = _context16["catch"](0);
14350
- log.error('ERROR in leave channel - ', _context16.t0.message);
14406
+ _context17.prev = 26;
14407
+ _context17.t0 = _context17["catch"](0);
14408
+ log.error('ERROR in leave channel - ', _context17.t0.message);
14351
14409
  case 29:
14352
14410
  case "end":
14353
- return _context16.stop();
14411
+ return _context17.stop();
14354
14412
  }
14355
- }, _marked16, null, [[0, 26]]);
14413
+ }, _marked17, null, [[0, 26]]);
14356
14414
  }
14357
14415
  function deleteChannel(action) {
14358
14416
  var payload, channelId, channel;
14359
- return _regeneratorRuntime().wrap(function deleteChannel$(_context17) {
14360
- while (1) switch (_context17.prev = _context17.next) {
14417
+ return _regeneratorRuntime().wrap(function deleteChannel$(_context18) {
14418
+ while (1) switch (_context18.prev = _context18.next) {
14361
14419
  case 0:
14362
- _context17.prev = 0;
14420
+ _context18.prev = 0;
14363
14421
  payload = action.payload;
14364
14422
  channelId = payload.channelId;
14365
- _context17.next = 5;
14423
+ _context18.next = 5;
14366
14424
  return call(getChannelFromMap, channelId);
14367
14425
  case 5:
14368
- channel = _context17.sent;
14426
+ channel = _context18.sent;
14369
14427
  if (!channel) {
14370
14428
  channel = getChannelFromAllChannels(channelId);
14371
14429
  }
14372
14430
  if (!channel) {
14373
- _context17.next = 16;
14431
+ _context18.next = 16;
14374
14432
  break;
14375
14433
  }
14376
- _context17.next = 10;
14434
+ _context18.next = 10;
14377
14435
  return call(channel["delete"]);
14378
14436
  case 10:
14379
- _context17.next = 12;
14437
+ _context18.next = 12;
14380
14438
  return put(setChannelToRemoveAC(channel));
14381
14439
  case 12:
14382
- _context17.next = 14;
14440
+ _context18.next = 14;
14383
14441
  return put(removeChannelAC(channelId));
14384
14442
  case 14:
14385
- _context17.next = 16;
14443
+ _context18.next = 16;
14386
14444
  return put(removeChannelCachesAC(channelId));
14387
14445
  case 16:
14388
- _context17.next = 21;
14446
+ _context18.next = 21;
14389
14447
  break;
14390
14448
  case 18:
14391
- _context17.prev = 18;
14392
- _context17.t0 = _context17["catch"](0);
14393
- log.error('ERROR in delete channel', _context17.t0);
14449
+ _context18.prev = 18;
14450
+ _context18.t0 = _context18["catch"](0);
14451
+ log.error('ERROR in delete channel', _context18.t0);
14394
14452
  case 21:
14395
14453
  case "end":
14396
- return _context17.stop();
14454
+ return _context18.stop();
14397
14455
  }
14398
- }, _marked17, null, [[0, 18]]);
14456
+ }, _marked18, null, [[0, 18]]);
14399
14457
  }
14400
14458
  function blockChannel(action) {
14401
14459
  var payload, channelId, channel;
14402
- return _regeneratorRuntime().wrap(function blockChannel$(_context18) {
14403
- while (1) switch (_context18.prev = _context18.next) {
14460
+ return _regeneratorRuntime().wrap(function blockChannel$(_context19) {
14461
+ while (1) switch (_context19.prev = _context19.next) {
14404
14462
  case 0:
14405
- _context18.prev = 0;
14463
+ _context19.prev = 0;
14406
14464
  payload = action.payload;
14407
14465
  channelId = payload.channelId;
14408
- _context18.next = 5;
14466
+ _context19.next = 5;
14409
14467
  return call(getChannelFromMap, channelId);
14410
14468
  case 5:
14411
- channel = _context18.sent;
14469
+ channel = _context19.sent;
14412
14470
  if (!channel) {
14413
14471
  channel = getChannelFromAllChannels(channelId);
14414
14472
  }
14415
14473
  if (!channel) {
14416
- _context18.next = 14;
14474
+ _context19.next = 14;
14417
14475
  break;
14418
14476
  }
14419
- _context18.next = 10;
14477
+ _context19.next = 10;
14420
14478
  return call(channel.block);
14421
14479
  case 10:
14422
- _context18.next = 12;
14480
+ _context19.next = 12;
14423
14481
  return put(removeChannelAC(channelId));
14424
14482
  case 12:
14425
- _context18.next = 14;
14483
+ _context19.next = 14;
14426
14484
  return put(removeChannelCachesAC(channelId));
14427
14485
  case 14:
14428
- _context18.next = 19;
14486
+ _context19.next = 19;
14429
14487
  break;
14430
14488
  case 16:
14431
- _context18.prev = 16;
14432
- _context18.t0 = _context18["catch"](0);
14433
- log.error('ERROR in block channel - ', _context18.t0.message);
14489
+ _context19.prev = 16;
14490
+ _context19.t0 = _context19["catch"](0);
14491
+ log.error('ERROR in block channel - ', _context19.t0.message);
14434
14492
  case 19:
14435
14493
  case "end":
14436
- return _context18.stop();
14494
+ return _context19.stop();
14437
14495
  }
14438
- }, _marked18, null, [[0, 16]]);
14496
+ }, _marked19, null, [[0, 16]]);
14439
14497
  }
14440
14498
  function updateChannel(action) {
14441
14499
  var payload, channelId, config, SceytChatClient, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata;
14442
- return _regeneratorRuntime().wrap(function updateChannel$(_context19) {
14443
- while (1) switch (_context19.prev = _context19.next) {
14500
+ return _regeneratorRuntime().wrap(function updateChannel$(_context20) {
14501
+ while (1) switch (_context20.prev = _context20.next) {
14444
14502
  case 0:
14445
- _context19.prev = 0;
14503
+ _context20.prev = 0;
14446
14504
  payload = action.payload;
14447
14505
  channelId = payload.channelId, config = payload.config;
14448
14506
  SceytChatClient = getClient();
14449
- _context19.next = 6;
14507
+ _context20.next = 6;
14450
14508
  return call(getChannelFromMap, channelId);
14451
14509
  case 6:
14452
- channel = _context19.sent;
14510
+ channel = _context20.sent;
14453
14511
  if (!channel) {
14454
14512
  channel = getChannelFromAllChannels(channelId);
14455
14513
  }
@@ -14460,7 +14518,7 @@ function updateChannel(action) {
14460
14518
  avatarUrl: channel.avatarUrl
14461
14519
  };
14462
14520
  if (!config.avatar) {
14463
- _context19.next = 14;
14521
+ _context20.next = 14;
14464
14522
  break;
14465
14523
  }
14466
14524
  fileToUpload = {
@@ -14469,10 +14527,10 @@ function updateChannel(action) {
14469
14527
  log.info('upload percent - ', progressPercent);
14470
14528
  }
14471
14529
  };
14472
- _context19.next = 13;
14530
+ _context20.next = 13;
14473
14531
  return call(SceytChatClient.uploadFile, fileToUpload);
14474
14532
  case 13:
14475
- paramsToUpdate.avatarUrl = _context19.sent;
14533
+ paramsToUpdate.avatarUrl = _context20.sent;
14476
14534
  case 14:
14477
14535
  if (config.subject) {
14478
14536
  paramsToUpdate.subject = config.subject;
@@ -14483,14 +14541,14 @@ function updateChannel(action) {
14483
14541
  if (config.avatarUrl === '') {
14484
14542
  paramsToUpdate.avatarUrl = '';
14485
14543
  }
14486
- _context19.next = 19;
14544
+ _context20.next = 19;
14487
14545
  return call(channel.update, paramsToUpdate);
14488
14546
  case 19:
14489
- _yield$call5 = _context19.sent;
14547
+ _yield$call5 = _context20.sent;
14490
14548
  subject = _yield$call5.subject;
14491
14549
  avatarUrl = _yield$call5.avatarUrl;
14492
14550
  metadata = _yield$call5.metadata;
14493
- _context19.next = 25;
14551
+ _context20.next = 25;
14494
14552
  return put(updateChannelDataAC(channelId, {
14495
14553
  subject: subject,
14496
14554
  avatarUrl: avatarUrl,
@@ -14502,30 +14560,30 @@ function updateChannel(action) {
14502
14560
  avatarUrl: avatarUrl,
14503
14561
  metadata: isJSON(metadata) ? JSON.parse(metadata) : metadata
14504
14562
  });
14505
- _context19.next = 31;
14563
+ _context20.next = 31;
14506
14564
  break;
14507
14565
  case 28:
14508
- _context19.prev = 28;
14509
- _context19.t0 = _context19["catch"](0);
14510
- log.error('ERROR in update channel', _context19.t0.message);
14566
+ _context20.prev = 28;
14567
+ _context20.t0 = _context20["catch"](0);
14568
+ log.error('ERROR in update channel', _context20.t0.message);
14511
14569
  case 31:
14512
14570
  case "end":
14513
- return _context19.stop();
14571
+ return _context20.stop();
14514
14572
  }
14515
- }, _marked19, null, [[0, 28]]);
14573
+ }, _marked20, null, [[0, 28]]);
14516
14574
  }
14517
14575
  function checkUsersStatus() {
14518
14576
  var SceytChatClient, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData;
14519
- return _regeneratorRuntime().wrap(function checkUsersStatus$(_context20) {
14520
- while (1) switch (_context20.prev = _context20.next) {
14577
+ return _regeneratorRuntime().wrap(function checkUsersStatus$(_context21) {
14578
+ while (1) switch (_context21.prev = _context21.next) {
14521
14579
  case 0:
14522
- _context20.prev = 0;
14580
+ _context21.prev = 0;
14523
14581
  SceytChatClient = getClient();
14524
14582
  usersForUpdate = Object.keys(usersMap);
14525
- _context20.next = 5;
14583
+ _context21.next = 5;
14526
14584
  return call(SceytChatClient.getUsers, usersForUpdate);
14527
14585
  case 5:
14528
- updatedUsers = _context20.sent;
14586
+ updatedUsers = _context21.sent;
14529
14587
  usersToUpdateMap = {};
14530
14588
  update = false;
14531
14589
  updatedUsers.forEach(function (updatedUser) {
@@ -14537,156 +14595,156 @@ function checkUsersStatus() {
14537
14595
  }
14538
14596
  });
14539
14597
  if (!update) {
14540
- _context20.next = 17;
14598
+ _context21.next = 17;
14541
14599
  break;
14542
14600
  }
14543
14601
  updateData = JSON.parse(JSON.stringify(usersToUpdateMap));
14544
- _context20.next = 13;
14602
+ _context21.next = 13;
14545
14603
  return put(updateMembersPresenceAC(updateData));
14546
14604
  case 13:
14547
- _context20.next = 15;
14605
+ _context21.next = 15;
14548
14606
  return put(updateUserStatusOnMapAC(updateData));
14549
14607
  case 15:
14550
- _context20.next = 17;
14608
+ _context21.next = 17;
14551
14609
  return put(updateUserStatusOnChannelAC(updateData));
14552
14610
  case 17:
14553
- _context20.next = 22;
14611
+ _context21.next = 22;
14554
14612
  break;
14555
14613
  case 19:
14556
- _context20.prev = 19;
14557
- _context20.t0 = _context20["catch"](0);
14558
- log.error('ERROR in check user status : ', _context20.t0.message);
14614
+ _context21.prev = 19;
14615
+ _context21.t0 = _context21["catch"](0);
14616
+ log.error('ERROR in check user status : ', _context21.t0.message);
14559
14617
  case 22:
14560
14618
  case "end":
14561
- return _context20.stop();
14619
+ return _context21.stop();
14562
14620
  }
14563
- }, _marked20, null, [[0, 19]]);
14621
+ }, _marked21, null, [[0, 19]]);
14564
14622
  }
14565
14623
  function sendTyping(action) {
14566
14624
  var state, activeChannelId, channel;
14567
- return _regeneratorRuntime().wrap(function sendTyping$(_context21) {
14568
- while (1) switch (_context21.prev = _context21.next) {
14625
+ return _regeneratorRuntime().wrap(function sendTyping$(_context22) {
14626
+ while (1) switch (_context22.prev = _context22.next) {
14569
14627
  case 0:
14570
14628
  state = action.payload.state;
14571
- _context21.next = 3;
14629
+ _context22.next = 3;
14572
14630
  return call(getActiveChannelId);
14573
14631
  case 3:
14574
- activeChannelId = _context21.sent;
14575
- _context21.next = 6;
14632
+ activeChannelId = _context22.sent;
14633
+ _context22.next = 6;
14576
14634
  return call(getChannelFromMap, activeChannelId);
14577
14635
  case 6:
14578
- channel = _context21.sent;
14579
- _context21.prev = 7;
14636
+ channel = _context22.sent;
14637
+ _context22.prev = 7;
14580
14638
  if (!channel) {
14581
- _context21.next = 16;
14639
+ _context22.next = 16;
14582
14640
  break;
14583
14641
  }
14584
14642
  if (!state) {
14585
- _context21.next = 14;
14643
+ _context22.next = 14;
14586
14644
  break;
14587
14645
  }
14588
- _context21.next = 12;
14646
+ _context22.next = 12;
14589
14647
  return call(channel.startTyping);
14590
14648
  case 12:
14591
- _context21.next = 16;
14649
+ _context22.next = 16;
14592
14650
  break;
14593
14651
  case 14:
14594
- _context21.next = 16;
14652
+ _context22.next = 16;
14595
14653
  return call(channel.stopTyping);
14596
14654
  case 16:
14597
- _context21.next = 21;
14655
+ _context22.next = 21;
14598
14656
  break;
14599
14657
  case 18:
14600
- _context21.prev = 18;
14601
- _context21.t0 = _context21["catch"](7);
14602
- log.error('ERROR in send typing', _context21.t0);
14658
+ _context22.prev = 18;
14659
+ _context22.t0 = _context22["catch"](7);
14660
+ log.error('ERROR in send typing', _context22.t0);
14603
14661
  case 21:
14604
14662
  case "end":
14605
- return _context21.stop();
14663
+ return _context22.stop();
14606
14664
  }
14607
- }, _marked21, null, [[7, 18]]);
14665
+ }, _marked22, null, [[7, 18]]);
14608
14666
  }
14609
14667
  function sendRecording(action) {
14610
14668
  var state, activeChannelId, channel;
14611
- return _regeneratorRuntime().wrap(function sendRecording$(_context22) {
14612
- while (1) switch (_context22.prev = _context22.next) {
14669
+ return _regeneratorRuntime().wrap(function sendRecording$(_context23) {
14670
+ while (1) switch (_context23.prev = _context23.next) {
14613
14671
  case 0:
14614
14672
  state = action.payload.state;
14615
- _context22.next = 3;
14673
+ _context23.next = 3;
14616
14674
  return call(getActiveChannelId);
14617
14675
  case 3:
14618
- activeChannelId = _context22.sent;
14619
- _context22.next = 6;
14676
+ activeChannelId = _context23.sent;
14677
+ _context23.next = 6;
14620
14678
  return call(getChannelFromMap, activeChannelId);
14621
14679
  case 6:
14622
- channel = _context22.sent;
14623
- _context22.prev = 7;
14680
+ channel = _context23.sent;
14681
+ _context23.prev = 7;
14624
14682
  if (!channel) {
14625
- _context22.next = 16;
14683
+ _context23.next = 16;
14626
14684
  break;
14627
14685
  }
14628
14686
  if (!state) {
14629
- _context22.next = 14;
14687
+ _context23.next = 14;
14630
14688
  break;
14631
14689
  }
14632
- _context22.next = 12;
14690
+ _context23.next = 12;
14633
14691
  return call(channel.startRecording);
14634
14692
  case 12:
14635
- _context22.next = 16;
14693
+ _context23.next = 16;
14636
14694
  break;
14637
14695
  case 14:
14638
- _context22.next = 16;
14696
+ _context23.next = 16;
14639
14697
  return call(channel.stopRecording);
14640
14698
  case 16:
14641
- _context22.next = 21;
14699
+ _context23.next = 21;
14642
14700
  break;
14643
14701
  case 18:
14644
- _context22.prev = 18;
14645
- _context22.t0 = _context22["catch"](7);
14646
- log.error('ERROR in send recording', _context22.t0);
14702
+ _context23.prev = 18;
14703
+ _context23.t0 = _context23["catch"](7);
14704
+ log.error('ERROR in send recording', _context23.t0);
14647
14705
  case 21:
14648
14706
  case "end":
14649
- return _context22.stop();
14707
+ return _context23.stop();
14650
14708
  }
14651
- }, _marked22, null, [[7, 18]]);
14709
+ }, _marked23, null, [[7, 18]]);
14652
14710
  }
14653
14711
  function clearHistory(action) {
14654
14712
  var payload, channelId, channel, activeChannelId, groupName;
14655
- return _regeneratorRuntime().wrap(function clearHistory$(_context23) {
14656
- while (1) switch (_context23.prev = _context23.next) {
14713
+ return _regeneratorRuntime().wrap(function clearHistory$(_context24) {
14714
+ while (1) switch (_context24.prev = _context24.next) {
14657
14715
  case 0:
14658
- _context23.prev = 0;
14716
+ _context24.prev = 0;
14659
14717
  payload = action.payload;
14660
14718
  channelId = payload.channelId;
14661
- _context23.next = 5;
14719
+ _context24.next = 5;
14662
14720
  return call(getChannelFromMap, channelId);
14663
14721
  case 5:
14664
- channel = _context23.sent;
14722
+ channel = _context24.sent;
14665
14723
  if (!channel) {
14666
14724
  channel = getChannelFromAllChannels(channelId);
14667
14725
  }
14668
- _context23.next = 9;
14726
+ _context24.next = 9;
14669
14727
  return call(getActiveChannelId);
14670
14728
  case 9:
14671
- activeChannelId = _context23.sent;
14729
+ activeChannelId = _context24.sent;
14672
14730
  if (!channel) {
14673
- _context23.next = 25;
14731
+ _context24.next = 25;
14674
14732
  break;
14675
14733
  }
14676
- _context23.next = 13;
14734
+ _context24.next = 13;
14677
14735
  return call(channel.deleteAllMessages);
14678
14736
  case 13:
14679
- _context23.next = 15;
14737
+ _context24.next = 15;
14680
14738
  return put(clearMessagesAC());
14681
14739
  case 15:
14682
14740
  removeMessagesFromMap(channelId);
14683
14741
  if (channelId === activeChannelId) {
14684
14742
  removeAllMessages();
14685
14743
  }
14686
- _context23.next = 19;
14744
+ _context24.next = 19;
14687
14745
  return put(clearSelectedMessagesAC());
14688
14746
  case 19:
14689
- _context23.next = 21;
14747
+ _context24.next = 21;
14690
14748
  return put(updateChannelDataAC(channel.id, {
14691
14749
  lastMessage: null,
14692
14750
  newMessageCount: 0,
@@ -14699,65 +14757,65 @@ function clearHistory(action) {
14699
14757
  newMentionCount: 0
14700
14758
  });
14701
14759
  groupName = getChannelGroupName(channel);
14702
- _context23.next = 25;
14760
+ _context24.next = 25;
14703
14761
  return put(updateSearchedChannelDataAC(channel.id, {
14704
14762
  lastMessage: null,
14705
14763
  newMessageCount: 0,
14706
14764
  newMentionCount: 0
14707
14765
  }, groupName));
14708
14766
  case 25:
14709
- _context23.next = 30;
14767
+ _context24.next = 30;
14710
14768
  break;
14711
14769
  case 27:
14712
- _context23.prev = 27;
14713
- _context23.t0 = _context23["catch"](0);
14714
- log.error('ERROR in clear history', _context23.t0);
14770
+ _context24.prev = 27;
14771
+ _context24.t0 = _context24["catch"](0);
14772
+ log.error('ERROR in clear history', _context24.t0);
14715
14773
  case 30:
14716
14774
  case "end":
14717
- return _context23.stop();
14775
+ return _context24.stop();
14718
14776
  }
14719
- }, _marked23, null, [[0, 27]]);
14777
+ }, _marked24, null, [[0, 27]]);
14720
14778
  }
14721
14779
  function deleteAllMessages(action) {
14722
14780
  var payload, channelId, channel, activeChannelId, groupName;
14723
- return _regeneratorRuntime().wrap(function deleteAllMessages$(_context24) {
14724
- while (1) switch (_context24.prev = _context24.next) {
14781
+ return _regeneratorRuntime().wrap(function deleteAllMessages$(_context25) {
14782
+ while (1) switch (_context25.prev = _context25.next) {
14725
14783
  case 0:
14726
- _context24.prev = 0;
14784
+ _context25.prev = 0;
14727
14785
  payload = action.payload;
14728
14786
  channelId = payload.channelId;
14729
- _context24.next = 5;
14787
+ _context25.next = 5;
14730
14788
  return call(getChannelFromMap, channelId);
14731
14789
  case 5:
14732
- channel = _context24.sent;
14790
+ channel = _context25.sent;
14733
14791
  if (!channel) {
14734
14792
  channel = getChannelFromAllChannels(channelId);
14735
14793
  }
14736
- _context24.next = 9;
14794
+ _context25.next = 9;
14737
14795
  return call(getActiveChannelId);
14738
14796
  case 9:
14739
- activeChannelId = _context24.sent;
14797
+ activeChannelId = _context25.sent;
14740
14798
  if (!channel) {
14741
- _context24.next = 26;
14799
+ _context25.next = 26;
14742
14800
  break;
14743
14801
  }
14744
- _context24.next = 13;
14802
+ _context25.next = 13;
14745
14803
  return call(channel.deleteAllMessages, true);
14746
14804
  case 13:
14747
14805
  removeMessagesFromMap(channelId);
14748
14806
  if (!(channelId === activeChannelId)) {
14749
- _context24.next = 18;
14807
+ _context25.next = 18;
14750
14808
  break;
14751
14809
  }
14752
- _context24.next = 17;
14810
+ _context25.next = 17;
14753
14811
  return put(clearMessagesAC());
14754
14812
  case 17:
14755
14813
  removeAllMessages();
14756
14814
  case 18:
14757
- _context24.next = 20;
14815
+ _context25.next = 20;
14758
14816
  return put(clearSelectedMessagesAC());
14759
14817
  case 20:
14760
- _context24.next = 22;
14818
+ _context25.next = 22;
14761
14819
  return put(updateChannelDataAC(channel.id, {
14762
14820
  lastMessage: null,
14763
14821
  newMessageCount: 0,
@@ -14770,183 +14828,186 @@ function deleteAllMessages(action) {
14770
14828
  newMentionCount: 0
14771
14829
  });
14772
14830
  groupName = getChannelGroupName(channel);
14773
- _context24.next = 26;
14831
+ _context25.next = 26;
14774
14832
  return put(updateSearchedChannelDataAC(channel.id, {
14775
14833
  lastMessage: null,
14776
14834
  newMessageCount: 0,
14777
14835
  newMentionCount: 0
14778
14836
  }, groupName));
14779
14837
  case 26:
14780
- _context24.next = 31;
14838
+ _context25.next = 31;
14781
14839
  break;
14782
14840
  case 28:
14783
- _context24.prev = 28;
14784
- _context24.t0 = _context24["catch"](0);
14785
- log.error('ERROR in clear history', _context24.t0);
14841
+ _context25.prev = 28;
14842
+ _context25.t0 = _context25["catch"](0);
14843
+ log.error('ERROR in clear history', _context25.t0);
14786
14844
  case 31:
14787
14845
  case "end":
14788
- return _context24.stop();
14846
+ return _context25.stop();
14789
14847
  }
14790
- }, _marked24, null, [[0, 28]]);
14848
+ }, _marked25, null, [[0, 28]]);
14791
14849
  }
14792
14850
  function joinChannel(action) {
14793
14851
  var payload, channelId, SceytChatClient, channel, joinedChannel;
14794
- return _regeneratorRuntime().wrap(function joinChannel$(_context25) {
14795
- while (1) switch (_context25.prev = _context25.next) {
14852
+ return _regeneratorRuntime().wrap(function joinChannel$(_context26) {
14853
+ while (1) switch (_context26.prev = _context26.next) {
14796
14854
  case 0:
14797
- _context25.prev = 0;
14855
+ _context26.prev = 0;
14798
14856
  payload = action.payload;
14799
14857
  channelId = payload.channelId;
14800
14858
  SceytChatClient = getClient();
14801
- _context25.next = 6;
14859
+ _context26.next = 6;
14802
14860
  return call(getChannelFromMap, channelId);
14803
14861
  case 6:
14804
- channel = _context25.sent;
14862
+ channel = _context26.sent;
14805
14863
  if (!channel) {
14806
14864
  channel = getChannelFromAllChannels(channelId);
14807
14865
  }
14808
14866
  if (channel) {
14809
- _context25.next = 12;
14867
+ _context26.next = 12;
14810
14868
  break;
14811
14869
  }
14812
- _context25.next = 11;
14870
+ _context26.next = 11;
14813
14871
  return call(SceytChatClient.getChannel, channelId);
14814
14872
  case 11:
14815
- channel = _context25.sent;
14873
+ channel = _context26.sent;
14816
14874
  case 12:
14817
- _context25.next = 14;
14875
+ _context26.next = 14;
14818
14876
  return call(channel.join);
14819
14877
  case 14:
14820
- joinedChannel = _context25.sent;
14821
- _context25.next = 17;
14878
+ joinedChannel = _context26.sent;
14879
+ _context26.next = 17;
14822
14880
  return put(setCloseSearchChannelsAC(true));
14823
14881
  case 17:
14824
- _context25.next = 19;
14882
+ _context26.next = 19;
14825
14883
  return put(setChannelToAddAC(JSON.parse(JSON.stringify(joinedChannel))));
14826
14884
  case 19:
14827
- _context25.next = 21;
14885
+ _context26.next = 21;
14828
14886
  return put(switchChannelActionAC(JSON.parse(JSON.stringify(joinedChannel))));
14829
14887
  case 21:
14830
14888
  addChannelToAllChannels(joinedChannel);
14831
- _context25.next = 24;
14889
+ _context26.next = 24;
14832
14890
  return call(setActiveChannelId, joinedChannel.id);
14833
14891
  case 24:
14834
- _context25.next = 29;
14892
+ _context26.next = 29;
14835
14893
  break;
14836
14894
  case 26:
14837
- _context25.prev = 26;
14838
- _context25.t0 = _context25["catch"](0);
14839
- log.error(_context25.t0, 'Error in join to channel');
14895
+ _context26.prev = 26;
14896
+ _context26.t0 = _context26["catch"](0);
14897
+ log.error(_context26.t0, 'Error in join to channel');
14840
14898
  case 29:
14841
14899
  case "end":
14842
- return _context25.stop();
14900
+ return _context26.stop();
14843
14901
  }
14844
- }, _marked25, null, [[0, 26]]);
14902
+ }, _marked26, null, [[0, 26]]);
14845
14903
  }
14846
14904
  function watchForChannelEvents() {
14847
- return _regeneratorRuntime().wrap(function watchForChannelEvents$(_context26) {
14848
- while (1) switch (_context26.prev = _context26.next) {
14905
+ return _regeneratorRuntime().wrap(function watchForChannelEvents$(_context27) {
14906
+ while (1) switch (_context27.prev = _context27.next) {
14849
14907
  case 0:
14850
- _context26.next = 2;
14908
+ _context27.next = 2;
14851
14909
  return call(watchForEvents);
14852
14910
  case 2:
14853
14911
  case "end":
14854
- return _context26.stop();
14912
+ return _context27.stop();
14855
14913
  }
14856
- }, _marked26);
14914
+ }, _marked27);
14857
14915
  }
14858
14916
  function ChannelsSaga() {
14859
- return _regeneratorRuntime().wrap(function ChannelsSaga$(_context27) {
14860
- while (1) switch (_context27.prev = _context27.next) {
14917
+ return _regeneratorRuntime().wrap(function ChannelsSaga$(_context28) {
14918
+ while (1) switch (_context28.prev = _context28.next) {
14861
14919
  case 0:
14862
- _context27.next = 2;
14920
+ _context28.next = 2;
14863
14921
  return takeLatest(CREATE_CHANNEL, createChannel);
14864
14922
  case 2:
14865
- _context27.next = 4;
14923
+ _context28.next = 4;
14866
14924
  return takeLatest(GET_CHANNELS, getChannels);
14867
14925
  case 4:
14868
- _context27.next = 6;
14926
+ _context28.next = 6;
14869
14927
  return takeLatest(SEARCH_CHANNELS, searchChannels);
14870
14928
  case 6:
14871
- _context27.next = 8;
14929
+ _context28.next = 8;
14872
14930
  return takeLatest(GET_CHANNELS_FOR_FORWARD, getChannelsForForward);
14873
14931
  case 8:
14874
- _context27.next = 10;
14932
+ _context28.next = 10;
14875
14933
  return takeLatest(SEARCH_CHANNELS_FOR_FORWARD, searchChannelsForForward);
14876
14934
  case 10:
14877
- _context27.next = 12;
14935
+ _context28.next = 12;
14878
14936
  return takeLatest(LOAD_MORE_CHANNEL, channelsLoadMore);
14879
14937
  case 12:
14880
- _context27.next = 14;
14938
+ _context28.next = 14;
14881
14939
  return takeLatest(LOAD_MORE_CHANNELS_FOR_FORWARD, channelsForForwardLoadMore);
14882
14940
  case 14:
14883
- _context27.next = 16;
14941
+ _context28.next = 16;
14884
14942
  return takeEvery(SWITCH_CHANNEL, switchChannel);
14885
14943
  case 16:
14886
- _context27.next = 18;
14944
+ _context28.next = 18;
14887
14945
  return takeLatest(LEAVE_CHANNEL, leaveChannel);
14888
14946
  case 18:
14889
- _context27.next = 20;
14947
+ _context28.next = 20;
14890
14948
  return takeLatest(DELETE_CHANNEL, deleteChannel);
14891
14949
  case 20:
14892
- _context27.next = 22;
14950
+ _context28.next = 22;
14893
14951
  return takeLatest(BLOCK_CHANNEL, blockChannel);
14894
14952
  case 22:
14895
- _context27.next = 24;
14953
+ _context28.next = 24;
14896
14954
  return takeLatest(UPDATE_CHANNEL, updateChannel);
14897
14955
  case 24:
14898
- _context27.next = 26;
14956
+ _context28.next = 26;
14899
14957
  return takeEvery(MARK_MESSAGES_AS_READ, markMessagesRead);
14900
14958
  case 26:
14901
- _context27.next = 28;
14959
+ _context28.next = 28;
14902
14960
  return takeLatest(MARK_MESSAGES_AS_DELIVERED, markMessagesDelivered);
14903
14961
  case 28:
14904
- _context27.next = 30;
14962
+ _context28.next = 30;
14905
14963
  return takeLatest(WATCH_FOR_EVENTS, watchForChannelEvents);
14906
14964
  case 30:
14907
- _context27.next = 32;
14965
+ _context28.next = 32;
14908
14966
  return takeLatest(TURN_OFF_NOTIFICATION, notificationsTurnOff);
14909
14967
  case 32:
14910
- _context27.next = 34;
14968
+ _context28.next = 34;
14911
14969
  return takeLatest(TURN_ON_NOTIFICATION, notificationsTurnOn);
14912
14970
  case 34:
14913
- _context27.next = 36;
14971
+ _context28.next = 36;
14914
14972
  return takeLatest(MARK_CHANNEL_AS_READ, markChannelAsRead);
14915
14973
  case 36:
14916
- _context27.next = 38;
14974
+ _context28.next = 38;
14917
14975
  return takeLatest(MARK_CHANNEL_AS_UNREAD, markChannelAsUnRead);
14918
14976
  case 38:
14919
- _context27.next = 40;
14977
+ _context28.next = 40;
14920
14978
  return takeLatest(CHECK_USER_STATUS, checkUsersStatus);
14921
14979
  case 40:
14922
- _context27.next = 42;
14980
+ _context28.next = 42;
14923
14981
  return takeLatest(SEND_TYPING, sendTyping);
14924
14982
  case 42:
14925
- _context27.next = 44;
14983
+ _context28.next = 44;
14926
14984
  return takeLatest(SEND_RECORDING, sendRecording);
14927
14985
  case 44:
14928
- _context27.next = 46;
14986
+ _context28.next = 46;
14929
14987
  return takeLatest(PIN_CHANNEL, pinChannel);
14930
14988
  case 46:
14931
- _context27.next = 48;
14989
+ _context28.next = 48;
14932
14990
  return takeLatest(UNPIN_CHANNEL, unpinChannel);
14933
14991
  case 48:
14934
- _context27.next = 50;
14992
+ _context28.next = 50;
14935
14993
  return takeLatest(CLEAR_HISTORY, clearHistory);
14936
14994
  case 50:
14937
- _context27.next = 52;
14995
+ _context28.next = 52;
14938
14996
  return takeLatest(JOIN_TO_CHANNEL, joinChannel);
14939
14997
  case 52:
14940
- _context27.next = 54;
14998
+ _context28.next = 54;
14941
14999
  return takeLatest(DELETE_ALL_MESSAGES, deleteAllMessages);
14942
15000
  case 54:
14943
- _context27.next = 56;
15001
+ _context28.next = 56;
14944
15002
  return takeLatest(REMOVE_CHANNEL_CACHES, removeChannelCaches);
14945
15003
  case 56:
15004
+ _context28.next = 58;
15005
+ return takeLatest(GET_CHANNEL_MENTIONS, getChannelMentions);
15006
+ case 58:
14946
15007
  case "end":
14947
- return _context27.stop();
15008
+ return _context28.stop();
14948
15009
  }
14949
- }, _marked27);
15010
+ }, _marked28);
14950
15011
  }
14951
15012
 
14952
15013
  function rgbaToThumbHash(w, h, rgba) {
@@ -21827,6 +21888,7 @@ var ChannelList = function ChannelList(_ref) {
21827
21888
  }, [searchValue]);
21828
21889
  useDidUpdate(function () {
21829
21890
  if (getSelectedChannel) {
21891
+ dispatch(getChannelMentionsAC(activeChannel.id));
21830
21892
  getSelectedChannel(activeChannel);
21831
21893
  }
21832
21894
  }, [activeChannel && activeChannel.members && activeChannel.members.length]);
@@ -38637,8 +38699,34 @@ var MessagesScrollToBottomButton = function MessagesScrollToBottomButton(_ref) {
38637
38699
  var theme = useSelector(themeSelector);
38638
38700
  var sendMessageInputHeight = useSelector(sendMessageInputHeightSelector);
38639
38701
  var showScrollToNewMessageButton = useSelector(showScrollToNewMessageButtonSelector);
38702
+ var messages = useSelector(activeChannelMessagesSelector) || [];
38640
38703
  var handleScrollToBottom = function handleScrollToBottom() {
38641
- dispatch(scrollToNewMessageAC(true, true));
38704
+ dispatch(markMessagesAsReadAC(channel.id, [channel.lastMessage.id]));
38705
+ handleScrollToRepliedMessage(channel.lastMessage.id);
38706
+ };
38707
+ var handleScrollToRepliedMessage = function handleScrollToRepliedMessage(messageId) {
38708
+ try {
38709
+ if (messages.findIndex(function (msg) {
38710
+ return msg.id === messageId;
38711
+ }) >= 10) {
38712
+ var repliedMessage = document.getElementById(messageId);
38713
+ if (repliedMessage) {
38714
+ var scrollRef = document.getElementById('scrollableDiv');
38715
+ if (scrollRef) {
38716
+ scrollRef.scrollTop = repliedMessage.offsetTop - scrollRef.offsetHeight / 2;
38717
+ }
38718
+ repliedMessage.classList.add('highlight');
38719
+ setTimeout(function () {
38720
+ repliedMessage.classList.remove('highlight');
38721
+ }, 1000);
38722
+ }
38723
+ } else {
38724
+ dispatch(getMessagesAC(channel, undefined, messageId));
38725
+ }
38726
+ return Promise.resolve();
38727
+ } catch (e) {
38728
+ return Promise.reject(e);
38729
+ }
38642
38730
  };
38643
38731
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, showScrollToNewMessageButton && (/*#__PURE__*/React__default.createElement(BottomButton, {
38644
38732
  theme: theme,
@@ -38681,5 +38769,144 @@ var UnreadCount$1 = styled.span(_templateObject2$O || (_templateObject2$O = _tag
38681
38769
  return props.textColor || '#fff';
38682
38770
  });
38683
38771
 
38684
- export { Attachment$1 as Attachment, Avatar, Channel, ChannelDetailsContainer as ChannelDetails, ChannelList, ChannelSearch, Chat, ChatHeader, CreateChannel, DropDown, EmojisPopup, FrequentlyEmojis, MessagesContainer as MessageList, MessageStatusIcon, MessageTextFormat, MessagesScrollToBottomButton, SceytChatContainer as SceytChat, SendMessageInput as SendMessage, THEME_COLORS };
38772
+ var _path$1t, _path2$9;
38773
+ function _extends$1x() {
38774
+ return _extends$1x = Object.assign ? Object.assign.bind() : function (n) {
38775
+ for (var e = 1; e < arguments.length; e++) {
38776
+ var t = arguments[e];
38777
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
38778
+ }
38779
+ return n;
38780
+ }, _extends$1x.apply(null, arguments);
38781
+ }
38782
+ function SvgMention(props) {
38783
+ return /*#__PURE__*/createElement$1("svg", _extends$1x({
38784
+ width: 24,
38785
+ height: 24,
38786
+ fill: "none",
38787
+ xmlns: "http://www.w3.org/2000/svg"
38788
+ }, props), _path$1t || (_path$1t = /*#__PURE__*/createElement$1("path", {
38789
+ d: "M12 15.6a3.6 3.6 0 100-7.2 3.6 3.6 0 000 7.2z",
38790
+ stroke: "currentColor",
38791
+ strokeWidth: 1.8,
38792
+ strokeLinecap: "round",
38793
+ strokeLinejoin: "round"
38794
+ })), _path2$9 || (_path2$9 = /*#__PURE__*/createElement$1("path", {
38795
+ d: "M15.6 8.4v4.5a2.7 2.7 0 005.4 0V12a9 9 0 10-3.528 7.145",
38796
+ stroke: "currentColor",
38797
+ strokeWidth: 1.8,
38798
+ strokeLinecap: "round",
38799
+ strokeLinejoin: "round"
38800
+ })));
38801
+ }
38802
+
38803
+ var _templateObject$X, _templateObject2$P;
38804
+ var MessagesScrollToUnreadMentionsButton = function MessagesScrollToUnreadMentionsButton(_ref) {
38805
+ var buttonIcon = _ref.buttonIcon,
38806
+ buttonWidth = _ref.buttonWidth,
38807
+ buttonHeight = _ref.buttonHeight,
38808
+ bottomPosition = _ref.bottomPosition,
38809
+ rightPosition = _ref.rightPosition,
38810
+ buttonBorder = _ref.buttonBorder,
38811
+ buttonBackgroundColor = _ref.buttonBackgroundColor,
38812
+ buttonHoverBackgroundColor = _ref.buttonHoverBackgroundColor,
38813
+ buttonBorderRadius = _ref.buttonBorderRadius,
38814
+ buttonShadow = _ref.buttonShadow,
38815
+ unreadCountWidth = _ref.unreadCountWidth,
38816
+ unreadCountHeight = _ref.unreadCountHeight,
38817
+ unreadCountFontSize = _ref.unreadCountFontSize,
38818
+ unreadCountTextColor = _ref.unreadCountTextColor;
38819
+ var _useColor = useColors(),
38820
+ accentColor = _useColor[THEME_COLORS.ACCENT],
38821
+ backgroundSections = _useColor[THEME_COLORS.BACKGROUND_SECTIONS];
38822
+ var dispatch = useDispatch();
38823
+ var channel = useSelector(activeChannelSelector);
38824
+ var theme = useSelector(themeSelector);
38825
+ var sendMessageInputHeight = useSelector(sendMessageInputHeightSelector);
38826
+ var showScrollToNewMessageButton = useSelector(showScrollToNewMessageButtonSelector);
38827
+ var messages = useSelector(activeChannelMessagesSelector) || [];
38828
+ var handleScrollToBottom = function handleScrollToBottom() {
38829
+ if (channel.newMentionCount >= 3 && (!channel.mentionsIds || channel.mentionsIds.length < 3)) {
38830
+ dispatch(getChannelMentionsAC(channel.id));
38831
+ }
38832
+ if (channel.mentionsIds && channel.mentionsIds.length) {
38833
+ handleScrollToRepliedMessage(channel.mentionsIds[0]);
38834
+ dispatch(markMessagesAsReadAC(channel.id, [channel.mentionsIds[0]]));
38835
+ dispatch(updateChannelDataAC(channel.id, {
38836
+ mentionsIds: channel.mentionsIds.slice(1)
38837
+ }));
38838
+ }
38839
+ };
38840
+ var handleScrollToRepliedMessage = function handleScrollToRepliedMessage(messageId) {
38841
+ try {
38842
+ if (messages.findIndex(function (msg) {
38843
+ return msg.id === messageId;
38844
+ }) >= 10) {
38845
+ var repliedMessage = document.getElementById(messageId);
38846
+ if (repliedMessage) {
38847
+ var scrollRef = document.getElementById('scrollableDiv');
38848
+ if (scrollRef) {
38849
+ scrollRef.scrollTop = repliedMessage.offsetTop - scrollRef.offsetHeight / 2;
38850
+ }
38851
+ repliedMessage.classList.add('highlight');
38852
+ setTimeout(function () {
38853
+ repliedMessage.classList.remove('highlight');
38854
+ }, 1000);
38855
+ }
38856
+ } else {
38857
+ dispatch(getMessagesAC(channel, undefined, messageId));
38858
+ }
38859
+ return Promise.resolve();
38860
+ } catch (e) {
38861
+ return Promise.reject(e);
38862
+ }
38863
+ };
38864
+ useEffect(function () {
38865
+ if (channel.newMentionCount && (!channel.mentionsIds || channel.mentionsIds.length < 3)) {
38866
+ dispatch(getChannelMentionsAC(channel.id));
38867
+ }
38868
+ }, [channel.newMentionCount]);
38869
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, channel.newMentionCount ? (/*#__PURE__*/React__default.createElement(BottomButton$1, {
38870
+ theme: theme,
38871
+ width: buttonWidth,
38872
+ height: buttonHeight,
38873
+ border: buttonBorder,
38874
+ borderRadius: buttonBorderRadius,
38875
+ backgroundColor: buttonBackgroundColor || backgroundSections,
38876
+ hoverBackgroundColor: buttonHoverBackgroundColor,
38877
+ shadow: buttonShadow,
38878
+ onClick: handleScrollToBottom,
38879
+ bottomOffset: sendMessageInputHeight,
38880
+ bottomPosition: bottomPosition,
38881
+ showsUnreadMentionsButton: !!showScrollToNewMessageButton,
38882
+ rightPosition: rightPosition
38883
+ }, !!(channel.newMentionCount && channel.newMentionCount > 0) && (/*#__PURE__*/React__default.createElement(UnreadCount$2, {
38884
+ width: unreadCountWidth,
38885
+ height: unreadCountHeight,
38886
+ textColor: unreadCountTextColor,
38887
+ fontSize: unreadCountFontSize,
38888
+ backgroundColor: accentColor,
38889
+ isMuted: channel.muted
38890
+ }, channel.newMentionCount ? channel.newMentionCount > 99 ? '99+' : channel.newMentionCount : '')), buttonIcon || /*#__PURE__*/React__default.createElement(SvgMention, null))) : null);
38891
+ };
38892
+ var BottomButton$1 = styled.div(_templateObject$X || (_templateObject$X = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: ", ";\n right: ", ";\n margin-right: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ", ";\n border: 0.5px solid rgba(0, 0, 0, 0.1);\n border-radius: 50px;\n width: 48px;\n height: 48px;\n cursor: pointer;\n z-index: 14;\n\n & > svg {\n color: rgba(129, 140, 153, 1);\n }\n\n & > span {\n bottom: 32px;\n right: 0;\n }\n"])), function (props) {
38893
+ return props.bottomOffset + (props.bottomPosition === undefined ? 45 : props.bottomPosition) + (props.showsUnreadMentionsButton ? 60 : 0) + "px";
38894
+ }, function (props) {
38895
+ return (props.rightPosition === undefined ? 16 : props.rightPosition) + "px";
38896
+ }, function (props) {
38897
+ return props.backgroundColor;
38898
+ });
38899
+ var UnreadCount$2 = styled.span(_templateObject2$P || (_templateObject2$P = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: 11px;\n right: 16px;\n flex: 0 0 auto;\n margin-left: auto;\n background-color: ", ";\n padding: 0 4px;\n font-size: ", ";\n line-height: 20px;\n min-width: ", ";\n height: ", ";\n text-align: center;\n font-weight: 500;\n color: ", ";\n border-radius: 10px;\n box-sizing: border-box;\n"])), function (props) {
38900
+ return props.backgroundColor;
38901
+ }, function (props) {
38902
+ return props.fontSize || '13px';
38903
+ }, function (props) {
38904
+ return props.width || '20px';
38905
+ }, function (props) {
38906
+ return props.height || '20px';
38907
+ }, function (props) {
38908
+ return props.textColor || '#fff';
38909
+ });
38910
+
38911
+ export { Attachment$1 as Attachment, Avatar, Channel, ChannelDetailsContainer as ChannelDetails, ChannelList, ChannelSearch, Chat, ChatHeader, CreateChannel, DropDown, EmojisPopup, FrequentlyEmojis, MessagesContainer as MessageList, MessageStatusIcon, MessageTextFormat, MessagesScrollToBottomButton, MessagesScrollToUnreadMentionsButton, SceytChatContainer as SceytChat, SendMessageInput as SendMessage, THEME_COLORS };
38685
38912
  //# sourceMappingURL=index.modern.js.map