face-validator-sdk 1.3.0 → 1.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.
@@ -15,11 +15,29 @@ export declare class FaceValidator {
15
15
  private lastDetection;
16
16
  private stableSince;
17
17
  private isCapturing;
18
+ private containerElement;
19
+ private statusElement;
20
+ private uiRootElement;
21
+ private cameraStream;
22
+ private cameraReadyPromise;
23
+ private managedElements;
24
+ private managedCamera;
25
+ private injectedStyleElement;
18
26
  constructor(options: FaceValidatorOptions);
19
27
  private resolveOptions;
28
+ private setupElements;
29
+ private resolveContainer;
30
+ private ensureDefaultUI;
31
+ private attachMediaElements;
32
+ private injectDefaultStyles;
33
+ private applyMirrorStyles;
20
34
  private init;
21
35
  private getMessageForStatus;
22
36
  private setStatus;
37
+ private updateStatusUI;
38
+ private getStatusClass;
39
+ private initCamera;
40
+ private waitForVideoReady;
23
41
  private startDetectionLoop;
24
42
  /**
25
43
  * Estima bounding box a partir dos landmarks (MediaPipe não fornece bbox diretamente).
@@ -27,4 +45,7 @@ export declare class FaceValidator {
27
45
  private estimateBoundingBox;
28
46
  private captureImage;
29
47
  stop(): void;
48
+ destroy(): void;
49
+ private stopCamera;
50
+ private getVideoElement;
30
51
  }
@@ -19,10 +19,20 @@ export declare enum ValidationStatus {
19
19
  }
20
20
  export type SupportedLocale = 'pt-BR' | 'en' | 'es';
21
21
  export interface FaceValidatorOptions {
22
+ /** Optional container element or selector to auto-render UI and media elements. */
23
+ container?: HTMLElement | string;
24
+ /** Optional UI mode. Default: 'default'. */
25
+ ui?: 'default' | 'none';
26
+ /** Auto-start camera if SDK manages the video element. Default: true. */
27
+ autoStart?: boolean;
28
+ /** Mirror preview horizontally. Default: true. */
29
+ mirror?: boolean;
30
+ /** Optional video constraints passed to getUserMedia. */
31
+ videoConstraints?: MediaTrackConstraints;
22
32
  /** Optional path to MediaPipe models WASM files. Default: auto-detected from CDN */
23
33
  modelPath?: string;
24
34
  /** Video element for the camera stream. */
25
- videoElement: HTMLVideoElement;
35
+ videoElement?: HTMLVideoElement;
26
36
  /** Optional canvas for visual feedback (e.g. face outline). */
27
37
  overlayCanvasElement?: HTMLCanvasElement | null;
28
38
  /** Optional video width. Default: 640 */
@@ -34,11 +44,11 @@ export interface FaceValidatorOptions {
34
44
  /** Optional override for specific status messages. */
35
45
  customMessages?: Partial<Record<ValidationStatus, string>>;
36
46
  /** Callback on each validation status update. */
37
- onStatusUpdate: (status: ValidationStatus, message: string) => void;
47
+ onStatusUpdate?: (status: ValidationStatus, message: string) => void;
38
48
  /** Callback when selfie is successfully captured (receives Blob). */
39
- onCaptureSuccess: (imageBlob: Blob) => void;
49
+ onCaptureSuccess?: (imageBlob: Blob) => void;
40
50
  /** Callback on error. */
41
- onError: (errorType: ValidationStatus, error: Error) => void;
51
+ onError?: (errorType: ValidationStatus, error: Error) => void;
42
52
  /** Optional min detection confidence (0–1). Default: 0.5 */
43
53
  minDetectionConfidence?: number;
44
54
  /** Optional min brightness (0–255). Default: 70 */
@@ -19,10 +19,20 @@ export declare enum ValidationStatus {
19
19
  }
20
20
  export type SupportedLocale = 'pt-BR' | 'en' | 'es';
21
21
  export interface FaceValidatorOptions {
22
+ /** Optional container element or selector to auto-render UI and media elements. */
23
+ container?: HTMLElement | string;
24
+ /** Optional UI mode. Default: 'default'. */
25
+ ui?: 'default' | 'none';
26
+ /** Auto-start camera if SDK manages the video element. Default: true. */
27
+ autoStart?: boolean;
28
+ /** Mirror preview horizontally. Default: true. */
29
+ mirror?: boolean;
30
+ /** Optional video constraints passed to getUserMedia. */
31
+ videoConstraints?: MediaTrackConstraints;
22
32
  /** Optional path to MediaPipe models WASM files. Default: auto-detected from CDN */
23
33
  modelPath?: string;
24
34
  /** Video element for the camera stream. */
25
- videoElement: HTMLVideoElement;
35
+ videoElement?: HTMLVideoElement;
26
36
  /** Optional canvas for visual feedback (e.g. face outline). */
27
37
  overlayCanvasElement?: HTMLCanvasElement | null;
28
38
  /** Optional video width. Default: 640 */
@@ -34,11 +44,11 @@ export interface FaceValidatorOptions {
34
44
  /** Optional override for specific status messages. */
35
45
  customMessages?: Partial<Record<ValidationStatus, string>>;
36
46
  /** Callback on each validation status update. */
37
- onStatusUpdate: (status: ValidationStatus, message: string) => void;
47
+ onStatusUpdate?: (status: ValidationStatus, message: string) => void;
38
48
  /** Callback when selfie is successfully captured (receives Blob). */
39
- onCaptureSuccess: (imageBlob: Blob) => void;
49
+ onCaptureSuccess?: (imageBlob: Blob) => void;
40
50
  /** Callback on error. */
41
- onError: (errorType: ValidationStatus, error: Error) => void;
51
+ onError?: (errorType: ValidationStatus, error: Error) => void;
42
52
  /** Optional min detection confidence (0–1). Default: 0.5 */
43
53
  minDetectionConfidence?: number;
44
54
  /** Optional min brightness (0–255). Default: 70 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "face-validator-sdk",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Real-time selfie validation SDK with face detection, i18n (pt-BR, en, es). Built on MediaPipe.",
5
5
  "main": "dist/face-validator-sdk.cjs.js",
6
6
  "module": "dist/face-validator-sdk.esm.js",