@dialtribe/chat-client 0.2.0 → 0.4.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/README.md +25 -7
- package/dist/index.d.mts +68 -5
- package/dist/index.d.ts +68 -5
- package/dist/index.js +399 -108
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +399 -108
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,10 +72,12 @@ Mount the provider only while someone is signed in, keyed by their user id.
|
|
|
72
72
|
Signing out or switching accounts then drops the old connection, inbox and
|
|
73
73
|
token rather than showing one user's messages to the next.
|
|
74
74
|
|
|
75
|
-
- **Desktop:** a rail pinned to the right edge (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
- **Desktop:** a rail pinned to the right edge (or the left, with `side="left"`)
|
|
76
|
+
holding the inbox, your contexts, recent DMs and unread badges, with a panel
|
|
77
|
+
that opens beside it. `placement="push"` pads the page so nothing is covered;
|
|
78
|
+
`"overlay"` floats over it. For your own fixed-position elements the root
|
|
79
|
+
element exposes `--dtc-messages-inset` (the width), plus
|
|
80
|
+
`--dtc-messages-side` and `data-dtc-messages-side` (`left` or `right`).
|
|
79
81
|
- **Mobile:** a floating button with a total badge. Tap it, or swipe in from the
|
|
80
82
|
right edge, to open; swipe right or press Escape to close.
|
|
81
83
|
|
|
@@ -97,12 +99,15 @@ function MessageButton({ user }: { user: { id: string; name: string } }) {
|
|
|
97
99
|
|
|
98
100
|
| Prop | Default | |
|
|
99
101
|
|------|---------|--|
|
|
102
|
+
| `side` | `"right"` | Which screen edge the rail docks to: `"left"` or `"right"` |
|
|
100
103
|
| `placement` | `"push"` | `"push"` or `"overlay"` (desktop) |
|
|
101
104
|
| `openPlacement` | `"push"` | With `placement="push"`: whether the open panel also pushes (`"push"`) or overlays (`"overlay"`). The collapsed rail always pushes |
|
|
102
105
|
| `items` | `[]` | Your own rail entries with your own panels (`RailItem[]`, see below) |
|
|
106
|
+
| `inboxRowClose` | `true` | An X on inbox conversations that removes them from the user's inbox (see `hideDM`) |
|
|
103
107
|
| `contexts` | `[]` | Extra rail entries, e.g. live shows: `{ roomId, label, avatarUrl?, badge? }` |
|
|
104
108
|
| `theme` | | `{ accent, background, surface, text, textMuted, border }` |
|
|
105
109
|
| `labels` | English | Override any string (`MessagesLabels`) to localize |
|
|
110
|
+
| `confirm` | built-in dialog | `(options) => Promise<boolean>`: show the mute and archive confirmations in your own modal (`ConfirmOptions`: `title`, `body`, `confirmLabel`, `cancelLabel`) |
|
|
106
111
|
| `panelWidth` | `380` | Desktop panel width in px |
|
|
107
112
|
| `railDmLimit` | `5` | Recent DMs shown as rail icons |
|
|
108
113
|
| `mobileBreakpoint` | `768` | Below this width the rail becomes the floating button |
|
|
@@ -117,7 +122,8 @@ Use the rail as your app's general-purpose rail: each item is your trigger
|
|
|
117
122
|
<DialtribeMessages
|
|
118
123
|
items={[{
|
|
119
124
|
id: "account",
|
|
120
|
-
placement: "
|
|
125
|
+
placement: "footer", // "top" (default) above the inbox, "bottom" below the DMs,
|
|
126
|
+
// "footer" pinned to the bottom edge (doesn't scroll)
|
|
121
127
|
label: "Account",
|
|
122
128
|
trigger: ({ active }) => <ProfileAvatar active={active} />,
|
|
123
129
|
panel: ({ close }) => <AccountMenu onDone={close} />,
|
|
@@ -145,14 +151,26 @@ const {
|
|
|
145
151
|
rooms, // every DM, newest first (DmRoomSummary[])
|
|
146
152
|
requests, // incoming requests not yet answered
|
|
147
153
|
totalUnread, // across unmuted, accepted DMs
|
|
148
|
-
requestDM, acceptDM, ignoreDM, closeDM, reopenDM,
|
|
149
|
-
addParticipant, setMuted, markRead, setVisible, refresh,
|
|
154
|
+
requestDM, acceptDM, ignoreDM, closeDM, reopenDM, hideDM,
|
|
155
|
+
addParticipant, setMuted, setArchived, markRead, setVisible, refresh,
|
|
150
156
|
} = useChatRooms();
|
|
151
157
|
```
|
|
152
158
|
|
|
153
159
|
A request id is the DM's room id. Ignoring is silent: the requester keeps
|
|
154
160
|
seeing "Request sent". Adding someone to a 1:1 starts a new group conversation.
|
|
155
161
|
|
|
162
|
+
`hideDM(roomId)` removes a conversation from this user's inbox only. Nothing is
|
|
163
|
+
deleted and the other person sees no change; it comes back when a newer message
|
|
164
|
+
arrives or when the user messages or reopens it. `closeDM` is different: it
|
|
165
|
+
closes the conversation for everyone and makes it read-only.
|
|
166
|
+
|
|
167
|
+
`setArchived(roomId, true)` archives a conversation for this user only: it
|
|
168
|
+
leaves their rail, stays in their inbox under Archived (`isArchived` on each
|
|
169
|
+
room), and its unread still counts toward `totalUnread`. New messages don't
|
|
170
|
+
unarchive it. In `<DialtribeMessages>` each conversation's menu (the kebab
|
|
171
|
+
next to the close X) offers Mute notifications and Archive conversation, each
|
|
172
|
+
behind a confirmation.
|
|
173
|
+
|
|
156
174
|
### `useDialtribeChat({ roomId })`
|
|
157
175
|
|
|
158
176
|
One room (a DM or a show room): `messages`, `config`, `typingUsers`, `status`,
|
package/dist/index.d.mts
CHANGED
|
@@ -104,6 +104,11 @@ interface DmRoomSummary {
|
|
|
104
104
|
/** "pending" means this is an incoming request the user hasn't answered. */
|
|
105
105
|
myStatus: DmMemberStatus;
|
|
106
106
|
isMuted: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Archived by the signed-in user: off their rail, kept in their inbox under
|
|
109
|
+
* Archived, unread still counted. Private to them. Absent on older servers.
|
|
110
|
+
*/
|
|
111
|
+
isArchived?: boolean;
|
|
107
112
|
/** Everyone except the signed-in user. */
|
|
108
113
|
participants: DmParticipant[];
|
|
109
114
|
lastMessageAt: string | null;
|
|
@@ -275,6 +280,12 @@ declare class InboxStore extends Store<InboxSnapshot> {
|
|
|
275
280
|
private readTimers;
|
|
276
281
|
/** Rooms currently on screen: activity there is read, not unread. */
|
|
277
282
|
private visible;
|
|
283
|
+
/**
|
|
284
|
+
* Rooms the user removed (hide/ignore) and when. Filtered out of every list,
|
|
285
|
+
* so a refresh already in flight can't put them back, until a newer message
|
|
286
|
+
* arrives or the user messages/reopens/accepts them.
|
|
287
|
+
*/
|
|
288
|
+
private removed;
|
|
278
289
|
constructor(client: ChatClient);
|
|
279
290
|
acquire(): void;
|
|
280
291
|
release(): void;
|
|
@@ -292,7 +303,18 @@ declare class InboxStore extends Store<InboxSnapshot> {
|
|
|
292
303
|
name?: string;
|
|
293
304
|
avatarUrl?: string;
|
|
294
305
|
}): Promise<string>;
|
|
306
|
+
/**
|
|
307
|
+
* Remove a conversation from the user's own inbox (optimistic). Not deleted
|
|
308
|
+
* and nobody else is affected: it comes back when a newer message arrives or
|
|
309
|
+
* when the user messages/reopens it.
|
|
310
|
+
*/
|
|
311
|
+
hideDM(roomId: string): Promise<void>;
|
|
295
312
|
setMuted(roomId: string, muted: boolean): Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Archive or unarchive for the signed-in user only (optimistic). The room
|
|
315
|
+
* leaves the rail but stays in the inbox; new messages don't unarchive it.
|
|
316
|
+
*/
|
|
317
|
+
setArchived(roomId: string, archived: boolean): Promise<void>;
|
|
296
318
|
/** Mark a room read now (optimistic). */
|
|
297
319
|
markRead(roomId: string): Promise<void>;
|
|
298
320
|
/**
|
|
@@ -513,7 +535,7 @@ declare function ChatRoomProvider({ roomId, children }: ChatRoomProviderProps):
|
|
|
513
535
|
/** The room from the nearest <ChatRoomProvider>. */
|
|
514
536
|
declare function useChatRoomContext(): UseDialtribeChatReturn;
|
|
515
537
|
|
|
516
|
-
type UseChatRoomsReturn = InboxSnapshot & Pick<InboxStore, "requestDM" | "acceptDM" | "ignoreDM" | "closeDM" | "reopenDM" | "addParticipant" | "setMuted" | "markRead" | "setVisible" | "refresh">;
|
|
538
|
+
type UseChatRoomsReturn = InboxSnapshot & Pick<InboxStore, "requestDM" | "acceptDM" | "ignoreDM" | "closeDM" | "reopenDM" | "hideDM" | "addParticipant" | "setMuted" | "setArchived" | "markRead" | "setVisible" | "refresh">;
|
|
517
539
|
/**
|
|
518
540
|
* The signed-in user's DMs: inbox (newest first), incoming requests, unread
|
|
519
541
|
* totals, and every DM action. Live via the personal channel; reconciled with
|
|
@@ -577,14 +599,42 @@ interface MessagesLabels {
|
|
|
577
599
|
waitingForReply: string;
|
|
578
600
|
conversationClosed: string;
|
|
579
601
|
reopen: string;
|
|
602
|
+
/** @deprecated No longer shown. Conversations are archived instead of closed. */
|
|
580
603
|
closeConversation: string;
|
|
604
|
+
/** Inbox row X: remove from the inbox (comes back on a new message). */
|
|
605
|
+
removeConversation: string;
|
|
606
|
+
/** Conversation menu: mute / unmute notifications. */
|
|
581
607
|
mute: string;
|
|
582
608
|
unmute: string;
|
|
609
|
+
/** Conversation menu: archive / unarchive (private to the user). */
|
|
610
|
+
archive: string;
|
|
611
|
+
unarchive: string;
|
|
612
|
+
/** Inbox section for archived conversations. */
|
|
613
|
+
archived: string;
|
|
614
|
+
/** Accessible name for the conversation's kebab menu button. */
|
|
615
|
+
moreOptions: string;
|
|
616
|
+
muteConfirmTitle: (name: string) => string;
|
|
617
|
+
muteConfirmBody: string;
|
|
618
|
+
muteConfirm: string;
|
|
619
|
+
archiveConfirmTitle: (name: string) => string;
|
|
620
|
+
archiveConfirmBody: string;
|
|
621
|
+
archiveConfirm: string;
|
|
622
|
+
cancel: string;
|
|
583
623
|
messagePlaceholder: string;
|
|
584
624
|
openMessages: string;
|
|
585
625
|
}
|
|
586
626
|
declare const DEFAULT_LABELS: MessagesLabels;
|
|
587
627
|
|
|
628
|
+
/** What a confirmation asks. Hosts render it in their own modal via the `confirm` prop. */
|
|
629
|
+
interface ConfirmOptions {
|
|
630
|
+
title: string;
|
|
631
|
+
body?: string;
|
|
632
|
+
confirmLabel: string;
|
|
633
|
+
cancelLabel: string;
|
|
634
|
+
}
|
|
635
|
+
/** Resolves true when the user confirms. */
|
|
636
|
+
type ConfirmFn = (options: ConfirmOptions) => Promise<boolean>;
|
|
637
|
+
|
|
588
638
|
/** A host-provided rail entry (e.g. a live show the user is watching). */
|
|
589
639
|
interface MessagesContext {
|
|
590
640
|
roomId: string;
|
|
@@ -607,8 +657,12 @@ interface RailItem {
|
|
|
607
657
|
panel: React.ReactNode | ((state: {
|
|
608
658
|
close: () => void;
|
|
609
659
|
}) => React.ReactNode);
|
|
610
|
-
/**
|
|
611
|
-
|
|
660
|
+
/**
|
|
661
|
+
* "top" (default) sits above the inbox button; "bottom" below the DMs (both
|
|
662
|
+
* scroll with the rail); "footer" is pinned to the bottom edge and never
|
|
663
|
+
* scrolls, e.g. the signed-in user's avatar opening a profile menu.
|
|
664
|
+
*/
|
|
665
|
+
placement?: "top" | "bottom" | "footer";
|
|
612
666
|
/** Count bubble on the trigger. */
|
|
613
667
|
badge?: number;
|
|
614
668
|
/** aria-label and tooltip. */
|
|
@@ -623,6 +677,8 @@ interface MessagesTheme {
|
|
|
623
677
|
border?: string;
|
|
624
678
|
}
|
|
625
679
|
interface DialtribeMessagesProps {
|
|
680
|
+
/** Which screen edge the rail docks to. */
|
|
681
|
+
side?: "left" | "right";
|
|
626
682
|
/** Desktop: "push" reserves room for the rail on the page; "overlay" floats over it. */
|
|
627
683
|
placement?: "push" | "overlay";
|
|
628
684
|
/**
|
|
@@ -632,6 +688,8 @@ interface DialtribeMessagesProps {
|
|
|
632
688
|
openPlacement?: "push" | "overlay";
|
|
633
689
|
/** Your own rail entries (e.g. an account menu), above or below the DMs. */
|
|
634
690
|
items?: RailItem[];
|
|
691
|
+
/** Show a close (X) on inbox conversations that removes them from the inbox. */
|
|
692
|
+
inboxRowClose?: boolean;
|
|
635
693
|
/** Extra rail entries above the DMs, e.g. live shows (room chats). */
|
|
636
694
|
contexts?: MessagesContext[];
|
|
637
695
|
theme?: MessagesTheme;
|
|
@@ -642,6 +700,11 @@ interface DialtribeMessagesProps {
|
|
|
642
700
|
railDmLimit?: number;
|
|
643
701
|
/** Below this width (px) the rail collapses to a floating button + drawer. */
|
|
644
702
|
mobileBreakpoint?: number;
|
|
703
|
+
/**
|
|
704
|
+
* Show confirmations (mute, archive) in your app's own modal. Resolve true to
|
|
705
|
+
* proceed. Without it, a built-in dialog inside the panel is used.
|
|
706
|
+
*/
|
|
707
|
+
confirm?: ConfirmFn;
|
|
645
708
|
}
|
|
646
709
|
/**
|
|
647
710
|
* Drop-in messages rail: inbox, DM requests, conversations, and any host
|
|
@@ -658,7 +721,7 @@ interface DialtribeMessagesProps {
|
|
|
658
721
|
* </DialtribeChatProvider>
|
|
659
722
|
* ```
|
|
660
723
|
*/
|
|
661
|
-
declare function DialtribeMessages({ placement, openPlacement, items, contexts, theme, labels: labelOverrides, panelWidth, railDmLimit, mobileBreakpoint, }: DialtribeMessagesProps): react.JSX.Element;
|
|
724
|
+
declare function DialtribeMessages({ side, placement, openPlacement, items, inboxRowClose, contexts, theme, labels: labelOverrides, panelWidth, railDmLimit, mobileBreakpoint, confirm: hostConfirm, }: DialtribeMessagesProps): react.JSX.Element;
|
|
662
725
|
|
|
663
726
|
interface AvatarProps {
|
|
664
727
|
name: string;
|
|
@@ -737,4 +800,4 @@ interface ChatInputProps {
|
|
|
737
800
|
*/
|
|
738
801
|
declare function ChatInput({ onSendMessage, onSendTyping, replyTo, onClearReply, disabled, placeholder, maxLength, }: ChatInputProps): react.JSX.Element;
|
|
739
802
|
|
|
740
|
-
export { Avatar, type AvatarProps, ChatClient, type ChatClientOptions, type ChatErrorCode, ChatInput, type ChatInputProps, type ChatMessage, ChatMessageItem, type ChatMessageItemProps, ChatPanel, type ChatPanelProps, ChatRequestError, type ChatRoomConfig, ChatRoomProvider, type ChatRoomProviderProps, type ChatSelf, type ConnectionSnapshot, type ConnectionState, DEFAULT_LABELS, DialtribeChatProvider, type DialtribeChatProviderProps, DialtribeMessages, type DialtribeMessagesProps, type DmMemberStatus, type DmParticipant, type DmRequestResult, type DmRoomSummary, type Flair, type InboxSnapshot, type MessagesContext, type MessagesLabels, type MessagesTheme, type MessagesUiSnapshot, type MessagesView, type ParsedReactions, type RailItem, type RichMediaConfig, type RoomEvent, type RoomInit, type RoomSnapshot, type RoomState, type TypingUser, type UseChatRoomsReturn, type UseDialtribeChatOptions, type UseDialtribeChatReturn, type UseDialtribeMessagesReturn, type UserEvent, parseReactions, useChatClient, useChatConnection, useChatRoomContext, useChatRooms, useDialtribeChat, useDialtribeMessages };
|
|
803
|
+
export { Avatar, type AvatarProps, ChatClient, type ChatClientOptions, type ChatErrorCode, ChatInput, type ChatInputProps, type ChatMessage, ChatMessageItem, type ChatMessageItemProps, ChatPanel, type ChatPanelProps, ChatRequestError, type ChatRoomConfig, ChatRoomProvider, type ChatRoomProviderProps, type ChatSelf, type ConfirmFn, type ConfirmOptions, type ConnectionSnapshot, type ConnectionState, DEFAULT_LABELS, DialtribeChatProvider, type DialtribeChatProviderProps, DialtribeMessages, type DialtribeMessagesProps, type DmMemberStatus, type DmParticipant, type DmRequestResult, type DmRoomSummary, type Flair, type InboxSnapshot, type MessagesContext, type MessagesLabels, type MessagesTheme, type MessagesUiSnapshot, type MessagesView, type ParsedReactions, type RailItem, type RichMediaConfig, type RoomEvent, type RoomInit, type RoomSnapshot, type RoomState, type TypingUser, type UseChatRoomsReturn, type UseDialtribeChatOptions, type UseDialtribeChatReturn, type UseDialtribeMessagesReturn, type UserEvent, parseReactions, useChatClient, useChatConnection, useChatRoomContext, useChatRooms, useDialtribeChat, useDialtribeMessages };
|
package/dist/index.d.ts
CHANGED
|
@@ -104,6 +104,11 @@ interface DmRoomSummary {
|
|
|
104
104
|
/** "pending" means this is an incoming request the user hasn't answered. */
|
|
105
105
|
myStatus: DmMemberStatus;
|
|
106
106
|
isMuted: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Archived by the signed-in user: off their rail, kept in their inbox under
|
|
109
|
+
* Archived, unread still counted. Private to them. Absent on older servers.
|
|
110
|
+
*/
|
|
111
|
+
isArchived?: boolean;
|
|
107
112
|
/** Everyone except the signed-in user. */
|
|
108
113
|
participants: DmParticipant[];
|
|
109
114
|
lastMessageAt: string | null;
|
|
@@ -275,6 +280,12 @@ declare class InboxStore extends Store<InboxSnapshot> {
|
|
|
275
280
|
private readTimers;
|
|
276
281
|
/** Rooms currently on screen: activity there is read, not unread. */
|
|
277
282
|
private visible;
|
|
283
|
+
/**
|
|
284
|
+
* Rooms the user removed (hide/ignore) and when. Filtered out of every list,
|
|
285
|
+
* so a refresh already in flight can't put them back, until a newer message
|
|
286
|
+
* arrives or the user messages/reopens/accepts them.
|
|
287
|
+
*/
|
|
288
|
+
private removed;
|
|
278
289
|
constructor(client: ChatClient);
|
|
279
290
|
acquire(): void;
|
|
280
291
|
release(): void;
|
|
@@ -292,7 +303,18 @@ declare class InboxStore extends Store<InboxSnapshot> {
|
|
|
292
303
|
name?: string;
|
|
293
304
|
avatarUrl?: string;
|
|
294
305
|
}): Promise<string>;
|
|
306
|
+
/**
|
|
307
|
+
* Remove a conversation from the user's own inbox (optimistic). Not deleted
|
|
308
|
+
* and nobody else is affected: it comes back when a newer message arrives or
|
|
309
|
+
* when the user messages/reopens it.
|
|
310
|
+
*/
|
|
311
|
+
hideDM(roomId: string): Promise<void>;
|
|
295
312
|
setMuted(roomId: string, muted: boolean): Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Archive or unarchive for the signed-in user only (optimistic). The room
|
|
315
|
+
* leaves the rail but stays in the inbox; new messages don't unarchive it.
|
|
316
|
+
*/
|
|
317
|
+
setArchived(roomId: string, archived: boolean): Promise<void>;
|
|
296
318
|
/** Mark a room read now (optimistic). */
|
|
297
319
|
markRead(roomId: string): Promise<void>;
|
|
298
320
|
/**
|
|
@@ -513,7 +535,7 @@ declare function ChatRoomProvider({ roomId, children }: ChatRoomProviderProps):
|
|
|
513
535
|
/** The room from the nearest <ChatRoomProvider>. */
|
|
514
536
|
declare function useChatRoomContext(): UseDialtribeChatReturn;
|
|
515
537
|
|
|
516
|
-
type UseChatRoomsReturn = InboxSnapshot & Pick<InboxStore, "requestDM" | "acceptDM" | "ignoreDM" | "closeDM" | "reopenDM" | "addParticipant" | "setMuted" | "markRead" | "setVisible" | "refresh">;
|
|
538
|
+
type UseChatRoomsReturn = InboxSnapshot & Pick<InboxStore, "requestDM" | "acceptDM" | "ignoreDM" | "closeDM" | "reopenDM" | "hideDM" | "addParticipant" | "setMuted" | "setArchived" | "markRead" | "setVisible" | "refresh">;
|
|
517
539
|
/**
|
|
518
540
|
* The signed-in user's DMs: inbox (newest first), incoming requests, unread
|
|
519
541
|
* totals, and every DM action. Live via the personal channel; reconciled with
|
|
@@ -577,14 +599,42 @@ interface MessagesLabels {
|
|
|
577
599
|
waitingForReply: string;
|
|
578
600
|
conversationClosed: string;
|
|
579
601
|
reopen: string;
|
|
602
|
+
/** @deprecated No longer shown. Conversations are archived instead of closed. */
|
|
580
603
|
closeConversation: string;
|
|
604
|
+
/** Inbox row X: remove from the inbox (comes back on a new message). */
|
|
605
|
+
removeConversation: string;
|
|
606
|
+
/** Conversation menu: mute / unmute notifications. */
|
|
581
607
|
mute: string;
|
|
582
608
|
unmute: string;
|
|
609
|
+
/** Conversation menu: archive / unarchive (private to the user). */
|
|
610
|
+
archive: string;
|
|
611
|
+
unarchive: string;
|
|
612
|
+
/** Inbox section for archived conversations. */
|
|
613
|
+
archived: string;
|
|
614
|
+
/** Accessible name for the conversation's kebab menu button. */
|
|
615
|
+
moreOptions: string;
|
|
616
|
+
muteConfirmTitle: (name: string) => string;
|
|
617
|
+
muteConfirmBody: string;
|
|
618
|
+
muteConfirm: string;
|
|
619
|
+
archiveConfirmTitle: (name: string) => string;
|
|
620
|
+
archiveConfirmBody: string;
|
|
621
|
+
archiveConfirm: string;
|
|
622
|
+
cancel: string;
|
|
583
623
|
messagePlaceholder: string;
|
|
584
624
|
openMessages: string;
|
|
585
625
|
}
|
|
586
626
|
declare const DEFAULT_LABELS: MessagesLabels;
|
|
587
627
|
|
|
628
|
+
/** What a confirmation asks. Hosts render it in their own modal via the `confirm` prop. */
|
|
629
|
+
interface ConfirmOptions {
|
|
630
|
+
title: string;
|
|
631
|
+
body?: string;
|
|
632
|
+
confirmLabel: string;
|
|
633
|
+
cancelLabel: string;
|
|
634
|
+
}
|
|
635
|
+
/** Resolves true when the user confirms. */
|
|
636
|
+
type ConfirmFn = (options: ConfirmOptions) => Promise<boolean>;
|
|
637
|
+
|
|
588
638
|
/** A host-provided rail entry (e.g. a live show the user is watching). */
|
|
589
639
|
interface MessagesContext {
|
|
590
640
|
roomId: string;
|
|
@@ -607,8 +657,12 @@ interface RailItem {
|
|
|
607
657
|
panel: React.ReactNode | ((state: {
|
|
608
658
|
close: () => void;
|
|
609
659
|
}) => React.ReactNode);
|
|
610
|
-
/**
|
|
611
|
-
|
|
660
|
+
/**
|
|
661
|
+
* "top" (default) sits above the inbox button; "bottom" below the DMs (both
|
|
662
|
+
* scroll with the rail); "footer" is pinned to the bottom edge and never
|
|
663
|
+
* scrolls, e.g. the signed-in user's avatar opening a profile menu.
|
|
664
|
+
*/
|
|
665
|
+
placement?: "top" | "bottom" | "footer";
|
|
612
666
|
/** Count bubble on the trigger. */
|
|
613
667
|
badge?: number;
|
|
614
668
|
/** aria-label and tooltip. */
|
|
@@ -623,6 +677,8 @@ interface MessagesTheme {
|
|
|
623
677
|
border?: string;
|
|
624
678
|
}
|
|
625
679
|
interface DialtribeMessagesProps {
|
|
680
|
+
/** Which screen edge the rail docks to. */
|
|
681
|
+
side?: "left" | "right";
|
|
626
682
|
/** Desktop: "push" reserves room for the rail on the page; "overlay" floats over it. */
|
|
627
683
|
placement?: "push" | "overlay";
|
|
628
684
|
/**
|
|
@@ -632,6 +688,8 @@ interface DialtribeMessagesProps {
|
|
|
632
688
|
openPlacement?: "push" | "overlay";
|
|
633
689
|
/** Your own rail entries (e.g. an account menu), above or below the DMs. */
|
|
634
690
|
items?: RailItem[];
|
|
691
|
+
/** Show a close (X) on inbox conversations that removes them from the inbox. */
|
|
692
|
+
inboxRowClose?: boolean;
|
|
635
693
|
/** Extra rail entries above the DMs, e.g. live shows (room chats). */
|
|
636
694
|
contexts?: MessagesContext[];
|
|
637
695
|
theme?: MessagesTheme;
|
|
@@ -642,6 +700,11 @@ interface DialtribeMessagesProps {
|
|
|
642
700
|
railDmLimit?: number;
|
|
643
701
|
/** Below this width (px) the rail collapses to a floating button + drawer. */
|
|
644
702
|
mobileBreakpoint?: number;
|
|
703
|
+
/**
|
|
704
|
+
* Show confirmations (mute, archive) in your app's own modal. Resolve true to
|
|
705
|
+
* proceed. Without it, a built-in dialog inside the panel is used.
|
|
706
|
+
*/
|
|
707
|
+
confirm?: ConfirmFn;
|
|
645
708
|
}
|
|
646
709
|
/**
|
|
647
710
|
* Drop-in messages rail: inbox, DM requests, conversations, and any host
|
|
@@ -658,7 +721,7 @@ interface DialtribeMessagesProps {
|
|
|
658
721
|
* </DialtribeChatProvider>
|
|
659
722
|
* ```
|
|
660
723
|
*/
|
|
661
|
-
declare function DialtribeMessages({ placement, openPlacement, items, contexts, theme, labels: labelOverrides, panelWidth, railDmLimit, mobileBreakpoint, }: DialtribeMessagesProps): react.JSX.Element;
|
|
724
|
+
declare function DialtribeMessages({ side, placement, openPlacement, items, inboxRowClose, contexts, theme, labels: labelOverrides, panelWidth, railDmLimit, mobileBreakpoint, confirm: hostConfirm, }: DialtribeMessagesProps): react.JSX.Element;
|
|
662
725
|
|
|
663
726
|
interface AvatarProps {
|
|
664
727
|
name: string;
|
|
@@ -737,4 +800,4 @@ interface ChatInputProps {
|
|
|
737
800
|
*/
|
|
738
801
|
declare function ChatInput({ onSendMessage, onSendTyping, replyTo, onClearReply, disabled, placeholder, maxLength, }: ChatInputProps): react.JSX.Element;
|
|
739
802
|
|
|
740
|
-
export { Avatar, type AvatarProps, ChatClient, type ChatClientOptions, type ChatErrorCode, ChatInput, type ChatInputProps, type ChatMessage, ChatMessageItem, type ChatMessageItemProps, ChatPanel, type ChatPanelProps, ChatRequestError, type ChatRoomConfig, ChatRoomProvider, type ChatRoomProviderProps, type ChatSelf, type ConnectionSnapshot, type ConnectionState, DEFAULT_LABELS, DialtribeChatProvider, type DialtribeChatProviderProps, DialtribeMessages, type DialtribeMessagesProps, type DmMemberStatus, type DmParticipant, type DmRequestResult, type DmRoomSummary, type Flair, type InboxSnapshot, type MessagesContext, type MessagesLabels, type MessagesTheme, type MessagesUiSnapshot, type MessagesView, type ParsedReactions, type RailItem, type RichMediaConfig, type RoomEvent, type RoomInit, type RoomSnapshot, type RoomState, type TypingUser, type UseChatRoomsReturn, type UseDialtribeChatOptions, type UseDialtribeChatReturn, type UseDialtribeMessagesReturn, type UserEvent, parseReactions, useChatClient, useChatConnection, useChatRoomContext, useChatRooms, useDialtribeChat, useDialtribeMessages };
|
|
803
|
+
export { Avatar, type AvatarProps, ChatClient, type ChatClientOptions, type ChatErrorCode, ChatInput, type ChatInputProps, type ChatMessage, ChatMessageItem, type ChatMessageItemProps, ChatPanel, type ChatPanelProps, ChatRequestError, type ChatRoomConfig, ChatRoomProvider, type ChatRoomProviderProps, type ChatSelf, type ConfirmFn, type ConfirmOptions, type ConnectionSnapshot, type ConnectionState, DEFAULT_LABELS, DialtribeChatProvider, type DialtribeChatProviderProps, DialtribeMessages, type DialtribeMessagesProps, type DmMemberStatus, type DmParticipant, type DmRequestResult, type DmRoomSummary, type Flair, type InboxSnapshot, type MessagesContext, type MessagesLabels, type MessagesTheme, type MessagesUiSnapshot, type MessagesView, type ParsedReactions, type RailItem, type RichMediaConfig, type RoomEvent, type RoomInit, type RoomSnapshot, type RoomState, type TypingUser, type UseChatRoomsReturn, type UseDialtribeChatOptions, type UseDialtribeChatReturn, type UseDialtribeMessagesReturn, type UserEvent, parseReactions, useChatClient, useChatConnection, useChatRoomContext, useChatRooms, useDialtribeChat, useDialtribeMessages };
|