stream-chat-react 10.7.3 → 10.7.4
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 +70 -47
- package/dist/browser.full-bundle.js.map +1 -1
- package/dist/browser.full-bundle.min.js +1 -1
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/components/Channel/Channel.d.ts.map +1 -1
- package/dist/components/Channel/Channel.js +69 -46
- package/dist/index.cjs.js +70 -47
- 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
|
@@ -46653,55 +46653,78 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
46653
46653
|
}
|
|
46654
46654
|
};
|
|
46655
46655
|
var markReadThrottled = lodash_throttle(markRead, 500, { leading: true, trailing: true });
|
|
46656
|
-
var handleEvent = function (event) {
|
|
46657
|
-
var
|
|
46658
|
-
|
|
46659
|
-
|
|
46660
|
-
|
|
46661
|
-
|
|
46662
|
-
|
|
46663
|
-
|
|
46664
|
-
|
|
46665
|
-
|
|
46666
|
-
|
|
46667
|
-
|
|
46668
|
-
return dispatch({ channel: channel, type: 'setTyping' });
|
|
46669
|
-
}
|
|
46670
|
-
if (event.type === 'connection.changed' && typeof event.online === 'boolean') {
|
|
46671
|
-
online.current = event.online;
|
|
46672
|
-
}
|
|
46673
|
-
if (event.type === 'message.new') {
|
|
46674
|
-
var mainChannelUpdated = true;
|
|
46675
|
-
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)) {
|
|
46676
|
-
mainChannelUpdated = false;
|
|
46677
|
-
}
|
|
46678
|
-
if (mainChannelUpdated && ((_d = (_c = event.message) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.id) !== client.userID) {
|
|
46679
|
-
if (!document.hidden) {
|
|
46680
|
-
markReadThrottled();
|
|
46681
|
-
}
|
|
46682
|
-
else if ((channelConfig === null || channelConfig === void 0 ? void 0 : channelConfig.read_events) && !channel.muteStatus().muted) {
|
|
46683
|
-
var unread = channel.countUnread(lastRead.current);
|
|
46684
|
-
if (activeUnreadHandler) {
|
|
46685
|
-
activeUnreadHandler(unread, originalTitle.current);
|
|
46656
|
+
var handleEvent = function (event) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
46657
|
+
var mainChannelUpdated, unread, messageDate, cid, oldestID;
|
|
46658
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
46659
|
+
return __generator$1(this, function (_m) {
|
|
46660
|
+
switch (_m.label) {
|
|
46661
|
+
case 0:
|
|
46662
|
+
if (event.message) {
|
|
46663
|
+
dispatch({
|
|
46664
|
+
channel: channel,
|
|
46665
|
+
message: event.message,
|
|
46666
|
+
type: 'updateThreadOnEvent',
|
|
46667
|
+
});
|
|
46686
46668
|
}
|
|
46687
|
-
|
|
46688
|
-
|
|
46669
|
+
if (event.type === 'user.watching.start' || event.type === 'user.watching.stop')
|
|
46670
|
+
return [2 /*return*/];
|
|
46671
|
+
if (event.type === 'typing.start' || event.type === 'typing.stop') {
|
|
46672
|
+
return [2 /*return*/, dispatch({ channel: channel, type: 'setTyping' })];
|
|
46689
46673
|
}
|
|
46690
|
-
|
|
46691
|
-
|
|
46692
|
-
|
|
46693
|
-
|
|
46694
|
-
|
|
46695
|
-
|
|
46696
|
-
|
|
46697
|
-
|
|
46698
|
-
|
|
46699
|
-
|
|
46700
|
-
|
|
46674
|
+
if (event.type === 'connection.changed' && typeof event.online === 'boolean') {
|
|
46675
|
+
online.current = event.online;
|
|
46676
|
+
}
|
|
46677
|
+
if (event.type === 'message.new') {
|
|
46678
|
+
mainChannelUpdated = true;
|
|
46679
|
+
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)) {
|
|
46680
|
+
mainChannelUpdated = false;
|
|
46681
|
+
}
|
|
46682
|
+
if (mainChannelUpdated && ((_d = (_c = event.message) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.id) !== client.userID) {
|
|
46683
|
+
if (!document.hidden) {
|
|
46684
|
+
markReadThrottled();
|
|
46685
|
+
}
|
|
46686
|
+
else if ((channelConfig === null || channelConfig === void 0 ? void 0 : channelConfig.read_events) && !channel.muteStatus().muted) {
|
|
46687
|
+
unread = channel.countUnread(lastRead.current);
|
|
46688
|
+
if (activeUnreadHandler) {
|
|
46689
|
+
activeUnreadHandler(unread, originalTitle.current);
|
|
46690
|
+
}
|
|
46691
|
+
else {
|
|
46692
|
+
document.title = "(".concat(unread, ") ").concat(originalTitle.current);
|
|
46693
|
+
}
|
|
46694
|
+
}
|
|
46695
|
+
}
|
|
46696
|
+
if (((_f = (_e = event.message) === null || _e === void 0 ? void 0 : _e.user) === null || _f === void 0 ? void 0 : _f.id) === client.userID &&
|
|
46697
|
+
((_g = event === null || event === void 0 ? void 0 : event.message) === null || _g === void 0 ? void 0 : _g.created_at) &&
|
|
46698
|
+
((_h = event === null || event === void 0 ? void 0 : event.message) === null || _h === void 0 ? void 0 : _h.cid)) {
|
|
46699
|
+
messageDate = new Date(event.message.created_at);
|
|
46700
|
+
cid = event.message.cid;
|
|
46701
|
+
if (!latestMessageDatesByChannels[cid] ||
|
|
46702
|
+
latestMessageDatesByChannels[cid].getTime() < messageDate.getTime()) {
|
|
46703
|
+
latestMessageDatesByChannels[cid] = messageDate;
|
|
46704
|
+
}
|
|
46705
|
+
}
|
|
46706
|
+
}
|
|
46707
|
+
if (!(event.type === 'user.deleted')) return [3 /*break*/, 2];
|
|
46708
|
+
oldestID = (_l = (_k = (_j = channel.state) === null || _j === void 0 ? void 0 : _j.messages) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.id;
|
|
46709
|
+
/**
|
|
46710
|
+
* 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.
|
|
46711
|
+
*/
|
|
46712
|
+
return [4 /*yield*/, channel.query({
|
|
46713
|
+
messages: { id_lt: oldestID, limit: DEFAULT_NEXT_CHANNEL_PAGE_SIZE },
|
|
46714
|
+
watchers: { limit: DEFAULT_NEXT_CHANNEL_PAGE_SIZE },
|
|
46715
|
+
})];
|
|
46716
|
+
case 1:
|
|
46717
|
+
/**
|
|
46718
|
+
* 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.
|
|
46719
|
+
*/
|
|
46720
|
+
_m.sent();
|
|
46721
|
+
_m.label = 2;
|
|
46722
|
+
case 2:
|
|
46723
|
+
throttledCopyStateFromChannel();
|
|
46724
|
+
return [2 /*return*/];
|
|
46701
46725
|
}
|
|
46702
|
-
}
|
|
46703
|
-
|
|
46704
|
-
};
|
|
46726
|
+
});
|
|
46727
|
+
}); };
|
|
46705
46728
|
// useLayoutEffect here to prevent spinner. Use Suspense when it is available in stable release
|
|
46706
46729
|
React$2.useLayoutEffect(function () {
|
|
46707
46730
|
var errored = false;
|
|
@@ -48355,7 +48378,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
48355
48378
|
|
|
48356
48379
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
|
|
48357
48380
|
|
|
48358
|
-
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version$1 = '10.7.
|
|
48381
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version$1 = '10.7.4';
|
|
48359
48382
|
|
|
48360
48383
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useChat = function (_a) {
|
|
48361
48384
|
var _b, _c;
|