stream-chat-react 14.6.0 → 14.7.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/cjs/{ReactPlayerWrapper.30240f76.js → ReactPlayerWrapper.c340ab05.js} +2 -2
- package/dist/cjs/{ReactPlayerWrapper.30240f76.js.map → ReactPlayerWrapper.c340ab05.js.map} +1 -1
- package/dist/cjs/audioProcessing.22303d69.js.map +1 -1
- package/dist/cjs/channel-detail.js +2 -2
- package/dist/cjs/channel-detail.js.map +1 -1
- package/dist/cjs/emojis.js +2 -2
- package/dist/cjs/emojis.js.map +1 -1
- package/dist/cjs/index.js +50 -52
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/mp3-encoder.js.map +1 -1
- package/dist/cjs/{useChannelHeaderOnlineStatus.6546ac83.js → useChannelHeaderOnlineStatus.d39ede24.js} +25 -9
- package/dist/cjs/{useChannelHeaderOnlineStatus.6546ac83.js.map → useChannelHeaderOnlineStatus.d39ede24.js.map} +1 -1
- package/dist/cjs/{useMessageComposerController.c0dad9bc.js → useMessageComposerController.f1a3d182.js} +2 -2
- package/dist/cjs/{useMessageComposerController.c0dad9bc.js.map → useMessageComposerController.f1a3d182.js.map} +1 -1
- package/dist/cjs/{useNotificationApi.eb753f31.js → useNotificationApi.87ba0b39.js} +13 -13
- package/dist/cjs/useNotificationApi.87ba0b39.js.map +1 -0
- package/dist/css/index.css +3 -3
- package/dist/css/index.css.map +1 -1
- package/dist/es/audioProcessing.766ca76c.mjs.map +1 -1
- package/dist/es/channel-detail.mjs +2 -2
- package/dist/es/channel-detail.mjs.map +1 -1
- package/dist/es/emojis.mjs +2 -2
- package/dist/es/emojis.mjs.map +1 -1
- package/dist/es/index.mjs +34 -36
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/mp3-encoder.mjs.map +1 -1
- package/dist/es/{useChannelHeaderOnlineStatus.c5215b13.mjs → useChannelHeaderOnlineStatus.b3a51ca7.mjs} +24 -8
- package/dist/es/{useChannelHeaderOnlineStatus.c5215b13.mjs.map → useChannelHeaderOnlineStatus.b3a51ca7.mjs.map} +1 -1
- package/dist/es/{useMessageComposerController.29f189b4.mjs → useMessageComposerController.2309f433.mjs} +2 -2
- package/dist/es/{useMessageComposerController.29f189b4.mjs.map → useMessageComposerController.2309f433.mjs.map} +1 -1
- package/dist/es/{useNotificationApi.fa5cddf9.mjs → useNotificationApi.eff88f29.mjs} +9 -9
- package/dist/es/useNotificationApi.eff88f29.mjs.map +1 -0
- package/dist/types/components/Channel/Channel.d.ts.map +1 -1
- package/dist/types/components/Channel/hooks/useCreateChannelStateContext.d.ts.map +1 -1
- package/dist/types/components/ChannelList/ChannelList.d.ts.map +1 -1
- package/dist/types/components/ChannelList/hooks/useChannelListShape.d.ts.map +1 -1
- package/dist/types/components/ChannelListItem/hooks/useIsChannelMuted.d.ts.map +1 -1
- package/dist/types/components/Message/renderText/regex.d.ts.map +1 -1
- package/dist/types/components/MessageList/hooks/useMarkRead.d.ts.map +1 -1
- package/dist/types/context/ComponentContext.d.ts +2 -0
- package/dist/types/context/ComponentContext.d.ts.map +1 -1
- package/dist/types/i18n/Streami18n.d.ts +12 -12
- package/dist/types/i18n/Streami18n.d.ts.map +1 -1
- package/dist/types/i18n/types.d.ts +1 -1
- package/package.json +8 -7
- package/dist/cjs/useNotificationApi.eb753f31.js.map +0 -1
- package/dist/es/useNotificationApi.fa5cddf9.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as useLegacyThreadContext, Lr as useStateStore, Wr as useChatContext, g as useThreadContext, qr as useChannelStateContext } from "./useNotificationApi.
|
|
1
|
+
import { L as useLegacyThreadContext, Lr as useStateStore, Wr as useChatContext, g as useThreadContext, qr as useChannelStateContext } from "./useNotificationApi.eff88f29.mjs";
|
|
2
2
|
import { createContext, useContext, useEffect, useMemo } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { MessageComposer } from "stream-chat";
|
|
@@ -66,4 +66,4 @@ var useMessageComposerController = () => {
|
|
|
66
66
|
//#endregion
|
|
67
67
|
export { useMessageComposerContext as a, MessageComposerContextProvider as i, useIsCooldownActive as n, MessageComposerContext as r, useMessageComposerController as t };
|
|
68
68
|
|
|
69
|
-
//# sourceMappingURL=useMessageComposerController.
|
|
69
|
+
//# sourceMappingURL=useMessageComposerController.2309f433.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessageComposerController.
|
|
1
|
+
{"version":3,"file":"useMessageComposerController.2309f433.mjs","names":[],"sources":["../../src/context/MessageComposerContext.tsx","../../src/components/MessageComposer/hooks/useIsCooldownActive.ts","../../src/components/MessageComposer/hooks/useMessageComposerController.ts"],"sourcesContent":["import React, { createContext, useContext } from 'react';\nimport type { PropsWithChildren } from 'react';\n\nimport type { MessageComposerProps } from '../components/MessageComposer';\nimport type { UseMessageComposerBindingsParams } from '../components/MessageComposer/hooks/useMessageComposerBindings';\n\nexport type MessageComposerContextValue = UseMessageComposerBindingsParams &\n Omit<MessageComposerProps, 'Input'>;\n\nexport const MessageComposerContext = createContext<\n UseMessageComposerBindingsParams | undefined\n>(undefined);\n\nexport const MessageComposerContextProvider = ({\n children,\n value,\n}: PropsWithChildren<{\n value: MessageComposerContextValue;\n}>) => (\n <MessageComposerContext.Provider\n value={value as unknown as MessageComposerContextValue}\n >\n {children}\n </MessageComposerContext.Provider>\n);\n\nexport const useMessageComposerContext = (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n componentName?: string,\n) => {\n const contextValue = useContext(MessageComposerContext);\n\n if (!contextValue) {\n return {} as MessageComposerContextValue;\n }\n\n return contextValue as unknown as MessageComposerContextValue;\n};\n","import { useChannelStateContext } from '../../../context';\nimport { useStateStore } from '../../../store';\nimport type { CooldownTimerState } from 'stream-chat';\n\nconst cooldownTimerStateSelector = (state: CooldownTimerState) => ({\n isCooldownActive: !!state.cooldownRemaining,\n});\n\nexport const useIsCooldownActive = () => {\n const { channel } = useChannelStateContext();\n return useStateStore(channel.cooldownTimer.state, cooldownTimerStateSelector)\n .isCooldownActive;\n};\n","import { useEffect, useMemo } from 'react';\nimport { MessageComposer as MessageComposerController } from 'stream-chat';\nimport { useThreadContext } from '../../Threads';\nimport { useChannelStateContext, useChatContext } from '../../../context';\nimport { useLegacyThreadContext } from '../../Thread';\n\nexport const useMessageComposerController = () => {\n const { client } = useChatContext();\n const { messageComposerCache: queueCache } = client;\n const { channel } = useChannelStateContext();\n const { legacyThread: parentMessage } = useLegacyThreadContext();\n const threadInstance = useThreadContext();\n\n const cachedParentMessage = useMemo(() => {\n if (!parentMessage) return undefined;\n\n return parentMessage;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [parentMessage?.id]);\n\n // composer hierarchy\n // edited message (always new) -> thread instance (own) -> thread message (always new) -> channel (own)\n // editedMessage ?? thread ?? parentMessage ?? channel;\n const messageComposer = useMemo(() => {\n if (threadInstance) {\n return threadInstance.messageComposer;\n } else if (cachedParentMessage) {\n const compositionContext = {\n ...cachedParentMessage,\n legacyThreadId: cachedParentMessage.id,\n };\n\n const tag = MessageComposerController.constructTag(compositionContext);\n\n const cachedComposer = queueCache.get(tag);\n if (cachedComposer) return cachedComposer;\n\n return new MessageComposerController({\n client,\n compositionContext,\n });\n } else {\n return channel.messageComposer;\n }\n }, [cachedParentMessage, channel, client, queueCache, threadInstance]);\n\n if (\n (['legacy_thread', 'message'] as MessageComposerController['contextType'][]).includes(\n messageComposer.contextType,\n ) &&\n !queueCache.peek(messageComposer.tag)\n ) {\n queueCache.add(messageComposer.tag, messageComposer);\n }\n\n useEffect(() => {\n const unsubscribe = messageComposer.registerSubscriptions();\n return () => {\n unsubscribe();\n };\n }, [messageComposer]);\n\n return messageComposer;\n};\n"],"mappings":";;;;;AASA,IAAa,yBAAyB,cAEpC,KAAA,CAAS;AAEX,IAAa,kCAAkC,EAC7C,UACA,YAIA,oBAAC,uBAAuB,UAAxB;CACS;CAEN;AAC8B,CAAA;AA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,OAAO;AACT"}
|
|
@@ -6,8 +6,8 @@ import clsx from "clsx";
|
|
|
6
6
|
import { useSyncExternalStore } from "use-sync-external-store/shim";
|
|
7
7
|
import { createPortal } from "react-dom";
|
|
8
8
|
import Dayjs from "dayjs";
|
|
9
|
-
import calendar from "dayjs/plugin/calendar";
|
|
10
|
-
import localizedFormat from "dayjs/plugin/localizedFormat";
|
|
9
|
+
import calendar from "dayjs/plugin/calendar.js";
|
|
10
|
+
import localizedFormat from "dayjs/plugin/localizedFormat.js";
|
|
11
11
|
import debounce from "lodash.debounce";
|
|
12
12
|
import throttle from "lodash.throttle";
|
|
13
13
|
import deepequal from "react-fast-compare";
|
|
@@ -692,7 +692,7 @@ var getNotificationTargetPanels = (notification) => {
|
|
|
692
692
|
var getNotificationTargetTag = (panel) => `target:${panel}`;
|
|
693
693
|
var addNotificationTargetTag = (panel, tags) => {
|
|
694
694
|
if (!panel) return tags ?? [];
|
|
695
|
-
return Array.from(new Set([getNotificationTargetTag(panel), ...tags ?? []]));
|
|
695
|
+
return Array.from(/* @__PURE__ */ new Set([getNotificationTargetTag(panel), ...tags ?? []]));
|
|
696
696
|
};
|
|
697
697
|
var isNotificationForPanel = (notification, panel, options) => {
|
|
698
698
|
const explicitTargetPanels = getNotificationTargetPanels(notification);
|
|
@@ -1707,7 +1707,7 @@ var initialState = {
|
|
|
1707
1707
|
var useCreateChannelStateContext = (value) => {
|
|
1708
1708
|
const { channel, channelCapabilitiesArray = [], channelConfig, channelUnreadUiState, error, giphyVersion, hasMore, hasMoreNewer, highlightedMessageId, imageAttachmentSizeHandler, loading, loadingMore, loadingMoreForJumpToChannelMessage, members, messages = [], mutes, notifications, pinnedMessages, read = {}, shouldGenerateVideoThumbnail, skipMessageDataMemoization, suppressAutoscroll, thread, threadHasMore, threadLoadingMore, threadMessages = [], videoAttachmentSizeHandler, watcher_count, watcherCount, watchers } = value;
|
|
1709
1709
|
const channelId = channel.cid;
|
|
1710
|
-
const lastRead = channel.initialized && channel.lastRead()?.getTime();
|
|
1710
|
+
const lastRead = channel.initialized && !channel.disconnected && channel.lastRead()?.getTime();
|
|
1711
1711
|
const membersLength = Object.keys(members || []).length;
|
|
1712
1712
|
const notificationsLength = notifications.length;
|
|
1713
1713
|
const readUsers = Object.values(read);
|
|
@@ -3400,7 +3400,7 @@ var ChannelInner = (props) => {
|
|
|
3400
3400
|
});
|
|
3401
3401
|
}, [isMounted]);
|
|
3402
3402
|
const loadMore = async (limit = 25) => {
|
|
3403
|
-
if (!online.current || !window.navigator.onLine || !channel.state.messagePagination.hasPrev) return 0;
|
|
3403
|
+
if (channel.disconnected || !online.current || !window.navigator.onLine || !channel.state.messagePagination.hasPrev) return 0;
|
|
3404
3404
|
const oldestMessage = state?.messages?.[0];
|
|
3405
3405
|
if (state.loadingMore || state.loadingMoreNewer || oldestMessage?.status !== "received") return 0;
|
|
3406
3406
|
dispatch({
|
|
@@ -4084,9 +4084,9 @@ var hasSystemNotificationTag = (notification) => notification.tags?.includes("sy
|
|
|
4084
4084
|
var getTargetTags = (targetPanels, inferredPanel, tags, modalManagerHasOpenDialog) => {
|
|
4085
4085
|
if (targetPanels) {
|
|
4086
4086
|
const effectiveTargetPanels = modalManagerHasOpenDialog && targetPanels.length > 0 ? [...targetPanels, "modal"] : targetPanels;
|
|
4087
|
-
return Array.from(new Set([...effectiveTargetPanels.map(getNotificationTargetTag), ...tags ?? []]));
|
|
4087
|
+
return Array.from(/* @__PURE__ */ new Set([...effectiveTargetPanels.map(getNotificationTargetTag), ...tags ?? []]));
|
|
4088
4088
|
}
|
|
4089
|
-
if (modalManagerHasOpenDialog) return Array.from(new Set([
|
|
4089
|
+
if (modalManagerHasOpenDialog) return Array.from(/* @__PURE__ */ new Set([
|
|
4090
4090
|
...inferredPanel ? [getNotificationTargetTag(inferredPanel)] : [],
|
|
4091
4091
|
getNotificationTargetTag("modal"),
|
|
4092
4092
|
...tags ?? []
|
|
@@ -4139,7 +4139,7 @@ var useNotificationApi = () => {
|
|
|
4139
4139
|
modalManagerHasOpenDialog
|
|
4140
4140
|
]),
|
|
4141
4141
|
addSystemNotification: useCallback(({ actions, context, duration, emitter, error, incident, message, severity, tags, type }) => {
|
|
4142
|
-
const notificationTags = Array.from(new Set([SYSTEM_NOTIFICATION_TAG, ...tags ?? []]));
|
|
4142
|
+
const notificationTags = Array.from(/* @__PURE__ */ new Set([SYSTEM_NOTIFICATION_TAG, ...tags ?? []]));
|
|
4143
4143
|
const resolvedType = getTypeFromIncident({
|
|
4144
4144
|
incident,
|
|
4145
4145
|
severity,
|
|
@@ -4174,4 +4174,4 @@ var useNotificationApi = () => {
|
|
|
4174
4174
|
//#endregion
|
|
4175
4175
|
export { isMessageErrorRetryable as $, addNotificationTargetTag as $n, useChannelActionContext as $r, IconGiphy as $t, WithAudioPlayback as A, IconSend as An, useDialogIsOpen as Ar, IconCamera as At, MESSAGE_ACTIONS as B, IconUserAdd as Bn, ComponentProvider as Br, IconDelete as Bt, insertIntro as C, IconPoll as Cn, useModalDialogManager as Cr, IconAttachment as Ct, makeDateMessageId as D, IconReply as Dn, Portal as Dr, IconBolt as Dt, isLocalMessage as E, IconReorder as En, DialogPortalEntry as Er, IconBellOff as Et, elementIsPlaying as F, IconTrophy as Fn, useModalDialogIsTopmost as Fr, IconChevronLeft as Ft, getImages as G, IconVideoFill as Gn, ChannelStateContext as Gr, IconExclamationCircleFill as Gt, areMessagePropsEqual as H, IconUserRemove as Hn, ChatContext as Hr, IconEdit as Ht, LegacyThreadContext as I, IconUnpin as In, useOpenedDialogCount as Ir, IconChevronRight as It, getReadByTooltipText as J, IconXmark as Jn, ChannelListContext as Jr, IconExclamationTriangleFill as Jt, getMessageActions as K, IconVoice as Kn, ChannelStateProvider as Kr, IconExclamationMark as Kt, useLegacyThreadContext as L, IconUnsupportedAttachment as Ln, useStateStore as Lr, IconClock as Lt, useAudioPlayer as M, IconThread as Mn, useDialogOnNearestManager as Mr, IconCheckmark1Small as Mt, AudioPlayer as N, IconThreadFill as Nn, useModalDialog as Nr, IconChecks as Nt, makeIntroMessage as O, IconRetry as On, modalDialogId as Or, IconBookmark as Ot, defaultRegisterAudioPlayerError as P, IconTranslate as Pn, useModalDialogIsOpen as Pr, IconChevronDown as Pt, isMessageEdited as Q, useStableId as Qn, ChannelActionProvider as Qr, IconFolder as Qt, usePopoverPosition as R, IconUpload as Rn, DialogManager as Rr, IconCommand as Rt, hasMoreMessagesProbably as S, IconPlusSmall as Sn, useDialogManager as Sr, IconArrowUpRight as St, isIntroMessage as T, IconRefresh as Tn, DialogPortalDestination as Tr, IconBell as Tt, areMessageUIPropsEqual as U, IconUsers as Un, ChatProvider as Ur, IconEmoji as Ut, OPTIONAL_MESSAGE_ACTIONS as V, IconUserCheck as Vn, useComponentContext as Vr, IconDownload as Vt, countEmojis as W, IconVideo as Wn, useChatContext as Wr, IconEmojiAdd as Wt, isMessageBounced as X, createIcon as Xn, useChannelListContext as Xr, IconFile as Xt, isMessageBlocked as Y, IconXmarkSmall as Yn, ChannelListContextProvider as Yr, IconEyeFill as Yt, isMessageDeleted as Z, Button as Zn, ChannelActionContext as Zr, IconFlag as Zt, Channel as _, IconNotification as _n, isNumberOrString as _r, IconArchive as _t, ChatView as a, IconLocation as an, TypingContext as ar, messageHasQuotedMessage as at, getIsFirstUnreadMessage as b, IconPlayFill as bn, ModalDialogManagerProvider as br, IconArrowLeft as bt, ChatViewSelectorButton as c, IconMessageBubble as cn, TranslationContext as cr, messageTextHasEmojisOnly as ct, useActiveThread as d, IconMicrophoneSolid as dn, defaultDateTimeParser as dr, CHANNEL_CONTAINER_ID as dt, IconImage as en, getNotificationTargetPanel as er, isNetworkSendFailure as et, useChatViewContext as f, IconMinus as fn, defaultTranslatorFunction as fr, LoadingErrorIndicator as ft, useThreadContext as g, IconNoSign as gn, isLanguageSupported as gr, EmptyStateIndicator as gt, ThreadProvider as h, IconMute as hn, isDayOrMoment as hr, useEditMessageHandler as ht, useNotificationTarget as i, IconLoading as in, isNotificationTargetPanel as ir, messageHasGiphyAttachment as it, useActiveAudioPlayer as j, IconShield as jn, useDialogIsTopmost as jr, IconCheckmark as jt, processMessages as k, IconSearch as kn, useDialog as kr, IconBookmarkRemove as kt, ChatViewThreadsSelectorButton as l, IconMessageBubbleFill as ln, TranslationProvider as lr, validateAndGetMessage as lt, ThreadContext as m, IconMore as mn, isDate as mr, useMentionsHandlers as mt, hasSystemNotificationTag as n, IconLeave as nn, getNotificationTargetTag as nr, mapToUserNameOrId as nt, ChatViewChannelsSelectorButton as o, IconMegaphone as on, TypingProvider as or, messageHasReactions as ot, useThreadsViewContext as p, IconMinusCircle as pn, getDateString as pr, LoadingChannel as pt, getNonImageAttachments as q, IconXCircle as qn, useChannelStateContext as qr, IconExclamationMarkFill as qt, useNotificationApi as r, IconLink as rn, isNotificationForPanel as rr, messageHasAttachments as rt, ChatViewContext as s, IconMenu as sn, useTypingContext as sr, messageHasSingleAttachment as st, SYSTEM_NOTIFICATION_TAG as t, IconInfo as tn, getNotificationTargetPanels as tr, isUserMuted as tt, defaultChatViewSelectorItemSet as u, IconMessageBubbles as un, useTranslationContext as ur, EMOJI_REGEX as ut, getChannel as v, IconPauseFill as vn, predefinedFormatters as vr, IconArrowDown as vt, isDateSeparatorMessage as w, IconQuote as wn, useNearestDialogManagerContext as wr, IconAudio as wt, getLastReceived as x, IconPlus as xn, modalDialogManagerId as xr, IconArrowUp as xt, getGroupStyles as y, IconPin as yn, DialogManagerProvider as yr, IconArrowDownCircle as yt, ACTIONS_NOT_WORKING_IN_THREAD as z, IconUser as zn, ComponentContext as zr, IconCopy as zt };
|
|
4176
4176
|
|
|
4177
|
-
//# sourceMappingURL=useNotificationApi.
|
|
4177
|
+
//# sourceMappingURL=useNotificationApi.eff88f29.mjs.map
|