sceyt-chat-react-uikit 1.8.7-beta.7 → 1.8.7-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.
@@ -49,6 +49,10 @@ interface IChannelProps {
49
49
  doNotShowMessageDeliveryTypes: string[];
50
50
  showPhoneNumber?: boolean;
51
51
  channelListWidth?: number;
52
+ getCustomIconOnAvatar?: (args: {
53
+ channel: IChannel;
54
+ user: IUser;
55
+ }) => any;
52
56
  }
53
57
  declare const Channel: React.FC<IChannelProps>;
54
58
  export default Channel;
@@ -78,6 +78,7 @@ interface IChannelListProps {
78
78
  getCustomLatestMessage?: (lastMessage: IMessage, typingOrRecording: any, draftMessageText: any, textSecondary: string, channel: IChannel, channelLastMessageFontSize: string, channelLastMessageHeight: string, isDirectChannel: boolean, textPrimary: string, messageAuthorRef: any, contactsMap: {
79
79
  [key: string]: IContact;
80
80
  }, getFromContacts: boolean, warningColor: string, user: IUser, MessageText: any) => any;
81
+ getCustomIconOnAvatar?: (channel: IChannel, user: IUser) => any;
81
82
  doNotShowMessageDeliveryTypes?: string[];
82
83
  showPhoneNumber?: boolean;
83
84
  channelListWidth?: number;
package/index.js CHANGED
@@ -29740,7 +29740,8 @@ var Channel = function Channel(_ref3) {
29740
29740
  getCustomLatestMessage = _ref3.getCustomLatestMessage,
29741
29741
  doNotShowMessageDeliveryTypes = _ref3.doNotShowMessageDeliveryTypes,
29742
29742
  showPhoneNumber = _ref3.showPhoneNumber,
29743
- channelListWidth = _ref3.channelListWidth;
29743
+ channelListWidth = _ref3.channelListWidth,
29744
+ getCustomIconOnAvatar = _ref3.getCustomIconOnAvatar;
29744
29745
  var _useColor = useColors(),
29745
29746
  accentColor = _useColor[THEME_COLORS.ACCENT],
29746
29747
  textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
@@ -29940,7 +29941,10 @@ var Channel = function Channel(_ref3) {
29940
29941
  })), isDirectChannel && directChannelUser && hideUserPresence && (hideUserPresence(directChannelUser) ? '' : directChannelUser.presence && directChannelUser.presence.state === USER_PRESENCE_STATUS.ONLINE) && (/*#__PURE__*/React__default.createElement(UserStatus, {
29941
29942
  backgroundColor: onlineStatus,
29942
29943
  borderColor: background
29943
- })))), channelListWidth === undefined || channelListWidth >= 280 ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ChannelInfo, {
29944
+ })))), getCustomIconOnAvatar ? getCustomIconOnAvatar({
29945
+ channel: channel,
29946
+ user: user
29947
+ }) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null), channelListWidth === undefined || channelListWidth >= 280 ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ChannelInfo, {
29944
29948
  avatar: showAvatar,
29945
29949
  isMuted: channel.muted,
29946
29950
  isPinned: !!channel.pinnedAt,
@@ -32296,6 +32300,7 @@ var ChannelList = function ChannelList(_ref2) {
32296
32300
  searchedChannelsTitleFontSize = _ref2.searchedChannelsTitleFontSize,
32297
32301
  searchChannelsPadding = _ref2.searchChannelsPadding,
32298
32302
  getCustomLatestMessage = _ref2.getCustomLatestMessage,
32303
+ getCustomIconOnAvatar = _ref2.getCustomIconOnAvatar,
32299
32304
  _ref2$doNotShowMessag = _ref2.doNotShowMessageDeliveryTypes,
32300
32305
  doNotShowMessageDeliveryTypes = _ref2$doNotShowMessag === void 0 ? ['system'] : _ref2$doNotShowMessag,
32301
32306
  _ref2$showPhoneNumber = _ref2.showPhoneNumber,
@@ -32634,7 +32639,8 @@ var ChannelList = function ChannelList(_ref2) {
32634
32639
  getCustomLatestMessage: getCustomLatestMessage,
32635
32640
  doNotShowMessageDeliveryTypes: doNotShowMessageDeliveryTypes,
32636
32641
  showPhoneNumber: showPhoneNumber,
32637
- channelListWidth: channelListWidth
32642
+ channelListWidth: channelListWidth,
32643
+ getCustomIconOnAvatar: getCustomIconOnAvatar
32638
32644
  })));
