sceyt-chat-react-uikit 1.8.9-beta.1 → 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 +280 -184
  2. package/index.modern.js +281 -185
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -10490,7 +10490,7 @@ if (isBrowser) {
10490
10490
  } else {
10491
10491
  cacheAvailable = 'caches' in global;
10492
10492
  }
10493
- var ATTACHMENT_VERSION = "_1_0_1";
10493
+ var ATTACHMENT_VERSION = "_1_0_2";
10494
10494
  var setAttachmentToCache = function setAttachmentToCache(attachmentUrl, attachmentResponse) {
10495
10495
  try {
10496
10496
  var attachmentURLVersion = attachmentUrl + ATTACHMENT_VERSION;
@@ -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,7 +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
- return Promise.resolve(resizeImageWithPica(file, maxWidth || 1280, maxHeight || 1080, quality || 1)).then(function (_ref2) {
15999
+ return Promise.resolve(resizeImageWithPica(file, scaleForDevicePixelRatio(maxWidth || 1280), scaleForDevicePixelRatio(maxHeight || 1080), quality || 1)).then(function (_ref2) {
15988
16000
  var compressedBlob = _ref2.blob;
15989
16001
  var returningUrl = compressedBlob ? URL.createObjectURL(compressedBlob) : '';
15990
16002
  if (compressedBlob) {
@@ -22902,7 +22914,7 @@ var UploadAvatarButton = styled__default.button(_templateObject23 || (_templateO
22902
22914
  var UploadAvatarHandler = styled__default.div(_templateObject24 || (_templateObject24 = _taggedTemplateLiteralLoose(["\n margin-left: 18px;\n font-size: 13px;\n color: ", ";\n"])), function (props) {
22903
22915
  return props.color;
22904
22916
  });
22905
- 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) {
22906
22918
  return props.fontWeight || props.isLastMessage && '500';
22907
22919
  }, function (props) {
22908
22920
  return props.fontFamily;
@@ -23091,6 +23103,10 @@ var PendingIconWrapper = styled__default(SvgPendingIcon)(_templateObject5$1 || (
23091
23103
  }, function (props) {
23092
23104
  return props.color;
23093
23105
  });
23106
+ var canActivateMention = function canActivateMention() {
23107
+ var selection = typeof window !== 'undefined' ? window.getSelection() : null;
23108
+ return !selection || selection.isCollapsed;
23109
+ };
23094
23110
  var MessageStatusIcon = function MessageStatusIcon(_ref) {
23095
23111
  var messageStatus = _ref.messageStatus,
23096
23112
  messageStatusDisplayingType = _ref.messageStatusDisplayingType,
@@ -23306,7 +23322,7 @@ var MessageTextFormat = function MessageTextFormat(_ref3) {
23306
23322
  key: attributeOffset + index,
23307
23323
  "data-mention": attribute.metadata,
23308
23324
  onClick: function onClick() {
23309
- if (onMentionNameClick && shouldOpenUserProfileForMention) {
23325
+ if (canActivateMention() && onMentionNameClick && shouldOpenUserProfileForMention) {
23310
23326
  onMentionNameClick(mentionDisplay);
23311
23327
  }
23312
23328
  }
@@ -23320,7 +23336,7 @@ var MessageTextFormat = function MessageTextFormat(_ref3) {
23320
23336
  key: attributeOffset,
23321
23337
  "data-mention": attribute.metadata,
23322
23338
  onClick: function onClick() {
23323
- if (onMentionNameClick && shouldOpenUserProfileForMention) {
23339
+ if (canActivateMention() && onMentionNameClick && shouldOpenUserProfileForMention) {
23324
23340
  onMentionNameClick(mentionDisplay);
23325
23341
  }
23326
23342
  },
@@ -27787,49 +27803,56 @@ function leaveChannel(action) {
27787
27803
  _context24.p = 0;
27788
27804
  payload = action.payload;
27789
27805
  channelId = payload.channelId;
27790
- _context24.n = 1;
27791
- 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);
27792
27812
  case 1:
27813
+ _context24.n = 2;
27814
+ return effects.call(getChannelFromMap, channelId);
27815
+ case 2:
27793
27816
  channel = _context24.v;
27794
27817
  if (!channel) {
27795
27818
  channel = getChannelFromAllChannels(channelId);
27796
27819
  }
27797
27820
  if (!channel) {
27798
- _context24.n = 5;
27821
+ _context24.n = 6;
27799
27822
  break;
27800
27823
  }
27801
27824
  if (!(channel.type === DEFAULT_CHANNEL_TYPE.GROUP || channel.type === DEFAULT_CHANNEL_TYPE.PRIVATE)) {
27802
- _context24.n = 2;
27825
+ _context24.n = 3;
27803
27826
  break;
27804
27827
  }
27805
27828
  messageBuilder = channel.createMessageBuilder();
27806
27829
  messageBuilder.setBody('LG').setType('system').setDisplayCount(0).setSilent(true);
27807
27830
  messageToSend = messageBuilder.create();
27808
27831
  log.info('send message for left');
27809
- _context24.n = 2;
27810
- return effects.call(channel.sendMessage, messageToSend);
27811
- case 2:
27812
- log.info('leave');
27813
27832
  _context24.n = 3;
27814
- return effects.call(channel.leave);
27833
+ return effects.call(channel.sendMessage, messageToSend);
27815
27834
  case 3:
27835
+ log.info('leave');
27816
27836
  _context24.n = 4;
27817
- return effects.put(removeChannelAC(channelId));
27837
+ return effects.call(channel.leave);
27818
27838
  case 4:
27819
- deleteChannelFromAllChannels(channelId);
27820
27839
  _context24.n = 5;
27821
- return effects.put(removeChannelCachesAC(channelId));
27840
+ return effects.put(removeChannelAC(channelId));
27822
27841
  case 5:
27823
- _context24.n = 7;
27824
- break;
27842
+ deleteChannelFromAllChannels(channelId);
27843
+ _context24.n = 6;
27844
+ return effects.put(removeChannelCachesAC(channelId));
27825
27845
  case 6:
27826
- _context24.p = 6;
27846
+ _context24.n = 8;
27847
+ break;
27848
+ case 7:
27849
+ _context24.p = 7;
27827
27850
  _t22 = _context24.v;
27828
27851
  log.error('ERROR in leave channel - ', _t22.message);
27829
- case 7:
27852
+ case 8:
27830
27853
  return _context24.a(2);
27831
27854
  }
27832
- }, _marked22$1, null, [[0, 6]]);
27855
+ }, _marked22$1, null, [[0, 7]]);
27833
27856
  }
27834
27857
  function deletePendingDeleteChannels() {
27835
27858
  var pendingDeleteChannels, _iterator10, _step10, channel, resendableError, _t23;
@@ -50627,25 +50650,12 @@ function useFormatMessage(editor, editorState, setMessageBodyAttributes, setMess
50627
50650
  }
50628
50651
  return true;
50629
50652
  }, [editor, contactsMap, setMentionedMember, getFromContacts, activeChannelMembers, processMentionsInPastedText]);
50630
- var onDelete = React.useCallback(function (event) {
50631
- event.preventDefault();
50632
- editor.update(function () {
50633
- var selection = lexical.$getSelection();
50634
- if (lexical.$isRangeSelection(selection)) {
50635
- var node = getSelectedNode(selection);
50636
- if ($isMentionNode(node)) {
50637
- node.remove();
50638
- }
50639
- }
50640
- });
50641
- return false;
50642
- }, [editor]);
50643
50653
  React.useEffect(function () {
50644
50654
  return mergeRegister(editor.registerCommand(lexical.PASTE_COMMAND, function (e) {
50645
50655
  handlePast(e);
50646
50656
  return true;
50647
- }, 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));
50648
- }, [editor, handlePast, onDelete]);
50657
+ }, lexical.COMMAND_PRIORITY_NORMAL));
50658
+ }, [editor, handlePast]);
50649
50659
  useDidUpdate(function () {
50650
50660
  if (editorState) {
50651
50661
  editorState.read(function () {
@@ -50984,6 +50994,15 @@ var Emoji$1 = styled__default.li(_templateObject8$l || (_templateObject8$l = _ta
50984
50994
  return props.hoverBackgroundColor;
50985
50995
  });
50986
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
+
50987
51006
  var CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
50988
51007
 
50989
51008
  var _circle$6, _path$1j;
@@ -51293,8 +51312,10 @@ var AudioRecord = function AudioRecord(_ref) {
51293
51312
  warningColor = _useColor[THEME_COLORS.WARNING],
51294
51313
  iconPrimary = _useColor[THEME_COLORS.ICON_PRIMARY],
51295
51314
  surface1 = _useColor[THEME_COLORS.SURFACE_1],
51315
+ textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
51296
51316
  iconInactive = _useColor[THEME_COLORS.ICON_INACTIVE],
51297
- textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY];
51317
+ textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY],
51318
+ background = _useColor[THEME_COLORS.BACKGROUND];
51298
51319
  var _useState = React.useState(null),
51299
51320
  recording = _useState[0],
51300
51321
  setStartRecording = _useState[1];
@@ -51322,6 +51343,9 @@ var AudioRecord = function AudioRecord(_ref) {
51322
51343
  var _useState9 = React.useState(false),
51323
51344
  playAudio = _useState9[0],
51324
51345
  setPlayAudio = _useState9[1];
51346
+ var _useState0 = React.useState(false),
51347
+ microphonePermissionDenied = _useState0[0],
51348
+ setMicrophonePermissionDenied = _useState0[1];
51325
51349
  var recordButtonRef = React.useRef(null);
51326
51350
  var audioElements = React.useRef({});
51327
51351
  var intervalRef = React.useRef({});
@@ -51411,27 +51435,21 @@ var AudioRecord = function AudioRecord(_ref) {
51411
51435
  var startRecording = function startRecording(cId) {
51412
51436
  try {
51413
51437
  var id = cId || currentChannelId;
51414
- var _temp = _catch(function () {
51415
- return Promise.resolve(navigator.permissions.query({
51416
- name: 'microphone'
51417
- })).then(function (permissionStatus) {
51418
- if (permissionStatus.state === 'granted') {
51419
- setShowRecording(true);
51420
- } else {
51421
- recordButtonRef.current.style.pointerEvents = 'none';
51422
- }
51423
- if (recording) {
51424
- stopRecording(true, id, false, recorder);
51425
- } else if (currentRecordedFile) {
51426
- removeAudioRecordingFromMap(id);
51427
- setRecordedFile(null);
51428
- setPlayAudio(false);
51429
- cleanupAudioElement(id);
51430
- setStartRecording(false);
51431
- setShowRecording(false);
51432
- dispatch(setChannelDraftMessageIsRemovedAC(id));
51433
- sendRecordedFile(currentRecordedFile, id);
51434
- } 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 () {
51435
51453
  handleStartRecording();
51436
51454
  setAudioRecordingToMap(id, {
51437
51455
  file: null,
@@ -51439,96 +51457,97 @@ var AudioRecord = function AudioRecord(_ref) {
51439
51457
  thumb: null,
51440
51458
  dur: 0
51441
51459
  });
51442
- recorder.start().then(function () {
51443
- recordButtonRef.current.style.pointerEvents = 'initial';
51444
- setShowRecording(true);
51445
- setStartRecording(true);
51446
- shouldDraw = true;
51447
- var stream = recorder.activeStream;
51448
- var obj = {};
51449
- var init = function init() {
51450
- obj.canvas = document.getElementById("waveform-" + id);
51451
- obj.ctx = obj.canvas.getContext('2d');
51452
- obj.width = 360;
51453
- obj.height = 28;
51454
- obj.canvas.width = obj.width;
51455
- obj.canvas.height = obj.height;
51456
- obj.canvas.style.width = obj.width + 'px';
51457
- obj.canvas.style.height = obj.height + 'px';
51458
- };
51459
- var timeOffset = 100;
51460
- var now = parseInt(performance.now()) / timeOffset;
51461
- var _loop = function loop() {
51462
- if (!shouldDraw) {
51463
- obj.x = 0;
51464
- obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
51465
- if (obj.audioContext && obj.audioContext.state !== 'closed') {
51466
- obj.audioContext.close()["catch"](function () {
51467
- return undefined;
51468
- });
51469
- }
51470
- return;
51471
- }
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;
51472
51480
  obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
51473
- var max = 0;
51474
- if (parseInt(performance.now() / timeOffset) > now) {
51475
- now = parseInt(performance.now() / timeOffset);
51476
- obj.analyser.getFloatTimeDomainData(obj.frequencyArray);
51477
- for (var i = 0; i < obj.frequencyArray.length; i++) {
51478
- if (obj.frequencyArray[i] > max) {
51479
- max = obj.frequencyArray[i];
51480
- }
51481
- }
51482
- var freq = Math.floor(max * 90);
51483
- if (freq === 0) {
51484
- freq = 1;
51485
- }
51486
- obj.bars.push({
51487
- x: obj.width,
51488
- y: obj.height / 2 - freq / 2,
51489
- height: freq,
51490
- width: 3
51481
+ if (obj.audioContext && obj.audioContext.state !== 'closed') {
51482
+ obj.audioContext.close()["catch"](function () {
51483
+ return undefined;
51491
51484
  });
51492
51485
  }
51493
- draw();
51494
- requestAnimationFrame(_loop);
51495
- };
51496
- obj.bars = [];
51497
- var draw = function draw() {
51498
- for (var i = 0; i < obj.bars.length; i++) {
51499
- var bar = obj.bars[i];
51500
- obj.ctx.fillStyle = textSecondary;
51501
- obj.ctx.fillRect(bar.x, bar.y, bar.width, bar.height);
51502
- bar.x = bar.x - 1;
51503
- if (bar.x < 1) {
51504
- 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];
51505
51496
  }
51506
51497
  }
51507
- };
51508
- var soundAllowed = function soundAllowed(stream) {
51509
- var AudioContext = window.AudioContext || window.webkitAudioContext;
51510
- var audioContent = new AudioContext();
51511
- obj.audioContext = audioContent;
51512
- var streamSource = audioContent.createMediaStreamSource(stream);
51513
- obj.analyser = audioContent.createAnalyser();
51514
- streamSource.connect(obj.analyser);
51515
- obj.analyser.fftSize = 512;
51516
- obj.frequencyArray = new Float32Array(obj.analyser.fftSize);
51517
- init();
51518
- _loop();
51519
- };
51520
- soundAllowed(stream);
51521
- })["catch"](function (e) {
51522
- handleStopRecording();
51523
- log.error(e);
51524
- });
51525
- }
51526
- });
51527
- }, function (e) {
51528
- 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
+ }
51529
51548
  log.error(e);
51530
- });
51531
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
51549
+ }
51550
+ return Promise.resolve();
51532
51551
  } catch (e) {
51533
51552
  return Promise.reject(e);
51534
51553
  }
@@ -51853,7 +51872,36 @@ var AudioRecord = function AudioRecord(_ref) {
51853
51872
  return startRecording(currentChannelId);
51854
51873
  },
51855
51874
  iconColor: accentColor
51856
- }, 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"))))));
51857
51905
  };
51858
51906
  var AudioRecord$1 = /*#__PURE__*/React.memo(AudioRecord, function (prevProps, nextProps) {
51859
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;
@@ -52378,7 +52426,7 @@ var SettingItem = styled__default.div(_templateObject9$i || (_templateObject9$i
52378
52426
  return props.color;
52379
52427
  });
52380
52428
 
52381
- 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;
52382
52430
  function AutoFocusPlugin(_ref) {
52383
52431
  var messageForReply = _ref.messageForReply;
52384
52432
  var _useLexicalComposerCo = LexicalComposerContext.useLexicalComposerContext(),
@@ -53237,10 +53285,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53237
53285
  }
53238
53286
  }
53239
53287
  };
53240
- var handleCut = function handleCut() {
53241
- setMessageText('');
53242
- setMentionedUsers([]);
53243
- };
53244
53288
  var handleEmojiPopupToggle = function handleEmojiPopupToggle(bool) {
53245
53289
  setIsEmojisOpened(bool);
53246
53290
  };
@@ -53832,7 +53876,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53832
53876
  }, 800);
53833
53877
  }
53834
53878
  messageContRef.current.addEventListener('paste', handlePastAttachments);
53835
- messageContRef.current.addEventListener('cut', handleCut);
53836
53879
  document.addEventListener('mousedown', handleClick);
53837
53880
  return function () {
53838
53881
  if (inputHeightTimeout) {
@@ -53842,7 +53885,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53842
53885
  document.removeEventListener('mousedown', handleClick);
53843
53886
  if (messageContRef && messageContRef.current) {
53844
53887
  messageContRef.current.removeEventListener('paste', handlePastAttachments);
53845
- messageContRef.current.removeEventListener('cut', handleCut);
53846
53888
  }
53847
53889
  };
53848
53890
  }, []);
@@ -54020,14 +54062,23 @@ var SendMessageInput = function SendMessageInput(_ref3) {
54020
54062
  attachment: messageForReply.attachments[0],
54021
54063
  backgroundColor: selectedFileAttachmentsBoxBackground || '',
54022
54064
  isRepliedMessage: true
54023
- })) : 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, {
54024
54075
  backgroundColor: accentColor,
54025
54076
  iconColor: textOnPrimary
54026
54077
  }, /*#__PURE__*/React__default.createElement(SvgChoseFile, null)))), /*#__PURE__*/React__default.createElement(ReplyMessageBody$1, {
54027
54078
  linkColor: accentColor
54028
54079
  }, /*#__PURE__*/React__default.createElement(EditReplyMessageHeader, {
54029
54080
  color: accentColor
54030
- }, 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, {
54031
54082
  style: {
54032
54083
  margin: '0 4px -3px 0'
54033
54084
  }
@@ -54382,7 +54433,7 @@ var MessageInputWrapper = styled__default.div(_templateObject12$7 || (_templateO
54382
54433
  }, function (props) {
54383
54434
  return props.borderRadius || '18px';
54384
54435
  });
54385
- 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) {
54386
54437
  return props.borderRadius;
54387
54438
  }, function (props) {
54388
54439
  return props.backgroundColor;
@@ -54490,19 +54541,24 @@ var LinkPreviewContainer = styled__default.div(_templateObject39$1 || (_template
54490
54541
  return props.isClosing ? linkPreviewSlideOut : linkPreviewSlideIn;
54491
54542
  });
54492
54543
  var LinkPreviewContent = styled__default.div(_templateObject40$1 || (_templateObject40$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: 12px;\n flex: 1;\n overflow: hidden;\n"])));
54493
- 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
+ });
54494
54547
  var LinkPreviewIcon = styled__default(SvgLinkIcon)(_templateObject42 || (_templateObject42 = _taggedTemplateLiteralLoose(["\n color: ", ";\n rect {\n fill: ", ";\n fill-opacity: 1;\n }\n"])), function (props) {
54495
54548
  return props.color;
54496
54549
  }, function (props) {
54497
54550
  return props.bg;
54498
54551
  });
54499
- 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) {
54500
54556
  return props.hasImage ? '' : 'padding-left: 0;';
54501
54557
  });
54502
- 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) {
54503
54559
  return props.color;
54504
54560
  });
