@ttt-productions/chat-react 0.13.15 → 0.13.17
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/README.md +3 -3
- package/dist/context/ChatNameResolverContext.d.ts +3 -26
- package/dist/context/ChatNameResolverContext.d.ts.map +1 -1
- package/dist/context/ChatNameResolverContext.js +3 -19
- package/dist/context/ChatNameResolverContext.js.map +1 -1
- package/dist/firestore/queries.js +1 -1
- package/dist/firestore/queries.js.map +1 -1
- package/dist/hooks/useChatMessages.d.ts +3 -7
- package/dist/hooks/useChatMessages.d.ts.map +1 -1
- package/dist/hooks/useChatMessages.js +20 -22
- package/dist/hooks/useChatMessages.js.map +1 -1
- package/dist/index.d.ts +32 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -14
- package/dist/index.js.map +1 -1
- package/dist/realtime/channel-client.d.ts +0 -248
- package/dist/realtime/channel-client.d.ts.map +1 -1
- package/dist/realtime/channel-client.js +102 -464
- package/dist/realtime/channel-client.js.map +1 -1
- package/dist/realtime/diagnostics.d.ts +0 -62
- package/dist/realtime/diagnostics.d.ts.map +1 -1
- package/dist/realtime/diagnostics.js +4 -89
- package/dist/realtime/diagnostics.js.map +1 -1
- package/dist/realtime/inbox-client.d.ts +0 -71
- package/dist/realtime/inbox-client.d.ts.map +1 -1
- package/dist/realtime/inbox-client.js +29 -109
- package/dist/realtime/inbox-client.js.map +1 -1
- package/dist/realtime/initial-load-budget.d.ts +1 -16
- package/dist/realtime/initial-load-budget.d.ts.map +1 -1
- package/dist/realtime/initial-load-budget.js +1 -20
- package/dist/realtime/initial-load-budget.js.map +1 -1
- package/dist/realtime/map.d.ts +0 -28
- package/dist/realtime/map.d.ts.map +1 -1
- package/dist/realtime/map.js +3 -37
- package/dist/realtime/map.js.map +1 -1
- package/dist/realtime/shared.d.ts +0 -79
- package/dist/realtime/shared.d.ts.map +1 -1
- package/dist/realtime/shared.js +2 -80
- package/dist/realtime/shared.js.map +1 -1
- package/dist/realtime/socket.d.ts +0 -15
- package/dist/realtime/socket.d.ts.map +1 -1
- package/dist/realtime/socket.js +1 -15
- package/dist/realtime/socket.js.map +1 -1
- package/dist/realtime/transport.d.ts +1 -25
- package/dist/realtime/transport.d.ts.map +1 -1
- package/dist/realtime/transport.js +1 -14
- package/dist/realtime/transport.js.map +1 -1
- package/dist/realtime/useRealtimeChatMessages.d.ts +4 -21
- package/dist/realtime/useRealtimeChatMessages.d.ts.map +1 -1
- package/dist/realtime/useRealtimeChatMessages.js +5 -27
- package/dist/realtime/useRealtimeChatMessages.js.map +1 -1
- package/dist/realtime/wire.d.ts +0 -58
- package/dist/realtime/wire.d.ts.map +1 -1
- package/dist/realtime/wire.js +0 -22
- package/dist/realtime/wire.js.map +1 -1
- package/dist/types.d.ts +3 -41
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +1 -1
- package/dist/ui/ChatShell.d.ts +5 -47
- package/dist/ui/ChatShell.d.ts.map +1 -1
- package/dist/ui/ChatShell.js +39 -73
- package/dist/ui/ChatShell.js.map +1 -1
- package/dist/ui/Composer.d.ts +1 -14
- package/dist/ui/Composer.d.ts.map +1 -1
- package/dist/ui/Composer.js +12 -25
- package/dist/ui/Composer.js.map +1 -1
- package/dist/ui/MessageItemDefault.d.ts +2 -6
- package/dist/ui/MessageItemDefault.d.ts.map +1 -1
- package/dist/ui/MessageItemDefault.js +26 -56
- package/dist/ui/MessageItemDefault.js.map +1 -1
- package/dist/ui/MessageList.d.ts +3 -26
- package/dist/ui/MessageList.d.ts.map +1 -1
- package/dist/ui/MessageList.js +15 -28
- package/dist/ui/MessageList.js.map +1 -1
- package/dist/ui/MessageText.d.ts +0 -13
- package/dist/ui/MessageText.d.ts.map +1 -1
- package/dist/ui/MessageText.js.map +1 -1
- package/dist/ui/SenderName.d.ts +0 -5
- package/dist/ui/SenderName.d.ts.map +1 -1
- package/dist/ui/SenderName.js +3 -8
- package/dist/ui/SenderName.js.map +1 -1
- package/dist/ui/menus.d.ts +1 -1
- package/dist/ui/menus.d.ts.map +1 -1
- package/dist/ui/menus.js +5 -7
- package/dist/ui/menus.js.map +1 -1
- package/package.json +10 -10
- package/src/styles/chat.css +2 -15
- package/dist/realtime/index.d.ts +0 -19
- package/dist/realtime/index.d.ts.map +0 -1
- package/dist/realtime/index.js +0 -15
- package/dist/realtime/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# @ttt-productions/chat-react
|
|
2
2
|
|
|
3
|
-
Chat **React UI** for
|
|
3
|
+
Chat **React UI** for consuming apps: chat shell, composer, message list,
|
|
4
4
|
the name-resolver context, and the realtime-newest-window + infinite-older
|
|
5
|
-
hooks. Chat is PLAIN-TEXT-only — a conversation
|
|
6
|
-
app's
|
|
5
|
+
hooks. Chat is PLAIN-TEXT-only — files an app attaches to a conversation are the
|
|
6
|
+
app's own surface, never in the message timeline, and message text
|
|
7
7
|
carries no token grammar (no mentions, no autocomplete, no chips).
|
|
8
8
|
|
|
9
9
|
Built on the pure [`@ttt-productions/chat-core`](../chat-core) package
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import type { ChatNameResolution, ChatNameResolver, ChatPrewarmSenders } from
|
|
3
|
-
/** A sender name the app could not resolve: pending, unavailable, or failed. */
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ChatNameResolution, ChatNameResolver, ChatPrewarmSenders } from '@ttt-productions/chat-core';
|
|
4
3
|
export type UnresolvedChatName = Exclude<ChatNameResolution, {
|
|
5
|
-
status:
|
|
4
|
+
status: 'resolved';
|
|
6
5
|
}>;
|
|
7
6
|
type ChatNameResolverContextValue = {
|
|
8
7
|
resolveName: ChatNameResolver;
|
|
@@ -12,34 +11,12 @@ type ChatNameResolverContextValue = {
|
|
|
12
11
|
export type ChatNameResolverProviderProps = {
|
|
13
12
|
resolveName: ChatNameResolver;
|
|
14
13
|
prewarm?: ChatPrewarmSenders;
|
|
15
|
-
/**
|
|
16
|
-
* Renders a sender whose name is not resolved — the app's own placeholder while the
|
|
17
|
-
* read is pending, its unavailable state when there is no person to name, and its
|
|
18
|
-
* load-error state (with `retry`) when the read failed. The chat UI never writes a
|
|
19
|
-
* stand-in name of its own; without this slot an unresolved sender renders nothing.
|
|
20
|
-
*/
|
|
21
14
|
renderUnresolvedName?: (resolution: UnresolvedChatName) => React.ReactNode;
|
|
22
15
|
children: React.ReactNode;
|
|
23
16
|
};
|
|
24
|
-
/**
|
|
25
|
-
* Wraps any chat-react consumer (typically the whole app shell) and provides the name
|
|
26
|
-
* resolver. Required for any tree that renders <ChatShell>, <MessageList>, or
|
|
27
|
-
* <MessageItemDefault>.
|
|
28
|
-
*/
|
|
29
17
|
export declare function ChatNameResolverProvider(props: ChatNameResolverProviderProps): React.JSX.Element;
|
|
30
|
-
/**
|
|
31
|
-
* Strict hook — throws if no provider is wrapped. Used inside this package's own
|
|
32
|
-
* renderers so a missing setup surfaces on first render instead of rendering a sender
|
|
33
|
-
* with no name.
|
|
34
|
-
*/
|
|
35
18
|
export declare function useChatNameResolver(): ChatNameResolverContextValue;
|
|
36
|
-
/**
|
|
37
|
-
* Optional variant — returns null instead of throwing when no provider is wrapped.
|
|
38
|
-
* Used internally by the message hooks so headless callers (tests, data-only consumers
|
|
39
|
-
* that render no UI) can still use them.
|
|
40
|
-
*/
|
|
41
19
|
export declare function useOptionalChatNameResolver(): ChatNameResolverContextValue | null;
|
|
42
|
-
/** What the app knows about a sender's name right now. Re-renders as the app's cache settles. */
|
|
43
20
|
export declare function useSenderNameResolution(senderId: string): ChatNameResolution;
|
|
44
21
|
export {};
|
|
45
22
|
//# sourceMappingURL=ChatNameResolverContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatNameResolverContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatNameResolverContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAEpC,
|
|
1
|
+
{"version":3,"file":"ChatNameResolverContext.d.ts","sourceRoot":"","sources":["../../src/context/ChatNameResolverContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,EAAE;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC,CAAC;AAErF,KAAK,4BAA4B,GAAG;IAClC,WAAW,EAAE,gBAAgB,CAAC;IAC9B,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,oBAAoB,CAAC,EAAE,CAAC,UAAU,EAAE,kBAAkB,KAAK,KAAK,CAAC,SAAS,CAAC;CAC5E,CAAC;AAIF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,WAAW,EAAE,gBAAgB,CAAC;IAC9B,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,oBAAoB,CAAC,EAAE,CAAC,UAAU,EAAE,kBAAkB,KAAK,KAAK,CAAC,SAAS,CAAC;IAC3E,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,qBAS5E;AAED,wBAAgB,mBAAmB,IAAI,4BAA4B,CAQlE;AAED,wBAAgB,2BAA2B,IAAI,4BAA4B,GAAG,IAAI,CAEjF;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,CAG5E"}
|
|
@@ -1,38 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as React from
|
|
3
|
+
import * as React from 'react';
|
|
4
4
|
const ChatNameResolverContext = React.createContext(null);
|
|
5
|
-
/**
|
|
6
|
-
* Wraps any chat-react consumer (typically the whole app shell) and provides the name
|
|
7
|
-
* resolver. Required for any tree that renders <ChatShell>, <MessageList>, or
|
|
8
|
-
* <MessageItemDefault>.
|
|
9
|
-
*/
|
|
10
5
|
export function ChatNameResolverProvider(props) {
|
|
11
6
|
const { resolveName, prewarm, renderUnresolvedName, children } = props;
|
|
12
7
|
const value = React.useMemo(() => ({ resolveName, prewarm, renderUnresolvedName }), [resolveName, prewarm, renderUnresolvedName]);
|
|
13
8
|
return (_jsx(ChatNameResolverContext.Provider, { value: value, children: children }));
|
|
14
9
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Strict hook — throws if no provider is wrapped. Used inside this package's own
|
|
17
|
-
* renderers so a missing setup surfaces on first render instead of rendering a sender
|
|
18
|
-
* with no name.
|
|
19
|
-
*/
|
|
20
10
|
export function useChatNameResolver() {
|
|
21
11
|
const ctx = React.useContext(ChatNameResolverContext);
|
|
22
12
|
if (!ctx) {
|
|
23
|
-
throw new Error(
|
|
13
|
+
throw new Error('[chat-react] ChatNameResolverProvider is required. Wrap your ChatShell tree with <ChatNameResolverProvider>.');
|
|
24
14
|
}
|
|
25
15
|
return ctx;
|
|
26
16
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Optional variant — returns null instead of throwing when no provider is wrapped.
|
|
29
|
-
* Used internally by the message hooks so headless callers (tests, data-only consumers
|
|
30
|
-
* that render no UI) can still use them.
|
|
31
|
-
*/
|
|
32
17
|
export function useOptionalChatNameResolver() {
|
|
33
18
|
return React.useContext(ChatNameResolverContext);
|
|
34
19
|
}
|
|
35
|
-
/** What the app knows about a sender's name right now. Re-renders as the app's cache settles. */
|
|
36
20
|
export function useSenderNameResolution(senderId) {
|
|
37
21
|
const { resolveName } = useChatNameResolver();
|
|
38
22
|
return resolveName(senderId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatNameResolverContext.js","sourceRoot":"","sources":["../../src/context/ChatNameResolverContext.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatNameResolverContext.js","sourceRoot":"","sources":["../../src/context/ChatNameResolverContext.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,MAAM,uBAAuB,GAAG,KAAK,CAAC,aAAa,CAAsC,IAAI,CAAC,CAAC;AAS/F,MAAM,UAAU,wBAAwB,CAAC,KAAoC;IAC3E,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACvE,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CACzB,GAAG,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC,EACtD,CAAC,WAAW,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAC7C,CAAC;IACF,OAAO,CACL,KAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAoC,CAC9F,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;IACtD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,8GAA8G,CAC/G,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,2BAA2B;IACzC,OAAO,KAAK,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,QAAgB;IACtD,MAAM,EAAE,WAAW,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAC9C,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type {\n ChatNameResolution,\n ChatNameResolver,\n ChatPrewarmSenders,\n} from '@ttt-productions/chat-core';\n\nexport type UnresolvedChatName = Exclude<ChatNameResolution, { status: 'resolved' }>;\n\ntype ChatNameResolverContextValue = {\n resolveName: ChatNameResolver;\n prewarm?: ChatPrewarmSenders;\n renderUnresolvedName?: (resolution: UnresolvedChatName) => React.ReactNode;\n};\n\nconst ChatNameResolverContext = React.createContext<ChatNameResolverContextValue | null>(null);\n\nexport type ChatNameResolverProviderProps = {\n resolveName: ChatNameResolver;\n prewarm?: ChatPrewarmSenders;\n renderUnresolvedName?: (resolution: UnresolvedChatName) => React.ReactNode;\n children: React.ReactNode;\n};\n\nexport function ChatNameResolverProvider(props: ChatNameResolverProviderProps) {\n const { resolveName, prewarm, renderUnresolvedName, children } = props;\n const value = React.useMemo(\n () => ({ resolveName, prewarm, renderUnresolvedName }),\n [resolveName, prewarm, renderUnresolvedName],\n );\n return (\n <ChatNameResolverContext.Provider value={value}>{children}</ChatNameResolverContext.Provider>\n );\n}\n\nexport function useChatNameResolver(): ChatNameResolverContextValue {\n const ctx = React.useContext(ChatNameResolverContext);\n if (!ctx) {\n throw new Error(\n '[chat-react] ChatNameResolverProvider is required. Wrap your ChatShell tree with <ChatNameResolverProvider>.',\n );\n }\n return ctx;\n}\n\nexport function useOptionalChatNameResolver(): ChatNameResolverContextValue | null {\n return React.useContext(ChatNameResolverContext);\n}\n\nexport function useSenderNameResolution(senderId: string): ChatNameResolution {\n const { resolveName } = useChatNameResolver();\n return resolveName(senderId);\n}\n"]}
|
|
@@ -4,7 +4,7 @@ function normalizeSegments(path) {
|
|
|
4
4
|
export function threadDocPath(chatCollectionPath, threadId) {
|
|
5
5
|
return [...normalizeSegments(chatCollectionPath), threadId];
|
|
6
6
|
}
|
|
7
|
-
export function messagesColPath(chatCollectionPath, threadId, messagesSubcollection =
|
|
7
|
+
export function messagesColPath(chatCollectionPath, threadId, messagesSubcollection = 'messages') {
|
|
8
8
|
const segments = [...normalizeSegments(chatCollectionPath), threadId, messagesSubcollection];
|
|
9
9
|
return segments;
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/firestore/queries.ts"],"names":[],"mappings":"AAAA,SAAS,iBAAiB,CAAC,IAAuB;IAChD,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,kBAAqC,EAAE,QAAgB;IACnF,OAAO,CAAC,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,kBAAqC,EACrC,QAAgB,EAChB,qBAAqB,GAAG,UAAU;IAElC,MAAM,QAAQ,GAAG,CAAC,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;IAC7F,OAAO,QAAyC,CAAC;AACnD,CAAC","sourcesContent":["function normalizeSegments(path: string | string[]): string[] {\n return Array.isArray(path) ? path : [path];\n}\n\nexport function threadDocPath(chatCollectionPath: string | string[], threadId: string): string[] {\n return [...normalizeSegments(chatCollectionPath), threadId];\n}\n\nexport function messagesColPath(\n chatCollectionPath: string | string[],\n threadId: string,\n messagesSubcollection =
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/firestore/queries.ts"],"names":[],"mappings":"AAAA,SAAS,iBAAiB,CAAC,IAAuB;IAChD,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,kBAAqC,EAAE,QAAgB;IACnF,OAAO,CAAC,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,kBAAqC,EACrC,QAAgB,EAChB,qBAAqB,GAAG,UAAU;IAElC,MAAM,QAAQ,GAAG,CAAC,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;IAC7F,OAAO,QAAyC,CAAC;AACnD,CAAC","sourcesContent":["function normalizeSegments(path: string | string[]): string[] {\n return Array.isArray(path) ? path : [path];\n}\n\nexport function threadDocPath(chatCollectionPath: string | string[], threadId: string): string[] {\n return [...normalizeSegments(chatCollectionPath), threadId];\n}\n\nexport function messagesColPath(\n chatCollectionPath: string | string[],\n threadId: string,\n messagesSubcollection = 'messages',\n): [string, string, ...string[]] {\n const segments = [...normalizeSegments(chatCollectionPath), threadId, messagesSubcollection];\n return segments as [string, string, ...string[]];\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { FirestoreSourceState } from
|
|
2
|
-
import type { ChatMessageV1 } from
|
|
3
|
-
import type { ChatCoreConfig } from
|
|
1
|
+
import type { FirestoreSourceState } from '@ttt-productions/query-core/types';
|
|
2
|
+
import type { ChatMessageV1 } from '@ttt-productions/chat-core';
|
|
3
|
+
import type { ChatCoreConfig } from '../types.js';
|
|
4
4
|
export type UseChatMessagesResult = {
|
|
5
5
|
allowed: boolean;
|
|
6
6
|
isInitialLoading: boolean;
|
|
@@ -8,13 +8,9 @@ export type UseChatMessagesResult = {
|
|
|
8
8
|
fetchOlder: () => Promise<void>;
|
|
9
9
|
hasOlder: boolean;
|
|
10
10
|
isFetchingOlder: boolean;
|
|
11
|
-
/** The live listener's state: `connecting` while it (re)subscribes, `error` once it failed. */
|
|
12
11
|
sourceState: FirestoreSourceState;
|
|
13
|
-
/** The live listener's failure; the messages already shown stay in `messages`. */
|
|
14
12
|
error: Error | null;
|
|
15
|
-
/** The last older-page read failed; the list stops asking for older pages until `retry`. */
|
|
16
13
|
olderError: Error | null;
|
|
17
|
-
/** Re-run what failed: resubscribe a failed listener, re-read a failed older page. */
|
|
18
14
|
retry: () => void;
|
|
19
15
|
};
|
|
20
16
|
export declare function useChatMessages(config: ChatCoreConfig): UseChatMessagesResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChatMessages.d.ts","sourceRoot":"","sources":["../../src/hooks/useChatMessages.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useChatMessages.d.ts","sourceRoot":"","sources":["../../src/hooks/useChatMessages.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMlD,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,oBAAoB,CAAC;IAClC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,KAAK,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AA8BF,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,qBAAqB,CAyF7E"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import * as React from
|
|
3
|
-
import { toMillis } from
|
|
4
|
-
import { useFirestoreLiveInfinite } from
|
|
5
|
-
import { messagesColPath } from
|
|
6
|
-
import { useOptionalChatNameResolver } from
|
|
7
|
-
// Safety limit to prevent memory exhaustion
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { toMillis } from '@ttt-productions/firebase-helpers';
|
|
4
|
+
import { useFirestoreLiveInfinite } from '@ttt-productions/query-core/react';
|
|
5
|
+
import { messagesColPath } from '../firestore/queries.js';
|
|
6
|
+
import { useOptionalChatNameResolver } from '../context/ChatNameResolverContext.js';
|
|
8
7
|
const MAX_PAGE_SIZE = 100;
|
|
9
8
|
function mapMsg(data, threadId, messageMeta) {
|
|
10
9
|
const d = data;
|
|
@@ -12,47 +11,46 @@ function mapMsg(data, threadId, messageMeta) {
|
|
|
12
11
|
if (!createdAt) {
|
|
13
12
|
console.error('[useChatMessages] Message missing valid createdAt:', data.id, d.createdAt);
|
|
14
13
|
}
|
|
15
|
-
// A stored `replyTo` (if any legacy doc still carries one) is deliberately NOT
|
|
16
|
-
// mapped: chat has no reply-authoring affordance, so the UI has no reply
|
|
17
|
-
// renderer to feed.
|
|
18
14
|
const appMeta = messageMeta?.(data);
|
|
19
15
|
return {
|
|
20
16
|
messageId: data.id,
|
|
21
17
|
threadId,
|
|
22
18
|
createdAt: createdAt || 0,
|
|
23
19
|
senderId: d.senderId,
|
|
24
|
-
text: d.text ??
|
|
20
|
+
text: d.text ?? '',
|
|
25
21
|
type: d.type,
|
|
26
22
|
isSystemMessage: d.isSystemMessage ?? undefined,
|
|
27
23
|
referencedUids: Array.isArray(d.referencedUids) ? d.referencedUids : undefined,
|
|
28
|
-
// Moderation tombstone flag (backend-written) — carried through so renderers
|
|
29
|
-
// can tombstone the content.
|
|
30
24
|
hidden: d.hidden ?? undefined,
|
|
31
25
|
meta: appMeta ? { ...d.meta, ...appMeta } : d.meta,
|
|
32
26
|
};
|
|
33
27
|
}
|
|
34
28
|
export function useChatMessages(config) {
|
|
35
|
-
const { chatCollectionPath, messagesSubcollection =
|
|
29
|
+
const { chatCollectionPath, messagesSubcollection = 'messages', threadId, pageSize: requestedPageSize = 20, currentUserId, allowed, createdAtField = 'createdAt', messageMeta, } = config;
|
|
36
30
|
const pageSize = Math.min(requestedPageSize, MAX_PAGE_SIZE);
|
|
37
31
|
if (requestedPageSize > MAX_PAGE_SIZE) {
|
|
38
32
|
console.warn(`[useChatMessages] Requested pageSize ${requestedPageSize} exceeds maximum ${MAX_PAGE_SIZE}. Using ${MAX_PAGE_SIZE}.`);
|
|
39
33
|
}
|
|
40
|
-
// Stable key segment for the message collection path (string | string[]).
|
|
41
34
|
const pathKey = React.useMemo(() => JSON.stringify(Array.isArray(chatCollectionPath) ? chatCollectionPath : [chatCollectionPath]), [chatCollectionPath]);
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
const { items, isInitialLoading, fetchOlder, hasOlder, isFetchingOlder, sourceState, error, olderError, retry } = useFirestoreLiveInfinite({
|
|
35
|
+
const collectionPath = React.useMemo(() => messagesColPath(chatCollectionPath, threadId, messagesSubcollection).join('/'), [chatCollectionPath, threadId, messagesSubcollection]);
|
|
36
|
+
const { items, isInitialLoading, fetchOlder, hasOlder, isFetchingOlder, sourceState, error, olderError, retry, } = useFirestoreLiveInfinite({
|
|
45
37
|
collectionPath,
|
|
46
|
-
queryKey: [
|
|
38
|
+
queryKey: [
|
|
39
|
+
'chat-core',
|
|
40
|
+
'messages',
|
|
41
|
+
pathKey,
|
|
42
|
+
threadId,
|
|
43
|
+
messagesSubcollection,
|
|
44
|
+
pageSize,
|
|
45
|
+
currentUserId,
|
|
46
|
+
],
|
|
47
47
|
orderByField: createdAtField,
|
|
48
48
|
pageSize,
|
|
49
49
|
enabled: allowed,
|
|
50
|
-
sort:
|
|
50
|
+
sort: 'asc',
|
|
51
51
|
select: (data) => mapMsg(data, threadId, messageMeta),
|
|
52
52
|
});
|
|
53
53
|
const messages = React.useMemo(() => (allowed ? items : []), [allowed, items]);
|
|
54
|
-
// Pre-warm name cache for all visible senders.
|
|
55
|
-
// Optional resolver: silent no-op if no provider is wrapped.
|
|
56
54
|
const resolverCtx = useOptionalChatNameResolver();
|
|
57
55
|
const senderIds = React.useMemo(() => {
|
|
58
56
|
const set = new Set();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChatMessages.js","sourceRoot":"","sources":["../../src/hooks/useChatMessages.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAI7E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAEpF,
|
|
1
|
+
{"version":3,"file":"useChatMessages.js","sourceRoot":"","sources":["../../src/hooks/useChatMessages.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAI7E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAEpF,MAAM,aAAa,GAAG,GAAG,CAAC;AAe1B,SAAS,MAAM,CACb,IAAmC,EACnC,QAAgB,EAChB,WAA0C;IAE1C,MAAM,CAAC,GAAG,IAAW,CAAC;IAEtB,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAExC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oDAAoD,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;IAC5F,C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,CAAC,CAAC;YACpB,KAAK,MAAM,GAAG,IAAI,CAAC,CAAC,cAAc,IAAI,EAAE;gBAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,WAAW,EAAE,OAAO,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjD,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACjC,CAAC;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;IAE7B,OAAO;QACL,OAAO;QACP,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK;QACpD,QAAQ;QACR,UAAU;QACV,QAAQ;QACR,eAAe;QACf,WAAW;QACX,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;QAC7B,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI;QACvC,KAAK;KACN,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { DocumentData } from 'firebase/firestore';\nimport { toMillis } from '@ttt-productions/firebase-helpers';\nimport { useFirestoreLiveInfinite } from '@ttt-productions/query-core/react';\nimport type { FirestoreSourceState } from '@ttt-productions/query-core/types';\nimport type { ChatMessageV1 } from '@ttt-productions/chat-core';\nimport type { ChatCoreConfig } from '../types.js';\nimport { messagesColPath } from '../firestore/queries.js';\nimport { useOptionalChatNameResolver } from '../context/ChatNameResolverContext.js';\n\nconst MAX_PAGE_SIZE = 100;\n\nexport type UseChatMessagesResult = {\n allowed: boolean;\n isInitialLoading: boolean;\n messages: ChatMessageV1[];\n fetchOlder: () => Promise<void>;\n hasOlder: boolean;\n isFetchingOlder: boolean;\n sourceState: FirestoreSourceState;\n error: Error | null;\n olderError: Error | null;\n retry: () => void;\n};\n\nfunction mapMsg(\n data: DocumentData & { id: string },\n threadId: string,\n messageMeta: ChatCoreConfig['messageMeta'],\n): ChatMessageV1 {\n const d = data as any;\n\n const createdAt = toMillis(d.createdAt);\n\n if (!createdAt) {\n console.error('[useChatMessages] Message missing valid createdAt:', data.id, d.createdAt);\n }\n\n const appMeta = messageMeta?.(data);\n return {\n messageId: data.id,\n threadId,\n createdAt: createdAt || 0,\n senderId: d.senderId,\n text: d.text ?? '',\n type: d.type,\n isSystemMessage: d.isSystemMessage ?? undefined,\n referencedUids: Array.isArray(d.referencedUids) ? d.referencedUids : undefined,\n hidden: d.hidden ?? undefined,\n meta: appMeta ? { ...d.meta, ...appMeta } : d.meta,\n };\n}\n\nexport function useChatMessages(config: ChatCoreConfig): UseChatMessagesResult {\n const {\n chatCollectionPath,\n messagesSubcollection = 'messages',\n threadId,\n pageSize: requestedPageSize = 20,\n currentUserId,\n allowed,\n createdAtField = 'createdAt',\n messageMeta,\n } = config;\n\n const pageSize = Math.min(requestedPageSize, MAX_PAGE_SIZE);\n\n if (requestedPageSize > MAX_PAGE_SIZE) {\n console.warn(\n `[useChatMessages] Requested pageSize ${requestedPageSize} exceeds maximum ${MAX_PAGE_SIZE}. Using ${MAX_PAGE_SIZE}.`,\n );\n }\n\n const pathKey = React.useMemo(\n () =>\n JSON.stringify(Array.isArray(chatCollectionPath) ? chatCollectionPath : [chatCollectionPath]),\n [chatCollectionPath],\n );\n\n const collectionPath = React.useMemo(\n () => messagesColPath(chatCollectionPath, threadId, messagesSubcollection).join('/'),\n [chatCollectionPath, threadId, messagesSubcollection],\n );\n\n const {\n items,\n isInitialLoading,\n fetchOlder,\n hasOlder,\n isFetchingOlder,\n sourceState,\n error,\n olderError,\n retry,\n } = useFirestoreLiveInfinite<ChatMessageV1>({\n collectionPath,\n queryKey: [\n 'chat-core',\n 'messages',\n pathKey,\n threadId,\n messagesSubcollection,\n pageSize,\n currentUserId,\n ],\n orderByField: createdAtField,\n pageSize,\n enabled: allowed,\n sort: 'asc',\n select: (data) => mapMsg(data, threadId, messageMeta),\n });\n\n const messages = React.useMemo(() => (allowed ? items : []), [allowed, items]);\n\n const resolverCtx = useOptionalChatNameResolver();\n const senderIds = React.useMemo(() => {\n const set = new Set<string>();\n for (const m of messages) {\n set.add(m.senderId);\n for (const uid of m.referencedUids ?? []) set.add(uid);\n }\n return Array.from(set);\n }, [messages]);\n\n React.useEffect(() => {\n if (resolverCtx?.prewarm && senderIds.length > 0) {\n resolverCtx.prewarm(senderIds);\n }\n }, [resolverCtx, senderIds]);\n\n return {\n allowed,\n isInitialLoading: allowed ? isInitialLoading : false,\n messages,\n fetchOlder,\n hasOlder,\n isFetchingOlder,\n sourceState,\n error: allowed ? error : null,\n olderError: allowed ? olderError : null,\n retry,\n };\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,33 @@
|
|
|
1
|
-
export type { ChatCoreConfig, ChatTransportMode, ChatRealtimeTransportConfig, MessageRenderer, MessageRendererRegistry, } from
|
|
2
|
-
export type { ChatNameResolverProviderProps, UnresolvedChatName, } from
|
|
3
|
-
export { ChatNameResolverProvider, useChatNameResolver, useOptionalChatNameResolver, useSenderNameResolution, } from
|
|
4
|
-
export { SenderName } from
|
|
5
|
-
export type { UseChatMessagesResult } from
|
|
6
|
-
export { useChatMessages } from
|
|
7
|
-
export { createRealtimeChatClient, createInboxClient
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export {
|
|
15
|
-
export type {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
1
|
+
export type { ChatCoreConfig, ChatTransportMode, ChatRealtimeTransportConfig, MessageRenderer, MessageRendererRegistry, } from './types.js';
|
|
2
|
+
export type { ChatNameResolverProviderProps, UnresolvedChatName, } from './context/ChatNameResolverContext.js';
|
|
3
|
+
export { ChatNameResolverProvider, useChatNameResolver, useOptionalChatNameResolver, useSenderNameResolution, } from './context/ChatNameResolverContext.js';
|
|
4
|
+
export { SenderName } from './ui/SenderName.js';
|
|
5
|
+
export type { UseChatMessagesResult } from './hooks/useChatMessages.js';
|
|
6
|
+
export { useChatMessages } from './hooks/useChatMessages.js';
|
|
7
|
+
export { createRealtimeChatClient, createInboxClient } from './realtime/transport.js';
|
|
8
|
+
export { ChannelClient } from './realtime/channel-client.js';
|
|
9
|
+
export { InboxClient } from './realtime/inbox-client.js';
|
|
10
|
+
export { useRealtimeChatMessages } from './realtime/useRealtimeChatMessages.js';
|
|
11
|
+
export { browserSocketFactory } from './realtime/socket.js';
|
|
12
|
+
export { ChatAccessDeniedError, isChatAccessDeniedError, CHAT_INITIAL_LOAD_FAILURE_BUDGET_MS, } from './realtime/shared.js';
|
|
13
|
+
export { buildFrame, parseFrame } from './realtime/wire.js';
|
|
14
|
+
export { CHAT_CLIENT_DIAGNOSTIC_EVENTS } from './realtime/diagnostics.js';
|
|
15
|
+
export type { RealtimeChatClient, RealtimeTransportConfig } from './realtime/transport.js';
|
|
16
|
+
export type { ChatClientDiagnosticsOption, ChatClientDiagnosticsSink, ChatClientDiagnosticEventName, } from './realtime/diagnostics.js';
|
|
17
|
+
export type { ChannelClientState, ChannelClientConfig } from './realtime/channel-client.js';
|
|
18
|
+
export type { InboxClientState, InboxClientConfig, ChatMarkReadOutcome, } from './realtime/inbox-client.js';
|
|
19
|
+
export type { UseRealtimeChatMessagesResult } from './realtime/useRealtimeChatMessages.js';
|
|
20
|
+
export type { GrantProvider, TransportTimers, RealtimeStatus } from './realtime/shared.js';
|
|
21
|
+
export type { RealtimeSocket, SocketFactory, SocketHandlers } from './realtime/socket.js';
|
|
22
|
+
export type { WireMessageRow, WireInboxSnapshot, WireRegistryEntry, ServerFrame, } from './realtime/wire.js';
|
|
23
|
+
export type { ChatShellProps, ChatLoadFailure } from './ui/ChatShell.js';
|
|
24
|
+
export { ChatShell } from './ui/ChatShell.js';
|
|
25
|
+
export { MessageList } from './ui/MessageList.js';
|
|
26
|
+
export type { ChatScrollContainerProps } from './ui/MessageList.js';
|
|
27
|
+
export type { ComposerProps } from './ui/Composer.js';
|
|
28
|
+
export { Composer } from './ui/Composer.js';
|
|
29
|
+
export type { MessageItemDefaultProps } from './ui/MessageItemDefault.js';
|
|
30
|
+
export { MessageItemDefault } from './ui/MessageItemDefault.js';
|
|
31
|
+
export { MessageActions, ThreadActions } from './ui/menus.js';
|
|
32
|
+
export { MessageText, type MessageTextProps } from './ui/MessageText.js';
|
|
19
33
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,2BAA2B,EAC3B,eAAe,EACf,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,6BAA6B,EAC7B,kBAAkB,GACnB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4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AAC5C,YAAY,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
export { ChatNameResolverProvider, useChatNameResolver, useOptionalChatNameResolver, useSenderNameResolution, } from
|
|
3
|
-
export { SenderName } from
|
|
4
|
-
export { useChatMessages } from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
1
|
+
'use client';
|
|
2
|
+
export { ChatNameResolverProvider, useChatNameResolver, useOptionalChatNameResolver, useSenderNameResolution, } from './context/ChatNameResolverContext.js';
|
|
3
|
+
export { SenderName } from './ui/SenderName.js';
|
|
4
|
+
export { useChatMessages } from './hooks/useChatMessages.js';
|
|
5
|
+
export { createRealtimeChatClient, createInboxClient } from './realtime/transport.js';
|
|
6
|
+
export { ChannelClient } from './realtime/channel-client.js';
|
|
7
|
+
export { InboxClient } from './realtime/inbox-client.js';
|
|
8
|
+
export { useRealtimeChatMessages } from './realtime/useRealtimeChatMessages.js';
|
|
9
|
+
export { browserSocketFactory } from './realtime/socket.js';
|
|
10
|
+
export { ChatAccessDeniedError, isChatAccessDeniedError, CHAT_INITIAL_LOAD_FAILURE_BUDGET_MS, } from './realtime/shared.js';
|
|
11
|
+
export { buildFrame, parseFrame } from './realtime/wire.js';
|
|
12
|
+
export { CHAT_CLIENT_DIAGNOSTIC_EVENTS } from './realtime/diagnostics.js';
|
|
13
|
+
export { ChatShell } from './ui/ChatShell.js';
|
|
14
|
+
export { MessageList } from './ui/MessageList.js';
|
|
15
|
+
export { Composer } from './ui/Composer.js';
|
|
16
|
+
export { MessageItemDefault } from './ui/MessageItemDefault.js';
|
|
17
|
+
export { MessageActions, ThreadActions } from './ui/menus.js';
|
|
18
|
+
export { MessageText } from './ui/MessageText.js';
|
|
15
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAcb,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,mCAAmC,GACpC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAwB1E,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAyB,MAAM,qBAAqB,CAAC","sourcesContent":["'use client';\n\nexport type {\n ChatCoreConfig,\n ChatTransportMode,\n ChatRealtimeTransportConfig,\n MessageRenderer,\n MessageRendererRegistry,\n} from './types.js';\n\nexport type {\n ChatNameResolverProviderProps,\n UnresolvedChatName,\n} from './context/ChatNameResolverContext.js';\nexport {\n ChatNameResolverProvider,\n useChatNameResolver,\n useOptionalChatNameResolver,\n useSenderNameResolution,\n} from './context/ChatNameResolverContext.js';\nexport { SenderName } from './ui/SenderName.js';\n\nexport type { UseChatMessagesResult } from './hooks/useChatMessages.js';\nexport { useChatMessages } from './hooks/useChatMessages.js';\n\nexport { createRealtimeChatClient, createInboxClient } from './realtime/transport.js';\nexport { ChannelClient } from './realtime/channel-client.js';\nexport { InboxClient } from './realtime/inbox-client.js';\nexport { useRealtimeChatMessages } from './realtime/useRealtimeChatMessages.js';\nexport { browserSocketFactory } from './realtime/socket.js';\nexport {\n ChatAccessDeniedError,\n isChatAccessDeniedError,\n CHAT_INITIAL_LOAD_FAILURE_BUDGET_MS,\n} from './realtime/shared.js';\nexport { buildFrame, parseFrame } from './realtime/wire.js';\nexport { CHAT_CLIENT_DIAGNOSTIC_EVENTS } from './realtime/diagnostics.js';\nexport type { RealtimeChatClient, RealtimeTransportConfig } from './realtime/transport.js';\nexport type {\n ChatClientDiagnosticsOption,\n ChatClientDiagnosticsSink,\n ChatClientDiagnosticEventName,\n} from './realtime/diagnostics.js';\nexport type { ChannelClientState, ChannelClientConfig } from './realtime/channel-client.js';\nexport type {\n InboxClientState,\n InboxClientConfig,\n ChatMarkReadOutcome,\n} from './realtime/inbox-client.js';\nexport type { UseRealtimeChatMessagesResult } from './realtime/useRealtimeChatMessages.js';\nexport type { GrantProvider, TransportTimers, RealtimeStatus } from './realtime/shared.js';\nexport type { RealtimeSocket, SocketFactory, SocketHandlers } from './realtime/socket.js';\nexport type {\n WireMessageRow,\n WireInboxSnapshot,\n WireRegistryEntry,\n ServerFrame,\n} from './realtime/wire.js';\n\nexport type { ChatShellProps, ChatLoadFailure } from './ui/ChatShell.js';\nexport { ChatShell } from './ui/ChatShell.js';\nexport { MessageList } from './ui/MessageList.js';\nexport type { ChatScrollContainerProps } from './ui/MessageList.js';\nexport type { ComposerProps } from './ui/Composer.js';\nexport { Composer } from './ui/Composer.js';\nexport type { MessageItemDefaultProps } from './ui/MessageItemDefault.js';\nexport { MessageItemDefault } from './ui/MessageItemDefault.js';\nexport { MessageActions, ThreadActions } from './ui/menus.js';\nexport { MessageText, type MessageTextProps } from './ui/MessageText.js';\n"]}
|