@regulaforensics/vp-frontend-document-components 7.3.1696-rc → 7.3.1755-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 CHANGED
@@ -93,7 +93,7 @@ import { defineComponents, DocumentReaderService } from '@regulaforensics/vp-fro
93
93
  ```
94
94
  Without module bundler:
95
95
  ```javascript
96
- import { defineComponents, DocumentReaderService } from './node_modules/@regulaforensics/vp-frontend-document-components/esm/main.js';
96
+ import { defineComponents, DocumentReaderService } from './node_modules/@regulaforensics/vp-frontend-document-components/dist/main.js';
97
97
  ```
98
98
 
99
99
  **Step 3.** Define the components, depending on the functionality that you need.
@@ -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
 
@@ -148,7 +159,7 @@ Use the CDN link in a format as follows: `unpkg.com/:package@:version/:file`
148
159
 
149
160
  For example:
150
161
  ```html
151
- <script src="https://unpkg.com/@regulaforensics/vp-frontend-document-components@latest/dist/main.js"></script>
162
+ <script src="https://unpkg.com/@regulaforensics/vp-frontend-document-components@latest/dist/main.iife.js"></script>
152
163
  ```
153
164
 
154
165
  **Note:** You can find all available script versions in the corresponding section of npm, using the same link from the previous example.
@@ -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
- ```javascript
866
- const element = document.createElement('document-reader');
867
-
868
- element.settings = {
869
- startScreen: true,
870
- internalScenario: 'Locate',
871
- multipageProcessing: true,
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
- ```javascript
877
- <document-reader start-screen internal-scenario="Locate"></document-reader>
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).
@@ -1074,7 +1095,7 @@ import { DocumentReaderProcessor } from '@regulaforensics/vp-frontend-document-c
1074
1095
 
1075
1096
  Without module bundler:
1076
1097
  ```javascript
1077
- import { DocumentReaderProcessor } from '/node_modules/@regulaforensics/vp-frontend-document-components/esm/main.js';
1098
+ import { DocumentReaderProcessor } from '/node_modules/@regulaforensics/vp-frontend-document-components/dist/main.js';
1078
1099
  ```
1079
1100
 
1080
1101
  **Step 3.** Add a video tag to the `.html` file, then prepare and initialize `DocumentReaderProcessor`.
@@ -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();
@@ -1130,7 +1162,7 @@ Use the CDN link in a format as follows: `unpkg.com/:package@:version/:file`
1130
1162
 
1131
1163
  For example:
1132
1164
  ```html
1133
- <script src="https://unpkg.com/@regulaforensics/vp-frontend-document-components@latest/dist/main.js"></script>
1165
+ <script src="https://unpkg.com/@regulaforensics/vp-frontend-document-components@latest/dist/main.iife.js"></script>
1134
1166
  ```
1135
1167
 
1136
1168
  **Note:** You can find all available script versions in the corresponding section of npm, using the same link from the previous example.
@@ -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
- const { DocumentReaderProcessor } = window.Regula;
1144
-
1145
- const videoElement = document.getElementById('yourVideoElement');
1146
- const processor = new DocumentReaderProcessor(videoElement);
1147
-
1148
- try {
1149
- // Variant 1 - for production environment
1150
- await processor.initialize();
1151
-
1152
- // Variant 2 - for test-only environment
1153
- // await processor.initialize({ license: 'BASE64_LICENSE_KEY' });
1154
-
1155
- const result = await processor.startRecognition(); // Result of the document recognition will be located here.
1156
-
1157
- processor.stopRecognition();
1158
-
1159
- console.log(result);
1160
- } catch (e) {
1161
- console.log(e);
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
  },