54505
- 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) {
54506
54562
  return props.color;
54507
54563
  });
54508
54564
 
@@ -55335,12 +55391,14 @@ var Actions = function Actions(_ref) {
55335
55391
  commonGroupsTextColor = _ref.commonGroupsTextColor,
55336
55392
  showGroupsInCommon = _ref.showGroupsInCommon;
55337
55393
  var _useColor = useColors(),
55394
+ accentColor = _useColor[THEME_COLORS.ACCENT],
55338
55395
  textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
55339
55396
  textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY],
55340
55397
  iconPrimary = _useColor[THEME_COLORS.ICON_PRIMARY],
55341
55398
  surface1 = _useColor[THEME_COLORS.SURFACE_1],
55342
55399
  warningColor = _useColor[THEME_COLORS.WARNING],
55343
- backgroundColor = _useColor[THEME_COLORS.BACKGROUND];
55400
+ backgroundColor = _useColor[THEME_COLORS.BACKGROUND],
55401
+ textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY];
55344
55402
  var ChatClient = getClient();
55345
55403
  var user = ChatClient.user;
55346
55404
  var _useState = React.useState(false),
@@ -55353,35 +55411,39 @@ var Actions = function Actions(_ref) {
55353
55411
  leaveChannelPopupOpen = _useState3[0],
55354
55412
  setLeaveChannelPopupOpen = _useState3[1];
55355
55413
  var _useState4 = React.useState(false),
55356
- deleteChannelPopupOpen = _useState4[0],
55357
- setDeleteChannelPopupOpen = _useState4[1];
55414
+ leaveChannelOfflinePopupOpen = _useState4[0],
55415
+ setLeaveChannelOfflinePopupOpen = _useState4[1];
55358
55416
  var _useState5 = React.useState(false),
55359
- blockChannelPopupOpen = _useState5[0],
55360
- setBlockChannelPopupOpen = _useState5[1];
55417
+ deleteChannelPopupOpen = _useState5[0],
55418
+ setDeleteChannelPopupOpen = _useState5[1];
55361
55419
  var _useState6 = React.useState(false),
55362
- blockUserPopupOpen = _useState6[0],
55363
- setBlockUserPopupOpen = _useState6[1];
55420
+ blockChannelPopupOpen = _useState6[0],
55421
+ setBlockChannelPopupOpen = _useState6[1];
55364
55422
  var _useState7 = React.useState(false),
55365
- unblockUserPopupOpen = _useState7[0],
55366
- setUnblockUserPopupOpen = _useState7[1];
55423
+ blockUserPopupOpen = _useState7[0],
55424
+ setBlockUserPopupOpen = _useState7[1];
55367
55425
  var _useState8 = React.useState(false),
55368
- reportUserPopupOpen = _useState8[0],
55369
- setReportUserPopupOpen = _useState8[1];
55426
+ unblockUserPopupOpen = _useState8[0],
55427
+ setUnblockUserPopupOpen = _useState8[1];
55370
55428
  var _useState9 = React.useState(false),
55371
- disappearingMessagesPopupOpen = _useState9[0],
55372
- setDisappearingMessagesPopupOpen = _useState9[1];
55429
+ reportUserPopupOpen = _useState9[0],
55430
+ setReportUserPopupOpen = _useState9[1];
55373
55431
  var _useState0 = React.useState(false),
55374
- groupsInCommonPopupOpen = _useState0[0],
55375
- 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];
55376
55437
  var _usePermissions = usePermissions(channel.userRole),
