UNPKG

react-webrtc-phone-dialer

Version:

A modern, floating WebRTC phone dialer component for React applications

52 lines (48 loc) 1.32 kB
import React from 'react'; interface Contact { id: string; name: string; number: string; avatar?: string; } interface CallHistoryItem { id: string; name: string; number: string; type: "incoming" | "outgoing" | "missed"; timestamp: Date; duration: number; } interface ActiveCall { id: string; name: string; number: string; avatar?: string; } interface CallCallbacks { onCall?: (number: string, fromNumber: string) => void; onAnswerCall?: (callId: string) => void; onRejectCall?: (callId: string) => void; onEndCall?: (callId: string) => void; onMute?: (isMuted: boolean) => void; onSpeaker?: (isOn: boolean) => void; onCancelDialing?: (callId: string) => void; } interface PhoneDialerProps { availableNumbers: string[]; activeCall: ActiveCall | null; callStatus: "idle" | "dialing" | "ringing" | "in-call"; contacts?: Contact[]; callHistory?: CallHistoryItem[]; initialPosition?: { x: number; y: number; }; isMinimized?: boolean; callbacks?: CallCallbacks; className?: string; theme?: "light" | "dark"; } declare const PhoneDialer: React.FC<PhoneDialerProps>; export { PhoneDialer }; export type { ActiveCall, CallCallbacks, CallHistoryItem, Contact, PhoneDialerProps };