@regulaforensics/vp-frontend-face-components 2.0.1 → 3.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/README.md +363 -167
- package/dist/main.js +1 -1
- package/dist/main.js.LICENSE.txt +18 -8
- package/lib/index.d.ts +232 -0
- package/package.json +5 -83
- package/lib/common/BackCameraIcon.d.ts +0 -6
- package/lib/common/Button.d.ts +0 -7
- package/lib/common/CameraChangeIcon.d.ts +0 -6
- package/lib/common/CameraIcon.d.ts +0 -6
- package/lib/common/CheckIcon.d.ts +0 -6
- package/lib/common/CrossIcon.d.ts +0 -6
- package/lib/common/DocReaderCameraDisabled.d.ts +0 -5
- package/lib/common/DocReaderCameraPreparing.d.ts +0 -5
- package/lib/common/DocReaderFlip.d.ts +0 -5
- package/lib/common/DocReaderProcessing.d.ts +0 -5
- package/lib/common/DocReaderProcessingError.d.ts +0 -5
- package/lib/common/DocReaderProcessingFinished.d.ts +0 -6
- package/lib/common/DocReaderSearch.d.ts +0 -5
- package/lib/common/ErrorIcon.d.ts +0 -6
- package/lib/common/FromCameraIcon.d.ts +0 -5
- package/lib/common/FromGalleryIcon.d.ts +0 -5
- package/lib/common/FrontCameraIcon.d.ts +0 -6
- package/lib/common/FullscreenExitIcon.d.ts +0 -6
- package/lib/common/FullscreenIcon.d.ts +0 -6
- package/lib/common/Icon.d.ts +0 -64
- package/lib/common/Message.d.ts +0 -8
- package/lib/common/NoGlareIconLivenessDetection.d.ts +0 -5
- package/lib/common/NoSmilingIconLivenessDetection.d.ts +0 -5
- package/lib/common/PortraitOrientationOnlyIcon.d.ts +0 -6
- package/lib/common/RegulaLogo.d.ts +0 -6
- package/lib/common/RegulaLogoLivenessDetection.d.ts +0 -5
- package/lib/common/SnapshotIcon.d.ts +0 -6
- package/lib/common/Spinner.d.ts +0 -3
- package/lib/common/SquareIcon.d.ts +0 -6
- package/lib/common/StopIcon.d.ts +0 -6
- package/lib/common/VerifiedIcon.d.ts +0 -6
- package/lib/components/ButtonFaceLiveness.d.ts +0 -7
- package/lib/components/CameraCapture.d.ts +0 -9
- package/lib/components/CameraSnapshot.d.ts +0 -2
- package/lib/components/CameraSnapshotFileCapture.d.ts +0 -10
- package/lib/components/DocumentCapture.d.ts +0 -11
- package/lib/components/DocumentContainer.d.ts +0 -11
- package/lib/components/DocumentReader.d.ts +0 -2
- package/lib/components/DocumentReaderFileCapture.d.ts +0 -12
- package/lib/components/DocumentReaderLayout.d.ts +0 -22
- package/lib/components/DocumentReaderStartScreen.d.ts +0 -10
- package/lib/components/ErrorBoundary.d.ts +0 -18
- package/lib/components/FaceCapture.d.ts +0 -25
- package/lib/components/FaceDetection.d.ts +0 -2
- package/lib/components/FaceFullScreenOverlay.d.ts +0 -10
- package/lib/components/FaceHintAnimaition.d.ts +0 -16
- package/lib/components/FaceLayout.d.ts +0 -23
- package/lib/components/FaceLiveness.d.ts +0 -2
- package/lib/components/InfoScreen.d.ts +0 -11
- package/lib/components/InfoScreenFaceLiveness.d.ts +0 -12
- package/lib/components/InstructionVideoScreen.d.ts +0 -9
- package/lib/components/ProcessScreen.d.ts +0 -6
- package/lib/components/ProcessScreenFaceLiveness.d.ts +0 -6
- package/lib/components/RetryScreenFaceLiveness.d.ts +0 -7
- package/lib/components/SectorAnimationSvg.d.ts +0 -11
- package/lib/components/WebCamera.d.ts +0 -19
- package/lib/constants.d.ts +0 -668
- package/lib/contexts/DocumentAttributesContext.d.ts +0 -25
- package/lib/contexts/DocumentSDKContext.d.ts +0 -8
- package/lib/contexts/FaceAttributesContext.d.ts +0 -26
- package/lib/hoc/withDocumentAttributesContext.d.ts +0 -4
- package/lib/hoc/withDocumentSDKContext.d.ts +0 -3
- package/lib/hoc/withFaceAttributesContext.d.ts +0 -4
- package/lib/hoc/withLocalize.d.ts +0 -8
- package/lib/hooks/useDocumentReaderSeries.d.ts +0 -19
- package/lib/hooks/useDocumentReaderSingle.d.ts +0 -14
- package/lib/hooks/useFaceLiveness.d.ts +0 -41
- package/lib/hooks/useImageInputParam.d.ts +0 -7
- package/lib/hooks/useOrientationChange.d.ts +0 -10
- package/lib/hooks/useStateCallback.d.ts +0 -1
- package/lib/hooks/useStream.d.ts +0 -10
- package/lib/hooks/useUserAgent.d.ts +0 -3
- package/lib/hooks/useWindowBlur.d.ts +0 -2
- package/lib/i18n/dictionaries/_dictionaries.d.ts +0 -2275
- package/lib/index-document.d.ts +0 -4
- package/lib/index-face.d.ts +0 -1
- package/lib/media-resources/resourcesBase64.d.ts +0 -7
- package/lib/models/CameraModel.d.ts +0 -9
- package/lib/models/CustomError.d.ts +0 -7
- package/lib/models/DocReaderWebclient/ext/authenticity/authenticity.d.ts +0 -32
- package/lib/models/DocReaderWebclient/ext/authenticity/fiber.d.ts +0 -7
- package/lib/models/DocReaderWebclient/ext/authenticity/ident.d.ts +0 -8
- package/lib/models/DocReaderWebclient/ext/authenticity/image-ident.d.ts +0 -7
- package/lib/models/DocReaderWebclient/ext/authenticity/index.d.ts +0 -5
- package/lib/models/DocReaderWebclient/ext/authenticity/ocr-security-text.d.ts +0 -7
- package/lib/models/DocReaderWebclient/ext/authenticity/security-feature.d.ts +0 -8
- package/lib/models/DocReaderWebclient/ext/images.d.ts +0 -16
- package/lib/models/DocReaderWebclient/ext/index.d.ts +0 -6
- package/lib/models/DocReaderWebclient/ext/process-request-image.d.ts +0 -5
- package/lib/models/DocReaderWebclient/ext/process-request.d.ts +0 -38
- package/lib/models/DocReaderWebclient/ext/process-response.d.ts +0 -36
- package/lib/models/DocReaderWebclient/ext/text-field.d.ts +0 -40
- package/lib/models/DocReaderWebclient/ext/text.d.ts +0 -14
- package/lib/models/DocReaderWebclient/models/area-array.d.ts +0 -32
- package/lib/models/DocReaderWebclient/models/area-container.d.ts +0 -38
- package/lib/models/DocReaderWebclient/models/authenticity-check-list.d.ts +0 -31
- package/lib/models/DocReaderWebclient/models/authenticity-check-result-item.d.ts +0 -38
- package/lib/models/DocReaderWebclient/models/authenticity-check-result.d.ts +0 -43
- package/lib/models/DocReaderWebclient/models/authenticity-result-all-of.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/authenticity-result-type.d.ts +0 -33
- package/lib/models/DocReaderWebclient/models/authenticity-result.d.ts +0 -18
- package/lib/models/DocReaderWebclient/models/bc-pdf417-info.d.ts +0 -54
- package/lib/models/DocReaderWebclient/models/bc-roidetect.d.ts +0 -42
- package/lib/models/DocReaderWebclient/models/check-diagnose.d.ts +0 -98
- package/lib/models/DocReaderWebclient/models/check-result.d.ts +0 -30
- package/lib/models/DocReaderWebclient/models/chosen-document-type-result-all-of.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/chosen-document-type-result.d.ts +0 -19
- package/lib/models/DocReaderWebclient/models/chosen-document-type.d.ts +0 -74
- package/lib/models/DocReaderWebclient/models/container-list.d.ts +0 -45
- package/lib/models/DocReaderWebclient/models/critical.d.ts +0 -26
- package/lib/models/DocReaderWebclient/models/cross-source-value-comparison.d.ts +0 -38
- package/lib/models/DocReaderWebclient/models/data-module.d.ts +0 -48
- package/lib/models/DocReaderWebclient/models/details-optical.d.ts +0 -67
- package/lib/models/DocReaderWebclient/models/details-rfid.d.ts +0 -61
- package/lib/models/DocReaderWebclient/models/device-info.d.ts +0 -54
- package/lib/models/DocReaderWebclient/models/doc-bar-code-info-all-of.d.ts +0 -31
- package/lib/models/DocReaderWebclient/models/doc-bar-code-info.d.ts +0 -19
- package/lib/models/DocReaderWebclient/models/doc-visual-extended-field.d.ts +0 -70
- package/lib/models/DocReaderWebclient/models/doc-visual-extended-info.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/document-format.d.ts +0 -70
- package/lib/models/DocReaderWebclient/models/document-image-result-all-of.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/document-image-result.d.ts +0 -18
- package/lib/models/DocReaderWebclient/models/document-image.d.ts +0 -24
- package/lib/models/DocReaderWebclient/models/document-position-result-all-of.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/document-position-result.d.ts +0 -19
- package/lib/models/DocReaderWebclient/models/document-position.d.ts +0 -80
- package/lib/models/DocReaderWebclient/models/document-type-recognition-result.d.ts +0 -30
- package/lib/models/DocReaderWebclient/models/document-type.d.ts +0 -246
- package/lib/models/DocReaderWebclient/models/document-types-candidates-list.d.ts +0 -32
- package/lib/models/DocReaderWebclient/models/document-types-candidates-result-all-of.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/document-types-candidates-result.d.ts +0 -18
- package/lib/models/DocReaderWebclient/models/document-types-candidates.d.ts +0 -32
- package/lib/models/DocReaderWebclient/models/encrypted-rclresult-all-of.d.ts +0 -24
- package/lib/models/DocReaderWebclient/models/encrypted-rclresult.d.ts +0 -18
- package/lib/models/DocReaderWebclient/models/fdsidlist.d.ts +0 -80
- package/lib/models/DocReaderWebclient/models/fiber-result-all-of.d.ts +0 -74
- package/lib/models/DocReaderWebclient/models/fiber-result.d.ts +0 -18
- package/lib/models/DocReaderWebclient/models/graphic-field-type.d.ts +0 -118
- package/lib/models/DocReaderWebclient/models/graphic-field.d.ts +0 -63
- package/lib/models/DocReaderWebclient/models/graphic-fields-list.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/graphics-result-all-of.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/graphics-result.d.ts +0 -19
- package/lib/models/DocReaderWebclient/models/ident-result-all-of.d.ts +0 -65
- package/lib/models/DocReaderWebclient/models/ident-result.d.ts +0 -18
- package/lib/models/DocReaderWebclient/models/image-data.d.ts +0 -24
- package/lib/models/DocReaderWebclient/models/image-qa.d.ts +0 -54
- package/lib/models/DocReaderWebclient/models/image-quality-check-list.d.ts +0 -32
- package/lib/models/DocReaderWebclient/models/image-quality-check-type.d.ts +0 -50
- package/lib/models/DocReaderWebclient/models/image-quality-check.d.ts +0 -64
- package/lib/models/DocReaderWebclient/models/image-quality-result-all-of.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/image-quality-result.d.ts +0 -18
- package/lib/models/DocReaderWebclient/models/images-available-source.d.ts +0 -31
- package/lib/models/DocReaderWebclient/models/images-field-value.d.ts +0 -70
- package/lib/models/DocReaderWebclient/models/images-field.d.ts +0 -38
- package/lib/models/DocReaderWebclient/models/images-result-all-of.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/images-result.d.ts +0 -18
- package/lib/models/DocReaderWebclient/models/images.d.ts +0 -32
- package/lib/models/DocReaderWebclient/models/index.d.ts +0 -123
- package/lib/models/DocReaderWebclient/models/lcid.d.ts +0 -582
- package/lib/models/DocReaderWebclient/models/lexical-analysis-result-all-of.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/lexical-analysis-result.d.ts +0 -19
- package/lib/models/DocReaderWebclient/models/license-result-all-of.d.ts +0 -24
- package/lib/models/DocReaderWebclient/models/license-result.d.ts +0 -18
- package/lib/models/DocReaderWebclient/models/light.d.ts +0 -34
- package/lib/models/DocReaderWebclient/models/list-verified-fields.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/log-level.d.ts +0 -23
- package/lib/models/DocReaderWebclient/models/measure-system.d.ts +0 -26
- package/lib/models/DocReaderWebclient/models/mrzformat.d.ts +0 -24
- package/lib/models/DocReaderWebclient/models/ocrsecurity-text-result-all-of.d.ts +0 -81
- package/lib/models/DocReaderWebclient/models/ocrsecurity-text-result.d.ts +0 -18
- package/lib/models/DocReaderWebclient/models/one-candidate.d.ts +0 -74
- package/lib/models/DocReaderWebclient/models/original-symbol.d.ts +0 -37
- package/lib/models/DocReaderWebclient/models/parray-field.d.ts +0 -81
- package/lib/models/DocReaderWebclient/models/per-document-config.d.ts +0 -30
- package/lib/models/DocReaderWebclient/models/photo-ident-result-all-of.d.ts +0 -76
- package/lib/models/DocReaderWebclient/models/photo-ident-result.d.ts +0 -18
- package/lib/models/DocReaderWebclient/models/point-array.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/point.d.ts +0 -30
- package/lib/models/DocReaderWebclient/models/points-container.d.ts +0 -31
- package/lib/models/DocReaderWebclient/models/process-params.d.ts +0 -254
- package/lib/models/DocReaderWebclient/models/process-request-image.d.ts +0 -38
- package/lib/models/DocReaderWebclient/models/process-request.d.ts +0 -60
- package/lib/models/DocReaderWebclient/models/process-response.d.ts +0 -66
- package/lib/models/DocReaderWebclient/models/process-system-info.d.ts +0 -30
- package/lib/models/DocReaderWebclient/models/processing-status.d.ts +0 -30
- package/lib/models/DocReaderWebclient/models/raw-image-container-list.d.ts +0 -31
- package/lib/models/DocReaderWebclient/models/rectangle-coordinates.d.ts +0 -42
- package/lib/models/DocReaderWebclient/models/result-item.d.ts +0 -48
- package/lib/models/DocReaderWebclient/models/result.d.ts +0 -98
- package/lib/models/DocReaderWebclient/models/rfid-location.d.ts +0 -30
- package/lib/models/DocReaderWebclient/models/rfid-origin.d.ts +0 -42
- package/lib/models/DocReaderWebclient/models/scenario.d.ts +0 -36
- package/lib/models/DocReaderWebclient/models/security-feature-result-all-of.d.ts +0 -59
- package/lib/models/DocReaderWebclient/models/security-feature-result.d.ts +0 -18
- package/lib/models/DocReaderWebclient/models/security-feature-type.d.ts +0 -49
- package/lib/models/DocReaderWebclient/models/source-validity.d.ts +0 -32
- package/lib/models/DocReaderWebclient/models/source.d.ts +0 -23
- package/lib/models/DocReaderWebclient/models/status-result-all-of.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/status-result.d.ts +0 -18
- package/lib/models/DocReaderWebclient/models/status.d.ts +0 -63
- package/lib/models/DocReaderWebclient/models/string-recognition-result.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/symbol-candidate.d.ts +0 -30
- package/lib/models/DocReaderWebclient/models/symbol-recognition-result.d.ts +0 -32
- package/lib/models/DocReaderWebclient/models/text-available-source.d.ts +0 -38
- package/lib/models/DocReaderWebclient/models/text-data-result-all-of.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/text-data-result.d.ts +0 -19
- package/lib/models/DocReaderWebclient/models/text-field-type.d.ts +0 -2386
- package/lib/models/DocReaderWebclient/models/text-field-value.d.ts +0 -70
- package/lib/models/DocReaderWebclient/models/text-field.d.ts +0 -84
- package/lib/models/DocReaderWebclient/models/text-post-processing.d.ts +0 -22
- package/lib/models/DocReaderWebclient/models/text-result-all-of.d.ts +0 -25
- package/lib/models/DocReaderWebclient/models/text-result.d.ts +0 -18
- package/lib/models/DocReaderWebclient/models/text.d.ts +0 -51
- package/lib/models/DocReaderWebclient/models/transaction-info.d.ts +0 -42
- package/lib/models/DocReaderWebclient/models/verification-result.d.ts +0 -38
- package/lib/models/DocReaderWebclient/models/verified-field-map.d.ts +0 -63
- package/lib/models/DocReaderWebclient/models/visibility.d.ts +0 -23
- package/lib/models/ImageModel.d.ts +0 -7
- package/lib/services/DebugService.d.ts +0 -17
- package/lib/services/DeviceOrientationService.d.ts +0 -18
- package/lib/services/DocumentReaderProcessor.d.ts +0 -43
- package/lib/services/DocumentReaderService.d.ts +0 -37
- package/lib/services/EventEmitter.d.ts +0 -9
- package/lib/services/FaceLivenessService.d.ts +0 -70
- package/lib/services/FaceService.d.ts +0 -39
- package/lib/services/StreamRecorderService.d.ts +0 -24
- package/lib/types.d.ts +0 -361
- package/lib/utils.d.ts +0 -30
- package/lib/web-components/CameraSnapshot.d.ts +0 -14
- package/lib/web-components/DocumentReader.d.ts +0 -14
- package/lib/web-components/FaceDetection.d.ts +0 -11
- package/lib/web-components/FaceLiveness.d.ts +0 -17
- package/lib/web-components/FullScreenContainer.d.ts +0 -4
package/README.md
CHANGED
|
@@ -1,28 +1,46 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
# Face SDK Web Components
|
|
2
|
+
|
|
3
|
+
- [Overview](#overview)
|
|
4
|
+
- [Before you start](#before-you-start)
|
|
5
|
+
- [Compatibility](#compatibility)
|
|
6
|
+
- [Install via NPM](#install-via-npm)
|
|
7
|
+
- [Install via CDN](#install-via-cdn)
|
|
8
|
+
- [Settings](#settings)
|
|
9
|
+
- [Customization](#customization)
|
|
10
|
+
- [Events](#events)
|
|
11
|
+
- [Response](#response)
|
|
12
|
+
- [Attributes](#attributes)
|
|
13
|
+
- [Custom translations](#custom-translations)
|
|
14
|
+
- [Examples](#examples)
|
|
15
|
+
- [Additional resources](#additional-resources)
|
|
12
16
|
|
|
13
17
|
---
|
|
14
18
|
|
|
15
|
-
##
|
|
19
|
+
## Overview
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
The Face SDK web components let you add automatic capture of a user's selfie and liveness check to your web site. The components capture a face from the device camera and can either simply detect a face on the captured photo or confirm the face <a href="https://docs.regulaforensics.com/develop/overview/#liveness-detection" target="_blank">liveness</a>.
|
|
18
22
|
|
|
23
|
+
The available components are:
|
|
24
|
+
|
|
25
|
+
- `face-capture`
|
|
26
|
+
- `face-liveness`
|
|
27
|
+
|
|
28
|
+
The web components are based on WebAssembly (.wasm module), which is our core C++ code compiled for use in browsers and wrapped with a JS layer. It is exactly the same code as built for all the other platform SDK packages.
|
|
29
|
+
|
|
30
|
+
## Before you start
|
|
31
|
+
|
|
32
|
+
Please note that:
|
|
33
|
+
|
|
34
|
+
- The components work **only** under the HTTPS protocol on the web site.
|
|
35
|
+
- The components library does register the components on the web page itself, so make sure to import the library to your web site before adding the components to the web page code.
|
|
36
|
+
- We do not include polyfills for older browsers in the package. If you need to support older versions of browsers in your project, you can simply install the necessary package. For example https://www.npmjs.com/package/@webcomponents/webcomponentsjs
|
|
19
37
|
## Compatibility
|
|
20
38
|
|
|
21
39
|
| Devices |  |  |  |
|
|
22
40
|
|:---------------------|:-------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------:|
|
|
23
41
|
| **Mobile (iOS)** | 99 (iOS14.4+) | 99 (iOS14.4+) | 11 |
|
|
24
|
-
| **Mobile (Android)** |
|
|
25
|
-
| **Desktop** | 66 |
|
|
42
|
+
| **Mobile (Android)** | 69 | 63 | - |
|
|
43
|
+
| **Desktop** | 66 | 69 | 11 |
|
|
26
44
|
|
|
27
45
|
## Install via NPM
|
|
28
46
|
|
|
@@ -39,26 +57,26 @@ npm init
|
|
|
39
57
|
```
|
|
40
58
|
Answer the questions in the command line questionnaire.
|
|
41
59
|
|
|
42
|
-
Install
|
|
60
|
+
Install `@regulaforensics/vp-frontend-face-components`:
|
|
43
61
|
|
|
44
62
|
```
|
|
45
63
|
npm i @regulaforensics/vp-frontend-face-components
|
|
46
64
|
```
|
|
47
65
|
|
|
48
|
-
Create
|
|
66
|
+
Create `index.html` and `index.js` files in the root directory of the project.
|
|
49
67
|
|
|
50
|
-
Import
|
|
68
|
+
Import `@regulaforensics/vp-frontend-face-components` into your `index.js`:
|
|
51
69
|
|
|
52
70
|
```javascript
|
|
53
71
|
import './node_modules/@regulaforensics/vp-frontend-face-components/dist/main.js';
|
|
54
72
|
```
|
|
55
73
|
|
|
56
|
-
In
|
|
74
|
+
In `index.html` connect `index.js` and add the name of the component you want to use. Available components:
|
|
57
75
|
|
|
58
|
-
1.
|
|
59
|
-
1.
|
|
76
|
+
1. `<face-capture></face-capture>` - for creating a face snapshot;
|
|
77
|
+
1. `<face-liveness></face-liveness>` - for performing liveness verification.
|
|
60
78
|
|
|
61
|
-
|
|
79
|
+
For example:
|
|
62
80
|
|
|
63
81
|
```html
|
|
64
82
|
<!DOCTYPE html>
|
|
@@ -76,43 +94,159 @@ Example:
|
|
|
76
94
|
|
|
77
95
|
## Install via CDN
|
|
78
96
|
|
|
79
|
-
Connect the script in your
|
|
97
|
+
Connect the script in your `.html` file. CDN link: `unpkg.com/:package@:version/:file`
|
|
80
98
|
|
|
81
|
-
|
|
99
|
+
For example:
|
|
82
100
|
|
|
83
101
|
```html
|
|
84
|
-
<script src="https://unpkg.com/@regulaforensics/vp-frontend-face-components@
|
|
102
|
+
<script src="https://unpkg.com/@regulaforensics/vp-frontend-face-components@latest/dist/main.js"></script>
|
|
85
103
|
```
|
|
86
104
|
|
|
87
105
|
Add the name of the component to the html, as in the example above.
|
|
88
106
|
|
|
89
|
-
##
|
|
90
|
-
|
|
91
|
-
### face-liveness
|
|
107
|
+
## Settings
|
|
92
108
|
|
|
93
|
-
|
|
109
|
+
You can set any parameter using `settings`. Find below examples of applying all the settings at once and just some of them.
|
|
94
110
|
|
|
95
|
-
Example:
|
|
111
|
+
Example of using all the settings:
|
|
96
112
|
|
|
97
|
-
|
|
113
|
+
````javascript
|
|
98
114
|
const component = document.getElementsByTagName('face-liveness')[0];
|
|
99
115
|
|
|
100
|
-
component.
|
|
101
|
-
|
|
116
|
+
component.settings = {
|
|
117
|
+
locale: 'en',
|
|
118
|
+
copyright: true,
|
|
119
|
+
cameraId: '123',
|
|
120
|
+
changeCamera: true,
|
|
121
|
+
startScreen: true,
|
|
122
|
+
closeDisabled: true,
|
|
123
|
+
finishScreen: true,
|
|
124
|
+
videoRecording: true,
|
|
125
|
+
url: 'https://your-server.com',
|
|
126
|
+
headers: {
|
|
127
|
+
Authorization: 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
|
|
128
|
+
},
|
|
129
|
+
tag: 'sessionIdValue',
|
|
130
|
+
retryCount: 5,
|
|
131
|
+
customization: {
|
|
132
|
+
fontFamily: 'Noto Sans, sans-serif',
|
|
133
|
+
fontSize: '16px',
|
|
134
|
+
onboardingScreenStartButtonBackground: '#7E57C5',
|
|
135
|
+
onboardingScreenStartButtonBackgroundHover: '#7c45b4',
|
|
136
|
+
onboardingScreenStartButtonTitle: '#FFFFFF',
|
|
137
|
+
onboardingScreenStartButtonTitleHover: '#FFFFFF',
|
|
138
|
+
cameraScreenFrontHintLabelBackground: '#E8E8E8',
|
|
139
|
+
onboardingScreenIllumination: 'https://path-to-image.com',
|
|
140
|
+
onboardingScreenAccessories: 'data:image/svg+xml;base64,PHN2...',
|
|
141
|
+
onboardingScreenCameraLevel: importedImage,
|
|
142
|
+
cameraScreenFrontHintLabelText: '#000000',
|
|
143
|
+
cameraScreenSectorActive: '#7E57C5',
|
|
144
|
+
cameraScreenSectorTarget: '#BEABE2',
|
|
145
|
+
cameraScreenStrokeNormal: '#7E57C5',
|
|
146
|
+
processingScreenProgress: '#7E57C5',
|
|
147
|
+
retryScreenRetryButtonBackground: '#7E57C5',
|
|
148
|
+
retryScreenRetryButtonBackgroundHover: '#7c45b4',
|
|
149
|
+
retryScreenRetryButtonTitle: '#FFFFFF',
|
|
150
|
+
retryScreenRetryButtonTitleHover: '#FFFFFF',
|
|
151
|
+
retryScreenEnvironmentImage: 'https://path-to-image.com',
|
|
152
|
+
retryScreenPersonImage: 'data:image/svg+xml;base64,PHN2...',
|
|
153
|
+
successScreenImage: importedImage,
|
|
154
|
+
}
|
|
155
|
+
}
|
|
102
156
|
|
|
103
|
-
|
|
157
|
+
````
|
|
104
158
|
|
|
105
|
-
Example:
|
|
159
|
+
Example of using just the selected settings:
|
|
160
|
+
|
|
161
|
+
````javascript
|
|
162
|
+
const yourSettings = {
|
|
163
|
+
locale: 'de',
|
|
164
|
+
videoRecording: false,
|
|
165
|
+
url: 'https://your-server.com',
|
|
166
|
+
headers: {
|
|
167
|
+
Authorization: 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
|
|
168
|
+
},
|
|
169
|
+
customization: {
|
|
170
|
+
fontFamily: 'Noto Sans, sans-serif',
|
|
171
|
+
successScreenImage: importedImage,
|
|
172
|
+
}
|
|
173
|
+
}
|
|
106
174
|
|
|
107
|
-
```javascript
|
|
108
175
|
const component = document.getElementsByTagName('face-liveness')[0];
|
|
109
176
|
|
|
110
|
-
component.
|
|
111
|
-
|
|
177
|
+
component.settings = yourSettings;
|
|
178
|
+
|
|
179
|
+
````
|
|
180
|
+
|
|
181
|
+
Here are all the available settings:
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
| Setting | Info | Data type | Default value | Values | Used in |
|
|
185
|
+
|:-----------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------:|:--------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|---------------------------------|
|
|
186
|
+
| `locale` | The language of the component. | `string` | `en` | `ru`, `en`, `de`, `pl`, `it`, `hu`, `zh`, `sk`, `uk`, `fr`, `es`, `pt`, `ar`, `nl`, `id`, `vi`, `ko`, `ms`, `ro`, `el`, `tr`, `ja`, `cs`, `th`, `hi`, `bn`, `he`, `fi`, `sv`, `da`, `hr`, `no` | `face-liveness`, `face-capture` |
|
|
187
|
+
| `url` | The backend URL. | `string` | `https://faceapi.regulaforensics.com/` | any url | `face-liveness` |
|
|
188
|
+
| `copyright` | Whether to show the Regula copyright footer. | `boolean` | `false` | `true`, `false` | `face-liveness`, `face-capture` |
|
|
189
|
+
| `cameraId` | The ability to select a camera by defining the camera ID. | `string` | `undefined` | `camera id string value` | `face-liveness`, `face-capture` |
|
|
190
|
+
| `changeCamera` | Whether to show the camera switch button. | `boolean` | `true` | `true`, `false` | `face-liveness`, `face-capture` |
|
|
191
|
+
| `startScreen` | Whether to show the start screen with video instruction. If `true`, the start screen is shown. If `false`, no start screen is shown and instead the camera of the device is turned on automatically to capture the face. | `boolean` | `true` | `true`, `false` | `face-liveness`, `face-capture` |
|
|
192
|
+
| `finishScreen` | Whether to show the finish screen (`success screen`, `retry-screen`). If `true`, the finish screen is shown. If `false`, no finish screen will be displayed, and **the user will only have one attempt to pass the liveness check**. | `boolean` | `true` | `true`, `false` | `face-liveness`, `face-capture` |
|
|
193
|
+
| `closeDisabled` | Whether to disable the "Close" button of the component. If set to `true`, the "Close" button is hidden from the user. | `boolean` | `false` | `true`, `false` | `face-liveness`, `face-capture` |
|
|
194
|
+
| `videoRecording` | Whether to enable the video recording of the process. If set to `true`, the video is sent to the server. The video format depends on the browser: MP4 for Safari, WEB for other browsers. | `boolean` | `false` | `true`, `false` | `face-liveness` |
|
|
195
|
+
| `tag` | The server generates a unique identifier for each session before starting a verification process. Using `tag`, you can set a custom value. Make sure that `tag` is unique for each session. | `string` | `undefined` | any unique for each session | `face-liveness` |
|
|
196
|
+
| `retryCount` | Using the `retryCount` setter, you can set the number of liveness transaction attempts for the user. Once the attempts are exhausted, the component will display a white screen and throw the "RETRY_COUNTER_EXCEEDED" event. By default, the number of attempts is unlimited. Setting the value to **0** removes the limit on the number of attempts, while any positive number limits the attempts. | `number` | `-1` | number of the attempts count | `face-liveness` |
|
|
197
|
+
| `headers` | Before starting the camera capture, the component sends a `start` request to the server and receives the initialization data in response. Once the component successfully completes two stages of verification, it sends the received data to the API for processing. You can use the `headers` setter to set the headers for the HTTP POST method. Additionally, the video recording is transmitted to the server along with these `headers`. | `object` | `undefined` | object with headers (key, value) | `face-liveness` |
|
|
198
|
+
| `customization` | You can customize element colors, fonts, and images using this object. See the customization section below. | `object` | `undefined` | object with customization settings | `face-liveness`, `face-capture` |
|
|
199
|
+
| `nonce` | You can set a unique nonce value to maintain the CSP policy. | `string` | `undefined` | unique nonce value | `face-liveness`, `face-capture` |
|
|
200
|
+
|
|
201
|
+
## Customization
|
|
202
|
+
|
|
203
|
+
You can customize colors of some elements, fonts, and images using the `customization` field in the `settings` object. The customization settings are the following:
|
|
204
|
+
|
|
205
|
+
| Setting | Info | Migrate from | Data type | Default value |
|
|
206
|
+
|:---------------------------------------------|:-----------------------------------------------------------------------------|-------------------------|:-------------------------------:|:-----------------------:|
|
|
207
|
+
| `fontFamily` | The component font. | `--font-family` | string | `Noto Sans, sans-serif` |
|
|
208
|
+
| `fontSize` | The component base font size. | `--font-size` | string | `16px` |
|
|
209
|
+
| `onboardingScreenStartButtonBackground` | The instruction screen button background color. | `--main-color` | string | `#7E57C5` |
|
|
210
|
+
| `onboardingScreenStartButtonBackgroundHover` | The instruction screen button background hover color. | `--hover-color` | string | `#7C45B4` |
|
|
211
|
+
| `onboardingScreenStartButtonTitle` | The instruction screen button text color. | | string | `#FFFFFF` |
|
|
212
|
+
| `onboardingScreenStartButtonTitleHover` | The instruction screen button text hover color. | | string | `#FFFFFF` |
|
|
213
|
+
| `onboardingScreenIllumination` | The instruction screen "Illumination" icon image. | | base64 or url or imported image | `` |
|
|
214
|
+
| `onboardingScreenAccessories` | The instruction screen "No accessories" icon image. | | base64 or url or imported image | `` |
|
|
215
|
+
| `onboardingScreenCameraLevel` | The instruction screen "Camera level" icon image. | | base64 or url or imported image | `` |
|
|
216
|
+
| `cameraScreenFrontHintLabelBackground` | The camera screen plate with info-message background color. | `--plate-color` | string | `#E8E8E8` |
|
|
217
|
+
| `cameraScreenFrontHintLabelText` | The camera screen plate with info-message text color. | | string | `#000000` |
|
|
218
|
+
| `cameraScreenSectorActive` | The user progress sector color (available only in face-liveness component). | | string | `#7E57C5` |
|
|
219
|
+
| `cameraScreenSectorTarget` | The target sector color (available only in face-liveness component). | `--target-sector-color` | string | `#BEABE2` |
|
|
220
|
+
| `cameraScreenStrokeNormal` | The stroke color of the camera circle. | | string | `#7E57C5` |
|
|
221
|
+
| `processingScreenProgress` | The processing screen spinner color. | | string | `#7E57C5` |
|
|
222
|
+
| `retryScreenEnvironmentImage` | The Retry screen environment image. | | base64 or url or imported image | `` |
|
|
223
|
+
| `retryScreenPersonImage` | The Retry screen person image. | | base64 or url or imported image | `` |
|
|
224
|
+
| `retryScreenRetryButtonBackground` | The Retry screen button background color. | `--main-color` | string | `#7E57C5` |
|
|
225
|
+
| `retryScreenRetryButtonBackgroundHover` | The Retry screen button background hover color. | `--hover-color` | string | `#7C45B4` |
|
|
226
|
+
| `retryScreenRetryButtonTitle` | The Retry screen button text color. | | string | `#FFFFFF` |
|
|
227
|
+
| `retryScreenRetryButtonTitleHover` | The Retry screen button text hover color. | | string | `#FFFFFF` |
|
|
228
|
+
| `successScreenImage` | The Success screen image. | | base64 or url or imported image | `` |
|
|
229
|
+
|
|
230
|
+
For example:
|
|
231
|
+
|
|
232
|
+
```javascript
|
|
233
|
+
const component = document.getElementsByTagName('face-liveness')[0];
|
|
234
|
+
|
|
235
|
+
component.settings = {
|
|
236
|
+
...otherSettings,
|
|
237
|
+
customization: {
|
|
238
|
+
fontFamily: 'Noto Sans, sans-serif',
|
|
239
|
+
fontSize: '16px',
|
|
240
|
+
onboardingScreenStartButtonBackground: '#7E57C5',
|
|
241
|
+
onboardingScreenStartButtonBackgroundHover: '#7c45b4',
|
|
242
|
+
retryScreenPersonImage: 'data:image/svg+xml;base64,PHN2...',
|
|
243
|
+
}
|
|
112
244
|
}
|
|
245
|
+
|
|
113
246
|
```
|
|
114
247
|
|
|
115
|
-
|
|
248
|
+
|
|
249
|
+
## Events
|
|
116
250
|
|
|
117
251
|
You can subscribe to the component events.
|
|
118
252
|
|
|
@@ -126,9 +260,9 @@ faceLivenessComponent.addEventListener('face-liveness', (event) => console.log(e
|
|
|
126
260
|
faceCaptureComponent.addEventListener('face-capture', (event) => console.log(event.detail)); // event listener for face-capture component
|
|
127
261
|
```
|
|
128
262
|
|
|
129
|
-
The
|
|
263
|
+
The `face-liveness` type of event is generated for the face-liveness component, and `face-capture` type of event is generated for the face-capture component.
|
|
130
264
|
|
|
131
|
-
The generated event object (
|
|
265
|
+
The generated event object (`event.detail`) contains three fields that describe the event:
|
|
132
266
|
|
|
133
267
|
```javascript
|
|
134
268
|
{
|
|
@@ -140,16 +274,17 @@ The generated event object (```event.detail```) contains three fields that descr
|
|
|
140
274
|
|
|
141
275
|
Type of actions:
|
|
142
276
|
|
|
143
|
-
| Type of action
|
|
144
|
-
|
|
145
|
-
|
|
|
146
|
-
|
|
|
147
|
-
|
|
|
148
|
-
|
|
|
149
|
-
|
|
|
150
|
-
|
|
|
277
|
+
| Type of action | Description of the action | The component |
|
|
278
|
+
|:-------------------------|:---------------------------------------------------------------------------------------:|:-------------------------------:|
|
|
279
|
+
| `ELEMENT_VISIBLE` | The component is appended in the DOM. | `face-liveness`, `face-capture` |
|
|
280
|
+
| `PRESS_START_BUTTON` | The "Get started" button is pressed. | `face-liveness`, `face-capture` |
|
|
281
|
+
| `PRESS_RETRY_BUTTON` | The "Retry" button is pressed. | `face-liveness`, `face-capture` |
|
|
282
|
+
| `CLOSE` | The "Close" button is pressed. | `face-liveness`, `face-capture` |
|
|
283
|
+
| `PROCESS_FINISHED` | The component has finished its work. | `face-liveness`, `face-capture` |
|
|
284
|
+
| `SERVICE_INITIALIZED` | The component has started its work. | `face-liveness`, `face-capture` |
|
|
285
|
+
| `RETRY_COUNTER_EXCEEDED` | The component has finished its work due to the exceeded number of transaction attempts. | `face-liveness` |
|
|
151
286
|
|
|
152
|
-
In cases of successful operation of the components, the
|
|
287
|
+
In cases of successful operation of the components, the `data` field will contain the following fields:
|
|
153
288
|
|
|
154
289
|
```javascript
|
|
155
290
|
{
|
|
@@ -158,7 +293,7 @@ In cases of successful operation of the components, the ```data``` field will co
|
|
|
158
293
|
}
|
|
159
294
|
```
|
|
160
295
|
|
|
161
|
-
In cases of unsuccessful work, the
|
|
296
|
+
In cases of unsuccessful work, the `data` field will contain the following fields:
|
|
162
297
|
|
|
163
298
|
```javascript
|
|
164
299
|
{
|
|
@@ -167,19 +302,23 @@ In cases of unsuccessful work, the ```data``` field will contain the following f
|
|
|
167
302
|
}
|
|
168
303
|
```
|
|
169
304
|
|
|
170
|
-
Table of
|
|
171
|
-
|
|
172
|
-
| Reason
|
|
173
|
-
|
|
174
|
-
|
|
|
175
|
-
|
|
|
176
|
-
|
|
|
177
|
-
|
|
|
178
|
-
|
|
|
179
|
-
|
|
|
180
|
-
|
|
|
181
|
-
|
|
|
182
|
-
|
|
|
305
|
+
Table of event causes:
|
|
306
|
+
|
|
307
|
+
| Reason | Description of the reason |
|
|
308
|
+
|:----------------------------|:-------------------------------------------------------------------------------------------------------:|
|
|
309
|
+
| `WASM_ERROR` | Error in WASM. |
|
|
310
|
+
| `UNKNOWN_ERROR` | Unknown error. |
|
|
311
|
+
| `NOT_SUPPORTED` | The browser is not supported. |
|
|
312
|
+
| `CAMERA_UNKNOWN_ERROR` | Unknown camera error. |
|
|
313
|
+
| `CAMERA_PERMISSION_DENIED` | Access to the camera is prohibited. |
|
|
314
|
+
| `NO_CAMERA` | There is no camera. |
|
|
315
|
+
| `CONNECTION_ERROR` | Connection errors. |
|
|
316
|
+
| `LANDSCAPE_MODE_RESTRICTED` | Work in landscape orientation is prohibited. |
|
|
317
|
+
| `TIMEOUT_ERROR` | Transaction failed due to timeout. |
|
|
318
|
+
| `CHANGE_CAMERA` | The user has changed the camera. Return to start-screen or restart service if start-screen is disabled. |
|
|
319
|
+
| `DEVICE_ROTATE` | The user has rotated the device. Return to start-screen or restart service if start-screen is disabled. |
|
|
320
|
+
| `APP_INACTIVE` | The user has closed the tab or browser during the face capture process. |
|
|
321
|
+
| `INCORRECT_CAMERA_ID` | No camera with the specified ID found. |
|
|
183
322
|
|
|
184
323
|
The table below describes the cases of event generation:
|
|
185
324
|
|
|
@@ -192,7 +331,7 @@ The table below describes the cases of event generation:
|
|
|
192
331
|
<th>Event type</th>
|
|
193
332
|
<th>
|
|
194
333
|
|
|
195
|
-
Event object
|
|
334
|
+
Event object `event.detail`
|
|
196
335
|
</th>
|
|
197
336
|
<th>Description</th>
|
|
198
337
|
</tr>
|
|
@@ -202,11 +341,10 @@ Event object ```event.detail```
|
|
|
202
341
|
<td>The component is mounted in the DOM.</td>
|
|
203
342
|
<td>
|
|
204
343
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
```face-capture```
|
|
344
|
+
`face-liveness`
|
|
345
|
+
<br>
|
|
346
|
+
<br>
|
|
347
|
+
`face-capture`
|
|
210
348
|
|
|
211
349
|
</td>
|
|
212
350
|
<td>
|
|
@@ -214,8 +352,7 @@ For face-capture:
|
|
|
214
352
|
```javascript
|
|
215
353
|
{
|
|
216
354
|
action: "ELEMENT_VISIBLE",
|
|
217
|
-
data: null
|
|
218
|
-
manual: true
|
|
355
|
+
data: null
|
|
219
356
|
}
|
|
220
357
|
```
|
|
221
358
|
|
|
@@ -224,7 +361,8 @@ For face-capture:
|
|
|
224
361
|
|
|
225
362
|
To receive this event, you must wrap the component in another element (for example, a div) and add an addEventListener to it. When the component appears in the DOM, the event will pop up.
|
|
226
363
|
|
|
227
|
-
|
|
364
|
+
For example:
|
|
365
|
+
|
|
228
366
|
```html
|
|
229
367
|
<div id="add-event-listener-to-this-element">
|
|
230
368
|
<face-liveness></face-liveness>
|
|
@@ -237,11 +375,10 @@ Example:
|
|
|
237
375
|
<td>The "Get started" button is pressed.</td>
|
|
238
376
|
<td>
|
|
239
377
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
```face-capture```
|
|
378
|
+
`face-liveness`
|
|
379
|
+
<br>
|
|
380
|
+
<br>
|
|
381
|
+
`face-capture`
|
|
245
382
|
|
|
246
383
|
</td>
|
|
247
384
|
<td>
|
|
@@ -249,8 +386,7 @@ For face-capture:
|
|
|
249
386
|
```javascript
|
|
250
387
|
{
|
|
251
388
|
action: "PRESS_START_BUTTON",
|
|
252
|
-
data: null
|
|
253
|
-
manual: true
|
|
389
|
+
data: null
|
|
254
390
|
}
|
|
255
391
|
```
|
|
256
392
|
|
|
@@ -261,11 +397,10 @@ For face-capture:
|
|
|
261
397
|
<td>The "Retry" button is pressed.</td>
|
|
262
398
|
<td>
|
|
263
399
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
```face-capture```
|
|
400
|
+
`face-liveness`
|
|
401
|
+
<br>
|
|
402
|
+
<br>
|
|
403
|
+
`face-capture`
|
|
269
404
|
|
|
270
405
|
</td>
|
|
271
406
|
<td>
|
|
@@ -273,8 +408,7 @@ For face-capture:
|
|
|
273
408
|
```javascript
|
|
274
409
|
{
|
|
275
410
|
action: "PRESS_RETRY_BUTTON",
|
|
276
|
-
data: null
|
|
277
|
-
manual: true
|
|
411
|
+
data: null
|
|
278
412
|
}
|
|
279
413
|
```
|
|
280
414
|
|
|
@@ -285,11 +419,10 @@ For face-capture:
|
|
|
285
419
|
<td>The "Close" button is pressed.</td>
|
|
286
420
|
<td>
|
|
287
421
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
```face-capture```
|
|
422
|
+
`face-liveness`
|
|
423
|
+
<br>
|
|
424
|
+
<br>
|
|
425
|
+
`face-capture`
|
|
293
426
|
|
|
294
427
|
</td>
|
|
295
428
|
<td>
|
|
@@ -297,8 +430,7 @@ For face-capture:
|
|
|
297
430
|
```javascript
|
|
298
431
|
{
|
|
299
432
|
action: "CLOSE",
|
|
300
|
-
data: null
|
|
301
|
-
manual: true
|
|
433
|
+
data: null
|
|
302
434
|
}
|
|
303
435
|
```
|
|
304
436
|
|
|
@@ -309,11 +441,10 @@ For face-capture:
|
|
|
309
441
|
<td>The work of the component is completed successfully.</td>
|
|
310
442
|
<td>
|
|
311
443
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
```face-capture```
|
|
444
|
+
`face-liveness`
|
|
445
|
+
<br>
|
|
446
|
+
<br>
|
|
447
|
+
`face-capture`
|
|
317
448
|
|
|
318
449
|
</td>
|
|
319
450
|
<td>
|
|
@@ -325,7 +456,6 @@ For face-capture:
|
|
|
325
456
|
response: { ... },
|
|
326
457
|
status: 1
|
|
327
458
|
},
|
|
328
|
-
manual: false
|
|
329
459
|
}
|
|
330
460
|
```
|
|
331
461
|
|
|
@@ -336,11 +466,10 @@ For face-capture:
|
|
|
336
466
|
<td>The work of the component failed.</td>
|
|
337
467
|
<td>
|
|
338
468
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
```face-capture```
|
|
469
|
+
`face-liveness`
|
|
470
|
+
<br>
|
|
471
|
+
<br>
|
|
472
|
+
`face-capture`
|
|
344
473
|
|
|
345
474
|
</td>
|
|
346
475
|
<td>
|
|
@@ -349,10 +478,9 @@ For face-capture:
|
|
|
349
478
|
{
|
|
350
479
|
action: "PROCESS_FINISHED",
|
|
351
480
|
data: {
|
|
352
|
-
reason: "An
|
|
481
|
+
reason: "An event has occurred",
|
|
353
482
|
status: 0
|
|
354
483
|
},
|
|
355
|
-
manual: false
|
|
356
484
|
}
|
|
357
485
|
```
|
|
358
486
|
|
|
@@ -360,14 +488,38 @@ For face-capture:
|
|
|
360
488
|
<td></td>
|
|
361
489
|
</tr>
|
|
362
490
|
<tr>
|
|
363
|
-
<td>
|
|
491
|
+
<td>The work of the component finished by timeout.</td>
|
|
364
492
|
<td>
|
|
365
493
|
|
|
366
|
-
|
|
367
|
-
|
|
494
|
+
`face-liveness`
|
|
495
|
+
<br>
|
|
496
|
+
<br>
|
|
497
|
+
`face-capture`
|
|
498
|
+
|
|
499
|
+
</td>
|
|
500
|
+
<td>
|
|
501
|
+
|
|
502
|
+
```javascript
|
|
503
|
+
{
|
|
504
|
+
action: "PROCESS_FINISHED",
|
|
505
|
+
data: {
|
|
506
|
+
reason: "TIMEOUT_ERROR"
|
|
507
|
+
status: 0
|
|
508
|
+
},
|
|
509
|
+
}
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
</td>
|
|
513
|
+
<td></td>
|
|
514
|
+
</tr>
|
|
515
|
+
<tr>
|
|
516
|
+
<td>The component is initialized and ready to work.</td>
|
|
517
|
+
<td>
|
|
368
518
|
|
|
369
|
-
|
|
370
|
-
|
|
519
|
+
`face-liveness`
|
|
520
|
+
<br>
|
|
521
|
+
<br>
|
|
522
|
+
`face-capture`
|
|
371
523
|
|
|
372
524
|
</td>
|
|
373
525
|
<td>
|
|
@@ -375,8 +527,7 @@ For face-capture:
|
|
|
375
527
|
```javascript
|
|
376
528
|
{
|
|
377
529
|
action: "SERVICE_INITIALIZED",
|
|
378
|
-
data: null
|
|
379
|
-
manual: false
|
|
530
|
+
data: null
|
|
380
531
|
}
|
|
381
532
|
```
|
|
382
533
|
|
|
@@ -386,11 +537,11 @@ For face-capture:
|
|
|
386
537
|
</tbody>
|
|
387
538
|
</table>
|
|
388
539
|
|
|
389
|
-
##
|
|
540
|
+
## Response
|
|
390
541
|
|
|
391
|
-
You can get the response of the component in the
|
|
542
|
+
You can get the response of the component in the `detail` field of the event object.
|
|
392
543
|
|
|
393
|
-
|
|
544
|
+
For example:
|
|
394
545
|
|
|
395
546
|
```javascript
|
|
396
547
|
const component = document.getElementsByTagName('face-capture')[0];
|
|
@@ -405,7 +556,7 @@ function listener(event) {
|
|
|
405
556
|
component.addEventListener('face-capture', listener);
|
|
406
557
|
```
|
|
407
558
|
|
|
408
|
-
The
|
|
559
|
+
The `face-liveness` response has the following structure:
|
|
409
560
|
|
|
410
561
|
```javascript
|
|
411
562
|
{
|
|
@@ -413,77 +564,122 @@ The ```face-liveness``` response has the following structure
|
|
|
413
564
|
metadata: {
|
|
414
565
|
[key: string]: any
|
|
415
566
|
};
|
|
416
|
-
|
|
417
|
-
status: number // liveness status
|
|
567
|
+
tag: string
|
|
568
|
+
status: number // liveness status: 0 if the person's liveness is confirmed, 1 if not.
|
|
569
|
+
estimatedAge: number | null // approximate age with an accuracy of +/-3 years
|
|
418
570
|
transactionId: string
|
|
419
571
|
images: string[] // array with the final image in base64
|
|
420
572
|
}
|
|
421
573
|
````
|
|
422
574
|
|
|
423
|
-
The
|
|
575
|
+
The `face-capture` response has the following structure:
|
|
424
576
|
|
|
425
577
|
```javascript
|
|
426
578
|
{
|
|
427
579
|
capture: string[] // array with the final image in base64
|
|
428
580
|
}
|
|
429
|
-
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
## Attributes
|
|
430
584
|
|
|
431
|
-
|
|
585
|
+
**Warning**. Passing parameters via attributes is deprecated. In future versions, support will be discontinued. Please use the settings.
|
|
432
586
|
|
|
433
587
|
### face-capture
|
|
434
588
|
|
|
435
|
-
| Attribute
|
|
436
|
-
|
|
437
|
-
| **locale**
|
|
438
|
-
| **copyright**
|
|
439
|
-
| **camera-id**
|
|
440
|
-
| **change-camera**
|
|
441
|
-
| **start-screen**
|
|
589
|
+
| Attribute | Info | Data type | Default value | Values |
|
|
590
|
+
|:-------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------:|:-------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
|
591
|
+
| **locale** | The language of the component. | string | `en` | `ru`, `en`, `de`, `pl`, `it`, `hu`, `zh`, `sk`, `uk`, `fr`, `es`, `pt`, `ar`, `nl`, `id`, `vi`, `ko`, `ms`, `ro`, `el`, `tr`, `ja`, `cs`, `th`, `hi`, `bn`, `he`, `fi`, `sv`, `da`, `hr`, `no` |
|
|
592
|
+
| **copyright** | Whether to show the Regula copyright footer. | boolean | `false` | `true`, `false` |
|
|
593
|
+
| **camera-id** | Ability to select a camera. | string | `undefined` | `camera id string value` |
|
|
594
|
+
| **change-camera** | Whether to show the camera switch button. | boolean | `true` | `true`, `false` |
|
|
595
|
+
| **start-screen** | Whether to show the start screen with video instructions. If `true`, the start screen is shown. If `false`, no start screen is shown and instead the camera of the device is turned on automatically to capture the face. | boolean | `true` | `true`, `false` |
|
|
596
|
+
| **finish-screen** | Whether to show the finish screen (`success screen`, `retry-screen`). If `true`, the finish screen is shown. If `false`, no finish screen will be displayed, and **the user will only have one attempt to pass the liveness check**. | boolean | `true` | `true`, `false` |
|
|
597
|
+
| **close-disabled** | Whether to disable the "Close" button of the component. If set to `true`, the "Close" button is hidden from the user. | boolean | `false` | `true`, `false` |
|
|
442
598
|
|
|
443
599
|
### face-liveness
|
|
444
600
|
|
|
445
|
-
| Attribute
|
|
446
|
-
|
|
447
|
-
| **locale**
|
|
448
|
-
| **url**
|
|
449
|
-
| **copyright**
|
|
450
|
-
| **camera-id**
|
|
451
|
-
| **change-camera**
|
|
452
|
-
| **start-screen**
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
CSS:
|
|
472
|
-
|
|
473
|
-
```css
|
|
474
|
-
.my-custom-style {
|
|
475
|
-
--font-family: Arial, sans-serif;
|
|
476
|
-
--main-color: green;
|
|
477
|
-
--hover-color: red;
|
|
478
|
-
}
|
|
601
|
+
| Attribute | Info | Data type | Default value | Values |
|
|
602
|
+
|:--------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------:|:--------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
|
603
|
+
| **locale** | The language of the component. | string | `en` | `ru`, `en`, `de`, `pl`, `it`, `hu`, `zh`, `sk`, `uk`, `fr`, `es`, `pt`, `ar`, `nl`, `id`, `vi`, `ko`, `ms`, `ro`, `el`, `tr`, `ja`, `cs`, `th`, `hi`, `bn`, `he`, `fi`, `sv`, `da`, `hr`, `no` |
|
|
604
|
+
| **url** | The backend URL. | string | `https://faceapi.regulaforensics.com/` | any url |
|
|
605
|
+
| **copyright** | Whether to show the Regula copyright footer. | boolean | `false` | `true`, `false` |
|
|
606
|
+
| **camera-id** | The ability to select a camera by defining the camera ID. | string | `undefined` | `camera id string value` |
|
|
607
|
+
| **change-camera** | Whether to show the camera switch button. | boolean | `true` | `true`, `false` |
|
|
608
|
+
| **start-screen** | Whether to show the start screen with video instruction. If `true`, the start screen is shown. If `false`, no start screen is shown and instead the camera of the device is turned on automatically to capture the face. | boolean | `true` | `true`, `false` |
|
|
609
|
+
| **finish-screen** | Whether to show the finish screen (`success screen`, `retry-screen`). If `true`, the finish screen is shown. If `false`, no finish screen will be displayed, and **the user will only have one attempt to pass the liveness check**. | boolean | `true` | `true`, `false` |
|
|
610
|
+
| **close-disabled** | Whether to disable the "Close" button of the component. If set to `true`, the "Close" button is hidden from the user. | boolean | `false` | `true`, `false` |
|
|
611
|
+
| **video-recording** | Whether to enable the video recording of the process. If set to `true`, the video is sent to the server. The video format depends on the browser: MP4 for Safari, WEB for other browsers. | boolean | `false` | `true`, `false` |
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
## Custom translations
|
|
615
|
+
|
|
616
|
+
To change the standard component messages or any text, specify the language you are using (or add your own) and the label you want to change (you can see the list of available languages in the [attributes](#component-attributes) section, the `locale` attribute):
|
|
617
|
+
|
|
618
|
+
```javascript
|
|
619
|
+
const element = document.querySelector('face-liveness');
|
|
620
|
+
|
|
621
|
+
element.translations = {
|
|
622
|
+
en: {
|
|
623
|
+
selfieTime: 'Get Selfie',
|
|
624
|
+
},
|
|
625
|
+
};
|
|
479
626
|
```
|
|
480
627
|
|
|
481
|
-
|
|
628
|
+
**Note**. To see the changes, don't forget to set the language you changed to the `locale` attribute:
|
|
482
629
|
|
|
483
630
|
```html
|
|
484
|
-
<face-
|
|
631
|
+
<face-liveness locale="en"></face-liveness>
|
|
485
632
|
```
|
|
486
633
|
|
|
634
|
+
The list of labels used in the component:
|
|
635
|
+
|
|
636
|
+
| Label | Default message in `en` locale | Used in |
|
|
637
|
+
|:------------------------------|:----------------------------------------------------------------------------------------------------|:-------------------------------:|
|
|
638
|
+
| **showOnlyOneFace** | Make sure there is only one face on the screen. | `face-liveness`, `face-capture` |
|
|
639
|
+
| **preparingCamera** | Preparing the camera... | `face-liveness`, `face-capture` |
|
|
640
|
+
| **allowAccessCamera** | Allow access to the camera | `face-liveness`, `face-capture` |
|
|
641
|
+
| **somethingWentWrong** | Something went wrong | `face-liveness`, `face-capture` |
|
|
642
|
+
| **incorrectCameraId** | No camera with the specified ID found. | `face-liveness`, `face-capture` |
|
|
643
|
+
| **checkCameraId** | Check if the specified camera ID is correct. | `face-liveness`, `face-capture` |
|
|
644
|
+
| **preparingService** | Preparing the service... | `face-liveness`, `face-capture` |
|
|
645
|
+
| **allowAccessToCamera** | Allow access to the camera and reload this page to continue. | `face-liveness`, `face-capture` |
|
|
646
|
+
| **error** | Error! | `face-liveness`, `face-capture` |
|
|
647
|
+
| **versionNotSupported** | Your browser version is not supported. | `face-liveness`, `face-capture` |
|
|
648
|
+
| **updateBrowser** | Update your browser version | `face-liveness`, `face-capture` |
|
|
649
|
+
| **licenseError** | A license error has occurred | `face-liveness`, `face-capture` |
|
|
650
|
+
| **licenseExpired** | The license cannot be found or has expired | `face-liveness`, `face-capture` |
|
|
651
|
+
| **onlyPortraitOrientation** | Portrait orientation only | `face-liveness`, `face-capture` |
|
|
652
|
+
| **turnDeviceIntoPortrait** | Please turn your device into portrait mode | `face-liveness`, `face-capture` |
|
|
653
|
+
| **tryAgain** | Try again | `face-liveness`, `face-capture` |
|
|
654
|
+
| **noCameraAvailable** | No camera available | `face-liveness`, `face-capture` |
|
|
655
|
+
| **checkCameraConnection** | Check the camera connection and try again. | `face-liveness`, `face-capture` |
|
|
656
|
+
| **lookStraight** | Look straight | `face-liveness`, `face-capture` |
|
|
657
|
+
| **fitYourFace** | Center your face | `face-liveness`, `face-capture` |
|
|
658
|
+
| **moveCloser** | Move closer | `face-liveness`, `face-capture` |
|
|
659
|
+
| **moveAway** | Move away | `face-liveness`, `face-capture` |
|
|
660
|
+
| **holdSteady** | Hold steady | `face-liveness`, `face-capture` |
|
|
661
|
+
| **processing** | Processing... | `face-liveness`, `face-capture` |
|
|
662
|
+
| **retryButtonText** | Retry | `face-liveness`, `face-capture` |
|
|
663
|
+
| **followGuidelinesText** | But please follow these guidelines: | `face-liveness`, `face-capture` |
|
|
664
|
+
| **letsTryAgainTitle** | Let’s try that again | `face-liveness`, `face-capture` |
|
|
665
|
+
| **noCameraPermission** | Camera unavailable! | `face-liveness`, `face-capture` |
|
|
666
|
+
| **goButton** | Go | `face-liveness`, `face-capture` |
|
|
667
|
+
| **selfieTime** | Selfie time! | `face-liveness`, `face-capture` |
|
|
668
|
+
| **ambientLighting** | Ambient lighting is not too bright or too dark and there are no shadows or glare on your face | `face-liveness` |
|
|
669
|
+
| **noMaskSunglassesHeaddress** | Neutral facial expression (no smiling, eyes open and mouth closed), no mask, sunglasses or headwear | `face-liveness` |
|
|
670
|
+
| **turnHead** | Turn your head a bit | `face-liveness` |
|
|
671
|
+
| **centerFaceTurnHead** | Center your face, turn your head | `face-liveness` |
|
|
672
|
+
| **centerFace** | Center your face | `face-capture` |
|
|
673
|
+
| **errorCode** | Error code: | `face-liveness` |
|
|
674
|
+
| **illumination** | Good illumination. | `face-liveness`, `face-capture` |
|
|
675
|
+
| **cameraLevel** | Camera at eye level. | `face-liveness`, `face-capture` |
|
|
676
|
+
| **noAccessories** | No accessories: glasses, mask, hat, etc. | `face-liveness`, `face-capture` |
|
|
677
|
+
| **getReady** | Get ready | `face-liveness`, `face-capture` |
|
|
678
|
+
|
|
487
679
|
## Examples
|
|
488
680
|
|
|
489
|
-
You can
|
|
681
|
+
You can find examples of using the components on the <a href="https://github.com/regulaforensics/face-web-components-samples" target="_blank">Samples page</a>.
|
|
682
|
+
|
|
683
|
+
## Additional resources
|
|
684
|
+
|
|
685
|
+
The Face SDK web components are also available on <a href="https://storybook-face.regulaforensics.com/" target="_blank">Storybook</a>.
|