interview-widget 3.1.6 → 3.1.9

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.
@@ -22,6 +22,7 @@ interface InterviewContentProps {
22
22
  onAnswerChange?: ((e: React.ChangeEvent<HTMLTextAreaElement>) => void) | undefined;
23
23
  editingTime?: number | undefined;
24
24
  answeringTime?: number | undefined;
25
+ disableSubmitButton?: boolean;
25
26
  }
26
27
  export declare const InterviewContent: React.FC<InterviewContentProps>;
27
28
  export {};
@@ -5,6 +5,7 @@ interface Props {
5
5
  answeringTime: number;
6
6
  nextPhase: () => void;
7
7
  sttError: STTError | null;
8
+ disableStopButton?: boolean;
8
9
  }
9
- export declare const AnsweringPhase: ({ state, answeringTime, nextPhase, sttError, }: Props) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const AnsweringPhase: ({ state, answeringTime, nextPhase, sttError, disableStopButton, }: Props) => import("react/jsx-runtime").JSX.Element;
10
11
  export {};
@@ -2,6 +2,7 @@ import { default as React } from 'react';
2
2
  interface SubmitResponseButtonProps {
3
3
  onClick: () => void;
4
4
  text?: string;
5
+ disabled?: boolean;
5
6
  }
6
7
  export declare const SubmitResponseButton: React.FC<SubmitResponseButtonProps>;
7
8
  export {};
@@ -37,8 +37,13 @@ declare class STTService {
37
37
  private config;
38
38
  private mediaRecorder;
39
39
  private audioChunks;
40
+ private audioChunksTotalSize;
40
41
  private recordingStream;
41
42
  private autoStopTimeoutId;
43
+ private disposed;
44
+ private pendingStopPromise;
45
+ private isStarting;
46
+ private recordingStartTime;
42
47
  constructor(config?: STTConfig);
43
48
  /**
44
49
  * Update STT configuration
@@ -49,13 +54,27 @@ declare class STTService {
49
54
  */
50
55
  isRecordingSupported(): boolean;
51
56
  /**
52
- * Start recording audio from user's microphone
57
+ * Start recording audio from user's microphone.
58
+ *
59
+ * Event flow:
60
+ * - onStart fires immediately when recording begins
61
+ * - onStop fires ONLY via the MediaRecorder's stop event (single source of truth)
62
+ * - onError fires on MediaRecorder errors
63
+ * - onDataAvailable fires every 100ms with new audio data
53
64
  */
54
65
  startRecording(maxDuration?: number, events?: RecordingEvents): Promise<void>;
55
66
  /**
56
- * Stop recording and return the audio blob
67
+ * Stop recording and return the audio blob.
57
68
  */
58
69
  stopRecording(): Promise<Blob>;
70
+ /**
71
+ * Handle auto-stop with minimum duration enforcement
72
+ */
73
+ private handleAutoStop;
74
+ /**
75
+ * Execute the actual auto-stop with error handling
76
+ */
77
+ private executeAutoStop;
59
78
  /**
60
79
  * Transcribe audio blob using the STT API
61
80
  */
@@ -68,6 +87,15 @@ declare class STTService {
68
87
  * Check if currently recording
69
88
  */
70
89
  isRecording(): boolean;
90
+ /**
91
+ * Fully dispose of the service instance, releasing all resources.
92
+ * After calling dispose(), the instance cannot be reused.
93
+ */
94
+ dispose(): void;
95
+ /**
96
+ * Check if the service has been disposed
97
+ */
98
+ isDisposed(): boolean;
71
99
  /**
72
100
  * Get supported MIME type for recording
73
101
  */
@@ -80,6 +108,10 @@ declare class STTService {
80
108
  * Clean up recording resources
81
109
  */
82
110
  private cleanup;
111
+ /**
112
+ * Throw if the service has been disposed
113
+ */
114
+ private throwIfDisposed;
83
115
  }
84
116
  export declare const sttService: STTService;
85
117
  export { STTService };
@@ -0,0 +1,24 @@
1
+ export interface AudioRecord {
2
+ id: string;
3
+ interviewId: string;
4
+ qnaId: string;
5
+ audioBlob: Blob;
6
+ mimeType: string;
7
+ savedAt: number;
8
+ }
9
+ /**
10
+ * Save an audio record to IndexedDB
11
+ */
12
+ export declare function saveAudio(record: AudioRecord): Promise<void>;
13
+ /**
14
+ * Retrieve a specific audio record by its ID
15
+ */
16
+ export declare function getAudio(id: string): Promise<AudioRecord | undefined>;
17
+ /**
18
+ * Get all audio records for a specific interview
19
+ */
20
+ export declare function getAllAudio(interviewId: string): Promise<AudioRecord[]>;
21
+ /**
22
+ * Delete a specific audio record by its ID
23
+ */
24
+ export declare function deleteAudio(id: string): Promise<void>;