sceyt-chat-react-uikit 1.7.7-beta.10 → 1.7.7-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +739 -687
  2. package/index.modern.js +740 -688
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -18841,18 +18841,10 @@ var addPendingMessage = function addPendingMessage(message, messageCopy, channel
18841
18841
  mentionedUsers: message.mentionedUsers,
18842
18842
  parentMessage: message.parentMessage
18843
18843
  });
18844
- addMessageToMap(channel.id, messageToAdd);
18845
- var activeChannelId = getActiveChannelId();
18846
- if (activeChannelId === channel.id) {
18847
- addAllMessages([messageToAdd], MESSAGE_LOAD_DIRECTION.NEXT);
18848
- }
18849
18844
  setPendingMessage(channel.id, messageToAdd);
18850
18845
  if (!(messageToAdd !== null && messageToAdd !== void 0 && messageToAdd.forwardingDetails)) {
18851
18846
  store.dispatch(scrollToNewMessageAC(true));
18852
18847
  }
18853
- if (activeChannelId === channel.id) {
18854
- store.dispatch(addMessageAC(messageToAdd));
18855
- }
18856
18848
  return Promise.resolve();
18857
18849
  } catch (e) {
18858
18850
  return Promise.reject(e);
@@ -18987,7 +18979,8 @@ function sendMessage(action) {
18987
18979
  channelId: channel.id
18988
18980
  }));
18989
18981
  messageForSend = _extends({}, _messageToSend, {
18990
- attachments: [messageAttachment]
18982
+ attachments: [messageAttachment],
18983
+ createdAt: new Date(Date.now())
18991
18984
  });
18992
18985
  messagesToSend.push(messageForSend);
