@poolse/react-native 3.7.1 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ReactElement } from 'react';
3
- import { Conversation, Uuid, Message, LiveCall, AttachmentUploadInput, Membership, PresenceState, Attachment, LinkPreview } from '@poolse/sdk';
3
+ import { Conversation, Uuid, Message, LiveCall, AttachmentUploadInput, Membership, PresenceState, Attachment, LinkPreview, Poolse } from '@poolse/sdk';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { GroupPosition } from '@poolse/react';
6
6
  import { StyleProp, ViewStyle } from 'react-native';
@@ -288,6 +288,10 @@ interface MessageRowProps {
288
288
  onMarkUnread?: () => void;
289
289
  /** The "edited" label opens the edit history (`chat.messages.edits`). Defaults to true. */
290
290
  editHistory?: boolean;
291
+ /** Unsent message (queued or failed in the outbox): the Retry under it. */
292
+ onRetrySend?: () => void;
293
+ /** Unsent message: the Delete under it. */
294
+ onDiscardSend?: () => void;
291
295
  }
292
296
  declare function MessageRow(props: MessageRowProps): react_jsx_runtime.JSX.Element | null;
293
297
 
@@ -919,8 +923,15 @@ interface ConversationListProps {
919
923
  onSelect?: (conv: Conversation) => void;
920
924
  /** Optional override for each row's rendering. */
921
925
  renderItem?: (conv: Conversation, selected: boolean) => ReactNode;
922
- /** Custom empty state when there are no conversations. */
926
+ /**
927
+ * What an empty list shows. Defaults to "No conversations yet" with a
928
+ * hint at the next step.
929
+ */
923
930
  emptyState?: ReactNode | string;
931
+ /** Show only conversations matching this text (a search field in `header`). */
932
+ query?: string;
933
+ /** What shows when `query` matches nothing. Receives the query. */
934
+ noResultsState?: ReactNode | ((query: string) => ReactNode);
924
935
  /** Controlled-mode: skip `useConversations()` and render from these. */
925
936
  conversations?: Conversation[];
926
937
  loading?: boolean;
@@ -958,7 +969,7 @@ interface ConversationListProps {
958
969
  /** Presence badges on direct chats' avatars. Defaults to `true`. */
959
970
  showPresence?: boolean;
960
971
  }
961
- 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;
972
+ declare function ConversationList({ selectedId, onSelect, renderItem, emptyState, query, noResultsState, 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;
962
973
 
963
974
  interface MemberListProps {
964
975
  conversationId: Uuid;
@@ -1645,6 +1656,10 @@ declare const defaultDarkTheme: PoolseRNTheme;
1645
1656
  * `useConversations` reload from REST to catch up on what was sent
1646
1657
  * while the app was away.
1647
1658
  *
1659
+ * One workspace. With several signed in, use `useBackgroundClients`
1660
+ * instead (once, outside the providers) — it also keeps the workspaces
1661
+ * that aren't on screen disconnected.
1662
+ *
1648
1663
  * Mount once, inside the provider:
1649
1664
  *
1650
1665
  * <PoolseProvider config={config}>
@@ -1675,6 +1690,64 @@ declare function useAppStateLifecycle(options?: {
1675
1690
  */
1676
1691
  declare function useAppStatePresence(enabled?: boolean): void;
1677
1692
 
1693
+ /**
1694
+ * Which clients should be in the background: all of them while the app
1695
+ * isn't active; otherwise every one except `active` (and `keepConnected`).
1696
+ */
1697
+ declare function applyBackground(clients: ReadonlyArray<Poolse>, active: Poolse | null, appActive: boolean, keepConnected?: ReadonlyArray<Poolse>): void;
1698
+
1699
+ interface BackgroundClientsOptions {
1700
+ /**
1701
+ * Also report presence from the app state on the client on screen
1702
+ * (`active` in the foreground, `idle` otherwise). Default `true`.
1703
+ */
1704
+ presence?: boolean;
1705
+ /**
1706
+ * Keep these clients connected even when not on screen (a workspace
1707
+ * with a call running, say). Default none.
1708
+ */
1709
+ keepConnected?: ReadonlyArray<Poolse>;
1710
+ }
1711
+ /**
1712
+ * Drive `setBackground` for every signed-in workspace from `AppState`
1713
+ * and which one is on screen.
1714
+ *
1715
+ * ```tsx
1716
+ * useBackgroundClients(clients, current);
1717
+ * // In the push handler, for the workspace the push names:
1718
+ * clientFor(push.tenant_id)?.wake();
1719
+ * ```
1720
+ */
1721
+ declare function useBackgroundClients(clients: ReadonlyArray<Poolse>, active: Poolse | null, opts?: BackgroundClientsOptions): void;
1722
+
1723
+ interface EmptyStateProps {
1724
+ /** What's empty, in a few words: "No messages yet". */
1725
+ title: string;
1726
+ /** What to do next. */
1727
+ hint?: string;
1728
+ /** A button for the next step. */
1729
+ action?: ReactNode;
1730
+ }
1731
+ /**
1732
+ * An empty screen that says what to do next — the default for an empty
1733
+ * conversation list, an empty conversation and an empty thread. Pass
1734
+ * your own `emptyState` to any of them to replace it.
1735
+ */
1736
+ declare function EmptyState({ title, hint, action }: EmptyStateProps): react_jsx_runtime.JSX.Element;
1737
+
1738
+ interface SendStatusProps {
1739
+ message: Message;
1740
+ onRetry?: () => void;
1741
+ onDiscard?: () => void;
1742
+ alignEnd?: boolean;
1743
+ }
1744
+ /**
1745
+ * Under an unsent message: "Waiting for network…" while it's queued
1746
+ * offline (it goes out by itself), or "Not sent" with Retry and Delete
1747
+ * when the server refused it.
1748
+ */
1749
+ declare function SendStatus({ message, onRetry, onDiscard, alignEnd }: SendStatusProps): react_jsx_runtime.JSX.Element | null;
1750
+
1678
1751
  interface CallControlButtonProps {
1679
1752
  icon: IconName;
1680
1753
  /** Shown under the button. Omit for the hang-up / answer buttons. */
@@ -1815,4 +1888,4 @@ declare const callColors: {
1815
1888
  */
1816
1889
  declare function useCallDuration(connected: boolean): string | null;
1817
1890
 
1818
- 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, usePoolseTheme, useTheme };
1891
+ export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, type AudioRoute, type AudioRouteKind, AudioRouteSheet, type AudioRouteSheetProps, Avatar, type AvatarProps, type BackgroundClientsOptions, 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, EmptyState, type EmptyStateProps, 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, SendStatus, type SendStatusProps, 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, applyBackground, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useAppStatePresence, useBackgroundClients, useCallDuration, useDisplayName, usePoolseTheme, useTheme };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ReactElement } from 'react';
3
- import { Conversation, Uuid, Message, LiveCall, AttachmentUploadInput, Membership, PresenceState, Attachment, LinkPreview } from '@poolse/sdk';
3
+ import { Conversation, Uuid, Message, LiveCall, AttachmentUploadInput, Membership, PresenceState, Attachment, LinkPreview, Poolse } from '@poolse/sdk';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { GroupPosition } from '@poolse/react';
6
6
  import { StyleProp, ViewStyle } from 'react-native';
@@ -288,6 +288,10 @@ interface MessageRowProps {
288
288
  onMarkUnread?: () => void;
289
289
  /** The "edited" label opens the edit history (`chat.messages.edits`). Defaults to true. */
290
290
  editHistory?: boolean;
291
+ /** Unsent message (queued or failed in the outbox): the Retry under it. */
292
+ onRetrySend?: () => void;
293
+ /** Unsent message: the Delete under it. */
294
+ onDiscardSend?: () => void;
291
295
  }
292
296
  declare function MessageRow(props: MessageRowProps): react_jsx_runtime.JSX.Element | null;
293
297
 
@@ -919,8 +923,15 @@ interface ConversationListProps {
919
923
  onSelect?: (conv: Conversation) => void;
920
924
  /** Optional override for each row's rendering. */
921
925
  renderItem?: (conv: Conversation, selected: boolean) => ReactNode;
922
- /** Custom empty state when there are no conversations. */
926
+ /**
927
+ * What an empty list shows. Defaults to "No conversations yet" with a
928
+ * hint at the next step.
929
+ */
923
930
  emptyState?: ReactNode | string;
931
+ /** Show only conversations matching this text (a search field in `header`). */
932
+ query?: string;
933
+ /** What shows when `query` matches nothing. Receives the query. */
934
+ noResultsState?: ReactNode | ((query: string) => ReactNode);
924
935
  /** Controlled-mode: skip `useConversations()` and render from these. */
925
936
  conversations?: Conversation[];
926
937
  loading?: boolean;
@@ -958,7 +969,7 @@ interface ConversationListProps {
958
969
  /** Presence badges on direct chats' avatars. Defaults to `true`. */
959
970
  showPresence?: boolean;
960
971
  }
961
- 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;
972
+ declare function ConversationList({ selectedId, onSelect, renderItem, emptyState, query, noResultsState, 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;
962
973
 
963
974
  interface MemberListProps {
964
975
  conversationId: Uuid;
@@ -1645,6 +1656,10 @@ declare const defaultDarkTheme: PoolseRNTheme;
1645
1656
  * `useConversations` reload from REST to catch up on what was sent
1646
1657
  * while the app was away.
1647
1658
  *
1659
+ * One workspace. With several signed in, use `useBackgroundClients`
1660
+ * instead (once, outside the providers) — it also keeps the workspaces
1661
+ * that aren't on screen disconnected.
1662
+ *
1648
1663
  * Mount once, inside the provider:
1649
1664
  *
1650
1665
  * <PoolseProvider config={config}>
@@ -1675,6 +1690,64 @@ declare function useAppStateLifecycle(options?: {
1675
1690
  */
1676
1691
  declare function useAppStatePresence(enabled?: boolean): void;
1677
1692
 
1693
+ /**
1694
+ * Which clients should be in the background: all of them while the app
1695
+ * isn't active; otherwise every one except `active` (and `keepConnected`).
1696
+ */
1697
+ declare function applyBackground(clients: ReadonlyArray<Poolse>, active: Poolse | null, appActive: boolean, keepConnected?: ReadonlyArray<Poolse>): void;
1698
+
1699
+ interface BackgroundClientsOptions {
1700
+ /**
1701
+ * Also report presence from the app state on the client on screen
1702
+ * (`active` in the foreground, `idle` otherwise). Default `true`.
1703
+ */
1704
+ presence?: boolean;
1705
+ /**
1706
+ * Keep these clients connected even when not on screen (a workspace
1707
+ * with a call running, say). Default none.
1708
+ */
1709
+ keepConnected?: ReadonlyArray<Poolse>;
1710
+ }
1711
+ /**
1712
+ * Drive `setBackground` for every signed-in workspace from `AppState`
1713
+ * and which one is on screen.
1714
+ *
1715
+ * ```tsx
1716
+ * useBackgroundClients(clients, current);
1717
+ * // In the push handler, for the workspace the push names:
1718
+ * clientFor(push.tenant_id)?.wake();
1719
+ * ```
1720
+ */
1721
+ declare function useBackgroundClients(clients: ReadonlyArray<Poolse>, active: Poolse | null, opts?: BackgroundClientsOptions): void;
1722
+
1723
+ interface EmptyStateProps {
1724
+ /** What's empty, in a few words: "No messages yet". */
1725
+ title: string;
1726
+ /** What to do next. */
1727
+ hint?: string;
1728
+ /** A button for the next step. */
1729
+ action?: ReactNode;
1730
+ }
1731
+ /**
1732
+ * An empty screen that says what to do next — the default for an empty
1733
+ * conversation list, an empty conversation and an empty thread. Pass
1734
+ * your own `emptyState` to any of them to replace it.
1735
+ */
1736
+ declare function EmptyState({ title, hint, action }: EmptyStateProps): react_jsx_runtime.JSX.Element;
1737
+
1738
+ interface SendStatusProps {
1739
+ message: Message;
1740
+ onRetry?: () => void;
1741
+ onDiscard?: () => void;
1742
+ alignEnd?: boolean;
1743
+ }
1744
+ /**
1745
+ * Under an unsent message: "Waiting for network…" while it's queued
1746
+ * offline (it goes out by itself), or "Not sent" with Retry and Delete
1747
+ * when the server refused it.
1748
+ */
1749
+ declare function SendStatus({ message, onRetry, onDiscard, alignEnd }: SendStatusProps): react_jsx_runtime.JSX.Element | null;
1750
+
1678
1751
  interface CallControlButtonProps {
1679
1752
  icon: IconName;
1680
1753
  /** Shown under the button. Omit for the hang-up / answer buttons. */
@@ -1815,4 +1888,4 @@ declare const callColors: {
1815
1888
  */
1816
1889
  declare function useCallDuration(connected: boolean): string | null;
1817
1890
 
1818
- 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, usePoolseTheme, useTheme };
1891
+ export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, type AudioRoute, type AudioRouteKind, AudioRouteSheet, type AudioRouteSheetProps, Avatar, type AvatarProps, type BackgroundClientsOptions, 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, EmptyState, type EmptyStateProps, 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, SendStatus, type SendStatusProps, 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, applyBackground, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useAppStatePresence, useBackgroundClients, useCallDuration, useDisplayName, usePoolseTheme, useTheme };