@incodetech/core 0.0.0-dev-20260304-fb1914c → 0.0.0-dev-20260306-aac8dd3
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/authentication.d.ts +9 -8
- package/dist/authentication.esm.js +10 -10
- package/dist/{backCameraStream-CvzBcQqz.esm.js → backCameraStream-DXS4n4yS.esm.js} +1 -1
- package/dist/camera-HI2fNiV5.d.ts +4 -0
- package/dist/curp-validation.d.ts +4 -3
- package/dist/curp-validation.esm.js +5 -5
- package/dist/{deepsightLoader-BYoe0Nsv.esm.js → deepsightLoader-CCuD-pzB.esm.js} +4 -4
- package/dist/{deepsightService-nqR8Q7AS.esm.js → deepsightService-D2rnPj53.esm.js} +3 -3
- package/dist/{deepsightService-BpVsx9qI.d.ts → deepsightService-Dv1ILk27.d.ts} +1 -1
- package/dist/document-capture.d.ts +660 -0
- package/dist/document-capture.esm.js +428 -0
- package/dist/document-upload.d.ts +49 -48
- 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 +1 -1
- package/dist/email.esm.js +5 -5
- package/dist/{endpoints-DZ8tQH8V.esm.js → endpoints-PMCuQkqs.esm.js} +4 -0
- package/dist/{events-B4Z68p21.esm.js → events-Bf73PAdv.esm.js} +2 -2
- package/dist/face-match.d.ts +1 -1
- package/dist/face-match.esm.js +5 -5
- package/dist/{faceCaptureManagerFactory-tyJQU0bQ.d.ts → faceCaptureManagerFactory-CftLkmnH.d.ts} +5 -5
- package/dist/{faceCaptureSetup-C6JFWLvG.esm.js → faceCaptureSetup-D3cIjwWO.esm.js} +9 -9
- package/dist/flow.d.ts +7 -6
- package/dist/flow.esm.js +5 -5
- package/dist/{flowCompletionService-BxrOI23Q.esm.js → flowCompletionService-C2Cjw8WY.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-B_LxGdTF.esm.js → id-CbVfoXco.esm.js} +10 -10
- package/dist/id.d.ts +9 -8
- package/dist/id.esm.js +10 -10
- package/dist/{index-BRPR-rem.d.ts → index-_guGVj8K.d.ts} +7 -7
- package/dist/index.d.ts +47 -10
- package/dist/index.esm.js +11 -11
- package/dist/{lib-DhQ9gAaS.esm.js → lib-DVaeY7hq.esm.js} +1 -1
- package/dist/phone.d.ts +1 -1
- package/dist/phone.esm.js +5 -5
- package/dist/selfie.d.ts +9 -8
- package/dist/selfie.esm.js +10 -10
- package/dist/session.d.ts +1 -1
- package/dist/session.esm.js +3 -3
- package/dist/{src-jvUXRQjK.esm.js → src-BJhTmsja.esm.js} +77 -3
- package/dist/{stats-CIdlLJwO.esm.js → stats-De--Z9N5.esm.js} +1 -1
- package/dist/stats.esm.js +2 -2
- package/dist/{streamingEvents-evH8YUFP.esm.js → streamingEvents-BAYT4t4N.esm.js} +21 -4
- package/dist/{types-Cd8ODk69.d.ts → types-B_l5fu_D.d.ts} +4 -4
- package/dist/{types-CCmurMLG.d.ts → types-BcGRS3lW.d.ts} +1 -1
- package/package.json +5 -1
- /package/dist/{Actor-BWuqxR_a.d.ts → Actor-SKZvDOCc.d.ts} +0 -0
- /package/dist/{Manager-WfeWDo3j.d.ts → Manager-CVog-etk.d.ts} +0 -0
- /package/dist/{StateMachine-DQeBZwAJ.d.ts → StateMachine-Coiuk0UD.d.ts} +0 -0
- /package/dist/{api-utDuOVDZ.esm.js → api-CdJjfxTX.esm.js} +0 -0
- /package/dist/{chunk-B6vU4TSh.esm.js → chunk-3Wl3T5mL.esm.js} +0 -0
- /package/dist/{flowCompletionService-CSeT3Po7.d.ts → flowCompletionService-DtL1jOz4.d.ts} +0 -0
- /package/dist/{types-M1Q7M45h.d.ts → types-dSdX5z-n.d.ts} +0 -0
- /package/dist/{types-CnKs94Sr.d.ts → types-vXjqO0B-.d.ts} +0 -0
- /package/dist/{usStates-BAjX-Al7.esm.js → usStates-IoVg25OV.esm.js} +0 -0
- /package/dist/{warmup-G1qbIG0g.d.ts → warmup-CO10kO5G.d.ts} +0 -0
- /package/dist/{xstate.esm-Be4HOnoi.esm.js → xstate.esm-yA5caGbx.esm.js} +0 -0
|
@@ -0,0 +1,660 @@
|
|
|
1
|
+
import { t as Manager } from "./Manager-CVog-etk.js";
|
|
2
|
+
import { t as CameraStream } from "./camera-HI2fNiV5.js";
|
|
3
|
+
import * as xstate0 from "xstate";
|
|
4
|
+
|
|
5
|
+
//#region src/modules/document-capture/types.d.ts
|
|
6
|
+
type DocumentType = 'addressStatement' | 'otherDocument1' | 'otherDocument2' | 'otherDocument3' | 'v5cMultiPageLogbook' | 'circulationCard' | 'financeSettlement' | 'carInvoice' | 'capture' | 'processPoaOcr' | 'processLoaOcr' | 'processAsylumSeekerVisaZaf' | 'processBankStatementOCR' | 'processBankCheck' | 'processV5CLogbook' | 'processCarInvoice' | 'processCirculationCard' | 'processFinanceSettlement';
|
|
7
|
+
declare const DOCUMENT_CAPTURE_ERROR_CODES: {
|
|
8
|
+
readonly FILE_TOO_LARGE: "FILE_TOO_LARGE";
|
|
9
|
+
readonly UPLOAD_FAILED: "UPLOAD_FAILED";
|
|
10
|
+
};
|
|
11
|
+
type DocumentCaptureErrorCode = (typeof DOCUMENT_CAPTURE_ERROR_CODES)[keyof typeof DOCUMENT_CAPTURE_ERROR_CODES];
|
|
12
|
+
/**
|
|
13
|
+
* Configuration for the document capture module.
|
|
14
|
+
* Parameterized to support both DOCUMENT_CAPTURE and ADDRESS flows.
|
|
15
|
+
*/
|
|
16
|
+
type DocumentCaptureConfig = {
|
|
17
|
+
/** Processing type for API endpoint routing. @default 'addressStatement' */
|
|
18
|
+
processingType?: DocumentType;
|
|
19
|
+
/** Capture mode. 'camera' shows bottom sheet with camera+file options. 'file' opens file picker directly. @default 'camera' */
|
|
20
|
+
captureMode?: 'file' | 'camera';
|
|
21
|
+
/** Allow user to skip this step. @default false */
|
|
22
|
+
allowSkipDocumentCapture?: boolean;
|
|
23
|
+
/** Tutorial screen title override */
|
|
24
|
+
title?: string;
|
|
25
|
+
/** Tutorial screen text override */
|
|
26
|
+
text?: string;
|
|
27
|
+
/** Title override for the second-page tutorial (multi-page flows). Falls back to `title`. */
|
|
28
|
+
step2Title?: string;
|
|
29
|
+
/** Text override for the second-page tutorial (multi-page flows). Falls back to `text`. */
|
|
30
|
+
step2Text?: string;
|
|
31
|
+
/** Number of capture/upload attempts before auto-advancing. @default 3 */
|
|
32
|
+
captureAttempts?: number;
|
|
33
|
+
/** Send image as base64 instead of raw file. @default false */
|
|
34
|
+
sendBase64?: boolean;
|
|
35
|
+
/** Maximum file size in bytes. @default 10485760 (10MB) */
|
|
36
|
+
maxFileSize?: number;
|
|
37
|
+
};
|
|
38
|
+
type CapturedDocument = {
|
|
39
|
+
imageBase64: string;
|
|
40
|
+
file: File;
|
|
41
|
+
fileType: string;
|
|
42
|
+
};
|
|
43
|
+
type DocumentUploadResponse = {
|
|
44
|
+
success: boolean;
|
|
45
|
+
status?: 'ADD_NEXT_PAGE' | 'SUCCESS';
|
|
46
|
+
};
|
|
47
|
+
type DocumentCaptureResolvedConfig = {
|
|
48
|
+
processingType: DocumentType;
|
|
49
|
+
captureMode: 'file' | 'camera';
|
|
50
|
+
allowSkipDocumentCapture: boolean;
|
|
51
|
+
captureAttempts: number;
|
|
52
|
+
sendBase64: boolean;
|
|
53
|
+
maxFileSize: number;
|
|
54
|
+
title: string | undefined;
|
|
55
|
+
text: string | undefined;
|
|
56
|
+
step2Title: string | undefined;
|
|
57
|
+
step2Text: string | undefined;
|
|
58
|
+
};
|
|
59
|
+
type DocumentCaptureContext = {
|
|
60
|
+
config: DocumentCaptureResolvedConfig;
|
|
61
|
+
stream: CameraStream | undefined;
|
|
62
|
+
capturedDocument: CapturedDocument | undefined;
|
|
63
|
+
captureMethod: 'camera' | 'file' | undefined;
|
|
64
|
+
progress: number;
|
|
65
|
+
error: DocumentCaptureErrorCode | undefined;
|
|
66
|
+
attemptsRemaining: number;
|
|
67
|
+
pageNumber: number;
|
|
68
|
+
pendingNextPage: boolean;
|
|
69
|
+
};
|
|
70
|
+
type DocumentCaptureInput = {
|
|
71
|
+
config: DocumentCaptureConfig;
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/modules/document-capture/documentCaptureStateMachine.d.ts
|
|
75
|
+
declare const documentCaptureMachine: xstate0.StateMachine<DocumentCaptureContext, {
|
|
76
|
+
type: "CAPTURE";
|
|
77
|
+
} | {
|
|
78
|
+
type: "FILE_SELECTED";
|
|
79
|
+
file: File;
|
|
80
|
+
imageBase64: string;
|
|
81
|
+
fileType: string;
|
|
82
|
+
} | {
|
|
83
|
+
type: "ACCEPT";
|
|
84
|
+
} | {
|
|
85
|
+
type: "RETAKE";
|
|
86
|
+
} | {
|
|
87
|
+
type: "UPLOAD_PROGRESS";
|
|
88
|
+
progress: number;
|
|
89
|
+
} | {
|
|
90
|
+
type: "RETRY";
|
|
91
|
+
} | {
|
|
92
|
+
type: "CONTINUE";
|
|
93
|
+
} | {
|
|
94
|
+
type: "SKIP";
|
|
95
|
+
} | {
|
|
96
|
+
type: "CLOSE";
|
|
97
|
+
}, {
|
|
98
|
+
[x: string]: xstate0.ActorRefFromLogic<xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>> | xstate0.ActorRefFromLogic<xstate0.PromiseActorLogic<DocumentUploadResponse, {
|
|
99
|
+
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
100
|
+
processingType: string;
|
|
101
|
+
onProgress: (progress: number) => void;
|
|
102
|
+
}, xstate0.EventObject>> | undefined;
|
|
103
|
+
}, xstate0.Values<{
|
|
104
|
+
initCamera: {
|
|
105
|
+
src: "initCamera";
|
|
106
|
+
logic: xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>;
|
|
107
|
+
id: string | undefined;
|
|
108
|
+
};
|
|
109
|
+
uploadDocument: {
|
|
110
|
+
src: "uploadDocument";
|
|
111
|
+
logic: xstate0.PromiseActorLogic<DocumentUploadResponse, {
|
|
112
|
+
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
113
|
+
processingType: string;
|
|
114
|
+
onProgress: (progress: number) => void;
|
|
115
|
+
}, xstate0.EventObject>;
|
|
116
|
+
id: string | undefined;
|
|
117
|
+
};
|
|
118
|
+
}>, xstate0.Values<{
|
|
119
|
+
setStream: {
|
|
120
|
+
type: "setStream";
|
|
121
|
+
params: unknown;
|
|
122
|
+
};
|
|
123
|
+
setCapturedDocument: {
|
|
124
|
+
type: "setCapturedDocument";
|
|
125
|
+
params: unknown;
|
|
126
|
+
};
|
|
127
|
+
setFileTooLargeError: {
|
|
128
|
+
type: "setFileTooLargeError";
|
|
129
|
+
params: unknown;
|
|
130
|
+
};
|
|
131
|
+
setProgress: {
|
|
132
|
+
type: "setProgress";
|
|
133
|
+
params: unknown;
|
|
134
|
+
};
|
|
135
|
+
setUploadError: {
|
|
136
|
+
type: "setUploadError";
|
|
137
|
+
params: unknown;
|
|
138
|
+
};
|
|
139
|
+
decrementAttemptsRemaining: {
|
|
140
|
+
type: "decrementAttemptsRemaining";
|
|
141
|
+
params: unknown;
|
|
142
|
+
};
|
|
143
|
+
setCaptureMethodFile: {
|
|
144
|
+
type: "setCaptureMethodFile";
|
|
145
|
+
params: unknown;
|
|
146
|
+
};
|
|
147
|
+
setCaptureMethodCamera: {
|
|
148
|
+
type: "setCaptureMethodCamera";
|
|
149
|
+
params: unknown;
|
|
150
|
+
};
|
|
151
|
+
clearCapturedDocument: {
|
|
152
|
+
type: "clearCapturedDocument";
|
|
153
|
+
params: unknown;
|
|
154
|
+
};
|
|
155
|
+
setPendingNextPage: {
|
|
156
|
+
type: "setPendingNextPage";
|
|
157
|
+
params: unknown;
|
|
158
|
+
};
|
|
159
|
+
clearForNextPage: {
|
|
160
|
+
type: "clearForNextPage";
|
|
161
|
+
params: unknown;
|
|
162
|
+
};
|
|
163
|
+
clearError: {
|
|
164
|
+
type: "clearError";
|
|
165
|
+
params: unknown;
|
|
166
|
+
};
|
|
167
|
+
resetProgress: {
|
|
168
|
+
type: "resetProgress";
|
|
169
|
+
params: unknown;
|
|
170
|
+
};
|
|
171
|
+
stopStream: {
|
|
172
|
+
type: "stopStream";
|
|
173
|
+
params: unknown;
|
|
174
|
+
};
|
|
175
|
+
trackTutorial: {
|
|
176
|
+
type: "trackTutorial";
|
|
177
|
+
params: unknown;
|
|
178
|
+
};
|
|
179
|
+
trackCapture: {
|
|
180
|
+
type: "trackCapture";
|
|
181
|
+
params: unknown;
|
|
182
|
+
};
|
|
183
|
+
trackPreview: {
|
|
184
|
+
type: "trackPreview";
|
|
185
|
+
params: unknown;
|
|
186
|
+
};
|
|
187
|
+
trackUploading: {
|
|
188
|
+
type: "trackUploading";
|
|
189
|
+
params: unknown;
|
|
190
|
+
};
|
|
191
|
+
trackSuccess: {
|
|
192
|
+
type: "trackSuccess";
|
|
193
|
+
params: unknown;
|
|
194
|
+
};
|
|
195
|
+
trackFailure: {
|
|
196
|
+
type: "trackFailure";
|
|
197
|
+
params: unknown;
|
|
198
|
+
};
|
|
199
|
+
}>, xstate0.Values<{
|
|
200
|
+
allowSkip: {
|
|
201
|
+
type: "allowSkip";
|
|
202
|
+
params: unknown;
|
|
203
|
+
};
|
|
204
|
+
fileSizeOk: {
|
|
205
|
+
type: "fileSizeOk";
|
|
206
|
+
params: unknown;
|
|
207
|
+
};
|
|
208
|
+
hasAttemptsRemaining: {
|
|
209
|
+
type: "hasAttemptsRemaining";
|
|
210
|
+
params: unknown;
|
|
211
|
+
};
|
|
212
|
+
canRetryCamera: {
|
|
213
|
+
type: "canRetryCamera";
|
|
214
|
+
params: unknown;
|
|
215
|
+
};
|
|
216
|
+
canRetryFile: {
|
|
217
|
+
type: "canRetryFile";
|
|
218
|
+
params: unknown;
|
|
219
|
+
};
|
|
220
|
+
attemptsExhausted: {
|
|
221
|
+
type: "attemptsExhausted";
|
|
222
|
+
params: unknown;
|
|
223
|
+
};
|
|
224
|
+
isCameraMode: {
|
|
225
|
+
type: "isCameraMode";
|
|
226
|
+
params: unknown;
|
|
227
|
+
};
|
|
228
|
+
isPendingNextPage: {
|
|
229
|
+
type: "isPendingNextPage";
|
|
230
|
+
params: unknown;
|
|
231
|
+
};
|
|
232
|
+
}>, never, "initCamera" | "tutorial" | "capturing" | "preview" | "finished" | "closed" | "failure" | "uploading" | "success", string, DocumentCaptureInput, xstate0.NonReducibleUnknown, xstate0.EventObject, xstate0.MetaObject, {
|
|
233
|
+
readonly id: "documentCapture";
|
|
234
|
+
readonly initial: "tutorial";
|
|
235
|
+
readonly context: ({
|
|
236
|
+
input
|
|
237
|
+
}: {
|
|
238
|
+
spawn: {
|
|
239
|
+
<TSrc extends "initCamera" | "uploadDocument">(logic: TSrc, ...[options]: ({
|
|
240
|
+
src: "initCamera";
|
|
241
|
+
logic: xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>;
|
|
242
|
+
id: string | undefined;
|
|
243
|
+
} extends infer T ? T extends {
|
|
244
|
+
src: "initCamera";
|
|
245
|
+
logic: xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>;
|
|
246
|
+
id: string | undefined;
|
|
247
|
+
} ? T extends {
|
|
248
|
+
src: TSrc;
|
|
249
|
+
} ? xstate0.ConditionalRequired<[options?: ({
|
|
250
|
+
id?: T["id"] | undefined;
|
|
251
|
+
systemId?: string;
|
|
252
|
+
input?: xstate0.InputFrom<T["logic"]> | undefined;
|
|
253
|
+
syncSnapshot?: boolean;
|
|
254
|
+
} & { [K in xstate0.RequiredActorOptions<T>]: unknown }) | undefined], xstate0.IsNotNever<xstate0.RequiredActorOptions<T>>> : never : never : never) | ({
|
|
255
|
+
src: "uploadDocument";
|
|
256
|
+
logic: xstate0.PromiseActorLogic<DocumentUploadResponse, {
|
|
257
|
+
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
258
|
+
processingType: string;
|
|
259
|
+
onProgress: (progress: number) => void;
|
|
260
|
+
}, xstate0.EventObject>;
|
|
261
|
+
id: string | undefined;
|
|
262
|
+
} extends infer T_1 ? T_1 extends {
|
|
263
|
+
src: "uploadDocument";
|
|
264
|
+
logic: xstate0.PromiseActorLogic<DocumentUploadResponse, {
|
|
265
|
+
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
266
|
+
processingType: string;
|
|
267
|
+
onProgress: (progress: number) => void;
|
|
268
|
+
}, xstate0.EventObject>;
|
|
269
|
+
id: string | undefined;
|
|
270
|
+
} ? T_1 extends {
|
|
271
|
+
src: TSrc;
|
|
272
|
+
} ? xstate0.ConditionalRequired<[options?: ({
|
|
273
|
+
id?: T_1["id"] | undefined;
|
|
274
|
+
systemId?: string;
|
|
275
|
+
input?: xstate0.InputFrom<T_1["logic"]> | undefined;
|
|
276
|
+
syncSnapshot?: boolean;
|
|
277
|
+
} & { [K_1 in xstate0.RequiredActorOptions<T_1>]: unknown }) | undefined], xstate0.IsNotNever<xstate0.RequiredActorOptions<T_1>>> : never : never : never)): xstate0.ActorRefFromLogic<xstate0.GetConcreteByKey<xstate0.Values<{
|
|
278
|
+
initCamera: {
|
|
279
|
+
src: "initCamera";
|
|
280
|
+
logic: xstate0.PromiseActorLogic<MediaStream, void, xstate0.EventObject>;
|
|
281
|
+
id: string | undefined;
|
|
282
|
+
};
|
|
283
|
+
uploadDocument: {
|
|
284
|
+
src: "uploadDocument";
|
|
285
|
+
logic: xstate0.PromiseActorLogic<DocumentUploadResponse, {
|
|
286
|
+
capturedDocument: NonNullable<DocumentCaptureContext["capturedDocument"]>;
|
|
287
|
+
processingType: string;
|
|
288
|
+
onProgress: (progress: number) => void;
|
|
289
|
+
}, xstate0.EventObject>;
|
|
290
|
+
id: string | undefined;
|
|
291
|
+
};
|
|
292
|
+
}>, "src", TSrc>["logic"]>;
|
|
293
|
+
<TLogic extends xstate0.AnyActorLogic>(src: TLogic, ...[options]: xstate0.ConditionalRequired<[options?: ({
|
|
294
|
+
id?: never;
|
|
295
|
+
systemId?: string;
|
|
296
|
+
input?: xstate0.InputFrom<TLogic> | undefined;
|
|
297
|
+
syncSnapshot?: boolean;
|
|
298
|
+
} & { [K in xstate0.RequiredLogicInput<TLogic>]: unknown }) | undefined], xstate0.IsNotNever<xstate0.RequiredLogicInput<TLogic>>>): xstate0.ActorRefFromLogic<TLogic>;
|
|
299
|
+
};
|
|
300
|
+
input: DocumentCaptureInput;
|
|
301
|
+
self: xstate0.ActorRef<xstate0.MachineSnapshot<DocumentCaptureContext, {
|
|
302
|
+
type: "CAPTURE";
|
|
303
|
+
} | {
|
|
304
|
+
type: "FILE_SELECTED";
|
|
305
|
+
file: File;
|
|
306
|
+
imageBase64: string;
|
|
307
|
+
fileType: string;
|
|
308
|
+
} | {
|
|
309
|
+
type: "ACCEPT";
|
|
310
|
+
} | {
|
|
311
|
+
type: "RETAKE";
|
|
312
|
+
} | {
|
|
313
|
+
type: "UPLOAD_PROGRESS";
|
|
314
|
+
progress: number;
|
|
315
|
+
} | {
|
|
316
|
+
type: "RETRY";
|
|
317
|
+
} | {
|
|
318
|
+
type: "CONTINUE";
|
|
319
|
+
} | {
|
|
320
|
+
type: "SKIP";
|
|
321
|
+
} | {
|
|
322
|
+
type: "CLOSE";
|
|
323
|
+
}, Record<string, xstate0.AnyActorRef | undefined>, xstate0.StateValue, string, unknown, any, any>, {
|
|
324
|
+
type: "CAPTURE";
|
|
325
|
+
} | {
|
|
326
|
+
type: "FILE_SELECTED";
|
|
327
|
+
file: File;
|
|
328
|
+
imageBase64: string;
|
|
329
|
+
fileType: string;
|
|
330
|
+
} | {
|
|
331
|
+
type: "ACCEPT";
|
|
332
|
+
} | {
|
|
333
|
+
type: "RETAKE";
|
|
334
|
+
} | {
|
|
335
|
+
type: "UPLOAD_PROGRESS";
|
|
336
|
+
progress: number;
|
|
337
|
+
} | {
|
|
338
|
+
type: "RETRY";
|
|
339
|
+
} | {
|
|
340
|
+
type: "CONTINUE";
|
|
341
|
+
} | {
|
|
342
|
+
type: "SKIP";
|
|
343
|
+
} | {
|
|
344
|
+
type: "CLOSE";
|
|
345
|
+
}, xstate0.AnyEventObject>;
|
|
346
|
+
}) => {
|
|
347
|
+
config: {
|
|
348
|
+
processingType: DocumentType;
|
|
349
|
+
captureMode: "file" | "camera";
|
|
350
|
+
allowSkipDocumentCapture: boolean;
|
|
351
|
+
captureAttempts: number;
|
|
352
|
+
sendBase64: boolean;
|
|
353
|
+
maxFileSize: number;
|
|
354
|
+
title: string | undefined;
|
|
355
|
+
text: string | undefined;
|
|
356
|
+
step2Title: string | undefined;
|
|
357
|
+
step2Text: string | undefined;
|
|
358
|
+
};
|
|
359
|
+
stream: undefined;
|
|
360
|
+
capturedDocument: undefined;
|
|
361
|
+
captureMethod: undefined;
|
|
362
|
+
progress: number;
|
|
363
|
+
error: undefined;
|
|
364
|
+
attemptsRemaining: number;
|
|
365
|
+
pageNumber: number;
|
|
366
|
+
pendingNextPage: false;
|
|
367
|
+
};
|
|
368
|
+
readonly states: {
|
|
369
|
+
readonly tutorial: {
|
|
370
|
+
readonly entry: "trackTutorial";
|
|
371
|
+
readonly on: {
|
|
372
|
+
readonly CAPTURE: readonly [{
|
|
373
|
+
readonly target: "initCamera";
|
|
374
|
+
readonly guard: "isCameraMode";
|
|
375
|
+
}, {
|
|
376
|
+
readonly target: "capturing";
|
|
377
|
+
}];
|
|
378
|
+
readonly FILE_SELECTED: readonly [{
|
|
379
|
+
readonly target: "preview";
|
|
380
|
+
readonly guard: "fileSizeOk";
|
|
381
|
+
readonly actions: readonly ["setCapturedDocument", "setCaptureMethodFile"];
|
|
382
|
+
}, {
|
|
383
|
+
readonly target: "tutorial";
|
|
384
|
+
readonly actions: "setFileTooLargeError";
|
|
385
|
+
}];
|
|
386
|
+
readonly SKIP: {
|
|
387
|
+
readonly target: "finished";
|
|
388
|
+
readonly guard: "allowSkip";
|
|
389
|
+
};
|
|
390
|
+
readonly CLOSE: {
|
|
391
|
+
readonly target: "closed";
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
readonly initCamera: {
|
|
396
|
+
readonly invoke: {
|
|
397
|
+
readonly id: "initCamera";
|
|
398
|
+
readonly src: "initCamera";
|
|
399
|
+
readonly input: undefined;
|
|
400
|
+
readonly onDone: {
|
|
401
|
+
readonly target: "capturing";
|
|
402
|
+
readonly actions: "setStream";
|
|
403
|
+
};
|
|
404
|
+
readonly onError: {
|
|
405
|
+
readonly target: "failure";
|
|
406
|
+
readonly actions: "setUploadError";
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
readonly on: {
|
|
410
|
+
readonly CLOSE: {
|
|
411
|
+
readonly target: "closed";
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
readonly capturing: {
|
|
416
|
+
readonly entry: "trackCapture";
|
|
417
|
+
readonly on: {
|
|
418
|
+
readonly FILE_SELECTED: readonly [{
|
|
419
|
+
readonly target: "preview";
|
|
420
|
+
readonly guard: "fileSizeOk";
|
|
421
|
+
readonly actions: readonly ["setCapturedDocument", "setCaptureMethodCamera"];
|
|
422
|
+
}, {
|
|
423
|
+
readonly target: "capturing";
|
|
424
|
+
readonly actions: "setFileTooLargeError";
|
|
425
|
+
}];
|
|
426
|
+
readonly CLOSE: {
|
|
427
|
+
readonly target: "closed";
|
|
428
|
+
readonly actions: "stopStream";
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
readonly preview: {
|
|
433
|
+
readonly entry: "trackPreview";
|
|
434
|
+
readonly on: {
|
|
435
|
+
readonly ACCEPT: {
|
|
436
|
+
readonly target: "uploading";
|
|
437
|
+
readonly actions: "resetProgress";
|
|
438
|
+
};
|
|
439
|
+
readonly RETAKE: {
|
|
440
|
+
readonly target: "capturing";
|
|
441
|
+
readonly actions: "clearCapturedDocument";
|
|
442
|
+
};
|
|
443
|
+
readonly CLOSE: {
|
|
444
|
+
readonly target: "closed";
|
|
445
|
+
readonly actions: "stopStream";
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
readonly uploading: {
|
|
450
|
+
readonly entry: "trackUploading";
|
|
451
|
+
readonly invoke: {
|
|
452
|
+
readonly id: "uploadDocument";
|
|
453
|
+
readonly src: "uploadDocument";
|
|
454
|
+
readonly input: ({
|
|
455
|
+
context,
|
|
456
|
+
self
|
|
457
|
+
}: {
|
|
458
|
+
context: DocumentCaptureContext;
|
|
459
|
+
event: {
|
|
460
|
+
type: "CAPTURE";
|
|
461
|
+
} | {
|
|
462
|
+
type: "FILE_SELECTED";
|
|
463
|
+
file: File;
|
|
464
|
+
imageBase64: string;
|
|
465
|
+
fileType: string;
|
|
466
|
+
} | {
|
|
467
|
+
type: "ACCEPT";
|
|
468
|
+
} | {
|
|
469
|
+
type: "RETAKE";
|
|
470
|
+
} | {
|
|
471
|
+
type: "UPLOAD_PROGRESS";
|
|
472
|
+
progress: number;
|
|
473
|
+
} | {
|
|
474
|
+
type: "RETRY";
|
|
475
|
+
} | {
|
|
476
|
+
type: "CONTINUE";
|
|
477
|
+
} | {
|
|
478
|
+
type: "SKIP";
|
|
479
|
+
} | {
|
|
480
|
+
type: "CLOSE";
|
|
481
|
+
};
|
|
482
|
+
self: xstate0.ActorRef<xstate0.MachineSnapshot<DocumentCaptureContext, {
|
|
483
|
+
type: "CAPTURE";
|
|
484
|
+
} | {
|
|
485
|
+
type: "FILE_SELECTED";
|
|
486
|
+
file: File;
|
|
487
|
+
imageBase64: string;
|
|
488
|
+
fileType: string;
|
|
489
|
+
} | {
|
|
490
|
+
type: "ACCEPT";
|
|
491
|
+
} | {
|
|
492
|
+
type: "RETAKE";
|
|
493
|
+
} | {
|
|
494
|
+
type: "UPLOAD_PROGRESS";
|
|
495
|
+
progress: number;
|
|
496
|
+
} | {
|
|
497
|
+
type: "RETRY";
|
|
498
|
+
} | {
|
|
499
|
+
type: "CONTINUE";
|
|
500
|
+
} | {
|
|
501
|
+
type: "SKIP";
|
|
502
|
+
} | {
|
|
503
|
+
type: "CLOSE";
|
|
504
|
+
}, Record<string, xstate0.AnyActorRef>, xstate0.StateValue, string, unknown, any, any>, {
|
|
505
|
+
type: "CAPTURE";
|
|
506
|
+
} | {
|
|
507
|
+
type: "FILE_SELECTED";
|
|
508
|
+
file: File;
|
|
509
|
+
imageBase64: string;
|
|
510
|
+
fileType: string;
|
|
511
|
+
} | {
|
|
512
|
+
type: "ACCEPT";
|
|
513
|
+
} | {
|
|
514
|
+
type: "RETAKE";
|
|
515
|
+
} | {
|
|
516
|
+
type: "UPLOAD_PROGRESS";
|
|
517
|
+
progress: number;
|
|
518
|
+
} | {
|
|
519
|
+
type: "RETRY";
|
|
520
|
+
} | {
|
|
521
|
+
type: "CONTINUE";
|
|
522
|
+
} | {
|
|
523
|
+
type: "SKIP";
|
|
524
|
+
} | {
|
|
525
|
+
type: "CLOSE";
|
|
526
|
+
}, xstate0.AnyEventObject>;
|
|
527
|
+
}) => {
|
|
528
|
+
capturedDocument: CapturedDocument;
|
|
529
|
+
processingType: DocumentType;
|
|
530
|
+
onProgress: (progress: number) => void;
|
|
531
|
+
};
|
|
532
|
+
readonly onDone: {
|
|
533
|
+
readonly target: "success";
|
|
534
|
+
readonly actions: readonly ["setPendingNextPage", "stopStream"];
|
|
535
|
+
};
|
|
536
|
+
readonly onError: {
|
|
537
|
+
readonly target: "failure";
|
|
538
|
+
readonly actions: readonly ["setUploadError", "decrementAttemptsRemaining", "stopStream"];
|
|
539
|
+
};
|
|
540
|
+
};
|
|
541
|
+
readonly on: {
|
|
542
|
+
readonly UPLOAD_PROGRESS: {
|
|
543
|
+
readonly actions: "setProgress";
|
|
544
|
+
};
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
readonly success: {
|
|
548
|
+
readonly entry: "trackSuccess";
|
|
549
|
+
readonly on: {
|
|
550
|
+
readonly CONTINUE: readonly [{
|
|
551
|
+
readonly target: "tutorial";
|
|
552
|
+
readonly guard: "isPendingNextPage";
|
|
553
|
+
readonly actions: "clearForNextPage";
|
|
554
|
+
}, {
|
|
555
|
+
readonly target: "finished";
|
|
556
|
+
}];
|
|
557
|
+
};
|
|
558
|
+
};
|
|
559
|
+
readonly failure: {
|
|
560
|
+
readonly entry: "trackFailure";
|
|
561
|
+
readonly on: {
|
|
562
|
+
readonly RETRY: readonly [{
|
|
563
|
+
readonly target: "initCamera";
|
|
564
|
+
readonly guard: "canRetryCamera";
|
|
565
|
+
readonly actions: readonly ["clearError", "clearCapturedDocument"];
|
|
566
|
+
}, {
|
|
567
|
+
readonly target: "tutorial";
|
|
568
|
+
readonly guard: "canRetryFile";
|
|
569
|
+
readonly actions: readonly ["clearError", "clearCapturedDocument"];
|
|
570
|
+
}];
|
|
571
|
+
readonly CLOSE: {
|
|
572
|
+
readonly target: "closed";
|
|
573
|
+
};
|
|
574
|
+
};
|
|
575
|
+
readonly after: {
|
|
576
|
+
readonly 3000: {
|
|
577
|
+
readonly target: "finished";
|
|
578
|
+
readonly guard: "attemptsExhausted";
|
|
579
|
+
};
|
|
580
|
+
};
|
|
581
|
+
};
|
|
582
|
+
readonly finished: {
|
|
583
|
+
readonly type: "final";
|
|
584
|
+
};
|
|
585
|
+
readonly closed: {
|
|
586
|
+
readonly type: "final";
|
|
587
|
+
};
|
|
588
|
+
};
|
|
589
|
+
}>;
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region src/modules/document-capture/documentCaptureActor.d.ts
|
|
592
|
+
type CreateDocumentCaptureActorOptions = {
|
|
593
|
+
config: DocumentCaptureConfig;
|
|
594
|
+
};
|
|
595
|
+
//#endregion
|
|
596
|
+
//#region src/modules/document-capture/documentCaptureManager.d.ts
|
|
597
|
+
type DocumentCaptureTutorialState = {
|
|
598
|
+
status: 'tutorial';
|
|
599
|
+
title: string | undefined;
|
|
600
|
+
text: string | undefined;
|
|
601
|
+
allowSkipDocumentCapture: boolean;
|
|
602
|
+
captureMode: 'file' | 'camera';
|
|
603
|
+
error: DocumentCaptureErrorCode | undefined;
|
|
604
|
+
pageNumber: number;
|
|
605
|
+
};
|
|
606
|
+
type DocumentCaptureInitializingCameraState = {
|
|
607
|
+
status: 'initializingCamera';
|
|
608
|
+
};
|
|
609
|
+
type DocumentCaptureCapturingState = {
|
|
610
|
+
status: 'capturing';
|
|
611
|
+
stream: MediaStream | undefined;
|
|
612
|
+
captureMode: 'file' | 'camera';
|
|
613
|
+
error: DocumentCaptureErrorCode | undefined;
|
|
614
|
+
pageNumber: number;
|
|
615
|
+
};
|
|
616
|
+
type DocumentCapturePreviewState = {
|
|
617
|
+
status: 'preview';
|
|
618
|
+
imageBase64: string;
|
|
619
|
+
fileType: string;
|
|
620
|
+
fileName: string;
|
|
621
|
+
};
|
|
622
|
+
type DocumentCaptureUploadingState = {
|
|
623
|
+
status: 'uploading';
|
|
624
|
+
progress: number;
|
|
625
|
+
imageBase64: string;
|
|
626
|
+
fileType: string;
|
|
627
|
+
fileName: string;
|
|
628
|
+
};
|
|
629
|
+
type DocumentCaptureSuccessState = {
|
|
630
|
+
status: 'success';
|
|
631
|
+
imageBase64: string;
|
|
632
|
+
fileType: string;
|
|
633
|
+
fileName: string;
|
|
634
|
+
pendingNextPage: boolean;
|
|
635
|
+
};
|
|
636
|
+
type DocumentCaptureFailureState = {
|
|
637
|
+
status: 'failure';
|
|
638
|
+
error: DocumentCaptureErrorCode;
|
|
639
|
+
attemptsRemaining: number;
|
|
640
|
+
};
|
|
641
|
+
type DocumentCaptureFinishedState = {
|
|
642
|
+
status: 'finished';
|
|
643
|
+
};
|
|
644
|
+
type DocumentCaptureClosedState = {
|
|
645
|
+
status: 'closed';
|
|
646
|
+
};
|
|
647
|
+
type DocumentCaptureState = DocumentCaptureTutorialState | DocumentCaptureInitializingCameraState | DocumentCaptureCapturingState | DocumentCapturePreviewState | DocumentCaptureUploadingState | DocumentCaptureSuccessState | DocumentCaptureFailureState | DocumentCaptureFinishedState | DocumentCaptureClosedState;
|
|
648
|
+
declare function createDocumentCaptureManager(options: CreateDocumentCaptureActorOptions): Manager<DocumentCaptureState> & {
|
|
649
|
+
capture(): void;
|
|
650
|
+
setFile(file: File, imageBase64: string): void;
|
|
651
|
+
accept(): void;
|
|
652
|
+
retake(): void;
|
|
653
|
+
retry(): void;
|
|
654
|
+
continue(): void;
|
|
655
|
+
skip(): void;
|
|
656
|
+
close(): void;
|
|
657
|
+
};
|
|
658
|
+
type DocumentCaptureManager = ReturnType<typeof createDocumentCaptureManager>;
|
|
659
|
+
//#endregion
|
|
660
|
+
export { DOCUMENT_CAPTURE_ERROR_CODES, type DocumentCaptureConfig, type DocumentCaptureErrorCode, type DocumentCaptureManager, type DocumentCaptureState, type DocumentType, createDocumentCaptureManager, documentCaptureMachine };
|