@regulaforensics/vp-frontend-face-components 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/README.md +317 -29
  2. package/dist/main.js +1 -1
  3. package/dist/main.js.LICENSE.txt +41 -0
  4. package/lib/common/BackCameraIcon.d.ts +6 -0
  5. package/lib/common/Button.d.ts +7 -0
  6. package/lib/common/CameraChangeIcon.d.ts +6 -0
  7. package/lib/common/CameraIcon.d.ts +6 -0
  8. package/lib/common/CheckIcon.d.ts +6 -0
  9. package/lib/common/CrossIcon.d.ts +6 -0
  10. package/lib/common/DocReaderCameraDisabled.d.ts +5 -0
  11. package/lib/common/DocReaderCameraPreparing.d.ts +5 -0
  12. package/lib/common/DocReaderFlip.d.ts +5 -0
  13. package/lib/common/DocReaderProcessing.d.ts +5 -0
  14. package/lib/common/DocReaderProcessingError.d.ts +5 -0
  15. package/lib/common/DocReaderProcessingFinished.d.ts +6 -0
  16. package/lib/common/DocReaderSearch.d.ts +5 -0
  17. package/lib/common/ErrorIcon.d.ts +6 -0
  18. package/lib/common/FromCameraIcon.d.ts +5 -0
  19. package/lib/common/FromGalleryIcon.d.ts +5 -0
  20. package/lib/common/FrontCameraIcon.d.ts +6 -0
  21. package/lib/common/FullscreenExitIcon.d.ts +6 -0
  22. package/lib/common/FullscreenIcon.d.ts +6 -0
  23. package/lib/common/Icon.d.ts +64 -0
  24. package/lib/common/Message.d.ts +8 -0
  25. package/lib/common/NoGlareIconLivenessDetection.d.ts +5 -0
  26. package/lib/common/NoSmilingIconLivenessDetection.d.ts +5 -0
  27. package/lib/common/PortraitOrientationOnlyIcon.d.ts +6 -0
  28. package/lib/common/RegulaLogo.d.ts +6 -0
  29. package/lib/common/RegulaLogoLivenessDetection.d.ts +5 -0
  30. package/lib/common/SnapshotIcon.d.ts +6 -0
  31. package/lib/common/Spinner.d.ts +3 -0
  32. package/lib/common/SquareIcon.d.ts +6 -0
  33. package/lib/common/StopIcon.d.ts +6 -0
  34. package/lib/common/VerifiedIcon.d.ts +6 -0
  35. package/lib/components/ButtonFaceLiveness.d.ts +7 -0
  36. package/lib/components/CameraCapture.d.ts +9 -0
  37. package/lib/components/CameraSnapshot.d.ts +2 -0
  38. package/lib/components/CameraSnapshotFileCapture.d.ts +10 -0
  39. package/lib/components/DocumentCapture.d.ts +11 -0
  40. package/lib/components/DocumentContainer.d.ts +11 -0
  41. package/lib/components/DocumentReader.d.ts +2 -0
  42. package/lib/components/DocumentReaderFileCapture.d.ts +12 -0
  43. package/lib/components/DocumentReaderLayout.d.ts +22 -0
  44. package/lib/components/DocumentReaderStartScreen.d.ts +10 -0
  45. package/lib/components/ErrorBoundary.d.ts +18 -0
  46. package/lib/components/FaceCapture.d.ts +25 -0
  47. package/lib/components/FaceDetection.d.ts +2 -0
  48. package/lib/components/FaceFullScreenOverlay.d.ts +10 -0
  49. package/lib/components/FaceHintAnimaition.d.ts +16 -0
  50. package/lib/components/FaceLayout.d.ts +23 -0
  51. package/lib/components/FaceLiveness.d.ts +2 -0
  52. package/lib/components/InfoScreen.d.ts +11 -0
  53. package/lib/components/InfoScreenFaceLiveness.d.ts +12 -0
  54. package/lib/components/InstructionVideoScreen.d.ts +9 -0
  55. package/lib/components/ProcessScreen.d.ts +6 -0
  56. package/lib/components/ProcessScreenFaceLiveness.d.ts +6 -0
  57. package/lib/components/RetryScreenFaceLiveness.d.ts +7 -0
  58. package/lib/components/SectorAnimationSvg.d.ts +11 -0
  59. package/lib/components/WebCamera.d.ts +19 -0
  60. package/lib/constants.d.ts +686 -0
  61. package/lib/contexts/DocumentAttributesContext.d.ts +25 -0
  62. package/lib/contexts/DocumentSDKContext.d.ts +8 -0
  63. package/lib/contexts/FaceAttributesContext.d.ts +25 -0
  64. package/lib/hoc/withDocumentAttributesContext.d.ts +4 -0
  65. package/lib/hoc/withDocumentSDKContext.d.ts +3 -0
  66. package/lib/hoc/withFaceAttributesContext.d.ts +4 -0
  67. package/lib/hoc/withLocalize.d.ts +8 -0
  68. package/lib/hooks/useDocumentReaderSeries.d.ts +20 -0
  69. package/lib/hooks/useDocumentReaderSingle.d.ts +15 -0
  70. package/lib/hooks/useFaceLiveness.d.ts +41 -0
  71. package/lib/hooks/useImageInputParam.d.ts +7 -0
  72. package/lib/hooks/useOrientationChange.d.ts +10 -0
  73. package/lib/hooks/useStateCallback.d.ts +1 -0
  74. package/lib/hooks/useStream.d.ts +10 -0
  75. package/lib/hooks/useUserAgent.d.ts +3 -0
  76. package/lib/hooks/useWindowBlur.d.ts +2 -0
  77. package/lib/i18n/dictionaries/_dictionaries.d.ts +2275 -0
  78. package/lib/index-document.d.ts +4 -0
  79. package/lib/index-face.d.ts +1 -0
  80. package/lib/media-resources/resourcesBase64.d.ts +7 -0
  81. package/lib/models/CameraModel.d.ts +9 -0
  82. package/lib/models/CustomError.d.ts +7 -0
  83. package/lib/models/DocReaderWebclient/ext/authenticity/authenticity.d.ts +32 -0
  84. package/lib/models/DocReaderWebclient/ext/authenticity/fiber.d.ts +7 -0
  85. package/lib/models/DocReaderWebclient/ext/authenticity/ident.d.ts +8 -0
  86. package/lib/models/DocReaderWebclient/ext/authenticity/image-ident.d.ts +7 -0
  87. package/lib/models/DocReaderWebclient/ext/authenticity/index.d.ts +5 -0
  88. package/lib/models/DocReaderWebclient/ext/authenticity/ocr-security-text.d.ts +7 -0
  89. package/lib/models/DocReaderWebclient/ext/authenticity/security-feature.d.ts +8 -0
  90. package/lib/models/DocReaderWebclient/ext/images.d.ts +16 -0
  91. package/lib/models/DocReaderWebclient/ext/index.d.ts +6 -0
  92. package/lib/models/DocReaderWebclient/ext/process-request-image.d.ts +5 -0
  93. package/lib/models/DocReaderWebclient/ext/process-request.d.ts +38 -0
  94. package/lib/models/DocReaderWebclient/ext/process-response.d.ts +36 -0
  95. package/lib/models/DocReaderWebclient/ext/text-field.d.ts +40 -0
  96. package/lib/models/DocReaderWebclient/ext/text.d.ts +14 -0
  97. package/lib/models/DocReaderWebclient/models/area-array.d.ts +32 -0
  98. package/lib/models/DocReaderWebclient/models/area-container.d.ts +38 -0
  99. package/lib/models/DocReaderWebclient/models/authenticity-check-list.d.ts +31 -0
  100. package/lib/models/DocReaderWebclient/models/authenticity-check-result-item.d.ts +38 -0
  101. package/lib/models/DocReaderWebclient/models/authenticity-check-result.d.ts +43 -0
  102. package/lib/models/DocReaderWebclient/models/authenticity-result-all-of.d.ts +25 -0
  103. package/lib/models/DocReaderWebclient/models/authenticity-result-type.d.ts +33 -0
  104. package/lib/models/DocReaderWebclient/models/authenticity-result.d.ts +18 -0
  105. package/lib/models/DocReaderWebclient/models/bc-pdf417-info.d.ts +54 -0
  106. package/lib/models/DocReaderWebclient/models/bc-roidetect.d.ts +42 -0
  107. package/lib/models/DocReaderWebclient/models/check-diagnose.d.ts +98 -0
  108. package/lib/models/DocReaderWebclient/models/check-result.d.ts +30 -0
  109. package/lib/models/DocReaderWebclient/models/chosen-document-type-result-all-of.d.ts +25 -0
  110. package/lib/models/DocReaderWebclient/models/chosen-document-type-result.d.ts +19 -0
  111. package/lib/models/DocReaderWebclient/models/chosen-document-type.d.ts +74 -0
  112. package/lib/models/DocReaderWebclient/models/container-list.d.ts +45 -0
  113. package/lib/models/DocReaderWebclient/models/critical.d.ts +26 -0
  114. package/lib/models/DocReaderWebclient/models/cross-source-value-comparison.d.ts +38 -0
  115. package/lib/models/DocReaderWebclient/models/data-module.d.ts +48 -0
  116. package/lib/models/DocReaderWebclient/models/details-optical.d.ts +67 -0
  117. package/lib/models/DocReaderWebclient/models/details-rfid.d.ts +61 -0
  118. package/lib/models/DocReaderWebclient/models/device-info.d.ts +54 -0
  119. package/lib/models/DocReaderWebclient/models/doc-bar-code-info-all-of.d.ts +31 -0
  120. package/lib/models/DocReaderWebclient/models/doc-bar-code-info.d.ts +19 -0
  121. package/lib/models/DocReaderWebclient/models/doc-visual-extended-field.d.ts +70 -0
  122. package/lib/models/DocReaderWebclient/models/doc-visual-extended-info.d.ts +25 -0
  123. package/lib/models/DocReaderWebclient/models/document-format.d.ts +70 -0
  124. package/lib/models/DocReaderWebclient/models/document-image-result-all-of.d.ts +25 -0
  125. package/lib/models/DocReaderWebclient/models/document-image-result.d.ts +18 -0
  126. package/lib/models/DocReaderWebclient/models/document-image.d.ts +24 -0
  127. package/lib/models/DocReaderWebclient/models/document-position-result-all-of.d.ts +25 -0
  128. package/lib/models/DocReaderWebclient/models/document-position-result.d.ts +19 -0
  129. package/lib/models/DocReaderWebclient/models/document-position.d.ts +80 -0
  130. package/lib/models/DocReaderWebclient/models/document-type-recognition-result.d.ts +30 -0
  131. package/lib/models/DocReaderWebclient/models/document-type.d.ts +246 -0
  132. package/lib/models/DocReaderWebclient/models/document-types-candidates-list.d.ts +32 -0
  133. package/lib/models/DocReaderWebclient/models/document-types-candidates-result-all-of.d.ts +25 -0
  134. package/lib/models/DocReaderWebclient/models/document-types-candidates-result.d.ts +18 -0
  135. package/lib/models/DocReaderWebclient/models/document-types-candidates.d.ts +32 -0
  136. package/lib/models/DocReaderWebclient/models/encrypted-rclresult-all-of.d.ts +24 -0
  137. package/lib/models/DocReaderWebclient/models/encrypted-rclresult.d.ts +18 -0
  138. package/lib/models/DocReaderWebclient/models/fdsidlist.d.ts +80 -0
  139. package/lib/models/DocReaderWebclient/models/fiber-result-all-of.d.ts +74 -0
  140. package/lib/models/DocReaderWebclient/models/fiber-result.d.ts +18 -0
  141. package/lib/models/DocReaderWebclient/models/graphic-field-type.d.ts +118 -0
  142. package/lib/models/DocReaderWebclient/models/graphic-field.d.ts +63 -0
  143. package/lib/models/DocReaderWebclient/models/graphic-fields-list.d.ts +25 -0
  144. package/lib/models/DocReaderWebclient/models/graphics-result-all-of.d.ts +25 -0
  145. package/lib/models/DocReaderWebclient/models/graphics-result.d.ts +19 -0
  146. package/lib/models/DocReaderWebclient/models/ident-result-all-of.d.ts +65 -0
  147. package/lib/models/DocReaderWebclient/models/ident-result.d.ts +18 -0
  148. package/lib/models/DocReaderWebclient/models/image-data.d.ts +24 -0
  149. package/lib/models/DocReaderWebclient/models/image-qa.d.ts +54 -0
  150. package/lib/models/DocReaderWebclient/models/image-quality-check-list.d.ts +32 -0
  151. package/lib/models/DocReaderWebclient/models/image-quality-check-type.d.ts +50 -0
  152. package/lib/models/DocReaderWebclient/models/image-quality-check.d.ts +64 -0
  153. package/lib/models/DocReaderWebclient/models/image-quality-result-all-of.d.ts +25 -0
  154. package/lib/models/DocReaderWebclient/models/image-quality-result.d.ts +18 -0
  155. package/lib/models/DocReaderWebclient/models/images-available-source.d.ts +31 -0
  156. package/lib/models/DocReaderWebclient/models/images-field-value.d.ts +70 -0
  157. package/lib/models/DocReaderWebclient/models/images-field.d.ts +38 -0
  158. package/lib/models/DocReaderWebclient/models/images-result-all-of.d.ts +25 -0
  159. package/lib/models/DocReaderWebclient/models/images-result.d.ts +18 -0
  160. package/lib/models/DocReaderWebclient/models/images.d.ts +32 -0
  161. package/lib/models/DocReaderWebclient/models/index.d.ts +123 -0
  162. package/lib/models/DocReaderWebclient/models/lcid.d.ts +582 -0
  163. package/lib/models/DocReaderWebclient/models/lexical-analysis-result-all-of.d.ts +25 -0
  164. package/lib/models/DocReaderWebclient/models/lexical-analysis-result.d.ts +19 -0
  165. package/lib/models/DocReaderWebclient/models/license-result-all-of.d.ts +24 -0
  166. package/lib/models/DocReaderWebclient/models/license-result.d.ts +18 -0
  167. package/lib/models/DocReaderWebclient/models/light.d.ts +34 -0
  168. package/lib/models/DocReaderWebclient/models/list-verified-fields.d.ts +25 -0
  169. package/lib/models/DocReaderWebclient/models/log-level.d.ts +23 -0
  170. package/lib/models/DocReaderWebclient/models/measure-system.d.ts +26 -0
  171. package/lib/models/DocReaderWebclient/models/mrzformat.d.ts +24 -0
  172. package/lib/models/DocReaderWebclient/models/ocrsecurity-text-result-all-of.d.ts +81 -0
  173. package/lib/models/DocReaderWebclient/models/ocrsecurity-text-result.d.ts +18 -0
  174. package/lib/models/DocReaderWebclient/models/one-candidate.d.ts +74 -0
  175. package/lib/models/DocReaderWebclient/models/original-symbol.d.ts +37 -0
  176. package/lib/models/DocReaderWebclient/models/parray-field.d.ts +81 -0
  177. package/lib/models/DocReaderWebclient/models/per-document-config.d.ts +30 -0
  178. package/lib/models/DocReaderWebclient/models/photo-ident-result-all-of.d.ts +76 -0
  179. package/lib/models/DocReaderWebclient/models/photo-ident-result.d.ts +18 -0
  180. package/lib/models/DocReaderWebclient/models/point-array.d.ts +25 -0
  181. package/lib/models/DocReaderWebclient/models/point.d.ts +30 -0
  182. package/lib/models/DocReaderWebclient/models/points-container.d.ts +31 -0
  183. package/lib/models/DocReaderWebclient/models/process-params.d.ts +254 -0
  184. package/lib/models/DocReaderWebclient/models/process-request-image.d.ts +38 -0
  185. package/lib/models/DocReaderWebclient/models/process-request.d.ts +60 -0
  186. package/lib/models/DocReaderWebclient/models/process-response.d.ts +66 -0
  187. package/lib/models/DocReaderWebclient/models/process-system-info.d.ts +30 -0
  188. package/lib/models/DocReaderWebclient/models/processing-status.d.ts +30 -0
  189. package/lib/models/DocReaderWebclient/models/raw-image-container-list.d.ts +31 -0
  190. package/lib/models/DocReaderWebclient/models/rectangle-coordinates.d.ts +42 -0
  191. package/lib/models/DocReaderWebclient/models/result-item.d.ts +48 -0
  192. package/lib/models/DocReaderWebclient/models/result.d.ts +98 -0
  193. package/lib/models/DocReaderWebclient/models/rfid-location.d.ts +30 -0
  194. package/lib/models/DocReaderWebclient/models/rfid-origin.d.ts +42 -0
  195. package/lib/models/DocReaderWebclient/models/scenario.d.ts +36 -0
  196. package/lib/models/DocReaderWebclient/models/security-feature-result-all-of.d.ts +59 -0
  197. package/lib/models/DocReaderWebclient/models/security-feature-result.d.ts +18 -0
  198. package/lib/models/DocReaderWebclient/models/security-feature-type.d.ts +49 -0
  199. package/lib/models/DocReaderWebclient/models/source-validity.d.ts +32 -0
  200. package/lib/models/DocReaderWebclient/models/source.d.ts +23 -0
  201. package/lib/models/DocReaderWebclient/models/status-result-all-of.d.ts +25 -0
  202. package/lib/models/DocReaderWebclient/models/status-result.d.ts +18 -0
  203. package/lib/models/DocReaderWebclient/models/status.d.ts +63 -0
  204. package/lib/models/DocReaderWebclient/models/string-recognition-result.d.ts +25 -0
  205. package/lib/models/DocReaderWebclient/models/symbol-candidate.d.ts +30 -0
  206. package/lib/models/DocReaderWebclient/models/symbol-recognition-result.d.ts +32 -0
  207. package/lib/models/DocReaderWebclient/models/text-available-source.d.ts +38 -0
  208. package/lib/models/DocReaderWebclient/models/text-data-result-all-of.d.ts +25 -0
  209. package/lib/models/DocReaderWebclient/models/text-data-result.d.ts +19 -0
  210. package/lib/models/DocReaderWebclient/models/text-field-type.d.ts +2386 -0
  211. package/lib/models/DocReaderWebclient/models/text-field-value.d.ts +70 -0
  212. package/lib/models/DocReaderWebclient/models/text-field.d.ts +84 -0
  213. package/lib/models/DocReaderWebclient/models/text-post-processing.d.ts +22 -0
  214. package/lib/models/DocReaderWebclient/models/text-result-all-of.d.ts +25 -0
  215. package/lib/models/DocReaderWebclient/models/text-result.d.ts +18 -0
  216. package/lib/models/DocReaderWebclient/models/text.d.ts +51 -0
  217. package/lib/models/DocReaderWebclient/models/transaction-info.d.ts +42 -0
  218. package/lib/models/DocReaderWebclient/models/verification-result.d.ts +38 -0
  219. package/lib/models/DocReaderWebclient/models/verified-field-map.d.ts +63 -0
  220. package/lib/models/DocReaderWebclient/models/visibility.d.ts +23 -0
  221. package/lib/models/ImageModel.d.ts +7 -0
  222. package/lib/services/DebugService.d.ts +17 -0
  223. package/lib/services/DocumentReaderProcessor.d.ts +50 -0
  224. package/lib/services/DocumentReaderService.d.ts +57 -0
  225. package/lib/services/EventEmitter.d.ts +9 -0
  226. package/lib/services/FaceLivenessService.d.ts +62 -0
  227. package/lib/services/FaceService.d.ts +39 -0
  228. package/lib/services/StreamRecorderService.d.ts +24 -0
  229. package/lib/types.d.ts +361 -0
  230. package/lib/utils.d.ts +30 -0
  231. package/lib/web-components/CameraSnapshot.d.ts +14 -0
  232. package/lib/web-components/DocumentReader.d.ts +14 -0
  233. package/lib/web-components/FaceDetection.d.ts +11 -0
  234. package/lib/web-components/FaceLiveness.d.ts +17 -0
  235. package/lib/web-components/FullScreenContainer.d.ts +4 -0
  236. package/package.json +64 -72
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  1. [Install via NPM](#install-via-npm)
5
5
  1. [Install via CDN](#install-via-cdn)
6
6
  1. [Component settings](#component-settings)
7
- 1. [Component events](#component-events)
7
+ 1. [Components events](#components-events)
8
8
  1. [Component response](#component-response)
9
9
  1. [Component attributes](#component-attributes)
10
10
  1. [Component customization](#component-customization)
@@ -20,8 +20,8 @@ This package contains web components for face recognition.
20
20
 
21
21
  | Devices | ![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome_48x48.png) | ![FireFox](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_48x48.png) | ![Safari](https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari_48x48.png) |
22
22
  |:---------------------|:-------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------:|
23
- | **Mobile (iOS)** | 87 (iOS14.4+) | 30 (iOS14.4+) | 11 |
24
- | **Mobile (Android)** | 96 | 94 | - |
23
+ | **Mobile (iOS)** | 99 (iOS14.4+) | 99 (iOS14.4+) | 11 |
24
+ | **Mobile (Android)** | 66 | 62 | - |
25
25
  | **Desktop** | 66 | 63 | 11 |
26
26
 
27
27
  ## Install via NPM
@@ -90,6 +90,16 @@ Add the name of the component to the html, as in the example above.
90
90
 
91
91
  ### face-liveness
92
92
 
93
+ The server generates a unique identifier for each session before starting a verification process. Using ```sessionId``` setter you can set custom value. Make sure that the ```sessionId``` is unique for each session
94
+
95
+ Example:
96
+
97
+ ```javascript
98
+ const component = document.getElementsByTagName('face-liveness')[0];
99
+
100
+ component.sessionId = "ID"
101
+ ```
102
+
93
103
  After passing two stages of verification, the component sends the received data for processing to the API. Using ```headers``` setter you can set HTTP POST method headers.
94
104
 
95
105
  Example:
@@ -102,21 +112,280 @@ component.headers = {
102
112
  }
103
113
  ```
104
114
 
105
- ## Component events
115
+ ## Components events
116
+
117
+ You can subscribe to the component events.
118
+
119
+ For example:
120
+
121
+ ```javascript
122
+ const faceLivenessComponent = document.getElementsByTagName('face-liveness')[0];
123
+ const faceCaptureComponent = document.getElementsByTagName('face-capture')[0];
124
+
125
+ faceLivenessComponent.addEventListener('face-liveness', (event) => console.log(event.detail)); // event listener for face-liveness component
126
+ faceCaptureComponent.addEventListener('face-capture', (event) => console.log(event.detail)); // event listener for face-capture component
127
+ ```
128
+
129
+ 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
+
131
+ The generated event object (```event.detail```) contains three fields that describe the event:
132
+
133
+ ```javascript
134
+ {
135
+ action: "PRESS_START_BUTTON", // the type of action that generated the event (all actions are described in the table below)
136
+ data: null, // component data
137
+ manual: true // event generated by user action or component by itself
138
+ }
139
+ ```
140
+
141
+ Type of actions:
142
+
143
+ | Type of action | Description of the action | In which component is present |
144
+ |:--------------------------|:------------------------------------:|:---------------------------------------:|
145
+ | ```ELEMENT_VISIBLE``` | Component is appended in the DOM. | ```face-liveness```, ```face-capture``` |
146
+ | ```PRESS_START_BUTTON``` | The "Get started" button is pressed. | ```face-liveness```, ```face-capture``` |
147
+ | ```PRESS_RETRY_BUTTON``` | The "Retry" button is pressed. | ```face-liveness```, ```face-capture``` |
148
+ | ```CLOSE``` | The "Close" button is pressed. | ```face-liveness```, ```face-capture``` |
149
+ | ```PROCESS_FINISHED``` | The component has finished its work. | ```face-liveness```, ```face-capture``` |
150
+ | ```SERVICE_INITIALIZED``` | The component has started its work. | ```face-liveness```, ```face-capture``` |
151
+
152
+ In cases of successful operation of the components, the ```data``` field will contain the following fields:
153
+
154
+ ```javascript
155
+ {
156
+ response: { ... }, // component result
157
+ status: 1 // 1 for successful work and 0 for unsuccessful
158
+ }
159
+ ```
160
+
161
+ In cases of unsuccessful work, the ```data``` field will contain the following fields:
162
+
163
+ ```javascript
164
+ {
165
+ reason: "CAMERA_PERMISSION_DENIED", // error reason (possible causes of errors are described in the table below)
166
+ status: 0
167
+ }
168
+ ```
106
169
 
107
- You can subscribe to component events. In cases of successful and unsuccessful work, the following events will be triggered:
170
+ Table of error causes:
171
+
172
+ | Reason | Description of the reason |
173
+ |:--------------------------------|:--------------------------------------------:|
174
+ | ```WASM_ERROR``` | Error in WASM. |
175
+ | ```WASM_LICENSE``` | Missing or incorrect license. |
176
+ | ```UNKNOWN_ERROR``` | Unknown error. |
177
+ | ```NOT_SUPPORTED``` | The browser is not supported. |
178
+ | ```CAMERA_UNKNOWN_ERROR``` | Unknown camera error. |
179
+ | ```CAMERA_PERMISSION_DENIED``` | Access to the camera is prohibited. |
180
+ | ```NO_CAMERA``` | There is no camera. |
181
+ | ```CONNECTION_ERROR``` | Connection errors. |
182
+ | ```LANDSCAPE_MODE_RESTRICTED``` | Work in landscape orientation is prohibited. |
183
+
184
+ The table below describes the cases of event generation:
185
+
186
+ ### face-liveness & face-capture
187
+
188
+ <table>
189
+ <thead>
190
+ <tr>
191
+ <th>Event condition </th>
192
+ <th>Event type</th>
193
+ <th>
194
+
195
+ Event object ```event.detail```
196
+ </th>
197
+ <th>Description</th>
198
+ </tr>
199
+ </thead>
200
+ <tbody>
201
+ <tr>
202
+ <td>The component is mounted in the DOM.</td>
203
+ <td>
204
+
205
+ For face-liveness:
206
+ ```face-liveness```
207
+
208
+ For face-capture:
209
+ ```face-capture```
210
+
211
+ </td>
212
+ <td>
108
213
 
109
- For the ```face-capture``` component - ```face-capture```
110
- For the ```face-liveness``` component - ```face-liveness```
214
+ ```javascript
215
+ {
216
+ action: "ELEMENT_VISIBLE",
217
+ data: null,
218
+ manual: true
219
+ }
220
+ ```
221
+
222
+ </td>
223
+ <td>
224
+
225
+ 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.
111
226
 
112
227
  Example:
228
+ ```html
229
+ <div id="add-event-listener-to-this-element">
230
+ <face-liveness></face-liveness>
231
+ </div>
232
+ ```
233
+
234
+ </td>
235
+ </tr>
236
+ <tr>
237
+ <td>The "Get started" button is pressed.</td>
238
+ <td>
239
+
240
+ For face-liveness:
241
+ ```face-liveness```
242
+
243
+ For face-capture:
244
+ ```face-capture```
245
+
246
+ </td>
247
+ <td>
113
248
 
114
249
  ```javascript
115
- const component = document.getElementsByTagName('face-capture')[0];
250
+ {
251
+ action: "PRESS_START_BUTTON",
252
+ data: null,
253
+ manual: true
254
+ }
255
+ ```
116
256
 
117
- component.addEventListener('face-capture', () => alert('Event!'));
257
+ </td>
258
+ <td></td>
259
+ </tr>
260
+ <tr>
261
+ <td>The "Retry" button is pressed.</td>
262
+ <td>
263
+
264
+ For face-liveness:
265
+ ```face-liveness```
266
+
267
+ For face-capture:
268
+ ```face-capture```
269
+
270
+ </td>
271
+ <td>
272
+
273
+ ```javascript
274
+ {
275
+ action: "PRESS_RETRY_BUTTON",
276
+ data: null,
277
+ manual: true
278
+ }
118
279
  ```
119
280
 
281
+ </td>
282
+ <td></td>
283
+ </tr>
284
+ <tr>
285
+ <td>The "Close" button is pressed.</td>
286
+ <td>
287
+
288
+ For face-liveness:
289
+ ```face-liveness```
290
+
291
+ For face-capture:
292
+ ```face-capture```
293
+
294
+ </td>
295
+ <td>
296
+
297
+ ```javascript
298
+ {
299
+ action: "CLOSE",
300
+ data: null,
301
+ manual: true
302
+ }
303
+ ```
304
+
305
+ </td>
306
+ <td></td>
307
+ </tr>
308
+ <tr>
309
+ <td>The work of the component is completed successfully.</td>
310
+ <td>
311
+
312
+ For face-liveness:
313
+ ```face-liveness```
314
+
315
+ For face-capture:
316
+ ```face-capture```
317
+
318
+ </td>
319
+ <td>
320
+
321
+ ```javascript
322
+ {
323
+ action: "PROCESS_FINISHED",
324
+ data: {
325
+ response: { ... },
326
+ status: 1
327
+ },
328
+ manual: false
329
+ }
330
+ ```
331
+
332
+ </td>
333
+ <td></td>
334
+ </tr>
335
+ <tr>
336
+ <td>The work of the component failed.</td>
337
+ <td>
338
+
339
+ For face-liveness:
340
+ ```face-liveness```
341
+
342
+ For face-capture:
343
+ ```face-capture```
344
+
345
+ </td>
346
+ <td>
347
+
348
+ ```javascript
349
+ {
350
+ action: "PROCESS_FINISHED",
351
+ data: {
352
+ reason: "An error has occurred",
353
+ status: 0
354
+ },
355
+ manual: false
356
+ }
357
+ ```
358
+
359
+ </td>
360
+ <td></td>
361
+ </tr>
362
+ <tr>
363
+ <td>Component is initialized and ready to work.</td>
364
+ <td>
365
+
366
+ For face-liveness:
367
+ ```face-liveness```
368
+
369
+ For face-capture:
370
+ ```face-capture```
371
+
372
+ </td>
373
+ <td>
374
+
375
+ ```javascript
376
+ {
377
+ action: "SERVICE_INITIALIZED",
378
+ data: null,
379
+ manual: false
380
+ }
381
+ ```
382
+
383
+ </td>
384
+ <td></td>
385
+ </tr>
386
+ </tbody>
387
+ </table>
388
+
120
389
  ## Component response
121
390
 
122
391
  You can get the response of the component in the ```detail``` field of the event object.
@@ -127,8 +396,8 @@ Example:
127
396
  const component = document.getElementsByTagName('face-capture')[0];
128
397
 
129
398
  function listener(event) {
130
- if (event.detail) {
131
- const response = event.detail;
399
+ if (event.detail.action === 'PROCESS_FINISHED' && event.detail.data.status === 1) {
400
+ const response = event.detail.data.response;
132
401
  console.log(response);
133
402
  }
134
403
  }
@@ -136,35 +405,54 @@ function listener(event) {
136
405
  component.addEventListener('face-capture', listener);
137
406
  ```
138
407
 
408
+ Please find ```face-liveness``` response structure in [OpenAPI documentation](https://dev.regulaforensics.com/FaceSDK-web-openapi/#tag/liveness-2.0/operation/get_liveness_transaction).
409
+
410
+
411
+ The ```face-capture``` response has the following structure
412
+
413
+ ```javascript
414
+ {
415
+ capture: string[] // array with the final image in base64
416
+ }
417
+ ````
418
+
139
419
  ## Component attributes
140
420
 
141
421
  ### face-capture
142
422
 
143
- | Attribute | Info | Default value | Values |
144
- |:-----------|:------------------------------|:-------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
145
- | **locale** | the language of the component | ```en``` | ```ru```, ```en```, ```de```, ```pl```, ```it```, ```hu```, ```ch```, ```sk```, ```uk```, ```fr```, ```es```, ```pt```, ```ar```, ```nl```, ```id```, ```vi```, ```ko```, ```ms```, ```ro```, ```gr```, ```tr```, ```jp```, ```cz```, ```th```, ```hi```, ```bn```, ```he```, ```fi```, ```sv```, ```da```, ```hr```, ```no``` |
423
+ | Attribute | Info | Data type | Default value | Values |
424
+ |:-----------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------:|:---------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
425
+ | **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``` |
426
+ | **copyright** | Show Regula copyright footer. | boolean | ```false``` | ```true```, ```false``` |
427
+ | **camera-id** | Ability to select a camera. | string | ```undefined``` | ```camera id string value``` |
428
+ | **change-camera** | Show the camera switch button. | boolean | ```true``` | ```true```, ```false``` |
429
+ | **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``` |
146
430
 
147
431
  ### face-liveness
148
432
 
149
- | Attribute | Info | Default value | Values |
150
- |:-----------|:------------------------------|:------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
151
- | **locale** | the language of the component | ```en``` | ```ru```, ```en```, ```de```, ```pl```, ```it```, ```hu```, ```ch```, ```sk```, ```uk```, ```fr```, ```es```, ```pt```, ```ar```, ```nl```, ```id```, ```vi```, ```ko```, ```ms```, ```ro```, ```gr```, ```tr```, ```jp```, ```cz```, ```th```, ```hi```, ```bn```, ```he```, ```fi```, ```sv```, ```da```, ```hr```, ```no``` |
152
- | **url** | backend url | ```https://faceapi.regulaforensics.com/``` | any url |
433
+ | Attribute | Info | Data type | Default value | Values |
434
+ |:-----------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------:|:------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
435
+ | **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``` |
436
+ | **url** | Backend url. | string | ```https://faceapi.regulaforensics.com/``` | any url |
437
+ | **copyright** | Show Regula copyright footer. | boolean | ```false``` | ```true```, ```false``` |
438
+ | **camera-id** | Ability to select a camera. | string | ```undefined``` | ```camera id string value``` |
439
+ | **change-camera** | Show the camera switch button. | boolean | ```true``` | ```true```, ```false``` |
440
+ | **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``` |
153
441
 
154
442
  ## Component customization
155
443
 
156
444
  Using CSS variables, you can change the font and the main colors of the components.
157
445
 
158
- | Variable | Info | Default value |
159
- |:-------------------|:---------------------------------------------------------------------------------------|:---------------------------:|
160
- | **--font-family** | component font | ```Noto Sans, sans-serif``` |
161
- | **--font-size** | component base font size | ```16px``` |
162
- | **--main-color** | button and frame color | ```#663399``` |
163
- | **--second-color** | instruction image background color | ```#EBE1F6``` |
164
- | **--third-color** | instruction image portrait background color (available only in face-capture component) | ```#C5B9D2``` |
165
- | **--hover-color** | button hover color | ```#7c45b4``` |
166
- | **--active-color** | button active color | ```#663399``` |
167
- | **--plate-color** | information plate color | ```rgba(0, 0, 0, 0.6)``` |
446
+ | Variable | Info | Default value |
447
+ |:-----------------------------|:----------------------------------------------------------------------------------------|:---------------------------:|
448
+ | **--font-family** | Сomponent font. | ```Noto Sans, sans-serif``` |
449
+ | **--font-size** | Сomponent base font size. | ```16px``` |
450
+ | **--main-color** | Button and frame color. | ```#7E57C5``` |
451
+ | **--hover-color** | Button hover color. | ```#7c45b4``` |
452
+ | **--active-color** | Button active color. | ```#7E57C5``` |
453
+ | **--plate-color** | Information plate color. | ```#E8E8E8``` |
454
+ | **--target-sector-color** | Target sector color (available only in face-liveness component). | ```#BEABE2``` |
455
+ | **--direction-sector-color** | Direction sector color (available only in face-liveness component). | ```#EAEAEA``` |
168
456
 
169
457
  Example:
170
458
 
@@ -186,4 +474,4 @@ HTML:
186
474
 
187
475
  ## Examples
188
476
 
189
- You can see examples of using the components [here](https://github.com/regulaforensics/face-web-components-samples).
477
+ You can see the examples of using the components on the [Samples page](https://github.com/regulaforensics/face-web-components-samples).