32639
32645
  }), channelsLoading === LOADING_STATE.LOADING && channelsHasNext && (/*#__PURE__*/React__default.createElement(ChannelSkeletonList, {
32640
32646
  color: surface1,
@@ -32674,6 +32680,7 @@ var ChannelList = function ChannelList(_ref2) {
32674
32680
  contactsMap: contactsMap,
32675
32681
  setSelectedChannel: setSelectedChannel,
32676
32682
  getCustomLatestMessage: getCustomLatestMessage,
32683
+ getCustomIconOnAvatar: getCustomIconOnAvatar,
32677
32684
  doNotShowMessageDeliveryTypes: doNotShowMessageDeliveryTypes,
32678
32685
  showPhoneNumber: showPhoneNumber,
32679
32686
  channelListWidth: channelListWidth
@@ -32746,6 +32753,7 @@ var ChannelList = function ChannelList(_ref2) {
32746
32753
  contactsMap: contactsMap,
32747
32754
  setSelectedChannel: setSelectedChannel,
32748
32755
  getCustomLatestMessage: getCustomLatestMessage,
32756
+ getCustomIconOnAvatar: getCustomIconOnAvatar,
32749
32757
  doNotShowMessageDeliveryTypes: doNotShowMessageDeliveryTypes,
32750
32758
  showPhoneNumber: showPhoneNumber
32751
32759
  }));
@@ -32796,6 +32804,7 @@ var ChannelList = function ChannelList(_ref2) {
32796
32804
  contactsMap: contactsMap,
32797
32805
  setSelectedChannel: setSelectedChannel,
32798
32806
  getCustomLatestMessage: getCustomLatestMessage,
32807
+ getCustomIconOnAvatar: getCustomIconOnAvatar,
32799
32808
  doNotShowMessageDeliveryTypes: doNotShowMessageDeliveryTypes,
32800
32809
  showPhoneNumber: showPhoneNumber
32801
32810
  }));
@@ -32842,6 +32851,7 @@ var ChannelList = function ChannelList(_ref2) {
32842
32851
  key: channel.id,
32843
32852
  setSelectedChannel: setSelectedChannel,
32844
32853
  getCustomLatestMessage: getCustomLatestMessage,
32854
+ getCustomIconOnAvatar: getCustomIconOnAvatar,
32845
32855
  doNotShowMessageDeliveryTypes: doNotShowMessageDeliveryTypes,
32846
32856
  showPhoneNumber: showPhoneNumber
32847
32857
  }));
@@ -32880,6 +32890,7 @@ var ChannelList = function ChannelList(_ref2) {
32880
32890
  contactsMap: contactsMap,
32881
32891
  setSelectedChannel: setSelectedChannel,
32882
32892
  getCustomLatestMessage: getCustomLatestMessage,
32893
+ getCustomIconOnAvatar: getCustomIconOnAvatar,
32883
32894
  doNotShowMessageDeliveryTypes: doNotShowMessageDeliveryTypes,
32884
32895
  showPhoneNumber: showPhoneNumber
32885
32896
  }));
