@regulaforensics/vp-frontend-document-components 2.6.1 → 7.2.1573-stage

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
@@ -16,6 +16,7 @@
16
16
  * [Event Generation Logic](#event-generation-logic)
17
17
  * [Event Response](#event-response)
18
18
  * [Settings and Attributes](#settings-and-attributes)
19
+ * [Backend reprocessing](#backend-reprocessing)
19
20
  * [Appearance Customization](#appearance-customization)
20
21
  * [Font and Colors](#font-and-colors)
21
22
  * [Localized Messages](#localized-messages)
@@ -65,6 +66,7 @@ Current document acts as a quick start guide for operating Document Reader Web C
65
66
 
66
67
  Important notes:
67
68
 
69
+ * **Never** keep the license in **production** environment. On production environments, the <a href="https://docs.regulaforensics.com/develop/doc-reader-sdk/overview/licensing">domain name licensing</a> method must be used. Using the license in the source code of your project is applicable only in development and for testing.
68
70
  * Document Reader Web Components and their methods strictly require the secure contexts, so using **HTTPS** protocol is a must.
69
71
  * The considered components are registered on the **web page itself**, so make sure to import the library to your website before adding any of the components to the web page code.
70
72
  * Only the modern browser versions are supported, see [compatibility](#compatibility). **Polyfills** are not included in the package by default.
@@ -116,7 +118,7 @@ window.RegulaDocumentSDK = new DocumentReaderService();
116
118
  ```
117
119
  **2.** Define the components and initialize the service:
118
120
 
119
- On **production environment** (with preinstalled license file):
121
+ On **production environment** (the <a href="https://docs.regulaforensics.com/develop/doc-reader-sdk/overview/licensing">domain name licensing</a> is used):
120
122
 
121
123
  ```javascript
122
124
  defineComponents().then(() => window.RegulaDocumentSDK.initialize());
@@ -182,7 +184,7 @@ window.RegulaDocumentSDK = new DocumentReaderService();
182
184
  ```
183
185
  **3.** Define the components and initialize the service.
184
186
 
185
- On **production environment** (with preinstalled license file):
187
+ On **production environment** (the <a href="https://docs.regulaforensics.com/develop/doc-reader-sdk/overview/licensing">domain name licensing</a> is used):
186
188
  ```javascript
187
189
  defineComponents().then(() => window.RegulaDocumentSDK.initialize());
188
190
  ```
@@ -278,6 +280,7 @@ After adding `DocumentReaderService` to the global variable, you can change the
278
280
  | **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` |
279
281
  | **parseBarcodes** | This option can be disabled to stop parsing after barcode is read. | boolean | `true` | `true`, `false` |
280
282
  | **splitNames** | When enabled, the Surname and GivenNames fields will be divided into ft_First_Name, ft_Second_Name, ft_Third_Name, ft_Fourth_Name, ft_Last_Name fields. | boolean | `false` | `true`, `false` |
283
+ | **backendProcessing** | When enabled, it prepares the processing result to be sent to the backend for re-processing. Use ```service.finalizePackage();``` after receiving the processing results to send them to the backend. | Object | {} | { serviceURL: 'URL', httpHeaders: { key1: 'header1', key2: 'header2', ... } } |
281
284
 
282
285
  **Attention!** If the `multipage-processing` or `internal-scenario` attributes are set, the corresponding `multipageProcessing` and `scenario` parameters' values are ignored.
283
286
 
@@ -1040,6 +1043,37 @@ See all component's settings and attributes in the following table.
1040
1043
  | **videoRecord** | | Sets the ability to record a video of the document scanning process. If set to true it records the entire process. You can also set the recording delay and recording duration. The video will be available in the component response. | boolean or object | `undefined` | `true`, `false`, `{ delay: number, duration: number }` | `document-reader` |
1041
1044
  | **videoCaptureMotionControl** | | Enables device shaking control. | boolean | `false` | `true`, `false` | `document-reader` |
1042
1045
 
1046
+ ### Backend reprocessing
1047
+
1048
+ You can send the results to the backend for further processing:
1049
+
1050
+ **1.** Set `backendProcessing`, `serviceURL` and `httpHeaders` (optional) in processParam:
1051
+ ```javascript
1052
+ window.RegulaDocumentSDK.recognizerProcessParam = {
1053
+ processParam: {
1054
+ backendProcessing: true,
1055
+ serviceURL: 'YOUR_SERVICE_URL',
1056
+ httpHeaders: { // you can set http headers if necessary
1057
+ key1: 'header1',
1058
+ key2: 'header2',
1059
+ key3: 'header3'
1060
+ }
1061
+ },
1062
+ };
1063
+ ```
1064
+ **2.** Send the data to the backend after receiving the processing results:
1065
+ ```javascript
1066
+ const component = document.querySelector('document-reader');
1067
+
1068
+ function listener(event) {
1069
+ if (event.detail.action === 'PROCESS_FINISHED' && event.detail.data.status === 1) {
1070
+ window.RegulaDocumentSDK.finalizePackage();
1071
+ }
1072
+ }
1073
+
1074
+ component.addEventListener('document-reader', listener);
1075
+ ```
1076
+
1043
1077
  ### Appearance Customization
1044
1078
 
1045
1079
  #### Font and Colors
@@ -1125,7 +1159,6 @@ See the following table with localized labels, used in the components.
1125
1159
  | **timeout** | Timeout | `document-reader` |
1126
1160
  | **processing** | Processing... | `document-reader` |
1127
1161
  | **preparingService** | Preparing the service... | `document-reader` |
1128
- | **detectingDocument** | Detecting a document... | `document-reader` |
1129
1162
  | **placeDocumentIntoFrame** | Fit the document into the frame | `document-reader` |
1130
1163
  | **noFocus** | No camera focus | `document-reader` |
1131
1164
  | **moveCloser** | Move closer | `document-reader` |
@@ -1193,11 +1226,13 @@ try {
1193
1226
  ```
1194
1227
 
1195
1228
  In the preceding example, the `DocumentReaderProcessor` object is created using the HTML element with the ID `yourVideoElement`.
1196
- After that, `processor` needs to be initialized with the license. There are two licensing variants:
1229
+ After that, `processor` needs to be initialized. There are two licensing variants:
1197
1230
 
1198
- **1.** License file (for **production** environment).
1231
+ **1.** <a href="https://docs.regulaforensics.com/develop/doc-reader-sdk/overview/licensing">Domain name licensing</a> (for **production** environment).
1199
1232
 
1200
- Get Regula license file, put it into the specific directory, and then asynchronously call the `initialize` method without parameters:
1233
+ To get your website domain licensed, <a href="https://explore.regula.app/docs-support-request" target="_blank">contact our sales team</a>.
1234
+
1235
+ Then asynchronously call the `initialize` method without parameters:
1201
1236
  ```javascript
1202
1237
  await processor.initialize();
1203
1238
  ```
@@ -1255,9 +1290,11 @@ For example:
1255
1290
  In the preceding example, the `DocumentReaderProcessor` object is created using the HTML element with ID `yourVideoElement`.
1256
1291
  After that, `processor` needs to be initialized with the license. There are two licensing variants:
1257
1292
 
1258
- **1.** License file (for **production** environment).
1293
+ **1.** <a href="https://docs.regulaforensics.com/develop/doc-reader-sdk/overview/licensing">Domain name licensing</a> (for **production** environment).
1294
+
1295
+ To get your website domain licensed, <a href="https://explore.regula.app/docs-support-request" target="_blank">contact our sales team</a>.
1259
1296
 
1260
- You need to get Regula license file, put it into the specific directory, and then asynchronously call `initialize` method without parameters:
1297
+ Then asynchronously call the `initialize` method without parameters:
1261
1298
  ```javascript
1262
1299
  await processor.initialize();
1263
1300
  ```
@@ -1278,7 +1315,7 @@ For more information about licensing, see the <a href="https://docs.regulaforens
1278
1315
 
1279
1316
  Initializes the DocumentReaderProcessor object. Accepts an object with a Base64 encoded license string.
1280
1317
 
1281
- **Note:** Base64 license string is applied only to test environments, production mode must use the binary license file.
1318
+ **Note:** Base64 license string is applied only to test environments, production mode must use the <a href="https://docs.regulaforensics.com/develop/doc-reader-sdk/overview/licensing">domain name licensing</a>.
1282
1319
 
1283
1320
  ```javascript
1284
1321
  await processor.initialize({ license: 'BASE64_LICENSE_KEY' });