@sawport/peers-caller
Version:
WebRTC multi-peer video call library with mesh architecture supporting up to 4 participants
57 lines • 3.15 kB
TypeScript
/**
* Zustand store for managing call state across the PeersCaller library
*/
import type { CallState, CallParticipant, PeersCallerError, CallStatusResponse } from "../types";
interface CallStoreActions {
setConversationId: (conversationId: string) => void;
setLocalParticipant: (participant: CallParticipant) => void;
addParticipant: (participant: CallParticipant) => void;
removeParticipant: (userId: string) => void;
updateParticipant: (userId: string, updates: Partial<CallParticipant>) => void;
clearParticipants: () => void;
setCallStatus: (status: CallState["callStatus"]) => void;
setIsCalling: (isCalling: boolean) => void;
setIsRecording: (isRecording: boolean) => void;
setRecordLoading: (loading: boolean) => void;
setError: (error: PeersCallerError | null, message?: string) => void;
clearError: () => void;
setCallStatusInfo: (statusInfo: CallStatusResponse | null) => void;
setCallStatusLoading: (loading: boolean) => void;
setCallStatusError: (error: string | null) => void;
resetCall: () => void;
}
export type CallStore = CallState & CallStoreActions;
export declare const useCallStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<CallStore>, "setState" | "devtools"> & {
setState(partial: CallStore | Partial<CallStore> | ((state: CallStore) => CallStore | Partial<CallStore>), replace?: false | undefined, action?: (string | {
[x: string]: unknown;
[x: number]: unknown;
[x: symbol]: unknown;
type: string;
}) | undefined): void;
setState(state: CallStore | ((state: CallStore) => CallStore), replace: true, action?: (string | {
[x: string]: unknown;
[x: number]: unknown;
[x: symbol]: unknown;
type: string;
}) | undefined): void;
devtools: {
cleanup: () => void;
};
}>;
export declare const selectParticipants: (state: CallStore) => Record<string, CallParticipant>;
export declare const selectParticipantCount: (state: CallStore) => number;
export declare const selectLocalParticipant: (state: CallStore) => CallParticipant | null;
export declare const selectCallStatus: (state: CallStore) => "idle" | "connecting" | "connected" | "disconnecting" | "failed";
export declare const selectIsConnected: (state: CallStore) => boolean;
export declare const selectError: (state: CallStore) => string | null;
export declare const selectCallStatusInfo: (state: CallStore) => CallStatusResponse | null;
export declare const selectCallStatusLoading: (state: CallStore) => boolean;
export declare const selectCallStatusError: (state: CallStore) => string | null;
export declare const selectCanJoinCall: (state: CallStore) => boolean;
export declare const selectIsCallActive: (state: CallStore) => boolean;
export declare const getParticipant: (userId: string) => CallParticipant;
export declare const isParticipantConnected: (userId: string) => boolean;
export declare const getParticipantList: () => CallParticipant[];
export declare const canAcceptMoreParticipants: (maxParticipants?: number) => boolean;
export {};
//# sourceMappingURL=index.d.ts.map