interview-widget 1.0.0 → 1.0.1
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/README.md +214 -223
- package/dist/assets/alert-triangle-icon.d.ts +1 -0
- package/dist/assets/bot-icon.d.ts +1 -0
- package/dist/assets/circle-play-icon.d.ts +1 -0
- package/dist/assets/clock-fading-icon.d.ts +1 -0
- package/dist/assets/clock-icon.d.ts +1 -0
- package/dist/assets/eye-icon.d.ts +1 -0
- package/dist/assets/focus-icon.d.ts +1 -0
- package/dist/assets/index.d.ts +12 -0
- package/dist/assets/keyboard-icon.d.ts +1 -0
- package/dist/assets/loader-icon.d.ts +1 -0
- package/dist/assets/monitor-icon.d.ts +1 -0
- package/dist/assets/mouse-pointer-click-icon.d.ts +1 -0
- package/dist/assets/shield-icon.d.ts +2 -0
- package/dist/assets/speak-icon.d.ts +1 -0
- package/dist/components/interview/answer-area.d.ts +12 -0
- package/dist/components/interview/interview-content.d.ts +11 -0
- package/dist/components/interview/interview-controller.d.ts +10 -0
- package/dist/components/interview/interview-header.d.ts +7 -0
- package/dist/components/interview/phases/animated-blob.d.ts +13 -0
- package/dist/components/interview/phases/answering-phase.d.ts +10 -0
- package/dist/components/interview/phases/file-generation-animation.d.ts +1 -0
- package/dist/components/interview/phases/interview-completion-modal.d.ts +7 -0
- package/dist/components/interview/phases/question-reading-animation.d.ts +5 -0
- package/dist/components/interview/phases/thinking-phase.d.ts +8 -0
- package/dist/components/interview/phases/transcription-animation.d.ts +6 -0
- package/dist/components/interview/proctoring/cheating-warning-modal.d.ts +10 -0
- package/dist/components/interview/proctoring/interview-proctoring.d.ts +6 -0
- package/dist/components/interview/question-display.d.ts +9 -0
- package/dist/components/media/audio-wave-visualizer.d.ts +14 -0
- package/dist/components/media/video-feed.d.ts +6 -0
- package/dist/components/modals/exit-confirmation-modal.d.ts +7 -0
- package/dist/components/modals/hard-reload-warning.d.ts +16 -0
- package/dist/components/modals/onboarding-modal.d.ts +8 -0
- package/dist/components/timer/circular-timer.d.ts +11 -0
- package/dist/components/timer/timer-display.d.ts +13 -0
- package/dist/components/ui/button.d.ts +9 -0
- package/dist/components/ui/dialog.d.ts +13 -0
- package/dist/components/ui/extended/styled-button.d.ts +7 -0
- package/dist/components/ui/input.d.ts +8 -0
- package/dist/components/ui/textarea.d.ts +8 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/interview-widget-context.d.ts +34 -0
- package/dist/context/proctoring-context.d.ts +17 -0
- package/dist/dev.d.ts +0 -1
- package/dist/hooks/index.d.ts +11 -0
- package/dist/hooks/use-api.d.ts +26 -0
- package/dist/hooks/use-dialog.d.ts +6 -0
- package/dist/hooks/use-full-screen.d.ts +17 -0
- package/dist/hooks/use-interview-api.d.ts +5 -0
- package/dist/hooks/use-keyboard-prevention.d.ts +2 -0
- package/dist/hooks/use-stt.d.ts +20 -0
- package/dist/hooks/use-tab-switch.d.ts +2 -0
- package/dist/hooks/use-text-selection-prevention.d.ts +1 -0
- package/dist/hooks/use-timer.d.ts +13 -0
- package/dist/hooks/use-tts.d.ts +15 -0
- package/dist/hooks/use-violation-logger.d.ts +13 -0
- package/dist/index.d.ts +6 -8
- package/dist/interview-widget.d.ts +4 -0
- package/dist/services/api/index.d.ts +2 -0
- package/dist/services/api/interview-api.d.ts +23 -0
- package/dist/services/stt/index.d.ts +1 -0
- package/dist/services/stt/stt-service.d.ts +79 -0
- package/dist/services/timer/index.d.ts +6 -0
- package/dist/services/timer/timer-service.d.ts +82 -0
- package/dist/services/tts/index.d.ts +1 -0
- package/dist/services/tts/tts-service.d.ts +44 -0
- package/dist/styles.d.ts +0 -0
- package/dist/types.d.ts +89 -23
- package/dist/utils/api-error-classifier.d.ts +2 -0
- package/dist/utils/constants.d.ts +3 -0
- package/dist/utils/helper.d.ts +8 -0
- package/dist/utils/resilient-fetch.d.ts +9 -0
- package/dist/widget.css +1 -0
- package/dist/widget.es.js +3204 -0
- package/dist/widget.umd.js +127 -0
- package/package.json +37 -23
- package/dist/ChatWidget.d.ts +0 -5
- package/dist/Message.d.ts +0 -10
- package/dist/chat-widget.css +0 -1
- package/dist/chat-widget.es.js +0 -189
- package/dist/chat-widget.umd.js +0 -9
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ViolationType } from '../../../types';
|
|
2
|
+
interface CheatingWarningModalProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
warningCount: number;
|
|
6
|
+
violationType: ViolationType;
|
|
7
|
+
onDisqualify: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function CheatingWarningModal({ isOpen, onClose, warningCount, violationType, onDisqualify, }: CheatingWarningModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { InterviewQuestionData } from '../../types';
|
|
3
|
+
interface QuestionDisplayProps {
|
|
4
|
+
question: InterviewQuestionData | null;
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const QuestionDisplay: React.FC<QuestionDisplayProps>;
|
|
9
|
+
export default QuestionDisplay;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
type AudioWaveVisualizerProps = {
|
|
3
|
+
className?: string;
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
barWidth?: number;
|
|
7
|
+
gap?: number;
|
|
8
|
+
fftSize?: 256 | 512 | 1024 | 2048;
|
|
9
|
+
smoothingTimeConstant?: number;
|
|
10
|
+
mediaStream?: MediaStream;
|
|
11
|
+
startOnMount?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare const AudioWaveVisualizer: React.FC<AudioWaveVisualizerProps>;
|
|
14
|
+
export default AudioWaveVisualizer;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface Violation {
|
|
3
|
+
type: string;
|
|
4
|
+
severity: string;
|
|
5
|
+
details: {
|
|
6
|
+
action: string;
|
|
7
|
+
reason: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
interface Props {
|
|
11
|
+
showHardReloadWarning: boolean;
|
|
12
|
+
logViolation: (violation: Violation) => void;
|
|
13
|
+
onContinue: () => void;
|
|
14
|
+
}
|
|
15
|
+
declare const HardReloadWarning: React.FC<Props>;
|
|
16
|
+
export default HardReloadWarning;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface CircularTimerProps {
|
|
3
|
+
total: number;
|
|
4
|
+
remaining: number;
|
|
5
|
+
size?: number;
|
|
6
|
+
strokeWidth?: number;
|
|
7
|
+
className?: string;
|
|
8
|
+
showLabel?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const CircularTimer: React.FC<CircularTimerProps>;
|
|
11
|
+
export default CircularTimer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TimerState } from '../../services/timer/timer-service';
|
|
3
|
+
interface TimerDisplayProps {
|
|
4
|
+
state: TimerState;
|
|
5
|
+
className?: string;
|
|
6
|
+
defaultTimers?: {
|
|
7
|
+
thinking?: number;
|
|
8
|
+
answering?: number;
|
|
9
|
+
editing?: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
declare const TimerDisplay: React.FC<TimerDisplayProps>;
|
|
13
|
+
export default TimerDisplay;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React, ButtonHTMLAttributes } from 'react';
|
|
2
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
variant?: "primary" | "secondary" | "outline" | "text" | "gradient";
|
|
4
|
+
size?: "sm" | "md" | "lg";
|
|
5
|
+
fullWidth?: boolean;
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const Button: React.FC<ButtonProps>;
|
|
9
|
+
export default Button;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
interface DialogProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
title?: string;
|
|
7
|
+
showCloseButton?: boolean;
|
|
8
|
+
closeOnOverlayClick?: boolean;
|
|
9
|
+
closeOnEscape?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const Dialog: React.FC<DialogProps>;
|
|
13
|
+
export default Dialog;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const StyledButton: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React, TextareaHTMLAttributes } from 'react';
|
|
2
|
+
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
3
|
+
label?: string;
|
|
4
|
+
error?: string;
|
|
5
|
+
fullWidth?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const Textarea: React.FC<TextareaProps>;
|
|
8
|
+
export default Textarea;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { InterviewWidgetConfig } from '../types';
|
|
3
|
+
interface InterviewWidgetProviderProps {
|
|
4
|
+
config?: InterviewWidgetConfig;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function InterviewWidgetProvider({ config, children, }: InterviewWidgetProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function useInterviewConfig(): InterviewWidgetConfig;
|
|
9
|
+
/**
|
|
10
|
+
* Hook to access specific config sections
|
|
11
|
+
*/
|
|
12
|
+
export declare function useAPIConfig(): {
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
authToken?: string;
|
|
15
|
+
retryConfig?: {
|
|
16
|
+
attempts?: number;
|
|
17
|
+
backoff?: "fixed" | "exponential";
|
|
18
|
+
baseDelay?: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare function useUIConfig(): {
|
|
22
|
+
baseColor?: string;
|
|
23
|
+
borderRadius?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function useInterviewConfigSection(): NonNullable<InterviewWidgetConfig["interview"]>;
|
|
26
|
+
export declare function useSTTConfig(): {
|
|
27
|
+
provider?: "groq" | "deepgram";
|
|
28
|
+
model?: "whisper-large-v3-turbo" | (string & {});
|
|
29
|
+
language?: "en";
|
|
30
|
+
} | undefined;
|
|
31
|
+
export declare function useTTSConfig(): {
|
|
32
|
+
provider?: "piper";
|
|
33
|
+
} | undefined;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ViolationLogger } from '../types';
|
|
3
|
+
export declare const ProctoringProvider: React.FC<{
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const useProctoringStore: () => {
|
|
7
|
+
logViolations: ViolationLogger[];
|
|
8
|
+
totalViolations: number;
|
|
9
|
+
addViolation: (violation: ViolationLogger) => void;
|
|
10
|
+
clearViolations: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare const useViolations: () => ViolationLogger[];
|
|
13
|
+
export declare const useTotalViolations: () => number;
|
|
14
|
+
export declare const useProctoringActions: () => {
|
|
15
|
+
addViolation: (violation: ViolationLogger) => void;
|
|
16
|
+
clearViolations: () => void;
|
|
17
|
+
};
|
package/dist/dev.d.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './use-api';
|
|
2
|
+
export * from './use-dialog';
|
|
3
|
+
export * from './use-full-screen';
|
|
4
|
+
export * from './use-interview-api';
|
|
5
|
+
export * from './use-keyboard-prevention';
|
|
6
|
+
export * from './use-stt';
|
|
7
|
+
export * from './use-tab-switch';
|
|
8
|
+
export * from './use-text-selection-prevention';
|
|
9
|
+
export * from './use-timer';
|
|
10
|
+
export * from './use-tts';
|
|
11
|
+
export * from './use-violation-logger';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { APIError, APIHookState } from '../types';
|
|
2
|
+
type UseQueryAPIOptions<T> = {
|
|
3
|
+
immediate?: boolean;
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
onError?: (error: APIError) => void;
|
|
6
|
+
onSuccess?: (data: T) => void;
|
|
7
|
+
onSettled?: (data: T | null, error: APIError | null) => void;
|
|
8
|
+
};
|
|
9
|
+
type UseMutationAPIOptions<T> = {
|
|
10
|
+
onError?: (error: APIError) => void;
|
|
11
|
+
onSuccess?: (data: T) => void;
|
|
12
|
+
onSettled?: (data: T | null, error: APIError | null) => void;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Hook for GET requests (queries) - auto-executes and provides refetch
|
|
16
|
+
*/
|
|
17
|
+
export declare function useQueryAPI<T>(apiCall: () => Promise<T>, options?: UseQueryAPIOptions<T>): APIHookState<T> & {
|
|
18
|
+
refetch: () => Promise<void>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Hook for mutations (POST/PUT/PATCH/DELETE) - manual execution with parameters
|
|
22
|
+
*/
|
|
23
|
+
export declare function useMutationAPI<T, P extends any[] = []>(apiCall: (...args: P) => Promise<T>, options?: UseMutationAPIOptions<T>): APIHookState<T> & {
|
|
24
|
+
execute: (...args: P) => Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface FullscreenError {
|
|
2
|
+
name: string;
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
interface UseFullScreenReturn {
|
|
6
|
+
isFullScreen: boolean;
|
|
7
|
+
toggleFullScreen: (element?: HTMLElement) => Promise<void>;
|
|
8
|
+
enterFullScreen: (element?: HTMLElement) => Promise<void>;
|
|
9
|
+
exitFullScreen: () => Promise<void>;
|
|
10
|
+
error: FullscreenError | null;
|
|
11
|
+
}
|
|
12
|
+
interface UseFullScreenOptions {
|
|
13
|
+
onError?: (error: FullscreenError) => void;
|
|
14
|
+
onFullScreenChange?: (isFullScreen: boolean) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const useFullScreen: (options?: UseFullScreenOptions) => UseFullScreenReturn;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { STTConfig, STTError, STTRequest, STTResponse } from '../services/stt';
|
|
2
|
+
export interface UseSTTReturn {
|
|
3
|
+
startRecording: (maxDuration?: number) => Promise<void>;
|
|
4
|
+
stopRecording: () => Promise<Blob>;
|
|
5
|
+
transcribe: (audioBlob: Blob, options?: Partial<STTRequest>) => Promise<STTResponse>;
|
|
6
|
+
cancelRecording: () => void;
|
|
7
|
+
isRecording: boolean;
|
|
8
|
+
isTranscribing: boolean;
|
|
9
|
+
transcript: string | null;
|
|
10
|
+
error: STTError | null;
|
|
11
|
+
audioBlob: Blob | null;
|
|
12
|
+
}
|
|
13
|
+
export interface UseSTTOptions {
|
|
14
|
+
config?: Partial<STTConfig>;
|
|
15
|
+
onStart?: () => void;
|
|
16
|
+
onStop?: () => void;
|
|
17
|
+
onTranscriptionComplete?: (result: STTResponse) => void;
|
|
18
|
+
onError?: (error: STTError) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare const useSTT: (options?: UseSTTOptions) => UseSTTReturn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useTextSelectionPrevention: () => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TimerService, TimerState, TimerConfig, TimerCallbacks } from '../services/timer/timer-service';
|
|
2
|
+
export interface UseTimerOptions {
|
|
3
|
+
config?: Partial<TimerConfig>;
|
|
4
|
+
callbacks?: TimerCallbacks;
|
|
5
|
+
}
|
|
6
|
+
export interface UseTimerReturn {
|
|
7
|
+
state: TimerState;
|
|
8
|
+
startQuestion: () => void;
|
|
9
|
+
nextPhase: () => void;
|
|
10
|
+
completeInterview: () => void;
|
|
11
|
+
timerService: TimerService;
|
|
12
|
+
}
|
|
13
|
+
export declare function useTimer(options?: UseTimerOptions): UseTimerReturn;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TTSConfig, TTSRequest } from '../services/tts';
|
|
2
|
+
export interface UseTTSReturn {
|
|
3
|
+
speak: (text: string, options?: Partial<TTSRequest>) => Promise<void>;
|
|
4
|
+
stop: () => void;
|
|
5
|
+
isPlaying: boolean;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
error: Error | null;
|
|
8
|
+
}
|
|
9
|
+
export interface UseTTSOptions {
|
|
10
|
+
config?: Partial<TTSConfig>;
|
|
11
|
+
onStart?: () => void;
|
|
12
|
+
onEnd?: () => void;
|
|
13
|
+
onError?: (error: Error) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const useTTS: (options?: UseTTSOptions) => UseTTSReturn;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Violation, ViolationLogger } from '../types';
|
|
2
|
+
interface ViolationLoggerProps {
|
|
3
|
+
onViolation?: (violation: ViolationLogger, violationCount: number) => void;
|
|
4
|
+
onEnd?: (reason: string, violationCount: number) => void;
|
|
5
|
+
maxViolations?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const useViolationLogger: ({ onViolation, onEnd: onExamEnd, maxViolations, }: ViolationLoggerProps) => {
|
|
8
|
+
logViolation: ({ type, severity, details }: Violation) => void;
|
|
9
|
+
onInterviewEnd: (reason: string) => void;
|
|
10
|
+
violationCount: number;
|
|
11
|
+
logList: ViolationLogger[];
|
|
12
|
+
};
|
|
13
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { default as
|
|
3
|
-
|
|
4
|
-
export { ChatWidget, Message };
|
|
1
|
+
import { InterviewWidgetProvider } from './context/interview-widget-context';
|
|
2
|
+
import { default as InterviewWidget } from './interview-widget';
|
|
5
3
|
export * from './types';
|
|
6
|
-
export {
|
|
4
|
+
export { InterviewWidget as default, InterviewWidget, InterviewWidgetProvider };
|
|
7
5
|
declare global {
|
|
8
6
|
interface Window {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
InterviewWidget: {
|
|
8
|
+
InterviewWidget: typeof InterviewWidget;
|
|
9
|
+
InterviewWidgetProvider: typeof InterviewWidgetProvider;
|
|
12
10
|
};
|
|
13
11
|
React: any;
|
|
14
12
|
ReactDOM: any;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { InterviewQuestionPayload, InterviewQuestionResponse, InterviewWidgetConfig } from '../../types';
|
|
2
|
+
declare class InterviewAPI {
|
|
3
|
+
private config;
|
|
4
|
+
constructor(config?: InterviewWidgetConfig["api"]);
|
|
5
|
+
/**
|
|
6
|
+
* Update configuration
|
|
7
|
+
*/
|
|
8
|
+
updateConfig(config: InterviewWidgetConfig["api"]): void;
|
|
9
|
+
/**
|
|
10
|
+
* Get default headers for API requests
|
|
11
|
+
*/
|
|
12
|
+
private getHeaders;
|
|
13
|
+
/**
|
|
14
|
+
* Get base URL from config with fallback
|
|
15
|
+
*/
|
|
16
|
+
private getBaseUrl;
|
|
17
|
+
/**
|
|
18
|
+
* Get questions for an interview
|
|
19
|
+
*/
|
|
20
|
+
generateQuestion({ interviewId, isInterviewDone, qnaId, question, answer, answerDuration, }: InterviewQuestionPayload): Promise<InterviewQuestionResponse>;
|
|
21
|
+
}
|
|
22
|
+
export declare const interviewAPI: InterviewAPI;
|
|
23
|
+
export { InterviewAPI };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { sttService, STTService, STTError, type STTConfig, type STTRequest, type STTResponse, type RecordingEvents, } from './stt-service';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export interface STTConfig {
|
|
2
|
+
baseUrl?: string;
|
|
3
|
+
provider?: string;
|
|
4
|
+
model?: string;
|
|
5
|
+
language?: string;
|
|
6
|
+
authToken?: string;
|
|
7
|
+
includeTimestamps?: boolean;
|
|
8
|
+
temperature?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface STTRequest {
|
|
11
|
+
audioBlob: Blob;
|
|
12
|
+
model?: string;
|
|
13
|
+
language?: string;
|
|
14
|
+
includeTimestamps?: boolean;
|
|
15
|
+
temperature?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface STTResponse {
|
|
18
|
+
transcript: string;
|
|
19
|
+
confidence?: number;
|
|
20
|
+
language?: string;
|
|
21
|
+
duration?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface RecordingEvents {
|
|
24
|
+
onStart?: () => void;
|
|
25
|
+
onStop?: () => void;
|
|
26
|
+
onDataAvailable?: (blob: Blob) => void;
|
|
27
|
+
onError?: (error: Error) => void;
|
|
28
|
+
}
|
|
29
|
+
export declare class STTError extends Error {
|
|
30
|
+
readonly code: string;
|
|
31
|
+
readonly recoverable: boolean;
|
|
32
|
+
constructor(message: string, code: string, recoverable?: boolean);
|
|
33
|
+
}
|
|
34
|
+
declare class STTService {
|
|
35
|
+
private config;
|
|
36
|
+
private mediaRecorder;
|
|
37
|
+
private audioChunks;
|
|
38
|
+
private recordingStream;
|
|
39
|
+
private autoStopTimeoutId;
|
|
40
|
+
constructor(config?: STTConfig);
|
|
41
|
+
/**
|
|
42
|
+
* Update STT configuration
|
|
43
|
+
*/
|
|
44
|
+
updateConfig(config: Partial<STTConfig>): void;
|
|
45
|
+
/**
|
|
46
|
+
* Check if browser supports audio recording
|
|
47
|
+
*/
|
|
48
|
+
isRecordingSupported(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Start recording audio from user's microphone
|
|
51
|
+
*/
|
|
52
|
+
startRecording(maxDuration?: number, events?: RecordingEvents): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Stop recording and return the audio blob
|
|
55
|
+
*/
|
|
56
|
+
stopRecording(): Promise<Blob>;
|
|
57
|
+
/**
|
|
58
|
+
* Transcribe audio blob using the STT API
|
|
59
|
+
*/
|
|
60
|
+
transcribe(request: STTRequest): Promise<STTResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Cancel current recording without processing
|
|
63
|
+
*/
|
|
64
|
+
cancelRecording(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Check if currently recording
|
|
67
|
+
*/
|
|
68
|
+
isRecording(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Get supported MIME type for recording
|
|
71
|
+
*/
|
|
72
|
+
private getSupportedMimeType;
|
|
73
|
+
/**
|
|
74
|
+
* Clean up recording resources
|
|
75
|
+
*/
|
|
76
|
+
private cleanup;
|
|
77
|
+
}
|
|
78
|
+
export declare const sttService: STTService;
|
|
79
|
+
export { STTService };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { TimerPhase, TimerService } from './timer-service';
|
|
2
|
+
export type { TimerCallbacks, TimerConfig, TimerState } from './timer-service';
|
|
3
|
+
export { useTimer } from '../../hooks/use-timer';
|
|
4
|
+
export type { UseTimerOptions, UseTimerReturn } from '../../hooks/use-timer';
|
|
5
|
+
export { default as InterviewController } from '../../components/interview/interview-controller';
|
|
6
|
+
export { default as TimerDisplay } from '../../components/timer/timer-display';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimerService - Time controller for interview phases
|
|
3
|
+
*/
|
|
4
|
+
export declare enum TimerPhase {
|
|
5
|
+
IDLE = "idle",
|
|
6
|
+
FETCHING_QUESTION = "fetching_question",
|
|
7
|
+
READING_QUESTION = "reading_question",
|
|
8
|
+
THINKING = "thinking",
|
|
9
|
+
ANSWERING = "answering",
|
|
10
|
+
TRANSCRIBING = "transcribing",
|
|
11
|
+
EDITING = "editing",
|
|
12
|
+
SUBMITTING = "submitting",
|
|
13
|
+
COMPLETED = "completed"
|
|
14
|
+
}
|
|
15
|
+
export interface TimerConfig {
|
|
16
|
+
thinkingDuration: number;
|
|
17
|
+
answeringDuration: number;
|
|
18
|
+
editingDuration: number;
|
|
19
|
+
}
|
|
20
|
+
export interface TimerState {
|
|
21
|
+
phase: TimerPhase;
|
|
22
|
+
currentPhaseTimeRemaining: number;
|
|
23
|
+
totalTimeElapsed: number;
|
|
24
|
+
currentQuestionNumber: number;
|
|
25
|
+
}
|
|
26
|
+
export interface TimerCallbacks {
|
|
27
|
+
onPhaseChange?: (phase: TimerPhase, state: TimerState) => void;
|
|
28
|
+
onTick?: (state: TimerState) => void;
|
|
29
|
+
onInterviewEnd?: () => void;
|
|
30
|
+
}
|
|
31
|
+
export declare class TimerService {
|
|
32
|
+
private config;
|
|
33
|
+
private state;
|
|
34
|
+
private phaseIntervalId;
|
|
35
|
+
private globalIntervalId;
|
|
36
|
+
callbacks: TimerCallbacks;
|
|
37
|
+
constructor(config?: Partial<TimerConfig>, callbacks?: TimerCallbacks);
|
|
38
|
+
/**
|
|
39
|
+
* Get current state
|
|
40
|
+
*/
|
|
41
|
+
getState(): Readonly<TimerState>;
|
|
42
|
+
/**
|
|
43
|
+
* Start a new question cycle
|
|
44
|
+
*/
|
|
45
|
+
startQuestion(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Move to next phase
|
|
48
|
+
*/
|
|
49
|
+
nextPhase(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Manually complete the interview
|
|
52
|
+
*/
|
|
53
|
+
completeInterview(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Cleanup
|
|
56
|
+
*/
|
|
57
|
+
destroy(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Get duration for a phase
|
|
60
|
+
*/
|
|
61
|
+
private getDurationForPhase;
|
|
62
|
+
/**
|
|
63
|
+
* Start global timer (runs continuously during entire interview for tracking)
|
|
64
|
+
*/
|
|
65
|
+
private startGlobalTimer;
|
|
66
|
+
/**
|
|
67
|
+
* Stop global timer
|
|
68
|
+
*/
|
|
69
|
+
private stopGlobalTimer;
|
|
70
|
+
/**
|
|
71
|
+
* Start phase timer (only for timed phases)
|
|
72
|
+
*/
|
|
73
|
+
private startPhaseTimer;
|
|
74
|
+
/**
|
|
75
|
+
* Stop phase timer
|
|
76
|
+
*/
|
|
77
|
+
private stopPhaseTimer;
|
|
78
|
+
/**
|
|
79
|
+
* Notify phase change
|
|
80
|
+
*/
|
|
81
|
+
private notifyChange;
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tts-service';
|