@regulaforensics/vp-frontend-document-components 7.2.1738-nightly → 7.2.1740-nightly
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -38
- package/dist/index.d.ts +2 -0
- package/dist/main.iife.js +23 -21
- package/dist/main.js +9814 -8756
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -105,9 +105,20 @@ defineComponents();
|
|
|
105
105
|
|
|
106
106
|
If you need the entire scope of functionality:
|
|
107
107
|
|
|
108
|
-
**1.** Add `DocumentReaderService` to the global variable `RegulaDocumentSDK
|
|
108
|
+
**1.** Add `DocumentReaderService` to the global variable `RegulaDocumentSDK` and set processing scenario:
|
|
109
109
|
```javascript
|
|
110
110
|
window.RegulaDocumentSDK = new DocumentReaderService();
|
|
111
|
+
|
|
112
|
+
window.RegulaDocumentSDK.recognizerProcessParam = {
|
|
113
|
+
processParam: {
|
|
114
|
+
scenario: 'MrzAndLocate',
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
window.RegulaDocumentSDK.imageProcessParam = {
|
|
118
|
+
processParam: {
|
|
119
|
+
scenario: 'MrzAndLocate',
|
|
120
|
+
},
|
|
121
|
+
};
|
|
111
122
|
```
|
|
112
123
|
**2.** Define the components and initialize the service:
|
|
113
124
|
|
|
@@ -166,9 +177,20 @@ If you need the entire scope of functionality:
|
|
|
166
177
|
```javascript
|
|
167
178
|
const { defineComponents, DocumentReaderService } = window.Regula;
|
|
168
179
|
```
|
|
169
|
-
**2.** Add `DocumentReaderService` to the global variable `RegulaDocumentSDK
|
|
180
|
+
**2.** Add `DocumentReaderService` to the global variable `RegulaDocumentSDK` and set processing scenario:
|
|
170
181
|
```javascript
|
|
171
182
|
window.RegulaDocumentSDK = new DocumentReaderService();
|
|
183
|
+
|
|
184
|
+
window.RegulaDocumentSDK.recognizerProcessParam = {
|
|
185
|
+
processParam: {
|
|
186
|
+
scenario: 'MrzAndLocate',
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
window.RegulaDocumentSDK.imageProcessParam = {
|
|
190
|
+
processParam: {
|
|
191
|
+
scenario: 'MrzAndLocate',
|
|
192
|
+
},
|
|
193
|
+
};
|
|
172
194
|
```
|
|
173
195
|
**3.** Define the components and initialize the service.
|
|
174
196
|
|
|
@@ -194,7 +216,6 @@ After adding `DocumentReaderService` to the global variable, you can change the
|
|
|
194
216
|
window.RegulaDocumentSDK.recognizerProcessParam = {
|
|
195
217
|
processParam: {
|
|
196
218
|
returnUncroppedImage: true,
|
|
197
|
-
scenario: 'MrzAndLocate',
|
|
198
219
|
multipageProcessing: false,
|
|
199
220
|
returnPackageForReprocess: false,
|
|
200
221
|
timeout: 20000,
|
|
@@ -216,7 +237,6 @@ After adding `DocumentReaderService` to the global variable, you can change the
|
|
|
216
237
|
```javascript
|
|
217
238
|
window.RegulaDocumentSDK.imageProcessParam = {
|
|
218
239
|
processParam: {
|
|
219
|
-
scenario: 'MrzAndLocate',
|
|
220
240
|
returnUncroppedImage: true,
|
|
221
241
|
returnPackageForReprocess: false,
|
|
222
242
|
},
|
|
@@ -381,6 +401,7 @@ Available fields of `event.detail.data` object:
|
|
|
381
401
|
| `FILE_SIZE` | The file size is too large |
|
|
382
402
|
| `INCORRECT_FILE` | Problems with reading the file |
|
|
383
403
|
| `INCORRECT_SCENARIO` | Scenario is not supported |
|
|
404
|
+
| `MISSING_SCENARIO` | Scenario is missing |
|
|
384
405
|
| `UNKNOWN_ERROR` | Unknown error |
|
|
385
406
|
| `NOT_SUPPORTED` | The browser is not supported |
|
|
386
407
|
| `CAMERA_UNKNOWN_ERROR` | Unknown camera error |
|
|
@@ -862,20 +883,20 @@ There are two ways to define the element's settings: using the `settings` proper
|
|
|
862
883
|
See the description and examples below.
|
|
863
884
|
|
|
864
885
|
* Using `settings` property to configure element:
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
886
|
+
```javascript
|
|
887
|
+
const element = document.createElement('document-reader');
|
|
888
|
+
|
|
889
|
+
element.settings = {
|
|
890
|
+
startScreen: true,
|
|
891
|
+
internalScenario: 'Locate',
|
|
892
|
+
multipageProcessing: true,
|
|
893
|
+
};
|
|
894
|
+
```
|
|
874
895
|
|
|
875
896
|
* Using attributes to configure element:
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
897
|
+
```javascript
|
|
898
|
+
<document-reader start-screen internal-scenario="Locate"></document-reader>
|
|
899
|
+
```
|
|
879
900
|
|
|
880
901
|
We **recommend** using the `settings` property of the element to configure its parameters.
|
|
881
902
|
This method gives more flexibility in setup, in addition, all new parameters in the future will be available **only** as the settings of the object (not as HTML attributes).
|
|
@@ -1083,6 +1104,17 @@ import { DocumentReaderProcessor } from '/node_modules/@regulaforensics/vp-front
|
|
|
1083
1104
|
const videoElement = document.getElementById('yourVideoElement');
|
|
1084
1105
|
const processor = new DocumentReaderProcessor(videoElement);
|
|
1085
1106
|
|
|
1107
|
+
processor.recognizerProcessParam = {
|
|
1108
|
+
processParam: {
|
|
1109
|
+
scenario: 'MrzAndLocate',
|
|
1110
|
+
},
|
|
1111
|
+
};
|
|
1112
|
+
processor.imageProcessParam = {
|
|
1113
|
+
processParam: {
|
|
1114
|
+
scenario: 'MrzAndLocate',
|
|
1115
|
+
},
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1086
1118
|
try {
|
|
1087
1119
|
// Variant 1 - for production environment
|
|
1088
1120
|
await processor.initialize();
|
|
@@ -1140,26 +1172,37 @@ For example:
|
|
|
1140
1172
|
`DocumentReaderProcessor` is available in the global variable `window.Regula`. See the following example:
|
|
1141
1173
|
|
|
1142
1174
|
```javascript
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1175
|
+
const { DocumentReaderProcessor } = window.Regula;
|
|
1176
|
+
|
|
1177
|
+
const videoElement = document.getElementById('yourVideoElement');
|
|
1178
|
+
const processor = new DocumentReaderProcessor(videoElement);
|
|
1179
|
+
|
|
1180
|
+
processor.recognizerProcessParam = {
|
|
1181
|
+
processParam: {
|
|
1182
|
+
scenario: 'MrzAndLocate',
|
|
1183
|
+
},
|
|
1184
|
+
};
|
|
1185
|
+
processor.imageProcessParam = {
|
|
1186
|
+
processParam: {
|
|
1187
|
+
scenario: 'MrzAndLocate',
|
|
1188
|
+
},
|
|
1189
|
+
};
|
|
1190
|
+
|
|
1191
|
+
try {
|
|
1192
|
+
// Variant 1 - for production environment
|
|
1193
|
+
await processor.initialize();
|
|
1194
|
+
|
|
1195
|
+
// Variant 2 - for test-only environment
|
|
1196
|
+
// await processor.initialize({ license: 'BASE64_LICENSE_KEY' });
|
|
1197
|
+
|
|
1198
|
+
const result = await processor.startRecognition(); // Result of the document recognition will be located here.
|
|
1199
|
+
|
|
1200
|
+
processor.stopRecognition();
|
|
1201
|
+
|
|
1202
|
+
console.log(result);
|
|
1203
|
+
} catch (e) {
|
|
1204
|
+
console.log(e);
|
|
1205
|
+
}
|
|
1163
1206
|
```
|
|
1164
1207
|
|
|
1165
1208
|
In the preceding example, the `DocumentReaderProcessor` object is created using the HTML element with ID `yourVideoElement`.
|
|
@@ -1288,7 +1331,6 @@ The parameters for recognizing a document from the camera (by the `startRecognit
|
|
|
1288
1331
|
```javascript
|
|
1289
1332
|
processor.recognizerProcessParam = {
|
|
1290
1333
|
processParam: {
|
|
1291
|
-
scenario: 'MrzAndLocate',
|
|
1292
1334
|
returnUncroppedImage: true,
|
|
1293
1335
|
returnPackageForReprocess: false,
|
|
1294
1336
|
},
|
|
@@ -1306,7 +1348,6 @@ See the following example with several parameters and their default values:
|
|
|
1306
1348
|
// Default settings:
|
|
1307
1349
|
processor.imageProcessParam = {
|
|
1308
1350
|
processParam: {
|
|
1309
|
-
scenario: 'MrzAndLocate',
|
|
1310
1351
|
returnUncroppedImage: true,
|
|
1311
1352
|
returnPackageForReprocess: false,
|
|
1312
1353
|
},
|
package/dist/index.d.ts
CHANGED
|
@@ -224,6 +224,7 @@ export declare class DocumentReaderService {
|
|
|
224
224
|
private _prepareListener;
|
|
225
225
|
private _initializeListener;
|
|
226
226
|
private _processingListener;
|
|
227
|
+
private _queueService;
|
|
227
228
|
isAutoPrepare: boolean;
|
|
228
229
|
isPrepared: boolean;
|
|
229
230
|
isInitialized: boolean;
|
|
@@ -364,6 +365,7 @@ export declare enum ErrorTypes {
|
|
|
364
365
|
FILE_SIZE = "FILE_SIZE",
|
|
365
366
|
INCORRECT_FILE = "INCORRECT_FILE",
|
|
366
367
|
INCORRECT_SCENARIO = "INCORRECT_SCENARIO",
|
|
368
|
+
MISSING_SCENARIO = "MISSING_SCENARIO",
|
|
367
369
|
UNKNOWN_ERROR = "UNKNOWN_ERROR",
|
|
368
370
|
NOT_SUPPORTED = "NOT_SUPPORTED",
|
|
369
371
|
CAMERA_UNKNOWN_ERROR = "CAMERA_UNKNOWN_ERROR",
|