alphavalid-sdk 1.0.0 → 1.0.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 +133 -0
- package/bin/alphavalid.js +92 -0
- package/dist/__vite-browser-external-C7ivxuo1.mjs +18 -0
- package/dist/alphavalid.es.d.ts +126 -0
- package/dist/alphavalid.es.js +20092 -0
- package/dist/alphavalid.umd.d.ts +126 -0
- package/dist/alphavalid.umd.js +3852 -0
- package/dist/core/camera.d.ts +8 -0
- package/dist/core/camera.d.ts.map +1 -0
- package/dist/core/feedback.d.ts +112 -0
- package/dist/core/feedback.d.ts.map +1 -0
- package/dist/index.d.ts +126 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/setupModels-RA6BN3uf.mjs +19 -0
- package/dist/setupModels.d.ts +2 -0
- package/dist/setupModels.d.ts.map +1 -0
- package/dist/types/sdk.d.ts +451 -0
- package/dist/types/sdk.d.ts.map +1 -0
- package/dist/ui/baseStyles.d.ts +2 -0
- package/dist/ui/baseStyles.d.ts.map +1 -0
- package/dist/ui/captureButtonCoxinha.d.ts +13 -0
- package/dist/ui/captureButtonCoxinha.d.ts.map +1 -0
- package/dist/ui/containerStyles.d.ts +1 -0
- package/dist/ui/containerStyles.d.ts.map +1 -0
- package/dist/ui/loader.d.ts +15 -0
- package/dist/ui/loader.d.ts.map +1 -0
- package/dist/ui/overlay.d.ts +221 -0
- package/dist/ui/overlay.d.ts.map +1 -0
- package/dist/ui/overlayCoxinhaMobile.d.ts +10 -0
- package/dist/ui/overlayCoxinhaMobile.d.ts.map +1 -0
- package/dist/ui/userPreviewCoxinha.d.ts +20 -0
- package/dist/ui/userPreviewCoxinha.d.ts.map +1 -0
- package/dist/utils/canvas.d.ts +27 -0
- package/dist/utils/canvas.d.ts.map +1 -0
- package/dist/utils/dom.d.ts +3 -0
- package/dist/utils/dom.d.ts.map +1 -0
- package/dist/vision/faceDetector.d.ts +11 -0
- package/dist/vision/faceDetector.d.ts.map +1 -0
- package/models/README.md +8 -0
- package/models/face_landmark_68_tiny_model-shard1.bin +0 -0
- package/models/face_landmark_68_tiny_model-weights_manifest.json +1 -0
- package/models/tiny_face_detector_model-shard1.bin +0 -0
- package/models/tiny_face_detector_model-weights_manifest.json +1 -0
- package/package.json +31 -7
- package/public/images/alphaloader.gif +0 -0
- package/scripts/copy-models.cjs +31 -0
- package/tsconfig.json +21 -0
- package/vite.config.ts +19 -0
- package/.gitattributes +0 -2
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
mouthWidthRatioDebug?: number;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
import type { AlphaValidStartOptions, AlphaValidState } from './types/sdk';
|
|
7
|
+
export declare function setupModels(): Promise<string>;
|
|
8
|
+
export declare class AlphaValid {
|
|
9
|
+
private _camera;
|
|
10
|
+
private _overlay;
|
|
11
|
+
private _container;
|
|
12
|
+
private _faceDetector;
|
|
13
|
+
private _loopTimer;
|
|
14
|
+
private _lastStatusValid;
|
|
15
|
+
private _options;
|
|
16
|
+
private _status;
|
|
17
|
+
private _challengeIndex;
|
|
18
|
+
private _challengeStartedAt;
|
|
19
|
+
private _challengeEnterAt;
|
|
20
|
+
private _challengeCompletedAt;
|
|
21
|
+
private _challengeBaselineSeen;
|
|
22
|
+
private _blinkArmed;
|
|
23
|
+
private _state;
|
|
24
|
+
private _stableSince;
|
|
25
|
+
private _lastStableCx;
|
|
26
|
+
private _lastStableCy;
|
|
27
|
+
private _lastStableArea;
|
|
28
|
+
private _autoCaptureFired;
|
|
29
|
+
private _lastGoodStatus;
|
|
30
|
+
private _lastGoodAt;
|
|
31
|
+
/**
|
|
32
|
+
* Last detected frame status (most recent tick) used specifically for real-time
|
|
33
|
+
* capture button gating (look-forward).
|
|
34
|
+
*/
|
|
35
|
+
private _lastStatusForCaptureGate;
|
|
36
|
+
private _lastLookForwardGateOk;
|
|
37
|
+
private _poseLatch;
|
|
38
|
+
private _lastPoseChallenge;
|
|
39
|
+
private _mouthJawBaseline;
|
|
40
|
+
private _faceLostAt;
|
|
41
|
+
private _lookForwardOkSince;
|
|
42
|
+
private _blinkCount;
|
|
43
|
+
private _blinkPrevClosed;
|
|
44
|
+
private _cheeseBaseline;
|
|
45
|
+
private _cheeseBaselineSamples;
|
|
46
|
+
private _cheeseBaselineSum;
|
|
47
|
+
private _cheeseBaselineStartedAt;
|
|
48
|
+
private _challengeHoldSince;
|
|
49
|
+
private _challengeLastStepOk;
|
|
50
|
+
private _challengeHoldProgress;
|
|
51
|
+
private _challengeUiProgress;
|
|
52
|
+
/** Keep the last start options so the loop/catch/finally always has access (avoids scope issues). */
|
|
53
|
+
private _startOptions;
|
|
54
|
+
/** Estado de preview: blob da última captura, se em preview. */
|
|
55
|
+
private _previewBlob;
|
|
56
|
+
/** Guardar actions do preview para retake/confirm. */
|
|
57
|
+
private _previewActions;
|
|
58
|
+
private _cheeseWindow;
|
|
59
|
+
private _cheeseWindowStart;
|
|
60
|
+
private _openMouthWindow;
|
|
61
|
+
private _openMouthWindowStart;
|
|
62
|
+
/** Internal SDK lifecycle state machine. */
|
|
63
|
+
private _lifecycle;
|
|
64
|
+
/** Prevent starting multiple detection loops concurrently. */
|
|
65
|
+
private _loopActive;
|
|
66
|
+
/** Internal flag for debug logs (derived from start options). */
|
|
67
|
+
private _debug;
|
|
68
|
+
/** Prevent concurrent capture() executions. */
|
|
69
|
+
private _isCapturing;
|
|
70
|
+
/** userPreview UI (Coxinha mode only). */
|
|
71
|
+
private _userPreviewUi;
|
|
72
|
+
private _userPreviewUrl;
|
|
73
|
+
/** Built-in camera/models loader overlay. */
|
|
74
|
+
private _loader;
|
|
75
|
+
private _captureBtn;
|
|
76
|
+
private _disposeCaptureButton;
|
|
77
|
+
private _syncCaptureButton;
|
|
78
|
+
private _setLifecycle;
|
|
79
|
+
/**
|
|
80
|
+
* Pauses the detection loop without stopping the camera stream or clearing options.
|
|
81
|
+
* Safe to call multiple times.
|
|
82
|
+
*/
|
|
83
|
+
private _pause;
|
|
84
|
+
/**
|
|
85
|
+
* Resume the detection loop after a preview retake without tearing down/restoring options multiple times.
|
|
86
|
+
* Camera & overlay are recreated by calling start() with the original options.
|
|
87
|
+
*/
|
|
88
|
+
private _retakeFromPreview;
|
|
89
|
+
/**
|
|
90
|
+
* Confirms the preview and finalizes the flow.
|
|
91
|
+
*/
|
|
92
|
+
private _confirmFromPreview;
|
|
93
|
+
private _hideUserPreviewUi;
|
|
94
|
+
private _disposeUserPreviewUi;
|
|
95
|
+
/**
|
|
96
|
+
* Chama o preview após captura, pausa detecção e exibe opções de retake/confirm.
|
|
97
|
+
*/
|
|
98
|
+
private _showPreview;
|
|
99
|
+
private _usesCustomPreview;
|
|
100
|
+
private _usesSdkManagedPreview;
|
|
101
|
+
/** Hide camera until everything is ready (prevents showing video before models/overlay are loaded). */
|
|
102
|
+
private _setVideoVisibility;
|
|
103
|
+
/** Esconde vídeo + overlay enquanto o host exibe preview customizado. */
|
|
104
|
+
private _setCaptureSurfaceVisibility;
|
|
105
|
+
start(options: AlphaValidStartOptions): Promise<void>;
|
|
106
|
+
stop(): Promise<void>;
|
|
107
|
+
/** Indica se está em preview (bloqueia detecção/captura). */
|
|
108
|
+
private get _isInPreview();
|
|
109
|
+
capture(): Promise<Blob>;
|
|
110
|
+
getState(): AlphaValidState | null;
|
|
111
|
+
/** Reset the challenge progression back to step 0 (does not restart camera/detector). */
|
|
112
|
+
resetChallenges(): void;
|
|
113
|
+
private getCurrentChallenge;
|
|
114
|
+
private markStepCompletedIfNeeded;
|
|
115
|
+
private mapChallengeToHint;
|
|
116
|
+
private isStableFrame;
|
|
117
|
+
/**
|
|
118
|
+
* Simple, independent lookForward gate for capture.
|
|
119
|
+
* Intentionally does NOT reuse computeFeedback/lookForward challenge state.
|
|
120
|
+
* Returns true when user is roughly facing the camera.
|
|
121
|
+
*/
|
|
122
|
+
private _isLookForwardForCapture;
|
|
123
|
+
private startDetectionLoop;
|
|
124
|
+
}
|
|
125
|
+
export type { AlphaValidHint, AlphaValidStartOptions, AlphaValidState } from './types/sdk';
|
|
126
|
+
//# sourceMappingURL=index.d.ts.map
|