@poolse/react 3.8.0 → 3.9.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_jsx_runtime from 'react/jsx-runtime';
2
- import { Poolse, PoolseConfig, TrackActivityOptions, Conversation, Uuid, UnreadTotals, OutboxEntry, Me, ConversationCreateRequest, Membership, MemberRole, Message, MessageCreateRequest, Presence, RealtimeStatus, Attachment, AttachmentUploadInput, PoolseUserProfile, AppEvent, CallRoomStatus, CallParticipant, CameraFacing, CallDeviceKind, CallDevice, LiveKitModule, LiveCall } from '@poolse/sdk';
3
- export { ApiError, ApiErrorCode, AppEvent, Attachment, AttachmentStatus, AttachmentUploadInput, AttachmentUploadRequest, AttachmentUploadResponse, AuthError, CallEndReason, CallLog, CallLogDisplay, CallLogEntry, CallLogMedia, CallMissedEntry, CallParticipantStatus, Conversation, ConversationCreateRequest, ConversationReadEvent, DestroyOptions, DeviceKind, LinkPreview, LinkPreviewType, LiveCall, LiveCallMember, LocalMessageStatus, Me, MemberRole, Membership, Message, MessageCreateRequest, MessageDiscardedError, MessageEdit, MessageEditList, MessageQueuedError, MessageType, MessageUpdateRequest, NetworkError, NotificationPreferences, NotifyLevel, OutboxEntry, OwnMembership, OwnMembershipUpdateRequest, Poolse, PoolseConfig, PoolseError, PoolseStorage, PoolseUserProfile, Presence, PresenceActivity, PresenceChangedEvent, PresenceState, RateLimitedError, ReadReceiptsState, RealtimeStatus, RoomSession, ThreadParticipant, ThreadUpdatedEvent, TimingEvent, TrackActivityOptions, UnreadSummary, UnreadTotals, Uuid, callLogDisplayFor, createIndexedDbStorage, describeCallLog, formatCallDuration, formatCallLogPreview, isCallLogMessage, isMessageVisibleTo, isTombstone, memoryStorage, mergeMessage, parseCallLog, parseCallLogBody, toTombstone } from '@poolse/sdk';
2
+ import { Poolse, PoolseConfig, TrackActivityOptions, Conversation, Uuid, UnreadTotals, OutboxEntry, Me, ConversationCreateRequest, Membership, MemberRole, Message, MessageCreateRequest, Presence, RealtimeStatus, Attachment, AttachmentUploadInput, PoolseUserProfile, AppEvent, CallRoomStatus, CallParticipant, CameraFacing, CallDeviceKind, CallDevice, LiveKitModule, LiveCall, CallRecordingState, CallTranscriptionState, ConsentDecision, Recording, RecordingMode, LiveTranscriptSegment, Transcript, TranscriptWithSegments, RecordingStartedEvent, RecordingChangedEvent, RecordingConsentEvent, TranscriptChangedEvent } from '@poolse/sdk';
3
+ export { ApiError, ApiErrorCode, AppEvent, Attachment, AttachmentStatus, AttachmentUploadInput, AttachmentUploadRequest, AttachmentUploadResponse, AuthError, CallEndReason, CallLog, CallLogDisplay, CallLogEntry, CallLogMedia, CallMissedEntry, CallParticipantStatus, CallRecordingState, CallTranscriptionState, ConsentDecision, Conversation, ConversationCreateRequest, ConversationReadEvent, ConversationRecordingSettings, DestroyOptions, DeviceKind, LinkPreview, LinkPreviewType, LiveCall, LiveCallMember, LiveTranscriptSegment, LocalMessageStatus, Me, MemberRole, Membership, Message, MessageCreateRequest, MessageDiscardedError, MessageEdit, MessageEditList, MessageQueuedError, MessageType, MessageUpdateRequest, NetworkError, NotificationPreferences, NotifyLevel, OutboxEntry, OwnMembership, OwnMembershipUpdateRequest, POOLSE_SERVICE_IDENTITY_PREFIX, Poolse, PoolseConfig, PoolseError, PoolseStorage, PoolseUserProfile, Presence, PresenceActivity, PresenceChangedEvent, PresenceState, RateLimitedError, ReadReceiptsState, RealtimeStatus, Recording, RecordingDownload, RecordingMode, RecordingNotice, RecordingNoticeDisplay, RecordingStatus, RoomSession, ThreadParticipant, ThreadUpdatedEvent, TimingEvent, TrackActivityOptions, Transcript, TranscriptBlock, TranscriptSegment, TranscriptSpeaker, TranscriptWithSegments, UnreadSummary, UnreadTotals, Uuid, applyLiveSegment, callLogDisplayFor, captureErrorMessage, captureLabel, createIndexedDbStorage, describeCallLog, describeRecordingNotice, findInText, formatCallDuration, formatCallLogPreview, formatRecordingNoticePreview, groupTranscript, isCallLogMessage, isMessageVisibleTo, isServiceParticipant, isTombstone, memoryStorage, mergeMessage, parseCallLog, parseCallLogBody, parseRecordingNotice, parseRecordingNoticeBody, recordingNoticeDisplayFor, speakerName, toTombstone } from '@poolse/sdk';
4
4
  import { ReactNode } from 'react';
