@incodetech/core 2.0.0-rc.0 → 2.0.0
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/package.json +3 -3
- package/dist/Actor-CI32dTbG.d.ts +0 -2
- package/dist/BaseWasmProvider-C_DLEI40.esm.js +0 -1118
- package/dist/BrowserStorageProvider-CuOW1Er2.esm.js +0 -55
- package/dist/BrowserTimerProvider-DhNc_x02.esm.js +0 -22
- package/dist/ITimerCapability-C67ZRskg.esm.js +0 -7
- package/dist/IpifyProvider-D7jx52AL.esm.js +0 -139
- package/dist/Manager-C8PrhBOx.d.ts +0 -19
- package/dist/MotionSensorProvider-4v7xkqAp.esm.js +0 -254
- package/dist/OpenViduRecordingProvider-CMu6XVdc.esm.js +0 -87
- package/dist/StateMachine-BCQrZJhf.d.ts +0 -2
- package/dist/WasmUtilProvider-j98OJf-S.esm.js +0 -114
- package/dist/addressSearch-BpTbTWCa.esm.js +0 -430
- package/dist/ae-signature-DDDZmWXj.esm.js +0 -12
- package/dist/ae-signature.d.ts +0 -25
- package/dist/ae-signature.esm.js +0 -8
- package/dist/antifraud.d.ts +0 -57
- package/dist/antifraud.esm.js +0 -45
- package/dist/antifraudStateMachine-O0TMf6yc.esm.js +0 -39
- package/dist/api-CESGtpbH.esm.js +0 -53
- package/dist/authentication.d.ts +0 -12
- package/dist/authentication.esm.js +0 -25
- package/dist/authenticationManager-5M-fKzXx.esm.js +0 -67
- package/dist/authenticationManager-C83GNIhl.d.ts +0 -66
- package/dist/authenticationStateMachine-BMZqatiF.esm.js +0 -139
- package/dist/backCameraStream-DMdMeGk2.esm.js +0 -346
- package/dist/browserSimulation-gxD8cSpM.esm.js +0 -20
- package/dist/camera-DBSxa6ML.d.ts +0 -4
- package/dist/camera-PA2Ljri3.esm.js +0 -22
- package/dist/camera.d.ts +0 -15
- package/dist/camera.esm.js +0 -5
- package/dist/chunk-CRF6K_H_.esm.js +0 -49
- package/dist/consent.d.ts +0 -398
- package/dist/consent.esm.js +0 -79
- package/dist/consentStateMachine-CCT-B60O.esm.js +0 -151
- package/dist/cpf-PPz2Njto.esm.js +0 -38
- package/dist/cpf-ocr.d.ts +0 -204
- package/dist/cpf-ocr.esm.js +0 -177
- package/dist/cross-document-data-match.d.ts +0 -34
- package/dist/cross-document-data-match.esm.js +0 -71
- package/dist/curp-validation.d.ts +0 -188
- package/dist/curp-validation.esm.js +0 -110
- package/dist/curpValidationStateMachine-CitWLr2c.esm.js +0 -595
- package/dist/custom-fields.d.ts +0 -115
- package/dist/custom-fields.esm.js +0 -177
- package/dist/custom-watchlist.d.ts +0 -66
- package/dist/custom-watchlist.esm.js +0 -86
- package/dist/dateUtils-UoN5xswP.esm.js +0 -23
- package/dist/deepsightLoader-Cm4JIT_z.esm.js +0 -52
- package/dist/deepsightService-CEVxzehb.d.ts +0 -412
- package/dist/deepsightService-O74l4Y__.esm.js +0 -489
- package/dist/device.d.ts +0 -46
- package/dist/device.esm.js +0 -106
- package/dist/displayErrors-DqJ_IbsG.d.ts +0 -39
- package/dist/document-capture.d.ts +0 -906
- package/dist/document-capture.esm.js +0 -156
- package/dist/document-upload.d.ts +0 -331
- package/dist/document-upload.esm.js +0 -203
- package/dist/documentCaptureStateMachine-BqzTDy9k.esm.js +0 -394
- package/dist/dynamic-forms.d.ts +0 -178
- package/dist/dynamic-forms.esm.js +0 -323
- package/dist/ekyb.d.ts +0 -148
- package/dist/ekyb.esm.js +0 -127
- package/dist/ekybStateMachine-B59rQjgj.esm.js +0 -674
- package/dist/ekyc.d.ts +0 -164
- package/dist/ekyc.esm.js +0 -104
- package/dist/ekycStateMachine-oeO0Iekd.esm.js +0 -10626
- package/dist/electronic-signature.d.ts +0 -4
- package/dist/electronic-signature.esm.js +0 -7
- package/dist/electronicSignatureManager-D9OHzTpG.esm.js +0 -428
- package/dist/email.d.ts +0 -4
- package/dist/email.esm.js +0 -9
- package/dist/emailManager-DIfnS5g1.d.ts +0 -352
- package/dist/emailManager-wAV0LE-H.esm.js +0 -238
- package/dist/emailStateMachine-DOf4j58N.esm.js +0 -292
- package/dist/endpoints-CnN3SyDa.esm.js +0 -87
- package/dist/events-D6-e4vok.esm.js +0 -596
- package/dist/events.d.ts +0 -265
- package/dist/events.esm.js +0 -4
- package/dist/extensibility.d.ts +0 -122
- package/dist/extensibility.esm.js +0 -43
- package/dist/face-match.d.ts +0 -228
- package/dist/face-match.esm.js +0 -173
- package/dist/faceCaptureManagerFactory-Dh2PdGlF.esm.js +0 -290
- package/dist/faceCaptureManagerFactory-yqtpxjnN.d.ts +0 -690
- package/dist/faceCaptureSetup-B3faSpYA.esm.js +0 -873
- package/dist/faceMatchStateMachine-DNFrxTFS.esm.js +0 -127
- package/dist/flow-events.d.ts +0 -6
- package/dist/flow-events.esm.js +0 -0
- package/dist/flow.d.ts +0 -358
- package/dist/flow.esm.js +0 -825
- package/dist/flowCompletionService-DhkT4SRY.d.ts +0 -10
- package/dist/flowCompletionService-P54yzGvA.esm.js +0 -13
- package/dist/flowServices-DTsm-Vf1.esm.js +0 -188
- package/dist/geolocation.d.ts +0 -127
- package/dist/geolocation.esm.js +0 -89
- package/dist/geolocationStateMachine-asasuHY2.esm.js +0 -105
- package/dist/getBrowser-BSXUTWXw.esm.js +0 -41
- package/dist/getDeviceClass-BSntT9_j.esm.js +0 -14
- package/dist/government-validation.d.ts +0 -67
- package/dist/government-validation.esm.js +0 -81
- package/dist/governmentValidationStateMachine-BDDYrJTo.esm.js +0 -271
- package/dist/home.d.ts +0 -99
- package/dist/home.esm.js +0 -61
- package/dist/http.d.ts +0 -68
- package/dist/http.esm.js +0 -3
- package/dist/id-ocr.d.ts +0 -635
- package/dist/id-ocr.esm.js +0 -86
- package/dist/id-verification.d.ts +0 -190
- package/dist/id-verification.esm.js +0 -43
- package/dist/id.d.ts +0 -24
- package/dist/id.esm.js +0 -164
- package/dist/idCaptureManager-B9TGA5dq.d.ts +0 -956
- package/dist/idCaptureManager-DMK0GIt3.esm.js +0 -581
- package/dist/idCaptureStateMachine-Bq0fVZXl.esm.js +0 -2954
- package/dist/idOcrStateMachine-YbjjC_Gg.esm.js +0 -388
- package/dist/idVerificationStateMachine-xbw9HP1Z.esm.js +0 -71
- package/dist/identity-reuse.d.ts +0 -530
- package/dist/identity-reuse.esm.js +0 -274
- package/dist/index-BLKtMA0g.d.ts +0 -1177
- package/dist/index-BcRG8rtJ.d.ts +0 -97
- package/dist/index.d.ts +0 -3
- package/dist/index.esm.js +0 -12
- package/dist/invokeOnCaptureCallback-rc6kBHo5.esm.js +0 -30
- package/dist/lib-BB0B_qQX.esm.js +0 -12499
- package/dist/mandatory-consent.d.ts +0 -412
- package/dist/mandatory-consent.esm.js +0 -78
- package/dist/mandatoryConsentStateMachine-Cnco1jvn.esm.js +0 -126
- package/dist/openviduLazy-Cm0XFh_v.esm.js +0 -3
- package/dist/openviduLazy-Cok70ZSg.esm.js +0 -12
- package/dist/permissionServices-D_i6nzEw.esm.js +0 -50
- package/dist/phone.d.ts +0 -4
- package/dist/phone.esm.js +0 -9
- package/dist/phoneManager-B6M30hKE.d.ts +0 -397
- package/dist/phoneManager-DAJbGhlY.esm.js +0 -256
- package/dist/phoneStateMachine-CuPARRaT.esm.js +0 -351
- package/dist/platform-CfrjKhmi.esm.js +0 -83
- package/dist/qe-signature-DFo_Cc-I.esm.js +0 -12
- package/dist/qe-signature.d.ts +0 -25
- package/dist/qe-signature.esm.js +0 -8
- package/dist/recordingService-Ig2UgbLv.esm.js +0 -1003
- package/dist/redirect-to-mobile.d.ts +0 -107
- package/dist/redirect-to-mobile.esm.js +0 -102
- package/dist/redirectToMobileStateMachine-BOEqe46A.esm.js +0 -249
- package/dist/runChildModule-CqqwqAkW.esm.js +0 -219
- package/dist/selfie.d.ts +0 -26
- package/dist/selfie.esm.js +0 -146
- package/dist/selfieManager-D0lSgd-J.d.ts +0 -68
- package/dist/selfieManager-Duisl7qN.esm.js +0 -60
- package/dist/selfieStateMachine-D76whWEf.esm.js +0 -68
- package/dist/session-BS-d_vuE.esm.js +0 -3206
- package/dist/session.d.ts +0 -217
- package/dist/session.esm.js +0 -9
- package/dist/setup-Buy-hyj4.esm.js +0 -887
- package/dist/setup-C5AITV8m.d.ts +0 -254
- package/dist/signature.d.ts +0 -94
- package/dist/signature.esm.js +0 -66
- package/dist/signatureStateMachine-B5-QVUve.esm.js +0 -132
- package/dist/stats-CIfiPzb1.esm.js +0 -16
- package/dist/stats.d.ts +0 -16
- package/dist/stats.esm.js +0 -4
- package/dist/trust-graph.d.ts +0 -54
- package/dist/trust-graph.esm.js +0 -56
- package/dist/types-B06Ypu2F.d.ts +0 -49
- package/dist/types-BP1m8VRw.d.ts +0 -340
- package/dist/types-CAD4va6a.d.ts +0 -5
- package/dist/types-CFV9G_7j.d.ts +0 -24
- package/dist/warmup-CEcppFiS.d.ts +0 -63
- package/dist/wasm.d.ts +0 -15
- package/dist/wasm.esm.js +0 -12
- package/dist/watchlist-for-business.d.ts +0 -79
- package/dist/watchlist-for-business.esm.js +0 -148
- package/dist/watchlist.d.ts +0 -62
- package/dist/watchlist.esm.js +0 -86
- package/dist/watchlistServices-DMbUhkBX.esm.js +0 -12
- package/dist/workflow.d.ts +0 -907
- package/dist/workflow.esm.js +0 -702
- package/dist/xstate.esm-B70JrNqo.esm.js +0 -3404
|
@@ -1,581 +0,0 @@
|
|
|
1
|
-
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-D6-e4vok.esm.js";
|
|
2
|
-
import { c as createManager, s as createActor } from "./xstate.esm-B70JrNqo.esm.js";
|
|
3
|
-
import { t as BrowserStorageProvider } from "./BrowserStorageProvider-CuOW1Er2.esm.js";
|
|
4
|
-
import { h as mapDigitalIdScreenName, t as idCaptureMachine } from "./idCaptureStateMachine-Bq0fVZXl.esm.js";
|
|
5
|
-
|
|
6
|
-
//#region src/internal/idCapture/idCaptureManagerFactory.ts
|
|
7
|
-
function getPermissionStatus(snapshot) {
|
|
8
|
-
if (!snapshot.matches("permissions")) return;
|
|
9
|
-
if (snapshot.matches({ permissions: "idle" })) return "idle";
|
|
10
|
-
if (snapshot.matches({ permissions: "waitingForUser" })) return "idle";
|
|
11
|
-
if (snapshot.matches({ permissions: "learnMore" })) return "learnMore";
|
|
12
|
-
if (snapshot.matches({ permissions: "requesting" })) return "requesting";
|
|
13
|
-
if (snapshot.matches({ permissions: "denied" })) return "denied";
|
|
14
|
-
}
|
|
15
|
-
function getCaptureStatus(snapshot) {
|
|
16
|
-
const matches = {
|
|
17
|
-
initializing: snapshot.matches({ capture: "initializing" }),
|
|
18
|
-
detecting: snapshot.matches({ capture: "detecting" }),
|
|
19
|
-
manualCaptureWaiting: snapshot.matches({ capture: "manualCaptureWaiting" }),
|
|
20
|
-
capturing: snapshot.matches({ capture: "capturing" }),
|
|
21
|
-
capturingManual: snapshot.matches({ capture: "capturingManual" }),
|
|
22
|
-
uploading: snapshot.matches({ capture: "uploading" }),
|
|
23
|
-
uploadError: snapshot.matches({ capture: "uploadError" }),
|
|
24
|
-
success: snapshot.matches({ capture: "success" })
|
|
25
|
-
};
|
|
26
|
-
if (matches.initializing) return "initializing";
|
|
27
|
-
if (matches.detecting || matches.manualCaptureWaiting) return "detecting";
|
|
28
|
-
if (matches.capturing || matches.capturingManual) return "capturing";
|
|
29
|
-
if (matches.uploading) return "uploading";
|
|
30
|
-
if (matches.uploadError) return "uploadError";
|
|
31
|
-
if (matches.success) return "success";
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Returns an i18n key for the error title. The UI layer is responsible for
|
|
35
|
-
* calling `t()` on the returned key.
|
|
36
|
-
*
|
|
37
|
-
* Passport-aware keys are emitted for error codes that have user-facing copy
|
|
38
|
-
* specific to passports (e.g. CLASSIFICATION_FAILED → ".titlePassport").
|
|
39
|
-
* Other codes fall back to the shared key.
|
|
40
|
-
*/
|
|
41
|
-
function getErrorTitleKey(errorCode, currentMode) {
|
|
42
|
-
if (!errorCode) return void 0;
|
|
43
|
-
const isPassport = currentMode === "passport";
|
|
44
|
-
if (errorCode === "CLASSIFICATION_FAILED") return isPassport ? "idv2.capture.processing.errors.classification.titlePassport" : "idv2.capture.processing.errors.classification.title";
|
|
45
|
-
return {
|
|
46
|
-
UPLOAD_ERROR: "idv2.capture.processing.errors.upload.title",
|
|
47
|
-
CLASSIFICATION_FAILED: "idv2.capture.processing.errors.classification.title",
|
|
48
|
-
LOW_SHARPNESS: "idv2.capture.processing.errors.sharpness.title",
|
|
49
|
-
GLARE_DETECTED: "idv2.capture.processing.errors.glare.title",
|
|
50
|
-
WRONG_DOCUMENT_SIDE: "idv2.capture.processing.errors.wrongSide.title",
|
|
51
|
-
ID_TYPE_UNACCEPTABLE: "idv2.capture.processing.errors.unacceptable.title",
|
|
52
|
-
READABILITY_ISSUE: "idv2.capture.processing.errors.readability.title",
|
|
53
|
-
RETRY_EXHAUSTED_CONTINUE_TO_BACK: "idv2.capture.processing.errors.default.title",
|
|
54
|
-
RETRY_EXHAUSTED_SKIP_BACK: "idv2.capture.processing.errors.default.title",
|
|
55
|
-
NO_MORE_TRIES: "idv2.capture.processing.errors.default.title",
|
|
56
|
-
UNEXPECTED_ERROR: "idv2.capture.processing.errors.default.title",
|
|
57
|
-
NO_TOKEN: "idv2.capture.processing.errors.default.title",
|
|
58
|
-
PERMISSION_DENIED: "idv2.capture.processing.errors.default.title",
|
|
59
|
-
USER_CANCELLED: "idv2.capture.processing.errors.default.title",
|
|
60
|
-
SERVER_ERROR: "idv2.capture.processing.errors.default.title"
|
|
61
|
-
}[errorCode];
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Returns an i18n key for the error subtitle. The UI layer is responsible for
|
|
65
|
-
* calling `t()` on the returned key.
|
|
66
|
-
*
|
|
67
|
-
* Passport-aware keys are emitted for error codes that have user-facing copy
|
|
68
|
-
* specific to passports (e.g. CLASSIFICATION_FAILED → ".subtitlePassport").
|
|
69
|
-
* Other codes fall back to the shared key.
|
|
70
|
-
*/
|
|
71
|
-
function getErrorSubtitleKey(errorCode, uploadResponse, currentMode) {
|
|
72
|
-
if (!errorCode) return void 0;
|
|
73
|
-
const isPassport = currentMode === "passport";
|
|
74
|
-
if (errorCode === "WRONG_DOCUMENT_SIDE") return uploadResponse?.side === "back" ? "idv2.capture.processing.errors.wrongSide.back.subtitle" : "idv2.capture.processing.errors.wrongSide.front.subtitle";
|
|
75
|
-
if (errorCode === "CLASSIFICATION_FAILED") return isPassport ? "idv2.capture.processing.errors.classification.subtitlePassport" : "idv2.capture.processing.errors.classification.subtitle";
|
|
76
|
-
return {
|
|
77
|
-
UPLOAD_ERROR: "idv2.capture.processing.errors.upload.subtitle",
|
|
78
|
-
CLASSIFICATION_FAILED: "idv2.capture.processing.errors.classification.subtitle",
|
|
79
|
-
LOW_SHARPNESS: "idv2.capture.processing.errors.sharpness.subtitle",
|
|
80
|
-
GLARE_DETECTED: "idv2.capture.processing.errors.glare.subtitle",
|
|
81
|
-
WRONG_DOCUMENT_SIDE: "idv2.capture.processing.errors.wrongSide.front.subtitle",
|
|
82
|
-
ID_TYPE_UNACCEPTABLE: "idv2.capture.processing.errors.unacceptable.subtitle",
|
|
83
|
-
READABILITY_ISSUE: "idv2.capture.processing.errors.readability.subtitle",
|
|
84
|
-
RETRY_EXHAUSTED_CONTINUE_TO_BACK: "idv2.capture.processing.errors.default.subtitle",
|
|
85
|
-
RETRY_EXHAUSTED_SKIP_BACK: "idv2.capture.processing.errors.default.subtitle",
|
|
86
|
-
NO_MORE_TRIES: "idv2.capture.processing.errors.default.subtitle",
|
|
87
|
-
UNEXPECTED_ERROR: "idv2.capture.processing.errors.default.subtitle",
|
|
88
|
-
NO_TOKEN: "idv2.capture.processing.errors.default.subtitle",
|
|
89
|
-
PERMISSION_DENIED: "idv2.capture.processing.errors.default.subtitle",
|
|
90
|
-
USER_CANCELLED: "idv2.capture.processing.errors.default.subtitle",
|
|
91
|
-
SERVER_ERROR: "idv2.capture.processing.errors.default.subtitle"
|
|
92
|
-
}[errorCode];
|
|
93
|
-
}
|
|
94
|
-
function shouldCaptureBack(context) {
|
|
95
|
-
if (context.isDigitalUpload) return false;
|
|
96
|
-
if (!(context.currentMode === "front" || context.currentMode === "passport")) return false;
|
|
97
|
-
if (context.config.onlyBack) return false;
|
|
98
|
-
if (context.config.usSmartCapture && context.currentMode === "front") return false;
|
|
99
|
-
const serverSkipped = context.uploadResponse?.skipBackIdCapture === true;
|
|
100
|
-
const forceBackForNonPassport = context.config.alwaysCaptureBackOfId === true && context.currentMode !== "passport";
|
|
101
|
-
return !serverSkipped || forceBackForNonPassport;
|
|
102
|
-
}
|
|
103
|
-
function shouldCaptureFront(context) {
|
|
104
|
-
return context.config.usSmartCapture === true && context.currentMode === "back" && context.uploadResponse?.forceFrontIdCapture === true;
|
|
105
|
-
}
|
|
106
|
-
function mapCaptureState(snapshot, context) {
|
|
107
|
-
const captureStatus = getCaptureStatus(snapshot) ?? "initializing";
|
|
108
|
-
const { uploadError, uploadResponse } = context;
|
|
109
|
-
return {
|
|
110
|
-
status: "capture",
|
|
111
|
-
captureStatus,
|
|
112
|
-
stream: context.stream,
|
|
113
|
-
detectionStatus: context.detectionStatus,
|
|
114
|
-
debugFrame: void 0,
|
|
115
|
-
attemptsRemaining: context.attemptsRemaining,
|
|
116
|
-
uploadError,
|
|
117
|
-
currentMode: context.currentMode,
|
|
118
|
-
counterValue: context.counterValue,
|
|
119
|
-
orientation: context.orientation,
|
|
120
|
-
idType: context.idType,
|
|
121
|
-
previewImageUrl: context.previewImageUrl,
|
|
122
|
-
uploadProgress: context.uploadProgress ?? 0,
|
|
123
|
-
ageAssurance: context.config.ageAssurance === true,
|
|
124
|
-
uploadErrorMessage: uploadError ? getErrorTitleKey(uploadError, context.currentMode) : void 0,
|
|
125
|
-
uploadErrorDescription: uploadError ? getErrorSubtitleKey(uploadError, uploadResponse, context.currentMode) : void 0,
|
|
126
|
-
needsBackCapture: shouldCaptureBack(context),
|
|
127
|
-
needsFrontCapture: shouldCaptureFront(context),
|
|
128
|
-
showCaptureButtonInAuto: context.config.showCaptureButtonInAuto ?? false,
|
|
129
|
-
canRetry: context.attemptsRemaining > 0
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
function isLoadingPhase(snapshot) {
|
|
133
|
-
return snapshot.matches({ capture: "checkingStream" }) || snapshot.matches({ capture: "initializingDeepsight" }) || snapshot.matches({ capture: "initializing" }) || snapshot.matches({ permissions: "idle" });
|
|
134
|
-
}
|
|
135
|
-
function mapManualUploadState(snapshot) {
|
|
136
|
-
const { config } = snapshot.context;
|
|
137
|
-
const childSnapshot = snapshot.children["manualIdUpload"]?.getSnapshot();
|
|
138
|
-
const childCtx = childSnapshot?.context;
|
|
139
|
-
const childValue = childSnapshot?.value;
|
|
140
|
-
const phase = childValue === "retriesExhausted" ? "exhausted" : childValue === "uploadingFront" || childValue === "uploadingBack" || childValue === "uploadingPassport" ? "uploading" : "selecting";
|
|
141
|
-
const uploadingSide = childValue === "uploadingFront" ? "front" : childValue === "uploadingBack" ? "back" : childValue === "uploadingPassport" ? "passport" : void 0;
|
|
142
|
-
/**
|
|
143
|
-
* Server told us the document doesn't need a back side (e.g. passport-class
|
|
144
|
-
* docs, single-sided IDs). Treat the back slot as uploaded so the UI shows
|
|
145
|
-
* a green check rather than hiding the slot — matches v1's behavior and
|
|
146
|
-
* keeps both slots visible once the front has been processed.
|
|
147
|
-
*/
|
|
148
|
-
const backUploaded = (childCtx?.backUploaded ?? false) || (childCtx?.skipBackFromServer ?? false);
|
|
149
|
-
const idTabCanContinue = (childCtx?.frontUploaded ?? false) && backUploaded;
|
|
150
|
-
const canContinue = childCtx?.activeTab === "id" ? idTabCanContinue : childCtx?.passportUploaded ?? false;
|
|
151
|
-
return {
|
|
152
|
-
status: "manualUpload",
|
|
153
|
-
phase,
|
|
154
|
-
uploadingSide,
|
|
155
|
-
activeTab: childCtx?.activeTab ?? "id",
|
|
156
|
-
showIdTab: config.enableId ?? true,
|
|
157
|
-
showPassportTab: config.enablePassport ?? false,
|
|
158
|
-
showBackSlot: true,
|
|
159
|
-
frontFileName: childCtx?.frontFile?.name,
|
|
160
|
-
backFileName: childCtx?.backFile?.name,
|
|
161
|
-
passportFileName: childCtx?.passportFile?.name,
|
|
162
|
-
frontUploaded: childCtx?.frontUploaded ?? false,
|
|
163
|
-
backUploaded,
|
|
164
|
-
passportUploaded: childCtx?.passportUploaded ?? false,
|
|
165
|
-
canContinue,
|
|
166
|
-
retriesLeft: childCtx?.retriesLeft ?? snapshot.context.config.captureAttempts,
|
|
167
|
-
errorKey: childCtx?.errorMessage ?? null
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
function mapDigitalUploadState(snapshot) {
|
|
171
|
-
const childSnapshot = snapshot.children["digitalIdUpload"]?.getSnapshot();
|
|
172
|
-
const childCtx = childSnapshot?.context;
|
|
173
|
-
const childValue = childSnapshot?.value;
|
|
174
|
-
return {
|
|
175
|
-
status: "digitalIdUpload",
|
|
176
|
-
phase: (() => {
|
|
177
|
-
if (childValue === "tutorial") return "tutorial";
|
|
178
|
-
if (childValue === "selecting") return "selecting";
|
|
179
|
-
if (childValue === "reviewing") return "reviewing";
|
|
180
|
-
if (childValue === "success") return "success";
|
|
181
|
-
if (childValue === "error") return "error";
|
|
182
|
-
if (childValue === "fileTooLarge") return "fileTooLarge";
|
|
183
|
-
if (childValue === "retriesExhausted") return "exhausted";
|
|
184
|
-
if (childSnapshot?.matches({ uploading: "holding" })) return "holding";
|
|
185
|
-
if (childSnapshot?.matches({ uploading: "analyzing" })) return "uploading";
|
|
186
|
-
return "selecting";
|
|
187
|
-
})(),
|
|
188
|
-
file: childCtx?.file ?? null,
|
|
189
|
-
fileName: childCtx?.file?.name,
|
|
190
|
-
failReason: childCtx?.failReason ?? null,
|
|
191
|
-
attemptsRemaining: childCtx?.attemptsRemaining ?? snapshot.context.config.captureAttempts,
|
|
192
|
-
uploadProgress: childCtx?.uploadProgress ?? 0,
|
|
193
|
-
pickerRequestId: childCtx?.pickerRequestId ?? 0
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
function mapState(snapshot) {
|
|
197
|
-
const { context } = snapshot;
|
|
198
|
-
if (snapshot.matches("idle")) return { status: "idle" };
|
|
199
|
-
if (isLoadingPhase(snapshot)) return { status: "loading" };
|
|
200
|
-
if (snapshot.matches("chooser")) return {
|
|
201
|
-
status: "chooser",
|
|
202
|
-
availableDocumentTypes: context.availableDocumentTypes
|
|
203
|
-
};
|
|
204
|
-
if (snapshot.matches("loading")) return { status: "loading" };
|
|
205
|
-
if (snapshot.matches("tutorial")) return {
|
|
206
|
-
status: "tutorial",
|
|
207
|
-
selectedDocumentType: context.selectedDocumentType,
|
|
208
|
-
currentMode: context.currentMode
|
|
209
|
-
};
|
|
210
|
-
if (snapshot.matches("ageVerification")) return { status: "ageVerification" };
|
|
211
|
-
if (snapshot.matches("closed")) return { status: "closed" };
|
|
212
|
-
if (snapshot.matches("permissions")) {
|
|
213
|
-
const permissionStatus = getPermissionStatus(snapshot);
|
|
214
|
-
if (permissionStatus === void 0) return {
|
|
215
|
-
status: "permissions",
|
|
216
|
-
permissionStatus: "idle"
|
|
217
|
-
};
|
|
218
|
-
return {
|
|
219
|
-
status: "permissions",
|
|
220
|
-
permissionStatus
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
if (snapshot.matches("capture")) return mapCaptureState(snapshot, context);
|
|
224
|
-
if (snapshot.matches("mandatoryConsent")) return {
|
|
225
|
-
status: "mandatoryConsent",
|
|
226
|
-
regulationType: context.uploadResponse?.regulationType ?? "Other"
|
|
227
|
-
};
|
|
228
|
-
if (snapshot.matches("frontFinished")) return { status: "frontFinished" };
|
|
229
|
-
if (snapshot.matches("backFinished")) return { status: "backFinished" };
|
|
230
|
-
if (snapshot.matches("processing")) return { status: "processing" };
|
|
231
|
-
if (snapshot.matches("expiredExhausted")) return { status: "expiredExhausted" };
|
|
232
|
-
if (snapshot.matches("expired")) {
|
|
233
|
-
const counter = context.expiredFromUpload ? context.expiredAttempts : context.processingExpiredAttempts;
|
|
234
|
-
return {
|
|
235
|
-
status: "expired",
|
|
236
|
-
attemptsRemaining: Math.max(0, context.config.captureAttempts - counter)
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
if (snapshot.matches("finished")) return { status: "finished" };
|
|
240
|
-
if (snapshot.matches("error")) return {
|
|
241
|
-
status: "error",
|
|
242
|
-
error: context.error ?? "Unknown error"
|
|
243
|
-
};
|
|
244
|
-
if (snapshot.matches("manualIdUpload")) return mapManualUploadState(snapshot);
|
|
245
|
-
if (snapshot.matches("digitalIdUpload")) return mapDigitalUploadState(snapshot);
|
|
246
|
-
return { status: "idle" };
|
|
247
|
-
}
|
|
248
|
-
function createApi({ actor, trackElementClicked, trackCaptureAttemptFinished }) {
|
|
249
|
-
const snapshot = actor.getSnapshot();
|
|
250
|
-
if (snapshot.context.dependencies) snapshot.context.dependencies.trackCaptureAttemptFinished = trackCaptureAttemptFinished;
|
|
251
|
-
return {
|
|
252
|
-
load() {
|
|
253
|
-
actor.send({ type: "LOAD" });
|
|
254
|
-
},
|
|
255
|
-
selectDocument(documentType) {
|
|
256
|
-
trackElementClicked?.(`selectDocument.${documentType}`);
|
|
257
|
-
actor.send({
|
|
258
|
-
type: "SELECT_DOCUMENT",
|
|
259
|
-
documentType
|
|
260
|
-
});
|
|
261
|
-
},
|
|
262
|
-
nextStep() {
|
|
263
|
-
trackElementClicked?.("nextStep");
|
|
264
|
-
actor.send({ type: "NEXT_STEP" });
|
|
265
|
-
},
|
|
266
|
-
requestPermission() {
|
|
267
|
-
trackElementClicked?.("requestPermission");
|
|
268
|
-
actor.send({ type: "REQUEST_PERMISSION" });
|
|
269
|
-
},
|
|
270
|
-
goToLearnMore() {
|
|
271
|
-
trackElementClicked?.("goToLearnMore");
|
|
272
|
-
actor.send({ type: "GO_TO_LEARN_MORE" });
|
|
273
|
-
},
|
|
274
|
-
back() {
|
|
275
|
-
trackElementClicked?.("back");
|
|
276
|
-
actor.send({ type: "BACK" });
|
|
277
|
-
},
|
|
278
|
-
close() {
|
|
279
|
-
trackElementClicked?.("close");
|
|
280
|
-
actor.send({ type: "QUIT" });
|
|
281
|
-
},
|
|
282
|
-
reset() {
|
|
283
|
-
actor.send({ type: "RESET" });
|
|
284
|
-
},
|
|
285
|
-
retryCapture() {
|
|
286
|
-
trackElementClicked?.("retryCapture");
|
|
287
|
-
actor.send({ type: "RETRY_CAPTURE" });
|
|
288
|
-
},
|
|
289
|
-
continueExhausted() {
|
|
290
|
-
trackElementClicked?.("continueExhausted");
|
|
291
|
-
actor.send({ type: "CONTINUE_EXHAUSTED" });
|
|
292
|
-
},
|
|
293
|
-
continueFromError() {
|
|
294
|
-
trackElementClicked?.("continueFromError");
|
|
295
|
-
actor.send({ type: "CONTINUE_FROM_ERROR" });
|
|
296
|
-
},
|
|
297
|
-
capture() {
|
|
298
|
-
trackElementClicked?.("capture");
|
|
299
|
-
actor.send({ type: "MANUAL_CAPTURE" });
|
|
300
|
-
},
|
|
301
|
-
switchToManualCapture() {
|
|
302
|
-
trackElementClicked?.("switchToManualCapture");
|
|
303
|
-
actor.send({ type: "SWITCH_TO_MANUAL_CAPTURE" });
|
|
304
|
-
},
|
|
305
|
-
continueToBack() {
|
|
306
|
-
trackElementClicked?.("continueToBack");
|
|
307
|
-
actor.send({ type: "CONTINUE_TO_BACK" });
|
|
308
|
-
},
|
|
309
|
-
continueToFront() {
|
|
310
|
-
trackElementClicked?.("continueToFront");
|
|
311
|
-
actor.send({ type: "CONTINUE_TO_FRONT" });
|
|
312
|
-
},
|
|
313
|
-
skipBack() {
|
|
314
|
-
trackElementClicked?.("skipBack");
|
|
315
|
-
actor.send({ type: "SKIP_BACK" });
|
|
316
|
-
},
|
|
317
|
-
acceptMandatoryConsent() {
|
|
318
|
-
trackElementClicked?.("acceptMandatoryConsent");
|
|
319
|
-
actor.send({ type: "CONSENT_ACCEPT" });
|
|
320
|
-
},
|
|
321
|
-
cancelMandatoryConsent() {
|
|
322
|
-
trackElementClicked?.("cancelMandatoryConsent");
|
|
323
|
-
actor.send({ type: "CONSENT_CANCEL" });
|
|
324
|
-
},
|
|
325
|
-
updateDetectionArea(detectionArea) {
|
|
326
|
-
actor.send({
|
|
327
|
-
type: "UPDATE_DETECTION_AREA",
|
|
328
|
-
detectionArea
|
|
329
|
-
});
|
|
330
|
-
},
|
|
331
|
-
manualUploadChangeTab(tab) {
|
|
332
|
-
trackElementClicked?.(`manualUpload.tab.${tab}`);
|
|
333
|
-
actor.send({
|
|
334
|
-
type: "MANUAL_UPLOAD_TAB_CHANGED",
|
|
335
|
-
tab
|
|
336
|
-
});
|
|
337
|
-
},
|
|
338
|
-
manualUploadSelectFile(side, file) {
|
|
339
|
-
trackElementClicked?.(`manualUpload.select.${side}`);
|
|
340
|
-
actor.send({
|
|
341
|
-
type: "MANUAL_UPLOAD_FILE_SELECTED",
|
|
342
|
-
side,
|
|
343
|
-
file
|
|
344
|
-
});
|
|
345
|
-
},
|
|
346
|
-
manualUploadContinue() {
|
|
347
|
-
trackElementClicked?.("manualUpload.continue");
|
|
348
|
-
actor.send({ type: "MANUAL_UPLOAD_CONTINUE" });
|
|
349
|
-
},
|
|
350
|
-
manualUploadReset() {
|
|
351
|
-
trackElementClicked?.("manualUpload.reset");
|
|
352
|
-
actor.send({ type: "MANUAL_UPLOAD_RESET" });
|
|
353
|
-
},
|
|
354
|
-
digitalUploadNextStep() {
|
|
355
|
-
trackElementClicked?.("digitalUpload.nextStep");
|
|
356
|
-
actor.send({ type: "DIGITAL_UPLOAD_NEXT_STEP" });
|
|
357
|
-
},
|
|
358
|
-
digitalUploadPickFile(file) {
|
|
359
|
-
trackElementClicked?.("digitalUpload.pickFile");
|
|
360
|
-
actor.send({
|
|
361
|
-
type: "DIGITAL_UPLOAD_FILE_PICKED",
|
|
362
|
-
file
|
|
363
|
-
});
|
|
364
|
-
},
|
|
365
|
-
digitalUploadConfirm() {
|
|
366
|
-
trackElementClicked?.("digitalUpload.confirmFile");
|
|
367
|
-
actor.send({ type: "DIGITAL_UPLOAD_CONFIRM" });
|
|
368
|
-
},
|
|
369
|
-
digitalUploadReplace() {
|
|
370
|
-
trackElementClicked?.("digitalUpload.replaceFile");
|
|
371
|
-
actor.send({ type: "DIGITAL_UPLOAD_REPLACE" });
|
|
372
|
-
},
|
|
373
|
-
digitalUploadRetry() {
|
|
374
|
-
trackElementClicked?.("digitalUpload.retry");
|
|
375
|
-
actor.send({ type: "DIGITAL_UPLOAD_RETRY" });
|
|
376
|
-
},
|
|
377
|
-
digitalUploadScanInstead() {
|
|
378
|
-
trackElementClicked?.("digitalUpload.scanInstead");
|
|
379
|
-
actor.send({ type: "DIGITAL_UPLOAD_SCAN_INSTEAD" });
|
|
380
|
-
},
|
|
381
|
-
digitalUploadChooseAnother() {
|
|
382
|
-
trackElementClicked?.("digitalUpload.chooseAnother");
|
|
383
|
-
actor.send({ type: "DIGITAL_UPLOAD_CHOOSE_ANOTHER" });
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
const FRONT_SCREENS = {
|
|
388
|
-
tutorial: "idCapture.tutorial.front",
|
|
389
|
-
capturePrefix: "idCapture.frontCapture",
|
|
390
|
-
analyzingPrefix: "idCapture.frontAnalyzing",
|
|
391
|
-
errorPrefix: "idCapture.frontCaptureError",
|
|
392
|
-
successPrefix: "idCapture.frontCaptureSuccess",
|
|
393
|
-
liveCueSide: "showfront"
|
|
394
|
-
};
|
|
395
|
-
const BACK_SCREENS = {
|
|
396
|
-
tutorial: "idCapture.tutorial.back",
|
|
397
|
-
capturePrefix: "idCapture.backCapture",
|
|
398
|
-
analyzingPrefix: "idCapture.backAnalyzing",
|
|
399
|
-
errorPrefix: "idCapture.backCaptureError",
|
|
400
|
-
successPrefix: "idCapture.backCaptureSuccess",
|
|
401
|
-
liveCueSide: "showback"
|
|
402
|
-
};
|
|
403
|
-
const PASSPORT_SCREENS = { tutorial: "idCapture.tutorial.passport" };
|
|
404
|
-
function getSideScreens(mode) {
|
|
405
|
-
if (mode === "back") return BACK_SCREENS;
|
|
406
|
-
if (mode === "passport") return {
|
|
407
|
-
...FRONT_SCREENS,
|
|
408
|
-
...PASSPORT_SCREENS
|
|
409
|
-
};
|
|
410
|
-
return FRONT_SCREENS;
|
|
411
|
-
}
|
|
412
|
-
function getCaptureLiveCueScreen(screens, detectionStatus) {
|
|
413
|
-
switch (detectionStatus) {
|
|
414
|
-
case "wrongSide": return `${screens.capturePrefix}.livecue-${screens.liveCueSide}`;
|
|
415
|
-
case "blur": return `${screens.capturePrefix}.livecue-blur`;
|
|
416
|
-
case "farAway":
|
|
417
|
-
case "idNotDetected": return `${screens.capturePrefix}.livecue-align`;
|
|
418
|
-
case "glare": return `${screens.capturePrefix}.livecue-glare`;
|
|
419
|
-
case "offline": return `${screens.capturePrefix}.livecue-dark`;
|
|
420
|
-
case "manualCapture": return `${screens.capturePrefix}.manual`;
|
|
421
|
-
case "capturing": return `${screens.capturePrefix}.takingphoto`;
|
|
422
|
-
case "detecting":
|
|
423
|
-
case "idle":
|
|
424
|
-
default: return `${screens.capturePrefix}.default`;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
function getCaptureErrorScreen(screens, errorCode) {
|
|
428
|
-
switch (errorCode) {
|
|
429
|
-
case "WRONG_DOCUMENT_SIDE": return `${screens.errorPrefix}.wrongside`;
|
|
430
|
-
case "GLARE_DETECTED": return `${screens.errorPrefix}.glare`;
|
|
431
|
-
case "LOW_SHARPNESS": return `${screens.errorPrefix}.blur`;
|
|
432
|
-
case "READABILITY_ISSUE": return `${screens.errorPrefix}.notreadable`;
|
|
433
|
-
case "ID_TYPE_UNACCEPTABLE":
|
|
434
|
-
case "CLASSIFICATION_FAILED": return `${screens.errorPrefix}.notaccepted`;
|
|
435
|
-
case "RETRY_EXHAUSTED_CONTINUE_TO_BACK":
|
|
436
|
-
case "RETRY_EXHAUSTED_SKIP_BACK":
|
|
437
|
-
case "NO_MORE_TRIES": return `${screens.errorPrefix}.failedExhausted`;
|
|
438
|
-
case "NO_TOKEN":
|
|
439
|
-
case "SERVER_ERROR": return `${screens.errorPrefix}.nointernet`;
|
|
440
|
-
case "UPLOAD_ERROR":
|
|
441
|
-
case "UNEXPECTED_ERROR":
|
|
442
|
-
case "PERMISSION_DENIED":
|
|
443
|
-
case "USER_CANCELLED":
|
|
444
|
-
default: return `${screens.errorPrefix}.failed`;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
function getSuccessScreen(snapshot, screens) {
|
|
448
|
-
const { config } = snapshot.context;
|
|
449
|
-
if (config?.onlyBack === true || config?.showCaptureButtonInAuto === true) return `${screens.successPrefix}.captureonly`;
|
|
450
|
-
return `${screens.successPrefix}.default`;
|
|
451
|
-
}
|
|
452
|
-
function getCaptureSubstateScreen(snapshot, screens) {
|
|
453
|
-
const { value, context } = snapshot;
|
|
454
|
-
if (typeof value !== "object" || value === null) return void 0;
|
|
455
|
-
const captureValue = value.capture;
|
|
456
|
-
if (captureValue === void 0) return void 0;
|
|
457
|
-
if (typeof captureValue === "string") switch (captureValue) {
|
|
458
|
-
case "checkingStream":
|
|
459
|
-
case "initializing":
|
|
460
|
-
case "initializingDeepsight": return "idCapture.loader.preparingcamera";
|
|
461
|
-
case "detecting": return getCaptureLiveCueScreen(screens, context.detectionStatus);
|
|
462
|
-
case "manualCaptureWaiting": return `${screens.capturePrefix}.manual`;
|
|
463
|
-
case "capturing": return `${screens.capturePrefix}.takingphoto`;
|
|
464
|
-
case "capturingManual": return `${screens.capturePrefix}.manual`;
|
|
465
|
-
case "uploading":
|
|
466
|
-
case "validatingUpload": return `${screens.analyzingPrefix}.uploading`;
|
|
467
|
-
case "uploadError": return getCaptureErrorScreen(screens, context.uploadError);
|
|
468
|
-
case "success": return getSuccessScreen(snapshot, screens);
|
|
469
|
-
}
|
|
470
|
-
if (typeof captureValue === "object" && captureValue !== null) {
|
|
471
|
-
const substates = Object.keys(captureValue);
|
|
472
|
-
if (substates.includes("checkingStream") || substates.includes("initializing") || substates.includes("initializingDeepsight")) return "idCapture.loader.preparingcamera";
|
|
473
|
-
if (substates.includes("detecting")) return getCaptureLiveCueScreen(screens, context.detectionStatus);
|
|
474
|
-
if (substates.includes("manualCaptureWaiting")) return `${screens.capturePrefix}.manual`;
|
|
475
|
-
if (substates.includes("capturing")) return `${screens.capturePrefix}.takingphoto`;
|
|
476
|
-
if (substates.includes("capturingManual")) return `${screens.capturePrefix}.manual`;
|
|
477
|
-
if (substates.includes("uploading") || substates.includes("validatingUpload")) return `${screens.analyzingPrefix}.uploading`;
|
|
478
|
-
if (substates.includes("uploadError")) return getCaptureErrorScreen(screens, context.uploadError);
|
|
479
|
-
if (substates.includes("success")) return getSuccessScreen(snapshot, screens);
|
|
480
|
-
}
|
|
481
|
-
return `${screens.capturePrefix}.default`;
|
|
482
|
-
}
|
|
483
|
-
function getPermissionScreen(value) {
|
|
484
|
-
if (typeof value !== "object" || value === null) return "idCapture.permissions.default";
|
|
485
|
-
switch (value.permissions) {
|
|
486
|
-
case "requesting": return "idCapture.permissions.required";
|
|
487
|
-
case "denied": return "idCapture.permissions.quit";
|
|
488
|
-
case "learnMore": return "idCapture.commonissues.default";
|
|
489
|
-
case "idle":
|
|
490
|
-
case "waitingForUser":
|
|
491
|
-
default: return "idCapture.permissions.default";
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
function getIdCaptureScreenName(snapshot) {
|
|
495
|
-
const { value, context } = snapshot;
|
|
496
|
-
if (value === void 0 || value === null) return void 0;
|
|
497
|
-
const topLevel = typeof value === "string" ? value : typeof value === "object" ? Object.keys(value)[0] : void 0;
|
|
498
|
-
if (topLevel === void 0) return void 0;
|
|
499
|
-
const side = context.currentMode;
|
|
500
|
-
const screens = getSideScreens(side);
|
|
501
|
-
switch (topLevel) {
|
|
502
|
-
case "idle": return "idCapture.loader.default";
|
|
503
|
-
case "chooser": return "idCapture.documentchooser";
|
|
504
|
-
case "loading": return "idCapture.loader.default";
|
|
505
|
-
case "tutorial": return screens.tutorial;
|
|
506
|
-
case "ageVerification": return "idCapture.tutorial.ageverification";
|
|
507
|
-
case "permissions": return getPermissionScreen(value);
|
|
508
|
-
case "capture": return getCaptureSubstateScreen(snapshot, screens);
|
|
509
|
-
case "mandatoryConsent": return "idCapture.mandatoryConsent";
|
|
510
|
-
case "frontFinished": return "idCapture.flipid.showback";
|
|
511
|
-
case "backFinished": return "idCapture.flipid.showfront";
|
|
512
|
-
case "processing": return `${screens.analyzingPrefix}.processing`;
|
|
513
|
-
case "expired": return "idCapture.expired";
|
|
514
|
-
case "expiredExhausted": return "idCapture.expiredExhausted";
|
|
515
|
-
case "finished": return "idCapture.finished";
|
|
516
|
-
case "closed": return "idCapture.closed";
|
|
517
|
-
case "error": return "idCapture.error";
|
|
518
|
-
case "digitalIdUpload": {
|
|
519
|
-
const child = snapshot.children["digitalIdUpload"]?.getSnapshot();
|
|
520
|
-
const childContext = child?.context;
|
|
521
|
-
return mapDigitalIdScreenName(child?.value, childContext?.failReason ?? null);
|
|
522
|
-
}
|
|
523
|
-
default: return `idCapture.${topLevel}`;
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
function mapIdCaptureScreenName(snapshot) {
|
|
527
|
-
return getIdCaptureScreenName(snapshot);
|
|
528
|
-
}
|
|
529
|
-
function getIdCaptureErrorPayload(snapshot) {
|
|
530
|
-
const errorCode = snapshot.context.uploadError;
|
|
531
|
-
if (errorCode === void 0) return;
|
|
532
|
-
return { errorCode };
|
|
533
|
-
}
|
|
534
|
-
/**
|
|
535
|
-
* Builds the public ID capture manager from an already-created actor.
|
|
536
|
-
* Used by both `createIdCaptureManager` and `createIdCaptureOnlyManager`.
|
|
537
|
-
*
|
|
538
|
-
* The internal cast to `IdCaptureActor` narrows the union for `createManager`,
|
|
539
|
-
* which is typed against the regular machine. Variants produced via
|
|
540
|
-
* `idCaptureMachine.provide({...})` share the same context and event types,
|
|
541
|
-
* so the cast is sound at runtime — only the actor implementation differs.
|
|
542
|
-
*/
|
|
543
|
-
function createIdCaptureManagerFromActor(actor) {
|
|
544
|
-
return createManager({
|
|
545
|
-
actor,
|
|
546
|
-
mapState,
|
|
547
|
-
createApi,
|
|
548
|
-
instrumentation: createManagerInstrumentation(eventModuleNames.idCapture, {
|
|
549
|
-
getEventScreenName: mapIdCaptureScreenName,
|
|
550
|
-
getErrorPayload: getIdCaptureErrorPayload
|
|
551
|
-
})
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
//#endregion
|
|
556
|
-
//#region src/modules/id/idCaptureActor.ts
|
|
557
|
-
function createIdCaptureActor(options) {
|
|
558
|
-
const dependencies = options.dependencies ?? { storage: new BrowserStorageProvider() };
|
|
559
|
-
return createActor(idCaptureMachine, { input: {
|
|
560
|
-
config: options.config,
|
|
561
|
-
dependencies
|
|
562
|
-
} }).start();
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
//#endregion
|
|
566
|
-
//#region src/modules/id/idCaptureManager.ts
|
|
567
|
-
/**
|
|
568
|
-
* Creates a manager for the regular ID capture flow. The shared
|
|
569
|
-
* `mapState`/`createApi`/state-types live in
|
|
570
|
-
* `internal/idCapture/idCaptureManagerFactory.ts`; this file is a thin
|
|
571
|
-
* wrapper that creates the actor and delegates to the factory.
|
|
572
|
-
*
|
|
573
|
-
* For the captureOnly flow (rich payload delivered locally via `onCapture`),
|
|
574
|
-
* use `createIdCaptureOnlyManager`.
|
|
575
|
-
*/
|
|
576
|
-
function createIdCaptureManager(options) {
|
|
577
|
-
return createIdCaptureManagerFromActor(createIdCaptureActor(options));
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
//#endregion
|
|
581
|
-
export { createIdCaptureActor as n, createIdCaptureManagerFromActor as r, createIdCaptureManager as t };
|