@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 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/dist/main.js';
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.iife.js"></script>
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 | Description of the action | Components and events, where present |
315
- |:------------------------------|:------------------------------------------------------------------|:------------------------------------:|
316
- | `ELEMENT_VISIBLE` | Component is appended in the DOM. | `document-reader`, `camera-snapshot` |
317
- | `PRESS_CAMERA_BUTTON` | The "From camera" button is pressed. | `document-reader`, `camera-snapshot` |
318
- | `PRESS_FILE_BUTTON` | The "From gallery" button is pressed. | `document-reader`, `camera-snapshot` |
319
- | `PRESS_RETRY_BUTTON` | The "Retry" button is pressed. | `document-reader`, `camera-snapshot` |
320
- | `PRESS_SKIP_BUTTON` | The "Skip" button is pressed. | `document-reader` |
321
- | `PRESS_CAPTURE_BUTTON` | The "Capture" button is pressed. | `document-reader`, `camera-snapshot` |
322
- | `PRESS_CHANGE_CAMERA_BUTTON` | The "Change camera" button is pressed. | `document-reader`, `camera-snapshot` |
323
- | `PRESS_MIRRORING_BUTTON` | The "Mirroring" button is pressed. | `document-reader`, `camera-snapshot` |
324
- | `NEW_PAGE_AVAILABLE` | The document contains another page. | `document-reader` |
325
- | `NEW_PAGE_STARTED` | Recognition of a new page has started. | `document-reader` |
326
- | `CLOSE` | The "Close" button is pressed. | `document-reader`, `camera-snapshot` |
327
- | `CAMERA_PROCESS_CLOSED` | The "Close" button is pressed on the document recognition screen. | `document-reader`, `camera-snapshot` |
328
- | `CAMERA_PROCESS_STARTED` | Recognition from the camera has started. | `document-reader` |
329
- | `VIDEO_STARTED` | Video stream started. | `document-reader`, `camera-snapshot` |
330
- | `VIDEO_STOPPED` | Video stream stopped. | `document-reader`, `camera-snapshot` |
331
- | `FILE_PROCESS_STARTED` | File processing has started. | `document-reader`, `camera-snapshot` |
332
- | `PROCESS_FINISHED` | The component has finished its work. | `document-reader`, `camera-snapshot` |
333
- | `SERVICE_INITIALIZED` | The component has started its work. | `document-reader` |
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
- ![Delegate action](./docs/document-reader-delegate-button.jpg)
1000
-
1001
- that shows the user QR Code with url (i.e. `https://your-page.com?tag=123`)
1002
-
1003
- ![Delegate mode](./docs/document-reader-delegate-mode.jpg)
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 | Default message in `en` locale | Used in |
1081
- |:-------------------------------|:---------------------------------------------------------------------------------------------|:------------------------------------:|
1082
- | **success** | Success! | `document-reader`, `camera-snapshot` |
1083
- | **fileCorrupt** | This file is corrupt or not supported | `document-reader`, `camera-snapshot` |
1084
- | **selectAnotherFile** | Please select another file | `document-reader`, `camera-snapshot` |
1085
- | **error** | Error! | `document-reader`, `camera-snapshot` |
1086
- | **somethingWentWrong** | Something went wrong | `document-reader`, `camera-snapshot` |
1087
- | **tryAgain** | Try again | `document-reader`, `camera-snapshot` |
1088
- | **fromCamera** | From camera | `document-reader`, `camera-snapshot` |
1089
- | **fromGallery** | From gallery | `document-reader`, `camera-snapshot` |
1090
- | **fromOtherPhone** | From other phone | `document-reader`, `camera-snapshot` |
1091
- | **cameraUnavailable** | Camera unavailable! | `document-reader`, `camera-snapshot` |
1092
- | **preparingCamera** | Preparing the camera... | `document-reader`, `camera-snapshot` |
1093
- | **noCameraAvailable** | No camera available | `document-reader`, `camera-snapshot` |
1094
- | **incorrectCameraId** | No camera with the specified ID found. | `document-reader`, `camera-snapshot` |
1095
- | **allowAccessToCamera** | Allow access to the camera and reload this page to continue. | `document-reader`, `camera-snapshot` |
1096
- | **cameraConnection** | Make sure the camera is connected correctly. | `document-reader`, `camera-snapshot` |
1097
- | **checkCameraId** | Check if the specified camera ID is correct. | `document-reader`, `camera-snapshot` |
1098
- | **scanIDInBrowser** | Scan an ID in your browser | `document-reader` |
1099
- | **useYourDeviceCamera** | Use your device camera to scan a document or select a photo of the document from the gallery | `document-reader` |
1100
- | **processingFinished** | Processing finished. | `document-reader` |
1101
- | **largeFile** | This file is too large to be uploaded | `document-reader` |
1102
- | **selectSmallerFile** | Please select a smaller file | `document-reader` |
1103
- | **versionNotSupported** | Your browser version is not supported | `document-reader` |
1104
- | **updateBrowser** | Update your browser version | `document-reader` |
1105
- | **licenseError** | A license error has occurred | `document-reader` |
1106
- | **licenseExpired** | The license cannot be found or has expired | `document-reader` |
1107
- | **timeout** | Timeout | `document-reader` |
1108
- | **processing** | Processing... | `document-reader` |
1109
- | **preparingService** | Preparing the service... | `document-reader` |
1110
- | **placeDocumentIntoFrame** | Fit the document into the frame | `document-reader` |
1111
- | **noFocus** | No camera focus | `document-reader` |
1112
- | **moveCloser** | Move closer | `document-reader` |
1113
- | **glaresOnDocument** | Avoid glare on the document | `document-reader` |
1114
- | **holdDocumentStraight** | Hold the document straight | `document-reader` |
1115
- | **documentProcessing** | Document processing... | `document-reader` |
1116
- | **flipDocument** | Flip the document | `document-reader` |
1117
- | **verified** | Verified! | `document-reader` |
1118
- | **keepDeviceStill** | Hold the device still | `document-reader` |
1119
- | **positionDocumentCenter** | Position the document in the center | `camera-snapshot` |
1120
- | **photoCapturedSuccessfully** | The photo is captured successfully. | `camera-snapshot` |
1121
- | **uploadPhoto** | Upload a photo | `camera-snapshot` |
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/dist/main.js';
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.iife.js"></script>
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.