@incodetech/core 0.0.0-dev-20260409-a38d5e8 → 0.0.0-dev-20260409-09dfd52

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 (134) hide show
  1. package/dist/BrowserStorageProvider-CXaS5Ooj.esm.js +55 -0
  2. package/dist/{OpenViduRecordingProvider-Bn2meybK.esm.js → OpenViduRecordingProvider-D_cVAwYQ.esm.js} +1 -1
  3. package/dist/{WasmUtilProvider-BpZSvZbg.esm.js → WasmUtilProvider-mWSXzp7b.esm.js} +1 -1
  4. package/dist/{addressSearch-DOFI7lwy.esm.js → addressSearch-C26OZIx0.esm.js} +4 -4
  5. package/dist/antifraud.d.ts +1 -1
  6. package/dist/antifraud.esm.js +4 -37
  7. package/dist/antifraudStateMachine-B74mO8vr.esm.js +39 -0
  8. package/dist/authentication.d.ts +11 -11
  9. package/dist/authentication.esm.js +22 -19
  10. package/dist/authenticationManager-BBQHippG.esm.js +67 -0
  11. package/dist/{authenticationManager-C2mk36yK.d.ts → authenticationManager-DOTo1EYF.d.ts} +2 -2
  12. package/dist/{authenticationManager-C7dL_avf.esm.js → authenticationStateMachine-DCJ0ArAt.esm.js} +7 -67
  13. package/dist/{backCameraStream-tabTmwDS.esm.js → backCameraStream-D9g2wyil.esm.js} +3 -3
  14. package/dist/camera.d.ts +1 -1
  15. package/dist/camera.esm.js +3 -3
  16. package/dist/consent.d.ts +55 -55
  17. package/dist/consent.esm.js +4 -149
  18. package/dist/consentStateMachine-DIdJXJW0.esm.js +151 -0
  19. package/dist/cross-document-data-match.d.ts +1 -1
  20. package/dist/cross-document-data-match.esm.js +4 -4
  21. package/dist/curp-validation.d.ts +5 -5
  22. package/dist/curp-validation.esm.js +4 -417
  23. package/dist/curpValidationStateMachine-Dp5WB6__.esm.js +419 -0
  24. package/dist/{deepsightLoader-Cj6SyUQ-.esm.js → deepsightLoader-CaULV07H.esm.js} +10 -10
  25. package/dist/{deepsightService-ByD6uIs7.d.ts → deepsightService-S-tU77m-.d.ts} +2 -2
  26. package/dist/{deepsightService-BjgXl5hs.esm.js → deepsightService-rPGLH8Xp.esm.js} +5 -5
  27. package/dist/device.esm.js +3 -3
  28. package/dist/document-capture.d.ts +80 -78
  29. package/dist/document-capture.esm.js +8 -403
  30. package/dist/document-upload.d.ts +53 -53
  31. package/dist/document-upload.esm.js +7 -7
  32. package/dist/documentCaptureStateMachine-ByYOCKz5.esm.js +403 -0
  33. package/dist/ekyb.d.ts +3 -3
  34. package/dist/ekyb.esm.js +10 -655
  35. package/dist/ekybStateMachine-DRku_YmR.esm.js +653 -0
  36. package/dist/ekyc.d.ts +3 -3
  37. package/dist/ekyc.esm.js +6 -10614
  38. package/dist/ekycStateMachine-CSWaaWVl.esm.js +10615 -0
  39. package/dist/email.d.ts +3 -3
  40. package/dist/email.esm.js +6 -5
  41. package/dist/{emailManager-CU_hzrsl.d.ts → emailManager-D6CHM2QO.d.ts} +4 -3
  42. package/dist/emailManager-DByjyeY8.esm.js +238 -0
  43. package/dist/{emailManager-_9R4vm6g.esm.js → emailStateMachine-BoIkeCw5.esm.js} +6 -239
  44. package/dist/{events-DlHrOIRc.esm.js → events-W91zLpx4.esm.js} +5 -1
  45. package/dist/events.esm.js +2 -2
  46. package/dist/extensibility.d.ts +15 -15
  47. package/dist/extensibility.esm.js +33 -26
  48. package/dist/face-match.d.ts +7 -6
  49. package/dist/face-match.esm.js +8 -129
  50. package/dist/faceCaptureManagerFactory-Bspg2Tyf.esm.js +117 -0
  51. package/dist/{faceCaptureManagerFactory-Da_-ohdg.d.ts → faceCaptureManagerFactory-P2yy30KU.d.ts} +8 -8
  52. package/dist/{faceCaptureSetup-CaVWkjvE.esm.js → faceCaptureSetup-CQevz86q.esm.js} +5 -119
  53. package/dist/faceMatchStateMachine-CLterVEC.esm.js +127 -0
  54. package/dist/flow.d.ts +8 -13
  55. package/dist/flow.esm.js +10 -29
  56. package/dist/{flowCompletionService-B5JemmC6.esm.js → flowCompletionService-DZSDUXus.esm.js} +2 -2
  57. package/dist/{flowServices-p22wrYPf.esm.js → flowServices-YATk0fgY.esm.js} +3 -3
  58. package/dist/geolocation.d.ts +7 -6
  59. package/dist/geolocation.esm.js +7 -105
  60. package/dist/geolocationStateMachine-CRRUCl9K.esm.js +105 -0
  61. package/dist/{getDeviceClass-DEzz4cmY.esm.js → getDeviceClass-DBF-ExLR.esm.js} +1 -1
  62. package/dist/government-validation.d.ts +2 -2
  63. package/dist/government-validation.esm.js +5 -269
  64. package/dist/governmentValidationStateMachine-C_iPX9VE.esm.js +271 -0
  65. package/dist/http.esm.js +1 -1
  66. package/dist/id.d.ts +10 -10
  67. package/dist/id.esm.js +22 -20
  68. package/dist/idCaptureManager-CJfatzuY.esm.js +335 -0
  69. package/dist/{idCaptureManager-CV08v1e3.d.ts → idCaptureManager-CbZvdr9y.d.ts} +7 -7
  70. package/dist/{idCaptureManager-dyZzKv8L.esm.js → idCaptureStateMachine-gf-Q9piu.esm.js} +17 -346
  71. package/dist/index.d.ts +2 -2
  72. package/dist/index.esm.js +8 -8
  73. package/dist/{lib-Bavz2qmt.esm.js → lib-BzVJ-zxG.esm.js} +1 -1
  74. package/dist/mandatory-consent.d.ts +55 -55
  75. package/dist/mandatory-consent.esm.js +4 -124
  76. package/dist/mandatoryConsentStateMachine-BZNBJ1fK.esm.js +126 -0
  77. package/dist/{openviduLazy-vhrVZCr_.esm.js → openviduLazy-CLg_-u0m.esm.js} +2 -2
  78. package/dist/openviduLazy-rFXBtZVZ.esm.js +3 -0
  79. package/dist/{permissionServices-Cskq32Yd.esm.js → permissionServices-Cisv73eQ.esm.js} +2 -2
  80. package/dist/phone.d.ts +3 -3
  81. package/dist/phone.esm.js +6 -5
  82. package/dist/phoneManager-DhC4obPF.esm.js +258 -0
  83. package/dist/{phoneManager-ulJuGvJ8.d.ts → phoneManager-Zwr-qCnC.d.ts} +2 -2
  84. package/dist/{phoneManager-DerdUfd4.esm.js → phoneStateMachine-Cc_w4tC0.esm.js} +5 -258
  85. package/dist/{recordingService-483wQ6kR.esm.js → recordingService-CCfxUY7-.esm.js} +14 -68
  86. package/dist/redirect-to-mobile.d.ts +2 -2
  87. package/dist/redirect-to-mobile.esm.js +5 -247
  88. package/dist/redirectToMobileStateMachine-vOe27Ufw.esm.js +249 -0
  89. package/dist/runChildModule-DVC4JEjp.esm.js +27 -0
  90. package/dist/selfie.d.ts +11 -11
  91. package/dist/selfie.esm.js +22 -19
  92. package/dist/selfieManager-CorEST5h.esm.js +60 -0
  93. package/dist/{selfieManager-DCRP7X75.d.ts → selfieManager-DNwfxieF.d.ts} +2 -2
  94. package/dist/selfieStateMachine-3b19ON1z.esm.js +56 -0
  95. package/dist/{session-CUh77zj3.esm.js → session-B_rKSRql.esm.js} +4 -4
  96. package/dist/session.d.ts +1 -1
  97. package/dist/session.esm.js +6 -6
  98. package/dist/{setup-DpHakxsC.d.ts → setup-BYqwVLiv.d.ts} +1 -1
  99. package/dist/{setup-XpxfZgKn.esm.js → setup-DLvhsDol.esm.js} +6 -5
  100. package/dist/signature.d.ts +4 -3
  101. package/dist/signature.esm.js +6 -189
  102. package/dist/signatureStateMachine-CU92zCXU.esm.js +189 -0
  103. package/dist/{stats-DHDoqSBV.esm.js → stats-gFD2351t.esm.js} +1 -1
  104. package/dist/stats.esm.js +2 -2
  105. package/dist/{types-2OPf1pyv.d.ts → types-CYJ0Ish6.d.ts} +1 -1
  106. package/dist/types-CjsEZRcz.d.ts +35 -0
  107. package/dist/{types-CVJVQ7fp.d.ts → types-DU8HmI5U.d.ts} +1 -1
  108. package/dist/wasm.d.ts +2 -2
  109. package/dist/wasm.esm.js +8 -8
  110. package/dist/workflow.d.ts +813 -0
  111. package/dist/workflow.esm.js +600 -0
  112. package/package.json +7 -3
  113. package/dist/openviduLazy-BIPHozOu.esm.js +0 -3
  114. package/dist/selfieManager-DeOcNel4.esm.js +0 -110
  115. /package/dist/{Actor-Ba71-_30.d.ts → Actor-DbWH1K6E.d.ts} +0 -0
  116. /package/dist/{BaseWasmProvider-D-s_6M5H.esm.js → BaseWasmProvider-DoYDYH1z.esm.js} +0 -0
  117. /package/dist/{BrowserEnvironmentProvider-DaHeLJQw.esm.js → BrowserEnvironmentProvider-BtKLxTx4.esm.js} +0 -0
  118. /package/dist/{BrowserTimerProvider-BhD2MlHg.esm.js → BrowserTimerProvider-v7bpbrAk.esm.js} +0 -0
  119. /package/dist/{ITimerCapability-oixwa6nj.esm.js → ITimerCapability-BZO_FsCo.esm.js} +0 -0
  120. /package/dist/{Manager-BN2g_I8W.d.ts → Manager-DcPMRgTm.d.ts} +0 -0
  121. /package/dist/{MotionSensorProvider-CodM3e0E.esm.js → MotionSensorProvider-D90R4qwV.esm.js} +0 -0
  122. /package/dist/{StateMachine-BoJsfMvg.d.ts → StateMachine-BBuIgsHT.d.ts} +0 -0
  123. /package/dist/{api-DzpnV6O7.esm.js → api-aa9Mx20l.esm.js} +0 -0
  124. /package/dist/{browserSimulation-B4ubb2OL.esm.js → browserSimulation-DFqGKQAD.esm.js} +0 -0
  125. /package/dist/{camera-1eeGnAaL.d.ts → camera-DATT31my.d.ts} +0 -0
  126. /package/dist/{camera-DmkFpf5N.esm.js → camera-DpPQS_-5.esm.js} +0 -0
  127. /package/dist/{chunk-DsxENsBR.esm.js → chunk-YGHKo4MY.esm.js} +0 -0
  128. /package/dist/{displayErrors-BZLX7idb.d.ts → displayErrors-xrg0ejaS.d.ts} +0 -0
  129. /package/dist/{flowCompletionService-D-3YCHyO.d.ts → flowCompletionService-gxt5reFV.d.ts} +0 -0
  130. /package/dist/{getBrowser-Dtyt9J_h.esm.js → getBrowser-DCcD7H-M.esm.js} +0 -0
  131. /package/dist/{platform-Dv7a2fv-.esm.js → platform-DctkySJU.esm.js} +0 -0
  132. /package/dist/{types-D_QfFKxT.d.ts → types-CIjb0FKu.d.ts} +0 -0
  133. /package/dist/{warmup-CIj_wEV_.d.ts → warmup-Ckb1hN85.d.ts} +0 -0
  134. /package/dist/{xstate.esm-Bv55-lJ4.esm.js → xstate.esm-B7FPE6br.esm.js} +0 -0
