@regulaforensics/vp-frontend-document-components 2.0.1 → 2.2.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 (190) hide show
  1. package/README.md +177 -34
  2. package/dist/main.js +1 -1
  3. package/esm/main.js +1 -1
  4. package/lib/common/Message.d.ts +2 -1
  5. package/lib/common/NoGlareIconLivenessDetection.d.ts +5 -0
  6. package/lib/common/NoSmilingIconLivenessDetection.d.ts +5 -0
  7. package/lib/common/PortraitOrientationOnlyIcon.d.ts +6 -0
  8. package/lib/common/RegulaLogoLivenessDetection.d.ts +5 -0
  9. package/lib/components/ButtonFaceLiveness.d.ts +7 -0
  10. package/lib/components/DocumentCapture.d.ts +1 -1
  11. package/lib/components/DocumentReaderFileCapture.d.ts +3 -3
  12. package/lib/components/DocumentReaderLayout.d.ts +4 -6
  13. package/lib/components/FaceCapture.d.ts +15 -6
  14. package/lib/components/FaceFullScreenOverlay.d.ts +2 -3
  15. package/lib/components/FaceHintAnimaition.d.ts +16 -0
  16. package/lib/components/FaceLayout.d.ts +10 -5
  17. package/lib/components/InfoScreenFaceLiveness.d.ts +11 -0
  18. package/lib/components/InstructionVideoScreen.d.ts +9 -0
  19. package/lib/components/ProcessScreenFaceLiveness.d.ts +6 -0
  20. package/lib/components/RetryScreenFaceLiveness.d.ts +7 -0
  21. package/lib/components/SectorAnimationSvg.d.ts +11 -0
  22. package/lib/constants.d.ts +126 -11
  23. package/lib/contexts/DocumentAttributesContext.d.ts +4 -2
  24. package/lib/contexts/DocumentSDKContext.d.ts +3 -1
  25. package/lib/contexts/FaceAttributesContext.d.ts +6 -3
  26. package/lib/hoc/withLocalize.d.ts +5 -4
  27. package/lib/hooks/useDocumentReaderSeries.d.ts +3 -6
  28. package/lib/hooks/useDocumentReaderSingle.d.ts +3 -3
  29. package/lib/hooks/useFaceLiveness.d.ts +13 -3
  30. package/lib/hooks/useStateCallback.d.ts +1 -0
  31. package/lib/i18n/dictionaries/_dictionaries.d.ts +2212 -2052
  32. package/lib/index-document.d.ts +3 -4
  33. package/lib/media-resources/resourcesBase64.d.ts +7 -0
  34. package/lib/models/DocReaderWebclient/ext/authenticity/authenticity.d.ts +32 -0
  35. package/lib/models/DocReaderWebclient/ext/authenticity/fiber.d.ts +7 -0
  36. package/lib/models/DocReaderWebclient/ext/authenticity/ident.d.ts +8 -0
  37. package/lib/models/DocReaderWebclient/ext/authenticity/image-ident.d.ts +7 -0
  38. package/lib/models/DocReaderWebclient/ext/authenticity/index.d.ts +5 -0
  39. package/lib/models/DocReaderWebclient/ext/authenticity/ocr-security-text.d.ts +7 -0
  40. package/lib/models/DocReaderWebclient/ext/authenticity/security-feature.d.ts +8 -0
  41. package/lib/models/DocReaderWebclient/ext/images.d.ts +16 -0
  42. package/lib/models/DocReaderWebclient/ext/index.d.ts +6 -0
  43. package/lib/models/DocReaderWebclient/ext/process-request-image.d.ts +5 -0
  44. package/lib/models/DocReaderWebclient/ext/process-request.d.ts +38 -0
  45. package/lib/models/DocReaderWebclient/ext/process-response.d.ts +36 -0
  46. package/lib/models/DocReaderWebclient/ext/text-field.d.ts +40 -0
  47. package/lib/models/DocReaderWebclient/ext/text.d.ts +14 -0
  48. package/lib/models/DocReaderWebclient/models/area-array.d.ts +32 -0
  49. package/lib/models/DocReaderWebclient/models/area-container.d.ts +38 -0
  50. package/lib/models/DocReaderWebclient/models/authenticity-check-list.d.ts +31 -0
  51. package/lib/models/DocReaderWebclient/models/authenticity-check-result-item.d.ts +38 -0
  52. package/lib/models/DocReaderWebclient/models/authenticity-check-result.d.ts +43 -0
  53. package/lib/models/DocReaderWebclient/models/authenticity-result-all-of.d.ts +25 -0
  54. package/lib/models/DocReaderWebclient/models/authenticity-result-type.d.ts +33 -0
  55. package/lib/models/DocReaderWebclient/models/authenticity-result.d.ts +18 -0
  56. package/lib/models/DocReaderWebclient/models/bc-pdf417-info.d.ts +54 -0
  57. package/lib/models/DocReaderWebclient/models/bc-roidetect.d.ts +42 -0
  58. package/lib/models/DocReaderWebclient/models/check-diagnose.d.ts +98 -0
  59. package/lib/models/DocReaderWebclient/models/check-result.d.ts +30 -0
  60. package/lib/models/DocReaderWebclient/models/chosen-document-type-result-all-of.d.ts +25 -0
  61. package/lib/models/DocReaderWebclient/models/chosen-document-type-result.d.ts +19 -0
  62. package/lib/models/DocReaderWebclient/models/chosen-document-type.d.ts +74 -0
  63. package/lib/models/DocReaderWebclient/models/container-list.d.ts +45 -0
  64. package/lib/models/DocReaderWebclient/models/critical.d.ts +26 -0
  65. package/lib/models/DocReaderWebclient/models/cross-source-value-comparison.d.ts +38 -0
  66. package/lib/models/DocReaderWebclient/models/data-module.d.ts +48 -0
  67. package/lib/models/DocReaderWebclient/models/details-optical.d.ts +67 -0
  68. package/lib/models/DocReaderWebclient/models/details-rfid.d.ts +61 -0
  69. package/lib/models/DocReaderWebclient/models/device-info.d.ts +54 -0
  70. package/lib/models/DocReaderWebclient/models/doc-bar-code-info-all-of.d.ts +31 -0
  71. package/lib/models/DocReaderWebclient/models/doc-bar-code-info.d.ts +19 -0
  72. package/lib/models/DocReaderWebclient/models/doc-visual-extended-field.d.ts +70 -0
  73. package/lib/models/DocReaderWebclient/models/doc-visual-extended-info.d.ts +25 -0
  74. package/lib/models/DocReaderWebclient/models/document-format.d.ts +70 -0
  75. package/lib/models/DocReaderWebclient/models/document-image-result-all-of.d.ts +25 -0
  76. package/lib/models/DocReaderWebclient/models/document-image-result.d.ts +18 -0
  77. package/lib/models/DocReaderWebclient/models/document-image.d.ts +24 -0
  78. package/lib/models/DocReaderWebclient/models/document-position-result-all-of.d.ts +25 -0
  79. package/lib/models/DocReaderWebclient/models/document-position-result.d.ts +19 -0
  80. package/lib/models/DocReaderWebclient/models/document-position.d.ts +80 -0
  81. package/lib/models/DocReaderWebclient/models/document-type-recognition-result.d.ts +30 -0
  82. package/lib/models/DocReaderWebclient/models/document-type.d.ts +246 -0
  83. package/lib/models/DocReaderWebclient/models/document-types-candidates-list.d.ts +32 -0
  84. package/lib/models/DocReaderWebclient/models/document-types-candidates-result-all-of.d.ts +25 -0
  85. package/lib/models/DocReaderWebclient/models/document-types-candidates-result.d.ts +18 -0
  86. package/lib/models/DocReaderWebclient/models/document-types-candidates.d.ts +32 -0
  87. package/lib/models/DocReaderWebclient/models/encrypted-rclresult-all-of.d.ts +24 -0
  88. package/lib/models/DocReaderWebclient/models/encrypted-rclresult.d.ts +18 -0
  89. package/lib/models/DocReaderWebclient/models/fdsidlist.d.ts +80 -0
  90. package/lib/models/DocReaderWebclient/models/fiber-result-all-of.d.ts +74 -0
  91. package/lib/models/DocReaderWebclient/models/fiber-result.d.ts +18 -0
  92. package/lib/models/DocReaderWebclient/models/graphic-field-type.d.ts +118 -0
  93. package/lib/models/DocReaderWebclient/models/graphic-field.d.ts +63 -0
  94. package/lib/models/DocReaderWebclient/models/graphic-fields-list.d.ts +25 -0
  95. package/lib/models/DocReaderWebclient/models/graphics-result-all-of.d.ts +25 -0
  96. package/lib/models/DocReaderWebclient/models/graphics-result.d.ts +19 -0
  97. package/lib/models/DocReaderWebclient/models/ident-result-all-of.d.ts +65 -0
  98. package/lib/models/DocReaderWebclient/models/ident-result.d.ts +18 -0
  99. package/lib/models/DocReaderWebclient/models/image-data.d.ts +24 -0
  100. package/lib/models/DocReaderWebclient/models/image-qa.d.ts +54 -0
  101. package/lib/models/DocReaderWebclient/models/image-quality-check-list.d.ts +32 -0
  102. package/lib/models/DocReaderWebclient/models/image-quality-check-type.d.ts +50 -0
  103. package/lib/models/DocReaderWebclient/models/image-quality-check.d.ts +64 -0
  104. package/lib/models/DocReaderWebclient/models/image-quality-result-all-of.d.ts +25 -0
  105. package/lib/models/DocReaderWebclient/models/image-quality-result.d.ts +18 -0
  106. package/lib/models/DocReaderWebclient/models/images-available-source.d.ts +31 -0
  107. package/lib/models/DocReaderWebclient/models/images-field-value.d.ts +70 -0
  108. package/lib/models/DocReaderWebclient/models/images-field.d.ts +38 -0
  109. package/lib/models/DocReaderWebclient/models/images-result-all-of.d.ts +25 -0
  110. package/lib/models/DocReaderWebclient/models/images-result.d.ts +18 -0
  111. package/lib/models/DocReaderWebclient/models/images.d.ts +32 -0
  112. package/lib/models/DocReaderWebclient/models/index.d.ts +123 -0
  113. package/lib/models/DocReaderWebclient/models/lcid.d.ts +582 -0
  114. package/lib/models/DocReaderWebclient/models/lexical-analysis-result-all-of.d.ts +25 -0
  115. package/lib/models/DocReaderWebclient/models/lexical-analysis-result.d.ts +19 -0
  116. package/lib/models/DocReaderWebclient/models/license-result-all-of.d.ts +24 -0
  117. package/lib/models/DocReaderWebclient/models/license-result.d.ts +18 -0
  118. package/lib/models/DocReaderWebclient/models/light.d.ts +34 -0
  119. package/lib/models/DocReaderWebclient/models/list-verified-fields.d.ts +25 -0
  120. package/lib/models/DocReaderWebclient/models/log-level.d.ts +23 -0
  121. package/lib/models/DocReaderWebclient/models/measure-system.d.ts +26 -0
  122. package/lib/models/DocReaderWebclient/models/mrzformat.d.ts +24 -0
  123. package/lib/models/DocReaderWebclient/models/ocrsecurity-text-result-all-of.d.ts +81 -0
  124. package/lib/models/DocReaderWebclient/models/ocrsecurity-text-result.d.ts +18 -0
  125. package/lib/models/DocReaderWebclient/models/one-candidate.d.ts +74 -0
  126. package/lib/models/DocReaderWebclient/models/original-symbol.d.ts +37 -0
  127. package/lib/models/DocReaderWebclient/models/parray-field.d.ts +81 -0
  128. package/lib/models/DocReaderWebclient/models/per-document-config.d.ts +30 -0
  129. package/lib/models/DocReaderWebclient/models/photo-ident-result-all-of.d.ts +76 -0
  130. package/lib/models/DocReaderWebclient/models/photo-ident-result.d.ts +18 -0
  131. package/lib/models/DocReaderWebclient/models/point-array.d.ts +25 -0
  132. package/lib/models/DocReaderWebclient/models/point.d.ts +30 -0
  133. package/lib/models/DocReaderWebclient/models/points-container.d.ts +31 -0
  134. package/lib/models/DocReaderWebclient/models/process-params.d.ts +254 -0
  135. package/lib/models/DocReaderWebclient/models/process-request-image.d.ts +38 -0
  136. package/lib/models/DocReaderWebclient/models/process-request.d.ts +60 -0
  137. package/lib/models/DocReaderWebclient/models/process-response.d.ts +66 -0
  138. package/lib/models/DocReaderWebclient/models/process-system-info.d.ts +30 -0
  139. package/lib/models/DocReaderWebclient/models/processing-status.d.ts +30 -0
  140. package/lib/models/DocReaderWebclient/models/raw-image-container-list.d.ts +31 -0
  141. package/lib/models/DocReaderWebclient/models/rectangle-coordinates.d.ts +42 -0
  142. package/lib/models/DocReaderWebclient/models/result-item.d.ts +48 -0
  143. package/lib/models/DocReaderWebclient/models/result.d.ts +98 -0
  144. package/lib/models/DocReaderWebclient/models/rfid-location.d.ts +30 -0
  145. package/lib/models/DocReaderWebclient/models/rfid-origin.d.ts +42 -0
  146. package/lib/models/DocReaderWebclient/models/scenario.d.ts +36 -0
  147. package/lib/models/DocReaderWebclient/models/security-feature-result-all-of.d.ts +59 -0
  148. package/lib/models/DocReaderWebclient/models/security-feature-result.d.ts +18 -0
  149. package/lib/models/DocReaderWebclient/models/security-feature-type.d.ts +49 -0
  150. package/lib/models/DocReaderWebclient/models/source-validity.d.ts +32 -0
  151. package/lib/models/DocReaderWebclient/models/source.d.ts +23 -0
  152. package/lib/models/DocReaderWebclient/models/status-result-all-of.d.ts +25 -0
  153. package/lib/models/DocReaderWebclient/models/status-result.d.ts +18 -0
  154. package/lib/models/DocReaderWebclient/models/status.d.ts +63 -0
  155. package/lib/models/DocReaderWebclient/models/string-recognition-result.d.ts +25 -0
  156. package/lib/models/DocReaderWebclient/models/symbol-candidate.d.ts +30 -0
  157. package/lib/models/DocReaderWebclient/models/symbol-recognition-result.d.ts +32 -0
  158. package/lib/models/DocReaderWebclient/models/text-available-source.d.ts +38 -0
  159. package/lib/models/DocReaderWebclient/models/text-data-result-all-of.d.ts +25 -0
  160. package/lib/models/DocReaderWebclient/models/text-data-result.d.ts +19 -0
  161. package/lib/models/DocReaderWebclient/models/text-field-type.d.ts +2386 -0
  162. package/lib/models/DocReaderWebclient/models/text-field-value.d.ts +70 -0
  163. package/lib/models/DocReaderWebclient/models/text-field.d.ts +84 -0
  164. package/lib/models/DocReaderWebclient/models/text-post-processing.d.ts +22 -0
  165. package/lib/models/DocReaderWebclient/models/text-result-all-of.d.ts +25 -0
  166. package/lib/models/DocReaderWebclient/models/text-result.d.ts +18 -0
  167. package/lib/models/DocReaderWebclient/models/text.d.ts +51 -0
  168. package/lib/models/DocReaderWebclient/models/transaction-info.d.ts +42 -0
  169. package/lib/models/DocReaderWebclient/models/verification-result.d.ts +38 -0
  170. package/lib/models/DocReaderWebclient/models/verified-field-map.d.ts +63 -0
  171. package/lib/models/DocReaderWebclient/models/visibility.d.ts +23 -0
  172. package/lib/services/DebugService.d.ts +4 -0
  173. package/lib/services/DocumentReaderProcessor.d.ts +9 -16
  174. package/lib/services/DocumentReaderService.d.ts +10 -4
  175. package/lib/services/FaceLivenessService.d.ts +70 -16
  176. package/lib/services/FaceService.d.ts +18 -5
  177. package/lib/types.d.ts +103 -83
  178. package/lib/utils.d.ts +4 -1
  179. package/lib/web-components/CameraSnapshot.d.ts +6 -3
  180. package/lib/web-components/DocumentReader.d.ts +6 -3
  181. package/lib/web-components/FaceDetection.d.ts +2 -3
  182. package/lib/web-components/FaceLiveness.d.ts +6 -4
  183. package/lib/web-components/FullScreenContainer.d.ts +1 -1
  184. package/package.json +6 -6
  185. package/lib/common/InstructionIconFaceDetection.d.ts +0 -5
  186. package/lib/common/InstructionIconFaceLiveness.d.ts +0 -5
  187. package/lib/common/NoGlareIcon.d.ts +0 -5
  188. package/lib/common/NoSmilingIcon.d.ts +0 -5
  189. package/lib/components/InstructionScreen.d.ts +0 -9
  190. package/lib/components/RetryScreen.d.ts +0 -7
