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.modern.js CHANGED
@@ -13,7 +13,7 @@ import Cropper from 'react-easy-crop';
13
13
  import { CircularProgressbar } from 'react-circular-progressbar';
14
14
  import { FFmpeg } from '@ffmpeg/ffmpeg';
15
15
  import { toBlobURL, fetchFile } from '@ffmpeg/util';
16
- import { $applyNodeReplacement, TextNode, $createTextNode, $getSelection, $isRangeSelection, $isTextNode, FORMAT_TEXT_COMMAND, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_LOW, $getRoot, $createParagraphNode, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, PASTE_COMMAND, COMMAND_PRIORITY_NORMAL } from 'lexical';
16
+ import { $applyNodeReplacement, TextNode, $createTextNode, $getSelection, $isRangeSelection, $isTextNode, FORMAT_TEXT_COMMAND, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_LOW, $getRoot, $createParagraphNode, PASTE_COMMAND, COMMAND_PRIORITY_NORMAL } from 'lexical';
17
17
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
18
18
  import { LexicalComposer } from '@lexical/react/LexicalComposer';
19
19
  import { ContentEditable } from '@lexical/react/LexicalContentEditable';
@@ -15682,11 +15682,11 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15682
15682
  var _exit4 = false;
15683
15683
  if (_exit3) return _result3;
