stream-chat-react 10.20.0 → 10.20.1
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 +23 -18
- package/dist/browser.full-bundle.js.map +1 -1
- package/dist/browser.full-bundle.min.js +3 -3
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/components/Channel/Channel.js +18 -16
- package/dist/components/Channel/channelState.d.ts +1 -0
- package/dist/components/Channel/channelState.d.ts.map +1 -1
- package/dist/components/Channel/channelState.js +2 -2
- package/dist/components/InfiniteScrollPaginator/InfiniteScroll.js +1 -0
- package/dist/components/MessageList/utils.d.ts.map +1 -1
- package/dist/components/MessageList/utils.js +1 -0
- package/dist/components/Thread/Thread.js +1 -0
- package/dist/index.cjs.js +23 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -39627,8 +39627,8 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
39627
39627
|
return __assign(__assign({}, state), { members: __assign({}, channel.state.members), messages: __spreadArray([], channel.state.messages, true), pinnedMessages: __spreadArray([], channel.state.pinnedMessages, true), read: __assign({}, channel.state.read), watcherCount: channel.state.watcher_count, watchers: __assign({}, channel.state.watchers) });
|
|
39628
39628
|
}
|
|
39629
39629
|
case 'initStateFromChannel': {
|
|
39630
|
-
var channel = action.channel;
|
|
39631
|
-
return __assign(__assign({}, state), { loading: false, members: __assign({}, channel.state.members), messages: __spreadArray([], channel.state.messages, true), pinnedMessages: __spreadArray([], channel.state.pinnedMessages, true), read: __assign({}, channel.state.read), watcherCount: channel.state.watcher_count, watchers: __assign({}, channel.state.watchers) });
|
|
39630
|
+
var channel = action.channel, hasMore = action.hasMore;
|
|
39631
|
+
return __assign(__assign({}, state), { hasMore: hasMore, loading: false, members: __assign({}, channel.state.members), messages: __spreadArray([], channel.state.messages, true), pinnedMessages: __spreadArray([], channel.state.pinnedMessages, true), read: __assign({}, channel.state.read), watcherCount: channel.state.watcher_count, watchers: __assign({}, channel.state.watchers) });
|
|
39632
39632
|
}
|
|
39633
39633
|
case 'jumpToLatestMessage': {
|
|
39634
39634
|
return __assign(__assign({}, state), { hasMoreNewer: false, highlightedMessageId: undefined, loading: false, suppressAutoscroll: false });
|
|
@@ -45570,6 +45570,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
45570
45570
|
var hasMoreMessagesProbably = function (returnedCountMessages, limit) {
|
|
45571
45571
|
return returnedCountMessages === limit;
|
|
45572
45572
|
};
|
|
45573
|
+
// @deprecated
|
|
45573
45574
|
var hasNotMoreMessages = function (returnedCountMessages, limit) {
|
|
45574
45575
|
return returnedCountMessages < limit;
|
|
45575
45576
|
};
|
|
@@ -45865,6 +45866,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
45865
45866
|
/**
|
|
45866
45867
|
* 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.
|
|
45867
45868
|
*/
|
|
45869
|
+
// FIXME: we should use channelQueryOptions if they are available
|
|
45868
45870
|
return [4 /*yield*/, channel.query({
|
|
45869
45871
|
messages: { id_lt: oldestID, limit: DEFAULT_NEXT_CHANNEL_PAGE_SIZE },
|
|
45870
45872
|
watchers: { limit: DEFAULT_NEXT_CHANNEL_PAGE_SIZE },
|
|
@@ -45873,6 +45875,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
45873
45875
|
/**
|
|
45874
45876
|
* 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.
|
|
45875
45877
|
*/
|
|
45878
|
+
// FIXME: we should use channelQueryOptions if they are available
|
|
45876
45879
|
_m.sent();
|
|
45877
45880
|
_m.label = 2;
|
|
45878
45881
|
case 2:
|
|
@@ -45891,14 +45894,14 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
45891
45894
|
};
|
|
45892
45895
|
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
45893
45896
|
var members, _i, _a, member, userId, _b, user, user_id, config, e_1;
|
|
45894
|
-
var _c;
|
|
45895
|
-
return __generator(this, function (
|
|
45896
|
-
switch (
|
|
45897
|
+
var _c, _d, _e;
|
|
45898
|
+
return __generator(this, function (_f) {
|
|
45899
|
+
switch (_f.label) {
|
|
45897
45900
|
case 0:
|
|
45898
45901
|
if (!(!channel.initialized && initializeOnMount)) return [3 /*break*/, 4];
|
|
45899
|
-
|
|
45902
|
+
_f.label = 1;
|
|
45900
45903
|
case 1:
|
|
45901
|
-
|
|
45904
|
+
_f.trys.push([1, 3, , 4]);
|
|
45902
45905
|
members = [];
|
|
45903
45906
|
if (!channel.id && ((_c = channel.data) === null || _c === void 0 ? void 0 : _c.members)) {
|
|
45904
45907
|
for (_i = 0, _a = channel.data.members; _i < _a.length; _i++) {
|
|
@@ -45918,12 +45921,12 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
45918
45921
|
}
|
|
45919
45922
|
return [4 /*yield*/, getChannel({ channel: channel, client: client, members: members, options: channelQueryOptions })];
|
|
45920
45923
|
case 2:
|
|
45921
|
-
|
|
45924
|
+
_f.sent();
|
|
45922
45925
|
config = channel.getConfig();
|
|
45923
45926
|
setChannelConfig(config);
|
|
45924
45927
|
return [3 /*break*/, 4];
|
|
45925
45928
|
case 3:
|
|
45926
|
-
e_1 =
|
|
45929
|
+
e_1 = _f.sent();
|
|
45927
45930
|
dispatch({ error: e_1, type: 'setError' });
|
|
45928
45931
|
errored = true;
|
|
45929
45932
|
return [3 /*break*/, 4];
|
|
@@ -45931,7 +45934,11 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
45931
45934
|
done = true;
|
|
45932
45935
|
originalTitle.current = document.title;
|
|
45933
45936
|
if (!errored) {
|
|
45934
|
-
dispatch({
|
|
45937
|
+
dispatch({
|
|
45938
|
+
channel: channel,
|
|
45939
|
+
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),
|
|
45940
|
+
type: 'initStateFromChannel',
|
|
45941
|
+
});
|
|
45935
45942
|
if (channel.countUnread() > 0)
|
|
45936
45943
|
markRead();
|
|
45937
45944
|
// The more complex sync logic is done in Chat
|
|
@@ -45986,22 +45993,17 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
45986
45993
|
var loadMore = function (limit) {
|
|
45987
45994
|
if (limit === void 0) { limit = DEFAULT_NEXT_CHANNEL_PAGE_SIZE; }
|
|
45988
45995
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
45989
|
-
var oldestMessage,
|
|
45996
|
+
var oldestMessage, oldestID, perPage, queryResponse, e_2, hasMoreMessages;
|
|
45990
45997
|
var _a;
|
|
45991
45998
|
return __generator(this, function (_b) {
|
|
45992
45999
|
switch (_b.label) {
|
|
45993
46000
|
case 0:
|
|
45994
|
-
if (!online.current || !window.navigator.onLine)
|
|
46001
|
+
if (!online.current || !window.navigator.onLine || !state.hasMore)
|
|
45995
46002
|
return [2 /*return*/, 0];
|
|
45996
46003
|
oldestMessage = (_a = state === null || state === void 0 ? void 0 : state.messages) === null || _a === void 0 ? void 0 : _a[0];
|
|
45997
46004
|
if (state.loadingMore || state.loadingMoreNewer || (oldestMessage === null || oldestMessage === void 0 ? void 0 : oldestMessage.status) !== 'received') {
|
|
45998
46005
|
return [2 /*return*/, 0];
|
|
45999
46006
|
}
|
|
46000
|
-
notHasMore = hasNotMoreMessages(channel.state.messages.length, DEFAULT_INITIAL_CHANNEL_PAGE_SIZE);
|
|
46001
|
-
if (notHasMore) {
|
|
46002
|
-
loadMoreFinished(false, channel.state.messages);
|
|
46003
|
-
return [2 /*return*/, channel.state.messages.length];
|
|
46004
|
-
}
|
|
46005
46007
|
dispatch({ loadingMore: true, type: 'setLoadingMore' });
|
|
46006
46008
|
oldestID = oldestMessage === null || oldestMessage === void 0 ? void 0 : oldestMessage.id;
|
|
46007
46009
|
perPage = limit;
|
|
@@ -46281,6 +46283,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
46281
46283
|
return __generator(this, function (_b) {
|
|
46282
46284
|
switch (_b.label) {
|
|
46283
46285
|
case 0:
|
|
46286
|
+
// FIXME: should prevent loading more, if state.thread.reply_count === channel.state.threads[parentID].length
|
|
46284
46287
|
if (state.threadLoadingMore || !state.thread)
|
|
46285
46288
|
return [2 /*return*/];
|
|
46286
46289
|
dispatch({ type: 'startLoadingThread' });
|
|
@@ -47737,7 +47740,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
47737
47740
|
|
|
47738
47741
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
|
|
47739
47742
|
|
|
47740
|
-
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version$1 = '10.20.
|
|
47743
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version$1 = '10.20.1';
|
|
47741
47744
|
|
|
47742
47745
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useChat = function (_a) {
|
|
47743
47746
|
var _b, _c;
|
|
@@ -48056,6 +48059,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
48056
48059
|
}
|
|
48057
48060
|
if (isLoading)
|
|
48058
48061
|
return;
|
|
48062
|
+
// FIXME: this triggers loadMore call when a user types messages in thread and the scroll container container expands
|
|
48059
48063
|
if (reverseOffset < Number(threshold) &&
|
|
48060
48064
|
typeof loadPreviousPageFn === 'function' &&
|
|
48061
48065
|
hasPreviousPageFlag) {
|
|
@@ -51033,6 +51037,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
51033
51037
|
var ThreadMessageList = virtualized ? VirtualizedMessageList : MessageList;
|
|
51034
51038
|
React$2.useEffect(function () {
|
|
51035
51039
|
if ((thread === null || thread === void 0 ? void 0 : thread.id) && (thread === null || thread === void 0 ? void 0 : thread.reply_count)) {
|
|
51040
|
+
// FIXME: integrators can customize channel query options but cannot customize channel.getReplies() options
|
|
51036
51041
|
loadMoreThread();
|
|
51037
51042
|
}
|
|
51038
51043
|
}, []);
|