@poolse/react-native 3.4.0 → 3.6.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/CHANGELOG.md +81 -0
- package/README.md +92 -2
- package/dist/index.cjs +3067 -1021
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +326 -21
- package/dist/index.d.ts +326 -21
- package/dist/index.js +3063 -1024
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { Conversation, Uuid, Message, LiveCall, AttachmentUploadInput, Membership, Attachment } from '@poolse/sdk';
|
|
3
|
+
import { Conversation, Uuid, Message, LiveCall, AttachmentUploadInput, Membership, PresenceState, Attachment, LinkPreview } from '@poolse/sdk';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { GroupPosition } from '@poolse/react';
|
|
6
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
6
7
|
import { ThemeInput, ColorSchemePreference, NativeThemeOptions, NativeTheme } from '@poolse/theme';
|
|
7
8
|
|
|
8
9
|
interface InboxUser {
|
|
@@ -45,6 +46,13 @@ interface PoolseInboxProps {
|
|
|
45
46
|
emptyState?: ReactNode | string;
|
|
46
47
|
/** Forwarded to `<ConversationView>` — set if you have a nav header above. */
|
|
47
48
|
keyboardOffset?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Report this device as `active` / `idle` for presence from
|
|
51
|
+
* `AppState` (see `useAppStatePresence`). Defaults to `true`.
|
|
52
|
+
*/
|
|
53
|
+
trackActivity?: boolean;
|
|
54
|
+
/** Presence badges on direct chats in the list. Defaults to `true`. */
|
|
55
|
+
showPresence?: boolean;
|
|
48
56
|
}
|
|
49
57
|
interface PoolseInboxHandle {
|
|
50
58
|
/** Open a known conversation (e.g. from a deep link / push tap). */
|
|
@@ -183,6 +191,10 @@ interface MessageBubbleProps {
|
|
|
183
191
|
*/
|
|
184
192
|
slots?: MessageSlots;
|
|
185
193
|
slotContext?: MessageSlotContext;
|
|
194
|
+
/** Show `message.link_previews` as cards under the text. Defaults to true. */
|
|
195
|
+
linkPreviews?: boolean;
|
|
196
|
+
/** Makes the "edited" label tappable — `<MessageRow>` opens the edit history. */
|
|
197
|
+
onEditedPress?: () => void;
|
|
186
198
|
}
|
|
187
199
|
/**
|
|
188
200
|
* One message bubble, structured as stacked sections rather than one
|
|
@@ -191,7 +203,7 @@ interface MessageBubbleProps {
|
|
|
191
203
|
* room allows — which is what makes "ok" a one-line bubble instead of
|
|
192
204
|
* a squat rectangle.
|
|
193
205
|
*/
|
|
194
|
-
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, showSenderName, onSenderPress, actionsTrigger, showAttachments, markdown, onLongPress, timeFormat, density, slots, slotContext, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
206
|
+
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, showSenderName, onSenderPress, actionsTrigger, showAttachments, markdown, onLongPress, timeFormat, density, slots, slotContext, linkPreviews, onEditedPress, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
195
207
|
|
|
196
208
|
/** Who sent a message — what `onSenderPress` / `onAvatarPress` receive. */
|
|
197
209
|
interface MessageUser {
|
|
@@ -262,9 +274,39 @@ interface MessageRowProps {
|
|
|
262
274
|
* with an accent bar.
|
|
263
275
|
*/
|
|
264
276
|
mentionsMe?: boolean;
|
|
277
|
+
/** Presence badge on the sender's avatar (needs `showAvatar`). */
|
|
278
|
+
showPresence?: boolean;
|
|
279
|
+
/** Show the message's link previews as cards under the text. Defaults to true. */
|
|
280
|
+
linkPreviews?: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Long-press → "Remove preview" on your own message (one per link).
|
|
283
|
+
* Receives the preview's url — `chat.messages.update(id, { remove_link_previews: [url] })`.
|
|
284
|
+
*/
|
|
285
|
+
onRemoveLinkPreview?: (url: string) => void;
|
|
286
|
+
/** Long-press → "Mark unread" on other people's messages. */
|
|
287
|
+
onMarkUnread?: () => void;
|
|
288
|
+
/** The "edited" label opens the edit history (`chat.messages.edits`). Defaults to true. */
|
|
289
|
+
editHistory?: boolean;
|
|
265
290
|
}
|
|
266
291
|
declare function MessageRow(props: MessageRowProps): react_jsx_runtime.JSX.Element | null;
|
|
267
292
|
|
|
293
|
+
/** What the composer held for a conversation. */
|
|
294
|
+
interface ConversationDraft {
|
|
295
|
+
text: string;
|
|
296
|
+
/** The message being quote-replied to, if any. */
|
|
297
|
+
quote: Message | null;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Where `persistDrafts` keeps drafts between launches — MMKV,
|
|
301
|
+
* AsyncStorage or anything with the same three calls. Values are JSON
|
|
302
|
+
* strings; each call may return a promise.
|
|
303
|
+
*/
|
|
304
|
+
interface DraftStorage {
|
|
305
|
+
get: (key: string) => string | null | undefined | Promise<string | null | undefined>;
|
|
306
|
+
set: (key: string, value: string) => void | Promise<void>;
|
|
307
|
+
remove: (key: string) => void | Promise<void>;
|
|
308
|
+
}
|
|
309
|
+
|
|
268
310
|
interface ConversationViewProps {
|
|
269
311
|
conversationId: Uuid;
|
|
270
312
|
emptyState?: ReactElement | string;
|
|
@@ -401,8 +443,49 @@ interface ConversationViewProps {
|
|
|
401
443
|
* (the viewer is in the room, or ringing out as its caller).
|
|
402
444
|
*/
|
|
403
445
|
currentCallId?: string | null;
|
|
446
|
+
/** Presence badges on message avatars (where avatars show). Defaults to `false`. */
|
|
447
|
+
showPresence?: boolean;
|
|
448
|
+
/**
|
|
449
|
+
* Link previews (`message.link_previews`) as cards under the text,
|
|
450
|
+
* with "Remove preview" in the sender's long-press sheet. Defaults to `true`.
|
|
451
|
+
*/
|
|
452
|
+
linkPreviews?: boolean;
|
|
453
|
+
/**
|
|
454
|
+
* A "New messages" line above the first message that was unread when
|
|
455
|
+
* the conversation opened, and a pill that jumps to it (loading older
|
|
456
|
+
* pages as needed) while it's off screen. Defaults to `true`.
|
|
457
|
+
*/
|
|
458
|
+
newMessagesDivider?: boolean;
|
|
459
|
+
/**
|
|
460
|
+
* Unsent text and the quote target are kept per conversation in
|
|
461
|
+
* memory, across conversation switches, always. With a `draftStorage`
|
|
462
|
+
* they are also written there, so they survive a restart; set
|
|
463
|
+
* `persistDrafts={false}` to keep them in memory only. Defaults to
|
|
464
|
+
* `true` when `draftStorage` is given.
|
|
465
|
+
*/
|
|
466
|
+
persistDrafts?: boolean;
|
|
467
|
+
/**
|
|
468
|
+
* Where drafts persist — `{ get, set, remove }` over string values
|
|
469
|
+
* (MMKV, AsyncStorage, …); each may return a promise. Keys are
|
|
470
|
+
* `poolse:draft:<conversationId>`.
|
|
471
|
+
*/
|
|
472
|
+
draftStorage?: DraftStorage;
|
|
473
|
+
/** An emoji button in the composer. Defaults to `true`. */
|
|
474
|
+
emojiPicker?: boolean;
|
|
475
|
+
/** Largest attachment accepted, in bytes; larger picks show an error. */
|
|
476
|
+
maxFileSize?: number;
|
|
477
|
+
/** Accepted attachment types: MIME types, wildcards (`'image/*'`) or extensions (`'.pdf'`). */
|
|
478
|
+
acceptedFileTypes?: string[];
|
|
479
|
+
/**
|
|
480
|
+
* Long-press → "Mark unread" on other people's messages. Defaults to
|
|
481
|
+
* `true`. The view then stops marking messages read until you send
|
|
482
|
+
* one or reopen the conversation.
|
|
483
|
+
*/
|
|
484
|
+
markUnread?: boolean;
|
|
485
|
+
/** Fires after "Mark unread" succeeded (the unread counts follow over realtime). */
|
|
486
|
+
onMarkedUnread?: (conversationId: string, messageId: string) => void;
|
|
404
487
|
}
|
|
405
|
-
declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, avatarFor, header, onHeaderMembersPress, onHeaderPress, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, senderLabels, avatars, onMarkedRead, onSent, focusMessageId, onFocusMessageNotFound, onSenderPress, onAvatarPress, composer, readOnly, keyboardOffset, onCallBack, onJoinCall, currentCallId, layout, density, showAvatars: showAvatarsProp, timeFormat, groupWindowMinutes, daySeparators, slots, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
|
|
488
|
+
declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, avatarFor, header, onHeaderMembersPress, onHeaderPress, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, senderLabels, avatars, onMarkedRead, onSent, focusMessageId, onFocusMessageNotFound, onSenderPress, onAvatarPress, composer, readOnly, keyboardOffset, onCallBack, onJoinCall, currentCallId, layout, density, showAvatars: showAvatarsProp, timeFormat, groupWindowMinutes, daySeparators, slots, showPresence, linkPreviews, newMessagesDivider, persistDrafts, draftStorage, emojiPicker, maxFileSize, acceptedFileTypes, markUnread, onMarkedUnread, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
|
|
406
489
|
|
|
407
490
|
interface ChatHeaderProps {
|
|
408
491
|
conversationId: Uuid;
|
|
@@ -436,7 +519,8 @@ interface ChatHeaderProps {
|
|
|
436
519
|
}
|
|
437
520
|
/**
|
|
438
521
|
* Top-of-chat header bar.
|
|
439
|
-
* * 1:1 direct → other user's display name + avatar + presence
|
|
522
|
+
* * 1:1 direct → other user's display name + avatar + presence badge,
|
|
523
|
+
* and "Online" / "Away" / "In a call" / "Last seen …" under the name.
|
|
440
524
|
* * Group → conversation name + "N members" + group-tile avatar.
|
|
441
525
|
*
|
|
442
526
|
* Sits above `<MessageList>` inside `<ConversationView>` by default;
|
|
@@ -554,6 +638,23 @@ interface MessageComposerProps {
|
|
|
554
638
|
editingMessage?: Message | null;
|
|
555
639
|
onCancelEdit?: () => void;
|
|
556
640
|
onSaveEdit?: (body: string) => Promise<unknown> | void;
|
|
641
|
+
/**
|
|
642
|
+
* Controlled text. With `value`, the composer shows it and reports
|
|
643
|
+
* keystrokes through `onChangeText` (ConversationView uses this for
|
|
644
|
+
* drafts). Edit mode keeps its own text either way.
|
|
645
|
+
*/
|
|
646
|
+
value?: string;
|
|
647
|
+
/** Every change to the (non-edit) text, typed or programmatic. */
|
|
648
|
+
onChangeText?: (text: string) => void;
|
|
649
|
+
/** The cursor / selection moved. */
|
|
650
|
+
onSelectionChange?: (selection: {
|
|
651
|
+
start: number;
|
|
652
|
+
end: number;
|
|
653
|
+
}) => void;
|
|
654
|
+
/** An emoji button that opens `<EmojiPicker>` and inserts at the cursor. Defaults to true. */
|
|
655
|
+
emojiPicker?: boolean;
|
|
656
|
+
/** Rendered above the input row — e.g. `<MentionInput>`'s suggestions. */
|
|
657
|
+
accessory?: ReactNode;
|
|
557
658
|
}
|
|
558
659
|
/**
|
|
559
660
|
* Imperative handle for parents that want to add files to the
|
|
@@ -565,6 +666,8 @@ interface MessageComposerHandle {
|
|
|
565
666
|
addFiles: (inputs: AttachmentUploadInput[]) => void;
|
|
566
667
|
focus: () => void;
|
|
567
668
|
clear: () => void;
|
|
669
|
+
/** Move the cursor (`start === end`) or select a range. */
|
|
670
|
+
setSelection: (start: number, end: number) => void;
|
|
568
671
|
}
|
|
569
672
|
declare const MessageComposer: react.ForwardRefExoticComponent<MessageComposerProps & react.RefAttributes<MessageComposerHandle>>;
|
|
570
673
|
|
|
@@ -585,6 +688,20 @@ interface MessageActionsProps {
|
|
|
585
688
|
onEdit?: () => void;
|
|
586
689
|
onDelete?: () => void;
|
|
587
690
|
onCopy?: () => void;
|
|
691
|
+
/** "Mark unread" — offered on other people's messages. */
|
|
692
|
+
onMarkUnread?: () => void;
|
|
693
|
+
/**
|
|
694
|
+
* "Remove preview" (one per link when there are several) — offered to
|
|
695
|
+
* the sender. Receives the preview's `url`.
|
|
696
|
+
*/
|
|
697
|
+
onRemovePreview?: (url: string) => void;
|
|
698
|
+
/** The message's link-preview urls, for `onRemovePreview`. */
|
|
699
|
+
previewUrls?: string[];
|
|
700
|
+
/**
|
|
701
|
+
* A "+" after the quick reactions that opens the full emoji picker.
|
|
702
|
+
* Called after the sheet closes.
|
|
703
|
+
*/
|
|
704
|
+
onMoreReactions?: () => void;
|
|
588
705
|
}
|
|
589
706
|
/**
|
|
590
707
|
* Long-press action menu — modal bottom sheet. Renders a row of
|
|
@@ -592,7 +709,7 @@ interface MessageActionsProps {
|
|
|
592
709
|
* action items below. Matches WhatsApp / iMessage's "long-press
|
|
593
710
|
* shows everything inline" pattern.
|
|
594
711
|
*/
|
|
595
|
-
declare function MessageActions({ visible, onClose, isSelf, emojis, onPickReaction, onReply, onReplyInThread, onQuote, onEdit, onDelete, onCopy, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
|
|
712
|
+
declare function MessageActions({ visible, onClose, isSelf, emojis, onPickReaction, onReply, onReplyInThread, onQuote, onEdit, onDelete, onCopy, onMarkUnread, onRemovePreview, previewUrls, onMoreReactions, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
|
|
596
713
|
|
|
597
714
|
/**
|
|
598
715
|
* Either a real message or a day-separator row. ConversationView
|
|
@@ -639,6 +756,11 @@ interface MessageListProps {
|
|
|
639
756
|
*/
|
|
640
757
|
scrollToMessageId?: string | null;
|
|
641
758
|
scrollRequest?: number;
|
|
759
|
+
/**
|
|
760
|
+
* The rows on screen changed: message ids and separator ids. Lets a
|
|
761
|
+
* parent tell whether a row (e.g. the "New messages" line) was seen.
|
|
762
|
+
*/
|
|
763
|
+
onVisibleItemsChange?: (keys: string[]) => void;
|
|
642
764
|
}
|
|
643
765
|
/**
|
|
644
766
|
* Inverted FlatList wrapper for chat history. Newest message at the
|
|
@@ -648,7 +770,7 @@ interface MessageListProps {
|
|
|
648
770
|
* Pagination is owned by `useMessages` (hand it `messages` +
|
|
649
771
|
* `hasMore` + `loadMore`); this component just renders + scrolls.
|
|
650
772
|
*/
|
|
651
|
-
declare function MessageList({ messages, items, loading, hasMore, onLoadMore, renderItem, ListHeader, ListFooter, emptyState, meId, scrollToMessageId, scrollRequest, }: MessageListProps): react_jsx_runtime.JSX.Element;
|
|
773
|
+
declare function MessageList({ messages, items, loading, hasMore, onLoadMore, renderItem, ListHeader, ListFooter, emptyState, meId, scrollToMessageId, scrollRequest, onVisibleItemsChange, }: MessageListProps): react_jsx_runtime.JSX.Element;
|
|
652
774
|
|
|
653
775
|
interface DaySeparatorProps {
|
|
654
776
|
label: string;
|
|
@@ -693,6 +815,10 @@ interface ThreadViewProps {
|
|
|
693
815
|
/** Row layout for the root and replies — see `ChatLayout`. Defaults to `'bubbles'`. */
|
|
694
816
|
layout?: ChatLayout;
|
|
695
817
|
timeFormat?: TimeFormat;
|
|
818
|
+
/** Presence badges on reply avatars. Defaults to `false`. */
|
|
819
|
+
showPresence?: boolean;
|
|
820
|
+
/** Link previews under replies. Defaults to `true`. */
|
|
821
|
+
linkPreviews?: boolean;
|
|
696
822
|
}
|
|
697
823
|
/**
|
|
698
824
|
* Bottom-sheet modal for thread replies. Pull the drag handle / header
|
|
@@ -709,7 +835,51 @@ interface ThreadViewProps {
|
|
|
709
835
|
* sheet top (the gutter), since KAV measures its frame relative to
|
|
710
836
|
* its parent (the sheet), not the screen.
|
|
711
837
|
*/
|
|
712
|
-
declare function ThreadView({ visible, onClose, conversationId, rootMessage, labelFor, avatarFor, layout, timeFormat, }: ThreadViewProps): react_jsx_runtime.JSX.Element;
|
|
838
|
+
declare function ThreadView({ visible, onClose, conversationId, rootMessage, labelFor, avatarFor, layout, timeFormat, showPresence, linkPreviews, }: ThreadViewProps): react_jsx_runtime.JSX.Element;
|
|
839
|
+
|
|
840
|
+
interface ThreadSummaryProps {
|
|
841
|
+
/** The thread's root: `reply_count`, `last_reply_at`, `thread_participants`. */
|
|
842
|
+
message: Pick<Message, 'reply_count' | 'last_reply_at' | 'thread_participants'>;
|
|
843
|
+
onPress: () => void;
|
|
844
|
+
labelFor?: (externalId: string) => string;
|
|
845
|
+
avatarFor?: (externalId: string) => string | null;
|
|
846
|
+
/** Align to the right (under your own bubble). */
|
|
847
|
+
alignEnd?: boolean;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* "3 replies · last reply 5m ago" with the last few repliers' avatars
|
|
851
|
+
* stacked in front. Tap opens the thread. Draws nothing without replies.
|
|
852
|
+
*/
|
|
853
|
+
declare function ThreadSummary({ message, onPress, labelFor, avatarFor, alignEnd, }: ThreadSummaryProps): react_jsx_runtime.JSX.Element | null;
|
|
854
|
+
|
|
855
|
+
interface NewMessagesDividerProps {
|
|
856
|
+
/** Defaults to "New messages". */
|
|
857
|
+
label?: string;
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* The line `<ConversationView>` draws above the first message you
|
|
861
|
+
* hadn't read when the conversation opened. Full width, so it reads the
|
|
862
|
+
* same in every layout.
|
|
863
|
+
*/
|
|
864
|
+
declare function NewMessagesDivider({ label }: NewMessagesDividerProps): react_jsx_runtime.JSX.Element;
|
|
865
|
+
|
|
866
|
+
interface EditHistorySheetProps {
|
|
867
|
+
visible: boolean;
|
|
868
|
+
onClose: () => void;
|
|
869
|
+
messageId: Uuid;
|
|
870
|
+
/** The text the message has now, shown on top as "Current". */
|
|
871
|
+
currentBody?: string | null;
|
|
872
|
+
/**
|
|
873
|
+
* The server refused the history (403 — the workspace keeps it to
|
|
874
|
+
* admins or the sender). The sheet closes itself.
|
|
875
|
+
*/
|
|
876
|
+
onForbidden?: () => void;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Bottom sheet listing a message's earlier versions, newest first
|
|
880
|
+
* (`chat.messages.edits(id)`). Opened from the "edited" label.
|
|
881
|
+
*/
|
|
882
|
+
declare function EditHistorySheet({ visible, onClose, messageId, currentBody, onForbidden, }: EditHistorySheetProps): react_jsx_runtime.JSX.Element;
|
|
713
883
|
|
|
714
884
|
interface UserNameProps {
|
|
715
885
|
/** The user's external_id. Pass null to render the fallback. */
|
|
@@ -732,6 +902,15 @@ declare function UserName({ externalId, fallback, labelFor }: UserNameProps): re
|
|
|
732
902
|
*/
|
|
733
903
|
declare function useDisplayName(externalId: string | null | undefined, labelFor?: (externalId: string) => string): string;
|
|
734
904
|
|
|
905
|
+
/** One section of `<ConversationList sections>`. */
|
|
906
|
+
interface ConversationSection {
|
|
907
|
+
title: string;
|
|
908
|
+
/** Conversations this section holds. Each conversation goes to the first section that takes it. */
|
|
909
|
+
filter: (conversation: Conversation) => boolean;
|
|
910
|
+
}
|
|
911
|
+
/** `<ConversationList groupBy>`: `'type'` → "Channels" (groups), then "Direct messages". */
|
|
912
|
+
type ConversationGroupBy = 'type';
|
|
913
|
+
|
|
735
914
|
interface ConversationListProps {
|
|
736
915
|
selectedId?: string | null;
|
|
737
916
|
onSelect?: (conv: Conversation) => void;
|
|
@@ -743,6 +922,15 @@ interface ConversationListProps {
|
|
|
743
922
|
conversations?: Conversation[];
|
|
744
923
|
loading?: boolean;
|
|
745
924
|
error?: Error | null;
|
|
925
|
+
/**
|
|
926
|
+
* Controlled mode paging: more conversations exist. Uncontrolled, the
|
|
927
|
+
* list pages through `useConversations()` itself.
|
|
928
|
+
*/
|
|
929
|
+
hasMore?: boolean;
|
|
930
|
+
/** Controlled mode paging: a page is loading (a spinner shows at the end). */
|
|
931
|
+
loadingMore?: boolean;
|
|
932
|
+
/** Controlled mode paging: called near the end of the list while `hasMore`. */
|
|
933
|
+
onLoadMore?: () => void;
|
|
746
934
|
/** Per-conversation unread counts rendered as a Pulse Coral pill. */
|
|
747
935
|
unreadCounts?: Record<Uuid, number>;
|
|
748
936
|
/**
|
|
@@ -752,8 +940,22 @@ interface ConversationListProps {
|
|
|
752
940
|
*/
|
|
753
941
|
labelFor?: (externalId: string) => string;
|
|
754
942
|
avatarFor?: (externalId: string) => string | null;
|
|
943
|
+
/** Scrolls with the list, above the first row (a search field, a title). */
|
|
944
|
+
header?: ReactElement | null;
|
|
945
|
+
/**
|
|
946
|
+
* Split the list into titled sections; each conversation goes to the
|
|
947
|
+
* first section whose `filter` takes it, empty sections are hidden.
|
|
948
|
+
* Overrides `groupBy`.
|
|
949
|
+
*/
|
|
950
|
+
sections?: ConversationSection[];
|
|
951
|
+
/** `'type'` → "Channels" (groups), then "Direct messages". */
|
|
952
|
+
groupBy?: ConversationGroupBy;
|
|
953
|
+
/** `'comfortable'` (default) or `'compact'` rows (smaller avatar, one line). */
|
|
954
|
+
density?: ChatDensity;
|
|
955
|
+
/** Presence badges on direct chats' avatars. Defaults to `true`. */
|
|
956
|
+
showPresence?: boolean;
|
|
755
957
|
}
|
|
756
|
-
declare function ConversationList({ selectedId, onSelect, renderItem, emptyState, conversations: controlled, loading: controlledLoading, error: controlledError, unreadCounts, labelFor, avatarFor, }: ConversationListProps): react_jsx_runtime.JSX.Element;
|
|
958
|
+
declare function ConversationList({ selectedId, onSelect, renderItem, emptyState, conversations: controlled, loading: controlledLoading, error: controlledError, hasMore: controlledHasMore, loadingMore: controlledLoadingMore, onLoadMore, unreadCounts, labelFor, avatarFor, header, sections, groupBy, density, showPresence, }: ConversationListProps): react_jsx_runtime.JSX.Element;
|
|
757
959
|
|
|
758
960
|
interface MemberListProps {
|
|
759
961
|
conversationId: Uuid;
|
|
@@ -763,8 +965,32 @@ interface MemberListProps {
|
|
|
763
965
|
canRemove?: (m: Membership) => boolean;
|
|
764
966
|
renderItem?: (m: Membership) => ReactNode;
|
|
765
967
|
emptyState?: ReactNode | string;
|
|
968
|
+
/**
|
|
969
|
+
* Presence badges on the avatars (online / away / in a call / do not
|
|
970
|
+
* disturb, via `useUserPresence`). Defaults to `true`. With
|
|
971
|
+
* `onlineExternalIds` given, those drive a plain online dot instead.
|
|
972
|
+
*/
|
|
973
|
+
showPresence?: boolean;
|
|
766
974
|
}
|
|
767
|
-
declare function MemberList({ conversationId, labelFor, avatarFor, onlineExternalIds, canRemove, renderItem, emptyState, }: MemberListProps): react_jsx_runtime.JSX.Element;
|
|
975
|
+
declare function MemberList({ conversationId, labelFor, avatarFor, onlineExternalIds, canRemove, renderItem, emptyState, showPresence, }: MemberListProps): react_jsx_runtime.JSX.Element;
|
|
976
|
+
|
|
977
|
+
interface PresenceBadgeProps {
|
|
978
|
+
/** `online`, `away`, `in_call` or `offline` (draws nothing), as `useUserPresence` gives it. */
|
|
979
|
+
state: PresenceState | null | undefined;
|
|
980
|
+
/** Do not disturb: a moon instead of the online / away dot. */
|
|
981
|
+
doNotDisturb?: boolean;
|
|
982
|
+
/** Diameter in px. Defaults to 12. */
|
|
983
|
+
size?: number;
|
|
984
|
+
/** The ring around the badge — the colour it sits on. Defaults to `colors.surface`. */
|
|
985
|
+
ringColor?: string;
|
|
986
|
+
style?: StyleProp<ViewStyle>;
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* A presence dot: online = `success`, away = `warning`, in a call =
|
|
990
|
+
* `accent` with a phone, do not disturb = a moon. Offline (or unknown)
|
|
991
|
+
* draws nothing.
|
|
992
|
+
*/
|
|
993
|
+
declare function PresenceBadge({ state, doNotDisturb, size, ringColor, style, }: PresenceBadgeProps): react_jsx_runtime.JSX.Element | null;
|
|
768
994
|
|
|
769
995
|
interface AttachmentPreviewProps {
|
|
770
996
|
attachment: Attachment;
|
|
@@ -781,6 +1007,41 @@ interface AttachmentPreviewProps {
|
|
|
781
1007
|
}
|
|
782
1008
|
declare function AttachmentPreview({ attachment, onPress, maxWidth, tone, }: AttachmentPreviewProps): react_jsx_runtime.JSX.Element;
|
|
783
1009
|
|
|
1010
|
+
interface LinkPreviewCardProps {
|
|
1011
|
+
preview: LinkPreview;
|
|
1012
|
+
/** Shows a × on the card; the long-press sheet's "Remove preview" is the usual way. */
|
|
1013
|
+
onRemove?: () => void;
|
|
1014
|
+
/** Card width cap in px. Defaults to 320. */
|
|
1015
|
+
maxWidth?: number;
|
|
1016
|
+
/** `'onBrand'` for a card inside your own (accent-filled) bubble. */
|
|
1017
|
+
tone?: 'default' | 'onBrand';
|
|
1018
|
+
/** Long-press on the card — rows pass their actions sheet. */
|
|
1019
|
+
onLongPress?: () => void;
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* A link's preview under the message text. `website`: the page's image,
|
|
1023
|
+
* site name with favicon, title and description. `image`: the picture
|
|
1024
|
+
* itself, inline. Tapping opens the link.
|
|
1025
|
+
*/
|
|
1026
|
+
declare function LinkPreviewCard({ preview, onRemove, maxWidth, tone, onLongPress, }: LinkPreviewCardProps): react_jsx_runtime.JSX.Element | null;
|
|
1027
|
+
|
|
1028
|
+
interface EmojiPickerProps {
|
|
1029
|
+
visible: boolean;
|
|
1030
|
+
onClose: () => void;
|
|
1031
|
+
/** An emoji was tapped. The picker closes unless `keepOpen`. */
|
|
1032
|
+
onPick: (emoji: string) => void;
|
|
1033
|
+
/** Stay open after a pick (the composer's picker, to type several). */
|
|
1034
|
+
keepOpen?: boolean;
|
|
1035
|
+
/** Heading. Defaults to "Pick an emoji". */
|
|
1036
|
+
title?: string;
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* Bottom-sheet emoji picker with search, recently used and categories.
|
|
1040
|
+
* Built in and dependency-free: a compact set of common emoji, parsed
|
|
1041
|
+
* the first time a picker opens.
|
|
1042
|
+
*/
|
|
1043
|
+
declare function EmojiPicker({ visible, onClose, onPick, keepOpen, title, }: EmojiPickerProps): react_jsx_runtime.JSX.Element;
|
|
1044
|
+
|
|
784
1045
|
/**
|
|
785
1046
|
* Horizontal scrolling preview row of pending / in-flight / ready
|
|
786
1047
|
* uploads. Image attachments render as 64×64 thumbnails sourced from
|
|
@@ -800,8 +1061,10 @@ interface ReactionStripProps {
|
|
|
800
1061
|
meId: string | null;
|
|
801
1062
|
/** Seed map from a known message (e.g. `useMessages`). */
|
|
802
1063
|
initialReactions?: Record<string, Uuid[]>;
|
|
1064
|
+
/** A "+" chip after the reactions — open an emoji picker (see `<EmojiPicker>`). */
|
|
1065
|
+
onMorePress?: () => void;
|
|
803
1066
|
}
|
|
804
|
-
declare function ReactionStrip({ messageId, conversationId, meId, initialReactions, }: ReactionStripProps): react_jsx_runtime.JSX.Element | null;
|
|
1067
|
+
declare function ReactionStrip({ messageId, conversationId, meId, initialReactions, onMorePress, }: ReactionStripProps): react_jsx_runtime.JSX.Element | null;
|
|
805
1068
|
interface ReactionPickerProps {
|
|
806
1069
|
visible: boolean;
|
|
807
1070
|
onClose: () => void;
|
|
@@ -813,20 +1076,23 @@ declare function ReactionPicker({ visible, onClose, onPick, emojis, }: ReactionP
|
|
|
813
1076
|
|
|
814
1077
|
interface MentionInputProps extends Omit<MessageComposerProps, 'onSend'> {
|
|
815
1078
|
conversationId: Uuid;
|
|
816
|
-
/** Same callback as MessageComposer.onSend, plus
|
|
1079
|
+
/** Same callback as MessageComposer.onSend, plus the mentioned user_ids. */
|
|
817
1080
|
onSend: (body: string, opts?: {
|
|
818
1081
|
quoted_message_id?: Uuid;
|
|
819
1082
|
attachment_ids?: Uuid[];
|
|
820
1083
|
mentions?: Uuid[];
|
|
821
1084
|
}) => Promise<unknown> | void;
|
|
1085
|
+
/** Most suggestions shown at once. Defaults to 6. */
|
|
1086
|
+
maxSuggestions?: number;
|
|
822
1087
|
}
|
|
823
1088
|
/**
|
|
824
|
-
* Composer with
|
|
825
|
-
* conversation members
|
|
826
|
-
*
|
|
827
|
-
*
|
|
1089
|
+
* Composer with @-mentions: typing `@` (at the start or after a space)
|
|
1090
|
+
* shows matching conversation members above the input, filtered by
|
|
1091
|
+
* name or id as you type. Picking one inserts `@Name ` and the send
|
|
1092
|
+
* carries their user id in `mentions` — for as long as `@Name` is
|
|
1093
|
+
* still in the text.
|
|
828
1094
|
*/
|
|
829
|
-
declare function MentionInput({ conversationId, onSend, ...composerProps }: MentionInputProps): react_jsx_runtime.JSX.Element;
|
|
1095
|
+
declare function MentionInput({ conversationId, onSend, maxSuggestions, labelFor, value: valueProp, onChangeText, onSelectionChange, ...composerProps }: MentionInputProps): react_jsx_runtime.JSX.Element;
|
|
830
1096
|
|
|
831
1097
|
interface AttachmentPickerProps {
|
|
832
1098
|
visible: boolean;
|
|
@@ -854,6 +1120,18 @@ interface AttachmentPickerProps {
|
|
|
854
1120
|
* iOS Info.plist when leaving this on.
|
|
855
1121
|
*/
|
|
856
1122
|
camera?: boolean;
|
|
1123
|
+
/** Largest file accepted, in bytes (checked after image compression). */
|
|
1124
|
+
maxFileSize?: number;
|
|
1125
|
+
/** Accepted types: MIME types, wildcards (`'image/*'`) or extensions (`'.pdf'`). */
|
|
1126
|
+
acceptedTypes?: string[];
|
|
1127
|
+
/**
|
|
1128
|
+
* A picked file was refused (too large, a type not accepted) or the
|
|
1129
|
+
* picker failed (e.g. camera permission denied). Receives a sentence
|
|
1130
|
+
* to show; `<ConversationView>` shows it above the composer.
|
|
1131
|
+
*/
|
|
1132
|
+
onError?: (message: string) => void;
|
|
1133
|
+
/** Pick several photos at once from the library. Defaults to true. */
|
|
1134
|
+
multiple?: boolean;
|
|
857
1135
|
}
|
|
858
1136
|
/**
|
|
859
1137
|
* Picker sheet wrapping `expo-image-picker` and `expo-document-picker`.
|
|
@@ -862,7 +1140,7 @@ interface AttachmentPickerProps {
|
|
|
862
1140
|
* declared as optional peers because consumers who pass
|
|
863
1141
|
* `attachments={false}` to ConversationView never render this file.
|
|
864
1142
|
*/
|
|
865
|
-
declare function AttachmentPicker({ visible, onClose, onPickInputs, camera, }: AttachmentPickerProps): react_jsx_runtime.JSX.Element;
|
|
1143
|
+
declare function AttachmentPicker({ visible, onClose, onPickInputs, camera, maxFileSize, acceptedTypes, onError, multiple, }: AttachmentPickerProps): react_jsx_runtime.JSX.Element;
|
|
866
1144
|
|
|
867
1145
|
interface ImageMosaicProps {
|
|
868
1146
|
images: Attachment[];
|
|
@@ -1199,12 +1477,22 @@ interface AvatarProps {
|
|
|
1199
1477
|
name?: string | null;
|
|
1200
1478
|
/** Stable color seed (typically the user's external_id). */
|
|
1201
1479
|
seed?: string | null;
|
|
1202
|
-
/** Show a green presence dot in the bottom-right corner. */
|
|
1480
|
+
/** Show a green presence dot in the bottom-right corner. Superseded by `presence`. */
|
|
1203
1481
|
online?: boolean;
|
|
1482
|
+
/**
|
|
1483
|
+
* A presence badge in the bottom-right corner (see `<PresenceBadge>`):
|
|
1484
|
+
* a state, or `true` to look it up live with `useUserPresence` for
|
|
1485
|
+
* `userId` (else `seed`) — that needs a `<PoolseProvider>` above.
|
|
1486
|
+
*/
|
|
1487
|
+
presence?: PresenceState | true | null;
|
|
1488
|
+
/** Do not disturb, with an explicit `presence` state (looked up automatically with `true`). */
|
|
1489
|
+
doNotDisturb?: boolean;
|
|
1490
|
+
/** Who `presence={true}` looks up: a user id or external id. Defaults to `seed`. */
|
|
1491
|
+
userId?: string | null;
|
|
1204
1492
|
/** Size variant. `md` → 40px, `sm` → 28px, `xs` → 20px, `lg` → 56px. */
|
|
1205
1493
|
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
1206
1494
|
}
|
|
1207
|
-
declare function Avatar({ src, name, seed, online, size }: AvatarProps): react_jsx_runtime.JSX.Element;
|
|
1495
|
+
declare function Avatar({ src, name, seed, online, presence, doNotDisturb, userId, size, }: AvatarProps): react_jsx_runtime.JSX.Element;
|
|
1208
1496
|
|
|
1209
1497
|
declare const primitives: {
|
|
1210
1498
|
PoolseIcon: typeof PoolseIcon;
|
|
@@ -1359,8 +1647,25 @@ declare const defaultDarkTheme: PoolseRNTheme;
|
|
|
1359
1647
|
* useAppStateLifecycle();
|
|
1360
1648
|
* return ...;
|
|
1361
1649
|
* }
|
|
1650
|
+
*
|
|
1651
|
+
* It also reports this device's activity for presence (foreground →
|
|
1652
|
+
* `active`, background / inactive → `idle`, which others see as away);
|
|
1653
|
+
* pass `{ presence: false }` to leave that to you.
|
|
1654
|
+
*/
|
|
1655
|
+
declare function useAppStateLifecycle(options?: {
|
|
1656
|
+
presence?: boolean;
|
|
1657
|
+
}): void;
|
|
1658
|
+
|
|
1659
|
+
/**
|
|
1660
|
+
* Reports this device's activity for presence from `AppState`: the
|
|
1661
|
+
* app in the foreground → `presence.setActivity('active')`, in the
|
|
1662
|
+
* background (or iOS `inactive`: app switcher, notification centre) →
|
|
1663
|
+
* `'idle'`, so others see you as away. The SDK skips repeats.
|
|
1664
|
+
*
|
|
1665
|
+
* `<PoolseInbox>` and `useAppStateLifecycle()` already do this; call
|
|
1666
|
+
* it yourself only when you use neither. `enabled: false` turns it off.
|
|
1362
1667
|
*/
|
|
1363
|
-
declare function
|
|
1668
|
+
declare function useAppStatePresence(enabled?: boolean): void;
|
|
1364
1669
|
|
|
1365
1670
|
interface CallControlButtonProps {
|
|
1366
1671
|
icon: IconName;
|
|
@@ -1502,4 +1807,4 @@ declare const callColors: {
|
|
|
1502
1807
|
*/
|
|
1503
1808
|
declare function useCallDuration(connected: boolean): string | null;
|
|
1504
1809
|
|
|
1505
|
-
export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, type AudioRoute, type AudioRouteKind, AudioRouteSheet, type AudioRouteSheetProps, Avatar, type AvatarProps, CallAvatar, type CallAvatarProps, CallControlButton, type CallControlButtonProps, CallLogRow, type CallLogRowProps, type ChatDensity, ChatHeader, type ChatHeaderProps, type ChatLayout, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, MessageList, type MessageListItem, type MessageListProps, MessageRow, type MessageRowProps, type MessageSlot, type MessageSlotProps, type MessageSlots, type MessageUser, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, type PoolseRNTheme, type PoolseRNThemeOverrides, PoolseTheme, type PoolseThemeProps, primitives as Primitives, ReactionPicker, type ReactionPickerProps, ReactionStrip, type ReactionStripProps, type RenderMessageContext, type ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, type TimeFormat, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useCallDuration, useDisplayName, useTheme };
|
|
1810
|
+
export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, type AudioRoute, type AudioRouteKind, AudioRouteSheet, type AudioRouteSheetProps, Avatar, type AvatarProps, CallAvatar, type CallAvatarProps, CallControlButton, type CallControlButtonProps, CallLogRow, type CallLogRowProps, type ChatDensity, ChatHeader, type ChatHeaderProps, type ChatLayout, type ConversationDraft, type ConversationGroupBy, ConversationList, type ConversationListProps, type ConversationSection, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, type DraftStorage, EditHistorySheet, type EditHistorySheetProps, EmojiPicker, type EmojiPickerProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, LinkPreviewCard, type LinkPreviewCardProps, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerHandle, type MessageComposerProps, MessageList, type MessageListItem, type MessageListProps, MessageRow, type MessageRowProps, type MessageSlot, type MessageSlotProps, type MessageSlots, type MessageUser, NewMessagesDivider, type NewMessagesDividerProps, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, type PoolseRNTheme, type PoolseRNThemeOverrides, PoolseTheme, type PoolseThemeProps, PresenceBadge, type PresenceBadgeProps, primitives as Primitives, ReactionPicker, type ReactionPickerProps, ReactionStrip, type ReactionStripProps, type RenderMessageContext, type ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadSummary, type ThreadSummaryProps, ThreadView, type ThreadViewProps, type TimeFormat, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useAppStatePresence, useCallDuration, useDisplayName, useTheme };
|