UNPKG

@voicefeedback/sdk

Version:

Modern voice feedback SDK with beautiful UI components and AI-powered analysis

59 lines (55 loc) 2.01 kB
import React from 'react'; interface VoiceFeedbackConfig { apiKey: string; apiUrl?: string; webhookUrl?: string; language?: string; maxDuration?: number; onStart?: () => void; onStop?: () => void; onComplete?: (result: VoiceFeedbackResult) => void; onError?: (error: Error) => void; debug?: boolean; } interface VoiceFeedbackResult { id: string; transcript: string; sentiment: 'positive' | 'negative' | 'neutral'; sentimentScore: number; topics: string[]; emotions?: string[]; duration: number; language: string; processingTime: number; } interface VoiceFeedbackHookOptions extends Omit<VoiceFeedbackConfig, 'onStart' | 'onStop' | 'onComplete' | 'onError'> { onStart?: () => void; onStop?: () => void; onComplete?: (result: VoiceFeedbackResult) => void; onError?: (error: Error) => void; } interface VoiceFeedbackHookReturn { startRecording: () => Promise<void>; stopRecording: () => void; isRecording: boolean; duration: number; isSupported: boolean; error: Error | null; } declare function useVoiceFeedback(options: VoiceFeedbackHookOptions): VoiceFeedbackHookReturn; interface VoiceFeedbackButtonProps extends VoiceFeedbackHookOptions { children?: React.ReactNode; className?: string; style?: React.CSSProperties; disabled?: boolean; size?: 'small' | 'medium' | 'large'; variant?: 'primary' | 'secondary' | 'minimal' | 'glass'; shape?: 'circle' | 'rounded' | 'square'; showDuration?: boolean; showWaveform?: boolean; recordingText?: string; idleText?: string; } declare function VoiceFeedbackButton({ children, className, style, disabled, size, variant, shape, showDuration, showWaveform, recordingText, idleText, ...hookOptions }: VoiceFeedbackButtonProps): JSX.Element; export { VoiceFeedbackButton, VoiceFeedbackButton as default, useVoiceFeedback }; export type { VoiceFeedbackButtonProps, VoiceFeedbackHookOptions, VoiceFeedbackHookReturn };