55377
55438
  checkActionPermission = _usePermissions[0];
55378
- var _useState1 = React.useState(''),
55379
- popupButtonText = _useState1[0],
55380
- setPopupButtonText = _useState1[1];
55381
55439
  var _useState10 = React.useState(''),
55382
- popupTitle = _useState10[0],
55383
- setPopupTitle = _useState10[1];
55440
+ popupButtonText = _useState10[0],
55441
+ setPopupButtonText = _useState10[1];
55442
+ var _useState11 = React.useState(''),
55443
+ popupTitle = _useState11[0],
55444
+ setPopupTitle = _useState11[1];
55384
55445
  var dispatch = useDispatch();
55446
+ var connectionStatus = useSelector(connectionStatusSelector);
55385
55447
  var oneHour = 60 * 60 * 1000;
55386
55448
  var twoHours = oneHour * 2;
55387
55449
  var oneDay = oneHour * 24;
@@ -55426,6 +55488,10 @@ var Actions = function Actions(_ref) {
55426
55488
  }
55427
55489
  };
55428
55490
  var handleLeaveChannel = function handleLeaveChannel() {
55491
+ if (connectionStatus !== CONNECTION_STATUS.CONNECTED) {
55492
+ setLeaveChannelOfflinePopupOpen(true);
55493
+ return;
55494
+ }
55429
55495
  dispatch(leaveChannelAC(channel.id));
55430
55496
  };
55431
55497
  var handleDeleteChannel = function handleDeleteChannel() {
@@ -55727,7 +55793,37 @@ var Actions = function Actions(_ref) {
55727
55793
  buttonText: popupButtonText,
55728
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.',
55729
55795
  title: popupTitle
55730
- })), 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, {
55731
55827
  handleFunction: handleDeleteChannel,
55732
55828
  togglePopup: handleToggleDeleteChannelPopupOpen,
55733
55829
  buttonText: popupButtonText,