sceyt-chat-react-uikit 1.7.5-beta.12 → 1.7.5-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.modern.js CHANGED
@@ -13651,6 +13651,12 @@ var CopiedTooltip = styled.span(_templateObject41 || (_templateObject41 = _tagge
13651
13651
  return p.color;
13652
13652
  });
13653
13653
 
13654
+ var SceytReduxContext = /*#__PURE__*/React__default.createContext(null);
13655
+
13656
+ var useSelector = createSelectorHook(SceytReduxContext);
13657
+ var useDispatch = createDispatchHook(SceytReduxContext);
13658
+ var useStore = createStoreHook(SceytReduxContext);
13659
+
13654
13660
  var _templateObject$1, _templateObject2$1, _templateObject3$1, _templateObject4$1, _templateObject5$1;
13655
13661
  var StatusText = styled.span(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n color: ", ";\n font-weight: 400;\n font-size: ", ";\n"])), function (props) {
13656
13662
  return props.color;
@@ -13726,7 +13732,7 @@ var MessageStatusIcon = function MessageStatusIcon(_ref) {
13726
13732
  });
13727
13733
  }
13728
13734
  };
13729
- var linkifyTextPart = function linkifyTextPart(textPart, match, target) {
13735
+ var linkifyTextPart = function linkifyTextPart(textPart, match, target, isInviteLink, onInviteLinkClick) {
13730
13736
  if (target === void 0) {
13731
13737
  target = '_blank';
13732
13738
  }
@@ -13737,18 +13743,29 @@ var linkifyTextPart = function linkifyTextPart(textPart, match, target) {
13737
13743
  var matchIndex = textPart.indexOf(matchItem.text, lastFoundIndex);
13738
13744
  lastFoundIndex = matchIndex + matchItem.text.length;
13739
13745
  if (index === 0) {
13740
- newMessageText = [textPart.substring(0, matchIndex), /*#__PURE__*/React__default.createElement("a", {
13746
+ newMessageText = [textPart.substring(0, matchIndex), /*#__PURE__*/React__default.createElement("a", Object.assign({
13741
13747
  draggable: false,
13742
13748
  key: index,
13743
- href: matchItem.url,
13749
+ href: isInviteLink ? undefined : matchItem.url,
13744
13750
  target: target,
13745
- rel: 'noreferrer'
13746
- }, "" + matchItem.text)];
13751
+ rel: 'noreferrer',
13752
+ style: {
13753
+ cursor: 'pointer'
13754
+ }
13755
+ }, isInviteLink ? {
13756
+ onClick: function onClick() {
13757
+ var splitedKey = matchItem.url.split('/');
13758
+ var key = splitedKey[splitedKey.length - 1];
13759
+ if (key) {
13760
+ onInviteLinkClick === null || onInviteLinkClick === void 0 ? void 0 : onInviteLinkClick(key);
13761
+ }
13762
+ }
13763
+ } : {}), "" + matchItem.text)];
13747
13764
  } else {
13748
13765
  newMessageText.push(textPart.substring(prevMatchEnd, matchIndex), /*#__PURE__*/React__default.createElement("a", {
13749
13766
  draggable: false,
13750
13767
  key: index,
13751
- href: matchItem.url,
13768
+ href: isInviteLink ? undefined : matchItem.url,
13752
13769
  target: target,
13753
13770
  rel: 'noreferrer'
13754
13771
  }, "" + matchItem.text));
@@ -13773,7 +13790,13 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
13773
13790
  shouldOpenUserProfileForMention = _ref2.shouldOpenUserProfileForMention,
13774
13791
  unsupportedMessage = _ref2.unsupportedMessage,
13775
13792
  _ref2$target = _ref2.target,
13776
- target = _ref2$target === void 0 ? '_blank' : _ref2$target;
13793
+ target = _ref2$target === void 0 ? '_blank' : _ref2$target,
13794
+ _ref2$isInviteLink = _ref2.isInviteLink,
13795
+ isInviteLink = _ref2$isInviteLink === void 0 ? false : _ref2$isInviteLink;
13796
+ var dispatch = useDispatch();
13797
+ var onInviteLinkClick = function onInviteLinkClick(key) {
13798
+ dispatch(getChannelByInviteKeyAC(key));
13799
+ };
13777
13800
  try {
13778
13801
  var messageText = [];
13779
13802
  var linkify = new LinkifyIt();
@@ -13791,12 +13814,12 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
13791
13814
  var firstPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(nextPartIndex || 0, attributeOffset) : '');
13792
13815
  var firstPartMatch = firstPart ? linkify.match(firstPart) : '';
13793
13816
  if (!isLastMessage && !asSampleText && firstPartMatch) {
13794
- firstPart = linkifyTextPart(firstPart, firstPartMatch, target);
13817
+ firstPart = linkifyTextPart(firstPart, firstPartMatch, target, isInviteLink, onInviteLinkClick);
13795
13818
  }
13796
13819
  var secondPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(attributeOffset + attribute.length) : '');
13797
13820
  var secondPartMatch = secondPart ? linkify.match(secondPart) : '';
13798
13821
  if (!isLastMessage && !asSampleText && secondPartMatch) {
13799
- secondPart = linkifyTextPart(secondPart, secondPartMatch, target);
13822
+ secondPart = linkifyTextPart(secondPart, secondPartMatch, target, isInviteLink, onInviteLinkClick);
13800
13823
  }
13801
13824
  if (attribute.type.includes('mention')) {
13802
13825
  var mentionDisplay = message.mentionedUsers && message.mentionedUsers.find(function (men) {
@@ -13865,7 +13888,7 @@ var MessageTextFormat = function MessageTextFormat(_ref2) {
13865
13888
  } else {
13866
13889
  var match = linkify.match(text);
13867
13890
  if (!isLastMessage && !asSampleText && match) {
13868
- messageText = linkifyTextPart(text, match, target);
13891
+ messageText = linkifyTextPart(text, match, target, isInviteLink, onInviteLinkClick);
13869
13892
  }
13870
13893
  }
13871
13894
  return messageText.length > 1 ? asSampleText ? messageText.join('') : messageText : text;
@@ -14333,10 +14356,11 @@ function watchForEvents() {
14333
14356
  };
14334
14357
  });
14335
14358
  _loop = /*#__PURE__*/_regenerator().m(function _callee() {
14336
- var _yield$take, type, args, createdChannel, channelFilterTypes, getFromContacts, channelExists, _chan, channel, _chan2, _channel, member, _channelExists, _activeChannelId, groupName, updateChannelData, _channel2, _channelExists2, _channel3, removedMembers, _activeChannelId2, _channelExists3, activeChannel, _updateChannelData, _groupName, _channel4, addedMembers, _activeChannelId3, _channelExists4, _updateChannelData2, _groupName2, updatedChannel, _channelExists5, subject, avatarUrl, muted, mutedTill, metadata, _activeChannelId4, _groupName3, _channel5, message, messageToHandle, _channelFilterTypes, _activeChannelId5, _channelExists6, channelForAdd, hasNextMessage, _groupName4, showNotifications, tabIsActive, _state$ThemeReducer$n, _state$ThemeReducer$n2, _state$ThemeReducer$n3, _state$ThemeReducer$n4, _state$ThemeReducer$n5, _state$ThemeReducer$n6, contactsMap, _getFromContacts, state, theme, accentColor, textSecondary, messageBody, channelId, markerList, _channel6, _activeChannelId6, updateLastMessage, markersMap, activeChannelMessages, lastMessage, _channelId, _channel7, _channel8, deletedMessage, _activeChannelId7, _channelExists7, _channel9, _message, _activeChannelId8, _channelExists8, _channel0, user, _message2, reaction, isSelf, _activeChannelId9, _state$ThemeReducer$n7, _state$ThemeReducer$n8, _state$ThemeReducer$n9, _state$ThemeReducer$n0, _state$ThemeReducer$n1, _state$ThemeReducer$n10, _contactsMap, _getFromContacts2, _state, _theme, _accentColor, _textSecondary, _messageBody, channelUpdateParams, _channel1, pollDetails, messageId, _activeChannelId0, addedVotes, obj, _store$getState$Messa, key, hasNext, _iterator, _step, vote, _channel10, _pollDetails, _messageId, _activeChannelId1, deletedVotes, _iterator2, _step2, _vote, _channel11, _pollDetails2, _messageId2, _activeChannelId10, retractedVotes, _iterator3, _step3, _vote2, _channel12, _messageId3, _activeChannelId11, _channel13, _user, _message3, _reaction, channelFromMap, _isSelf, _activeChannelId12, _channelUpdateParams, _channel14, _updatedChannel, _channel15, _activeChannelId13, channelExist, _channel16, _channel17, _channel18, _channel19, _channel20, _channel21, _channel22, _groupName5, _channel23, _groupName6, _channel24, members, _activeChannelId14, i, _channel25, _channel26, _channelId2, from, name, status, _t;
14359
+ var _yield$take, type, args, createdChannel, channelFilterTypes, getFromContacts, channelExists, _chan, channel, _chan2, _channel, member, _channelExists, _activeChannelId, groupName, updateChannelData, _channel2, _channelExists2, _channel3, removedMembers, _activeChannelId2, _channelExists3, activeChannel, _updateChannelData, _groupName, _channel4, addedMembers, _activeChannelId3, _channelExists4, _updateChannelData2, _groupName2, updatedChannel, _channelExists5, subject, avatarUrl, muted, mutedTill, metadata, _activeChannelId4, _groupName3, _channel5, message, messageToHandle, _channelFilterTypes, _activeChannelId5, _channelExists6, channelForAdd, hasNextMessage, _groupName4, showNotifications, tabIsActive, _state$ThemeReducer$n, _state$ThemeReducer$n2, _state$ThemeReducer$n3, _state$ThemeReducer$n4, _state$ThemeReducer$n5, _state$ThemeReducer$n6, contactsMap, _getFromContacts, state, theme, accentColor, textSecondary, messageBody, channelId, markerList, _channel6, _activeChannelId6, updateLastMessage, markersMap, activeChannelMessages, lastMessage, _channelId, _channel7, _channel8, deletedMessage, _activeChannelId7, _channelExists7, _channel9, _message, _activeChannelId8, _channelExists8, _channel0, user, _message2, reaction, isSelf, _activeChannelId9, _state$ThemeReducer$n7, _state$ThemeReducer$n8, _state$ThemeReducer$n9, _state$ThemeReducer$n0, _state$ThemeReducer$n1, _state$ThemeReducer$n10, _contactsMap, _getFromContacts2, _state, _theme, _accentColor, _textSecondary, _messageBody, channelUpdateParams, _channel1, pollDetails, messageId, _activeChannelId0, addedVotes, obj, _store$getState$Messa, key, hasNext, _iterator, _step, vote, _channel10, _pollDetails, _messageId, _activeChannelId1, deletedVotes, _iterator2, _step2, _vote, _channel11, _pollDetails2, _messageId2, _activeChannelId10, retractedVotes, _iterator3, _step3, _vote2, _channel12, _messageId3, _activeChannelId11, _channel13, _user, _message3, _reaction, channelFromMap, _isSelf, _activeChannelId12, _channelUpdateParams, _channel14, _updatedChannel, _channel15, _activeChannelId13, channelExist, _channel16, _channel17, _channel18, _channel19, _channel20, _channel21, _channel22, _groupName5, _channel23, _groupName6, _channel24, members, _activeChannelId14, i, _channel25, _channel26, _channelId2, from, name, status, _t, _t2;
14337
14360
  return _regenerator().w(function (_context) {
14338
- while (1) switch (_context.n) {
14361
+ while (1) switch (_context.p = _context.n) {
14339
14362
  case 0:
14363
+ _context.p = 0;
14340
14364
  _context.n = 1;
14341
14365
  return take(chan);
14342
14366
  case 1:
@@ -14344,7 +14368,7 @@ function watchForEvents() {
14344
14368
  type = _yield$take.type;
14345
14369
  args = _yield$take.args;
14346
14370
  _t = type;
14347
- _context.n = _t === CHANNEL_EVENT_TYPES.CREATE ? 2 : _t === CHANNEL_EVENT_TYPES.JOIN ? 7 : _t === CHANNEL_EVENT_TYPES.LEAVE ? 9 : _t === CHANNEL_EVENT_TYPES.BLOCK ? 19 : _t === CHANNEL_EVENT_TYPES.UNBLOCK ? 21 : _t === CHANNEL_EVENT_TYPES.KICK_MEMBERS ? 22 : _t === CHANNEL_EVENT_TYPES.ADD_MEMBERS ? 33 : _t === CHANNEL_EVENT_TYPES.UPDATE_CHANNEL ? 43 : _t === CHANNEL_EVENT_TYPES.MESSAGE ? 48 : _t === CHANNEL_EVENT_TYPES.MESSAGE_MARKERS_RECEIVED ? 65 : _t === CHANNEL_EVENT_TYPES.DELETE ? 72 : _t === CHANNEL_EVENT_TYPES.DELETE_MESSAGE ? 74 : _t === CHANNEL_EVENT_TYPES.EDIT_MESSAGE ? 78 : _t === CHANNEL_EVENT_TYPES.REACTION_ADDED ? 82 : _t === CHANNEL_EVENT_TYPES.POLL_ADDED ? 89 : _t === CHANNEL_EVENT_TYPES.POLL_DELETED ? 94 : _t === CHANNEL_EVENT_TYPES.POLL_RETRACTED ? 99 : _t === CHANNEL_EVENT_TYPES.POLL_CLOSED ? 104 : _t === CHANNEL_EVENT_TYPES.REACTION_DELETED ? 107 : _t === CHANNEL_EVENT_TYPES.UNREAD_MESSAGES_INFO ? 111 : _t === CHANNEL_EVENT_TYPES.CLEAR_HISTORY ? 114 : _t === CHANNEL_EVENT_TYPES.MUTE ? 120 : _t === CHANNEL_EVENT_TYPES.UNMUTE ? 122 : _t === CHANNEL_EVENT_TYPES.PINED ? 124 : _t === CHANNEL_EVENT_TYPES.UNPINED ? 126 : _t === CHANNEL_EVENT_TYPES.HIDE ? 128 : _t === CHANNEL_EVENT_TYPES.UNHIDE ? 130 : _t === CHANNEL_EVENT_TYPES.CHANNEL_MARKED_AS_UNREAD ? 132 : _t === CHANNEL_EVENT_TYPES.CHANNEL_MARKED_AS_READ ? 135 : _t === CHANNEL_EVENT_TYPES.CHANGE_ROLE ? 138 : _t === CHANNEL_EVENT_TYPES.FROZEN ? 145 : _t === CHANNEL_EVENT_TYPES.UNFROZEN ? 146 : _t === CHANNEL_EVENT_TYPES.CHANNEL_EVENT ? 147 : _t === CONNECTION_EVENT_TYPES.CONNECTION_STATUS_CHANGED ? 156 : 159;
14371
+ _context.n = _t === CHANNEL_EVENT_TYPES.CREATE ? 2 : _t === CHANNEL_EVENT_TYPES.JOIN ? 7 : _t === CHANNEL_EVENT_TYPES.LEAVE ? 9 : _t === CHANNEL_EVENT_TYPES.BLOCK ? 22 : _t === CHANNEL_EVENT_TYPES.UNBLOCK ? 24 : _t === CHANNEL_EVENT_TYPES.KICK_MEMBERS ? 25 : _t === CHANNEL_EVENT_TYPES.ADD_MEMBERS ? 36 : _t === CHANNEL_EVENT_TYPES.UPDATE_CHANNEL ? 46 : _t === CHANNEL_EVENT_TYPES.MESSAGE ? 51 : _t === CHANNEL_EVENT_TYPES.MESSAGE_MARKERS_RECEIVED ? 68 : _t === CHANNEL_EVENT_TYPES.DELETE ? 75 : _t === CHANNEL_EVENT_TYPES.DELETE_MESSAGE ? 77 : _t === CHANNEL_EVENT_TYPES.EDIT_MESSAGE ? 82 : _t === CHANNEL_EVENT_TYPES.REACTION_ADDED ? 87 : _t === CHANNEL_EVENT_TYPES.POLL_ADDED ? 95 : _t === CHANNEL_EVENT_TYPES.POLL_DELETED ? 101 : _t === CHANNEL_EVENT_TYPES.POLL_RETRACTED ? 107 : _t === CHANNEL_EVENT_TYPES.POLL_CLOSED ? 113 : _t === CHANNEL_EVENT_TYPES.REACTION_DELETED ? 117 : _t === CHANNEL_EVENT_TYPES.UNREAD_MESSAGES_INFO ? 122 : _t === CHANNEL_EVENT_TYPES.CLEAR_HISTORY ? 125 : _t === CHANNEL_EVENT_TYPES.MUTE ? 131 : _t === CHANNEL_EVENT_TYPES.UNMUTE ? 133 : _t === CHANNEL_EVENT_TYPES.PINED ? 135 : _t === CHANNEL_EVENT_TYPES.UNPINED ? 137 : _t === CHANNEL_EVENT_TYPES.HIDE ? 139 : _t === CHANNEL_EVENT_TYPES.UNHIDE ? 141 : _t === CHANNEL_EVENT_TYPES.CHANNEL_MARKED_AS_UNREAD ? 143 : _t === CHANNEL_EVENT_TYPES.CHANNEL_MARKED_AS_READ ? 146 : _t === CHANNEL_EVENT_TYPES.CHANGE_ROLE ? 149 : _t === CHANNEL_EVENT_TYPES.FROZEN ? 156 : _t === CHANNEL_EVENT_TYPES.UNFROZEN ? 157 : _t === CHANNEL_EVENT_TYPES.CHANNEL_EVENT ? 158 : _t === CONNECTION_EVENT_TYPES.CONNECTION_STATUS_CHANGED ? 167 : 170;
14348
14372
  break;
14349
14373
  case 2:
14350
14374
  createdChannel = args.createdChannel;
@@ -14378,7 +14402,7 @@ function watchForEvents() {
14378
14402
  addChannelToAllChannels(createdChannel);
14379
14403
  }
14380
14404
  case 6:
14381
- return _context.a(3, 160);
14405
+ return _context.a(3, 171);
14382
14406
  case 7:
14383
14407
  channel = args.channel;
14384
14408
  log.info('channel JOIN ... . ', channel);
@@ -14389,7 +14413,7 @@ function watchForEvents() {
14389
14413
  if (!_chan2) {
14390
14414
  addChannelToAllChannels(channel);
14391
14415
  }
14392
- return _context.a(3, 160);
14416
+ return _context.a(3, 171);
14393
14417
  case 9:
14394
14418
  _channel = args.channel, member = args.member;
14395
14419
  log.info('channel LEAVE ... ', _channel, member);
@@ -14399,235 +14423,244 @@ function watchForEvents() {
14399
14423
  case 10:
14400
14424
  _activeChannelId = _context.v;
14401
14425
  if (!(member.id === SceytChatClient.user.id)) {
14402
- _context.n = 12;
14426
+ _context.n = 15;
14403
14427
  break;
14404
14428
  }
14405
14429
  _context.n = 11;
14406
- return put(removeChannelAC(_channel.id));
14430
+ return put(switchChannelActionAC(null));
14407
14431
  case 11:
14432
+ _context.n = 12;
14433
+ return put(removeChannelAC(_channel.id));
14434
+ case 12:
14408
14435
  removeChannelFromMap(_channel.id);
14409
14436
  deleteChannelFromAllChannels(_channel.id);
14410
- _context.n = 18;
14437
+ _context.n = 13;
14438
+ return put(setChannelToRemoveAC(_channel));
14439
+ case 13:
14440
+ _context.n = 14;
14441
+ return put(removeChannelCachesAC(_channel.id));
14442
+ case 14:
14443
+ _context.n = 21;
14411
14444
  break;
14412
- case 12:
14445
+ case 15:
14413
14446
  groupName = getChannelGroupName(_channel);
14414
14447
  if (!_channelExists) {
14415
- _context.n = 16;
14448
+ _context.n = 19;
14416
14449
  break;
14417
14450
  }
14418
14451
  updateChannelData = {};
14419
14452
  if (!(_activeChannelId === _channel.id)) {
14420
- _context.n = 15;
14453
+ _context.n = 18;
14421
14454
  break;
14422
14455
  }
14423
- _context.n = 13;
14456
+ _context.n = 16;
14424
14457
  return put(removeMemberFromListAC([member]));
14425
- case 13:
14426
- _context.n = 14;
14458
+ case 16:
14459
+ _context.n = 17;
14427
14460
  return call(updateActiveChannelMembersRemove, [member]) || {};
14428
- case 14:
14461
+ case 17:
14429
14462
  updateChannelData = _context.v;
14430
- case 15:
14431
- _context.n = 16;
14463
+ case 18:
14464
+ _context.n = 19;
14432
14465
  return put(updateChannelDataAC(_channel.id, _extends({
14433
14466
  memberCount: _channel.memberCount,
14434
14467
  muted: _channel.muted,
14435
14468
  mutedTill: _channel.mutedTill
14436
14469
  }, updateChannelData)));
14437
- case 16:
14438
- _context.n = 17;
14470
+ case 19:
14471
+ _context.n = 20;
14439
14472
  return put(updateSearchedChannelDataAC(_channel.id, {
14440
14473
  memberCount: _channel.memberCount,
14441
14474
  muted: _channel.muted,
14442
14475
  mutedTill: _channel.mutedTill
14443
14476
  }, groupName));
14444
- case 17:
14477
+ case 20:
14445
14478
  updateChannelOnAllChannels(_channel.id, {
14446
14479
  memberCount: _channel.memberCount,
14447
14480
  muted: _channel.muted,
14448
14481
  mutedTill: _channel.mutedTill
14449
14482
  });
14450
- case 18:
14451
- return _context.a(3, 160);
14452
- case 19:
14483
+ case 21:
14484
+ return _context.a(3, 171);
14485
+ case 22:
14453
14486
  log.info('channel BLOCK ... ');
14454
14487
  _channel2 = args.channel;
14455
14488
  _channelExists2 = checkChannelExists(_channel2.id);
14456
14489
  if (!_channelExists2) {
14457
- _context.n = 20;
14490
+ _context.n = 23;
14458
14491
  break;
14459
14492
  }
14460
- _context.n = 20;
14493
+ _context.n = 23;
14461
14494
  return put(removeChannelAC(_channel2.id));
14462
- case 20:
14463
- return _context.a(3, 160);
14464
- case 21:
14495
+ case 23:
14496
+ return _context.a(3, 171);
14497
+ case 24:
14465
14498
  log.info('channel UNBLOCK ... ');
14466
- return _context.a(3, 160);
14467
- case 22:
14499
+ return _context.a(3, 171);
14500
+ case 25:
14468
14501
  _channel3 = args.channel, removedMembers = args.removedMembers;
14469
14502
  log.info('channel KICK_MEMBERS ... ', removedMembers);
14470
- _context.n = 23;
14503
+ _context.n = 26;
14471
14504
  return call(getActiveChannelId);
14472
- case 23:
14505
+ case 26:
14473
14506
  _activeChannelId2 = _context.v;
14474
14507
  _channelExists3 = checkChannelExists(_channel3.id);
14475
14508
  if (!_channelExists3) {
14476
- _context.n = 32;
14509
+ _context.n = 35;
14477
14510
  break;
14478
14511
  }
14479
14512
  if (!removedMembers.find(function (mem) {
14480
14513
  return mem.id === SceytChatClient.user.id;
14481
14514
  })) {
14482
- _context.n = 27;
14515
+ _context.n = 30;
14483
14516
  break;
14484
14517
  }
14485
14518
  removeChannelFromMap(_channel3.id);
14486
- _context.n = 24;
14519
+ _context.n = 27;
14487
14520
  return put(removeChannelAC(_channel3.id));
14488
- case 24:
14489
- _context.n = 25;
14521
+ case 27:
14522
+ _context.n = 28;
14490
14523
  return call(getLastChannelFromMap);
14491
- case 25:
14524
+ case 28:
14492
14525
  activeChannel = _context.v;
14493
14526
  if (!activeChannel) {
14494
- _context.n = 26;
14527
+ _context.n = 29;
14495
14528
  break;
14496
14529
  }
14497
- _context.n = 26;
14530
+ _context.n = 29;
14498
14531
  return put(switchChannelActionAC(JSON.parse(JSON.stringify(activeChannel))));
14499
- case 26:
14500
- _context.n = 32;
14532
+ case 29:
14533
+ _context.n = 35;
14501
14534
  break;
14502
- case 27:
14535
+ case 30:
14503
14536
  _updateChannelData = {};
14504
14537
  if (!(_activeChannelId2 === _channel3.id)) {
14505
- _context.n = 30;
14538
+ _context.n = 33;
14506
14539
  break;
14507
14540
  }
14508
- _context.n = 28;
14541
+ _context.n = 31;
14509
14542
  return put(removeMemberFromListAC(removedMembers));
14510
- case 28:
14511
- _context.n = 29;
14543
+ case 31:
14544
+ _context.n = 32;
14512
14545
  return call(updateActiveChannelMembersRemove, removedMembers) || {};
14513
- case 29:
14546
+ case 32:
14514
14547
  _updateChannelData = _context.v;
14515
- case 30:
14548
+ case 33:
14516
14549
  _groupName = getChannelGroupName(_channel3);
14517
- _context.n = 31;
14550
+ _context.n = 34;
14518
14551
  return put(updateSearchedChannelDataAC(_channel3.id, {
14519
14552
  memberCount: _channel3.memberCount,
14520
14553
  muted: _channel3.muted,
14521
14554
  mutedTill: _channel3.mutedTill
14522
14555
  }, _groupName));
14523
- case 31:
14524
- _context.n = 32;
14556
+ case 34:
14557
+ _context.n = 35;
14525
14558
  return put(updateChannelDataAC(_channel3.id, _extends({
14526
14559
  memberCount: _channel3.memberCount,
14527
14560
  muted: _channel3.muted,
14528
14561
  mutedTill: _channel3.mutedTill
14529
14562
  }, _updateChannelData)));
14530
- case 32:
14563
+ case 35:
14531
14564
  updateChannelOnAllChannels(_channel3.id, {
14532
14565
  memberCount: _channel3.memberCount,
14533
14566
  muted: _channel3.muted,
14534
14567
  mutedTill: _channel3.mutedTill
14535
14568
  });
14536
- return _context.a(3, 160);
14537
- case 33:
14569
+ return _context.a(3, 171);
14570
+ case 36:
14538
14571
  _channel4 = args.channel, addedMembers = args.addedMembers;
14539
14572
  log.info('channel ADD_MEMBERS ... ', addedMembers);
14540
- _context.n = 34;
14573
+ _context.n = 37;
14541
14574
  return call(getActiveChannelId);
14542
- case 34:
14575
+ case 37:
14543
14576
  _activeChannelId3 = _context.v;
14544
14577
  _channelExists4 = checkChannelExists(_channel4.id);
14545
14578
  if (!_channelExists4) {
14546
- _context.n = 39;
14579
+ _context.n = 42;
14547
14580
  break;
14548
14581
  }
14549
14582
  _updateChannelData2 = {};
14550
14583
  if (!(_activeChannelId3 === _channel4.id)) {
14551
- _context.n = 37;
14584
+ _context.n = 40;
14552
14585
  break;
14553
14586
  }
14554
- _context.n = 35;
14587
+ _context.n = 38;
14555
14588
  return put(addMembersToListAC(addedMembers));
14556
- case 35:
14557
- _context.n = 36;
14589
+ case 38:
14590
+ _context.n = 39;
14558
14591
  return call(updateActiveChannelMembersAdd, addedMembers) || {};
14559
- case 36:
14592
+ case 39:
14560
14593
  _updateChannelData2 = _context.v;
14561
- case 37:
14562
- _context.n = 38;
14594
+ case 40:
14595
+ _context.n = 41;
14563
14596
  return put(updateChannelDataAC(_channel4.id, _extends({
14564
14597
  memberCount: _channel4.memberCount,
14565
14598
  muted: _channel4.muted,
14566
14599
  mutedTill: _channel4.mutedTill
14567
14600
  }, _updateChannelData2)));
14568
- case 38:
14569
- _context.n = 41;
14601
+ case 41:
14602
+ _context.n = 44;
14570
14603
  break;
14571
- case 39:
14572
- _context.n = 40;
14604
+ case 42:
14605
+ _context.n = 43;
14573
14606
  return call(setChannelInMap, _channel4);
14574
- case 40:
14575
- _context.n = 41;
14607
+ case 43:
14608
+ _context.n = 44;
14576
14609
  return put(setAddedToChannelAC(JSON.parse(JSON.stringify(_channel4))));
14577
- case 41:
14610
+ case 44:
14578
14611
  _groupName2 = getChannelGroupName(_channel4);
14579
- _context.n = 42;
14612
+ _context.n = 45;
14580
14613
  return put(updateSearchedChannelDataAC(_channel4.id, {
14581
14614
  memberCount: _channel4.memberCount,
14582
14615
  muted: _channel4.muted,
14583
14616
  mutedTill: _channel4.mutedTill
14584
14617
  }, _groupName2));
14585
- case 42:
14618
+ case 45:
14586
14619
  updateChannelOnAllChannels(_channel4.id, {
14587
14620
  memberCount: _channel4.memberCount,
14588
14621
  muted: _channel4.muted,
14589
14622
  mutedTill: _channel4.mutedTill
14590
14623
  });
14591
- return _context.a(3, 160);
14592
- case 43:
14624
+ return _context.a(3, 171);
14625
+ case 46:
14593
14626
  log.info('channel UPDATE_CHANNEL ... ');
14594
14627
  updatedChannel = args.updatedChannel;
14595
14628
  _channelExists5 = checkChannelExists(updatedChannel.id);
14596
14629
  subject = updatedChannel.subject, avatarUrl = updatedChannel.avatarUrl, muted = updatedChannel.muted, mutedTill = updatedChannel.mutedTill, metadata = updatedChannel.metadata;
14597
14630
  if (!_channelExists5) {
14598
- _context.n = 46;
14631
+ _context.n = 49;
14599
14632
  break;
14600
14633
  }
14601
- _context.n = 44;
14634
+ _context.n = 47;
14602
14635
  return put(updateChannelDataAC(updatedChannel.id, {
14603
14636
  subject: subject,
14604
14637
  avatarUrl: avatarUrl,
14605
14638
  muted: muted,
14606
14639
  mutedTill: mutedTill
14607
14640
  }));
14608
- case 44:
14609
- _context.n = 45;
14641
+ case 47:
14642
+ _context.n = 48;
14610
14643
  return call(getActiveChannelId);
14611
- case 45:
14644
+ case 48:
14612
14645
  _activeChannelId4 = _context.v;
14613
14646
  if (!(_activeChannelId4 === updatedChannel.id)) {
14614
- _context.n = 46;
14647
+ _context.n = 49;
14615
14648
  break;
14616
14649
  }
14617
- _context.n = 46;
14650
+ _context.n = 49;
14618
14651
  return put(setActiveChannelAC(_extends({}, updatedChannel, {
14619
14652
  metadata: isJSON(metadata) ? JSON.parse(metadata) : metadata
14620
14653
  })));
14621
- case 46:
14654
+ case 49:
14622
14655
  _groupName3 = getChannelGroupName(updatedChannel);
14623
- _context.n = 47;
14656
+ _context.n = 50;
14624
14657
  return put(updateSearchedChannelDataAC(updatedChannel.id, {
14625
14658
  subject: subject,
14626
14659
  avatarUrl: avatarUrl,
14627
14660
  muted: muted,
14628
14661
  mutedTill: mutedTill
14629
14662
  }, _groupName3));
14630
- case 47:
14663
+ case 50:
14631
14664
  updateChannelOnAllChannels(updatedChannel.id, {
14632
14665
  subject: subject,
14633
14666
  avatarUrl: avatarUrl,
@@ -14635,67 +14668,67 @@ function watchForEvents() {
14635
14668
  mutedTill: mutedTill,
14636
14669
  metadata: isJSON(metadata) ? JSON.parse(metadata) : metadata
14637
14670
  });
14638
- return _context.a(3, 160);
14639
- case 48:
14671
+ return _context.a(3, 171);
14672
+ case 51:
14640
14673
  _channel5 = args.channel, message = args.message;
14641
14674
  log.info('channel MESSAGE ... id : ', message.id, ', channel.id: ', _channel5.id);
14642
14675
  messageToHandle = handleNewMessages ? handleNewMessages(message, _channel5) : message;
14643
14676
  _channelFilterTypes = getChannelTypesFilter();
14644
14677
  if (!(messageToHandle && _channel5 && (_channelFilterTypes !== null && _channelFilterTypes !== void 0 && _channelFilterTypes.length ? _channelFilterTypes.includes(_channel5.type) : true))) {
14645
- _context.n = 64;
14678
+ _context.n = 67;
14646
14679
  break;
14647
14680
  }
14648
14681
  _channel5.metadata = isJSON(_channel5.metadata) ? JSON.parse(_channel5.metadata) : _channel5.metadata;
14649
- _context.n = 49;
14682
+ _context.n = 52;
14650
14683
  return call(getActiveChannelId);
14651
- case 49:
14684
+ case 52:
14652
14685
  _activeChannelId5 = _context.v;
14653
14686
  _channelExists6 = checkChannelExists(_channel5.id);
14654
14687
  channelForAdd = JSON.parse(JSON.stringify(_channel5));
14655
- _context.n = 50;
14688
+ _context.n = 53;
14656
14689
  return put(addChannelAC(channelForAdd));
14657
- case 50:
14690
+ case 53:
14658
14691
  if (_channelExists6) {
14659
- _context.n = 52;
14692
+ _context.n = 55;
14660
14693
  break;
14661
14694
  }
14662
- _context.n = 51;
14695
+ _context.n = 54;
14663
14696
  return call(setChannelInMap, _channel5);
14664
- case 51:
14665
- _context.n = 53;
14697
+ case 54:
14698
+ _context.n = 56;
14666
14699
  break;
14667
- case 52:
14700
+ case 55:
14668
14701
  if (message.repliedInThread) {
14669
- _context.n = 53;
14702
+ _context.n = 56;
14670
14703
  break;
14671
14704
  }
14672
- _context.n = 53;
14705
+ _context.n = 56;
14673
14706
  return put(updateChannelLastMessageAC(message, channelForAdd));
14674
- case 53:
14707
+ case 56:
14675
14708
  if (!(_channel5.id === _activeChannelId5)) {
14676
- _context.n = 55;
14709
+ _context.n = 58;
14677
14710
  break;
14678
14711
  }
14679
14712
  if (getHasNextCached()) {
14680
- _context.n = 54;
14713
+ _context.n = 57;
14681
14714
  break;
14682
14715
  }
14683
- _context.n = 54;
14716
+ _context.n = 57;
14684
14717
  return put(addMessageAC(message));
14685
- case 54:
14718
+ case 57:
14686
14719
  addAllMessages([message], MESSAGE_LOAD_DIRECTION.NEXT);
14687
14720
  hasNextMessage = store.getState().MessageReducer.messagesHasNext;
14688
14721
  if (!(!getHasNextCached() && !hasNextMessage)) {
14689
- _context.n = 55;
14722
+ _context.n = 58;
14690
14723
  break;
14691
14724
  }
14692
- _context.n = 55;
14725
+ _context.n = 58;
14693
14726
  return put(scrollToNewMessageAC(true, false, true));
14694
- case 55:
14727
+ case 58:
14695
14728
  if (getMessagesFromMap(_channel5.id) && getMessagesFromMap(_channel5.id).length) {
14696
14729
  addMessageToMap(_channel5.id, message);
14697
14730
  }
14698
- _context.n = 56;
14731
+ _context.n = 59;
14699
14732
  return put(updateChannelDataAC(_channel5.id, {
14700
14733
  messageCount: channelForAdd.messageCount,
14701
14734
  unread: channelForAdd.unread,
@@ -14711,9 +14744,9 @@ function watchForEvents() {
14711
14744
  userMessageReactions: [],
14712
14745
  lastReactedMessage: null
14713
14746
  }));
14714
- case 56:
14747
+ case 59:
14715
14748
  _groupName4 = getChannelGroupName(_channel5);
14716
- _context.n = 57;
14749
+ _context.n = 60;
14717
14750
  return put(updateSearchedChannelDataAC(_channel5.id, {
14718
14751
  messageCount: channelForAdd.messageCount,
14719
14752
  unread: channelForAdd.unread,
@@ -14729,27 +14762,27 @@ function watchForEvents() {
14729
14762
  userMessageReactions: [],
14730
14763
  lastReactedMessage: null
14731
14764
  }, _groupName4));
14732
- case 57:
14765
+ case 60:
14733
14766
  showNotifications = getShowNotifications();
14734
14767
  if (!(showNotifications && !message.silent && message.user.id !== SceytChatClient.user.id && !_channel5.muted)) {
14735
- _context.n = 60;
14768
+ _context.n = 63;
14736
14769
  break;
14737
14770
  }
14738
14771
  if (!(Notification.permission === 'granted')) {
14739
- _context.n = 60;
14772
+ _context.n = 63;
14740
14773
  break;
14741
14774
  }
14742
- _context.n = 58;
14775
+ _context.n = 61;
14743
14776
  return select(browserTabIsActiveSelector);
14744
- case 58:
14777
+ case 61:
14745
14778
  tabIsActive = _context.v;
14746
14779
  if (!(document.visibilityState !== 'visible' || !tabIsActive || _channel5.id !== _activeChannelId5)) {
14747
- _context.n = 60;
14780
+ _context.n = 63;
14748
14781
  break;
14749
14782
  }
14750
- _context.n = 59;
14783
+ _context.n = 62;
14751
14784
  return select(contactsMapSelector);
14752
- case 59:
14785
+ case 62:
14753
14786
  contactsMap = _context.v;
14754
14787
  _getFromContacts = getShowOnlyContactUsers();
14755
14788
  state = store.getState();
@@ -14769,20 +14802,20 @@ function watchForEvents() {
14769
14802
  setNotification(messageBody, message.user, _channel5, undefined, message.attachments && message.attachments.length ? message.attachments.find(function (att) {
14770
14803
  return att.type !== attachmentTypes.link;
14771
14804
  }) : undefined);
14772
- case 60:
14805
+ case 63:
14773
14806
  if (!(message.repliedInThread && message.parentMessage.id)) {
14774
- _context.n = 62;
14807
+ _context.n = 65;
14775
14808
  break;
14776
14809
  }
14777
- _context.n = 61;
14810
+ _context.n = 64;
14778
14811
  return put(markMessagesAsDeliveredAC(message.parentMessage.id, [message.id]));
14779
- case 61:
14780
- _context.n = 63;
14812
+ case 64:
14813
+ _context.n = 66;
14781
14814
  break;
14782
- case 62:
14783
- _context.n = 63;
14815
+ case 65:
14816
+ _context.n = 66;
14784
14817
  return put(markMessagesAsDeliveredAC(_channel5.id, [message.id]));
14785
- case 63:
14818
+ case 66:
14786
14819
  updateChannelOnAllChannels(_channel5.id, {
14787
14820
  messageCount: channelForAdd.messageCount,
14788
14821
  unread: channelForAdd.unread,
@@ -14799,22 +14832,22 @@ function watchForEvents() {
14799
14832
  userMessageReactions: _channel5.userMessageReactions
14800
14833
  });
14801
14834
  updateChannelLastMessageOnAllChannels(_channel5.id, _channel5.lastMessage);
14802
- case 64:
14803
- return _context.a(3, 160);
14804
- case 65:
14835
+ case 67:
14836
+ return _context.a(3, 171);
14837
+ case 68:
14805
14838
  channelId = args.channelId, markerList = args.markerList;
14806
- _context.n = 66;
14839
+ _context.n = 69;
14807
14840
  return call(getChannelFromMap, channelId);
14808
- case 66:
14841
+ case 69:
14809
14842
  _channel6 = _context.v;
14810
14843
  log.info('channel MESSAGE_MARKERS_RECEIVED ... channel: ', _channel6, 'markers list: ', markerList);
14811
14844
  if (!_channel6) {
14812
- _context.n = 71;
14845
+ _context.n = 74;
14813
14846
  break;
14814
14847
  }
14815
- _context.n = 67;
14848
+ _context.n = 70;
14816
14849
  return call(getActiveChannelId);
14817
- case 67:
14850
+ case 70:
14818
14851
  _activeChannelId6 = _context.v;
14819
14852
  updateLastMessage = false;
14820
14853
  markersMap = {};
@@ -14844,92 +14877,98 @@ function watchForEvents() {
14844
14877
  });
14845
14878
  });
14846
14879
  if (!updateLastMessage) {
14847
- _context.n = 68;
14880
+ _context.n = 71;
14848
14881
  break;
14849
14882
  }
14850
14883
  lastMessage = _extends({}, _channel6.lastMessage, {
14851
14884
  deliveryStatus: markerList.name
14852
14885
  });
14853
14886
  updateChannelLastMessageOnAllChannels(_channel6.id, lastMessage);
14854
- _context.n = 68;
14887
+ _context.n = 71;
14855
14888
  return put(updateChannelLastMessageStatusAC(lastMessage, _channel6));
14856
- case 68:
14889
+ case 71:
14857
14890
  if (!(_activeChannelId6 === channelId)) {
14858
- _context.n = 70;
14891
+ _context.n = 73;
14859
14892
  break;
14860
14893
  }
14861
- _context.n = 69;
14894
+ _context.n = 72;
14862
14895
  return put(updateMessagesStatusAC(markerList.name, markersMap));
14863
- case 69:
14896
+ case 72:
14864
14897
  updateMarkersOnAllMessages(markersMap, markerList.name);
14865
- case 70:
14898
+ case 73:
14866
14899
  updateMessageStatusOnMap(_channel6.id, {
14867
14900
  name: markerList.name,
14868
14901
  markersMap: markersMap
14869
14902
  });
14870
- _context.n = 71;
14903
+ _context.n = 74;
14871
14904
  return put(updateMessagesMarkersAC(channelId, markerList.name, markerList));
14872
- case 71:
14873
- return _context.a(3, 160);
14874
- case 72:
14905
+ case 74:
14906
+ return _context.a(3, 171);
14907
+ case 75:
14875
14908
  _channelId = args.channelId;
14876
14909
  log.info('channel DELETE ... ');
14877
14910
  _channel7 = getChannelFromMap(_channelId);
14878
- _context.n = 73;
14911
+ _context.n = 76;
14879
14912
  return put(setChannelToRemoveAC(_channel7));
14880
- case 73:
14913
+ case 76:
14881
14914
  deleteChannelFromAllChannels(_channelId);
14882
- return _context.a(3, 160);
14883
- case 74:
14915
+ return _context.a(3, 171);
14916
+ case 77:
14884
14917
  _channel8 = args.channel, deletedMessage = args.deletedMessage;
14885
- _activeChannelId7 = getActiveChannelId();
14918
+ _context.n = 78;
14919
+ return call(getActiveChannelId);
14920
+ case 78:
14921
+ _activeChannelId7 = _context.v;
14886
14922
  log.info('channel DELETE_MESSAGE ... ');
14887
14923
  _channelExists7 = checkChannelExists(_channel8.id);
14888
14924
  if (!(_channel8.id === _activeChannelId7)) {
14889
- _context.n = 75;
14925
+ _context.n = 79;
14890
14926
  break;
14891
14927
  }
14892
14928
  updateMessageOnAllMessages(deletedMessage.id, deletedMessage);
14893
- _context.n = 75;
14929
+ _context.n = 79;
14894
14930
  return put(updateMessageAC(deletedMessage.id, deletedMessage));
14895
- case 75:
14931
+ case 79:
14896
14932
  updateMessageOnMap(_channel8.id, {
14897
14933
  messageId: deletedMessage.id,
14898
14934
  params: deletedMessage
14899
14935
  });
14900
14936
  if (!_channelExists7) {
14901
- _context.n = 77;
14937
+ _context.n = 81;
14902
14938
  break;
14903
14939
  }
14904
- _context.n = 76;
14940
+ _context.n = 80;
14905
14941
  return put(updateChannelDataAC(_channel8.id, {
14906
14942
  newMessageCount: _channel8.newMessageCount,
14907
14943
  muted: _channel8.muted,
14908
14944
  mutedTill: _channel8.mutedTill
14909
14945
  }));
14910
- case 76:
14946
+ case 80:
14911
14947
  if (!(_channel8.lastMessage.id === deletedMessage.id)) {
14912
- _context.n = 77;
14948
+ _context.n = 81;
14913
14949
  break;
14914
14950
  }
14915
- _context.n = 77;
14951
+ _context.n = 81;
14916
14952
  return put(updateChannelLastMessageAC(deletedMessage, _channel8));
14917
- case 77:
14953
+ case 81:
14918
14954
  updateChannelOnAllChannels(_channel8.id, {
14919
14955
  newMessageCount: _channel8.newMessageCount,
14920
14956
  muted: _channel8.muted,
14921
14957
  mutedTill: _channel8.mutedTill
14922
14958
  }, deletedMessage);
14923
- return _context.a(3, 160);
14924
- case 78:
14959
+ return _context.a(3, 171);
14960
+ case 82:
14925
14961
  _channel9 = args.channel, _message = args.message;
14926
- _activeChannelId8 = getActiveChannelId();
14962
+ _context.n = 83;
14963
+ return call(getActiveChannelId);
14964
+ case 83:
14965
+ _activeChannelId8 = _context.v;
14927
14966
  _channelExists8 = checkChannelExists(_channel9.id);
14928
14967
  if (!(_channel9.id === _activeChannelId8)) {
14929
- _context.n = 80;
14968
+ _context.n = 85;
14930
14969
  break;
14931
14970
  }
14932
- _context.n = 79;
14971
+ _context.n = 84;
14933
14972
  return put(updateMessageAC(_message.id, {
14934
14973
  body: _message.body,
14935
14974
  state: _message.state,
@@ -14938,7 +14977,7 @@ function watchForEvents() {
14938
14977
  mentionedUsers: _message.mentionedUsers,
14939
14978
  updatedAt: _message.updatedAt
14940
14979
  }));
14941
- case 79:
14980
+ case 84:
14942
14981
  updateMessageOnAllMessages(_message.id, {
14943
14982
  body: _message.body,
14944
14983
  state: _message.state,
@@ -14947,18 +14986,18 @@ function watchForEvents() {
14947
14986
  mentionedUsers: _message.mentionedUsers,
14948
14987
  updatedAt: _message.updatedAt
14949
14988
  });
14950
- case 80:
14989
+ case 85:
14951
14990
  if (!_channelExists8) {
14952
- _context.n = 81;
14991
+ _context.n = 86;
14953
14992
  break;
14954
14993
  }
14955
14994
  if (!(_channel9.lastMessage.id === _message.id)) {
14956
- _context.n = 81;
14995
+ _context.n = 86;
14957
14996
  break;
14958
14997
  }
14959
- _context.n = 81;
14998
+ _context.n = 86;
14960
14999
  return put(updateChannelLastMessageAC(_message, _channel9));
14961
- case 81:
15000
+ case 86:
14962
15001
  if (checkChannelExistsOnMessagesMap(_channel9.id)) {
14963
15002
  updateMessageOnMap(_channel9.id, {
14964
15003
  messageId: _message.id,
@@ -14966,35 +15005,38 @@ function watchForEvents() {
14966
15005
  });
14967
15006
  }
14968
15007
  updateChannelOnAllChannels(_channel9.id, {}, _message);
14969
- return _context.a(3, 160);
14970
- case 82:
15008
+ return _context.a(3, 171);
15009
+ case 87:
14971
15010
  _channel0 = args.channel, user = args.user, _message2 = args.message, reaction = args.reaction;
14972
15011
  isSelf = user.id === SceytChatClient.user.id;
14973
- _activeChannelId9 = getActiveChannelId();
15012
+ _context.n = 88;
15013
+ return call(getActiveChannelId);
15014
+ case 88:
15015
+ _activeChannelId9 = _context.v;
14974
15016
  if (!(_channel0.id === _activeChannelId9)) {
14975
- _context.n = 84;
15017
+ _context.n = 90;
14976
15018
  break;
14977
15019
  }
14978
- _context.n = 83;
15020
+ _context.n = 89;
14979
15021
  return put(addReactionToMessageAC(_message2, reaction, isSelf));
14980
- case 83:
15022
+ case 89:
14981
15023
  addReactionOnAllMessages(_message2, reaction, true);
14982
- case 84:
15024
+ case 90:
14983
15025
  if (!(_message2.user.id === SceytChatClient.user.id)) {
14984
- _context.n = 88;
15026
+ _context.n = 94;
14985
15027
  break;
14986
15028
  }
14987
15029
  if (!(!isSelf && Notification.permission === 'granted')) {
14988
- _context.n = 86;
15030
+ _context.n = 92;
14989
15031
  break;
14990
15032
  }
14991
15033
  if (!(document.visibilityState !== 'visible' || _channel0.id !== _activeChannelId9)) {
14992
- _context.n = 86;
15034
+ _context.n = 92;
14993
15035
  break;
14994
15036
  }
14995
- _context.n = 85;
15037
+ _context.n = 91;
14996
15038
  return select(contactsMapSelector);
14997
- case 85:
15039
+ case 91:
14998
15040
  _contactsMap = _context.v;
14999
15041
  _getFromContacts2 = getShowOnlyContactUsers();
15000
15042
  _state = store.getState();
@@ -15014,9 +15056,9 @@ function watchForEvents() {
15014
15056
  setNotification(_messageBody, reaction.user, _channel0, reaction.key, _message2.attachments && _message2.attachments.length ? _message2.attachments.find(function (att) {
15015
15057
  return att.type !== attachmentTypes.link;
15016
15058
  }) : undefined);
15017
- case 86:
15059
+ case 92:
15018
15060
  if (!(_channel0.newReactions && _channel0.newReactions.length)) {
15019
- _context.n = 87;
15061
+ _context.n = 93;
15020
15062
  break;
15021
15063
  }
15022
15064
  channelUpdateParams = {
@@ -15026,9 +15068,9 @@ function watchForEvents() {
15026
15068
  muted: _channel0.muted,
15027
15069
  mutedTill: _channel0.mutedTill
15028
15070
  };
15029
- _context.n = 87;
15071
+ _context.n = 93;
15030
15072
  return put(updateChannelDataAC(_channel0.id, channelUpdateParams));
15031
- case 87:
15073
+ case 93:
15032
15074
  updateChannelOnAllChannels(_channel0.id, {
15033
15075
  userMessageReactions: _channel0.newReactions,
15034
15076
  lastReactedMessage: _message2,
@@ -15036,14 +15078,17 @@ function watchForEvents() {
15036
15078
  muted: _channel0.muted,
15037
15079
  mutedTill: _channel0.mutedTill
15038
15080
  });
15039
- case 88:
15081
+ case 94:
15040
15082
  if (checkChannelExistsOnMessagesMap(_channel0.id)) {
15041
15083
  addReactionToMessageOnMap(_channel0.id, _message2, reaction, true);
15042
15084
  }
15043
- return _context.a(3, 160);
15044
- case 89:
15085
+ return _context.a(3, 171);
15086
+ case 95:
15045
15087
  _channel1 = args.channel, pollDetails = args.pollDetails, messageId = args.messageId;
15046
- _activeChannelId0 = getActiveChannelId();
15088
+ _context.n = 96;
15089
+ return call(getActiveChannelId);
15090
+ case 96:
15091
+ _activeChannelId0 = _context.v;
15047
15092
  addedVotes = (pollDetails === null || pollDetails === void 0 ? void 0 : pollDetails.votes) || [];
15048
15093
  obj = {
15049
15094
  votes: addedVotes,
@@ -15051,58 +15096,61 @@ function watchForEvents() {
15051
15096
  multipleVotes: pollDetails.allowMultipleVotes || false
15052
15097
  };
15053
15098
  if (!(pollDetails !== null && pollDetails !== void 0 && pollDetails.id && addedVotes.length > 0)) {
15054
- _context.n = 92;
15099
+ _context.n = 99;
15055
15100
  break;
15056
15101
  }
15057
15102
  key = pollDetails.id + "_" + addedVotes[0].optionId;
15058
15103
  hasNext = ((_store$getState$Messa = store.getState().MessageReducer.pollVotesHasMore) === null || _store$getState$Messa === void 0 ? void 0 : _store$getState$Messa[key]) || false;
15059
15104
  _iterator = _createForOfIteratorHelperLoose(addedVotes);
15060
- case 90:
15105
+ case 97:
15061
15106
  if ((_step = _iterator()).done) {
15062
- _context.n = 92;
15107
+ _context.n = 99;
15063
15108
  break;
15064
15109
  }
15065
15110
  vote = _step.value;
15066
- _context.n = 91;
15111
+ _context.n = 98;
15067
15112
  return put(addPollVotesToListAC(pollDetails.id, vote.optionId, [vote], hasNext, undefined));
15068
- case 91:
15069
- _context.n = 90;
15113
+ case 98:
15114
+ _context.n = 97;
15070
15115
  break;
15071
- case 92:
15116
+ case 99:
15072
15117
  updateMessageOnMap(_channel1.id, {
15073
15118
  messageId: messageId,
15074
15119
  params: {}
15075
15120
  }, obj);
15076
15121
  if (!(_channel1.id === _activeChannelId0)) {
15077
- _context.n = 93;
15122
+ _context.n = 100;
15078
15123
  break;
15079
15124
  }
15080
15125
  updateMessageOnAllMessages(messageId, {}, obj);
15081
- _context.n = 93;
15126
+ _context.n = 100;
15082
15127
  return put(updateMessageAC(messageId, {}, undefined, obj));
15083
- case 93:
15084
- return _context.a(3, 160);
15085
- case 94:
15128
+ case 100:
15129
+ return _context.a(3, 171);
15130
+ case 101:
15086
15131
  _channel10 = args.channel, _pollDetails = args.pollDetails, _messageId = args.messageId;
15087
- _activeChannelId1 = getActiveChannelId();
15132
+ _context.n = 102;
15133
+ return call(getActiveChannelId);
15134
+ case 102:
15135
+ _activeChannelId1 = _context.v;
15088
15136
  deletedVotes = (_pollDetails === null || _pollDetails === void 0 ? void 0 : _pollDetails.votes) || [];
15089
15137
  if (!(_pollDetails !== null && _pollDetails !== void 0 && _pollDetails.id && deletedVotes.length > 0)) {
15090
- _context.n = 97;
15138
+ _context.n = 105;
15091
15139
  break;
15092
15140
  }
15093
15141
  _iterator2 = _createForOfIteratorHelperLoose(deletedVotes);
15094
- case 95:
15142
+ case 103:
15095
15143
  if ((_step2 = _iterator2()).done) {
15096
- _context.n = 97;
15144
+ _context.n = 105;
15097
15145
  break;
15098
15146
  }
15099
15147
  _vote = _step2.value;
15100
- _context.n = 96;
15148
+ _context.n = 104;
15101
15149
  return put(deletePollVotesFromListAC(_pollDetails.id, _vote.optionId, [_vote], _messageId));
15102
- case 96:
15103
- _context.n = 95;
15150
+ case 104:
15151
+ _context.n = 103;
15104
15152
  break;
15105
- case 97:
15153
+ case 105:
15106
15154
  updateMessageOnMap(_channel10.id, {
15107
15155
  messageId: _messageId,
15108
15156
  params: {}
@@ -15111,23 +15159,26 @@ function watchForEvents() {
15111
15159
  votesPerOption: _pollDetails.votesPerOption
15112
15160
  });
15113
15161
  if (!(_channel10.id === _activeChannelId1)) {
15114
- _context.n = 98;
15162
+ _context.n = 106;
15115
15163
  break;
15116
15164
  }
15117
15165
  updateMessageOnAllMessages(_messageId, {}, {
15118
15166
  deletedVotes: deletedVotes,
15119
15167
  votesPerOption: _pollDetails.votesPerOption || {}
15120
15168
  });
15121
- _context.n = 98;
15169
+ _context.n = 106;
15122
15170
  return put(updateMessageAC(_messageId, {}, undefined, {
15123
15171
  deletedVotes: deletedVotes,
15124
15172
  votesPerOption: _pollDetails.votesPerOption || {}
15125
15173
  }));
15126
- case 98:
15127
- return _context.a(3, 160);
15128
- case 99:
15174
+ case 106:
15175
+ return _context.a(3, 171);
15176
+ case 107:
15129
15177
  _channel11 = args.channel, _pollDetails2 = args.pollDetails, _messageId2 = args.messageId;
15130
- _activeChannelId10 = getActiveChannelId();
15178
+ _context.n = 108;
15179
+ return call(getActiveChannelId);
15180
+ case 108:
15181
+ _activeChannelId10 = _context.v;
15131
15182
  retractedVotes = (_pollDetails2 === null || _pollDetails2 === void 0 ? void 0 : _pollDetails2.votes) || [];
15132
15183
  updateMessageOnMap(_channel11.id, {
15133
15184
  messageId: _messageId2,
@@ -15137,40 +15188,43 @@ function watchForEvents() {
15137
15188
  votesPerOption: _pollDetails2.votesPerOption
15138
15189
  });
15139
15190
  if (!(_pollDetails2 !== null && _pollDetails2 !== void 0 && _pollDetails2.id && retractedVotes.length > 0)) {
15140
- _context.n = 102;
15191
+ _context.n = 111;
15141
15192
  break;
15142
15193
  }
15143
15194
  _iterator3 = _createForOfIteratorHelperLoose(retractedVotes);
15144
- case 100:
15195
+ case 109:
15145
15196
  if ((_step3 = _iterator3()).done) {
15146
- _context.n = 102;
15197
+ _context.n = 111;
15147
15198
  break;
15148
15199
  }
15149
15200
  _vote2 = _step3.value;
15150
- _context.n = 101;
15201
+ _context.n = 110;
15151
15202
  return put(deletePollVotesFromListAC(_pollDetails2.id, _vote2.optionId, [_vote2], _messageId2));
15152
- case 101:
15153
- _context.n = 100;
15203
+ case 110:
15204
+ _context.n = 109;
15154
15205
  break;
15155
- case 102:
15206
+ case 111:
15156
15207
  if (!(_channel11.id === _activeChannelId10)) {
15157
- _context.n = 103;
15208
+ _context.n = 112;
15158
15209
  break;
15159
15210
  }
15160
15211
  updateMessageOnAllMessages(_messageId2, {}, {
15161
15212
  deletedVotes: retractedVotes,
15162
15213
  votesPerOption: _pollDetails2.votesPerOption || {}
15163
15214
  });
15164
- _context.n = 103;
15215
+ _context.n = 112;
15165
15216
  return put(updateMessageAC(_messageId2, {}, undefined, {
15166
15217
  deletedVotes: retractedVotes,
15167
15218
  votesPerOption: _pollDetails2.votesPerOption || {}
15168
15219
  }));
15169
- case 103:
15170
- return _context.a(3, 160);
15171
- case 104:
15220
+ case 112:
15221
+ return _context.a(3, 171);
15222
+ case 113:
15172
15223
  _channel12 = args.channel, _messageId3 = args.messageId;
15173
- _activeChannelId11 = getActiveChannelId();
15224
+ _context.n = 114;
15225
+ return call(getActiveChannelId);
15226
+ case 114:
15227
+ _activeChannelId11 = _context.v;
15174
15228
  updateMessageOnMap(_channel12.id, {
15175
15229
  messageId: _messageId3,
15176
15230
  params: {}
@@ -15178,55 +15232,58 @@ function watchForEvents() {
15178
15232
  closed: true
15179
15233
  });
15180
15234
  if (!(_channel12.id === _activeChannelId11)) {
15181
- _context.n = 106;
15235
+ _context.n = 116;
15182
15236
  break;
15183
15237
  }
15184
15238
  updateMessageOnAllMessages(_messageId3, {}, {
15185
15239
  closed: true
15186
15240
  });
15187
- _context.n = 105;
15241
+ _context.n = 115;
15188
15242
  return put(updateMessageAC(_messageId3, {}, undefined, {
15189
15243
  closed: true
15190
15244
  }));
15191
- case 105:
15192
- return _context.a(3, 160);
15193
- case 106:
15194
- return _context.a(3, 160);
15195
- case 107:
15245
+ case 115:
15246
+ return _context.a(3, 171);
15247
+ case 116:
15248
+ return _context.a(3, 171);
15249
+ case 117:
15196
15250
  _channel13 = args.channel, _user = args.user, _message3 = args.message, _reaction = args.reaction;
15197
15251
  log.info('channel REACTION_DELETED ... ', _channel13);
15198
15252
  channelFromMap = getChannelFromMap(_channel13.id);
15199
15253
  _isSelf = _user.id === SceytChatClient.user.id;
15200
- _activeChannelId12 = getActiveChannelId();
15254
+ _context.n = 118;
15255
+ return call(getActiveChannelId);
15256
+ case 118:
15257
+ _activeChannelId12 = _context.v;
15201
15258
  if (!(_channel13.id === _activeChannelId12)) {
15202
- _context.n = 109;
15259
+ _context.n = 120;
15203
15260
  break;
15204
15261
  }
15205
- _context.n = 108;
15262
+ _context.n = 119;
15206
15263
  return put(deleteReactionFromMessageAC(_message3, _reaction, _isSelf));
15207
- case 108:
15264
+ case 119:
15208
15265
  removeReactionOnAllMessages(_message3, _reaction, true);
15209
- case 109:
15266
+ case 120:
15210
15267
  _channelUpdateParams = JSON.parse(JSON.stringify(_channel13));
15211
15268
  if (channelFromMap && channelFromMap.lastReactedMessage && channelFromMap.lastReactedMessage.id === _message3.id) {
15212
15269
  _channelUpdateParams.lastReactedMessage = null;
15213
15270
  }
15214
- _context.n = 110;
15271
+ _context.n = 121;
15215
15272
  return put(updateChannelDataAC(_channel13.id, _channelUpdateParams));
15216
- case 110:
15273
+ case 121:
15217
15274
  updateChannelOnAllChannels(_channel13.id, _channelUpdateParams);
15218
15275
  if (checkChannelExistsOnMessagesMap(_channel13.id)) {
15219
15276
  removeReactionToMessageOnMap(_channel13.id, _message3, _reaction, true);
15220
15277
  }
15221
- return _context.a(3, 160);
15222
- case 111:
15278
+ return _context.a(3, 171);
15279
+ case 122:
15223
15280
  _channel14 = args.channel;
15224
15281
  if (!_channel14) {
15225
- _context.n = 113;
15282
+ _context.n = 124;
15226
15283
  break;
15227
15284
  }
15228
15285
  _updatedChannel = JSON.parse(JSON.stringify(_channel14));
15229
- _context.n = 112;
15286
+ _context.n = 123;
15230
15287
  return put(updateChannelDataAC(_channel14.id, {
15231
15288
  lastMessage: _channel14.lastMessage,
15232
15289
  newMessageCount: _channel14.newMessageCount,
@@ -15239,36 +15296,36 @@ function watchForEvents() {
15239
15296
  lastDisplayedMessageId: _channel14.lastDisplayedMessageId,
15240
15297
  messageRetentionPeriod: _channel14.messageRetentionPeriod
15241
15298
  }));
15242
- case 112:
15299
+ case 123:
15243
15300
  updateChannelOnAllChannels(_channel14.id, _updatedChannel);
15244
- case 113:
15245
- return _context.a(3, 160);
15246
- case 114:
15301
+ case 124:
15302
+ return _context.a(3, 171);
15303
+ case 125:
15247
15304
  _channel15 = args.channel;
15248
15305
  log.info('CLEAR_HISTORY: ', _channel15);
15249
- _context.n = 115;
15306
+ _context.n = 126;
15250
15307
  return call(getActiveChannelId);
15251
- case 115:
15308
+ case 126:
15252
15309
  _activeChannelId13 = _context.v;
15253
- _context.n = 116;
15310
+ _context.n = 127;
15254
15311
  return call(checkChannelExists, _channel15.id);
15255
- case 116:
15312
+ case 127:
15256
15313
  channelExist = _context.v;
15257
15314
  if (!(_channel15.id === _activeChannelId13)) {
15258
- _context.n = 118;
15315
+ _context.n = 129;
15259
15316
  break;
15260
15317
  }
15261
- _context.n = 117;
15318
+ _context.n = 128;
15262
15319
  return put(clearMessagesAC());
15263
- case 117:
15320
+ case 128:
15264
15321
  removeAllMessages();
15265
- case 118:
15322
+ case 129:
15266
15323
  removeMessagesFromMap(_channel15.id);
15267
15324
  if (!channelExist) {
15268
- _context.n = 119;
15325
+ _context.n = 130;
15269
15326
  break;
15270
15327
  }
15271
- _context.n = 119;
15328
+ _context.n = 130;
15272
15329
  return put(updateChannelDataAC(_channel15.id, {
15273
15330
  lastMessage: null,
15274
15331
  newMessageCount: 0,
@@ -15276,7 +15333,7 @@ function watchForEvents() {
15276
15333
  muted: _channel15.muted,
15277
15334
  mutedTill: _channel15.mutedTill
15278
15335
  }));
15279
- case 119:
15336
+ case 130:
15280
15337
  updateChannelOnAllChannels(_channel15.id, {
15281
15338
  lastMessage: null,
15282
15339
  newMessageCount: 0,
@@ -15284,173 +15341,173 @@ function watchForEvents() {
15284
15341
  muted: _channel15.muted,
15285
15342
  mutedTill: _channel15.mutedTill
15286
15343
  });
15287
- return _context.a(3, 160);
15288
- case 120:
15344
+ return _context.a(3, 171);
15345
+ case 131:
15289
15346
  _channel16 = args.channel;
15290
15347
  log.info('channel MUTE ... ');
15291
- _context.n = 121;
15348
+ _context.n = 132;
15292
15349
  return put(updateChannelDataAC(_channel16.id, {
15293
15350
  muted: _channel16.muted,
15294
15351
  mutedTill: _channel16.mutedTill
15295
15352
  }));
15296
- case 121:
15353
+ case 132:
15297
15354
  updateChannelOnAllChannels(_channel16.id, {
15298
15355
  muted: _channel16.muted,
15299
15356
  mutedTill: _channel16.mutedTill
15300
15357
  });
15301
- return _context.a(3, 160);
15302
- case 122:
15358
+ return _context.a(3, 171);
15359
+ case 133:
15303
15360
  _channel17 = args.channel;
15304
15361
  log.info('channel UNMUTE ... ');
15305
- _context.n = 123;
15362
+ _context.n = 134;
15306
15363
  return put(updateChannelDataAC(_channel17.id, {
15307
15364
  muted: _channel17.muted,
15308
15365
  mutedTill: _channel17.mutedTill
15309
15366
  }));
15310
- case 123:
15367
+ case 134:
15311
15368
  updateChannelOnAllChannels(_channel17.id, {
15312
15369
  muted: _channel17.muted,
15313
15370
  mutedTill: _channel17.mutedTill
15314
15371
  });
15315
- return _context.a(3, 160);
15316
- case 124:
15372
+ return _context.a(3, 171);
15373
+ case 135:
15317
15374
  _channel18 = args.channel;
15318
15375
  log.info('channel PINED ... ');
15319
- _context.n = 125;
15376
+ _context.n = 136;
15320
15377
  return put(updateChannelDataAC(_channel18.id, {
15321
15378
  pinnedAt: _channel18.pinnedAt
15322
15379
  }, true));
15323
- case 125:
15380
+ case 136:
15324
15381
  updateChannelOnAllChannels(_channel18.id, {
15325
15382
  pinnedAt: _channel18.pinnedAt
15326
15383
  });
15327
- return _context.a(3, 160);
15328
- case 126:
15384
+ return _context.a(3, 171);
15385
+ case 137:
15329
15386
  _channel19 = args.channel;
15330
15387
  log.info('channel UNPINED ... ');
15331
- _context.n = 127;
15388
+ _context.n = 138;
15332
15389
  return put(updateChannelDataAC(_channel19.id, {
15333
15390
  pinnedAt: _channel19.pinnedAt
15334
15391
  }, false, true));
15335
- case 127:
15392
+ case 138:
15336
15393
  updateChannelOnAllChannels(_channel19.id, {
15337
15394
  pinnedAt: _channel19.pinnedAt
15338
15395
  });
15339
- return _context.a(3, 160);
15340
- case 128:
15396
+ return _context.a(3, 171);
15397
+ case 139:
15341
15398
  _channel20 = args.channel;
15342
15399
  log.info('channel HIDE ... ');
15343
- _context.n = 129;
15400
+ _context.n = 140;
15344
15401
  return put(setChannelToHideAC(_channel20));
15345
- case 129:
15346
- return _context.a(3, 160);
15347
- case 130:
15402
+ case 140:
15403
+ return _context.a(3, 171);
15404
+ case 141:
15348
15405
  _channel21 = args.channel;
15349
15406
  log.info('channel UNHIDE ... ');
15350
- _context.n = 131;
15407
+ _context.n = 142;
15351
15408
  return put(setChannelToUnHideAC(_channel21));
15352
- case 131:
15353
- return _context.a(3, 160);
15354
- case 132:
15409
+ case 142:
15410
+ return _context.a(3, 171);
15411
+ case 143:
15355
15412
  _channel22 = args.channel;
15356
- _context.n = 133;
15413
+ _context.n = 144;
15357
15414
  return put(updateChannelDataAC(_channel22.id, {
15358
15415
  unread: _channel22.unread,
15359
15416
  muted: _channel22.muted,
15360
15417
  mutedTill: _channel22.mutedTill
15361
15418
  }));
15362
- case 133:
15419
+ case 144:
15363
15420
  _groupName5 = getChannelGroupName(_channel22);
15364
- _context.n = 134;
15421
+ _context.n = 145;
15365
15422
  return put(updateSearchedChannelDataAC(_channel22.id, {
15366
15423
  unread: _channel22.unread
15367
15424
  }, _groupName5));
15368
- case 134:
15425
+ case 145:
15369
15426
  updateChannelOnAllChannels(_channel22.id, {
15370
15427
  unread: _channel22.unread
15371
15428
  });
15372
- return _context.a(3, 160);
15373
- case 135:
15429
+ return _context.a(3, 171);
15430
+ case 146:
15374
15431
  _channel23 = args.channel;
15375
- _context.n = 136;
15432
+ _context.n = 147;
15376
15433
  return put(updateChannelDataAC(_channel23.id, {
15377
15434
  unread: _channel23.unread,
15378
15435
  muted: _channel23.muted,
15379
15436
  mutedTill: _channel23.mutedTill
15380
15437
  }));
15381
- case 136:
15438
+ case 147:
15382
15439
  _groupName6 = getChannelGroupName(_channel23);
15383
- _context.n = 137;
15440
+ _context.n = 148;
15384
15441
  return put(updateSearchedChannelDataAC(_channel23.id, {
15385
15442
  unread: _channel23.unread
15386
15443
  }, _groupName6));
15387
- case 137:
15444
+ case 148:
15388
15445
  updateChannelOnAllChannels(_channel23.id, {
15389
15446
  unread: _channel23.unread
15390
15447
  });
15391
- return _context.a(3, 160);
15392
- case 138:
15448
+ return _context.a(3, 171);
15449
+ case 149:
15393
15450
  _channel24 = args.channel, members = args.members;
15394
15451
  log.info('channel CHANGE_ROLE channel ... ', _channel24);
15395
15452
  log.info('channel CHANGE_ROLE member ... ', members);
15396
- _context.n = 139;
15453
+ _context.n = 150;
15397
15454
  return call(getActiveChannelId);
15398
- case 139:
15455
+ case 150:
15399
15456
  _activeChannelId14 = _context.v;
15400
15457
  if (!(_channel24.id === _activeChannelId14)) {
15401
- _context.n = 140;
15458
+ _context.n = 151;
15402
15459
  break;
15403
15460
  }
15404
- _context.n = 140;
15461
+ _context.n = 151;
15405
15462
  return put(updateMembersAC(members));
15406
- case 140:
15463
+ case 151:
15407
15464
  i = 0;
15408
- case 141:
15465
+ case 152:
15409
15466
  if (!(i < members.length)) {
15410
- _context.n = 144;
15467
+ _context.n = 155;
15411
15468
  break;
15412
15469
  }
15413
15470
  if (!(members[i].id === SceytChatClient.user.id)) {
15414
- _context.n = 143;
15471
+ _context.n = 154;
15415
15472
  break;
15416
15473
  }
15417
- _context.n = 142;
15474
+ _context.n = 153;
15418
15475
  return put(updateChannelDataAC(_channel24.id, {
15419
15476
  userRole: members[i].role,
15420
15477
  muted: _channel24.muted,
15421
15478
  mutedTill: _channel24.mutedTill
15422
15479
  }));
15423
- case 142:
15480
+ case 153:
15424
15481
  updateChannelOnAllChannels(_channel24.id, {
15425
15482
  userRole: members[i].role,
15426
15483
  muted: _channel24.muted,
15427
15484
  mutedTill: _channel24.mutedTill
15428
15485
  });
15429
- case 143:
15486
+ case 154:
15430
15487
  i++;
15431
- _context.n = 141;
15488
+ _context.n = 152;
15432
15489
  break;
15433
- case 144:
15434
- return _context.a(3, 160);
15435
- case 145:
15490
+ case 155:
15491
+ return _context.a(3, 171);
15492
+ case 156:
15436
15493
  _channel25 = args.channel;
15437
15494
  log.info('channel frozen channel ... ', _channel25);
15438
- return _context.a(3, 160);
15439
- case 146:
15495
+ return _context.a(3, 171);
15496
+ case 157:
15440
15497
  _channel26 = args.channel;
15441
15498
  log.info('channel unfrozen channel ... ', _channel26);
15442
- return _context.a(3, 160);
15443
- case 147:
15499
+ return _context.a(3, 171);
15500
+ case 158:
15444
15501
  _channelId2 = args.channelId, from = args.from, name = args.name;
15445
15502
  log.info('channel event received >>>... . . . . . ', args);
15446
15503
  if (!(from.id === SceytChatClient.user.id)) {
15447
- _context.n = 148;
15504
+ _context.n = 159;
15448
15505
  break;
15449
15506
  }
15450
- return _context.a(3, 160);
15451
- case 148:
15507
+ return _context.a(3, 171);
15508
+ case 159:
15452
15509
  if (!(name === 'start_typing')) {
15453
- _context.n = 150;
15510
+ _context.n = 161;
15454
15511
  break;
15455
15512
  }
15456
15513
  if (!usersTimeout[_channelId2]) {
@@ -15462,27 +15519,27 @@ function watchForEvents() {
15462
15519
  usersTimeout[_channelId2][from.id] = setTimeout(function () {
15463
15520
  channelListener.onReceivedChannelEvent(_channelId2, from, 'stop_typing');
15464
15521
  }, 5000);
15465
- _context.n = 149;
15522
+ _context.n = 160;
15466
15523
  return put(switchTypingIndicatorAC(true, _channelId2, from));
15467
- case 149:
15468
- _context.n = 155;
15524
+ case 160:
15525
+ _context.n = 166;
15469
15526
  break;
15470
- case 150:
15527
+ case 161:
15471
15528
  if (!(name === 'stop_typing')) {
15472
- _context.n = 152;
15529
+ _context.n = 163;
15473
15530
  break;
15474
15531
  }
15475
15532
  if (usersTimeout[_channelId2] && usersTimeout[_channelId2][from.id]) {
15476
15533
  clearTimeout(usersTimeout[_channelId2][from.id]);
15477
15534
  }
15478
- _context.n = 151;
15535
+ _context.n = 162;
15479
15536
  return put(switchTypingIndicatorAC(false, _channelId2, from));
15480
- case 151:
15481
- _context.n = 155;
15537
+ case 162:
15538
+ _context.n = 166;
15482
15539
  break;
15483
- case 152:
15540
+ case 163:
15484
15541
  if (!(name === 'start_recording')) {
15485
- _context.n = 154;
15542
+ _context.n = 165;
15486
15543
  break;
15487
15544
  }
15488
15545
  if (!usersTimeout[_channelId2]) {
@@ -15494,43 +15551,50 @@ function watchForEvents() {
15494
15551
  usersTimeout[_channelId2][from.id] = setTimeout(function () {
15495
15552
  channelListener.onReceivedChannelEvent(_channelId2, from, 'stop_recording');
15496
15553
  }, 5000);
15497
- _context.n = 153;
15554
+ _context.n = 164;
15498
15555
  return put(switchRecordingIndicatorAC(true, _channelId2, from));
15499
- case 153:
15500
- _context.n = 155;
15556
+ case 164:
15557
+ _context.n = 166;
15501
15558
  break;
15502
- case 154:
15559
+ case 165:
15503
15560
  if (!(name === 'stop_recording')) {
15504
- _context.n = 155;
15561
+ _context.n = 166;
15505
15562
  break;
15506
15563
  }
15507
15564
  if (usersTimeout[_channelId2] && usersTimeout[_channelId2][from.id]) {
15508
15565
  clearTimeout(usersTimeout[_channelId2][from.id]);
15509
15566
  }
15510
- _context.n = 155;
15567
+ _context.n = 166;
15511
15568
  return put(switchRecordingIndicatorAC(false, _channelId2, from));
15512
- case 155:
15513
- return _context.a(3, 160);
15514
- case 156:
15569
+ case 166:
15570
+ return _context.a(3, 171);
15571
+ case 167:
15515
15572
  status = args.status;
15516
15573
  log.info('connection status changed . . . . . ', status);
15517
- _context.n = 157;
15574
+ _context.n = 168;
15518
15575
  return put(setConnectionStatusAC(status));
15519
- case 157:
15576
+ case 168:
15520
15577
  if (!(status === CONNECTION_STATUS.CONNECTED)) {
15521
- _context.n = 158;
15578
+ _context.n = 169;
15522
15579
  break;
15523
15580
  }
15524
- _context.n = 158;
15581
+ _context.n = 169;
15525
15582
  return put(getRolesAC());
15526
- case 158:
15527
- return _context.a(3, 160);
15528
- case 159:
15583
+ case 169:
15584
+ return _context.a(3, 171);
15585
+ case 170:
15529
15586
  log.warn('UNHANDLED EVENT FROM REDUX-SAGA EVENT-CHANNEL');
15530
- case 160:
15587
+ case 171:
15588
+ _context.n = 173;
15589
+ break;
15590
+ case 172:
15591
+ _context.p = 172;
15592
+ _t2 = _context.v;
15593
+ log.error('Error in watchForEvents:', _t2);
15594
+ case 173:
15531
15595
  return _context.a(2);
15532
15596
  }
15533
- }, _callee);
15597
+ }, _callee, null, [[0, 172]]);
15534
15598
  });
15535
15599
  case 1:
15536
15600
  return _context2.d(_regeneratorValues(_loop()), 2);
@@ -17659,6 +17723,7 @@ function getChannelByInviteKey(action) {
17659
17723
  _context33.n = 2;
17660
17724
  return put(setJoinableChannelAC(JSON.parse(JSON.stringify(channel[0]))));
17661
17725
  case 2:
17726
+ window.history.pushState({}, '', window.location.pathname + '?join=' + key);
17662
17727
  _context33.n = 5;
17663
17728
  break;
17664
17729
  case 3:
@@ -22292,12 +22357,6 @@ var store = configureStore({
22292
22357
  });
22293
22358
  sagaMiddleware.run(rootSaga);
22294
22359
 
22295
- var SceytReduxContext = /*#__PURE__*/React__default.createContext(null);
22296
-
22297
- var useSelector = createSelectorHook(SceytReduxContext);
22298
- var useDispatch = createDispatchHook(SceytReduxContext);
22299
- var useStore = createStoreHook(SceytReduxContext);
22300
-
22301
22360
  var channelsSelector = function channelsSelector(store) {
22302
22361
  return store.ChannelReducer.channels;
22303
22362
  };
@@ -22883,6 +22942,7 @@ function JoinGroupPopup(_ref) {
22883
22942
  height: '12px',
22884
22943
  width: '12px'
22885
22944
  }), /*#__PURE__*/React__default.createElement(TopAvatar, null, /*#__PURE__*/React__default.createElement(Avatar, {
22945
+ key: channel.id,
22886
22946
  name: channel.subject || '',
22887
22947
  image: channel.avatar || '',
22888
22948
  size: 90,
@@ -22894,7 +22954,7 @@ function JoinGroupPopup(_ref) {
22894
22954
  color: textPrimary
22895
22955
  }, subtitleText), showMembersAvatars && (/*#__PURE__*/React__default.createElement(MembersRow, null, firstMembers.map(function (m, idx) {
22896
22956
  return /*#__PURE__*/React__default.createElement(MemberAvatar, {
22897
- key: m.id,
22957
+ key: m.id || "member-" + idx,
22898
22958
  index: idx,
22899
22959
  borderColor: background
22900
22960
  }, /*#__PURE__*/React__default.createElement(Avatar, {
@@ -26149,7 +26209,7 @@ var ChannelList = function ChannelList(_ref) {
26149
26209
  }, [searchValue]);
26150
26210
  useDidUpdate(function () {
26151
26211
  if (getSelectedChannel) {
26152
- if (!(activeChannel !== null && activeChannel !== void 0 && activeChannel.mentionsIds)) {
26212
+ if (!(activeChannel !== null && activeChannel !== void 0 && activeChannel.mentionsIds) && activeChannel !== null && activeChannel !== void 0 && activeChannel.id) {
26153
26213
  dispatch(getChannelMentionsAC(activeChannel.id));
26154
26214
  }
26155
26215
  getSelectedChannel(activeChannel);
@@ -34410,6 +34470,8 @@ var OGMetadata = function OGMetadata(_ref) {
34410
34470
  ogContainerMargin = _ref.ogContainerMargin,
34411
34471
  _ref$target = _ref.target,
34412
34472
  target = _ref$target === void 0 ? '_blank' : _ref$target,
34473
+ _ref$isInviteLink = _ref.isInviteLink,
34474
+ isInviteLink = _ref$isInviteLink === void 0 ? false : _ref$isInviteLink,
34413
34475
  metadataGetSuccessCallback = _ref.metadataGetSuccessCallback;
34414
34476
  var dispatch = useDispatch();
34415
34477
  var oGMetadata = useSelector(function (state) {
@@ -34687,7 +34749,14 @@ var OGMetadata = function OGMetadata(_ref) {
34687
34749
  alt: ''
34688
34750
  })))) : textContent;
34689
34751
  }, [hasImage, elements, shouldAnimate, ogContainerShowBackground, ogShowFavicon, faviconUrl, textContent]);
34690
- return /*#__PURE__*/React__default.createElement(OGMetadataContainer, {
34752
+ var getChannel = useCallback(function () {
34753
+ var splitedKey = attachment === null || attachment === void 0 ? void 0 : attachment.url.split('/');
34754
+ var key = splitedKey[splitedKey.length - 1];
34755
+ if (key) {
34756
+ dispatch(getChannelByInviteKeyAC(key));
34757
+ }
34758
+ }, [attachment === null || attachment === void 0 ? void 0 : attachment.url]);
34759
+ return /*#__PURE__*/React__default.createElement(OGMetadataContainer, Object.assign({
34691
34760
  showOGMetadata: !!showOGMetadata,
34692
34761
  bgColor: incoming ? incomingMessageBackgroundX : outgoingMessageBackgroundX,
34693
34762
  showBackground: ogContainerShowBackground,
@@ -34695,12 +34764,18 @@ var OGMetadata = function OGMetadata(_ref) {
34695
34764
  borderRadius: ogContainerBorderRadius,
34696
34765
  padding: ogContainerPadding,
34697
34766
  className: ogContainerClassName,
34698
- containerMargin: ogContainerMargin,
34767
+ containerMargin: ogContainerMargin
34768
+ }, isInviteLink ? {
34769
+ as: 'div',
34770
+ onClick: function onClick() {
34771
+ getChannel();
34772
+ }
34773
+ } : {
34699
34774
  as: 'a',
34700
34775
  href: attachment === null || attachment === void 0 ? void 0 : attachment.url,
34701
34776
  target: target,
34702
34777
  rel: target === '_blank' ? 'noopener noreferrer' : undefined
34703
- }, content);
34778
+ }), content);
34704
34779
  };
34705
34780
  var sharedKeyframes = "\n @keyframes fadeInSlideUp {\n from {\n opacity: 0;\n transform: translateY(10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n @keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n @keyframes expandHeight {\n from {\n max-height: 0;\n opacity: 0;\n }\n to {\n max-height: 1000px;\n opacity: 1;\n }\n }\n";
34706
34781
  var OGMetadataContainer = styled.div(_templateObject$F || (_templateObject$F = _taggedTemplateLiteralLoose(["\n min-width: inherit;\n max-width: inherit;\n width: 100%;\n display: grid;\n grid-template-columns: 1fr;\n background-color: ", ";\n border-radius: ", ";\n margin: ", ";\n // margin-bottom: ", ";\n padding: ", ";\n text-decoration: none;\n color: inherit;\n &:hover {\n opacity: 0.9;\n cursor: pointer;\n }\n"])), function (_ref2) {
@@ -35237,7 +35312,8 @@ var MessageBody = function MessageBody(_ref) {
35237
35312
  ogContainerClassName: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.ogContainerClassName,
35238
35313
  ogContainerShowBackground: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.ogContainerShowBackground,
35239
35314
  ogContainerBackground: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.ogContainerBackground,
35240
- infoPadding: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.infoPadding
35315
+ infoPadding: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.infoPadding,
35316
+ isInviteLink: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.isInviteLink
35241
35317
  })), messageStatusAndTimePosition === 'onMessage' && !notLinkAttachment && (messageStatusVisible || messageTimeVisible) ? (/*#__PURE__*/React__default.createElement(MessageStatusAndTime$1, {
35242
35318
  message: message,
35243
35319
  showMessageTimeAndStatusOnlyOnHover: showMessageTimeAndStatusOnlyOnHover,
@@ -35969,23 +36045,7 @@ var Message$1 = function Message(_ref) {
35969
36045
  messageTextLineHeight = _ref.messageTextLineHeight,
35970
36046
  messageTimeColorOnAttachment = _ref.messageTimeColorOnAttachment,
35971
36047
  shouldOpenUserProfileForMention = _ref.shouldOpenUserProfileForMention,
35972
- _ref$ogMetadataProps = _ref.ogMetadataProps,
35973
- ogMetadataProps = _ref$ogMetadataProps === void 0 ? {
35974
- maxWidth: 400,
35975
- maxHeight: undefined,
35976
- ogLayoutOrder: 'link-first',
35977
- ogShowUrl: false,
35978
- ogShowTitle: true,
35979
- ogShowDescription: true,
35980
- ogShowFavicon: true,
35981
- order: {
35982
- image: 1,
35983
- title: 2,
35984
- description: 3,
35985
- link: 4
35986
- },
35987
- infoPadding: '0 8px'
35988
- } : _ref$ogMetadataProps,
36048
+ ogMetadataProps = _ref.ogMetadataProps,
35989
36049
  _ref$showInfoMessageP = _ref.showInfoMessageProps,
35990
36050
  showInfoMessageProps = _ref$showInfoMessageP === void 0 ? {} : _ref$showInfoMessageP;
35991
36051
  var _useColor = useColors(),
@@ -36917,23 +36977,7 @@ var MessageList = function MessageList(_ref2) {
36917
36977
  shouldOpenUserProfileForMention = _ref2.shouldOpenUserProfileForMention,
36918
36978
  _ref2$showInfoMessage = _ref2.showInfoMessageProps,
36919
36979
  showInfoMessageProps = _ref2$showInfoMessage === void 0 ? {} : _ref2$showInfoMessage,
36920
- _ref2$ogMetadataProps = _ref2.ogMetadataProps,
36921
- ogMetadataProps = _ref2$ogMetadataProps === void 0 ? {
36922
- maxWidth: 400,
36923
- maxHeight: undefined,
36924
- ogLayoutOrder: 'link-first',
36925
- ogShowUrl: false,
36926
- ogShowTitle: true,
36927
- ogShowDescription: true,
36928
- ogShowFavicon: true,
36929
- order: {
36930
- image: 1,
36931
- title: 2,
36932
- description: 3,
36933
- link: 4
36934
- },
36935
- infoPadding: '0 8px'
36936
- } : _ref2$ogMetadataProps;
36980
+ ogMetadataProps = _ref2.ogMetadataProps;
36937
36981
  var _useColor = useColors(),
36938
36982
  outgoingMessageBackground = _useColor[THEME_COLORS.OUTGOING_MESSAGE_BACKGROUND],
36939
36983
  themeBackgroundColor = _useColor[THEME_COLORS.BACKGROUND],
@@ -38026,7 +38070,8 @@ var MessagesContainer = function MessagesContainer(_ref) {
38026
38070
  description: 3,
38027
38071
  link: 4
38028
38072
  },
38029
- infoPadding: '0 8px'
38073
+ infoPadding: '0 8px',
38074
+ isInviteLink: false
38030
38075
  } : _ref$ogMetadataProps;
38031
38076
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(MessageList, {
38032
38077
  fontFamily: fontFamily,
@@ -43689,145 +43734,24 @@ function InviteLinkModal(_ref) {
43689
43734
  };
43690
43735
  var handleForwardChannels = function handleForwardChannels(channelIds) {
43691
43736
  try {
43692
- if (!(channelIds !== null && channelIds !== void 0 && channelIds.length)) {
43693
- setOpenForwardPopup(false);
43694
- return Promise.resolve();
43695
- }
43696
- setOpenForwardPopup(false);
43697
- return Promise.resolve(_forOf(channelIds, function (channelId) {
43698
- var channel = getChannelFromMap(channelId);
43699
- var _temp3 = function () {
43700
- if (shareMode === 'link') {
43701
- var linkAttachmentBuilder = channel.createAttachmentBuilder(inviteUrl, attachmentTypes.link);
43702
- var linkAttachmentToSend = linkAttachmentBuilder.setName('Invite link').setUpload(false).create();
43703
- var message = {
43704
- metadata: '',
43705
- body: inviteUrl,
43706
- mentionedUsers: [],
43707
- type: 'text',
43708
- attachments: [linkAttachmentToSend]
43709
- };
43710
- dispatch(forwardMessageAC(message, channelId, connectionStatus, false));
43711
- } else {
43712
- var _temp2 = _catch(function () {
43713
- var toPngBlob = function toPngBlob() {
43714
- try {
43715
- var dpr = 4;
43716
- var baseQrSize = 200;
43717
- var qrSize = baseQrSize * dpr;
43718
- var qrUrl = "https://api.qrserver.com/v1/create-qr-code/?data=" + encodeURIComponent(inviteUrl) + "&size=" + qrSize + "x" + qrSize + "&ecc=H&margin=32&color=000000&bgcolor=FFFFFF";
43719
- return Promise.resolve(fetch(qrUrl, {
43720
- cache: 'no-store'
43721
- })).then(function (qrResp) {
43722
- return Promise.resolve(qrResp.blob()).then(function (qrBlob) {
43723
- var qrObjectUrl = URL.createObjectURL(qrBlob);
43724
- var boxWidth = qrSize;
43725
- var boxHeight = qrSize;
43726
- var canvas = document.createElement('canvas');
43727
- canvas.width = boxWidth;
43728
- canvas.height = boxHeight;
43729
- var ctx = canvas.getContext('2d');
43730
- var img = new Image();
43731
- img.src = qrObjectUrl;
43732
- return Promise.resolve(new Promise(function (resolve, reject) {
43733
- img.onload = function () {
43734
- return resolve(null);
43735
- };
43736
- img.onerror = reject;
43737
- })).then(function () {
43738
- var _logoRef$current;
43739
- function _temp6() {
43740
- URL.revokeObjectURL(qrObjectUrl);
43741
- return Promise.resolve(new Promise(function (resolve) {
43742
- return canvas.toBlob(function (b) {
43743
- return resolve(b);
43744
- }, 'image/png');
43745
- }));
43746
- }
43747
- ctx.imageSmoothingEnabled = false;
43748
- ctx.drawImage(img, 0, 0, qrSize, qrSize);
43749
- var overlaySize = qrSize * 22 / 100;
43750
- var overlayX = (boxWidth - overlaySize) / 2;
43751
- var overlayY = (boxHeight - overlaySize) / 2;
43752
- var roundedPath = function roundedPath(x, y, w, h, r) {
43753
- ctx.beginPath();
43754
- ctx.moveTo(x + r, y);
43755
- ctx.lineTo(x + w - r, y);
43756
- ctx.quadraticCurveTo(x + w, y, x + w, y + r);
43757
- ctx.lineTo(x + w, y + h - r);
43758
- ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
43759
- ctx.lineTo(x + r, y + h);
43760
- ctx.quadraticCurveTo(x, y + h, x, y + h - r);
43761
- ctx.lineTo(x, y + r);
43762
- ctx.quadraticCurveTo(x, y, x + r, y);
43763
- ctx.closePath();
43764
- };
43765
- var cornerRadius = 8 * dpr;
43766
- var imgElement = (_logoRef$current = logoRef.current) === null || _logoRef$current === void 0 ? void 0 : _logoRef$current.querySelector('img');
43767
- var _temp5 = function () {
43768
- if (imgElement && (imgElement.currentSrc || imgElement.src)) {
43769
- var logoUrl = imgElement.currentSrc || imgElement.src;
43770
- var logoImg = new Image();
43771
- logoImg.src = logoUrl;
43772
- return Promise.resolve(new Promise(function (resolve, reject) {
43773
- logoImg.onload = function () {
43774
- return resolve(null);
43775
- };
43776
- logoImg.onerror = reject;
43777
- })).then(function () {
43778
- ctx.save();
43779
- roundedPath(overlayX, overlayY, overlaySize, overlaySize, cornerRadius);
43780
- ctx.clip();
43781
- ctx.drawImage(logoImg, overlayX, overlayY, overlaySize, overlaySize);
43782
- ctx.restore();
43783
- });
43784
- } else {
43785
- var _logoRef$current2;
43786
- var svgElement = (_logoRef$current2 = logoRef.current) === null || _logoRef$current2 === void 0 ? void 0 : _logoRef$current2.querySelector('svg');
43787
- var _temp4 = function () {
43788
- if (svgElement) {
43789
- var serializer = new XMLSerializer();
43790
- var svgString = serializer.serializeToString(svgElement);
43791
- if (!/^<svg[^>]+xmlns=/.test(svgString)) {
43792
- svgString = svgString.replace('<svg', '<svg xmlns="http://www.w3.org/2000/svg"');
43793
- }
43794
- var svgBlob = new Blob([svgString], {
43795
- type: 'image/svg+xml;charset=utf-8'
43796
- });
43797
- var svgUrl = URL.createObjectURL(svgBlob);
43798
- var _logoImg = new Image();
43799
- _logoImg.src = svgUrl;
43800
- return Promise.resolve(new Promise(function (resolve, reject) {
43801
- _logoImg.onload = function () {
43802
- return resolve(null);
43803
- };
43804
- _logoImg.onerror = reject;
43805
- })).then(function () {
43806
- ctx.save();
43807
- roundedPath(overlayX, overlayY, overlaySize, overlaySize, cornerRadius);
43808
- ctx.clip();
43809
- ctx.drawImage(_logoImg, overlayX, overlayY, overlaySize, overlaySize);
43810
- ctx.restore();
43811
- URL.revokeObjectURL(svgUrl);
43812
- });
43813
- }
43814
- }();
43815
- if (_temp4 && _temp4.then) return _temp4.then(function () {});
43816
- }
43817
- }();
43818
- return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
43819
- });
43820
- });
43821
- });
43822
- } catch (e) {
43823
- return Promise.reject(e);
43824
- }
43737
+ var _temp5 = function _temp5() {
43738
+ return _forOf(channelIds, function (channelId) {
43739
+ var channel = getChannelFromMap(channelId);
43740
+ var _temp3 = function () {
43741
+ if (shareMode === 'link') {
43742
+ var linkAttachmentBuilder = channel.createAttachmentBuilder(inviteUrl, attachmentTypes.link);
43743
+ var linkAttachmentToSend = linkAttachmentBuilder.setName('Invite link').setUpload(false).create();
43744
+ var message = {
43745
+ metadata: '',
43746
+ body: inviteUrl,
43747
+ mentionedUsers: [],
43748
+ type: 'text',
43749
+ attachments: [linkAttachmentToSend]
43825
43750
  };
43826
- return Promise.resolve(toPngBlob()).then(function (blob) {
43827
- var file = new File([blob], 'invite-qr.png', {
43828
- type: 'image/png'
43829
- });
43830
- var localUrl = URL.createObjectURL(file);
43751
+ dispatch(forwardMessageAC(message, channelId, connectionStatus, false));
43752
+ } else {
43753
+ var _temp2 = _catch(function () {
43754
+ var _file, _file2, _file3, _file4;
43831
43755
  var message = {
43832
43756
  metadata: '',
43833
43757
  body: '',
@@ -43837,16 +43761,16 @@ function InviteLinkModal(_ref) {
43837
43761
  name: 'invite-qr.png',
43838
43762
  data: file,
43839
43763
  upload: false,
43840
- type: "" + file.type,
43764
+ type: "" + ((_file = file) === null || _file === void 0 ? void 0 : _file.type),
43841
43765
  url: {
43842
- type: "" + file.type,
43766
+ type: "" + ((_file2 = file) === null || _file2 === void 0 ? void 0 : _file2.type),
43843
43767
  data: file
43844
43768
  },
43845
43769
  createdAt: new Date(),
43846
43770
  progress: 0,
43847
43771
  completion: 0,
43848
43772
  messageId: '',
43849
- size: file.size,
43773
+ size: (_file3 = file) === null || _file3 === void 0 ? void 0 : _file3.size,
43850
43774
  attachmentUrl: localUrl
43851
43775
  }]
43852
43776
  };
@@ -43860,32 +43784,165 @@ function InviteLinkModal(_ref) {
43860
43784
  progress: 0,
43861
43785
  completion: 0,
43862
43786
  messageId: '',
43863
- size: file.size,
43787
+ size: ((_file4 = file) === null || _file4 === void 0 ? void 0 : _file4.size) || 0,
43864
43788
  attachmentUrl: localUrl
43865
43789
  }], message, channel)).then(function (attachmentsToSend) {
43866
43790
  dispatch(forwardMessageAC(_extends({}, message, {
43867
43791
  attachments: attachmentsToSend
43868
43792
  }), channelId, connectionStatus, false));
43869
43793
  });
43794
+ }, function (e) {
43795
+ console.log('error', e);
43796
+ var linkAttachmentBuilder = channel.createAttachmentBuilder(inviteUrl, attachmentTypes.link);
43797
+ var linkAttachmentToSend = linkAttachmentBuilder.setName('Invite link').setUpload(false).create();
43798
+ var message = {
43799
+ metadata: '',
43800
+ body: inviteUrl,
43801
+ mentionedUsers: [],
43802
+ type: 'text',
43803
+ attachments: [linkAttachmentToSend]
43804
+ };
43805
+ dispatch(forwardMessageAC(message, channelId, connectionStatus, false));
43870
43806
  });
43871
- }, function (e) {
43872
- console.log('error', e);
43873
- var linkAttachmentBuilder = channel.createAttachmentBuilder(inviteUrl, attachmentTypes.link);
43874
- var linkAttachmentToSend = linkAttachmentBuilder.setName('Invite link').setUpload(false).create();
43875
- var message = {
43876
- metadata: '',
43877
- body: inviteUrl,
43878
- mentionedUsers: [],
43879
- type: 'text',
43880
- attachments: [linkAttachmentToSend]
43881
- };
43882
- dispatch(forwardMessageAC(message, channelId, connectionStatus, false));
43807
+ if (_temp2 && _temp2.then) return _temp2.then(function () {});
43808
+ }
43809
+ }();
43810
+ if (_temp3 && _temp3.then) return _temp3.then(function () {});
43811
+ });
43812
+ };
43813
+ if (!(channelIds !== null && channelIds !== void 0 && channelIds.length)) {
43814
+ setOpenForwardPopup(false);
43815
+ return Promise.resolve();
43816
+ }
43817
+ setOpenForwardPopup(false);
43818
+ var file = null;
43819
+ var blob = null;
43820
+ var localUrl = '';
43821
+ var _temp4 = function () {
43822
+ if (shareMode === 'qr') {
43823
+ var toPngBlob = function toPngBlob() {
43824
+ try {
43825
+ var dpr = 4;
43826
+ var baseQrSize = 200;
43827
+ var qrSize = baseQrSize * dpr;
43828
+ var qrUrl = "https://api.qrserver.com/v1/create-qr-code/?data=" + encodeURIComponent(inviteUrl) + "&size=" + qrSize + "x" + qrSize + "&ecc=H&margin=32&color=000000&bgcolor=FFFFFF";
43829
+ return Promise.resolve(fetch(qrUrl, {
43830
+ cache: 'no-store'
43831
+ })).then(function (qrResp) {
43832
+ return Promise.resolve(qrResp.blob()).then(function (qrBlob) {
43833
+ var qrObjectUrl = URL.createObjectURL(qrBlob);
43834
+ var boxWidth = qrSize;
43835
+ var boxHeight = qrSize;
43836
+ var canvas = document.createElement('canvas');
43837
+ canvas.width = boxWidth;
43838
+ canvas.height = boxHeight;
43839
+ var ctx = canvas.getContext('2d');
43840
+ var img = new Image();
43841
+ img.src = qrObjectUrl;
43842
+ return Promise.resolve(new Promise(function (resolve, reject) {
43843
+ img.onload = function () {
43844
+ return resolve(null);
43845
+ };
43846
+ img.onerror = reject;
43847
+ })).then(function () {
43848
+ var _logoRef$current;
43849
+ function _temp8() {
43850
+ URL.revokeObjectURL(qrObjectUrl);
43851
+ return Promise.resolve(new Promise(function (resolve) {
43852
+ return canvas.toBlob(function (b) {
43853
+ return resolve(b);
43854
+ }, 'image/png');
43855
+ }));
43856
+ }
43857
+ ctx.imageSmoothingEnabled = false;
43858
+ ctx.drawImage(img, 0, 0, qrSize, qrSize);
43859
+ var overlaySize = qrSize * 22 / 100;
43860
+ var overlayX = (boxWidth - overlaySize) / 2;
43861
+ var overlayY = (boxHeight - overlaySize) / 2;
43862
+ var roundedPath = function roundedPath(x, y, w, h, r) {
43863
+ ctx.beginPath();
43864
+ ctx.moveTo(x + r, y);
43865
+ ctx.lineTo(x + w - r, y);
43866
+ ctx.quadraticCurveTo(x + w, y, x + w, y + r);
43867
+ ctx.lineTo(x + w, y + h - r);
43868
+ ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
43869
+ ctx.lineTo(x + r, y + h);
43870
+ ctx.quadraticCurveTo(x, y + h, x, y + h - r);
43871
+ ctx.lineTo(x, y + r);
43872
+ ctx.quadraticCurveTo(x, y, x + r, y);
43873
+ ctx.closePath();
43874
+ };
43875
+ var cornerRadius = 8 * dpr;
43876
+ var imgElement = (_logoRef$current = logoRef.current) === null || _logoRef$current === void 0 ? void 0 : _logoRef$current.querySelector('img');
43877
+ var _temp7 = function () {
43878
+ if (imgElement && (imgElement.currentSrc || imgElement.src)) {
43879
+ var logoUrl = imgElement.currentSrc || imgElement.src;
43880
+ var logoImg = new Image();
43881
+ logoImg.src = logoUrl;
43882
+ return Promise.resolve(new Promise(function (resolve, reject) {
43883
+ logoImg.onload = function () {
43884
+ return resolve(null);
43885
+ };
43886
+ logoImg.onerror = reject;
43887
+ })).then(function () {
43888
+ ctx.save();
43889
+ roundedPath(overlayX, overlayY, overlaySize, overlaySize, cornerRadius);
43890
+ ctx.clip();
43891
+ ctx.drawImage(logoImg, overlayX, overlayY, overlaySize, overlaySize);
43892
+ ctx.restore();
43893
+ });
43894
+ } else {
43895
+ var _logoRef$current2;
43896
+ var svgElement = (_logoRef$current2 = logoRef.current) === null || _logoRef$current2 === void 0 ? void 0 : _logoRef$current2.querySelector('svg');
43897
+ var _temp6 = function () {
43898
+ if (svgElement) {
43899
+ var serializer = new XMLSerializer();
43900
+ var svgString = serializer.serializeToString(svgElement);
43901
+ if (!/^<svg[^>]+xmlns=/.test(svgString)) {
43902
+ svgString = svgString.replace('<svg', '<svg xmlns="http://www.w3.org/2000/svg"');
43903
+ }
43904
+ var svgBlob = new Blob([svgString], {
43905
+ type: 'image/svg+xml;charset=utf-8'
43906
+ });
43907
+ var svgUrl = URL.createObjectURL(svgBlob);
43908
+ var _logoImg = new Image();
43909
+ _logoImg.src = svgUrl;
43910
+ return Promise.resolve(new Promise(function (resolve, reject) {
43911
+ _logoImg.onload = function () {
43912
+ return resolve(null);
43913
+ };
43914
+ _logoImg.onerror = reject;
43915
+ })).then(function () {
43916
+ ctx.save();
43917
+ roundedPath(overlayX, overlayY, overlaySize, overlaySize, cornerRadius);
43918
+ ctx.clip();
43919
+ ctx.drawImage(_logoImg, overlayX, overlayY, overlaySize, overlaySize);
43920
+ ctx.restore();
43921
+ URL.revokeObjectURL(svgUrl);
43922
+ });
43923
+ }
43924
+ }();
43925
+ if (_temp6 && _temp6.then) return _temp6.then(function () {});
43926
+ }
43927
+ }();
43928
+ return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
43929
+ });
43930
+ });
43931
+ });
43932
+ } catch (e) {
43933
+ return Promise.reject(e);
43934
+ }
43935
+ };
43936
+ return Promise.resolve(toPngBlob()).then(function (_toPngBlob) {
43937
+ blob = _toPngBlob;
43938
+ file = new File([blob], 'invite-qr.png', {
43939
+ type: 'image/png'
43883
43940
  });
43884
- if (_temp2 && _temp2.then) return _temp2.then(function () {});
43885
- }
43886
- }();
43887
- if (_temp3 && _temp3.then) return _temp3.then(function () {});
43888
- }));
43941
+ localUrl = URL.createObjectURL(file);
43942
+ });
43943
+ }
43944
+ }();
43945
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4));
43889
43946
  } catch (e) {
43890
43947
  return Promise.reject(e);
43891
43948
  }