@incodetech/core 0.0.0-dev-20260126-4504c5b
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/Manager-Co-PsiG9.d.ts +19 -0
- package/dist/OpenViduLogger-BLxxXoyF.esm.js +803 -0
- package/dist/OpenViduLogger-DyqID_-7.esm.js +3 -0
- package/dist/api-DfRLAneb.esm.js +53 -0
- package/dist/chunk-V5DOKNPJ.esm.js +49 -0
- package/dist/deepsightLoader-BMT0FSg6.esm.js +24 -0
- package/dist/deepsightService-j5zMt6wf.esm.js +236 -0
- package/dist/email.d.ts +264 -0
- package/dist/email.esm.js +478 -0
- package/dist/endpoints-BUsSVoJV.esm.js +3288 -0
- package/dist/events-B8ZkhAZo.esm.js +285 -0
- package/dist/flow.d.ts +278 -0
- package/dist/flow.esm.js +638 -0
- package/dist/getDeviceClass-DkfbtsIJ.esm.js +41 -0
- package/dist/id-r1mw9zBM.esm.js +1827 -0
- package/dist/id.d.ts +5 -0
- package/dist/id.esm.js +9 -0
- package/dist/index-CJMK8K5u.d.ts +614 -0
- package/dist/index.d.ts +445 -0
- package/dist/index.esm.js +163 -0
- package/dist/lib-CbAibJlt.esm.js +11700 -0
- package/dist/phone.d.ts +292 -0
- package/dist/phone.esm.js +552 -0
- package/dist/selfie.d.ts +592 -0
- package/dist/selfie.esm.js +1221 -0
- package/dist/src-DYtpbFY5.esm.js +2781 -0
- package/dist/stats-DnU4uUFv.esm.js +16 -0
- package/dist/stats.d.ts +12 -0
- package/dist/stats.esm.js +4 -0
- package/dist/streamingEvents-CfEJv3xH.esm.js +96 -0
- package/dist/types-CMR6NkxW.d.ts +359 -0
- package/dist/types-CRVSv38Q.d.ts +344 -0
- package/package.json +58 -0
package/dist/id.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { a as CameraStream, n as PermissionStatus, t as PermissionResult } from "./types-CRVSv38Q.js";
|
|
2
|
+
import { A as IdCaptureMode, B as IIdCaptureCapability, C as CaptureIdResponse, D as ID_ERROR_CODES, E as DetectionStatus, F as IdFlowStep, I as RecordingSession, L as UploadIdResponse, M as IdDocumentType, N as IdError, O as IdCaptureConfig, P as IdErrorCode, R as IdCaptureProvider, S as validateUploadResponse, T as DetectionArea, V as IdCaptureSettings, _ as processId, a as IdCaptureActor, b as stopStream, c as IdCaptureEvent, d as idCaptureMachine, f as IdCaptureInitResult, g as initializeIdCapture, h as ValidationError, i as CreateIdCaptureActorOptions, j as IdCaptureThresholds, k as IdCaptureGeometry, l as IdCaptureInput, m as UploadIdImageParams, n as IdCaptureState, o as createIdCaptureActor, p as StartRecordingParams, r as createIdCaptureManager, s as IdCaptureContext, t as IdCaptureManager, u as IdCaptureMachine, v as startRecordingSession, w as CapturedImage, x as uploadIdImage, y as stopRecording, z as DetectionOrientation } from "./index-CJMK8K5u.js";
|
|
3
|
+
import "./types-CMR6NkxW.js";
|
|
4
|
+
import "./Manager-Co-PsiG9.js";
|
|
5
|
+
export { CameraStream, CaptureIdResponse, CapturedImage, CreateIdCaptureActorOptions, DetectionArea, DetectionOrientation, DetectionStatus, ID_ERROR_CODES, IIdCaptureCapability, IdCaptureActor, IdCaptureConfig, IdCaptureContext, IdCaptureEvent, IdCaptureGeometry, IdCaptureInitResult, IdCaptureInput, IdCaptureMachine, IdCaptureManager, IdCaptureMode, IdCaptureProvider, IdCaptureSettings, IdCaptureState, IdCaptureThresholds, IdDocumentType, IdError, IdErrorCode, IdFlowStep, PermissionResult, PermissionStatus, RecordingSession, StartRecordingParams, UploadIdImageParams, UploadIdResponse, ValidationError, createIdCaptureActor, createIdCaptureManager, idCaptureMachine, initializeIdCapture, processId, startRecordingSession, stopRecording, stopStream, uploadIdImage, validateUploadResponse };
|
package/dist/id.esm.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "./events-B8ZkhAZo.esm.js";
|
|
2
|
+
import { a as processId, c as stopStream, d as ID_ERROR_CODES, i as initializeIdCapture, l as uploadIdImage, n as createIdCaptureActor, o as startRecordingSession, r as idCaptureMachine, s as stopRecording, t as createIdCaptureManager, u as validateUploadResponse } from "./id-r1mw9zBM.esm.js";
|
|
3
|
+
import { i as IdCaptureProvider } from "./src-DYtpbFY5.esm.js";
|
|
4
|
+
import "./getDeviceClass-DkfbtsIJ.esm.js";
|
|
5
|
+
import "./endpoints-BUsSVoJV.esm.js";
|
|
6
|
+
import "./streamingEvents-CfEJv3xH.esm.js";
|
|
7
|
+
import "./api-DfRLAneb.esm.js";
|
|
8
|
+
|
|
9
|
+
export { ID_ERROR_CODES, IdCaptureProvider, createIdCaptureActor, createIdCaptureManager, idCaptureMachine, initializeIdCapture, processId, startRecordingSession, stopRecording, stopStream, uploadIdImage, validateUploadResponse };
|
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
import { a as CameraStream, c as IMotionSensorCapability, d as IMLProviderCapability, f as MLProviderConfig, i as StreamCanvasCapture, n as PermissionStatus, o as IRecordingCapability, p as IncodeCanvas, r as BaseWasmProvider, s as RecordingConnection, t as PermissionResult } from "./types-CRVSv38Q.js";
|
|
2
|
+
import { a as AnyStateMachine, i as TutorialIdConfig, o as StateMachine } from "./types-CMR6NkxW.js";
|
|
3
|
+
import { t as Manager } from "./Manager-Co-PsiG9.js";
|
|
4
|
+
import { ActorRefFrom } from "xstate";
|
|
5
|
+
|
|
6
|
+
//#region ../infra/src/capabilities/IIdCaptureCapability.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for ID capture provider.
|
|
9
|
+
* Extends base ML provider config with ID-capture specific options.
|
|
10
|
+
*/
|
|
11
|
+
type IdCaptureConfig$1 = MLProviderConfig;
|
|
12
|
+
interface IdCaptureThresholds$1 {
|
|
13
|
+
blurThreshold: number;
|
|
14
|
+
blurChangeThreshold: number;
|
|
15
|
+
glareThreshold: number;
|
|
16
|
+
clsThreshold: number;
|
|
17
|
+
sideThreshold: number;
|
|
18
|
+
iouThreshold: number;
|
|
19
|
+
idDetectedTimeout: number;
|
|
20
|
+
autocaptureTimeout: number;
|
|
21
|
+
framesAggregationInterval: number;
|
|
22
|
+
minFaceIdQualityScore: number;
|
|
23
|
+
}
|
|
24
|
+
interface IdCaptureGeometry$1 {
|
|
25
|
+
areaDown: number;
|
|
26
|
+
areaUp: number;
|
|
27
|
+
areaIOSPassportUp: number;
|
|
28
|
+
areaIOSPassportDown: number;
|
|
29
|
+
widthIOSUp: number;
|
|
30
|
+
widthIOSDown: number;
|
|
31
|
+
widthDown: number;
|
|
32
|
+
widthUp: number;
|
|
33
|
+
windowOuterWidth: number;
|
|
34
|
+
windowOuterHeight: number;
|
|
35
|
+
windowInnerWidth: number;
|
|
36
|
+
windowInnerHeight: number;
|
|
37
|
+
}
|
|
38
|
+
interface IdCaptureSettings {
|
|
39
|
+
isFixedMask: boolean;
|
|
40
|
+
isIPhone14OrHigher: boolean;
|
|
41
|
+
idType: string;
|
|
42
|
+
blurCheckEnabled: boolean;
|
|
43
|
+
glareCheckEnabled: boolean;
|
|
44
|
+
faceQualityCheckEnabled: boolean;
|
|
45
|
+
iouCheckEnabled: boolean;
|
|
46
|
+
}
|
|
47
|
+
type IdCaptureModelType = 'v1' | 'v2' | 'v3';
|
|
48
|
+
type DetectionOrientation = 'horizontal' | 'vertical';
|
|
49
|
+
interface IdCaptureCallbacks {
|
|
50
|
+
onFarAway?: () => void;
|
|
51
|
+
onDetectionStarted?: () => void;
|
|
52
|
+
onMaskChange?: (show: boolean, mask: boolean, top: number, orientation: DetectionOrientation) => void;
|
|
53
|
+
onBlur?: () => void;
|
|
54
|
+
onGlare?: () => void;
|
|
55
|
+
onCapturing?: () => void;
|
|
56
|
+
onCapture?: () => void;
|
|
57
|
+
onBestFrame?: (blur: number, glare: number, orientation: string) => void;
|
|
58
|
+
onIdNotDetected?: () => void;
|
|
59
|
+
onSwitchToManualCapture?: () => void;
|
|
60
|
+
onIdTypeChange?: (idType: string) => void;
|
|
61
|
+
onIdSideChange?: (side: string) => void;
|
|
62
|
+
onCapturingCounterValueChange?: (value: number) => void;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* WASM array type for quad coordinates.
|
|
66
|
+
* Use .get(index) instead of [index] to access elements.
|
|
67
|
+
*/
|
|
68
|
+
interface QuadArray {
|
|
69
|
+
get(index: number): {
|
|
70
|
+
x: number;
|
|
71
|
+
y: number;
|
|
72
|
+
};
|
|
73
|
+
size?(): number;
|
|
74
|
+
length?: number;
|
|
75
|
+
}
|
|
76
|
+
interface IdCaptureProcessResult {
|
|
77
|
+
cls: number;
|
|
78
|
+
blur: number;
|
|
79
|
+
glare: number;
|
|
80
|
+
quad: QuadArray;
|
|
81
|
+
barQuad: QuadArray;
|
|
82
|
+
side: string;
|
|
83
|
+
size: number;
|
|
84
|
+
idType: string;
|
|
85
|
+
networkInferenceTime: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Capability interface for ID document capture.
|
|
89
|
+
* Extends the base ML provider capability with ID-capture specific methods.
|
|
90
|
+
*/
|
|
91
|
+
interface IIdCaptureCapability extends IMLProviderCapability<IdCaptureConfig$1> {
|
|
92
|
+
/**
|
|
93
|
+
* Sets callbacks for ID capture events.
|
|
94
|
+
* @param callbacks - Object containing callback functions for various capture events
|
|
95
|
+
*/
|
|
96
|
+
setCallbacks(callbacks: IdCaptureCallbacks): void;
|
|
97
|
+
/**
|
|
98
|
+
* Sets detection thresholds for quality checks.
|
|
99
|
+
* @param thresholds - Threshold values for blur, glare, and other quality metrics
|
|
100
|
+
*/
|
|
101
|
+
setThresholds(thresholds: IdCaptureThresholds$1): void;
|
|
102
|
+
/**
|
|
103
|
+
* Sets geometry constraints for ID detection.
|
|
104
|
+
* @param geometry - Geometry parameters for ID positioning
|
|
105
|
+
*/
|
|
106
|
+
setGeometry(geometry: IdCaptureGeometry$1): void;
|
|
107
|
+
/**
|
|
108
|
+
* Sets capture settings.
|
|
109
|
+
* @param settings - Configuration for capture behavior
|
|
110
|
+
*/
|
|
111
|
+
setSettings(settings: IdCaptureSettings): void;
|
|
112
|
+
/**
|
|
113
|
+
* Sets the ML model type to use for ID detection.
|
|
114
|
+
* @param modelType - Model version ('v1', 'v2', or 'v3')
|
|
115
|
+
*/
|
|
116
|
+
setModelType(modelType: IdCaptureModelType): void;
|
|
117
|
+
/**
|
|
118
|
+
* Gets the last process result from the most recent frame processing.
|
|
119
|
+
* Returns null if no frame has been processed yet.
|
|
120
|
+
* @returns The last process result with quad coordinates, or null if not available
|
|
121
|
+
*/
|
|
122
|
+
getLastProcessResult(): IdCaptureProcessResult | null;
|
|
123
|
+
/**
|
|
124
|
+
* Transforms the canvas using perspective correction based on frame coordinates.
|
|
125
|
+
* @param canvas - The canvas to transform
|
|
126
|
+
* @param frameRect - Frame rectangle in canvas coordinates (x, y, w, h)
|
|
127
|
+
* @returns The transformed canvas
|
|
128
|
+
*/
|
|
129
|
+
transformPerspective(canvas: IncodeCanvas, frameRect: {
|
|
130
|
+
x: number;
|
|
131
|
+
y: number;
|
|
132
|
+
w: number;
|
|
133
|
+
h: number;
|
|
134
|
+
}): IncodeCanvas;
|
|
135
|
+
/**
|
|
136
|
+
* Gets the captured canvas (transformed for preview).
|
|
137
|
+
* @returns The captured canvas, or null if not available
|
|
138
|
+
*/
|
|
139
|
+
getCapturedCanvas(): IncodeCanvas | null;
|
|
140
|
+
/**
|
|
141
|
+
* Gets the original captured canvas (full frame for upload).
|
|
142
|
+
* @returns The original captured canvas, or null if not available
|
|
143
|
+
*/
|
|
144
|
+
getOriginalCapturedCanvas(): IncodeCanvas | null;
|
|
145
|
+
/**
|
|
146
|
+
* Sets the captured canvases (original and transformed).
|
|
147
|
+
* Called by the state machine after capture and transformation.
|
|
148
|
+
* @param original - The original full-frame canvas (for upload)
|
|
149
|
+
* @param transformed - The transformed canvas (for preview)
|
|
150
|
+
*/
|
|
151
|
+
setCapturedCanvases(original: IncodeCanvas, transformed: IncodeCanvas): void;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region ../infra/src/providers/wasm/IdCaptureProvider.d.ts
|
|
155
|
+
declare class IdCaptureProvider extends BaseWasmProvider implements IIdCaptureCapability {
|
|
156
|
+
private lastProcessResult;
|
|
157
|
+
private capturedCanvas;
|
|
158
|
+
private originalCapturedCanvas;
|
|
159
|
+
constructor();
|
|
160
|
+
initialize(config: IdCaptureConfig$1): Promise<void>;
|
|
161
|
+
setCallbacks(callbacks: IdCaptureCallbacks): void;
|
|
162
|
+
setThresholds(thresholds: IdCaptureThresholds$1): void;
|
|
163
|
+
setGeometry(geometry: IdCaptureGeometry$1): void;
|
|
164
|
+
setSettings(settings: IdCaptureSettings): void;
|
|
165
|
+
setModelType(modelType: 'v1' | 'v2' | 'v3'): void;
|
|
166
|
+
/**
|
|
167
|
+
* Processes a frame through the WASM pipeline and stores the result.
|
|
168
|
+
*/
|
|
169
|
+
processFrame(image: ImageData): Promise<void>;
|
|
170
|
+
/**
|
|
171
|
+
* Gets the last process result from the most recent frame processing.
|
|
172
|
+
* @returns The last process result with quad coordinates, or null if not available
|
|
173
|
+
*/
|
|
174
|
+
getLastProcessResult(): IdCaptureProcessResult | null;
|
|
175
|
+
transformPerspective(canvas: IncodeCanvas, frameRect: {
|
|
176
|
+
x: number;
|
|
177
|
+
y: number;
|
|
178
|
+
w: number;
|
|
179
|
+
h: number;
|
|
180
|
+
}): IncodeCanvas;
|
|
181
|
+
/**
|
|
182
|
+
* Crops a canvas to the specified rectangle region.
|
|
183
|
+
* @param canvas - The canvas to crop
|
|
184
|
+
* @param rect - The rectangle to crop to (x, y, w, h)
|
|
185
|
+
* @returns A new IncodeCanvas with the cropped region, or null if cropping fails
|
|
186
|
+
*/
|
|
187
|
+
private cropCanvasToRect;
|
|
188
|
+
/**
|
|
189
|
+
* Gets the captured canvas (transformed for preview).
|
|
190
|
+
* @returns The captured canvas, or null if not available
|
|
191
|
+
*/
|
|
192
|
+
getCapturedCanvas(): IncodeCanvas | null;
|
|
193
|
+
/**
|
|
194
|
+
* Gets the original captured canvas (full frame for upload).
|
|
195
|
+
* @returns The original captured canvas, or null if not available
|
|
196
|
+
*/
|
|
197
|
+
getOriginalCapturedCanvas(): IncodeCanvas | null;
|
|
198
|
+
/**
|
|
199
|
+
* Sets the captured canvases (original and transformed).
|
|
200
|
+
* @param original - The original full-frame canvas (for upload)
|
|
201
|
+
* @param transformed - The transformed canvas (for preview)
|
|
202
|
+
*/
|
|
203
|
+
setCapturedCanvases(original: IncodeCanvas, transformed: IncodeCanvas): void;
|
|
204
|
+
reset(): void;
|
|
205
|
+
}
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/modules/id/types.d.ts
|
|
208
|
+
type IdCaptureMode = 'front' | 'back' | 'passport';
|
|
209
|
+
type IdDocumentType = 'id' | 'passport';
|
|
210
|
+
type IdFlowStep = 'chooser' | 'tutorial' | 'permissions' | 'capture' | 'frontFinished' | 'success' | 'processing' | 'expired' | 'finished' | 'error' | 'closed' | 'manualIdUpload' | 'digitalIdUpload';
|
|
211
|
+
type DetectionStatus = 'idle' | 'detecting' | 'farAway' | 'blur' | 'glare' | 'wrongSide' | 'capturing' | 'manualCapture' | 'idNotDetected' | 'offline';
|
|
212
|
+
/**
|
|
213
|
+
* Represents the detection area dimensions in pixels.
|
|
214
|
+
* Used by UI to communicate the expected ID position and size to the WASM detection.
|
|
215
|
+
*/
|
|
216
|
+
type DetectionArea = {
|
|
217
|
+
x: number;
|
|
218
|
+
y: number;
|
|
219
|
+
width: number;
|
|
220
|
+
height: number;
|
|
221
|
+
};
|
|
222
|
+
type IdCaptureGeometry = {
|
|
223
|
+
areaDown: number;
|
|
224
|
+
areaUp: number;
|
|
225
|
+
areaIOSPassportUp: number;
|
|
226
|
+
areaIOSPassportDown: number;
|
|
227
|
+
widthIOSUp: number;
|
|
228
|
+
widthIOSDown: number;
|
|
229
|
+
widthDown: number;
|
|
230
|
+
widthUp: number;
|
|
231
|
+
windowOuterWidth: number;
|
|
232
|
+
windowOuterHeight: number;
|
|
233
|
+
windowInnerWidth: number;
|
|
234
|
+
windowInnerHeight: number;
|
|
235
|
+
};
|
|
236
|
+
type IdCaptureThresholds = {
|
|
237
|
+
blurThreshold: number;
|
|
238
|
+
blurChangeThreshold: number;
|
|
239
|
+
glareThreshold: number;
|
|
240
|
+
clsThreshold: number;
|
|
241
|
+
sideThreshold: number;
|
|
242
|
+
iouThreshold: number;
|
|
243
|
+
framesAggregationInterval: number;
|
|
244
|
+
minFaceIdQualityScore: number;
|
|
245
|
+
idDetectedTimeout: number;
|
|
246
|
+
autocaptureTimeout: number;
|
|
247
|
+
};
|
|
248
|
+
type IdCaptureConfig = TutorialIdConfig & {
|
|
249
|
+
recording?: {
|
|
250
|
+
capability?: IRecordingCapability;
|
|
251
|
+
};
|
|
252
|
+
ageAssurance?: boolean;
|
|
253
|
+
mergeSessionRecordings?: boolean;
|
|
254
|
+
isDeepsightEnabled?: boolean;
|
|
255
|
+
isSecondId?: boolean;
|
|
256
|
+
geometry?: IdCaptureGeometry;
|
|
257
|
+
detectionArea?: DetectionArea;
|
|
258
|
+
thresholds?: Partial<IdCaptureThresholds>;
|
|
259
|
+
settings?: Partial<IdCaptureSettings>;
|
|
260
|
+
modelVersion?: 'v1' | 'v2' | 'v3';
|
|
261
|
+
};
|
|
262
|
+
type IdErrorCode = 'UPLOAD_ERROR' | 'CLASSIFICATION_FAILED' | 'LOW_SHARPNESS' | 'GLARE_DETECTED' | 'WRONG_DOCUMENT_SIDE' | 'ID_TYPE_UNACCEPTABLE' | 'READABILITY_ISSUE' | 'RETRY_EXHAUSTED_CONTINUE_TO_BACK' | 'RETRY_EXHAUSTED_SKIP_BACK' | 'NO_MORE_TRIES' | 'UNEXPECTED_ERROR' | 'NO_TOKEN' | 'PERMISSION_DENIED' | 'USER_CANCELLED' | 'SERVER_ERROR';
|
|
263
|
+
type IdError = {
|
|
264
|
+
code: IdErrorCode;
|
|
265
|
+
message: string;
|
|
266
|
+
messageDescription?: string;
|
|
267
|
+
};
|
|
268
|
+
type UploadIdResponse = {
|
|
269
|
+
sharpness: number;
|
|
270
|
+
correctSharpness: boolean;
|
|
271
|
+
glare: number;
|
|
272
|
+
correctGlare: boolean;
|
|
273
|
+
horizontalResolution: number;
|
|
274
|
+
classification: boolean;
|
|
275
|
+
readability: boolean;
|
|
276
|
+
typeOfId: string;
|
|
277
|
+
issueYear: number;
|
|
278
|
+
issueName: string;
|
|
279
|
+
curpCheck?: boolean;
|
|
280
|
+
sessionStatus: string;
|
|
281
|
+
countryCode: string;
|
|
282
|
+
state?: string;
|
|
283
|
+
skipBackIdCapture?: boolean;
|
|
284
|
+
skipGlareFront?: boolean;
|
|
285
|
+
skipGlareBack?: boolean;
|
|
286
|
+
documentIsOnTheEdge?: boolean;
|
|
287
|
+
acceptedDocuments?: Array<{
|
|
288
|
+
type: string;
|
|
289
|
+
name: string;
|
|
290
|
+
}>;
|
|
291
|
+
forceFrontIdCapture?: boolean;
|
|
292
|
+
failReason?: string;
|
|
293
|
+
side?: 'front' | 'back';
|
|
294
|
+
};
|
|
295
|
+
type CaptureIdResponse = UploadIdResponse & {
|
|
296
|
+
croppedIDFace?: string;
|
|
297
|
+
croppedFrontID?: string;
|
|
298
|
+
croppedBackID?: string;
|
|
299
|
+
originalImage?: string;
|
|
300
|
+
frontIdImage?: string;
|
|
301
|
+
backIdImage?: string;
|
|
302
|
+
};
|
|
303
|
+
type CapturedImage = {
|
|
304
|
+
imageBase64: string;
|
|
305
|
+
};
|
|
306
|
+
type RecordingSession = {
|
|
307
|
+
token: string;
|
|
308
|
+
sessionId: string;
|
|
309
|
+
videoRecordingId: string;
|
|
310
|
+
connection: RecordingConnection;
|
|
311
|
+
resolution?: string;
|
|
312
|
+
hasAudio: boolean;
|
|
313
|
+
};
|
|
314
|
+
declare const ID_ERROR_CODES: {
|
|
315
|
+
readonly UPLOAD_ERROR: "UPLOAD_ERROR";
|
|
316
|
+
readonly CLASSIFICATION_FAILED: "CLASSIFICATION_FAILED";
|
|
317
|
+
readonly LOW_SHARPNESS: "LOW_SHARPNESS";
|
|
318
|
+
readonly GLARE_DETECTED: "GLARE_DETECTED";
|
|
319
|
+
readonly WRONG_DOCUMENT_SIDE: "WRONG_DOCUMENT_SIDE";
|
|
320
|
+
readonly ID_TYPE_UNACCEPTABLE: "ID_TYPE_UNACCEPTABLE";
|
|
321
|
+
readonly READABILITY_ISSUE: "READABILITY_ISSUE";
|
|
322
|
+
readonly RETRY_EXHAUSTED_CONTINUE_TO_BACK: "RETRY_EXHAUSTED_CONTINUE_TO_BACK";
|
|
323
|
+
readonly RETRY_EXHAUSTED_SKIP_BACK: "RETRY_EXHAUSTED_SKIP_BACK";
|
|
324
|
+
readonly NO_MORE_TRIES: "NO_MORE_TRIES";
|
|
325
|
+
readonly UNEXPECTED_ERROR: "UNEXPECTED_ERROR";
|
|
326
|
+
readonly NO_TOKEN: "NO_TOKEN";
|
|
327
|
+
readonly PERMISSION_DENIED: "PERMISSION_DENIED";
|
|
328
|
+
readonly USER_CANCELLED: "USER_CANCELLED";
|
|
329
|
+
readonly SERVER: "SERVER_ERROR";
|
|
330
|
+
};
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region src/modules/id/idCaptureServices.d.ts
|
|
333
|
+
type IdCaptureInitResult = {
|
|
334
|
+
stream: CameraStream;
|
|
335
|
+
provider: IIdCaptureCapability;
|
|
336
|
+
};
|
|
337
|
+
declare function initializeIdCapture(provider: IIdCaptureCapability, config: IdCaptureConfig): Promise<IdCaptureInitResult>;
|
|
338
|
+
declare function stopStream(stream: CameraStream): void;
|
|
339
|
+
type UploadIdImageParams = {
|
|
340
|
+
image: string;
|
|
341
|
+
type: 'front' | 'back';
|
|
342
|
+
sendBase64?: boolean;
|
|
343
|
+
isSecondId?: boolean;
|
|
344
|
+
onlyFront?: boolean;
|
|
345
|
+
glare?: number;
|
|
346
|
+
sharpness?: number;
|
|
347
|
+
shouldSkipGlareBack?: boolean;
|
|
348
|
+
shouldSkipGlareFront?: boolean;
|
|
349
|
+
captureType?: string;
|
|
350
|
+
ageAssurance?: boolean;
|
|
351
|
+
onProgress?: (progress: number) => void;
|
|
352
|
+
metadata?: string;
|
|
353
|
+
signal?: AbortSignal;
|
|
354
|
+
};
|
|
355
|
+
type ValidationError = {
|
|
356
|
+
error: boolean;
|
|
357
|
+
message: string;
|
|
358
|
+
messageDescription?: string;
|
|
359
|
+
errorKey: IdErrorCode;
|
|
360
|
+
};
|
|
361
|
+
declare function validateUploadResponse(response: UploadIdResponse & {
|
|
362
|
+
failReason?: string;
|
|
363
|
+
side?: 'front' | 'back';
|
|
364
|
+
}, sessionState?: {
|
|
365
|
+
skipGlareFront?: boolean;
|
|
366
|
+
skipGlareBack?: boolean;
|
|
367
|
+
}): ValidationError | undefined;
|
|
368
|
+
declare function uploadIdImage(params: UploadIdImageParams): Promise<CaptureIdResponse>;
|
|
369
|
+
type StartRecordingParams = {
|
|
370
|
+
config: IdCaptureConfig;
|
|
371
|
+
stream: CameraStream;
|
|
372
|
+
existing?: RecordingSession;
|
|
373
|
+
type: 'frontId' | 'backId';
|
|
374
|
+
};
|
|
375
|
+
declare function startRecordingSession(params: StartRecordingParams): Promise<RecordingSession | undefined>;
|
|
376
|
+
declare function stopRecording(session: RecordingSession): void;
|
|
377
|
+
declare function processId(isSecondId?: boolean, queueName?: string, signal?: AbortSignal): Promise<{
|
|
378
|
+
isDocumentExpired: boolean;
|
|
379
|
+
}>;
|
|
380
|
+
//#endregion
|
|
381
|
+
//#region src/modules/id/idCaptureStateMachine.d.ts
|
|
382
|
+
type IdCaptureContext = {
|
|
383
|
+
config: IdCaptureConfig;
|
|
384
|
+
currentMode: IdCaptureMode;
|
|
385
|
+
selectedDocumentType: IdDocumentType | undefined;
|
|
386
|
+
stream: CameraStream | undefined;
|
|
387
|
+
provider: IIdCaptureCapability | undefined;
|
|
388
|
+
frameCapturer: StreamCanvasCapture | undefined;
|
|
389
|
+
error: string | undefined;
|
|
390
|
+
detectionStatus: DetectionStatus;
|
|
391
|
+
counterValue: number;
|
|
392
|
+
orientation: DetectionOrientation | undefined;
|
|
393
|
+
capturedImages: {
|
|
394
|
+
front?: CapturedImage;
|
|
395
|
+
back?: CapturedImage;
|
|
396
|
+
};
|
|
397
|
+
uploadResponse: CaptureIdResponse | undefined;
|
|
398
|
+
recordingSession: RecordingSession | undefined;
|
|
399
|
+
attemptsRemaining: number;
|
|
400
|
+
uploadError: IdErrorCode | undefined;
|
|
401
|
+
permissionResult: PermissionResult | 'refresh' | undefined;
|
|
402
|
+
resetDetection: (() => void) | undefined;
|
|
403
|
+
idType: string | undefined;
|
|
404
|
+
qualityElements: {
|
|
405
|
+
glare?: number;
|
|
406
|
+
sharpness?: number;
|
|
407
|
+
} | undefined;
|
|
408
|
+
debugFrame: ImageData | undefined;
|
|
409
|
+
frameRect: {
|
|
410
|
+
x: number;
|
|
411
|
+
y: number;
|
|
412
|
+
w: number;
|
|
413
|
+
h: number;
|
|
414
|
+
} | undefined;
|
|
415
|
+
/** Detection area from UI for WASM geometry calculation */
|
|
416
|
+
detectionArea: {
|
|
417
|
+
x: number;
|
|
418
|
+
y: number;
|
|
419
|
+
width: number;
|
|
420
|
+
height: number;
|
|
421
|
+
} | undefined;
|
|
422
|
+
previewImageUrl?: string;
|
|
423
|
+
uploadProgress?: number;
|
|
424
|
+
motionStatus?: 'PASS' | 'FAIL' | 'UNCLEAR';
|
|
425
|
+
manualCaptureTriggered: boolean;
|
|
426
|
+
};
|
|
427
|
+
type IdCaptureEvent = {
|
|
428
|
+
type: 'LOAD';
|
|
429
|
+
} | {
|
|
430
|
+
type: 'SELECT_DOCUMENT';
|
|
431
|
+
documentType: IdDocumentType;
|
|
432
|
+
} | {
|
|
433
|
+
type: 'NEXT_STEP';
|
|
434
|
+
} | {
|
|
435
|
+
type: 'REQUEST_PERMISSION';
|
|
436
|
+
} | {
|
|
437
|
+
type: 'GO_TO_LEARN_MORE';
|
|
438
|
+
} | {
|
|
439
|
+
type: 'BACK';
|
|
440
|
+
} | {
|
|
441
|
+
type: 'QUIT';
|
|
442
|
+
} | {
|
|
443
|
+
type: 'RESET';
|
|
444
|
+
} | {
|
|
445
|
+
type: 'MANUAL_CAPTURE';
|
|
446
|
+
} | {
|
|
447
|
+
type: 'SWITCH_TO_MANUAL_CAPTURE';
|
|
448
|
+
} | {
|
|
449
|
+
type: 'DETECTION_UPDATE';
|
|
450
|
+
status: DetectionStatus;
|
|
451
|
+
} | {
|
|
452
|
+
type: 'DETECTION_FRAME';
|
|
453
|
+
frame: ImageData;
|
|
454
|
+
} | {
|
|
455
|
+
type: 'DETECTION_SUCCESS';
|
|
456
|
+
canvas: IncodeCanvas;
|
|
457
|
+
qualityElements?: {
|
|
458
|
+
glare?: number;
|
|
459
|
+
sharpness?: number;
|
|
460
|
+
};
|
|
461
|
+
} | {
|
|
462
|
+
type: 'DETECTION_RESET_READY';
|
|
463
|
+
reset: () => void;
|
|
464
|
+
} | {
|
|
465
|
+
type: 'COUNTER_VALUE_CHANGE';
|
|
466
|
+
value: number;
|
|
467
|
+
} | {
|
|
468
|
+
type: 'ID_TYPE_CHANGE';
|
|
469
|
+
idType: string;
|
|
470
|
+
} | {
|
|
471
|
+
type: 'ID_SIDE_CHANGE';
|
|
472
|
+
side: string;
|
|
473
|
+
} | {
|
|
474
|
+
type: 'ORIENTATION_CHANGE';
|
|
475
|
+
orientation: DetectionOrientation;
|
|
476
|
+
} | {
|
|
477
|
+
type: 'RETRY_CAPTURE';
|
|
478
|
+
} | {
|
|
479
|
+
type: 'CONTINUE_FROM_ERROR';
|
|
480
|
+
} | {
|
|
481
|
+
type: 'FRONT_COMPLETE';
|
|
482
|
+
} | {
|
|
483
|
+
type: 'CONTINUE_TO_BACK';
|
|
484
|
+
} | {
|
|
485
|
+
type: 'PROCESS_COMPLETE';
|
|
486
|
+
} | {
|
|
487
|
+
type: 'PROCESS_EXPIRED';
|
|
488
|
+
} | {
|
|
489
|
+
type: 'SKIP_BACK';
|
|
490
|
+
} | {
|
|
491
|
+
type: 'UPLOAD_PROGRESS';
|
|
492
|
+
progress: number;
|
|
493
|
+
} | {
|
|
494
|
+
type: 'SET_FRAME_RECT';
|
|
495
|
+
frameRect: {
|
|
496
|
+
x: number;
|
|
497
|
+
y: number;
|
|
498
|
+
w: number;
|
|
499
|
+
h: number;
|
|
500
|
+
};
|
|
501
|
+
} | {
|
|
502
|
+
type: 'UPDATE_DETECTION_AREA';
|
|
503
|
+
detectionArea: {
|
|
504
|
+
x: number;
|
|
505
|
+
y: number;
|
|
506
|
+
width: number;
|
|
507
|
+
height: number;
|
|
508
|
+
};
|
|
509
|
+
} | {
|
|
510
|
+
type: 'MOTION_STATUS';
|
|
511
|
+
status: 'PASS' | 'FAIL' | 'UNCLEAR';
|
|
512
|
+
};
|
|
513
|
+
type IdCaptureInput = {
|
|
514
|
+
config: IdCaptureConfig;
|
|
515
|
+
provider: IIdCaptureCapability;
|
|
516
|
+
motionProvider?: IMotionSensorCapability;
|
|
517
|
+
};
|
|
518
|
+
declare const idCaptureMachine: AnyStateMachine;
|
|
519
|
+
type IdCaptureMachine = StateMachine<IdCaptureContext, IdCaptureEvent, any, any, any, any, any, any, any, IdCaptureInput, any, any, any, any>;
|
|
520
|
+
//#endregion
|
|
521
|
+
//#region src/modules/id/idCaptureActor.d.ts
|
|
522
|
+
type CreateIdCaptureActorOptions = {
|
|
523
|
+
config: IdCaptureConfig;
|
|
524
|
+
provider: IIdCaptureCapability;
|
|
525
|
+
};
|
|
526
|
+
type IdCaptureActor = ActorRefFrom<IdCaptureMachine>;
|
|
527
|
+
declare function createIdCaptureActor(options: CreateIdCaptureActorOptions): IdCaptureActor;
|
|
528
|
+
//#endregion
|
|
529
|
+
//#region src/modules/id/idCaptureManager.d.ts
|
|
530
|
+
type CaptureStatus = 'initializing' | 'detecting' | 'capturing' | 'uploading' | 'uploadError' | 'success';
|
|
531
|
+
type IdCaptureIdleState = {
|
|
532
|
+
status: 'idle';
|
|
533
|
+
};
|
|
534
|
+
type IdCaptureChooserState = {
|
|
535
|
+
status: 'chooser';
|
|
536
|
+
};
|
|
537
|
+
type IdCaptureLoadingState = {
|
|
538
|
+
status: 'loading';
|
|
539
|
+
};
|
|
540
|
+
type IdCaptureTutorialState = {
|
|
541
|
+
status: 'tutorial';
|
|
542
|
+
selectedDocumentType: IdDocumentType | undefined;
|
|
543
|
+
};
|
|
544
|
+
type IdCapturePermissionsState = {
|
|
545
|
+
status: 'permissions';
|
|
546
|
+
permissionStatus: PermissionStatus;
|
|
547
|
+
};
|
|
548
|
+
type IdCaptureCaptureState = {
|
|
549
|
+
status: 'capture';
|
|
550
|
+
captureStatus: CaptureStatus;
|
|
551
|
+
stream: CameraStream | undefined;
|
|
552
|
+
detectionStatus: DetectionStatus;
|
|
553
|
+
debugFrame: ImageData | undefined;
|
|
554
|
+
attemptsRemaining: number;
|
|
555
|
+
uploadError: IdErrorCode | undefined;
|
|
556
|
+
currentMode: IdCaptureMode;
|
|
557
|
+
counterValue: number;
|
|
558
|
+
orientation: DetectionOrientation | undefined;
|
|
559
|
+
idType: string | undefined;
|
|
560
|
+
previewImageUrl?: string;
|
|
561
|
+
uploadProgress?: number;
|
|
562
|
+
uploadErrorMessage?: string;
|
|
563
|
+
uploadErrorDescription?: string;
|
|
564
|
+
/** Whether back capture is needed after front capture completes */
|
|
565
|
+
needsBackCapture: boolean;
|
|
566
|
+
showCaptureButtonInAuto: boolean;
|
|
567
|
+
/** Whether retry is available (attemptsRemaining > 0) */
|
|
568
|
+
canRetry: boolean;
|
|
569
|
+
};
|
|
570
|
+
type IdCaptureFrontFinishedState = {
|
|
571
|
+
status: 'frontFinished';
|
|
572
|
+
};
|
|
573
|
+
type IdCaptureProcessingState = {
|
|
574
|
+
status: 'processing';
|
|
575
|
+
};
|
|
576
|
+
type IdCaptureExpiredState = {
|
|
577
|
+
status: 'expired';
|
|
578
|
+
};
|
|
579
|
+
type IdCaptureFinishedState = {
|
|
580
|
+
status: 'finished';
|
|
581
|
+
};
|
|
582
|
+
type IdCaptureClosedState = {
|
|
583
|
+
status: 'closed';
|
|
584
|
+
};
|
|
585
|
+
type IdCaptureErrorState = {
|
|
586
|
+
status: 'error';
|
|
587
|
+
error: string;
|
|
588
|
+
};
|
|
589
|
+
type IdCaptureState = IdCaptureIdleState | IdCaptureChooserState | IdCaptureLoadingState | IdCaptureTutorialState | IdCapturePermissionsState | IdCaptureCaptureState | IdCaptureFrontFinishedState | IdCaptureProcessingState | IdCaptureExpiredState | IdCaptureFinishedState | IdCaptureClosedState | IdCaptureErrorState;
|
|
590
|
+
declare function createIdCaptureManager(options: CreateIdCaptureActorOptions): Manager<IdCaptureState> & {
|
|
591
|
+
load(): void;
|
|
592
|
+
selectDocument(documentType: IdDocumentType): void;
|
|
593
|
+
nextStep(): void;
|
|
594
|
+
requestPermission(): void;
|
|
595
|
+
goToLearnMore(): void;
|
|
596
|
+
back(): void;
|
|
597
|
+
close(): void;
|
|
598
|
+
reset(): void;
|
|
599
|
+
retryCapture(): void;
|
|
600
|
+
continueFromError(): void;
|
|
601
|
+
capture(): void;
|
|
602
|
+
switchToManualCapture(): void;
|
|
603
|
+
continueToBack(): void;
|
|
604
|
+
skipBack(): void;
|
|
605
|
+
/**
|
|
606
|
+
* Updates the detection area used for WASM geometry calculation.
|
|
607
|
+
* Call this when the UI detection area dimensions change (e.g., on resize or orientation change).
|
|
608
|
+
* @param detectionArea - The detection area in canvas coordinates
|
|
609
|
+
*/
|
|
610
|
+
updateDetectionArea(detectionArea: DetectionArea): void;
|
|
611
|
+
};
|
|
612
|
+
type IdCaptureManager = ReturnType<typeof createIdCaptureManager>;
|
|
613
|
+
//#endregion
|
|
614
|
+
export { IdCaptureMode as A, IIdCaptureCapability as B, CaptureIdResponse as C, ID_ERROR_CODES as D, DetectionStatus as E, IdFlowStep as F, RecordingSession as I, UploadIdResponse as L, IdDocumentType as M, IdError as N, IdCaptureConfig as O, IdErrorCode as P, IdCaptureProvider as R, validateUploadResponse as S, DetectionArea as T, IdCaptureSettings as V, processId as _, IdCaptureActor as a, stopStream as b, IdCaptureEvent as c, idCaptureMachine as d, IdCaptureInitResult as f, initializeIdCapture as g, ValidationError as h, CreateIdCaptureActorOptions as i, IdCaptureThresholds as j, IdCaptureGeometry as k, IdCaptureInput as l, UploadIdImageParams as m, IdCaptureState as n, createIdCaptureActor as o, StartRecordingParams as p, createIdCaptureManager as r, IdCaptureContext as s, IdCaptureManager as t, IdCaptureMachine as u, startRecordingSession as v, CapturedImage as w, uploadIdImage as x, stopRecording as y, DetectionOrientation as z };
|