@incodetech/core 2.0.0-alpha.11 → 2.0.0-alpha.12

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