sceyt-chat-react-uikit 1.8.9-beta.2 → 1.8.9-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +279 -184
  2. package/index.modern.js +280 -185
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -15702,11 +15702,11 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15702
15702
  var _exit4 = false;
15703
15703
  if (_exit3) return _result3;
15704
15704
  function _temp8(_result4) {
15705
- return _exit4 ? _result4 : Promise.resolve(extractFrameFromUrl(videoSrc, maxWidth, maxHeight, quality)).then(function (direct) {
15705
+ return _exit4 ? _result4 : Promise.resolve(extractFrameFromUrl(videoSrc, scaledMaxWidth, scaledMaxHeight, quality)).then(function (direct) {
15706
15706
  return direct ? direct : _catch(function () {
15707
15707
  return Promise.resolve(fetch(videoSrc)).then(function (response) {
15708
15708
  return Promise.resolve(response.blob()).then(function (blob) {
15709
- return Promise.resolve(_extractFrameFromBlob2(blob, maxWidth, maxHeight, quality));
15709
+ return Promise.resolve(_extractFrameFromBlob2(blob, scaledMaxWidth, scaledMaxHeight, quality));
15710
15710
  });
15711
15711
  });
15712
15712
  }, function (error) {
@@ -15720,7 +15720,7 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15720
15720
  return _catch(function () {
15721
15721
  return Promise.resolve(fetch(videoSrc)).then(function (_fetch) {
15722
15722
  return Promise.resolve(_fetch.blob()).then(function (blob) {
15723
- return Promise.resolve(_extractFrameFromBlob2(blob, maxWidth, maxHeight, quality)).then(function (_await$_extractFrameF2) {
15723
+ return Promise.resolve(_extractFrameFromBlob2(blob, scaledMaxWidth, scaledMaxHeight, quality)).then(function (_await$_extractFrameF2) {
15724
15724
  _exit4 = true;
15725
15725
  return _await$_extractFrameF2;
15726
15726
  });
@@ -15728,7 +15728,7 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15728
15728
  });
15729
15729
  }, function (error) {
15730
15730
  log.warn('getVideoFirstFrame: failed to re-fetch blob url, trying directly', error);
15731
- return Promise.resolve(extractFrameFromUrl(videoSrc, maxWidth, maxHeight, quality)).then(function (_await$extractFrameFr) {
15731
+ return Promise.resolve(extractFrameFromUrl(videoSrc, scaledMaxWidth, scaledMaxHeight, quality)).then(function (_await$extractFrameFr) {
15732
15732
  _exit4 = true;
15733
15733
  return _await$extractFrameFr;
15734
15734
  });
@@ -15737,9 +15737,11 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15737
15737
  }();
15738
15738
  return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
15739
15739
  }
15740
+ var scaledMaxWidth = scaleForDevicePixelRatio(maxWidth);
15741
+ var scaledMaxHeight = scaleForDevicePixelRatio(maxHeight);
15740
15742
  var _temp9 = function () {
15741
15743
  if (videoSrc instanceof Blob) {
15742
- return Promise.resolve(_extractFrameFromBlob2(videoSrc, maxWidth, maxHeight, quality)).then(function (_await$_extractFrameF) {
15744
+ return Promise.resolve(_extractFrameFromBlob2(videoSrc, scaledMaxWidth, scaledMaxHeight, quality)).then(function (_await$_extractFrameF) {
15743
15745
  _exit3 = true;
15744
15746
  return _await$_extractFrameF;
15745
15747
  });
@@ -15754,6 +15756,16 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15754
15756
  return Promise.reject(e);
15755
15757
  }
15756
15758
  };
15759
+ var scaleForDevicePixelRatio = function scaleForDevicePixelRatio(value, cap) {
15760
+ if (cap === void 0) {
15761
+ cap = 2;
15762
+ }
15763
+ if (!value) {
15764
+ return value;
15765
+ }
15766
+ var dpr = Math.min(window.devicePixelRatio || 1, cap);
15767
+ return value * dpr;
15768
+ };
15757
15769
  var normalizeVideoBlob = function normalizeVideoBlob(blob) {
15758
15770
  try {
15759
15771
  return Promise.resolve(inspectVideoBlob(blob)).then(function (info) {
@@ -15984,8 +15996,7 @@ var compressAndCacheImage = function compressAndCacheImage(url, cacheKey, maxWid
15984
15996
  var file = new File([blob], 'image.jpeg', {
15985
15997
  type: blob.type
15986
15998
  });
15987
- var dpr = Math.min(window.devicePixelRatio || 1, 2);
15988
- return Promise.resolve(resizeImageWithPica(file, (maxWidth || 1280) * dpr, (maxHeight || 1080) * dpr, quality || 1)).then(function (_ref2) {
15999
+ return Promise.resolve(resizeImageWithPica(file, scaleForDevicePixelRatio(maxWidth || 1280), scaleForDevicePixelRatio(maxHeight || 1080), quality || 1)).then(function (_ref2) {
15989
16000
  var compressedBlob = _ref2.blob;
15990
16001
  var returningUrl = compressedBlob ? URL.createObjectURL(compressedBlob) : '';
15991
16002
  if (compressedBlob) {
@@ -22903,7 +22914,7 @@ var UploadAvatarButton = styled__default.button(_templateObject23 || (_templateO
22903
22914
  var UploadAvatarHandler = styled__default.div(_templateObject24 || (_templateObject24 = _taggedTemplateLiteralLoose(["\n margin-left: 18px;\n font-size: 13px;\n color: ", ";\n"])), function (props) {
22904
22915
  return props.color;
22905
22916
  });
22906
- var StyledText = styled__default.span(_templateObject25 || (_templateObject25 = _taggedTemplateLiteralLoose(["\n font-weight: ", ";\n font-family: ", ";\n font-style: ", ";\n text-decoration: ", ";\n letter-spacing: ", ";\n\n &.mention {\n color: ", ";\n font-weight: ", ";\n cursor: ", ";\n }\n &.bold {\n font-weight: 600;\n }\n &.italic {\n font-style: italic;\n }\n &.underline {\n text-decoration: underline;\n }\n &.strikethrough {\n text-decoration: line-through;\n }\n &.underline.strikethrough {\n text-decoration: underline line-through;\n }\n &.monospace {\n letter-spacing: 4px;\n }\n"])), function (props) {
22917
+ var StyledText = styled__default.span(_templateObject25 || (_templateObject25 = _taggedTemplateLiteralLoose(["\n font-weight: ", ";\n font-family: ", ";\n font-style: ", ";\n text-decoration: ", ";\n letter-spacing: ", ";\n\n &.mention {\n color: ", ";\n font-weight: ", ";\n cursor: ", ";\n display: inline;\n user-select: text;\n -webkit-user-select: text;\n }\n &.bold {\n font-weight: 600;\n }\n &.italic {\n font-style: italic;\n }\n &.underline {\n text-decoration: underline;\n }\n &.strikethrough {\n text-decoration: line-through;\n }\n &.underline.strikethrough {\n text-decoration: underline line-through;\n }\n &.monospace {\n letter-spacing: 4px;\n }\n"])), function (props) {
22907
22918
  return props.fontWeight || props.isLastMessage && '500';
22908
22919
  }, function (props) {
22909
22920
  return props.fontFamily;
@@ -23092,6 +23103,10 @@ var PendingIconWrapper = styled__default(SvgPendingIcon)(_templateObject5$1 || (
23092
23103
  }, function (props) {
23093
23104
  return props.color;
23094
23105
  });
23106
+ var canActivateMention = function canActivateMention() {
23107
+ var selection = typeof window !== 'undefined' ? window.getSelection() : null;
23108
+ return !selection || selection.isCollapsed;
23109
+ };
23095
23110
  var MessageStatusIcon = function MessageStatusIcon(_ref) {
23096
23111
  var messageStatus = _ref.messageStatus,
23097
23112
  messageStatusDisplayingType = _ref.messageStatusDisplayingType,
@@ -23307,7 +23322,7 @@ var MessageTextFormat = function MessageTextFormat(_ref3) {
23307
23322
  key: attributeOffset + index,
23308
23323
  "data-mention": attribute.metadata,
23309
23324
  onClick: function onClick() {
23310
- if (onMentionNameClick && shouldOpenUserProfileForMention) {
23325
+ if (canActivateMention() && onMentionNameClick && shouldOpenUserProfileForMention) {
23311
23326
  onMentionNameClick(mentionDisplay);
23312
23327
  }
23313
23328
  }
@@ -23321,7 +23336,7 @@ var MessageTextFormat = function MessageTextFormat(_ref3) {
23321
23336
  key: attributeOffset,
23322
23337
  "data-mention": attribute.metadata,
23323
23338
  onClick: function onClick() {
23324
- if (onMentionNameClick && shouldOpenUserProfileForMention) {
23339
+ if (canActivateMention() && onMentionNameClick && shouldOpenUserProfileForMention) {
23325
23340
  onMentionNameClick(mentionDisplay);
23326
23341
  }
23327
23342
  },
@@ -27788,49 +27803,56 @@ function leaveChannel(action) {
27788
27803
  _context24.p = 0;
27789
27804
  payload = action.payload;
27790
27805
  channelId = payload.channelId;
27791
- _context24.n = 1;
27792
- return effects.call(getChannelFromMap, channelId);
27806
+ if (!(store.getState().UserReducer.connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
27807
+ _context24.n = 1;
27808
+ break;
27809
+ }
27810
+ log.warn('Cannot leave channel while offline');
27811
+ return _context24.a(2);
27793
27812
  case 1:
27813
+ _context24.n = 2;
27814
+ return effects.call(getChannelFromMap, channelId);
27815
+ case 2:
27794
27816
  channel = _context24.v;
27795
27817
  if (!channel) {
27796
27818
  channel = getChannelFromAllChannels(channelId);
27797
27819
  }
27798
27820
  if (!channel) {
27799
- _context24.n = 5;
27821
+ _context24.n = 6;
27800
27822
  break;
27801
27823
  }
27802
27824
  if (!(channel.type === DEFAULT_CHANNEL_TYPE.GROUP || channel.type === DEFAULT_CHANNEL_TYPE.PRIVATE)) {
27803
- _context24.n = 2;
27825
+ _context24.n = 3;
27804
27826
  break;
27805
27827
  }
27806
27828
  messageBuilder = channel.createMessageBuilder();
27807
27829
  messageBuilder.setBody('LG').setType('system').setDisplayCount(0).setSilent(true);
27808
27830
  messageToSend = messageBuilder.create();
27809
27831
  log.info('send message for left');
27810
- _context24.n = 2;
27811
- return effects.call(channel.sendMessage, messageToSend);
27812
- case 2:
27813
- log.info('leave');
27814
27832
  _context24.n = 3;
27815
- return effects.call(channel.leave);
27833
+ return effects.call(channel.sendMessage, messageToSend);
27816
27834
  case 3:
27835
+ log.info('leave');
27817
27836
  _context24.n = 4;
27818
- return effects.put(removeChannelAC(channelId));
27837
+ return effects.call(channel.leave);
27819
27838
  case 4:
27820
- deleteChannelFromAllChannels(channelId);
27821
27839
  _context24.n = 5;
27822
- return effects.put(removeChannelCachesAC(channelId));
27840
+ return effects.put(removeChannelAC(channelId));
27823
27841
  case 5:
27824
- _context24.n = 7;
27825
- break;
27842
+ deleteChannelFromAllChannels(channelId);
27843
+ _context24.n = 6;
27844
+ return effects.put(removeChannelCachesAC(channelId));
27826
27845
  case 6:
27827
- _context24.p = 6;
27846
+ _context24.n = 8;
27847
+ break;
27848
+ case 7:
27849
+ _context24.p = 7;
27828
27850
  _t22 = _context24.v;
27829
27851
  log.error('ERROR in leave channel - ', _t22.message);
27830
- case 7:
27852
+ case 8:
27831
27853
  return _context24.a(2);
27832
27854
  }
27833
- }, _marked22$1, null, [[0, 6]]);
27855
+ }, _marked22$1, null, [[0, 7]]);
27834
27856
  }
27835
27857
  function deletePendingDeleteChannels() {
27836
27858
  var pendingDeleteChannels, _iterator10, _step10, channel, resendableError, _t23;
@@ -50628,25 +50650,12 @@ function useFormatMessage(editor, editorState, setMessageBodyAttributes, setMess
50628
50650
  }
50629
50651
  return true;
50630
50652
  }, [editor, contactsMap, setMentionedMember, getFromContacts, activeChannelMembers, processMentionsInPastedText]);
50631
- var onDelete = React.useCallback(function (event) {
50632
- event.preventDefault();
50633
- editor.update(function () {
50634
- var selection = lexical.$getSelection();
50635
- if (lexical.$isRangeSelection(selection)) {
50636
- var node = getSelectedNode(selection);
50637
- if ($isMentionNode(node)) {
50638
- node.remove();
50639
- }
50640
- }
50641
- });
50642
- return false;
50643
- }, [editor]);
50644
50653
  React.useEffect(function () {
50645
50654
  return mergeRegister(editor.registerCommand(lexical.PASTE_COMMAND, function (e) {
50646
50655
  handlePast(e);
50647
50656
  return true;
50648
- }, lexical.COMMAND_PRIORITY_NORMAL), editor.registerCommand(lexical.KEY_DELETE_COMMAND, onDelete, lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(lexical.KEY_BACKSPACE_COMMAND, onDelete, lexical.COMMAND_PRIORITY_LOW));
50649
- }, [editor, handlePast, onDelete]);
50657
+ }, lexical.COMMAND_PRIORITY_NORMAL));
50658
+ }, [editor, handlePast]);
50650
50659
  useDidUpdate(function () {
50651
50660
  if (editorState) {
50652
50661
  editorState.read(function () {
@@ -50985,6 +50994,15 @@ var Emoji$1 = styled__default.li(_templateObject8$l || (_templateObject8$l = _ta
50985
50994
  return props.hoverBackgroundColor;
50986
50995
  });
50987
50996
 
50997
+ var getReplyLinkPreviewImage = function getReplyLinkPreviewImage(attachments) {
50998
+ var _attachments$;
50999
+ var attachment = attachments !== null && attachments !== void 0 && attachments.length && ((_attachments$ = attachments[0]) === null || _attachments$ === void 0 ? void 0 : _attachments$.type) === attachmentTypes.link ? attachments[0] : null;
51000
+ if (!(attachment !== null && attachment !== void 0 && attachment.metadata) || !isJSON(attachment.metadata)) return null;
51001
+ var compactMeta = JSON.parse(attachment.metadata);
51002
+ var imageUrl = compactMeta.iur || null;
51003
+ return !(compactMeta !== null && compactMeta !== void 0 && compactMeta.hld) ? imageUrl : null;
51004
+ };
51005
+
50988
51006
  var CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
50989
51007
 
50990
51008
  var _circle$6, _path$1j;
@@ -51294,8 +51312,10 @@ var AudioRecord = function AudioRecord(_ref) {
51294
51312
  warningColor = _useColor[THEME_COLORS.WARNING],
51295
51313
  iconPrimary = _useColor[THEME_COLORS.ICON_PRIMARY],
51296
51314
  surface1 = _useColor[THEME_COLORS.SURFACE_1],
51315
+ textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
51297
51316
  iconInactive = _useColor[THEME_COLORS.ICON_INACTIVE],
51298
- textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY];
51317
+ textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY],
51318
+ background = _useColor[THEME_COLORS.BACKGROUND];
51299
51319
  var _useState = React.useState(null),
51300
51320
  recording = _useState[0],
51301
51321
  setStartRecording = _useState[1];
@@ -51323,6 +51343,9 @@ var AudioRecord = function AudioRecord(_ref) {
51323
51343
  var _useState9 = React.useState(false),
51324
51344
  playAudio = _useState9[0],
51325
51345
  setPlayAudio = _useState9[1];
51346
+ var _useState0 = React.useState(false),
51347
+ microphonePermissionDenied = _useState0[0],
51348
+ setMicrophonePermissionDenied = _useState0[1];
51326
51349
  var recordButtonRef = React.useRef(null);
51327
51350
  var audioElements = React.useRef({});
51328
51351
  var intervalRef = React.useRef({});
@@ -51412,27 +51435,21 @@ var AudioRecord = function AudioRecord(_ref) {
51412
51435
  var startRecording = function startRecording(cId) {
51413
51436
  try {
51414
51437
  var id = cId || currentChannelId;
51415
- var _temp = _catch(function () {
51416
- return Promise.resolve(navigator.permissions.query({
51417
- name: 'microphone'
51418
- })).then(function (permissionStatus) {
51419
- if (permissionStatus.state === 'granted') {
51420
- setShowRecording(true);
51421
- } else {
51422
- recordButtonRef.current.style.pointerEvents = 'none';
51423
- }
51424
- if (recording) {
51425
- stopRecording(true, id, false, recorder);
51426
- } else if (currentRecordedFile) {
51427
- removeAudioRecordingFromMap(id);
51428
- setRecordedFile(null);
51429
- setPlayAudio(false);
51430
- cleanupAudioElement(id);
51431
- setStartRecording(false);
51432
- setShowRecording(false);
51433
- dispatch(setChannelDraftMessageIsRemovedAC(id));
51434
- sendRecordedFile(currentRecordedFile, id);
51435
- } else {
51438
+ try {
51439
+ if (recording) {
51440
+ stopRecording(true, id, false, recorder);
51441
+ } else if (currentRecordedFile) {
51442
+ removeAudioRecordingFromMap(id);
51443
+ setRecordedFile(null);
51444
+ setPlayAudio(false);
51445
+ cleanupAudioElement(id);
51446
+ setStartRecording(false);
51447
+ setShowRecording(false);
51448
+ dispatch(setChannelDraftMessageIsRemovedAC(id));
51449
+ sendRecordedFile(currentRecordedFile, id);
51450
+ } else {
51451
+ if (!recorder) return Promise.resolve();
51452
+ recorder.start().then(function () {
51436
51453
  handleStartRecording();
51437
51454
  setAudioRecordingToMap(id, {
51438
51455
  file: null,
@@ -51440,96 +51457,97 @@ var AudioRecord = function AudioRecord(_ref) {
51440
51457
  thumb: null,
51441
51458
  dur: 0
51442
51459
  });
51443
- recorder.start().then(function () {
51444
- recordButtonRef.current.style.pointerEvents = 'initial';
51445
- setShowRecording(true);
51446
- setStartRecording(true);
51447
- shouldDraw = true;
51448
- var stream = recorder.activeStream;
51449
- var obj = {};
51450
- var init = function init() {
51451
- obj.canvas = document.getElementById("waveform-" + id);
51452
- obj.ctx = obj.canvas.getContext('2d');
51453
- obj.width = 360;
51454
- obj.height = 28;
51455
- obj.canvas.width = obj.width;
51456
- obj.canvas.height = obj.height;
51457
- obj.canvas.style.width = obj.width + 'px';
51458
- obj.canvas.style.height = obj.height + 'px';
51459
- };
51460
- var timeOffset = 100;
51461
- var now = parseInt(performance.now()) / timeOffset;
51462
- var _loop = function loop() {
51463
- if (!shouldDraw) {
51464
- obj.x = 0;
51465
- obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
51466
- if (obj.audioContext && obj.audioContext.state !== 'closed') {
51467
- obj.audioContext.close()["catch"](function () {
51468
- return undefined;
51469
- });
51470
- }
51471
- return;
51472
- }
51460
+ setShowRecording(true);
51461
+ setStartRecording(true);
51462
+ shouldDraw = true;
51463
+ var stream = recorder.activeStream;
51464
+ var obj = {};
51465
+ var init = function init() {
51466
+ obj.canvas = document.getElementById("waveform-" + id);
51467
+ obj.ctx = obj.canvas.getContext('2d');
51468
+ obj.width = 360;
51469
+ obj.height = 28;
51470
+ obj.canvas.width = obj.width;
51471
+ obj.canvas.height = obj.height;
51472
+ obj.canvas.style.width = obj.width + 'px';
51473
+ obj.canvas.style.height = obj.height + 'px';
51474
+ };
51475
+ var timeOffset = 100;
51476
+ var now = parseInt(performance.now()) / timeOffset;
51477
+ var _loop = function loop() {
51478
+ if (!shouldDraw) {
51479
+ obj.x = 0;
51473
51480
  obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
51474
- var max = 0;
51475
- if (parseInt(performance.now() / timeOffset) > now) {
51476
- now = parseInt(performance.now() / timeOffset);
51477
- obj.analyser.getFloatTimeDomainData(obj.frequencyArray);
51478
- for (var i = 0; i < obj.frequencyArray.length; i++) {
51479
- if (obj.frequencyArray[i] > max) {
51480
- max = obj.frequencyArray[i];
51481
- }
51482
- }
51483
- var freq = Math.floor(max * 90);
51484
- if (freq === 0) {
51485
- freq = 1;
51486
- }
51487
- obj.bars.push({
51488
- x: obj.width,
51489
- y: obj.height / 2 - freq / 2,
51490
- height: freq,
51491
- width: 3
51481
+ if (obj.audioContext && obj.audioContext.state !== 'closed') {
51482
+ obj.audioContext.close()["catch"](function () {
51483
+ return undefined;
51492
51484
  });
51493
51485
  }
51494
- draw();
51495
- requestAnimationFrame(_loop);
51496
- };
51497
- obj.bars = [];
51498
- var draw = function draw() {
51499
- for (var i = 0; i < obj.bars.length; i++) {
51500
- var bar = obj.bars[i];
51501
- obj.ctx.fillStyle = textSecondary;
51502
- obj.ctx.fillRect(bar.x, bar.y, bar.width, bar.height);
51503
- bar.x = bar.x - 1;
51504
- if (bar.x < 1) {
51505
- obj.bars.splice(i, 1);
51486
+ return;
51487
+ }
51488
+ obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
51489
+ var max = 0;
51490
+ if (parseInt(performance.now() / timeOffset) > now) {
51491
+ now = parseInt(performance.now() / timeOffset);
51492
+ obj.analyser.getFloatTimeDomainData(obj.frequencyArray);
51493
+ for (var i = 0; i < obj.frequencyArray.length; i++) {
51494
+ if (obj.frequencyArray[i] > max) {
51495
+ max = obj.frequencyArray[i];
51506
51496
  }
51507
51497
  }
51508
- };
51509
- var soundAllowed = function soundAllowed(stream) {
51510
- var AudioContext = window.AudioContext || window.webkitAudioContext;
51511
- var audioContent = new AudioContext();
51512
- obj.audioContext = audioContent;
51513
- var streamSource = audioContent.createMediaStreamSource(stream);
51514
- obj.analyser = audioContent.createAnalyser();
51515
- streamSource.connect(obj.analyser);
51516
- obj.analyser.fftSize = 512;
51517
- obj.frequencyArray = new Float32Array(obj.analyser.fftSize);
51518
- init();
51519
- _loop();
51520
- };
51521
- soundAllowed(stream);
51522
- })["catch"](function (e) {
51523
- handleStopRecording();
51524
- log.error(e);
51525
- });
51526
- }
51527
- });
51528
- }, function (e) {
51529
- handleStopRecording();
51498
+ var freq = Math.floor(max * 90);
51499
+ if (freq === 0) {
51500
+ freq = 1;
51501
+ }
51502
+ obj.bars.push({
51503
+ x: obj.width,
51504
+ y: obj.height / 2 - freq / 2,
51505
+ height: freq,
51506
+ width: 3
51507
+ });
51508
+ }
51509
+ draw();
51510
+ requestAnimationFrame(_loop);
51511
+ };
51512
+ obj.bars = [];
51513
+ var draw = function draw() {
51514
+ for (var i = 0; i < obj.bars.length; i++) {
51515
+ var bar = obj.bars[i];
51516
+ obj.ctx.fillStyle = textSecondary;
51517
+ obj.ctx.fillRect(bar.x, bar.y, bar.width, bar.height);
51518
+ bar.x = bar.x - 1;
51519
+ if (bar.x < 1) {
51520
+ obj.bars.splice(i, 1);
51521
+ }
51522
+ }
51523
+ };
51524
+ var soundAllowed = function soundAllowed(stream) {
51525
+ var AudioContext = window.AudioContext || window.webkitAudioContext;
51526
+ var audioContent = new AudioContext();
51527
+ obj.audioContext = audioContent;
51528
+ var streamSource = audioContent.createMediaStreamSource(stream);
51529
+ obj.analyser = audioContent.createAnalyser();
51530
+ streamSource.connect(obj.analyser);
51531
+ obj.analyser.fftSize = 512;
51532
+ obj.frequencyArray = new Float32Array(obj.analyser.fftSize);
51533
+ init();
51534
+ _loop();
51535
+ };
51536
+ soundAllowed(stream);
51537
+ })["catch"](function (e) {
51538
+ if ((e === null || e === void 0 ? void 0 : e.name) === 'NotAllowedError' || (e === null || e === void 0 ? void 0 : e.name) === 'PermissionDeniedError') {
51539
+ setMicrophonePermissionDenied(true);
51540
+ }
51541
+ log.error(e);
51542
+ });
51543
+ }
51544
+ } catch (e) {
51545
+ if ((e === null || e === void 0 ? void 0 : e.name) === 'NotAllowedError' || (e === null || e === void 0 ? void 0 : e.name) === 'PermissionDeniedError') {
51546
+ setMicrophonePermissionDenied(true);
51547
+ }
51530
51548
  log.error(e);
51531
- });
51532
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
51549
+ }
51550
+ return Promise.resolve();
51533
51551
  } catch (e) {
51534
51552
  return Promise.reject(e);
51535
51553
  }
@@ -51854,7 +51872,36 @@ var AudioRecord = function AudioRecord(_ref) {
51854
51872
  return startRecording(currentChannelId);
51855
51873
  },
51856
51874
  iconColor: accentColor
51857
- }, showRecording || currentRecordedFile ? /*#__PURE__*/React__default.createElement(SvgSend, null) : /*#__PURE__*/React__default.createElement(SvgRecordButton, null)));
51875
+ }, showRecording || currentRecordedFile ? /*#__PURE__*/React__default.createElement(SvgSend, null) : /*#__PURE__*/React__default.createElement(SvgRecordButton, null)), microphonePermissionDenied && (/*#__PURE__*/React__default.createElement(PopupContainer, null, /*#__PURE__*/React__default.createElement(Popup, {
51876
+ backgroundColor: background,
51877
+ maxWidth: '520px',
51878
+ minWidth: '520px',
51879
+ padding: '0'
51880
+ }, /*#__PURE__*/React__default.createElement(PopupBody, {
51881
+ paddingH: '24px',
51882
+ paddingV: '24px'
51883
+ }, /*#__PURE__*/React__default.createElement(CloseIcon, {
51884
+ color: iconPrimary,
51885
+ onClick: function onClick() {
51886
+ return setMicrophonePermissionDenied(false);
51887
+ }
51888
+ }), /*#__PURE__*/React__default.createElement(PopupName, {
51889
+ color: textPrimary,
51890
+ marginBottom: '20px'
51891
+ }, "Microphone Permission Denied"), /*#__PURE__*/React__default.createElement(PopupDescription, {
51892
+ color: textPrimary,
51893
+ highlightColor: textSecondary
51894
+ }, "We can't access your microphone. Enable microphone permission in your browser settings and try again.")), /*#__PURE__*/React__default.createElement(PopupFooter, {
51895
+ backgroundColor: surface1
51896
+ }, /*#__PURE__*/React__default.createElement(Button, {
51897
+ type: 'button',
51898
+ backgroundColor: accentColor,
51899
+ color: textOnPrimary,
51900
+ borderRadius: '8px',
51901
+ onClick: function onClick() {
51902
+ return setMicrophonePermissionDenied(false);
51903
+ }
51904
+ }, "Close"))))));
51858
51905
  };
51859
51906
  var AudioRecord$1 = /*#__PURE__*/React.memo(AudioRecord, function (prevProps, nextProps) {
51860
51907
  return prevProps.channelId === nextProps.channelId && prevProps.showRecording === nextProps.showRecording && prevProps.maxRecordingDuration === nextProps.maxRecordingDuration && prevProps.showViewOnceToggle === nextProps.showViewOnceToggle && prevProps.viewOnce === nextProps.viewOnce && prevProps.ViewOnceSelectedSVGIcon === nextProps.ViewOnceSelectedSVGIcon && prevProps.ViewOnceNotSelectedSVGIcon === nextProps.ViewOnceNotSelectedSVGIcon;
@@ -52379,7 +52426,7 @@ var SettingItem = styled__default.div(_templateObject9$i || (_templateObject9$i
52379
52426
  return props.color;
52380
52427
  });
52381
52428
 
52382
- var _templateObject$W, _templateObject2$R, _templateObject3$I, _templateObject4$C, _templateObject5$x, _templateObject6$t, _templateObject7$q, _templateObject8$n, _templateObject9$j, _templateObject0$h, _templateObject1$f, _templateObject10$c, _templateObject11$9, _templateObject12$7, _templateObject13$6, _templateObject14$4, _templateObject15$2, _templateObject16$2, _templateObject17$2, _templateObject18$2, _templateObject19$2, _templateObject20$2, _templateObject21$2, _templateObject22$1, _templateObject23$1, _templateObject24$1, _templateObject25$1, _templateObject26$1, _templateObject27$1, _templateObject28$1, _templateObject29$1, _templateObject30$1, _templateObject31$1, _templateObject32$1, _templateObject33$1, _templateObject34$1, _templateObject35$1, _templateObject36$1, _templateObject37$1, _templateObject38$1, _templateObject39$1, _templateObject40$1, _templateObject41$1, _templateObject42, _templateObject43, _templateObject44, _templateObject45;
52429
+ var _templateObject$W, _templateObject2$R, _templateObject3$I, _templateObject4$C, _templateObject5$x, _templateObject6$t, _templateObject7$q, _templateObject8$n, _templateObject9$j, _templateObject0$h, _templateObject1$f, _templateObject10$c, _templateObject11$9, _templateObject12$7, _templateObject13$6, _templateObject14$4, _templateObject15$2, _templateObject16$2, _templateObject17$2, _templateObject18$2, _templateObject19$2, _templateObject20$2, _templateObject21$2, _templateObject22$1, _templateObject23$1, _templateObject24$1, _templateObject25$1, _templateObject26$1, _templateObject27$1, _templateObject28$1, _templateObject29$1, _templateObject30$1, _templateObject31$1, _templateObject32$1, _templateObject33$1, _templateObject34$1, _templateObject35$1, _templateObject36$1, _templateObject37$1, _templateObject38$1, _templateObject39$1, _templateObject40$1, _templateObject41$1, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46;
52383
52430
  function AutoFocusPlugin(_ref) {
52384
52431
  var messageForReply = _ref.messageForReply;
52385
52432
  var _useLexicalComposerCo = LexicalComposerContext.useLexicalComposerContext(),
@@ -53238,10 +53285,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53238
53285
  }
53239
53286
  }
53240
53287
  };
53241
- var handleCut = function handleCut() {
53242
- setMessageText('');
53243
- setMentionedUsers([]);
53244
- };
53245
53288
  var handleEmojiPopupToggle = function handleEmojiPopupToggle(bool) {
53246
53289
  setIsEmojisOpened(bool);
53247
53290
  };
@@ -53833,7 +53876,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53833
53876
  }, 800);
53834
53877
  }
53835
53878
  messageContRef.current.addEventListener('paste', handlePastAttachments);
53836
- messageContRef.current.addEventListener('cut', handleCut);
53837
53879
  document.addEventListener('mousedown', handleClick);
53838
53880
  return function () {
53839
53881
  if (inputHeightTimeout) {
@@ -53843,7 +53885,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53843
53885
  document.removeEventListener('mousedown', handleClick);
53844
53886
  if (messageContRef && messageContRef.current) {
53845
53887
  messageContRef.current.removeEventListener('paste', handlePastAttachments);
53846
- messageContRef.current.removeEventListener('cut', handleCut);
53847
53888
  }
53848
53889
  };
53849
53890
  }, []);
@@ -54021,14 +54062,23 @@ var SendMessageInput = function SendMessageInput(_ref3) {
54021
54062
  attachment: messageForReply.attachments[0],
54022
54063
  backgroundColor: selectedFileAttachmentsBoxBackground || '',
54023
54064
  isRepliedMessage: true
54024
- })) : messageForReply.attachments[0].type === attachmentTypes.file && (/*#__PURE__*/React__default.createElement(ReplyIconWrapper, {
54065
+ })) : getReplyLinkPreviewImage(messageForReply.attachments) ? (/*#__PURE__*/React__default.createElement(LinkPreviewImage, {
54066
+ bg: background,
54067
+ src: getReplyLinkPreviewImage(messageForReply.attachments),
54068
+ alt: 'Link preview'
54069
+ })) : messageForReply.attachments[0].type === attachmentTypes.link ? (/*#__PURE__*/React__default.createElement(LinkPreviewIconWrapper, {
54070
+ bg: background
54071
+ }, /*#__PURE__*/React__default.createElement(LinkPreviewIcon, {
54072
+ color: accentColor,
54073
+ bg: background
54074
+ }))) : messageForReply.attachments[0].type === attachmentTypes.file && (/*#__PURE__*/React__default.createElement(ReplyIconWrapper, {
54025
54075
  backgroundColor: accentColor,
54026
54076
  iconColor: textOnPrimary
54027
54077
  }, /*#__PURE__*/React__default.createElement(SvgChoseFile, null)))), /*#__PURE__*/React__default.createElement(ReplyMessageBody$1, {
54028
54078
  linkColor: accentColor
54029
54079
  }, /*#__PURE__*/React__default.createElement(EditReplyMessageHeader, {
54030
54080
  color: accentColor
54031
- }, replyMessageIcon || /*#__PURE__*/React__default.createElement(SvgReplyIcon, null), " Reply to", /*#__PURE__*/React__default.createElement(UserName$1, null, user.id === messageForReply.user.id ? user.firstName ? user.firstName + " " + user.lastName : user.id : makeUsername(contactsMap[messageForReply.user.id], messageForReply.user, getFromContacts))), messageForReply.attachments && messageForReply.attachments.length ? messageForReply.attachments[0].type === attachmentTypes.voice ? (/*#__PURE__*/React__default.createElement(TextInOneLine, null, (messageForReply === null || messageForReply === void 0 ? void 0 : messageForReply.viewOnce) && /*#__PURE__*/React__default.createElement(SvgViewOnceLastMessage, {
54081
+ }, replyMessageIcon || /*#__PURE__*/React__default.createElement(SvgReplyIcon, null), user.id === messageForReply.user.id ? ' Reply You' : (/*#__PURE__*/React__default.createElement("span", null, ' Reply to', /*#__PURE__*/React__default.createElement(UserName$1, null, makeUsername(contactsMap[messageForReply.user.id], messageForReply.user, getFromContacts))))), messageForReply.attachments && messageForReply.attachments.length ? messageForReply.attachments[0].type === attachmentTypes.voice ? (/*#__PURE__*/React__default.createElement(TextInOneLine, null, (messageForReply === null || messageForReply === void 0 ? void 0 : messageForReply.viewOnce) && /*#__PURE__*/React__default.createElement(SvgViewOnceLastMessage, {
54032
54082
  style: {
54033
54083
  margin: '0 4px -3px 0'
54034
54084
  }
@@ -54383,7 +54433,7 @@ var MessageInputWrapper = styled__default.div(_templateObject12$7 || (_templateO
54383
54433
  }, function (props) {
54384
54434
  return props.borderRadius || '18px';
54385
54435
  });
54386
- var LexicalWrapper = styled__default.div(_templateObject13$6 || (_templateObject13$6 = _taggedTemplateLiteralLoose(["\n position: relative;\n width: 100%;\n\n & .rich_text_editor {\n width: 100%;\n max-height: 80px;\n min-height: 20px;\n display: block;\n border: none;\n box-sizing: border-box;\n outline: none !important;\n border-radius: ", ";\n background-color: ", ";\n padding: ", ";\n color: ", ";\n order: ", ";\n overflow-y: auto;\n overflow-x: hidden;\n scrollbar-width: none;\n scrollbar-color: transparent transparent;\n overscroll-behavior: none;\n\n @supports (overflow: overlay) {\n overflow-y: overlay;\n }\n\n &::-webkit-scrollbar {\n width: 8px;\n background: transparent;\n }\n &::-webkit-scrollbar-thumb {\n background: transparent;\n }\n\n &.show-scrollbar::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 4px;\n }\n &.show-scrollbar::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &.show-scrollbar {\n scrollbar-width: thin;\n scrollbar-color: ", " transparent;\n }\n\n & p {\n font-size: 15px;\n line-height: 20px;\n color: ", ";\n }\n\n &::selection {\n background-color: ", ";\n }\n\n & *::selection {\n background-color: ", ";\n }\n\n & span::selection {\n background-color: ", ";\n }\n\n &:empty:before {\n content: attr(data-placeholder);\n }\n\n & .content_editable_input {\n border: none !important;\n outline: none !important;\n }\n\n & .mention {\n color: ", ";\n background-color: inherit !important;\n user-modify: read-only;\n }\n\n & span.bold {\n font-weight: bold;\n }\n\n & .editor_paragraph {\n margin: 0;\n }\n\n & .text_bold {\n font-weight: 600;\n }\n\n & .text_italic {\n font-style: italic;\n }\n\n & .text_underline {\n text-decoration: underline;\n }\n\n & .text_strikethrough {\n text-decoration: line-through;\n }\n\n & .text_underlineStrikethrough {\n text-decoration: underline line-through;\n }\n\n & code {\n font-family: inherit;\n letter-spacing: 4px;\n }\n }\n"])), function (props) {
54436
+ var LexicalWrapper = styled__default.div(_templateObject13$6 || (_templateObject13$6 = _taggedTemplateLiteralLoose(["\n position: relative;\n width: 100%;\n\n & .rich_text_editor {\n width: 100%;\n max-height: 80px;\n min-height: 20px;\n display: block;\n border: none;\n box-sizing: border-box;\n outline: none !important;\n border-radius: ", ";\n background-color: ", ";\n padding: ", ";\n color: ", ";\n order: ", ";\n overflow-y: auto;\n overflow-x: hidden;\n scrollbar-width: none;\n scrollbar-color: transparent transparent;\n overscroll-behavior: none;\n\n @supports (overflow: overlay) {\n overflow-y: overlay;\n }\n\n &::-webkit-scrollbar {\n width: 8px;\n background: transparent;\n }\n &::-webkit-scrollbar-thumb {\n background: transparent;\n }\n\n &.show-scrollbar::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 4px;\n }\n &.show-scrollbar::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &.show-scrollbar {\n scrollbar-width: thin;\n scrollbar-color: ", " transparent;\n }\n\n & p {\n font-size: 15px;\n line-height: 20px;\n color: ", ";\n }\n\n &::selection {\n background-color: ", ";\n }\n\n & *::selection {\n background-color: ", ";\n }\n\n & span::selection {\n background-color: ", ";\n }\n\n &:empty:before {\n content: attr(data-placeholder);\n }\n\n & .content_editable_input {\n border: none !important;\n outline: none !important;\n }\n\n & .mention {\n color: ", ";\n background-color: inherit !important;\n user-select: text;\n -webkit-user-select: text;\n }\n\n & span.bold {\n font-weight: bold;\n }\n\n & .editor_paragraph {\n margin: 0;\n }\n\n & .text_bold {\n font-weight: 600;\n }\n\n & .text_italic {\n font-style: italic;\n }\n\n & .text_underline {\n text-decoration: underline;\n }\n\n & .text_strikethrough {\n text-decoration: line-through;\n }\n\n & .text_underlineStrikethrough {\n text-decoration: underline line-through;\n }\n\n & code {\n font-family: inherit;\n letter-spacing: 4px;\n }\n }\n"])), function (props) {
54387
54437
  return props.borderRadius;
54388
54438
  }, function (props) {
54389
54439
  return props.backgroundColor;
@@ -54491,19 +54541,24 @@ var LinkPreviewContainer = styled__default.div(_templateObject39$1 || (_template
54491
54541
  return props.isClosing ? linkPreviewSlideOut : linkPreviewSlideIn;
54492
54542
  });
54493
54543
  var LinkPreviewContent = styled__default.div(_templateObject40$1 || (_templateObject40$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: 12px;\n flex: 1;\n overflow: hidden;\n"])));
54494
- var LinkPreviewImage = styled__default.img(_templateObject41$1 || (_templateObject41$1 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n object-fit: cover;\n border-radius: 8px;\n flex-shrink: 0;\n"])));
54544
+ var LinkPreviewImage = styled__default.img(_templateObject41$1 || (_templateObject41$1 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n object-fit: cover;\n border-radius: 4px;\n flex-shrink: 0;\n margin-right: 8px;\n background: ", ";\n"])), function (props) {
54545
+ return props.bg;
54546
+ });
54495
54547
  var LinkPreviewIcon = styled__default(SvgLinkIcon)(_templateObject42 || (_templateObject42 = _taggedTemplateLiteralLoose(["\n color: ", ";\n rect {\n fill: ", ";\n fill-opacity: 1;\n }\n"])), function (props) {
54496
54548
  return props.color;
54497
54549
  }, function (props) {
54498
54550
  return props.bg;
54499
54551
  });
54500
- var LinkPreviewTextContent = styled__default.div(_templateObject43 || (_templateObject43 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 4px;\n overflow: hidden;\n flex: 1;\n justify-content: center;\n ", "\n"])), function (props) {
54552
+ var LinkPreviewIconWrapper = styled__default.div(_templateObject43 || (_templateObject43 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n border-radius: 4px;\n margin-right: 8px;\n background: ", ";\n"])), function (props) {
54553
+ return props.bg;
54554
+ });
54555
+ var LinkPreviewTextContent = styled__default.div(_templateObject44 || (_templateObject44 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 4px;\n overflow: hidden;\n flex: 1;\n justify-content: center;\n ", "\n"])), function (props) {
54501
54556
  return props.hasImage ? '' : 'padding-left: 0;';
54502
54557
  });
54503
- var LinkPreviewTitle = styled__default.div(_templateObject44 || (_templateObject44 = _taggedTemplateLiteralLoose(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: Inter;\n font-weight: 500;\n font-size: 13px;\n line-height: 16px;\n letter-spacing: 0px;\n"])), function (props) {
54558
+ var LinkPreviewTitle = styled__default.div(_templateObject45 || (_templateObject45 = _taggedTemplateLiteralLoose(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: Inter;\n font-weight: 500;\n font-size: 13px;\n line-height: 16px;\n letter-spacing: 0px;\n"])), function (props) {
54504
54559
  return props.color;
54505
54560
  });
54506
- var LinkPreviewDescription = styled__default.div(_templateObject45 || (_templateObject45 = _taggedTemplateLiteralLoose(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n font-weight: 400;\n font-size: 15px;\n line-height: 20px;\n letter-spacing: -0.2px;\n"])), function (props) {
54561
+ var LinkPreviewDescription = styled__default.div(_templateObject46 || (_templateObject46 = _taggedTemplateLiteralLoose(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n font-weight: 400;\n font-size: 15px;\n line-height: 20px;\n letter-spacing: -0.2px;\n"])), function (props) {
54507
54562
  return props.color;
54508
54563
  });
54509
54564
 
@@ -55336,12 +55391,14 @@ var Actions = function Actions(_ref) {
55336
55391
  commonGroupsTextColor = _ref.commonGroupsTextColor,
55337
55392
  showGroupsInCommon = _ref.showGroupsInCommon;
55338
55393
  var _useColor = useColors(),
55394
+ accentColor = _useColor[THEME_COLORS.ACCENT],
55339
55395
  textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
55340
55396
  textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY],
55341
55397
  iconPrimary = _useColor[THEME_COLORS.ICON_PRIMARY],
55342
55398
  surface1 = _useColor[THEME_COLORS.SURFACE_1],
55343
55399
  warningColor = _useColor[THEME_COLORS.WARNING],
55344
- backgroundColor = _useColor[THEME_COLORS.BACKGROUND];
55400
+ backgroundColor = _useColor[THEME_COLORS.BACKGROUND],
55401
+ textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY];
55345
55402
  var ChatClient = getClient();
55346
55403
  var user = ChatClient.user;
55347
55404
  var _useState = React.useState(false),
@@ -55354,35 +55411,39 @@ var Actions = function Actions(_ref) {
55354
55411
  leaveChannelPopupOpen = _useState3[0],
55355
55412
  setLeaveChannelPopupOpen = _useState3[1];
55356
55413
  var _useState4 = React.useState(false),
55357
- deleteChannelPopupOpen = _useState4[0],
55358
- setDeleteChannelPopupOpen = _useState4[1];
55414
+ leaveChannelOfflinePopupOpen = _useState4[0],
55415
+ setLeaveChannelOfflinePopupOpen = _useState4[1];
55359
55416
  var _useState5 = React.useState(false),
55360
- blockChannelPopupOpen = _useState5[0],
55361
- setBlockChannelPopupOpen = _useState5[1];
55417
+ deleteChannelPopupOpen = _useState5[0],
55418
+ setDeleteChannelPopupOpen = _useState5[1];
55362
55419
  var _useState6 = React.useState(false),
55363
- blockUserPopupOpen = _useState6[0],
55364
- setBlockUserPopupOpen = _useState6[1];
55420
+ blockChannelPopupOpen = _useState6[0],
55421
+ setBlockChannelPopupOpen = _useState6[1];
55365
55422
  var _useState7 = React.useState(false),
55366
- unblockUserPopupOpen = _useState7[0],
55367
- setUnblockUserPopupOpen = _useState7[1];
55423
+ blockUserPopupOpen = _useState7[0],
55424
+ setBlockUserPopupOpen = _useState7[1];
55368
55425
  var _useState8 = React.useState(false),
55369
- reportUserPopupOpen = _useState8[0],
55370
- setReportUserPopupOpen = _useState8[1];
55426
+ unblockUserPopupOpen = _useState8[0],
55427
+ setUnblockUserPopupOpen = _useState8[1];
55371
55428
  var _useState9 = React.useState(false),
55372
- disappearingMessagesPopupOpen = _useState9[0],
55373
- setDisappearingMessagesPopupOpen = _useState9[1];
55429
+ reportUserPopupOpen = _useState9[0],
55430
+ setReportUserPopupOpen = _useState9[1];
55374
55431
  var _useState0 = React.useState(false),
55375
- groupsInCommonPopupOpen = _useState0[0],
55376
- setGroupsInCommonPopupOpen = _useState0[1];
55432
+ disappearingMessagesPopupOpen = _useState0[0],
55433
+ setDisappearingMessagesPopupOpen = _useState0[1];
55434
+ var _useState1 = React.useState(false),
55435
+ groupsInCommonPopupOpen = _useState1[0],
55436
+ setGroupsInCommonPopupOpen = _useState1[1];
55377
55437
  var _usePermissions = usePermissions(channel.userRole),
55378
55438
  checkActionPermission = _usePermissions[0];
55379
- var _useState1 = React.useState(''),
55380
- popupButtonText = _useState1[0],
55381
- setPopupButtonText = _useState1[1];
55382
55439
  var _useState10 = React.useState(''),
55383
- popupTitle = _useState10[0],
55384
- setPopupTitle = _useState10[1];
55440
+ popupButtonText = _useState10[0],
55441
+ setPopupButtonText = _useState10[1];
55442
+ var _useState11 = React.useState(''),
55443
+ popupTitle = _useState11[0],
55444
+ setPopupTitle = _useState11[1];
55385
55445
  var dispatch = useDispatch();
55446
+ var connectionStatus = useSelector(connectionStatusSelector);
55386
55447
  var oneHour = 60 * 60 * 1000;
55387
55448
  var twoHours = oneHour * 2;
55388
55449
  var oneDay = oneHour * 24;
@@ -55427,6 +55488,10 @@ var Actions = function Actions(_ref) {
55427
55488
  }
55428
55489
  };
55429
55490
  var handleLeaveChannel = function handleLeaveChannel() {
55491
+ if (connectionStatus !== CONNECTION_STATUS.CONNECTED) {
55492
+ setLeaveChannelOfflinePopupOpen(true);
55493
+ return;
55494
+ }
55430
55495
  dispatch(leaveChannelAC(channel.id));
55431
55496
  };
55432
55497
  var handleDeleteChannel = function handleDeleteChannel() {
@@ -55728,7 +55793,37 @@ var Actions = function Actions(_ref) {
55728
55793
  buttonText: popupButtonText,
55729
55794
  description: channel.type === DEFAULT_CHANNEL_TYPE.GROUP || channel.type === DEFAULT_CHANNEL_TYPE.PRIVATE ? 'Once you leave this group it will be removed for you along with its entire history.' : 'Once you leave this channel it will be removed for you along with its entire history.',
55730
55795
  title: popupTitle
55731
- })), deleteChannelPopupOpen && (/*#__PURE__*/React__default.createElement(ConfirmPopup, {
55796
+ })), leaveChannelOfflinePopupOpen && (/*#__PURE__*/React__default.createElement(PopupContainer, null, /*#__PURE__*/React__default.createElement(Popup, {
55797
+ backgroundColor: backgroundColor,
55798
+ maxWidth: '520px',
55799
+ minWidth: '520px',
55800
+ padding: '0'
55801
+ }, /*#__PURE__*/React__default.createElement(PopupBody, {
55802
+ paddingH: '24px',
55803
+ paddingV: '24px'
55804
+ }, /*#__PURE__*/React__default.createElement(CloseIcon, {
55805
+ color: iconPrimary,
55806
+ onClick: function onClick() {
55807
+ return setLeaveChannelOfflinePopupOpen(false);
55808
+ }
55809
+ }), /*#__PURE__*/React__default.createElement(PopupName, {
55810
+ color: textPrimary,
55811
+ isDelete: true,
55812
+ marginBottom: '20px'
55813
+ }, "Failed to leave group"), /*#__PURE__*/React__default.createElement(PopupDescription, {
55814
+ color: textPrimary,
55815
+ highlightColor: textSecondary
55816
+ }, "You\u2019re offline. Reconnect and try again.")), /*#__PURE__*/React__default.createElement(PopupFooter, {
55817
+ backgroundColor: surface1
55818
+ }, /*#__PURE__*/React__default.createElement(Button, {
55819
+ type: 'button',
55820
+ backgroundColor: accentColor,
55821
+ color: textOnPrimary,
55822
+ borderRadius: '8px',
55823
+ onClick: function onClick() {
55824
+ return setLeaveChannelOfflinePopupOpen(false);
55825
+ }
55826
+ }, "Close"))))), deleteChannelPopupOpen && (/*#__PURE__*/React__default.createElement(ConfirmPopup, {
55732
55827
  handleFunction: handleDeleteChannel,
55733
55828
  togglePopup: handleToggleDeleteChannelPopupOpen,
55734
55829
  buttonText: popupButtonText,