facecog-liveness-showcase 0.0.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/.browserslistrc +15 -0
- package/.dockerignore +48 -0
- package/.editorconfig +16 -0
- package/.eslintrc.json +47 -0
- package/.vercelignore +7 -0
- package/.vscode/extensions.json +5 -0
- package/.vscode/settings.json +3 -0
- package/DOCKER.md +221 -0
- package/Dockerfile +33 -0
- package/README.md +268 -0
- package/angular.json +156 -0
- package/capacitor.config.ts +9 -0
- package/docker-compose.dev.yml +20 -0
- package/docker-compose.yml +18 -0
- package/ionic.config.json +7 -0
- package/jest.config.js +38 -0
- package/nginx.conf +50 -0
- package/package.json +131 -0
- package/patches/ng-packagr+20.3.2.patch +60 -0
- package/projects/facecog-liveness-verification/README.md +295 -0
- package/projects/facecog-liveness-verification/ng-package.json +7 -0
- package/projects/facecog-liveness-verification/package.json +48 -0
- package/projects/facecog-liveness-verification/scripts/build-with-wrapper-copy.js +38 -0
- package/projects/facecog-liveness-verification/scripts/copy-wrapper-after-ngc.js +35 -0
- package/projects/facecog-liveness-verification/sources/FaceLivenessReactWrapper.tsx +320 -0
- package/projects/facecog-liveness-verification/src/lib/components/aws-face-liveness/FaceLivenessReactWrapper.generated.d.ts +28 -0
- package/projects/facecog-liveness-verification/src/lib/components/aws-face-liveness/FaceLivenessReactWrapper.generated.js +247 -0
- package/projects/facecog-liveness-verification/src/lib/components/aws-face-liveness/FaceLivenessReactWrapper.generated.js.map +1 -0
- package/projects/facecog-liveness-verification/src/lib/components/aws-face-liveness/FaceLivenessReactWrapper.js.map +1 -0
- package/projects/facecog-liveness-verification/src/lib/components/aws-face-liveness/FaceLivenessReactWrapper.ts +5 -0
- package/projects/facecog-liveness-verification/src/lib/components/aws-face-liveness/aws-face-liveness.component.ts +500 -0
- package/projects/facecog-liveness-verification/src/lib/components/camera-permission/camera-permission.component.html +41 -0
- package/projects/facecog-liveness-verification/src/lib/components/camera-permission/camera-permission.component.scss +234 -0
- package/projects/facecog-liveness-verification/src/lib/components/camera-permission/camera-permission.component.spec.ts +158 -0
- package/projects/facecog-liveness-verification/src/lib/components/camera-permission/camera-permission.component.ts +58 -0
- package/projects/facecog-liveness-verification/src/lib/components/camera-verification/camera-verification.component.html +34 -0
- package/projects/facecog-liveness-verification/src/lib/components/camera-verification/camera-verification.component.ts +210 -0
- package/projects/facecog-liveness-verification/src/lib/components/dialogs/save-custom-pose-dialog.component.ts +174 -0
- package/projects/facecog-liveness-verification/src/lib/components/facetec-scan/facetec-scan.component.html +45 -0
- package/projects/facecog-liveness-verification/src/lib/components/facetec-scan/facetec-scan.component.scss +87 -0
- package/projects/facecog-liveness-verification/src/lib/components/facetec-scan/facetec-scan.component.ts +182 -0
- package/projects/facecog-liveness-verification/src/lib/components/intro/intro.component.html +394 -0
- package/projects/facecog-liveness-verification/src/lib/components/intro/intro.component.scss +1567 -0
- package/projects/facecog-liveness-verification/src/lib/components/intro/intro.component.spec.ts +699 -0
- package/projects/facecog-liveness-verification/src/lib/components/intro/intro.component.ts +721 -0
- package/projects/facecog-liveness-verification/src/lib/components/live-preview/live-preview.component.html +120 -0
- package/projects/facecog-liveness-verification/src/lib/components/live-preview/live-preview.component.scss +611 -0
- package/projects/facecog-liveness-verification/src/lib/components/live-preview/live-preview.component.spec.ts +605 -0
- package/projects/facecog-liveness-verification/src/lib/components/live-preview/live-preview.component.ts +524 -0
- package/projects/facecog-liveness-verification/src/lib/components/liveness-flow/liveness-flow.component.html +73 -0
- package/projects/facecog-liveness-verification/src/lib/components/liveness-flow/liveness-flow.component.scss +19 -0
- package/projects/facecog-liveness-verification/src/lib/components/liveness-flow/liveness-flow.component.spec.ts +673 -0
- package/projects/facecog-liveness-verification/src/lib/components/liveness-flow/liveness-flow.component.ts +963 -0
- package/projects/facecog-liveness-verification/src/lib/components/liveness-verification/liveness-verification.component.html +38 -0
- package/projects/facecog-liveness-verification/src/lib/components/liveness-verification/liveness-verification.component.scss +10 -0
- package/projects/facecog-liveness-verification/src/lib/components/liveness-verification/liveness-verification.component.ts +233 -0
- package/projects/facecog-liveness-verification/src/lib/components/pose-selection/pose-selection.component.html +17 -0
- package/projects/facecog-liveness-verification/src/lib/components/pose-selection/pose-selection.component.spec.ts +35 -0
- package/projects/facecog-liveness-verification/src/lib/components/pose-selection/pose-selection.component.ts +33 -0
- package/projects/facecog-liveness-verification/src/lib/components/processing/processing.component.html +17 -0
- package/projects/facecog-liveness-verification/src/lib/components/processing/processing.component.scss +156 -0
- package/projects/facecog-liveness-verification/src/lib/components/processing/processing.component.spec.ts +46 -0
- package/projects/facecog-liveness-verification/src/lib/components/processing/processing.component.ts +18 -0
- package/projects/facecog-liveness-verification/src/lib/components/verification-result/verification-result.component.html +190 -0
- package/projects/facecog-liveness-verification/src/lib/components/verification-result/verification-result.component.scss +534 -0
- package/projects/facecog-liveness-verification/src/lib/components/verification-result/verification-result.component.spec.ts +286 -0
- package/projects/facecog-liveness-verification/src/lib/components/verification-result/verification-result.component.ts +155 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/analyze-response.interface.ts +16 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/aws-face-liveness.interface.ts +46 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/backend-adapter.interface.ts +21 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/backend-http-client.interface.ts +93 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/backend-response.interface.ts +9 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/camera-provider.interface.ts +107 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/category-info.interface.ts +9 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/custom-pose-data.interface.ts +14 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/custom-pose-repository.interface.ts +48 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/custom-pose-response.interface.ts +14 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/index.ts +52 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/liveness-action-result.interface.ts +13 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/liveness-config.interface.ts +17 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/liveness-metadata.interface.ts +17 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/liveness-result.interface.ts +24 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/liveness-verification-config.interface.ts +41 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/multi-backend-analyze-response.interface.ts +21 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/multi-backend-liveness-result.interface.ts +14 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/pose-definition.interface.ts +35 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/pose-keypoint.interface.ts +12 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/pose-match-result.interface.ts +9 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/pose-verify-response.interface.ts +8 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/scan-results.interface.ts +29 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/verification-plan.interface.ts +42 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/verification-progress-event.interface.ts +12 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/verification-session.interface.ts +72 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/verification-step-change-event.interface.ts +11 -0
- package/projects/facecog-liveness-verification/src/lib/interfaces/video-recording.interface.ts +9 -0
- package/projects/facecog-liveness-verification/src/lib/liveness-verification.module.ts +123 -0
- package/projects/facecog-liveness-verification/src/lib/models/constants/aws-face-liveness-component.token.ts +23 -0
- package/projects/facecog-liveness-verification/src/lib/models/constants/category-info.constant.ts +14 -0
- package/projects/facecog-liveness-verification/src/lib/models/constants/default-liveness-config.constant.ts +18 -0
- package/projects/facecog-liveness-verification/src/lib/models/constants/index.ts +5 -0
- package/projects/facecog-liveness-verification/src/lib/models/constants/liveness-verification-config.token.ts +16 -0
- package/projects/facecog-liveness-verification/src/lib/models/constants/pose-definitions.constant.ts +377 -0
- package/projects/facecog-liveness-verification/src/lib/models/index.ts +5 -0
- package/projects/facecog-liveness-verification/src/lib/models/utils/index.ts +2 -0
- package/projects/facecog-liveness-verification/src/lib/models/utils/pose.utils.spec.ts +76 -0
- package/projects/facecog-liveness-verification/src/lib/models/utils/pose.utils.ts +59 -0
- package/projects/facecog-liveness-verification/src/lib/services/aws-face-liveness.service.ts +49 -0
- package/projects/facecog-liveness-verification/src/lib/services/backend-http.service.spec.ts +111 -0
- package/projects/facecog-liveness-verification/src/lib/services/backend-http.service.ts +130 -0
- package/projects/facecog-liveness-verification/src/lib/services/backends/azure-backend.service.spec.ts +69 -0
- package/projects/facecog-liveness-verification/src/lib/services/backends/azure-backend.service.ts +72 -0
- package/projects/facecog-liveness-verification/src/lib/services/backends/facetec-backend.service.spec.ts +24 -0
- package/projects/facecog-liveness-verification/src/lib/services/backends/facetec-backend.service.ts +35 -0
- package/projects/facecog-liveness-verification/src/lib/services/backends/mock-backend.service.spec.ts +36 -0
- package/projects/facecog-liveness-verification/src/lib/services/backends/mock-backend.service.ts +39 -0
- package/projects/facecog-liveness-verification/src/lib/services/backends/openpose-backend.service.spec.ts +81 -0
- package/projects/facecog-liveness-verification/src/lib/services/backends/openpose-backend.service.ts +72 -0
- package/projects/facecog-liveness-verification/src/lib/services/backends/rekognition-analysis-backend.service.spec.ts +69 -0
- package/projects/facecog-liveness-verification/src/lib/services/backends/rekognition-analysis-backend.service.ts +83 -0
- package/projects/facecog-liveness-verification/src/lib/services/camera.service.spec.ts +200 -0
- package/projects/facecog-liveness-verification/src/lib/services/camera.service.ts +155 -0
- package/projects/facecog-liveness-verification/src/lib/services/custom-poses-api.service.ts +117 -0
- package/projects/facecog-liveness-verification/src/lib/services/index.ts +18 -0
- package/projects/facecog-liveness-verification/src/lib/services/liveness-backend.service.spec.ts +103 -0
- package/projects/facecog-liveness-verification/src/lib/services/liveness-backend.service.ts +61 -0
- package/projects/facecog-liveness-verification/src/lib/services/liveness-config.service.spec.ts +109 -0
- package/projects/facecog-liveness-verification/src/lib/services/liveness-config.service.ts +70 -0
- package/projects/facecog-liveness-verification/src/lib/services/liveness-orchestrator.service.spec.ts +144 -0
- package/projects/facecog-liveness-verification/src/lib/services/liveness-orchestrator.service.ts +162 -0
- package/projects/facecog-liveness-verification/src/lib/services/pose-detection/hand-gesture-detection.service.ts +315 -0
- package/projects/facecog-liveness-verification/src/lib/services/pose-detection/index.ts +5 -0
- package/projects/facecog-liveness-verification/src/lib/services/pose-detection/openpose.service.ts +287 -0
- package/projects/facecog-liveness-verification/src/lib/services/pose-detection/pose-comparison.service.ts +353 -0
- package/projects/facecog-liveness-verification/src/lib/services/pose-detection/pose-matching.service.ts +2370 -0
- package/projects/facecog-liveness-verification/src/lib/services/pose-detection/reference-pose.service.ts +271 -0
- package/projects/facecog-liveness-verification/src/lib/services/pose-selection.service.spec.ts +183 -0
- package/projects/facecog-liveness-verification/src/lib/services/pose-selection.service.ts +179 -0
- package/projects/facecog-liveness-verification/src/lib/services/verification-api.service.spec.ts +159 -0
- package/projects/facecog-liveness-verification/src/lib/services/verification-api.service.ts +151 -0
- package/projects/facecog-liveness-verification/src/lib/services/verification-plan.service.spec.ts +184 -0
- package/projects/facecog-liveness-verification/src/lib/services/verification-plan.service.ts +94 -0
- package/projects/facecog-liveness-verification/src/lib/services/video-recorder.service.spec.ts +52 -0
- package/projects/facecog-liveness-verification/src/lib/services/video-recorder.service.ts +117 -0
- package/projects/facecog-liveness-verification/src/lib/types/detection-strategy.type.ts +5 -0
- package/projects/facecog-liveness-verification/src/lib/types/index.ts +7 -0
- package/projects/facecog-liveness-verification/src/lib/types/liveness-action.type.ts +31 -0
- package/projects/facecog-liveness-verification/src/lib/types/liveness-backend.type.ts +5 -0
- package/projects/facecog-liveness-verification/src/lib/types/pose-category.type.ts +5 -0
- package/projects/facecog-liveness-verification/src/lib/types/pose-difficulty.type.ts +5 -0
- package/projects/facecog-liveness-verification/src/lib/types/verification-flow-step.type.ts +5 -0
- package/projects/facecog-liveness-verification/src/lib/types/verification-step-kind.type.ts +4 -0
- package/projects/facecog-liveness-verification/src/public-api.ts +150 -0
- package/projects/facecog-liveness-verification/tsconfig.lib.json +20 -0
- package/projects/facecog-liveness-verification/tsconfig.lib.prod.json +11 -0
- package/projects/facecog-liveness-verification/tsconfig.spec.json +13 -0
- package/projects/facecog-liveness-verification/tsconfig.wrapper.json +15 -0
- package/projects/facecog-liveness-verification-test/src/app/app-routing.module.ts +22 -0
- package/projects/facecog-liveness-verification-test/src/app/app.component.html +3 -0
- package/projects/facecog-liveness-verification-test/src/app/app.component.scss +0 -0
- package/projects/facecog-liveness-verification-test/src/app/app.component.ts +11 -0
- package/projects/facecog-liveness-verification-test/src/app/app.module.ts +27 -0
- package/projects/facecog-liveness-verification-test/src/app/home/home-routing.module.ts +16 -0
- package/projects/facecog-liveness-verification-test/src/app/home/home.module.ts +19 -0
- package/projects/facecog-liveness-verification-test/src/app/home/home.page.html +39 -0
- package/projects/facecog-liveness-verification-test/src/app/home/home.page.scss +97 -0
- package/projects/facecog-liveness-verification-test/src/app/home/home.page.spec.ts +24 -0
- package/projects/facecog-liveness-verification-test/src/app/home/home.page.ts +92 -0
- package/projects/facecog-liveness-verification-test/src/app/home/verification-modal.component.ts +106 -0
- package/projects/facecog-liveness-verification-test/src/assets/fonts/gilroy/Gilroy-Bold_0.ttf +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/fonts/gilroy/Gilroy-Medium_0.ttf +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/fonts/gilroy/Gilroy-Regular_0.ttf +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/fonts/gilroy/Gilroy-SemiBold_0.ttf +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/fonts/gilroy/Gilroy-Thin_0.ttf +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/icon/favicon.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/Five_Fingers_Left.jpg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/Left_Palm.jpg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/Ok_Sign_Right.jpg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/Peace_Sign_Left.jpg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/README.md +77 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/Right_Palm.jpg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/Speak_Phrase.jpg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/Three_Fingers_Right.jpg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/Thumbs_Up_Left.jpg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/Thumbs_Up_Right.jpg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/Wave_Right.jpg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/blink.jpeg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/blink_twice.jpeg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/center_face.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/clap.jpeg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/cover_mouth.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/cover_right_eye.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/cross_arms.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/face_straight.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/follow_dot.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/look_down.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/look_up.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/move_closer.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/nod.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/open_mouth.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/raise_eyebrow.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/rotate_face.jpeg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/shake_head.jpeg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/smile.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/tilt_left.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/tilt_right.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/touch_chin_left.jpg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/touch_left_cheek.jpeg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/touch_nose_right.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/touch_right_cheek.jpeg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/turn_left.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/turn_right.png +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/poses/wink.jpeg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/images/reference-pose.jpg +0 -0
- package/projects/facecog-liveness-verification-test/src/assets/shapes.svg +1 -0
- package/projects/facecog-liveness-verification-test/src/environments/environment.prod.ts +4 -0
- package/projects/facecog-liveness-verification-test/src/environments/environment.ts +17 -0
- package/projects/facecog-liveness-verification-test/src/global.scss +288 -0
- package/projects/facecog-liveness-verification-test/src/index.html +31 -0
- package/projects/facecog-liveness-verification-test/src/main.ts +6 -0
- package/projects/facecog-liveness-verification-test/src/polyfills.ts +55 -0
- package/projects/facecog-liveness-verification-test/src/theme/nextsapien-theme.scss +174 -0
- package/projects/facecog-liveness-verification-test/src/theme/variables.scss +2 -0
- package/projects/facecog-liveness-verification-test/src/zone-flags.ts +6 -0
- package/projects/facecog-liveness-verification-test/tsconfig.app.json +15 -0
- package/projects/facecog-liveness-verification-test/tsconfig.spec.json +14 -0
- package/setup-jest.ts +118 -0
- package/tsconfig.json +41 -0
- package/tsconfig.spec.json +15 -0
- package/vercel.json +24 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<div class="liveness-verification-container">
|
|
2
|
+
<!-- Intro Step -->
|
|
3
|
+
<div *ngIf="currentStep === 'intro'" class="step-intro">
|
|
4
|
+
<facecog-pose-selection
|
|
5
|
+
[selectedPose]="selectedPose"
|
|
6
|
+
(startVerification)="startVerification()">
|
|
7
|
+
</facecog-pose-selection>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<!-- Camera Verification Steps (permission + preview) -->
|
|
11
|
+
<div *ngIf="currentStep === 'permission' || currentStep === 'preview'" class="step-camera">
|
|
12
|
+
<facecog-camera-verification
|
|
13
|
+
#cameraVerification
|
|
14
|
+
[selectedPose]="selectedPose"
|
|
15
|
+
[config]="config"
|
|
16
|
+
(verificationComplete)="onCaptureComplete($event)"
|
|
17
|
+
(cancelled)="cancelVerification()"
|
|
18
|
+
(error)="handleError($event)">
|
|
19
|
+
</facecog-camera-verification>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<!-- Processing and Result Steps -->
|
|
23
|
+
<div *ngIf="currentStep === 'processing' || currentStep === 'result'" class="step-result">
|
|
24
|
+
<lib-verification-result
|
|
25
|
+
*ngIf="result"
|
|
26
|
+
[result]="result"
|
|
27
|
+
[isProcessing]="currentStep === 'processing'"
|
|
28
|
+
[processingProgress]="processingProgress"
|
|
29
|
+
(retry)="resetVerification()"
|
|
30
|
+
(complete)="completeVerification()">
|
|
31
|
+
</lib-verification-result>
|
|
32
|
+
<!-- Processing spinner when no result yet -->
|
|
33
|
+
<div *ngIf="!result && currentStep === 'processing'" class="processing-spinner">
|
|
34
|
+
<ion-spinner name="crescent"></ion-spinner>
|
|
35
|
+
<p>Processing...</p>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { Component, OnInit, Input, Output, EventEmitter, OnDestroy, ViewChild } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { IonicModule } from '@ionic/angular';
|
|
4
|
+
import { Subscription } from 'rxjs';
|
|
5
|
+
import { LivenessConfigService } from '../../services/liveness-config.service';
|
|
6
|
+
import { PoseSelectionService, SelectedPoseInfo } from '../../services/pose-selection.service';
|
|
7
|
+
import { MockBackendService } from '../../services/backends/mock-backend.service';
|
|
8
|
+
import { LivenessVerificationConfig } from '../../interfaces/liveness-verification-config.interface';
|
|
9
|
+
import { VerificationStepChangeEvent } from '../../interfaces/verification-step-change-event.interface';
|
|
10
|
+
import { VerificationProgressEvent } from '../../interfaces/verification-progress-event.interface';
|
|
11
|
+
import { LivenessResult } from '../../interfaces/liveness-result.interface';
|
|
12
|
+
import { PoseDefinition } from '../../interfaces/pose-definition.interface';
|
|
13
|
+
import { VerificationFlowStep } from '../../types/verification-flow-step.type';
|
|
14
|
+
import { LivenessBackend } from '../../types/liveness-backend.type';
|
|
15
|
+
import { getPoseById } from '../../models/utils/pose.utils';
|
|
16
|
+
import { PoseSelectionComponent } from '../pose-selection/pose-selection.component';
|
|
17
|
+
import { CameraVerificationComponent, CapturedVerificationData } from '../camera-verification/camera-verification.component';
|
|
18
|
+
import { VerificationResultComponent } from '../verification-result/verification-result.component';
|
|
19
|
+
|
|
20
|
+
@Component({
|
|
21
|
+
selector: 'facecog-liveness-verification',
|
|
22
|
+
standalone: true,
|
|
23
|
+
imports: [
|
|
24
|
+
CommonModule,
|
|
25
|
+
IonicModule,
|
|
26
|
+
PoseSelectionComponent,
|
|
27
|
+
CameraVerificationComponent,
|
|
28
|
+
VerificationResultComponent
|
|
29
|
+
],
|
|
30
|
+
templateUrl: './liveness-verification.component.html',
|
|
31
|
+
styleUrls: ['./liveness-verification.component.scss']
|
|
32
|
+
})
|
|
33
|
+
export class LivenessVerificationComponent implements OnInit, OnDestroy {
|
|
34
|
+
@ViewChild('cameraVerification') cameraVerification?: CameraVerificationComponent;
|
|
35
|
+
|
|
36
|
+
/** Configuration for the verification */
|
|
37
|
+
@Input() config?: Partial<LivenessVerificationConfig>;
|
|
38
|
+
|
|
39
|
+
/** Pose ID to verify (1-40) */
|
|
40
|
+
@Input() set pose(value: number | PoseDefinition | undefined) {
|
|
41
|
+
if (typeof value === 'number') {
|
|
42
|
+
this.selectedPose = getPoseById(value);
|
|
43
|
+
} else if (value) {
|
|
44
|
+
this.selectedPose = value;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Emitted when verification completes (success or failure) */
|
|
49
|
+
@Output() verificationComplete = new EventEmitter<LivenessResult>();
|
|
50
|
+
|
|
51
|
+
/** Emitted when an error occurs */
|
|
52
|
+
@Output() verificationError = new EventEmitter<Error>();
|
|
53
|
+
|
|
54
|
+
/** Emitted when the verification step changes */
|
|
55
|
+
@Output() stepChange = new EventEmitter<VerificationStepChangeEvent>();
|
|
56
|
+
|
|
57
|
+
/** Emitted during progress updates */
|
|
58
|
+
@Output() progress = new EventEmitter<VerificationProgressEvent>();
|
|
59
|
+
|
|
60
|
+
currentStep: VerificationFlowStep = 'intro';
|
|
61
|
+
selectedPose?: PoseDefinition;
|
|
62
|
+
result: LivenessResult | null = null;
|
|
63
|
+
processingProgress = 0;
|
|
64
|
+
|
|
65
|
+
private capturedFrames: string[] = [];
|
|
66
|
+
private videoBlob?: Blob;
|
|
67
|
+
private attemptCount = 0;
|
|
68
|
+
private subscriptions: Subscription[] = [];
|
|
69
|
+
|
|
70
|
+
constructor(
|
|
71
|
+
private configService: LivenessConfigService,
|
|
72
|
+
private poseSelection: PoseSelectionService,
|
|
73
|
+
private mockBackend: MockBackendService
|
|
74
|
+
) {}
|
|
75
|
+
|
|
76
|
+
ngOnInit(): void {
|
|
77
|
+
if (this.config) {
|
|
78
|
+
this.configService.updateConfig(this.config);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const sub = this.poseSelection.selectedPose$.subscribe((info: SelectedPoseInfo | null) => {
|
|
82
|
+
if (info) {
|
|
83
|
+
this.selectedPose = info.pose;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
this.subscriptions.push(sub);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
ngOnDestroy(): void {
|
|
90
|
+
this.subscriptions.forEach(sub => sub.unsubscribe());
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
startVerification(): void {
|
|
94
|
+
this.setStep('permission');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
onCaptureComplete(data: CapturedVerificationData): void {
|
|
98
|
+
this.capturedFrames = data.frames;
|
|
99
|
+
this.videoBlob = data.videoBlob;
|
|
100
|
+
this.attemptCount = data.attemptNumber;
|
|
101
|
+
|
|
102
|
+
this.setStep('processing');
|
|
103
|
+
this.processVerification();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
cancelVerification(): void {
|
|
107
|
+
const cancelResult: LivenessResult = {
|
|
108
|
+
success: false,
|
|
109
|
+
confidence: 0,
|
|
110
|
+
verifiedImage: '',
|
|
111
|
+
error: 'User cancelled',
|
|
112
|
+
metadata: {
|
|
113
|
+
timestamp: new Date().toISOString(),
|
|
114
|
+
backend: 'mock' as LivenessBackend,
|
|
115
|
+
confidence: 0,
|
|
116
|
+
attemptNumber: this.attemptCount
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
this.verificationComplete.emit(cancelResult);
|
|
121
|
+
this.resetToIntro();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
resetVerification(): void {
|
|
125
|
+
this.result = null;
|
|
126
|
+
this.capturedFrames = [];
|
|
127
|
+
this.videoBlob = undefined;
|
|
128
|
+
this.processingProgress = 0;
|
|
129
|
+
|
|
130
|
+
if (this.cameraVerification) {
|
|
131
|
+
this.cameraVerification.reset();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
this.setStep('intro');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
completeVerification(): void {
|
|
138
|
+
if (this.result) {
|
|
139
|
+
this.verificationComplete.emit(this.result);
|
|
140
|
+
}
|
|
141
|
+
this.resetVerification();
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
handleError(error: Error): void {
|
|
145
|
+
console.error('[LivenessVerification] Error:', error);
|
|
146
|
+
this.verificationError.emit(error);
|
|
147
|
+
|
|
148
|
+
this.result = {
|
|
149
|
+
success: false,
|
|
150
|
+
confidence: 0,
|
|
151
|
+
verifiedImage: '',
|
|
152
|
+
error: error.message,
|
|
153
|
+
metadata: {
|
|
154
|
+
timestamp: new Date().toISOString(),
|
|
155
|
+
backend: 'mock' as LivenessBackend,
|
|
156
|
+
confidence: 0,
|
|
157
|
+
attemptNumber: this.attemptCount
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
this.setStep('result');
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
private async processVerification(): Promise<void> {
|
|
165
|
+
this.processingProgress = 0;
|
|
166
|
+
|
|
167
|
+
const progressInterval = setInterval(() => {
|
|
168
|
+
this.processingProgress = Math.min(this.processingProgress + 10, 90);
|
|
169
|
+
}, 200);
|
|
170
|
+
|
|
171
|
+
try {
|
|
172
|
+
const primaryFrame = this.capturedFrames[0];
|
|
173
|
+
|
|
174
|
+
const response = await new Promise<{ isLive: boolean; confidence: number }>((resolve, reject) => {
|
|
175
|
+
this.mockBackend.verifyLiveness(primaryFrame, this.videoBlob).subscribe({
|
|
176
|
+
next: resolve,
|
|
177
|
+
error: reject
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
clearInterval(progressInterval);
|
|
182
|
+
this.processingProgress = 100;
|
|
183
|
+
|
|
184
|
+
this.result = {
|
|
185
|
+
success: response.isLive,
|
|
186
|
+
confidence: response.confidence,
|
|
187
|
+
verifiedImage: primaryFrame,
|
|
188
|
+
videoBlob: this.videoBlob,
|
|
189
|
+
metadata: {
|
|
190
|
+
timestamp: new Date().toISOString(),
|
|
191
|
+
backend: 'mock' as LivenessBackend,
|
|
192
|
+
confidence: response.confidence,
|
|
193
|
+
attemptNumber: this.attemptCount
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
this.setStep('result');
|
|
198
|
+
} catch (error) {
|
|
199
|
+
clearInterval(progressInterval);
|
|
200
|
+
this.result = {
|
|
201
|
+
success: false,
|
|
202
|
+
confidence: 0,
|
|
203
|
+
verifiedImage: this.capturedFrames[0] || '',
|
|
204
|
+
error: (error as Error).message || 'Verification failed',
|
|
205
|
+
metadata: {
|
|
206
|
+
timestamp: new Date().toISOString(),
|
|
207
|
+
backend: 'mock' as LivenessBackend,
|
|
208
|
+
confidence: 0,
|
|
209
|
+
attemptNumber: this.attemptCount
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
this.setStep('result');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
private setStep(step: VerificationFlowStep): void {
|
|
217
|
+
const previousStep = this.currentStep;
|
|
218
|
+
this.currentStep = step;
|
|
219
|
+
this.stepChange.emit({
|
|
220
|
+
step,
|
|
221
|
+
previousStep,
|
|
222
|
+
timestamp: new Date()
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
private resetToIntro(): void {
|
|
227
|
+
this.result = null;
|
|
228
|
+
this.capturedFrames = [];
|
|
229
|
+
this.videoBlob = undefined;
|
|
230
|
+
this.processingProgress = 0;
|
|
231
|
+
this.setStep('intro');
|
|
232
|
+
}
|
|
233
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<ion-card>
|
|
2
|
+
<ion-card-header>
|
|
3
|
+
<ion-card-title>Liveness Verification</ion-card-title>
|
|
4
|
+
<ion-card-subtitle>Verify your identity</ion-card-subtitle>
|
|
5
|
+
</ion-card-header>
|
|
6
|
+
<ion-card-content>
|
|
7
|
+
<div *ngIf="selectedPose" class="selected-pose">
|
|
8
|
+
<p>Selected pose: <strong>{{ selectedPose.name }}</strong></p>
|
|
9
|
+
<p class="pose-description">{{ selectedPose.description }}</p>
|
|
10
|
+
</div>
|
|
11
|
+
<p *ngIf="!selectedPose">No pose selected. Click start to begin.</p>
|
|
12
|
+
<ion-button expand="block" (click)="onStartVerification()">
|
|
13
|
+
<ion-icon name="camera" slot="start"></ion-icon>
|
|
14
|
+
Start Verification
|
|
15
|
+
</ion-button>
|
|
16
|
+
</ion-card-content>
|
|
17
|
+
</ion-card>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
import { IonicModule } from '@ionic/angular';
|
|
5
|
+
import { PoseSelectionComponent } from './pose-selection.component';
|
|
6
|
+
|
|
7
|
+
describe('PoseSelectionComponent', () => {
|
|
8
|
+
let component: PoseSelectionComponent;
|
|
9
|
+
let fixture: ComponentFixture<PoseSelectionComponent>;
|
|
10
|
+
|
|
11
|
+
beforeEach(async () => {
|
|
12
|
+
await TestBed.configureTestingModule({
|
|
13
|
+
imports: [CommonModule, IonicModule.forRoot(), PoseSelectionComponent],
|
|
14
|
+
schemas: [NO_ERRORS_SCHEMA]
|
|
15
|
+
}).compileComponents();
|
|
16
|
+
|
|
17
|
+
fixture = TestBed.createComponent(PoseSelectionComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should create', () => {
|
|
22
|
+
expect(component).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('selectedPose defaults to undefined', () => {
|
|
26
|
+
expect(component.selectedPose).toBeUndefined();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('onStartVerification emits startVerification', () => {
|
|
30
|
+
const spy = jest.fn();
|
|
31
|
+
component.startVerification.subscribe(spy);
|
|
32
|
+
component.onStartVerification();
|
|
33
|
+
expect(spy).toHaveBeenCalled();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { IonicModule } from '@ionic/angular';
|
|
4
|
+
import { PoseDefinition } from '../../interfaces/pose-definition.interface';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'facecog-pose-selection',
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [CommonModule, IonicModule],
|
|
10
|
+
templateUrl: './pose-selection.component.html',
|
|
11
|
+
styles: [`
|
|
12
|
+
.selected-pose {
|
|
13
|
+
margin-bottom: 16px;
|
|
14
|
+
padding: 12px;
|
|
15
|
+
background: var(--ion-color-light);
|
|
16
|
+
border-radius: 8px;
|
|
17
|
+
}
|
|
18
|
+
.pose-description {
|
|
19
|
+
font-size: 14px;
|
|
20
|
+
color: var(--ion-color-medium);
|
|
21
|
+
margin-top: 4px;
|
|
22
|
+
}
|
|
23
|
+
`]
|
|
24
|
+
})
|
|
25
|
+
export class PoseSelectionComponent {
|
|
26
|
+
@Input() selectedPose?: PoseDefinition;
|
|
27
|
+
|
|
28
|
+
@Output() startVerification = new EventEmitter<void>();
|
|
29
|
+
|
|
30
|
+
onStartVerification(): void {
|
|
31
|
+
this.startVerification.emit();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<div class="processing-wrapper">
|
|
2
|
+
<div class="processing-container">
|
|
3
|
+
<div class="image-preview" *ngIf="capturedImage">
|
|
4
|
+
<img [src]="capturedImage" alt="Captured frame" />
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<ion-spinner name="crescent" class="large-spinner"></ion-spinner>
|
|
8
|
+
|
|
9
|
+
<ion-text class="processing-text">
|
|
10
|
+
<h2>{{ message }}</h2>
|
|
11
|
+
<p>{{ subMessage }}</p>
|
|
12
|
+
</ion-text>
|
|
13
|
+
|
|
14
|
+
<ion-progress-bar [value]="progress / 100" color="primary"></ion-progress-bar>
|
|
15
|
+
<p class="progress-label">{{ Math.round(progress) }}% Complete</p>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
height: 100%;
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.processing-wrapper {
|
|
9
|
+
flex: 1;
|
|
10
|
+
overflow-y: auto;
|
|
11
|
+
padding: 16px;
|
|
12
|
+
background: var(--ion-background-color, #fff);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.processing-container {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
min-height: 100%;
|
|
21
|
+
padding: 24px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.image-preview {
|
|
25
|
+
width: 240px;
|
|
26
|
+
height: 240px;
|
|
27
|
+
border-radius: 24px;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
margin-bottom: 32px;
|
|
30
|
+
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.1);
|
|
31
|
+
position: relative;
|
|
32
|
+
animation: fadeIn 0.3s ease-out;
|
|
33
|
+
|
|
34
|
+
&::after {
|
|
35
|
+
content: '';
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 0;
|
|
38
|
+
left: 0;
|
|
39
|
+
right: 0;
|
|
40
|
+
bottom: 0;
|
|
41
|
+
background: linear-gradient(135deg, rgba(254, 60, 114, 0.1) 0%, transparent 100%);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
img {
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: 100%;
|
|
47
|
+
object-fit: cover;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.large-spinner {
|
|
52
|
+
width: 72px;
|
|
53
|
+
height: 72px;
|
|
54
|
+
margin: 32px 0;
|
|
55
|
+
color: var(--ion-color-primary);
|
|
56
|
+
animation: spinnerPulse 1.5s ease-in-out infinite;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.processing-text {
|
|
60
|
+
text-align: center;
|
|
61
|
+
margin: 24px 0 32px;
|
|
62
|
+
max-width: 400px;
|
|
63
|
+
|
|
64
|
+
h2 {
|
|
65
|
+
color: var(--ion-color-primary);
|
|
66
|
+
margin-bottom: 16px;
|
|
67
|
+
font-size: 26px;
|
|
68
|
+
font-weight: 700;
|
|
69
|
+
letter-spacing: -0.5px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
p {
|
|
73
|
+
color: var(--ion-color-medium);
|
|
74
|
+
font-size: 16px;
|
|
75
|
+
line-height: 1.6;
|
|
76
|
+
font-weight: 400;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
ion-progress-bar {
|
|
81
|
+
width: 100%;
|
|
82
|
+
max-width: 400px;
|
|
83
|
+
margin: 32px 0 16px;
|
|
84
|
+
height: 6px;
|
|
85
|
+
border-radius: 3px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.progress-label {
|
|
89
|
+
color: var(--ion-color-medium);
|
|
90
|
+
font-size: 16px;
|
|
91
|
+
font-weight: 600;
|
|
92
|
+
letter-spacing: 0.5px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@keyframes fadeIn {
|
|
96
|
+
0% {
|
|
97
|
+
opacity: 0;
|
|
98
|
+
}
|
|
99
|
+
100% {
|
|
100
|
+
opacity: 1;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@keyframes spinnerPulse {
|
|
105
|
+
0%, 100% {
|
|
106
|
+
transform: scale(1);
|
|
107
|
+
opacity: 1;
|
|
108
|
+
}
|
|
109
|
+
50% {
|
|
110
|
+
transform: scale(1.1);
|
|
111
|
+
opacity: 0.8;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@media (max-width: 768px) {
|
|
116
|
+
.image-preview {
|
|
117
|
+
width: 240px;
|
|
118
|
+
height: 240px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.processing-text {
|
|
122
|
+
h2 {
|
|
123
|
+
font-size: 24px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
p {
|
|
127
|
+
font-size: 15px;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@media (max-width: 480px) {
|
|
133
|
+
.processing-container {
|
|
134
|
+
padding: 32px 20px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.image-preview {
|
|
138
|
+
width: 200px;
|
|
139
|
+
height: 200px;
|
|
140
|
+
margin-bottom: 24px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.large-spinner {
|
|
144
|
+
width: 64px;
|
|
145
|
+
height: 64px;
|
|
146
|
+
margin: 24px 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.processing-text {
|
|
150
|
+
margin: 16px 0 24px;
|
|
151
|
+
|
|
152
|
+
h2 {
|
|
153
|
+
font-size: 22px;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { IonicModule } from '@ionic/angular';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
import { ProcessingComponent } from './processing.component';
|
|
6
|
+
|
|
7
|
+
describe('ProcessingComponent', () => {
|
|
8
|
+
let component: ProcessingComponent;
|
|
9
|
+
let fixture: ComponentFixture<ProcessingComponent>;
|
|
10
|
+
|
|
11
|
+
beforeEach(async () => {
|
|
12
|
+
await TestBed.configureTestingModule({
|
|
13
|
+
imports: [CommonModule, IonicModule.forRoot(), ProcessingComponent]
|
|
14
|
+
}).compileComponents();
|
|
15
|
+
|
|
16
|
+
fixture = TestBed.createComponent(ProcessingComponent);
|
|
17
|
+
component = fixture.componentInstance;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('has correct default inputs', () => {
|
|
25
|
+
expect(component.progress).toBe(0);
|
|
26
|
+
expect(component.message).toBe('Analyzing for liveness...');
|
|
27
|
+
expect(component.subMessage).toBe('This may take a moment.');
|
|
28
|
+
expect(component.capturedImage).toBeUndefined();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('renders progress value', () => {
|
|
32
|
+
component.progress = 75;
|
|
33
|
+
component.message = 'Custom message';
|
|
34
|
+
fixture.detectChanges();
|
|
35
|
+
|
|
36
|
+
expect(component.Math.round(component.progress)).toBe(75);
|
|
37
|
+
const compiled = fixture.nativeElement as HTMLElement;
|
|
38
|
+
expect(compiled.textContent).toContain('75');
|
|
39
|
+
expect(compiled.textContent).toContain('Custom message');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('exposes Math for template', () => {
|
|
43
|
+
expect(component.Math).toBe(Math);
|
|
44
|
+
expect(component.Math.round(42.7)).toBe(43);
|
|
45
|
+
});
|
|
46
|
+
});
|
package/projects/facecog-liveness-verification/src/lib/components/processing/processing.component.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { IonicModule } from '@ionic/angular';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'lib-processing',
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [CommonModule, IonicModule],
|
|
9
|
+
templateUrl: './processing.component.html',
|
|
10
|
+
styleUrls: ['./processing.component.scss']
|
|
11
|
+
})
|
|
12
|
+
export class ProcessingComponent {
|
|
13
|
+
@Input() capturedImage?: string;
|
|
14
|
+
@Input() progress: number = 0;
|
|
15
|
+
@Input() message: string = 'Analyzing for liveness...';
|
|
16
|
+
@Input() subMessage: string = 'This may take a moment.';
|
|
17
|
+
Math = Math;
|
|
18
|
+
}
|