@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
|
@@ -0,0 +1,917 @@
|
|
|
1
|
+
import { r as WasmUtilProvider } from "./safeStorage-Ep56I-f_.esm.js";
|
|
2
|
+
import { t as ensureWasmPipelines } from "./setup-CYdVacqv.esm.js";
|
|
3
|
+
import { t as BrowserTimerProvider } from "./BrowserTimerProvider-BXhgNxLt.esm.js";
|
|
4
|
+
import { i as resolveDashboardModuleConfig, l as facingModeForStep } from "./flowServices-unhF9V9F.esm.js";
|
|
5
|
+
import { c as createManager, n as sendTo, o as createActor, r as assign, t as setup } from "./xstate.esm-Cf4e0Cfd.esm.js";
|
|
6
|
+
import { n as fromPromise, t as fromCallback } from "./xstate-actors.esm-CtI5S0f4.esm.js";
|
|
7
|
+
import { _ as StreamCanvasProcessingSession, a as encryptSelfieImage, l as startDetection, v as FaceDetectionProvider } from "./onDeviceFaceResults-f81FVdQs.esm.js";
|
|
8
|
+
import { n as getWindowDimensions } from "./getDeviceClass-CeBiEayS.esm.js";
|
|
9
|
+
import { i as uploadSelfie, r as processFace } from "./selfieErrorUtils-C2PYBVsp.esm.js";
|
|
10
|
+
import { t as StreamCanvasCapture } from "./StreamCanvasCapture-D2XcXCZ4.esm.js";
|
|
11
|
+
import { n as DEFAULT_ID_CAPTURE_THRESHOLDS, r as IdCaptureProvider, t as DEFAULT_ID_CAPTURE_GEOMETRY } from "./idCaptureDefaults-WeHbQM7W.esm.js";
|
|
12
|
+
import { a as processId, d as validateUploadResponse, f as ID_ERROR_CODES, l as uploadIdImage } from "./idCaptureServices-CFDwqTtQ.esm.js";
|
|
13
|
+
import { n as getFinishStatus } from "./flowCompletionService-BSe3p7pg.esm.js";
|
|
14
|
+
import { a as delay, c as isWrongVideoSelfieIdSide, n as defaultAcquireCamera, r as CameraCompositor, s as isSelfieValidationError } from "./videoSelfieCameraWarmer-h_VUk5Vu.esm.js";
|
|
15
|
+
//#region src/modules/id-selfie-flow/idSelfieFlowStepDetector.ts
|
|
16
|
+
/** Default autocapture window for the selfie step. */
|
|
17
|
+
const SELFIE_AUTOCAPTURE_MS = 1e4;
|
|
18
|
+
const SELFIE_SUCCESS_DWELL_MS = 900;
|
|
19
|
+
const ID_SUCCESS_DWELL_MS = 900;
|
|
20
|
+
function abortError() {
|
|
21
|
+
return /* @__PURE__ */ new Error("aborted");
|
|
22
|
+
}
|
|
23
|
+
function throwIfAborted(signal) {
|
|
24
|
+
if (signal.aborted) throw abortError();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Maps a regular ID-upload validation error to the Video Selfie failure
|
|
28
|
+
* vocabulary the shared UI masks already know how to render.
|
|
29
|
+
*/
|
|
30
|
+
function idValidationFailureFor(validationError) {
|
|
31
|
+
if (validationError.errorKey === ID_ERROR_CODES.ID_TYPE_UNACCEPTABLE) return "idTypeMismatch";
|
|
32
|
+
return "idScanFailed";
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Builds the per-step detector for the ID + Selfie flow, shipping every
|
|
36
|
+
* accepted frame through the REGULAR onboarding endpoints:
|
|
37
|
+
*
|
|
38
|
+
* - `frontId` / `backId` run the REGULAR ID-capture pipeline (same as the
|
|
39
|
+
* standalone ID module: best-frame autocapture, quality values, live mask
|
|
40
|
+
* orientation) → `POST /omni/add/front-id/v2` / `add/back-id/v2` + the
|
|
41
|
+
* response quality validation the standalone ID module applies.
|
|
42
|
+
* - `selfie` reuses the Video Selfie face UX → encrypt →
|
|
43
|
+
* `POST /omni/add/face?imageType=selfie` →
|
|
44
|
+
* `POST /omni/process/face?imageType=selfie`.
|
|
45
|
+
*
|
|
46
|
+
* `process/id` is NOT called here — the state machine invokes it once, after
|
|
47
|
+
* the last ID side is accepted (mirrors how integrators chain the modules).
|
|
48
|
+
*/
|
|
49
|
+
function createIdSelfieFlowStepDetector(config, deps) {
|
|
50
|
+
return ({ step, stream, signal, onStatus, onOrientation, registerManualCapture }) => {
|
|
51
|
+
if (step === "selfie") return detectSelfie({
|
|
52
|
+
config,
|
|
53
|
+
deps,
|
|
54
|
+
stream,
|
|
55
|
+
signal,
|
|
56
|
+
onStatus,
|
|
57
|
+
registerManualCapture
|
|
58
|
+
});
|
|
59
|
+
if (step === "frontId" || step === "backId") return detectId({
|
|
60
|
+
step,
|
|
61
|
+
stream,
|
|
62
|
+
signal,
|
|
63
|
+
onStatus,
|
|
64
|
+
onOrientation,
|
|
65
|
+
registerManualCapture
|
|
66
|
+
});
|
|
67
|
+
return new Promise(() => {});
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async function detectSelfie(params) {
|
|
71
|
+
const { config, deps, stream, signal, onStatus, registerManualCapture } = params;
|
|
72
|
+
const provider = new FaceDetectionProvider();
|
|
73
|
+
await provider.initialize({
|
|
74
|
+
autocaptureInterval: SELFIE_AUTOCAPTURE_MS,
|
|
75
|
+
useOnDeviceWorkflow: false,
|
|
76
|
+
videoSelfie: true
|
|
77
|
+
});
|
|
78
|
+
if (signal.aborted) {
|
|
79
|
+
provider.dispose();
|
|
80
|
+
throw abortError();
|
|
81
|
+
}
|
|
82
|
+
provider.setChecksEnabled({
|
|
83
|
+
lenses: config.validateLenses ?? false,
|
|
84
|
+
mask: config.validateFaceMask ?? false,
|
|
85
|
+
closedEyes: config.validateClosedEyes ?? false,
|
|
86
|
+
headWear: config.validateHeadCover ?? false,
|
|
87
|
+
occlusion: false
|
|
88
|
+
});
|
|
89
|
+
const capturer = new StreamCanvasCapture(stream);
|
|
90
|
+
const detectionConfig = {
|
|
91
|
+
showTutorial: false,
|
|
92
|
+
validateBrightness: false,
|
|
93
|
+
validateLenses: config.validateLenses ?? false,
|
|
94
|
+
validateFaceMask: config.validateFaceMask ?? false,
|
|
95
|
+
validateClosedEyes: config.validateClosedEyes ?? false,
|
|
96
|
+
validateHeadCover: config.validateHeadCover ?? false,
|
|
97
|
+
autoCaptureTimeout: SELFIE_AUTOCAPTURE_MS / 1e3
|
|
98
|
+
};
|
|
99
|
+
const runAttempt = () => new Promise((resolve, reject) => {
|
|
100
|
+
if (signal.aborted) {
|
|
101
|
+
reject(abortError());
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
let settled = false;
|
|
105
|
+
let submitting = false;
|
|
106
|
+
function settle(run) {
|
|
107
|
+
if (settled) return;
|
|
108
|
+
settled = true;
|
|
109
|
+
signal.removeEventListener("abort", onAbort);
|
|
110
|
+
run();
|
|
111
|
+
}
|
|
112
|
+
const submit = (canvas, faceCoordinates) => {
|
|
113
|
+
if (submitting || settled) return;
|
|
114
|
+
submitting = true;
|
|
115
|
+
onStatus?.("capturing");
|
|
116
|
+
(async () => {
|
|
117
|
+
try {
|
|
118
|
+
const encryptedBase64Image = await encryptSelfieImage({
|
|
119
|
+
canvas,
|
|
120
|
+
dependencies: { getWasmUtil: async () => deps.getWasmUtil() }
|
|
121
|
+
});
|
|
122
|
+
throwIfAborted(signal);
|
|
123
|
+
await uploadSelfie({
|
|
124
|
+
encryptedBase64Image,
|
|
125
|
+
faceCoordinates,
|
|
126
|
+
imageType: "selfie"
|
|
127
|
+
});
|
|
128
|
+
throwIfAborted(signal);
|
|
129
|
+
await processFace("selfie");
|
|
130
|
+
throwIfAborted(signal);
|
|
131
|
+
onStatus?.("success");
|
|
132
|
+
await delay(SELFIE_SUCCESS_DWELL_MS, signal);
|
|
133
|
+
settle(resolve);
|
|
134
|
+
} catch (error) {
|
|
135
|
+
settle(() => reject(error instanceof Error ? error : new Error(String(error))));
|
|
136
|
+
}
|
|
137
|
+
})();
|
|
138
|
+
};
|
|
139
|
+
const detection = startDetection({
|
|
140
|
+
config: detectionConfig,
|
|
141
|
+
capturer,
|
|
142
|
+
provider,
|
|
143
|
+
onUpdate: (status) => onStatus?.(status),
|
|
144
|
+
onSuccess: (canvas, faceCoordinates) => {
|
|
145
|
+
submit(canvas, faceCoordinates);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
registerManualCapture?.(() => {
|
|
149
|
+
const canvas = capturer.getLatestCanvas();
|
|
150
|
+
if (!canvas) return;
|
|
151
|
+
submit(canvas);
|
|
152
|
+
});
|
|
153
|
+
function onAbort() {
|
|
154
|
+
detection.cleanup();
|
|
155
|
+
settle(() => reject(abortError()));
|
|
156
|
+
}
|
|
157
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
158
|
+
if (signal.aborted) onAbort();
|
|
159
|
+
});
|
|
160
|
+
try {
|
|
161
|
+
await runAttempt();
|
|
162
|
+
return { outcome: "success" };
|
|
163
|
+
} catch (error) {
|
|
164
|
+
if (signal.aborted || !isSelfieValidationError(error)) throw error;
|
|
165
|
+
onStatus?.("error");
|
|
166
|
+
return {
|
|
167
|
+
outcome: "validationFailed",
|
|
168
|
+
failure: "selfieVerificationFailed"
|
|
169
|
+
};
|
|
170
|
+
} finally {
|
|
171
|
+
capturer.dispose();
|
|
172
|
+
provider.dispose();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
async function detectId(params) {
|
|
176
|
+
const { step, stream, signal, onStatus, onOrientation, registerManualCapture } = params;
|
|
177
|
+
const provider = new IdCaptureProvider();
|
|
178
|
+
await provider.initialize({});
|
|
179
|
+
if (signal.aborted) {
|
|
180
|
+
provider.dispose();
|
|
181
|
+
throw abortError();
|
|
182
|
+
}
|
|
183
|
+
const capturer = new StreamCanvasCapture(stream);
|
|
184
|
+
const initialCanvas = capturer.getLatestCanvas();
|
|
185
|
+
const windowDimensions = getWindowDimensions(initialCanvas?.width() ?? 1280, initialCanvas?.height() ?? 720);
|
|
186
|
+
provider.setGeometry({
|
|
187
|
+
...DEFAULT_ID_CAPTURE_GEOMETRY,
|
|
188
|
+
windowOuterWidth: windowDimensions.outerWidth,
|
|
189
|
+
windowOuterHeight: windowDimensions.outerHeight,
|
|
190
|
+
windowInnerWidth: windowDimensions.innerWidth,
|
|
191
|
+
windowInnerHeight: windowDimensions.innerHeight
|
|
192
|
+
});
|
|
193
|
+
provider.setSettings({
|
|
194
|
+
isFixedMask: false,
|
|
195
|
+
isIPhone14OrHigher: false,
|
|
196
|
+
idType: step === "backId" ? "BackId" : "FrontId",
|
|
197
|
+
blurCheckEnabled: false,
|
|
198
|
+
glareCheckEnabled: false,
|
|
199
|
+
faceQualityCheckEnabled: true,
|
|
200
|
+
iouCheckEnabled: true,
|
|
201
|
+
fpsLimitEnabled: false
|
|
202
|
+
});
|
|
203
|
+
provider.setThresholds(DEFAULT_ID_CAPTURE_THRESHOLDS);
|
|
204
|
+
provider.setModelType("v2");
|
|
205
|
+
return new Promise((resolve, reject) => {
|
|
206
|
+
let validating = false;
|
|
207
|
+
let wrongSide = false;
|
|
208
|
+
let settled = false;
|
|
209
|
+
let toreDown = false;
|
|
210
|
+
let bestCanvas = null;
|
|
211
|
+
let storedQuality = {};
|
|
212
|
+
const session = new StreamCanvasProcessingSession({
|
|
213
|
+
capturer,
|
|
214
|
+
provider
|
|
215
|
+
});
|
|
216
|
+
function teardown() {
|
|
217
|
+
if (toreDown) return;
|
|
218
|
+
toreDown = true;
|
|
219
|
+
session.dispose();
|
|
220
|
+
capturer.dispose();
|
|
221
|
+
provider.dispose();
|
|
222
|
+
}
|
|
223
|
+
function settle(run) {
|
|
224
|
+
if (settled) return;
|
|
225
|
+
settled = true;
|
|
226
|
+
signal.removeEventListener("abort", onAbort);
|
|
227
|
+
teardown();
|
|
228
|
+
run();
|
|
229
|
+
}
|
|
230
|
+
function onAbort() {
|
|
231
|
+
settle(() => reject(abortError()));
|
|
232
|
+
}
|
|
233
|
+
function uploadCaptured(base64Image) {
|
|
234
|
+
validating = true;
|
|
235
|
+
onStatus?.("capturing");
|
|
236
|
+
(async () => {
|
|
237
|
+
try {
|
|
238
|
+
const response = await uploadIdImage({
|
|
239
|
+
type: step === "backId" ? "back" : "front",
|
|
240
|
+
image: base64Image,
|
|
241
|
+
glare: storedQuality.glare,
|
|
242
|
+
sharpness: storedQuality.sharpness,
|
|
243
|
+
signal
|
|
244
|
+
});
|
|
245
|
+
throwIfAborted(signal);
|
|
246
|
+
const validationError = validateUploadResponse({
|
|
247
|
+
...response,
|
|
248
|
+
side: step === "backId" ? "back" : "front"
|
|
249
|
+
});
|
|
250
|
+
if (validationError) {
|
|
251
|
+
onStatus?.("error");
|
|
252
|
+
settle(() => resolve({
|
|
253
|
+
outcome: "validationFailed",
|
|
254
|
+
failure: idValidationFailureFor(validationError)
|
|
255
|
+
}));
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
onStatus?.("success");
|
|
259
|
+
await delay(ID_SUCCESS_DWELL_MS, signal);
|
|
260
|
+
settle(() => resolve({ outcome: "success" }));
|
|
261
|
+
} catch (error) {
|
|
262
|
+
if (signal.aborted) {
|
|
263
|
+
settle(() => reject(error instanceof Error ? error : new Error(String(error))));
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
onStatus?.("error");
|
|
267
|
+
settle(() => resolve({
|
|
268
|
+
outcome: "retryableFailure",
|
|
269
|
+
failure: "idScanFailed"
|
|
270
|
+
}));
|
|
271
|
+
}
|
|
272
|
+
})();
|
|
273
|
+
}
|
|
274
|
+
provider.setCallbacks({
|
|
275
|
+
onFarAway: () => {
|
|
276
|
+
if (!validating && !wrongSide) onStatus?.("tooFar");
|
|
277
|
+
},
|
|
278
|
+
onMaskChange: (_show, _mask, _top, orientation) => {
|
|
279
|
+
onOrientation?.(orientation);
|
|
280
|
+
},
|
|
281
|
+
onBlur: () => {
|
|
282
|
+
if (!validating && !wrongSide) onStatus?.("blur");
|
|
283
|
+
},
|
|
284
|
+
onIdNotDetected: () => {
|
|
285
|
+
if (!validating && !wrongSide) onStatus?.("detecting");
|
|
286
|
+
},
|
|
287
|
+
onSwitchToManualCapture: () => {
|
|
288
|
+
if (!validating) onStatus?.("manualCapture");
|
|
289
|
+
},
|
|
290
|
+
onIdSideChange: (side) => {
|
|
291
|
+
if (validating) return;
|
|
292
|
+
wrongSide = isWrongVideoSelfieIdSide(step, side);
|
|
293
|
+
onStatus?.(wrongSide ? "wrongSide" : "detecting");
|
|
294
|
+
},
|
|
295
|
+
onCapturing: () => {
|
|
296
|
+
if (!validating) onStatus?.("capturing");
|
|
297
|
+
},
|
|
298
|
+
onBestFrame: (blur, glare, orientation) => {
|
|
299
|
+
const latest = capturer.getLatestCanvas();
|
|
300
|
+
if (latest) {
|
|
301
|
+
bestCanvas = latest.clone();
|
|
302
|
+
storedQuality = {
|
|
303
|
+
glare,
|
|
304
|
+
sharpness: blur
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
if (orientation === "horizontal" || orientation === "vertical") onOrientation?.(orientation);
|
|
308
|
+
},
|
|
309
|
+
onCapture: () => {
|
|
310
|
+
if (validating) return;
|
|
311
|
+
const base64Image = bestCanvas?.getBase64Image() ?? capturer.getLatestCanvas()?.getBase64Image();
|
|
312
|
+
if (!base64Image) return;
|
|
313
|
+
uploadCaptured(base64Image);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
registerManualCapture?.(() => {
|
|
317
|
+
if (validating || settled) return;
|
|
318
|
+
const base64Image = capturer.getLatestCanvas()?.getBase64Image();
|
|
319
|
+
if (!base64Image) return;
|
|
320
|
+
storedQuality = {};
|
|
321
|
+
uploadCaptured(base64Image);
|
|
322
|
+
});
|
|
323
|
+
onStatus?.("detecting");
|
|
324
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
325
|
+
if (signal.aborted) onAbort();
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
//#endregion
|
|
329
|
+
//#region src/modules/id-selfie-flow/idSelfieFlowStateMachine.ts
|
|
330
|
+
/** A detector that never settles — used when no config was provided. */
|
|
331
|
+
const manualStepDetector = () => new Promise(() => {});
|
|
332
|
+
function eventOutputStream(event) {
|
|
333
|
+
return event.output;
|
|
334
|
+
}
|
|
335
|
+
function errorFromEvent(event) {
|
|
336
|
+
return String(event.error);
|
|
337
|
+
}
|
|
338
|
+
function detectionStatusFromEvent(event) {
|
|
339
|
+
return event.status;
|
|
340
|
+
}
|
|
341
|
+
function detectionErrorFromEvent(event) {
|
|
342
|
+
return event.error;
|
|
343
|
+
}
|
|
344
|
+
function validationFailureFromEvent(event) {
|
|
345
|
+
return event.failure;
|
|
346
|
+
}
|
|
347
|
+
function orientationFromEvent(event) {
|
|
348
|
+
return event.orientation;
|
|
349
|
+
}
|
|
350
|
+
function finishStatusFromEvent(event) {
|
|
351
|
+
return event.output;
|
|
352
|
+
}
|
|
353
|
+
function retryableFailureFromEvent(event) {
|
|
354
|
+
return event.failure;
|
|
355
|
+
}
|
|
356
|
+
const SWITCHING_CAMERA_MIN_DWELL_MS = 3e3;
|
|
357
|
+
const ID_FLIP_DWELL_MS = 4e3;
|
|
358
|
+
const FINAL_SUCCESS_DWELL_MS = 3e3;
|
|
359
|
+
const VALIDATION_FEEDBACK_DWELL_MS = 3e3;
|
|
360
|
+
const DEFAULT_ATTEMPTS_PER_STEP = 3;
|
|
361
|
+
const UNLIMITED_ATTEMPTS = -1;
|
|
362
|
+
function normalizeAttempts(attempts) {
|
|
363
|
+
if (attempts === UNLIMITED_ATTEMPTS) return UNLIMITED_ATTEMPTS;
|
|
364
|
+
if (typeof attempts === "number" && attempts > 0) return attempts;
|
|
365
|
+
return DEFAULT_ATTEMPTS_PER_STEP;
|
|
366
|
+
}
|
|
367
|
+
function isIdStep(step) {
|
|
368
|
+
return step === "frontId" || step === "backId";
|
|
369
|
+
}
|
|
370
|
+
function waitForDwell(ms, signal) {
|
|
371
|
+
if (ms <= 0) return Promise.resolve(!signal.aborted);
|
|
372
|
+
const timerProvider = BrowserTimerProvider.getInstance();
|
|
373
|
+
return new Promise((resolve) => {
|
|
374
|
+
const onAbort = () => {
|
|
375
|
+
timerProvider.clearTimeout(timer);
|
|
376
|
+
resolve(false);
|
|
377
|
+
};
|
|
378
|
+
const timer = timerProvider.setTimeout(() => {
|
|
379
|
+
signal.removeEventListener("abort", onAbort);
|
|
380
|
+
resolve(true);
|
|
381
|
+
}, ms);
|
|
382
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
383
|
+
if (signal.aborted) onAbort();
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Orchestrates the ID + Selfie flow behind the Video Selfie UX: ONE continuous
|
|
388
|
+
* camera session that auto-advances per step and switches the camera facing
|
|
389
|
+
* between the ID and selfie sections — but runs the REGULAR capture pipeline
|
|
390
|
+
* (no recording, no microphone):
|
|
391
|
+
*
|
|
392
|
+
* idle ─START▶ acquiringCamera ─▶ capturing ⇄ validationFeedback/flippingId
|
|
393
|
+
* │ last ID side accepted ─▶ processingId ─▶ switchingCamera
|
|
394
|
+
* │ last step accepted ─▶ success ─▶ finished
|
|
395
|
+
*
|
|
396
|
+
* `capturing` runs the injected per-step detector (WASM autocapture + regular
|
|
397
|
+
* endpoint upload). When the last ID side is accepted the machine invokes
|
|
398
|
+
* `process/id` before switching to the selfie; the selfie detector runs
|
|
399
|
+
* `add/face` + `process/face` itself.
|
|
400
|
+
*
|
|
401
|
+
* Teardown mirrors the Video Selfie recording machine: `ABORT` is accepted from
|
|
402
|
+
* any non-final state and every settled path runs `cleanup`. XState v5 executes
|
|
403
|
+
* NO exit actions on an external `actor.stop()`, so the manager sends `ABORT`
|
|
404
|
+
* before stopping the actor.
|
|
405
|
+
*/
|
|
406
|
+
const idSelfieFlowSetup = setup({
|
|
407
|
+
types: {
|
|
408
|
+
context: {},
|
|
409
|
+
events: {},
|
|
410
|
+
input: {}
|
|
411
|
+
},
|
|
412
|
+
delays: {
|
|
413
|
+
ID_FLIP_DWELL: ID_FLIP_DWELL_MS,
|
|
414
|
+
FINAL_SUCCESS_DWELL: FINAL_SUCCESS_DWELL_MS,
|
|
415
|
+
VALIDATION_FEEDBACK_DWELL: VALIDATION_FEEDBACK_DWELL_MS
|
|
416
|
+
},
|
|
417
|
+
actors: {
|
|
418
|
+
acquireCamera: fromPromise(async ({ input, signal }) => {
|
|
419
|
+
const stream = await input.acquire(input.facingMode, false);
|
|
420
|
+
if (signal.aborted) {
|
|
421
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
422
|
+
throw new Error("Camera acquire cancelled");
|
|
423
|
+
}
|
|
424
|
+
return stream;
|
|
425
|
+
}),
|
|
426
|
+
switchCamera: fromPromise(async ({ input, signal }) => {
|
|
427
|
+
const dwellCompleted = waitForDwell(input.minDwellMs, signal);
|
|
428
|
+
const stream = await input.acquire(input.facingMode, false);
|
|
429
|
+
if (signal.aborted || !await dwellCompleted) {
|
|
430
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
431
|
+
throw new Error("Camera switch cancelled");
|
|
432
|
+
}
|
|
433
|
+
return stream;
|
|
434
|
+
}),
|
|
435
|
+
runProcessId: fromPromise(async ({ input, signal }) => input.run(input.queueName, signal)),
|
|
436
|
+
runFinish: fromPromise(async ({ input, signal }) => input.run(signal)),
|
|
437
|
+
detectStep: fromCallback(({ input, sendBack, receive }) => {
|
|
438
|
+
const controller = new AbortController();
|
|
439
|
+
let manualCaptureTrigger;
|
|
440
|
+
receive((event) => {
|
|
441
|
+
if (event.type === "MANUAL_CAPTURE") manualCaptureTrigger?.();
|
|
442
|
+
});
|
|
443
|
+
input.detect({
|
|
444
|
+
step: input.step,
|
|
445
|
+
stream: input.stream,
|
|
446
|
+
signal: controller.signal,
|
|
447
|
+
onStatus: (status) => sendBack({
|
|
448
|
+
type: "DETECTION_STATUS",
|
|
449
|
+
status
|
|
450
|
+
}),
|
|
451
|
+
onOrientation: (orientation) => sendBack({
|
|
452
|
+
type: "ORIENTATION",
|
|
453
|
+
orientation
|
|
454
|
+
}),
|
|
455
|
+
registerManualCapture: (trigger) => {
|
|
456
|
+
manualCaptureTrigger = trigger;
|
|
457
|
+
}
|
|
458
|
+
}).then((result) => {
|
|
459
|
+
if (result.outcome === "retryableFailure") {
|
|
460
|
+
sendBack({
|
|
461
|
+
type: "RETRYABLE_FAILURE",
|
|
462
|
+
failure: result.failure
|
|
463
|
+
});
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
if (result.outcome === "validationFailed") {
|
|
467
|
+
sendBack({
|
|
468
|
+
type: "VALIDATION_FAILED",
|
|
469
|
+
failure: result.failure
|
|
470
|
+
});
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
sendBack({ type: "DETECTION_DONE" });
|
|
474
|
+
}).catch((err) => {
|
|
475
|
+
if (!controller.signal.aborted) sendBack({
|
|
476
|
+
type: "DETECTION_FAILED",
|
|
477
|
+
error: String(err)
|
|
478
|
+
});
|
|
479
|
+
});
|
|
480
|
+
return () => controller.abort();
|
|
481
|
+
})
|
|
482
|
+
},
|
|
483
|
+
actions: {
|
|
484
|
+
advanceStep: assign({
|
|
485
|
+
stepIndex: ({ context }) => context.stepIndex + 1,
|
|
486
|
+
attemptsRemaining: ({ context }) => context.attemptsPerStep,
|
|
487
|
+
validationFailure: () => void 0
|
|
488
|
+
}),
|
|
489
|
+
setDetectionStatus: assign(({ context, event }) => {
|
|
490
|
+
const status = detectionStatusFromEvent(event);
|
|
491
|
+
return {
|
|
492
|
+
detectionStatus: status,
|
|
493
|
+
manualCaptureAvailable: context.manualCaptureAvailable || status === "manualCapture"
|
|
494
|
+
};
|
|
495
|
+
}),
|
|
496
|
+
setOrientation: assign({ orientation: ({ event }) => orientationFromEvent(event) }),
|
|
497
|
+
setValidationFailure: assign(({ context, event }) => ({
|
|
498
|
+
attemptsRemaining: context.attemptsRemaining === UNLIMITED_ATTEMPTS ? UNLIMITED_ATTEMPTS : Math.max(0, context.attemptsRemaining - 1),
|
|
499
|
+
validationFailure: validationFailureFromEvent(event),
|
|
500
|
+
detectionStatus: "error"
|
|
501
|
+
})),
|
|
502
|
+
setUncountedRetryableFailure: assign(({ event }) => ({
|
|
503
|
+
validationFailure: retryableFailureFromEvent(event),
|
|
504
|
+
detectionStatus: "error"
|
|
505
|
+
})),
|
|
506
|
+
setErrorFromDetection: assign({ error: ({ event }) => detectionErrorFromEvent(event) }),
|
|
507
|
+
setAttemptsExhaustedError: assign({ error: () => "Capture attempts exhausted" }),
|
|
508
|
+
clearDetectionFeedback: assign({
|
|
509
|
+
detectionStatus: () => void 0,
|
|
510
|
+
validationFailure: () => void 0,
|
|
511
|
+
orientation: () => void 0,
|
|
512
|
+
manualCaptureAvailable: () => false
|
|
513
|
+
}),
|
|
514
|
+
resetSession: assign(({ context }) => ({
|
|
515
|
+
stepIndex: 0,
|
|
516
|
+
stream: void 0,
|
|
517
|
+
composite: void 0,
|
|
518
|
+
finishStatus: void 0,
|
|
519
|
+
orientation: void 0,
|
|
520
|
+
manualCaptureAvailable: false,
|
|
521
|
+
detectionStatus: void 0,
|
|
522
|
+
validationFailure: void 0,
|
|
523
|
+
attemptsRemaining: context.attemptsPerStep,
|
|
524
|
+
error: void 0
|
|
525
|
+
})),
|
|
526
|
+
cleanup: ({ context }) => {
|
|
527
|
+
context.compositor.stop();
|
|
528
|
+
context.stream?.getTracks().forEach((track) => track.stop());
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
guards: {
|
|
532
|
+
isLastStep: ({ context }) => context.stepIndex >= context.steps.length - 1,
|
|
533
|
+
hasAttemptsRemaining: ({ context }) => context.attemptsRemaining === UNLIMITED_ATTEMPTS || context.attemptsRemaining > 0,
|
|
534
|
+
nextStepFlipsId: ({ context }) => context.steps[context.stepIndex] === "frontId" && context.steps[context.stepIndex + 1] === "backId",
|
|
535
|
+
/** The accepted step closes the ID section → run `process/id` next. */
|
|
536
|
+
completedIdSection: ({ context }) => isIdStep(context.steps[context.stepIndex]) && !isIdStep(context.steps[context.stepIndex + 1]),
|
|
537
|
+
nextStepFlipsCamera: ({ context }) => facingModeForStep(context.steps[context.stepIndex]) !== facingModeForStep(context.steps[context.stepIndex + 1])
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
/**
|
|
541
|
+
* Shared advance transitions for an accepted step. Order matters: closing the
|
|
542
|
+
* ID section routes through `processingId` first; the front→back flip shows
|
|
543
|
+
* the flip modal; the final step ends the session.
|
|
544
|
+
*/
|
|
545
|
+
const ADVANCE_TRANSITIONS = [
|
|
546
|
+
{
|
|
547
|
+
target: "flippingId",
|
|
548
|
+
guard: "nextStepFlipsId"
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
target: "processingId",
|
|
552
|
+
guard: "completedIdSection"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
target: "finishing",
|
|
556
|
+
guard: "isLastStep"
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
target: "switchingCamera",
|
|
560
|
+
guard: "nextStepFlipsCamera",
|
|
561
|
+
actions: "advanceStep"
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
target: "capturing",
|
|
565
|
+
reenter: true,
|
|
566
|
+
actions: "advanceStep"
|
|
567
|
+
}
|
|
568
|
+
];
|
|
569
|
+
const idSelfieFlowMachine = idSelfieFlowSetup.createMachine({
|
|
570
|
+
id: "idSelfieFlow",
|
|
571
|
+
initial: "idle",
|
|
572
|
+
context: ({ input }) => ({
|
|
573
|
+
compositor: input.dependencies?.createCompositor?.() ?? new CameraCompositor(),
|
|
574
|
+
acquireCamera: input.dependencies?.acquireCamera ?? defaultAcquireCamera,
|
|
575
|
+
detect: input.dependencies?.detect ?? manualStepDetector,
|
|
576
|
+
runProcessId: input.dependencies?.runProcessId ?? (async (queueName, signal) => {
|
|
577
|
+
await processId(false, queueName, signal);
|
|
578
|
+
}),
|
|
579
|
+
runFinish: input.dependencies?.runFinish ?? ((signal) => getFinishStatus(void 0, signal)),
|
|
580
|
+
finishStatus: void 0,
|
|
581
|
+
steps: input.steps && input.steps.length > 0 ? input.steps : [
|
|
582
|
+
"frontId",
|
|
583
|
+
"backId",
|
|
584
|
+
"selfie"
|
|
585
|
+
],
|
|
586
|
+
stepIndex: 0,
|
|
587
|
+
stream: void 0,
|
|
588
|
+
composite: void 0,
|
|
589
|
+
detectionStatus: void 0,
|
|
590
|
+
orientation: void 0,
|
|
591
|
+
manualCaptureAvailable: false,
|
|
592
|
+
validationFailure: void 0,
|
|
593
|
+
attemptsPerStep: normalizeAttempts(input.attemptsPerStep),
|
|
594
|
+
attemptsRemaining: normalizeAttempts(input.attemptsPerStep),
|
|
595
|
+
processIdQueueName: input.processIdQueueName ?? "",
|
|
596
|
+
error: void 0,
|
|
597
|
+
switchingCameraMinDwellMs: input.dependencies?.switchingCameraMinDwellMs ?? SWITCHING_CAMERA_MIN_DWELL_MS
|
|
598
|
+
}),
|
|
599
|
+
on: { ABORT: { target: ".closed" } },
|
|
600
|
+
states: {
|
|
601
|
+
idle: { on: { START: { target: "acquiringCamera" } } },
|
|
602
|
+
acquiringCamera: { invoke: {
|
|
603
|
+
src: "acquireCamera",
|
|
604
|
+
input: ({ context }) => ({
|
|
605
|
+
acquire: context.acquireCamera,
|
|
606
|
+
facingMode: facingModeForStep(context.steps[context.stepIndex])
|
|
607
|
+
}),
|
|
608
|
+
onDone: {
|
|
609
|
+
target: "capturing",
|
|
610
|
+
actions: [({ context, event }) => {
|
|
611
|
+
context.compositor.start(eventOutputStream(event));
|
|
612
|
+
}, assign({
|
|
613
|
+
stream: ({ event }) => eventOutputStream(event),
|
|
614
|
+
composite: ({ context }) => context.compositor.stream
|
|
615
|
+
})]
|
|
616
|
+
},
|
|
617
|
+
onError: {
|
|
618
|
+
target: "error",
|
|
619
|
+
actions: assign({ error: ({ event }) => errorFromEvent(event) })
|
|
620
|
+
}
|
|
621
|
+
} },
|
|
622
|
+
capturing: {
|
|
623
|
+
entry: "clearDetectionFeedback",
|
|
624
|
+
invoke: {
|
|
625
|
+
id: "detectStep",
|
|
626
|
+
src: "detectStep",
|
|
627
|
+
input: ({ context }) => ({
|
|
628
|
+
detect: context.detect,
|
|
629
|
+
step: context.steps[context.stepIndex],
|
|
630
|
+
stream: context.stream
|
|
631
|
+
})
|
|
632
|
+
},
|
|
633
|
+
on: {
|
|
634
|
+
DETECTION_STATUS: { actions: "setDetectionStatus" },
|
|
635
|
+
ORIENTATION: { actions: "setOrientation" },
|
|
636
|
+
MANUAL_CAPTURE: { actions: sendTo("detectStep", { type: "MANUAL_CAPTURE" }) },
|
|
637
|
+
DETECTION_DONE: ADVANCE_TRANSITIONS,
|
|
638
|
+
NEXT_STEP: ADVANCE_TRANSITIONS,
|
|
639
|
+
VALIDATION_FAILED: {
|
|
640
|
+
target: "validationFeedback",
|
|
641
|
+
actions: "setValidationFailure"
|
|
642
|
+
},
|
|
643
|
+
RETRYABLE_FAILURE: {
|
|
644
|
+
target: "validationFeedback",
|
|
645
|
+
actions: "setUncountedRetryableFailure"
|
|
646
|
+
},
|
|
647
|
+
DETECTION_FAILED: {
|
|
648
|
+
target: "error",
|
|
649
|
+
actions: "setErrorFromDetection"
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
validationFeedback: { after: { VALIDATION_FEEDBACK_DWELL: [{
|
|
654
|
+
target: "capturing",
|
|
655
|
+
guard: "hasAttemptsRemaining"
|
|
656
|
+
}, {
|
|
657
|
+
target: "error",
|
|
658
|
+
actions: "setAttemptsExhaustedError"
|
|
659
|
+
}] } },
|
|
660
|
+
flippingId: {
|
|
661
|
+
after: { ID_FLIP_DWELL: {
|
|
662
|
+
target: "capturing",
|
|
663
|
+
actions: "advanceStep"
|
|
664
|
+
} },
|
|
665
|
+
on: { NEXT_STEP: {
|
|
666
|
+
target: "capturing",
|
|
667
|
+
actions: "advanceStep"
|
|
668
|
+
} }
|
|
669
|
+
},
|
|
670
|
+
processingId: { invoke: {
|
|
671
|
+
src: "runProcessId",
|
|
672
|
+
input: ({ context }) => ({
|
|
673
|
+
run: context.runProcessId,
|
|
674
|
+
queueName: context.processIdQueueName
|
|
675
|
+
}),
|
|
676
|
+
onDone: [
|
|
677
|
+
{
|
|
678
|
+
target: "finishing",
|
|
679
|
+
guard: "isLastStep"
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
target: "switchingCamera",
|
|
683
|
+
guard: "nextStepFlipsCamera",
|
|
684
|
+
actions: "advanceStep"
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
target: "capturing",
|
|
688
|
+
reenter: true,
|
|
689
|
+
actions: "advanceStep"
|
|
690
|
+
}
|
|
691
|
+
],
|
|
692
|
+
onError: {
|
|
693
|
+
target: "error",
|
|
694
|
+
actions: assign({ error: ({ event }) => errorFromEvent(event) })
|
|
695
|
+
}
|
|
696
|
+
} },
|
|
697
|
+
switchingCamera: { invoke: {
|
|
698
|
+
src: "switchCamera",
|
|
699
|
+
input: ({ context }) => ({
|
|
700
|
+
acquire: context.acquireCamera,
|
|
701
|
+
facingMode: facingModeForStep(context.steps[context.stepIndex]),
|
|
702
|
+
minDwellMs: context.switchingCameraMinDwellMs
|
|
703
|
+
}),
|
|
704
|
+
onDone: {
|
|
705
|
+
target: "capturing",
|
|
706
|
+
actions: [({ context, event }) => {
|
|
707
|
+
context.compositor.switchVideo(eventOutputStream(event));
|
|
708
|
+
}, assign({ stream: ({ event }) => eventOutputStream(event) })]
|
|
709
|
+
},
|
|
710
|
+
onError: {
|
|
711
|
+
target: "error",
|
|
712
|
+
actions: assign({ error: ({ event }) => errorFromEvent(event) })
|
|
713
|
+
}
|
|
714
|
+
} },
|
|
715
|
+
finishing: {
|
|
716
|
+
entry: "cleanup",
|
|
717
|
+
invoke: {
|
|
718
|
+
src: "runFinish",
|
|
719
|
+
input: ({ context }) => ({ run: context.runFinish }),
|
|
720
|
+
onDone: {
|
|
721
|
+
target: "success",
|
|
722
|
+
actions: assign({ finishStatus: ({ event }) => finishStatusFromEvent(event) })
|
|
723
|
+
},
|
|
724
|
+
onError: {
|
|
725
|
+
target: "error",
|
|
726
|
+
actions: assign({ error: ({ event }) => errorFromEvent(event) })
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
},
|
|
730
|
+
success: { after: { FINAL_SUCCESS_DWELL: "finished" } },
|
|
731
|
+
finished: { type: "final" },
|
|
732
|
+
error: {
|
|
733
|
+
entry: "cleanup",
|
|
734
|
+
on: { RETRY: {
|
|
735
|
+
target: "acquiringCamera",
|
|
736
|
+
actions: "resetSession"
|
|
737
|
+
} }
|
|
738
|
+
},
|
|
739
|
+
closed: {
|
|
740
|
+
type: "final",
|
|
741
|
+
entry: "cleanup"
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
//#endregion
|
|
746
|
+
//#region src/modules/id-selfie-flow/idSelfieFlowActor.ts
|
|
747
|
+
function createIdSelfieFlowActor(options = {}) {
|
|
748
|
+
const config = options.config;
|
|
749
|
+
const detect = options.dependencies?.detect ?? (config ? createIdSelfieFlowStepDetector(config, { getWasmUtil: () => WasmUtilProvider.getInstance() }) : void 0);
|
|
750
|
+
return createActor(idSelfieFlowMachine, { input: {
|
|
751
|
+
steps: config?.steps,
|
|
752
|
+
attemptsPerStep: config?.numberOfTries,
|
|
753
|
+
processIdQueueName: config?.processIdQueueName,
|
|
754
|
+
dependencies: {
|
|
755
|
+
...options.dependencies,
|
|
756
|
+
detect
|
|
757
|
+
}
|
|
758
|
+
} }).start();
|
|
759
|
+
}
|
|
760
|
+
//#endregion
|
|
761
|
+
//#region src/modules/id-selfie-flow/idSelfieFlowManager.ts
|
|
762
|
+
function mapState(snapshot) {
|
|
763
|
+
const value = typeof snapshot.value === "string" ? snapshot.value : "idle";
|
|
764
|
+
const { context } = snapshot;
|
|
765
|
+
const status = value === "acquiringCamera" ? "starting" : value;
|
|
766
|
+
const steps = context.steps;
|
|
767
|
+
const stepIndex = context.stepIndex;
|
|
768
|
+
return {
|
|
769
|
+
status,
|
|
770
|
+
step: steps[stepIndex],
|
|
771
|
+
stepIndex,
|
|
772
|
+
isLastStep: stepIndex >= steps.length - 1,
|
|
773
|
+
stream: context.stream,
|
|
774
|
+
composite: context.composite,
|
|
775
|
+
detectionStatus: context.detectionStatus,
|
|
776
|
+
orientation: context.orientation,
|
|
777
|
+
manualCaptureAvailable: context.manualCaptureAvailable,
|
|
778
|
+
validationFailure: context.validationFailure,
|
|
779
|
+
attemptsRemaining: context.attemptsRemaining,
|
|
780
|
+
finishStatus: context.finishStatus,
|
|
781
|
+
error: context.error
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
function createApi({ actor }) {
|
|
785
|
+
return {
|
|
786
|
+
/** Acquire the first camera and begin the capture session. */
|
|
787
|
+
start() {
|
|
788
|
+
actor.send({ type: "START" });
|
|
789
|
+
},
|
|
790
|
+
retry() {
|
|
791
|
+
actor.send({ type: "RETRY" });
|
|
792
|
+
},
|
|
793
|
+
/**
|
|
794
|
+
* Advance to the next step (manual steps only — the capture steps
|
|
795
|
+
* auto-advance once the backend accepts the frame).
|
|
796
|
+
*/
|
|
797
|
+
nextStep() {
|
|
798
|
+
actor.send({ type: "NEXT_STEP" });
|
|
799
|
+
},
|
|
800
|
+
/**
|
|
801
|
+
* Capture + upload the current ID frame. Meaningful once
|
|
802
|
+
* `manualCaptureAvailable` is `true` (autocapture timed out).
|
|
803
|
+
*/
|
|
804
|
+
manualCapture() {
|
|
805
|
+
actor.send({ type: "MANUAL_CAPTURE" });
|
|
806
|
+
},
|
|
807
|
+
/** Abandon the session. */
|
|
808
|
+
abort() {
|
|
809
|
+
actor.send({ type: "ABORT" });
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Creates a manager for the ID + Selfie flow PoC: the regular ID front/back +
|
|
815
|
+
* selfie capture pipeline (regular endpoints, regular validations) presented
|
|
816
|
+
* through the Video Selfie continuous-camera UX. No recording, no microphone.
|
|
817
|
+
*
|
|
818
|
+
* Exposes `getState()` / `subscribe()` (status, step, preview `stream`) plus
|
|
819
|
+
* `start()`, `nextStep()`, `retry()`, and `abort()`.
|
|
820
|
+
*/
|
|
821
|
+
function createIdSelfieFlowManager(options = {}) {
|
|
822
|
+
const actor = createIdSelfieFlowActor(options);
|
|
823
|
+
const manager = createManager({
|
|
824
|
+
actor,
|
|
825
|
+
mapState,
|
|
826
|
+
createApi
|
|
827
|
+
});
|
|
828
|
+
return {
|
|
829
|
+
...manager,
|
|
830
|
+
stop() {
|
|
831
|
+
if (actor.getSnapshot().status === "active") actor.send({ type: "ABORT" });
|
|
832
|
+
manager.stop();
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
//#endregion
|
|
837
|
+
//#region src/modules/id-selfie-flow/idSelfieFlowWasm.ts
|
|
838
|
+
/**
|
|
839
|
+
* The WASM pipelines an ID + Selfie flow session loads: the Video Selfie face
|
|
840
|
+
* pipeline for the selfie step, plus the REGULAR ID-capture pipeline (same as
|
|
841
|
+
* the standalone ID module — best-frame autocapture, quality scoring, mask
|
|
842
|
+
* orientation) when any ID step is active.
|
|
843
|
+
*/
|
|
844
|
+
function idSelfieFlowWasmPipelines(config) {
|
|
845
|
+
const steps = config.steps ?? [
|
|
846
|
+
"frontId",
|
|
847
|
+
"backId",
|
|
848
|
+
"selfie"
|
|
849
|
+
];
|
|
850
|
+
const pipelines = ["videoSelfie"];
|
|
851
|
+
if (steps.includes("frontId") || steps.includes("backId")) pipelines.push("idCapture");
|
|
852
|
+
return pipelines;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Warms the WASM pipelines the ID + Selfie flow needs. Idempotent and safe to
|
|
856
|
+
* call eagerly (e.g. while the tutorial or permissions screen is up). No-op
|
|
857
|
+
* when WASM was not configured.
|
|
858
|
+
*/
|
|
859
|
+
function warmupIdSelfieFlowWasm(config) {
|
|
860
|
+
return ensureWasmPipelines(idSelfieFlowWasmPipelines(config));
|
|
861
|
+
}
|
|
862
|
+
//#endregion
|
|
863
|
+
//#region src/modules/id-selfie-flow/idSelfieFlowDashboardConfig.ts
|
|
864
|
+
function definedEntries(value) {
|
|
865
|
+
return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== void 0));
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Derives the ID + Selfie flow config from the active session's FLOW
|
|
869
|
+
* configuration — the same dashboard config the regular ID and SELFIE modules
|
|
870
|
+
* read. Requires an active session token (`initializeSession`).
|
|
871
|
+
*
|
|
872
|
+
* Mapping:
|
|
873
|
+
* - Steps: `frontId`/`backId` when the flow has an ID module (`onlyFront` /
|
|
874
|
+
* `onlyBack` respected), `selfie` when it has a SELFIE module.
|
|
875
|
+
* - `showTutorials`: either module's `showTutorial`.
|
|
876
|
+
* - `numberOfTries`: the larger of the two modules' `captureAttempts`.
|
|
877
|
+
* - Selfie validations (`validateLenses` / mask / eyes / head cover): from
|
|
878
|
+
* the SELFIE module config.
|
|
879
|
+
*
|
|
880
|
+
* A module missing from the flow simply drops its steps; if neither module is
|
|
881
|
+
* present the promise rejects. Any `options.config` values win over the
|
|
882
|
+
* derived ones. If the flow cannot be fetched but `options.config` was
|
|
883
|
+
* provided, it is returned as-is (standalone fallback).
|
|
884
|
+
*/
|
|
885
|
+
async function resolveIdSelfieFlowConfig(options = {}) {
|
|
886
|
+
const overrides = options.config ? definedEntries(options.config) : {};
|
|
887
|
+
const [idConfig, selfieConfig] = await Promise.all([resolveDashboardModuleConfig({
|
|
888
|
+
moduleKey: "ID",
|
|
889
|
+
signal: options.signal
|
|
890
|
+
}).catch(() => void 0), resolveDashboardModuleConfig({
|
|
891
|
+
moduleKey: "SELFIE",
|
|
892
|
+
signal: options.signal
|
|
893
|
+
}).catch(() => void 0)]);
|
|
894
|
+
if (!idConfig && !selfieConfig) {
|
|
895
|
+
if (options.config) return options.config;
|
|
896
|
+
throw new Error("The active flow has neither an ID nor a SELFIE module (and no config was provided)");
|
|
897
|
+
}
|
|
898
|
+
const steps = [];
|
|
899
|
+
if (idConfig) {
|
|
900
|
+
if (idConfig.onlyBack !== true) steps.push("frontId");
|
|
901
|
+
if (idConfig.onlyFront !== true) steps.push("backId");
|
|
902
|
+
}
|
|
903
|
+
if (selfieConfig) steps.push("selfie");
|
|
904
|
+
const attempts = Math.max(typeof idConfig?.captureAttempts === "number" ? idConfig.captureAttempts : 0, typeof selfieConfig?.captureAttempts === "number" ? selfieConfig.captureAttempts : 0);
|
|
905
|
+
return {
|
|
906
|
+
steps,
|
|
907
|
+
showTutorials: idConfig?.showTutorial === true || selfieConfig?.showTutorial === true,
|
|
908
|
+
...attempts > 0 ? { numberOfTries: attempts } : {},
|
|
909
|
+
validateLenses: selfieConfig?.validateLenses ?? false,
|
|
910
|
+
validateFaceMask: selfieConfig?.validateFaceMask ?? false,
|
|
911
|
+
validateClosedEyes: selfieConfig?.validateClosedEyes ?? false,
|
|
912
|
+
validateHeadCover: selfieConfig?.validateHeadCover ?? false,
|
|
913
|
+
...overrides
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
//#endregion
|
|
917
|
+
export { createIdSelfieFlowManager, resolveIdSelfieFlowConfig, warmupIdSelfieFlowWasm };
|