@regulaforensics/vp-frontend-document-components 7.2.1713-nightly → 7.2.1715-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 +67 -134
- package/dist/main.js +2 -22075
- package/dist/main.js.LICENSE.txt +41 -0
- package/esm/main.js +2 -0
- package/esm/main.js.LICENSE.txt +41 -0
- package/lib/index.d.ts +496 -0
- package/package.json +9 -17
- package/dist/index.d.ts +0 -609
- package/dist/main.iife.js +0 -103
- package/docs/document-reader-delegate-button.jpg +0 -0
- package/docs/document-reader-delegate-mode.jpg +0 -0
package/README.md
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
* [Event Response](#event-response)
|
|
18
18
|
* [Settings and Attributes](#settings-and-attributes)
|
|
19
19
|
* [Backend reprocessing](#backend-reprocessing)
|
|
20
|
-
* [Delegating scan to device with better camera](#delegating-scan-to-device-with-better-camera)
|
|
21
20
|
* [Appearance Customization](#appearance-customization)
|
|
22
21
|
* [Font and Colors](#font-and-colors)
|
|
23
22
|
* [Localized Messages](#localized-messages)
|
|
@@ -94,7 +93,7 @@ import { defineComponents, DocumentReaderService } from '@regulaforensics/vp-fro
|
|
|
94
93
|
```
|
|
95
94
|
Without module bundler:
|
|
96
95
|
```javascript
|
|
97
|
-
import { defineComponents, DocumentReaderService } from './node_modules/@regulaforensics/vp-frontend-document-components/
|
|
96
|
+
import { defineComponents, DocumentReaderService } from './node_modules/@regulaforensics/vp-frontend-document-components/esm/main.js';
|
|
98
97
|
```
|
|
99
98
|
|
|
100
99
|
**Step 3.** Define the components, depending on the functionality that you need.
|
|
@@ -149,7 +148,7 @@ Use the CDN link in a format as follows: `unpkg.com/:package@:version/:file`
|
|
|
149
148
|
|
|
150
149
|
For example:
|
|
151
150
|
```html
|
|
152
|
-
<script src="https://unpkg.com/@regulaforensics/vp-frontend-document-components@latest/dist/main.
|
|
151
|
+
<script src="https://unpkg.com/@regulaforensics/vp-frontend-document-components@latest/dist/main.js"></script>
|
|
153
152
|
```
|
|
154
153
|
|
|
155
154
|
**Note:** You can find all available script versions in the corresponding section of npm, using the same link from the previous example.
|
|
@@ -212,14 +211,7 @@ After adding `DocumentReaderService` to the global variable, you can change the
|
|
|
212
211
|
},
|
|
213
212
|
};
|
|
214
213
|
```
|
|
215
|
-
|
|
216
|
-
**Session ID** for video processing:
|
|
217
|
-
```javascript
|
|
218
|
-
window.RegulaDocumentSDK.recognizerProcessParam = {
|
|
219
|
-
tag: 'your session id',
|
|
220
|
-
};
|
|
221
|
-
```
|
|
222
|
-
|
|
214
|
+
|
|
223
215
|
**Image processing** default settings. The functionality is available via the gallery button.
|
|
224
216
|
```javascript
|
|
225
217
|
window.RegulaDocumentSDK.imageProcessParam = {
|
|
@@ -311,29 +303,26 @@ The fields of the `event.detail` object:
|
|
|
311
303
|
|
|
312
304
|
#### Action Types
|
|
313
305
|
|
|
314
|
-
| Type of action
|
|
315
|
-
|
|
316
|
-
| `ELEMENT_VISIBLE`
|
|
317
|
-
| `PRESS_CAMERA_BUTTON`
|
|
318
|
-
| `PRESS_FILE_BUTTON`
|
|
319
|
-
| `PRESS_RETRY_BUTTON`
|
|
320
|
-
| `PRESS_SKIP_BUTTON`
|
|
321
|
-
| `PRESS_CAPTURE_BUTTON`
|
|
322
|
-
| `PRESS_CHANGE_CAMERA_BUTTON`
|
|
323
|
-
| `PRESS_MIRRORING_BUTTON`
|
|
324
|
-
| `NEW_PAGE_AVAILABLE`
|
|
325
|
-
| `NEW_PAGE_STARTED`
|
|
326
|
-
| `CLOSE`
|
|
327
|
-
| `CAMERA_PROCESS_CLOSED`
|
|
328
|
-
| `CAMERA_PROCESS_STARTED`
|
|
329
|
-
| `VIDEO_STARTED`
|
|
330
|
-
| `VIDEO_STOPPED`
|
|
331
|
-
| `FILE_PROCESS_STARTED`
|
|
332
|
-
| `PROCESS_FINISHED`
|
|
333
|
-
| `SERVICE_INITIALIZED`
|
|
334
|
-
| `PRESS_REMOTE_DEVICE_BUTTON` | The "From other phone" button is pressed. | `document-reader` |
|
|
335
|
-
| `REMOTE_TRANSACTION_UPLOADED` | Remote transaction with current tag was uploaded | `document-reader` |
|
|
336
|
-
| `REMOTE_PROCESS_FINISHED` | Remote transaction with current tag was processed | `document-reader` |
|
|
306
|
+
| Type of action | Description of the action | Components and events, where present |
|
|
307
|
+
|:-----------------------------|:------------------------------------------------------------------|:------------------------------------:|
|
|
308
|
+
| `ELEMENT_VISIBLE` | Component is appended in the DOM. | `document-reader`, `camera-snapshot` |
|
|
309
|
+
| `PRESS_CAMERA_BUTTON` | The "From camera" button is pressed. | `document-reader`, `camera-snapshot` |
|
|
310
|
+
| `PRESS_FILE_BUTTON` | The "From gallery" button is pressed. | `document-reader`, `camera-snapshot` |
|
|
311
|
+
| `PRESS_RETRY_BUTTON` | The "Retry" button is pressed. | `document-reader`, `camera-snapshot` |
|
|
312
|
+
| `PRESS_SKIP_BUTTON` | The "Skip" button is pressed. | `document-reader` |
|
|
313
|
+
| `PRESS_CAPTURE_BUTTON` | The "Capture" button is pressed. | `document-reader`, `camera-snapshot` |
|
|
314
|
+
| `PRESS_CHANGE_CAMERA_BUTTON` | The "Change camera" button is pressed. | `document-reader`, `camera-snapshot` |
|
|
315
|
+
| `PRESS_MIRRORING_BUTTON` | The "Mirroring" button is pressed. | `document-reader`, `camera-snapshot` |
|
|
316
|
+
| `NEW_PAGE_AVAILABLE` | The document contains another page. | `document-reader` |
|
|
317
|
+
| `NEW_PAGE_STARTED` | Recognition of a new page has started. | `document-reader` |
|
|
318
|
+
| `CLOSE` | The "Close" button is pressed. | `document-reader`, `camera-snapshot` |
|
|
319
|
+
| `CAMERA_PROCESS_CLOSED` | The "Close" button is pressed on the document recognition screen. | `document-reader`, `camera-snapshot` |
|
|
320
|
+
| `CAMERA_PROCESS_STARTED` | Recognition from the camera has started. | `document-reader` |
|
|
321
|
+
| `VIDEO_STARTED` | Video stream started. | `document-reader`, `camera-snapshot` |
|
|
322
|
+
| `VIDEO_STOPPED` | Video stream stopped. | `document-reader`, `camera-snapshot` |
|
|
323
|
+
| `FILE_PROCESS_STARTED` | File processing has started. | `document-reader`, `camera-snapshot` |
|
|
324
|
+
| `PROCESS_FINISHED` | The component has finished its work. | `document-reader`, `camera-snapshot` |
|
|
325
|
+
| `SERVICE_INITIALIZED` | The component has started its work. | `document-reader` |
|
|
337
326
|
|
|
338
327
|
|
|
339
328
|
#### Action Data
|
|
@@ -400,21 +389,6 @@ Available fields of `event.detail.data` object:
|
|
|
400
389
|
| `INCORRECT_CAMERA_ID` | Camera with this ID was not found |
|
|
401
390
|
| `CONNECTION_ERROR` | Connection errors |
|
|
402
391
|
|
|
403
|
-
#### Remote action data
|
|
404
|
-
|
|
405
|
-
**1.** In case of remote scan scenario REMOTE_TRANSACTION_UPLOADED `event.detail` will contain the following data:
|
|
406
|
-
```javascript
|
|
407
|
-
{
|
|
408
|
-
action: EventActions.REMOTE_TRANSACTION_UPLOADED,
|
|
409
|
-
data: {
|
|
410
|
-
id: 1,
|
|
411
|
-
state: 1,
|
|
412
|
-
updatedAt: 'dateStr'
|
|
413
|
-
},
|
|
414
|
-
}
|
|
415
|
-
```
|
|
416
|
-
Transaction id can be used to trigger reprocessing.
|
|
417
|
-
|
|
418
392
|
#### Event Generation Logic
|
|
419
393
|
|
|
420
394
|
The cases of event generation are described in the following table.
|
|
@@ -980,46 +954,6 @@ function listener(event) {
|
|
|
980
954
|
|
|
981
955
|
component.addEventListener('document-reader', listener);
|
|
982
956
|
```
|
|
983
|
-
### Delegating scan to device with better camera
|
|
984
|
-
|
|
985
|
-
For cases when user's main device lacks camera or does not succeed to scan with given camera quality,
|
|
986
|
-
you have an option to delegate scanning to another available device (i.e. phone).
|
|
987
|
-
|
|
988
|
-
#### 1. "From other phone" action may be configured on the start screen:
|
|
989
|
-
- configure [backend reprocessing](#backend-reprocessing)
|
|
990
|
-
- add 'delegateURL' and 'tag':
|
|
991
|
-
```javascript
|
|
992
|
-
processor.recognizerProcessParam = {
|
|
993
|
-
delegateURL: 'https://your-page.com?tag={tag}', // the page which will be used by other device
|
|
994
|
-
tag: 123 // your session id, will be added to delegateURL in place of {tag} substring
|
|
995
|
-
}
|
|
996
|
-
```
|
|
997
|
-
- these settings will unlock "From other phone" option
|
|
998
|
-
|
|
999
|
-

|
|
1000
|
-
|
|
1001
|
-
that shows the user QR Code with url (i.e. `https://your-page.com?tag=123`)
|
|
1002
|
-
|
|
1003
|
-

|
|
1004
|
-
- the component will emit **REMOTE_TRANSACTION_UPLOADED** event with the most recent transaction uploaded with your session tag.
|
|
1005
|
-
Transaction id may be used to trigger full process backend reprocessing (i.e use [Document Reader Webclient](https://www.npmjs.com/package/@regulaforensics/document-reader-webclient))
|
|
1006
|
-
- the component will emit **REMOTE_PROCESS_FINISHED** event with a result of the most recent processed transaction.
|
|
1007
|
-
It is similar to **PROCESS_FINISHED** event but may contain more data due to backend reprocessing
|
|
1008
|
-
|
|
1009
|
-
#### 2. Configure Delegate page component on delegateURL:
|
|
1010
|
-
- configure [backend reprocessing](#backend-reprocessing)
|
|
1011
|
-
- use the same tag as on the main page
|
|
1012
|
-
```javascript
|
|
1013
|
-
window.RegulaDocumentSDK.recognizerProcessParam = {
|
|
1014
|
-
tag: 123 // your session id, i.e. it can be extracted from your delegate page URL
|
|
1015
|
-
};
|
|
1016
|
-
|
|
1017
|
-
element.settings = {
|
|
1018
|
-
startScreen: false, // From camera recognition is expected
|
|
1019
|
-
}
|
|
1020
|
-
```
|
|
1021
|
-
- use finalizePackage() to send the data for further reprocessing
|
|
1022
|
-
|
|
1023
957
|
|
|
1024
958
|
### Appearance Customization
|
|
1025
959
|
|
|
@@ -1077,49 +1011,48 @@ body.append(element);
|
|
|
1077
1011
|
|
|
1078
1012
|
See the following table with localized labels, used in the components.
|
|
1079
1013
|
|
|
1080
|
-
| Label
|
|
1081
|
-
|
|
1082
|
-
| **success**
|
|
1083
|
-
| **fileCorrupt**
|
|
1084
|
-
| **selectAnotherFile**
|
|
1085
|
-
| **error**
|
|
1086
|
-
| **somethingWentWrong**
|
|
1087
|
-
| **tryAgain**
|
|
1088
|
-
| **fromCamera**
|
|
1089
|
-
| **fromGallery**
|
|
1090
|
-
| **
|
|
1091
|
-
| **
|
|
1092
|
-
| **
|
|
1093
|
-
| **
|
|
1094
|
-
| **
|
|
1095
|
-
| **
|
|
1096
|
-
| **
|
|
1097
|
-
| **
|
|
1098
|
-
| **
|
|
1099
|
-
| **
|
|
1100
|
-
| **
|
|
1101
|
-
| **
|
|
1102
|
-
| **
|
|
1103
|
-
| **
|
|
1104
|
-
| **
|
|
1105
|
-
| **
|
|
1106
|
-
| **
|
|
1107
|
-
| **
|
|
1108
|
-
| **
|
|
1109
|
-
| **
|
|
1110
|
-
| **
|
|
1111
|
-
| **
|
|
1112
|
-
| **
|
|
1113
|
-
| **
|
|
1114
|
-
| **
|
|
1115
|
-
| **
|
|
1116
|
-
| **
|
|
1117
|
-
| **
|
|
1118
|
-
| **
|
|
1119
|
-
| **
|
|
1120
|
-
| **
|
|
1121
|
-
| **
|
|
1122
|
-
| **useCameraOrGallery** | Use your device camera or select a photo from the gallery | `camera-snapshot` |
|
|
1014
|
+
| Label | Default message in `en` locale | Used in |
|
|
1015
|
+
|:------------------------------|:---------------------------------------------------------------------------------------------|:------------------------------------:|
|
|
1016
|
+
| **success** | Success! | `document-reader`, `camera-snapshot` |
|
|
1017
|
+
| **fileCorrupt** | This file is corrupt or not supported | `document-reader`, `camera-snapshot` |
|
|
1018
|
+
| **selectAnotherFile** | Please select another file | `document-reader`, `camera-snapshot` |
|
|
1019
|
+
| **error** | Error! | `document-reader`, `camera-snapshot` |
|
|
1020
|
+
| **somethingWentWrong** | Something went wrong | `document-reader`, `camera-snapshot` |
|
|
1021
|
+
| **tryAgain** | Try again | `document-reader`, `camera-snapshot` |
|
|
1022
|
+
| **fromCamera** | From camera | `document-reader`, `camera-snapshot` |
|
|
1023
|
+
| **fromGallery** | From gallery | `document-reader`, `camera-snapshot` |
|
|
1024
|
+
| **cameraUnavailable** | Camera unavailable! | `document-reader`, `camera-snapshot` |
|
|
1025
|
+
| **preparingCamera** | Preparing the camera... | `document-reader`, `camera-snapshot` |
|
|
1026
|
+
| **noCameraAvailable** | No camera available | `document-reader`, `camera-snapshot` |
|
|
1027
|
+
| **incorrectCameraId** | No camera with the specified ID found. | `document-reader`, `camera-snapshot` |
|
|
1028
|
+
| **allowAccessToCamera** | Allow access to the camera and reload this page to continue. | `document-reader`, `camera-snapshot` |
|
|
1029
|
+
| **cameraConnection** | Make sure the camera is connected correctly. | `document-reader`, `camera-snapshot` |
|
|
1030
|
+
| **checkCameraId** | Check if the specified camera ID is correct. | `document-reader`, `camera-snapshot` |
|
|
1031
|
+
| **scanIDInBrowser** | Scan an ID in your browser | `document-reader` |
|
|
1032
|
+
| **useYourDeviceCamera** | Use your device camera to scan a document or select a photo of the document from the gallery | `document-reader` |
|
|
1033
|
+
| **processingFinished** | Processing finished. | `document-reader` |
|
|
1034
|
+
| **largeFile** | This file is too large to be uploaded | `document-reader` |
|
|
1035
|
+
| **selectSmallerFile** | Please select a smaller file | `document-reader` |
|
|
1036
|
+
| **versionNotSupported** | Your browser version is not supported | `document-reader` |
|
|
1037
|
+
| **updateBrowser** | Update your browser version | `document-reader` |
|
|
1038
|
+
| **licenseError** | A license error has occurred | `document-reader` |
|
|
1039
|
+
| **licenseExpired** | The license cannot be found or has expired | `document-reader` |
|
|
1040
|
+
| **timeout** | Timeout | `document-reader` |
|
|
1041
|
+
| **processing** | Processing... | `document-reader` |
|
|
1042
|
+
| **preparingService** | Preparing the service... | `document-reader` |
|
|
1043
|
+
| **placeDocumentIntoFrame** | Fit the document into the frame | `document-reader` |
|
|
1044
|
+
| **noFocus** | No camera focus | `document-reader` |
|
|
1045
|
+
| **moveCloser** | Move closer | `document-reader` |
|
|
1046
|
+
| **glaresOnDocument** | Avoid glare on the document | `document-reader` |
|
|
1047
|
+
| **holdDocumentStraight** | Hold the document straight | `document-reader` |
|
|
1048
|
+
| **documentProcessing** | Document processing... | `document-reader` |
|
|
1049
|
+
| **flipDocument** | Flip the document | `document-reader` |
|
|
1050
|
+
| **verified** | Verified! | `document-reader` |
|
|
1051
|
+
| **keepDeviceStill** | Hold the device still | `document-reader` |
|
|
1052
|
+
| **positionDocumentCenter** | Position the document in the center | `camera-snapshot` |
|
|
1053
|
+
| **photoCapturedSuccessfully** | The photo is captured successfully. | `camera-snapshot` |
|
|
1054
|
+
| **uploadPhoto** | Upload a photo | `camera-snapshot` |
|
|
1055
|
+
| **useCameraOrGallery** | Use your device camera or select a photo from the gallery | `camera-snapshot` |
|
|
1123
1056
|
|
|
1124
1057
|
## Document Reader Processor
|
|
1125
1058
|
|
|
@@ -1141,7 +1074,7 @@ import { DocumentReaderProcessor } from '@regulaforensics/vp-frontend-document-c
|
|
|
1141
1074
|
|
|
1142
1075
|
Without module bundler:
|
|
1143
1076
|
```javascript
|
|
1144
|
-
import { DocumentReaderProcessor } from '/node_modules/@regulaforensics/vp-frontend-document-components/
|
|
1077
|
+
import { DocumentReaderProcessor } from '/node_modules/@regulaforensics/vp-frontend-document-components/esm/main.js';
|
|
1145
1078
|
```
|
|
1146
1079
|
|
|
1147
1080
|
**Step 3.** Add a video tag to the `.html` file, then prepare and initialize `DocumentReaderProcessor`.
|
|
@@ -1197,7 +1130,7 @@ Use the CDN link in a format as follows: `unpkg.com/:package@:version/:file`
|
|
|
1197
1130
|
|
|
1198
1131
|
For example:
|
|
1199
1132
|
```html
|
|
1200
|
-
<script src="https://unpkg.com/@regulaforensics/vp-frontend-document-components@latest/dist/main.
|
|
1133
|
+
<script src="https://unpkg.com/@regulaforensics/vp-frontend-document-components@latest/dist/main.js"></script>
|
|
1201
1134
|
```
|
|
1202
1135
|
|
|
1203
1136
|
**Note:** You can find all available script versions in the corresponding section of npm, using the same link from the previous example.
|