@@ -43787,6 +43798,7 @@ function useChatController(_ref5) {
43787
43798
  var visibleUnreadReportedRef = React.useRef(new Set());
43788
43799
  var restoreRef = React.useRef(null);
43789
43800
  var lastBootKeyRef = React.useRef(null);
43801
+ var pendingBootScrolledRef = React.useRef(false);
43790
43802
  var highlightedItemIdRef = React.useRef(null);
43791
43803
  var highlightTimeoutRef = React.useRef(null);
43792
43804
  var unreadRestoreCompletedRef = React.useRef(false);
@@ -44985,6 +44997,7 @@ function useChatController(_ref5) {
44985
44997
  currentJumpIdRef.current += 1;
44986
44998
  activeChannelIdRef.current = channel.id;
44987
44999
  lastBootKeyRef.current = null;
45000
+ pendingBootScrolledRef.current = false;
44988
45001
  restoreRef.current = null;
44989
45002
  windowLoadScopeRef.current = null;
44990
45003
  activeEdgeIntentRef.current = null;
@@ -45081,13 +45094,26 @@ function useChatController(_ref5) {
45081
45094
  return;
45082
45095
  }
45083
45096
  if (!lastBootKeyRef.current) {
45084
- lastBootKeyRef.current = channel.id + ":" + getMessageLocalRef(messages[0]);
45085
- var preservePendingHistoryEdge = pendingEdgeCheckAfterLoadRef.current && activeEdgeIntentRef.current === 'previous';
45086
- restoreRef.current = unreadScrollTo && unreadMessageId ? {
45087
- mode: 'reveal-unread-separator'
45088
- } : preservePendingHistoryEdge ? null : isScrollInteractionActive() ? null : {
45089
- mode: 'to-bottom'
45090
- };
45097
+ var hasConfirmedMessages = messages.some(function (m) {
45098
+ return !!m.id;
45099
+ });
45100
+ if (hasConfirmedMessages) {
45101
+ lastBootKeyRef.current = channel.id + ":" + getMessageLocalRef(messages[0]);
45102
+ pendingBootScrolledRef.current = false;
45103
+ var preservePendingHistoryEdge = pendingEdgeCheckAfterLoadRef.current && activeEdgeIntentRef.current === 'previous';
45104
+ restoreRef.current = unreadScrollTo && unreadMessageId ? {
45105
+ mode: 'reveal-unread-separator'
45106
+ } : preservePendingHistoryEdge ? null : isScrollInteractionActive() ? null : {
45107
+ mode: 'to-bottom'
45108
+ };
45109
+ } else if (!pendingBootScrolledRef.current) {
45110
+ pendingBootScrolledRef.current = true;
45111
+ if (!restoreRef.current) {
45112
+ restoreRef.current = {
45113
+ mode: 'to-bottom'
45114
+ };
45115
+ }
45116
+ }
45091
45117
  }
45092
45118
  var restoreState = restoreRef.current;
45093
45119
  if (!restoreState) {
package/index.modern.js CHANGED
@@ -29739,7 +29739,8 @@ var Channel = function Channel(_ref3) {
29739
29739
  getCustomLatestMessage = _ref3.getCustomLatestMessage,
29740
29740
  doNotShowMessageDeliveryTypes = _ref3.doNotShowMessageDeliveryTypes,
29741
29741
  showPhoneNumber = _ref3.showPhoneNumber,
29742
- channelListWidth = _ref3.channelListWidth;
29742
+ channelListWidth = _ref3.channelListWidth,
29743
+ getCustomIconOnAvatar = _ref3.getCustomIconOnAvatar;
29743
29744
  var _useColor = useColors(),
29744
29745
  accentColor = _useColor[THEME_COLORS.ACCENT],
29745
29746
  textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
@@ -29939,7 +29940,10 @@ var Channel = function Channel(_ref3) {
29939
29940
  })), isDirectChannel && directChannelUser && hideUserPresence && (hideUserPresence(directChannelUser) ? '' : directChannelUser.presence && directChannelUser.presence.state === USER_PRESENCE_STATUS.ONLINE) && (/*#__PURE__*/React__default.createElement(UserStatus, {
29940
29941
  backgroundColor: onlineStatus,
29941
29942
  borderColor: background
29942
- })))), channelListWidth === undefined || channelListWidth >= 280 ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ChannelInfo, {
29943
+ })))), getCustomIconOnAvatar ? getCustomIconOnAvatar({
29944
+ channel: channel,
29945
+ user: user
29946
+ }) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null), channelListWidth === undefined || channelListWidth >= 280 ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ChannelInfo, {
29943
29947
  avatar: showAvatar,
29944
29948
  isMuted: channel.muted,
29945
29949
  isPinned: !!channel.pinnedAt,
@@ -32295,6 +32299,7 @@ var ChannelList = function ChannelList(_ref2) {
32295
32299
  searchedChannelsTitleFontSize = _ref2.searchedChannelsTitleFontSize,
32296
32300
  searchChannelsPadding = _ref2.searchChannelsPadding,
32297
32301
  getCustomLatestMessage = _ref2.getCustomLatestMessage,
32302
+ getCustomIconOnAvatar = _ref2.getCustomIconOnAvatar,
32298
32303
  _ref2$doNotShowMessag = _ref2.doNotShowMessageDeliveryTypes,
32299
32304
  doNotShowMessageDeliveryTypes = _ref2$doNotShowMessag === void 0 ? ['system'] : _ref2$doNotShowMessag,
32300
32305
  _ref2$showPhoneNumber = _ref2.showPhoneNumber,
@@ -32633,7 +32638,8 @@ var ChannelList = function ChannelList(_ref2) {
32633
32638
  getCustomLatestMessage: getCustomLatestMessage,
32634
32639
  doNotShowMessageDeliveryTypes: doNotShowMessageDeliveryTypes,
32635
32640
  showPhoneNumber: showPhoneNumber,
32636
- channelListWidth: channelListWidth
32641
+ channelListWidth: channelListWidth,
32642
+ getCustomIconOnAvatar: getCustomIconOnAvatar
32637
32643
  })));