5
5
 
6
6
  interface PoolseProviderProps {
@@ -793,6 +793,12 @@ interface UseCallRoomOptions {
793
793
  * Pass `0` to never report it.
794
794
  */
795
795
  aloneGraceMs?: number;
796
+ /**
797
+ * Bring the microphone and camera back by themselves when publish
798
+ * permission returns (after accepting recording consent). Defaults to
799
+ * true; false: call `republish` yourself.
800
+ */
801
+ republishOnPermission?: boolean;
796
802
  }
797
803
  interface UseCallRoom {
798
804
  status: CallRoomStatus;
@@ -874,6 +880,18 @@ interface UseCallRoom {
874
880
  /** Share a screen (the platform's picker opens) or stop sharing. */
875
881
  setScreenShareEnabled: (enabled: boolean) => Promise<void>;
876
882
  toggleScreenShare: () => Promise<void>;
883
+ /**
884
+ * The SFU lets you publish. False while the call is recorded or
885
+ * transcribed under `consent: "required"` and you haven't accepted —
886
+ * show the consent prompt; you still hear and see everyone.
887
+ */
888
+ canPublish: boolean;
889
+ /**
890
+ * Turn the microphone and camera back on as you last had them. Done
891
+ * for you when publish permission returns unless
892
+ * `republishOnPermission: false`.
893
+ */
894
+ republish: () => Promise<void>;
877
895
  }
878
896
  /**
879
897
  * A call's media, carried by the SFU.
@@ -953,6 +971,172 @@ interface UseRoom {
953
971
  */
954
972
  declare function useRoom(conversationId: string | null, opts: UseRoomOptions): UseRoom;
955
973
 
974
+ interface UseRecording {
975
+ /** This server can record (LiveKit Egress). False: hide the Record button. */
976
+ available: boolean;
977
+ /** The call is being recorded right now. */
978
+ active: boolean;
979
+ /** The snapshot's recording state, kept live; null until read. */
980
+ recording: CallRecordingState | null;
981
+ /** The live-transcript state, kept live; null until read. */
982
+ transcription: CallTranscriptionState | null;
983
+ /** Something is capturing the call: a recording or a live transcript. */
984
+ capturing: boolean;
985
+ /**
986
+ * Capture needs everyone's consent: whoever hasn't accepted may not
987
+ * publish (the workspace's or room's `consent: "required"`).
988
+ */
989
+ consentRequired: boolean;
990
+ /** Your answer for this call; `accepted` too when you started the recording. */
991
+ myConsent: ConsentDecision | null;
992
+ /**
993
+ * Show the consent prompt: the call is captured, consent is required
994
+ * and you haven't accepted. Declining keeps it true — you stay
995
+ * listen-only and may change your mind.
996
+ */
997
+ needsConsent: boolean;
998
+ /**
999
+ * How people were told when the recording started here: `spoken` (the
1000
+ * assistant said it aloud) or `banner` (no speech on this server — your
1001
+ * banner is the notice). Null until a start was seen on this screen.
1002
+ */
1003
+ notice: 'spoken' | 'banner' | null;
1004
+ /** The latest recording of this call seen in an event (its `status` moves to `ready` or `failed`). */
1005
+ lastRecording: Recording | null;
1006
+ /** A start, stop or consent request is in flight. */
1007
+ pending: boolean;
1008
+ /** The last request's failure (`ApiError.code`: `not_allowed`, `egress_failed`, …), cleared by the next. */
1009
+ error: Error | null;
1010
+ /** Start recording (`mode` defaults to the room's). Resolves false on failure (see `error`). */
1011
+ start: (mode?: RecordingMode) => Promise<boolean>;
1012
+ stop: () => Promise<boolean>;
1013
+ /**
1014
+ * Answer the consent prompt. After `accepted`, the SFU lets you publish
1015
+ * again: `CallRoom` republishes by itself (or use `useCallRoom().republish`).
1016
+ */
1017
+ consent: (decision: ConsentDecision) => Promise<boolean>;
1018
+ /** Re-read the call snapshot. */
1019
+ refresh: () => void;
1020
+ }
1021
+ /**
1022
+ * A call's recording and consent state, with the actions — what a Record
1023
+ * button, a "Recording" banner and a consent prompt need. Reads the call
1024
+ * snapshot on mount (so a late joiner sees it at once) and after every
1025
+ * reconnect, then follows `recording:*` / `transcript:*` events.
1026
+ *
1027
+ * const rec = useRecording(call.id, call.conversation_id);
1028
+ * {rec.active && <RecordingBanner … />}
1029
+ * {rec.needsConsent && <ConsentPrompt onAnswer={rec.consent} />}
1030
+ *
1031
+ * Pass `initial` (e.g. `useLiveCall().call`) to skip the first read.
1032
+ */
1033
+ declare function useRecording(callId: string | null, conversationId: string | null, initial?: {
1034
+ id: string;
1035
+ recording?: CallRecordingState;
1036
+ transcription?: CallTranscriptionState;
1037
+ } | null): UseRecording;
1038
+
1039
+ interface UseLiveTranscriptOptions {
1040
+ /** Open the transcript topic. Defaults to true; false leaves it (e.g. the panel is closed). */
1041
+ enabled?: boolean;
1042
+ /** How many final segments to keep. Defaults to 1000. */
1043
+ maxSegments?: number;
1044
+ }
1045
+ interface UseLiveTranscript {
1046
+ /** Final segments in time order, then each speaker's interim one. */
1047
+ segments: LiveTranscriptSegment[];
1048
+ /** Only the final segments. */
1049
+ finals: LiveTranscriptSegment[];
1050
+ /** The speakers' current interim segments (still talking). */
1051
+ interim: LiveTranscriptSegment[];
1052
+ /** The transcript, once one exists for the call (kept live by `transcript:*` events). */
1053
+ transcript: Transcript | null;
1054
+ /** Transcription is running now. */
1055
+ live: boolean;
1056
+ /** The topic is joined and the catch-up has arrived. */
1057
+ joined: boolean;
1058
+ /** The join was refused (`forbidden`, `not_found`), or a start/stop failed. */
1059
+ error: Error | null;
1060
+ pending: boolean;
1061
+ /**
1062
+ * Start (or resume) transcription — someone in the call. Errors:
1063
+ * `not_in_call`, `transcription_disabled`, `transcription_unavailable`.
1064
+ */
1065
+ start: () => Promise<boolean>;
1066
+ stop: () => Promise<boolean>;
1067
+ }
1068
+ /**
1069
+ * A call's live transcript: joins `transcript:<call_id>` (opening the
1070
+ * transcript — only those who do get the stream), takes the last 200
1071
+ * final segments as catch-up, then folds in each pushed segment, an
1072
+ * interim one replacing the speaker's previous interim. Re-syncs on
1073
+ * every rejoin. `start` / `stop` switch transcription itself on and off.
1074
+ */
1075
+ declare function useLiveTranscript(callId: string | null, opts?: UseLiveTranscriptOptions): UseLiveTranscript;
1076
+
1077
+ interface UseTranscript {
1078
+ /** The transcript with speakers and segments; null while loading or when there is none. */
1079
+ transcript: TranscriptWithSegments | null;
1080
+ loading: boolean;
1081
+ /** The call was never transcribed (`not_found`). */
1082
+ missing: boolean;
1083
+ error: Error | null;
1084
+ /**
1085
+ * Correct speaker names: key → name, or null to put back the person's
1086
+ * own. For someone who took part in the call or the conversation's
1087
+ * owners and admins — otherwise rejects with `ApiError` `forbidden`.
1088
+ */
1089
+ renameSpeakers: (names: Record<string, string | null>) => Promise<void>;
1090
+ refresh: () => void;
1091
+ }
1092
+ /**
1093
+ * A call's stored transcript (`GET /v1/calls/:id/transcript`), for a
1094
+ * viewer: speakers, every segment, speaker renames — kept live by
1095
+ * `transcript:speakers` (someone else renaming) and re-read on
1096
+ * `transcript:ready` (the call ended and the transcript is complete).
1097
+ */
1098
+ declare function useTranscript(callId: string | null): UseTranscript;
1099
+ interface UseCaptureList<T> {
1100
+ items: T[];
1101
+ loading: boolean;
1102
+ error: Error | null;
1103
+ refresh: () => void;
1104
+ }
1105
+ /** A conversation's transcripts, newest first (no segments) — re-read when one becomes ready. */
1106
+ declare function useTranscripts(conversationId: string | null, opts?: {
1107
+ limit?: number;
1108
+ }): UseCaptureList<Transcript>;
1109
+ /**
1110
+ * A conversation's recordings, newest first — re-read as one starts and
1111
+ * finishes. Play or save one with `poolse.calls.recording.downloadUrl(id)`.
1112
+ */
1113
+ declare function useRecordings(conversationId: string | null, opts?: {
1114
+ limit?: number;
1115
+ }): UseCaptureList<Recording>;
1116
+
1117
+ interface CaptureState {
1118
+ recording: CallRecordingState | null;
1119
+ transcription: CallTranscriptionState | null;
1120
+ }
1121
+ type CaptureEvent = {
1122
+ type: 'recording:started';
1123
+ evt: RecordingStartedEvent;
1124
+ } | {
1125
+ type: 'recording:stopped';
1126
+ evt: RecordingChangedEvent;
1127
+ } | {
1128
+ type: 'recording:ready';
1129
+ evt: RecordingChangedEvent;
1130
+ } | {
1131
+ type: 'recording:consent';
1132
+ evt: RecordingConsentEvent;
1133
+ } | {
1134
+ type: 'transcript:changed';
1135
+ evt: TranscriptChangedEvent;
1136
+ };
1137
+ /** The capture state after one event (pure). */
1138
+ declare function applyCaptureEvent(state: CaptureState, e: CaptureEvent): CaptureState;
1139
+
956
1140
  interface UseReadReceipts {
957
1141
  /**
958
1142
  * Whether this user sees other people's read state. False → show no
@@ -992,4 +1176,4 @@ declare function canEditOwnMessage(args: {
992
1176
  now?: number;
993
1177
  }): boolean;
994
1178
 
995
- export { type ConversationSearchOptions, EDIT_WINDOW_MS, type GroupPosition, type MessageStream, PoolseProvider, type PoolseProviderProps, type ReactionMap, type UploadItem, type UploadItemStatus, type UseCallRoom, type UseCallRoomOptions, type UseLiveCall, type UseOutbox, type UseReadReceipts, type UseRoom, type UseRoomOptions, type UseUnreadQueue, type UseUnreadQueueOptions, type UseUnreadTotals, type UseUserState, canEditOwnMessage, computeGroupPosition, filterConversations, formatDayLabel, orderUnread, receiptsOf, sameDay, sameGroup, useAppEvent, useAttachmentUpload, useAttachmentUrl, useCallRoom, useClientTimings, useConversation, useConversationPresence, useConversations, useLiveCall, useMe, useMembers, useMessageStreams, useMessages, useOutbox, usePoolse, usePresence, usePresenceMany, useReactions, useReadReceipts, useRealtimeStatus, useRoom, useThread, useTyping, useUnreadQueue, useUnreadTotals, useUser, useUserPresence };
1179
+ export { type CaptureEvent, type CaptureState, type ConversationSearchOptions, EDIT_WINDOW_MS, type GroupPosition, type MessageStream, PoolseProvider, type PoolseProviderProps, type ReactionMap, type UploadItem, type UploadItemStatus, type UseCallRoom, type UseCallRoomOptions, type UseCaptureList, type UseLiveCall, type UseLiveTranscript, type UseLiveTranscriptOptions, type UseOutbox, type UseReadReceipts, type UseRecording, type UseRoom, type UseRoomOptions, type UseTranscript, type UseUnreadQueue, type UseUnreadQueueOptions, type UseUnreadTotals, type UseUserState, applyCaptureEvent, canEditOwnMessage, computeGroupPosition, filterConversations, formatDayLabel, orderUnread, receiptsOf, sameDay, sameGroup, useAppEvent, useAttachmentUpload, useAttachmentUrl, useCallRoom, useClientTimings, useConversation, useConversationPresence, useConversations, useLiveCall, useLiveTranscript, useMe, useMembers, useMessageStreams, useMessages, useOutbox, usePoolse, usePresence, usePresenceMany, useReactions, useReadReceipts, useRealtimeStatus, useRecording, useRecordings, useRoom, useThread, useTranscript, useTranscripts, useTyping, useUnreadQueue, useUnreadTotals, useUser, useUserPresence };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Poolse, PoolseConfig, TrackActivityOptions, Conversation, Uuid, UnreadTotals, OutboxEntry, Me, ConversationCreateRequest, Membership, MemberRole, Message, MessageCreateRequest, Presence, RealtimeStatus, Attachment, AttachmentUploadInput, PoolseUserProfile, AppEvent, CallRoomStatus, CallParticipant, CameraFacing, CallDeviceKind, CallDevice, LiveKitModule, LiveCall } from '@poolse/sdk';
3
- export { ApiError, ApiErrorCode, AppEvent, Attachment, AttachmentStatus, AttachmentUploadInput, AttachmentUploadRequest, AttachmentUploadResponse, AuthError, CallEndReason, CallLog, CallLogDisplay, CallLogEntry, CallLogMedia, CallMissedEntry, CallParticipantStatus, Conversation, ConversationCreateRequest, ConversationReadEvent, DestroyOptions, DeviceKind, LinkPreview, LinkPreviewType, LiveCall, LiveCallMember, LocalMessageStatus, Me, MemberRole, Membership, Message, MessageCreateRequest, MessageDiscardedError, MessageEdit, MessageEditList, MessageQueuedError, MessageType, MessageUpdateRequest, NetworkError, NotificationPreferences, NotifyLevel, OutboxEntry, OwnMembership, OwnMembershipUpdateRequest, Poolse, PoolseConfig, PoolseError, PoolseStorage, PoolseUserProfile, Presence, PresenceActivity, PresenceChangedEvent, PresenceState, RateLimitedError, ReadReceiptsState, RealtimeStatus, RoomSession, ThreadParticipant, ThreadUpdatedEvent, TimingEvent, TrackActivityOptions, UnreadSummary, UnreadTotals, Uuid, callLogDisplayFor, createIndexedDbStorage, describeCallLog, formatCallDuration, formatCallLogPreview, isCallLogMessage, isMessageVisibleTo, isTombstone, memoryStorage, mergeMessage, parseCallLog, parseCallLogBody, toTombstone } from '@poolse/sdk';
2
+ import { Poolse, PoolseConfig, TrackActivityOptions, Conversation, Uuid, UnreadTotals, OutboxEntry, Me, ConversationCreateRequest, Membership, MemberRole, Message, MessageCreateRequest, Presence, RealtimeStatus, Attachment, AttachmentUploadInput, PoolseUserProfile, AppEvent, CallRoomStatus, CallParticipant, CameraFacing, CallDeviceKind, CallDevice, LiveKitModule, LiveCall, CallRecordingState, CallTranscriptionState, ConsentDecision, Recording, RecordingMode, LiveTranscriptSegment, Transcript, TranscriptWithSegments, RecordingStartedEvent, RecordingChangedEvent, RecordingConsentEvent, TranscriptChangedEvent } from '@poolse/sdk';
3
+ export { ApiError, ApiErrorCode, AppEvent, Attachment, AttachmentStatus, AttachmentUploadInput, AttachmentUploadRequest, AttachmentUploadResponse, AuthError, CallEndReason, CallLog, CallLogDisplay, CallLogEntry, CallLogMedia, CallMissedEntry, CallParticipantStatus, CallRecordingState, CallTranscriptionState, ConsentDecision, Conversation, ConversationCreateRequest, ConversationReadEvent, ConversationRecordingSettings, DestroyOptions, DeviceKind, LinkPreview, LinkPreviewType, LiveCall, LiveCallMember, LiveTranscriptSegment, LocalMessageStatus, Me, MemberRole, Membership, Message, MessageCreateRequest, MessageDiscardedError, MessageEdit, MessageEditList, MessageQueuedError, MessageType, MessageUpdateRequest, NetworkError, NotificationPreferences, NotifyLevel, OutboxEntry, OwnMembership, OwnMembershipUpdateRequest, POOLSE_SERVICE_IDENTITY_PREFIX, Poolse, PoolseConfig, PoolseError, PoolseStorage, PoolseUserProfile, Presence, PresenceActivity, PresenceChangedEvent, PresenceState, RateLimitedError, ReadReceiptsState, RealtimeStatus, Recording, RecordingDownload, RecordingMode, RecordingNotice, RecordingNoticeDisplay, RecordingStatus, RoomSession, ThreadParticipant, ThreadUpdatedEvent, TimingEvent, TrackActivityOptions, Transcript, TranscriptBlock, TranscriptSegment, TranscriptSpeaker, TranscriptWithSegments, UnreadSummary, UnreadTotals, Uuid, applyLiveSegment, callLogDisplayFor, captureErrorMessage, captureLabel, createIndexedDbStorage, describeCallLog, describeRecordingNotice, findInText, formatCallDuration, formatCallLogPreview, formatRecordingNoticePreview, groupTranscript, isCallLogMessage, isMessageVisibleTo, isServiceParticipant, isTombstone, memoryStorage, mergeMessage, parseCallLog, parseCallLogBody, parseRecordingNotice, parseRecordingNoticeBody, recordingNoticeDisplayFor, speakerName, toTombstone } from '@poolse/sdk';
4
4
  import { ReactNode } from 'react';
5
5
 
6
6
  interface PoolseProviderProps {
@@ -793,6 +793,12 @@ interface UseCallRoomOptions {
793
793
  * Pass `0` to never report it.
794
794
  */
795
795
  aloneGraceMs?: number;
796
+ /**
797
+ * Bring the microphone and camera back by themselves when publish
798
+ * permission returns (after accepting recording consent). Defaults to
799
+ * true; false: call `republish` yourself.
800
+ */
801
+ republishOnPermission?: boolean;
796
802
  }
797
803
  interface UseCallRoom {
798
804
  status: CallRoomStatus;
@@ -874,6 +880,18 @@ interface UseCallRoom {
874
880
  /** Share a screen (the platform's picker opens) or stop sharing. */
875
881
  setScreenShareEnabled: (enabled: boolean) => Promise<void>;
876
882
  toggleScreenShare: () => Promise<void>;
883
+ /**
884
+ * The SFU lets you publish. False while the call is recorded or
885
+ * transcribed under `consent: "required"` and you haven't accepted —
886
+ * show the consent prompt; you still hear and see everyone.
887
+ */
888
+ canPublish: boolean;
889
+ /**
890
+ * Turn the microphone and camera back on as you last had them. Done
891
+ * for you when publish permission returns unless
892
+ * `republishOnPermission: false`.
893
+ */
894
+ republish: () => Promise<void>;
877
895
  }
878
896
  /**
879
897
  * A call's media, carried by the SFU.
@@ -953,6 +971,172 @@ interface UseRoom {
953
971
  */
954
972
  declare function useRoom(conversationId: string | null, opts: UseRoomOptions): UseRoom;
955
973
 
974
+ interface UseRecording {
975
+ /** This server can record (LiveKit Egress). False: hide the Record button. */
976
+ available: boolean;
977
+ /** The call is being recorded right now. */
978
+ active: boolean;
979
+ /** The snapshot's recording state, kept live; null until read. */
980
+ recording: CallRecordingState | null;
981
+ /** The live-transcript state, kept live; null until read. */
982
+ transcription: CallTranscriptionState | null;
983
+ /** Something is capturing the call: a recording or a live transcript. */
984
+ capturing: boolean;
985
+ /**
986
+ * Capture needs everyone's consent: whoever hasn't accepted may not
987
+ * publish (the workspace's or room's `consent: "required"`).
988
+ */
989
+ consentRequired: boolean;
990
+ /** Your answer for this call; `accepted` too when you started the recording. */
991
+ myConsent: ConsentDecision | null;
992
+ /**
993
+ * Show the consent prompt: the call is captured, consent is required
994
+ * and you haven't accepted. Declining keeps it true — you stay
995
+ * listen-only and may change your mind.
996
+ */
997
+ needsConsent: boolean;
998
+ /**
999
+ * How people were told when the recording started here: `spoken` (the
1000
+ * assistant said it aloud) or `banner` (no speech on this server — your
1001
+ * banner is the notice). Null until a start was seen on this screen.
1002
+ */
1003
+ notice: 'spoken' | 'banner' | null;
1004
+ /** The latest recording of this call seen in an event (its `status` moves to `ready` or `failed`). */
1005
+ lastRecording: Recording | null;
1006
+ /** A start, stop or consent request is in flight. */
1007
+ pending: boolean;
1008
+ /** The last request's failure (`ApiError.code`: `not_allowed`, `egress_failed`, …), cleared by the next. */
1009
+ error: Error | null;
1010
+ /** Start recording (`mode` defaults to the room's). Resolves false on failure (see `error`). */
1011
+ start: (mode?: RecordingMode) => Promise<boolean>;
1012
+ stop: () => Promise<boolean>;
1013
+ /**
1014
+ * Answer the consent prompt. After `accepted`, the SFU lets you publish
1015
+ * again: `CallRoom` republishes by itself (or use `useCallRoom().republish`).
1016
+ */
1017
+ consent: (decision: ConsentDecision) => Promise<boolean>;
1018
+ /** Re-read the call snapshot. */
1019
+ refresh: () => void;
1020
+ }
1021
+ /**
1022
+ * A call's recording and consent state, with the actions — what a Record
1023
+ * button, a "Recording" banner and a consent prompt need. Reads the call
1024
+ * snapshot on mount (so a late joiner sees it at once) and after every
1025
+ * reconnect, then follows `recording:*` / `transcript:*` events.
1026
+ *
1027
+ * const rec = useRecording(call.id, call.conversation_id);
1028
+ * {rec.active && <RecordingBanner … />}
1029
+ * {rec.needsConsent && <ConsentPrompt onAnswer={rec.consent} />}
1030
+ *
1031
+ * Pass `initial` (e.g. `useLiveCall().call`) to skip the first read.
1032
+ */
1033
+ declare function useRecording(callId: string | null, conversationId: string | null, initial?: {
1034
+ id: string;
1035
+ recording?: CallRecordingState;
1036
+ transcription?: CallTranscriptionState;
1037
+ } | null): UseRecording;
1038
+
1039
+ interface UseLiveTranscriptOptions {
1040
+ /** Open the transcript topic. Defaults to true; false leaves it (e.g. the panel is closed). */
1041
+ enabled?: boolean;
1042
+ /** How many final segments to keep. Defaults to 1000. */
1043
+ maxSegments?: number;
1044
+ }
1045
+ interface UseLiveTranscript {
1046
+ /** Final segments in time order, then each speaker's interim one. */
1047
+ segments: LiveTranscriptSegment[];
1048
+ /** Only the final segments. */
1049
+ finals: LiveTranscriptSegment[];
1050
+ /** The speakers' current interim segments (still talking). */
1051
+ interim: LiveTranscriptSegment[];
1052
+ /** The transcript, once one exists for the call (kept live by `transcript:*` events). */
1053
+ transcript: Transcript | null;
1054
+ /** Transcription is running now. */
1055
+ live: boolean;
1056
+ /** The topic is joined and the catch-up has arrived. */
1057
+ joined: boolean;
1058
+ /** The join was refused (`forbidden`, `not_found`), or a start/stop failed. */
1059
+ error: Error | null;
1060
+ pending: boolean;
1061
+ /**
1062
+ * Start (or resume) transcription — someone in the call. Errors:
1063
+ * `not_in_call`, `transcription_disabled`, `transcription_unavailable`.
1064
+ */
1065
+ start: () => Promise<boolean>;
1066
+ stop: () => Promise<boolean>;
1067
+ }
1068
+ /**
1069
+ * A call's live transcript: joins `transcript:<call_id>` (opening the
1070
+ * transcript — only those who do get the stream), takes the last 200
1071
+ * final segments as catch-up, then folds in each pushed segment, an
1072
+ * interim one replacing the speaker's previous interim. Re-syncs on
1073
+ * every rejoin. `start` / `stop` switch transcription itself on and off.
1074
+ */
1075
+ declare function useLiveTranscript(callId: string | null, opts?: UseLiveTranscriptOptions): UseLiveTranscript;
1076
+
1077
+ interface UseTranscript {
1078
+ /** The transcript with speakers and segments; null while loading or when there is none. */
1079
+ transcript: TranscriptWithSegments | null;
1080
+ loading: boolean;
1081
+ /** The call was never transcribed (`not_found`). */
1082
+ missing: boolean;
1083
+ error: Error | null;
1084
+ /**
1085
+ * Correct speaker names: key → name, or null to put back the person's
1086
+ * own. For someone who took part in the call or the conversation's
1087
+ * owners and admins — otherwise rejects with `ApiError` `forbidden`.
1088
+ */
1089
+ renameSpeakers: (names: Record<string, string | null>) => Promise<void>;
1090
+ refresh: () => void;
1091
+ }
1092
+ /**
1093
+ * A call's stored transcript (`GET /v1/calls/:id/transcript`), for a
1094
+ * viewer: speakers, every segment, speaker renames — kept live by
1095
+ * `transcript:speakers` (someone else renaming) and re-read on
1096
+ * `transcript:ready` (the call ended and the transcript is complete).
1097
+ */
1098
+ declare function useTranscript(callId: string | null): UseTranscript;
1099
+ interface UseCaptureList<T> {
1100
+ items: T[];
1101
+ loading: boolean;
1102
+ error: Error | null;
1103
+ refresh: () => void;
1104
+ }
1105
+ /** A conversation's transcripts, newest first (no segments) — re-read when one becomes ready. */
1106
+ declare function useTranscripts(conversationId: string | null, opts?: {
1107
+ limit?: number;
1108
+ }): UseCaptureList<Transcript>;
1109
+ /**
1110
+ * A conversation's recordings, newest first — re-read as one starts and
1111
+ * finishes. Play or save one with `poolse.calls.recording.downloadUrl(id)`.
1112
+ */
1113
+ declare function useRecordings(conversationId: string | null, opts?: {
1114
+ limit?: number;
1115
+ }): UseCaptureList<Recording>;
1116
+
1117
+ interface CaptureState {
1118
+ recording: CallRecordingState | null;
1119
+ transcription: CallTranscriptionState | null;
1120
+ }
1121
+ type CaptureEvent = {
1122
+ type: 'recording:started';
1123
+ evt: RecordingStartedEvent;
1124
+ } | {
1125
+ type: 'recording:stopped';
1126
+ evt: RecordingChangedEvent;
1127
+ } | {
1128
+ type: 'recording:ready';
1129
+ evt: RecordingChangedEvent;
1130
+ } | {
1131
+ type: 'recording:consent';
1132
+ evt: RecordingConsentEvent;
1133
+ } | {
1134
+ type: 'transcript:changed';
1135
+ evt: TranscriptChangedEvent;
1136
+ };
1137
+ /** The capture state after one event (pure). */
1138
+ declare function applyCaptureEvent(state: CaptureState, e: CaptureEvent): CaptureState;
1139
+
956
1140
  interface UseReadReceipts {
957
1141
  /**
958
1142
  * Whether this user sees other people's read state. False → show no
@@ -992,4 +1176,4 @@ declare function canEditOwnMessage(args: {
992
1176
  now?: number;
993
1177
  }): boolean;
994
1178
 
995
- export { type ConversationSearchOptions, EDIT_WINDOW_MS, type GroupPosition, type MessageStream, PoolseProvider, type PoolseProviderProps, type ReactionMap, type UploadItem, type UploadItemStatus, type UseCallRoom, type UseCallRoomOptions, type UseLiveCall, type UseOutbox, type UseReadReceipts, type UseRoom, type UseRoomOptions, type UseUnreadQueue, type UseUnreadQueueOptions, type UseUnreadTotals, type UseUserState, canEditOwnMessage, computeGroupPosition, filterConversations, formatDayLabel, orderUnread, receiptsOf, sameDay, sameGroup, useAppEvent, useAttachmentUpload, useAttachmentUrl, useCallRoom, useClientTimings, useConversation, useConversationPresence, useConversations, useLiveCall, useMe, useMembers, useMessageStreams, useMessages, useOutbox, usePoolse, usePresence, usePresenceMany, useReactions, useReadReceipts, useRealtimeStatus, useRoom, useThread, useTyping, useUnreadQueue, useUnreadTotals, useUser, useUserPresence };
1179
+ export { type CaptureEvent, type CaptureState, type ConversationSearchOptions, EDIT_WINDOW_MS, type GroupPosition, type MessageStream, PoolseProvider, type PoolseProviderProps, type ReactionMap, type UploadItem, type UploadItemStatus, type UseCallRoom, type UseCallRoomOptions, type UseCaptureList, type UseLiveCall, type UseLiveTranscript, type UseLiveTranscriptOptions, type UseOutbox, type UseReadReceipts, type UseRecording, type UseRoom, type UseRoomOptions, type UseTranscript, type UseUnreadQueue, type UseUnreadQueueOptions, type UseUnreadTotals, type UseUserState, applyCaptureEvent, canEditOwnMessage, computeGroupPosition, filterConversations, formatDayLabel, orderUnread, receiptsOf, sameDay, sameGroup, useAppEvent, useAttachmentUpload, useAttachmentUrl, useCallRoom, useClientTimings, useConversation, useConversationPresence, useConversations, useLiveCall, useLiveTranscript, useMe, useMembers, useMessageStreams, useMessages, useOutbox, usePoolse, usePresence, usePresenceMany, useReactions, useReadReceipts, useRealtimeStatus, useRecording, useRecordings, useRoom, useThread, useTranscript, useTranscripts, useTyping, useUnreadQueue, useUnreadTotals, useUser, useUserPresence };