@usecrow/ui 0.1.57 → 0.1.59

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
@@ -720,7 +720,7 @@ interface UseConversationsOptions {
720
720
  declare function useConversations({ productId, apiUrl }: UseConversationsOptions): {
721
721
  conversations: Conversation[];
722
722
  isLoadingHistory: boolean;
723
- loadConversations: () => Promise<void>;
723
+ loadConversations: () => Promise<Conversation[]>;
724
724
  loadConversationHistory: (conversationId: string) => Promise<Message[]>;
725
725
  loadAnonymousConversationHistory: (conversationId: string) => Promise<Message[]>;
726
726
  };
@@ -761,50 +761,26 @@ declare function useCrowAPI({ onIdentified, onReset }?: UseCrowAPIOptions): {
761
761
  };
762
762
 
763
763
  /**
764
- * useVoiceInput - Browser speech-to-text via Web Speech API
764
+ * useVoiceInput - Speech-to-text via Gradium STT WebSocket
765
765
  *
766
- * Returns recording state, transcript, and controls.
767
- * Hides itself (supported=false) when the browser lacks SpeechRecognition.
766
+ * Uses MediaRecorder API (works on all browsers including mobile Safari)
767
+ * and streams audio to backend WebSocket proxy for Gradium STT.
768
768
  */
769
- interface SpeechRecognitionEvent {
770
- results: SpeechRecognitionResultList;
771
- resultIndex: number;
772
- }
773
- interface SpeechRecognitionErrorEvent {
774
- error: string;
775
- message?: string;
776
- }
777
- interface SpeechRecognitionInstance extends EventTarget {
778
- continuous: boolean;
779
- interimResults: boolean;
780
- lang: string;
781
- start(): void;
782
- stop(): void;
783
- abort(): void;
784
- onresult: ((event: SpeechRecognitionEvent) => void) | null;
785
- onerror: ((event: SpeechRecognitionErrorEvent) => void) | null;
786
- onend: (() => void) | null;
787
- onspeechend: (() => void) | null;
788
- }
789
- declare global {
790
- interface Window {
791
- SpeechRecognition?: new () => SpeechRecognitionInstance;
792
- webkitSpeechRecognition?: new () => SpeechRecognitionInstance;
793
- }
794
- }
795
769
  interface UseVoiceInputOptions {
796
- /** Language for recognition (default: browser language or "en-US") */
797
- lang?: string;
798
- /** Auto-submit after silence. If set, calls onTranscript with final text after this many ms of silence. */
770
+ /** Backend URL for WebSocket connection (e.g., "ws://localhost:8000" or "wss://api.example.com") */
771
+ backendUrl: string;
772
+ /** Auto-submit after silence. If set, stops recording after this many ms of silence. */
799
773
  silenceTimeoutMs?: number;
800
774
  }
801
775
  interface UseVoiceInputReturn {
802
- /** Whether the browser supports speech recognition */
776
+ /** Whether the browser supports audio recording (MediaRecorder API) */
803
777
  supported: boolean;
804
778
  /** Whether currently recording */
805
779
  isRecording: boolean;
806
- /** Current transcript (includes interim results while recording) */
780
+ /** Current transcript (accumulated final results) */
807
781
  transcript: string;
782
+ /** Error message if any */
783
+ error: string | null;
808
784
  /** Start recording */
809
785
  start: () => void;
810
786
  /** Stop recording and finalize transcript */
@@ -814,7 +790,7 @@ interface UseVoiceInputReturn {
814
790
  /** Clear the transcript */
815
791
  clear: () => void;
816
792
  }
817
- declare function useVoiceInput(options?: UseVoiceInputOptions): UseVoiceInputReturn;
793
+ declare function useVoiceInput(options: UseVoiceInputOptions): UseVoiceInputReturn;
818
794
 
819
795
  /**
820
796
  * useWidgetStyles Hook
@@ -1144,6 +1120,10 @@ interface PromptInputBoxProps {
1144
1120
  availableModels?: Model[];
1145
1121
  /** When true, adds a pulsing highlight effect to indicate user input is needed */
1146
1122
  highlighted?: boolean;
1123
+ /** Backend URL for voice input WebSocket (required for voice input to work) */
1124
+ backendUrl?: string;
1125
+ /** When this value changes (and is > 0), start voice recording */
1126
+ triggerVoiceRecording?: number;
1147
1127
  }
1148
1128
  declare const PromptInputBox: react__default.ForwardRefExoticComponent<PromptInputBoxProps & react__default.RefAttributes<HTMLDivElement>>;
1149
1129
 
package/dist/index.d.ts CHANGED
@@ -720,7 +720,7 @@ interface UseConversationsOptions {
720
720
  declare function useConversations({ productId, apiUrl }: UseConversationsOptions): {
721
721
  conversations: Conversation[];
722
722
  isLoadingHistory: boolean;
723
- loadConversations: () => Promise<void>;
723
+ loadConversations: () => Promise<Conversation[]>;
724
724
  loadConversationHistory: (conversationId: string) => Promise<Message[]>;
725
725
  loadAnonymousConversationHistory: (conversationId: string) => Promise<Message[]>;
726
726
  };
@@ -761,50 +761,26 @@ declare function useCrowAPI({ onIdentified, onReset }?: UseCrowAPIOptions): {
761
761
  };
762
762
 
763
763
  /**
764
- * useVoiceInput - Browser speech-to-text via Web Speech API
764
+ * useVoiceInput - Speech-to-text via Gradium STT WebSocket
765
765
  *
766
- * Returns recording state, transcript, and controls.
767
- * Hides itself (supported=false) when the browser lacks SpeechRecognition.
766
+ * Uses MediaRecorder API (works on all browsers including mobile Safari)
767
+ * and streams audio to backend WebSocket proxy for Gradium STT.
768
768
  */
769
- interface SpeechRecognitionEvent {
770
- results: SpeechRecognitionResultList;
771
- resultIndex: number;
772
- }
773
- interface SpeechRecognitionErrorEvent {
774
- error: string;
775
- message?: string;
776
- }
777
- interface SpeechRecognitionInstance extends EventTarget {
778
- continuous: boolean;
779
- interimResults: boolean;
780
- lang: string;
781
- start(): void;
782
- stop(): void;
783
- abort(): void;
784
- onresult: ((event: SpeechRecognitionEvent) => void) | null;
785
- onerror: ((event: SpeechRecognitionErrorEvent) => void) | null;
786
- onend: (() => void) | null;
787
- onspeechend: (() => void) | null;
788
- }
789
- declare global {
790
- interface Window {
791
- SpeechRecognition?: new () => SpeechRecognitionInstance;
792
- webkitSpeechRecognition?: new () => SpeechRecognitionInstance;
793
- }
794
- }
795
769
  interface UseVoiceInputOptions {
796
- /** Language for recognition (default: browser language or "en-US") */
797
- lang?: string;
798
- /** Auto-submit after silence. If set, calls onTranscript with final text after this many ms of silence. */
770
+ /** Backend URL for WebSocket connection (e.g., "ws://localhost:8000" or "wss://api.example.com") */
771
+ backendUrl: string;
772
+ /** Auto-submit after silence. If set, stops recording after this many ms of silence. */
799
773
  silenceTimeoutMs?: number;
800
774
  }
801
775
  interface UseVoiceInputReturn {
802
- /** Whether the browser supports speech recognition */
776
+ /** Whether the browser supports audio recording (MediaRecorder API) */
803
777
  supported: boolean;
804
778
  /** Whether currently recording */
805
779
  isRecording: boolean;
806
- /** Current transcript (includes interim results while recording) */
780
+ /** Current transcript (accumulated final results) */
807
781
  transcript: string;
782
+ /** Error message if any */
783
+ error: string | null;
808
784
  /** Start recording */
809
785
  start: () => void;
810
786
  /** Stop recording and finalize transcript */
@@ -814,7 +790,7 @@ interface UseVoiceInputReturn {
814
790
  /** Clear the transcript */
815
791
  clear: () => void;
816
792
  }
817
- declare function useVoiceInput(options?: UseVoiceInputOptions): UseVoiceInputReturn;
793
+ declare function useVoiceInput(options: UseVoiceInputOptions): UseVoiceInputReturn;
818
794
 
819
795
  /**
820
796
  * useWidgetStyles Hook
@@ -1144,6 +1120,10 @@ interface PromptInputBoxProps {
1144
1120
  availableModels?: Model[];
1145
1121
  /** When true, adds a pulsing highlight effect to indicate user input is needed */
1146
1122
  highlighted?: boolean;
1123
+ /** Backend URL for voice input WebSocket (required for voice input to work) */
1124
+ backendUrl?: string;
1125
+ /** When this value changes (and is > 0), start voice recording */
1126
+ triggerVoiceRecording?: number;
1147
1127
  }
1148
1128
  declare const PromptInputBox: react__default.ForwardRefExoticComponent<PromptInputBoxProps & react__default.RefAttributes<HTMLDivElement>>;
1149
1129