@incodetech/core 0.0.0-dev-20260421-3ad52f4 → 0.0.0-dev-20260421-ac38ea9
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/ae-signature.d.ts +1 -1
- package/dist/consent.d.ts +53 -53
- package/dist/document-capture.d.ts +76 -76
- package/dist/document-upload.d.ts +49 -49
- package/dist/electronic-signature.d.ts +1 -1
- package/dist/extensibility.d.ts +1 -1
- package/dist/extensibility.esm.js +2 -2
- package/dist/home.d.ts +10 -10
- package/dist/id.d.ts +2 -2
- package/dist/id.esm.js +3 -3
- package/dist/{idCaptureManager-CfHYOEgl.esm.js → idCaptureManager-CxTrbaj_.esm.js} +58 -1
- package/dist/{idCaptureManager-eoc0PvFh.d.ts → idCaptureManager-DaqJk3sg.d.ts} +108 -3
- package/dist/{idCaptureStateMachine-BFSvu5or.esm.js → idCaptureStateMachine-CkDMgCTu.esm.js} +406 -14
- package/dist/identity-reuse.d.ts +47 -47
- package/dist/{index-D98KKBR4.d.ts → index-9p9VlHBc.d.ts} +119 -119
- package/dist/mandatory-consent.d.ts +52 -52
- package/dist/qe-signature.d.ts +1 -1
- package/dist/workflow.d.ts +112 -112
- package/dist/workflow.esm.js +1 -1
- package/package.json +3 -3
package/dist/{idCaptureStateMachine-BFSvu5or.esm.js → idCaptureStateMachine-CkDMgCTu.esm.js}
RENAMED
|
@@ -215,6 +215,9 @@ const ID_ERROR_CODES = {
|
|
|
215
215
|
USER_CANCELLED: "USER_CANCELLED",
|
|
216
216
|
SERVER: "SERVER_ERROR"
|
|
217
217
|
};
|
|
218
|
+
const MANUAL_UPLOAD_MAX_RETRIES = 3;
|
|
219
|
+
const MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
|
220
|
+
const MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS = 5e3;
|
|
218
221
|
|
|
219
222
|
//#endregion
|
|
220
223
|
//#region src/modules/id/idCaptureServices.ts
|
|
@@ -471,6 +474,31 @@ async function processId(isSecondId = false, queueName = "", signal) {
|
|
|
471
474
|
const url = queueName ? `${endpoint}?queueName=${queueName}` : endpoint;
|
|
472
475
|
return { isDocumentExpired: (await api.post(url, {}, { signal })).data?.isDocumentExpired ?? false };
|
|
473
476
|
}
|
|
477
|
+
/**
|
|
478
|
+
* Upload a user-selected image as front / back / passport ID.
|
|
479
|
+
*
|
|
480
|
+
* Uses the same request shape as the live-camera path (`uploadIdImage`):
|
|
481
|
+
* JSON body `{ base64Image }` with default application/json Content-Type,
|
|
482
|
+
* `captureType=UPLOAD` query param, `retry=true` when retrying.
|
|
483
|
+
* Back is POSTed to `/omni/add/back-id/v2`; front and passport both go to
|
|
484
|
+
* `/omni/add/front-id/v2` — the server distinguishes by session state.
|
|
485
|
+
*
|
|
486
|
+
* The v2 endpoints reject raw `image/jpeg` bodies with 415, so the caller
|
|
487
|
+
* must convert the File to base64 before calling this service.
|
|
488
|
+
*/
|
|
489
|
+
async function uploadManualIdFile(params) {
|
|
490
|
+
const { side, base64Image, retry, onlyFront, signal } = params;
|
|
491
|
+
const endpoint = side === "back" ? endpoints.backId : endpoints.frontId;
|
|
492
|
+
const queryParams = { captureType: "UPLOAD" };
|
|
493
|
+
if (retry) queryParams.retry = true;
|
|
494
|
+
if (onlyFront && side === "front") queryParams.onlyFront = true;
|
|
495
|
+
const res = await api.post(endpoint, { base64Image }, {
|
|
496
|
+
signal,
|
|
497
|
+
query: queryParams
|
|
498
|
+
});
|
|
499
|
+
if (!res.ok) throw new Error(`POST ${endpoint} failed: ${res.status} ${res.statusText}`);
|
|
500
|
+
return res.data;
|
|
501
|
+
}
|
|
474
502
|
|
|
475
503
|
//#endregion
|
|
476
504
|
//#region ../infra/src/wasm/idCaptureDefaults.ts
|
|
@@ -812,6 +840,87 @@ const checkVirtualCameraActor = fromPromise(async ({ input }) => {
|
|
|
812
840
|
if (!videoTrack) return false;
|
|
813
841
|
return input.deepsightService.checkVirtualCamera(videoTrack);
|
|
814
842
|
});
|
|
843
|
+
/**
|
|
844
|
+
* Read a File's bytes and return the raw base64 payload (the portion after
|
|
845
|
+
* `data:<mime>;base64,`). The backend's `/omni/add/*-id/v2` endpoints reject
|
|
846
|
+
* full data-URLs with `IllegalArgumentException: Illegal base64 character 3a`,
|
|
847
|
+
* so the prefix must be stripped before posting. Mirrors the live-camera
|
|
848
|
+
* path in `packages/infra/src/media/canvas.ts:getBase64Image()`.
|
|
849
|
+
*/
|
|
850
|
+
function fileToBase64Payload(file) {
|
|
851
|
+
return new Promise((resolve, reject) => {
|
|
852
|
+
const reader = new FileReader();
|
|
853
|
+
reader.onload = () => {
|
|
854
|
+
const result = reader.result;
|
|
855
|
+
if (typeof result !== "string") {
|
|
856
|
+
reject(/* @__PURE__ */ new Error("FileReader produced non-string result"));
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
859
|
+
const commaIndex = result.indexOf(",");
|
|
860
|
+
resolve(commaIndex === -1 ? result : result.slice(commaIndex + 1));
|
|
861
|
+
};
|
|
862
|
+
reader.onerror = () => {
|
|
863
|
+
reject(reader.error ?? /* @__PURE__ */ new Error("FileReader failed"));
|
|
864
|
+
};
|
|
865
|
+
reader.readAsDataURL(file);
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
const uploadManualFileActor = fromPromise(async ({ input, signal }) => {
|
|
869
|
+
const base64Image = await fileToBase64Payload(input.file);
|
|
870
|
+
return uploadManualIdFile({
|
|
871
|
+
side: input.side,
|
|
872
|
+
base64Image,
|
|
873
|
+
retry: input.retry,
|
|
874
|
+
onlyFront: input.onlyFront,
|
|
875
|
+
signal
|
|
876
|
+
});
|
|
877
|
+
});
|
|
878
|
+
|
|
879
|
+
//#endregion
|
|
880
|
+
//#region src/modules/id/manualUploadErrors.ts
|
|
881
|
+
/**
|
|
882
|
+
* i18n keys for manual-upload user-facing error copy.
|
|
883
|
+
* Keep in sync with `packages/ui/src/i18n/**.json` under the `manualIdUpload.*` namespace.
|
|
884
|
+
*/
|
|
885
|
+
const MANUAL_UPLOAD_ERROR_KEYS = {
|
|
886
|
+
wrongSide: "manualIdUpload.wrongSide",
|
|
887
|
+
wrongDocument: "manualIdUpload.wrongDocument",
|
|
888
|
+
fileTooBig: "manualIdUpload.fileTooBig",
|
|
889
|
+
generic: "manualIdUpload.generic",
|
|
890
|
+
lowSharpness: "manualIdUpload.lowSharpness",
|
|
891
|
+
glareDetected: "manualIdUpload.glareDetected",
|
|
892
|
+
readabilityIssue: "manualIdUpload.readabilityIssue",
|
|
893
|
+
qualityRejected: "manualIdUpload.qualityRejected"
|
|
894
|
+
};
|
|
895
|
+
/**
|
|
896
|
+
* Map the server's `failReason` (plus client-side passport/ID tab mismatch and
|
|
897
|
+
* per-image quality flags) onto an i18n key. Mirrors v1's `shouldUploadAgain`
|
|
898
|
+
* branch logic in
|
|
899
|
+
* `ms-incodesmile-web/packages/incode-welcome/src/manualIdUpload/manuaIdUpload.tsx`,
|
|
900
|
+
* extended to also reject responses where the backend flagged a per-image
|
|
901
|
+
* quality issue (`correctSharpness`, `correctGlare`, `readability`, or
|
|
902
|
+
* `idQualityAttemptApproved` set to `false`).
|
|
903
|
+
*
|
|
904
|
+
* Quality flags are checked with `=== false` so missing/undefined values
|
|
905
|
+
* (older backends, partial payloads) keep the legacy "trust the server"
|
|
906
|
+
* behaviour and do not produce false positives.
|
|
907
|
+
*
|
|
908
|
+
* Returns `null` when the response represents a successful upload — the caller
|
|
909
|
+
* should treat `null` as "no error, advance to next slot".
|
|
910
|
+
*/
|
|
911
|
+
function mapFailReasonToErrorKey(response, expectedTab) {
|
|
912
|
+
const failReason = response.failReason;
|
|
913
|
+
if (failReason === "WRONG_DOCUMENT_SIDE") return MANUAL_UPLOAD_ERROR_KEYS.wrongSide;
|
|
914
|
+
if (failReason === "WRONG_ONE_SIDED_DOCUMENT" || failReason === "UNKNOWN_DOCUMENT_TYPE") return MANUAL_UPLOAD_ERROR_KEYS.wrongDocument;
|
|
915
|
+
if (failReason === "ID_TYPE_UNACCEPTABLE") return MANUAL_UPLOAD_ERROR_KEYS.wrongDocument;
|
|
916
|
+
if (expectedTab === "passport" && response.typeOfId && response.typeOfId.toLowerCase() !== "passport") return MANUAL_UPLOAD_ERROR_KEYS.wrongDocument;
|
|
917
|
+
if (expectedTab === "id" && response.typeOfId?.toLowerCase() === "passport") return MANUAL_UPLOAD_ERROR_KEYS.wrongDocument;
|
|
918
|
+
if (response.correctSharpness === false) return MANUAL_UPLOAD_ERROR_KEYS.lowSharpness;
|
|
919
|
+
if (response.correctGlare === false) return MANUAL_UPLOAD_ERROR_KEYS.glareDetected;
|
|
920
|
+
if (response.readability === false) return MANUAL_UPLOAD_ERROR_KEYS.readabilityIssue;
|
|
921
|
+
if (response.idQualityAttemptApproved === false) return MANUAL_UPLOAD_ERROR_KEYS.qualityRejected;
|
|
922
|
+
return null;
|
|
923
|
+
}
|
|
815
924
|
|
|
816
925
|
//#endregion
|
|
817
926
|
//#region src/modules/id/idCaptureActions.ts
|
|
@@ -1089,6 +1198,47 @@ const hasMandatoryConsentGuard = ({ context }) => context.uploadResponse?.showMa
|
|
|
1089
1198
|
const isDeepsightEnabledGuard = ({ context }) => context.dependencies !== void 0;
|
|
1090
1199
|
const isDeepsightReadyGuard = ({ context }) => context.deepsightService !== void 0;
|
|
1091
1200
|
const needsDeepsightInitGuard = ({ context }) => context.dependencies !== void 0 && context.deepsightService === void 0 && !context.deepsightInitAttempted;
|
|
1201
|
+
const getFileFromEvent = (event) => {
|
|
1202
|
+
if (event.type === "MANUAL_UPLOAD_FILE_SELECTED") return event.file;
|
|
1203
|
+
};
|
|
1204
|
+
const getSideFromEvent = (event) => {
|
|
1205
|
+
if (event.type === "MANUAL_UPLOAD_FILE_SELECTED") return event.side;
|
|
1206
|
+
};
|
|
1207
|
+
const isSelectedFileTooLargeGuard = ({ event }) => {
|
|
1208
|
+
const file = getFileFromEvent(event);
|
|
1209
|
+
return file ? file.size > MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES : false;
|
|
1210
|
+
};
|
|
1211
|
+
const isFrontFileSelectionGuard = ({ event }) => getSideFromEvent(event) === "front";
|
|
1212
|
+
const isBackFileSelectionGuard = ({ event }) => getSideFromEvent(event) === "back";
|
|
1213
|
+
const isPassportFileSelectionGuard = ({ event }) => getSideFromEvent(event) === "passport";
|
|
1214
|
+
/**
|
|
1215
|
+
* True once `retriesLeft` has been decremented to 0 — evaluated from the
|
|
1216
|
+
* `checkRetries` state after the decrement action runs.
|
|
1217
|
+
*/
|
|
1218
|
+
const manualUploadRetriesExhaustedGuard = ({ context }) => context.manualUpload.retriesLeft <= 0;
|
|
1219
|
+
const canContinueFromIdTabGuard = ({ context }) => {
|
|
1220
|
+
if (context.manualUpload.activeTab !== "id") return false;
|
|
1221
|
+
if (!context.manualUpload.frontUploaded) return false;
|
|
1222
|
+
if (context.config.onlyFront) return true;
|
|
1223
|
+
if (context.manualUpload.skipBackFromServer) return true;
|
|
1224
|
+
return context.manualUpload.backUploaded;
|
|
1225
|
+
};
|
|
1226
|
+
const canContinueFromPassportTabGuard = ({ context }) => context.manualUpload.activeTab === "passport" && context.manualUpload.passportUploaded;
|
|
1227
|
+
const getUploadResponseFromEvent = (event) => {
|
|
1228
|
+
if ("output" in event) return event.output;
|
|
1229
|
+
};
|
|
1230
|
+
/**
|
|
1231
|
+
* True when the server-side upload response contains a failReason or type
|
|
1232
|
+
* mismatch that should be surfaced to the user and counted against retries.
|
|
1233
|
+
* Evaluated by the actor's `onDone`, so the response lives on `event.output`.
|
|
1234
|
+
*/
|
|
1235
|
+
const manualUploadResponseHasErrorGuard = ({ context, event }) => {
|
|
1236
|
+
const response = getUploadResponseFromEvent(event);
|
|
1237
|
+
if (!response) return false;
|
|
1238
|
+
return mapFailReasonToErrorKey(response, context.manualUpload.activeTab) !== null;
|
|
1239
|
+
};
|
|
1240
|
+
const hasOnlyManualUploadAvailableGuard = ({ context }) => context.availableDocumentTypes.length === 1 && context.availableDocumentTypes[0] === "manualIdUpload";
|
|
1241
|
+
const isManualIdUploadSelectedGuard = ({ event }) => event.type === "SELECT_DOCUMENT" && event.documentType === "manualIdUpload";
|
|
1092
1242
|
|
|
1093
1243
|
//#endregion
|
|
1094
1244
|
//#region src/modules/id/idCaptureStateMachine.ts
|
|
@@ -1114,7 +1264,8 @@ const _idCaptureMachine = setup({
|
|
|
1114
1264
|
startRecording: startRecordingActor,
|
|
1115
1265
|
checkMotionSensor: checkMotionSensorActor,
|
|
1116
1266
|
initializeDeepsightSession: initializeDeepsightSessionActor,
|
|
1117
|
-
checkVirtualCamera: checkVirtualCameraActor
|
|
1267
|
+
checkVirtualCamera: checkVirtualCameraActor,
|
|
1268
|
+
uploadManualFile: uploadManualFileActor
|
|
1118
1269
|
},
|
|
1119
1270
|
actions: {
|
|
1120
1271
|
stopMediaStream: assign(({ context }) => {
|
|
@@ -1266,7 +1417,94 @@ const _idCaptureMachine = setup({
|
|
|
1266
1417
|
} }),
|
|
1267
1418
|
setMotionStatus: assign({ motionStatus: ({ event }) => {
|
|
1268
1419
|
if ("status" in event && event.type === "MOTION_STATUS") return event.status;
|
|
1269
|
-
} })
|
|
1420
|
+
} }),
|
|
1421
|
+
setManualUploadActiveTab: assign(({ context, event }) => {
|
|
1422
|
+
if (event.type !== "MANUAL_UPLOAD_TAB_CHANGED") return {};
|
|
1423
|
+
return { manualUpload: {
|
|
1424
|
+
...context.manualUpload,
|
|
1425
|
+
activeTab: event.tab,
|
|
1426
|
+
frontFile: null,
|
|
1427
|
+
backFile: null,
|
|
1428
|
+
passportFile: null,
|
|
1429
|
+
frontUploaded: false,
|
|
1430
|
+
backUploaded: false,
|
|
1431
|
+
passportUploaded: false,
|
|
1432
|
+
skipBackFromServer: false,
|
|
1433
|
+
errorMessage: null,
|
|
1434
|
+
retriesLeft: MANUAL_UPLOAD_MAX_RETRIES
|
|
1435
|
+
} };
|
|
1436
|
+
}),
|
|
1437
|
+
resetManualUpload: assign(({ context }) => ({ manualUpload: {
|
|
1438
|
+
...context.manualUpload,
|
|
1439
|
+
frontFile: null,
|
|
1440
|
+
backFile: null,
|
|
1441
|
+
passportFile: null,
|
|
1442
|
+
frontUploaded: false,
|
|
1443
|
+
backUploaded: false,
|
|
1444
|
+
passportUploaded: false,
|
|
1445
|
+
skipBackFromServer: false,
|
|
1446
|
+
errorMessage: null,
|
|
1447
|
+
retriesLeft: MANUAL_UPLOAD_MAX_RETRIES
|
|
1448
|
+
} })),
|
|
1449
|
+
storeSelectedFile: assign(({ context, event }) => {
|
|
1450
|
+
if (event.type !== "MANUAL_UPLOAD_FILE_SELECTED") return {};
|
|
1451
|
+
const updated = {
|
|
1452
|
+
...context.manualUpload,
|
|
1453
|
+
errorMessage: null
|
|
1454
|
+
};
|
|
1455
|
+
if (event.side === "front") updated.frontFile = event.file;
|
|
1456
|
+
else if (event.side === "back") updated.backFile = event.file;
|
|
1457
|
+
else updated.passportFile = event.file;
|
|
1458
|
+
return { manualUpload: updated };
|
|
1459
|
+
}),
|
|
1460
|
+
markFrontUploaded: assign(({ context }) => ({ manualUpload: {
|
|
1461
|
+
...context.manualUpload,
|
|
1462
|
+
frontUploaded: true,
|
|
1463
|
+
errorMessage: null
|
|
1464
|
+
} })),
|
|
1465
|
+
markBackUploaded: assign(({ context }) => ({ manualUpload: {
|
|
1466
|
+
...context.manualUpload,
|
|
1467
|
+
backUploaded: true,
|
|
1468
|
+
errorMessage: null
|
|
1469
|
+
} })),
|
|
1470
|
+
markPassportUploaded: assign(({ context }) => ({ manualUpload: {
|
|
1471
|
+
...context.manualUpload,
|
|
1472
|
+
passportUploaded: true,
|
|
1473
|
+
errorMessage: null
|
|
1474
|
+
} })),
|
|
1475
|
+
recordSkipBackFromResponse: assign(({ context, event }) => {
|
|
1476
|
+
if (!("output" in event)) return {};
|
|
1477
|
+
if (!event.output.skipBackIdCapture) return {};
|
|
1478
|
+
return { manualUpload: {
|
|
1479
|
+
...context.manualUpload,
|
|
1480
|
+
skipBackFromServer: true
|
|
1481
|
+
} };
|
|
1482
|
+
}),
|
|
1483
|
+
decrementManualUploadRetries: assign(({ context }) => ({ manualUpload: {
|
|
1484
|
+
...context.manualUpload,
|
|
1485
|
+
retriesLeft: Math.max(0, context.manualUpload.retriesLeft - 1)
|
|
1486
|
+
} })),
|
|
1487
|
+
setManualUploadErrorFromResponse: assign(({ context, event }) => {
|
|
1488
|
+
if (!("output" in event)) return {};
|
|
1489
|
+
const response = event.output;
|
|
1490
|
+
const errorKey = mapFailReasonToErrorKey(response, context.manualUpload.activeTab);
|
|
1491
|
+
return { manualUpload: {
|
|
1492
|
+
...context.manualUpload,
|
|
1493
|
+
errorMessage: errorKey ?? "manualIdUpload.generic"
|
|
1494
|
+
} };
|
|
1495
|
+
}),
|
|
1496
|
+
setManualUploadGenericError: assign(({ context }) => ({ manualUpload: {
|
|
1497
|
+
...context.manualUpload,
|
|
1498
|
+
errorMessage: "manualIdUpload.generic"
|
|
1499
|
+
} })),
|
|
1500
|
+
setManualUploadFileTooLargeError: assign(({ context }) => ({ manualUpload: {
|
|
1501
|
+
...context.manualUpload,
|
|
1502
|
+
errorMessage: "manualIdUpload.fileTooBig"
|
|
1503
|
+
} })),
|
|
1504
|
+
clearManualUploadError: assign(({ context }) => ({ manualUpload: {
|
|
1505
|
+
...context.manualUpload,
|
|
1506
|
+
errorMessage: null
|
|
1507
|
+
} }))
|
|
1270
1508
|
},
|
|
1271
1509
|
guards: {
|
|
1272
1510
|
hasShowTutorial: hasShowTutorialGuard,
|
|
@@ -1284,7 +1522,17 @@ const _idCaptureMachine = setup({
|
|
|
1284
1522
|
hasMandatoryConsent: hasMandatoryConsentGuard,
|
|
1285
1523
|
isDeepsightEnabled: isDeepsightEnabledGuard,
|
|
1286
1524
|
isDeepsightReady: isDeepsightReadyGuard,
|
|
1287
|
-
needsDeepsightInit: needsDeepsightInitGuard
|
|
1525
|
+
needsDeepsightInit: needsDeepsightInitGuard,
|
|
1526
|
+
isSelectedFileTooLarge: isSelectedFileTooLargeGuard,
|
|
1527
|
+
isFrontFileSelection: isFrontFileSelectionGuard,
|
|
1528
|
+
isBackFileSelection: isBackFileSelectionGuard,
|
|
1529
|
+
isPassportFileSelection: isPassportFileSelectionGuard,
|
|
1530
|
+
manualUploadRetriesExhausted: manualUploadRetriesExhaustedGuard,
|
|
1531
|
+
canContinueFromIdTab: canContinueFromIdTabGuard,
|
|
1532
|
+
canContinueFromPassportTab: canContinueFromPassportTabGuard,
|
|
1533
|
+
manualUploadResponseHasError: manualUploadResponseHasErrorGuard,
|
|
1534
|
+
hasOnlyManualUploadAvailable: hasOnlyManualUploadAvailableGuard,
|
|
1535
|
+
isManualIdUploadSelected: isManualIdUploadSelectedGuard
|
|
1288
1536
|
}
|
|
1289
1537
|
}).createMachine({
|
|
1290
1538
|
id: "idCapture",
|
|
@@ -1325,7 +1573,19 @@ const _idCaptureMachine = setup({
|
|
|
1325
1573
|
deepsightInitAttempted: false,
|
|
1326
1574
|
availableDocumentTypes: getAvailableDocumentTypes(input.config),
|
|
1327
1575
|
captureResolution: void 0,
|
|
1328
|
-
cameraFallbackLevel: void 0
|
|
1576
|
+
cameraFallbackLevel: void 0,
|
|
1577
|
+
manualUpload: {
|
|
1578
|
+
frontFile: null,
|
|
1579
|
+
backFile: null,
|
|
1580
|
+
passportFile: null,
|
|
1581
|
+
activeTab: "id",
|
|
1582
|
+
retriesLeft: MANUAL_UPLOAD_MAX_RETRIES,
|
|
1583
|
+
errorMessage: null,
|
|
1584
|
+
skipBackFromServer: false,
|
|
1585
|
+
frontUploaded: false,
|
|
1586
|
+
backUploaded: false,
|
|
1587
|
+
passportUploaded: false
|
|
1588
|
+
}
|
|
1329
1589
|
};
|
|
1330
1590
|
},
|
|
1331
1591
|
on: {
|
|
@@ -1334,6 +1594,10 @@ const _idCaptureMachine = setup({
|
|
|
1334
1594
|
},
|
|
1335
1595
|
states: {
|
|
1336
1596
|
idle: { on: { LOAD: [
|
|
1597
|
+
{
|
|
1598
|
+
target: "manualIdUpload",
|
|
1599
|
+
guard: "hasOnlyManualUploadAvailable"
|
|
1600
|
+
},
|
|
1337
1601
|
{
|
|
1338
1602
|
target: "chooser",
|
|
1339
1603
|
guard: "hasShowDocumentChooser"
|
|
@@ -1344,14 +1608,22 @@ const _idCaptureMachine = setup({
|
|
|
1344
1608
|
},
|
|
1345
1609
|
{ target: "loading" }
|
|
1346
1610
|
] } },
|
|
1347
|
-
chooser: { on: { SELECT_DOCUMENT: [
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1611
|
+
chooser: { on: { SELECT_DOCUMENT: [
|
|
1612
|
+
{
|
|
1613
|
+
target: "manualIdUpload",
|
|
1614
|
+
guard: "isManualIdUploadSelected",
|
|
1615
|
+
actions: ["setSelectedDocument"]
|
|
1616
|
+
},
|
|
1617
|
+
{
|
|
1618
|
+
target: "tutorial",
|
|
1619
|
+
guard: "hasShowTutorial",
|
|
1620
|
+
actions: ["setSelectedDocument", "setCurrentMode"]
|
|
1621
|
+
},
|
|
1622
|
+
{
|
|
1623
|
+
target: "loading",
|
|
1624
|
+
actions: ["setSelectedDocument", "setCurrentMode"]
|
|
1625
|
+
}
|
|
1626
|
+
] } },
|
|
1355
1627
|
loading: {
|
|
1356
1628
|
entry: "preloadRecordingProvider",
|
|
1357
1629
|
type: "parallel",
|
|
@@ -1983,11 +2255,131 @@ const _idCaptureMachine = setup({
|
|
|
1983
2255
|
actions: "resetContext"
|
|
1984
2256
|
} }
|
|
1985
2257
|
},
|
|
1986
|
-
manualIdUpload: {
|
|
2258
|
+
manualIdUpload: {
|
|
2259
|
+
initial: "selecting",
|
|
2260
|
+
on: {
|
|
2261
|
+
QUIT: { target: "closed" },
|
|
2262
|
+
MANUAL_UPLOAD_TAB_CHANGED: {
|
|
2263
|
+
target: ".selecting",
|
|
2264
|
+
actions: ["setManualUploadActiveTab"]
|
|
2265
|
+
},
|
|
2266
|
+
MANUAL_UPLOAD_RESET: {
|
|
2267
|
+
target: ".selecting",
|
|
2268
|
+
actions: ["resetManualUpload"]
|
|
2269
|
+
}
|
|
2270
|
+
},
|
|
2271
|
+
states: {
|
|
2272
|
+
selecting: { on: {
|
|
2273
|
+
MANUAL_UPLOAD_FILE_SELECTED: [
|
|
2274
|
+
{
|
|
2275
|
+
guard: "isSelectedFileTooLarge",
|
|
2276
|
+
actions: ["setManualUploadFileTooLargeError"]
|
|
2277
|
+
},
|
|
2278
|
+
{
|
|
2279
|
+
guard: "isFrontFileSelection",
|
|
2280
|
+
target: "uploadingFront",
|
|
2281
|
+
actions: ["storeSelectedFile"]
|
|
2282
|
+
},
|
|
2283
|
+
{
|
|
2284
|
+
guard: "isBackFileSelection",
|
|
2285
|
+
target: "uploadingBack",
|
|
2286
|
+
actions: ["storeSelectedFile"]
|
|
2287
|
+
},
|
|
2288
|
+
{
|
|
2289
|
+
guard: "isPassportFileSelection",
|
|
2290
|
+
target: "uploadingPassport",
|
|
2291
|
+
actions: ["storeSelectedFile"]
|
|
2292
|
+
}
|
|
2293
|
+
],
|
|
2294
|
+
MANUAL_UPLOAD_CONTINUE: [{
|
|
2295
|
+
guard: "canContinueFromIdTab",
|
|
2296
|
+
target: "#idCapture.processing"
|
|
2297
|
+
}, {
|
|
2298
|
+
guard: "canContinueFromPassportTab",
|
|
2299
|
+
target: "#idCapture.processing"
|
|
2300
|
+
}]
|
|
2301
|
+
} },
|
|
2302
|
+
uploadingFront: { invoke: {
|
|
2303
|
+
id: "uploadManualFile",
|
|
2304
|
+
src: "uploadManualFile",
|
|
2305
|
+
input: ({ context }) => ({
|
|
2306
|
+
side: "front",
|
|
2307
|
+
file: context.manualUpload.frontFile,
|
|
2308
|
+
retry: context.manualUpload.retriesLeft < MANUAL_UPLOAD_MAX_RETRIES,
|
|
2309
|
+
onlyFront: context.config.onlyFront ?? false
|
|
2310
|
+
}),
|
|
2311
|
+
onDone: [{
|
|
2312
|
+
guard: "manualUploadResponseHasError",
|
|
2313
|
+
target: "checkRetries",
|
|
2314
|
+
actions: ["decrementManualUploadRetries", "setManualUploadErrorFromResponse"]
|
|
2315
|
+
}, {
|
|
2316
|
+
target: "selecting",
|
|
2317
|
+
actions: [
|
|
2318
|
+
"markFrontUploaded",
|
|
2319
|
+
"recordSkipBackFromResponse",
|
|
2320
|
+
"clearManualUploadError"
|
|
2321
|
+
]
|
|
2322
|
+
}],
|
|
2323
|
+
onError: {
|
|
2324
|
+
target: "checkRetries",
|
|
2325
|
+
actions: ["decrementManualUploadRetries", "setManualUploadGenericError"]
|
|
2326
|
+
}
|
|
2327
|
+
} },
|
|
2328
|
+
uploadingBack: { invoke: {
|
|
2329
|
+
id: "uploadManualFile",
|
|
2330
|
+
src: "uploadManualFile",
|
|
2331
|
+
input: ({ context }) => ({
|
|
2332
|
+
side: "back",
|
|
2333
|
+
file: context.manualUpload.backFile,
|
|
2334
|
+
retry: context.manualUpload.retriesLeft < MANUAL_UPLOAD_MAX_RETRIES,
|
|
2335
|
+
onlyFront: false
|
|
2336
|
+
}),
|
|
2337
|
+
onDone: [{
|
|
2338
|
+
guard: "manualUploadResponseHasError",
|
|
2339
|
+
target: "checkRetries",
|
|
2340
|
+
actions: ["decrementManualUploadRetries", "setManualUploadErrorFromResponse"]
|
|
2341
|
+
}, {
|
|
2342
|
+
target: "selecting",
|
|
2343
|
+
actions: ["markBackUploaded", "clearManualUploadError"]
|
|
2344
|
+
}],
|
|
2345
|
+
onError: {
|
|
2346
|
+
target: "checkRetries",
|
|
2347
|
+
actions: ["decrementManualUploadRetries", "setManualUploadGenericError"]
|
|
2348
|
+
}
|
|
2349
|
+
} },
|
|
2350
|
+
uploadingPassport: { invoke: {
|
|
2351
|
+
id: "uploadManualFile",
|
|
2352
|
+
src: "uploadManualFile",
|
|
2353
|
+
input: ({ context }) => ({
|
|
2354
|
+
side: "passport",
|
|
2355
|
+
file: context.manualUpload.passportFile,
|
|
2356
|
+
retry: context.manualUpload.retriesLeft < MANUAL_UPLOAD_MAX_RETRIES,
|
|
2357
|
+
onlyFront: false
|
|
2358
|
+
}),
|
|
2359
|
+
onDone: [{
|
|
2360
|
+
guard: "manualUploadResponseHasError",
|
|
2361
|
+
target: "checkRetries",
|
|
2362
|
+
actions: ["decrementManualUploadRetries", "setManualUploadErrorFromResponse"]
|
|
2363
|
+
}, {
|
|
2364
|
+
target: "selecting",
|
|
2365
|
+
actions: ["markPassportUploaded", "clearManualUploadError"]
|
|
2366
|
+
}],
|
|
2367
|
+
onError: {
|
|
2368
|
+
target: "checkRetries",
|
|
2369
|
+
actions: ["decrementManualUploadRetries", "setManualUploadGenericError"]
|
|
2370
|
+
}
|
|
2371
|
+
} },
|
|
2372
|
+
checkRetries: { always: [{
|
|
2373
|
+
guard: "manualUploadRetriesExhausted",
|
|
2374
|
+
target: "retriesExhausted"
|
|
2375
|
+
}, { target: "selecting" }] },
|
|
2376
|
+
retriesExhausted: { after: { [MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS]: { target: "#idCapture.finished" } } }
|
|
2377
|
+
}
|
|
2378
|
+
},
|
|
1987
2379
|
digitalIdUpload: { on: { QUIT: { target: "closed" } } }
|
|
1988
2380
|
}
|
|
1989
2381
|
});
|
|
1990
2382
|
const idCaptureMachine = _idCaptureMachine;
|
|
1991
2383
|
|
|
1992
2384
|
//#endregion
|
|
1993
|
-
export { startRecordingSession as a, uploadIdImage as c, processId as i,
|
|
2385
|
+
export { startRecordingSession as a, uploadIdImage as c, ID_ERROR_CODES as d, MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS as f, processId as i, uploadManualIdFile as l, MANUAL_UPLOAD_MAX_RETRIES as m, initializeIdCapture as n, stopRecording as o, MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES as p, preloadIdRecordingProvider as r, stopStream as s, idCaptureMachine as t, validateUploadResponse as u };
|