@@ -0,0 +1,403 @@
1
+ import { t as api } from "./api-aa9Mx20l.esm.js";
2
+ import { _ as endpoints } from "./events-W91zLpx4.esm.js";
3
+ import { i as fromPromise, n as assign, t as setup } from "./xstate.esm-B7FPE6br.esm.js";
4
+ import { i as stopCameraStream } from "./camera-DpPQS_-5.esm.js";
5
+ import { t as getBackCameraStream } from "./backCameraStream-D9g2wyil.esm.js";
6
+
7
+ //#region src/modules/document-capture/types.ts
8
+ const PROCESSING_TYPE_MAP = {
9
+ processV5CLogbook: "v5cMultiPageLogbook",
10
+ processCirculationCard: "circulationCard",
11
+ processFinanceSettlement: "financeSettlement",
12
+ processCarInvoice: "carInvoice",
13
+ asyncProcessCarInvoice: "carInvoice",
14
+ asyncProcessCirculationCard: "circulationCard",
15
+ capture: "addressStatement"
16
+ };
17
+ const MULTI_PAGE_TYPES = [
18
+ "v5cMultiPageLogbook",
19
+ "circulationCard",
20
+ "financeSettlement"
21
+ ];
22
+ const DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024;
23
+ const DEFAULT_CAPTURE_ATTEMPTS = 3;
24
+ const OTHER_DOCUMENT_TYPES = new Set([
25
+ "otherDocument1",
26
+ "otherDocument2",
27
+ "otherDocument3"
28
+ ]);
29
+ const DOCUMENT_CAPTURE_ERROR_CODES = {
30
+ FILE_TOO_LARGE: "FILE_TOO_LARGE",
31
+ UPLOAD_FAILED: "UPLOAD_FAILED"
32
+ };
33
+ const DOCUMENT_CAPTURE_FINALIZE_ERROR_CODES = { UNEXPECTED_ERROR: "UNEXPECTED_ERROR" };
34
+
35
+ //#endregion
36
+ //#region src/modules/document-capture/documentCaptureUploadService.ts
37
+ function isMultiPageDocumentType(processingType) {
38
+ return MULTI_PAGE_TYPES.includes(processingType);
39
+ }
40
+ function normalizeProcessingType(processingType) {
41
+ return PROCESSING_TYPE_MAP[processingType] ?? processingType;
42
+ }
43
+ function buildUrl(baseUrl, type, format) {
44
+ return `${baseUrl}?type=${encodeURIComponent(type)}&format=${format}`;
45
+ }
46
+ function resolveUploadUrl(processingType, fileFormat) {
47
+ const format = fileFormat === "application/pdf" ? "pdf" : "image";
48
+ const resolvedType = normalizeProcessingType(processingType);
49
+ if (isMultiPageDocumentType(resolvedType)) return buildUrl(endpoints.documentV3, resolvedType, format);
50
+ if (resolvedType === "carInvoice") return buildUrl(endpoints.cfdi, resolvedType, format);
51
+ if (OTHER_DOCUMENT_TYPES.has(resolvedType)) return buildUrl(endpoints.addDocument, resolvedType, format);
52
+ if (resolvedType === "addressStatement" || !resolvedType) return buildUrl(endpoints.addressStatement, resolvedType || "addressStatement", format);
53
+ return buildUrl(endpoints.addressStatement, processingType, format);
54
+ }
55
+ async function uploadDocumentCapture({ base64Image, processingType, fileFormat, onProgress, signal }) {
56
+ const url = resolveUploadUrl(processingType, fileFormat);
57
+ const rawBase64 = base64Image.includes(",") ? base64Image.split(",")[1] : base64Image;
58
+ const response = await api.post(url, { base64Image: rawBase64 }, {
59
+ signal,
60
+ onUploadProgress: onProgress
61
+ });
62
+ if (!response.ok) throw new Error(`Document upload failed: ${response.status}`);
63
+ if (!(response.data.success || response.data.status === "SUCCESS" || response.data.status === "ADD_NEXT_PAGE" || response.data.status === "OPTIONAL_PAGE_CAPTURE")) throw new Error("Document upload rejected by server");
64
+ return response.data;
65
+ }
66
+ function resolveMultiPageDocumentType(processingType) {
67
+ const resolvedType = normalizeProcessingType(processingType);
68
+ return isMultiPageDocumentType(resolvedType) ? resolvedType : null;
69
+ }
70
+ async function finalizeDocument({ processingType, signal }) {
71
+ const type = resolveMultiPageDocumentType(processingType);
72
+ if (!type) throw new Error(`finalizeDocument only supports multi-page types (${MULTI_PAGE_TYPES.join(", ")})`);
73
+ const response = await api.post(endpoints.finalizeDocument, { type }, { signal });
74
+ if (!response.ok) throw new Error(`Document finalize failed: ${response.status}`);
75
+ const data = response.data;
76
+ if (!data) throw new Error("Document finalize rejected by server");
77
+ if (!(data.success || data.status === "SUCCESS")) {
78
+ const serverStatus = typeof data.status === "string" ? data.status : "unknown";
79
+ throw new Error(`Document finalize rejected by server (status: ${serverStatus})`);
80
+ }
81
+ return data;
82
+ }
83
+
84
+ //#endregion
85
+ //#region src/modules/document-capture/documentCaptureStateMachine.ts
86
+ const documentCaptureMachine = setup({
87
+ types: {
88
+ context: {},
89
+ events: {},
90
+ input: {}
91
+ },
92
+ actors: {
93
+ initCamera: fromPromise(async () => {
94
+ const { stream } = await getBackCameraStream(void 0);
95
+ return stream;
96
+ }),
97
+ uploadDocument: fromPromise(async ({ input, signal }) => {
98
+ return uploadDocumentCapture({
99
+ base64Image: input.capturedDocument.imageBase64,
100
+ processingType: input.processingType,
101
+ fileFormat: input.capturedDocument.fileType,
102
+ onProgress: input.onProgress,
103
+ signal
104
+ });
105
+ }),
106
+ finalizeDocumentRequest: fromPromise(async ({ input, signal }) => {
107
+ return finalizeDocument({
108
+ processingType: input.processingType,
109
+ signal
110
+ });
111
+ })
112
+ },
113
+ actions: {
114
+ setStream: assign(({ event }) => ({ stream: event.output })),
115
+ setCapturedDocument: assign(({ event }) => {
116
+ const e = event;
117
+ return {
118
+ capturedDocument: {
119
+ imageBase64: e.imageBase64,
120
+ file: e.file,
121
+ fileType: e.fileType
122
+ },
123
+ error: void 0
124
+ };
125
+ }),
126
+ setFileTooLargeError: assign({ error: () => DOCUMENT_CAPTURE_ERROR_CODES.FILE_TOO_LARGE }),
127
+ setProgress: assign(({ event }) => ({ progress: event.progress })),
128
+ setUploadError: assign({ error: () => DOCUMENT_CAPTURE_ERROR_CODES.UPLOAD_FAILED }),
129
+ setFinalizeError: assign({ error: () => DOCUMENT_CAPTURE_FINALIZE_ERROR_CODES.UNEXPECTED_ERROR }),
130
+ decrementAttemptsRemaining: assign(({ context }) => ({ attemptsRemaining: context.attemptsRemaining - 1 })),
131
+ setCaptureMethodFile: assign({ captureMethod: () => "file" }),
132
+ setCaptureMethodCamera: assign({ captureMethod: () => "camera" }),
133
+ setCaptureMethodGallery: assign({ captureMethod: () => "gallery" }),
134
+ clearCapturedDocument: assign({
135
+ capturedDocument: () => void 0,
136
+ captureMethod: () => void 0,
137
+ progress: () => 0,
138
+ error: () => void 0
139
+ }),
140
+ clearCapturedDocumentGalleryRetake: assign({
141
+ capturedDocument: () => void 0,
142
+ progress: () => 0,
143
+ error: () => void 0
144
+ }),
145
+ setNextPageType: assign(({ context, event }) => {
146
+ const { status } = event.output;
147
+ if (context.captureMethod === "file" && context.capturedDocument?.fileType === "application/pdf") return { nextPageType: "none" };
148
+ return { nextPageType: status === "ADD_NEXT_PAGE" ? "required" : status === "OPTIONAL_PAGE_CAPTURE" ? "optional" : "none" };
149
+ }),
150
+ clearForNextPage: assign(({ context }) => ({
151
+ capturedDocument: void 0,
152
+ progress: 0,
153
+ error: void 0,
154
+ pageNumber: context.pageNumber + 1,
155
+ nextPageType: "none",
156
+ captureMethod: void 0
157
+ })),
158
+ clearError: assign({ error: () => void 0 }),
159
+ resetProgress: assign({ progress: () => 0 }),
160
+ stopStream: assign(({ context }) => {
161
+ if (context.stream) stopCameraStream(context.stream);
162
+ return { stream: void 0 };
163
+ })
164
+ },
165
+ guards: {
166
+ allowSkip: ({ context }) => context.config.allowSkipDocumentCapture && context.pageNumber === 1,
167
+ fileSizeOk: ({ context, event }) => {
168
+ return event.file.size <= context.config.maxFileSize;
169
+ },
170
+ canRetryCamera: ({ context }) => context.attemptsRemaining > 0 && context.captureMethod === "camera",
171
+ canRetryFile: ({ context }) => context.attemptsRemaining > 0 && context.captureMethod !== "camera",
172
+ canRetryNextDocumentCapture: ({ context }) => context.attemptsRemaining > 0 && context.nextPageType === "optional",
173
+ attemptsExhausted: ({ context }) => context.attemptsRemaining <= 0,
174
+ isCameraMode: ({ context }) => context.config.captureMode === "camera",
175
+ isCaptureMethodCamera: ({ context }) => context.captureMethod === "camera",
176
+ isCaptureMethodGallery: ({ context }) => context.captureMethod === "gallery",
177
+ isCaptureMethodFile: ({ context }) => context.captureMethod === "file",
178
+ isNextPageOptional: ({ context }) => context.nextPageType === "optional",
179
+ isNextPageRequired: ({ context }) => context.nextPageType === "required",
180
+ canFinalizeOptionalPages: ({ context }) => context.nextPageType === "optional" && resolveMultiPageDocumentType(context.config.processingType) !== null,
181
+ fileSizeOkForGallery: ({ context, event }) => {
182
+ return event.file.size <= context.config.maxFileSize && context.captureMethod === "gallery";
183
+ },
184
+ fileSizeOkForNonGallery: ({ context, event }) => {
185
+ return event.file.size <= context.config.maxFileSize && context.captureMethod !== "gallery";
186
+ }
187
+ }
188
+ }).createMachine({
189
+ id: "documentCapture",
190
+ initial: "tutorial",
191
+ context: ({ input }) => {
192
+ const { processingType = "addressStatement", captureMode = "camera", allowSkipDocumentCapture, disableSkipPoa, captureAttempts = DEFAULT_CAPTURE_ATTEMPTS, sendBase64 = false, maxFileSize = DEFAULT_MAX_FILE_SIZE, title, text, step2Title, step2Text } = input.config;
193
+ return {
194
+ config: {
195
+ processingType,
196
+ captureMode,
197
+ allowSkipDocumentCapture: allowSkipDocumentCapture ?? (disableSkipPoa != null ? !disableSkipPoa : false),
198
+ captureAttempts,
199
+ sendBase64,
200
+ maxFileSize,
201
+ title,
202
+ text,
203
+ step2Title,
204
+ step2Text
205
+ },
206
+ stream: void 0,
207
+ capturedDocument: void 0,
208
+ captureMethod: void 0,
209
+ progress: 0,
210
+ error: void 0,
211
+ attemptsRemaining: captureAttempts,
212
+ pageNumber: 1,
213
+ nextPageType: "none"
214
+ };
215
+ },
216
+ states: {
217
+ tutorial: { on: {
218
+ CAPTURE: [{
219
+ target: "initCamera",
220
+ guard: "isCameraMode"
221
+ }, { target: "capturing" }],
222
+ FILE_SELECTED: [{
223
+ target: "preview",
224
+ guard: "fileSizeOk",
225
+ actions: ["setCapturedDocument", "setCaptureMethodFile"]
226
+ }, {
227
+ target: "tutorial",
228
+ actions: "setFileTooLargeError"
229
+ }],
230
+ SKIP: {
231
+ target: "finished",
232
+ guard: "allowSkip"
233
+ },
234
+ CLOSE: { target: "closed" }
235
+ } },
236
+ initCamera: {
237
+ invoke: {
238
+ id: "initCamera",
239
+ src: "initCamera",
240
+ input: void 0,
241
+ onDone: {
242
+ target: "capturing",
243
+ actions: "setStream"
244
+ },
245
+ onError: {
246
+ target: "failure",
247
+ actions: "setUploadError"
248
+ }
249
+ },
250
+ on: { CLOSE: { target: "closed" } }
251
+ },
252
+ capturing: { on: {
253
+ FILE_SELECTED: [
254
+ {
255
+ target: "preview",
256
+ guard: "fileSizeOkForGallery",
257
+ actions: "setCapturedDocument"
258
+ },
259
+ {
260
+ target: "preview",
261
+ guard: "fileSizeOkForNonGallery",
262
+ actions: ["setCapturedDocument", "setCaptureMethodCamera"]
263
+ },
264
+ {
265
+ target: "capturing",
266
+ actions: "setFileTooLargeError"
267
+ }
268
+ ],
269
+ CLOSE: {
270
+ target: "closed",
271
+ actions: "stopStream"
272
+ }
273
+ } },
274
+ preview: { on: {
275
+ ACCEPT: {
276
+ target: "uploading",
277
+ actions: "resetProgress"
278
+ },
279
+ RETAKE: [
280
+ {
281
+ target: "tutorial",
282
+ guard: "isCaptureMethodFile",
283
+ actions: "clearCapturedDocument"
284
+ },
285
+ {
286
+ target: "capturing",
287
+ guard: "isCaptureMethodGallery",
288
+ actions: "clearCapturedDocumentGalleryRetake"
289
+ },
290
+ {
291
+ target: "capturing",
292
+ actions: "clearCapturedDocument"
293
+ }
294
+ ],
295
+ CLOSE: {
296
+ target: "closed",
297
+ actions: "stopStream"
298
+ }
299
+ } },
300
+ uploading: {
301
+ invoke: {
302
+ id: "uploadDocument",
303
+ src: "uploadDocument",
304
+ input: ({ context, self }) => {
305
+ if (!context.capturedDocument) throw new Error("No captured document to upload");
306
+ return {
307
+ capturedDocument: context.capturedDocument,
308
+ processingType: context.config.processingType,
309
+ onProgress: (progress) => {
310
+ self.send({
311
+ type: "UPLOAD_PROGRESS",
312
+ progress
313
+ });
314
+ }
315
+ };
316
+ },
317
+ onDone: {
318
+ target: "success",
319
+ actions: ["setNextPageType", "stopStream"]
320
+ },
321
+ onError: {
322
+ target: "failure",
323
+ actions: [
324
+ "setUploadError",
325
+ "decrementAttemptsRemaining",
326
+ "stopStream"
327
+ ]
328
+ }
329
+ },
330
+ on: { UPLOAD_PROGRESS: { actions: "setProgress" } }
331
+ },
332
+ success: { on: {
333
+ CONTINUE: [
334
+ {
335
+ target: "nextPage",
336
+ guard: "isNextPageOptional"
337
+ },
338
+ {
339
+ target: "nextPage",
340
+ guard: "isNextPageRequired"
341
+ },
342
+ { target: "finished" }
343
+ ],
344
+ CLOSE: { target: "closed" }
345
+ } },
346
+ nextPage: { on: {
347
+ NEXT_PAGE_CAMERA: {
348
+ target: "initCamera",
349
+ actions: ["clearForNextPage", "setCaptureMethodCamera"]
350
+ },
351
+ NEXT_PAGE_PHOTO_LIBRARY: {
352
+ target: "capturing",
353
+ actions: ["clearForNextPage", "setCaptureMethodGallery"]
354
+ },
355
+ ALL_PAGES_CAPTURED: [{
356
+ target: "finalizing",
357
+ guard: "canFinalizeOptionalPages"
358
+ }, { target: "finished" }],
359
+ CLOSE: { target: "closed" }
360
+ } },
361
+ finalizing: { invoke: {
362
+ id: "finalizeDocument",
363
+ src: "finalizeDocumentRequest",
364
+ input: ({ context }) => ({ processingType: context.config.processingType }),
365
+ onDone: { target: "finished" },
366
+ onError: {
367
+ target: "failure",
368
+ actions: ["setFinalizeError", "decrementAttemptsRemaining"]
369
+ }
370
+ } },
371
+ failure: {
372
+ on: {
373
+ RETRY: [
374
+ {
375
+ target: "nextPage",
376
+ guard: "canRetryNextDocumentCapture",
377
+ actions: ["clearError", "clearCapturedDocument"]
378
+ },
379
+ {
380
+ target: "initCamera",
381
+ guard: "canRetryCamera",
382
+ actions: ["clearError", "clearCapturedDocument"]
383
+ },
384
+ {
385
+ target: "tutorial",
386
+ guard: "canRetryFile",
387
+ actions: ["clearError", "clearCapturedDocument"]
388
+ }
389
+ ],
390
+ CLOSE: { target: "closed" }
391
+ },
392
+ after: { 3e3: {
393
+ target: "finished",
394
+ guard: "attemptsExhausted"
395
+ } }
396
+ },
397
+ finished: { type: "final" },
398
+ closed: { type: "final" }
399
+ }
400
+ });
401
+
402
+ //#endregion
403
+ export { DOCUMENT_CAPTURE_ERROR_CODES as n, documentCaptureMachine as t };
package/dist/ekyb.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { t as Manager } from "./Manager-BN2g_I8W.js";
2
- import "./Actor-Ba71-_30.js";
3
- import { n as AddressSuggestion, r as FieldDef, t as DisplayErrorsResult } from "./displayErrors-BZLX7idb.js";
1
+ import { t as Manager } from "./Manager-DcPMRgTm.js";
2
+ import "./Actor-DbWH1K6E.js";
3
+ import { n as AddressSuggestion, r as FieldDef, t as DisplayErrorsResult } from "./displayErrors-xrg0ejaS.js";
4
4
 
5
5
  //#region src/modules/ekyb/types.d.ts
6
6
  type UboEntry = {