@incodetech/core 0.0.0-dev-20260313-486e658 → 0.0.0-dev-20260313-bc2dab4
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/dist/Actor-BAf9LRYf.d.ts +2 -0
- package/dist/StateMachine-DJpZF_HP.d.ts +2 -0
- package/dist/authentication.d.ts +10 -78
- package/dist/authentication.esm.js +11 -195
- package/dist/authenticationManager-4j4j8ac9.esm.js +197 -0
- package/dist/authenticationManager-DQL9XsaI.d.ts +66 -0
- package/dist/{backCameraStream-B57NWDGu.esm.js → backCameraStream-4aLwsDOv.esm.js} +1 -1
- package/dist/curp-validation.d.ts +4 -4
- package/dist/curp-validation.esm.js +5 -5
- package/dist/{deepsightLoader-BXTRzhYx.esm.js → deepsightLoader-C-Xil8cg.esm.js} +4 -4
- package/dist/{deepsightService-CTK55DG8.esm.js → deepsightService-BgqD33AH.esm.js} +3 -3
- package/dist/{deepsightService-CYCDsan2.d.ts → deepsightService-UhtHJCFb.d.ts} +131 -3
- package/dist/document-capture.d.ts +49 -49
- package/dist/document-capture.esm.js +6 -6
- package/dist/document-upload.d.ts +49 -49
- package/dist/document-upload.esm.js +5 -5
- package/dist/ekyb.d.ts +2 -2
- package/dist/ekyb.esm.js +6 -6
- package/dist/ekyc.d.ts +2 -2
- package/dist/ekyc.esm.js +6 -6
- package/dist/email.d.ts +3 -263
- package/dist/email.esm.js +6 -477
- package/dist/emailManager-DZeOYBQ6.d.ts +335 -0
- package/dist/emailManager-e7j__XBB.esm.js +486 -0
- package/dist/{events-b4_xvENs.esm.js → events-3HzCcoEy.esm.js} +2 -2
- package/dist/extensibility.d.ts +95 -0
- package/dist/extensibility.esm.js +17 -0
- package/dist/face-match.d.ts +1 -1
- package/dist/face-match.esm.js +5 -5
- package/dist/faceCaptureManagerFactory-CiQWYHp2.d.ts +610 -0
- package/dist/{faceCaptureSetup-10lCb_yE.esm.js → faceCaptureSetup-CF9TJlsc.esm.js} +11 -11
- package/dist/flow.d.ts +7 -7
- package/dist/flow.esm.js +5 -5
- package/dist/{flowCompletionService-DHXqHOAk.esm.js → flowCompletionService-CV8Ywiut.esm.js} +2 -2
- package/dist/geolocation.d.ts +1 -1
- package/dist/geolocation.esm.js +5 -5
- package/dist/government-validation.d.ts +1 -1
- package/dist/government-validation.esm.js +4 -4
- package/dist/id-A_upgNRR.esm.js +0 -0
- package/dist/id.d.ts +9 -9
- package/dist/id.esm.js +11 -10
- package/dist/{id-TUJyOPso.esm.js → idCaptureManager-B9BsU7-M.esm.js} +18 -11
- package/dist/{index-5ZEjz-8I.d.ts → idCaptureManager-D8FwP0TW.d.ts} +30 -8
- package/dist/index-BtQzTfU9.d.ts +1 -0
- package/dist/index.d.ts +21 -12
- package/dist/index.esm.js +33 -21
- package/dist/{lib-V3Lo-Jit.esm.js → lib-COh1FH9n.esm.js} +1 -1
- package/dist/phone.d.ts +3 -291
- package/dist/phone.esm.js +6 -551
- package/dist/phoneManager-B6fNmxhw.esm.js +560 -0
- package/dist/phoneManager-BsamACjL.d.ts +370 -0
- package/dist/redirect-to-mobile.d.ts +1 -1
- package/dist/redirect-to-mobile.esm.js +4 -4
- package/dist/selfie.d.ts +10 -408
- package/dist/selfie.esm.js +11 -118
- package/dist/selfieManager-ByV0akn-.esm.js +117 -0
- package/dist/selfieManager-Czysy-lv.d.ts +68 -0
- package/dist/session.d.ts +1 -1
- package/dist/session.esm.js +3 -3
- package/dist/{src-D3v6I2la.esm.js → src-BmVrWkLJ.esm.js} +2 -2
- package/dist/{stats-D76Thmqp.esm.js → stats-kLtQIgsA.esm.js} +1 -1
- package/dist/stats.esm.js +2 -2
- package/dist/{streamingEvents-CQq5fJCL.esm.js → streamingEvents-Cw6kqXEh.esm.js} +3 -3
- package/dist/{types-DnrAr9fb.d.ts → types-BugcSDaO.d.ts} +1 -1
- package/dist/{types-Bn54lmeM.d.ts → types-C9Jo2XOb.d.ts} +1 -1
- package/package.json +5 -1
- package/dist/Actor-B6Lr-x6S.d.ts +0 -2
- package/dist/StateMachine-WHeQE3lC.d.ts +0 -2
- package/dist/faceCaptureManagerFactory-D1NUo68Z.d.ts +0 -231
- package/dist/types-B4KNFqC4.d.ts +0 -130
- /package/dist/{Manager-CG5CQ1kY.d.ts → Manager-CXnC-tN_.d.ts} +0 -0
- /package/dist/{api-3fZO5bmj.esm.js → api-C2uzxrpN.esm.js} +0 -0
- /package/dist/{camera-D7zu0Mls.d.ts → camera-DDn9ILon.d.ts} +0 -0
- /package/dist/{chunk-B1Ox1Owh.esm.js → chunk-C4_ANvih.esm.js} +0 -0
- /package/dist/{endpoints-5sPFFmaB.esm.js → endpoints-IAlXA1zN.esm.js} +0 -0
- /package/dist/{flowCompletionService-DeWKduBI.d.ts → flowCompletionService-D4YDcHQR.d.ts} +0 -0
- /package/dist/{types-BYYaKde4.d.ts → types-DTieLton.d.ts} +0 -0
- /package/dist/{usStates-D4SmlpeT.esm.js → usStates-vWM_ZgEH.esm.js} +0 -0
- /package/dist/{warmup-Da5qDIWZ.d.ts → warmup-Bp_1oXoL.d.ts} +0 -0
- /package/dist/{xstate.esm-07M59Cte.esm.js → xstate.esm-CcoTezCZ.esm.js} +0 -0
package/dist/selfie.d.ts
CHANGED
|
@@ -1,409 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { t as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import "./types-
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
//#region ../infra/src/capabilities/IFaceDetectionCapability.d.ts
|
|
12
|
-
/**
|
|
13
|
-
* Configuration for face detection provider.
|
|
14
|
-
* Extends base ML provider config with face-detection specific options.
|
|
15
|
-
*/
|
|
16
|
-
interface FaceDetectionConfig extends MLProviderConfig {
|
|
17
|
-
autocaptureInterval?: number;
|
|
18
|
-
}
|
|
19
|
-
interface FacePositionConstraints {
|
|
20
|
-
minX: number;
|
|
21
|
-
minY: number;
|
|
22
|
-
maxX: number;
|
|
23
|
-
maxY: number;
|
|
24
|
-
}
|
|
25
|
-
interface FaceDetectionThresholds {
|
|
26
|
-
brightnessThreshold: number;
|
|
27
|
-
blurrinessThreshold: number;
|
|
28
|
-
tiltRotationAngleThreshold: number;
|
|
29
|
-
minMagicCropSize: number;
|
|
30
|
-
autocaptureInterval: number;
|
|
31
|
-
minFaceQualityScore: number;
|
|
32
|
-
faceOcclusionThreshold: number;
|
|
33
|
-
}
|
|
34
|
-
interface FaceAttributesThresholds {
|
|
35
|
-
headwearThreshold: number;
|
|
36
|
-
lensesThreshold: number;
|
|
37
|
-
closedEyesThreshold: number;
|
|
38
|
-
maskThreshold: number;
|
|
39
|
-
}
|
|
40
|
-
interface FaceChecksConfig {
|
|
41
|
-
lenses: boolean;
|
|
42
|
-
mask: boolean;
|
|
43
|
-
closedEyes: boolean;
|
|
44
|
-
headWear: boolean;
|
|
45
|
-
occlusion: boolean;
|
|
46
|
-
}
|
|
47
|
-
interface FaceData {
|
|
48
|
-
rect: {
|
|
49
|
-
x: number;
|
|
50
|
-
y: number;
|
|
51
|
-
width: number;
|
|
52
|
-
height: number;
|
|
53
|
-
};
|
|
54
|
-
rightEye: {
|
|
55
|
-
x: number;
|
|
56
|
-
y: number;
|
|
57
|
-
};
|
|
58
|
-
leftEye: {
|
|
59
|
-
x: number;
|
|
60
|
-
y: number;
|
|
61
|
-
};
|
|
62
|
-
noseTip: {
|
|
63
|
-
x: number;
|
|
64
|
-
y: number;
|
|
65
|
-
};
|
|
66
|
-
rightMouthCorner: {
|
|
67
|
-
x: number;
|
|
68
|
-
y: number;
|
|
69
|
-
};
|
|
70
|
-
leftMouthCorner: {
|
|
71
|
-
x: number;
|
|
72
|
-
y: number;
|
|
73
|
-
};
|
|
74
|
-
pitch: number;
|
|
75
|
-
yaw: number;
|
|
76
|
-
roll: number;
|
|
77
|
-
}
|
|
78
|
-
type FaceCoordinates = {
|
|
79
|
-
rightEyeX: number;
|
|
80
|
-
rightEyeY: number;
|
|
81
|
-
leftEyeX: number;
|
|
82
|
-
leftEyeY: number;
|
|
83
|
-
noseTipX: number;
|
|
84
|
-
noseTipY: number;
|
|
85
|
-
rightMouthX: number;
|
|
86
|
-
rightMouthY: number;
|
|
87
|
-
mouthX: number;
|
|
88
|
-
mouthY: number;
|
|
89
|
-
x: number;
|
|
90
|
-
y: number;
|
|
91
|
-
width: number;
|
|
92
|
-
height: number;
|
|
93
|
-
};
|
|
94
|
-
interface FaceDetectionCallbacks {
|
|
95
|
-
onFarAway?: () => void;
|
|
96
|
-
onTooClose?: () => void;
|
|
97
|
-
onTooManyFaces?: () => void;
|
|
98
|
-
onNoFace?: () => void;
|
|
99
|
-
onCapture?: (canvas: IncodeCanvas, faceCoordinates: FaceCoordinates) => void;
|
|
100
|
-
onGetReady?: () => void;
|
|
101
|
-
onGetReadyFinished?: () => void;
|
|
102
|
-
onCenterFace?: () => void;
|
|
103
|
-
onDark?: () => void;
|
|
104
|
-
onBlur?: () => void;
|
|
105
|
-
onFaceAngle?: () => void;
|
|
106
|
-
onBestShot?: (face: FaceData) => void;
|
|
107
|
-
onLenses?: () => void;
|
|
108
|
-
onMask?: () => void;
|
|
109
|
-
onEyesClosed?: () => void;
|
|
110
|
-
onHeadWear?: () => void;
|
|
111
|
-
onSwitchToManualCapture?: () => void;
|
|
112
|
-
onFaceOccluded?: () => void;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Capability interface for face detection and selfie capture.
|
|
116
|
-
* Extends the base ML provider capability with face-detection specific methods.
|
|
117
|
-
*/
|
|
118
|
-
interface IFaceDetectionCapability extends IMLProviderCapability<FaceDetectionConfig> {
|
|
119
|
-
/**
|
|
120
|
-
* Sets callbacks for face detection events.
|
|
121
|
-
* @param callbacks - Object containing callback functions for various detection events
|
|
122
|
-
*/
|
|
123
|
-
setCallbacks(callbacks: FaceDetectionCallbacks): void;
|
|
124
|
-
/**
|
|
125
|
-
* Sets position constraints for face detection.
|
|
126
|
-
* @param constraints - Bounding box constraints for valid face position
|
|
127
|
-
*/
|
|
128
|
-
setPositionConstraints(constraints: FacePositionConstraints): void;
|
|
129
|
-
/**
|
|
130
|
-
* Sets detection thresholds for quality checks.
|
|
131
|
-
* @param thresholds - Threshold values for various quality metrics
|
|
132
|
-
*/
|
|
133
|
-
setThresholds(thresholds: FaceDetectionThresholds): void;
|
|
134
|
-
/**
|
|
135
|
-
* Sets thresholds for face attribute detection.
|
|
136
|
-
* @param thresholds - Threshold values for attribute detection (headwear, lenses, etc.)
|
|
137
|
-
*/
|
|
138
|
-
setAttributesThresholds(thresholds: FaceAttributesThresholds): void;
|
|
139
|
-
/**
|
|
140
|
-
* Enables or disables specific face checks.
|
|
141
|
-
* @param config - Configuration for which checks to enable
|
|
142
|
-
*/
|
|
143
|
-
setChecksEnabled(config: FaceChecksConfig): void;
|
|
144
|
-
/**
|
|
145
|
-
* Sets video selfie mode.
|
|
146
|
-
* @param enabled - Whether to enable video selfie mode
|
|
147
|
-
*/
|
|
148
|
-
setVideoSelfieMode(enabled: boolean): void;
|
|
149
|
-
}
|
|
150
|
-
//#endregion
|
|
151
|
-
//#region ../infra/src/wasm/WasmPipelineType.d.ts
|
|
152
|
-
declare enum WasmPipelineType {
|
|
153
|
-
IdBlurGlarePipeline = 0,
|
|
154
|
-
IdBarcodeAndTextQualityPipeline = 1,
|
|
155
|
-
IdVideoSelfiePipeline = 2,
|
|
156
|
-
SelfieWithAggregationMetrics = 3,
|
|
157
|
-
SelfieWithQualityMetrics = 4,
|
|
158
|
-
IdFaceDetectionPipeline = 5,
|
|
159
|
-
}
|
|
160
|
-
//#endregion
|
|
161
|
-
//#region ../infra/src/providers/wasm/BaseWasmProvider.d.ts
|
|
162
|
-
/**
|
|
163
|
-
* Base configuration for WASM providers
|
|
164
|
-
*/
|
|
165
|
-
interface BaseWasmConfig {
|
|
166
|
-
/** Path to the WASM binary */
|
|
167
|
-
wasmPath?: string;
|
|
168
|
-
/** Path to the SIMD-optimized WASM binary (optional) */
|
|
169
|
-
wasmSimdPath?: string;
|
|
170
|
-
/** Path to the WASM glue code */
|
|
171
|
-
glueCodePath?: string;
|
|
172
|
-
/** Whether to use SIMD optimizations (default: true) */
|
|
173
|
-
useSimd?: boolean;
|
|
174
|
-
/**
|
|
175
|
-
* Base path for ML model files. Models will be loaded from `${modelsBasePath}/${modelFileName}`.
|
|
176
|
-
* If not provided, models are expected in a 'models' subdirectory relative to the WASM binary.
|
|
177
|
-
*/
|
|
178
|
-
modelsBasePath?: string;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Base provider class that abstracts common WASM functionality.
|
|
182
|
-
* This serves as a foundation for specific ML capability providers
|
|
183
|
-
* like FaceDetectionProvider and IdCaptureProvider.
|
|
184
|
-
*/
|
|
185
|
-
declare abstract class BaseWasmProvider {
|
|
186
|
-
private _isInitialized;
|
|
187
|
-
protected pipelineType: WasmPipelineType | undefined;
|
|
188
|
-
/**
|
|
189
|
-
* Creates a new BaseWasmProvider
|
|
190
|
-
* @param pipelineType - The WASM pipeline type this provider uses
|
|
191
|
-
*/
|
|
192
|
-
constructor(pipelineType?: WasmPipelineType);
|
|
193
|
-
/**
|
|
194
|
-
* Returns whether this provider has been initialized.
|
|
195
|
-
*/
|
|
196
|
-
get initialized(): boolean;
|
|
197
|
-
protected getPipelineType(): WasmPipelineType;
|
|
198
|
-
/**
|
|
199
|
-
* Initializes the provider by ensuring WASM is loaded
|
|
200
|
-
* @param config - Provider configuration
|
|
201
|
-
* @param pipeline - The pipeline type to warm up ('selfie', 'idCapture', etc.)
|
|
202
|
-
*/
|
|
203
|
-
protected initializeBase(config: BaseWasmConfig, pipeline: WasmPipeline): Promise<void>;
|
|
204
|
-
/**
|
|
205
|
-
* Ensures the provider is initialized before performing operations.
|
|
206
|
-
* @throws Error if not initialized
|
|
207
|
-
*/
|
|
208
|
-
protected ensureInitialized(): void;
|
|
209
|
-
/**
|
|
210
|
-
* Processes a frame through the WASM pipeline
|
|
211
|
-
* @param image - Image data to process
|
|
212
|
-
* @returns The pipeline result (type depends on pipeline - WASM returns any)
|
|
213
|
-
*/
|
|
214
|
-
protected processFrameWasm(image: ImageData): Promise<any>;
|
|
215
|
-
abstract processFrame(image: ImageData): Promise<void>;
|
|
216
|
-
/**
|
|
217
|
-
* Resets the pipeline to its initial state.
|
|
218
|
-
* Safe to call even if not initialized (no-op in that case).
|
|
219
|
-
*/
|
|
220
|
-
reset(): void;
|
|
221
|
-
/**
|
|
222
|
-
* Disposes of resources and resets initialization state.
|
|
223
|
-
* Safe to call even if not initialized.
|
|
224
|
-
*/
|
|
225
|
-
dispose(): Promise<void>;
|
|
226
|
-
}
|
|
227
|
-
//#endregion
|
|
228
|
-
//#region ../infra/src/providers/wasm/FaceDetectionProvider.d.ts
|
|
229
|
-
declare class FaceDetectionProvider extends BaseWasmProvider implements IFaceDetectionCapability {
|
|
230
|
-
private defaultThresholds;
|
|
231
|
-
private currentThresholds;
|
|
232
|
-
private currentFrame;
|
|
233
|
-
private bestCanvas;
|
|
234
|
-
private bestFace;
|
|
235
|
-
constructor();
|
|
236
|
-
processFrame(image: ImageData): Promise<void>;
|
|
237
|
-
initialize(config: FaceDetectionConfig): Promise<void>;
|
|
238
|
-
setCallbacks(callbacks: FaceDetectionCallbacks): void;
|
|
239
|
-
setPositionConstraints(constraints: FacePositionConstraints): void;
|
|
240
|
-
applyDefaults(autocaptureInterval?: number): void;
|
|
241
|
-
setAutocaptureInterval(interval: number): void;
|
|
242
|
-
setThresholds(thresholds: FaceDetectionThresholds): void;
|
|
243
|
-
setAttributesThresholds(thresholds: FaceAttributesThresholds): void;
|
|
244
|
-
setChecksEnabled(config: FaceChecksConfig): void;
|
|
245
|
-
setVideoSelfieMode(enabled: boolean): void;
|
|
246
|
-
reset(): void;
|
|
247
|
-
private createDefaultFaceCoordinates;
|
|
248
|
-
private formatFaceCoordinates;
|
|
249
|
-
}
|
|
250
|
-
//#endregion
|
|
251
|
-
//#region src/modules/selfie/types.d.ts
|
|
252
|
-
type SelfieConfig = FlowModuleConfig['SELFIE'] & BaseFaceCaptureConfig;
|
|
253
|
-
type SelfieDependencies = FaceCaptureDependencies;
|
|
254
|
-
//#endregion
|
|
255
|
-
//#region src/modules/selfie/selfieUploadService.d.ts
|
|
256
|
-
type ProcessFaceImageType = 'selfie' | 'videoSelfie';
|
|
257
|
-
type ProcessFaceResponse = {
|
|
258
|
-
faceMatch: boolean;
|
|
259
|
-
confidence: number;
|
|
260
|
-
existingUser: boolean;
|
|
261
|
-
};
|
|
262
|
-
declare function processFace(imageType?: ProcessFaceImageType, signal?: AbortSignal): Promise<ProcessFaceResponse>;
|
|
263
|
-
//#endregion
|
|
264
|
-
//#region src/internal/faceCapture/recordingService.d.ts
|
|
265
|
-
type RecordingService = {
|
|
266
|
-
start(stream: MediaStream): Promise<void>;
|
|
267
|
-
stop(): Promise<{
|
|
268
|
-
recordingId: string | null;
|
|
269
|
-
}>;
|
|
270
|
-
cleanup(): void;
|
|
271
|
-
};
|
|
272
|
-
//#endregion
|
|
273
|
-
//#region src/internal/faceCapture/faceCaptureSetup.d.ts
|
|
274
|
-
type FaceCaptureConfig = BaseFaceCaptureConfig;
|
|
275
|
-
type FaceCaptureInput = {
|
|
276
|
-
config: FaceCaptureConfig;
|
|
277
|
-
dependencies: FaceCaptureDependencies;
|
|
278
|
-
authHint?: string;
|
|
279
|
-
};
|
|
280
|
-
type FaceErrorObject = {
|
|
281
|
-
type: string;
|
|
282
|
-
message: string;
|
|
283
|
-
};
|
|
284
|
-
type FaceCaptureContext = {
|
|
285
|
-
config: FaceCaptureConfig;
|
|
286
|
-
dependencies: FaceCaptureDependencies;
|
|
287
|
-
authHint: string | undefined;
|
|
288
|
-
stream: CameraStream | undefined;
|
|
289
|
-
provider: FaceDetectionProvider | undefined;
|
|
290
|
-
frameCapturer: StreamCanvasCapture | undefined;
|
|
291
|
-
error: string | FaceErrorObject | undefined;
|
|
292
|
-
detectionStatus: DetectionStatus;
|
|
293
|
-
debugFrame: ImageData | undefined;
|
|
294
|
-
capturedImage: IncodeCanvas | undefined;
|
|
295
|
-
faceCoordinates: FaceCoordinates | undefined;
|
|
296
|
-
uploadResponse: Record<string, unknown> | undefined;
|
|
297
|
-
processResponse: Record<string, unknown> | undefined;
|
|
298
|
-
recordingService: RecordingService | undefined;
|
|
299
|
-
attemptsRemaining: number;
|
|
300
|
-
uploadError: FaceErrorCode | undefined;
|
|
301
|
-
permissionResult: PermissionResult | 'refresh' | undefined;
|
|
302
|
-
resetDetection: (() => void) | undefined;
|
|
303
|
-
deepsightService: DeepsightService | undefined;
|
|
304
|
-
encryptedBase64Image: string | undefined;
|
|
305
|
-
uploadRecordingId: string | null | undefined;
|
|
306
|
-
manualCaptureTriggered: boolean;
|
|
307
|
-
};
|
|
308
|
-
type FaceCaptureEvent = {
|
|
309
|
-
type: 'LOAD';
|
|
310
|
-
} | {
|
|
311
|
-
type: 'NEXT_STEP';
|
|
312
|
-
} | {
|
|
313
|
-
type: 'REQUEST_PERMISSION';
|
|
314
|
-
} | {
|
|
315
|
-
type: 'GO_TO_LEARN_MORE';
|
|
316
|
-
} | {
|
|
317
|
-
type: 'BACK';
|
|
318
|
-
} | {
|
|
319
|
-
type: 'QUIT';
|
|
320
|
-
} | {
|
|
321
|
-
type: 'RESET';
|
|
322
|
-
} | {
|
|
323
|
-
type: 'MANUAL_CAPTURE';
|
|
324
|
-
} | {
|
|
325
|
-
type: 'DETECTION_UPDATE';
|
|
326
|
-
status: DetectionStatus;
|
|
327
|
-
} | {
|
|
328
|
-
type: 'DETECTION_FRAME';
|
|
329
|
-
frame: ImageData;
|
|
330
|
-
} | {
|
|
331
|
-
type: 'DETECTION_SUCCESS';
|
|
332
|
-
canvas: IncodeCanvas;
|
|
333
|
-
faceCoordinates?: FaceCoordinates;
|
|
334
|
-
} | {
|
|
335
|
-
type: 'DETECTION_RESET_READY';
|
|
336
|
-
reset: () => void;
|
|
337
|
-
} | {
|
|
338
|
-
type: 'RETRY_CAPTURE';
|
|
339
|
-
};
|
|
340
|
-
//#endregion
|
|
341
|
-
//#region src/modules/selfie/selfieStateMachine.d.ts
|
|
342
|
-
type SelfieContext = FaceCaptureContext;
|
|
343
|
-
type SelfieEvent = FaceCaptureEvent;
|
|
344
|
-
type SelfieInput = FaceCaptureInput;
|
|
345
|
-
/**
|
|
346
|
-
* The selfie capture state machine.
|
|
347
|
-
*
|
|
348
|
-
* Note: Uses AnyStateMachine type for declaration file portability.
|
|
349
|
-
* Type safety is ensured via the machine configuration.
|
|
350
|
-
*/
|
|
351
|
-
declare const selfieMachine: AnyStateMachine;
|
|
352
|
-
/**
|
|
353
|
-
* Type representing the selfie machine.
|
|
354
|
-
* For advanced use cases requiring specific machine types.
|
|
355
|
-
*/
|
|
356
|
-
type SelfieMachine = StateMachine<SelfieContext, SelfieEvent, any, any, any, any, any, any, any, SelfieInput, any, any, any, any>;
|
|
357
|
-
//#endregion
|
|
358
|
-
//#region src/modules/selfie/selfieActor.d.ts
|
|
359
|
-
type CreateSelfieActorOptions = {
|
|
360
|
-
config: SelfieConfig;
|
|
361
|
-
dependencies?: SelfieDependencies;
|
|
362
|
-
authHint?: string;
|
|
363
|
-
};
|
|
364
|
-
//#endregion
|
|
365
|
-
//#region src/modules/selfie/selfieManager.d.ts
|
|
366
|
-
type SelfieState = FaceCaptureManagerState;
|
|
367
|
-
/**
|
|
368
|
-
* Creates a selfie manager instance for handling selfie capture flow.
|
|
369
|
-
*
|
|
370
|
-
* The selfie manager provides:
|
|
371
|
-
* - State management with statuses: `idle`, `loading`, `tutorial`, `permissions`, `capture`, `finished`, `closed`, `error`
|
|
372
|
-
* - Permission handling with nested states: `idle`, `requesting`, `denied`, `learnMore`
|
|
373
|
-
* - Capture handling with nested states: `initializing`, `startingRecorder`, `recordingActive`, `detecting`, `capturing`, `uploading`, `uploadError`, `success`
|
|
374
|
-
* - Camera stream access when in `capture` state
|
|
375
|
-
* - Detection status feedback during face detection
|
|
376
|
-
* - Attempt tracking with `attemptsRemaining`
|
|
377
|
-
*
|
|
378
|
-
* @param options - Configuration for the selfie actor
|
|
379
|
-
* @param options.config - The selfie module configuration from the flow
|
|
380
|
-
* @returns A manager instance with state subscription, API methods, and lifecycle controls
|
|
381
|
-
*
|
|
382
|
-
* @example
|
|
383
|
-
* ```ts
|
|
384
|
-
* const selfieManager = createSelfieManager({ config: selfieConfig });
|
|
385
|
-
*
|
|
386
|
-
* selfieManager.subscribe((state) => {
|
|
387
|
-
* if (state.status === 'capture') {
|
|
388
|
-
* console.log('Camera ready:', state.stream);
|
|
389
|
-
* console.log('Detection status:', state.detectionStatus);
|
|
390
|
-
* }
|
|
391
|
-
* });
|
|
392
|
-
*
|
|
393
|
-
* selfieManager.load();
|
|
394
|
-
* ```
|
|
395
|
-
*/
|
|
396
|
-
declare function createSelfieManager(options: CreateSelfieActorOptions): Manager<FaceCaptureManagerState> & {
|
|
397
|
-
load(): void;
|
|
398
|
-
nextStep(): void;
|
|
399
|
-
requestPermission(): void;
|
|
400
|
-
goToLearnMore(): void;
|
|
401
|
-
back(): void;
|
|
402
|
-
close(): void;
|
|
403
|
-
reset(): void;
|
|
404
|
-
retryCapture(): void;
|
|
405
|
-
capture(): void;
|
|
406
|
-
};
|
|
407
|
-
type SelfieManager = FaceCaptureManager;
|
|
408
|
-
//#endregion
|
|
1
|
+
import { n as PermissionResult, r as PermissionStatus, t as DeepsightService } from "./deepsightService-UhtHJCFb.js";
|
|
2
|
+
import { _ as DetectionStatus, a as SelfieMachine, d as SelfieConfig, o as selfieMachine, v as FaceErrorCode } from "./faceCaptureManagerFactory-CiQWYHp2.js";
|
|
3
|
+
import "./warmup-Bp_1oXoL.js";
|
|
4
|
+
import "./Manager-CXnC-tN_.js";
|
|
5
|
+
import { t as CameraStream } from "./camera-DDn9ILon.js";
|
|
6
|
+
import "./Actor-BAf9LRYf.js";
|
|
7
|
+
import "./StateMachine-DJpZF_HP.js";
|
|
8
|
+
import "./types-BugcSDaO.js";
|
|
9
|
+
import "./types-C9Jo2XOb.js";
|
|
10
|
+
import { a as ProcessFaceResponse, n as SelfieState, o as processFace, r as createSelfieManager, t as SelfieManager } from "./selfieManager-Czysy-lv.js";
|
|
409
11
|
export { type CameraStream, type DeepsightService, type DetectionStatus, type FaceErrorCode, type PermissionResult, type PermissionStatus, type ProcessFaceResponse, type SelfieConfig, type SelfieMachine, type SelfieManager, type SelfieState, createSelfieManager, processFace, selfieMachine };
|
package/dist/selfie.esm.js
CHANGED
|
@@ -1,120 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./backCameraStream-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import "./streamingEvents-
|
|
6
|
-
import "./deepsightService-
|
|
7
|
-
import "./api-
|
|
8
|
-
import "./endpoints-
|
|
9
|
-
import "./stats-
|
|
10
|
-
import {
|
|
1
|
+
import "./events-3HzCcoEy.esm.js";
|
|
2
|
+
import "./backCameraStream-4aLwsDOv.esm.js";
|
|
3
|
+
import "./src-BmVrWkLJ.esm.js";
|
|
4
|
+
import "./xstate.esm-CcoTezCZ.esm.js";
|
|
5
|
+
import "./streamingEvents-Cw6kqXEh.esm.js";
|
|
6
|
+
import "./deepsightService-BgqD33AH.esm.js";
|
|
7
|
+
import "./api-C2uzxrpN.esm.js";
|
|
8
|
+
import "./endpoints-IAlXA1zN.esm.js";
|
|
9
|
+
import "./stats-kLtQIgsA.esm.js";
|
|
10
|
+
import { r as processFace } from "./faceCaptureSetup-CF9TJlsc.esm.js";
|
|
11
|
+
import { r as selfieMachine, t as createSelfieManager } from "./selfieManager-ByV0akn-.esm.js";
|
|
11
12
|
|
|
12
|
-
//#region src/modules/selfie/selfieErrorUtils.ts
|
|
13
|
-
const FACE_ERROR_CODE_VALUES = Object.values(FACE_ERROR_CODES);
|
|
14
|
-
const validateUploadResponse = ({ config, response }) => {
|
|
15
|
-
if (!response) return FACE_ERROR_CODES.SERVER;
|
|
16
|
-
if (response.confidence !== 0) return FACE_ERROR_CODES.LIVENESS;
|
|
17
|
-
if (config.validateBrightness && !response.isBright) return FACE_ERROR_CODES.BRIGHTNESS;
|
|
18
|
-
if (config.validateLenses && response.hasLenses) return FACE_ERROR_CODES.LENSES;
|
|
19
|
-
if (config.validateFaceMask && response.hasFaceMask) return FACE_ERROR_CODES.MASK;
|
|
20
|
-
if (config.validateClosedEyes && response.hasClosedEyes) return FACE_ERROR_CODES.CLOSED_EYES;
|
|
21
|
-
if (config.validateHeadCover && response.hasHeadCover) return FACE_ERROR_CODES.HEAD_COVER;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region src/modules/selfie/selfieStateMachine.ts
|
|
26
|
-
const _selfieMachine = faceCaptureMachine.provide({
|
|
27
|
-
actors: {
|
|
28
|
-
uploadFace: fromPromise(async ({ input, signal }) => {
|
|
29
|
-
const ctx = input;
|
|
30
|
-
return uploadSelfie({
|
|
31
|
-
encryptedBase64Image: ctx.encryptedBase64Image,
|
|
32
|
-
faceCoordinates: ctx.faceCoordinates,
|
|
33
|
-
metadata: ctx.deepsightService?.getMetadata(),
|
|
34
|
-
recordingId: ctx.uploadRecordingId,
|
|
35
|
-
signal
|
|
36
|
-
});
|
|
37
|
-
}),
|
|
38
|
-
processFace: fromPromise(async ({ signal }) => {
|
|
39
|
-
return processFace("selfie", signal);
|
|
40
|
-
})
|
|
41
|
-
},
|
|
42
|
-
actions: {
|
|
43
|
-
trackContinue: () => {
|
|
44
|
-
addEvent({
|
|
45
|
-
code: FACE_CAPTURE_EVENT_CODES.CONTINUE,
|
|
46
|
-
module: eventModuleNames.selfie
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
setUploadErrorFromUploadValidation: assign({ uploadError: ({ context }) => validateUploadResponse({
|
|
50
|
-
config: context.config,
|
|
51
|
-
response: context.uploadResponse
|
|
52
|
-
}) ?? FACE_ERROR_CODES.SERVER })
|
|
53
|
-
},
|
|
54
|
-
guards: {
|
|
55
|
-
hasUploadValidationError: ({ context }) => validateUploadResponse({
|
|
56
|
-
config: context.config,
|
|
57
|
-
response: context.uploadResponse
|
|
58
|
-
}) !== void 0,
|
|
59
|
-
isTerminalUploadError: () => false
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
/**
|
|
63
|
-
* The selfie capture state machine.
|
|
64
|
-
*
|
|
65
|
-
* Note: Uses AnyStateMachine type for declaration file portability.
|
|
66
|
-
* Type safety is ensured via the machine configuration.
|
|
67
|
-
*/
|
|
68
|
-
const selfieMachine = _selfieMachine;
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region src/modules/selfie/selfieActor.ts
|
|
72
|
-
function createSelfieActor(options) {
|
|
73
|
-
const dependencies = options.dependencies ?? {
|
|
74
|
-
storage: new BrowserStorageProvider(),
|
|
75
|
-
getWasmUtil: () => WasmUtilProvider.getInstance()
|
|
76
|
-
};
|
|
77
|
-
return createActor(selfieMachine, { input: {
|
|
78
|
-
config: options.config,
|
|
79
|
-
dependencies,
|
|
80
|
-
authHint: options.authHint
|
|
81
|
-
} }).start();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
//#endregion
|
|
85
|
-
//#region src/modules/selfie/selfieManager.ts
|
|
86
|
-
/**
|
|
87
|
-
* Creates a selfie manager instance for handling selfie capture flow.
|
|
88
|
-
*
|
|
89
|
-
* The selfie manager provides:
|
|
90
|
-
* - State management with statuses: `idle`, `loading`, `tutorial`, `permissions`, `capture`, `finished`, `closed`, `error`
|
|
91
|
-
* - Permission handling with nested states: `idle`, `requesting`, `denied`, `learnMore`
|
|
92
|
-
* - Capture handling with nested states: `initializing`, `startingRecorder`, `recordingActive`, `detecting`, `capturing`, `uploading`, `uploadError`, `success`
|
|
93
|
-
* - Camera stream access when in `capture` state
|
|
94
|
-
* - Detection status feedback during face detection
|
|
95
|
-
* - Attempt tracking with `attemptsRemaining`
|
|
96
|
-
*
|
|
97
|
-
* @param options - Configuration for the selfie actor
|
|
98
|
-
* @param options.config - The selfie module configuration from the flow
|
|
99
|
-
* @returns A manager instance with state subscription, API methods, and lifecycle controls
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```ts
|
|
103
|
-
* const selfieManager = createSelfieManager({ config: selfieConfig });
|
|
104
|
-
*
|
|
105
|
-
* selfieManager.subscribe((state) => {
|
|
106
|
-
* if (state.status === 'capture') {
|
|
107
|
-
* console.log('Camera ready:', state.stream);
|
|
108
|
-
* console.log('Detection status:', state.detectionStatus);
|
|
109
|
-
* }
|
|
110
|
-
* });
|
|
111
|
-
*
|
|
112
|
-
* selfieManager.load();
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
function createSelfieManager(options) {
|
|
116
|
-
return createFaceCaptureManager(createSelfieActor(options));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
//#endregion
|
|
120
13
|
export { createSelfieManager, processFace, selfieMachine };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { d as addEvent, n as eventModuleNames } from "./events-3HzCcoEy.esm.js";
|
|
2
|
+
import { _ as BrowserStorageProvider, a as WasmUtilProvider } from "./src-BmVrWkLJ.esm.js";
|
|
3
|
+
import { a as createActor, i as fromPromise, n as assign } from "./xstate.esm-CcoTezCZ.esm.js";
|
|
4
|
+
import { a as FACE_ERROR_CODES, i as uploadSelfie, n as faceCaptureMachine, o as createFaceCaptureManagerFromActor, r as processFace, t as FACE_CAPTURE_EVENT_CODES } from "./faceCaptureSetup-CF9TJlsc.esm.js";
|
|
5
|
+
|
|
6
|
+
//#region src/modules/selfie/selfieErrorUtils.ts
|
|
7
|
+
const FACE_ERROR_CODE_VALUES = Object.values(FACE_ERROR_CODES);
|
|
8
|
+
const validateUploadResponse = ({ config, response }) => {
|
|
9
|
+
if (!response) return FACE_ERROR_CODES.SERVER;
|
|
10
|
+
if (response.confidence !== 0) return FACE_ERROR_CODES.LIVENESS;
|
|
11
|
+
if (config.validateBrightness && !response.isBright) return FACE_ERROR_CODES.BRIGHTNESS;
|
|
12
|
+
if (config.validateLenses && response.hasLenses) return FACE_ERROR_CODES.LENSES;
|
|
13
|
+
if (config.validateFaceMask && response.hasFaceMask) return FACE_ERROR_CODES.MASK;
|
|
14
|
+
if (config.validateClosedEyes && response.hasClosedEyes) return FACE_ERROR_CODES.CLOSED_EYES;
|
|
15
|
+
if (config.validateHeadCover && response.hasHeadCover) return FACE_ERROR_CODES.HEAD_COVER;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/modules/selfie/selfieStateMachine.ts
|
|
20
|
+
const _selfieMachine = faceCaptureMachine.provide({
|
|
21
|
+
actors: {
|
|
22
|
+
uploadFace: fromPromise(async ({ input, signal }) => {
|
|
23
|
+
const ctx = input;
|
|
24
|
+
return uploadSelfie({
|
|
25
|
+
encryptedBase64Image: ctx.encryptedBase64Image,
|
|
26
|
+
faceCoordinates: ctx.faceCoordinates,
|
|
27
|
+
metadata: ctx.deepsightService?.getMetadata(),
|
|
28
|
+
recordingId: ctx.uploadRecordingId,
|
|
29
|
+
signal
|
|
30
|
+
});
|
|
31
|
+
}),
|
|
32
|
+
processFace: fromPromise(async ({ signal }) => {
|
|
33
|
+
return processFace("selfie", signal);
|
|
34
|
+
})
|
|
35
|
+
},
|
|
36
|
+
actions: {
|
|
37
|
+
trackContinue: () => {
|
|
38
|
+
addEvent({
|
|
39
|
+
code: FACE_CAPTURE_EVENT_CODES.CONTINUE,
|
|
40
|
+
module: eventModuleNames.selfie
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
setUploadErrorFromUploadValidation: assign({ uploadError: ({ context }) => validateUploadResponse({
|
|
44
|
+
config: context.config,
|
|
45
|
+
response: context.uploadResponse
|
|
46
|
+
}) ?? FACE_ERROR_CODES.SERVER })
|
|
47
|
+
},
|
|
48
|
+
guards: {
|
|
49
|
+
hasUploadValidationError: ({ context }) => validateUploadResponse({
|
|
50
|
+
config: context.config,
|
|
51
|
+
response: context.uploadResponse
|
|
52
|
+
}) !== void 0,
|
|
53
|
+
isTerminalUploadError: () => false
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* The selfie capture state machine.
|
|
58
|
+
*
|
|
59
|
+
* Note: Uses AnyStateMachine type for declaration file portability.
|
|
60
|
+
* Type safety is ensured via the machine configuration.
|
|
61
|
+
*/
|
|
62
|
+
const selfieMachine = _selfieMachine;
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/modules/selfie/selfieActor.ts
|
|
66
|
+
function createSelfieActor(options) {
|
|
67
|
+
const dependencies = options.dependencies ?? {
|
|
68
|
+
storage: new BrowserStorageProvider(),
|
|
69
|
+
getWasmUtil: () => WasmUtilProvider.getInstance()
|
|
70
|
+
};
|
|
71
|
+
return createActor(selfieMachine, { input: {
|
|
72
|
+
config: options.config,
|
|
73
|
+
dependencies,
|
|
74
|
+
authHint: options.authHint
|
|
75
|
+
} }).start();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/modules/selfie/selfieManager.ts
|
|
80
|
+
function createSelfieManagerFromActor(actor) {
|
|
81
|
+
return createFaceCaptureManagerFromActor(actor);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Creates a selfie manager instance for handling selfie capture flow.
|
|
85
|
+
*
|
|
86
|
+
* The selfie manager provides:
|
|
87
|
+
* - State management with statuses: `idle`, `loading`, `tutorial`, `permissions`, `capture`, `finished`, `closed`, `error`
|
|
88
|
+
* - Permission handling with nested states: `idle`, `requesting`, `denied`, `learnMore`
|
|
89
|
+
* - Capture handling with nested states: `initializing`, `startingRecorder`, `recordingActive`, `detecting`, `capturing`, `uploading`, `uploadError`, `success`
|
|
90
|
+
* - Camera stream access when in `capture` state
|
|
91
|
+
* - Detection status feedback during face detection
|
|
92
|
+
* - Attempt tracking with `attemptsRemaining`
|
|
93
|
+
*
|
|
94
|
+
* @param options - Configuration for the selfie actor
|
|
95
|
+
* @param options.config - The selfie module configuration from the flow
|
|
96
|
+
* @returns A manager instance with state subscription, API methods, and lifecycle controls
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* const selfieManager = createSelfieManager({ config: selfieConfig });
|
|
101
|
+
*
|
|
102
|
+
* selfieManager.subscribe((state) => {
|
|
103
|
+
* if (state.status === 'capture') {
|
|
104
|
+
* console.log('Camera ready:', state.stream);
|
|
105
|
+
* console.log('Detection status:', state.detectionStatus);
|
|
106
|
+
* }
|
|
107
|
+
* });
|
|
108
|
+
*
|
|
109
|
+
* selfieManager.load();
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
function createSelfieManager(options) {
|
|
113
|
+
return createFaceCaptureManagerFromActor(createSelfieActor(options));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
//#endregion
|
|
117
|
+
export { createSelfieManagerFromActor as n, selfieMachine as r, createSelfieManager as t };
|