sceyt-chat-react-uikit 1.8.6-beta.7 → 1.8.6-beta.9

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.
@@ -1,6 +1,6 @@
1
1
  import React, { FC } from 'react';
2
2
  import { IMessage } from '../../types';
3
- interface SendMessageProps {
3
+ export interface SendMessageProps {
4
4
  draggedAttachments?: boolean;
5
5
  handleAttachmentSelected?: (state: boolean) => void;
6
6
  handleSendMessage?: (message: IMessage, channelId: string) => Promise<IMessage>;
@@ -61,6 +61,11 @@ interface SendMessageProps {
61
61
  replyEditMessageContainerBottomPosition?: string;
62
62
  replyEditMessageContainerLeftPosition?: string;
63
63
  replyEditMessageContainerPadding?: string;
64
+ customReplyMessageTypes?: string[];
65
+ CustomReplyMessageContainer?: FC<{
66
+ messageForReply: IMessage;
67
+ onClose: () => void;
68
+ }>;
64
69
  editMessageIcon?: JSX.Element;
65
70
  editMessageBackgroundColor?: string;
66
71
  editMessageTextColor?: string;
package/index.js CHANGED
@@ -18299,7 +18299,7 @@ function getChannelsForForward() {
18299
18299
  channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
18300
18300
  var isSelfChannel = channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === _SceytChatClient.user.id;
18301
18301
  return channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? channel.userRole === 'admin' || channel.userRole === 'owner' : channel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? isSelfChannel || channel.members.find(function (member) {
18302
- return member.id && member.id !== _SceytChatClient.user.id;
18302
+ return member.id && member.id !== _SceytChatClient.user.id && !member.blocked && member.state !== USER_STATE.DELETED && !(hideUserPresence && hideUserPresence(member));
18303
18303
  }) : true;
18304
18304
  });
18305
18305
  _context5.n = 5;
@@ -18373,13 +18373,16 @@ function searchChannelsForForward(action) {
18373
18373
  _contactsWithChannelsMap[directChannelUser.id] = true;
18374
18374
  }
18375
18375
  var userName = makeUsername(directChannelUser && _contactsMap[directChannelUser.id], directChannelUser, _getFromContacts).toLowerCase();
18376
- if (userName.includes(_lowerCaseSearchBy) || isSelfChannel && 'me'.includes(_lowerCaseSearchBy) || isSelfChannel && 'you'.includes(_lowerCaseSearchBy)) {
18376
+ var isBlockedOrDeleted = !isSelfChannel && directChannelUser && (directChannelUser.blocked || directChannelUser.state === USER_STATE.DELETED || !!(hideUserPresence && hideUserPresence(directChannelUser)));
18377
+ if (!isBlockedOrDeleted && (userName.includes(_lowerCaseSearchBy) || isSelfChannel && 'me'.includes(_lowerCaseSearchBy) || isSelfChannel && 'you'.includes(_lowerCaseSearchBy))) {
18377
18378
  _chatsGroups.push(channel);
18378
18379
  }
18379
18380
  } else {
18380
18381
  if (channel.subject && channel.subject.toLowerCase().includes(_lowerCaseSearchBy)) {
18381
18382
  if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
18382
- _publicChannels.push(channel);
18383
+ if (channel.userRole === 'admin' || channel.userRole === 'owner') {
18384
+ _publicChannels.push(channel);
18385
+ }
18383
18386
  } else {
18384
18387
  _chatsGroups.push(channel);
18385
18388
  }
@@ -18434,7 +18437,7 @@ function searchChannelsForForward(action) {
18434
18437
  _publicChannels = [];
18435
18438
  handleChannels(Object.values(channelsMap));
18436
18439
  channelsToAdd = channelsData.channels.filter(function (channel) {
18437
- return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
18440
+ return (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) && (channel.userRole === 'admin' || channel.userRole === 'owner');
18438
18441
  });
18439
18442
  _context6.n = 6;
18440
18443
  return effects.put(setSearchedChannelsForForwardAC({
@@ -18636,8 +18639,9 @@ function channelsForForwardLoadMore(action) {
18636
18639
  return effects.put(channelHasNextAC(channelsData.hasNext, true));
18637
18640
  case 3:
18638
18641
  channelsToAdd = channelsData.channels.filter(function (channel) {
18639
- return channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? channel.userRole === 'admin' || channel.userRole === 'owner' : channel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? channel.members.find(function (member) {
18640
- return member.id && member.id !== _SceytChatClient4.user.id;
18642
+ var isSelfChannel = channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === _SceytChatClient4.user.id;
18643
+ return channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? channel.userRole === 'admin' || channel.userRole === 'owner' : channel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? isSelfChannel || channel.members.find(function (member) {
18644
+ return member.id && member.id !== _SceytChatClient4.user.id && !member.blocked && member.state !== USER_STATE.DELETED && !(hideUserPresence && hideUserPresence(member));
18641
18645
  }) : true;
18642
18646
  });
18643
18647
  _context9.n = 4;
@@ -50254,6 +50258,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
50254
50258
  replyEditMessageContainerBottomPosition = _ref3.replyEditMessageContainerBottomPosition,
50255
50259
  replyEditMessageContainerPadding = _ref3.replyEditMessageContainerPadding,
50256
50260
  replyEditMessageContainerLeftPosition = _ref3.replyEditMessageContainerLeftPosition,
50261
+ customReplyMessageTypes = _ref3.customReplyMessageTypes,
50262
+ CustomReplyMessageContainer = _ref3.CustomReplyMessageContainer,
50257
50263
  sendAttachmentSeparately = _ref3.sendAttachmentSeparately,
50258
50264
  _ref3$allowMentionUse = _ref3.allowMentionUser,
50259
50265
  allowMentionUser = _ref3$allowMentionUse === void 0 ? true : _ref3$allowMentionUse,
@@ -51769,7 +51775,10 @@ var SendMessageInput = function SendMessageInput(_ref3) {
51769
51775
  }, /*#__PURE__*/React__default.createElement(CloseEditMode, {
51770
51776
  color: textSecondary,
51771
51777
  onClick: handleCloseReply
51772
- }, /*#__PURE__*/React__default.createElement(SvgClose, null)), /*#__PURE__*/React__default.createElement(ReplyMessageCont, null, !!(messageForReply.attachments && messageForReply.attachments.length) && !messageForReply.viewOnce && (messageForReply.attachments[0].type === attachmentTypes.image || messageForReply.attachments[0].type === attachmentTypes.video ? (/*#__PURE__*/React__default.createElement(Attachment$1, {
51778
+ }, /*#__PURE__*/React__default.createElement(SvgClose, null)), CustomReplyMessageContainer && customReplyMessageTypes !== null && customReplyMessageTypes !== void 0 && customReplyMessageTypes.includes(messageForReply.type) ? (/*#__PURE__*/React__default.createElement(CustomReplyMessageContainer, {
51779
+ messageForReply: messageForReply,
51780
+ onClose: handleCloseReply
51781
+ })) : (/*#__PURE__*/React__default.createElement(ReplyMessageCont, null, !!(messageForReply.attachments && messageForReply.attachments.length) && !messageForReply.viewOnce && (messageForReply.attachments[0].type === attachmentTypes.image || messageForReply.attachments[0].type === attachmentTypes.video ? (/*#__PURE__*/React__default.createElement(Attachment$1, {
51773
51782
  attachment: messageForReply.attachments[0],
51774
51783
  backgroundColor: selectedFileAttachmentsBoxBackground || '',
51775
51784
  isRepliedMessage: true
@@ -51820,7 +51829,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
51820
51829
  getFromContacts: getFromContacts,
51821
51830
  accentColor: accentColor,
51822
51831
  textSecondary: textSecondary
51823
- }))))), showLinkPreview && linkPreview && (/*#__PURE__*/React__default.createElement(LinkPreviewContainer, {
51832
+ })))))), showLinkPreview && linkPreview && (/*#__PURE__*/React__default.createElement(LinkPreviewContainer, {
51824
51833
  backgroundColor: surface1Background,
51825
51834
  borderColor: borderColor,
51826
51835
  isClosing: isClosingPreview,
package/index.modern.js CHANGED
@@ -18298,7 +18298,7 @@ function getChannelsForForward() {
18298
18298
  channel.metadata = isJSON(channel.metadata) ? JSON.parse(channel.metadata) : channel.metadata;
18299
18299
  var isSelfChannel = channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === _SceytChatClient.user.id;
18300
18300
  return channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? channel.userRole === 'admin' || channel.userRole === 'owner' : channel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? isSelfChannel || channel.members.find(function (member) {
18301
- return member.id && member.id !== _SceytChatClient.user.id;
18301
+ return member.id && member.id !== _SceytChatClient.user.id && !member.blocked && member.state !== USER_STATE.DELETED && !(hideUserPresence && hideUserPresence(member));
18302
18302
  }) : true;
18303
18303
  });
18304
18304
  _context5.n = 5;
@@ -18372,13 +18372,16 @@ function searchChannelsForForward(action) {
18372
18372
  _contactsWithChannelsMap[directChannelUser.id] = true;
18373
18373
  }
18374
18374
  var userName = makeUsername(directChannelUser && _contactsMap[directChannelUser.id], directChannelUser, _getFromContacts).toLowerCase();
18375
- if (userName.includes(_lowerCaseSearchBy) || isSelfChannel && 'me'.includes(_lowerCaseSearchBy) || isSelfChannel && 'you'.includes(_lowerCaseSearchBy)) {
18375
+ var isBlockedOrDeleted = !isSelfChannel && directChannelUser && (directChannelUser.blocked || directChannelUser.state === USER_STATE.DELETED || !!(hideUserPresence && hideUserPresence(directChannelUser)));
18376
+ if (!isBlockedOrDeleted && (userName.includes(_lowerCaseSearchBy) || isSelfChannel && 'me'.includes(_lowerCaseSearchBy) || isSelfChannel && 'you'.includes(_lowerCaseSearchBy))) {
18376
18377
  _chatsGroups.push(channel);
18377
18378
  }
18378
18379
  } else {
18379
18380
  if (channel.subject && channel.subject.toLowerCase().includes(_lowerCaseSearchBy)) {
18380
18381
  if (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) {
18381
- _publicChannels.push(channel);
18382
+ if (channel.userRole === 'admin' || channel.userRole === 'owner') {
18383
+ _publicChannels.push(channel);
18384
+ }
18382
18385
  } else {
18383
18386
  _chatsGroups.push(channel);
18384
18387
  }
@@ -18433,7 +18436,7 @@ function searchChannelsForForward(action) {
18433
18436
  _publicChannels = [];
18434
18437
  handleChannels(Object.values(channelsMap));
18435
18438
  channelsToAdd = channelsData.channels.filter(function (channel) {
18436
- return channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST;
18439
+ return (channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC || channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST) && (channel.userRole === 'admin' || channel.userRole === 'owner');
18437
18440
  });
18438
18441
  _context6.n = 6;
18439
18442
  return put(setSearchedChannelsForForwardAC({
@@ -18635,8 +18638,9 @@ function channelsForForwardLoadMore(action) {
18635
18638
  return put(channelHasNextAC(channelsData.hasNext, true));
18636
18639
  case 3:
18637
18640
  channelsToAdd = channelsData.channels.filter(function (channel) {
18638
- return channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? channel.userRole === 'admin' || channel.userRole === 'owner' : channel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? channel.members.find(function (member) {
18639
- return member.id && member.id !== _SceytChatClient4.user.id;
18641
+ var isSelfChannel = channel.memberCount === 1 && channel.members.length > 0 && channel.members[0].id === _SceytChatClient4.user.id;
18642
+ return channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC ? channel.userRole === 'admin' || channel.userRole === 'owner' : channel.type === DEFAULT_CHANNEL_TYPE.DIRECT ? isSelfChannel || channel.members.find(function (member) {
18643
+ return member.id && member.id !== _SceytChatClient4.user.id && !member.blocked && member.state !== USER_STATE.DELETED && !(hideUserPresence && hideUserPresence(member));
18640
18644
  }) : true;
18641
18645
  });
18642
18646
  _context9.n = 4;
@@ -50253,6 +50257,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
50253
50257
  replyEditMessageContainerBottomPosition = _ref3.replyEditMessageContainerBottomPosition,
50254
50258
  replyEditMessageContainerPadding = _ref3.replyEditMessageContainerPadding,
50255
50259
  replyEditMessageContainerLeftPosition = _ref3.replyEditMessageContainerLeftPosition,
50260
+ customReplyMessageTypes = _ref3.customReplyMessageTypes,
50261
+ CustomReplyMessageContainer = _ref3.CustomReplyMessageContainer,
50256
50262
  sendAttachmentSeparately = _ref3.sendAttachmentSeparately,
50257
50263
  _ref3$allowMentionUse = _ref3.allowMentionUser,
50258
50264
  allowMentionUser = _ref3$allowMentionUse === void 0 ? true : _ref3$allowMentionUse,
@@ -51768,7 +51774,10 @@ var SendMessageInput = function SendMessageInput(_ref3) {
51768
51774
  }, /*#__PURE__*/React__default.createElement(CloseEditMode, {
51769
51775
  color: textSecondary,
51770
51776
  onClick: handleCloseReply
51771
- }, /*#__PURE__*/React__default.createElement(SvgClose, null)), /*#__PURE__*/React__default.createElement(ReplyMessageCont, null, !!(messageForReply.attachments && messageForReply.attachments.length) && !messageForReply.viewOnce && (messageForReply.attachments[0].type === attachmentTypes.image || messageForReply.attachments[0].type === attachmentTypes.video ? (/*#__PURE__*/React__default.createElement(Attachment$1, {
51777
+ }, /*#__PURE__*/React__default.createElement(SvgClose, null)), CustomReplyMessageContainer && customReplyMessageTypes !== null && customReplyMessageTypes !== void 0 && customReplyMessageTypes.includes(messageForReply.type) ? (/*#__PURE__*/React__default.createElement(CustomReplyMessageContainer, {
51778
+ messageForReply: messageForReply,
51779
+ onClose: handleCloseReply
51780
+ })) : (/*#__PURE__*/React__default.createElement(ReplyMessageCont, null, !!(messageForReply.attachments && messageForReply.attachments.length) && !messageForReply.viewOnce && (messageForReply.attachments[0].type === attachmentTypes.image || messageForReply.attachments[0].type === attachmentTypes.video ? (/*#__PURE__*/React__default.createElement(Attachment$1, {
51772
51781
  attachment: messageForReply.attachments[0],
51773
51782
  backgroundColor: selectedFileAttachmentsBoxBackground || '',
51774
51783
  isRepliedMessage: true
@@ -51819,7 +51828,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
51819
51828
  getFromContacts: getFromContacts,
51820
51829
  accentColor: accentColor,
51821
51830
  textSecondary: textSecondary
51822
- }))))), showLinkPreview && linkPreview && (/*#__PURE__*/React__default.createElement(LinkPreviewContainer, {
51831
+ })))))), showLinkPreview && linkPreview && (/*#__PURE__*/React__default.createElement(LinkPreviewContainer, {
51823
51832
  backgroundColor: surface1Background,
51824
51833
  borderColor: borderColor,
51825
51834
  isClosing: isClosingPreview,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sceyt-chat-react-uikit",
3
- "version": "1.8.6-beta.7",
3
+ "version": "1.8.6-beta.9",
4
4
  "description": "Interactive React UI Components for Sceyt Chat.",
5
5
  "author": "Sceyt",
6
6
  "license": "MIT",