package/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
  3. [UI components](#ui-components)
5
5
  * [Integration via NPM](#integration-via-npm)
6
6
  * [Integration via CDN](#integration-via-cdn)
7
+ * [Settings](#settings)
7
8
  * [Events](#events)
8
9
  * [Response](#response)
9
10
  * [Attributes](#attributes)
@@ -105,6 +106,85 @@ Add the component name to the ```.html``` file. The available components are:
105
106
 
106
107
  Notice: To use ```<document-reader></document-reader>``` component on test environments, set the base64 license value to the ```license``` attribute. Example: ```<document-reader license="BASE64_LICENSE_KEY"></document-reader>```.
107
108
 
109
+ ### Settings
110
+
111
+ After adding ```DocumentReaderService``` to the global variable, you can change the default document recognition settings:
112
+
113
+ ```javascript
114
+ // Default settings for video capture (From camera button):
115
+ window.RegulaDocumentSDK.recognizerProcessParam = {
116
+ processParam: {
117
+ returnUncroppedImage: true,
118
+ scenario: 'MrzAndLocate',
119
+ multipageProcessing: false,
120
+ returnPackageForReprocess: false,
121
+ timeout: 20000,
122
+ resultTypeOutput: [],
123
+ imageQa: {
124
+ expectedPass: ['dpiThreshold', 'glaresCheck', 'focusCheck'],
125
+ dpiThreshold: 130,
126
+ glaresCheck: true,
127
+ glaresCheckParams: {
128
+ imgMarginPart: 0.05,
129
+ maxGlaringPart: 0.01,
130
+ },
131
+ },
132
+ },
133
+ };
134
+
135
+ // Default settings for image processing (From gallery button):
136
+ window.RegulaDocumentSDK.imageProcessParam = {
137
+ processParam: {
138
+ scenario: 'MrzAndLocate',
139
+ returnUncroppedImage: true,
140
+ returnPackageForReprocess: false,
141
+ },
142
+ };
143
+ ```
144
+
145
+ #### Descriptions of settings
146
+
147
+ | Setting | Info | Data type | Default value | Values |
148
+ |:----------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------:|:---------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
149
+ | **returnUncroppedImage** | When enabled, returns input images in output. | boolean | ```true``` | ```true```, ```false``` |
150
+ | **scenario** | Recognition scenario. | string | 'MrzAndLocate' | 'MrzAndLocate', 'MrzOrLocate', 'Mrz', 'Locate' |
151
+ | **multipageProcessing** | Enables multi-page document processing mode. | boolean | ```true``` | ```true```, ```false``` |
152
+ | **timeout** | Recognition timeout in milliseconds. After this time process will be finished. | number | 2000 | numbers > 0 |
153
+ | **resultTypeOutput** | Types of results to return in response. [] - all available types. | number[] | [] | ```1``` - DocumentImageResult, ```3``` - TextDataResult, ```5``` - DocBarCodeInfo, ```6``` - GraphicsResult, ```8``` - DocumentTypesCandidatesResult, ```9``` - ChosenDocumentTypeResult, ```20``` - AuthenticityResult, ```15``` - LexicalAnalysisResult, ```17``` - TextDataResult, ```18``` - TextDataResult, ```19``` - GraphicsResult, ```30``` - ImageQualityResult, ```33``` - StatusResult, ```36``` - TextResult, ```37``` - ImagesResult, ```85``` - DocumentPositionResult, ```102``` - TextDataResult, ```103``` - GraphicsResult, ```50``` - LicenseResult, ```49``` - EncryptedRCLResult |
154
+ | **returnPackageForReprocess** | Enable returning the package for reprocessing on the backend. | boolean | ```false``` | ```true```, ```false``` |
155
+ | **imageQa** | When enabled, image quality checks status affects document optical and overall status. | | | |
156
+ | **expectedPass** | Activated image quality checks. | string[] | ['dpiThreshold', 'glaresCheck', 'focusCheck'] | 'dpiThreshold', 'glaresCheck', 'focusCheck' |
157
+ | **dpiThreshold** | This parameter sets threshold for Image QA check of the presented document physical dpi. If actual document dpi is below this threshold, check will fail. | number | 150 | numbers > 0 |
158
+ | **glaresCheck** | This option enables glares check while performing image quality validation. | boolean | ```true``` | ```true```, ```false``` |
159
+ | **glaresCheckParams** | Settings for glare check. | | | |
160
+ | **imageOutputMaxHeight** | This parameter allows setting maximum height in pixels of output images and thus reducing image size to desired. Does not change the aspect ratio. Changes disabled if equals to 0. | number | 0 | numbers > 0 |
161
+ | **imageOutputMaxWidth** | This parameter allows setting maximum width in pixels of output images and thus reducing image size to desired. Does not change the aspect ratio. Changes disabled if equals to 0. | number | 0 | numbers > 0 |
162
+ | **doublePageSpread** | Enable this option if the image you provide contains double page spread of the passport and you want to process both pages in one go. It makes sense to use it for documents that have meaningful information on both pages, like Russian domestic passport, or some others. | boolean | ```false``` | ```true```, ```false``` |
163
+ | **generateDoublePageSpreadImage** | When enabled together with "doublePageSpread" and there is a passport with two pages spread in the image, pages will be cropped, straightened and aligned together, as if the document was captured on a flatbed scanner. | boolean | ```false``` | ```true```, ```false``` |
164
+ | **fieldTypesFilter** | List of text field types to extract. If empty, all text fields from template will be extracted. Narrowing the list can shorten processing time. | number[] | [] | |
165
+ | **dateFormat** | This option allows you to set dates format so that solution will return dates in this format. For example, if you supply 'MM/dd/yyyy', and document have printed date '09 JUL 2020' for the date os issue, you will get '07/09/2020' as a result. By default it is set to system locale default (where the service is running). | string | | 'MM/dd/yyyy' |
166
+ | **measureSystem** | This option allows you to set the system of measurement used for converting original values in document to output result values. Metric by default. | number | 0 | ```0``` - Metric, ```1``` - Imperial |
167
+ | **imageDpiOutMax** | This parameter controls maximum resolution in dpi of output images. Resolution will remain original in case 0 is supplied. By default is set to return images in response with resolution not greater than 300 dpi for all scenarios except FullAuth. In FullAuth scenario this limit is 1000 dpi by default. | number | | numbers > 0 |
168
+ | **alreadyCropped** | This option can be enabled if you know for sure that the image you provide contains already cropped document by its edges. This was designed to process on the server side images captured and cropped on mobile. | boolean | ```false``` | ```true```, ```false``` |
169
+ | **customParams** | This option allows passing custom processing parameters that can be implemented in future without changing API. | Object | {} | |
170
+ | **fastDocDetect** | When enabled, shorten the list of candidates to process during document detection in a single image process mode. Reduces processing time for specific backgrounds. | boolean | ```true``` | ```true```, ```false``` |
171
+ | **updateOCRValidityByGlare** | When enabled, fail OCR field validity, if there is a glare over the text field on the image. | boolean | ```false``` | ```true```, ```false``` |
172
+ | **returnCroppedBarcode** | When enabled, returns cropped barcode images for unknown documents. | boolean | ```false``` | ```true```, ```false``` |
173
+ | **respectImageQuality** | When enabled, image quality checks status affects document optical and overall status. | boolean | ```false``` | ```true```, ```false``` |
174
+ | **forceDocFormat** | Force use of specified document format when locating and recognizing document to reduce the number of candidates. | number | | ```0``` - ID1 document format, ```1``` - ID2 document format, ```2``` - ID3 document format, ```3``` - Undefined document format, ```4``` - A4 document format, ```5``` - ID3 double document format, ```10``` - ID1 format document rotated 90°, ```11``` - ID1 format document rotated 180°, ```12``` - ID1 format document rotated 270°, ```13``` - ID2 format document rotated 90°, ```14``` - ID3 format document rotated 180°, ```1000``` - Arbitrary format, ```1002``` - Flexible format. Standard formats can be resized during cropping, depending on various factors: light, background... |
175
+ | **noGraphics** | When enabled, no graphic fields will be cropped from document image. | boolean | ```false``` | ```true```, ```false``` |
176
+ | **documentAreaMin** | Specifies minimal area of the image that document should cover to be treated as candidate when locating. Value should be in range from 0 to 1, where 1 is when document should fully cover the image. | number | 0 | 0 - 1 |
177
+ | **depersonalizeLog** | When enabled, all personal data will be forcibly removed from the logs. | boolean | ```false``` | ```true```, ```false``` |
178
+ | **multiDocOnImage** | This option allows locating and cropping multiple documents from one image if enabled. | boolean | ```false``` | ```true```, ```false``` |
179
+ | **shiftExpiryDate** | This option allows shifting the date of expiry into the future or past for number of months specified. This is useful, for example, in some cases when document might be still valid for some period after original expiration date to prevent negative validity status for such documents. Or by shifting the date to the past will set negative validity for the documents that is about to expire in a specified number of months. | number | 0 | numbers > 0 |
180
+ | **minimalHolderAge** | This options allows specifying the minimal age in years of the document holder for the document to be considered valid. | number | 0 | numbers > 0 |
181
+ | **mrzFormatsFilter** | This option allows limiting MRZ formats to be recognized by specifying them in array. | string[] | [] | ```'1x30'``` - IDL, ```'3x30'``` - ID1, ```'2x36'``` - ID2, ```'2x44'``` - ID3, ```'1x6'``` - CAN, ```'2x30'``` - ID1 2x30 |
182
+ | **forceReadMrzBeforeLocate** | When enabled, make sure that in series processing MRZ is located fully inside the result document image, if present on the document. Enabling this option may add extra processing time, by disabling optimizations, but allows more stability in output image quality. | boolean | ```false``` | ```true```, ```false``` |
183
+ | **parseBarcodes** | This option can be disabled to stop parsing after barcode is read. | boolean | ```true``` | ```true```, ```false``` |
184
+ | **splitNames** | When enabled, the Surname and GivenNames field will be divided into ft_First_Name, ft_Second_Name, ft_Third_Name, ft_Fourth_Name, ft_Last_Name fields. | boolean | ```false``` | ```true```, ```false``` |
185
+
186
+ **Attention!** If the ```multipage-processing``` or ```internal-scenario``` attributes are set, the ```multipageProcessing``` and ```scenario``` settings will be ignored.
187
+
108
188
  ### Events
109
189
 
110
190
  You can subscribe to the component events.
@@ -133,16 +213,18 @@ The generated event object (```event.detail```) contains three fields that descr
133
213
 
134
214
  Type of actions:
135
215
 
136
- | Type of action | Description of the action | In which component is present |
137
- |:--------------------------|:-------------------------------------:|:--------------------------------------------:|
138
- | ```ELEMENT_VISIBLE``` | Component is appended in the DOM. | ```document-reader```, ```camera-snapshot``` |
139
- | ```PRESS_CAMERA_BUTTON``` | The "From camera" button is pressed. | ```document-reader```, ```camera-snapshot``` |
140
- | ```PRESS_FILE_BUTTON``` | The "From gallery" button is pressed. | ```document-reader```, ```camera-snapshot``` |
141
- | ```PRESS_RETRY_BUTTON``` | The "Retry" button is pressed. | ```document-reader```, ```camera-snapshot``` |
142
- | ```PRESS_SKIP_BUTTON``` | The "Skip" button is pressed. | ```document-reader``` |
143
- | ```CLOSE``` | The "Close" button is pressed. | ```document-reader```, ```camera-snapshot``` |
144
- | ```PROCESS_FINISHED``` | The component has finished its work. | ```document-reader```, ```camera-snapshot``` |
145
- | ```SERVICE_INITIALIZED``` | The component has started its work. | ```document-reader``` |
216
+ | Type of action | Description of the action | In which component is present |
217
+ |:-----------------------------|:----------------------------------------:|:--------------------------------------------:|
218
+ | ```ELEMENT_VISIBLE``` | Component is appended in the DOM. | ```document-reader```, ```camera-snapshot``` |
219
+ | ```PRESS_CAMERA_BUTTON``` | The "From camera" button is pressed. | ```document-reader```, ```camera-snapshot``` |
220
+ | ```PRESS_FILE_BUTTON``` | The "From gallery" button is pressed. | ```document-reader```, ```camera-snapshot``` |
221
+ | ```PRESS_RETRY_BUTTON``` | The "Retry" button is pressed. | ```document-reader```, ```camera-snapshot``` |
222
+ | ```PRESS_SKIP_BUTTON``` | The "Skip" button is pressed. | ```document-reader``` |
223
+ | ```CLOSE``` | The "Close" button is pressed. | ```document-reader```, ```camera-snapshot``` |
224
+ | ```CAMERA_PROCESS_STARTED``` | Recognition from the camera has started. | ```document-reader```, ```camera-snapshot``` |
225
+ | ```FILE_PROCESS_STARTED``` | File processing has started. | ```document-reader```, ```camera-snapshot``` |
226
+ | ```PROCESS_FINISHED``` | The component has finished its work. | ```document-reader```, ```camera-snapshot``` |
227
+ | ```SERVICE_INITIALIZED``` | The component has started its work. | ```document-reader``` |
146
228
 
147
229
  In cases of successful operation of the components, the ```data``` field will contain the following fields:
148
230
 
@@ -453,7 +535,7 @@ component.addEventListener('document-reader', listener);
453
535
 
454
536
  | Attribute | Info | Data type | Default value | Values |
455
537
  |:-------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------:|:------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
456
- | **locale** | The language of the component interface. If empty, the language is selected from the browser settings, if it is not found, the system language is taken. | string | ```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``` |
538
+ | **locale** | The language of the component interface. If empty, the language is selected from the browser settings, if it is not found, the system language is taken. | 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``` |
457
539
  | **internal-scenario** | The component document verification scenario. For more details, see the [Web components documentation](https://docs.regulaforensics.com/develop/doc-reader-sdk/web-components/getting-started#processing-scenarios). | string | ```MrzAndLocate``` | ```MrzAndLocate```, ```MrzOrLocate```, ```Mrz```, ```Locate``` |
458
540
  | **multipage-processing** | Whether to allow processing of two pages in cases when the component detects an ID1-sized document. Multipage processing is not triggered for documents of other formats. If ```true```, the component asks for the second page and processes it. If ```false```, only one page/side of the document is processed regardless the document format. | boolean | ```false``` | ```true```, ```false``` |
459
541
  | **start-screen** | Whether to show the start screen with two options for the document image uploading: From camera and From gallery. 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 image of the document. | boolean | ```false``` | ```true```, ```false``` |
@@ -468,7 +550,7 @@ component.addEventListener('document-reader', listener);
468
550
 
469
551
  | Attribute | Info | Data type | Default value | Values |
470
552
  |:------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------:|:---------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
471
- | **locale** | The language of the component interface. If empty, the language is selected from the browser settings, if it is not found, the system language is taken. | string | ```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``` |
553
+ | **locale** | The language of the component interface. If empty, the language is selected from the browser settings, if it is not found, the system language is taken. | 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``` |
472
554
  | **start-screen** | Whether to show the start screen with two options for the document image uploading: From camera and From gallery. 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 image of the document. | boolean | ```false``` | ```true```, ```false``` |
473
555
  | **multiple** | Whether to allow uploading more than one file via the file system. Can be set to ```true``` only if ```startScreen``` is ```true```. | boolean | ```true``` | ```true```, ```false``` |
474
556
  | **camera-id** | Ability to select a camera. You can get the device ID using [navigator.mediaDevices.enumerateDevices()](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices). | string | ```undefined``` | ```camera id string value``` |
@@ -478,15 +560,17 @@ component.addEventListener('document-reader', listener);
478
560
 
479
561
  ### Customization
480
562
 
563
+ #### Font and colors
564
+
481
565
  Using CSS variables, you can change the font and the main colors of the components.
482
566
 
483
567
  | Variable | Info | Default value |
484
568
  |:-------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------:|
485
569
  | **--font-family** | The font family of all text elements. If you change the font family, make sure to adjust the fond size so the message on the start screen would fit the frame. | ```Noto Sans, sans-serif``` |
486
570
  | **--font-size** | The font size for the text elements. | ```16px``` |
487
- | **--main-color** | Color for the graphic elements of the component. By default, the brand Regula violet is set. | ```#663399``` |
488
- | **--hover-color** | Buttons hover color. | ```#7c45b4``` |
489
- | **--active-color** | Buttons active color. | ```#663399``` |
571
+ | **--main-color** | Color for the graphic elements of the component. By default, the brand Regula violet is set. | ```#bd7dff``` |
572
+ | **--hover-color** | Buttons hover color. | ```#c994ff``` |
573
+ | **--active-color** | Buttons active color. | ```#bd7dff``` |
490
574
 
491
575
  For example:
492
576
 
@@ -505,6 +589,71 @@ HTML:
505
589
  <document-reader class="my-custom-style"></document-reader>
506
590
  ```
507
591
 
592
+ #### Messages
593
+
594
+ 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 [attribute](#attributes) descriptions section, ```locale``` attribute):
595
+
596
+ ```javascript
597
+ const element = document.querySelector('document-reader');
598
+
599
+ element.translations = {
600
+ en: {
601
+ fromCamera: 'Use your camera',
602
+ },
603
+ };
604
+ ```
605
+
606
+ **Note**: to see the changes, don't forget to set the language you changed to the ```locale``` attribute.
607
+
608
+ ```html
609
+ <document-reader locale="en"></document-reader>
610
+ ```
611
+
612
+ List of labels used in the component:
613
+
614
+ | Label | Default message in ```en``` locale | Used in |
615
+ |:------------------------------|:---------------------------------------------------------------------------------------------|:--------------------------------------------:|
616
+ | **success** | Success! | ```document-reader```, ```camera-snapshot``` |
617
+ | **fileCorrupt** | This file is corrupt or not supported | ```document-reader```, ```camera-snapshot``` |
618
+ | **selectAnotherFile** | Please select another file | ```document-reader```, ```camera-snapshot``` |
619
+ | **error** | Error! | ```document-reader```, ```camera-snapshot``` |
620
+ | **somethingWentWrong** | Something went wrong | ```document-reader```, ```camera-snapshot``` |
621
+ | **tryAgain** | Try again | ```document-reader```, ```camera-snapshot``` |
622
+ | **fromCamera** | From camera | ```document-reader```, ```camera-snapshot``` |
623
+ | **fromGallery** | From gallery | ```document-reader```, ```camera-snapshot``` |
624
+ | **cameraUnavailable** | Camera unavailable! | ```document-reader```, ```camera-snapshot``` |
625
+ | **preparingCamera** | Preparing the camera... | ```document-reader```, ```camera-snapshot``` |
626
+ | **noCameraAvailable** | No camera available | ```document-reader```, ```camera-snapshot``` |
627
+ | **incorrectCameraId** | No camera with the specified ID found. | ```document-reader```, ```camera-snapshot``` |
628
+ | **allowAccessToCamera** | Allow access to the camera and reload this page to continue. | ```document-reader```, ```camera-snapshot``` |
629
+ | **cameraConnection** | Make sure the camera is connected correctly. | ```document-reader```, ```camera-snapshot``` |
630
+ | **checkCameraId** | Check if the specified camera ID is correct. | ```document-reader```, ```camera-snapshot``` |
631
+ | **scanIDInBrowser** | Scan an ID in your browser | ```document-reader``` |
632
+ | **useYourDeviceCamera** | Use your device camera to scan a document or select a photo of the document from the gallery | ```document-reader``` |
633
+ | **processingFinished** | Processing finished. | ```document-reader``` |
634
+ | **largeFile** | This file is too large to be uploaded | ```document-reader``` |
635
+ | **selectSmallerFile** | Please select a smaller file | ```document-reader``` |
636
+ | **versionNotSupported** | Your browser version is not supported | ```document-reader``` |
637
+ | **updateBrowser** | Update your browser version | ```document-reader``` |
638
+ | **licenseError** | A license error has occurred | ```document-reader``` |
639
+ | **licenseExpired** | The license cannot be found or has expired | ```document-reader``` |
640
+ | **timeout** | Timeout | ```document-reader``` |
641
+ | **processing** | Processing... | ```document-reader``` |
642
+ | **preparingService** | Preparing the service... | ```document-reader``` |
643
+ | **detectingDocument** | Detecting a document... | ```document-reader``` |
644
+ | **placeDocumentIntoFrame** | Fit the document into the frame | ```document-reader``` |
645
+ | **noFocus** | No camera focus | ```document-reader``` |
646
+ | **moveCloser** | Move closer | ```document-reader``` |
647
+ | **glaresOnDocument** | Avoid glare on the document | ```document-reader``` |
648
+ | **holdDocumentStraight** | Hold the document straight | ```document-reader``` |
649
+ | **documentProcessing** | Document processing... | ```document-reader``` |
650
+ | **flipDocument** | Flip the document | ```document-reader``` |
651
+ | **verified** | Verified! | ```document-reader``` |
652
+ | **positionDocumentCenter** | Position the document in the center | ```camera-snapshot``` |
653
+ | **photoCapturedSuccessfully** | The photo is captured successfully. | ```camera-snapshot``` |
654
+ | **uploadPhoto** | Upload a photo | ```camera-snapshot``` |
655
+ | **useCameraOrGallery** | Use your device camera or select a photo from the gallery | ```camera-snapshot``` |
656
+
508
657
  ## Document reader SDK
509
658
 
510
659
  You can use the document-reader SDK to create your own UI interface.
@@ -650,7 +799,7 @@ Sets the video stream settings:
650
799
 
651
800
  ```javascript
652
801
  processor.streamParam = {
653
- cameraMode: 'user', // Camera facing mode. Can be 'environment' or 'user'. By default 'user'.
802
+ cameraMode: 'environment', // Camera facing mode. Can be 'environment' or 'user'. By default 'environment'.
654
803
  preferredCameraId: '', // Selecting a camera by ID. The camera ID can be obtained using navigator.mediaDevices.enumerateDevices();. Not set by default.
655
804
  resolution: { // Video resolution. By default 1280x720.
656
805
  width: 1280,
@@ -664,40 +813,34 @@ processor.streamParam = {
664
813
  Sets the settings for recognizing a document from the camera (```startRecognition``` method):
665
814
 
666
815
  ```javascript
816
+ // Default settings:
667
817
  processor.recognizerProcessParam = {
668
818
  processParam: {
669
- returnUncroppedImage: true, // When enabled, returns input images in output. Disabled by default.
670
- scenario: 'MrzAndLocate', // Recognition scenario. Can be 'MrzAndLocate', 'MrzOrLocate', 'Mrz', 'Locate'. By default 'MrzAndLocate'.
671
- multipageProcessing: true, // Enables multi-page document processing mode. By default false.
672
- timeout: 20000, // Recognition timeout in milliseconds. After this time process will be finished. By default 20000.
673
- resultTypeOutput: [], // Types of results to return in response. By default [] - all available types.
674
- imageQa: { // Quality checks.
675
- expectedPass: ['dpiThreshold', 'glaresCheck'],
676
- dpiThreshold: 130,
677
- glaresCheck: true,
678
- glaresCheckParams: {
679
- imgMarginPart: 0.05,
680
- maxGlaringPart: 0.01,
681
- },
682
- },
819
+ scenario: 'MrzAndLocate',
820
+ returnUncroppedImage: true,
821
+ returnPackageForReprocess: false,
683
822
  },
684
- }
823
+ };
685
824
  ```
825
+ See the list of all available settings [here](#settings).
686
826
 
687
827
  #### imageProcessParam
688
828
 
689
829
  Sets the settings for recognizing a document as a file (```processImage``` method):
690
830
 
691
831
  ```javascript
832
+ // Default settings:
692
833
  processor.imageProcessParam = {
693
834
  processParam: {
694
- returnUncroppedImage: true, // When enabled, returns input images in output. Disabled by default.
695
- scenario: 'MrzAndLocate', // Recognition scenario. Can be 'MrzAndLocate', 'MrzOrLocate', 'Mrz', 'Locate'. By default 'MrzAndLocate'.
696
- resultTypeOutput: [], // Types of results to return in response. By default [] - all available types.
835
+ scenario: 'MrzAndLocate',
836
+ returnUncroppedImage: true,
837
+ returnPackageForReprocess: false,
697
838
  },
698
839
  }
699
840
  ```
700
841
 
842
+ See the list of all available settings [here](#settings).
843
+
701
844
  #### recognizeListener
702
845
 
703
846
  Sets the callback function that takes in the processing result for each frame: