interview-widget 3.3.0 → 3.3.2
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 +16 -12
- package/dist/assets/index.d.ts +5 -1
- package/dist/assets/net-cross-icon.d.ts +1 -0
- package/dist/assets/wifi-icon.d.ts +1 -0
- package/dist/assets/wifi-low-icon.d.ts +1 -0
- package/dist/assets/wifi-off-icon.d.ts +1 -0
- package/dist/components/interview/interview-content.d.ts +5 -0
- package/dist/components/interview/proctoring/gaze-detection/hooks/use-gaze-analysis.d.ts +1 -1
- package/dist/components/interview/proctoring/gaze-detection/hooks/use-render-loop.d.ts +1 -1
- package/dist/components/media/video-feed.d.ts +1 -0
- package/dist/components/modals/retry-confirmation-modal.d.ts +9 -0
- package/dist/components/network/network-quality-bar.d.ts +6 -0
- package/dist/components/network/network-quality-config.d.ts +21 -0
- package/dist/components/network/network-warning-modal.d.ts +12 -0
- package/dist/context/interview-widget-context.d.ts +3 -0
- package/dist/context/proctoring-context.d.ts +13 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-network-quality.d.ts +10 -0
- package/dist/hooks/use-video-recording.d.ts +1 -1
- package/dist/services/api/endpoints.d.ts +1 -0
- package/dist/services/api/interview-api.d.ts +9 -1
- package/dist/services/common-service.d.ts +1 -0
- package/dist/services/stt/stt-service.d.ts +1 -0
- package/dist/types.d.ts +15 -0
- package/dist/utils/safari-audio-utils.d.ts +49 -0
- package/dist/widget.3.3.2.css +1 -0
- package/dist/{widget.es.3.3.0.js → widget.es.3.3.2.js} +4029 -3521
- package/dist/widget.umd.3.3.2.js +179 -0
- package/package.json +9 -9
- package/dist/widget.3.3.0.css +0 -1
- package/dist/widget.umd.3.3.0.js +0 -179
package/README.md
CHANGED
|
@@ -201,21 +201,25 @@ Pass this object to `InterviewWidgetProvider` via the `config` prop. Tables list
|
|
|
201
201
|
|
|
202
202
|
### UI
|
|
203
203
|
|
|
204
|
-
| Prop
|
|
205
|
-
|
|
|
206
|
-
| baseColor
|
|
207
|
-
| borderRadius | `string (CSS)` | "8px"
|
|
204
|
+
| Prop | Type | Default | Description |
|
|
205
|
+
| --- | --- | --- | --- |
|
|
206
|
+
| baseColor | `string (hex)` | "#3B82F6" | Primary brand color used by the widget |
|
|
207
|
+
| borderRadius | `string (CSS)` | "8px" | Global corner radius for components |
|
|
208
|
+
| retryProgressSavedText | `string` | `"Your progress is saved — tap Retry or exit the interview..."` | Text to show in next-question retry modal |
|
|
209
|
+
| retryMaxAttempts | `number` | 3 | Maximum number of attempts allowed for retrying next question |
|
|
210
|
+
| retryNoAttemptsLeftText | `string` | `"Retry limit reached. Please exit and resume later."` | Error message shown when max attempts are reached |
|
|
208
211
|
|
|
209
212
|
### Interview
|
|
210
213
|
|
|
211
|
-
| Prop | Type | Default
|
|
212
|
-
| -------------------- | --------- |
|
|
213
|
-
| allow_answer_editing | `boolean` | true
|
|
214
|
-
| capture_screenshots | `boolean` | false
|
|
215
|
-
|
|
|
216
|
-
|
|
|
217
|
-
|
|
|
218
|
-
|
|
|
214
|
+
| Prop | Type | Default | Description |
|
|
215
|
+
| -------------------- | --------- | -------------------------------- | ------------------------------------------- |
|
|
216
|
+
| allow_answer_editing | `boolean` | true | Enable/disable answer editing phase |
|
|
217
|
+
| capture_screenshots | `boolean` | false | Enable/disable periodic screenshot captures |
|
|
218
|
+
| record_video | `boolean` | false | Enable/disable video recording |
|
|
219
|
+
| timers | `object` | [see below](#timers) | Per-phase and global timing configuration |
|
|
220
|
+
| stt | `object` | [see below](#stt-speech-to-text) | Speech-to-Text provider settings |
|
|
221
|
+
| tts | `object` | [see below](#tts-text-to-speech) | Text-to-Speech provider settings |
|
|
222
|
+
| proctoring | `object` | [see below](#proctoring) | Proctoring settings and cheating detection |
|
|
219
223
|
|
|
220
224
|
#### Timers
|
|
221
225
|
|
package/dist/assets/index.d.ts
CHANGED
|
@@ -17,11 +17,15 @@ export * from './mic-icon';
|
|
|
17
17
|
export * from './mic-off-icon';
|
|
18
18
|
export * from './monitor-icon';
|
|
19
19
|
export * from './mouse-pointer-click-icon';
|
|
20
|
+
export * from './net-cross-icon';
|
|
20
21
|
export * from './shield-icon';
|
|
21
22
|
export * from './speak-icon';
|
|
23
|
+
export * from './speech-icon';
|
|
22
24
|
export * from './target-icon';
|
|
23
25
|
export * from './users-icon';
|
|
24
26
|
export * from './video-icon';
|
|
25
27
|
export * from './video-off-icon';
|
|
26
28
|
export * from './volumn-icon';
|
|
27
|
-
export * from './
|
|
29
|
+
export * from './wifi-icon';
|
|
30
|
+
export * from './wifi-low-icon';
|
|
31
|
+
export * from './wifi-off-icon';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const NetCrossIcon: (props: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WifiIcon: (props: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WifiLowIcon: (props: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const WifiOffIcon: (props: React.SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -22,6 +22,11 @@ interface InterviewContentProps {
|
|
|
22
22
|
onAnswerChange?: ((e: React.ChangeEvent<HTMLTextAreaElement>) => void) | undefined;
|
|
23
23
|
editingTime?: number | undefined;
|
|
24
24
|
disableSubmitButton?: boolean;
|
|
25
|
+
fetchQuestionError?: any;
|
|
26
|
+
onRetryQuestion?: () => void;
|
|
27
|
+
retryClicksCount?: number;
|
|
28
|
+
isFetchingQuestion?: boolean;
|
|
29
|
+
onExitInterview?: () => void;
|
|
25
30
|
}
|
|
26
31
|
export declare const InterviewContent: React.FC<InterviewContentProps>;
|
|
27
32
|
export {};
|
|
@@ -2,7 +2,7 @@ import { Landmark, ReferenceData } from '../utils/types';
|
|
|
2
2
|
export declare const useGazeAnalysis: () => {
|
|
3
3
|
engagement: number;
|
|
4
4
|
isLookingAway: boolean;
|
|
5
|
-
analyzeGaze: (landmarks: Landmark[], reference: ReferenceData, gazeAnalysisEnabled: boolean) => {
|
|
5
|
+
analyzeGaze: (landmarks: Landmark[] | null, reference: ReferenceData, gazeAnalysisEnabled: boolean) => {
|
|
6
6
|
engagement: number;
|
|
7
7
|
isLookingAway: boolean;
|
|
8
8
|
} | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Landmark } from '../utils/types';
|
|
2
|
-
export declare const useRenderLoop: (videoRef: React.RefObject<HTMLVideoElement | null>, canvasRef: React.RefObject<HTMLCanvasElement | null>, faceLandmarkerRef: React.RefObject<any>, updateFPS: () => void, analyzeFace: (results: any, referenceSet: boolean, referenceRef: Landmark[], setStatusMessage: (message: string) => void) => Landmark[] | null, drawWithEngagementBar: (canvas: HTMLCanvasElement, video: HTMLVideoElement, landmarks: Landmark[], showLandmarks: boolean, showEngagementBar: boolean, gazeAnalysisEnabled: boolean, referenceSet: boolean) => void, clearCanvas: (canvas: HTMLCanvasElement, video: HTMLVideoElement) => void, analyzeGaze: (landmarks: Landmark[], reference: any, gazeAnalysisEnabled: boolean) => void, referenceSet: boolean, referenceRef: React.RefObject<any>, showLandmarks: boolean, showEngagementBar: boolean, gazeAnalysisEnabled: boolean, setStatusMessage: (message: string) => void, setReferenceFaceNotDetected: (detected: boolean) => void) => {
|
|
2
|
+
export declare const useRenderLoop: (videoRef: React.RefObject<HTMLVideoElement | null>, canvasRef: React.RefObject<HTMLCanvasElement | null>, faceLandmarkerRef: React.RefObject<any>, updateFPS: () => void, analyzeFace: (results: any, referenceSet: boolean, referenceRef: Landmark[], setStatusMessage: (message: string) => void) => Landmark[] | null, drawWithEngagementBar: (canvas: HTMLCanvasElement, video: HTMLVideoElement, landmarks: Landmark[], showLandmarks: boolean, showEngagementBar: boolean, gazeAnalysisEnabled: boolean, referenceSet: boolean) => void, clearCanvas: (canvas: HTMLCanvasElement, video: HTMLVideoElement) => void, analyzeGaze: (landmarks: Landmark[] | null, reference: any, gazeAnalysisEnabled: boolean) => void, referenceSet: boolean, referenceRef: React.RefObject<any>, showLandmarks: boolean, showEngagementBar: boolean, gazeAnalysisEnabled: boolean, setStatusMessage: (message: string) => void, setReferenceFaceNotDetected: (detected: boolean) => void) => {
|
|
3
3
|
renderLoop: () => void;
|
|
4
4
|
animationFrameRef: import('react').RefObject<number | null>;
|
|
5
5
|
};
|
|
@@ -18,6 +18,7 @@ interface VideoFeedProps {
|
|
|
18
18
|
cheatingWarningVisible?: boolean;
|
|
19
19
|
isDeviceLoading?: boolean;
|
|
20
20
|
videoAllowed?: boolean;
|
|
21
|
+
questionNumber?: number;
|
|
21
22
|
}
|
|
22
23
|
declare const VideoFeed: import('react').ForwardRefExoticComponent<VideoFeedProps & import('react').RefAttributes<VideoFeedHandle>>;
|
|
23
24
|
export default VideoFeed;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface RetryConfirmationModalProps {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
onRetry: () => void;
|
|
4
|
+
onExit: () => void;
|
|
5
|
+
retryClicksCount: number;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const RetryConfirmationModal: ({ isOpen, onRetry, onExit, retryClicksCount, isLoading, }: RetryConfirmationModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NetworkQualityLevel } from './network-quality-config';
|
|
2
|
+
interface NetworkQualityBarProps {
|
|
3
|
+
quality: NetworkQualityLevel;
|
|
4
|
+
}
|
|
5
|
+
export declare function NetworkQualityBar({ quality }: NetworkQualityBarProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type NetworkQualityLevel = "good" | "fair" | "poor" | "disconnected";
|
|
3
|
+
export interface NetworkQualityConfig {
|
|
4
|
+
/** Tailwind bar fill color class */
|
|
5
|
+
barColor: string;
|
|
6
|
+
/** Number of lit bars out of 3 */
|
|
7
|
+
activeBars: number;
|
|
8
|
+
/** Short label for tooltip */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Whether to trigger the warning modal */
|
|
11
|
+
showModal: boolean;
|
|
12
|
+
/** Icon component for the warning modal */
|
|
13
|
+
modalIcon: React.ComponentType<React.SVGProps<SVGSVGElement>>;
|
|
14
|
+
modalIconColor: string;
|
|
15
|
+
modalIconBg: string;
|
|
16
|
+
modalIconBorder: string;
|
|
17
|
+
modalTitle: string;
|
|
18
|
+
modalSubtitle: string;
|
|
19
|
+
modalDescription?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const networkQualityConfigs: Record<NetworkQualityLevel, NetworkQualityConfig>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NetworkQualityLevel } from './network-quality-config';
|
|
2
|
+
interface NetworkWarningModalProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
quality: NetworkQualityLevel;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Shown when network quality drops to "poor" or "disconnected".
|
|
9
|
+
* Styled identically to GazeWarningModal.
|
|
10
|
+
*/
|
|
11
|
+
export declare function NetworkWarningModal({ isOpen, quality, onClose, }: NetworkWarningModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
export {};
|
|
@@ -21,6 +21,9 @@ export declare function useAPIConfig(): {
|
|
|
21
21
|
export declare function useUIConfig(): {
|
|
22
22
|
baseColor?: string;
|
|
23
23
|
borderRadius?: string;
|
|
24
|
+
retryProgressSavedText?: string;
|
|
25
|
+
retryMaxAttempts?: number;
|
|
26
|
+
retryNoAttemptsLeftText?: string;
|
|
24
27
|
};
|
|
25
28
|
export declare function useInterviewConfigSection(): NonNullable<InterviewWidgetConfig["interview"]>;
|
|
26
29
|
export declare function useSTTConfig(): {
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { ViolationLogger } from '../types';
|
|
3
3
|
import { GazeViolationCounters, GazeViolationType } from '../components/interview/proctoring/gaze-detection/utils/types';
|
|
4
|
+
export type ProctoringState = {
|
|
5
|
+
logViolations: ViolationLogger[];
|
|
6
|
+
totalViolations: number;
|
|
7
|
+
gazeViolationCounters: GazeViolationCounters;
|
|
8
|
+
referenceSet: boolean;
|
|
9
|
+
referenceRef: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
noseX: number;
|
|
13
|
+
noseY: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
4
16
|
export declare const ProctoringProvider: React.FC<{
|
|
5
17
|
children: React.ReactNode;
|
|
18
|
+
interviewId?: string;
|
|
6
19
|
}>;
|
|
7
20
|
export declare const useProctoringStore: () => {
|
|
8
21
|
logViolations: ViolationLogger[];
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './use-dialog';
|
|
|
3
3
|
export * from './use-full-screen';
|
|
4
4
|
export * from './use-interview-api';
|
|
5
5
|
export * from './use-keyboard-prevention';
|
|
6
|
+
export * from './use-network-quality';
|
|
6
7
|
export * from './use-stt';
|
|
7
8
|
export * from './use-tab-switch';
|
|
8
9
|
export * from './use-text-selection-prevention';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type NetworkQualityLevel = "good" | "fair" | "poor" | "disconnected";
|
|
2
|
+
export interface NetworkQualityState {
|
|
3
|
+
quality: NetworkQualityLevel;
|
|
4
|
+
isOnline: boolean;
|
|
5
|
+
effectiveType?: string | undefined;
|
|
6
|
+
rtt?: number | undefined;
|
|
7
|
+
downlink?: number | undefined;
|
|
8
|
+
isInitialising: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function useNetworkQuality(): NetworkQualityState;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function useVideoRecordingStream(interviewId: string): {
|
|
1
|
+
export declare function useVideoRecordingStream(interviewId: string, record_video?: boolean, questionNumber?: number): {
|
|
2
2
|
startRecording: (stream: MediaStream) => void;
|
|
3
3
|
stopRecording: () => void;
|
|
4
4
|
isRecording: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InterviewConfigResponse, InterviewQuestionPayload, InterviewQuestionResponse, InterviewSubmitAnswerPayload, InterviewTranscriptResponse, InterviewWidgetConfig, ScreenshotUploadRequestResponse } from '../../types';
|
|
1
|
+
import { InterviewConfigResponse, InterviewQuestionPayload, InterviewQuestionResponse, InterviewSubmitAnswerPayload, InterviewTranscriptResponse, InterviewViolationsPayload, InterviewViolationsResponse, InterviewWidgetConfig, ScreenshotUploadRequestResponse } from '../../types';
|
|
2
2
|
declare class InterviewAPI {
|
|
3
3
|
private config;
|
|
4
4
|
constructor(config?: InterviewWidgetConfig["api"]);
|
|
@@ -46,6 +46,14 @@ declare class InterviewAPI {
|
|
|
46
46
|
* Get interview transcription
|
|
47
47
|
*/
|
|
48
48
|
getInterviewTranscription(interviewId: string): Promise<InterviewTranscriptResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* Get violations snapshot for an interview
|
|
51
|
+
*/
|
|
52
|
+
getViolations(interviewId: string): Promise<InterviewViolationsResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Update violations snapshot for an interview
|
|
55
|
+
*/
|
|
56
|
+
updateViolations({ interviewId, violations, }: InterviewViolationsPayload): Promise<InterviewViolationsResponse>;
|
|
49
57
|
}
|
|
50
58
|
export declare const interviewAPI: InterviewAPI;
|
|
51
59
|
export { InterviewAPI };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const stopAllServices: () => void;
|
package/dist/types.d.ts
CHANGED
|
@@ -46,10 +46,14 @@ export interface InterviewWidgetConfig {
|
|
|
46
46
|
ui?: {
|
|
47
47
|
baseColor?: string;
|
|
48
48
|
borderRadius?: string;
|
|
49
|
+
retryProgressSavedText?: string;
|
|
50
|
+
retryMaxAttempts?: number;
|
|
51
|
+
retryNoAttemptsLeftText?: string;
|
|
49
52
|
};
|
|
50
53
|
interview?: {
|
|
51
54
|
allow_answer_editing?: boolean;
|
|
52
55
|
capture_screenshots?: boolean;
|
|
56
|
+
record_video?: boolean;
|
|
53
57
|
timers?: {
|
|
54
58
|
thinkingDuration?: number;
|
|
55
59
|
answeringDuration?: number;
|
|
@@ -135,3 +139,14 @@ export interface TranscriptMessage {
|
|
|
135
139
|
question_generated_at: string;
|
|
136
140
|
answer_submitted_at: string | null;
|
|
137
141
|
}
|
|
142
|
+
export interface InterviewViolationsResponse {
|
|
143
|
+
success: boolean;
|
|
144
|
+
message: string;
|
|
145
|
+
data: any;
|
|
146
|
+
error?: string | null;
|
|
147
|
+
code?: number;
|
|
148
|
+
}
|
|
149
|
+
export interface InterviewViolationsPayload {
|
|
150
|
+
interviewId: string;
|
|
151
|
+
violations: any;
|
|
152
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safari Audio Utilities
|
|
3
|
+
*
|
|
4
|
+
* Centralises all Safari-specific audio quirks so every call site stays clean.
|
|
5
|
+
* Each function is a transparent no-op / pass-through on non-Safari browsers.
|
|
6
|
+
*
|
|
7
|
+
* Safari-specific lines are tagged with // [SAFARI] for easy auditing.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Returns true only for genuine Safari (desktop + iOS).
|
|
11
|
+
* Chrome/Edge on iOS report as Safari in the UA, but they also advertise
|
|
12
|
+
* "Chrome" or "CriOS" / "EdgA" — we exclude those. [SAFARI]
|
|
13
|
+
*/
|
|
14
|
+
export declare function isSafari(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the best supported MIME type for MediaRecorder.
|
|
17
|
+
*
|
|
18
|
+
* Safari only supports audio/mp4 (AAC-LC). Offering audio/webm first causes
|
|
19
|
+
* MediaRecorder construction to throw a NotSupportedError on Safari. [SAFARI]
|
|
20
|
+
*/
|
|
21
|
+
export declare function getSupportedMimeType(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Strips constraints that throw OverconstrainedError on Safari.
|
|
24
|
+
*
|
|
25
|
+
* Safari rejects `sampleRate` and `channelCount` as MediaTrackConstraints,
|
|
26
|
+
* raising an OverconstrainedError that blocks mic access entirely. [SAFARI]
|
|
27
|
+
* All other browsers receive the full constraint set unchanged.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getSafariSafeAudioConstraints(base?: MediaTrackConstraints): MediaTrackConstraints;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the timeslice argument (ms) to pass to MediaRecorder.start().
|
|
32
|
+
*
|
|
33
|
+
* Safari silently suppresses `ondataavailable` events when a timeslice is
|
|
34
|
+
* provided — it will only emit one blob when stop() is called. [SAFARI]
|
|
35
|
+
* Returning `undefined` causes the caller to call `start()` with no argument,
|
|
36
|
+
* which is the correct Safari behaviour.
|
|
37
|
+
*
|
|
38
|
+
* Other browsers get 100 ms streaming chunks for real-time processing.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getMediaRecorderStartArg(): number | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* [SAFARI] Do NOT call requestData() before stop().
|
|
43
|
+
* Without a timeslice, stop() guarantees one ondataavailable fires
|
|
44
|
+
* synchronously before onstop. Calling requestData() first queues a
|
|
45
|
+
* SECOND ondataavailable as a separate task — on some Safari versions
|
|
46
|
+
* that second event arrives AFTER onstop, so audioChunks is empty
|
|
47
|
+
* when the blob is assembled. Just call stop().
|
|
48
|
+
*/
|
|
49
|
+
export declare function safariSafeStop(recorder: MediaRecorder): void;
|