scanbot-web-sdk 6.0.0-dev.1 → 6.0.0-dev.2

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 (177) hide show
  1. package/@types/barcode-scanner-view.d.ts +10 -10
  2. package/@types/consume-type.d.ts +7 -0
  3. package/@types/core/bridge/common.d.ts +24 -0
  4. package/@types/core/bridge/compiled/BarcodeConfigs.d.ts +973 -0
  5. package/@types/core/bridge/compiled/BarcodeScannerTypes.d.ts +183 -0
  6. package/@types/core/bridge/compiled/BarcodeTypes.d.ts +183 -0
  7. package/@types/core/bridge/compiled/CheckRecognizerTypes.d.ts +29 -0
  8. package/@types/core/bridge/compiled/CommonFieldType.d.ts +59 -0
  9. package/@types/core/bridge/compiled/DocumentDetectorTypes.d.ts +196 -0
  10. package/@types/core/bridge/compiled/DocumentQualityAnalyzerTypes.d.ts +105 -0
  11. package/@types/core/bridge/compiled/EhicTypes.d.ts +218 -0
  12. package/@types/core/bridge/compiled/FrameUtilities.d.ts +18 -0
  13. package/@types/core/bridge/compiled/GenericDocument.d.ts +198 -0
  14. package/@types/core/bridge/compiled/GenericDocumentRecognizerTypes.d.ts +104 -0
  15. package/@types/core/bridge/compiled/GenericTextLineScannerTypes.d.ts +165 -0
  16. package/@types/core/bridge/compiled/Geometry.d.ts +49 -0
  17. package/@types/core/bridge/compiled/ImageProcessorTypes.d.ts +13 -0
  18. package/@types/core/bridge/compiled/LicensePlateScannerTypes.d.ts +67 -0
  19. package/@types/core/bridge/compiled/MRZTypes.d.ts +52 -0
  20. package/@types/core/bridge/compiled/MedicalCertificateTypes.d.ts +306 -0
  21. package/@types/core/bridge/compiled/OcrElements.d.ts +129 -0
  22. package/@types/core/bridge/compiled/ParametricFilters.d.ts +186 -0
  23. package/@types/core/bridge/compiled/PdfConfig.d.ts +197 -0
  24. package/@types/core/bridge/compiled/TiffTypes.d.ts +183 -0
  25. package/@types/core/bridge/compiled_schemas_v3/BarcodeConfigs.d.ts +973 -0
  26. package/@types/core/bridge/compiled_schemas_v3/BarcodeScannerTypes.d.ts +183 -0
  27. package/@types/core/bridge/compiled_schemas_v3/BarcodeTypes.d.ts +183 -0
  28. package/@types/core/bridge/compiled_schemas_v3/CheckRecognizerTypes.d.ts +29 -0
  29. package/@types/core/bridge/compiled_schemas_v3/CommonFieldType.d.ts +59 -0
  30. package/@types/core/bridge/compiled_schemas_v3/DocumentDetectorTypes.d.ts +196 -0
  31. package/@types/core/bridge/compiled_schemas_v3/DocumentQualityAnalyzerTypes.d.ts +105 -0
  32. package/@types/core/bridge/compiled_schemas_v3/EhicTypes.d.ts +218 -0
  33. package/@types/core/bridge/compiled_schemas_v3/FrameUtilities.d.ts +18 -0
  34. package/@types/core/bridge/compiled_schemas_v3/GenericDocument.d.ts +198 -0
  35. package/@types/core/bridge/compiled_schemas_v3/GenericDocumentRecognizerTypes.d.ts +104 -0
  36. package/@types/core/bridge/compiled_schemas_v3/GenericTextLineScannerTypes.d.ts +165 -0
  37. package/@types/core/bridge/compiled_schemas_v3/Geometry.d.ts +49 -0
  38. package/@types/core/bridge/compiled_schemas_v3/ImageProcessorTypes.d.ts +13 -0
  39. package/@types/core/bridge/compiled_schemas_v3/LicensePlateScannerTypes.d.ts +67 -0
  40. package/@types/core/bridge/compiled_schemas_v3/MRZTypes.d.ts +52 -0
  41. package/@types/core/bridge/compiled_schemas_v3/MedicalCertificateTypes.d.ts +306 -0
  42. package/@types/core/bridge/compiled_schemas_v3/OcrElements.d.ts +129 -0
  43. package/@types/core/bridge/compiled_schemas_v3/ParametricFilters.d.ts +186 -0
  44. package/@types/core/bridge/compiled_schemas_v3/PdfConfig.d.ts +197 -0
  45. package/@types/core/bridge/compiled_schemas_v3/TiffTypes.d.ts +183 -0
  46. package/@types/core/bridge/utils.d.ts +7 -0
  47. package/@types/core/bridge/worker-bridge.d.ts +362 -0
  48. package/@types/core/worker/ScanbotSDK.Core-simd-threads.d.ts +0 -0
  49. package/@types/core/worker/ScanbotSDK.Core-simd.d.ts +0 -0
  50. package/@types/core/worker/ScanbotSDK.Core.d.ts +75 -0
  51. package/@types/core-types.d.ts +23 -0
  52. package/@types/cropping-view.d.ts +4 -2
  53. package/@types/document-scanner-view.d.ts +5 -5
  54. package/@types/generic-document-recognizer-view.d.ts +22 -0
  55. package/@types/index.d.ts +12 -19
  56. package/@types/interfaces/i-document-scanner-handle.d.ts +2 -2
  57. package/@types/interfaces/i-generic-document-recognizer-scanner-handle.d.ts +3 -0
  58. package/@types/model/barcode/barcode-result.d.ts +6 -8
  59. package/@types/model/barcode/barcode.d.ts +3 -14
  60. package/@types/model/configuration/barcode-scanner-configuration.d.ts +12 -8
  61. package/@types/model/configuration/cropping-view-configuration.d.ts +2 -1
  62. package/@types/model/configuration/document-scanner-configuration.d.ts +5 -20
  63. package/@types/model/configuration/generic-document-recognizer-configuration.d.ts +9 -0
  64. package/@types/model/configuration/initialization-options.d.ts +2 -1
  65. package/@types/model/configuration/mrz-scanner-configuration.d.ts +4 -3
  66. package/@types/model/configuration/scanner-configuration.d.ts +1 -0
  67. package/@types/model/configuration/selection-overlay-configuration.d.ts +2 -2
  68. package/@types/model/configuration/text-data-scanner-configuration.d.ts +3 -6
  69. package/@types/model/configuration/view-finder-scanner-configuration.d.ts +3 -2
  70. package/@types/model/configuration/vin-scanner-configuration.d.ts +2 -1
  71. package/@types/model/response/cropping-result.d.ts +2 -1
  72. package/@types/scanbot-sdk.d.ts +208 -29
  73. package/@types/service/document-quality-analyzer.d.ts +7 -5
  74. package/@types/service/generic-document-recognizer.d.ts +11 -0
  75. package/@types/service/ocr-engine.d.ts +8 -5
  76. package/@types/service/pdf-generator.d.ts +7 -95
  77. package/@types/service/public-utils.d.ts +1 -1
  78. package/@types/service/simple-mrz-recognizer.d.ts +5 -5
  79. package/@types/service/text-data-recognizer.d.ts +5 -4
  80. package/@types/service/tiff-generator.d.ts +12 -10
  81. package/@types/ui2/configuration/BarcodeInfoMapping.d.ts +1 -1
  82. package/@types/ui2/configuration/BarcodeItem.d.ts +4 -28
  83. package/@types/ui2/configuration/BarcodeRecognizerConfiguration.d.ts +12 -155
  84. package/@types/ui2/configuration/BarcodeScannerConfiguration.d.ts +2 -18
  85. package/@types/ui2/configuration/BarcodeScannerTypes.d.ts +6 -0
  86. package/@types/ui2/configuration/BarcodeTextLocalization.d.ts +0 -60
  87. package/@types/ui2/configuration/BarcodeTypes.d.ts +1 -0
  88. package/@types/ui2/configuration/BarcodeUseCase.d.ts +3 -0
  89. package/@types/ui2/configuration/CameraConfiguration.d.ts +22 -23
  90. package/@types/ui2/configuration/CameraPermission.d.ts +0 -15
  91. package/@types/ui2/configuration/Common.d.ts +0 -37
  92. package/@types/ui2/configuration/FindAndPickScanningModeUseCase.d.ts +2 -2
  93. package/@types/ui2/configuration/Geometry.d.ts +1 -0
  94. package/@types/ui2/configuration/MultipleScanningModeUseCase.d.ts +1 -1
  95. package/@types/ui2/configuration/SingleScanningModeUseCase.d.ts +1 -1
  96. package/@types/ui2/configuration/TopBarConfiguration.d.ts +0 -16
  97. package/@types/ui2/configuration/ViewFinderConfiguration.d.ts +6 -3
  98. package/@types/ui2/configuration.d.ts +1 -1
  99. package/@types/ui2/controllers/multiple-scanning-mode-controller.d.ts +2 -1
  100. package/@types/ui2/controllers/single-scanning-mode-controller.d.ts +2 -1
  101. package/@types/ui2/model/counted-barcodes.d.ts +13 -12
  102. package/@types/ui2/scanbot-sdk-ui.d.ts +2 -2
  103. package/@types/ui2/utils/barcode-mapper.d.ts +15 -3
  104. package/@types/ui2/utils/camera-config.d.ts +2 -2
  105. package/@types/ui2/utils/styled-input.d.ts +1 -1
  106. package/@types/ui2/views/action-button/action-button-container.d.ts +2 -0
  107. package/@types/ui2/views/barcode-scanner.d.ts +4 -3
  108. package/@types/ui2/views/drawer/subviews/barcode-list-item.d.ts +3 -3
  109. package/@types/ui2/views/form/dialog-button.d.ts +2 -2
  110. package/@types/utils/dto/MagneticLine.d.ts +4 -4
  111. package/@types/utils/dto/Point.d.ts +2 -2
  112. package/@types/utils/image-utils.d.ts +1 -0
  113. package/@types/utils/react/usePromise.d.ts +3 -1
  114. package/@types/utils/utils.d.ts +1 -1
  115. package/@types/utils/video-stream.d.ts +1 -0
  116. package/@types/view/action-bar/bottom-action-bar.d.ts +2 -2
  117. package/@types/view/barcode-calculation/barcode-calculation-popup-list.d.ts +2 -2
  118. package/@types/view/barcode-calculation/barcode-calculation-popup.d.ts +4 -4
  119. package/@types/view/barcode-calculation/scanned-image-with-overlay.d.ts +2 -2
  120. package/@types/view/barcode-polygon/animated-barcode-selection-overlay.d.ts +6 -5
  121. package/@types/view/barcode-polygon/barcode-overlay.d.ts +3 -3
  122. package/@types/view/barcode-polygon/barcode-polygon-label.d.ts +2 -2
  123. package/@types/view/cropping/draggable-base-container.d.ts +8 -2
  124. package/@types/view/cropping/draggable-handles-component.d.ts +9 -2
  125. package/@types/view/view-finder.d.ts +1 -0
  126. package/@types/worker/worker-bridge.d.ts +349 -5
  127. package/Libraries.txt +307 -174
  128. package/README.md +3 -3
  129. package/bundle/ScanbotSDK.min.js +5 -5
  130. package/bundle/ScanbotSDK.ui2.min.js +108 -161
  131. package/bundle/ScanbotSDK.ui2.min.js.LICENSE.txt +0 -18
  132. package/bundle/bin/barcode-scanner/ScanbotSDK.Asm-simd-threads.js +1 -1
  133. package/bundle/bin/barcode-scanner/ScanbotSDK.Asm-simd-threads.wasm +0 -0
  134. package/bundle/bin/barcode-scanner/ScanbotSDK.Asm-simd.wasm +0 -0
  135. package/bundle/bin/barcode-scanner/ScanbotSDK.Asm.wasm +0 -0
  136. package/bundle/bin/barcode-scanner/ScanbotSDK.Core-simd-threads.js +1 -1
  137. package/bundle/bin/barcode-scanner/ScanbotSDK.Core-simd.js +1 -1
  138. package/bundle/bin/barcode-scanner/ScanbotSDK.Core.js +1 -1
  139. package/bundle/bin/complete/ScanbotSDK.Asm-simd-threads.js +1 -1
  140. package/bundle/bin/complete/ScanbotSDK.Asm-simd-threads.wasm +0 -0
  141. package/bundle/bin/complete/ScanbotSDK.Asm-simd.wasm +0 -0
  142. package/bundle/bin/complete/ScanbotSDK.Asm.wasm +0 -0
  143. package/bundle/bin/complete/ScanbotSDK.Core-simd-threads.js +1 -1
  144. package/bundle/bin/complete/ScanbotSDK.Core-simd.js +1 -1
  145. package/bundle/bin/complete/ScanbotSDK.Core.js +1 -1
  146. package/bundle/bin/document-scanner/ScanbotSDK.Asm-simd-threads.js +1 -1
  147. package/bundle/bin/document-scanner/ScanbotSDK.Asm-simd-threads.wasm +0 -0
  148. package/bundle/bin/document-scanner/ScanbotSDK.Asm-simd.wasm +0 -0
  149. package/bundle/bin/document-scanner/ScanbotSDK.Asm.wasm +0 -0
  150. package/bundle/bin/document-scanner/ScanbotSDK.Core-simd-threads.js +1 -1
  151. package/bundle/bin/document-scanner/ScanbotSDK.Core-simd.js +1 -1
  152. package/bundle/bin/document-scanner/ScanbotSDK.Core.js +1 -1
  153. package/package.json +4 -3
  154. package/ui.d.ts +3 -0
  155. package/ui.js +2 -0
  156. package/webpack/fileLoader.js +3 -5
  157. package/@types/core/compiled/ParametricFilters.d.ts +0 -181
  158. package/@types/core/utils.d.ts +0 -1
  159. package/@types/core/worker-bridge.d.ts +0 -20
  160. package/@types/model/barcode/barcode-format.d.ts +0 -1
  161. package/@types/model/barcode/engine-mode.d.ts +0 -1
  162. package/@types/model/configuration/document-quality-analyzer-configuration.d.ts +0 -13
  163. package/@types/model/document/contour-detection-result.d.ts +0 -11
  164. package/@types/model/document/detection-status.d.ts +0 -11
  165. package/@types/model/document/document-detection-result.d.ts +0 -8
  166. package/@types/model/filter-types.d.ts +0 -6
  167. package/@types/model/generic-text-line-recognizer/text-data-scanner-result.d.ts +0 -6
  168. package/@types/model/mrz/mrz-result.d.ts +0 -41
  169. package/@types/model/response/document-quality-analyzer-result.d.ts +0 -8
  170. package/@types/service/image-processor.d.ts +0 -35
  171. package/@types/ui2/configuration/BarcodeResult.d.ts +0 -14
  172. package/@types/utils/networking.d.ts +0 -7
  173. package/bundle/bin/barcode-scanner/ScanbotSDK.Asm.wasm-webpack-file-loader +0 -0
  174. package/bundle/bin/complete/ScanbotSDK.Asm-simd-threads.wasm-webpack-file-loader +0 -0
  175. package/bundle/bin/complete/ScanbotSDK.Asm-simd.wasm-webpack-file-loader +0 -0
  176. package/bundle/bin/complete/ScanbotSDK.Asm.wasm-webpack-file-loader +0 -0
  177. package/bundle/bin/document-scanner/ScanbotSDK.Asm.wasm-webpack-file-loader +0 -0