18993
18986
  pendingMessages.push(_extends({}, messageForSend, {
@@ -19029,7 +19022,9 @@ function sendMessage(action) {
19029
19022
  messageBuilder.setReplyInThread();
19030
19023
  }
19031
19024
  messageToSend = action.type === RESEND_MESSAGE ? action.payload.message : messageBuilder.create();
19032
- messageCopy = messageToSend;
19025
+ messageCopy = _extends({}, messageToSend, {
19026
+ createdAt: new Date(Date.now())
19027
+ });
19033
19028
  pendingMessages.push(_extends({}, messageCopy, {
19034
19029
  attachments: message.attachments
19035
19030
  }));
@@ -19040,7 +19035,7 @@ function sendMessage(action) {
19040
19035
  }
19041
19036
  case 11:
19042
19037
  _loop2 = /*#__PURE__*/_regenerator().m(function _callee2() {
19043
- var messageAttachment, messageToSend, _messageCopy, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, pendingAttachment, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, messageToUpdate, channelUpdateParam, pendingMessage, _t;
19038
+ var messageAttachment, messageToSend, _messageCopy, activeChannelId, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, pendingAttachment, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, messageToUpdate, channelUpdateParam, pendingMessage, _t;
19044
19039
  return _regenerator().w(function (_context2) {
19045
19040
  while (1) switch (_context2.p = _context2.n) {
19046
19041
  case 0:
@@ -19048,7 +19043,17 @@ function sendMessage(action) {
19048
19043
  messageToSend = messagesToSend[_i];
19049
19044
  _context2.p = 1;
19050
19045
  _messageCopy = JSON.parse(JSON.stringify(messagesToSend[_i]));
19051
- store.dispatch(scrollToNewMessageAC(true));
19046
+ activeChannelId = getActiveChannelId();
19047
+ if (action.type !== RESEND_MESSAGE) {
19048
+ addMessageToMap(channel.id, messageToSend);
19049
+ if (activeChannelId === channel.id) {
19050
+ addAllMessages([messageToSend], MESSAGE_LOAD_DIRECTION.NEXT);
19051
+ }
19052
+ if (activeChannelId === channel.id) {
19053
+ store.dispatch(addMessageAC(messageToSend));
19054
+ }
19055
+ store.dispatch(scrollToNewMessageAC(true));
19056
+ }
19052
19057
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
19053
19058
  _context2.n = 12;
19054
19059
  break;
@@ -19069,9 +19074,13 @@ function sendMessage(action) {
19069
19074
  linkAttachmentToSend = linkAttachmentBuilder.setName(linkAttachment.name).setUpload(linkAttachment.upload).create();
19070
19075
  }
19071
19076
  if (linkAttachmentToSend) {
19072
- messageToSend.attachments = [].concat(_attachmentsToSend, [linkAttachmentToSend]);
19077
+ messageToSend = _extends({}, messageToSend, {
19078
+ attachments: [].concat(_attachmentsToSend, [linkAttachmentToSend])
19079
+ });
19073
19080
  } else {
19074
- messageToSend.attachments = [].concat(_attachmentsToSend);
19081
+ messageToSend = _extends({}, messageToSend, {
19082
+ attachments: [].concat(_attachmentsToSend)
19083
+ });
19075
19084
  }
19076
19085
  _context2.n = 4;
19077
19086
  return effects.call(channel.sendMessage, messageToSend);
@@ -19107,7 +19116,9 @@ function sendMessage(action) {
19107
19116
  _context2.n = 5;
19108
19117
  break;
19109
19118
  case 8:
19110
- message.tid && store.dispatch(removePendingMessageAC(channel.id, message.tid));
19119
+ if (action.type === RESEND_MESSAGE) {
19120
+ messageToSend.tid && store.dispatch(removePendingMessageAC(channel.id, messageToSend.tid));
19121
+ }
19111
19122
  attachmentsToUpdate = [];
19112
19123
  if (messageResponse.attachments && messageResponse.attachments.length > 0) {
19113
19124
  currentAttachmentsMap = {};
@@ -19239,7 +19250,7 @@ function sendMessage(action) {
19239
19250
  }, _marked$3, null, [[1, 15]]);
19240
19251
  }
19241
19252
  function sendTextMessage(action) {
19242
- var payload, message, connectionState, channelId, isAddToPendingMessagesMap, channel, sendMessageTid, pendingMessage, activeChannelId, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, messageToSend, _messageResponse, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, _t3;
19253
+ var payload, message, connectionState, channelId, isAddToPendingMessagesMap, channel, sendMessageTid, pendingMessage, activeChannelId, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, messageToSend, _activeChannelId, _messageResponse, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, _t3;
19243
19254
  return _regenerator().w(function (_context4) {
19244
19255
  while (1) switch (_context4.p = _context4.n) {
19245
19256
  case 0:
@@ -19313,7 +19324,17 @@ function sendTextMessage(action) {
19313
19324
  if (pendingMessage && pendingMessage.metadata) {
19314
19325
  pendingMessage.metadata = JSON.parse(pendingMessage.metadata);
19315
19326
  }
19316
- store.dispatch(scrollToNewMessageAC(true));
19327
+ if (action.type !== RESEND_MESSAGE && pendingMessage) {
19328
+ _activeChannelId = getActiveChannelId();
19329
+ addMessageToMap(channel.id, pendingMessage);
19330
+ if (_activeChannelId === channel.id) {
19331
+ addAllMessages([pendingMessage], MESSAGE_LOAD_DIRECTION.NEXT);
19332
+ }
19333
+ if (_activeChannelId === channel.id) {
19334
+ store.dispatch(addMessageAC(pendingMessage));
19335
+ }
19336
+ store.dispatch(scrollToNewMessageAC(true));
19337
+ }
19317
19338
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
19318
19339
  _context4.n = 15;
19319
19340
  break;
@@ -19383,11 +19404,8 @@ function sendTextMessage(action) {
19383
19404
  return effects.put(markChannelAsReadAC(channel.id));
19384
19405
  case 14:
19385
19406
  channel.lastMessage = messageToUpdate;
19386
- if (!isAddToPendingMessagesMap) {
19387
- message.tid && store.dispatch(removePendingMessageAC(channel.id, message.tid));
19388
- message.id && store.dispatch(removePendingMessageAC(channel.id, message.id));
19407
+ if (action.type === RESEND_MESSAGE) {
19389
19408
  messageToSend.tid && store.dispatch(removePendingMessageAC(channel.id, messageToSend.tid));
19390
- messageToSend.id && store.dispatch(removePendingMessageAC(channel.id, messageToSend.id));
19391
19409
  }
19392
19410
  _context4.n = 16;
19393
19411
  break;
@@ -19547,6 +19565,15 @@ function forwardMessage(action) {
19547
19565
  _context5.n = 8;
19548
19566
  return effects.put(getMessagesAC(channel));
19549
19567
  case 8:
19568
+ if (action.type !== RESEND_MESSAGE) {
19569
+ addMessageToMap(channel.id, pendingMessage);
19570
+ if (activeChannelId === channel.id) {
19571
+ addAllMessages([pendingMessage], MESSAGE_LOAD_DIRECTION.NEXT);
19572
+ }
19573
+ if (activeChannelId === channel.id) {
19574
+ store.dispatch(addMessageAC(pendingMessage));
19575
+ }
19576
+ }
19550
19577
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
19551
19578
  _context5.n = 14;
19552
19579
  break;
@@ -19578,7 +19605,9 @@ function forwardMessage(action) {
19578
19605
  case 10:
19579
19606
  updateMessageOnAllMessages(messageToSend.tid, messageUpdateData);
19580
19607
  case 11:
19581
- message.tid && store.dispatch(removePendingMessageAC(channel.id, message.tid));
19608
+ if (action.type === RESEND_MESSAGE) {
19609
+ messageToSend.tid && store.dispatch(removePendingMessageAC(channel.id, messageToSend.tid));
19610
+ }
19582
19611
  updateMessageOnMap(channel.id, {
19583
19612
  messageId: !isAddToPendingMessagesMap ? message.tid : messageToSend.tid,
19584
19613
  params: messageUpdateData
@@ -19798,19 +19827,118 @@ function editMessage(action) {
19798
19827
  }
19799
19828
  }, _marked6$1, null, [[0, 5]]);
19800
19829
  }
19801
- function getMessagesQuery(action) {
19802
- var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _updatedMessages, _Object$values, previousAllMessages, _secondResult4, updatedMessages, lastMessageId, _allMessages2, setMappedAllMessages, allMessagesAfterLastMessage, pendingMessages, _messagesMap, filteredPendingMessages, waitToSendPendingMessages, pendingMessagesMap, channelId, _iterator, _step, _msg$attachments, msg, attachments, pendingPollActionsMap, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20;
19830
+ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee3(connectionState) {
19831
+ var pendingMessagesMap, channelId, _iterator, _step, _msg$attachments, msg, attachments, pendingPollActionsMap, _t7, _t8, _t9;
19803
19832
  return _regenerator().w(function (_context9) {
19804
19833
  while (1) switch (_context9.p = _context9.n) {
19805
19834
  case 0:
19806
- _context9.p = 0;
19835
+ pendingMessagesMap = _extends({}, getPendingMessagesMap());
19836
+ _t7 = _regeneratorKeys(pendingMessagesMap);
19837
+ case 1:
19838
+ if ((_t8 = _t7()).done) {
19839
+ _context9.n = 12;
19840
+ break;
19841
+ }
19842
+ channelId = _t8.value;
19843
+ _iterator = _createForOfIteratorHelperLoose(pendingMessagesMap[channelId]);
19844
+ case 2:
19845
+ if ((_step = _iterator()).done) {
19846
+ _context9.n = 11;
19847
+ break;
19848
+ }
19849
+ msg = _step.value;
19850
+ attachments = msg === null || msg === void 0 ? void 0 : (_msg$attachments = msg.attachments) === null || _msg$attachments === void 0 ? void 0 : _msg$attachments.filter(function (att) {
19851
+ return (att === null || att === void 0 ? void 0 : att.type) !== attachmentTypes.link;
19852
+ });
19853
+ _context9.p = 3;
19854
+ if (!(msg !== null && msg !== void 0 && msg.forwardingDetails)) {
19855
+ _context9.n = 5;
19856
+ break;
19857
+ }
19858
+ _context9.n = 4;
19859
+ return effects.call(forwardMessage, {
19860
+ type: RESEND_MESSAGE,
19861
+ payload: {
19862
+ message: msg,
19863
+ connectionState: connectionState,
19864
+ channelId: channelId,
19865
+ isForward: true,
19866
+ isAddToPendingMessagesMap: false
19867
+ }
19868
+ });
19869
+ case 4:
19870
+ _context9.n = 8;
19871
+ break;
19872
+ case 5:
19873
+ if (!(attachments && attachments.length > 0)) {
19874
+ _context9.n = 7;
19875
+ break;
19876
+ }
19877
+ _context9.n = 6;
19878
+ return effects.call(sendMessage, {
19879
+ type: RESEND_MESSAGE,
19880
+ payload: {
19881
+ message: msg,
19882
+ connectionState: connectionState,
19883
+ channelId: channelId,
19884
+ sendAttachmentsAsSeparateMessage: false,
19885
+ isResend: true,
19886
+ isAddToPendingMessagesMap: false
19887
+ }
19888
+ });
19889
+ case 6:
19890
+ _context9.n = 8;
19891
+ break;
19892
+ case 7:
19893
+ _context9.n = 8;
19894
+ return effects.call(sendTextMessage, {
19895
+ type: RESEND_MESSAGE,
19896
+ payload: {
19897
+ message: msg,
19898
+ connectionState: connectionState,
19899
+ channelId: channelId,
19900
+ isAddToPendingMessagesMap: false
19901
+ }
19902
+ });
19903
+ case 8:
19904
+ _context9.n = 10;
19905
+ break;
19906
+ case 9:
19907
+ _context9.p = 9;
19908
+ _t9 = _context9.v;
19909
+ log.error("Failed to send pending message " + (msg.tid || msg.id) + ":", _t9);
19910
+ case 10:
19911
+ _context9.n = 2;
19912
+ break;
19913
+ case 11:
19807
19914
  _context9.n = 1;
19915
+ break;
19916
+ case 12:
19917
+ pendingPollActionsMap = store.getState().MessageReducer.pendingPollActions;
19918
+ if (!(pendingPollActionsMap && Object.keys(pendingPollActionsMap).length > 0)) {
19919
+ _context9.n = 13;
19920
+ break;
19921
+ }
19922
+ _context9.n = 13;
19923
+ return effects.put(resendPendingPollActionsAC(connectionState));
19924
+ case 13:
19925
+ return _context9.a(2);
19926
+ }
19927
+ }, _callee3, null, [[3, 9]]);
19928
+ });
19929
+ function getMessagesQuery(action) {
19930
+ var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _updatedMessages, _Object$values, previousAllMessages, _secondResult4, updatedMessages, lastMessageId, _allMessages2, setMappedAllMessages, allMessagesAfterLastMessage, pendingMessages, _messagesMap, filteredPendingMessages, waitToSendPendingMessages, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20, _t21;
19931
+ return _regenerator().w(function (_context0) {
19932
+ while (1) switch (_context0.p = _context0.n) {
19933
+ case 0:
19934
+ _context0.p = 0;
19935
+ _context0.n = 1;
19808
19936
  return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
19809
19937
  case 1:
19810
19938
  _action$payload = action.payload, channel = _action$payload.channel, loadWithLastMessage = _action$payload.loadWithLastMessage, messageId = _action$payload.messageId, limit = _action$payload.limit, withDeliveredMessages = _action$payload.withDeliveredMessages, highlight = _action$payload.highlight, behavior = _action$payload.behavior;
19811
19939
  connectionState = store.getState().UserReducer.connectionStatus;
19812
19940
  if (!(channel.id && !channel.isMockChannel)) {
19813
- _context9.n = 86;
19941
+ _context0.n = 76;
19814
19942
  break;
19815
19943
  }
19816
19944
  SceytChatClient = getClient();
@@ -19818,19 +19946,19 @@ function getMessagesQuery(action) {
19818
19946
  messageQueryBuilder.limit(limit || MESSAGES_MAX_LENGTH);
19819
19947
  messageQueryBuilder.reverse(true);
19820
19948
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
19821
- _context9.n = 3;
19949
+ _context0.n = 3;
19822
19950
  break;
19823
19951
  }
19824
- _context9.n = 2;
19952
+ _context0.n = 2;
19825
19953
  return effects.call(messageQueryBuilder.build);
19826
19954
  case 2:
19827
- _t7 = _context9.v;
19828
- _context9.n = 4;
19955
+ _t0 = _context0.v;
19956
+ _context0.n = 4;
19829
19957
  break;
19830
19958
  case 3:
19831
- _t7 = null;
19959
+ _t0 = null;
19832
19960
  case 4:
19833
- messageQuery = _t7;
19961
+ messageQuery = _t0;
19834
19962
  query.messageQuery = messageQuery;
19835
19963
  cachedMessages = Object.values(getMessagesFromMap(channel.id) || {}).sort(function (a, b) {
19836
19964
  return Number(a.id) - Number(b.id);
@@ -19840,57 +19968,57 @@ function getMessagesQuery(action) {
19840
19968
  hasNext: false
19841
19969
  };
19842
19970
  if (!loadWithLastMessage) {
19843
- _context9.n = 19;
19971
+ _context0.n = 19;
19844
19972
  break;
19845
19973
  }
19846
19974
  allMessages = getAllMessages();
19847
19975
  havLastMessage = allMessages && allMessages.length && channel.lastMessage && allMessages[allMessages.length - 1] && allMessages[allMessages.length - 1].id === channel.lastMessage.id;
19848
19976
  if (!(channel.newMessageCount && channel.newMessageCount > 0 || !havLastMessage)) {
19849
- _context9.n = 14;
19977
+ _context0.n = 14;
19850
19978
  break;
19851
19979
  }
19852
19980
  setHasPrevCached(false);
19853
19981
  setMessagesToMap(channel.id, []);
19854
19982
  setAllMessages([]);
19855
19983
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
19856
- _context9.n = 6;
19984
+ _context0.n = 6;
19857
19985
  break;
19858
19986
  }
19859
- _context9.n = 5;
19987
+ _context0.n = 5;
19860
19988
  return effects.call(messageQuery.loadPreviousMessageId, '0');
19861
19989
  case 5:
19862
- _t8 = _context9.v;
19863
- _context9.n = 7;
19990
+ _t1 = _context0.v;
19991
+ _context0.n = 7;
19864
19992
  break;
19865
19993
  case 6:
19866
- _t8 = {
19994
+ _t1 = {
19867
19995
  messages: [],
19868
19996
  hasNext: false
19869
19997
  };
19870
19998
  case 7:
19871
- result = _t8;
19999
+ result = _t1;
19872
20000
  if (!(result.messages.length === 50)) {
19873
- _context9.n = 11;
20001
+ _context0.n = 11;
19874
20002
  break;
19875
20003
  }
19876
20004
  messageQuery.limit = 30;
19877
20005
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
19878
- _context9.n = 9;
20006
+ _context0.n = 9;
19879
20007
  break;
19880
20008
  }
19881
- _context9.n = 8;
20009
+ _context0.n = 8;
19882
20010
  return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
19883
20011
  case 8:
19884
- _t9 = _context9.v;
19885
- _context9.n = 10;
20012
+ _t10 = _context0.v;
20013
+ _context0.n = 10;
19886
20014
  break;
19887
20015
  case 9:
19888
- _t9 = {
20016
+ _t10 = {
19889
20017
  messages: [],
19890
20018
  hasNext: false
19891
20019
  };
19892
20020
  case 10:
19893
- secondResult = _t9;
20021
+ secondResult = _t10;
19894
20022
  result.messages = [].concat(secondResult.messages, result.messages);
19895
20023
  result.hasNext = secondResult.hasNext;
19896
20024
  case 11:
@@ -19906,40 +20034,40 @@ function getMessagesQuery(action) {
19906
20034
  return !messagesMap[msg.tid || ''];
19907
20035
  });
19908
20036
  result.messages = [].concat(result.messages, filteredSentMessages).slice(filteredSentMessages.length);
19909
- _context9.n = 12;
20037
+ _context0.n = 12;
19910
20038
  return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
19911
20039
  case 12:
19912
20040
  setMessagesToMap(channel.id, result.messages);
19913
20041
  setAllMessages(result.messages);
19914
- _context9.n = 13;
20042
+ _context0.n = 13;
19915
20043
  return effects.put(setMessagesHasPrevAC(true));
19916
20044
  case 13:
19917
- _context9.n = 16;
20045
+ _context0.n = 16;
19918
20046
  break;
19919
20047
  case 14:
19920
20048
  result.messages = getFromAllMessagesByMessageId('', '', true);
19921
- _context9.n = 15;
20049
+ _context0.n = 15;
19922
20050
  return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
19923
20051
  case 15:
19924
- _context9.n = 16;
20052
+ _context0.n = 16;
19925
20053
  return effects.put(setMessagesHasPrevAC(true));
19926
20054
  case 16:
19927
- _context9.n = 17;
20055
+ _context0.n = 17;
19928
20056
  return effects.put(setMessagesHasNextAC(false));
19929
20057
  case 17:
19930
20058
  setHasNextCached(false);
19931
20059
  if (!messageId) {
19932
- _context9.n = 18;
20060
+ _context0.n = 18;
19933
20061
  break;
19934
20062
  }
19935
- _context9.n = 18;
20063
+ _context0.n = 18;
19936
20064
  return effects.put(setScrollToMessagesAC(messageId, highlight, behavior));
19937
20065
  case 18:
19938
- _context9.n = 72;
20066
+ _context0.n = 72;
19939
20067
  break;
19940
20068
  case 19:
19941
20069
  if (!messageId) {
19942
- _context9.n = 38;
20070
+ _context0.n = 38;
19943
20071
  break;
19944
20072
  }
19945
20073
  _allMessages = getAllMessages();
@@ -19948,87 +20076,87 @@ function getMessagesQuery(action) {
19948
20076
  });
19949
20077
  maxLengthPart = MESSAGES_MAX_LENGTH / 2;
19950
20078
  if (!(messageIndex >= maxLengthPart)) {
19951
- _context9.n = 22;
20079
+ _context0.n = 22;
19952
20080
  break;
19953
20081
  }
19954
20082
  result.messages = _allMessages.slice(messageIndex - maxLengthPart, messageIndex + maxLengthPart);
19955
- _context9.n = 20;
20083
+ _context0.n = 20;
19956
20084
  return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
19957
20085
  case 20:
19958
20086
  setHasPrevCached(messageIndex > maxLengthPart);
19959
20087
  setHasNextCached(_allMessages.length > maxLengthPart);
19960
- _context9.n = 21;
20088
+ _context0.n = 21;
19961
20089
  return effects.put(setMessagesHasPrevAC(true));
19962
20090
  case 21:
19963
- _context9.n = 34;
20091
+ _context0.n = 34;
19964
20092
  break;
19965
20093
  case 22:
19966
20094
  messageQuery.limit = MESSAGES_MAX_LENGTH;
19967
20095
  log.info('load by message id from server ...............', messageId);
19968
20096
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
19969
- _context9.n = 24;
20097
+ _context0.n = 24;
19970
20098
  break;
19971
20099
  }
19972
- _context9.n = 23;
20100
+ _context0.n = 23;
19973
20101
  return effects.call(messageQuery.loadNearMessageId, messageId);
19974
20102
  case 23:
19975
- _t0 = _context9.v;
19976
- _context9.n = 25;
20103
+ _t11 = _context0.v;
20104
+ _context0.n = 25;
19977
20105
  break;
19978
20106
  case 24:
19979
- _t0 = {
20107
+ _t11 = {
19980
20108
  messages: [],
19981
20109
  hasNext: false
19982
20110
  };
19983
20111
  case 25:
19984
- result = _t0;
20112
+ result = _t11;
19985
20113
  if (!(result.messages.length === 50)) {
19986
- _context9.n = 32;
20114
+ _context0.n = 32;
19987
20115
  break;
19988
20116
  }
19989
20117
  messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
19990
20118
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
19991
- _context9.n = 27;
20119
+ _context0.n = 27;
19992
20120
  break;
19993
20121
  }
19994
- _context9.n = 26;
20122
+ _context0.n = 26;
19995
20123
  return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
19996
20124
  case 26:
19997
- _t1 = _context9.v;
19998
- _context9.n = 28;
20125
+ _t12 = _context0.v;
20126
+ _context0.n = 28;
19999
20127
  break;
20000
20128
  case 27:
20001
- _t1 = {
20129
+ _t12 = {
20002
20130
  messages: [],
20003
20131
  hasNext: false
20004
20132
  };
20005
20133
  case 28:
20006
- _secondResult = _t1;
20134
+ _secondResult = _t12;
20007
20135
  messageQuery.reverse = false;
20008
20136
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20009
- _context9.n = 30;
20137
+ _context0.n = 30;
20010
20138
  break;
20011
20139
  }
20012
- _context9.n = 29;
20140
+ _context0.n = 29;
20013
20141
  return effects.call(messageQuery.loadNextMessageId, result.messages[result.messages.length - 1].id);
20014
20142
  case 29:
20015
- _t10 = _context9.v;
20016
- _context9.n = 31;
20143
+ _t13 = _context0.v;
20144
+ _context0.n = 31;
20017
20145
  break;
20018
20146
  case 30:
20019
- _t10 = {
20147
+ _t13 = {
20020
20148
  messages: [],
20021
20149
  hasNext: false
20022
20150
  };
20023
20151
  case 31:
20024
- thirdResult = _t10;
20152
+ thirdResult = _t13;
20025
20153
  result.messages = [].concat(_secondResult.messages, result.messages, thirdResult.messages);
20026
20154
  result.hasNext = _secondResult.hasNext;
20027
20155
  messageQuery.reverse = true;
20028
- _context9.n = 32;
20156
+ _context0.n = 32;
20029
20157
  return effects.put(setMessagesHasPrevAC(_secondResult.hasNext));
20030
20158
  case 32:
20031
- _context9.n = 33;
20159
+ _context0.n = 33;
20032
20160
  return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
20033
20161
  case 33:
20034
20162
  setMessagesToMap(channel.id, result.messages);
@@ -20036,208 +20164,208 @@ function getMessagesQuery(action) {
20036
20164
  setHasPrevCached(false);
20037
20165
  setHasNextCached(false);
20038
20166
  case 34:
20039
- _context9.n = 35;
20167
+ _context0.n = 35;
20040
20168
  return effects.put(setMessagesHasNextAC(true));
20041
20169
  case 35:
20042
- _context9.n = 36;
20170
+ _context0.n = 36;
20043
20171
  return effects.put(setScrollToMessagesAC(messageId, true, behavior));
20044
20172
  case 36:
20045
- _context9.n = 37;
20173
+ _context0.n = 37;
20046
20174
  return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
20047
20175
  case 37:
20048
- _context9.n = 72;
20176
+ _context0.n = 72;
20049
20177
  break;
20050
20178
  case 38:
20051
20179
  if (!(channel.newMessageCount && channel.lastDisplayedMessageId)) {
20052
- _context9.n = 61;
20180
+ _context0.n = 61;
20053
20181
  break;
20054
20182
  }
20055
20183
  setMessagesToMap(channel.id, []);
20056
20184
  setAllMessages([]);
20057
20185
  messageQuery.limit = MESSAGES_MAX_LENGTH;
20058
20186
  if (!Number(channel.lastDisplayedMessageId)) {
20059
- _context9.n = 50;
20187
+ _context0.n = 50;
20060
20188
  break;
20061
20189
  }
20062
20190
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20063
- _context9.n = 40;
20191
+ _context0.n = 40;
20064
20192
  break;
20065
20193
  }
20066
- _context9.n = 39;
20194
+ _context0.n = 39;
20067
20195
  return effects.call(messageQuery.loadNearMessageId, channel.lastDisplayedMessageId);
20068
20196
  case 39:
20069
- _t11 = _context9.v;
20070
- _context9.n = 41;
20197
+ _t14 = _context0.v;
20198
+ _context0.n = 41;
20071
20199
  break;
20072
20200
  case 40:
20073
- _t11 = {
20201
+ _t14 = {
20074
20202
  messages: [],
20075
20203
  hasNext: false
20076
20204
  };
20077
20205
  case 41:
20078
- result = _t11;
20206
+ result = _t14;
20079
20207
  if (!(result.messages.length === 50)) {
20080
- _context9.n = 49;
20208
+ _context0.n = 49;
20081
20209
  break;
20082
20210
  }
20083
20211
  messageQuery.limit = channel.newMessageCount > 25 ? (MESSAGES_MAX_LENGTH - 50) / 2 : MESSAGES_MAX_LENGTH - 50;
20084
20212
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20085
- _context9.n = 43;
20213
+ _context0.n = 43;
20086
20214
  break;
20087
20215
  }
20088
- _context9.n = 42;
20216
+ _context0.n = 42;
20089
20217
  return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
20090
20218
  case 42:
20091
- _t12 = _context9.v;
20092
- _context9.n = 44;
20219
+ _t15 = _context0.v;
20220
+ _context0.n = 44;
20093
20221
  break;
20094
20222
  case 43:
20095
- _t12 = {
20223
+ _t15 = {
20096
20224
  messages: [],
20097
20225
  hasNext: false
20098
20226
  };
20099
20227
  case 44:
20100
- _secondResult2 = _t12;
20228
+ _secondResult2 = _t15;
20101
20229
  if (!(channel.newMessageCount > 25)) {
20102
- _context9.n = 48;
20230
+ _context0.n = 48;
20103
20231
  break;
20104
20232
  }
20105
20233
  messageQuery.reverse = false;
20106
20234
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20107
- _context9.n = 46;
20235
+ _context0.n = 46;
20108
20236
  break;
20109
20237
  }
20110
- _context9.n = 45;
20238
+ _context0.n = 45;
20111
20239
  return effects.call(messageQuery.loadNextMessageId, result.messages[result.messages.length - 1].id);
20112
20240
  case 45:
20113
- _t13 = _context9.v;
20114
- _context9.n = 47;
20241
+ _t16 = _context0.v;
20242
+ _context0.n = 47;
20115
20243
  break;
20116
20244
  case 46:
20117
- _t13 = {
20245
+ _t16 = {
20118
20246
  messages: [],
20119
20247
  hasNext: false
20120
20248
  };
20121
20249
  case 47:
20122
- _thirdResult = _t13;
20250
+ _thirdResult = _t16;
20123
20251
  result.messages = [].concat(_secondResult2.messages, result.messages, _thirdResult.messages);
20124
20252
  messageQuery.reverse = true;
20125
- _context9.n = 49;
20253
+ _context0.n = 49;
20126
20254
  break;
20127
20255
  case 48:
20128
20256
  result.messages = [].concat(_secondResult2.messages, result.messages);
20129
20257
  case 49:
20130
- _context9.n = 57;
20258
+ _context0.n = 57;
20131
20259
  break;
20132
20260
  case 50:
20133
20261
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20134
- _context9.n = 52;
20262
+ _context0.n = 52;
20135
20263
  break;
20136
20264
  }
20137
- _context9.n = 51;
20265
+ _context0.n = 51;
20138
20266
  return effects.call(messageQuery.loadPrevious);
20139
20267
  case 51:
20140
- _t14 = _context9.v;
20141
- _context9.n = 53;
20268
+ _t17 = _context0.v;
20269
+ _context0.n = 53;
20142
20270
  break;
20143
20271
  case 52:
20144
- _t14 = {
20272
+ _t17 = {
20145
20273
  messages: [],
20146
20274
  hasNext: false
20147
20275
  };
20148
20276
  case 53:
20149
- result = _t14;
20277
+ result = _t17;
20150
20278
  if (!(result.messages.length === 50)) {
20151
- _context9.n = 57;
20279
+ _context0.n = 57;
20152
20280
  break;
20153
20281
  }
20154
20282
  messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
20155
20283
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20156
- _context9.n = 55;
20284
+ _context0.n = 55;
20157
20285
  break;
20158
20286
  }
20159
- _context9.n = 54;
20287
+ _context0.n = 54;
20160
20288
  return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
20161
20289
  case 54:
20162
- _t15 = _context9.v;
20163
- _context9.n = 56;
20290
+ _t18 = _context0.v;
20291
+ _context0.n = 56;
20164
20292
  break;
20165
20293
  case 55:
20166
- _t15 = {
20294
+ _t18 = {
20167
20295
  messages: [],
20168
20296
  hasNext: false
20169
20297
  };
20170
20298
  case 56:
20171
- _secondResult3 = _t15;
20299
+ _secondResult3 = _t18;
20172
20300
  result.messages = [].concat(_secondResult3.messages, result.messages);
20173
20301
  result.hasNext = _secondResult3.hasNext;
20174
20302
  case 57:
20175
- _context9.n = 58;
20303
+ _context0.n = 58;
20176
20304
  return effects.put(setMessagesHasPrevAC(true));
20177
20305
  case 58:
20178
- _context9.n = 59;
20306
+ _context0.n = 59;
20179
20307
  return effects.put(setMessagesHasNextAC(channel.lastMessage && result.messages.length > 0 && channel.lastMessage.id !== result.messages[result.messages.length - 1].id));
20180
20308
  case 59:
20181
20309
  setMessagesToMap(channel.id, result.messages);
20182
20310
  setAllMessages([].concat(result.messages));
20183
- _context9.n = 60;
20311
+ _context0.n = 60;
20184
20312
  return effects.put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
20185
20313
  case 60:
20186
- _context9.n = 72;
20314
+ _context0.n = 72;
20187
20315
  break;
20188
20316
  case 61:
20189
20317
  previousAllMessages = getAllMessages();
20190
20318
  setMessagesToMap(channel.id, []);
20191
20319
  setAllMessages([]);
20192
20320
  if (!(cachedMessages && cachedMessages.length)) {
20193
- _context9.n = 62;
20321
+ _context0.n = 62;
20194
20322
  break;
20195
20323
  }
20196
20324
  setMessagesToMap(channel.id, []);
20197
20325
  setAllMessages([].concat(cachedMessages));
20198
- _context9.n = 62;
20326
+ _context0.n = 62;
20199
20327
  return effects.put(setMessagesAC(JSON.parse(JSON.stringify(cachedMessages))));
20200
20328
  case 62:
20201
20329
  log.info('load message from server');
20202
20330
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20203
- _context9.n = 64;
20331
+ _context0.n = 64;
20204
20332
  break;
20205
20333
  }
20206
- _context9.n = 63;
20334
+ _context0.n = 63;
20207
20335
  return effects.call(messageQuery.loadPrevious);
20208
20336
  case 63:
20209
- _t16 = _context9.v;
20210
- _context9.n = 65;
20337
+ _t19 = _context0.v;
20338
+ _context0.n = 65;
20211
20339
  break;
20212
20340
  case 64:
20213
- _t16 = {
20341
+ _t19 = {
20214
20342
  messages: [],
20215
20343
  hasNext: false
20216
20344
  };
20217
20345
  case 65:
20218
- result = _t16;
20346
+ result = _t19;
20219
20347
  if (!(result.messages.length === 50)) {
20220
- _context9.n = 69;
20348
+ _context0.n = 69;
20221
20349
  break;
20222
20350
  }
20223
20351
  messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
20224
20352
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20225
- _context9.n = 67;
20353
+ _context0.n = 67;
20226
20354
  break;
20227
20355
  }
20228
- _context9.n = 66;
20356
+ _context0.n = 66;
20229
20357
  return effects.call(messageQuery.loadPreviousMessageId, result.messages[0].id);
20230
20358
  case 66:
20231
- _t17 = _context9.v;
20232
- _context9.n = 68;
20359
+ _t20 = _context0.v;
20360
+ _context0.n = 68;
20233
20361
  break;
20234
20362
  case 67:
20235
- _t17 = {
20363
+ _t20 = {
20236
20364
  messages: [],
20237
20365
  hasNext: false
20238
20366
  };
20239
20367
  case 68:
20240
- _secondResult4 = _t17;
20368
+ _secondResult4 = _t20;
20241
20369
  result.messages = [].concat(_secondResult4.messages, result.messages);
20242
20370
  result.hasNext = _secondResult4.hasNext;
20243
20371
  case 69:
@@ -20269,18 +20397,18 @@ function getMessagesQuery(action) {
20269
20397
  updatedMessages = [].concat(updatedMessages, allMessagesAfterLastMessage || []);
20270
20398
  setMessagesToMap(channel.id, updatedMessages);
20271
20399
  setAllMessages(updatedMessages);
20272
- _context9.n = 70;
20400
+ _context0.n = 70;
20273
20401
  return effects.put(setMessagesAC(JSON.parse(JSON.stringify(updatedMessages))));
20274
20402
  case 70:
20275
- _context9.n = 71;
20403
+ _context0.n = 71;
20276
20404
  return effects.put(setMessagesHasPrevAC(true));
20277
20405
  case 71:
20278
- _context9.n = 72;
20406
+ _context0.n = 72;
20279
20407
  return effects.put(setMessagesHasNextAC(false));
20280
20408
  case 72:
20281
20409
  pendingMessages = getPendingMessages(channel.id);
20282
20410
  if (!(pendingMessages && pendingMessages.length)) {
20283
- _context9.n = 73;
20411
+ _context0.n = 73;
20284
20412
  break;
20285
20413
  }
20286
20414
  _messagesMap = {};
@@ -20290,152 +20418,76 @@ function getMessagesQuery(action) {
20290
20418
  filteredPendingMessages = pendingMessages.filter(function (msg) {
20291
20419
  return !_messagesMap[msg.tid || ''];
20292
20420
  });
20293
- _context9.n = 73;
20421
+ _context0.n = 73;
20294
20422
  return effects.put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
20295
20423
  case 73:
20296
20424
  waitToSendPendingMessages = store.getState().UserReducer.waitToSendPendingMessages;
20297
20425
  if (!(connectionState === CONNECTION_STATUS.CONNECTED && waitToSendPendingMessages)) {
20298
- _context9.n = 84;
20426
+ _context0.n = 75;
20299
20427
  break;
20300
20428
  }
20301
- _context9.n = 74;
20429
+ _context0.n = 74;
20302
20430
  return effects.put(setWaitToSendPendingMessagesAC(false));
20303
20431
  case 74:
20304
- pendingMessagesMap = getPendingMessagesMap();
20305
- _t18 = _regeneratorKeys(pendingMessagesMap);
20432
+ _context0.n = 75;
20433
+ return effects.spawn(sendPendingMessages, connectionState);
20306
20434
  case 75:
20307
- if ((_t19 = _t18()).done) {
20308
- _context9.n = 83;
20309
- break;
20310
- }
20311
- channelId = _t19.value;
20312
- _iterator = _createForOfIteratorHelperLoose(pendingMessagesMap[channelId]);
20435
+ _context0.n = 77;
20436
+ break;
20313
20437
  case 76:
20314
- if ((_step = _iterator()).done) {
20315
- _context9.n = 82;
20316
- break;
20317
- }
20318
- msg = _step.value;
20319
- attachments = (_msg$attachments = msg.attachments) === null || _msg$attachments === void 0 ? void 0 : _msg$attachments.filter(function (att) {
20320
- return att.type !== attachmentTypes.link;
20321
- });
20322
- if (!(msg !== null && msg !== void 0 && msg.forwardingDetails)) {
20323
- _context9.n = 78;
20438
+ if (!channel.isMockChannel) {
20439
+ _context0.n = 77;
20324
20440
  break;
20325
20441
  }
20326
- _context9.n = 77;
20327
- return effects.call(forwardMessage, {
20328
- type: RESEND_MESSAGE,
20329
- payload: {
20330
- message: msg,
20331
- connectionState: connectionState,
20332
- channelId: channelId
20333
- }
20334
- });
20442
+ _context0.n = 77;
20443
+ return effects.put(setMessagesAC([]));
20335
20444
  case 77:
20336
- _context9.n = 81;
20445
+ _context0.n = 79;
20337
20446
  break;
20338
20447
  case 78:
20339
- if (!(attachments && attachments.length > 0)) {
20340
- _context9.n = 80;
20341
- break;
20342
- }
20343
- _context9.n = 79;
20344
- return effects.call(sendMessage, {
20345
- type: RESEND_MESSAGE,
20346
- payload: {
20347
- message: msg,
20348
- connectionState: connectionState,
20349
- channelId: channelId
20350
- }
20351
- });
20448
+ _context0.p = 78;
20449
+ _t21 = _context0.v;
20450
+ log.error('error in message query', _t21);
20352
20451
  case 79:
20353
- _context9.n = 81;
20354
- break;
20452
+ _context0.p = 79;
20453
+ _context0.n = 80;
20454
+ return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
20355
20455
  case 80:
20356
- _context9.n = 81;
20357
- return effects.call(sendTextMessage, {
20358
- type: RESEND_MESSAGE,
20359
- payload: {
20360
- message: msg,
20361
- connectionState: connectionState,
20362
- channelId: channelId
20363
- }
20364
- });
20456
+ return _context0.f(79);
20365
20457
  case 81:
20366
- _context9.n = 76;
20367
- break;
20368
- case 82:
20369
- _context9.n = 75;
20370
- break;
20371
- case 83:
20372
- pendingPollActionsMap = store.getState().MessageReducer.pendingPollActions;
20373
- if (!(pendingPollActionsMap && Object.keys(pendingPollActionsMap).length > 0)) {
20374
- _context9.n = 84;
20375
- break;
20376
- }
20377
- _context9.n = 84;
20378
- return effects.put(resendPendingPollActionsAC(connectionState));
20379
- case 84:
20380
- _context9.n = 85;
20381
- return effects.put(setWaitToSendPendingMessagesAC(false));
20382
- case 85:
20383
- _context9.n = 87;
20384
- break;
20385
- case 86:
20386
- if (!channel.isMockChannel) {
20387
- _context9.n = 87;
20388
- break;
20389
- }
20390
- _context9.n = 87;
20391
- return effects.put(setMessagesAC([]));
20392
- case 87:
20393
- _context9.n = 89;
20394
- break;
20395
- case 88:
20396
- _context9.p = 88;
20397
- _t20 = _context9.v;
20398
- log.error('error in message query', _t20);
20399
- case 89:
20400
- _context9.p = 89;
20401
- _context9.n = 90;
20402
- return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
20403
- case 90:
20404
- return _context9.f(89);
20405
- case 91:
20406
- return _context9.a(2);
20458
+ return _context0.a(2);
20407
20459
  }
20408
- }, _marked7$1, null, [[0, 88, 89, 91]]);
20460
+ }, _marked7$1, null, [[0, 78, 79, 81]]);
20409
20461
  }
20410
20462
  function getMessageQuery(action) {
20411
- var payload, channelId, messageId, channel, connectionState, messages, fetchedMessage, _t21;
20412
- return _regenerator().w(function (_context0) {
20413
- while (1) switch (_context0.p = _context0.n) {
20463
+ var payload, channelId, messageId, channel, connectionState, messages, fetchedMessage, _t22;
20464
+ return _regenerator().w(function (_context1) {
20465
+ while (1) switch (_context1.p = _context1.n) {
20414
20466
  case 0:
20415
- _context0.p = 0;
20467
+ _context1.p = 0;
20416
20468
  payload = action.payload;
20417
20469
  channelId = payload.channelId, messageId = payload.messageId;
20418
- _context0.n = 1;
20470
+ _context1.n = 1;
20419
20471
  return effects.call(getChannelFromAllChannels, channelId);
20420
20472
  case 1:
20421
- channel = _context0.v;
20473
+ channel = _context1.v;
20422
20474
  connectionState = store.getState().UserReducer.connectionStatus;
20423
20475
  if (!(!channel || connectionState !== CONNECTION_STATUS.CONNECTED)) {
20424
- _context0.n = 2;
20476
+ _context1.n = 2;
20425
20477
  break;
20426
20478
  }
20427
- return _context0.a(2);
20479
+ return _context1.a(2);
20428
20480
  case 2:
20429
- _context0.n = 3;
20481
+ _context1.n = 3;
20430
20482
  return effects.call(channel.getMessagesById, [messageId]);
20431
20483
  case 3:
20432
- messages = _context0.v;
20484
+ messages = _context1.v;
20433
20485
  fetchedMessage = messages && messages[0] ? JSON.parse(JSON.stringify(messages[0])) : null;
20434
20486
  if (!fetchedMessage) {
20435
- _context0.n = 6;
20487
+ _context1.n = 6;
20436
20488
  break;
20437
20489
  }
20438
- _context0.n = 4;
20490
+ _context1.n = 4;
20439
20491
  return effects.put(updateMessageAC(messageId, fetchedMessage));
20440
20492
  case 4:
20441
20493
  updateMessageOnMap(channel.id, {
@@ -20443,45 +20495,45 @@ function getMessageQuery(action) {
20443
20495
  params: fetchedMessage
20444
20496
  });
20445
20497
  updateMessageOnAllMessages(messageId, fetchedMessage);
20446
- _context0.n = 5;
20498
+ _context1.n = 5;
20447
20499
  return effects.put(setScrollToMessagesAC(messageId, false));
20448
20500
  case 5:
20449
20501
  if (!(channel.lastMessage && channel.lastMessage.id === messageId)) {
20450
- _context0.n = 6;
20502
+ _context1.n = 6;
20451
20503
  break;
20452
20504
  }
20453
20505
  updateChannelLastMessageOnAllChannels(channel.id, fetchedMessage);
20454
- _context0.n = 6;
20506
+ _context1.n = 6;
20455
20507
  return effects.put(updateChannelLastMessageAC(fetchedMessage, channel));
20456
20508
  case 6:
20457
- _context0.n = 8;
20509
+ _context1.n = 8;
20458
20510
  break;
20459
20511
  case 7:
20460
- _context0.p = 7;
20461
- _t21 = _context0.v;
20462
- log.error('error in message query', _t21);
20512
+ _context1.p = 7;
20513
+ _t22 = _context1.v;
20514
+ log.error('error in message query', _t22);
20463
20515
  case 8:
20464
- return _context0.a(2);
20516
+ return _context1.a(2);
20465
20517
  }
20466
20518
  }, _marked8$1, null, [[0, 7]]);
20467
20519
  }
20468
20520
  function loadMoreMessages(action) {
20469
- var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result, _t22;
20470
- return _regenerator().w(function (_context1) {
20471
- while (1) switch (_context1.p = _context1.n) {
20521
+ var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result, _t23;
20522
+ return _regenerator().w(function (_context10) {
20523
+ while (1) switch (_context10.p = _context10.n) {
20472
20524
  case 0:
20473
- _context1.p = 0;
20525
+ _context10.p = 0;
20474
20526
  payload = action.payload;
20475
20527
  limit = payload.limit, direction = payload.direction, channelId = payload.channelId, messageId = payload.messageId, hasNext = payload.hasNext;
20476
20528
  SceytChatClient = getClient();
20477
20529
  messageQueryBuilder = new SceytChatClient.MessageListQueryBuilder(channelId);
20478
20530
  messageQueryBuilder.reverse(true);
20479
- _context1.n = 1;
20531
+ _context10.n = 1;
20480
20532
  return effects.call(messageQueryBuilder.build);
20481
20533
  case 1:
20482
- messageQuery = _context1.v;
20534
+ messageQuery = _context10.v;
20483
20535
  messageQuery.limit = limit || 5;
20484
- _context1.n = 2;
20536
+ _context10.n = 2;
20485
20537
  return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
20486
20538
  case 2:
20487
20539
  result = {
@@ -20489,130 +20541,130 @@ function loadMoreMessages(action) {
20489
20541
  hasNext: false
20490
20542
  };
20491
20543
  if (!(direction === MESSAGE_LOAD_DIRECTION.PREV)) {
20492
- _context1.n = 6;
20544
+ _context10.n = 6;
20493
20545
  break;
20494
20546
  }
20495
20547
  if (!getHasPrevCached()) {
20496
- _context1.n = 3;
20548
+ _context10.n = 3;
20497
20549
  break;
20498
20550
  }
20499
20551
  result.messages = getFromAllMessagesByMessageId(messageId, MESSAGE_LOAD_DIRECTION.PREV);
20500
- _context1.n = 5;
20552
+ _context10.n = 5;
20501
20553
  break;
20502
20554
  case 3:
20503
20555
  if (!hasNext) {
20504
- _context1.n = 5;
20556
+ _context10.n = 5;
20505
20557
  break;
20506
20558
  }
20507
- _context1.n = 4;
20559
+ _context10.n = 4;
20508
20560
  return effects.call(messageQuery.loadPreviousMessageId, messageId);
20509
20561
  case 4:
20510
- result = _context1.v;
20562
+ result = _context10.v;
20511
20563
  if (result.messages.length) {
20512
20564
  addAllMessages(result.messages, MESSAGE_LOAD_DIRECTION.PREV);
20513
20565
  setMessagesToMap(channelId, result.messages);
20514
20566
  }
20515
- _context1.n = 5;
20567
+ _context10.n = 5;
20516
20568
  return effects.put(setMessagesHasPrevAC(result.hasNext));
20517
20569
  case 5:
20518
- _context1.n = 10;
20570
+ _context10.n = 10;
20519
20571
  break;
20520
20572
  case 6:
20521
20573
  if (!getHasNextCached()) {
20522
- _context1.n = 7;
20574
+ _context10.n = 7;
20523
20575
  break;
20524
20576
  }
20525
20577
  result.messages = getFromAllMessagesByMessageId(messageId, MESSAGE_LOAD_DIRECTION.NEXT);
20526
- _context1.n = 9;
20578
+ _context10.n = 9;
20527
20579
  break;
20528
20580
  case 7:
20529
20581
  if (!hasNext) {
20530
- _context1.n = 9;
20582
+ _context10.n = 9;
20531
20583
  break;
20532
20584
  }
20533
20585
  log.info('saga load next from server ... ', messageId);
20534
20586
  messageQuery.reverse = false;
20535
- _context1.n = 8;
20587
+ _context10.n = 8;
20536
20588
  return effects.call(messageQuery.loadNextMessageId, messageId);
20537
20589
  case 8:
20538
- result = _context1.v;
20590
+ result = _context10.v;
20539
20591
  if (result.messages.length) {
20540
20592
  addAllMessages(result.messages, MESSAGE_LOAD_DIRECTION.NEXT);
20541
20593
  setMessagesToMap(channelId, result.messages);
20542
20594
  }
20543
- _context1.n = 9;
20595
+ _context10.n = 9;
20544
20596
  return effects.put(setMessagesHasNextAC(result.hasNext));
20545
20597
  case 9:
20546
- _context1.n = 10;
20598
+ _context10.n = 10;
20547
20599
  return effects.put(setMessagesHasPrevAC(true));
20548
20600
  case 10:
20549
20601
  if (!(result.messages && result.messages.length && result.messages.length > 0)) {
20550
- _context1.n = 12;
20602
+ _context10.n = 12;
20551
20603
  break;
20552
20604
  }
20553
- _context1.n = 11;
20605
+ _context10.n = 11;
20554
20606
  return effects.put(addMessagesAC(JSON.parse(JSON.stringify(result.messages)), direction));
20555
20607
  case 11:
20556
- _context1.n = 16;
20608
+ _context10.n = 16;
20557
20609
  break;
20558
20610
  case 12:
20559
- _context1.n = 13;
20611
+ _context10.n = 13;
20560
20612
  return effects.put(addMessagesAC([], direction));
20561
20613
  case 13:
20562
20614
  if (!(direction === MESSAGE_LOAD_DIRECTION.NEXT)) {
20563
- _context1.n = 15;
20615
+ _context10.n = 15;
20564
20616
  break;
20565
20617
  }
20566
- _context1.n = 14;
20618
+ _context10.n = 14;
20567
20619
  return effects.put(setMessagesHasNextAC(false));
20568
20620
  case 14:
20569
- _context1.n = 16;
20621
+ _context10.n = 16;
20570
20622
  break;
20571
20623
  case 15:
20572
- _context1.n = 16;
20624
+ _context10.n = 16;
20573
20625
  return effects.put(setMessagesHasPrevAC(false));
20574
20626
  case 16:
20575
- _context1.n = 17;
20627
+ _context10.n = 17;
20576
20628
  return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
20577
20629
  case 17:
20578
- _context1.n = 19;
20630
+ _context10.n = 19;
20579
20631
  break;
20580
20632
  case 18:
20581
- _context1.p = 18;
20582
- _t22 = _context1.v;
20583
- log.error('error in load more messages', _t22);
20633
+ _context10.p = 18;
20634
+ _t23 = _context10.v;
20635
+ log.error('error in load more messages', _t23);
20584
20636
  case 19:
20585
- return _context1.a(2);
20637
+ return _context10.a(2);
20586
20638
  }
20587
20639
  }, _marked9$1, null, [[0, 18]]);
20588
20640
  }
20589
20641
  function addReaction(action) {
20590
- var payload, channelId, messageId, key, score, reason, enforceUnique, user, channel, _yield$call, message, reaction, channelUpdateParam, _t23;
20591
- return _regenerator().w(function (_context10) {
20592
- while (1) switch (_context10.p = _context10.n) {
20642
+ var payload, channelId, messageId, key, score, reason, enforceUnique, user, channel, _yield$call, message, reaction, channelUpdateParam, _t24;
20643
+ return _regenerator().w(function (_context11) {
20644
+ while (1) switch (_context11.p = _context11.n) {
20593
20645
  case 0:
20594
- _context10.p = 0;
20646
+ _context11.p = 0;
20595
20647
  payload = action.payload;
20596
20648
  channelId = payload.channelId, messageId = payload.messageId, key = payload.key, score = payload.score, reason = payload.reason, enforceUnique = payload.enforceUnique;
20597
20649
  user = getClient().user;
20598
- _context10.n = 1;
20650
+ _context11.n = 1;
20599
20651
  return effects.call(getChannelFromMap, channelId);
20600
20652
  case 1:
20601
- channel = _context10.v;
20653
+ channel = _context11.v;
20602
20654
  if (!channel) {
20603
20655
  channel = getChannelFromAllChannels(channelId);
20604
20656
  if (channel) {
20605
20657
  setChannelInMap(channel);
20606
20658
  }
20607
20659
  }
20608
- _context10.n = 2;
20660
+ _context11.n = 2;
20609
20661
  return effects.call(channel.addReaction, messageId, key, score, reason, enforceUnique);
20610
20662
  case 2:
20611
- _yield$call = _context10.v;
20663
+ _yield$call = _context11.v;
20612
20664
  message = _yield$call.message;
20613
20665
  reaction = _yield$call.reaction;
20614
20666
  if (!(user.id === message.user.id)) {
20615
- _context10.n = 4;
20667
+ _context11.n = 4;
20616
20668
  break;
20617
20669
  }
20618
20670
  channelUpdateParam = {
@@ -20620,99 +20672,99 @@ function addReaction(action) {
20620
20672
  lastReactedMessage: message,
20621
20673
  newReactions: [reaction]
20622
20674
  };
20623
- _context10.n = 3;
20675
+ _context11.n = 3;
20624
20676
  return effects.put(updateChannelDataAC(channel.id, channelUpdateParam));
20625
20677
  case 3:
20626
20678
  updateChannelOnAllChannels(channel.id, channelUpdateParam);
20627
20679
  case 4:
20628
- _context10.n = 5;
20680
+ _context11.n = 5;
20629
20681
  return effects.put(addChannelAC(JSON.parse(JSON.stringify(channel))));
20630
20682
  case 5:
20631
- _context10.n = 6;
20683
+ _context11.n = 6;
20632
20684
  return effects.put(addReactionToListAC(reaction));
20633
20685
  case 6:
20634
- _context10.n = 7;
20686
+ _context11.n = 7;
20635
20687
  return effects.put(addReactionToMessageAC(message, reaction, true));
20636
20688
  case 7:
20637
20689
  addReactionToMessageOnMap(channelId, message, reaction, true);
20638
20690
  addReactionOnAllMessages(message, reaction, true);
20639
- _context10.n = 9;
20691
+ _context11.n = 9;
20640
20692
  break;
20641
20693
  case 8:
20642
- _context10.p = 8;
20643
- _t23 = _context10.v;
20644
- log.error('ERROR in add reaction', _t23.message);
20694
+ _context11.p = 8;
20695
+ _t24 = _context11.v;
20696
+ log.error('ERROR in add reaction', _t24.message);
20645
20697
  case 9:
20646
- return _context10.a(2);
20698
+ return _context11.a(2);
20647
20699
  }
20648
20700
  }, _marked0$1, null, [[0, 8]]);
20649
20701
  }
20650
20702
  function deleteReaction(action) {
20651
- var payload, channelId, messageId, key, isLastReaction, channel, _yield$call2, message, reaction, channelUpdateParam, _t24;
20652
- return _regenerator().w(function (_context11) {
20653
- while (1) switch (_context11.p = _context11.n) {
20703
+ var payload, channelId, messageId, key, isLastReaction, channel, _yield$call2, message, reaction, channelUpdateParam, _t25;
20704
+ return _regenerator().w(function (_context12) {
20705
+ while (1) switch (_context12.p = _context12.n) {
20654
20706
  case 0:
20655
- _context11.p = 0;
20707
+ _context12.p = 0;
20656
20708
  payload = action.payload;
20657
20709
  channelId = payload.channelId, messageId = payload.messageId, key = payload.key, isLastReaction = payload.isLastReaction;
20658
- _context11.n = 1;
20710
+ _context12.n = 1;
20659
20711
  return effects.call(getChannelFromMap, channelId);
20660
20712
  case 1:
20661
- channel = _context11.v;
20713
+ channel = _context12.v;
20662
20714
  if (!channel) {
20663
20715
  channel = getChannelFromAllChannels(channelId);
20664
20716
  if (channel) {
20665
20717
  setChannelInMap(channel);
20666
20718
  }
20667
20719
  }
20668
- _context11.n = 2;
20720
+ _context12.n = 2;
20669
20721
  return effects.call(channel.deleteReaction, messageId, key);
20670
20722
  case 2:
20671
- _yield$call2 = _context11.v;
20723
+ _yield$call2 = _context12.v;
20672
20724
  message = _yield$call2.message;
20673
20725
  reaction = _yield$call2.reaction;
20674
20726
  if (!isLastReaction) {
20675
- _context11.n = 4;
20727
+ _context12.n = 4;
20676
20728
  break;
20677
20729
  }
20678
20730
  channelUpdateParam = {
20679
20731
  userMessageReactions: [],
20680
20732
  lastReactedMessage: null
20681
20733
  };
20682
- _context11.n = 3;
20734
+ _context12.n = 3;
20683
20735
  return effects.put(updateChannelDataAC(channel.id, channelUpdateParam));
20684
20736
  case 3:
20685
20737
  updateChannelOnAllChannels(channel.id, channelUpdateParam);
20686
20738
  case 4:
20687
- _context11.n = 5;
20739
+ _context12.n = 5;
20688
20740
  return effects.put(deleteReactionFromListAC(reaction));
20689
20741
  case 5:
20690
- _context11.n = 6;
20742
+ _context12.n = 6;
20691
20743
  return effects.put(deleteReactionFromMessageAC(message, reaction, true));
20692
20744
  case 6:
20693
20745
  removeReactionToMessageOnMap(channelId, message, reaction, true);
20694
20746
  removeReactionOnAllMessages(message, reaction, true);
20695
- _context11.n = 8;
20747
+ _context12.n = 8;
20696
20748
  break;
20697
20749
  case 7:
20698
- _context11.p = 7;
20699
- _t24 = _context11.v;
20700
- log.error('ERROR in delete reaction', _t24.message);
20750
+ _context12.p = 7;
20751
+ _t25 = _context12.v;
20752
+ log.error('ERROR in delete reaction', _t25.message);
20701
20753
  case 8:
20702
- return _context11.a(2);
20754
+ return _context12.a(2);
20703
20755
  }
20704
20756
  }, _marked1$1, null, [[0, 7]]);
20705
20757
  }
20706
20758
  function getReactions(action) {
20707
- var payload, messageId, key, limit, SceytChatClient, reactionQueryBuilder, reactionQuery, result, _t25;
20708
- return _regenerator().w(function (_context12) {
20709
- while (1) switch (_context12.p = _context12.n) {
20759
+ var payload, messageId, key, limit, SceytChatClient, reactionQueryBuilder, reactionQuery, result, _t26;
20760
+ return _regenerator().w(function (_context13) {
20761
+ while (1) switch (_context13.p = _context13.n) {
20710
20762
  case 0:
20711
- _context12.p = 0;
20763
+ _context13.p = 0;
20712
20764
  payload = action.payload;
20713
20765
  messageId = payload.messageId, key = payload.key, limit = payload.limit;
20714
20766
  SceytChatClient = getClient();
20715
- _context12.n = 1;
20767
+ _context13.n = 1;
20716
20768
  return effects.put(setReactionsLoadingStateAC(LOADING_STATE.LOADING));
20717
20769
  case 1:
20718
20770
  reactionQueryBuilder = new SceytChatClient.ReactionListQueryBuilder(messageId);
@@ -20720,74 +20772,74 @@ function getReactions(action) {
20720
20772
  if (key) {
20721
20773
  reactionQueryBuilder.setKey(key);
20722
20774
  }
20723
- _context12.n = 2;
20775
+ _context13.n = 2;
20724
20776
  return effects.call(reactionQueryBuilder.build);
20725
20777
  case 2:
20726
- reactionQuery = _context12.v;
20727
- _context12.n = 3;
20778
+ reactionQuery = _context13.v;
20779
+ _context13.n = 3;
20728
20780
  return effects.call(reactionQuery.loadNext);
20729
20781
  case 3:
20730
- result = _context12.v;
20782
+ result = _context13.v;
20731
20783
  query.ReactionsQuery = reactionQuery;
20732
- _context12.n = 4;
20784
+ _context13.n = 4;
20733
20785
  return effects.put(setReactionsListAC(result.reactions, result.hasNext));
20734
20786
  case 4:
20735
- _context12.n = 5;
20787
+ _context13.n = 5;
20736
20788
  return effects.put(setReactionsLoadingStateAC(LOADING_STATE.LOADED));
20737
20789
  case 5:
20738
- _context12.n = 7;
20790
+ _context13.n = 7;
20739
20791
  break;
20740
20792
  case 6:
20741
- _context12.p = 6;
20742
- _t25 = _context12.v;
20743
- log.error('ERROR in get reactions', _t25.message);
20793
+ _context13.p = 6;
20794
+ _t26 = _context13.v;
20795
+ log.error('ERROR in get reactions', _t26.message);
20744
20796
  case 7:
20745
- return _context12.a(2);
20797
+ return _context13.a(2);
20746
20798
  }
20747
20799
  }, _marked10$1, null, [[0, 6]]);
20748
20800
  }
20749
20801
  function loadMoreReactions(action) {
20750
- var payload, limit, ReactionQuery, result, _t26;
20751
- return _regenerator().w(function (_context13) {
20752
- while (1) switch (_context13.p = _context13.n) {
20802
+ var payload, limit, ReactionQuery, result, _t27;
20803
+ return _regenerator().w(function (_context14) {
20804
+ while (1) switch (_context14.p = _context14.n) {
20753
20805
  case 0:
20754
- _context13.p = 0;
20806
+ _context14.p = 0;
20755
20807
  payload = action.payload;
20756
20808
  limit = payload.limit;
20757
- _context13.n = 1;
20809
+ _context14.n = 1;
20758
20810
  return effects.put(setReactionsLoadingStateAC(LOADING_STATE.LOADING));
20759
20811
  case 1:
20760
20812
  ReactionQuery = query.ReactionsQuery;
20761
20813
  if (limit) {
20762
20814
  ReactionQuery.limit = limit;
20763
20815
  }
20764
- _context13.n = 2;
20816
+ _context14.n = 2;
20765
20817
  return effects.call(ReactionQuery.loadNext);
20766
20818
  case 2:
20767
- result = _context13.v;
20768
- _context13.n = 3;
20819
+ result = _context14.v;
20820
+ _context14.n = 3;
20769
20821
  return effects.put(addReactionsToListAC(result.reactions, result.hasNext));
20770
20822
  case 3:
20771
- _context13.n = 4;
20823
+ _context14.n = 4;
20772
20824
  return effects.put(setReactionsLoadingStateAC(LOADING_STATE.LOADED));
20773
20825
  case 4:
20774
- _context13.n = 6;
20826
+ _context14.n = 6;
20775
20827
  break;
20776
20828
  case 5:
20777
- _context13.p = 5;
20778
- _t26 = _context13.v;
20779
- log.error('ERROR in load more reactions', _t26.message);
20829
+ _context14.p = 5;
20830
+ _t27 = _context14.v;
20831
+ log.error('ERROR in load more reactions', _t27.message);
20780
20832
  case 6:
20781
- return _context13.a(2);
20833
+ return _context14.a(2);
20782
20834
  }
20783
20835
  }, _marked11$1, null, [[0, 5]]);
20784
20836
  }
20785
20837
  function getMessageAttachments(action) {
20786
- var _action$payload2, channelId, attachmentType, limit, direction, attachmentId, forPopup, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, result, _t27;
20787
- return _regenerator().w(function (_context14) {
20788
- while (1) switch (_context14.p = _context14.n) {
20838
+ var _action$payload2, channelId, attachmentType, limit, direction, attachmentId, forPopup, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, result, _t28;
20839
+ return _regenerator().w(function (_context15) {
20840
+ while (1) switch (_context15.p = _context15.n) {
20789
20841
  case 0:
20790
- _context14.p = 0;
20842
+ _context15.p = 0;
20791
20843
  _action$payload2 = action.payload, channelId = _action$payload2.channelId, attachmentType = _action$payload2.attachmentType, limit = _action$payload2.limit, direction = _action$payload2.direction, attachmentId = _action$payload2.attachmentId, forPopup = _action$payload2.forPopup;
20792
20844
  SceytChatClient = getClient();
20793
20845
  typeList = [attachmentTypes.video, attachmentTypes.image, attachmentTypes.file, attachmentTypes.link, attachmentTypes.voice];
@@ -20802,244 +20854,244 @@ function getMessageAttachments(action) {
20802
20854
  }
20803
20855
  AttachmentByTypeQueryBuilder = new SceytChatClient.AttachmentListQueryBuilder(channelId, typeList);
20804
20856
  AttachmentByTypeQueryBuilder.limit(limit || 34);
20805
- _context14.n = 1;
20857
+ _context15.n = 1;
20806
20858
  return effects.call(AttachmentByTypeQueryBuilder.build);
20807
20859
  case 1:
20808
- AttachmentByTypeQuery = _context14.v;
20860
+ AttachmentByTypeQuery = _context15.v;
20809
20861
  if (forPopup) {
20810
20862
  AttachmentByTypeQuery.reverse = true;
20811
20863
  }
20812
20864
  if (!(direction === queryDirection.NEXT)) {
20813
- _context14.n = 3;
20865
+ _context15.n = 3;
20814
20866
  break;
20815
20867
  }
20816
- _context14.n = 2;
20868
+ _context15.n = 2;
20817
20869
  return effects.call(AttachmentByTypeQuery.loadPrevious);
20818
20870
  case 2:
20819
- result = _context14.v;
20820
- _context14.n = 7;
20871
+ result = _context15.v;
20872
+ _context15.n = 7;
20821
20873
  break;
20822
20874
  case 3:
20823
20875
  if (!(direction === queryDirection.NEAR)) {
20824
- _context14.n = 5;
20876
+ _context15.n = 5;
20825
20877
  break;
20826
20878
  }
20827
- _context14.n = 4;
20879
+ _context15.n = 4;
20828
20880
  return effects.call(AttachmentByTypeQuery.loadNearMessageId, attachmentId);
20829
20881
  case 4:
20830
- result = _context14.v;
20831
- _context14.n = 7;
20882
+ result = _context15.v;
20883
+ _context15.n = 7;
20832
20884
  break;
20833
20885
  case 5:
20834
- _context14.n = 6;
20886
+ _context15.n = 6;
20835
20887
  return effects.call(AttachmentByTypeQuery.loadPrevious);
20836
20888
  case 6:
20837
- result = _context14.v;
20889
+ result = _context15.v;
20838
20890
  case 7:
20839
20891
  if (!forPopup) {
20840
- _context14.n = 10;
20892
+ _context15.n = 10;
20841
20893
  break;
20842
20894
  }
20843
20895
  query.AttachmentByTypeQueryForPopup = AttachmentByTypeQuery;
20844
- _context14.n = 8;
20896
+ _context15.n = 8;
20845
20897
  return effects.put(setAttachmentsForPopupAC(JSON.parse(JSON.stringify(result.attachments))));
20846
20898
  case 8:
20847
- _context14.n = 9;
20899
+ _context15.n = 9;
20848
20900
  return effects.put(setAttachmentsCompleteForPopupAC(result.hasNext));
20849
20901
  case 9:
20850
- _context14.n = 12;
20902
+ _context15.n = 12;
20851
20903
  break;
20852
20904
  case 10:
20853
20905
  query.AttachmentByTypeQuery = AttachmentByTypeQuery;
20854
- _context14.n = 11;
20906
+ _context15.n = 11;
20855
20907
  return effects.put(setAttachmentsCompleteAC(result.hasNext));
20856
20908
  case 11:
20857
- _context14.n = 12;
20909
+ _context15.n = 12;
20858
20910
  return effects.put(setAttachmentsAC(JSON.parse(JSON.stringify(result.attachments))));
20859
20911
  case 12:
20860
- _context14.n = 14;
20912
+ _context15.n = 14;
20861
20913
  break;
20862
20914
  case 13:
20863
- _context14.p = 13;
20864
- _t27 = _context14.v;
20865
- log.error('error in message attachment query', _t27);
20915
+ _context15.p = 13;
20916
+ _t28 = _context15.v;
20917
+ log.error('error in message attachment query', _t28);
20866
20918
  case 14:
20867
- return _context14.a(2);
20919
+ return _context15.a(2);
20868
20920
  }
20869
20921
  }, _marked12$1, null, [[0, 13]]);
20870
20922
  }
20871
20923
  function loadMoreMessageAttachments(action) {
20872
- var _action$payload3, limit, direction, forPopup, AttachmentQuery, _yield$call3, attachments, hasNext, _t28;
20873
- return _regenerator().w(function (_context15) {
20874
- while (1) switch (_context15.p = _context15.n) {
20924
+ var _action$payload3, limit, direction, forPopup, AttachmentQuery, _yield$call3, attachments, hasNext, _t29;
20925
+ return _regenerator().w(function (_context16) {
20926
+ while (1) switch (_context16.p = _context16.n) {
20875
20927
  case 0:
20876
- _context15.p = 0;
20928
+ _context16.p = 0;
20877
20929
  _action$payload3 = action.payload, limit = _action$payload3.limit, direction = _action$payload3.direction, forPopup = _action$payload3.forPopup;
20878
20930
  if (forPopup) {
20879
20931
  AttachmentQuery = query.AttachmentByTypeQueryForPopup;
20880
20932
  } else {
20881
20933
  AttachmentQuery = query.AttachmentByTypeQuery;
20882
20934
  }
20883
- _context15.n = 1;
20935
+ _context16.n = 1;
20884
20936
  return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
20885
20937
  case 1:
20886
20938
  AttachmentQuery.limit = limit;
20887
- _context15.n = 2;
20939
+ _context16.n = 2;
20888
20940
  return effects.call(AttachmentQuery.loadPrevious);
20889
20941
  case 2:
20890
- _yield$call3 = _context15.v;
20942
+ _yield$call3 = _context16.v;
20891
20943
  attachments = _yield$call3.attachments;
20892
20944
  hasNext = _yield$call3.hasNext;
20893
20945
  if (!forPopup) {
20894
- _context15.n = 4;
20946
+ _context16.n = 4;
20895
20947
  break;
20896
20948
  }
20897
- _context15.n = 3;
20949
+ _context16.n = 3;
20898
20950
  return effects.put(addAttachmentsForPopupAC(attachments, direction));
20899
20951
  case 3:
20900
- _context15.n = 7;
20952
+ _context16.n = 7;
20901
20953
  break;
20902
20954
  case 4:
20903
- _context15.n = 5;
20955
+ _context16.n = 5;
20904
20956
  return effects.put(setAttachmentsCompleteAC(hasNext));
20905
20957
  case 5:
20906
- _context15.n = 6;
20958
+ _context16.n = 6;
20907
20959
  return effects.put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
20908
20960
  case 6:
20909
- _context15.n = 7;
20961
+ _context16.n = 7;
20910
20962
  return effects.put(addAttachmentsAC(attachments));
20911
20963
  case 7:
20912
- _context15.n = 9;
20964
+ _context16.n = 9;
20913
20965
  break;
20914
20966
  case 8:
20915
- _context15.p = 8;
20916
- _t28 = _context15.v;
20917
- log.error('error in message attachment query', _t28);
20967
+ _context16.p = 8;
20968
+ _t29 = _context16.v;
20969
+ log.error('error in message attachment query', _t29);
20918
20970
  case 9:
20919
- return _context15.a(2);
20971
+ return _context16.a(2);
20920
20972
  }
20921
20973
  }, _marked13$1, null, [[0, 8]]);
20922
20974
  }
20923
20975
  function pauseAttachmentUploading(action) {
20924
- var attachmentId, isPaused, _t29;
20925
- return _regenerator().w(function (_context16) {
20926
- while (1) switch (_context16.p = _context16.n) {
20976
+ var attachmentId, isPaused, _t30;
20977
+ return _regenerator().w(function (_context17) {
20978
+ while (1) switch (_context17.p = _context17.n) {
20927
20979
  case 0:
20928
- _context16.p = 0;
20980
+ _context17.p = 0;
20929
20981
  attachmentId = action.payload.attachmentId;
20930
20982
  if (!getCustomUploader()) {
20931
- _context16.n = 1;
20983
+ _context17.n = 1;
20932
20984
  break;
20933
20985
  }
20934
20986
  isPaused = pauseUpload(attachmentId);
20935
20987
  if (!isPaused) {
20936
- _context16.n = 1;
20988
+ _context17.n = 1;
20937
20989
  break;
20938
20990
  }
20939
- _context16.n = 1;
20991
+ _context17.n = 1;
20940
20992
  return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.PAUSED, attachmentId));
20941
20993
  case 1:
20942
- _context16.n = 3;
20994
+ _context17.n = 3;
20943
20995
  break;
20944
20996
  case 2:
20945
- _context16.p = 2;
20946
- _t29 = _context16.v;
20947
- log.error('error in pause attachment uploading', _t29);
20997
+ _context17.p = 2;
20998
+ _t30 = _context17.v;
20999
+ log.error('error in pause attachment uploading', _t30);
20948
21000
  case 3:
20949
- return _context16.a(2);
21001
+ return _context17.a(2);
20950
21002
  }
20951
21003
  }, _marked14$1, null, [[0, 2]]);
20952
21004
  }
20953
21005
  function resumeAttachmentUploading(action) {
20954
- var attachmentId, isResumed, _t30;
20955
- return _regenerator().w(function (_context17) {
20956
- while (1) switch (_context17.p = _context17.n) {
21006
+ var attachmentId, isResumed, _t31;
21007
+ return _regenerator().w(function (_context18) {
21008
+ while (1) switch (_context18.p = _context18.n) {
20957
21009
  case 0:
20958
- _context17.p = 0;
21010
+ _context18.p = 0;
20959
21011
  attachmentId = action.payload.attachmentId;
20960
21012
  log.info('resume for attachment ... ', attachmentId);
20961
21013
  if (!getCustomUploader()) {
20962
- _context17.n = 1;
21014
+ _context18.n = 1;
20963
21015
  break;
20964
21016
  }
20965
21017
  isResumed = resumeUpload(attachmentId);
20966
21018
  if (!isResumed) {
20967
- _context17.n = 1;
21019
+ _context18.n = 1;
20968
21020
  break;
20969
21021
  }
20970
- _context17.n = 1;
21022
+ _context18.n = 1;
20971
21023
  return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.UPLOADING, attachmentId));
20972
21024
  case 1:
20973
- _context17.n = 3;
21025
+ _context18.n = 3;
20974
21026
  break;
20975
21027
  case 2:
20976
- _context17.p = 2;
20977
- _t30 = _context17.v;
20978
- log.error('error in resume attachment uploading', _t30);
21028
+ _context18.p = 2;
21029
+ _t31 = _context18.v;
21030
+ log.error('error in resume attachment uploading', _t31);
20979
21031
  case 3:
20980
- return _context17.a(2);
21032
+ return _context18.a(2);
20981
21033
  }
20982
21034
  }, _marked15$1, null, [[0, 2]]);
20983
21035
  }
20984
21036
  function getMessageMarkers(action) {
20985
- var _action$payload4, messageId, channelId, deliveryStatus, sceytChatClient, messageMarkerListQueryBuilder, messageMarkerListQuery, messageMarkers, _t31;
20986
- return _regenerator().w(function (_context18) {
20987
- while (1) switch (_context18.p = _context18.n) {
21037
+ var _action$payload4, messageId, channelId, deliveryStatus, sceytChatClient, messageMarkerListQueryBuilder, messageMarkerListQuery, messageMarkers, _t32;
21038
+ return _regenerator().w(function (_context19) {
21039
+ while (1) switch (_context19.p = _context19.n) {
20988
21040
  case 0:
20989
- _context18.p = 0;
20990
- _context18.n = 1;
21041
+ _context19.p = 0;
21042
+ _context19.n = 1;
20991
21043
  return effects.put(setMessagesMarkersLoadingStateAC(LOADING_STATE.LOADING));
20992
21044
  case 1:
20993
21045
  _action$payload4 = action.payload, messageId = _action$payload4.messageId, channelId = _action$payload4.channelId, deliveryStatus = _action$payload4.deliveryStatus;
20994
21046
  sceytChatClient = getClient();
20995
21047
  if (!sceytChatClient) {
20996
- _context18.n = 4;
21048
+ _context19.n = 4;
20997
21049
  break;
20998
21050
  }
20999
21051
  messageMarkerListQueryBuilder = new sceytChatClient.MessageMarkerListQueryBuilder(channelId, String(messageId), deliveryStatus);
21000
- _context18.n = 2;
21052
+ _context19.n = 2;
21001
21053
  return effects.call(messageMarkerListQueryBuilder.build);
21002
21054
  case 2:
21003
- messageMarkerListQuery = _context18.v;
21004
- _context18.n = 3;
21055
+ messageMarkerListQuery = _context19.v;
21056
+ _context19.n = 3;
21005
21057
  return effects.call(messageMarkerListQuery.loadNext);
21006
21058
  case 3:
21007
- messageMarkers = _context18.v;
21008
- _context18.n = 4;
21059
+ messageMarkers = _context19.v;
21060
+ _context19.n = 4;
21009
21061
  return effects.put(setMessageMarkersAC(channelId, messageId, messageMarkers.markers, deliveryStatus));
21010
21062
  case 4:
21011
- _context18.n = 6;
21063
+ _context19.n = 6;
21012
21064
  break;
21013
21065
  case 5:
21014
- _context18.p = 5;
21015
- _t31 = _context18.v;
21016
- log.error('error in get message markers', _t31);
21066
+ _context19.p = 5;
21067
+ _t32 = _context19.v;
21068
+ log.error('error in get message markers', _t32);
21017
21069
  case 6:
21018
- _context18.p = 6;
21019
- _context18.n = 7;
21070
+ _context19.p = 6;
21071
+ _context19.n = 7;
21020
21072
  return effects.put(setMessagesMarkersLoadingStateAC(LOADING_STATE.LOADED));
21021
21073
  case 7:
21022
- return _context18.f(6);
21074
+ return _context19.f(6);
21023
21075
  case 8:
21024
- return _context18.a(2);
21076
+ return _context19.a(2);
21025
21077
  }
21026
21078
  }, _marked16$1, null, [[0, 5, 6, 8]]);
21027
21079
  }
21028
21080
  function executeAddPollVote(channelId, pollId, optionId, message, isResend) {
21029
21081
  var _user$presence, _message$pollDetails, _message$pollDetails2, _message$pollDetails3, _message$pollDetails4;
21030
21082
  var channel, user, vote, objs, _message$pollDetails5, _message$pollDetails6, _message$pollDetails7, _iterator2, _step2, obj;
21031
- return _regenerator().w(function (_context19) {
21032
- while (1) switch (_context19.n) {
21083
+ return _regenerator().w(function (_context20) {
21084
+ while (1) switch (_context20.n) {
21033
21085
  case 0:
21034
- _context19.n = 1;
21086
+ _context20.n = 1;
21035
21087
  return effects.call(getChannelFromMap, channelId);
21036
21088
  case 1:
21037
- channel = _context19.v;
21089
+ channel = _context20.v;
21038
21090
  if (message.pollDetails) {
21039
- _context19.n = 2;
21091
+ _context20.n = 2;
21040
21092
  break;
21041
21093
  }
21042
- return _context19.a(2);
21094
+ return _context20.a(2);
21043
21095
  case 2:
21044
21096
  user = getClient().user;
21045
21097
  vote = {
@@ -21077,13 +21129,13 @@ function executeAddPollVote(channelId, pollId, optionId, message, isResend) {
21077
21129
  incrementVotesPerOptionCount: 1
21078
21130
  });
21079
21131
  if (isResend) {
21080
- _context19.n = 5;
21132
+ _context20.n = 5;
21081
21133
  break;
21082
21134
  }
21083
21135
  _iterator2 = _createForOfIteratorHelperLoose(objs);
21084
21136
  case 3:
21085
21137
  if ((_step2 = _iterator2()).done) {
21086
- _context19.n = 5;
21138
+ _context20.n = 5;
21087
21139
  break;
21088
21140
  }
21089
21141
  obj = _step2.value;
@@ -21092,46 +21144,46 @@ function executeAddPollVote(channelId, pollId, optionId, message, isResend) {
21092
21144
  params: {}
21093
21145
  }, obj);
21094
21146
  updateMessageOnAllMessages(message.id, {}, obj);
21095
- _context19.n = 4;
21147
+ _context20.n = 4;
21096
21148
  return effects.put(updateMessageAC(message.id, {}, undefined, obj));
21097
21149
  case 4:
21098
- _context19.n = 3;
21150
+ _context20.n = 3;
21099
21151
  break;
21100
21152
  case 5:
21101
21153
  if (!channel) {
21102
- _context19.n = 7;
21154
+ _context20.n = 7;
21103
21155
  break;
21104
21156
  }
21105
- _context19.n = 6;
21157
+ _context20.n = 6;
21106
21158
  return effects.call(channel.addVote, message.id, pollId, [optionId]);
21107
21159
  case 6:
21108
- _context19.n = 7;
21160
+ _context20.n = 7;
21109
21161
  return effects.put(removePendingPollActionAC(message.id, 'ADD_POLL_VOTE', optionId));
21110
21162
  case 7:
21111
- return _context19.a(2);
21163
+ return _context20.a(2);
21112
21164
  }
21113
21165
  }, _marked17$1);
21114
21166
  }
21115
21167
  function updateMessageOptimisticallyForAddPollVote(channelId, message, vote) {
21116
21168
  var channel, obj;
21117
- return _regenerator().w(function (_context20) {
21118
- while (1) switch (_context20.n) {
21169
+ return _regenerator().w(function (_context21) {
21170
+ while (1) switch (_context21.n) {
21119
21171
  case 0:
21120
- _context20.n = 1;
21172
+ _context21.n = 1;
21121
21173
  return effects.call(getChannelFromMap, channelId);
21122
21174
  case 1:
21123
- channel = _context20.v;
21175
+ channel = _context21.v;
21124
21176
  if (channel) {
21125
- _context20.n = 2;
21177
+ _context21.n = 2;
21126
21178
  break;
21127
21179
  }
21128
- return _context20.a(2);
21180
+ return _context21.a(2);
21129
21181
  case 2:
21130
21182
  if (message.pollDetails) {
21131
- _context20.n = 3;
21183
+ _context21.n = 3;
21132
21184
  break;
21133
21185
  }
21134
- return _context20.a(2);
21186
+ return _context21.a(2);
21135
21187
  case 3:
21136
21188
  obj = {
21137
21189
  type: 'addOwn',
@@ -21143,24 +21195,24 @@ function updateMessageOptimisticallyForAddPollVote(channelId, message, vote) {
21143
21195
  params: {}
21144
21196
  }, obj);
21145
21197
  updateMessageOnAllMessages(message.id, {}, obj);
21146
- _context20.n = 4;
21198
+ _context21.n = 4;
21147
21199
  return effects.put(updateMessageAC(message.id, {}, undefined, obj));
21148
21200
  case 4:
21149
- return _context20.a(2);
21201
+ return _context21.a(2);
21150
21202
  }
21151
21203
  }, _marked18$1);
21152
21204
  }
21153
21205
  function addPollVote(action) {
21154
- var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _user$presence2, connectionState, user, vote, pendingAction, conflictCheck, channel, _Object$values2, _store$getState$Messa, _currentMessage$pollD, _currentMessage$pollD2, _currentMessage$pollD3, currentMessage, hasNext, obj, _t32;
21155
- return _regenerator().w(function (_context21) {
21156
- while (1) switch (_context21.p = _context21.n) {
21206
+ var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _user$presence2, connectionState, user, vote, pendingAction, conflictCheck, channel, _Object$values2, _store$getState$Messa, _currentMessage$pollD, _currentMessage$pollD2, _currentMessage$pollD3, currentMessage, hasNext, obj, _t33;
21207
+ return _regenerator().w(function (_context22) {
21208
+ while (1) switch (_context22.p = _context22.n) {
21157
21209
  case 0:
21158
- _context21.p = 0;
21210
+ _context22.p = 0;
21159
21211
  payload = action.payload;
21160
21212
  channelId = payload.channelId, pollId = payload.pollId, optionId = payload.optionId, message = payload.message, isResend = payload.isResend;
21161
21213
  sceytChatClient = getClient();
21162
21214
  if (!sceytChatClient) {
21163
- _context21.n = 7;
21215
+ _context22.n = 7;
21164
21216
  break;
21165
21217
  }
21166
21218
  connectionState = sceytChatClient.connectionState;
@@ -21187,7 +21239,7 @@ function addPollVote(action) {
21187
21239
  }
21188
21240
  };
21189
21241
  if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
21190
- _context21.n = 6;
21242
+ _context22.n = 6;
21191
21243
  break;
21192
21244
  }
21193
21245
  pendingAction = {
@@ -21199,22 +21251,22 @@ function addPollVote(action) {
21199
21251
  };
21200
21252
  conflictCheck = checkPendingPollActionConflict(pendingAction);
21201
21253
  if (!(conflictCheck.hasConflict && !conflictCheck.shouldSkip)) {
21202
- _context21.n = 4;
21254
+ _context22.n = 4;
21203
21255
  break;
21204
21256
  }
21205
- _context21.n = 1;
21257
+ _context22.n = 1;
21206
21258
  return effects.call(getChannelFromMap, channelId);
21207
21259
  case 1:
21208
- channel = _context21.v;
21260
+ channel = _context22.v;
21209
21261
  if (!channel) {
21210
- _context21.n = 3;
21262
+ _context22.n = 3;
21211
21263
  break;
21212
21264
  }
21213
21265
  currentMessage = ((_Object$values2 = Object.values(getMessagesFromMap(channelId) || {})) === null || _Object$values2 === void 0 ? void 0 : _Object$values2.find(function (msg) {
21214
21266
  return msg.id === message.id || msg.tid === message.id;
21215
21267
  })) || message;
21216
21268
  hasNext = ((_store$getState$Messa = store.getState().MessageReducer.pollVotesHasMore) === null || _store$getState$Messa === void 0 ? void 0 : _store$getState$Messa[pollId]) || false;
21217
- _context21.n = 2;
21269
+ _context22.n = 2;
21218
21270
  return effects.put(addPollVotesToListAC(pollId, optionId, [(_currentMessage$pollD = currentMessage.pollDetails) === null || _currentMessage$pollD === void 0 ? void 0 : (_currentMessage$pollD2 = _currentMessage$pollD.voteDetails) === null || _currentMessage$pollD2 === void 0 ? void 0 : (_currentMessage$pollD3 = _currentMessage$pollD2.ownVotes) === null || _currentMessage$pollD3 === void 0 ? void 0 : _currentMessage$pollD3[0]], hasNext, message.id));
21219
21271
  case 2:
21220
21272
  obj = {
@@ -21227,60 +21279,60 @@ function addPollVote(action) {
21227
21279
  params: {}
21228
21280
  }, obj);
21229
21281
  updateMessageOnAllMessages(message.id, {}, obj);
21230
- _context21.n = 3;
21282
+ _context22.n = 3;
21231
21283
  return effects.put(updateMessageAC(message.id, {}, undefined, obj));
21232
21284
  case 3:
21233
- _context21.n = 5;
21285
+ _context22.n = 5;
21234
21286
  break;
21235
21287
  case 4:
21236
21288
  if (conflictCheck.shouldSkip) {
21237
- _context21.n = 5;
21289
+ _context22.n = 5;
21238
21290
  break;
21239
21291
  }
21240
- return _context21.d(_regeneratorValues(updateMessageOptimisticallyForAddPollVote(channelId, message, vote)), 5);
21292
+ return _context22.d(_regeneratorValues(updateMessageOptimisticallyForAddPollVote(channelId, message, vote)), 5);
21241
21293
  case 5:
21242
21294
  if (!conflictCheck.shouldSkip) {
21243
21295
  setPendingPollAction(pendingAction);
21244
21296
  }
21245
- return _context21.a(2);
21297
+ return _context22.a(2);
21246
21298
  case 6:
21247
- return _context21.d(_regeneratorValues(executeAddPollVote(channelId, pollId, optionId, message, isResend)), 7);
21299
+ return _context22.d(_regeneratorValues(executeAddPollVote(channelId, pollId, optionId, message, isResend)), 7);
21248
21300
  case 7:
21249
- _context21.n = 9;
21301
+ _context22.n = 9;
21250
21302
  break;
21251
21303
  case 8:
21252
- _context21.p = 8;
21253
- _t32 = _context21.v;
21254
- log.error('error in add poll vote', _t32);
21304
+ _context22.p = 8;
21305
+ _t33 = _context22.v;
21306
+ log.error('error in add poll vote', _t33);
21255
21307
  case 9:
21256
- return _context21.a(2);
21308
+ return _context22.a(2);
21257
21309
  }
21258
21310
  }, _marked19$1, null, [[0, 8]]);
21259
21311
  }
21260
21312
  function executeDeletePollVote(channelId, pollId, optionId, message, isResend) {
21261
21313
  var _message$pollDetails8, _message$pollDetails9, _message$pollDetails0;
21262
21314
  var channel, vote, obj;
21263
- return _regenerator().w(function (_context22) {
21264
- while (1) switch (_context22.n) {
21315
+ return _regenerator().w(function (_context23) {
21316
+ while (1) switch (_context23.n) {
21265
21317
  case 0:
21266
- _context22.n = 1;
21318
+ _context23.n = 1;
21267
21319
  return effects.call(getChannelFromMap, channelId);
21268
21320
  case 1:
21269
- channel = _context22.v;
21321
+ channel = _context23.v;
21270
21322
  if (message.pollDetails) {
21271
- _context22.n = 2;
21323
+ _context23.n = 2;
21272
21324
  break;
21273
21325
  }
21274
- return _context22.a(2);
21326
+ return _context23.a(2);
21275
21327
  case 2:
21276
21328
  vote = (_message$pollDetails8 = message.pollDetails) === null || _message$pollDetails8 === void 0 ? void 0 : (_message$pollDetails9 = _message$pollDetails8.voteDetails) === null || _message$pollDetails9 === void 0 ? void 0 : (_message$pollDetails0 = _message$pollDetails9.ownVotes) === null || _message$pollDetails0 === void 0 ? void 0 : _message$pollDetails0.find(function (vote) {
21277
21329
  return vote.optionId === optionId;
21278
21330
  });
21279
21331
  if (vote) {
21280
- _context22.n = 3;
21332
+ _context23.n = 3;
21281
21333
  break;
21282
21334
  }
21283
- return _context22.a(2);
21335
+ return _context23.a(2);
21284
21336
  case 3:
21285
21337
  obj = {
21286
21338
  type: 'deleteOwn',
@@ -21288,7 +21340,7 @@ function executeDeletePollVote(channelId, pollId, optionId, message, isResend) {
21288
21340
  incrementVotesPerOptionCount: -1
21289
21341
  };
21290
21342
  if (isResend) {
21291
- _context22.n = 4;
21343
+ _context23.n = 4;
21292
21344
  break;
21293
21345
  }
21294
21346
  updateMessageOnMap(channel.id, {
@@ -21296,43 +21348,43 @@ function executeDeletePollVote(channelId, pollId, optionId, message, isResend) {
21296
21348
  params: {}
21297
21349
  }, obj);
21298
21350
  updateMessageOnAllMessages(message.id, {}, obj);
21299
- _context22.n = 4;
21351
+ _context23.n = 4;
21300
21352
  return effects.put(updateMessageAC(message.id, {}, undefined, obj));
21301
21353
  case 4:
21302
21354
  if (!channel) {
21303
- _context22.n = 6;
21355
+ _context23.n = 6;
21304
21356
  break;
21305
21357
  }
21306
- _context22.n = 5;
21358
+ _context23.n = 5;
21307
21359
  return effects.call(channel.deleteVote, message.id, pollId, [optionId]);
21308
21360
  case 5:
21309
- _context22.n = 6;
21361
+ _context23.n = 6;
21310
21362
  return effects.put(removePendingPollActionAC(message.id, 'DELETE_POLL_VOTE', optionId));
21311
21363
  case 6:
21312
- return _context22.a(2);
21364
+ return _context23.a(2);
21313
21365
  }
21314
21366
  }, _marked20$1);
21315
21367
  }
21316
21368
  function updateMessageOptimisticallyForDeletePollVote(channelId, message, vote) {
21317
21369
  var channel, obj;
21318
- return _regenerator().w(function (_context23) {
21319
- while (1) switch (_context23.n) {
21370
+ return _regenerator().w(function (_context24) {
21371
+ while (1) switch (_context24.n) {
21320
21372
  case 0:
21321
- _context23.n = 1;
21373
+ _context24.n = 1;
21322
21374
  return effects.call(getChannelFromMap, channelId);
21323
21375
  case 1:
21324
- channel = _context23.v;
21376
+ channel = _context24.v;
21325
21377
  if (channel) {
21326
- _context23.n = 2;
21378
+ _context24.n = 2;
21327
21379
  break;
21328
21380
  }
21329
- return _context23.a(2);
21381
+ return _context24.a(2);
21330
21382
  case 2:
21331
21383
  if (message.pollDetails) {
21332
- _context23.n = 3;
21384
+ _context24.n = 3;
21333
21385
  break;
21334
21386
  }
21335
- return _context23.a(2);
21387
+ return _context24.a(2);
21336
21388
  case 3:
21337
21389
  obj = {
21338
21390
  type: 'deleteOwn',
@@ -21344,24 +21396,24 @@ function updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)
21344
21396
  params: {}
21345
21397
  }, obj);
21346
21398
  updateMessageOnAllMessages(message.id, {}, obj);
21347
- _context23.n = 4;
21399
+ _context24.n = 4;
21348
21400
  return effects.put(updateMessageAC(message.id, {}, undefined, obj));
21349
21401
  case 4:
21350
- return _context23.a(2);
21402
+ return _context24.a(2);
21351
21403
  }
21352
21404
  }, _marked21$1);
21353
21405
  }
21354
21406
  function deletePollVote(action) {
21355
- var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _message$pollDetails1, _message$pollDetails10, _message$pollDetails11, connectionState, vote, pendingAction, conflictCheck, channel, _Object$values3, _currentMessage$pollD4, _currentMessage$pollD5, _currentMessage$pollD6, currentMessage, obj, _t33;
21356
- return _regenerator().w(function (_context24) {
21357
- while (1) switch (_context24.p = _context24.n) {
21407
+ var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _message$pollDetails1, _message$pollDetails10, _message$pollDetails11, connectionState, vote, pendingAction, conflictCheck, channel, _Object$values3, _currentMessage$pollD4, _currentMessage$pollD5, _currentMessage$pollD6, currentMessage, obj, _t34;
21408
+ return _regenerator().w(function (_context25) {
21409
+ while (1) switch (_context25.p = _context25.n) {
21358
21410
  case 0:
21359
- _context24.p = 0;
21411
+ _context25.p = 0;
21360
21412
  payload = action.payload;
21361
21413
  channelId = payload.channelId, pollId = payload.pollId, optionId = payload.optionId, message = payload.message, isResend = payload.isResend;
21362
21414
  sceytChatClient = getClient();
21363
21415
  if (!sceytChatClient) {
21364
- _context24.n = 8;
21416
+ _context25.n = 8;
21365
21417
  break;
21366
21418
  }
21367
21419
  connectionState = sceytChatClient.connectionState;
@@ -21369,13 +21421,13 @@ function deletePollVote(action) {
21369
21421
  return vote.optionId === optionId;
21370
21422
  });
21371
21423
  if (vote) {
21372
- _context24.n = 1;
21424
+ _context25.n = 1;
21373
21425
  break;
21374
21426
  }
21375
- return _context24.a(2);
21427
+ return _context25.a(2);
21376
21428
  case 1:
21377
21429
  if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
21378
- _context24.n = 7;
21430
+ _context25.n = 7;
21379
21431
  break;
21380
21432
  }
21381
21433
  pendingAction = {
@@ -21387,21 +21439,21 @@ function deletePollVote(action) {
21387
21439
  };
21388
21440
  conflictCheck = checkPendingPollActionConflict(pendingAction);
21389
21441
  if (!(conflictCheck.hasConflict && conflictCheck.shouldSkip)) {
21390
- _context24.n = 5;
21442
+ _context25.n = 5;
21391
21443
  break;
21392
21444
  }
21393
- _context24.n = 2;
21445
+ _context25.n = 2;
21394
21446
  return effects.call(getChannelFromMap, channelId);
21395
21447
  case 2:
21396
- channel = _context24.v;
21448
+ channel = _context25.v;
21397
21449
  if (!channel) {
21398
- _context24.n = 4;
21450
+ _context25.n = 4;
21399
21451
  break;
21400
21452
  }
21401
21453
  currentMessage = ((_Object$values3 = Object.values(getMessagesFromMap(channelId) || {})) === null || _Object$values3 === void 0 ? void 0 : _Object$values3.find(function (msg) {
21402
21454
  return msg.id === message.id || msg.tid === message.id;
21403
21455
  })) || message;
21404
- _context24.n = 3;
21456
+ _context25.n = 3;
21405
21457
  return effects.put(deletePollVotesFromListAC(pollId, optionId, [(_currentMessage$pollD4 = currentMessage.pollDetails) === null || _currentMessage$pollD4 === void 0 ? void 0 : (_currentMessage$pollD5 = _currentMessage$pollD4.voteDetails) === null || _currentMessage$pollD5 === void 0 ? void 0 : (_currentMessage$pollD6 = _currentMessage$pollD5.ownVotes) === null || _currentMessage$pollD6 === void 0 ? void 0 : _currentMessage$pollD6[0]], message.id));
21406
21458
  case 3:
21407
21459
  obj = {
@@ -21414,45 +21466,45 @@ function deletePollVote(action) {
21414
21466
  params: {}
21415
21467
  }, obj);
21416
21468
  updateMessageOnAllMessages(message.id, {}, obj);
21417
- _context24.n = 4;
21469
+ _context25.n = 4;
21418
21470
  return effects.put(updateMessageAC(message.id, {}, undefined, obj));
21419
21471
  case 4:
21420
- _context24.n = 6;
21472
+ _context25.n = 6;
21421
21473
  break;
21422
21474
  case 5:
21423
21475
  if (conflictCheck.shouldSkip) {
21424
- _context24.n = 6;
21476
+ _context25.n = 6;
21425
21477
  break;
21426
21478
  }
21427
- return _context24.d(_regeneratorValues(updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)), 6);
21479
+ return _context25.d(_regeneratorValues(updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)), 6);
21428
21480
  case 6:
21429
21481
  if (!conflictCheck.shouldSkip) {
21430
21482
  setPendingPollAction(pendingAction);
21431
21483
  }
21432
- return _context24.a(2);
21484
+ return _context25.a(2);
21433
21485
  case 7:
21434
- return _context24.d(_regeneratorValues(executeDeletePollVote(channelId, pollId, optionId, message, isResend)), 8);
21486
+ return _context25.d(_regeneratorValues(executeDeletePollVote(channelId, pollId, optionId, message, isResend)), 8);
21435
21487
  case 8:
21436
- _context24.n = 10;
21488
+ _context25.n = 10;
21437
21489
  break;
21438
21490
  case 9:
21439
- _context24.p = 9;
21440
- _t33 = _context24.v;
21441
- log.error('error in delete poll vote', _t33);
21491
+ _context25.p = 9;
21492
+ _t34 = _context25.v;
21493
+ log.error('error in delete poll vote', _t34);
21442
21494
  case 10:
21443
- return _context24.a(2);
21495
+ return _context25.a(2);
21444
21496
  }
21445
21497
  }, _marked22$1, null, [[0, 9]]);
21446
21498
  }
21447
21499
  function executeClosePoll(channelId, pollId, message) {
21448
21500
  var channel, obj;
21449
- return _regenerator().w(function (_context25) {
21450
- while (1) switch (_context25.n) {
21501
+ return _regenerator().w(function (_context26) {
21502
+ while (1) switch (_context26.n) {
21451
21503
  case 0:
21452
- _context25.n = 1;
21504
+ _context26.n = 1;
21453
21505
  return effects.call(getChannelFromMap, channelId);
21454
21506
  case 1:
21455
- channel = _context25.v;
21507
+ channel = _context26.v;
21456
21508
  obj = {
21457
21509
  type: 'close',
21458
21510
  incrementVotesPerOptionCount: 0
@@ -21462,37 +21514,37 @@ function executeClosePoll(channelId, pollId, message) {
21462
21514
  params: {}
21463
21515
  }, obj);
21464
21516
  updateMessageOnAllMessages(message.id, {}, obj);
21465
- _context25.n = 2;
21517
+ _context26.n = 2;
21466
21518
  return effects.put(updateMessageAC(message.id, {}, undefined, obj));
21467
21519
  case 2:
21468
21520
  if (!channel) {
21469
- _context25.n = 4;
21521
+ _context26.n = 4;
21470
21522
  break;
21471
21523
  }
21472
- _context25.n = 3;
21524
+ _context26.n = 3;
21473
21525
  return effects.call(channel.closePoll, message.id, pollId);
21474
21526
  case 3:
21475
- _context25.n = 4;
21527
+ _context26.n = 4;
21476
21528
  return effects.put(removePendingPollActionAC(message.id, 'CLOSE_POLL'));
21477
21529
  case 4:
21478
- return _context25.a(2);
21530
+ return _context26.a(2);
21479
21531
  }
21480
21532
  }, _marked23$1);
21481
21533
  }
21482
21534
  function updateMessageOptimisticallyForClosePoll(channelId, message) {
21483
21535
  var channel, pollDetails;
21484
- return _regenerator().w(function (_context26) {
21485
- while (1) switch (_context26.n) {
21536
+ return _regenerator().w(function (_context27) {
21537
+ while (1) switch (_context27.n) {
21486
21538
  case 0:
21487
- _context26.n = 1;
21539
+ _context27.n = 1;
21488
21540
  return effects.call(getChannelFromMap, channelId);
21489
21541
  case 1:
21490
- channel = _context26.v;
21542
+ channel = _context27.v;
21491
21543
  if (channel) {
21492
- _context26.n = 2;
21544
+ _context27.n = 2;
21493
21545
  break;
21494
21546
  }
21495
- return _context26.a(2);
21547
+ return _context27.a(2);
21496
21548
  case 2:
21497
21549
  pollDetails = JSON.parse(JSON.stringify(message.pollDetails));
21498
21550
  pollDetails.closed = true;
@@ -21506,34 +21558,34 @@ function updateMessageOptimisticallyForClosePoll(channelId, message) {
21506
21558
  updateMessageOnAllMessages(message.id, {
21507
21559
  pollDetails: pollDetails
21508
21560
  });
21509
- _context26.n = 3;
21561
+ _context27.n = 3;
21510
21562
  return effects.put(updateMessageAC(message.id, {
21511
21563
  pollDetails: pollDetails
21512
21564
  }));
21513
21565
  case 3:
21514
- return _context26.a(2);
21566
+ return _context27.a(2);
21515
21567
  }
21516
21568
  }, _marked24$1);
21517
21569
  }
21518
21570
  function closePoll(action) {
21519
- var payload, channelId, pollId, message, sceytChatClient, connectionState, _t34;
21520
- return _regenerator().w(function (_context27) {
21521
- while (1) switch (_context27.p = _context27.n) {
21571
+ var payload, channelId, pollId, message, sceytChatClient, connectionState, _t35;
21572
+ return _regenerator().w(function (_context28) {
21573
+ while (1) switch (_context28.p = _context28.n) {
21522
21574
  case 0:
21523
- _context27.p = 0;
21575
+ _context28.p = 0;
21524
21576
  payload = action.payload;
21525
21577
  channelId = payload.channelId, pollId = payload.pollId, message = payload.message;
21526
21578
  sceytChatClient = getClient();
21527
21579
  if (!sceytChatClient) {
21528
- _context27.n = 3;
21580
+ _context28.n = 3;
21529
21581
  break;
21530
21582
  }
21531
21583
  connectionState = sceytChatClient.connectionState;
21532
21584
  if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
21533
- _context27.n = 2;
21585
+ _context28.n = 2;
21534
21586
  break;
21535
21587
  }
21536
- return _context27.d(_regeneratorValues(updateMessageOptimisticallyForClosePoll(channelId, message)), 1);
21588
+ return _context28.d(_regeneratorValues(updateMessageOptimisticallyForClosePoll(channelId, message)), 1);
21537
21589
  case 1:
21538
21590
  setPendingPollAction({
21539
21591
  type: 'CLOSE_POLL',
@@ -21541,38 +21593,38 @@ function closePoll(action) {
21541
21593
  pollId: pollId,
21542
21594
  message: message
21543
21595
  });
21544
- return _context27.a(2);
21596
+ return _context28.a(2);
21545
21597
  case 2:
21546
- return _context27.d(_regeneratorValues(executeClosePoll(channelId, pollId, message)), 3);
21598
+ return _context28.d(_regeneratorValues(executeClosePoll(channelId, pollId, message)), 3);
21547
21599
  case 3:
21548
- _context27.n = 5;
21600
+ _context28.n = 5;
21549
21601
  break;
21550
21602
  case 4:
21551
- _context27.p = 4;
21552
- _t34 = _context27.v;
21553
- log.error('error in close poll', _t34);
21603
+ _context28.p = 4;
21604
+ _t35 = _context28.v;
21605
+ log.error('error in close poll', _t35);
21554
21606
  case 5:
21555
- return _context27.a(2);
21607
+ return _context28.a(2);
21556
21608
  }
21557
21609
  }, _marked25$1, null, [[0, 4]]);
21558
21610
  }
21559
21611
  function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
21560
21612
  var channel, _iterator3, _step3, obj;
21561
- return _regenerator().w(function (_context28) {
21562
- while (1) switch (_context28.n) {
21613
+ return _regenerator().w(function (_context29) {
21614
+ while (1) switch (_context29.n) {
21563
21615
  case 0:
21564
- _context28.n = 1;
21616
+ _context29.n = 1;
21565
21617
  return effects.call(getChannelFromMap, channelId);
21566
21618
  case 1:
21567
- channel = _context28.v;
21619
+ channel = _context29.v;
21568
21620
  if (isResend) {
21569
- _context28.n = 4;
21621
+ _context29.n = 4;
21570
21622
  break;
21571
21623
  }
21572
21624
  _iterator3 = _createForOfIteratorHelperLoose(objs);
21573
21625
  case 2:
21574
21626
  if ((_step3 = _iterator3()).done) {
21575
- _context28.n = 4;
21627
+ _context29.n = 4;
21576
21628
  break;
21577
21629
  }
21578
21630
  obj = _step3.value;
@@ -21581,45 +21633,45 @@ function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
21581
21633
  params: {}
21582
21634
  }, obj);
21583
21635
  updateMessageOnAllMessages(message.id, {}, obj);
21584
- _context28.n = 3;
21636
+ _context29.n = 3;
21585
21637
  return effects.put(updateMessageAC(message.id, {}, undefined, obj));
21586
21638
  case 3:
21587
- _context28.n = 2;
21639
+ _context29.n = 2;
21588
21640
  break;
21589
21641
  case 4:
21590
21642
  if (!channel) {
21591
- _context28.n = 6;
21643
+ _context29.n = 6;
21592
21644
  break;
21593
21645
  }
21594
- _context28.n = 5;
21646
+ _context29.n = 5;
21595
21647
  return effects.call(channel.retractVote, message.id, pollId);
21596
21648
  case 5:
21597
- _context28.n = 6;
21649
+ _context29.n = 6;
21598
21650
  return effects.put(removePendingPollActionAC(message.id || '', 'RETRACT_POLL_VOTE'));
21599
21651
  case 6:
21600
- return _context28.a(2);
21652
+ return _context29.a(2);
21601
21653
  }
21602
21654
  }, _marked26$1);
21603
21655
  }
21604
21656
  function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs) {
21605
21657
  var channel, _iterator4, _step4, obj;
21606
- return _regenerator().w(function (_context29) {
21607
- while (1) switch (_context29.n) {
21658
+ return _regenerator().w(function (_context30) {
21659
+ while (1) switch (_context30.n) {
21608
21660
  case 0:
21609
- _context29.n = 1;
21661
+ _context30.n = 1;
21610
21662
  return effects.call(getChannelFromMap, channelId);
21611
21663
  case 1:
21612
- channel = _context29.v;
21664
+ channel = _context30.v;
21613
21665
  if (channel) {
21614
- _context29.n = 2;
21666
+ _context30.n = 2;
21615
21667
  break;
21616
21668
  }
21617
- return _context29.a(2);
21669
+ return _context30.a(2);
21618
21670
  case 2:
21619
21671
  _iterator4 = _createForOfIteratorHelperLoose(objs);
21620
21672
  case 3:
21621
21673
  if ((_step4 = _iterator4()).done) {
21622
- _context29.n = 5;
21674
+ _context30.n = 5;
21623
21675
  break;
21624
21676
  }
21625
21677
  obj = _step4.value;
@@ -21628,27 +21680,27 @@ function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)
21628
21680
  params: {}
21629
21681
  });
21630
21682
  updateMessageOnAllMessages(message.id, {}, obj);
21631
- _context29.n = 4;
21683
+ _context30.n = 4;
21632
21684
  return effects.put(updateMessageAC(message.id, {}, undefined, obj));
21633
21685
  case 4:
21634
- _context29.n = 3;
21686
+ _context30.n = 3;
21635
21687
  break;
21636
21688
  case 5:
21637
- return _context29.a(2);
21689
+ return _context30.a(2);
21638
21690
  }
21639
21691
  }, _marked27$1);
21640
21692
  }
21641
21693
  function retractPollVote(action) {
21642
- var payload, channelId, pollId, message, isResend, sceytChatClient, connectionState, objs, _iterator5, _step5, _message$pollDetails12, _message$pollDetails13, vote, _t35;
21643
- return _regenerator().w(function (_context30) {
21644
- while (1) switch (_context30.p = _context30.n) {
21694
+ var payload, channelId, pollId, message, isResend, sceytChatClient, connectionState, objs, _iterator5, _step5, _message$pollDetails12, _message$pollDetails13, vote, _t36;
21695
+ return _regenerator().w(function (_context31) {
21696
+ while (1) switch (_context31.p = _context31.n) {
21645
21697
  case 0:
21646
- _context30.p = 0;
21698
+ _context31.p = 0;
21647
21699
  payload = action.payload;
21648
21700
  channelId = payload.channelId, pollId = payload.pollId, message = payload.message, isResend = payload.isResend;
21649
21701
  sceytChatClient = getClient();
21650
21702
  if (!sceytChatClient) {
21651
- _context30.n = 3;
21703
+ _context31.n = 3;
21652
21704
  break;
21653
21705
  }
21654
21706
  connectionState = sceytChatClient.connectionState;
@@ -21662,10 +21714,10 @@ function retractPollVote(action) {
21662
21714
  });
21663
21715
  }
21664
21716
  if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
21665
- _context30.n = 2;
21717
+ _context31.n = 2;
21666
21718
  break;
21667
21719
  }
21668
- return _context30.d(_regeneratorValues(updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)), 1);
21720
+ return _context31.d(_regeneratorValues(updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)), 1);
21669
21721
  case 1:
21670
21722
  setPendingPollAction({
21671
21723
  type: 'RETRACT_POLL_VOTE',
@@ -21673,39 +21725,39 @@ function retractPollVote(action) {
21673
21725
  pollId: pollId,
21674
21726
  message: message
21675
21727
  });
21676
- return _context30.a(2);
21728
+ return _context31.a(2);
21677
21729
  case 2:
21678
- return _context30.d(_regeneratorValues(executeRetractPollVote(channelId, pollId, message, objs, isResend)), 3);
21730
+ return _context31.d(_regeneratorValues(executeRetractPollVote(channelId, pollId, message, objs, isResend)), 3);
21679
21731
  case 3:
21680
- _context30.n = 5;
21732
+ _context31.n = 5;
21681
21733
  break;
21682
21734
  case 4:
21683
- _context30.p = 4;
21684
- _t35 = _context30.v;
21685
- log.error('error in retract poll vote', _t35);
21735
+ _context31.p = 4;
21736
+ _t36 = _context31.v;
21737
+ log.error('error in retract poll vote', _t36);
21686
21738
  case 5:
21687
- return _context30.a(2);
21739
+ return _context31.a(2);
21688
21740
  }
21689
21741
  }, _marked28$1, null, [[0, 4]]);
21690
21742
  }
21691
21743
  function resendPendingPollActions(action) {
21692
- var payload, connectionState, sceytChatClient, pendingPollActionsMap, pendingPollActionsMapCopy, _t36;
21693
- return _regenerator().w(function (_context31) {
21694
- while (1) switch (_context31.p = _context31.n) {
21744
+ var payload, connectionState, sceytChatClient, pendingPollActionsMap, pendingPollActionsMapCopy, _t37;
21745
+ return _regenerator().w(function (_context32) {
21746
+ while (1) switch (_context32.p = _context32.n) {
21695
21747
  case 0:
21696
- _context31.p = 0;
21748
+ _context32.p = 0;
21697
21749
  payload = action.payload;
21698
21750
  connectionState = payload.connectionState;
21699
21751
  sceytChatClient = getClient();
21700
21752
  if (!(!sceytChatClient || connectionState !== CONNECTION_STATUS.CONNECTED)) {
21701
- _context31.n = 1;
21753
+ _context32.n = 1;
21702
21754
  break;
21703
21755
  }
21704
- return _context31.a(2);
21756
+ return _context32.a(2);
21705
21757
  case 1:
21706
21758
  pendingPollActionsMap = store.getState().MessageReducer.pendingPollActions;
21707
21759
  pendingPollActionsMapCopy = JSON.parse(JSON.stringify(pendingPollActionsMap));
21708
- _context31.n = 2;
21760
+ _context32.n = 2;
21709
21761
  return effects.call(function () {
21710
21762
  return new Promise(function (resolve) {
21711
21763
  return setTimeout(resolve, 1000);
@@ -21741,32 +21793,32 @@ function resendPendingPollActions(action) {
21741
21793
  }
21742
21794
  });
21743
21795
  });
21744
- _context31.n = 4;
21796
+ _context32.n = 4;
21745
21797
  break;
21746
21798
  case 3:
21747
- _context31.p = 3;
21748
- _t36 = _context31.v;
21749
- log.error('error in resend pending poll actions', _t36);
21799
+ _context32.p = 3;
21800
+ _t37 = _context32.v;
21801
+ log.error('error in resend pending poll actions', _t37);
21750
21802
  case 4:
21751
- return _context31.a(2);
21803
+ return _context32.a(2);
21752
21804
  }
21753
21805
  }, _marked29$1, null, [[0, 3]]);
21754
21806
  }
21755
21807
  function getPollVotes(action) {
21756
- var payload, messageId, pollId, optionId, limit, key, SceytChatClient, queryBuilder, pollVotesQuery, result, formattedVotes, _t37;
21757
- return _regenerator().w(function (_context32) {
21758
- while (1) switch (_context32.p = _context32.n) {
21808
+ var payload, messageId, pollId, optionId, limit, key, SceytChatClient, queryBuilder, pollVotesQuery, result, formattedVotes, _t38;
21809
+ return _regenerator().w(function (_context33) {
21810
+ while (1) switch (_context33.p = _context33.n) {
21759
21811
  case 0:
21760
- _context32.p = 0;
21812
+ _context33.p = 0;
21761
21813
  payload = action.payload;
21762
21814
  messageId = payload.messageId, pollId = payload.pollId, optionId = payload.optionId, limit = payload.limit;
21763
21815
  key = pollId + "_" + optionId;
21764
- _context32.n = 1;
21816
+ _context33.n = 1;
21765
21817
  return effects.put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADING));
21766
21818
  case 1:
21767
21819
  SceytChatClient = getClient();
21768
21820
  if (!(!SceytChatClient || !SceytChatClient.PollVotesQueryBuilder)) {
21769
- _context32.n = 2;
21821
+ _context33.n = 2;
21770
21822
  break;
21771
21823
  }
21772
21824
  throw new Error('SceytChatClient or PollVotesQueryBuilder not available');
@@ -21774,14 +21826,14 @@ function getPollVotes(action) {
21774
21826
  queryBuilder = new SceytChatClient.PollVotesQueryBuilder(messageId, pollId);
21775
21827
  queryBuilder.setOptionId(optionId);
21776
21828
  queryBuilder.limit(limit || 20);
21777
- _context32.n = 3;
21829
+ _context33.n = 3;
21778
21830
  return effects.call(queryBuilder.build);
21779
21831
  case 3:
21780
- pollVotesQuery = _context32.v;
21781
- _context32.n = 4;
21832
+ pollVotesQuery = _context33.v;
21833
+ _context33.n = 4;
21782
21834
  return effects.call(pollVotesQuery.loadNext);
21783
21835
  case 4:
21784
- result = _context32.v;
21836
+ result = _context33.v;
21785
21837
  if (!query.PollVotesQueries) {
21786
21838
  query.PollVotesQueries = {};
21787
21839
  }
@@ -21809,39 +21861,39 @@ function getPollVotes(action) {
21809
21861
  }
21810
21862
  };
21811
21863
  });
21812
- _context32.n = 5;
21864
+ _context33.n = 5;
21813
21865
  return effects.put(setPollVotesListAC(pollId, optionId, formattedVotes, result.hasNext || false));
21814
21866
  case 5:
21815
- _context32.n = 6;
21867
+ _context33.n = 6;
21816
21868
  return effects.put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADED));
21817
21869
  case 6:
21818
- _context32.n = 8;
21870
+ _context33.n = 8;
21819
21871
  break;
21820
21872
  case 7:
21821
- _context32.p = 7;
21822
- _t37 = _context32.v;
21823
- log.error('ERROR in get poll votes', _t37);
21824
- _context32.n = 8;
21873
+ _context33.p = 7;
21874
+ _t38 = _context33.v;
21875
+ log.error('ERROR in get poll votes', _t38);
21876
+ _context33.n = 8;
21825
21877
  return effects.put(setPollVotesLoadingStateAC(action.payload.pollId, action.payload.optionId, LOADING_STATE.LOADED));
21826
21878
  case 8:
21827
- return _context32.a(2);
21879
+ return _context33.a(2);
21828
21880
  }
21829
21881
  }, _marked30$1, null, [[0, 7]]);
21830
21882
  }
21831
21883
  function loadMorePollVotes(action) {
21832
- var payload, pollId, optionId, limit, key, pollVotesQuery, result, formattedVotes, _t38;
21833
- return _regenerator().w(function (_context33) {
21834
- while (1) switch (_context33.p = _context33.n) {
21884
+ var payload, pollId, optionId, limit, key, pollVotesQuery, result, formattedVotes, _t39;
21885
+ return _regenerator().w(function (_context34) {
21886
+ while (1) switch (_context34.p = _context34.n) {
21835
21887
  case 0:
21836
- _context33.p = 0;
21888
+ _context34.p = 0;
21837
21889
  payload = action.payload;
21838
21890
  pollId = payload.pollId, optionId = payload.optionId, limit = payload.limit;
21839
21891
  key = pollId + "_" + optionId;
21840
- _context33.n = 1;
21892
+ _context34.n = 1;
21841
21893
  return effects.put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADING));
21842
21894
  case 1:
21843
21895
  if (!(!query.PollVotesQueries || !query.PollVotesQueries[key])) {
21844
- _context33.n = 2;
21896
+ _context34.n = 2;
21845
21897
  break;
21846
21898
  }
21847
21899
  throw new Error('Poll votes query not found');
@@ -21850,10 +21902,10 @@ function loadMorePollVotes(action) {
21850
21902
  if (limit && pollVotesQuery.limit < limit) {
21851
21903
  pollVotesQuery.limit = limit;
21852
21904
  }
21853
- _context33.n = 3;
21905
+ _context34.n = 3;
21854
21906
  return effects.call(pollVotesQuery.loadNext);
21855
21907
  case 3:
21856
- result = _context33.v;
21908
+ result = _context34.v;
21857
21909
  formattedVotes = (result.votes || []).map(function (vote) {
21858
21910
  return {
21859
21911
  optionId: vote.optionId || optionId,
@@ -21877,105 +21929,105 @@ function loadMorePollVotes(action) {
21877
21929
  }
21878
21930
  };
21879
21931
  });
21880
- _context33.n = 4;
21932
+ _context34.n = 4;
21881
21933
  return effects.put(addPollVotesToListAC(pollId, optionId, formattedVotes, result.hasNext || false));
21882
21934
  case 4:
21883
- _context33.n = 5;
21935
+ _context34.n = 5;
21884
21936
  return effects.put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADED));
21885
21937
  case 5:
21886
- _context33.n = 7;
21938
+ _context34.n = 7;
21887
21939
  break;
21888
21940
  case 6:
21889
- _context33.p = 6;
21890
- _t38 = _context33.v;
21891
- log.error('ERROR in load more poll votes', _t38);
21892
- _context33.n = 7;
21941
+ _context34.p = 6;
21942
+ _t39 = _context34.v;
21943
+ log.error('ERROR in load more poll votes', _t39);
21944
+ _context34.n = 7;
21893
21945
  return effects.put(setPollVotesLoadingStateAC(action.payload.pollId, action.payload.optionId, LOADING_STATE.LOADED));
21894
21946
  case 7:
21895
- return _context33.a(2);
21947
+ return _context34.a(2);
21896
21948
  }
21897
21949
  }, _marked31$1, null, [[0, 6]]);
21898
21950
  }
21899
21951
  function MessageSaga() {
21900
- return _regenerator().w(function (_context34) {
21901
- while (1) switch (_context34.n) {
21952
+ return _regenerator().w(function (_context35) {
21953
+ while (1) switch (_context35.n) {
21902
21954
  case 0:
21903
- _context34.n = 1;
21955
+ _context35.n = 1;
21904
21956
  return effects.takeEvery(SEND_MESSAGE, sendMessage);
21905
21957
  case 1:
21906
- _context34.n = 2;
21958
+ _context35.n = 2;
21907
21959
  return effects.takeEvery(SEND_TEXT_MESSAGE, sendTextMessage);
21908
21960
  case 2:
21909
- _context34.n = 3;
21961
+ _context35.n = 3;
21910
21962
  return effects.takeEvery(FORWARD_MESSAGE, forwardMessage);
21911
21963
  case 3:
21912
- _context34.n = 4;
21964
+ _context35.n = 4;
21913
21965
  return effects.takeEvery(RESEND_MESSAGE, resendMessage);
21914
21966
  case 4:
21915
- _context34.n = 5;
21967
+ _context35.n = 5;
21916
21968
  return effects.takeLatest(EDIT_MESSAGE, editMessage);
21917
21969
  case 5:
21918
- _context34.n = 6;
21970
+ _context35.n = 6;
21919
21971
  return effects.takeEvery(DELETE_MESSAGE, deleteMessage);
21920
21972
  case 6:
21921
- _context34.n = 7;
21973
+ _context35.n = 7;
21922
21974
  return effects.takeLatest(GET_MESSAGES, getMessagesQuery);
21923
21975
  case 7:
21924
- _context34.n = 8;
21976
+ _context35.n = 8;
21925
21977
  return effects.takeEvery(GET_MESSAGE, getMessageQuery);
21926
21978
  case 8:
21927
- _context34.n = 9;
21979
+ _context35.n = 9;
21928
21980
  return effects.takeLatest(GET_MESSAGE_MARKERS, getMessageMarkers);
21929
21981
  case 9:
21930
- _context34.n = 10;
21982
+ _context35.n = 10;
21931
21983
  return effects.takeLatest(GET_MESSAGES_ATTACHMENTS, getMessageAttachments);
21932
21984
  case 10:
21933
- _context34.n = 11;
21985
+ _context35.n = 11;
21934
21986
  return effects.takeLatest(LOAD_MORE_MESSAGES_ATTACHMENTS, loadMoreMessageAttachments);
21935
21987
  case 11:
21936
- _context34.n = 12;
21988
+ _context35.n = 12;
21937
21989
  return effects.takeLatest(ADD_REACTION, addReaction);
21938
21990
  case 12:
21939
- _context34.n = 13;
21991
+ _context35.n = 13;
21940
21992
  return effects.takeLatest(DELETE_REACTION, deleteReaction);
21941
21993
  case 13:
21942
- _context34.n = 14;
21994
+ _context35.n = 14;
21943
21995
  return effects.takeEvery(LOAD_MORE_MESSAGES, loadMoreMessages);
21944
21996
  case 14:
21945
- _context34.n = 15;
21997
+ _context35.n = 15;
21946
21998
  return effects.takeEvery(GET_REACTIONS, getReactions);
21947
21999
  case 15:
21948
- _context34.n = 16;
22000
+ _context35.n = 16;
21949
22001
  return effects.takeEvery(LOAD_MORE_REACTIONS, loadMoreReactions);
21950
22002
  case 16:
21951
- _context34.n = 17;
22003
+ _context35.n = 17;
21952
22004
  return effects.takeEvery(PAUSE_ATTACHMENT_UPLOADING, pauseAttachmentUploading);
21953
22005
  case 17:
21954
- _context34.n = 18;
22006
+ _context35.n = 18;
21955
22007
  return effects.takeEvery(RESUME_ATTACHMENT_UPLOADING, resumeAttachmentUploading);
21956
22008
  case 18:
21957
- _context34.n = 19;
22009
+ _context35.n = 19;
21958
22010
  return effects.takeEvery(ADD_POLL_VOTE, addPollVote);
21959
22011
  case 19:
21960
- _context34.n = 20;
22012
+ _context35.n = 20;
21961
22013
  return effects.takeEvery(DELETE_POLL_VOTE, deletePollVote);
21962
22014
  case 20:
21963
- _context34.n = 21;
22015
+ _context35.n = 21;
21964
22016
  return effects.takeEvery(CLOSE_POLL, closePoll);
21965
22017
  case 21:
21966
- _context34.n = 22;
22018
+ _context35.n = 22;
21967
22019
  return effects.takeEvery(RETRACT_POLL_VOTE, retractPollVote);
21968
22020
  case 22:
21969
- _context34.n = 23;
22021
+ _context35.n = 23;
21970
22022
  return effects.takeEvery(GET_POLL_VOTES, getPollVotes);
21971
22023
  case 23:
21972
- _context34.n = 24;
22024
+ _context35.n = 24;
21973
22025
  return effects.takeEvery(LOAD_MORE_POLL_VOTES, loadMorePollVotes);
21974
22026
  case 24:
21975
- _context34.n = 25;
22027
+ _context35.n = 25;
21976
22028
  return effects.takeEvery(RESEND_PENDING_POLL_ACTIONS, resendPendingPollActions);
21977
22029
  case 25:
21978
- return _context34.a(2);
22030
+ return _context35.a(2);
21979
22031
  }
21980
22032
  }, _marked32$1);
21981
22033
  }