stream-chat-react 11.1.1 → 11.2.0
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.
- package/dist/browser.full-bundle.js +101 -58
- package/dist/browser.full-bundle.js.map +1 -1
- package/dist/browser.full-bundle.min.js +4 -4
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/components/AutoCompleteTextarea/Textarea.d.ts +1 -0
- package/dist/components/AutoCompleteTextarea/Textarea.d.ts.map +1 -1
- package/dist/components/AutoCompleteTextarea/Textarea.js +10 -8
- package/dist/components/Channel/Channel.d.ts.map +1 -1
- package/dist/components/Channel/Channel.js +17 -10
- package/dist/components/ChannelList/ChannelList.d.ts +2 -0
- package/dist/components/ChannelList/ChannelList.d.ts.map +1 -1
- package/dist/components/ChannelList/ChannelList.js +2 -2
- package/dist/components/ChannelList/hooks/useMessageNewListener.d.ts +2 -2
- package/dist/components/ChannelList/hooks/useMessageNewListener.d.ts.map +1 -1
- package/dist/components/ChannelList/hooks/useMessageNewListener.js +16 -11
- package/dist/components/Emojis/index.cjs.js +1 -1
- package/dist/components/Gallery/ModalGallery.d.ts.map +1 -1
- package/dist/components/Gallery/ModalGallery.js +11 -1
- package/dist/components/MessageInput/CooldownTimer.d.ts +1 -1
- package/dist/components/MessageInput/CooldownTimer.d.ts.map +1 -1
- package/dist/components/MessageInput/CooldownTimer.js +14 -11
- package/dist/components/MessageInput/hooks/useCooldownTimer.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useCooldownTimer.js +11 -2
- package/dist/components/MessageInput/icons.js +4 -4
- package/dist/css/v2/index.css +1 -1
- package/dist/css/v2/index.layout.css +1 -1
- package/dist/{icons-a35a8ee7.js → icons-b84cd102.js} +4 -4
- package/dist/index.cjs.js +97 -54
- package/dist/scss/v2/AttachmentList/AttachmentList-layout.scss +1 -0
- package/dist/scss/v2/vendor/react-image-gallery.scss +19 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -10007,7 +10007,16 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
10007
10007
|
|
|
10008
10008
|
var ImageGallery = /*@__PURE__*/getDefaultExportFromCjs(imageGallery.exports);
|
|
10009
10009
|
|
|
10010
|
-
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var
|
|
10010
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var onError = function (e) {
|
|
10011
|
+
// Prevent having alt attribute on img as the img takes the height of the alt text
|
|
10012
|
+
// instead of the CSS / element width & height when the CSS mask (fallback) is applied.
|
|
10013
|
+
e.target.alt = '';
|
|
10014
|
+
};
|
|
10015
|
+
var renderItem = function (_a) {
|
|
10016
|
+
var original = _a.original, originalAlt = _a.originalAlt;
|
|
10017
|
+
return (React__default["default"].createElement(BaseImage, { alt: originalAlt, className: 'image-gallery-image', onError: onError, src: original }));
|
|
10018
|
+
};
|
|
10019
|
+
var ModalGallery = function (props) {
|
|
10011
10020
|
var images = props.images, index = props.index;
|
|
10012
10021
|
var t = useTranslationContext('ModalGallery').t;
|
|
10013
10022
|
var formattedArray = React$2.useMemo(function () {
|
|
@@ -10020,7 +10029,7 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
10020
10029
|
};
|
|
10021
10030
|
});
|
|
10022
10031
|
}, [images]);
|
|
10023
|
-
return (React__default["default"].createElement(ImageGallery, { items: formattedArray, showIndex: true, showPlayButton: false, showThumbnails: false, startIndex: index }));
|
|
10032
|
+
return (React__default["default"].createElement(ImageGallery, { items: formattedArray, renderItem: renderItem, showIndex: true, showPlayButton: false, showThumbnails: false, startIndex: index }));
|
|
10024
10033
|
};
|
|
10025
10034
|
|
|
10026
10035
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var UnMemoizedGallery = function (props) {
|
|
@@ -43590,6 +43599,7 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
43590
43599
|
currentTrigger: null,
|
|
43591
43600
|
data: null,
|
|
43592
43601
|
dataLoading: false,
|
|
43602
|
+
isComposing: false,
|
|
43593
43603
|
left: null,
|
|
43594
43604
|
selectionEnd: 0,
|
|
43595
43605
|
selectionStart: 0,
|
|
@@ -43640,22 +43650,23 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
43640
43650
|
SuggestionItem,
|
|
43641
43651
|
SuggestionList = List$1
|
|
43642
43652
|
} = this.props;
|
|
43653
|
+
const {
|
|
43654
|
+
isComposing
|
|
43655
|
+
} = this.state;
|
|
43643
43656
|
const triggerProps = this.getTriggerProps();
|
|
43644
|
-
if (triggerProps.values
|
|
43645
|
-
|
|
43646
|
-
|
|
43647
|
-
|
|
43648
|
-
|
|
43649
|
-
|
|
43650
|
-
|
|
43651
|
-
|
|
43652
|
-
|
|
43653
|
-
|
|
43654
|
-
|
|
43655
|
-
|
|
43656
|
-
|
|
43657
|
-
}
|
|
43658
|
-
return null;
|
|
43657
|
+
if (isComposing || !triggerProps.values || !triggerProps.currentTrigger || disableMentions && triggerProps.currentTrigger === '@') return null;
|
|
43658
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
43659
|
+
className: clsx('rta__autocomplete', 'str-chat__suggestion-list-container', dropdownClassName),
|
|
43660
|
+
ref: this.setDropdownRef,
|
|
43661
|
+
style: dropdownStyle
|
|
43662
|
+
}, /*#__PURE__*/React__default["default"].createElement(SuggestionList, _extends$2({
|
|
43663
|
+
className: clsx('str-chat__suggestion-list', listClassName),
|
|
43664
|
+
dropdownScroll: this._dropdownScroll,
|
|
43665
|
+
itemClassName: clsx('str-chat__suggestion-list-item', itemClassName),
|
|
43666
|
+
itemStyle: itemStyle,
|
|
43667
|
+
onSelect: this._onSelect,
|
|
43668
|
+
SuggestionItem: SuggestionItem
|
|
43669
|
+
}, triggerProps)));
|
|
43659
43670
|
}
|
|
43660
43671
|
render() {
|
|
43661
43672
|
const {
|
|
@@ -43709,6 +43720,14 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
43709
43720
|
this._onClickAndBlurHandler(e);
|
|
43710
43721
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
43711
43722
|
},
|
|
43723
|
+
onCompositionEnd: () => this.setState(pv => ({
|
|
43724
|
+
...pv,
|
|
43725
|
+
isComposing: false
|
|
43726
|
+
})),
|
|
43727
|
+
onCompositionStart: () => this.setState(pv => ({
|
|
43728
|
+
...pv,
|
|
43729
|
+
isComposing: true
|
|
43730
|
+
})),
|
|
43712
43731
|
onFocus: e => {
|
|
43713
43732
|
var _this$props$onFocus, _this$props;
|
|
43714
43733
|
(_this$props$onFocus = (_this$props = this.props).onFocus) === null || _this$props$onFocus === void 0 ? void 0 : _this$props$onFocus.call(_this$props, e);
|
|
@@ -47655,14 +47674,14 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
47655
47674
|
|
|
47656
47675
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var EmojiIconLarge = function () {
|
|
47657
47676
|
var t = useTranslationContext('EmojiIconLarge').t;
|
|
47658
|
-
return (React__default["default"].createElement("svg", { height: '28', width: '28', xmlns: 'http://www.w3.org/2000/svg' },
|
|
47677
|
+
return (React__default["default"].createElement("svg", { height: '28', viewBox: '0 0 28 28', width: '28', xmlns: 'http://www.w3.org/2000/svg' },
|
|
47659
47678
|
React__default["default"].createElement("title", null, t('Open emoji picker')),
|
|
47660
47679
|
React__default["default"].createElement("g", { clipRule: 'evenodd', fillRule: 'evenodd' },
|
|
47661
47680
|
React__default["default"].createElement("path", { d: 'M14 4.4C8.6 4.4 4.4 8.6 4.4 14c0 5.4 4.2 9.6 9.6 9.6c5.4 0 9.6-4.2 9.6-9.6c0-5.4-4.2-9.6-9.6-9.6zM2 14c0-6.6 5.4-12 12-12s12 5.4 12 12s-5.4 12-12 12s-12-5.4-12-12zM12.8 11c0 1-.8 1.8-1.8 1.8s-1.8-.8-1.8-1.8s.8-1.8 1.8-1.8s1.8.8 1.8 1.8zM18.8 11c0 1-.8 1.8-1.8 1.8s-1.8-.8-1.8-1.8s.8-1.8 1.8-1.8s1.8.8 1.8 1.8zM8.6 15.4c.6-.4 1.2-.2 1.6.2c.6.8 1.6 1.8 3 2c1.2.4 2.8.2 4.8-2c.4-.4 1.2-.6 1.6 0c.4.4.6 1.2 0 1.6c-2.2 2.6-4.8 3.4-7 3c-2-.4-3.6-1.8-4.4-3c-.4-.6-.2-1.2.4-1.8z' }))));
|
|
47662
47681
|
};
|
|
47663
47682
|
var EmojiIconSmall = function () {
|
|
47664
47683
|
var t = useTranslationContext('EmojiIconSmall').t;
|
|
47665
|
-
return (React__default["default"].createElement("svg", { height: '14', width: '14', xmlns: 'http://www.w3.org/2000/svg' },
|
|
47684
|
+
return (React__default["default"].createElement("svg", { height: '14', viewBox: '0 0 14 14', width: '14', xmlns: 'http://www.w3.org/2000/svg' },
|
|
47666
47685
|
React__default["default"].createElement("title", null, t('Open emoji picker')),
|
|
47667
47686
|
React__default["default"].createElement("g", { clipRule: 'evenodd', fillRule: 'evenodd' },
|
|
47668
47687
|
React__default["default"].createElement("path", { d: 'M6.7 1.42C3.73 1.42 1.42 3.73 1.42 6.7c0 2.97 2.31 5.28 5.28 5.28c2.97 0 5.28-2.31 5.28-5.28c0-2.97-2.31-5.28-5.28-5.28zM.1 6.7c0-3.63 2.97-6.6 6.6-6.6s6.6 2.97 6.6 6.6s-2.97 6.6-6.6 6.6s-6.6-2.97-6.6-6.6zM6.04 5.05c0 .55-.44.99-.99.99s-.99-.44-.99-.99s.44-.99.99-.99s.99.44.99.99zM9.34 5.05c0 .55-.44.99-.99.99s-.99-.44-.99-.99s.44-.99.99-.99s.99.44.99.99zM3.73 7.47c.33-.22.66-.11.88.11c.33.44.88.99 1.65 1.1c.66.22 1.54.11 2.64-1.1c.22-.22.66-.33.88 0c.22.22.33.66 0 .88c-1.21 1.43-2.64 1.87-3.85 1.65c-1.1-.22-1.98-.99-2.42-1.65c-.22-.33-.11-.66.22-.99z' }))));
|
|
@@ -47673,13 +47692,13 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
47673
47692
|
React__default["default"].createElement("path", { d: 'M14 4.4C8.6 4.4 4.4 8.6 4.4 14c0 5.4 4.2 9.6 9.6 9.6c5.4 0 9.6-4.2 9.6-9.6c0-5.4-4.2-9.6-9.6-9.6zM2 14c0-6.6 5.4-12 12-12s12 5.4 12 12s-5.4 12-12 12s-12-5.4-12-12zM12.8 11c0 1-.8 1.8-1.8 1.8s-1.8-.8-1.8-1.8s.8-1.8 1.8-1.8s1.8.8 1.8 1.8zM18.8 11c0 1-.8 1.8-1.8 1.8s-1.8-.8-1.8-1.8s.8-1.8 1.8-1.8s1.8.8 1.8 1.8zM8.6 15.4c.6-.4 1.2-.2 1.6.2c.6.8 1.6 1.8 3 2c1.2.4 2.8.2 4.8-2c.4-.4 1.2-.6 1.6 0c.4.4.6 1.2 0 1.6c-2.2 2.6-4.8 3.4-7 3c-2-.4-3.6-1.8-4.4-3c-.4-.6-.2-1.2.4-1.8z' })))); };
|
|
47674
47693
|
var FileUploadIcon = function () {
|
|
47675
47694
|
var t = useTranslationContext('FileUploadIcon').t;
|
|
47676
|
-
return (React__default["default"].createElement("svg", { height: '14', width: '14', xmlns: 'http://www.w3.org/2000/svg' },
|
|
47695
|
+
return (React__default["default"].createElement("svg", { height: '14', viewBox: '0 0 14 14', width: '14', xmlns: 'http://www.w3.org/2000/svg' },
|
|
47677
47696
|
React__default["default"].createElement("title", null, t('Attach files')),
|
|
47678
47697
|
React__default["default"].createElement("path", { d: 'M7 .5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5S.5 10.59.5 7 3.41.5 7 .5zm0 12c3.031 0 5.5-2.469 5.5-5.5S10.031 1.5 7 1.5A5.506 5.506 0 0 0 1.5 7c0 3.034 2.469 5.5 5.5 5.5zM7.506 3v3.494H11v1.05H7.506V11h-1.05V7.544H3v-1.05h3.456V3h1.05z', fillRule: 'nonzero' })));
|
|
47679
47698
|
};
|
|
47680
47699
|
var FileUploadIconFlat = function () {
|
|
47681
47700
|
var t = useTranslationContext('FileUploadIconFlat').t;
|
|
47682
|
-
return (React__default["default"].createElement("svg", { height: '14', width: '14', xmlns: 'http://www.w3.org/2000/svg' },
|
|
47701
|
+
return (React__default["default"].createElement("svg", { height: '14', viewBox: '0 0 14 14', width: '14', xmlns: 'http://www.w3.org/2000/svg' },
|
|
47683
47702
|
React__default["default"].createElement("title", null, t('Attach files')),
|
|
47684
47703
|
React__default["default"].createElement("path", { d: 'M1.667.333h10.666c.737 0 1.334.597 1.334 1.334v10.666c0 .737-.597 1.334-1.334 1.334H1.667a1.333 1.333 0 0 1-1.334-1.334V1.667C.333.93.93.333 1.667.333zm2 1.334a1.667 1.667 0 1 0 0 3.333 1.667 1.667 0 0 0 0-3.333zm-2 9.333v1.333h10.666v-4l-2-2-4 4-2-2L1.667 11z', fillRule: 'nonzero' })));
|
|
47685
47704
|
};
|
|
@@ -47788,19 +47807,22 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
47788
47807
|
};
|
|
47789
47808
|
|
|
47790
47809
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var CooldownTimer = function (_a) {
|
|
47791
|
-
var cooldownInterval = _a.cooldownInterval
|
|
47792
|
-
var _b = React$2.useState(
|
|
47810
|
+
var cooldownInterval = _a.cooldownInterval;
|
|
47811
|
+
var _b = React$2.useState(), seconds = _b[0], setSeconds = _b[1];
|
|
47793
47812
|
React$2.useEffect(function () {
|
|
47794
|
-
var
|
|
47795
|
-
|
|
47813
|
+
var countdownTimeout;
|
|
47814
|
+
if (typeof seconds === 'number' && seconds > 0) {
|
|
47815
|
+
countdownTimeout = setTimeout(function () {
|
|
47796
47816
|
setSeconds(seconds - 1);
|
|
47797
|
-
}
|
|
47798
|
-
|
|
47799
|
-
|
|
47800
|
-
|
|
47801
|
-
}
|
|
47802
|
-
|
|
47803
|
-
|
|
47817
|
+
}, 1000);
|
|
47818
|
+
}
|
|
47819
|
+
return function () {
|
|
47820
|
+
clearTimeout(countdownTimeout);
|
|
47821
|
+
};
|
|
47822
|
+
}, [seconds]);
|
|
47823
|
+
React$2.useEffect(function () {
|
|
47824
|
+
setSeconds(cooldownInterval !== null && cooldownInterval !== void 0 ? cooldownInterval : 0);
|
|
47825
|
+
}, [cooldownInterval]);
|
|
47804
47826
|
return (React__default["default"].createElement("div", { className: 'str-chat__message-input-cooldown', "data-testid": 'cooldown-timer' }, seconds));
|
|
47805
47827
|
};
|
|
47806
47828
|
|
|
@@ -48530,11 +48552,20 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
48530
48552
|
? // prevent negative values
|
|
48531
48553
|
Math.max(0, (new Date().getTime() - ownLatestMessageDate.getTime()) / 1000)
|
|
48532
48554
|
: undefined;
|
|
48533
|
-
|
|
48555
|
+
var remaining = !skipCooldown &&
|
|
48534
48556
|
typeof timeSinceOwnLastMessage !== 'undefined' &&
|
|
48535
48557
|
cooldownInterval > timeSinceOwnLastMessage
|
|
48536
48558
|
? Math.round(cooldownInterval - timeSinceOwnLastMessage)
|
|
48537
|
-
: 0
|
|
48559
|
+
: 0;
|
|
48560
|
+
setCooldownRemaining(remaining);
|
|
48561
|
+
if (!remaining)
|
|
48562
|
+
return;
|
|
48563
|
+
var timeout = setTimeout(function () {
|
|
48564
|
+
setCooldownRemaining(0);
|
|
48565
|
+
}, remaining * 1000);
|
|
48566
|
+
return function () {
|
|
48567
|
+
clearTimeout(timeout);
|
|
48568
|
+
};
|
|
48538
48569
|
}, [cooldownInterval, ownLatestMessageDate, skipCooldown]);
|
|
48539
48570
|
return {
|
|
48540
48571
|
cooldownInterval: cooldownInterval,
|
|
@@ -50461,9 +50492,9 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
50461
50492
|
var markReadThrottled = lodash_throttle(markRead, 500, { leading: true, trailing: true });
|
|
50462
50493
|
var handleEvent = function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
50463
50494
|
var mainChannelUpdated, unread, messageDate, cid, oldestID;
|
|
50464
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
50465
|
-
return __generator(this, function (
|
|
50466
|
-
switch (
|
|
50495
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
50496
|
+
return __generator(this, function (_k) {
|
|
50497
|
+
switch (_k.label) {
|
|
50467
50498
|
case 0:
|
|
50468
50499
|
if (event.message) {
|
|
50469
50500
|
dispatch({
|
|
@@ -50485,7 +50516,7 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
50485
50516
|
if (((_a = event.message) === null || _a === void 0 ? void 0 : _a.parent_id) && !((_b = event.message) === null || _b === void 0 ? void 0 : _b.show_in_channel)) {
|
|
50486
50517
|
mainChannelUpdated = false;
|
|
50487
50518
|
}
|
|
50488
|
-
if (mainChannelUpdated
|
|
50519
|
+
if (mainChannelUpdated) {
|
|
50489
50520
|
if (!document.hidden) {
|
|
50490
50521
|
markReadThrottled();
|
|
50491
50522
|
}
|
|
@@ -50499,9 +50530,9 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
50499
50530
|
}
|
|
50500
50531
|
}
|
|
50501
50532
|
}
|
|
50502
|
-
if (((
|
|
50503
|
-
((
|
|
50504
|
-
((
|
|
50533
|
+
if (((_d = (_c = event.message) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.id) === client.userID &&
|
|
50534
|
+
((_e = event === null || event === void 0 ? void 0 : event.message) === null || _e === void 0 ? void 0 : _e.created_at) &&
|
|
50535
|
+
((_f = event === null || event === void 0 ? void 0 : event.message) === null || _f === void 0 ? void 0 : _f.cid)) {
|
|
50505
50536
|
messageDate = new Date(event.message.created_at);
|
|
50506
50537
|
cid = event.message.cid;
|
|
50507
50538
|
if (!latestMessageDatesByChannels[cid] ||
|
|
@@ -50511,7 +50542,7 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
50511
50542
|
}
|
|
50512
50543
|
}
|
|
50513
50544
|
if (!(event.type === 'user.deleted')) return [3 /*break*/, 2];
|
|
50514
|
-
oldestID = (
|
|
50545
|
+
oldestID = (_j = (_h = (_g = channel.state) === null || _g === void 0 ? void 0 : _g.messages) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.id;
|
|
50515
50546
|
/**
|
|
50516
50547
|
* As the channel state is not normalized we re-fetch the channel data. Thus, we avoid having to search for user references in the channel state.
|
|
50517
50548
|
*/
|
|
@@ -50525,8 +50556,8 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
50525
50556
|
* As the channel state is not normalized we re-fetch the channel data. Thus, we avoid having to search for user references in the channel state.
|
|
50526
50557
|
*/
|
|
50527
50558
|
// FIXME: we should use channelQueryOptions if they are available
|
|
50528
|
-
|
|
50529
|
-
|
|
50559
|
+
_k.sent();
|
|
50560
|
+
_k.label = 2;
|
|
50530
50561
|
case 2:
|
|
50531
50562
|
throttledCopyStateFromChannel();
|
|
50532
50563
|
return [2 /*return*/];
|
|
@@ -50588,6 +50619,13 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
50588
50619
|
hasMore: hasMoreMessagesProbably(channel.state.messages.length, (_e = (_d = channelQueryOptions === null || channelQueryOptions === void 0 ? void 0 : channelQueryOptions.messages) === null || _d === void 0 ? void 0 : _d.limit) !== null && _e !== void 0 ? _e : DEFAULT_INITIAL_CHANNEL_PAGE_SIZE),
|
|
50589
50620
|
type: 'initStateFromChannel',
|
|
50590
50621
|
});
|
|
50622
|
+
/**
|
|
50623
|
+
* TODO: maybe pass last_read to the countUnread method to get proper value
|
|
50624
|
+
* combined with channel.countUnread adjustment (_countMessageAsUnread)
|
|
50625
|
+
* to allow counting own messages too
|
|
50626
|
+
*
|
|
50627
|
+
* const lastRead = channel.state.read[client.userID as string].last_read;
|
|
50628
|
+
*/
|
|
50591
50629
|
if (channel.countUnread() > 0)
|
|
50592
50630
|
markRead();
|
|
50593
50631
|
// The more complex sync logic is done in Chat
|
|
@@ -51399,22 +51437,27 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
51399
51437
|
return uniqBy(__spreadArray([channel], channels, true), 'cid');
|
|
51400
51438
|
};
|
|
51401
51439
|
|
|
51402
|
-
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useMessageNewListener = function (setChannels, lockChannelOrder, allowNewMessagesFromUnfilteredChannels) {
|
|
51440
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useMessageNewListener = function (setChannels, customHandler, lockChannelOrder, allowNewMessagesFromUnfilteredChannels) {
|
|
51403
51441
|
if (lockChannelOrder === void 0) { lockChannelOrder = false; }
|
|
51404
51442
|
if (allowNewMessagesFromUnfilteredChannels === void 0) { allowNewMessagesFromUnfilteredChannels = true; }
|
|
51405
51443
|
var client = useChatContext('useMessageNewListener').client;
|
|
51406
51444
|
React$2.useEffect(function () {
|
|
51407
51445
|
var handleEvent = function (event) {
|
|
51408
|
-
|
|
51409
|
-
|
|
51410
|
-
|
|
51411
|
-
|
|
51412
|
-
|
|
51413
|
-
|
|
51414
|
-
|
|
51415
|
-
|
|
51416
|
-
|
|
51417
|
-
|
|
51446
|
+
if (customHandler && typeof customHandler === 'function') {
|
|
51447
|
+
customHandler(setChannels, event);
|
|
51448
|
+
}
|
|
51449
|
+
else {
|
|
51450
|
+
setChannels(function (channels) {
|
|
51451
|
+
var channelInList = channels.filter(function (channel) { return channel.cid === event.cid; }).length > 0;
|
|
51452
|
+
if (!channelInList && allowNewMessagesFromUnfilteredChannels && event.channel_type) {
|
|
51453
|
+
var channel = client.channel(event.channel_type, event.channel_id);
|
|
51454
|
+
return uniqBy(__spreadArray([channel], channels, true), 'cid');
|
|
51455
|
+
}
|
|
51456
|
+
if (!lockChannelOrder)
|
|
51457
|
+
return moveChannelUp({ channels: channels, cid: event.cid || '' });
|
|
51458
|
+
return channels;
|
|
51459
|
+
});
|
|
51460
|
+
}
|
|
51418
51461
|
};
|
|
51419
51462
|
client.on('message.new', handleEvent);
|
|
51420
51463
|
return function () {
|
|
@@ -52258,7 +52301,7 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
52258
52301
|
var DEFAULT_SORT = {};
|
|
52259
52302
|
var UnMemoizedChannelList = function (props) {
|
|
52260
52303
|
var _a, _b;
|
|
52261
|
-
var additionalChannelSearchProps = props.additionalChannelSearchProps, _c = props.Avatar, Avatar$1 = _c === void 0 ? Avatar : _c, allowNewMessagesFromUnfilteredChannels = props.allowNewMessagesFromUnfilteredChannels, channelRenderFilterFn = props.channelRenderFilterFn, _d = props.ChannelSearch, ChannelSearch$1 = _d === void 0 ? ChannelSearch : _d, customActiveChannel = props.customActiveChannel, _e = props.EmptyStateIndicator, EmptyStateIndicator$1 = _e === void 0 ? EmptyStateIndicator : _e, filters = props.filters, _f = props.LoadingErrorIndicator, LoadingErrorIndicator = _f === void 0 ? ChatDown : _f, _g = props.LoadingIndicator, LoadingIndicator = _g === void 0 ? LoadingChannels : _g, _h = props.List, List = _h === void 0 ? ChannelListMessenger : _h, lockChannelOrder = props.lockChannelOrder, onAddedToChannel = props.onAddedToChannel, onChannelDeleted = props.onChannelDeleted, onChannelHidden = props.onChannelHidden, onChannelTruncated = props.onChannelTruncated, onChannelUpdated = props.onChannelUpdated, onChannelVisible = props.onChannelVisible, onMessageNew = props.onMessageNew, onRemovedFromChannel = props.onRemovedFromChannel, options = props.options, _j = props.Paginator, Paginator = _j === void 0 ? LoadMorePaginator : _j, Preview = props.Preview, recoveryThrottleIntervalMs = props.recoveryThrottleIntervalMs, renderChannels = props.renderChannels, _k = props.sendChannelsToList, sendChannelsToList = _k === void 0 ? false : _k, _l = props.setActiveChannelOnMount, setActiveChannelOnMount = _l === void 0 ? true : _l, _m = props.showChannelSearch, showChannelSearch = _m === void 0 ? false : _m, _o = props.sort, sort = _o === void 0 ? DEFAULT_SORT : _o, _p = props.watchers, watchers = _p === void 0 ? {} : _p;
|
|
52304
|
+
var additionalChannelSearchProps = props.additionalChannelSearchProps, _c = props.Avatar, Avatar$1 = _c === void 0 ? Avatar : _c, allowNewMessagesFromUnfilteredChannels = props.allowNewMessagesFromUnfilteredChannels, channelRenderFilterFn = props.channelRenderFilterFn, _d = props.ChannelSearch, ChannelSearch$1 = _d === void 0 ? ChannelSearch : _d, customActiveChannel = props.customActiveChannel, _e = props.EmptyStateIndicator, EmptyStateIndicator$1 = _e === void 0 ? EmptyStateIndicator : _e, filters = props.filters, _f = props.LoadingErrorIndicator, LoadingErrorIndicator = _f === void 0 ? ChatDown : _f, _g = props.LoadingIndicator, LoadingIndicator = _g === void 0 ? LoadingChannels : _g, _h = props.List, List = _h === void 0 ? ChannelListMessenger : _h, lockChannelOrder = props.lockChannelOrder, onAddedToChannel = props.onAddedToChannel, onChannelDeleted = props.onChannelDeleted, onChannelHidden = props.onChannelHidden, onChannelTruncated = props.onChannelTruncated, onChannelUpdated = props.onChannelUpdated, onChannelVisible = props.onChannelVisible, onMessageNew = props.onMessageNew, onMessageNewHandler = props.onMessageNewHandler, onRemovedFromChannel = props.onRemovedFromChannel, options = props.options, _j = props.Paginator, Paginator = _j === void 0 ? LoadMorePaginator : _j, Preview = props.Preview, recoveryThrottleIntervalMs = props.recoveryThrottleIntervalMs, renderChannels = props.renderChannels, _k = props.sendChannelsToList, sendChannelsToList = _k === void 0 ? false : _k, _l = props.setActiveChannelOnMount, setActiveChannelOnMount = _l === void 0 ? true : _l, _m = props.showChannelSearch, showChannelSearch = _m === void 0 ? false : _m, _o = props.sort, sort = _o === void 0 ? DEFAULT_SORT : _o, _p = props.watchers, watchers = _p === void 0 ? {} : _p;
|
|
52262
52305
|
var _q = useChatContext('ChannelList'), channel = _q.channel, channelsQueryState = _q.channelsQueryState, client = _q.client, closeMobileNav = _q.closeMobileNav, customClasses = _q.customClasses, _r = _q.navOpen, navOpen = _r === void 0 ? false : _r, setActiveChannel = _q.setActiveChannel, theme = _q.theme, useImageFlagEmojisOnWindows = _q.useImageFlagEmojisOnWindows;
|
|
52263
52306
|
var channelListRef = React$2.useRef(null);
|
|
52264
52307
|
var _s = React$2.useState(0), channelUpdateCount = _s[0], setChannelUpdateCount = _s[1];
|
|
@@ -52325,7 +52368,7 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
52325
52368
|
var _u = usePaginatedChannels(client, filters || DEFAULT_FILTERS, sort || DEFAULT_SORT, options || DEFAULT_OPTIONS, activeChannelHandler, recoveryThrottleIntervalMs), channels = _u.channels, hasNextPage = _u.hasNextPage, loadNextPage = _u.loadNextPage, setChannels = _u.setChannels;
|
|
52326
52369
|
var loadedChannels = channelRenderFilterFn ? channelRenderFilterFn(channels) : channels;
|
|
52327
52370
|
useMobileNavigation(channelListRef, navOpen, closeMobileNav);
|
|
52328
|
-
useMessageNewListener(setChannels, lockChannelOrder, allowNewMessagesFromUnfilteredChannels);
|
|
52371
|
+
useMessageNewListener(setChannels, onMessageNewHandler, lockChannelOrder, allowNewMessagesFromUnfilteredChannels);
|
|
52329
52372
|
useNotificationMessageNewListener(setChannels, onMessageNew, allowNewMessagesFromUnfilteredChannels);
|
|
52330
52373
|
useNotificationAddedToChannelListener(setChannels, onAddedToChannel, allowNewMessagesFromUnfilteredChannels);
|
|
52331
52374
|
useNotificationRemovedFromChannelListener(setChannels, onRemovedFromChannel);
|
|
@@ -52387,7 +52430,7 @@ var StreamChatReact = (function (exports, React$2, jsxRuntime, streamChat, React
|
|
|
52387
52430
|
|
|
52388
52431
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
|
|
52389
52432
|
|
|
52390
|
-
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version$1 = '11.
|
|
52433
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version$1 = '11.2.0';
|
|
52391
52434
|
|
|
52392
52435
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useChat = function (_a) {
|
|
52393
52436
|
var _b, _c;
|