@incodetech/core 2.1.1 → 2.2.0-rc.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/dist/{3dAvatarProvider-BwOmTMOy.esm.js → 3dAvatarProvider-g02DTFqT.esm.js} +811 -880
- package/dist/Actor-iTq7YY48.d.ts +1 -0
- package/dist/BrowserDiagnosticsCryptoProvider-CriIh1Gt.esm.js +95 -0
- package/dist/BrowserLazyImportProvider-BhoA957O.esm.js +114 -0
- package/dist/{BrowserStorageProvider-CBHBhKQN.esm.js → BrowserStorageProvider-k-FDkC4W.esm.js} +2 -4
- package/dist/{BrowserTimerProvider-CHloo0eQ.esm.js → BrowserTimerProvider-BXhgNxLt.esm.js} +1 -2
- package/dist/{BrowserVisibilityObserverProvider-GBS6XSii.esm.js → BrowserVisibilityObserverProvider-BX1BiLDK.esm.js} +1 -2
- package/dist/Face2DProvider-UUQt_vRC.esm.js +437 -0
- package/dist/{createFaceAvatar-CpdYp9Iy.d.ts → FaceDetectionProvider-Mh6q3EbA.d.ts} +107 -159
- package/dist/IBrowserEnvironmentCapability-DEaRRk-R.esm.js +9 -0
- package/dist/IFaceAvatarCapability-BrL19G0s.d.ts +23 -0
- package/dist/IFeatureManagementCapability-DdEUp6tB.d.ts +1125 -0
- package/dist/IIdCaptureCapability-DHTT3FC2.d.ts +237 -0
- package/dist/IStorageCapability-ORkQfK3F.d.ts +242 -0
- package/dist/{ITimerCapability-DJ73P4RK.esm.js → ITimerCapability-DgdDzp8G.esm.js} +1 -2
- package/dist/{Manager-goNPc_h_.d.ts → Manager-CQQ99QOI.d.ts} +1 -0
- package/dist/{MotionSensorProvider-BHuHoYvJ.esm.js → MotionSensorProvider-DGiV77J_.esm.js} +2 -37
- package/dist/{OpenViduRecordingProvider-CK6A5kiU.esm.js → OpenViduRecordingProvider-Du98qevC.esm.js} +2 -4
- package/dist/PrivacyLensProvider-D8PS7AJa.esm.js +405 -0
- package/dist/StateMachine-EDpYWy0i.d.ts +6 -0
- package/dist/{StreamCanvasCapture-CAqUdVkM.esm.js → StreamCanvasCapture-D2XcXCZ4.esm.js} +2 -4
- package/dist/{addressSearch-D7msRieq.esm.js → addressSearch-DQyrvDQj.esm.js} +10 -21
- package/dist/ae-signature.d.ts +4 -6
- package/dist/ae-signature.esm.js +10 -11
- package/dist/antifraud.d.ts +1 -6
- package/dist/antifraud.esm.js +3 -8
- package/dist/{antifraudManager-5KA84wtF.esm.js → antifraudManager-B8Plzf7a.esm.js} +11 -8
- package/dist/{antifraudManager-DCiNI6np.d.ts → antifraudManager-BY36bS12.d.ts} +3 -3
- package/dist/{antifraudStateMachine-BQVw46N5.esm.js → antifraudStateMachine-r4VxSBS4.esm.js} +5 -7
- package/dist/api-Bx3gKW_y.esm.js +129 -0
- package/dist/{apiError-DkOXfFBu.esm.js → apiError-DZfAyExM.esm.js} +25 -3
- package/dist/authentication.d.ts +3 -19
- package/dist/authentication.esm.js +3 -35
- package/dist/{authenticationManager-BeT6tNZm.d.ts → authenticationManager-BBMGTcwW.d.ts} +3 -4
- package/dist/{authenticationManager-BryLnSaF.esm.js → authenticationManager-DscbQwIl.esm.js} +7 -10
- package/dist/{authenticationStateMachine-DbdxfGHx.esm.js → authenticationStateMachine-SyuM00Fa.esm.js} +11 -15
- package/dist/avatar.d.ts +2 -2
- package/dist/avatar.esm.js +2 -3
- package/dist/avatar2dWarm-DqucNFX4.esm.js +1330 -0
- package/dist/avatarStats-CdUOb3VD.esm.js +136 -0
- package/dist/{backCameraStream-ChrMTJv-.esm.js → backCameraStream-CUeYm5eu.esm.js} +20 -8
- package/dist/browser-DlFgHpoC-DnyrCR8r.esm.js +1513 -0
- package/dist/callback-645_omgz.d.ts +133 -0
- package/dist/camera-_2sXMXiF.esm.js +140 -0
- package/dist/camera.d.ts +19 -2
- package/dist/camera.esm.js +2 -6
- package/dist/{canvas-Pi10hG_l.esm.js → canvas-E1zGkel4.esm.js} +1 -2
- package/dist/certificate-issuance.d.ts +34 -39
- package/dist/certificate-issuance.esm.js +4 -11
- package/dist/{certificateIssuanceStateMachine-DlZQT1_u.esm.js → certificateIssuanceStateMachine-COd7_l2T.esm.js} +7 -11
- package/dist/consent.d.ts +1 -4
- package/dist/consent.esm.js +3 -8
- package/dist/{consentManager-BwNu-uC-.esm.js → consentManager-BApTlfA0.esm.js} +5 -7
- package/dist/{consentManager-B4PMGXW-.d.ts → consentManager-uhDPdU6i.d.ts} +55 -61
- package/dist/{consentStateMachine-BOkVFiU7.esm.js → consentStateMachine-WD-S-Yhs.esm.js} +5 -7
- package/dist/{cpf-16m_cGAM.esm.js → cpf-BIADjddF.esm.js} +1 -2
- package/dist/createFaceAvatar-BEj18KXi.d.ts +50 -0
- package/dist/createFaceAvatar-DQKaRise.esm.js +103 -0
- package/dist/cross-document-data-match.d.ts +2 -26
- package/dist/cross-document-data-match.esm.js +2 -71
- package/dist/crossDocumentDataMatchManager-Dq8Z3SOg.d.ts +41 -0
- package/dist/crossDocumentDataMatchManager-OmYvyung.esm.js +84 -0
- package/dist/curp-validation.d.ts +1 -11
- package/dist/curp-validation.esm.js +3 -8
- package/dist/{curpValidationManager-CoqODZx5.d.ts → curpValidationManager-DVGr7Fq7.d.ts} +4 -6
- package/dist/{curpValidationManager-Cbji2inV.esm.js → curpValidationManager-UZxcrsrz.esm.js} +11 -7
- package/dist/{curpValidationStateMachine-Dlw4qfFb.esm.js → curpValidationStateMachine-9KwnqeoB.esm.js} +22 -14
- package/dist/custom-fields.d.ts +2 -5
- package/dist/custom-fields.esm.js +24 -11
- package/dist/custom-watchlist.d.ts +1 -3
- package/dist/custom-watchlist.esm.js +11 -10
- package/dist/{customWatchlistStateMachine-D8w0mNxm.esm.js → customWatchlistStateMachine-B_ey3TFj.esm.js} +5 -7
- package/dist/{dateUtils-BW6mBV6p.esm.js → dateUtils-CvG0FvK8.esm.js} +1 -2
- package/dist/{deepsightService-CViys6T4.esm.js → deepsightLoader-DcWjMC6A.esm.js} +68 -14
- package/dist/{deepsightService-BuTOFTr8.d.ts → deepsightService-DLVQS_RH.d.ts} +41 -2
- package/dist/device.d.ts +10 -2
- package/dist/device.esm.js +21 -21
- package/dist/document-capture.d.ts +3 -1816
- package/dist/document-capture.esm.js +3 -245
- package/dist/document-upload.d.ts +48 -55
- package/dist/document-upload.esm.js +8 -14
- package/dist/documentCaptureManager-B4Kivr8_.d.ts +2062 -0
- package/dist/documentCaptureManager-DszmcU-l.esm.js +296 -0
- package/dist/{documentCaptureStateMachine-BkTvU3yq.esm.js → documentCaptureStateMachine-D2jBwwVb.esm.js} +66 -40
- package/dist/dynamic-forms.d.ts +2 -4
- package/dist/dynamic-forms.esm.js +3 -9
- package/dist/{dynamicFormsManager-CHXUBNs4.esm.js → dynamicFormsManager-BoZ2-OUI.esm.js} +48 -9
- package/dist/{dynamicFormsManager-CKZkE7Wo.d.ts → dynamicFormsManager-fhK0yINk.d.ts} +22 -46
- package/dist/{dynamicFormsStateMachine-DJ1HGZff.esm.js → dynamicFormsStateMachine-D0RzkoEV.esm.js} +161 -34
- package/dist/ekyb.d.ts +5 -137
- package/dist/ekyb.esm.js +4 -179
- package/dist/ekybManager-DTvfxAOZ.esm.js +178 -0
- package/dist/ekybManager-Dzswb_b8.d.ts +114 -0
- package/dist/{ekybStateMachine-D9GzA4MW.esm.js → ekybStateMachine-BlTIozb6.esm.js} +16 -193
- package/dist/ekyc.d.ts +2 -79
- package/dist/ekyc.esm.js +4 -154
- package/dist/ekycManager-BFpHbBoT.d.ts +97 -0
- package/dist/ekycManager-oTstTJuL.esm.js +156 -0
- package/dist/{ekycStateMachine-DnVRiu3s.esm.js → ekycStateMachine-DHvksnrr.esm.js} +141 -423
- package/dist/ekycUtils-Dew1rBG0.esm.js +223 -0
- package/dist/electronic-signature.d.ts +3 -5
- package/dist/electronic-signature.esm.js +2 -10
- package/dist/{index-36QX_21w.d.ts → electronicSignatureManager-CcUXQZS7.d.ts} +220 -251
- package/dist/{electronicSignatureManager-DESRgObX.esm.js → electronicSignatureManager-DRYlHPjT.esm.js} +47 -33
- package/dist/email.d.ts +1 -5
- package/dist/email.esm.js +3 -10
- package/dist/{emailManager-CMS4q_r6.d.ts → emailManager-CADXW_9X.d.ts} +4 -7
- package/dist/{emailManager-B9Vrv3Ma.esm.js → emailManager-tE-YvNtS.esm.js} +76 -12
- package/dist/{emailStateMachine-CbmKFVSi.esm.js → emailStateMachine-Bm894MHB.esm.js} +7 -9
- package/dist/{endpoints-CwrFQfW7.esm.js → endpoints-CCzL3XD_.esm.js} +55 -6
- package/dist/{events-1wxZ97yf.esm.js → events-CxfNJVZW.esm.js} +43 -176
- package/dist/events.d.ts +28 -10
- package/dist/events.esm.js +2 -4
- package/dist/extensibility.d.ts +37 -37
- package/dist/extensibility.esm.js +31 -80
- package/dist/{externalFetch-hvmz_npP.esm.js → externalFetch-BKBThAUC.esm.js} +2 -4
- package/dist/face-match.d.ts +2 -225
- package/dist/face-match.esm.js +3 -173
- package/dist/{faceCaptureManagerFactory-C9TiGbkA.esm.js → faceCaptureManagerFactory-BDAsBCkh.esm.js} +52 -31
- package/dist/{faceCaptureManagerFactory-DiJ64oem.d.ts → faceCaptureManagerFactory-BxWPpxyd.d.ts} +63 -24
- package/dist/{faceCaptureSetup-BqhqfFHL.esm.js → faceCaptureSetup-C7Qv79fA.esm.js} +57 -36
- package/dist/faceMatchManager-BXp2WUT-.esm.js +201 -0
- package/dist/faceMatchManager-BnvrZM2F.d.ts +268 -0
- package/dist/{faceMatchStateMachine-MDb30gCm.esm.js → faceMatchStateMachine-CJiO2yLO.esm.js} +14 -10
- package/dist/feature-management-DS_Nj5Gg.esm.js +615 -0
- package/dist/feature-management.d.ts +173 -0
- package/dist/feature-management.esm.js +2 -0
- package/dist/field-comparison.d.ts +1 -4
- package/dist/field-comparison.esm.js +2 -7
- package/dist/{fieldComparisonManager-OLKVsG2Z.d.ts → fieldComparisonManager-CBvEGxFx.d.ts} +3 -5
- package/dist/{fieldComparisonManager-Cw4uzD7S.esm.js → fieldComparisonManager-DhnYdYZ2.esm.js} +6 -11
- package/dist/fiscal-qr.d.ts +1 -6
- package/dist/fiscal-qr.esm.js +14 -29
- package/dist/flow-events.d.ts +2 -9
- package/dist/flow.d.ts +59 -21
- package/dist/flow.esm.js +132 -49
- package/dist/{flowCompletionService-B6P6_EF3.esm.js → flowCompletionService-BSe3p7pg.esm.js} +4 -6
- package/dist/flowServices-unhF9V9F.esm.js +620 -0
- package/dist/geolocation.d.ts +1 -4
- package/dist/geolocation.esm.js +3 -9
- package/dist/{geolocationManager-CF6-NizA.esm.js → geolocationManager-Bv9MSVNr.esm.js} +44 -16
- package/dist/geolocationManager-Cz744E5S.d.ts +506 -0
- package/dist/{geolocationStateMachine-CD2XJs1b.esm.js → geolocationStateMachine-BxD6JK1M.esm.js} +53 -28
- package/dist/{getBrowser-1yNcfFZR.esm.js → getBrowser-Cb8Zgrgp.esm.js} +1 -2
- package/dist/getBrowser-DNrQeL4T.esm.js +16 -0
- package/dist/getDeviceClass-9y-kbVDw.esm.js +19 -0
- package/dist/{getDeviceClass-C-Dg6IsJ.esm.js → getDeviceClass-CeBiEayS.esm.js} +1 -2
- package/dist/getParsedUserAgent-pJjATANs.esm.js +1622 -0
- package/dist/government-validation.d.ts +3 -6
- package/dist/government-validation.esm.js +7 -13
- package/dist/{governmentValidationStateMachine-BE5wiQ7Y.esm.js → governmentValidationStateMachine-BYKYUdza.esm.js} +8 -11
- package/dist/home.d.ts +14 -22
- package/dist/home.esm.js +3 -8
- package/dist/http.d.ts +0 -1
- package/dist/http.esm.js +2 -4
- package/dist/id-ocr.d.ts +8 -7
- package/dist/id-ocr.esm.js +20 -9
- package/dist/id-selfie-flow.d.ts +179 -0
- package/dist/id-selfie-flow.esm.js +917 -0
- package/dist/id-verification.d.ts +2 -191
- package/dist/id-verification.esm.js +3 -43
- package/dist/id.d.ts +7 -18
- package/dist/id.esm.js +47 -53
- package/dist/{idCaptureDefaults-CZajItdO.esm.js → idCaptureDefaults-WeHbQM7W.esm.js} +54 -17
- package/dist/idCaptureManager-BjU-Wyow.d.ts +429 -0
- package/dist/{idCaptureManager-DASPUMtC.esm.js → idCaptureManager-BjiBSrHm.esm.js} +173 -34
- package/dist/idCaptureServices-CFDwqTtQ.esm.js +396 -0
- package/dist/{idCaptureStateMachine-DZ2ZTSxu.esm.js → idCaptureStateMachine-CRwQh8jc.esm.js} +438 -585
- package/dist/{idOcrManager-Tm4LzKR0.esm.js → idOcrManager-CvJZhmBR.esm.js} +4 -7
- package/dist/{idOcrManager-DLfAjDZn.d.ts → idOcrManager-DXc_xRN7.d.ts} +62 -229
- package/dist/{idOcrStateMachine-BJxZCxwS.esm.js → idOcrStateMachine-Bq_e3l4E.esm.js} +15 -20
- package/dist/idVerificationManager-BB4Pj_N6.d.ts +197 -0
- package/dist/idVerificationManager-CduNXhWd.esm.js +51 -0
- package/dist/{idVerificationStateMachine-DXN9WcdM.esm.js → idVerificationStateMachine-GEQWUPU2.esm.js} +5 -7
- package/dist/identity-reuse.d.ts +1 -4
- package/dist/identity-reuse.esm.js +3 -8
- package/dist/{identityReuseManager-LjkPvSQN.esm.js → identityReuseManager-D5vXknnJ.esm.js} +24 -7
- package/dist/{identityReuseManager-CLVOYxcp.d.ts → identityReuseManager-v2TH5g7e.d.ts} +38 -43
- package/dist/{identityReuseStateMachine-Bp-zONoV.esm.js → identityReuseStateMachine-AubRPhIi.esm.js} +6 -8
- package/dist/index-B8weJxmL.d.ts +1 -0
- package/dist/index-BKOWUhxG.d.ts +258 -0
- package/dist/{index-DrpWp15Z.d.ts → index-CLMF0QLQ.d.ts} +3 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.esm.js +2 -15
- package/dist/{invokeOnCaptureCallback-CCS2Ruzi.esm.js → invokeOnCaptureCallback-1m1VJ3Q4.esm.js} +2 -4
- package/dist/{lib-Bjd6nOLG.esm.js → lib-DAyUtOTj.esm.js} +1510 -1589
- package/dist/mandatory-consent.d.ts +2 -10
- package/dist/mandatory-consent.esm.js +3 -8
- package/dist/{mandatoryConsentManager-DeBmOHcQ.d.ts → mandatoryConsentManager-B29kR0XA.d.ts} +60 -85
- package/dist/{mandatoryConsentManager-DZ26sg4B.esm.js → mandatoryConsentManager-BeELm1zS.esm.js} +4 -7
- package/dist/{mandatoryConsentStateMachine-_44ZoDSh.esm.js → mandatoryConsentStateMachine-zroQGzwb.esm.js} +5 -7
- package/dist/manualReviewService-D4IkipnN.esm.js +15 -0
- package/dist/{mediaRecorderOptions-CClCKAiF.esm.js → mediaRecorderOptions-dALSV8af.esm.js} +2 -4
- package/dist/{mediapipeShared-Bcmkzs3x.esm.js → mediapipeShared-B6oNoXEQ.esm.js} +21 -9
- package/dist/{onDeviceFaceResults-DILtthks.esm.js → onDeviceFaceResults-f81FVdQs.esm.js} +30 -87
- package/dist/openviduLazy-CCDpFWg1.esm.js +10 -0
- package/dist/{otp-B1YeyRXu.d.ts → otp-CEWfTj9v.d.ts} +0 -1
- package/dist/{otp-uaXiKt_R.esm.js → otp-D2k3PeSL.esm.js} +3 -14
- package/dist/{permissionGuards-BNOe4Tnu.esm.js → permissionGuards-KINpmKtI.esm.js} +2 -4
- package/dist/{permissionServices-C_kxhNeo.esm.js → permissionServices-UvUcOSRb.esm.js} +35 -28
- package/dist/personhood.d.ts +13 -20
- package/dist/personhood.esm.js +153 -85
- package/dist/phone.d.ts +1 -5
- package/dist/phone.esm.js +3 -10
- package/dist/{phoneManager-_KtitbUA.d.ts → phoneManager-BBU8Lq0O.d.ts} +4 -7
- package/dist/{phoneManager-CRblfdcI.esm.js → phoneManager-Cpiai2IM.esm.js} +82 -12
- package/dist/{phoneStateMachine-DjFGWMjQ.esm.js → phoneStateMachine-E1fUUcNM.esm.js} +7 -9
- package/dist/{platform-0Ot-bF_a.esm.js → platform-BJrm5nzZ.esm.js} +31 -11
- package/dist/privacyLensWorker-DI-Rg83h.esm.js +355 -0
- package/dist/qe-signature.d.ts +4 -6
- package/dist/qe-signature.esm.js +10 -11
- package/dist/{recordingService-CxaYkITO.esm.js → recordingService-CFpfdXSS.esm.js} +13 -31
- package/dist/redirect-to-mobile.d.ts +2 -6
- package/dist/redirect-to-mobile.esm.js +3 -10
- package/dist/{redirectToMobileManager-dv29o_LS.d.ts → redirectToMobileManager-BD2PvT5B.d.ts} +8 -44
- package/dist/{redirectToMobileManager-DbuNUlru.esm.js → redirectToMobileManager-C0dfc7f6.esm.js} +28 -8
- package/dist/{redirectToMobileStateMachine-BRaIJWOM.esm.js → redirectToMobileStateMachine-C9SYCJcH.esm.js} +74 -18
- package/dist/rolldown-runtime-FZ4Itg2g.esm.js +42 -0
- package/dist/{runChildModule-kojSv3MH.esm.js → runChildModule-DpvgAGFA.esm.js} +10 -9
- package/dist/{WasmUtilProvider-BgzcXBdl.esm.js → safeStorage-Ep56I-f_.esm.js} +98 -473
- package/dist/selfie.d.ts +8 -21
- package/dist/selfie.esm.js +40 -47
- package/dist/selfieErrorUtils-C2PYBVsp.esm.js +90 -0
- package/dist/{selfieManager-B1Px3GGa.esm.js → selfieManager-Br4onIMy.esm.js} +7 -10
- package/dist/{selfieManager-4juKfrHG.d.ts → selfieManager-DwlCppg0.d.ts} +3 -4
- package/dist/{selfieStateMachine-D0TS93Tu.esm.js → selfieStateMachine-CNGs8vFK.esm.js} +14 -29
- package/dist/{session-CLsU2Jnb.esm.js → session-CX2H3tmI.esm.js} +16 -7
- package/dist/session.d.ts +12 -10
- package/dist/session.esm.js +5 -15
- package/dist/sessionInitializer-CV6Rj_dn.esm.js +1865 -0
- package/dist/{setup-CfNsYAeB.esm.js → setup-CYdVacqv.esm.js} +319 -137
- package/dist/{setup-CmA2apmN.d.ts → setup-DywQeePQ.d.ts} +186 -4
- package/dist/signature.d.ts +2 -96
- package/dist/signature.esm.js +3 -108
- package/dist/signatureManager-DGBSWz2_.d.ts +106 -0
- package/dist/signatureManager-DdPgcmou.esm.js +113 -0
- package/dist/{signatureStateMachine-CdhlMih-.esm.js → signatureStateMachine-Cf73DGWO.esm.js} +5 -7
- package/dist/spawn-D9jgw9pW.d.ts +1441 -0
- package/dist/src-0Jurt29N.esm.js +4482 -0
- package/dist/{stats-BVy52wLy.esm.js → stats-B0nFKawG.esm.js} +3 -5
- package/dist/stats.esm.js +2 -5
- package/dist/topLevelStateName-B5i2avbh.esm.js +41 -0
- package/dist/{tri-CFAPtAUM.esm.js → tri-4RsGrIt6.esm.js} +3 -119
- package/dist/tri.d.ts +2 -2
- package/dist/tri.esm-BIjHhBJ2.esm.js +2620 -0
- package/dist/tri.esm.js +2 -4
- package/dist/trueSight-B8G85W4z.esm.js +1 -0
- package/dist/trueSightService-6dTpiaTh.esm.js +1894 -0
- package/dist/trust-graph.d.ts +4 -5
- package/dist/trust-graph.esm.js +13 -9
- package/dist/types-BEwVKkLJ.d.ts +15 -0
- package/dist/{types-BKLb3C42.esm.js → types-BN5RPPIZ.esm.js} +1 -2
- package/dist/types-BSBzhHRH.d.ts +57 -0
- package/dist/types-BX_XkMsQ2.d.ts +21 -0
- package/dist/types-BfHiko5D.d.ts +48 -0
- package/dist/{types-D8Cl1N2Z.d.ts → types-BfgmV7s72.d.ts} +2 -2
- package/dist/types-CJ7Yl9K-2.d.ts +164 -0
- package/dist/types-DPIDuhut.d.ts +40 -0
- package/dist/types-DVmXIdzW.d.ts +82 -0
- package/dist/types-DelMqZLe.d.ts +105 -0
- package/dist/types-EELWyWpd.d.ts +6 -0
- package/dist/{types-fO6KIdol.d.ts → types-Hmd7U0JA.d.ts} +80 -6
- package/dist/{types-BUgeB2X6.d.ts → types-KPvmag_B.d.ts} +7 -7
- package/dist/types-M6eb82ra2.d.ts +589 -0
- package/dist/{types-DV3wkhQ4.d.ts → types-Vb4P9ovf.d.ts} +1 -3
- package/dist/{urlUtils-CpiYwn7w.esm.js → urlUtils-D6phjq1-.esm.js} +1 -2
- package/dist/{video-ZY92rkel.esm.js → video-BtSWtHy1.esm.js} +1 -2
- package/dist/video-selfie.d.ts +71 -117
- package/dist/video-selfie.esm.js +575 -643
- package/dist/videoSelfieCameraWarmer-h_VUk5Vu.esm.js +651 -0
- package/dist/videoSelfieStepDetector-D3oo2ofo.d.ts +123 -0
- package/dist/wasm.d.ts +2 -4
- package/dist/wasm.esm.js +4 -15
- package/dist/wasmDefaults-DTUrftxR.esm.js +125 -0
- package/dist/{wasmDsFlagSync-Ch0mFJNT.esm.js → wasmDsFlagSync-BqUCwLY8.esm.js} +2 -4
- package/dist/wasmWebClient-DM8lkb0z.esm.js +407 -0
- package/dist/watchlist-for-business.d.ts +1 -3
- package/dist/watchlist-for-business.esm.js +9 -9
- package/dist/watchlist.d.ts +1 -52
- package/dist/watchlist.esm.js +3 -70
- package/dist/{watchlistForBusinessStateMachine-R1Yp1g5A.esm.js → watchlistForBusinessStateMachine-BcBMkMvV.esm.js} +5 -7
- package/dist/watchlistManager-CjSMmbyq.esm.js +83 -0
- package/dist/watchlistManager-DLXef90v.d.ts +68 -0
- package/dist/{watchlistStateMachine-D07UVq1m.esm.js → watchlistStateMachine-Bl7Wy9Cm.esm.js} +5 -7
- package/dist/workflow.d.ts +239 -203
- package/dist/workflow.esm.js +156 -101
- package/dist/xstate-actors.esm-CtI5S0f4.esm.js +310 -0
- package/dist/{xstate.esm-nY3M5UYm.esm.js → xstate.esm-Cf4e0Cfd.esm.js} +136 -610
- package/package.json +14 -9
- package/dist/Actor-BwgmOPkb.d.ts +0 -2
- package/dist/Face2DProvider-CZU11g6r.esm.js +0 -824
- package/dist/FaceDetectionProvider-CPWg-PAH.d.ts +0 -119
- package/dist/IWasmUtilCapability-DaSNxgA8.d.ts +0 -150
- package/dist/PrivacyLensProvider-B_zrV25p.esm.js +0 -339
- package/dist/StateMachine-D5WO6lHS.d.ts +0 -2
- package/dist/StreamCanvasCapture-DHaWferF.d.ts +0 -42
- package/dist/ae-signature-Pp4oCAHD.esm.js +0 -12
- package/dist/api-DsbUi7TO.esm.js +0 -72
- package/dist/browser-DlFgHpoC-Br3G10gw.esm.js +0 -1425
- package/dist/browserSimulation-DZwEy9bu.esm.js +0 -2804
- package/dist/camera-CxxXV0VN.esm.js +0 -79
- package/dist/canvas-90BqS0NF.d.ts +0 -112
- package/dist/chunk-CIKcdghV.esm.js +0 -49
- package/dist/clientLifecycle-VyzRfALg.esm.js +0 -534
- package/dist/cpf-ocr.d.ts +0 -10
- package/dist/cpf-ocr.esm.js +0 -8
- package/dist/cpfOcrManager-9eM4z4o7.esm.js +0 -190
- package/dist/cpfOcrManager-C5U9E0hf.d.ts +0 -216
- package/dist/createFaceAvatar-BZSg2MNo.esm.js +0 -46
- package/dist/deepsightLoader-CU_tiLMx.esm.js +0 -62
- package/dist/flowServices-DkQmOkLV.esm.js +0 -208
- package/dist/geolocationManager-DaHYFkVO.d.ts +0 -156
- package/dist/getDeviceClass-DIjnTPjR.esm.js +0 -14
- package/dist/http-CnsKEaJY.esm.js +0 -0
- package/dist/idCaptureManager-CwuXtVu6.d.ts +0 -1013
- package/dist/index-BAyZ8_iI.d.ts +0 -93
- package/dist/openviduLazy-jPgABwrt.esm.js +0 -3
- package/dist/openviduLazy-wEojM41w.esm.js +0 -12
- package/dist/qe-signature-BnWIpR-O.esm.js +0 -12
- package/dist/sessionInitializer-Dj7-aJaP.esm.js +0 -547
- package/dist/tri.esm-DDJ1zOqG.esm.js +0 -2593
- package/dist/types-BcF-fii5.d.ts +0 -5
- package/dist/videoSelfieSteps-Djpv7cjb.esm.js +0 -58
- /package/dist/{IVisibilityObserverCapability-BZ1rE7ly.d.ts → IVisibilityObserverCapability-D4tvIB5v.d.ts} +0 -0
- /package/dist/{camera-CKU96nwJ.d.ts → camera-9wWD-pwg.d.ts} +0 -0
- /package/dist/{flowCompletionService-BOSTlAWo.d.ts → flowCompletionService-BlAHsKyv.d.ts} +0 -0
- /package/dist/{types-BgjMAEXl.d.ts → types-Bk_6dmDa.d.ts} +0 -0
- /package/dist/{warmup-Dd0iq6KF.d.ts → warmup-Dv2alr2-.d.ts} +0 -0
package/dist/{idCaptureStateMachine-DZ2ZTSxu.esm.js → idCaptureStateMachine-CRwQh8jc.esm.js}
RENAMED
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import { t as BrowserTimerProvider } from "./BrowserTimerProvider-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import { n as
|
|
13
|
-
import { n as
|
|
14
|
-
import { t as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
1
|
+
import { t as BrowserTimerProvider } from "./BrowserTimerProvider-BXhgNxLt.esm.js";
|
|
2
|
+
import { s as exposeExperimentOnce } from "./feature-management-DS_Nj5Gg.esm.js";
|
|
3
|
+
import { n as revokeObjectURL } from "./IBrowserEnvironmentCapability-DEaRRk-R.esm.js";
|
|
4
|
+
import { r as getToken, t as api } from "./api-Bx3gKW_y.esm.js";
|
|
5
|
+
import { c as trueSightHintTransition, l as trueSightLog, r as noteTrueSightCaptureActivity } from "./trueSightService-6dTpiaTh.esm.js";
|
|
6
|
+
import { n as eventModuleNames, s as recordExperimentAssignmentOnce } from "./events-CxfNJVZW.esm.js";
|
|
7
|
+
import { t as getDisableIpify } from "./sessionInitializer-CV6Rj_dn.esm.js";
|
|
8
|
+
import "./trueSight-B8G85W4z.esm.js";
|
|
9
|
+
import { t as addDeviceStats } from "./stats-B0nFKawG.esm.js";
|
|
10
|
+
import { t as isAndroid } from "./platform-BJrm5nzZ.esm.js";
|
|
11
|
+
import "./session-CX2H3tmI.esm.js";
|
|
12
|
+
import { a as and, n as sendTo, r as assign, s as not, t as setup } from "./xstate.esm-Cf4e0Cfd.esm.js";
|
|
13
|
+
import { n as fromPromise, t as fromCallback } from "./xstate-actors.esm-CtI5S0f4.esm.js";
|
|
14
|
+
import { n as invokeRequestPermissionActor, t as checkPermission } from "./permissionServices-UvUcOSRb.esm.js";
|
|
15
|
+
import { _ as StreamCanvasProcessingSession } from "./onDeviceFaceResults-f81FVdQs.esm.js";
|
|
16
|
+
import { t as sleep } from "./ITimerCapability-DgdDzp8G.esm.js";
|
|
17
|
+
import { t as IncodeCanvas } from "./canvas-E1zGkel4.esm.js";
|
|
18
|
+
import { t as getBrowser } from "./getBrowser-DNrQeL4T.esm.js";
|
|
19
|
+
import { n as getWindowDimensions } from "./getDeviceClass-CeBiEayS.esm.js";
|
|
20
|
+
import { t as StreamCanvasCapture } from "./StreamCanvasCapture-D2XcXCZ4.esm.js";
|
|
21
|
+
import { n as needsMotionPrimeOnlyFromPermission, r as resolveStoredPermissionResult, t as isReadyForCaptureFromPermission } from "./permissionGuards-KINpmKtI.esm.js";
|
|
22
|
+
import { n as flagIdManualReview } from "./manualReviewService-D4IkipnN.esm.js";
|
|
23
|
+
import { a as processId, c as stopStream, d as validateUploadResponse, f as ID_ERROR_CODES, g as getIdCameraStream, h as CAPTURE_RESULT_PREVIEW, i as preloadIdRecordingProvider, l as uploadIdImage, m as resolveIdCaptureThresholds, o as startRecordingSession, r as initializeIdCapture, s as stopRecording, t as addBarcode, u as uploadManualIdFile } from "./idCaptureServices-CFDwqTtQ.esm.js";
|
|
20
24
|
//#region src/modules/id/digitalUpload/digitalUploadErrors.ts
|
|
21
|
-
const TERMINAL_FAIL_REASONS = new Set(["DIGITAL_ID_REQUESTED_BUT_OTHER_PROVIDED", "ID_TYPE_UNACCEPTABLE"]);
|
|
25
|
+
const TERMINAL_FAIL_REASONS = /* @__PURE__ */ new Set(["DIGITAL_ID_REQUESTED_BUT_OTHER_PROVIDED", "ID_TYPE_UNACCEPTABLE"]);
|
|
22
26
|
function isKnownFailReason(reason) {
|
|
23
27
|
return reason === "DIGITAL_ID_REQUESTED_BUT_OTHER_PROVIDED" || reason === "ID_TYPE_UNACCEPTABLE" || reason === "FILE_CHANGED_ERROR" || reason === "NETWORK_ERROR" || reason === "GENERIC";
|
|
24
28
|
}
|
|
@@ -48,7 +52,6 @@ function classifyNetworkError(err) {
|
|
|
48
52
|
if (message.includes("ERR_UPLOAD_FILE_CHANGED") || message.includes("file changed") || message.includes("FILE_CHANGED")) return "FILE_CHANGED_ERROR";
|
|
49
53
|
return "NETWORK_ERROR";
|
|
50
54
|
}
|
|
51
|
-
|
|
52
55
|
//#endregion
|
|
53
56
|
//#region src/modules/id/digitalUpload/digitalUploadServices.ts
|
|
54
57
|
const DIGITAL_ID_UPLOAD_PATH = "/omni/add/front-id";
|
|
@@ -68,13 +71,8 @@ async function uploadDigitalIdFile(params) {
|
|
|
68
71
|
uploadDurationMs: 0
|
|
69
72
|
};
|
|
70
73
|
}
|
|
71
|
-
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/modules/id/digitalUpload/types.ts
|
|
74
|
-
const DIGITAL_UPLOAD_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
|
75
74
|
const DIGITAL_UPLOAD_HOLDING_TIMEOUT_MS = 8e3;
|
|
76
75
|
const DIGITAL_UPLOAD_ALLOWED_MIME_TYPES = ["application/pdf"];
|
|
77
|
-
|
|
78
76
|
//#endregion
|
|
79
77
|
//#region src/modules/id/digitalUpload/digitalUploadStateMachine.ts
|
|
80
78
|
const uploadDigitalIdActor = fromPromise(async ({ input, signal }) => {
|
|
@@ -89,7 +87,7 @@ const getUploadResponseFromEvent$1 = (event) => {
|
|
|
89
87
|
if (!("output" in event)) return;
|
|
90
88
|
return event.output;
|
|
91
89
|
};
|
|
92
|
-
const
|
|
90
|
+
const digitalUploadMachine = setup({
|
|
93
91
|
types: {
|
|
94
92
|
context: {},
|
|
95
93
|
events: {},
|
|
@@ -146,7 +144,7 @@ const _digitalUploadMachine = setup({
|
|
|
146
144
|
decrementAttemptOnFailure: assign(({ context }) => ({ attemptsRemaining: Math.max(0, context.attemptsRemaining - 1) }))
|
|
147
145
|
},
|
|
148
146
|
guards: {
|
|
149
|
-
isSelectedFileTooLarge: ({ event }) => event.type === "FILE_PICKED" && event.file.size >
|
|
147
|
+
isSelectedFileTooLarge: ({ event }) => event.type === "FILE_PICKED" && event.file.size > 5242880,
|
|
150
148
|
isSelectedFileMimeInvalid: ({ event }) => event.type === "FILE_PICKED" && !DIGITAL_UPLOAD_ALLOWED_MIME_TYPES.includes(event.file.type),
|
|
151
149
|
hasSelectedFile: ({ context }) => context.file !== null,
|
|
152
150
|
responseHasFailReason: ({ event }) => mapDigitalIdFailReason(getUploadResponseFromEvent$1(event)) !== null,
|
|
@@ -155,7 +153,7 @@ const _digitalUploadMachine = setup({
|
|
|
155
153
|
return isTerminalDigitalIdFailReason(getUploadResponseFromEvent$1(event));
|
|
156
154
|
},
|
|
157
155
|
isCurrentFailReasonTerminal: ({ context }) => {
|
|
158
|
-
const terminalReasons = new Set(["DIGITAL_ID_REQUESTED_BUT_OTHER_PROVIDED", "ID_TYPE_UNACCEPTABLE"]);
|
|
156
|
+
const terminalReasons = /* @__PURE__ */ new Set(["DIGITAL_ID_REQUESTED_BUT_OTHER_PROVIDED", "ID_TYPE_UNACCEPTABLE"]);
|
|
159
157
|
return context.failReason !== null && terminalReasons.has(context.failReason);
|
|
160
158
|
}
|
|
161
159
|
}
|
|
@@ -308,43 +306,6 @@ const _digitalUploadMachine = setup({
|
|
|
308
306
|
}
|
|
309
307
|
}
|
|
310
308
|
});
|
|
311
|
-
const digitalUploadMachine = _digitalUploadMachine;
|
|
312
|
-
|
|
313
|
-
//#endregion
|
|
314
|
-
//#region src/modules/id/digitalUpload/instrumentation.ts
|
|
315
|
-
const TERMINAL_REASONS = new Set(["DIGITAL_ID_REQUESTED_BUT_OTHER_PROVIDED", "ID_TYPE_UNACCEPTABLE"]);
|
|
316
|
-
function isHoldingState(value) {
|
|
317
|
-
if (value === "holding") return true;
|
|
318
|
-
if (typeof value !== "object" || value === null) return false;
|
|
319
|
-
const uploadingState = value.uploading;
|
|
320
|
-
if (uploadingState === "holding") return true;
|
|
321
|
-
if (typeof uploadingState === "object" && uploadingState !== null) return Object.prototype.hasOwnProperty.call(uploadingState, "holding");
|
|
322
|
-
return false;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Maps a Digital ID Upload child-machine snapshot to the exact Figma
|
|
326
|
-
* "Tracked Events" screen name. Source: Upload Digital ID Figma file
|
|
327
|
-
* (`https://www.figma.com/design/wxFsHRvllern4VnjRqM4JO/Upload-Digital-ID---Latest-Design?node-id=25911-4095`).
|
|
328
|
-
*
|
|
329
|
-
* Family is `uploadDigitalid.*` — emitted cross-family under the parent
|
|
330
|
-
* `idCapture` module token. Returns Figma-verbatim strings which the
|
|
331
|
-
* adapter emits as-is on `event.screen` (e.g.
|
|
332
|
-
* `uploadDigitalid.<section>.<state>`). See
|
|
333
|
-
* `docs/patterns/INSTRUMENTATION.md`.
|
|
334
|
-
*/
|
|
335
|
-
function mapDigitalIdScreenName(value, failReason) {
|
|
336
|
-
if (value === "tutorial") return "uploadDigitalid.tutorial.default";
|
|
337
|
-
if (value === "selecting" || value === "reviewing") return "uploadDigitalid.review.default";
|
|
338
|
-
if (value === "uploading" || isHoldingState(value)) return "uploadDigitalid.analyzing.default";
|
|
339
|
-
if (value === "success") return "uploadDigitalid.success.default";
|
|
340
|
-
if (value === "fileTooLarge") return "uploadDigitalid.error.filetoolarge";
|
|
341
|
-
if (value === "error") {
|
|
342
|
-
if (failReason !== null && TERMINAL_REASONS.has(failReason)) return "uploadDigitalid.error.notaccepted";
|
|
343
|
-
return "uploadDigitalid.error.default";
|
|
344
|
-
}
|
|
345
|
-
return "uploadDigitalid.review.default";
|
|
346
|
-
}
|
|
347
|
-
|
|
348
309
|
//#endregion
|
|
349
310
|
//#region src/modules/id/manualUpload/manualUploadErrors.ts
|
|
350
311
|
/**
|
|
@@ -389,7 +350,6 @@ function mapFailReasonToErrorKey(response, expectedTab) {
|
|
|
389
350
|
if (response.readability === false) return MANUAL_UPLOAD_ERROR_KEYS.readabilityIssue;
|
|
390
351
|
return null;
|
|
391
352
|
}
|
|
392
|
-
|
|
393
353
|
//#endregion
|
|
394
354
|
//#region ../infra/src/media/imageFile.ts
|
|
395
355
|
const DEFAULT_IMAGE_MIME_TYPE = "image/jpeg";
|
|
@@ -444,315 +404,11 @@ const imageFileToDataUrl = async (file, options = {}) => {
|
|
|
444
404
|
return readFileAsDataUrl(file);
|
|
445
405
|
}
|
|
446
406
|
};
|
|
447
|
-
|
|
448
|
-
//#endregion
|
|
449
|
-
//#region src/modules/id/idCameraStream.ts
|
|
450
|
-
async function getIdCameraStream(deviceId) {
|
|
451
|
-
return getBackCameraStream(deviceId);
|
|
452
|
-
}
|
|
453
|
-
|
|
454
407
|
//#endregion
|
|
455
408
|
//#region src/modules/id/manualUpload/types.ts
|
|
456
409
|
const MANUAL_UPLOAD_MAX_RETRIES = 3;
|
|
457
410
|
const MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
|
458
411
|
const MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS = 5e3;
|
|
459
|
-
|
|
460
|
-
//#endregion
|
|
461
|
-
//#region src/modules/id/types.ts
|
|
462
|
-
const ID_ERROR_CODES = {
|
|
463
|
-
UPLOAD_ERROR: "UPLOAD_ERROR",
|
|
464
|
-
CLASSIFICATION_FAILED: "CLASSIFICATION_FAILED",
|
|
465
|
-
LOW_SHARPNESS: "LOW_SHARPNESS",
|
|
466
|
-
GLARE_DETECTED: "GLARE_DETECTED",
|
|
467
|
-
WRONG_DOCUMENT_SIDE: "WRONG_DOCUMENT_SIDE",
|
|
468
|
-
ID_TYPE_UNACCEPTABLE: "ID_TYPE_UNACCEPTABLE",
|
|
469
|
-
READABILITY_ISSUE: "READABILITY_ISSUE",
|
|
470
|
-
RETRY_EXHAUSTED_CONTINUE_TO_BACK: "RETRY_EXHAUSTED_CONTINUE_TO_BACK",
|
|
471
|
-
RETRY_EXHAUSTED_SKIP_BACK: "RETRY_EXHAUSTED_SKIP_BACK",
|
|
472
|
-
NO_MORE_TRIES: "NO_MORE_TRIES",
|
|
473
|
-
UNEXPECTED_ERROR: "UNEXPECTED_ERROR",
|
|
474
|
-
NO_TOKEN: "NO_TOKEN",
|
|
475
|
-
PERMISSION_DENIED: "PERMISSION_DENIED",
|
|
476
|
-
USER_CANCELLED: "USER_CANCELLED",
|
|
477
|
-
SERVER: "SERVER_ERROR"
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
//#endregion
|
|
481
|
-
//#region src/modules/id/idCaptureServices.ts
|
|
482
|
-
/**
|
|
483
|
-
* Camera constraints used for PRC warmup before ID capture.
|
|
484
|
-
* Uses environment-facing camera on mobile devices (for back camera ID capture)
|
|
485
|
-
* and user-facing camera on desktop.
|
|
486
|
-
*/
|
|
487
|
-
function getPrcCameraConstraints() {
|
|
488
|
-
if (isDesktop()) return { video: {
|
|
489
|
-
facingMode: "user",
|
|
490
|
-
height: { ideal: 480 },
|
|
491
|
-
width: { ideal: 640 }
|
|
492
|
-
} };
|
|
493
|
-
return { video: {
|
|
494
|
-
facingMode: "environment",
|
|
495
|
-
height: { ideal: 720 }
|
|
496
|
-
} };
|
|
497
|
-
}
|
|
498
|
-
function getUploadEndpoint(type, isSecondId) {
|
|
499
|
-
if (isSecondId) return type === "front" ? endpoints.frontSecondId : endpoints.backSecondId;
|
|
500
|
-
return type === "front" ? endpoints.frontId : endpoints.backId;
|
|
501
|
-
}
|
|
502
|
-
const SHARPNESS_THRESHOLD = 10;
|
|
503
|
-
const GLARE_THRESHOLD = 10;
|
|
504
|
-
const DEFAULT_ID_CAPTURE_THRESHOLDS$1 = {
|
|
505
|
-
blurThreshold: .2,
|
|
506
|
-
blurChangeThreshold: .2,
|
|
507
|
-
glareThreshold: .3,
|
|
508
|
-
clsThreshold: .98,
|
|
509
|
-
sideThreshold: .8,
|
|
510
|
-
iouThreshold: .8,
|
|
511
|
-
framesAggregationInterval: 3e3
|
|
512
|
-
};
|
|
513
|
-
const DEFAULT_ID_CAPTURE_SETTINGS = {
|
|
514
|
-
isFixedMask: false,
|
|
515
|
-
isIPhone14OrHigher: false,
|
|
516
|
-
idType: "",
|
|
517
|
-
blurCheckEnabled: false,
|
|
518
|
-
glareCheckEnabled: false,
|
|
519
|
-
faceQualityCheckEnabled: true,
|
|
520
|
-
iouCheckEnabled: true,
|
|
521
|
-
fpsLimitEnabled: false
|
|
522
|
-
};
|
|
523
|
-
async function initializeIdCapture(params) {
|
|
524
|
-
const { config, deepsightService } = params;
|
|
525
|
-
const provider = new IdCaptureProvider();
|
|
526
|
-
await provider.initialize({});
|
|
527
|
-
provider.setThresholds({
|
|
528
|
-
...DEFAULT_ID_CAPTURE_THRESHOLDS$1,
|
|
529
|
-
...config.thresholds,
|
|
530
|
-
idDetectedTimeout: config.thresholds?.idDetectedTimeout ?? config.deviceIdleTimeout * 1e3,
|
|
531
|
-
autocaptureTimeout: config.thresholds?.autocaptureTimeout ?? config.autoCaptureTimeout * 1e3
|
|
532
|
-
});
|
|
533
|
-
if (config.settings) provider.setSettings({
|
|
534
|
-
...DEFAULT_ID_CAPTURE_SETTINGS,
|
|
535
|
-
...config.settings
|
|
536
|
-
});
|
|
537
|
-
if (deepsightService) try {
|
|
538
|
-
await deepsightService.performPrcCheck({ constraints: getPrcCameraConstraints() });
|
|
539
|
-
} catch {}
|
|
540
|
-
const { stream, fallbackLevel } = await getIdCameraStream();
|
|
541
|
-
const videoTrack = stream.getVideoTracks()[0];
|
|
542
|
-
let captureResolution;
|
|
543
|
-
if (videoTrack) {
|
|
544
|
-
const settings = videoTrack.getSettings();
|
|
545
|
-
if (typeof settings.width === "number" && typeof settings.height === "number") captureResolution = `${settings.width}x${settings.height}`;
|
|
546
|
-
}
|
|
547
|
-
if (deepsightService && videoTrack) deepsightService.metadata.updateCameraInfo(videoTrack);
|
|
548
|
-
return {
|
|
549
|
-
stream,
|
|
550
|
-
provider,
|
|
551
|
-
captureResolution,
|
|
552
|
-
cameraFallbackLevel: fallbackLevel
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
function stopStream(stream) {
|
|
556
|
-
for (const track of stream.getTracks()) track.stop();
|
|
557
|
-
}
|
|
558
|
-
function validateUploadResponse(response, sessionState) {
|
|
559
|
-
if (response.failReason === "ID_TYPE_UNACCEPTABLE") return {
|
|
560
|
-
error: true,
|
|
561
|
-
message: "ID type is not acceptable",
|
|
562
|
-
messageDescription: "Please use a valid ID type",
|
|
563
|
-
errorKey: ID_ERROR_CODES.ID_TYPE_UNACCEPTABLE
|
|
564
|
-
};
|
|
565
|
-
if (response.failReason === "WRONG_DOCUMENT_SIDE") return {
|
|
566
|
-
error: true,
|
|
567
|
-
message: "Wrong side of document",
|
|
568
|
-
messageDescription: response.side === "back" ? "Please show the back side of your ID" : "Please show the front side of your ID",
|
|
569
|
-
errorKey: ID_ERROR_CODES.WRONG_DOCUMENT_SIDE
|
|
570
|
-
};
|
|
571
|
-
if (!response.classification) return {
|
|
572
|
-
error: true,
|
|
573
|
-
message: "ID classification failed",
|
|
574
|
-
errorKey: ID_ERROR_CODES.CLASSIFICATION_FAILED
|
|
575
|
-
};
|
|
576
|
-
const sharpnessThreshold = getDeviceClass() === "desktop" ? -1 : SHARPNESS_THRESHOLD;
|
|
577
|
-
if (response.sharpness !== void 0 && sharpnessThreshold >= 0 && response.sharpness < sharpnessThreshold) return {
|
|
578
|
-
error: true,
|
|
579
|
-
message: "Image is not sharp enough",
|
|
580
|
-
messageDescription: "Please ensure the image is clear and well-focused",
|
|
581
|
-
errorKey: ID_ERROR_CODES.LOW_SHARPNESS
|
|
582
|
-
};
|
|
583
|
-
if (response.glare !== void 0 && response.glare < GLARE_THRESHOLD && !sessionState?.skipGlareFront && !sessionState?.skipGlareBack) return {
|
|
584
|
-
error: true,
|
|
585
|
-
message: "Glare detected on ID",
|
|
586
|
-
messageDescription: "Please avoid bright reflections on your ID",
|
|
587
|
-
errorKey: ID_ERROR_CODES.GLARE_DETECTED
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
async function getExtraImages(params) {
|
|
591
|
-
const extraImages = params.ageAssurance ? [params.type === "back" ? "croppedBackID" : "croppedFrontID"] : [];
|
|
592
|
-
try {
|
|
593
|
-
const res = await api.post(endpoints.getImages, { images: ["croppedIDFace", ...extraImages] }, { signal: params.signal });
|
|
594
|
-
if (!res.ok) throw new Error(`Failed to get extra images: ${res.status}`);
|
|
595
|
-
return res.data ?? {
|
|
596
|
-
croppedIDFace: "",
|
|
597
|
-
croppedFrontID: "",
|
|
598
|
-
croppedBackID: ""
|
|
599
|
-
};
|
|
600
|
-
} catch {
|
|
601
|
-
return {
|
|
602
|
-
croppedIDFace: "",
|
|
603
|
-
croppedFrontID: "",
|
|
604
|
-
croppedBackID: ""
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
const getRealQualityValue = (value) => (1 - value) * 100;
|
|
609
|
-
async function uploadIdImage(params) {
|
|
610
|
-
const { type, image, onProgress, signal, metadata, ageAssurance, glare, sharpness, shouldSkipGlareBack, analyticsProvider, imageData, isSecondId, onlyFront, extractIdFace } = params;
|
|
611
|
-
let finalMetadata = metadata;
|
|
612
|
-
if (analyticsProvider && imageData) try {
|
|
613
|
-
await analyticsProvider.analyzeFrame(imageData);
|
|
614
|
-
analyticsProvider.update();
|
|
615
|
-
finalMetadata = analyticsProvider.getMetadata();
|
|
616
|
-
} catch (error) {
|
|
617
|
-
console.warn("[IdCapture] Analytics failed:", error);
|
|
618
|
-
}
|
|
619
|
-
const endpoint = getUploadEndpoint(type, isSecondId);
|
|
620
|
-
const body = {
|
|
621
|
-
base64Image: image,
|
|
622
|
-
metadata: finalMetadata
|
|
623
|
-
};
|
|
624
|
-
const queryParams = { imageType: "id" };
|
|
625
|
-
if (onlyFront && type === "front") queryParams.onlyFront = true;
|
|
626
|
-
if (shouldSkipGlareBack && type === "back") queryParams.glare = 0;
|
|
627
|
-
else if (glare !== void 0) queryParams.glare = getRealQualityValue(glare);
|
|
628
|
-
if (sharpness !== void 0) queryParams.sharpness = getRealQualityValue(sharpness);
|
|
629
|
-
if (extractIdFace === false && type === "front") queryParams.extractIdFace = false;
|
|
630
|
-
try {
|
|
631
|
-
const res = await api.post(endpoint, body, {
|
|
632
|
-
signal,
|
|
633
|
-
query: queryParams,
|
|
634
|
-
onUploadProgress: onProgress
|
|
635
|
-
});
|
|
636
|
-
if (!res.ok) throw new Error(`POST ${endpoint} failed: ${res.status} ${res.statusText}`);
|
|
637
|
-
const response = res.data;
|
|
638
|
-
const extraImages = await getExtraImages({
|
|
639
|
-
type,
|
|
640
|
-
ageAssurance,
|
|
641
|
-
signal
|
|
642
|
-
});
|
|
643
|
-
const fullResponse = {
|
|
644
|
-
...response,
|
|
645
|
-
originalImage: image,
|
|
646
|
-
frontIdImage: type === "front" ? image : void 0,
|
|
647
|
-
backIdImage: extraImages.croppedBackID,
|
|
648
|
-
...extraImages
|
|
649
|
-
};
|
|
650
|
-
onProgress?.(100);
|
|
651
|
-
return fullResponse;
|
|
652
|
-
} catch (error) {
|
|
653
|
-
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
654
|
-
throw new Error(`${ID_ERROR_CODES.UPLOAD_ERROR}: ${errorMessage}`);
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
function buildStandardResolution(width, height) {
|
|
658
|
-
return height > width ? {
|
|
659
|
-
width: 1080,
|
|
660
|
-
height: 1920
|
|
661
|
-
} : {
|
|
662
|
-
width: 1920,
|
|
663
|
-
height: 1080
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
function buildResolutionFromStream(stream) {
|
|
667
|
-
const track = stream.getVideoTracks()[0];
|
|
668
|
-
if (!track) return "1080x1920";
|
|
669
|
-
const settings = track.getSettings();
|
|
670
|
-
const width = settings.width;
|
|
671
|
-
const height = settings.height;
|
|
672
|
-
if (typeof width === "number" && typeof height === "number") {
|
|
673
|
-
const standard = buildStandardResolution(width, height);
|
|
674
|
-
return `${standard.width}x${standard.height}`;
|
|
675
|
-
}
|
|
676
|
-
return "1080x1920";
|
|
677
|
-
}
|
|
678
|
-
function preloadIdRecordingProvider(config) {
|
|
679
|
-
if (config.enableIdRecording !== true) return;
|
|
680
|
-
preloadOpenViduProvider();
|
|
681
|
-
}
|
|
682
|
-
async function createOpenViduRecordingProvider() {
|
|
683
|
-
const { OpenViduRecordingProvider } = await import("./OpenViduRecordingProvider-CK6A5kiU.esm.js");
|
|
684
|
-
return new OpenViduRecordingProvider();
|
|
685
|
-
}
|
|
686
|
-
async function startRecordingSession(params) {
|
|
687
|
-
if (params.config.enableIdRecording !== true) return;
|
|
688
|
-
if (params.existing) return params.existing;
|
|
689
|
-
const provider = params.config.recording?.capability ?? await createOpenViduRecordingProvider();
|
|
690
|
-
const clonedStream = params.stream.clone();
|
|
691
|
-
const hasAudio = clonedStream.getAudioTracks().length > 0;
|
|
692
|
-
const resolution = buildResolutionFromStream(clonedStream);
|
|
693
|
-
const session = await createRecordingSession(params.type);
|
|
694
|
-
const connection = await provider.connect({
|
|
695
|
-
sessionToken: session.token,
|
|
696
|
-
stream: clonedStream,
|
|
697
|
-
events: {}
|
|
698
|
-
});
|
|
699
|
-
await startRecording({
|
|
700
|
-
videoRecordingId: session.videoRecordingId,
|
|
701
|
-
type: params.type,
|
|
702
|
-
resolution,
|
|
703
|
-
hasAudio
|
|
704
|
-
});
|
|
705
|
-
return {
|
|
706
|
-
token: session.token,
|
|
707
|
-
sessionId: session.sessionId,
|
|
708
|
-
videoRecordingId: session.videoRecordingId,
|
|
709
|
-
connection,
|
|
710
|
-
resolution,
|
|
711
|
-
hasAudio
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
function stopRecording(session) {
|
|
715
|
-
(async () => {
|
|
716
|
-
try {
|
|
717
|
-
await stopRecording$1(session.videoRecordingId);
|
|
718
|
-
} finally {
|
|
719
|
-
await session.connection.disconnect();
|
|
720
|
-
}
|
|
721
|
-
})();
|
|
722
|
-
}
|
|
723
|
-
async function processId(isSecondId = false, queueName = "", signal) {
|
|
724
|
-
const endpoint = isSecondId ? endpoints.processSecondId : endpoints.processId;
|
|
725
|
-
const url = queueName ? `${endpoint}?queueName=${queueName}` : endpoint;
|
|
726
|
-
return { isDocumentExpired: (await api.post(url, {}, { signal })).data?.isDocumentExpired ?? false };
|
|
727
|
-
}
|
|
728
|
-
/**
|
|
729
|
-
* Upload a user-selected image as front / back / passport ID.
|
|
730
|
-
*
|
|
731
|
-
* Uses the same request shape as the live-camera path (`uploadIdImage`):
|
|
732
|
-
* JSON body `{ base64Image }` with default application/json Content-Type,
|
|
733
|
-
* `captureType=UPLOAD` query param, `retry=true` when retrying.
|
|
734
|
-
* Back is POSTed to `/omni/add/back-id/v2` (or `/omni/add/back-second-id/v2`
|
|
735
|
-
* when `isSecondId`); front and passport go to `/omni/add/front-id/v2` (or
|
|
736
|
-
* `/omni/add/front-second-id/v2` when `isSecondId`).
|
|
737
|
-
*
|
|
738
|
-
* The v2 endpoints reject raw `image/jpeg` bodies with 415, so the caller
|
|
739
|
-
* must convert the File to base64 before calling this service.
|
|
740
|
-
*/
|
|
741
|
-
async function uploadManualIdFile(params) {
|
|
742
|
-
const { side, base64Image, retry, onlyFront, signal, isSecondId, extractIdFace } = params;
|
|
743
|
-
const endpoint = getUploadEndpoint(side === "back" ? "back" : "front", isSecondId);
|
|
744
|
-
const queryParams = { captureType: "UPLOAD" };
|
|
745
|
-
if (retry) queryParams.retry = true;
|
|
746
|
-
if (onlyFront && side === "front") queryParams.onlyFront = true;
|
|
747
|
-
if (extractIdFace === false && side !== "back") queryParams.extractIdFace = false;
|
|
748
|
-
const res = await api.post(endpoint, { base64Image }, {
|
|
749
|
-
signal,
|
|
750
|
-
query: queryParams
|
|
751
|
-
});
|
|
752
|
-
if (!res.ok) throw new Error(`POST ${endpoint} failed: ${res.status} ${res.statusText}`);
|
|
753
|
-
return res.data;
|
|
754
|
-
}
|
|
755
|
-
|
|
756
412
|
//#endregion
|
|
757
413
|
//#region src/modules/id/manualUpload/manualUploadServices.ts
|
|
758
414
|
const stripDataUrlPrefix = (dataUrl) => {
|
|
@@ -768,14 +424,14 @@ const getBase64PayloadByteLength = (payload) => {
|
|
|
768
424
|
};
|
|
769
425
|
const isBase64PayloadWithinSize = (payload, maxBytes) => getBase64PayloadByteLength(payload) <= maxBytes;
|
|
770
426
|
const fileToBase64Payload = async (file) => {
|
|
771
|
-
|
|
427
|
+
const dataUrl = await imageFileToDataUrl(file);
|
|
428
|
+
return stripDataUrlPrefix(dataUrl);
|
|
772
429
|
};
|
|
773
|
-
|
|
774
430
|
//#endregion
|
|
775
431
|
//#region src/modules/id/manualUpload/manualUploadStateMachine.ts
|
|
776
432
|
const uploadManualFileActor = fromPromise(async ({ input, signal }) => {
|
|
777
433
|
const base64Image = await fileToBase64Payload(input.file);
|
|
778
|
-
if (!isBase64PayloadWithinSize(base64Image,
|
|
434
|
+
if (!isBase64PayloadWithinSize(base64Image, 5242880)) return { type: "fileTooLarge" };
|
|
779
435
|
return {
|
|
780
436
|
type: "uploaded",
|
|
781
437
|
response: await uploadManualIdFile({
|
|
@@ -796,7 +452,7 @@ const getUploadResponseFromEvent = (event) => {
|
|
|
796
452
|
const output = getUploadOutputFromEvent(event);
|
|
797
453
|
return output?.type === "uploaded" ? output.response : void 0;
|
|
798
454
|
};
|
|
799
|
-
const
|
|
455
|
+
const manualUploadMachine = setup({
|
|
800
456
|
types: {
|
|
801
457
|
context: {},
|
|
802
458
|
events: {},
|
|
@@ -1102,84 +758,25 @@ const _manualUploadMachine = setup({
|
|
|
1102
758
|
}
|
|
1103
759
|
}
|
|
1104
760
|
});
|
|
1105
|
-
const manualUploadMachine = _manualUploadMachine;
|
|
1106
|
-
|
|
1107
|
-
//#endregion
|
|
1108
|
-
//#region src/modules/id/manualUpload/instrumentation.ts
|
|
1109
|
-
/**
|
|
1110
|
-
* Maps an ID Manual Upload child-machine snapshot to the exact Figma
|
|
1111
|
-
* "Tracked Events" screen name. Source: ID Manual Upload Figma file
|
|
1112
|
-
* (`https://www.figma.com/design/WCx6d4zXG5nu946mu0KZNO/ID-Manual-Upload---Latest-Design?node-id=2462-18986`).
|
|
1113
|
-
*
|
|
1114
|
-
* Family is `IDmanual.*` — emitted cross-family under the parent
|
|
1115
|
-
* `idCapture` module token (same precedent as `uploadDigitalid.*` from
|
|
1116
|
-
* the digital-upload sub-flow). Manual upload has no standalone manager
|
|
1117
|
-
* or module token of its own.
|
|
1118
|
-
*
|
|
1119
|
-
* The mapper returns Figma-verbatim strings (e.g.
|
|
1120
|
-
* `'IDmanual.upload.uploadedFrontandBack'`) which the adapter emits as-is
|
|
1121
|
-
* on `event.screen`. See `docs/patterns/INSTRUMENTATION.md`.
|
|
1122
|
-
*
|
|
1123
|
-
* In-scope Figma screens (driven from child SM state + context):
|
|
1124
|
-
*
|
|
1125
|
-
* - `IDmanual.upload.default` — selecting, ID tab, no front file yet
|
|
1126
|
-
* - `IDmanual.upload.uploadedFront` — selecting, ID tab, front uploaded,
|
|
1127
|
-
* back still needed
|
|
1128
|
-
* - `IDmanual.upload.uploadedFrontandBack` — selecting, ID tab, both
|
|
1129
|
-
* sides uploaded (or `onlyFront`/`skipBackFromServer` short-circuit)
|
|
1130
|
-
* - `IDmanual.upload.passport` — selecting, passport tab, no file
|
|
1131
|
-
* - `IDmanual.upload.uploadedPassport` — selecting, passport tab,
|
|
1132
|
-
* passport uploaded
|
|
1133
|
-
* - `IDmanual.error.document` — selecting, with a populated
|
|
1134
|
-
* `errorMessage`
|
|
1135
|
-
*
|
|
1136
|
-
* Figma screens intentionally NOT mapped here (parent-level surfaces or
|
|
1137
|
-
* shared with other families):
|
|
1138
|
-
*
|
|
1139
|
-
* - `IDmanual.documentchooser.default` / `IDmanual.howtoverify` —
|
|
1140
|
-
* the chooser and the "how to verify" tutorial are PARENT-LEVEL
|
|
1141
|
-
* `idCapture` surfaces (one shared React component, fired BEFORE the
|
|
1142
|
-
* user picks manual-vs-digital). The Upload Digital ID canvas
|
|
1143
|
-
* describes the same physical pixels under its own family name.
|
|
1144
|
-
* Decision (Option A, recorded in `.cursor/commands/sync-events.md`):
|
|
1145
|
-
* keep emitting the neutral parent names `idCapture.documentchooser`
|
|
1146
|
-
* and `idCapture.tutorial.{front,back,passport}` and treat the
|
|
1147
|
-
* per-canvas Figma names as design-side aliases. Per-flow attribution
|
|
1148
|
-
* would require a `selectedDocumentType`-aware override at the parent
|
|
1149
|
-
* dispatcher — explicitly NOT shipped here.
|
|
1150
|
-
* - `digitalID.success.default` — appears on the canvas for reference,
|
|
1151
|
-
* but the actual success surface is emitted by `mapDigitalIdScreenName`
|
|
1152
|
-
* as `uploadDigitalid.success.default`. Manual upload has no dedicated
|
|
1153
|
-
* success screen; `finished` returns control to the parent SM.
|
|
1154
|
-
*
|
|
1155
|
-
* Returns `undefined` for transient (`uploadingFront`/`uploadingBack`/
|
|
1156
|
-
* `uploadingPassport`/`checkRetries`) and terminal (`retriesExhausted`/
|
|
1157
|
-
* `exhausted`/`finished`) states — the parent dispatcher falls back to
|
|
1158
|
-
* its existing default (`idCapture.manualIdUpload`) for those beats.
|
|
1159
|
-
*/
|
|
1160
|
-
function mapIdManualUploadScreenName(value, context) {
|
|
1161
|
-
if (value !== "selecting" || context === void 0) return;
|
|
1162
|
-
if (context.errorMessage !== null) return "IDmanual.error.document";
|
|
1163
|
-
if (context.activeTab === "passport") return context.passportUploaded ? "IDmanual.upload.uploadedPassport" : "IDmanual.upload.passport";
|
|
1164
|
-
if (!context.frontUploaded) return "IDmanual.upload.default";
|
|
1165
|
-
if (context.backUploaded || context.skipBackFromServer || context.onlyFront) return "IDmanual.upload.uploadedFrontandBack";
|
|
1166
|
-
return "IDmanual.upload.uploadedFront";
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
761
|
//#endregion
|
|
1170
762
|
//#region src/modules/id/idCaptureGuards.ts
|
|
763
|
+
function getPermissionOutput(event) {
|
|
764
|
+
if (!("output" in event)) return;
|
|
765
|
+
const { output } = event;
|
|
766
|
+
if (typeof output === "object" && output !== null && "permissionResult" in output) return output.permissionResult;
|
|
767
|
+
return output;
|
|
768
|
+
}
|
|
1171
769
|
const hasShowTutorialGuard = ({ context }) => context.config.showTutorial;
|
|
1172
770
|
const hasAgeAssuranceGuard = ({ context }) => context.config.ageAssurance === true;
|
|
1173
771
|
const hasShowDocumentChooserGuard = ({ context }) => !context.config.onlyBack && (context.config.showDocumentChooserScreen ?? false);
|
|
1174
772
|
const isPermissionGrantedGuard = ({ event }) => {
|
|
1175
|
-
|
|
1176
|
-
return false;
|
|
773
|
+
return getPermissionOutput(event) === "granted";
|
|
1177
774
|
};
|
|
1178
775
|
const isReadyForCaptureGuard = ({ context, event }) => {
|
|
1179
|
-
return isReadyForCaptureFromPermission(resolveStoredPermissionResult(
|
|
776
|
+
return isReadyForCaptureFromPermission(resolveStoredPermissionResult(getPermissionOutput(event), context.permissionResult), context.config.ds);
|
|
1180
777
|
};
|
|
1181
778
|
const needsMotionPrimeOnlyGuard = ({ context, event }) => {
|
|
1182
|
-
return needsMotionPrimeOnlyFromPermission(resolveStoredPermissionResult(
|
|
779
|
+
return needsMotionPrimeOnlyFromPermission(resolveStoredPermissionResult(getPermissionOutput(event), context.permissionResult), context.config.ds);
|
|
1183
780
|
};
|
|
1184
781
|
const isPermissionDeniedErrorGuard = ({ event }) => {
|
|
1185
782
|
if ("error" in event) {
|
|
@@ -1189,6 +786,7 @@ const isPermissionDeniedErrorGuard = ({ event }) => {
|
|
|
1189
786
|
return false;
|
|
1190
787
|
};
|
|
1191
788
|
const hasStreamGuard = ({ context }) => context.stream !== void 0;
|
|
789
|
+
const hasInitializedCameraGuard = ({ context }) => context.stream !== void 0 && context.provider !== void 0;
|
|
1192
790
|
const hasAttemptsRemainingGuard = ({ context }) => context.attemptsRemaining > 0;
|
|
1193
791
|
const hasCapturedImageGuard = ({ context }) => {
|
|
1194
792
|
return context.provider?.getCapturedCanvas() !== null;
|
|
@@ -1202,15 +800,31 @@ const hasUploadValidationErrorGuard = ({ context }) => {
|
|
|
1202
800
|
};
|
|
1203
801
|
const isFrontModeGuard = ({ context }) => context.currentMode === "front" || context.currentMode === "passport";
|
|
1204
802
|
/**
|
|
1205
|
-
*
|
|
1206
|
-
*
|
|
1207
|
-
*
|
|
1208
|
-
*
|
|
1209
|
-
* `
|
|
1210
|
-
*
|
|
1211
|
-
*
|
|
803
|
+
* Single client-side authority on whether a back side is needed.
|
|
804
|
+
*
|
|
805
|
+
* `config.onlyFront` is deliberately NOT read here. The flag is forwarded to
|
|
806
|
+
* the backend as `?onlyFront=true` on the front upload
|
|
807
|
+
* (`idCaptureStateMachine` → `uploadIdImage`), and the backend answers with
|
|
808
|
+
* `skipBackIdCapture` after resolving the real per-document policy — which the
|
|
809
|
+
* flow-level flag cannot account for (`perCountryPerDocOverrides`). Honoring
|
|
810
|
+
* `onlyFront` client-side here was the ENG-45236 bug (PR #413): it skipped the
|
|
811
|
+
* back for documents that genuinely need both sides.
|
|
812
|
+
*
|
|
813
|
+
* Note `currentMode === 'passport'` is allowed through: passports are not
|
|
814
|
+
* implicitly single-side and can require a back (PR #269).
|
|
815
|
+
*
|
|
816
|
+
* The rule for when a client-side read IS legitimate (see
|
|
817
|
+
* `docs/features/ID_CAPTURE_FLOWS.md`):
|
|
818
|
+
* 1. read `config.onlyFront` only where the decision must be made before a
|
|
819
|
+
* server answer exists, and
|
|
820
|
+
* 2. where you do, still self-correct once the answer arrives.
|
|
821
|
+
*
|
|
822
|
+
* Two variants qualify under (1): the captureOnly machine
|
|
823
|
+
* (`idCaptureOnlyStateMachine` — no upload, so no answer ever exists) and the
|
|
824
|
+
* manual-upload sub-machine (slot visibility precedes any upload, and it ORs
|
|
825
|
+
* `skipBackFromServer` afterwards to satisfy (2)). This guard is on neither
|
|
826
|
+
* path — the answer is already in hand by the time it runs.
|
|
1212
827
|
*/
|
|
1213
|
-
const isOnlyFrontGuard = (_args) => false;
|
|
1214
828
|
const shouldContinueToBackGuard = ({ context }) => {
|
|
1215
829
|
if (context.currentMode !== "front" && context.currentMode !== "passport") return false;
|
|
1216
830
|
if (context.config.onlyBack) return false;
|
|
@@ -1220,6 +834,17 @@ const shouldContinueToBackGuard = ({ context }) => {
|
|
|
1220
834
|
};
|
|
1221
835
|
const shouldContinueToFrontGuard = ({ context }) => context.config.usSmartCapture === true && context.currentMode === "back" && context.uploadResponse?.forceFrontIdCapture === true;
|
|
1222
836
|
const hasMandatoryConsentGuard = ({ context }) => context.uploadResponse?.showMandatoryConsent === true;
|
|
837
|
+
/**
|
|
838
|
+
* Capture-result-preview feedback mode, resolved once per session by
|
|
839
|
+
* `resolveCaptureResultPreviewTreatment` at actor creation.
|
|
840
|
+
*/
|
|
841
|
+
const isCaptureResultPreviewModeGuard = ({ context }) => context.captureFeedbackMode === "result-preview";
|
|
842
|
+
/**
|
|
843
|
+
* Whether the rendering layer opted into handling `resultPreview` and
|
|
844
|
+
* advancing it with `manager.nextStep()`. Headless consumers that omit this
|
|
845
|
+
* capability retain the direct capture-to-upload path.
|
|
846
|
+
*/
|
|
847
|
+
const supportsCaptureResultPreviewGuard = ({ context }) => context.config.supportsCaptureResultPreview === true;
|
|
1223
848
|
const isDeepsightEnabledGuard = ({ context }) => context.dependencies !== void 0;
|
|
1224
849
|
const isDeepsightReadyGuard = ({ context }) => context.deepsightService !== void 0;
|
|
1225
850
|
const needsDeepsightInitGuard = ({ context }) => context.dependencies !== void 0 && context.deepsightService === void 0 && !context.deepsightInitAttempted;
|
|
@@ -1230,30 +855,6 @@ const isManualIdUploadSelectedGuard = ({ event }) => event.type === "SELECT_DOCU
|
|
|
1230
855
|
const isDigitalIdUploadSelectedGuard = ({ event }) => event.type === "SELECT_DOCUMENT" && event.documentType === "digitalIdUpload";
|
|
1231
856
|
const isUploadExpiredGuard = ({ context }) => context.uploadResponse?.isDocumentExpired === true;
|
|
1232
857
|
/**
|
|
1233
|
-
* Fixed cap on same-side expired retries, intentionally decoupled from the
|
|
1234
|
-
* dashboard-configurable `captureAttempts`.
|
|
1235
|
-
*
|
|
1236
|
-
* Business decision: the expired-ID retry policy is a fixed UX limit ("let the
|
|
1237
|
-
* user try a different ID a bounded number of times"), separate from the
|
|
1238
|
-
* generic capture-quality retry budget. The value `3` and this separation are
|
|
1239
|
-
* prescribed by the ENG-41643 spec — "[WEB] Document FE - Handle Expired ID
|
|
1240
|
-
* Errors on Front and Back ID Capture"
|
|
1241
|
-
* (https://app.notion.com/p/3264c3caef498080a44adf5ab62fcb77): *"Add
|
|
1242
|
-
* `MAX_EXPIRED_FIRST_SIDE_ATTEMPTS = 3` constant"* / *"Allow up to 3 attempts
|
|
1243
|
-
* when expired ID is detected on first side capture"*. SDK V1 implements it as
|
|
1244
|
-
* exactly this hardcoded constant (incode-welcome `Capture.tsx`), independent
|
|
1245
|
-
* of the configured capture-attempts; this restores that parity for ENG-46592
|
|
1246
|
-
* (https://app.notion.com/p/36b4c3caef4980f58f3ee3b1b4e234f2).
|
|
1247
|
-
*
|
|
1248
|
-
* NOTE: ENG-45666's acceptance text says the cap should follow "a specified
|
|
1249
|
-
* number of times if differently set on dashboard/SDK level". That wording
|
|
1250
|
-
* conflicts with the ENG-41643 spec + V1 for the *expired* path specifically;
|
|
1251
|
-
* V1 parity was chosen as source of truth here (see changeset
|
|
1252
|
-
* `eng-46592-r2-expired-id-v1-parity`). The configurable `captureAttempts`
|
|
1253
|
-
* still governs generic (non-expired) capture retries.
|
|
1254
|
-
*/
|
|
1255
|
-
const MAX_EXPIRED_FIRST_SIDE_ATTEMPTS = 3;
|
|
1256
|
-
/**
|
|
1257
858
|
* True when *this* expired upload will exhaust the same-side expired budget.
|
|
1258
859
|
* Compares the post-increment count, so the exhaustion branch can be picked in
|
|
1259
860
|
* the same tick that runs `incrementExpiredAttempts`:
|
|
@@ -1261,7 +862,7 @@ const MAX_EXPIRED_FIRST_SIDE_ATTEMPTS = 3;
|
|
|
1261
862
|
* - attempt 2 → 1+1=2 (not exhausted)
|
|
1262
863
|
* - attempt 3 → 2+1=3 (exhausted, force-back / finish)
|
|
1263
864
|
*/
|
|
1264
|
-
const isExpiredAttemptsExhaustedGuard = ({ context }) => context.expiredAttempts + 1 >=
|
|
865
|
+
const isExpiredAttemptsExhaustedGuard = ({ context }) => context.expiredAttempts + 1 >= 3;
|
|
1265
866
|
const isNotPassportModeGuard = ({ context }) => context.currentMode !== "passport";
|
|
1266
867
|
/**
|
|
1267
868
|
* V1 parity for `shouldApplyAlwaysCaptureBackOverride` — force-redirects to
|
|
@@ -1276,6 +877,22 @@ const shouldForceBackOnExpiredGuard = ({ context }) => context.currentMode === "
|
|
|
1276
877
|
const wasExpiredFromUploadGuard = ({ context }) => context.expiredFromUpload === true;
|
|
1277
878
|
const shouldSkipProcessIdGuard = ({ context }) => context.skipProcessId === true;
|
|
1278
879
|
/**
|
|
880
|
+
* US Smart Capture: after the back best-frame is captured, submit the decoded
|
|
881
|
+
* PDF417 barcode (instead of uploading the full frame) when one was decoded on
|
|
882
|
+
* the back side. Gated exactly as SDK 1 (`usSmartCapture && isBackId`), plus a
|
|
883
|
+
* non-empty decoded payload.
|
|
884
|
+
*/
|
|
885
|
+
const shouldSubmitBarcodeGuard = ({ context }) => context.currentMode === "back" && context.config.usSmartCapture === true && !!context.decodedBarcode?.text;
|
|
886
|
+
/**
|
|
887
|
+
* US Smart Capture pre-capture fast path: submit the decoded PDF417 barcode the
|
|
888
|
+
* instant it is decoded, before the best-frame auto-capture completes. Reads the
|
|
889
|
+
* barcode from the EVENT — the guard runs before the store action, so
|
|
890
|
+
* `context.decodedBarcode` isn't populated yet. One-shot per attempt via
|
|
891
|
+
* `barcodeFastPathAttempted` (a later best-frame decode falls through to the
|
|
892
|
+
* regular `shouldSubmitBarcode` path).
|
|
893
|
+
*/
|
|
894
|
+
const canRunBarcodeFastPathGuard = ({ context, event }) => context.currentMode === "back" && context.config.usSmartCapture === true && !context.barcodeFastPathAttempted && !!event.decoded?.text;
|
|
895
|
+
/**
|
|
1279
896
|
* Bug 4 fix: when `expiredExhausted` is reached via the per-upload-expired
|
|
1280
897
|
* exhaustion path with a back side captured (or the entire single-side back
|
|
1281
898
|
* flow), we want `processId` to run once on Continue so the backend
|
|
@@ -1316,7 +933,6 @@ const isBackModeInMultiSideFlowGuard = ({ context }) => context.currentMode ===
|
|
|
1316
933
|
* max-attempts/OCR cap (ENG-46592 / re-respects ENG-45666).
|
|
1317
934
|
*/
|
|
1318
935
|
const wasExpiredRedirectedGuard = ({ context }) => context.expiredRedirected === true;
|
|
1319
|
-
|
|
1320
936
|
//#endregion
|
|
1321
937
|
//#region src/modules/id/idCaptureHelpers.ts
|
|
1322
938
|
/**
|
|
@@ -1357,14 +973,55 @@ function getManualUploadTabs(config) {
|
|
|
1357
973
|
showPassportTab
|
|
1358
974
|
};
|
|
1359
975
|
}
|
|
1360
|
-
|
|
976
|
+
/**
|
|
977
|
+
* Computes `idCaptureMachine`'s terminal output — the downstream module-skip
|
|
978
|
+
* signal read by the Flow orchestrator (via `runChildModule`'s `MODULE_COMPLETE`).
|
|
979
|
+
*
|
|
980
|
+
* `skipFaceMatch` is set ONLY for the US Smart Capture *camera back-only* path:
|
|
981
|
+
* a back image was captured on-device (`capturedImages.back`) and no front was
|
|
982
|
+
* (`!capturedImages.front`) — "no front, no ID face, no match".
|
|
983
|
+
*
|
|
984
|
+
* Requiring a captured back is deliberate and load-bearing: the manual-upload
|
|
985
|
+
* and digital-ID-upload paths submit a full ID (front face present) but do NOT
|
|
986
|
+
* populate `capturedImages` (only the camera path does). Gating on a captured
|
|
987
|
+
* back excludes those upload paths so a real ID-vs-selfie match is never
|
|
988
|
+
* silently skipped. `capturedImages.front`/`forceFrontIdCapture` alone are not
|
|
989
|
+
* enough (a later front upload clears the request; uploads set neither field).
|
|
990
|
+
*
|
|
991
|
+
* Always `false` outside US Smart Capture. The selfie/face capture itself is
|
|
992
|
+
* unaffected — only the ID-vs-selfie match is skipped.
|
|
993
|
+
*/
|
|
994
|
+
function computeIdCaptureOutput(context) {
|
|
995
|
+
const frontIdCaptured = Boolean(context.capturedImages.front);
|
|
996
|
+
const backIdCaptured = Boolean(context.capturedImages.back);
|
|
997
|
+
return {
|
|
998
|
+
frontIdCaptured,
|
|
999
|
+
skipFaceMatch: context.config.usSmartCapture === true && backIdCaptured && !frontIdCaptured
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1361
1002
|
//#endregion
|
|
1362
1003
|
//#region src/modules/id/idCaptureActors.ts
|
|
1363
1004
|
const checkPermissionActor = fromPromise(async () => {
|
|
1364
1005
|
return checkPermission();
|
|
1365
1006
|
});
|
|
1007
|
+
async function requestIdCapturePermission(input) {
|
|
1008
|
+
if (!isAndroid() || getBrowser() !== "firefox") return invokeRequestPermissionActor(input);
|
|
1009
|
+
if (input.requestMotionPermission) {
|
|
1010
|
+
const motionResult = await invokeRequestPermissionActor({
|
|
1011
|
+
...input,
|
|
1012
|
+
permissionResult: "granted"
|
|
1013
|
+
});
|
|
1014
|
+
if (motionResult !== "granted") return motionResult;
|
|
1015
|
+
}
|
|
1016
|
+
const { stream, fallbackLevel } = await getIdCameraStream();
|
|
1017
|
+
return {
|
|
1018
|
+
permissionResult: "granted",
|
|
1019
|
+
stream,
|
|
1020
|
+
cameraFallbackLevel: fallbackLevel
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1366
1023
|
const requestPermissionActor = fromPromise(async ({ input }) => {
|
|
1367
|
-
return
|
|
1024
|
+
return requestIdCapturePermission(input);
|
|
1368
1025
|
});
|
|
1369
1026
|
const initializeCameraActor = fromPromise(async ({ input }) => {
|
|
1370
1027
|
return initializeIdCapture(input);
|
|
@@ -1407,6 +1064,7 @@ const runDetectionActor = fromCallback(({ input, sendBack }) => {
|
|
|
1407
1064
|
if (notificationTimeout && currentNotificationStatus !== status) return;
|
|
1408
1065
|
if (notificationTimeout && currentNotificationStatus === status) timer.clearTimeout(notificationTimeout);
|
|
1409
1066
|
currentNotificationStatus = status;
|
|
1067
|
+
trueSightHintTransition("module.id-capture", "idScan", status);
|
|
1410
1068
|
sendBack({
|
|
1411
1069
|
type: "DETECTION_UPDATE",
|
|
1412
1070
|
status
|
|
@@ -1457,14 +1115,8 @@ const runDetectionActor = fromCallback(({ input, sendBack }) => {
|
|
|
1457
1115
|
iouCheckEnabled: input.config.settings?.iouCheckEnabled ?? true,
|
|
1458
1116
|
fpsLimitEnabled: input.config.settings?.fpsLimitEnabled ?? false
|
|
1459
1117
|
});
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
...input.config.thresholds,
|
|
1463
|
-
idDetectedTimeout: (input.config.deviceIdleTimeout ?? 10) * 1e3,
|
|
1464
|
-
autocaptureTimeout: (input.config.autoCaptureTimeout ?? 5) * 1e3
|
|
1465
|
-
};
|
|
1466
|
-
provider.setThresholds(thresholds);
|
|
1467
|
-
const modelType = input.config.modelVersion ?? DEFAULT_ID_CAPTURE_MODEL_VERSION;
|
|
1118
|
+
provider.setThresholds(resolveIdCaptureThresholds(input.config));
|
|
1119
|
+
const modelType = input.config.modelVersion ?? "v2";
|
|
1468
1120
|
provider.setModelType(modelType);
|
|
1469
1121
|
provider.setCallbacks({
|
|
1470
1122
|
onFarAway: () => {
|
|
@@ -1484,10 +1136,13 @@ const runDetectionActor = fromCallback(({ input, sendBack }) => {
|
|
|
1484
1136
|
if (!isCapturing) sendNotification("glare");
|
|
1485
1137
|
},
|
|
1486
1138
|
onIdNotDetected: () => {
|
|
1487
|
-
if (!isCapturing)
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1139
|
+
if (!isCapturing) {
|
|
1140
|
+
trueSightHintTransition("module.id-capture", "idScan", "idNotDetected");
|
|
1141
|
+
sendBack({
|
|
1142
|
+
type: "DETECTION_UPDATE",
|
|
1143
|
+
status: "idNotDetected"
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1491
1146
|
},
|
|
1492
1147
|
onSwitchToManualCapture: () => {
|
|
1493
1148
|
isCapturing = false;
|
|
@@ -1497,6 +1152,7 @@ const runDetectionActor = fromCallback(({ input, sendBack }) => {
|
|
|
1497
1152
|
clearNotificationTimeout();
|
|
1498
1153
|
lastReportedSide = null;
|
|
1499
1154
|
isCapturing = true;
|
|
1155
|
+
trueSightHintTransition("module.id-capture", "idScan", "capturing");
|
|
1500
1156
|
sendBack({
|
|
1501
1157
|
type: "DETECTION_UPDATE",
|
|
1502
1158
|
status: "capturing"
|
|
@@ -1528,10 +1184,10 @@ const runDetectionActor = fromCallback(({ input, sendBack }) => {
|
|
|
1528
1184
|
qualityElements: {}
|
|
1529
1185
|
});
|
|
1530
1186
|
},
|
|
1531
|
-
onIdTypeChange: (idType
|
|
1187
|
+
onIdTypeChange: (idType) => {
|
|
1532
1188
|
sendBack({
|
|
1533
1189
|
type: "ID_TYPE_CHANGE",
|
|
1534
|
-
idType
|
|
1190
|
+
idType
|
|
1535
1191
|
});
|
|
1536
1192
|
},
|
|
1537
1193
|
onIdSideChange: (side) => {
|
|
@@ -1548,8 +1204,18 @@ const runDetectionActor = fromCallback(({ input, sendBack }) => {
|
|
|
1548
1204
|
type: "COUNTER_VALUE_CHANGE",
|
|
1549
1205
|
value
|
|
1550
1206
|
});
|
|
1207
|
+
},
|
|
1208
|
+
onBarcodeDecoded: (decoded) => {
|
|
1209
|
+
sendBack({
|
|
1210
|
+
type: "BARCODE_DECODED",
|
|
1211
|
+
decoded
|
|
1212
|
+
});
|
|
1551
1213
|
}
|
|
1552
1214
|
});
|
|
1215
|
+
const barcodeCaptureEnabled = input.config.usSmartCapture === true && input.currentMode === "back";
|
|
1216
|
+
provider.setBarcodeCaptureEnabled(barcodeCaptureEnabled);
|
|
1217
|
+
provider.setBarcodeAutoCaptureOnDecode(false);
|
|
1218
|
+
if (barcodeCaptureEnabled) provider.setBarcodeEnhancementModel().catch(() => {});
|
|
1553
1219
|
sendBack({
|
|
1554
1220
|
type: "DETECTION_UPDATE",
|
|
1555
1221
|
status: "detecting"
|
|
@@ -1559,10 +1225,6 @@ const runDetectionActor = fromCallback(({ input, sendBack }) => {
|
|
|
1559
1225
|
provider: {
|
|
1560
1226
|
processFrame: async (frame) => {
|
|
1561
1227
|
currentCanvas = IncodeCanvas.fromImageData(frame);
|
|
1562
|
-
sendBack({
|
|
1563
|
-
type: "DETECTION_FRAME",
|
|
1564
|
-
frame
|
|
1565
|
-
});
|
|
1566
1228
|
await provider.processFrame(frame);
|
|
1567
1229
|
},
|
|
1568
1230
|
reset: () => {
|
|
@@ -1576,14 +1238,11 @@ const runDetectionActor = fromCallback(({ input, sendBack }) => {
|
|
|
1576
1238
|
storedQualityElements = {};
|
|
1577
1239
|
isCapturing = false;
|
|
1578
1240
|
lastReportedSide = null;
|
|
1579
|
-
provider.
|
|
1241
|
+
provider.resetDetectionState();
|
|
1580
1242
|
}
|
|
1581
|
-
}
|
|
1582
|
-
onFrame: (frame) => sendBack({
|
|
1583
|
-
type: "DETECTION_FRAME",
|
|
1584
|
-
frame
|
|
1585
|
-
})
|
|
1243
|
+
}
|
|
1586
1244
|
});
|
|
1245
|
+
noteTrueSightCaptureActivity(true);
|
|
1587
1246
|
sendBack({
|
|
1588
1247
|
type: "DETECTION_RESET_READY",
|
|
1589
1248
|
reset: () => {
|
|
@@ -1593,8 +1252,16 @@ const runDetectionActor = fromCallback(({ input, sendBack }) => {
|
|
|
1593
1252
|
return () => {
|
|
1594
1253
|
clearNotificationTimeout();
|
|
1595
1254
|
session?.dispose();
|
|
1255
|
+
noteTrueSightCaptureActivity(false);
|
|
1596
1256
|
};
|
|
1597
1257
|
});
|
|
1258
|
+
const uploadProgressTickerActor = fromCallback(({ sendBack }) => {
|
|
1259
|
+
const timer = BrowserTimerProvider.getInstance();
|
|
1260
|
+
const interval = timer.setInterval(() => {
|
|
1261
|
+
sendBack({ type: "UPLOAD_PROGRESS_TICK" });
|
|
1262
|
+
}, 400);
|
|
1263
|
+
return () => timer.clearInterval(interval);
|
|
1264
|
+
});
|
|
1598
1265
|
const uploadIdImageActor = fromPromise(async ({ input, signal }) => {
|
|
1599
1266
|
const image = input.canvas.getBase64Image();
|
|
1600
1267
|
if (!image) throw new Error(ID_ERROR_CODES.UPLOAD_ERROR);
|
|
@@ -1603,8 +1270,8 @@ const uploadIdImageActor = fromPromise(async ({ input, signal }) => {
|
|
|
1603
1270
|
const sessionToken = getToken();
|
|
1604
1271
|
const frameSource = input.type === "back" ? "BACK_ID" : "FRONT_ID";
|
|
1605
1272
|
await input.deepsightService.performVirtualCameraCheck(sessionToken, frameSource);
|
|
1606
|
-
const imageData
|
|
1607
|
-
if (imageData
|
|
1273
|
+
const imageData = input.canvas.getImageData();
|
|
1274
|
+
if (imageData) await input.deepsightService.analyzeFrame(imageData);
|
|
1608
1275
|
const analysisStatus = input.deepsightService.getAnalysisStatus();
|
|
1609
1276
|
const motionStatus = input.deepsightService.getMotionStatus();
|
|
1610
1277
|
if (input.type === "front") await addDeviceStats({
|
|
@@ -1620,7 +1287,9 @@ const uploadIdImageActor = fromPromise(async ({ input, signal }) => {
|
|
|
1620
1287
|
motionStatus
|
|
1621
1288
|
});
|
|
1622
1289
|
metadata = input.deepsightService.getMetadata();
|
|
1623
|
-
} catch {
|
|
1290
|
+
} catch (error) {
|
|
1291
|
+
trueSightLog("warning", "deepsight", "idScan", `deepsight id analysis failed error=${String(error)}`);
|
|
1292
|
+
}
|
|
1624
1293
|
const imageData = input.canvas?.getImageData() ?? void 0;
|
|
1625
1294
|
const logs = input.deepsightService?.getPipelineState() ?? "";
|
|
1626
1295
|
input.dependencies?.trackCaptureAttemptFinished?.({
|
|
@@ -1648,6 +1317,15 @@ const uploadIdImageActor = fromPromise(async ({ input, signal }) => {
|
|
|
1648
1317
|
const processIdActor = fromPromise(async ({ input, signal }) => {
|
|
1649
1318
|
return processId(input.isSecondId, "", signal);
|
|
1650
1319
|
});
|
|
1320
|
+
const submitBarcodeActor = fromPromise(async ({ input, signal }) => {
|
|
1321
|
+
const [response] = await Promise.all([addBarcode({
|
|
1322
|
+
rawBarcode: input.rawBarcode,
|
|
1323
|
+
metrics: input.metrics,
|
|
1324
|
+
processId: input.processId,
|
|
1325
|
+
signal
|
|
1326
|
+
}), input.minDurationMs ? sleep(input.minDurationMs) : Promise.resolve()]);
|
|
1327
|
+
return response;
|
|
1328
|
+
});
|
|
1651
1329
|
const startRecordingActor = fromPromise(async ({ input }) => {
|
|
1652
1330
|
if (!input.stream) return;
|
|
1653
1331
|
const type = input.currentMode === "back" ? "backId" : "frontId";
|
|
@@ -1660,7 +1338,7 @@ const startRecordingActor = fromPromise(async ({ input }) => {
|
|
|
1660
1338
|
});
|
|
1661
1339
|
const initializeDeepsightSessionActor = fromPromise(async ({ input }) => {
|
|
1662
1340
|
if (!input.dependencies) return;
|
|
1663
|
-
const { loadDeepsightSession } = await import("./deepsightLoader-
|
|
1341
|
+
const { loadDeepsightSession } = await import("./deepsightLoader-DcWjMC6A.esm.js");
|
|
1664
1342
|
return loadDeepsightSession({
|
|
1665
1343
|
ds: input.ds,
|
|
1666
1344
|
storage: input.dependencies.storage,
|
|
@@ -1673,7 +1351,6 @@ const checkVirtualCameraActor = fromPromise(async ({ input }) => {
|
|
|
1673
1351
|
if (!videoTrack) return false;
|
|
1674
1352
|
return input.deepsightService.checkVirtualCamera(videoTrack);
|
|
1675
1353
|
});
|
|
1676
|
-
|
|
1677
1354
|
//#endregion
|
|
1678
1355
|
//#region src/modules/id/idCaptureActions.ts
|
|
1679
1356
|
function performStopMediaStream(context) {
|
|
@@ -1699,15 +1376,27 @@ function performResetForFrontCapture(context) {
|
|
|
1699
1376
|
function performResetDetection(context) {
|
|
1700
1377
|
context.resetDetection?.();
|
|
1701
1378
|
}
|
|
1702
|
-
function
|
|
1703
|
-
|
|
1704
|
-
|
|
1379
|
+
function performReportCaptureResultPreviewAssignment(context) {
|
|
1380
|
+
if (context.config.supportsCaptureResultPreview !== true) return;
|
|
1381
|
+
const assignment = exposeExperimentOnce(CAPTURE_RESULT_PREVIEW);
|
|
1382
|
+
if (!assignment) return;
|
|
1383
|
+
recordExperimentAssignmentOnce(eventModuleNames.idCapture, assignment);
|
|
1384
|
+
}
|
|
1705
1385
|
function performStopMediaRecording(context) {
|
|
1706
1386
|
if (context.recordingSession) stopRecording(context.recordingSession);
|
|
1707
1387
|
}
|
|
1708
1388
|
function getStreamFromEvent(event) {
|
|
1709
1389
|
if ("output" in event) return event.output.stream;
|
|
1710
1390
|
}
|
|
1391
|
+
function getPermissionResultFromEvent(event) {
|
|
1392
|
+
if (!("output" in event)) return;
|
|
1393
|
+
const { output } = event;
|
|
1394
|
+
if (output === "granted" || output === "denied" || output === "prompt") return output;
|
|
1395
|
+
if (typeof output === "object" && output !== null && "permissionResult" in output) {
|
|
1396
|
+
const result = output.permissionResult;
|
|
1397
|
+
if (result === "granted" || result === "denied" || result === "prompt") return result;
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1711
1400
|
function getProviderFromEvent(event) {
|
|
1712
1401
|
if ("output" in event) return event.output.provider;
|
|
1713
1402
|
}
|
|
@@ -1737,6 +1426,9 @@ function getResetContextValues(context) {
|
|
|
1737
1426
|
capturedImages: {},
|
|
1738
1427
|
captureOnlyImages: {},
|
|
1739
1428
|
uploadResponse: void 0,
|
|
1429
|
+
decodedBarcode: null,
|
|
1430
|
+
barcodeFastPathAttempted: false,
|
|
1431
|
+
barcodeFastPathCaptured: false,
|
|
1740
1432
|
recordingSession: void 0,
|
|
1741
1433
|
attemptsRemaining: context.config.captureAttempts,
|
|
1742
1434
|
expiredAttempts: 0,
|
|
@@ -1916,7 +1608,39 @@ function getCurrentModeFromEvent(context, event) {
|
|
|
1916
1608
|
if (event.type === "FRONT_COMPLETE") return "back";
|
|
1917
1609
|
return context.currentMode;
|
|
1918
1610
|
}
|
|
1919
|
-
|
|
1611
|
+
/**
|
|
1612
|
+
* Maps an `AddBarcodeV3Response` (US Smart Capture) into a synthetic
|
|
1613
|
+
* `uploadResponse` so the barcode submit path composes with the existing
|
|
1614
|
+
* downstream logic: `shouldContinueToFront` reads `forceFrontIdCapture`, and
|
|
1615
|
+
* `skipProcessId` is derived from `idValidationCompleted`. `classification` /
|
|
1616
|
+
* `readability` are forced `true` (the barcode response carries no image-quality
|
|
1617
|
+
* fields); the barcode path lands on `success` directly, bypassing upload
|
|
1618
|
+
* validation. Only ever *sets* the skip — an existing skip is preserved.
|
|
1619
|
+
*/
|
|
1620
|
+
function getBarcodeResponseValues(context, event) {
|
|
1621
|
+
const output = event.output;
|
|
1622
|
+
return {
|
|
1623
|
+
uploadResponse: {
|
|
1624
|
+
sharpness: 0,
|
|
1625
|
+
correctSharpness: true,
|
|
1626
|
+
glare: 0,
|
|
1627
|
+
correctGlare: true,
|
|
1628
|
+
horizontalResolution: 0,
|
|
1629
|
+
classification: true,
|
|
1630
|
+
readability: true,
|
|
1631
|
+
typeOfId: "",
|
|
1632
|
+
issueYear: 0,
|
|
1633
|
+
issueName: "",
|
|
1634
|
+
sessionStatus: output?.sessionStatus ?? "",
|
|
1635
|
+
countryCode: output?.countryCode ?? "",
|
|
1636
|
+
forceFrontIdCapture: output?.forceFrontIdCapture,
|
|
1637
|
+
idValidationCompleted: output?.idValidationCompleted,
|
|
1638
|
+
isDocumentExpired: output?.isDocumentExpired,
|
|
1639
|
+
success: output?.success
|
|
1640
|
+
},
|
|
1641
|
+
skipProcessId: output?.idValidationCompleted === true || context.skipProcessId
|
|
1642
|
+
};
|
|
1643
|
+
}
|
|
1920
1644
|
//#endregion
|
|
1921
1645
|
//#region src/modules/id/idCaptureStateMachine.ts
|
|
1922
1646
|
/**
|
|
@@ -1930,11 +1654,12 @@ function getIdErrorCodeFromUnknown(error) {
|
|
|
1930
1654
|
return Object.values(ID_ERROR_CODES).find((value) => message.includes(value));
|
|
1931
1655
|
}
|
|
1932
1656
|
}
|
|
1933
|
-
const
|
|
1657
|
+
const idCaptureMachine = setup({
|
|
1934
1658
|
types: {
|
|
1935
1659
|
context: {},
|
|
1936
1660
|
events: {},
|
|
1937
|
-
input: {}
|
|
1661
|
+
input: {},
|
|
1662
|
+
output: {}
|
|
1938
1663
|
},
|
|
1939
1664
|
actors: {
|
|
1940
1665
|
checkPermission: checkPermissionActor,
|
|
@@ -1942,7 +1667,9 @@ const _idCaptureMachine = setup({
|
|
|
1942
1667
|
initializeCamera: initializeCameraActor,
|
|
1943
1668
|
runDetection: runDetectionActor,
|
|
1944
1669
|
uploadIdImage: uploadIdImageActor,
|
|
1670
|
+
uploadProgressTicker: uploadProgressTickerActor,
|
|
1945
1671
|
processId: processIdActor,
|
|
1672
|
+
submitBarcode: submitBarcodeActor,
|
|
1946
1673
|
startRecording: startRecordingActor,
|
|
1947
1674
|
initializeDeepsightSession: initializeDeepsightSessionActor,
|
|
1948
1675
|
checkVirtualCamera: checkVirtualCameraActor,
|
|
@@ -1977,9 +1704,13 @@ const _idCaptureMachine = setup({
|
|
|
1977
1704
|
resetDetection: void 0,
|
|
1978
1705
|
idType: void 0,
|
|
1979
1706
|
qualityElements: void 0,
|
|
1980
|
-
debugFrame: void 0,
|
|
1981
1707
|
frameRect: void 0,
|
|
1982
1708
|
previewImageUrl: void 0,
|
|
1709
|
+
flipPreview: context.previewImageUrl ? {
|
|
1710
|
+
url: context.previewImageUrl,
|
|
1711
|
+
orientation: context.orientation,
|
|
1712
|
+
mode: context.currentMode === "passport" ? "passport" : "id"
|
|
1713
|
+
} : context.flipPreview,
|
|
1983
1714
|
uploadProgress: void 0,
|
|
1984
1715
|
manualCaptureTriggered: false,
|
|
1985
1716
|
attemptsRemaining: context.config.captureAttempts,
|
|
@@ -2002,9 +1733,13 @@ const _idCaptureMachine = setup({
|
|
|
2002
1733
|
resetDetection: void 0,
|
|
2003
1734
|
idType: void 0,
|
|
2004
1735
|
qualityElements: void 0,
|
|
2005
|
-
debugFrame: void 0,
|
|
2006
1736
|
frameRect: void 0,
|
|
2007
1737
|
previewImageUrl: void 0,
|
|
1738
|
+
flipPreview: context.previewImageUrl ? {
|
|
1739
|
+
url: context.previewImageUrl,
|
|
1740
|
+
orientation: context.orientation,
|
|
1741
|
+
mode: context.currentMode === "passport" ? "passport" : "id"
|
|
1742
|
+
} : context.flipPreview,
|
|
2008
1743
|
uploadProgress: void 0,
|
|
2009
1744
|
manualCaptureTriggered: false,
|
|
2010
1745
|
attemptsRemaining: context.config.captureAttempts,
|
|
@@ -2016,6 +1751,7 @@ const _idCaptureMachine = setup({
|
|
|
2016
1751
|
cameraFallbackLevel: void 0
|
|
2017
1752
|
};
|
|
2018
1753
|
}),
|
|
1754
|
+
clearFlipPreview: assign({ flipPreview: void 0 }),
|
|
2019
1755
|
prepareForBackCapture: assign(({ context }) => {
|
|
2020
1756
|
context.provider?.reset();
|
|
2021
1757
|
return {
|
|
@@ -2025,7 +1761,6 @@ const _idCaptureMachine = setup({
|
|
|
2025
1761
|
resetDetection: void 0,
|
|
2026
1762
|
idType: void 0,
|
|
2027
1763
|
qualityElements: void 0,
|
|
2028
|
-
debugFrame: void 0,
|
|
2029
1764
|
frameRect: void 0,
|
|
2030
1765
|
previewImageUrl: void 0,
|
|
2031
1766
|
uploadProgress: void 0,
|
|
@@ -2040,14 +1775,16 @@ const _idCaptureMachine = setup({
|
|
|
2040
1775
|
captureResolution: ({ event }) => getCaptureResolutionFromEvent(event),
|
|
2041
1776
|
cameraFallbackLevel: ({ event }) => getCameraFallbackLevelFromEvent(event)
|
|
2042
1777
|
}),
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
},
|
|
2049
|
-
|
|
2050
|
-
|
|
1778
|
+
setPermissionResultAndStream: assign({
|
|
1779
|
+
permissionResult: ({ context, event }) => getPermissionResultFromEvent(event) ?? context.permissionResult,
|
|
1780
|
+
stream: ({ context, event }) => getStreamFromEvent(event) ?? context.stream,
|
|
1781
|
+
cameraFallbackLevel: ({ context, event }) => getCameraFallbackLevelFromEvent(event) ?? context.cameraFallbackLevel
|
|
1782
|
+
}),
|
|
1783
|
+
trackTutorialId: () => {},
|
|
1784
|
+
trackContinue: () => {},
|
|
1785
|
+
trackCameraId: ({ context }) => {},
|
|
1786
|
+
reportCaptureResultPreviewAssignment: ({ context }) => {
|
|
1787
|
+
performReportCaptureResultPreviewAssignment(context);
|
|
2051
1788
|
},
|
|
2052
1789
|
preloadRecordingProvider: ({ context }) => {
|
|
2053
1790
|
preloadIdRecordingProvider(context.config);
|
|
@@ -2088,6 +1825,14 @@ const _idCaptureMachine = setup({
|
|
|
2088
1825
|
} }),
|
|
2089
1826
|
setCurrentMode: assign({ currentMode: ({ event, context }) => getCurrentModeFromEvent(context, event) }),
|
|
2090
1827
|
storeCapturedImage: assign(({ context, event }) => getStoreCapturedImageValues(context, event)),
|
|
1828
|
+
storeBarcodeResponse: assign(({ context, event }) => getBarcodeResponseValues(context, event)),
|
|
1829
|
+
storeDecodedBarcode: assign({ decodedBarcode: ({ event }) => event.decoded }),
|
|
1830
|
+
setBarcodeFastPathAttempted: assign({ barcodeFastPathAttempted: true }),
|
|
1831
|
+
markBarcodeFastPathCaptured: assign({
|
|
1832
|
+
barcodeFastPathCaptured: true,
|
|
1833
|
+
previewImageUrl: void 0
|
|
1834
|
+
}),
|
|
1835
|
+
clearBarcodeFastPathCaptured: assign({ barcodeFastPathCaptured: false }),
|
|
2091
1836
|
setDetectionStatus: assign({ detectionStatus: ({ event, context }) => getDetectionStatusFromUpdate(context, event) }),
|
|
2092
1837
|
setCounterValue: assign({ counterValue: ({ event }) => {
|
|
2093
1838
|
if ("value" in event) return event.value;
|
|
@@ -2106,6 +1851,18 @@ const _idCaptureMachine = setup({
|
|
|
2106
1851
|
if ("detectionArea" in event) return event.detectionArea;
|
|
2107
1852
|
} }),
|
|
2108
1853
|
incrementExpiredAttempts: assign(({ context }) => ({ expiredAttempts: context.expiredAttempts + 1 })),
|
|
1854
|
+
/**
|
|
1855
|
+
* Mirrors the child's successful upload response onto parent context so
|
|
1856
|
+
* the manager mapper (and the workflow orchestrator) can read fields
|
|
1857
|
+
* like `skipBackIdCapture` and `typeOfId`. Also marks the session as a
|
|
1858
|
+
* digital upload so back capture is suppressed regardless of
|
|
1859
|
+
* `alwaysCaptureBackOfId` (digital IDs are single-side, like passports).
|
|
1860
|
+
*
|
|
1861
|
+
* The child machine's `output` is intentionally narrow (`{ result }`);
|
|
1862
|
+
* to avoid breaking the established invoke→onDone contract, we read the
|
|
1863
|
+
* upload response from the child snapshot's context instead of widening
|
|
1864
|
+
* the output shape.
|
|
1865
|
+
*/
|
|
2109
1866
|
storeDigitalUploadResponse: assign(({ self }) => {
|
|
2110
1867
|
const response = ((self.getSnapshot().children?.["digitalIdUpload"]?.getSnapshot())?.context)?.response;
|
|
2111
1868
|
if (!response) return { isDigitalUpload: true };
|
|
@@ -2132,14 +1889,16 @@ const _idCaptureMachine = setup({
|
|
|
2132
1889
|
needsMotionPrimeOnly: needsMotionPrimeOnlyGuard,
|
|
2133
1890
|
isPermissionDeniedError: isPermissionDeniedErrorGuard,
|
|
2134
1891
|
hasStream: hasStreamGuard,
|
|
1892
|
+
hasInitializedCamera: hasInitializedCameraGuard,
|
|
2135
1893
|
hasAttemptsRemaining: hasAttemptsRemainingGuard,
|
|
2136
1894
|
hasCapturedImage: hasCapturedImageGuard,
|
|
2137
1895
|
hasUploadValidationError: hasUploadValidationErrorGuard,
|
|
2138
1896
|
isFrontMode: isFrontModeGuard,
|
|
2139
|
-
isOnlyFront: isOnlyFrontGuard,
|
|
2140
1897
|
shouldContinueToBack: shouldContinueToBackGuard,
|
|
2141
1898
|
shouldContinueToFront: shouldContinueToFrontGuard,
|
|
2142
1899
|
hasMandatoryConsent: hasMandatoryConsentGuard,
|
|
1900
|
+
isCaptureResultPreviewMode: isCaptureResultPreviewModeGuard,
|
|
1901
|
+
supportsCaptureResultPreview: supportsCaptureResultPreviewGuard,
|
|
2143
1902
|
isDeepsightEnabled: isDeepsightEnabledGuard,
|
|
2144
1903
|
isDeepsightReady: isDeepsightReadyGuard,
|
|
2145
1904
|
needsDeepsightInit: needsDeepsightInitGuard,
|
|
@@ -2153,6 +1912,8 @@ const _idCaptureMachine = setup({
|
|
|
2153
1912
|
shouldForceBackOnExpired: shouldForceBackOnExpiredGuard,
|
|
2154
1913
|
wasExpiredFromUpload: wasExpiredFromUploadGuard,
|
|
2155
1914
|
shouldSkipProcessId: shouldSkipProcessIdGuard,
|
|
1915
|
+
shouldSubmitBarcode: shouldSubmitBarcodeGuard,
|
|
1916
|
+
canRunBarcodeFastPath: canRunBarcodeFastPathGuard,
|
|
2156
1917
|
isProcessingExpiredExhausted: isProcessingExpiredExhaustedGuard,
|
|
2157
1918
|
shouldProcessAfterExhaustion: shouldProcessAfterExhaustionGuard,
|
|
2158
1919
|
forceFinishAfterProcessing: forceFinishAfterProcessingGuard,
|
|
@@ -2165,10 +1926,12 @@ const _idCaptureMachine = setup({
|
|
|
2165
1926
|
}).createMachine({
|
|
2166
1927
|
id: "idCapture",
|
|
2167
1928
|
initial: "idle",
|
|
1929
|
+
output: ({ context }) => computeIdCaptureOutput(context),
|
|
2168
1930
|
context: ({ input }) => {
|
|
2169
1931
|
const currentMode = input.config.onlyBack ? "back" : !input.config.enableId && input.config.enablePassport ? "passport" : input.config.usSmartCapture ? "back" : "front";
|
|
2170
1932
|
return {
|
|
2171
1933
|
config: input.config,
|
|
1934
|
+
captureFeedbackMode: input.captureFeedbackMode ?? "countdown",
|
|
2172
1935
|
currentMode,
|
|
2173
1936
|
selectedDocumentType: void 0,
|
|
2174
1937
|
stream: void 0,
|
|
@@ -2181,6 +1944,9 @@ const _idCaptureMachine = setup({
|
|
|
2181
1944
|
capturedImages: {},
|
|
2182
1945
|
captureOnlyImages: {},
|
|
2183
1946
|
uploadResponse: void 0,
|
|
1947
|
+
decodedBarcode: null,
|
|
1948
|
+
barcodeFastPathAttempted: false,
|
|
1949
|
+
barcodeFastPathCaptured: false,
|
|
2184
1950
|
recordingSession: void 0,
|
|
2185
1951
|
attemptsRemaining: input.config.captureAttempts,
|
|
2186
1952
|
expiredAttempts: 0,
|
|
@@ -2196,7 +1962,6 @@ const _idCaptureMachine = setup({
|
|
|
2196
1962
|
resetDetection: void 0,
|
|
2197
1963
|
idType: void 0,
|
|
2198
1964
|
qualityElements: void 0,
|
|
2199
|
-
debugFrame: void 0,
|
|
2200
1965
|
frameRect: void 0,
|
|
2201
1966
|
detectionArea: void 0,
|
|
2202
1967
|
previewImageUrl: void 0,
|
|
@@ -2500,16 +2265,16 @@ const _idCaptureMachine = setup({
|
|
|
2500
2265
|
{
|
|
2501
2266
|
target: "#idCapture.capture",
|
|
2502
2267
|
guard: "isReadyForCapture",
|
|
2503
|
-
actions:
|
|
2268
|
+
actions: "setPermissionResultAndStream"
|
|
2504
2269
|
},
|
|
2505
2270
|
{
|
|
2506
2271
|
target: "denied",
|
|
2507
|
-
guard: ({ event }) => event
|
|
2508
|
-
actions:
|
|
2272
|
+
guard: ({ event }) => getPermissionResultFromEvent(event) === "denied",
|
|
2273
|
+
actions: "setPermissionResultAndStream"
|
|
2509
2274
|
},
|
|
2510
2275
|
{
|
|
2511
2276
|
target: "waitingForUser",
|
|
2512
|
-
actions:
|
|
2277
|
+
actions: "setPermissionResultAndStream"
|
|
2513
2278
|
}
|
|
2514
2279
|
],
|
|
2515
2280
|
onError: { target: "denied" }
|
|
@@ -2530,7 +2295,7 @@ const _idCaptureMachine = setup({
|
|
|
2530
2295
|
},
|
|
2531
2296
|
{
|
|
2532
2297
|
target: "detecting",
|
|
2533
|
-
guard: "
|
|
2298
|
+
guard: "hasInitializedCamera"
|
|
2534
2299
|
},
|
|
2535
2300
|
{ target: "initializing" }
|
|
2536
2301
|
] },
|
|
@@ -2559,7 +2324,9 @@ const _idCaptureMachine = setup({
|
|
|
2559
2324
|
src: "initializeCamera",
|
|
2560
2325
|
input: ({ context }) => ({
|
|
2561
2326
|
config: context.config,
|
|
2562
|
-
deepsightService: context.deepsightService
|
|
2327
|
+
deepsightService: context.deepsightService,
|
|
2328
|
+
stream: context.stream,
|
|
2329
|
+
cameraFallbackLevel: context.cameraFallbackLevel
|
|
2563
2330
|
}),
|
|
2564
2331
|
onDone: {
|
|
2565
2332
|
target: "detecting",
|
|
@@ -2580,7 +2347,7 @@ const _idCaptureMachine = setup({
|
|
|
2580
2347
|
guard: ({ context }) => context.manualCaptureTriggered,
|
|
2581
2348
|
actions: assign({ detectionStatus: () => "manualCapture" })
|
|
2582
2349
|
}],
|
|
2583
|
-
entry: [assign({ detectionStatus: () => "detecting" })],
|
|
2350
|
+
entry: [assign({ detectionStatus: () => "detecting" }), "reportCaptureResultPreviewAssignment"],
|
|
2584
2351
|
invoke: [{
|
|
2585
2352
|
id: "startRecording",
|
|
2586
2353
|
src: "startRecording",
|
|
@@ -2607,12 +2374,16 @@ const _idCaptureMachine = setup({
|
|
|
2607
2374
|
}],
|
|
2608
2375
|
on: {
|
|
2609
2376
|
DETECTION_UPDATE: { actions: "setDetectionStatus" },
|
|
2610
|
-
DETECTION_FRAME: { actions: assign({ debugFrame: ({ event }) => event.frame }) },
|
|
2611
2377
|
DETECTION_RESET_READY: { actions: assign({ resetDetection: ({ event }) => event.reset }) },
|
|
2612
2378
|
DETECTION_SUCCESS: {
|
|
2613
2379
|
target: "capturing",
|
|
2614
2380
|
actions: assign({ qualityElements: ({ event }) => event.qualityElements })
|
|
2615
2381
|
},
|
|
2382
|
+
BARCODE_DECODED: [{
|
|
2383
|
+
target: "capturingBarcode",
|
|
2384
|
+
guard: "canRunBarcodeFastPath",
|
|
2385
|
+
actions: ["storeDecodedBarcode", "setBarcodeFastPathAttempted"]
|
|
2386
|
+
}, { actions: "storeDecodedBarcode" }],
|
|
2616
2387
|
MANUAL_CAPTURE: { target: "capturingManual" },
|
|
2617
2388
|
SWITCH_TO_MANUAL_CAPTURE: {
|
|
2618
2389
|
target: "manualCaptureWaiting",
|
|
@@ -2634,45 +2405,113 @@ const _idCaptureMachine = setup({
|
|
|
2634
2405
|
"storeCapturedCanvasInProvider",
|
|
2635
2406
|
"storeCapturedImage"
|
|
2636
2407
|
],
|
|
2637
|
-
always: [
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2408
|
+
always: [
|
|
2409
|
+
{
|
|
2410
|
+
target: "submittingBarcode",
|
|
2411
|
+
guard: and(["hasCapturedImage", "shouldSubmitBarcode"])
|
|
2412
|
+
},
|
|
2413
|
+
{
|
|
2414
|
+
target: "resultPreview",
|
|
2415
|
+
guard: and([
|
|
2416
|
+
"hasCapturedImage",
|
|
2417
|
+
"isCaptureResultPreviewMode",
|
|
2418
|
+
"supportsCaptureResultPreview"
|
|
2419
|
+
])
|
|
2420
|
+
},
|
|
2421
|
+
{
|
|
2422
|
+
target: "uploading",
|
|
2423
|
+
guard: "hasCapturedImage"
|
|
2424
|
+
},
|
|
2425
|
+
{
|
|
2426
|
+
target: "uploadError",
|
|
2427
|
+
actions: assign(({ context }) => ({
|
|
2428
|
+
uploadError: ID_ERROR_CODES.UPLOAD_ERROR,
|
|
2429
|
+
attemptsRemaining: context.attemptsRemaining - 1
|
|
2430
|
+
}))
|
|
2431
|
+
}
|
|
2432
|
+
]
|
|
2433
|
+
},
|
|
2434
|
+
resultPreview: { on: { RESULT_PREVIEW_COMPLETE: { target: "uploading" } } },
|
|
2435
|
+
submittingBarcode: { invoke: {
|
|
2436
|
+
id: "submitBarcode",
|
|
2437
|
+
src: "submitBarcode",
|
|
2438
|
+
input: ({ context }) => ({
|
|
2439
|
+
rawBarcode: context.decodedBarcode?.text ?? "",
|
|
2440
|
+
metrics: context.decodedBarcode,
|
|
2441
|
+
processId: context.config.skipProcessId !== true
|
|
2442
|
+
}),
|
|
2443
|
+
onDone: {
|
|
2444
|
+
target: "success",
|
|
2445
|
+
actions: "storeBarcodeResponse"
|
|
2446
|
+
},
|
|
2447
|
+
onError: { target: "uploading" }
|
|
2448
|
+
} },
|
|
2449
|
+
capturingBarcode: {
|
|
2450
|
+
entry: [
|
|
2451
|
+
"captureImage",
|
|
2452
|
+
"storeCapturedCanvasInProvider",
|
|
2453
|
+
"storeCapturedImage"
|
|
2454
|
+
],
|
|
2455
|
+
always: [{ target: "submittingBarcodePreCapture" }]
|
|
2647
2456
|
},
|
|
2457
|
+
submittingBarcodePreCapture: { invoke: {
|
|
2458
|
+
id: "submitBarcode",
|
|
2459
|
+
src: "submitBarcode",
|
|
2460
|
+
input: ({ context }) => ({
|
|
2461
|
+
rawBarcode: context.decodedBarcode?.text ?? "",
|
|
2462
|
+
metrics: context.decodedBarcode,
|
|
2463
|
+
processId: context.config.skipProcessId !== true,
|
|
2464
|
+
minDurationMs: 1e3
|
|
2465
|
+
}),
|
|
2466
|
+
onDone: {
|
|
2467
|
+
target: "success",
|
|
2468
|
+
actions: ["storeBarcodeResponse", "markBarcodeFastPathCaptured"]
|
|
2469
|
+
},
|
|
2470
|
+
onError: { target: "detecting" }
|
|
2471
|
+
} },
|
|
2648
2472
|
capturingManual: {
|
|
2649
2473
|
entry: [
|
|
2650
2474
|
"captureLatestFrame",
|
|
2651
2475
|
"storeCapturedCanvasInProvider",
|
|
2652
2476
|
"storeCapturedImage"
|
|
2653
2477
|
],
|
|
2654
|
-
always: [
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
}
|
|
2663
|
-
|
|
2478
|
+
always: [
|
|
2479
|
+
{
|
|
2480
|
+
target: "resultPreview",
|
|
2481
|
+
guard: and([
|
|
2482
|
+
"hasCapturedImage",
|
|
2483
|
+
"isCaptureResultPreviewMode",
|
|
2484
|
+
"supportsCaptureResultPreview"
|
|
2485
|
+
])
|
|
2486
|
+
},
|
|
2487
|
+
{
|
|
2488
|
+
target: "uploading",
|
|
2489
|
+
guard: "hasCapturedImage"
|
|
2490
|
+
},
|
|
2491
|
+
{
|
|
2492
|
+
target: "uploadError",
|
|
2493
|
+
actions: assign(({ context }) => ({
|
|
2494
|
+
uploadError: ID_ERROR_CODES.UPLOAD_ERROR,
|
|
2495
|
+
attemptsRemaining: context.attemptsRemaining - 1
|
|
2496
|
+
}))
|
|
2497
|
+
}
|
|
2498
|
+
]
|
|
2664
2499
|
},
|
|
2665
2500
|
uploading: {
|
|
2666
2501
|
entry: assign({ uploadProgress: () => 0 }),
|
|
2667
|
-
invoke: {
|
|
2502
|
+
invoke: [{
|
|
2503
|
+
id: "uploadProgressTicker",
|
|
2504
|
+
src: "uploadProgressTicker"
|
|
2505
|
+
}, {
|
|
2668
2506
|
id: "uploadIdImage",
|
|
2669
2507
|
src: "uploadIdImage",
|
|
2670
2508
|
input: ({ context, self }) => {
|
|
2671
2509
|
const canvas = context.provider?.getOriginalCapturedCanvas();
|
|
2672
2510
|
if (!canvas) throw new Error(ID_ERROR_CODES.UPLOAD_ERROR);
|
|
2511
|
+
const type = context.currentMode === "back" ? "back" : "front";
|
|
2673
2512
|
return {
|
|
2674
2513
|
canvas,
|
|
2675
|
-
type
|
|
2514
|
+
type,
|
|
2676
2515
|
qualityElements: context.qualityElements,
|
|
2677
2516
|
onProgress: (progress) => {
|
|
2678
2517
|
self.send({
|
|
@@ -2683,7 +2522,7 @@ const _idCaptureMachine = setup({
|
|
|
2683
2522
|
deepsightService: context.deepsightService,
|
|
2684
2523
|
stream: context.stream,
|
|
2685
2524
|
isSecondId: context.config.isSecondId ?? false,
|
|
2686
|
-
onlyFront: false,
|
|
2525
|
+
onlyFront: type === "front" && (context.config.onlyFront ?? false),
|
|
2687
2526
|
ageAssurance: context.config.ageAssurance,
|
|
2688
2527
|
dependencies: context.dependencies,
|
|
2689
2528
|
captureResolution: context.captureResolution,
|
|
@@ -2693,10 +2532,11 @@ const _idCaptureMachine = setup({
|
|
|
2693
2532
|
};
|
|
2694
2533
|
},
|
|
2695
2534
|
onDone: {
|
|
2696
|
-
target: "
|
|
2535
|
+
target: "uploadCompleted",
|
|
2697
2536
|
actions: [assign({
|
|
2698
2537
|
uploadResponse: ({ event }) => event.output,
|
|
2699
|
-
uploadProgress: () => 100
|
|
2538
|
+
uploadProgress: () => 100,
|
|
2539
|
+
skipProcessId: ({ context, event }) => event.output.idValidationCompleted === true || context.skipProcessId
|
|
2700
2540
|
}), "storeCapturedImage"]
|
|
2701
2541
|
},
|
|
2702
2542
|
onError: {
|
|
@@ -2706,9 +2546,13 @@ const _idCaptureMachine = setup({
|
|
|
2706
2546
|
attemptsRemaining: context.attemptsRemaining - 1
|
|
2707
2547
|
}))
|
|
2708
2548
|
}
|
|
2709
|
-
},
|
|
2710
|
-
on: {
|
|
2549
|
+
}],
|
|
2550
|
+
on: {
|
|
2551
|
+
UPLOAD_PROGRESS: { actions: assign({ uploadProgress: ({ context, event }) => Math.max(context.uploadProgress ?? 0, Math.round(event.progress / 100 * 80)) }) },
|
|
2552
|
+
UPLOAD_PROGRESS_TICK: { actions: assign({ uploadProgress: ({ context }) => Math.min(95, (context.uploadProgress ?? 0) + 1) }) }
|
|
2553
|
+
}
|
|
2711
2554
|
},
|
|
2555
|
+
uploadCompleted: { after: { [800]: { target: "validatingUpload" } } },
|
|
2712
2556
|
validatingUpload: { always: [
|
|
2713
2557
|
{
|
|
2714
2558
|
target: "uploadError",
|
|
@@ -2769,21 +2613,24 @@ const _idCaptureMachine = setup({
|
|
|
2769
2613
|
actions: ["flagIdManualReview"]
|
|
2770
2614
|
}
|
|
2771
2615
|
] } },
|
|
2772
|
-
success: {
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2616
|
+
success: {
|
|
2617
|
+
exit: "clearBarcodeFastPathCaptured",
|
|
2618
|
+
on: { NEXT_STEP: [
|
|
2619
|
+
{
|
|
2620
|
+
target: "#idCapture.mandatoryConsent",
|
|
2621
|
+
guard: "hasMandatoryConsent"
|
|
2622
|
+
},
|
|
2623
|
+
{
|
|
2624
|
+
target: "#idCapture.frontFinished",
|
|
2625
|
+
guard: "shouldContinueToBack"
|
|
2626
|
+
},
|
|
2627
|
+
{
|
|
2628
|
+
target: "#idCapture.backFinished",
|
|
2629
|
+
guard: "shouldContinueToFront"
|
|
2630
|
+
},
|
|
2631
|
+
{ target: "#idCapture.processing" }
|
|
2632
|
+
] }
|
|
2633
|
+
}
|
|
2787
2634
|
}
|
|
2788
2635
|
},
|
|
2789
2636
|
mandatoryConsent: { on: {
|
|
@@ -2845,8 +2692,12 @@ const _idCaptureMachine = setup({
|
|
|
2845
2692
|
},
|
|
2846
2693
|
onDone: [{
|
|
2847
2694
|
target: "#idCapture.capture.detecting",
|
|
2848
|
-
guard: "hasStream"
|
|
2849
|
-
|
|
2695
|
+
guard: "hasStream",
|
|
2696
|
+
actions: "clearFlipPreview"
|
|
2697
|
+
}, {
|
|
2698
|
+
target: "#idCapture.capture",
|
|
2699
|
+
actions: "clearFlipPreview"
|
|
2700
|
+
}]
|
|
2850
2701
|
},
|
|
2851
2702
|
backFinished: {
|
|
2852
2703
|
entry: ["stopMediaRecording", "resetForFrontCapture"],
|
|
@@ -2893,8 +2744,12 @@ const _idCaptureMachine = setup({
|
|
|
2893
2744
|
},
|
|
2894
2745
|
onDone: [{
|
|
2895
2746
|
target: "#idCapture.capture.detecting",
|
|
2896
|
-
guard: "hasStream"
|
|
2897
|
-
|
|
2747
|
+
guard: "hasStream",
|
|
2748
|
+
actions: "clearFlipPreview"
|
|
2749
|
+
}, {
|
|
2750
|
+
target: "#idCapture.capture",
|
|
2751
|
+
actions: "clearFlipPreview"
|
|
2752
|
+
}]
|
|
2898
2753
|
},
|
|
2899
2754
|
processing: {
|
|
2900
2755
|
entry: "stopMediaStream",
|
|
@@ -3023,7 +2878,7 @@ const _idCaptureMachine = setup({
|
|
|
3023
2878
|
src: "manualUploadMachine",
|
|
3024
2879
|
input: ({ context }) => ({
|
|
3025
2880
|
isSecondId: context.config.isSecondId ?? false,
|
|
3026
|
-
onlyFront: false,
|
|
2881
|
+
onlyFront: context.config.onlyFront ?? false,
|
|
3027
2882
|
captureAttempts: context.config.captureAttempts,
|
|
3028
2883
|
extractIdFace: context.config.extractIdFace
|
|
3029
2884
|
}),
|
|
@@ -3092,7 +2947,5 @@ const _idCaptureMachine = setup({
|
|
|
3092
2947
|
}
|
|
3093
2948
|
}
|
|
3094
2949
|
});
|
|
3095
|
-
const idCaptureMachine = _idCaptureMachine;
|
|
3096
|
-
|
|
3097
2950
|
//#endregion
|
|
3098
|
-
export { MANUAL_UPLOAD_MAX_RETRIES as
|
|
2951
|
+
export { MANUAL_UPLOAD_MAX_RETRIES as a, MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES as i, getManualUploadTabs as n, MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS as r, idCaptureMachine as t };
|