stream-chat-react 10.8.4 → 10.8.5
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 +14 -14
- 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/MessageInput/hooks/useCooldownTimer.d.ts.map +1 -1
- package/dist/components/MessageInput/hooks/useCooldownTimer.js +14 -15
- package/dist/index.cjs.js +14 -14
- 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
|
@@ -44997,27 +44997,27 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
44997
44997
|
|
|
44998
44998
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useCooldownTimer = function () {
|
|
44999
44999
|
var _a;
|
|
45000
|
-
var
|
|
45001
|
-
var
|
|
45002
|
-
var
|
|
45003
|
-
var
|
|
45004
|
-
|
|
45005
|
-
|
|
45006
|
-
var skipCooldown = !(own_capabilities === null || own_capabilities === void 0 ? void 0 : own_capabilities.includes('slow-mode'));
|
|
45000
|
+
var _b = useChatContext('useCooldownTimer'), client = _b.client, latestMessageDatesByChannels = _b.latestMessageDatesByChannels;
|
|
45001
|
+
var _c = useChannelStateContext('useCooldownTimer'), channel = _c.channel, _d = _c.messages, messages = _d === void 0 ? [] : _d;
|
|
45002
|
+
var _e = React$2.useState(), cooldownRemaining = _e[0], setCooldownRemaining = _e[1];
|
|
45003
|
+
var _f = (channel.data ||
|
|
45004
|
+
{}), _g = _f.cooldown, cooldownInterval = _g === void 0 ? 0 : _g, own_capabilities = _f.own_capabilities;
|
|
45005
|
+
var skipCooldown = own_capabilities === null || own_capabilities === void 0 ? void 0 : own_capabilities.includes('skip-slow-mode');
|
|
45007
45006
|
var ownLatestMessageDate = React$2.useMemo(function () {
|
|
45008
45007
|
var _a, _b;
|
|
45009
45008
|
return (_a = latestMessageDatesByChannels[channel.cid]) !== null && _a !== void 0 ? _a : (_b = __spreadArray([], messages, true).sort(function (a, b) { var _a, _b; return ((_a = b.created_at) === null || _a === void 0 ? void 0 : _a.getTime()) - ((_b = a.created_at) === null || _b === void 0 ? void 0 : _b.getTime()); })
|
|
45010
45009
|
.find(function (v) { var _a, _b; return ((_a = v.user) === null || _a === void 0 ? void 0 : _a.id) === ((_b = client.user) === null || _b === void 0 ? void 0 : _b.id); })) === null || _b === void 0 ? void 0 : _b.created_at;
|
|
45011
45010
|
}, [messages, (_a = client.user) === null || _a === void 0 ? void 0 : _a.id, latestMessageDatesByChannels, channel.cid]);
|
|
45012
45011
|
React$2.useEffect(function () {
|
|
45013
|
-
|
|
45014
|
-
|
|
45015
|
-
|
|
45016
|
-
|
|
45017
|
-
|
|
45012
|
+
var timeSinceOwnLastMessage = ownLatestMessageDate
|
|
45013
|
+
? (new Date().getTime() - ownLatestMessageDate.getTime()) / 1000
|
|
45014
|
+
: undefined;
|
|
45015
|
+
setCooldownRemaining(!skipCooldown && timeSinceOwnLastMessage && cooldownInterval > timeSinceOwnLastMessage
|
|
45016
|
+
? Math.round(cooldownInterval - timeSinceOwnLastMessage)
|
|
45017
|
+
: 0);
|
|
45018
45018
|
}, [cooldownInterval, ownLatestMessageDate, skipCooldown]);
|
|
45019
45019
|
return {
|
|
45020
|
-
cooldownInterval: cooldownInterval
|
|
45020
|
+
cooldownInterval: cooldownInterval,
|
|
45021
45021
|
cooldownRemaining: cooldownRemaining,
|
|
45022
45022
|
setCooldownRemaining: setCooldownRemaining,
|
|
45023
45023
|
};
|
|
@@ -48513,7 +48513,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
48513
48513
|
|
|
48514
48514
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
|
|
48515
48515
|
|
|
48516
|
-
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version$1 = '10.8.
|
|
48516
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version$1 = '10.8.5';
|
|
48517
48517
|
|
|
48518
48518
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useChat = function (_a) {
|
|
48519
48519
|
var _b, _c;
|