32638
32644
  }), channelsLoading === LOADING_STATE.LOADING && channelsHasNext && (/*#__PURE__*/React__default.createElement(ChannelSkeletonList, {
32639
32645
  color: surface1,
@@ -32673,6 +32679,7 @@ var ChannelList = function ChannelList(_ref2) {
32673
32679
  contactsMap: contactsMap,
32674
32680
  setSelectedChannel: setSelectedChannel,
32675
32681
  getCustomLatestMessage: getCustomLatestMessage,
32682
+ getCustomIconOnAvatar: getCustomIconOnAvatar,
32676
32683
  doNotShowMessageDeliveryTypes: doNotShowMessageDeliveryTypes,
32677
32684
  showPhoneNumber: showPhoneNumber,
32678
32685
  channelListWidth: channelListWidth
@@ -32745,6 +32752,7 @@ var ChannelList = function ChannelList(_ref2) {
32745
32752
  contactsMap: contactsMap,
32746
32753
  setSelectedChannel: setSelectedChannel,
32747
32754
  getCustomLatestMessage: getCustomLatestMessage,
32755
+ getCustomIconOnAvatar: getCustomIconOnAvatar,
32748
32756
  doNotShowMessageDeliveryTypes: doNotShowMessageDeliveryTypes,
32749
32757
  showPhoneNumber: showPhoneNumber
32750
32758
  }));
@@ -32795,6 +32803,7 @@ var ChannelList = function ChannelList(_ref2) {
32795
32803
  contactsMap: contactsMap,
32796
32804
  setSelectedChannel: setSelectedChannel,
32797
32805
  getCustomLatestMessage: getCustomLatestMessage,
32806
+ getCustomIconOnAvatar: getCustomIconOnAvatar,
32798
32807
  doNotShowMessageDeliveryTypes: doNotShowMessageDeliveryTypes,
32799
32808
  showPhoneNumber: showPhoneNumber
32800
32809
  }));
@@ -32841,6 +32850,7 @@ var ChannelList = function ChannelList(_ref2) {
32841
32850
  key: channel.id,
32842
32851
  setSelectedChannel: setSelectedChannel,
32843
32852
  getCustomLatestMessage: getCustomLatestMessage,
32853
+ getCustomIconOnAvatar: getCustomIconOnAvatar,
32844
32854
  doNotShowMessageDeliveryTypes: doNotShowMessageDeliveryTypes,
32845
32855
  showPhoneNumber: showPhoneNumber
32846
32856
  }));
