@poolse/react-native 2.9.0 → 2.10.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,9 +1,50 @@
1
- import * as react from 'react';
2
- import { ReactNode, ReactElement } from 'react';
3
- import { Conversation, Uuid, Message, AttachmentUploadInput, Membership, Attachment, WebRtcAdapter, VoiceStatus } from '@poolse/sdk';
4
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CallParticipant, Conversation, Uuid, Message, AttachmentUploadInput, Membership, Attachment, WebRtcAdapter, VoiceStatus, LiveKitModule, CallMedia } from '@poolse/sdk';
3
+ import * as react from 'react';
4
+ import { ComponentType, ReactNode, ReactElement } from 'react';
5
+ import { ViewStyle } from 'react-native';
5
6
  import { UseCalls } from '@poolse/react';
6
7
 
8
+ /**
9
+ * The slice of `@livekit/react-native` this needs.
10
+ *
11
+ * Passed in by the app rather than imported, for the same reason
12
+ * `react-native-webrtc` is: tsup rewrites `require()` into
13
+ * `__require()`, which Metro cannot follow, so anything this package
14
+ * imports for itself never reaches a React Native bundle.
15
+ *
16
+ * import * as livekitRN from '@livekit/react-native';
17
+ */
18
+ interface LiveKitReactNativeModule {
19
+ VideoTrack: ComponentType<{
20
+ trackRef: unknown;
21
+ style?: ViewStyle;
22
+ objectFit?: 'cover' | 'contain';
23
+ mirror?: boolean;
24
+ zOrder?: number;
25
+ }>;
26
+ }
27
+ interface CallVideoGridProps {
28
+ participants: CallParticipant[];
29
+ /** `@livekit/react-native`, imported by your app. */
30
+ livekitReactNative?: LiveKitReactNativeModule | null | undefined;
31
+ /** Resolves a user id to a display label. */
32
+ labelFor?: ((userId: string) => string) | undefined;
33
+ }
34
+ /**
35
+ * The video half of a call: one tile per participant.
36
+ *
37
+ * Someone with their camera off still gets a tile, showing their name
38
+ * and whether they're muted. Dropping them would make a five-person
39
+ * call with four cameras off look like a one-person call, and hide the
40
+ * fact that they are there and can hear you.
41
+ *
42
+ * Tiles are laid out in a simple grid that stays square-ish as the call
43
+ * grows. There is no active-speaker promotion yet — with the small
44
+ * calls an SFU mesh replacement is sized for, everyone fits on screen.
45
+ */
46
+ declare function CallVideoGrid({ participants, livekitReactNative, labelFor }: CallVideoGridProps): react_jsx_runtime.JSX.Element | null;
47
+
7
48
  interface InboxUser {
8
49
  /** The user's external_id (the same id you mint JWTs with). */
9
50
  externalId: string;
@@ -1084,17 +1125,40 @@ interface CallScreenProps {
1084
1125
  */
1085
1126
  calls?: UseCalls;
1086
1127
  /**
1087
- * The `react-native-webrtc` module, imported by your app. Required for
1088
- * call audio; without it the screen still rings and connects but warns
1089
- * that there is no audio. See {@link VoiceRoomBarProps.webrtc}.
1128
+ * The `react-native-webrtc` module (or `@livekit/react-native-webrtc`,
1129
+ * which is API-compatible), imported by your app.
1130
+ *
1131
+ * Used for the peer-to-peer fallback when the deployment has no SFU.
1132
+ * With an SFU configured, LiveKit owns the peer connection and this is
1133
+ * only the safety net.
1090
1134
  */
1091
1135
  webrtc?: NativeWebRtcModule | null;
1092
1136
  /**
1093
- * Called whenever the call's audio connection state changes. Drive
1137
+ * `livekit-client`, imported by your app. Enables SFU-backed calls,
1138
+ * which is what makes video and the mid-call camera toggle possible.
1139
+ * Omit it and calls fall back to the peer-to-peer mesh, audio only.
1140
+ */
1141
+ livekit?: LiveKitModule | null;
1142
+ /**
1143
+ * `@livekit/react-native`, imported by your app. Required to *render*
1144
+ * video; without it a video call still connects and carries audio, and
1145
+ * every tile shows a placeholder.
1146
+ */
1147
+ livekitReactNative?: LiveKitReactNativeModule | null;
1148
+ /**
1149
+ * Called whenever the call's media connection state changes. Drive
1094
1150
  * speakerphone and the proximity sensor from here — see
1095
1151
  * {@link VoiceRoomBarProps.onStatusChange}.
1096
1152
  */
1097
1153
  onStatusChange?: (status: VoiceStatus) => void;
1154
+ /**
1155
+ * Called when the call's video state changes.
1156
+ *
1157
+ * A video call belongs on the speaker with the proximity sensor OFF —
1158
+ * otherwise the screen blanks the moment the phone comes near your
1159
+ * face, which is exactly when you are looking at it.
1160
+ */
1161
+ onVideoChange?: (video: boolean) => void;
1098
1162
  /**
1099
1163
  * Hide this screen while a call is merely ringing in.
1100
1164
  *
@@ -1113,15 +1177,22 @@ interface CallScreenProps {
1113
1177
  * Mount it once, high in the tree, so a call can arrive on any screen:
1114
1178
  *
1115
1179
  * <PoolseProvider config={config}>
1116
- * <CallScreen userId={me.id} />
1180
+ * <CallScreen userId={me.id} livekit={livekit} livekitReactNative={livekitRN} />
1117
1181
  * <YourApp />
1118
1182
  * </PoolseProvider>
1119
1183
  *
1120
- * Placing a call is separate — `useCalls().call(conversationId)`, wired
1121
- * to whatever button your UI wants. Pass the same instance in via
1122
- * `calls` so both halves share one state machine.
1184
+ * ## Two media paths
1185
+ *
1186
+ * With `livekit` supplied, media rides the SFU: one upload per
1187
+ * participant regardless of call size, and the camera and microphone can
1188
+ * be switched on and off at any point. Without it — or against a
1189
+ * deployment that has no SFU configured — calls fall back to the
1190
+ * peer-to-peer mesh, which is audio only.
1191
+ *
1192
+ * The fallback is automatic and silent by design. A deployment without
1193
+ * an SFU is a supported configuration, not a broken one.
1123
1194
  */
1124
- declare function CallScreen({ userId, labelFor, calls: external, webrtc, onStatusChange, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1195
+ declare function CallScreen({ userId, labelFor, calls: callsProp, webrtc, livekit, livekitReactNative, onStatusChange, onVideoChange, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1125
1196
 
1126
1197
  /**
1127
1198
  * Bridges iOS PushKit + CallKit to poolse calls, and owns the incoming
@@ -1199,6 +1270,14 @@ interface VoipIncomingCall {
1199
1270
  conversationId: string;
1200
1271
  callerUserId: string;
1201
1272
  callerName: string;
1273
+ /**
1274
+ * What the call opened as.
1275
+ *
1276
+ * Carried by the push because CallKit fixes the answer button when the
1277
+ * call is reported and cannot change it afterwards — waiting for the
1278
+ * socket would mean answering a video call through an audio UI.
1279
+ */
1280
+ media: CallMedia;
1202
1281
  }
1203
1282
  interface UseVoipCallsOptions {
1204
1283
  voipPush: VoipPushModule;
@@ -1253,4 +1332,4 @@ declare function isStalePush(sentAt: number | undefined, now: number, staleAfter
1253
1332
  */
1254
1333
  declare function useVoipCalls({ voipPush, callKeep, calls, onAnswer, onDecline, appName, apnsEnvironment, staleAfterMs, }: UseVoipCallsOptions): void;
1255
1334
 
1256
- export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, type CallKeepModule, CallScreen, type CallScreenProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, MessageList, type MessageListItem, type MessageListProps, MessageRow, type MessageRowProps, type NativeWebRtcModule, 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 ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, type UseVoipCallsOptions, UserName, type UserNameProps, VoiceRoomBar, type VoiceRoomBarProps, type VoipIncomingCall, type VoipPushModule, createNativeWebRtcAdapter, defaultDarkTheme, defaultLightTheme, isNativeWebRtcAvailable, isStalePush, useAppStateLifecycle, useDisplayName, usePoolseTheme, useVoipCalls };
1335
+ export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, type CallKeepModule, CallScreen, type CallScreenProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, type LiveKitReactNativeModule, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, MessageList, type MessageListItem, type MessageListProps, MessageRow, type MessageRowProps, type NativeWebRtcModule, 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 ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, type UseVoipCallsOptions, UserName, type UserNameProps, VoiceRoomBar, type VoiceRoomBarProps, type VoipIncomingCall, type VoipPushModule, createNativeWebRtcAdapter, defaultDarkTheme, defaultLightTheme, isNativeWebRtcAvailable, isStalePush, useAppStateLifecycle, useDisplayName, usePoolseTheme, useVoipCalls };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,50 @@
1
- import * as react from 'react';
2
- import { ReactNode, ReactElement } from 'react';
3
- import { Conversation, Uuid, Message, AttachmentUploadInput, Membership, Attachment, WebRtcAdapter, VoiceStatus } from '@poolse/sdk';
4
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CallParticipant, Conversation, Uuid, Message, AttachmentUploadInput, Membership, Attachment, WebRtcAdapter, VoiceStatus, LiveKitModule, CallMedia } from '@poolse/sdk';
3
+ import * as react from 'react';
4
+ import { ComponentType, ReactNode, ReactElement } from 'react';
5
+ import { ViewStyle } from 'react-native';
5
6
  import { UseCalls } from '@poolse/react';
6
7
 
8
+ /**
9
+ * The slice of `@livekit/react-native` this needs.
10
+ *
11
+ * Passed in by the app rather than imported, for the same reason
12
+ * `react-native-webrtc` is: tsup rewrites `require()` into
13
+ * `__require()`, which Metro cannot follow, so anything this package
14
+ * imports for itself never reaches a React Native bundle.
15
+ *
16
+ * import * as livekitRN from '@livekit/react-native';
17
+ */
18
+ interface LiveKitReactNativeModule {
19
+ VideoTrack: ComponentType<{
20
+ trackRef: unknown;
21
+ style?: ViewStyle;
22
+ objectFit?: 'cover' | 'contain';
23
+ mirror?: boolean;
24
+ zOrder?: number;
25
+ }>;
26
+ }
27
+ interface CallVideoGridProps {
28
+ participants: CallParticipant[];
29
+ /** `@livekit/react-native`, imported by your app. */
30
+ livekitReactNative?: LiveKitReactNativeModule | null | undefined;
31
+ /** Resolves a user id to a display label. */
32
+ labelFor?: ((userId: string) => string) | undefined;
33
+ }
34
+ /**
35
+ * The video half of a call: one tile per participant.
36
+ *
37
+ * Someone with their camera off still gets a tile, showing their name
38
+ * and whether they're muted. Dropping them would make a five-person
39
+ * call with four cameras off look like a one-person call, and hide the
40
+ * fact that they are there and can hear you.
41
+ *
42
+ * Tiles are laid out in a simple grid that stays square-ish as the call
43
+ * grows. There is no active-speaker promotion yet — with the small
44
+ * calls an SFU mesh replacement is sized for, everyone fits on screen.
45
+ */
46
+ declare function CallVideoGrid({ participants, livekitReactNative, labelFor }: CallVideoGridProps): react_jsx_runtime.JSX.Element | null;
47
+
7
48
  interface InboxUser {
8
49
  /** The user's external_id (the same id you mint JWTs with). */
9
50
  externalId: string;
@@ -1084,17 +1125,40 @@ interface CallScreenProps {
1084
1125
  */
1085
1126
  calls?: UseCalls;
1086
1127
  /**
1087
- * The `react-native-webrtc` module, imported by your app. Required for
1088
- * call audio; without it the screen still rings and connects but warns
1089
- * that there is no audio. See {@link VoiceRoomBarProps.webrtc}.
1128
+ * The `react-native-webrtc` module (or `@livekit/react-native-webrtc`,
1129
+ * which is API-compatible), imported by your app.
1130
+ *
1131
+ * Used for the peer-to-peer fallback when the deployment has no SFU.
1132
+ * With an SFU configured, LiveKit owns the peer connection and this is
1133
+ * only the safety net.
1090
1134
  */
1091
1135
  webrtc?: NativeWebRtcModule | null;
1092
1136
  /**
1093
- * Called whenever the call's audio connection state changes. Drive
1137
+ * `livekit-client`, imported by your app. Enables SFU-backed calls,
1138
+ * which is what makes video and the mid-call camera toggle possible.
1139
+ * Omit it and calls fall back to the peer-to-peer mesh, audio only.
1140
+ */
1141
+ livekit?: LiveKitModule | null;
1142
+ /**
1143
+ * `@livekit/react-native`, imported by your app. Required to *render*
1144
+ * video; without it a video call still connects and carries audio, and
1145
+ * every tile shows a placeholder.
1146
+ */
1147
+ livekitReactNative?: LiveKitReactNativeModule | null;
1148
+ /**
1149
+ * Called whenever the call's media connection state changes. Drive
1094
1150
  * speakerphone and the proximity sensor from here — see
1095
1151
  * {@link VoiceRoomBarProps.onStatusChange}.
1096
1152
  */
1097
1153
  onStatusChange?: (status: VoiceStatus) => void;
1154
+ /**
1155
+ * Called when the call's video state changes.
1156
+ *
1157
+ * A video call belongs on the speaker with the proximity sensor OFF —
1158
+ * otherwise the screen blanks the moment the phone comes near your
1159
+ * face, which is exactly when you are looking at it.
1160
+ */
1161
+ onVideoChange?: (video: boolean) => void;
1098
1162
  /**
1099
1163
  * Hide this screen while a call is merely ringing in.
1100
1164
  *
@@ -1113,15 +1177,22 @@ interface CallScreenProps {
1113
1177
  * Mount it once, high in the tree, so a call can arrive on any screen:
1114
1178
  *
1115
1179
  * <PoolseProvider config={config}>
1116
- * <CallScreen userId={me.id} />
1180
+ * <CallScreen userId={me.id} livekit={livekit} livekitReactNative={livekitRN} />
1117
1181
  * <YourApp />
1118
1182
  * </PoolseProvider>
1119
1183
  *
1120
- * Placing a call is separate — `useCalls().call(conversationId)`, wired
1121
- * to whatever button your UI wants. Pass the same instance in via
1122
- * `calls` so both halves share one state machine.
1184
+ * ## Two media paths
1185
+ *
1186
+ * With `livekit` supplied, media rides the SFU: one upload per
1187
+ * participant regardless of call size, and the camera and microphone can
1188
+ * be switched on and off at any point. Without it — or against a
1189
+ * deployment that has no SFU configured — calls fall back to the
1190
+ * peer-to-peer mesh, which is audio only.
1191
+ *
1192
+ * The fallback is automatic and silent by design. A deployment without
1193
+ * an SFU is a supported configuration, not a broken one.
1123
1194
  */
1124
- declare function CallScreen({ userId, labelFor, calls: external, webrtc, onStatusChange, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1195
+ declare function CallScreen({ userId, labelFor, calls: callsProp, webrtc, livekit, livekitReactNative, onStatusChange, onVideoChange, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1125
1196
 
1126
1197
  /**
1127
1198
  * Bridges iOS PushKit + CallKit to poolse calls, and owns the incoming
@@ -1199,6 +1270,14 @@ interface VoipIncomingCall {
1199
1270
  conversationId: string;
1200
1271
  callerUserId: string;
1201
1272
  callerName: string;
1273
+ /**
1274
+ * What the call opened as.
1275
+ *
1276
+ * Carried by the push because CallKit fixes the answer button when the
1277
+ * call is reported and cannot change it afterwards — waiting for the
1278
+ * socket would mean answering a video call through an audio UI.
1279
+ */
1280
+ media: CallMedia;
1202
1281
  }
1203
1282
  interface UseVoipCallsOptions {
1204
1283
  voipPush: VoipPushModule;
@@ -1253,4 +1332,4 @@ declare function isStalePush(sentAt: number | undefined, now: number, staleAfter
1253
1332
  */
1254
1333
  declare function useVoipCalls({ voipPush, callKeep, calls, onAnswer, onDecline, appName, apnsEnvironment, staleAfterMs, }: UseVoipCallsOptions): void;
1255
1334
 
1256
- export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, type CallKeepModule, CallScreen, type CallScreenProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, MessageList, type MessageListItem, type MessageListProps, MessageRow, type MessageRowProps, type NativeWebRtcModule, 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 ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, type UseVoipCallsOptions, UserName, type UserNameProps, VoiceRoomBar, type VoiceRoomBarProps, type VoipIncomingCall, type VoipPushModule, createNativeWebRtcAdapter, defaultDarkTheme, defaultLightTheme, isNativeWebRtcAvailable, isStalePush, useAppStateLifecycle, useDisplayName, usePoolseTheme, useVoipCalls };
1335
+ export { AttachmentPicker, type AttachmentPickerProps, AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, type CallKeepModule, CallScreen, type CallScreenProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, DaySeparator, type DaySeparatorProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, ImageMosaic, type ImageMosaicProps, type InboxUser, type LiveKitReactNativeModule, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, MessageList, type MessageListItem, type MessageListProps, MessageRow, type MessageRowProps, type NativeWebRtcModule, 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 ThemeColors, type ThemeRadii, type ThemeShadows, type ThemeSpacing, type ThemeType, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, type UseVoipCallsOptions, UserName, type UserNameProps, VoiceRoomBar, type VoiceRoomBarProps, type VoipIncomingCall, type VoipPushModule, createNativeWebRtcAdapter, defaultDarkTheme, defaultLightTheme, isNativeWebRtcAvailable, isStalePush, useAppStateLifecycle, useDisplayName, usePoolseTheme, useVoipCalls };