15684
15684
  function _temp8(_result4) {
15685
- return _exit4 ? _result4 : Promise.resolve(extractFrameFromUrl(videoSrc, maxWidth, maxHeight, quality)).then(function (direct) {
15685
+ return _exit4 ? _result4 : Promise.resolve(extractFrameFromUrl(videoSrc, scaledMaxWidth, scaledMaxHeight, quality)).then(function (direct) {
15686
15686
  return direct ? direct : _catch(function () {
15687
15687
  return Promise.resolve(fetch(videoSrc)).then(function (response) {
15688
15688
  return Promise.resolve(response.blob()).then(function (blob) {
15689
- return Promise.resolve(_extractFrameFromBlob2(blob, maxWidth, maxHeight, quality));
15689
+ return Promise.resolve(_extractFrameFromBlob2(blob, scaledMaxWidth, scaledMaxHeight, quality));
15690
15690
  });
15691
15691
  });
15692
15692
  }, function (error) {
@@ -15700,7 +15700,7 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15700
15700
  return _catch(function () {
15701
15701
  return Promise.resolve(fetch(videoSrc)).then(function (_fetch) {
15702
15702
  return Promise.resolve(_fetch.blob()).then(function (blob) {
15703
- return Promise.resolve(_extractFrameFromBlob2(blob, maxWidth, maxHeight, quality)).then(function (_await$_extractFrameF2) {
15703
+ return Promise.resolve(_extractFrameFromBlob2(blob, scaledMaxWidth, scaledMaxHeight, quality)).then(function (_await$_extractFrameF2) {
15704
15704
  _exit4 = true;
15705
15705
  return _await$_extractFrameF2;
15706
15706
  });
@@ -15708,7 +15708,7 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15708
15708
  });
15709
15709
  }, function (error) {
15710
15710
  log.warn('getVideoFirstFrame: failed to re-fetch blob url, trying directly', error);
15711
- return Promise.resolve(extractFrameFromUrl(videoSrc, maxWidth, maxHeight, quality)).then(function (_await$extractFrameFr) {
15711
+ return Promise.resolve(extractFrameFromUrl(videoSrc, scaledMaxWidth, scaledMaxHeight, quality)).then(function (_await$extractFrameFr) {
15712
15712
  _exit4 = true;
15713
15713
  return _await$extractFrameFr;
15714
15714
  });
@@ -15717,9 +15717,11 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15717
15717
  }();
15718
15718
  return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
15719
15719
  }
15720
+ var scaledMaxWidth = scaleForDevicePixelRatio(maxWidth);
15721
+ var scaledMaxHeight = scaleForDevicePixelRatio(maxHeight);
15720
15722
  var _temp9 = function () {
15721
15723
  if (videoSrc instanceof Blob) {
15722
- return Promise.resolve(_extractFrameFromBlob2(videoSrc, maxWidth, maxHeight, quality)).then(function (_await$_extractFrameF) {
15724
+ return Promise.resolve(_extractFrameFromBlob2(videoSrc, scaledMaxWidth, scaledMaxHeight, quality)).then(function (_await$_extractFrameF) {
15723
15725
  _exit3 = true;
15724
15726
  return _await$_extractFrameF;
15725
15727
  });
@@ -15734,6 +15736,16 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15734
15736
  return Promise.reject(e);
15735
15737
  }
15736
15738
  };
15739
+ var scaleForDevicePixelRatio = function scaleForDevicePixelRatio(value, cap) {
15740
+ if (cap === void 0) {
15741
+ cap = 2;
15742
+ }
15743
+ if (!value) {
15744
+ return value;
15745
+ }
15746
+ var dpr = Math.min(window.devicePixelRatio || 1, cap);
15747
+ return value * dpr;
15748
+ };
15737
15749
  var normalizeVideoBlob = function normalizeVideoBlob(blob) {
15738
15750
  try {
15739
15751
  return Promise.resolve(inspectVideoBlob(blob)).then(function (info) {
@@ -15964,8 +15976,7 @@ var compressAndCacheImage = function compressAndCacheImage(url, cacheKey, maxWid
15964
15976
  var file = new File([blob], 'image.jpeg', {
15965
15977
  type: blob.type
15966
15978
  });
15967
- var dpr = Math.min(window.devicePixelRatio || 1, 2);
15968
- return Promise.resolve(resizeImageWithPica(file, (maxWidth || 1280) * dpr, (maxHeight || 1080) * dpr, quality || 1)).then(function (_ref2) {
15979
+ return Promise.resolve(resizeImageWithPica(file, scaleForDevicePixelRatio(maxWidth || 1280), scaleForDevicePixelRatio(maxHeight || 1080), quality || 1)).then(function (_ref2) {
15969
15980
  var compressedBlob = _ref2.blob;
15970
15981
  var returningUrl = compressedBlob ? URL.createObjectURL(compressedBlob) : '';
15971
15982
  if (compressedBlob) {
@@ -22883,7 +22894,7 @@ var UploadAvatarButton = styled.button(_templateObject23 || (_templateObject23 =
22883
22894
  var UploadAvatarHandler = styled.div(_templateObject24 || (_templateObject24 = _taggedTemplateLiteralLoose(["\n margin-left: 18px;\n font-size: 13px;\n color: ", ";\n"])), function (props) {
22884
22895
  return props.color;
22885
22896
  });
22886
- var StyledText = styled.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) {
22897
+ var StyledText = styled.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) {
22887
22898
  return props.fontWeight || props.isLastMessage && '500';
22888
22899
  }, function (props) {
22889
22900
  return props.fontFamily;
@@ -23072,6 +23083,10 @@ var PendingIconWrapper = styled(SvgPendingIcon)(_templateObject5$1 || (_template
23072
23083
  }, function (props) {
23073
23084
  return props.color;
23074
23085
  });
23086
+ var canActivateMention = function canActivateMention() {
23087
+ var selection = typeof window !== 'undefined' ? window.getSelection() : null;
23088
+ return !selection || selection.isCollapsed;
23089
+ };
23075
23090
  var MessageStatusIcon = function MessageStatusIcon(_ref) {
23076
23091
  var messageStatus = _ref.messageStatus,
23077
23092
  messageStatusDisplayingType = _ref.messageStatusDisplayingType,
@@ -23287,7 +23302,7 @@ var MessageTextFormat = function MessageTextFormat(_ref3) {
23287
23302
  key: attributeOffset + index,
23288
23303
  "data-mention": attribute.metadata,
23289
23304
  onClick: function onClick() {
23290
- if (onMentionNameClick && shouldOpenUserProfileForMention) {
23305
+ if (canActivateMention() && onMentionNameClick && shouldOpenUserProfileForMention) {
23291
23306
  onMentionNameClick(mentionDisplay);
23292
23307
  }
23293
23308
  }
@@ -23301,7 +23316,7 @@ var MessageTextFormat = function MessageTextFormat(_ref3) {
23301
23316
  key: attributeOffset,
23302
23317
  "data-mention": attribute.metadata,
23303
23318
  onClick: function onClick() {
23304
- if (onMentionNameClick && shouldOpenUserProfileForMention) {
23319
+ if (canActivateMention() && onMentionNameClick && shouldOpenUserProfileForMention) {
23305
23320
  onMentionNameClick(mentionDisplay);
23306
23321
  }
23307
23322
  },
@@ -27768,49 +27783,56 @@ function leaveChannel(action) {
27768
27783
  _context24.p = 0;
27769
27784
  payload = action.payload;
27770
27785
  channelId = payload.channelId;
27771
- _context24.n = 1;
27772
- return call(getChannelFromMap, channelId);
27786
+ if (!(store.getState().UserReducer.connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
27787
+ _context24.n = 1;
27788
+ break;
27789
+ }
27790
+ log.warn('Cannot leave channel while offline');
27791
+ return _context24.a(2);
27773
27792
  case 1:
27793
+ _context24.n = 2;
27794
+ return call(getChannelFromMap, channelId);
27795
+ case 2:
27774
27796
  channel = _context24.v;
27775
27797
  if (!channel) {
27776
27798
  channel = getChannelFromAllChannels(channelId);
27777
27799
  }
27778
27800
  if (!channel) {
27779
- _context24.n = 5;
27801
+ _context24.n = 6;
27780
27802
  break;
27781
27803
  }
27782
27804
  if (!(channel.type === DEFAULT_CHANNEL_TYPE.GROUP || channel.type === DEFAULT_CHANNEL_TYPE.PRIVATE)) {
27783
- _context24.n = 2;
27805
+ _context24.n = 3;
27784
27806
  break;
27785
27807
  }
27786
27808
  messageBuilder = channel.createMessageBuilder();
27787
27809
  messageBuilder.setBody('LG').setType('system').setDisplayCount(0).setSilent(true);
27788
27810
  messageToSend = messageBuilder.create();
27789
27811
  log.info('send message for left');
27790
- _context24.n = 2;
27791
- return call(channel.sendMessage, messageToSend);
27792
- case 2:
27793
- log.info('leave');
27794
27812
  _context24.n = 3;
27795
- return call(channel.leave);
27813
+ return call(channel.sendMessage, messageToSend);
27796
27814
  case 3:
27815
+ log.info('leave');
27797
27816
  _context24.n = 4;
27798
- return put(removeChannelAC(channelId));
27817
+ return call(channel.leave);
27799
27818
  case 4:
27800
- deleteChannelFromAllChannels(channelId);
27801
27819
  _context24.n = 5;
27802
- return put(removeChannelCachesAC(channelId));
27820
+ return put(removeChannelAC(channelId));
27803
27821
  case 5:
27804
- _context24.n = 7;
27805
- break;
27822
+ deleteChannelFromAllChannels(channelId);
27823
+ _context24.n = 6;
27824
+ return put(removeChannelCachesAC(channelId));
27806
27825
  case 6:
27807
- _context24.p = 6;
27826
+ _context24.n = 8;
27827
+ break;
27828
+ case 7:
27829
+ _context24.p = 7;
27808
27830
  _t22 = _context24.v;
27809
27831
  log.error('ERROR in leave channel - ', _t22.message);
27810
- case 7:
27832
+ case 8:
27811
27833
  return _context24.a(2);
27812
27834
  }
27813
- }, _marked22$1, null, [[0, 6]]);
27835
+ }, _marked22$1, null, [[0, 7]]);
27814
27836
  }
27815
27837
  function deletePendingDeleteChannels() {
27816
27838
  var pendingDeleteChannels, _iterator10, _step10, channel, resendableError, _t23;
@@ -50608,25 +50630,12 @@ function useFormatMessage(editor, editorState, setMessageBodyAttributes, setMess
50608
50630
  }
50609
50631
  return true;
50610
50632
  }, [editor, contactsMap, setMentionedMember, getFromContacts, activeChannelMembers, processMentionsInPastedText]);
50611
- var onDelete = useCallback(function (event) {
50612
- event.preventDefault();
50613
- editor.update(function () {
50614
- var selection = $getSelection();
50615
- if ($isRangeSelection(selection)) {
50616
- var node = getSelectedNode(selection);
50617
- if ($isMentionNode(node)) {
50618
- node.remove();
50619
- }
50620
- }
50621
- });
50622
- return false;
50623
- }, [editor]);
50624
50633
  useEffect(function () {
50625
50634
  return mergeRegister(editor.registerCommand(PASTE_COMMAND, function (e) {
50626
50635
  handlePast(e);
50627
50636
  return true;
50628
- }, COMMAND_PRIORITY_NORMAL), editor.registerCommand(KEY_DELETE_COMMAND, onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, onDelete, COMMAND_PRIORITY_LOW));
50629
- }, [editor, handlePast, onDelete]);
50637
+ }, COMMAND_PRIORITY_NORMAL));
50638
+ }, [editor, handlePast]);
50630
50639
  useDidUpdate(function () {
50631
50640
  if (editorState) {
50632
50641
  editorState.read(function () {
@@ -50965,6 +50974,15 @@ var Emoji$1 = styled.li(_templateObject8$l || (_templateObject8$l = _taggedTempl
50965
50974
  return props.hoverBackgroundColor;
50966
50975
  });
50967
50976
 
50977
+ var getReplyLinkPreviewImage = function getReplyLinkPreviewImage(attachments) {
50978
+ var _attachments$;
50979
+ 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;
50980
+ if (!(attachment !== null && attachment !== void 0 && attachment.metadata) || !isJSON(attachment.metadata)) return null;
50981
+ var compactMeta = JSON.parse(attachment.metadata);
50982
+ var imageUrl = compactMeta.iur || null;
50983
+ return !(compactMeta !== null && compactMeta !== void 0 && compactMeta.hld) ? imageUrl : null;
50984
+ };
50985
+
50968
50986
  var CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
50969
50987
 
50970
50988
  var _circle$6, _path$1j;
@@ -51274,8 +51292,10 @@ var AudioRecord = function AudioRecord(_ref) {
51274
51292
  warningColor = _useColor[THEME_COLORS.WARNING],
51275
51293
  iconPrimary = _useColor[THEME_COLORS.ICON_PRIMARY],
51276
51294
  surface1 = _useColor[THEME_COLORS.SURFACE_1],
51295
+ textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
51277
51296
  iconInactive = _useColor[THEME_COLORS.ICON_INACTIVE],
51278
- textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY];
51297
+ textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY],
51298
+ background = _useColor[THEME_COLORS.BACKGROUND];
51279
51299
  var _useState = useState(null),
51280
51300
  recording = _useState[0],
51281
51301
  setStartRecording = _useState[1];
@@ -51303,6 +51323,9 @@ var AudioRecord = function AudioRecord(_ref) {
51303
51323
  var _useState9 = useState(false),
51304
51324
  playAudio = _useState9[0],
51305
51325
  setPlayAudio = _useState9[1];
51326
+ var _useState0 = useState(false),
51327
+ microphonePermissionDenied = _useState0[0],
51328
+ setMicrophonePermissionDenied = _useState0[1];
51306
51329
  var recordButtonRef = useRef(null);
51307
51330
  var audioElements = useRef({});
51308
51331
  var intervalRef = useRef({});
@@ -51392,27 +51415,21 @@ var AudioRecord = function AudioRecord(_ref) {
51392
51415
  var startRecording = function startRecording(cId) {
51393
51416
  try {
51394
51417
  var id = cId || currentChannelId;
51395
- var _temp = _catch(function () {
51396
- return Promise.resolve(navigator.permissions.query({
51397
- name: 'microphone'
51398
- })).then(function (permissionStatus) {
51399
- if (permissionStatus.state === 'granted') {
51400
- setShowRecording(true);
51401
- } else {
51402
- recordButtonRef.current.style.pointerEvents = 'none';
51403
- }
51404
- if (recording) {
51405
- stopRecording(true, id, false, recorder);
51406
- } else if (currentRecordedFile) {
51407
- removeAudioRecordingFromMap(id);
51408
- setRecordedFile(null);
51409
- setPlayAudio(false);
51410
- cleanupAudioElement(id);
51411
- setStartRecording(false);
51412
- setShowRecording(false);
51413
- dispatch(setChannelDraftMessageIsRemovedAC(id));
51414
- sendRecordedFile(currentRecordedFile, id);
51415
- } else {
51418
+ try {
51419
+ if (recording) {
51420
+ stopRecording(true, id, false, recorder);
51421
+ } else if (currentRecordedFile) {
51422
+ removeAudioRecordingFromMap(id);
51423
+ setRecordedFile(null);
51424
+ setPlayAudio(false);
51425
+ cleanupAudioElement(id);
51426
+ setStartRecording(false);
51427
+ setShowRecording(false);
51428
+ dispatch(setChannelDraftMessageIsRemovedAC(id));
51429
+ sendRecordedFile(currentRecordedFile, id);
51430
+ } else {
51431
+ if (!recorder) return Promise.resolve();
51432
+ recorder.start().then(function () {
51416
51433
  handleStartRecording();
51417
51434
  setAudioRecordingToMap(id, {
51418
51435
  file: null,
@@ -51420,96 +51437,97 @@ var AudioRecord = function AudioRecord(_ref) {
51420
51437
  thumb: null,
51421
51438
  dur: 0
51422
51439
  });
51423
- recorder.start().then(function () {
51424
- recordButtonRef.current.style.pointerEvents = 'initial';
51425
- setShowRecording(true);
51426
- setStartRecording(true);
51427
- shouldDraw = true;
51428
- var stream = recorder.activeStream;
51429
- var obj = {};
51430
- var init = function init() {
51431
- obj.canvas = document.getElementById("waveform-" + id);
51432
- obj.ctx = obj.canvas.getContext('2d');
51433
- obj.width = 360;
51434
- obj.height = 28;
51435
- obj.canvas.width = obj.width;
51436
- obj.canvas.height = obj.height;
51437
- obj.canvas.style.width = obj.width + 'px';
51438
- obj.canvas.style.height = obj.height + 'px';
51439
- };
51440
- var timeOffset = 100;
51441
- var now = parseInt(performance.now()) / timeOffset;
51442
- var _loop = function loop() {
51443
- if (!shouldDraw) {
51444
- obj.x = 0;
51445
- obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
51446
- if (obj.audioContext && obj.audioContext.state !== 'closed') {
51447
- obj.audioContext.close()["catch"](function () {
51448
- return undefined;
51449
- });
51450
- }
51451
- return;
51452
- }
51440
+ setShowRecording(true);
51441
+ setStartRecording(true);
51442
+ shouldDraw = true;
51443
+ var stream = recorder.activeStream;
51444
+ var obj = {};
51445
+ var init = function init() {
51446
+ obj.canvas = document.getElementById("waveform-" + id);
51447
+ obj.ctx = obj.canvas.getContext('2d');
51448
+ obj.width = 360;
51449
+ obj.height = 28;
51450
+ obj.canvas.width = obj.width;
51451
+ obj.canvas.height = obj.height;
51452
+ obj.canvas.style.width = obj.width + 'px';
51453
+ obj.canvas.style.height = obj.height + 'px';
51454
+ };
51455
+ var timeOffset = 100;
51456
+ var now = parseInt(performance.now()) / timeOffset;
51457
+ var _loop = function loop() {
51458
+ if (!shouldDraw) {
51459
+ obj.x = 0;
51453
51460
  obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
51454
- var max = 0;
51455
- if (parseInt(performance.now() / timeOffset) > now) {
51456
- now = parseInt(performance.now() / timeOffset);
51457
- obj.analyser.getFloatTimeDomainData(obj.frequencyArray);
51458
- for (var i = 0; i < obj.frequencyArray.length; i++) {
51459
- if (obj.frequencyArray[i] > max) {
51460
- max = obj.frequencyArray[i];
51461
- }
51462
- }
51463
- var freq = Math.floor(max * 90);
51464
- if (freq === 0) {
51465
- freq = 1;
51466
- }
51467
- obj.bars.push({
51468
- x: obj.width,
51469
- y: obj.height / 2 - freq / 2,
51470
- height: freq,
51471
- width: 3
51461
+ if (obj.audioContext && obj.audioContext.state !== 'closed') {
51462
+ obj.audioContext.close()["catch"](function () {
51463
+ return undefined;
51472
51464
  });
51473
51465
  }
51474
- draw();
51475
- requestAnimationFrame(_loop);
51476
- };
51477
- obj.bars = [];
51478
- var draw = function draw() {
51479
- for (var i = 0; i < obj.bars.length; i++) {
51480
- var bar = obj.bars[i];
51481
- obj.ctx.fillStyle = textSecondary;
51482
- obj.ctx.fillRect(bar.x, bar.y, bar.width, bar.height);
51483
- bar.x = bar.x - 1;
51484
- if (bar.x < 1) {
51485
- obj.bars.splice(i, 1);
51466
+ return;
51467
+ }
51468
+ obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
51469
+ var max = 0;
51470
+ if (parseInt(performance.now() / timeOffset) > now) {
51471
+ now = parseInt(performance.now() / timeOffset);
51472
+ obj.analyser.getFloatTimeDomainData(obj.frequencyArray);
51473
+ for (var i = 0; i < obj.frequencyArray.length; i++) {
51474
+ if (obj.frequencyArray[i] > max) {
51475
+ max = obj.frequencyArray[i];
51486
51476
  }
51487
51477
  }
51488
- };
51489
- var soundAllowed = function soundAllowed(stream) {
51490
- var AudioContext = window.AudioContext || window.webkitAudioContext;
51491
- var audioContent = new AudioContext();
51492
- obj.audioContext = audioContent;
51493
- var streamSource = audioContent.createMediaStreamSource(stream);
51494
- obj.analyser = audioContent.createAnalyser();
51495
- streamSource.connect(obj.analyser);
51496
- obj.analyser.fftSize = 512;
51497
- obj.frequencyArray = new Float32Array(obj.analyser.fftSize);
51498
- init();
51499
- _loop();
51500
- };
51501
- soundAllowed(stream);
51502
- })["catch"](function (e) {
51503
- handleStopRecording();
51504
- log.error(e);
51505
- });
51506
- }
51507
- });
51508
- }, function (e) {
51509
- handleStopRecording();
51478
+ var freq = Math.floor(max * 90);
51479
+ if (freq === 0) {
51480
+ freq = 1;
51481
+ }
51482
+ obj.bars.push({
51483
+ x: obj.width,
51484
+ y: obj.height / 2 - freq / 2,
51485
+ height: freq,
51486
+ width: 3
51487
+ });
51488
+ }
51489
+ draw();
51490
+ requestAnimationFrame(_loop);
51491
+ };
51492
+ obj.bars = [];
51493
+ var draw = function draw() {
51494
+ for (var i = 0; i < obj.bars.length; i++) {
51495
+ var bar = obj.bars[i];
51496
+ obj.ctx.fillStyle = textSecondary;
51497
+ obj.ctx.fillRect(bar.x, bar.y, bar.width, bar.height);
51498
+ bar.x = bar.x - 1;
51499
+ if (bar.x < 1) {
51500
+ obj.bars.splice(i, 1);
51501
+ }
51502
+ }
51503
+ };
51504
+ var soundAllowed = function soundAllowed(stream) {
51505
+ var AudioContext = window.AudioContext || window.webkitAudioContext;
51506
+ var audioContent = new AudioContext();
51507
+ obj.audioContext = audioContent;
51508
+ var streamSource = audioContent.createMediaStreamSource(stream);
51509
+ obj.analyser = audioContent.createAnalyser();
51510
+ streamSource.connect(obj.analyser);
51511
+ obj.analyser.fftSize = 512;
51512
+ obj.frequencyArray = new Float32Array(obj.analyser.fftSize);
51513
+ init();
51514
+ _loop();
51515
+ };
51516
+ soundAllowed(stream);
51517
+ })["catch"](function (e) {
51518
+ if ((e === null || e === void 0 ? void 0 : e.name) === 'NotAllowedError' || (e === null || e === void 0 ? void 0 : e.name) === 'PermissionDeniedError') {
51519
+ setMicrophonePermissionDenied(true);
51520
+ }
51521
+ log.error(e);
51522
+ });
51523
+ }
51524
+ } catch (e) {
51525
+ if ((e === null || e === void 0 ? void 0 : e.name) === 'NotAllowedError' || (e === null || e === void 0 ? void 0 : e.name) === 'PermissionDeniedError') {
51526
+ setMicrophonePermissionDenied(true);
51527
+ }
51510
51528
  log.error(e);
51511
- });
51512
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
51529
+ }
51530
+ return Promise.resolve();
51513
51531
  } catch (e) {
51514
51532
  return Promise.reject(e);
51515
51533
  }
@@ -51834,7 +51852,36 @@ var AudioRecord = function AudioRecord(_ref) {
51834
51852
  return startRecording(currentChannelId);
51835
51853
  },
51836
51854
  iconColor: accentColor
51837
- }, showRecording || currentRecordedFile ? /*#__PURE__*/React__default.createElement(SvgSend, null) : /*#__PURE__*/React__default.createElement(SvgRecordButton, null)));
51855
+ }, 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, {
51856
+ backgroundColor: background,
51857
+ maxWidth: '520px',
51858
+ minWidth: '520px',
51859
+ padding: '0'
51860
+ }, /*#__PURE__*/React__default.createElement(PopupBody, {
51861
+ paddingH: '24px',
51862
+ paddingV: '24px'
51863
+ }, /*#__PURE__*/React__default.createElement(CloseIcon, {
51864
+ color: iconPrimary,
51865
+ onClick: function onClick() {
51866
+ return setMicrophonePermissionDenied(false);
51867
+ }
51868
+ }), /*#__PURE__*/React__default.createElement(PopupName, {
51869
+ color: textPrimary,
51870
+ marginBottom: '20px'
51871
+ }, "Microphone Permission Denied"), /*#__PURE__*/React__default.createElement(PopupDescription, {
51872
+ color: textPrimary,
51873
+ highlightColor: textSecondary
51874
+ }, "We can't access your microphone. Enable microphone permission in your browser settings and try again.")), /*#__PURE__*/React__default.createElement(PopupFooter, {
51875
+ backgroundColor: surface1
51876
+ }, /*#__PURE__*/React__default.createElement(Button, {
51877
+ type: 'button',
51878
+ backgroundColor: accentColor,
51879
+ color: textOnPrimary,
51880
+ borderRadius: '8px',
51881
+ onClick: function onClick() {
51882
+ return setMicrophonePermissionDenied(false);
51883
+ }
51884
+ }, "Close"))))));
51838
51885
  };
51839
51886
  var AudioRecord$1 = /*#__PURE__*/memo(AudioRecord, function (prevProps, nextProps) {
51840
51887
  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;
@@ -52359,7 +52406,7 @@ var SettingItem = styled.div(_templateObject9$i || (_templateObject9$i = _tagged
52359
52406
  return props.color;
52360
52407
  });
52361
52408
 
52362
- 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;
52409
+ 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;
52363
52410
  function AutoFocusPlugin(_ref) {
52364
52411
  var messageForReply = _ref.messageForReply;
52365
52412
  var _useLexicalComposerCo = useLexicalComposerContext(),
@@ -53218,10 +53265,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53218
53265
  }
53219
53266
  }
53220
53267
  };
53221
- var handleCut = function handleCut() {
53222
- setMessageText('');
53223
- setMentionedUsers([]);
53224
- };
53225
53268
  var handleEmojiPopupToggle = function handleEmojiPopupToggle(bool) {
53226
53269
  setIsEmojisOpened(bool);
53227
53270
  };
@@ -53813,7 +53856,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53813
53856
  }, 800);
53814
53857
  }
53815
53858
  messageContRef.current.addEventListener('paste', handlePastAttachments);
53816
- messageContRef.current.addEventListener('cut', handleCut);
53817
53859
  document.addEventListener('mousedown', handleClick);
53818
53860
  return function () {
53819
53861
  if (inputHeightTimeout) {
@@ -53823,7 +53865,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53823
53865
  document.removeEventListener('mousedown', handleClick);
53824
53866
  if (messageContRef && messageContRef.current) {
53825
53867
  messageContRef.current.removeEventListener('paste', handlePastAttachments);
53826
- messageContRef.current.removeEventListener('cut', handleCut);
53827
53868
  }
53828
53869
  };
53829
53870
  }, []);
@@ -54001,14 +54042,23 @@ var SendMessageInput = function SendMessageInput(_ref3) {
54001
54042
  attachment: messageForReply.attachments[0],
54002
54043
  backgroundColor: selectedFileAttachmentsBoxBackground || '',
54003
54044
  isRepliedMessage: true
54004
- })) : messageForReply.attachments[0].type === attachmentTypes.file && (/*#__PURE__*/React__default.createElement(ReplyIconWrapper, {
54045
+ })) : getReplyLinkPreviewImage(messageForReply.attachments) ? (/*#__PURE__*/React__default.createElement(LinkPreviewImage, {
54046
+ bg: background,
54047
+ src: getReplyLinkPreviewImage(messageForReply.attachments),
54048
+ alt: 'Link preview'
54049
+ })) : messageForReply.attachments[0].type === attachmentTypes.link ? (/*#__PURE__*/React__default.createElement(LinkPreviewIconWrapper, {
54050
+ bg: background
54051
+ }, /*#__PURE__*/React__default.createElement(LinkPreviewIcon, {
54052
+ color: accentColor,
54053
+ bg: background
54054
+ }))) : messageForReply.attachments[0].type === attachmentTypes.file && (/*#__PURE__*/React__default.createElement(ReplyIconWrapper, {
54005
54055
  backgroundColor: accentColor,
54006
54056
  iconColor: textOnPrimary
54007
54057
  }, /*#__PURE__*/React__default.createElement(SvgChoseFile, null)))), /*#__PURE__*/React__default.createElement(ReplyMessageBody$1, {
54008
54058
  linkColor: accentColor
54009
54059
  }, /*#__PURE__*/React__default.createElement(EditReplyMessageHeader, {
54010
54060
  color: accentColor
54011
- }, 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, {
54061
+ }, 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, {
54012
54062
  style: {
54013
54063
  margin: '0 4px -3px 0'
54014
54064
  }
@@ -54363,7 +54413,7 @@ var MessageInputWrapper = styled.div(_templateObject12$7 || (_templateObject12$7
54363
54413
  }, function (props) {
54364
54414
  return props.borderRadius || '18px';
54365
54415
  });
54366
- var LexicalWrapper = styled.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) {
54416
+ var LexicalWrapper = styled.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) {
54367
54417
  return props.borderRadius;
54368
54418
  }, function (props) {
54369
54419
  return props.backgroundColor;
@@ -54471,19 +54521,24 @@ var LinkPreviewContainer = styled.div(_templateObject39$1 || (_templateObject39$
54471
54521
  return props.isClosing ? linkPreviewSlideOut : linkPreviewSlideIn;
54472
54522
  });
54473
54523
  var LinkPreviewContent = styled.div(_templateObject40$1 || (_templateObject40$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: 12px;\n flex: 1;\n overflow: hidden;\n"])));
54474
- var LinkPreviewImage = styled.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"])));
54524
+ var LinkPreviewImage = styled.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) {
54525
+ return props.bg;
54526
+ });
54475
54527
  var LinkPreviewIcon = styled(SvgLinkIcon)(_templateObject42 || (_templateObject42 = _taggedTemplateLiteralLoose(["\n color: ", ";\n rect {\n fill: ", ";\n fill-opacity: 1;\n }\n"])), function (props) {
54476
54528
  return props.color;
54477
54529
  }, function (props) {
54478
54530
  return props.bg;
54479
54531
  });
54480
- var LinkPreviewTextContent = styled.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) {
54532
+ var LinkPreviewIconWrapper = styled.div(_templateObject43 || (_templateObject43 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n border-radius: 4px;\n margin-right: 8px;\n background: ", ";\n"])), function (props) {
54533
+ return props.bg;
54534
+ });
54535
+ var LinkPreviewTextContent = styled.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) {
54481
54536
  return props.hasImage ? '' : 'padding-left: 0;';
54482
54537
  });
54483
- var LinkPreviewTitle = styled.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) {
54538
+ var LinkPreviewTitle = styled.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) {
54484
54539
  return props.color;
54485
54540
  });
54486
- var LinkPreviewDescription = styled.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) {
54541
+ var LinkPreviewDescription = styled.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) {
54487
54542
  return props.color;
54488
54543
  });
54489
54544
 
@@ -55316,12 +55371,14 @@ var Actions = function Actions(_ref) {
55316
55371
  commonGroupsTextColor = _ref.commonGroupsTextColor,
55317
55372
  showGroupsInCommon = _ref.showGroupsInCommon;
55318
55373
  var _useColor = useColors(),
55374
+ accentColor = _useColor[THEME_COLORS.ACCENT],
55319
55375
  textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
55320
55376
  textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY],
55321
55377
  iconPrimary = _useColor[THEME_COLORS.ICON_PRIMARY],
55322
55378
  surface1 = _useColor[THEME_COLORS.SURFACE_1],
55323
55379
  warningColor = _useColor[THEME_COLORS.WARNING],
55324
- backgroundColor = _useColor[THEME_COLORS.BACKGROUND];
55380
+ backgroundColor = _useColor[THEME_COLORS.BACKGROUND],
55381
+ textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY];
55325
55382
  var ChatClient = getClient();
55326
55383
  var user = ChatClient.user;
55327
55384
  var _useState = useState(false),
@@ -55334,35 +55391,39 @@ var Actions = function Actions(_ref) {
55334
55391
  leaveChannelPopupOpen = _useState3[0],
55335
55392
  setLeaveChannelPopupOpen = _useState3[1];
55336
55393
  var _useState4 = useState(false),
55337
- deleteChannelPopupOpen = _useState4[0],
55338
- setDeleteChannelPopupOpen = _useState4[1];
55394
+ leaveChannelOfflinePopupOpen = _useState4[0],
55395
+ setLeaveChannelOfflinePopupOpen = _useState4[1];
55339
55396
  var _useState5 = useState(false),
55340
- blockChannelPopupOpen = _useState5[0],
55341
- setBlockChannelPopupOpen = _useState5[1];
55397
+ deleteChannelPopupOpen = _useState5[0],
55398
+ setDeleteChannelPopupOpen = _useState5[1];
55342
55399
  var _useState6 = useState(false),
55343
- blockUserPopupOpen = _useState6[0],
55344
- setBlockUserPopupOpen = _useState6[1];
55400
+ blockChannelPopupOpen = _useState6[0],
55401
+ setBlockChannelPopupOpen = _useState6[1];
55345
55402
  var _useState7 = useState(false),
55346
- unblockUserPopupOpen = _useState7[0],
55347
- setUnblockUserPopupOpen = _useState7[1];
55403
+ blockUserPopupOpen = _useState7[0],
55404
+ setBlockUserPopupOpen = _useState7[1];
55348
55405
  var _useState8 = useState(false),
55349
- reportUserPopupOpen = _useState8[0],
55350
- setReportUserPopupOpen = _useState8[1];
55406
+ unblockUserPopupOpen = _useState8[0],
55407
+ setUnblockUserPopupOpen = _useState8[1];
55351
55408
  var _useState9 = useState(false),
55352
- disappearingMessagesPopupOpen = _useState9[0],
55353
- setDisappearingMessagesPopupOpen = _useState9[1];
55409
+ reportUserPopupOpen = _useState9[0],
55410
+ setReportUserPopupOpen = _useState9[1];
55354
55411
  var _useState0 = useState(false),
55355
- groupsInCommonPopupOpen = _useState0[0],
55356
- setGroupsInCommonPopupOpen = _useState0[1];
55412
+ disappearingMessagesPopupOpen = _useState0[0],
55413
+ setDisappearingMessagesPopupOpen = _useState0[1];
55414
+ var _useState1 = useState(false),
55415
+ groupsInCommonPopupOpen = _useState1[0],
55416
+ setGroupsInCommonPopupOpen = _useState1[1];
55357
55417
  var _usePermissions = usePermissions(channel.userRole),
55358
55418
  checkActionPermission = _usePermissions[0];
55359
- var _useState1 = useState(''),
55360
- popupButtonText = _useState1[0],
55361
- setPopupButtonText = _useState1[1];
55362
55419
  var _useState10 = useState(''),
55363
- popupTitle = _useState10[0],
55364
- setPopupTitle = _useState10[1];
55420
+ popupButtonText = _useState10[0],
55421
+ setPopupButtonText = _useState10[1];
55422
+ var _useState11 = useState(''),
55423
+ popupTitle = _useState11[0],
55424
+ setPopupTitle = _useState11[1];
55365
55425
  var dispatch = useDispatch();
55426
+ var connectionStatus = useSelector(connectionStatusSelector);
55366
55427
  var oneHour = 60 * 60 * 1000;
55367
55428
  var twoHours = oneHour * 2;
55368
55429
  var oneDay = oneHour * 24;
@@ -55407,6 +55468,10 @@ var Actions = function Actions(_ref) {
55407
55468
  }
55408
55469
  };
55409
55470
  var handleLeaveChannel = function handleLeaveChannel() {
55471
+ if (connectionStatus !== CONNECTION_STATUS.CONNECTED) {
55472
+ setLeaveChannelOfflinePopupOpen(true);
55473
+ return;
55474
+ }
55410
55475
  dispatch(leaveChannelAC(channel.id));
55411
55476
  };
55412
55477
  var handleDeleteChannel = function handleDeleteChannel() {
@@ -55708,7 +55773,37 @@ var Actions = function Actions(_ref) {
55708
55773
  buttonText: popupButtonText,
55709
55774
  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.',
55710
55775
  title: popupTitle
55711
- })), deleteChannelPopupOpen && (/*#__PURE__*/React__default.createElement(ConfirmPopup, {
55776
+ })), leaveChannelOfflinePopupOpen && (/*#__PURE__*/React__default.createElement(PopupContainer, null, /*#__PURE__*/React__default.createElement(Popup, {
55777
+ backgroundColor: backgroundColor,
55778
+ maxWidth: '520px',
55779
+ minWidth: '520px',
55780
+ padding: '0'
55781
+ }, /*#__PURE__*/React__default.createElement(PopupBody, {
55782
+ paddingH: '24px',
55783
+ paddingV: '24px'
55784
+ }, /*#__PURE__*/React__default.createElement(CloseIcon, {
55785
+ color: iconPrimary,
55786
+ onClick: function onClick() {
55787
+ return setLeaveChannelOfflinePopupOpen(false);
55788
+ }
55789
+ }), /*#__PURE__*/React__default.createElement(PopupName, {
55790
+ color: textPrimary,
55791
+ isDelete: true,
55792
+ marginBottom: '20px'
55793
+ }, "Failed to leave group"), /*#__PURE__*/React__default.createElement(PopupDescription, {
55794
+ color: textPrimary,
55795
+ highlightColor: textSecondary
55796
+ }, "You\u2019re offline. Reconnect and try again.")), /*#__PURE__*/React__default.createElement(PopupFooter, {
55797
+ backgroundColor: surface1
55798
+ }, /*#__PURE__*/React__default.createElement(Button, {
55799
+ type: 'button',
55800
+ backgroundColor: accentColor,
55801
+ color: textOnPrimary,
55802
+ borderRadius: '8px',
55803
+ onClick: function onClick() {
55804
+ return setLeaveChannelOfflinePopupOpen(false);
55805
+ }
55806
+ }, "Close"))))), deleteChannelPopupOpen && (/*#__PURE__*/React__default.createElement(ConfirmPopup, {
55712
55807
  handleFunction: handleDeleteChannel,
55713
55808
  togglePopup: handleToggleDeleteChannelPopupOpen,
55714
55809
  buttonText: popupButtonText,