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