@poolse/react-native 2.9.0 → 2.10.1

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,52 @@
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';
1
3
  import * as react from 'react';
2
4
  import { ReactNode, ReactElement } from 'react';
3
- import { Conversation, Uuid, Message, AttachmentUploadInput, Membership, Attachment, WebRtcAdapter, VoiceStatus } from '@poolse/sdk';
4
- import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { UseCalls } from '@poolse/react';
6
6
 
7
+ /**
8
+ * The slice of `@livekit/react-native` this needs.
9
+ *
10
+ * Passed in by the app rather than imported, for the same reason
11
+ * `react-native-webrtc` is: tsup rewrites `require()` into
12
+ * `__require()`, which Metro cannot follow, so anything this package
13
+ * imports for itself never reaches a React Native bundle.
14
+ *
15
+ * import * as livekitRN from '@livekit/react-native';
16
+ */
17
+ interface LiveKitReactNativeModule {
18
+ /**
19
+ * The module's `VideoTrack` component.
20
+ *
21
+ * Typed as `unknown` on purpose. Its real props are far more specific
22
+ * than what this renders with, and React component props are
23
+ * contravariant — declaring the narrow shape here means the real
24
+ * component is not assignable to it and no app can pass the module in.
25
+ * It is narrowed to {@link CheckedVideoTrack} at the point of use.
26
+ */
27
+ VideoTrack: unknown;
28
+ }
29
+ interface CallVideoGridProps {
30
+ participants: CallParticipant[];
31
+ /** `@livekit/react-native`, imported by your app. */
32
+ livekitReactNative?: LiveKitReactNativeModule | null | undefined;
33
+ /** Resolves a user id to a display label. */
34
+ labelFor?: ((userId: string) => string) | undefined;
35
+ }
36
+ /**
37
+ * The video half of a call: one tile per participant.
38
+ *
39
+ * Someone with their camera off still gets a tile, showing their name
40
+ * and whether they're muted. Dropping them would make a five-person
41
+ * call with four cameras off look like a one-person call, and hide the
42
+ * fact that they are there and can hear you.
43
+ *
44
+ * Tiles are laid out in a simple grid that stays square-ish as the call
45
+ * grows. There is no active-speaker promotion yet — with the small
46
+ * calls an SFU mesh replacement is sized for, everyone fits on screen.
47
+ */
48
+ declare function CallVideoGrid({ participants, livekitReactNative, labelFor }: CallVideoGridProps): react_jsx_runtime.JSX.Element | null;
49
+
7
50
  interface InboxUser {
8
51
  /** The user's external_id (the same id you mint JWTs with). */
9
52
  externalId: string;
@@ -1084,17 +1127,40 @@ interface CallScreenProps {
1084
1127
  */
1085
1128
  calls?: UseCalls;
1086
1129
  /**
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}.
1130
+ * The `react-native-webrtc` module (or `@livekit/react-native-webrtc`,
1131
+ * which is API-compatible), imported by your app.
1132
+ *
1133
+ * Used for the peer-to-peer fallback when the deployment has no SFU.
1134
+ * With an SFU configured, LiveKit owns the peer connection and this is
1135
+ * only the safety net.
1090
1136
  */
1091
1137
  webrtc?: NativeWebRtcModule | null;
1092
1138
  /**
1093
- * Called whenever the call's audio connection state changes. Drive
1139
+ * `livekit-client`, imported by your app. Enables SFU-backed calls,
1140
+ * which is what makes video and the mid-call camera toggle possible.
1141
+ * Omit it and calls fall back to the peer-to-peer mesh, audio only.
1142
+ */
1143
+ livekit?: LiveKitModule | null;
1144
+ /**
1145
+ * `@livekit/react-native`, imported by your app. Required to *render*
1146
+ * video; without it a video call still connects and carries audio, and
1147
+ * every tile shows a placeholder.
1148
+ */
1149
+ livekitReactNative?: LiveKitReactNativeModule | null;
1150
+ /**
1151
+ * Called whenever the call's media connection state changes. Drive
1094
1152
  * speakerphone and the proximity sensor from here — see
1095
1153
  * {@link VoiceRoomBarProps.onStatusChange}.
1096
1154
  */
1097
1155
  onStatusChange?: (status: VoiceStatus) => void;
1156
+ /**
1157
+ * Called when the call's video state changes.
1158
+ *
1159
+ * A video call belongs on the speaker with the proximity sensor OFF —
1160
+ * otherwise the screen blanks the moment the phone comes near your
1161
+ * face, which is exactly when you are looking at it.
1162
+ */
1163
+ onVideoChange?: (video: boolean) => void;
1098
1164
  /**
1099
1165
  * Hide this screen while a call is merely ringing in.
1100
1166
  *
@@ -1113,15 +1179,22 @@ interface CallScreenProps {
1113
1179
  * Mount it once, high in the tree, so a call can arrive on any screen:
1114
1180
  *
1115
1181
  * <PoolseProvider config={config}>
1116
- * <CallScreen userId={me.id} />
1182
+ * <CallScreen userId={me.id} livekit={livekit} livekitReactNative={livekitRN} />
1117
1183
  * <YourApp />
1118
1184
  * </PoolseProvider>
1119
1185
  *
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.
1186
+ * ## Two media paths
1187
+ *
1188
+ * With `livekit` supplied, media rides the SFU: one upload per
1189
+ * participant regardless of call size, and the camera and microphone can
1190
+ * be switched on and off at any point. Without it — or against a
1191
+ * deployment that has no SFU configured — calls fall back to the
1192
+ * peer-to-peer mesh, which is audio only.
1193
+ *
1194
+ * The fallback is automatic and silent by design. A deployment without
1195
+ * an SFU is a supported configuration, not a broken one.
1123
1196
  */
1124
- declare function CallScreen({ userId, labelFor, calls: external, webrtc, onStatusChange, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1197
+ declare function CallScreen({ userId, labelFor, calls: callsProp, webrtc, livekit, livekitReactNative, onStatusChange, onVideoChange, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1125
1198
 
1126
1199
  /**
1127
1200
  * Bridges iOS PushKit + CallKit to poolse calls, and owns the incoming
@@ -1199,6 +1272,14 @@ interface VoipIncomingCall {
1199
1272
  conversationId: string;
1200
1273
  callerUserId: string;
1201
1274
  callerName: string;
1275
+ /**
1276
+ * What the call opened as.
1277
+ *
1278
+ * Carried by the push because CallKit fixes the answer button when the
1279
+ * call is reported and cannot change it afterwards — waiting for the
1280
+ * socket would mean answering a video call through an audio UI.
1281
+ */
1282
+ media: CallMedia;
1202
1283
  }
1203
1284
  interface UseVoipCallsOptions {
1204
1285
  voipPush: VoipPushModule;
@@ -1253,4 +1334,4 @@ declare function isStalePush(sentAt: number | undefined, now: number, staleAfter
1253
1334
  */
1254
1335
  declare function useVoipCalls({ voipPush, callKeep, calls, onAnswer, onDecline, appName, apnsEnvironment, staleAfterMs, }: UseVoipCallsOptions): void;
1255
1336
 
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 };
1337
+ 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,52 @@
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';
1
3
  import * as react from 'react';
2
4
  import { ReactNode, ReactElement } from 'react';
3
- import { Conversation, Uuid, Message, AttachmentUploadInput, Membership, Attachment, WebRtcAdapter, VoiceStatus } from '@poolse/sdk';
4
- import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { UseCalls } from '@poolse/react';
6
6
 
7
+ /**
8
+ * The slice of `@livekit/react-native` this needs.
9
+ *
10
+ * Passed in by the app rather than imported, for the same reason
11
+ * `react-native-webrtc` is: tsup rewrites `require()` into
12
+ * `__require()`, which Metro cannot follow, so anything this package
13
+ * imports for itself never reaches a React Native bundle.
14
+ *
15
+ * import * as livekitRN from '@livekit/react-native';
16
+ */
17
+ interface LiveKitReactNativeModule {
18
+ /**
19
+ * The module's `VideoTrack` component.
20
+ *
21
+ * Typed as `unknown` on purpose. Its real props are far more specific
22
+ * than what this renders with, and React component props are
23
+ * contravariant — declaring the narrow shape here means the real
24
+ * component is not assignable to it and no app can pass the module in.
25
+ * It is narrowed to {@link CheckedVideoTrack} at the point of use.
26
+ */
27
+ VideoTrack: unknown;
28
+ }
29
+ interface CallVideoGridProps {
30
+ participants: CallParticipant[];
31
+ /** `@livekit/react-native`, imported by your app. */
32
+ livekitReactNative?: LiveKitReactNativeModule | null | undefined;
33
+ /** Resolves a user id to a display label. */
34
+ labelFor?: ((userId: string) => string) | undefined;
35
+ }
36
+ /**
37
+ * The video half of a call: one tile per participant.
38
+ *
39
+ * Someone with their camera off still gets a tile, showing their name
40
+ * and whether they're muted. Dropping them would make a five-person
41
+ * call with four cameras off look like a one-person call, and hide the
42
+ * fact that they are there and can hear you.
43
+ *
44
+ * Tiles are laid out in a simple grid that stays square-ish as the call
45
+ * grows. There is no active-speaker promotion yet — with the small
46
+ * calls an SFU mesh replacement is sized for, everyone fits on screen.
47
+ */
48
+ declare function CallVideoGrid({ participants, livekitReactNative, labelFor }: CallVideoGridProps): react_jsx_runtime.JSX.Element | null;
49
+
7
50
  interface InboxUser {
8
51
  /** The user's external_id (the same id you mint JWTs with). */
9
52
  externalId: string;
@@ -1084,17 +1127,40 @@ interface CallScreenProps {
1084
1127
  */
1085
1128
  calls?: UseCalls;
1086
1129
  /**
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}.
1130
+ * The `react-native-webrtc` module (or `@livekit/react-native-webrtc`,
1131
+ * which is API-compatible), imported by your app.
1132
+ *
1133
+ * Used for the peer-to-peer fallback when the deployment has no SFU.
1134
+ * With an SFU configured, LiveKit owns the peer connection and this is
1135
+ * only the safety net.
1090
1136
  */
1091
1137
  webrtc?: NativeWebRtcModule | null;
1092
1138
  /**
1093
- * Called whenever the call's audio connection state changes. Drive
1139
+ * `livekit-client`, imported by your app. Enables SFU-backed calls,
1140
+ * which is what makes video and the mid-call camera toggle possible.
1141
+ * Omit it and calls fall back to the peer-to-peer mesh, audio only.
1142
+ */
1143
+ livekit?: LiveKitModule | null;
1144
+ /**
1145
+ * `@livekit/react-native`, imported by your app. Required to *render*
1146
+ * video; without it a video call still connects and carries audio, and
1147
+ * every tile shows a placeholder.
1148
+ */
1149
+ livekitReactNative?: LiveKitReactNativeModule | null;
1150
+ /**
1151
+ * Called whenever the call's media connection state changes. Drive
1094
1152
  * speakerphone and the proximity sensor from here — see
1095
1153
  * {@link VoiceRoomBarProps.onStatusChange}.
1096
1154
  */
1097
1155
  onStatusChange?: (status: VoiceStatus) => void;
1156
+ /**
1157
+ * Called when the call's video state changes.
1158
+ *
1159
+ * A video call belongs on the speaker with the proximity sensor OFF —
1160
+ * otherwise the screen blanks the moment the phone comes near your
1161
+ * face, which is exactly when you are looking at it.
1162
+ */
1163
+ onVideoChange?: (video: boolean) => void;
1098
1164
  /**
1099
1165
  * Hide this screen while a call is merely ringing in.
1100
1166
  *
@@ -1113,15 +1179,22 @@ interface CallScreenProps {
1113
1179
  * Mount it once, high in the tree, so a call can arrive on any screen:
1114
1180
  *
1115
1181
  * <PoolseProvider config={config}>
1116
- * <CallScreen userId={me.id} />
1182
+ * <CallScreen userId={me.id} livekit={livekit} livekitReactNative={livekitRN} />
1117
1183
  * <YourApp />
1118
1184
  * </PoolseProvider>
1119
1185
  *
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.
1186
+ * ## Two media paths
1187
+ *
1188
+ * With `livekit` supplied, media rides the SFU: one upload per
1189
+ * participant regardless of call size, and the camera and microphone can
1190
+ * be switched on and off at any point. Without it — or against a
1191
+ * deployment that has no SFU configured — calls fall back to the
1192
+ * peer-to-peer mesh, which is audio only.
1193
+ *
1194
+ * The fallback is automatic and silent by design. A deployment without
1195
+ * an SFU is a supported configuration, not a broken one.
1123
1196
  */
1124
- declare function CallScreen({ userId, labelFor, calls: external, webrtc, onStatusChange, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1197
+ declare function CallScreen({ userId, labelFor, calls: callsProp, webrtc, livekit, livekitReactNative, onStatusChange, onVideoChange, nativeIncomingUi, }: CallScreenProps): react_jsx_runtime.JSX.Element;
1125
1198
 
1126
1199
  /**
1127
1200
  * Bridges iOS PushKit + CallKit to poolse calls, and owns the incoming
@@ -1199,6 +1272,14 @@ interface VoipIncomingCall {
1199
1272
  conversationId: string;
1200
1273
  callerUserId: string;
1201
1274
  callerName: string;
1275
+ /**
1276
+ * What the call opened as.
1277
+ *
1278
+ * Carried by the push because CallKit fixes the answer button when the
1279
+ * call is reported and cannot change it afterwards — waiting for the
1280
+ * socket would mean answering a video call through an audio UI.
1281
+ */
1282
+ media: CallMedia;
1202
1283
  }
1203
1284
  interface UseVoipCallsOptions {
1204
1285
  voipPush: VoipPushModule;
@@ -1253,4 +1334,4 @@ declare function isStalePush(sentAt: number | undefined, now: number, staleAfter
1253
1334
  */
1254
1335
  declare function useVoipCalls({ voipPush, callKeep, calls, onAnswer, onDecline, appName, apnsEnvironment, staleAfterMs, }: UseVoipCallsOptions): void;
1255
1336
 
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 };
1337
+ 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 };