@@ -0,0 +1,105 @@
1
+ import { DeepPartial, PartiallyConstructible } from "../common";
2
+ /**
3
+ Result of document quality analysis.
4
+
5
+ - `VERY_POOR`:
6
+ Very poor quality
7
+ - `POOR`:
8
+ Poor quality
9
+ - `REASONABLE`:
10
+ Reasonable quality
11
+ - `GOOD`:
12
+ Good quality
13
+ - `EXCELLENT`:
14
+ Excellent quality
15
+ */
16
+ export type Quality = "VERY_POOR" | "POOR" | "REASONABLE" | "GOOD" | "EXCELLENT";
17
+ /**
18
+ Point in the quality-number of symbols space to separate quality levels
19
+ */
20
+ export declare class QualityThreshold extends PartiallyConstructible {
21
+ /**
22
+ Symbol quality
23
+ */
24
+ readonly symbolQuality: number;
25
+ /**
26
+ Symbol ratio
27
+ */
28
+ readonly symbolRatio: number;
29
+ /** @param source {@displayType `DeepPartial<QualityThreshold>`} */
30
+ constructor(source?: DeepPartial<QualityThreshold>);
31
+ }
32
+ /**
33
+ Document Quality Analyzer configuration
34
+ */
35
+ export declare class Config extends PartiallyConstructible {
36
+ /**
37
+ Quality thresholds to separate quality levels
38
+ @defaultValue [new QualityThreshold({
39
+ "symbolQuality": 0.5,
40
+ "symbolRatio": 0.5
41
+ }), new QualityThreshold({
42
+ "symbolQuality": 0.7,
43
+ "symbolRatio": 0.3
44
+ }), new QualityThreshold({
45
+ "symbolQuality": 0.85,
46
+ "symbolRatio": 0.3
47
+ }), new QualityThreshold({
48
+ "symbolQuality": 0.9,
49
+ "symbolRatio": 0.1
50
+ })];
51
+ */
52
+ readonly qualityThresholds: QualityThreshold[];
53
+ /**
54
+ quality levels
55
+ @defaultValue ["VERY_POOR", "POOR", "REASONABLE", "GOOD", "EXCELLENT"];
56
+ */
57
+ readonly qualityIndices: Quality[];
58
+ /**
59
+ Maximum image size in pixels, if image is bigger, it will be resized
60
+ @defaultValue 2000;
61
+ */
62
+ readonly maxImageSize: number;
63
+ /**
64
+ if estimated number of symbols is less than this value, return that document is not found
65
+ @defaultValue 20;
66
+ */
67
+ minEstimatedNumberOfSymbolsForDocument: number;
68
+ /**
69
+ at least this fraction of the image will be processed, range is from 0 to 1
70
+ @defaultValue 0.0;
71
+ */
72
+ readonly minProcessedFraction: number;
73
+ /**
74
+ at most this fraction of the image will be processed, range is from 0 to 1
75
+ @defaultValue 0.5;
76
+ */
77
+ readonly maxProcessedFraction: number;
78
+ /**
79
+ If this number of symbols is found and minProcessedFraction of the image is processed, the processing stops
80
+ @defaultValue 100;
81
+ */
82
+ readonly earlyStopIfNSymbolsFound: number;
83
+ /**
84
+ Image will be processed in tiles of this size; will be ignored if image is small
85
+ @defaultValue 300;
86
+ */
87
+ readonly tileSize: number;
88
+ /** @param source {@displayType `DeepPartial<Config>`} */
89
+ constructor(source?: DeepPartial<Config>);
90
+ }
91
+ /**
92
+ Result of document quality analysis. It can be used to determine, e.g., if a document is good enough to be used for OCR processing.
93
+ */
94
+ export declare class AnalysisResult extends PartiallyConstructible {
95
+ /**
96
+ True if a document was found
97
+ */
98
+ readonly documentFound: boolean;
99
+ /**
100
+ Quality of the document, if found
101
+ */
102
+ readonly quality: Quality | null;
103
+ /** @param source {@displayType `DeepPartial<AnalysisResult>`} */
104
+ constructor(source?: DeepPartial<AnalysisResult>);
105
+ }
@@ -0,0 +1,218 @@
1
+ import { DeepPartial, PartiallyConstructible } from "../common";
2
+ /**
3
+ The result of the health insurance card recognition
4
+ */
5
+ export declare class RecognitionResult extends PartiallyConstructible {
6
+ /**
7
+ Health insurance card fields
8
+ */
9
+ readonly fields: RecognitionResult.Field[];
10
+ /**
11
+ Detection status
12
+ @defaultValue "FAILED_DETECTION";
13
+ */
14
+ readonly status: RecognitionResult.DetectionStatus;
15
+ /** @param source {@displayType `DeepPartial<RecognitionResult>`} */
16
+ constructor(source?: DeepPartial<RecognitionResult>);
17
+ }
18
+ export declare namespace RecognitionResult {
19
+ /**
20
+ Card detection status
21
+
22
+ - `SUCCESS`:
23
+ Detection successful. The fields array is filled with all of the extracted data. All validatable fields have passed validation.
24
+ - `FAILED_DETECTION`:
25
+ No document found or the document doesn't look like the back of an EHIC.
26
+ - `INCOMPLETE_VALIDATION`:
27
+ A potential EHIC was found but one or more fields failed validation.
28
+ */
29
+ type DetectionStatus = "SUCCESS" | "FAILED_DETECTION" | "INCOMPLETE_VALIDATION";
30
+ /**
31
+ Health insurance card field
32
+ */
33
+ class Field extends PartiallyConstructible {
34
+ /**
35
+ Health insurance card field type
36
+ */
37
+ readonly type: RecognitionResult.Field.FieldType;
38
+ /**
39
+ Recognized value
40
+ */
41
+ readonly value: string;
42
+ /**
43
+ Recognition confidence
44
+ */
45
+ readonly confidence: number;
46
+ /**
47
+ Field validation status
48
+ @defaultValue "NOT_VALIDATED";
49
+ */
50
+ readonly validationStatus: RecognitionResult.Field.ValidationStatus;
51
+ /** @param source {@displayType `DeepPartial<Field>`} */
52
+ constructor(source?: DeepPartial<Field>);
53
+ }
54
+ namespace Field {
55
+ /**
56
+ Health insurance card field validation status
57
+
58
+ - `NOT_VALIDATED`:
59
+ Field shouldn't be validated
60
+ - `FAILURE`:
61
+ Field is not valid
62
+ - `SUCCESS`:
63
+ Field is valid
64
+ - `CONFIRMED`:
65
+ Field is valid and confirmed across multiple frames
66
+ */
67
+ type ValidationStatus = "NOT_VALIDATED" | "FAILURE" | "SUCCESS" | "CONFIRMED";
68
+ /**
69
+ Health insurance card field type
70
+
71
+ - `SURNAME`:
72
+ Surname
73
+ - `GIVEN_NAME`:
74
+ Given name
75
+ - `DATE_OF_BIRTH`:
76
+ Date of birth
77
+ - `PERSONAL_IDENTIFICATION_NUMBER`:
78
+ Personal identification number
79
+ - `INSTITUTION_NUMBER`:
80
+ Institution number
81
+ - `INSTITUTION_NAME`:
82
+ Institution name
83
+ - `CARD_NUMBER`:
84
+ Card number
85
+ - `CARD_EXPIRATION_DATE`:
86
+ Card expiration date
87
+ - `COUNTRY`:
88
+ Country
89
+ */
90
+ type FieldType = "SURNAME" | "GIVEN_NAME" | "DATE_OF_BIRTH" | "PERSONAL_IDENTIFICATION_NUMBER" | "INSTITUTION_NUMBER" | "INSTITUTION_NAME" | "CARD_NUMBER" | "CARD_EXPIRATION_DATE" | "COUNTRY";
91
+ }
92
+ }
93
+ /**
94
+ Health insurance card issuing country
95
+
96
+ - `AUSTRIA`:
97
+ Austria (Validation on the personal identification number is performed as described in "site:www.sozialversicherung.at Was ist die Versicherungsnummer?")
98
+ - `BELGIUM`:
99
+ Belgium
100
+ - `BULGARIA`:
101
+ Bulgaria
102
+ - `CROATIA`:
103
+ Croatia
104
+ - `CYPRUS`:
105
+ Cyprus
106
+ - `CZECH_REPUBLIC`:
107
+ Czech Republic
108
+ - `DENMARK`:
109
+ Denmark
110
+ - `ESTONIA`:
111
+ Estonia
112
+ - `FINLAND`:
113
+ Finland
114
+ - `FRANCE`:
115
+ France
116
+ - `GERMANY`:
117
+ Germany (Validation performed according to "Spezifikation für Musterkarten und Testkarten (eGK, HBA, SMC), Anhang A" and "GS1 Struktur der Kenn-Nummer (ICCSN) der elektronischen Gesundheitskarte")
118
+ - `GREECE`:
119
+ Greece
120
+ - `HUNGARY`:
121
+ Hungary
122
+ - `IRELAND`:
123
+ Ireland
124
+ - `ITALY`:
125
+ Italy
126
+ - `LATVIA`:
127
+ Latvia
128
+ - `LITHUANIA`:
129
+ Lithuania
130
+ - `LUXEMBOURG`:
131
+ Luxembourg
132
+ - `MALTA`:
133
+ Malta
134
+ - `NETHERLANDS`:
135
+ Netherlands
136
+ - `POLAND`:
137
+ Poland
138
+ - `PORTUGAL`:
139
+ Portugal
140
+ - `ROMANIA`:
141
+ Romania
142
+ - `SLOVAKIA`:
143
+ Slovakia
144
+ - `SLOVENIA`:
145
+ Slovenia
146
+ - `SPAIN`:
147
+ Spain
148
+ - `SWEDEN`:
149
+ Sweden
150
+ - `SWITZERLAND`:
151
+ Switzerland
152
+ */
153
+ export type IssuingCountry = "AUSTRIA" | "BELGIUM" | "BULGARIA" | "CROATIA" | "CYPRUS" | "CZECH_REPUBLIC" | "DENMARK" | "ESTONIA" | "FINLAND" | "FRANCE" | "GERMANY" | "GREECE" | "HUNGARY" | "IRELAND" | "ITALY" | "LATVIA" | "LITHUANIA" | "LUXEMBOURG" | "MALTA" | "NETHERLANDS" | "POLAND" | "PORTUGAL" | "ROMANIA" | "SLOVAKIA" | "SLOVENIA" | "SPAIN" | "SWEDEN" | "SWITZERLAND";
154
+ /**
155
+ Parameters for frame accumulation
156
+ */
157
+ export declare class RecognizerParameters extends PartiallyConstructible {
158
+ /**
159
+ List of allowed countries for the EHIC. If:
160
+ - single country: validation rules for the given country are used starting from the first
161
+ frame. If the country cannot be inferred or the inferred country doesn't
162
+ match the given country, the result of recognize() will be IncompleteValidation.
163
+ - multiple countries: the country is inferred from the card number first.
164
+ Until the country is detected, the document fields are not OCR'd and
165
+ accumulated. Once the country is inferred, the field accumulation starts
166
+ and the inferred country validation rules are applied.
167
+ If the country cannot be inferred or the inferred country doesn't match
168
+ any of the countries in the list, the result status will be IncompleteValidation.
169
+ - empty list: same as "multiple countries" with one additional detail.
170
+
171
+ If the country cannot be inferred within `maxCountryDetectionAttempts` successive frames in which the
172
+ part of the card number that stores the country code was successfully OCR'd, then the country is
173
+ inferred to be Unknown and no validation rules are applied. Field accumulation then proceeds normally.
174
+ In this case recognize() can eventually return Success and the document will have a CountryType of Unknown
175
+ @defaultValue [];
176
+ */
177
+ readonly allowedCountries: IssuingCountry[];
178
+ /**
179
+ Minimum year of birth
180
+ @defaultValue 0;
181
+ */
182
+ readonly minBirthYear: number;
183
+ /**
184
+ Maximum year of birth
185
+ @defaultValue 2999;
186
+ */
187
+ readonly maxBirthYear: number;
188
+ /**
189
+ Minimum card expiration year
190
+ @defaultValue 0;
191
+ */
192
+ readonly minExpirationYear: number;
193
+ /**
194
+ Maximum card expiration year
195
+ @defaultValue 2999;
196
+ */
197
+ readonly maxExpirationYear: number;
198
+ /**
199
+ Maximum number of attempts before giving up on country detection. After the specified number of
200
+ attempts, the country field is considered to be unknown and validation is skipped.
201
+ This option is ignored if allowedCountries is not empty.
202
+ @defaultValue 5;
203
+ */
204
+ readonly maxCountryDetectionAttempts: number;
205
+ /**
206
+ Minimum number of accumulated frames that should have equal result for a field.
207
+ Once satisfied, the corresponding field is considered to be successfully-recognized and won't be considered in the subsequent frames.
208
+ @defaultValue 4;
209
+ */
210
+ readonly minEqualFrameCount: number;
211
+ /**
212
+ Maximum number of partial frame results to keep in cache while waiting to gather minEqualFrameCount equal results
213
+ @defaultValue 10;
214
+ */
215
+ readonly maxAccumulatedFrameCount: number;
216
+ /** @param source {@displayType `DeepPartial<RecognizerParameters>`} */
217
+ constructor(source?: DeepPartial<RecognizerParameters>);
218
+ }
@@ -0,0 +1,18 @@
1
+ import { DeepPartial, PartiallyConstructible } from "../common";
2
+ /**
3
+ Configure the frame accumulation process
4
+ */
5
+ export declare class AccumulatedResultsVerifierConfig extends PartiallyConstructible {
6
+ /**
7
+ Maximum number of accumulated frames to inspect to verify a scan result
8
+ @defaultValue 3;
9
+ */
10
+ maximumNumberOfAccumulatedFrames: number;
11
+ /**
12
+ Minimum number of accumulated frames that have an equal result in order for the result to be considered verified
13
+ @defaultValue 2;
14
+ */
15
+ minimumNumberOfRequiredFramesWithEqualRecognitionResult: number;
16
+ /** @param source {@displayType `DeepPartial<AccumulatedResultsVerifierConfig>`} */
17
+ constructor(source?: DeepPartial<AccumulatedResultsVerifierConfig>);
18
+ }
@@ -0,0 +1,198 @@
1
+ import { CommonFieldType } from "./CommonFieldType";
2
+ import { DeepPartial, PartiallyConstructible } from "../common";
3
+ import { Point } from "../common";
4
+ import { RawImage } from "../common";
5
+ /**
6
+ Result of OCR text recognition.
7
+ */
8
+ export declare class OcrResult extends PartiallyConstructible {
9
+ /**
10
+ Maximum number of accumulated frames to inspect before actual result is returned.
11
+ */
12
+ readonly text: string;
13
+ /**
14
+ Minimum number of accumulated frames that have equal result.
15
+ */
16
+ readonly confidence: number;
17
+ /** @param source {@displayType `DeepPartial<OcrResult>`} */
18
+ constructor(source?: DeepPartial<OcrResult>);
19
+ }
20
+ /**
21
+ Field validation status.
22
+
23
+ Optical character recognition (OCR) invariably introduces errors in the recognized text.
24
+ There are numerous ways to verify that what has been recognized is, in fact, what was
25
+ written in the document.
26
+
27
+ The best way to validate the value of a field is for it to have a known format or validation
28
+ logic. For example, an IBAN number has a known format and two check digits that make it
29
+ very unlikely that a value with OCR errors will pass validation. Fields with known
30
+ validation rules will have a validation status of either VALID or INVALID.
31
+
32
+ Fields whose value can be inferred from other fields, or from domain knowledge (for example,
33
+ the field may have the same value in every instance of this type of document), will have the
34
+ status INFERRED. Inferring the value of a field is a strong validation method, provided that
35
+ there are no unexpected changes to the document format.
36
+
37
+ Fields that do not have validation rules and cannot be inferred can still be validated by checking whether the same
38
+ value is recognized from multiple attempts, e.g. across multiple frames of a camera stream.
39
+ If the same value is recognized in multiple frames, the value is considered CONFIRMED, otherwise
40
+ it will have the status NONE. This is the least strict validation method, as it does not protect
41
+ from systemic OCR errors, but in practice it still provides good results for most fields.
42
+
43
+
44
+ - `INVALID`:
45
+ Field value failed validation. This status is used for fields that have validation rules, like
46
+ IBAN, date fields, etc. that have check digits or a known format that can be validated.
47
+ - `NONE`:
48
+ Field value was not validated, typically because the field does not support validation and the value
49
+ has not been seen enough times to confirm it.
50
+ If the same value is seen in multiple frames, the validation status will transition to CONFIRMED,
51
+ but only if that particular recognizer supports multiple frame accumulation.
52
+ - `CONFIRMED`:
53
+ The same field value was recognized in multiple frames, thereby confirming the value.
54
+ Occurs only for fields that have no validation rules otherwise.
55
+ A CONFIRMED value gives a strong guarantee that the field value has been read out without errors,
56
+ but not as strong as VALID. The value may still be incorrect, due to systemic OCR errors.
57
+ In case of OCR errors, increase the number of frames needed to confirm the value in the
58
+ recognizer configuration
59
+ - `INFERRED`:
60
+ Field value was inferred from other fields or from domain knowledge.
61
+ The field value may differ from what is actually written in the document in unexpected situations.
62
+ - `VALID`:
63
+ Field value passed validation. This status is used for fields that have validation rules, like
64
+ IBAN, date fields, etc. that have check digits or a known format that can be validated.
65
+ The VALID status gives the strongest guarantee that the field value has been read out without errors.
66
+ - `IGNORED`:
67
+ The document contains a field of this type, but recognition for this field is disabled.
68
+ The value of this field is always empty, although the field may be non-empty in the document.
69
+ */
70
+ export type ValidationStatus = "INVALID" | "NONE" | "CONFIRMED" | "INFERRED" | "VALID" | "IGNORED";
71
+ /**
72
+ Generic Document Type
73
+ */
74
+ export declare class FieldType extends PartiallyConstructible {
75
+ /**
76
+ Local field type name scoped to the containing document type
77
+ */
78
+ readonly name: string;
79
+ /**
80
+ Unique global field type name prefixed with the document types of all containing documents
81
+ */
82
+ readonly fullName: string;
83
+ /**
84
+ Normalized global field type name. Fields in document types derived from the same base document type in the schema will have the same normalized name.
85
+ */
86
+ readonly normalizedName: string;
87
+ /**
88
+ Commonly occurring fields that have the same semantic meaning in different document types will often have a set common type.
89
+ */
90
+ readonly commonType: CommonFieldType | null;
91
+ /**
92
+ A document can contain multiple fields of the same name, the property serves for storing natural order of such fields, null if multiple entries aren't allowed for this field
93
+ @defaultValue null;
94
+ */
95
+ readonly listIndex: number | null;
96
+ /** @param source {@displayType `DeepPartial<FieldType>`} */
97
+ constructor(source?: DeepPartial<FieldType>);
98
+ }
99
+ /**
100
+ Generic document field
101
+ */
102
+ export declare class Field extends PartiallyConstructible {
103
+ /**
104
+ The type of the field.
105
+ */
106
+ readonly type: FieldType;
107
+ /**
108
+ Value of the field. Applicable only to text fields.
109
+ */
110
+ readonly value: OcrResult | null;
111
+ /**
112
+ Confidence weight
113
+ @defaultValue 1.0;
114
+ */
115
+ readonly confidenceWeight: number;
116
+ /**
117
+ Crop of the field
118
+ @defaultValue null;
119
+ */
120
+ readonly image: RawImage | null;
121
+ /**
122
+ Coordinates of the field in the root document coordinate system
123
+ */
124
+ readonly polygonInRoot: Point[];
125
+ /**
126
+ Field validation status. Applicable only to fields that support some kind of validation.
127
+ @defaultValue "NONE";
128
+ */
129
+ readonly validationStatus: ValidationStatus;
130
+ /** @param source {@displayType `DeepPartial<Field>`} */
131
+ constructor(source?: DeepPartial<Field>);
132
+ }
133
+ /**
134
+ Generic Document Type
135
+ */
136
+ export declare class GenericDocumentType extends PartiallyConstructible {
137
+ /**
138
+ Local document type name
139
+ */
140
+ readonly name: string;
141
+ /**
142
+ Unique global document type name prefixed with the document types of all containing documents
143
+ */
144
+ readonly fullName: string;
145
+ /**
146
+ Normalized global document type name. Common document types appearing as child documents in different places will often have the same normalized type name.
147
+ */
148
+ readonly normalizedName: string;
149
+ /**
150
+ A document can contain multiple fields of the same name, the property serves for storing natural order of such fields, null if multiple entries aren't allowed for this field
151
+ @defaultValue null;
152
+ */
153
+ readonly listIndex: number | null;
154
+ /** @param source {@displayType `DeepPartial<GenericDocumentType>`} */
155
+ constructor(source?: DeepPartial<GenericDocumentType>);
156
+ }
157
+ /**
158
+ Generic document
159
+ */
160
+ export declare class GenericDocument extends PartiallyConstructible {
161
+ /**
162
+ Document type
163
+ */
164
+ readonly type: GenericDocumentType;
165
+ /**
166
+ List of document fields
167
+ */
168
+ readonly fields: Field[];
169
+ /**
170
+ List of document sub-documents
171
+ */
172
+ readonly children: GenericDocument[];
173
+ /**
174
+ Coordinates of the document in the parent document coordinate system
175
+ */
176
+ readonly quad: Point[] | null;
177
+ /**
178
+ Coordinates of the document in the root document coordinate system
179
+ */
180
+ readonly quadInRoot: Point[] | null;
181
+ /**
182
+ Image crop of the document
183
+ @defaultValue null;
184
+ */
185
+ readonly crop: RawImage | null;
186
+ /**
187
+ The average confidence in the accuracy of the document recognition result
188
+ @defaultValue 0.0;
189
+ */
190
+ readonly confidence: number;
191
+ /**
192
+ The weight of the confidence. Can be used to calculate the weighted average confidence of two documents.
193
+ @defaultValue 0.0;
194
+ */
195
+ readonly confidenceWeight: number;
196
+ /** @param source {@displayType `DeepPartial<GenericDocument>`} */
197
+ constructor(source?: DeepPartial<GenericDocument>);
198
+ }
@@ -0,0 +1,104 @@
1
+ import { DeepPartial, PartiallyConstructible } from "../common";
2
+ import { GenericDocument } from "./GenericDocument";
3
+ import { Point } from "../common";
4
+ /**
5
+ The status of the recognition process
6
+
7
+ - `SUCCESS`:
8
+ The document was recognized successfully
9
+ - `ERROR_NOTHING_FOUND`:
10
+ No document was detected
11
+ - `ERROR_BAD_CROP`:
12
+ A document was detected, but it was at an angle/distance that was too large
13
+ - `ERROR_UNKNOWN_DOCUMENT`:
14
+ A document was detected, but it was not recognized as a supported document
15
+ - `ERROR_UNACCEPTABLE_DOCUMENT`:
16
+ A document was detected as a supported document, but it was not part of the accepted documents
17
+ - `INCOMPLETE_VALIDATION`:
18
+ All fields were recognized, but some of them failed validation
19
+ */
20
+ export type RecognitionStatus = "SUCCESS" | "ERROR_NOTHING_FOUND" | "ERROR_BAD_CROP" | "ERROR_UNKNOWN_DOCUMENT" | "ERROR_UNACCEPTABLE_DOCUMENT" | "INCOMPLETE_VALIDATION";
21
+ /**
22
+ Contains the result of running the generic document recognizer
23
+ */
24
+ export declare class RecognitionResult extends PartiallyConstructible {
25
+ /**
26
+ The status of the recognition process
27
+ */
28
+ readonly status: RecognitionStatus;
29
+ /**
30
+ The recognized document
31
+ */
32
+ readonly document: GenericDocument | null;
33
+ /**
34
+ Coordinates of the detected document in the input image (clockwise from top-left)
35
+ */
36
+ readonly quad: Point[] | null;
37
+ /** @param source {@displayType `DeepPartial<RecognitionResult>`} */
38
+ constructor(source?: DeepPartial<RecognitionResult>);
39
+ }
40
+ /**
41
+ The recognition mode
42
+
43
+ - `LIVE`:
44
+ The recognizer will attempt to accumulate results over multiple frames.
45
+ - `SINGLE_SHOT`:
46
+ The recognizer will only use the current frame and will spend additional time to ensure the best possible result.
47
+ */
48
+ export type RecognitionMode = "LIVE" | "SINGLE_SHOT";
49
+ /**
50
+ Parameters for the recognition process
51
+ */
52
+ export declare class RecognitionParameters extends PartiallyConstructible {
53
+ /**
54
+ The recognition mode
55
+ @defaultValue "LIVE";
56
+ */
57
+ mode: RecognitionMode;
58
+ /** @param source {@displayType `DeepPartial<RecognitionParameters>`} */
59
+ constructor(source?: DeepPartial<RecognitionParameters>);
60
+ }
61
+ /**
62
+ Configuration for how to accumulate results
63
+ */
64
+ export declare class ResultAccumulationConfig extends PartiallyConstructible {
65
+ /**
66
+ Number of identical results required to consider a field confirmed
67
+ @defaultValue 3;
68
+ */
69
+ minConfirmations: number;
70
+ /**
71
+ Minimum confidence required to consider a field confirmed
72
+ @defaultValue 0.8;
73
+ */
74
+ minConfidenceForStableField: number;
75
+ /**
76
+ Will auto-clear the cache if this number of frames have been a different document type or empty
77
+ @defaultValue 4;
78
+ */
79
+ autoClearThreshold: number;
80
+ /** @param source {@displayType `DeepPartial<ResultAccumulationConfig>`} */
81
+ constructor(source?: DeepPartial<ResultAccumulationConfig>);
82
+ }
83
+ /**
84
+ Configuration for the generic document recognizer
85
+ */
86
+ export declare class GenericDocumentRecognizerConfig extends PartiallyConstructible {
87
+ /**
88
+ Configuration for how to accumulate results
89
+ @defaultValue new ResultAccumulationConfig({});
90
+ */
91
+ resultAccumulationConfig: ResultAccumulationConfig;
92
+ /**
93
+ Normalized names of the fields to exclude from the result
94
+ @defaultValue [];
95
+ */
96
+ fieldExcludeList: string[];
97
+ /**
98
+ Names of documents that should be recognized
99
+ @defaultValue [];
100
+ */
101
+ acceptedDocumentTypes: string[];
102
+ /** @param source {@displayType `DeepPartial<GenericDocumentRecognizerConfig>`} */
103
+ constructor(source?: DeepPartial<GenericDocumentRecognizerConfig>);
104
+ }