@@ -32879,6 +32889,7 @@ var ChannelList = function ChannelList(_ref2) {
32879
32889
  contactsMap: contactsMap,
32880
32890
  setSelectedChannel: setSelectedChannel,
32881
32891
  getCustomLatestMessage: getCustomLatestMessage,
32892
+ getCustomIconOnAvatar: getCustomIconOnAvatar,
32882
32893
  doNotShowMessageDeliveryTypes: doNotShowMessageDeliveryTypes,
32883
32894
  showPhoneNumber: showPhoneNumber
32884
32895
  }));
@@ -43786,6 +43797,7 @@ function useChatController(_ref5) {
43786
43797
  var visibleUnreadReportedRef = useRef(new Set());
43787
43798
  var restoreRef = useRef(null);
43788
43799
  var lastBootKeyRef = useRef(null);
43800
+ var pendingBootScrolledRef = useRef(false);
43789
43801
  var highlightedItemIdRef = useRef(null);
43790
43802
  var highlightTimeoutRef = useRef(null);
43791
43803
  var unreadRestoreCompletedRef = useRef(false);
@@ -44984,6 +44996,7 @@ function useChatController(_ref5) {
44984
44996
  currentJumpIdRef.current += 1;
44985
44997
  activeChannelIdRef.current = channel.id;
44986
44998
  lastBootKeyRef.current = null;
44999
+ pendingBootScrolledRef.current = false;
44987
45000
  restoreRef.current = null;
44988
45001
  windowLoadScopeRef.current = null;
44989
45002
  activeEdgeIntentRef.current = null;
@@ -45080,13 +45093,26 @@ function useChatController(_ref5) {
45080
45093
  return;
45081
45094
  }
45082
45095
  if (!lastBootKeyRef.current) {
45083
- lastBootKeyRef.current = channel.id + ":" + getMessageLocalRef(messages[0]);
45084
- var preservePendingHistoryEdge = pendingEdgeCheckAfterLoadRef.current && activeEdgeIntentRef.current === 'previous';
45085
- restoreRef.current = unreadScrollTo && unreadMessageId ? {
45086
- mode: 'reveal-unread-separator'
45087
- } : preservePendingHistoryEdge ? null : isScrollInteractionActive() ? null : {
45088
- mode: 'to-bottom'
45089
- };
45096
+ var hasConfirmedMessages = messages.some(function (m) {
45097
+ return !!m.id;
45098
+ });
45099
+ if (hasConfirmedMessages) {
45100
+ lastBootKeyRef.current = channel.id + ":" + getMessageLocalRef(messages[0]);
45101
+ pendingBootScrolledRef.current = false;
45102
+ var preservePendingHistoryEdge = pendingEdgeCheckAfterLoadRef.current && activeEdgeIntentRef.current === 'previous';
45103
+ restoreRef.current = unreadScrollTo && unreadMessageId ? {
45104
+ mode: 'reveal-unread-separator'
45105
+ } : preservePendingHistoryEdge ? null : isScrollInteractionActive() ? null : {
45106
+ mode: 'to-bottom'
45107
+ };
45108
+ } else if (!pendingBootScrolledRef.current) {
45109
+ pendingBootScrolledRef.current = true;
45110
+ if (!restoreRef.current) {
45111
+ restoreRef.current = {
45112
+ mode: 'to-bottom'
45113
+ };
45114
+ }
45115
+ }
45090
45116
  }
45091
45117
  var restoreState = restoreRef.current;
45092
45118
  if (!restoreState) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sceyt-chat-react-uikit",
3
- "version": "1.8.7-beta.7",
3
+ "version": "1.8.7-beta.9",
4
4
  "description": "Interactive React UI Components for Sceyt Chat.",
5
5
  "author": "Sceyt",
6
6
  "license": "MIT",