@idmission/websdk-core 0.1.0-rc.1
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/README.md +66 -0
- package/dist/attestation/attestationState.d.ts +24 -0
- package/dist/attestation/attestationState.d.ts.map +1 -0
- package/dist/attestation/attestationState.js +57 -0
- package/dist/attestation/clientAttestation.d.ts +40 -0
- package/dist/attestation/clientAttestation.d.ts.map +1 -0
- package/dist/attestation/clientAttestation.js +19 -0
- package/dist/attestation/collectClientAttestation.d.ts +10 -0
- package/dist/attestation/collectClientAttestation.d.ts.map +1 -0
- package/dist/attestation/collectClientAttestation.js +18 -0
- package/dist/attestation/index.d.ts +5 -0
- package/dist/attestation/index.d.ts.map +1 -0
- package/dist/attestation/index.js +4 -0
- package/dist/attestation/nativeAttestationBridge.d.ts +3 -0
- package/dist/attestation/nativeAttestationBridge.d.ts.map +1 -0
- package/dist/attestation/nativeAttestationBridge.js +38 -0
- package/dist/barcode/AAMVAParser.d.ts +77 -0
- package/dist/barcode/AAMVAParser.d.ts.map +1 -0
- package/dist/barcode/AAMVAParser.js +422 -0
- package/dist/barcode/NativeBarcodeDecoder.d.ts +157 -0
- package/dist/barcode/NativeBarcodeDecoder.d.ts.map +1 -0
- package/dist/barcode/NativeBarcodeDecoder.js +832 -0
- package/dist/barcode/Parse.d.ts +6 -0
- package/dist/barcode/Parse.d.ts.map +1 -0
- package/dist/barcode/Parse.js +148 -0
- package/dist/barcode/decodeSummary.d.ts +45 -0
- package/dist/barcode/decodeSummary.d.ts.map +1 -0
- package/dist/barcode/decodeSummary.js +23 -0
- package/dist/barcode/index.d.ts +5 -0
- package/dist/barcode/index.d.ts.map +1 -0
- package/dist/barcode/index.js +4 -0
- package/dist/camera/Camera.d.ts +37 -0
- package/dist/camera/Camera.d.ts.map +1 -0
- package/dist/camera/Camera.js +453 -0
- package/dist/camera/acquireCamera.d.ts +29 -0
- package/dist/camera/acquireCamera.d.ts.map +1 -0
- package/dist/camera/acquireCamera.js +224 -0
- package/dist/camera/cameraSignals.d.ts +23 -0
- package/dist/camera/cameraSignals.d.ts.map +1 -0
- package/dist/camera/cameraSignals.js +32 -0
- package/dist/camera/getUserMediaIntegrity.d.ts +72 -0
- package/dist/camera/getUserMediaIntegrity.d.ts.map +1 -0
- package/dist/camera/getUserMediaIntegrity.js +256 -0
- package/dist/camera/index.d.ts +6 -0
- package/dist/camera/index.d.ts.map +1 -0
- package/dist/camera/index.js +5 -0
- package/dist/camera/isVirtualCamera.d.ts +10 -0
- package/dist/camera/isVirtualCamera.d.ts.map +1 -0
- package/dist/camera/isVirtualCamera.js +11 -0
- package/dist/client/IdmissionClient.d.ts +151 -0
- package/dist/client/IdmissionClient.d.ts.map +1 -0
- package/dist/client/IdmissionClient.js +638 -0
- package/dist/client/additionalDocument.d.ts +14 -0
- package/dist/client/additionalDocument.d.ts.map +1 -0
- package/dist/client/additionalDocument.js +24 -0
- package/dist/client/artifacts.d.ts +146 -0
- package/dist/client/artifacts.d.ts.map +1 -0
- package/dist/client/artifacts.js +1 -0
- package/dist/client/blobToB64.d.ts +2 -0
- package/dist/client/blobToB64.d.ts.map +1 -0
- package/dist/client/blobToB64.js +17 -0
- package/dist/client/endpoints.d.ts +7 -0
- package/dist/client/endpoints.d.ts.map +1 -0
- package/dist/client/endpoints.js +59 -0
- package/dist/client/errors.d.ts +20 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +45 -0
- package/dist/client/index.d.ts +23 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +38 -0
- package/dist/client/payload.d.ts +36 -0
- package/dist/client/payload.d.ts.map +1 -0
- package/dist/client/payload.js +397 -0
- package/dist/client/sessionMachine.d.ts +26 -0
- package/dist/client/sessionMachine.d.ts.map +1 -0
- package/dist/client/sessionMachine.js +23 -0
- package/dist/client/submissionMetadata.d.ts +31 -0
- package/dist/client/submissionMetadata.d.ts.map +1 -0
- package/dist/client/submissionMetadata.js +90 -0
- package/dist/client/timings.d.ts +49 -0
- package/dist/client/timings.d.ts.map +1 -0
- package/dist/client/timings.js +32 -0
- package/dist/client/types.d.ts +305 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +18 -0
- package/dist/client/upload.d.ts +60 -0
- package/dist/client/upload.d.ts.map +1 -0
- package/dist/client/upload.js +313 -0
- package/dist/client/uploadedDocument.d.ts +7 -0
- package/dist/client/uploadedDocument.d.ts.map +1 -0
- package/dist/client/uploadedDocument.js +4 -0
- package/dist/client/urls.d.ts +30 -0
- package/dist/client/urls.d.ts.map +1 -0
- package/dist/client/urls.js +73 -0
- package/dist/client/validateSession.d.ts +7 -0
- package/dist/client/validateSession.d.ts.map +1 -0
- package/dist/client/validateSession.js +63 -0
- package/dist/config/cdn.d.ts +2 -0
- package/dist/config/cdn.d.ts.map +1 -0
- package/dist/config/cdn.js +1 -0
- package/dist/diagnostics/buffer.d.ts +8 -0
- package/dist/diagnostics/buffer.d.ts.map +1 -0
- package/dist/diagnostics/buffer.js +25 -0
- package/dist/diagnostics/envCapability.d.ts +3 -0
- package/dist/diagnostics/envCapability.d.ts.map +1 -0
- package/dist/diagnostics/envCapability.js +40 -0
- package/dist/diagnostics/floodControl.d.ts +6 -0
- package/dist/diagnostics/floodControl.d.ts.map +1 -0
- package/dist/diagnostics/floodControl.js +29 -0
- package/dist/diagnostics/index.d.ts +8 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics/index.js +17 -0
- package/dist/diagnostics/install.d.ts +20 -0
- package/dist/diagnostics/install.d.ts.map +1 -0
- package/dist/diagnostics/install.js +159 -0
- package/dist/diagnostics/redaction.d.ts +7 -0
- package/dist/diagnostics/redaction.d.ts.map +1 -0
- package/dist/diagnostics/redaction.js +73 -0
- package/dist/diagnostics/transport.d.ts +15 -0
- package/dist/diagnostics/transport.d.ts.map +1 -0
- package/dist/diagnostics/transport.js +35 -0
- package/dist/diagnostics/types.d.ts +59 -0
- package/dist/diagnostics/types.d.ts.map +1 -0
- package/dist/diagnostics/types.js +1 -0
- package/dist/documentCapture/controller.d.ts +35 -0
- package/dist/documentCapture/controller.d.ts.map +1 -0
- package/dist/documentCapture/controller.js +254 -0
- package/dist/documentCapture/index.d.ts +4 -0
- package/dist/documentCapture/index.d.ts.map +1 -0
- package/dist/documentCapture/index.js +8 -0
- package/dist/documentCapture/reducer.d.ts +31 -0
- package/dist/documentCapture/reducer.d.ts.map +1 -0
- package/dist/documentCapture/reducer.js +87 -0
- package/dist/documentCapture/state.d.ts +49 -0
- package/dist/documentCapture/state.d.ts.map +1 -0
- package/dist/documentCapture/state.js +36 -0
- package/dist/idCapture/controller.d.ts +228 -0
- package/dist/idCapture/controller.d.ts.map +1 -0
- package/dist/idCapture/controller.js +1453 -0
- package/dist/idCapture/errors.d.ts +36 -0
- package/dist/idCapture/errors.d.ts.map +1 -0
- package/dist/idCapture/errors.js +18 -0
- package/dist/idCapture/guidance.d.ts +80 -0
- package/dist/idCapture/guidance.d.ts.map +1 -0
- package/dist/idCapture/guidance.js +143 -0
- package/dist/idCapture/index.d.ts +22 -0
- package/dist/idCapture/index.d.ts.map +1 -0
- package/dist/idCapture/index.js +46 -0
- package/dist/idCapture/phase.d.ts +10 -0
- package/dist/idCapture/phase.d.ts.map +1 -0
- package/dist/idCapture/phase.js +28 -0
- package/dist/idCapture/pipeline.d.ts +176 -0
- package/dist/idCapture/pipeline.d.ts.map +1 -0
- package/dist/idCapture/pipeline.js +1028 -0
- package/dist/idCapture/reducer.d.ts +3 -0
- package/dist/idCapture/reducer.d.ts.map +1 -0
- package/dist/idCapture/reducer.js +661 -0
- package/dist/idCapture/requirements.d.ts +10 -0
- package/dist/idCapture/requirements.d.ts.map +1 -0
- package/dist/idCapture/requirements.js +43 -0
- package/dist/idCapture/stabilizer.d.ts +2 -0
- package/dist/idCapture/stabilizer.d.ts.map +1 -0
- package/dist/idCapture/stabilizer.js +4 -0
- package/dist/idCapture/state.d.ts +426 -0
- package/dist/idCapture/state.d.ts.map +1 -0
- package/dist/idCapture/state.js +91 -0
- package/dist/idCapture/submit.d.ts +33 -0
- package/dist/idCapture/submit.d.ts.map +1 -0
- package/dist/idCapture/submit.js +105 -0
- package/dist/idCapture/types.d.ts +20 -0
- package/dist/idCapture/types.d.ts.map +1 -0
- package/dist/idCapture/types.js +12 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/liveness/challengeGeometry.d.ts +66 -0
- package/dist/liveness/challengeGeometry.d.ts.map +1 -0
- package/dist/liveness/challengeGeometry.js +226 -0
- package/dist/liveness/challengeSequence.d.ts +49 -0
- package/dist/liveness/challengeSequence.d.ts.map +1 -0
- package/dist/liveness/challengeSequence.js +71 -0
- package/dist/liveness/index.d.ts +4 -0
- package/dist/liveness/index.d.ts.map +1 -0
- package/dist/liveness/index.js +3 -0
- package/dist/liveness/livenessResult.d.ts +11 -0
- package/dist/liveness/livenessResult.d.ts.map +1 -0
- package/dist/liveness/livenessResult.js +16 -0
- package/dist/models/BarcodeReadability.d.ts +36 -0
- package/dist/models/BarcodeReadability.d.ts.map +1 -0
- package/dist/models/BarcodeReadability.js +71 -0
- package/dist/models/CapabilityProbing.d.ts +25 -0
- package/dist/models/CapabilityProbing.d.ts.map +1 -0
- package/dist/models/CapabilityProbing.js +172 -0
- package/dist/models/DocumentDetection.d.ts +96 -0
- package/dist/models/DocumentDetection.d.ts.map +1 -0
- package/dist/models/DocumentDetection.js +257 -0
- package/dist/models/FaceDetection.d.ts +21 -0
- package/dist/models/FaceDetection.d.ts.map +1 -0
- package/dist/models/FaceDetection.js +4 -0
- package/dist/models/Focus.d.ts +36 -0
- package/dist/models/Focus.d.ts.map +1 -0
- package/dist/models/Focus.js +69 -0
- package/dist/models/FrameLoop.d.ts +13 -0
- package/dist/models/FrameLoop.d.ts.map +1 -0
- package/dist/models/FrameLoop.js +56 -0
- package/dist/models/VisionRuntime.d.ts +18 -0
- package/dist/models/VisionRuntime.d.ts.map +1 -0
- package/dist/models/VisionRuntime.js +158 -0
- package/dist/models/defaults/BarcodeReadability.d.ts +3 -0
- package/dist/models/defaults/BarcodeReadability.d.ts.map +1 -0
- package/dist/models/defaults/BarcodeReadability.js +3 -0
- package/dist/models/defaults/BarcodeReadabilityLiteRT.d.ts +3 -0
- package/dist/models/defaults/BarcodeReadabilityLiteRT.d.ts.map +1 -0
- package/dist/models/defaults/BarcodeReadabilityLiteRT.js +3 -0
- package/dist/models/defaults/DocumentDetector.d.ts +3 -0
- package/dist/models/defaults/DocumentDetector.d.ts.map +1 -0
- package/dist/models/defaults/DocumentDetector.js +3 -0
- package/dist/models/defaults/DocumentDetectorLiteRT.d.ts +3 -0
- package/dist/models/defaults/DocumentDetectorLiteRT.d.ts.map +1 -0
- package/dist/models/defaults/DocumentDetectorLiteRT.js +3 -0
- package/dist/models/defaults/FaceDetector.d.ts +3 -0
- package/dist/models/defaults/FaceDetector.d.ts.map +1 -0
- package/dist/models/defaults/FaceDetector.js +3 -0
- package/dist/models/defaults/FaceLandmarker.d.ts +3 -0
- package/dist/models/defaults/FaceLandmarker.d.ts.map +1 -0
- package/dist/models/defaults/FaceLandmarker.js +8 -0
- package/dist/models/defaults/FaceLandmarkerLiteRT.d.ts +3 -0
- package/dist/models/defaults/FaceLandmarkerLiteRT.d.ts.map +1 -0
- package/dist/models/defaults/FaceLandmarkerLiteRT.js +3 -0
- package/dist/models/defaults/Focus.d.ts +3 -0
- package/dist/models/defaults/Focus.d.ts.map +1 -0
- package/dist/models/defaults/Focus.js +3 -0
- package/dist/models/defaults/FocusLiteRT.d.ts +3 -0
- package/dist/models/defaults/FocusLiteRT.d.ts.map +1 -0
- package/dist/models/defaults/FocusLiteRT.js +3 -0
- package/dist/models/defaults/index.d.ts +31 -0
- package/dist/models/defaults/index.d.ts.map +1 -0
- package/dist/models/defaults/index.js +38 -0
- package/dist/models/helpers.d.ts +25 -0
- package/dist/models/helpers.d.ts.map +1 -0
- package/dist/models/helpers.js +98 -0
- package/dist/models/index.d.ts +15 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +14 -0
- package/dist/models/modelLifecycle.d.ts +26 -0
- package/dist/models/modelLifecycle.d.ts.map +1 -0
- package/dist/models/modelLifecycle.js +137 -0
- package/dist/models/occlusion.d.ts +20 -0
- package/dist/models/occlusion.d.ts.map +1 -0
- package/dist/models/occlusion.js +109 -0
- package/dist/models/passportBooklet.d.ts +34 -0
- package/dist/models/passportBooklet.d.ts.map +1 -0
- package/dist/models/passportBooklet.js +152 -0
- package/dist/models/preloadModels.d.ts +42 -0
- package/dist/models/preloadModels.d.ts.map +1 -0
- package/dist/models/preloadModels.js +204 -0
- package/dist/models/providers/litert/BarcodeReadability.d.ts +11 -0
- package/dist/models/providers/litert/BarcodeReadability.d.ts.map +1 -0
- package/dist/models/providers/litert/BarcodeReadability.js +135 -0
- package/dist/models/providers/litert/CapabilityProbe.d.ts +3 -0
- package/dist/models/providers/litert/CapabilityProbe.d.ts.map +1 -0
- package/dist/models/providers/litert/CapabilityProbe.js +44 -0
- package/dist/models/providers/litert/DocumentDetection.d.ts +18 -0
- package/dist/models/providers/litert/DocumentDetection.d.ts.map +1 -0
- package/dist/models/providers/litert/DocumentDetection.js +194 -0
- package/dist/models/providers/litert/FaceDetection.d.ts +11 -0
- package/dist/models/providers/litert/FaceDetection.d.ts.map +1 -0
- package/dist/models/providers/litert/FaceDetection.js +204 -0
- package/dist/models/providers/litert/FaceLandmarker.d.ts +11 -0
- package/dist/models/providers/litert/FaceLandmarker.d.ts.map +1 -0
- package/dist/models/providers/litert/FaceLandmarker.js +199 -0
- package/dist/models/providers/litert/Focus.d.ts +11 -0
- package/dist/models/providers/litert/Focus.d.ts.map +1 -0
- package/dist/models/providers/litert/Focus.js +141 -0
- package/dist/models/providers/litert/barcodeReadabilityPrePost.d.ts +6 -0
- package/dist/models/providers/litert/barcodeReadabilityPrePost.d.ts.map +1 -0
- package/dist/models/providers/litert/barcodeReadabilityPrePost.js +68 -0
- package/dist/models/providers/litert/blazeFacePrePost.d.ts +30 -0
- package/dist/models/providers/litert/blazeFacePrePost.d.ts.map +1 -0
- package/dist/models/providers/litert/blazeFacePrePost.js +206 -0
- package/dist/models/providers/litert/docDetectPrePost.d.ts +25 -0
- package/dist/models/providers/litert/docDetectPrePost.d.ts.map +1 -0
- package/dist/models/providers/litert/docDetectPrePost.js +197 -0
- package/dist/models/providers/litert/faceMeshPrePost.d.ts +23 -0
- package/dist/models/providers/litert/faceMeshPrePost.d.ts.map +1 -0
- package/dist/models/providers/litert/faceMeshPrePost.js +86 -0
- package/dist/models/providers/litert/focusPrePost.d.ts +6 -0
- package/dist/models/providers/litert/focusPrePost.d.ts.map +1 -0
- package/dist/models/providers/litert/focusPrePost.js +67 -0
- package/dist/models/providers/litert/runtime.d.ts +14 -0
- package/dist/models/providers/litert/runtime.d.ts.map +1 -0
- package/dist/models/providers/litert/runtime.js +83 -0
- package/dist/models/providers/mediapipe/BarcodeReadability.d.ts +11 -0
- package/dist/models/providers/mediapipe/BarcodeReadability.d.ts.map +1 -0
- package/dist/models/providers/mediapipe/BarcodeReadability.js +68 -0
- package/dist/models/providers/mediapipe/CapabilityProbe.d.ts +2 -0
- package/dist/models/providers/mediapipe/CapabilityProbe.d.ts.map +1 -0
- package/dist/models/providers/mediapipe/CapabilityProbe.js +14 -0
- package/dist/models/providers/mediapipe/DocumentDetection.d.ts +12 -0
- package/dist/models/providers/mediapipe/DocumentDetection.d.ts.map +1 -0
- package/dist/models/providers/mediapipe/DocumentDetection.js +90 -0
- package/dist/models/providers/mediapipe/FaceDetection.d.ts +11 -0
- package/dist/models/providers/mediapipe/FaceDetection.d.ts.map +1 -0
- package/dist/models/providers/mediapipe/FaceDetection.js +93 -0
- package/dist/models/providers/mediapipe/FaceLandmarker.d.ts +46 -0
- package/dist/models/providers/mediapipe/FaceLandmarker.d.ts.map +1 -0
- package/dist/models/providers/mediapipe/FaceLandmarker.js +166 -0
- package/dist/models/providers/mediapipe/Focus.d.ts +11 -0
- package/dist/models/providers/mediapipe/Focus.d.ts.map +1 -0
- package/dist/models/providers/mediapipe/Focus.js +51 -0
- package/dist/models/runtimeSelection.d.ts +5 -0
- package/dist/models/runtimeSelection.d.ts.map +1 -0
- package/dist/models/runtimeSelection.js +21 -0
- package/dist/selfieCapture/challengeRunner.d.ts +38 -0
- package/dist/selfieCapture/challengeRunner.d.ts.map +1 -0
- package/dist/selfieCapture/challengeRunner.js +181 -0
- package/dist/selfieCapture/controller.d.ts +166 -0
- package/dist/selfieCapture/controller.d.ts.map +1 -0
- package/dist/selfieCapture/controller.js +1253 -0
- package/dist/selfieCapture/faceTracking.d.ts +67 -0
- package/dist/selfieCapture/faceTracking.d.ts.map +1 -0
- package/dist/selfieCapture/faceTracking.js +158 -0
- package/dist/selfieCapture/guidance.d.ts +24 -0
- package/dist/selfieCapture/guidance.d.ts.map +1 -0
- package/dist/selfieCapture/guidance.js +41 -0
- package/dist/selfieCapture/index.d.ts +18 -0
- package/dist/selfieCapture/index.d.ts.map +1 -0
- package/dist/selfieCapture/index.js +11 -0
- package/dist/selfieCapture/lighting.d.ts +36 -0
- package/dist/selfieCapture/lighting.d.ts.map +1 -0
- package/dist/selfieCapture/lighting.js +95 -0
- package/dist/selfieCapture/livenessMachine.d.ts +66 -0
- package/dist/selfieCapture/livenessMachine.d.ts.map +1 -0
- package/dist/selfieCapture/livenessMachine.js +137 -0
- package/dist/selfieCapture/pipeline.d.ts +42 -0
- package/dist/selfieCapture/pipeline.d.ts.map +1 -0
- package/dist/selfieCapture/pipeline.js +282 -0
- package/dist/selfieCapture/reducer.d.ts +35 -0
- package/dist/selfieCapture/reducer.d.ts.map +1 -0
- package/dist/selfieCapture/reducer.js +143 -0
- package/dist/selfieCapture/state.d.ts +40 -0
- package/dist/selfieCapture/state.d.ts.map +1 -0
- package/dist/selfieCapture/state.js +36 -0
- package/dist/selfieCapture/testing/challengeFixtures.d.ts +43 -0
- package/dist/selfieCapture/testing/challengeFixtures.d.ts.map +1 -0
- package/dist/selfieCapture/testing/challengeFixtures.js +43 -0
- package/dist/signature/frameDecode.d.ts +48 -0
- package/dist/signature/frameDecode.d.ts.map +1 -0
- package/dist/signature/frameDecode.js +491 -0
- package/dist/signature/index.d.ts +5 -0
- package/dist/signature/index.d.ts.map +1 -0
- package/dist/signature/index.js +4 -0
- package/dist/signature/metadata.d.ts +63 -0
- package/dist/signature/metadata.d.ts.map +1 -0
- package/dist/signature/metadata.js +1 -0
- package/dist/signature/quality.d.ts +169 -0
- package/dist/signature/quality.d.ts.map +1 -0
- package/dist/signature/quality.js +186 -0
- package/dist/signature/signatureValidity.d.ts +149 -0
- package/dist/signature/signatureValidity.d.ts.map +1 -0
- package/dist/signature/signatureValidity.js +305 -0
- package/dist/signatureCapture/controller.d.ts +67 -0
- package/dist/signatureCapture/controller.d.ts.map +1 -0
- package/dist/signatureCapture/controller.js +534 -0
- package/dist/signatureCapture/guidance.d.ts +9 -0
- package/dist/signatureCapture/guidance.d.ts.map +1 -0
- package/dist/signatureCapture/guidance.js +7 -0
- package/dist/signatureCapture/index.d.ts +6 -0
- package/dist/signatureCapture/index.d.ts.map +1 -0
- package/dist/signatureCapture/index.js +5 -0
- package/dist/signatureCapture/pipeline.d.ts +111 -0
- package/dist/signatureCapture/pipeline.d.ts.map +1 -0
- package/dist/signatureCapture/pipeline.js +680 -0
- package/dist/signatureCapture/reducer.d.ts +42 -0
- package/dist/signatureCapture/reducer.d.ts.map +1 -0
- package/dist/signatureCapture/reducer.js +159 -0
- package/dist/signatureCapture/state.d.ts +92 -0
- package/dist/signatureCapture/state.d.ts.map +1 -0
- package/dist/signatureCapture/state.js +24 -0
- package/dist/utils/canvas.d.ts +4 -0
- package/dist/utils/canvas.d.ts.map +1 -0
- package/dist/utils/canvas.js +21 -0
- package/dist/utils/cropping.d.ts +8 -0
- package/dist/utils/cropping.d.ts.map +1 -0
- package/dist/utils/cropping.js +85 -0
- package/dist/utils/dataUrlToBase64.d.ts +7 -0
- package/dist/utils/dataUrlToBase64.d.ts.map +1 -0
- package/dist/utils/dataUrlToBase64.js +67 -0
- package/dist/utils/getFrameDimensions.d.ts +3 -0
- package/dist/utils/getFrameDimensions.d.ts.map +1 -0
- package/dist/utils/getFrameDimensions.js +12 -0
- package/dist/utils/isMobile.d.ts +3 -0
- package/dist/utils/isMobile.d.ts.map +1 -0
- package/dist/utils/isMobile.js +36 -0
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +25 -0
- package/dist/utils/platform.d.ts +4 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +11 -0
- package/dist/utils/stabilizer.d.ts +26 -0
- package/dist/utils/stabilizer.d.ts.map +1 -0
- package/dist/utils/stabilizer.js +65 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +1 -0
- package/dist/videoIdCapture/controller.d.ts +108 -0
- package/dist/videoIdCapture/controller.d.ts.map +1 -0
- package/dist/videoIdCapture/controller.js +833 -0
- package/dist/videoIdCapture/index.d.ts +5 -0
- package/dist/videoIdCapture/index.d.ts.map +1 -0
- package/dist/videoIdCapture/index.js +2 -0
- package/dist/videoIdCapture/state.d.ts +88 -0
- package/dist/videoIdCapture/state.d.ts.map +1 -0
- package/dist/videoIdCapture/state.js +67 -0
- package/package.json +111 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/idCapture/reducer.ts"],"names":[],"mappings":"AA6BA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAExB,MAAM,SAAS,CAAA;AA2BhB,eAAO,MAAM,eAAe,GAC1B,OAAO,kBAAkB,EACzB,QAAQ,mBAAmB,EAC3B,MAAK,MAAM,IAAuB,KACjC,kBA2yBF,CAAA"}
|
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
// Pure ID-capture flow reducer, ported from
|
|
2
|
+
// sdk2/src/components/id_capture/IdCaptureStateProvider.tsx:471-1236.
|
|
3
|
+
// Transformations from the sdk2 source (everything else is verbatim):
|
|
4
|
+
// - renamed `reducer` -> `reduceIdCapture`, `IdCaptureState` ->
|
|
5
|
+
// `IdCaptureFlowState`, `IdCaptureAction` -> `IdCaptureFlowAction`,
|
|
6
|
+
// `initialState` -> `initialFlowState`
|
|
7
|
+
// - injected clock: `now: () => Date = () => new Date()` replaces every
|
|
8
|
+
// inline `new Date()`; recursive self-calls thread `now` through
|
|
9
|
+
// - dropped the 5 UI-layout action cases (redrawRequested, redrawInProgress,
|
|
10
|
+
// redrawCompleted, pageRendered, guideImageLoaded) and the `dispatch`
|
|
11
|
+
// handling in resetWizard
|
|
12
|
+
import { CapturedDocumentTypeValues, } from './types';
|
|
13
|
+
import { computeFingerOcclusion, computeGlareOcclusion, computeHologramOcclusion, resolveFingerOcclusionThresholds, } from '../models/occlusion';
|
|
14
|
+
import { analyzePassportBooklet, } from '../models/passportBooklet';
|
|
15
|
+
import { remainingIdCaptureRequirements } from './requirements';
|
|
16
|
+
import { GuidanceCode, deriveGuidanceCode } from './guidance';
|
|
17
|
+
import { createStabilizerState, stabilizeStep } from './stabilizer';
|
|
18
|
+
import { initialFlowState, } from './state';
|
|
19
|
+
/**
|
|
20
|
+
* Clears the current frame's verdict (sdk2 idCaptureReducer.ts:367-389). Both
|
|
21
|
+
* of these describe "the last frame we looked at", so they are meaningless —
|
|
22
|
+
* and actively misleading — whenever the detection loop is not running against
|
|
23
|
+
* the document we are about to capture.
|
|
24
|
+
*
|
|
25
|
+
* The reducer only advances on `objectsDetected`, and no frames are dispatched
|
|
26
|
+
* while a flip is being requested or a capture is being finalized, so without an
|
|
27
|
+
* explicit clear these stay frozen at their last value: `isGoodFrame` stays true
|
|
28
|
+
* from the front of the card, and the held guidance code stays `HOLD_STILL` — so
|
|
29
|
+
* the pill and the guide box both sit green through the whole flip prompt and
|
|
30
|
+
* into the first frames of the back capture, before the back has even been seen.
|
|
31
|
+
*
|
|
32
|
+
* The cleared stabilizer is stamped at time 0, not `now()`, so its min-hold
|
|
33
|
+
* is already satisfied. `NONE` renders nothing, so holding it would just suppress
|
|
34
|
+
* the pill: stamping a fresh hold here would buy the *invisible* code a full
|
|
35
|
+
* 1800ms of dwell time and leave the user with no guidance at all for the first
|
|
36
|
+
* ~2s of every capture and of every flip. Only the debounce should gate the first
|
|
37
|
+
* real message.
|
|
38
|
+
*/
|
|
39
|
+
const clearedFrameVerdict = {
|
|
40
|
+
isGoodFrame: false,
|
|
41
|
+
guidance: createStabilizerState(GuidanceCode.NONE, 0),
|
|
42
|
+
};
|
|
43
|
+
export const reduceIdCapture = (state, action, now = () => new Date()) => {
|
|
44
|
+
switch (action.type) {
|
|
45
|
+
case 'configureWizard': {
|
|
46
|
+
const { captureRequirement, precapturedDocuments, allowSinglePageIdCapture, requireFullPassportBooklet, allowIdCardBackToFrontCapture, idCardBackCaptureRequired, enableFingerOcclusionGuidance, fingerOcclusionThresholds, enableGlareOcclusionGuidance, enableHologramOcclusionGuidance, enableOverrideWrongDocumentTypeDialog, allowOverrideWrongDocumentTypeAfterMs, allowUploadingDocumentsFromStorage, enableBarcodeRecapture, barcodeRecaptureThreshold, barcodeRecaptureTimeoutMs, aggressiveModeEnabled, } = action.payload;
|
|
47
|
+
let newState = {
|
|
48
|
+
...state,
|
|
49
|
+
captureRequirement,
|
|
50
|
+
allowSinglePageIdCapture: allowSinglePageIdCapture ?? false,
|
|
51
|
+
requireFullPassportBooklet: requireFullPassportBooklet ?? false,
|
|
52
|
+
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture ?? false,
|
|
53
|
+
idCardBackCaptureRequired: idCardBackCaptureRequired ?? true,
|
|
54
|
+
enableFingerOcclusionGuidance: enableFingerOcclusionGuidance ?? false,
|
|
55
|
+
fingerOcclusionThresholds: resolveFingerOcclusionThresholds(fingerOcclusionThresholds),
|
|
56
|
+
enableGlareOcclusionGuidance: enableGlareOcclusionGuidance ?? false,
|
|
57
|
+
enableHologramOcclusionGuidance: enableHologramOcclusionGuidance ?? false,
|
|
58
|
+
enableOverrideWrongDocumentTypeDialog,
|
|
59
|
+
allowOverrideWrongDocumentTypeAfterMs,
|
|
60
|
+
allowUploadingDocumentsFromStorage,
|
|
61
|
+
enableBarcodeRecapture: enableBarcodeRecapture ?? false,
|
|
62
|
+
barcodeRecaptureThreshold: barcodeRecaptureThreshold ?? 0,
|
|
63
|
+
barcodeRecaptureTimeoutMs: barcodeRecaptureTimeoutMs ?? 5000,
|
|
64
|
+
aggressiveModeEnabled: aggressiveModeEnabled ?? false,
|
|
65
|
+
// Reset before the seeding loop below, like every other configured
|
|
66
|
+
// field's `?? default`: `newState` spreads the previous state, so a
|
|
67
|
+
// reconfigure that passes no `precapturedDocuments` would otherwise
|
|
68
|
+
// inherit the prior call's seeded list and keep excluding documents
|
|
69
|
+
// the caller no longer supplies. Annotated because a bare `[]` in this
|
|
70
|
+
// literal infers `never[]` and narrows the whole `newState` object.
|
|
71
|
+
precapturedDocumentTypes: [],
|
|
72
|
+
};
|
|
73
|
+
if (captureRequirement === 'idCardBack')
|
|
74
|
+
newState.requestedDocumentType = 'idCardBack';
|
|
75
|
+
if (captureRequirement === 'passport')
|
|
76
|
+
newState.requestedDocumentType = 'passport';
|
|
77
|
+
if (precapturedDocuments) {
|
|
78
|
+
// Recorded alongside the replay so hosts can tell a handed-in document
|
|
79
|
+
// from one the user captured -- `documentCaptured` erases the
|
|
80
|
+
// difference by design (see state.ts precapturedDocumentTypes).
|
|
81
|
+
const seeded = [];
|
|
82
|
+
for (const k of CapturedDocumentTypeValues) {
|
|
83
|
+
const payload = precapturedDocuments[k];
|
|
84
|
+
if (payload) {
|
|
85
|
+
seeded.push(k);
|
|
86
|
+
newState.requestedDocumentType = k;
|
|
87
|
+
newState = reduceIdCapture(newState, { type: 'documentCaptured', payload }, now);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
newState.precapturedDocumentTypes = seeded;
|
|
91
|
+
}
|
|
92
|
+
if (newState.captureState === 'initializing' &&
|
|
93
|
+
!allowUploadingDocumentsFromStorage) {
|
|
94
|
+
newState.captureState = 'capturing';
|
|
95
|
+
}
|
|
96
|
+
return newState;
|
|
97
|
+
}
|
|
98
|
+
case 'setRequiredDocumentType':
|
|
99
|
+
return { ...state, requiredDocumentType: action.payload };
|
|
100
|
+
case 'objectsDetected': {
|
|
101
|
+
const { prediction: { detectedObjects, detectionThresholdMet, detectedDocumentType, idCardFrontDetectionScore, idCardFrontDetectionThresholdMet, idCardBackDetectionScore, idCardBackDetectionThresholdMet, passportDetectionScore, passportDetectionThresholdMet, singlePageDetectionScore, singlePageDetectionThresholdMet, bestDocument, documentInBounds, documentTooClose, documentIsStable, focusScore, focusThresholdMet, pdf417PredictionScore, pdf417PredictionThresholdMet, frameWidth, frameHeight, }, } = action.payload;
|
|
102
|
+
const frameCapturedAt = now();
|
|
103
|
+
let frameCaptureRate = state.frameCaptureRate;
|
|
104
|
+
let goodFramesThreshold = state.goodFramesThreshold;
|
|
105
|
+
if (state.lastFrameCapturedAt) {
|
|
106
|
+
const frameTime = frameCapturedAt.getTime() - state.lastFrameCapturedAt.getTime();
|
|
107
|
+
if (frameTime > 0) {
|
|
108
|
+
const instantRate = 1000.0 / frameTime;
|
|
109
|
+
// Smooth the frame rate with an exponential moving average so that
|
|
110
|
+
// goodFramesThreshold (and therefore the progress bar) doesn't
|
|
111
|
+
// jitter from frame-to-frame timing variance.
|
|
112
|
+
frameCaptureRate =
|
|
113
|
+
state.frameCaptureRate > 0
|
|
114
|
+
? state.frameCaptureRate * 0.9 + instantRate * 0.1
|
|
115
|
+
: instantRate;
|
|
116
|
+
if (frameCaptureRate > 0) {
|
|
117
|
+
goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const idCardDetected = detectedDocumentType.includes('idCard') ||
|
|
122
|
+
detectedDocumentType === 'singlePage';
|
|
123
|
+
const idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
|
|
124
|
+
const passportNotAllowed = !state.captureRequirement
|
|
125
|
+
.toLowerCase()
|
|
126
|
+
.includes('passport');
|
|
127
|
+
const idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
|
|
128
|
+
const idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
|
|
129
|
+
const idCardBeingCaptured = (idCardFrontWasCaptured && !idCardBackWasCaptured) ||
|
|
130
|
+
(!idCardFrontWasCaptured && idCardBackWasCaptured);
|
|
131
|
+
const passportDetectedButNotAllowed = detectedDocumentType === 'passport' &&
|
|
132
|
+
(passportNotAllowed || idCardBeingCaptured);
|
|
133
|
+
const flipRequired = !state.overrideWrongDocumentTypeGuidance &&
|
|
134
|
+
(state.allowIdCardBackToFrontCapture
|
|
135
|
+
? idCardFrontWasCaptured && detectedDocumentType === 'idCardFront'
|
|
136
|
+
: state.requestedDocumentType === 'idCardBack' &&
|
|
137
|
+
detectedDocumentType === 'idCardFront');
|
|
138
|
+
const backDetectedFirst = !state.overrideWrongDocumentTypeGuidance &&
|
|
139
|
+
(state.allowIdCardBackToFrontCapture
|
|
140
|
+
? idCardBackWasCaptured && detectedDocumentType === 'idCardBack'
|
|
141
|
+
: state.requestedDocumentType === 'idCardFront' &&
|
|
142
|
+
detectedDocumentType === 'idCardBack');
|
|
143
|
+
let wrongDocumentTypePredictions = state.wrongDocumentTypePredictions;
|
|
144
|
+
if (state.captureState === 'capturing' &&
|
|
145
|
+
(flipRequired || backDetectedFirst)) {
|
|
146
|
+
wrongDocumentTypePredictions += 1;
|
|
147
|
+
}
|
|
148
|
+
const fingersOccludingDocument = state.enableFingerOcclusionGuidance
|
|
149
|
+
? computeFingerOcclusion(bestDocument, detectedObjects, detectedDocumentType, state.fingerOcclusionThresholds)
|
|
150
|
+
: false;
|
|
151
|
+
const glareOccludingDocument = state.enableGlareOcclusionGuidance
|
|
152
|
+
? computeGlareOcclusion(bestDocument, detectedObjects)
|
|
153
|
+
: false;
|
|
154
|
+
const hologramOccludingDocument = state.enableHologramOcclusionGuidance
|
|
155
|
+
? computeHologramOcclusion(bestDocument, detectedObjects)
|
|
156
|
+
: false;
|
|
157
|
+
// Full open passport booklet geometry. Only consulted when the integrator
|
|
158
|
+
// opts in AND the detected document is a passport; otherwise bookletGuidance
|
|
159
|
+
// stays null and the spatial gate below is unchanged (strict BAU).
|
|
160
|
+
const bookletMode = state.requireFullPassportBooklet && detectedDocumentType === 'passport';
|
|
161
|
+
let bookletGuidance = null;
|
|
162
|
+
let bookletVerdict = null;
|
|
163
|
+
let bookletValid = false;
|
|
164
|
+
if (bookletMode) {
|
|
165
|
+
bookletVerdict = analyzePassportBooklet(detectedObjects, frameWidth, frameHeight);
|
|
166
|
+
// Capture requires both the concentric geometry AND good framing.
|
|
167
|
+
bookletValid =
|
|
168
|
+
bookletVerdict.isFullBooklet && bookletVerdict.framing === 'ok';
|
|
169
|
+
if (!bookletValid) {
|
|
170
|
+
bookletGuidance =
|
|
171
|
+
bookletVerdict.framing === 'cornersCutOff'
|
|
172
|
+
? 'cornersCutOff'
|
|
173
|
+
: 'tooFar';
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// In booklet mode the booklet geometry replaces the generic in-bounds /
|
|
177
|
+
// too-close spatial gate (the booklet messages cover those cases).
|
|
178
|
+
const spatialOk = bookletMode
|
|
179
|
+
? bookletValid
|
|
180
|
+
: documentInBounds && !documentTooClose;
|
|
181
|
+
const isGoodFrame = detectionThresholdMet &&
|
|
182
|
+
spatialOk &&
|
|
183
|
+
!flipRequired &&
|
|
184
|
+
!backDetectedFirst &&
|
|
185
|
+
focusThresholdMet &&
|
|
186
|
+
!idCardDetectedButNotAllowed &&
|
|
187
|
+
!passportDetectedButNotAllowed &&
|
|
188
|
+
documentIsStable &&
|
|
189
|
+
!fingersOccludingDocument &&
|
|
190
|
+
!glareOccludingDocument &&
|
|
191
|
+
!hologramOccludingDocument;
|
|
192
|
+
// Display-only, and deliberately downstream of isGoodFrame: derived from
|
|
193
|
+
// the same inputs, never fed back into it or into anything below that
|
|
194
|
+
// gates capture (sdk2 idCaptureReducer.ts:766-793). Held here rather
|
|
195
|
+
// than in the controller so that every guidance surface reads one value.
|
|
196
|
+
// Ladder-only: the barcode-recapture override never enters the
|
|
197
|
+
// stabilizer (rawGuidance carries it, live). Stepped at the frame's
|
|
198
|
+
// captured-at time, never wall-clock.
|
|
199
|
+
const guidance = stabilizeStep(state.guidance, deriveGuidanceCode({
|
|
200
|
+
satisfied: isGoodFrame,
|
|
201
|
+
bookletMode,
|
|
202
|
+
detectionThresholdMet,
|
|
203
|
+
backDetectedFirst,
|
|
204
|
+
flipRequired,
|
|
205
|
+
idCardDetectedButNotAllowed,
|
|
206
|
+
passportDetectedButNotAllowed,
|
|
207
|
+
bookletGuidance,
|
|
208
|
+
documentInBounds,
|
|
209
|
+
documentTooClose,
|
|
210
|
+
fingersOccludingDocument,
|
|
211
|
+
glareOccludingDocument,
|
|
212
|
+
hologramOccludingDocument,
|
|
213
|
+
documentIsStable,
|
|
214
|
+
focusThresholdMet,
|
|
215
|
+
}), frameCapturedAt.getTime());
|
|
216
|
+
let captureStartedAt = state.captureStartedAt;
|
|
217
|
+
let goodFramesCount = state.goodFramesCount;
|
|
218
|
+
let totalFramesSinceCaptureStart = state.totalFramesSinceCaptureStart;
|
|
219
|
+
let consecutiveBadFrames = state.consecutiveBadFrames;
|
|
220
|
+
// Grace period: allow brief detection gaps (normal model noise) without
|
|
221
|
+
// triggering decay. Only start eroding after ~0.5s of sustained bad
|
|
222
|
+
// frames, which indicates conditions have genuinely changed (user moved
|
|
223
|
+
// the card, showed the wrong side, etc.).
|
|
224
|
+
const decayGracePeriod = Math.max(10, Math.ceil(frameCaptureRate * 0.5));
|
|
225
|
+
if (isGoodFrame) {
|
|
226
|
+
goodFramesCount += 1;
|
|
227
|
+
consecutiveBadFrames = 0;
|
|
228
|
+
captureStartedAt ||= now();
|
|
229
|
+
}
|
|
230
|
+
else if (captureStartedAt) {
|
|
231
|
+
consecutiveBadFrames += 1;
|
|
232
|
+
if (consecutiveBadFrames >= decayGracePeriod) {
|
|
233
|
+
// Decay: erode accumulated good frames so that sporadic model
|
|
234
|
+
// flickers can never accumulate into a false capture.
|
|
235
|
+
goodFramesCount = Math.max(0, goodFramesCount - 0.5);
|
|
236
|
+
if (goodFramesCount === 0) {
|
|
237
|
+
captureStartedAt = null;
|
|
238
|
+
totalFramesSinceCaptureStart = 0;
|
|
239
|
+
consecutiveBadFrames = 0;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (captureStartedAt) {
|
|
244
|
+
totalFramesSinceCaptureStart += 1;
|
|
245
|
+
}
|
|
246
|
+
// Require both enough good frames AND a minimum density of good frames
|
|
247
|
+
// relative to total frames observed. This prevents sparse, noisy
|
|
248
|
+
// detections accumulated over a long period from triggering capture.
|
|
249
|
+
const minGoodFrameDensity = 0.3;
|
|
250
|
+
const goodFrameDensity = totalFramesSinceCaptureStart > 0
|
|
251
|
+
? goodFramesCount / totalFramesSinceCaptureStart
|
|
252
|
+
: 0;
|
|
253
|
+
const goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold &&
|
|
254
|
+
goodFrameDensity >= minGoodFrameDensity;
|
|
255
|
+
let requestedDocumentType = state.requestedDocumentType;
|
|
256
|
+
if (state.captureRequirement.includes('idCard') &&
|
|
257
|
+
state.allowIdCardBackToFrontCapture) {
|
|
258
|
+
if (detectedDocumentType === 'idCardFront' &&
|
|
259
|
+
state.requestedDocumentType !== 'idCardFront' &&
|
|
260
|
+
!idCardFrontWasCaptured) {
|
|
261
|
+
requestedDocumentType = 'idCardFront';
|
|
262
|
+
}
|
|
263
|
+
else if (detectedDocumentType === 'idCardBack' &&
|
|
264
|
+
state.requestedDocumentType !== 'idCardBack' &&
|
|
265
|
+
!idCardBackWasCaptured) {
|
|
266
|
+
requestedDocumentType = 'idCardBack';
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (state.captureRequirement === 'idCardOrPassport') {
|
|
270
|
+
if (detectedDocumentType === 'passport' &&
|
|
271
|
+
state.requestedDocumentType !== 'passport') {
|
|
272
|
+
requestedDocumentType = 'passport';
|
|
273
|
+
}
|
|
274
|
+
if (requestedDocumentType === 'passport' &&
|
|
275
|
+
passportDetectionScore < 0.3) {
|
|
276
|
+
requestedDocumentType = idCardFrontWasCaptured
|
|
277
|
+
? 'idCardBack'
|
|
278
|
+
: 'idCardFront';
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
const hasBeenRunningForLongEnough = !!state.operationStartedAt &&
|
|
282
|
+
now().getTime() - state.operationStartedAt.getTime() > 1000;
|
|
283
|
+
const overrideFlipRequirementThreshold = Math.ceil((state.allowOverrideWrongDocumentTypeAfterMs / 1000) * frameCaptureRate);
|
|
284
|
+
const allowOverrideFlipRequirement = state.enableOverrideWrongDocumentTypeDialog &&
|
|
285
|
+
hasBeenRunningForLongEnough &&
|
|
286
|
+
!state.overrideWrongDocumentTypeGuidance &&
|
|
287
|
+
overrideFlipRequirementThreshold > 0 &&
|
|
288
|
+
(state.allowOverrideWrongDocumentTypeGuidance ||
|
|
289
|
+
wrongDocumentTypePredictions >= overrideFlipRequirementThreshold);
|
|
290
|
+
return {
|
|
291
|
+
...state,
|
|
292
|
+
videoWidth: frameWidth,
|
|
293
|
+
videoHeight: frameHeight,
|
|
294
|
+
detectedObjects,
|
|
295
|
+
bestDocument,
|
|
296
|
+
requestedDocumentType,
|
|
297
|
+
detectedDocumentType,
|
|
298
|
+
detectionThresholdMet,
|
|
299
|
+
documentInBounds,
|
|
300
|
+
documentTooClose,
|
|
301
|
+
bookletGuidance,
|
|
302
|
+
bookletVerdict,
|
|
303
|
+
documentIsStable,
|
|
304
|
+
fingersOccludingDocument,
|
|
305
|
+
glareOccludingDocument,
|
|
306
|
+
hologramOccludingDocument,
|
|
307
|
+
flipRequired,
|
|
308
|
+
backDetectedFirst,
|
|
309
|
+
idCardDetectedButNotAllowed,
|
|
310
|
+
passportDetectedButNotAllowed,
|
|
311
|
+
allowOverrideWrongDocumentTypeGuidance: allowOverrideFlipRequirement,
|
|
312
|
+
wrongDocumentTypePredictions,
|
|
313
|
+
idCardFrontDetectionScore,
|
|
314
|
+
idCardFrontDetectionThresholdMet,
|
|
315
|
+
idCardBackDetectionScore,
|
|
316
|
+
idCardBackDetectionThresholdMet,
|
|
317
|
+
passportDetectionScore,
|
|
318
|
+
passportDetectionThresholdMet,
|
|
319
|
+
singlePageDetectionScore,
|
|
320
|
+
singlePageDetectionThresholdMet,
|
|
321
|
+
focusScore,
|
|
322
|
+
focusThresholdMet,
|
|
323
|
+
pdf417PredictionScore,
|
|
324
|
+
pdf417PredictionThresholdMet,
|
|
325
|
+
isGoodFrame,
|
|
326
|
+
goodFramesCount,
|
|
327
|
+
goodFramesThreshold,
|
|
328
|
+
goodFramesThresholdMet,
|
|
329
|
+
totalFramesSinceCaptureStart,
|
|
330
|
+
consecutiveBadFrames,
|
|
331
|
+
guidance,
|
|
332
|
+
captureStartedAt,
|
|
333
|
+
lastFrameCapturedAt: frameCapturedAt,
|
|
334
|
+
frameCaptureRate,
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
case 'captureInitialized':
|
|
338
|
+
// A wizard that is already DONE stays done.
|
|
339
|
+
//
|
|
340
|
+
// sdk2 got this for free from its component tree: `captureInitialized`
|
|
341
|
+
// is dispatched by IdCapture.tsx's mount effect (:130), and that
|
|
342
|
+
// component only mounts while there is something left to capture — so
|
|
343
|
+
// in 2.x the action cannot arrive in a completed state. 3.0's
|
|
344
|
+
// controller dispatches it unconditionally from finalizeAttach, right
|
|
345
|
+
// after configureWizard, which meant a wizard completed by
|
|
346
|
+
// `precapturedDocuments` was immediately dragged back into 'capturing'
|
|
347
|
+
// and the user was asked to scan documents they had already supplied.
|
|
348
|
+
//
|
|
349
|
+
// Reproduced end-to-end: hand in both sides of an ID and 2.x goes
|
|
350
|
+
// straight to review while 3.0 asks for the back. The seeding itself
|
|
351
|
+
// was never at fault — configureWizard reached 'complete' correctly and
|
|
352
|
+
// this action undid it one dispatch later.
|
|
353
|
+
if (state.captureState === 'complete')
|
|
354
|
+
return state;
|
|
355
|
+
return {
|
|
356
|
+
...state,
|
|
357
|
+
captureState: 'capturing',
|
|
358
|
+
isUploadingDocumentsFromStorage: false,
|
|
359
|
+
...clearedFrameVerdict,
|
|
360
|
+
};
|
|
361
|
+
case 'captureStarted':
|
|
362
|
+
return {
|
|
363
|
+
...state,
|
|
364
|
+
operationStartedAt: now(),
|
|
365
|
+
captureStartedAt: null,
|
|
366
|
+
capturing: false,
|
|
367
|
+
captureFailed: false,
|
|
368
|
+
goodFramesCount: 0,
|
|
369
|
+
totalFramesSinceCaptureStart: 0,
|
|
370
|
+
consecutiveBadFrames: 0,
|
|
371
|
+
...clearedFrameVerdict,
|
|
372
|
+
};
|
|
373
|
+
case 'capturing':
|
|
374
|
+
return {
|
|
375
|
+
...state,
|
|
376
|
+
capturing: true,
|
|
377
|
+
captureFailed: false,
|
|
378
|
+
};
|
|
379
|
+
case 'captured':
|
|
380
|
+
return {
|
|
381
|
+
...state,
|
|
382
|
+
capturing: false,
|
|
383
|
+
captureFailed: false,
|
|
384
|
+
};
|
|
385
|
+
case 'frameCaptured':
|
|
386
|
+
return { ...state, imageUrl: action.payload.imageUrl };
|
|
387
|
+
case 'captureFailed':
|
|
388
|
+
return {
|
|
389
|
+
...state,
|
|
390
|
+
capturing: false,
|
|
391
|
+
captureFailed: true,
|
|
392
|
+
};
|
|
393
|
+
case 'documentCaptured': {
|
|
394
|
+
const stampedPayload = {
|
|
395
|
+
...action.payload,
|
|
396
|
+
capturedAt: action.payload.capturedAt ?? now().toISOString(),
|
|
397
|
+
};
|
|
398
|
+
const newState = {
|
|
399
|
+
...state,
|
|
400
|
+
capturing: false,
|
|
401
|
+
captureFailed: false,
|
|
402
|
+
allowOverrideFlipRequirement: false,
|
|
403
|
+
overrideFlipRequirement: false,
|
|
404
|
+
goodFramesCount: 0,
|
|
405
|
+
totalFramesSinceCaptureStart: 0,
|
|
406
|
+
consecutiveBadFrames: 0,
|
|
407
|
+
wrongDocumentTypePredictions: 0,
|
|
408
|
+
capturedDocuments: {
|
|
409
|
+
...state.capturedDocuments,
|
|
410
|
+
[stampedPayload.documentType]: stampedPayload,
|
|
411
|
+
},
|
|
412
|
+
...clearedFrameVerdict,
|
|
413
|
+
};
|
|
414
|
+
const remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType, state.idCardBackCaptureRequired);
|
|
415
|
+
if (remainingRequirements.length === 0) {
|
|
416
|
+
// Check if we just captured ID back and need barcode recapture
|
|
417
|
+
const justCapturedIdBack = action.payload.documentType === 'idCardBack';
|
|
418
|
+
const barcodeScore = state.capturedDocuments.idBarcodeImage?.barcodeReadabilityScore ?? 0;
|
|
419
|
+
// Skip recapture if aggressive mode has already successfully decoded the barcode
|
|
420
|
+
const aggressiveDecodeSucceeded = state.aggressiveModeDecodeComplete;
|
|
421
|
+
// When aggressive mode is enabled but hasn't succeeded, always request recapture
|
|
422
|
+
// regardless of score threshold (to give more chances to decode).
|
|
423
|
+
const needsBarcodeRecapture = state.enableBarcodeRecapture &&
|
|
424
|
+
justCapturedIdBack &&
|
|
425
|
+
state.barcodeRecaptureThreshold > 0 &&
|
|
426
|
+
!aggressiveDecodeSucceeded &&
|
|
427
|
+
(state.aggressiveModeEnabled || barcodeScore < state.barcodeRecaptureThreshold);
|
|
428
|
+
if (needsBarcodeRecapture) {
|
|
429
|
+
// Skip 'complete' and go directly to barcode recapture
|
|
430
|
+
newState.captureState = 'requestingBetterBarcode';
|
|
431
|
+
newState.barcodeRecaptureStartedAt = now();
|
|
432
|
+
newState.initialBarcodeScore = barcodeScore;
|
|
433
|
+
newState.initialCaptureBarcodeImage =
|
|
434
|
+
state.capturedDocuments.idBarcodeImage?.imageData ?? null;
|
|
435
|
+
newState.recaptureBarcodeScore = null;
|
|
436
|
+
newState.recaptureBarcodeImage = null;
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
newState.captureState = 'complete';
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
newState.requestedDocumentType = remainingRequirements[0];
|
|
444
|
+
if ((state.requestedDocumentType === 'idCardFront' &&
|
|
445
|
+
newState.requestedDocumentType === 'idCardBack') ||
|
|
446
|
+
(state.requestedDocumentType === 'idCardBack' &&
|
|
447
|
+
newState.requestedDocumentType === 'idCardFront')) {
|
|
448
|
+
if (!newState.isUploadingDocumentsFromStorage) {
|
|
449
|
+
newState.captureState = 'requestingFlip';
|
|
450
|
+
}
|
|
451
|
+
newState.idCardFrontDetectionThresholdMet = false;
|
|
452
|
+
newState.idCardBackDetectionThresholdMet = false;
|
|
453
|
+
newState.passportDetectionThresholdMet = false;
|
|
454
|
+
newState.wrongDocumentTypePredictions = 0;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
return newState;
|
|
458
|
+
}
|
|
459
|
+
case 'documentCapturedManually':
|
|
460
|
+
return reduceIdCapture(state, {
|
|
461
|
+
type: 'documentCaptured',
|
|
462
|
+
payload: {
|
|
463
|
+
...action.payload,
|
|
464
|
+
documentType: state.requestedDocumentType,
|
|
465
|
+
width: 0,
|
|
466
|
+
height: 0,
|
|
467
|
+
},
|
|
468
|
+
}, now);
|
|
469
|
+
case 'documentsCaptured': {
|
|
470
|
+
let newState = { ...state };
|
|
471
|
+
for (const doc of action.payload) {
|
|
472
|
+
newState = reduceIdCapture(newState, { type: 'documentCaptured', payload: doc }, now);
|
|
473
|
+
}
|
|
474
|
+
return newState;
|
|
475
|
+
}
|
|
476
|
+
case 'barcodeCaptured':
|
|
477
|
+
return reduceIdCapture(state, {
|
|
478
|
+
type: 'documentCaptured',
|
|
479
|
+
payload: {
|
|
480
|
+
imageData: action.payload.imageUrl,
|
|
481
|
+
documentType: 'idBarcodeImage',
|
|
482
|
+
width: 0,
|
|
483
|
+
height: 0,
|
|
484
|
+
barcodeReadabilityScore: action.payload.barcodeReadabilityScore,
|
|
485
|
+
},
|
|
486
|
+
}, now);
|
|
487
|
+
case 'flipRequestCompleted':
|
|
488
|
+
return {
|
|
489
|
+
...state,
|
|
490
|
+
captureState: 'capturing',
|
|
491
|
+
allowOverrideWrongDocumentTypeGuidance: false,
|
|
492
|
+
overrideWrongDocumentTypeGuidance: false,
|
|
493
|
+
wrongDocumentTypePredictions: 0,
|
|
494
|
+
goodFramesCount: 0,
|
|
495
|
+
totalFramesSinceCaptureStart: 0,
|
|
496
|
+
consecutiveBadFrames: 0,
|
|
497
|
+
...clearedFrameVerdict,
|
|
498
|
+
};
|
|
499
|
+
case 'allowOverrideFlipRequirement':
|
|
500
|
+
return { ...state, allowOverrideWrongDocumentTypeGuidance: true };
|
|
501
|
+
case 'overrideFlipRequirement':
|
|
502
|
+
return {
|
|
503
|
+
...state,
|
|
504
|
+
allowOverrideWrongDocumentTypeGuidance: false,
|
|
505
|
+
overrideWrongDocumentTypeGuidance: true,
|
|
506
|
+
};
|
|
507
|
+
case 'setUploadingDocumentsFromStorage':
|
|
508
|
+
return {
|
|
509
|
+
...state,
|
|
510
|
+
isUploadingDocumentsFromStorage: action.payload,
|
|
511
|
+
captureState: action.payload ? 'initializing' : 'capturing',
|
|
512
|
+
};
|
|
513
|
+
case 'setUploadingDocumentsType': {
|
|
514
|
+
const requestedDocumentType = !action.payload || action.payload === 'idCard'
|
|
515
|
+
? 'idCardFront'
|
|
516
|
+
: action.payload;
|
|
517
|
+
const uploadingDocumentsType = action.payload === 'singlePage' ? 'idCard' : action.payload;
|
|
518
|
+
return {
|
|
519
|
+
...state,
|
|
520
|
+
captureState: action.payload ? 'uploading' : 'initializing',
|
|
521
|
+
uploadingDocumentsType,
|
|
522
|
+
requestedDocumentType,
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
case 'barcodeRecaptureStarted':
|
|
526
|
+
return {
|
|
527
|
+
...state,
|
|
528
|
+
captureState: 'requestingBetterBarcode',
|
|
529
|
+
barcodeRecaptureStartedAt: now(),
|
|
530
|
+
initialBarcodeScore: action.payload.initialBarcodeScore,
|
|
531
|
+
initialCaptureBarcodeImage: action.payload.initialCaptureBarcodeImage,
|
|
532
|
+
recaptureBarcodeScore: null,
|
|
533
|
+
recaptureBarcodeImage: null,
|
|
534
|
+
goodFramesCount: 0,
|
|
535
|
+
totalFramesSinceCaptureStart: 0,
|
|
536
|
+
consecutiveBadFrames: 0,
|
|
537
|
+
capturing: false,
|
|
538
|
+
...clearedFrameVerdict,
|
|
539
|
+
};
|
|
540
|
+
case 'barcodeRecaptureScoreUpdated':
|
|
541
|
+
return {
|
|
542
|
+
...state,
|
|
543
|
+
recaptureBarcodeScore: action.payload.recaptureBarcodeScore,
|
|
544
|
+
};
|
|
545
|
+
case 'recaptureBarcodeImageCaptured':
|
|
546
|
+
return {
|
|
547
|
+
...state,
|
|
548
|
+
recaptureBarcodeImage: action.payload.recaptureBarcodeImage,
|
|
549
|
+
};
|
|
550
|
+
case 'barcodeRecaptureCompleted':
|
|
551
|
+
return {
|
|
552
|
+
...state,
|
|
553
|
+
captureState: 'complete',
|
|
554
|
+
barcodeRecaptureStartedAt: null,
|
|
555
|
+
};
|
|
556
|
+
case 'resetWizard':
|
|
557
|
+
return {
|
|
558
|
+
...initialFlowState,
|
|
559
|
+
// Preserve all configuration values
|
|
560
|
+
captureRequirement: state.captureRequirement,
|
|
561
|
+
allowSinglePageIdCapture: state.allowSinglePageIdCapture,
|
|
562
|
+
requireFullPassportBooklet: state.requireFullPassportBooklet,
|
|
563
|
+
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture,
|
|
564
|
+
idCardBackCaptureRequired: state.idCardBackCaptureRequired,
|
|
565
|
+
enableFingerOcclusionGuidance: state.enableFingerOcclusionGuidance,
|
|
566
|
+
fingerOcclusionThresholds: state.fingerOcclusionThresholds,
|
|
567
|
+
enableGlareOcclusionGuidance: state.enableGlareOcclusionGuidance,
|
|
568
|
+
enableHologramOcclusionGuidance: state.enableHologramOcclusionGuidance,
|
|
569
|
+
enableOverrideWrongDocumentTypeDialog: state.enableOverrideWrongDocumentTypeDialog,
|
|
570
|
+
allowOverrideWrongDocumentTypeAfterMs: state.allowOverrideWrongDocumentTypeAfterMs,
|
|
571
|
+
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
572
|
+
enableBarcodeRecapture: state.enableBarcodeRecapture,
|
|
573
|
+
barcodeRecaptureThreshold: state.barcodeRecaptureThreshold,
|
|
574
|
+
barcodeRecaptureTimeoutMs: state.barcodeRecaptureTimeoutMs,
|
|
575
|
+
aggressiveModeEnabled: state.aggressiveModeEnabled,
|
|
576
|
+
// Re-derive the starting document type from the preserved requirement
|
|
577
|
+
// (mirrors configureWizard). resetWizard must restore the
|
|
578
|
+
// POST-configuration state: leaving initialState's 'idCardFront' in a
|
|
579
|
+
// passport-only flow makes the wizard request an ID front on retry,
|
|
580
|
+
// so the models provider filters out every passport frame and the
|
|
581
|
+
// focus model never re-engages — capture deadlocks.
|
|
582
|
+
requestedDocumentType: state.captureRequirement === 'idCardBack'
|
|
583
|
+
? 'idCardBack'
|
|
584
|
+
: state.captureRequirement === 'passport'
|
|
585
|
+
? 'passport'
|
|
586
|
+
: 'idCardFront',
|
|
587
|
+
// Reset capture-specific state
|
|
588
|
+
captureState: state.allowUploadingDocumentsFromStorage
|
|
589
|
+
? 'initializing'
|
|
590
|
+
: 'capturing',
|
|
591
|
+
barcodeRecaptureStartedAt: null,
|
|
592
|
+
initialBarcodeScore: 0,
|
|
593
|
+
recaptureBarcodeScore: null,
|
|
594
|
+
initialCaptureBarcodeImage: null,
|
|
595
|
+
recaptureBarcodeImage: null,
|
|
596
|
+
nativeBarcodeDecodeResult: null,
|
|
597
|
+
nativeBarcodeDecoding: false,
|
|
598
|
+
nativeBarcodeDecodeAttempted: false,
|
|
599
|
+
nativeBarcodeDecodeDetails: null,
|
|
600
|
+
aggressiveModeDecodeResult: null,
|
|
601
|
+
aggressiveModeDecodeComplete: false,
|
|
602
|
+
pdf417DetectionCount: 0,
|
|
603
|
+
pdf417LowScoreCount: 0,
|
|
604
|
+
zxingParseAttemptCount: 0,
|
|
605
|
+
};
|
|
606
|
+
case 'nativeBarcodeDecodeStarted':
|
|
607
|
+
return {
|
|
608
|
+
...state,
|
|
609
|
+
nativeBarcodeDecoding: true,
|
|
610
|
+
nativeBarcodeDecodeResult: null,
|
|
611
|
+
nativeBarcodeDecodeAttempted: true,
|
|
612
|
+
nativeBarcodeDecodeDetails: null,
|
|
613
|
+
};
|
|
614
|
+
case 'nativeBarcodeDecoded':
|
|
615
|
+
return {
|
|
616
|
+
...state,
|
|
617
|
+
nativeBarcodeDecoding: false,
|
|
618
|
+
nativeBarcodeDecodeResult: {
|
|
619
|
+
text: action.payload.text,
|
|
620
|
+
format: action.payload.format,
|
|
621
|
+
method: action.payload.method,
|
|
622
|
+
rotationApplied: action.payload.rotationApplied,
|
|
623
|
+
},
|
|
624
|
+
nativeBarcodeDecodeDetails: action.payload.details,
|
|
625
|
+
};
|
|
626
|
+
case 'nativeBarcodeDecodeFailed':
|
|
627
|
+
return {
|
|
628
|
+
...state,
|
|
629
|
+
nativeBarcodeDecoding: false,
|
|
630
|
+
nativeBarcodeDecodeResult: null,
|
|
631
|
+
nativeBarcodeDecodeDetails: action.payload.details,
|
|
632
|
+
};
|
|
633
|
+
case 'aggressiveDecodeSuccess':
|
|
634
|
+
return {
|
|
635
|
+
...state,
|
|
636
|
+
aggressiveModeDecodeResult: {
|
|
637
|
+
text: action.payload.text,
|
|
638
|
+
format: action.payload.format,
|
|
639
|
+
method: action.payload.method,
|
|
640
|
+
rotationApplied: action.payload.rotationApplied,
|
|
641
|
+
},
|
|
642
|
+
aggressiveModeDecodeComplete: true,
|
|
643
|
+
};
|
|
644
|
+
case 'resetAggressiveDecode':
|
|
645
|
+
return {
|
|
646
|
+
...state,
|
|
647
|
+
aggressiveModeDecodeResult: null,
|
|
648
|
+
aggressiveModeDecodeComplete: false,
|
|
649
|
+
};
|
|
650
|
+
case 'incrementPdf417DetectionCount':
|
|
651
|
+
return { ...state, pdf417DetectionCount: state.pdf417DetectionCount + 1 };
|
|
652
|
+
case 'incrementPdf417LowScoreCount':
|
|
653
|
+
return { ...state, pdf417LowScoreCount: state.pdf417LowScoreCount + 1 };
|
|
654
|
+
case 'incrementZxingParseAttemptCount':
|
|
655
|
+
return { ...state, zxingParseAttemptCount: state.zxingParseAttemptCount + 1 };
|
|
656
|
+
case 'addZxingParseAttempts':
|
|
657
|
+
return { ...state, zxingParseAttemptCount: state.zxingParseAttemptCount + action.payload };
|
|
658
|
+
default:
|
|
659
|
+
return state;
|
|
660
|
+
}
|
|
661
|
+
};
|