@regulaforensics/vp-frontend-document-components 7.2.1749-nightly → 7.2.1753-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 +63 -130
- package/dist/index.d.ts +4 -29
- package/dist/main.iife.js +674 -61
- package/dist/main.js +16246 -21491
- package/package.json +3 -6
- 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)
|
|
@@ -233,14 +232,7 @@ After adding `DocumentReaderService` to the global variable, you can change the
|
|
|
233
232
|
},
|
|
234
233
|
};
|
|
235
234
|
```
|
|
236
|
-
|
|
237
|
-
**Session ID** for video processing:
|
|
238
|
-
```javascript
|
|
239
|
-
window.RegulaDocumentSDK.recognizerProcessParam = {
|
|
240
|
-
tag: 'your session id',
|
|
241
|
-
};
|
|
242
|
-
```
|
|
243
|
-
|
|
235
|
+
|
|
244
236
|
**Image processing** default settings. The functionality is available via the gallery button.
|
|
245
237
|
```javascript
|
|
246
238
|
window.RegulaDocumentSDK.imageProcessParam = {
|
|
@@ -331,29 +323,26 @@ The fields of the `event.detail` object:
|
|
|
331
323
|
|
|
332
324
|
#### Action Types
|
|
333
325
|
|
|
334
|
-
| Type of action
|
|
335
|
-
|
|
336
|
-
| `ELEMENT_VISIBLE`
|
|
337
|
-
| `PRESS_CAMERA_BUTTON`
|
|
338
|
-
| `PRESS_FILE_BUTTON`
|
|
339
|
-
| `PRESS_RETRY_BUTTON`
|
|
340
|
-
| `PRESS_SKIP_BUTTON`
|
|
341
|
-
| `PRESS_CAPTURE_BUTTON`
|
|
342
|
-
| `PRESS_CHANGE_CAMERA_BUTTON`
|
|
343
|
-
| `PRESS_MIRRORING_BUTTON`
|
|
344
|
-
| `NEW_PAGE_AVAILABLE`
|
|
345
|
-
| `NEW_PAGE_STARTED`
|
|
346
|
-
| `CLOSE`
|
|
347
|
-
| `CAMERA_PROCESS_CLOSED`
|
|
348
|
-
| `CAMERA_PROCESS_STARTED`
|
|
349
|
-
| `VIDEO_STARTED`
|
|
350
|
-
| `VIDEO_STOPPED`
|
|
351
|
-
| `FILE_PROCESS_STARTED`
|
|
352
|
-
| `PROCESS_FINISHED`
|
|
353
|
-
| `SERVICE_INITIALIZED`
|
|
354
|
-
| `PRESS_REMOTE_DEVICE_BUTTON` | The "From other phone" button is pressed. | `document-reader` |
|
|
355
|
-
| `REMOTE_TRANSACTION_UPLOADED` | Remote transaction with current tag was uploaded | `document-reader` |
|
|
356
|
-
| `REMOTE_PROCESS_FINISHED` | Remote transaction with current tag was processed | `document-reader` |
|
|
326
|
+
| Type of action | Description of the action | Components and events, where present |
|
|
327
|
+
|:-----------------------------|:------------------------------------------------------------------|:------------------------------------:|
|
|
328
|
+
| `ELEMENT_VISIBLE` | Component is appended in the DOM. | `document-reader`, `camera-snapshot` |
|
|
329
|
+
| `PRESS_CAMERA_BUTTON` | The "From camera" button is pressed. | `document-reader`, `camera-snapshot` |
|
|
330
|
+
| `PRESS_FILE_BUTTON` | The "From gallery" button is pressed. | `document-reader`, `camera-snapshot` |
|
|
331
|
+
| `PRESS_RETRY_BUTTON` | The "Retry" button is pressed. | `document-reader`, `camera-snapshot` |
|
|
332
|
+
| `PRESS_SKIP_BUTTON` | The "Skip" button is pressed. | `document-reader` |
|
|
333
|
+
| `PRESS_CAPTURE_BUTTON` | The "Capture" button is pressed. | `document-reader`, `camera-snapshot` |
|
|
334
|
+
| `PRESS_CHANGE_CAMERA_BUTTON` | The "Change camera" button is pressed. | `document-reader`, `camera-snapshot` |
|
|
335
|
+
| `PRESS_MIRRORING_BUTTON` | The "Mirroring" button is pressed. | `document-reader`, `camera-snapshot` |
|
|
336
|
+
| `NEW_PAGE_AVAILABLE` | The document contains another page. | `document-reader` |
|
|
337
|
+
| `NEW_PAGE_STARTED` | Recognition of a new page has started. | `document-reader` |
|
|
338
|
+
| `CLOSE` | The "Close" button is pressed. | `document-reader`, `camera-snapshot` |
|
|
339
|
+
| `CAMERA_PROCESS_CLOSED` | The "Close" button is pressed on the document recognition screen. | `document-reader`, `camera-snapshot` |
|
|
340
|
+
| `CAMERA_PROCESS_STARTED` | Recognition from the camera has started. | `document-reader` |
|
|
341
|
+
| `VIDEO_STARTED` | Video stream started. | `document-reader`, `camera-snapshot` |
|
|
342
|
+
| `VIDEO_STOPPED` | Video stream stopped. | `document-reader`, `camera-snapshot` |
|
|
343
|
+
| `FILE_PROCESS_STARTED` | File processing has started. | `document-reader`, `camera-snapshot` |
|
|
344
|
+
| `PROCESS_FINISHED` | The component has finished its work. | `document-reader`, `camera-snapshot` |
|
|
345
|
+
| `SERVICE_INITIALIZED` | The component has started its work. | `document-reader` |
|
|
357
346
|
|
|
358
347
|
|
|
359
348
|
#### Action Data
|
|
@@ -421,21 +410,6 @@ Available fields of `event.detail.data` object:
|
|
|
421
410
|
| `INCORRECT_CAMERA_ID` | Camera with this ID was not found |
|
|
422
411
|
| `CONNECTION_ERROR` | Connection errors |
|
|
423
412
|
|
|
424
|
-
#### Remote action data
|
|
425
|
-
|
|
426
|
-
**1.** In case of remote scan scenario REMOTE_TRANSACTION_UPLOADED `event.detail` will contain the following data:
|
|
427
|
-
```javascript
|
|
428
|
-
{
|
|
429
|
-
action: EventActions.REMOTE_TRANSACTION_UPLOADED,
|
|
430
|
-
data: {
|
|
431
|
-
id: 1,
|
|
432
|
-
state: 1,
|
|
433
|
-
updatedAt: 'dateStr'
|
|
434
|
-
},
|
|
435
|
-
}
|
|
436
|
-
```
|
|
437
|
-
Transaction id can be used to trigger reprocessing.
|
|
438
|
-
|
|
439
413
|
#### Event Generation Logic
|
|
440
414
|
|
|
441
415
|
The cases of event generation are described in the following table.
|
|
@@ -1001,46 +975,6 @@ function listener(event) {
|
|
|
1001
975
|
|
|
1002
976
|
component.addEventListener('document-reader', listener);
|
|
1003
977
|
```
|
|
1004
|
-
### Delegating scan to device with better camera
|
|
1005
|
-
|
|
1006
|
-
For cases when user's main device lacks camera or does not succeed to scan with given camera quality,
|
|
1007
|
-
you have an option to delegate scanning to another available device (i.e. phone).
|
|
1008
|
-
|
|
1009
|
-
#### 1. "From other phone" action may be configured on the start screen:
|
|
1010
|
-
- configure [backend reprocessing](#backend-reprocessing)
|
|
1011
|
-
- add 'delegateURL' and 'tag':
|
|
1012
|
-
```javascript
|
|
1013
|
-
processor.recognizerProcessParam = {
|
|
1014
|
-
delegateURL: 'https://your-page.com?tag={tag}', // the page which will be used by other device
|
|
1015
|
-
tag: 123 // your session id, will be added to delegateURL in place of {tag} substring
|
|
1016
|
-
}
|
|
1017
|
-
```
|
|
1018
|
-
- these settings will unlock "From other phone" option
|
|
1019
|
-
|
|
1020
|
-

|
|
1021
|
-
|
|
1022
|
-
that shows the user QR Code with url (i.e. `https://your-page.com?tag=123`)
|
|
1023
|
-
|
|
1024
|
-

|
|
1025
|
-
- the component will emit **REMOTE_TRANSACTION_UPLOADED** event with the most recent transaction uploaded with your session tag.
|
|
1026
|
-
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))
|
|
1027
|
-
- the component will emit **REMOTE_PROCESS_FINISHED** event with a result of the most recent processed transaction.
|
|
1028
|
-
It is similar to **PROCESS_FINISHED** event but may contain more data due to backend reprocessing
|
|
1029
|
-
|
|
1030
|
-
#### 2. Configure Delegate page component on delegateURL:
|
|
1031
|
-
- configure [backend reprocessing](#backend-reprocessing)
|
|
1032
|
-
- use the same tag as on the main page
|
|
1033
|
-
```javascript
|
|
1034
|
-
window.RegulaDocumentSDK.recognizerProcessParam = {
|
|
1035
|
-
tag: 123 // your session id, i.e. it can be extracted from your delegate page URL
|
|
1036
|
-
};
|
|
1037
|
-
|
|
1038
|
-
element.settings = {
|
|
1039
|
-
startScreen: false, // From camera recognition is expected
|
|
1040
|
-
}
|
|
1041
|
-
```
|
|
1042
|
-
- use finalizePackage() to send the data for further reprocessing
|
|
1043
|
-
|
|
1044
978
|
|
|
1045
979
|
### Appearance Customization
|
|
1046
980
|
|
|
@@ -1098,49 +1032,48 @@ body.append(element);
|
|
|
1098
1032
|
|
|
1099
1033
|
See the following table with localized labels, used in the components.
|
|
1100
1034
|
|
|
1101
|
-
| Label
|
|
1102
|
-
|
|
1103
|
-
| **success**
|
|
1104
|
-
| **fileCorrupt**
|
|
1105
|
-
| **selectAnotherFile**
|
|
1106
|
-
| **error**
|
|
1107
|
-
| **somethingWentWrong**
|
|
1108
|
-
| **tryAgain**
|
|
1109
|
-
| **fromCamera**
|
|
1110
|
-
| **fromGallery**
|
|
1111
|
-
| **
|
|
1112
|
-
| **
|
|
1113
|
-
| **
|
|
1114
|
-
| **
|
|
1115
|
-
| **
|
|
1116
|
-
| **
|
|
1117
|
-
| **
|
|
1118
|
-
| **
|
|
1119
|
-
| **
|
|
1120
|
-
| **
|
|
1121
|
-
| **
|
|
1122
|
-
| **
|
|
1123
|
-
| **
|
|
1124
|
-
| **
|
|
1125
|
-
| **
|
|
1126
|
-
| **
|
|
1127
|
-
| **
|
|
1128
|
-
| **
|
|
1129
|
-
| **
|
|
1130
|
-
| **
|
|
1131
|
-
| **
|
|
1132
|
-
| **
|
|
1133
|
-
| **
|
|
1134
|
-
| **
|
|
1135
|
-
| **
|
|
1136
|
-
| **
|
|
1137
|
-
| **
|
|
1138
|
-
| **
|
|
1139
|
-
| **
|
|
1140
|
-
| **
|
|
1141
|
-
| **
|
|
1142
|
-
| **
|
|
1143
|
-
| **useCameraOrGallery** | Use your device camera or select a photo from the gallery | `camera-snapshot` |
|
|
1035
|
+
| Label | Default message in `en` locale | Used in |
|
|
1036
|
+
|:------------------------------|:---------------------------------------------------------------------------------------------|:------------------------------------:|
|
|
1037
|
+
| **success** | Success! | `document-reader`, `camera-snapshot` |
|
|
1038
|
+
| **fileCorrupt** | This file is corrupt or not supported | `document-reader`, `camera-snapshot` |
|
|
1039
|
+
| **selectAnotherFile** | Please select another file | `document-reader`, `camera-snapshot` |
|
|
1040
|
+
| **error** | Error! | `document-reader`, `camera-snapshot` |
|
|
1041
|
+
| **somethingWentWrong** | Something went wrong | `document-reader`, `camera-snapshot` |
|
|
1042
|
+
| **tryAgain** | Try again | `document-reader`, `camera-snapshot` |
|
|
1043
|
+
| **fromCamera** | From camera | `document-reader`, `camera-snapshot` |
|
|
1044
|
+
| **fromGallery** | From gallery | `document-reader`, `camera-snapshot` |
|
|
1045
|
+
| **cameraUnavailable** | Camera unavailable! | `document-reader`, `camera-snapshot` |
|
|
1046
|
+
| **preparingCamera** | Preparing the camera... | `document-reader`, `camera-snapshot` |
|
|
1047
|
+
| **noCameraAvailable** | No camera available | `document-reader`, `camera-snapshot` |
|
|
1048
|
+
| **incorrectCameraId** | No camera with the specified ID found. | `document-reader`, `camera-snapshot` |
|
|
1049
|
+
| **allowAccessToCamera** | Allow access to the camera and reload this page to continue. | `document-reader`, `camera-snapshot` |
|
|
1050
|
+
| **cameraConnection** | Make sure the camera is connected correctly. | `document-reader`, `camera-snapshot` |
|
|
1051
|
+
| **checkCameraId** | Check if the specified camera ID is correct. | `document-reader`, `camera-snapshot` |
|
|
1052
|
+
| **scanIDInBrowser** | Scan an ID in your browser | `document-reader` |
|
|
1053
|
+
| **useYourDeviceCamera** | Use your device camera to scan a document or select a photo of the document from the gallery | `document-reader` |
|
|
1054
|
+
| **processingFinished** | Processing finished. | `document-reader` |
|
|
1055
|
+
| **largeFile** | This file is too large to be uploaded | `document-reader` |
|
|
1056
|
+
| **selectSmallerFile** | Please select a smaller file | `document-reader` |
|
|
1057
|
+
| **versionNotSupported** | Your browser version is not supported | `document-reader` |
|
|
1058
|
+
| **updateBrowser** | Update your browser version | `document-reader` |
|
|
1059
|
+
| **licenseError** | A license error has occurred | `document-reader` |
|
|
1060
|
+
| **licenseExpired** | The license cannot be found or has expired | `document-reader` |
|
|
1061
|
+
| **timeout** | Timeout | `document-reader` |
|
|
1062
|
+
| **processing** | Processing... | `document-reader` |
|
|
1063
|
+
| **preparingService** | Preparing the service... | `document-reader` |
|
|
1064
|
+
| **placeDocumentIntoFrame** | Fit the document into the frame | `document-reader` |
|
|
1065
|
+
| **noFocus** | No camera focus | `document-reader` |
|
|
1066
|
+
| **moveCloser** | Move closer | `document-reader` |
|
|
1067
|
+
| **glaresOnDocument** | Avoid glare on the document | `document-reader` |
|
|
1068
|
+
| **holdDocumentStraight** | Hold the document straight | `document-reader` |
|
|
1069
|
+
| **documentProcessing** | Document processing... | `document-reader` |
|
|
1070
|
+
| **flipDocument** | Flip the document | `document-reader` |
|
|
1071
|
+
| **verified** | Verified! | `document-reader` |
|
|
1072
|
+
| **keepDeviceStill** | Hold the device still | `document-reader` |
|
|
1073
|
+
| **positionDocumentCenter** | Position the document in the center | `camera-snapshot` |
|
|
1074
|
+
| **photoCapturedSuccessfully** | The photo is captured successfully. | `camera-snapshot` |
|
|
1075
|
+
| **uploadPhoto** | Upload a photo | `camera-snapshot` |
|
|
1076
|
+
| **useCameraOrGallery** | Use your device camera or select a photo from the gallery | `camera-snapshot` |
|
|
1144
1077
|
|
|
1145
1078
|
## Document Reader Processor
|
|
1146
1079
|
|
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ declare enum CameraSnapshotAttributes {
|
|
|
27
27
|
closeButton = "close-button"
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export declare type CameraSnapshotDetailType = DetailEvent<
|
|
30
|
+
export declare type CameraSnapshotDetailType = DetailEvent<EventActions, CameraSnapshotResponseType>;
|
|
31
31
|
|
|
32
32
|
export declare type CameraSnapshotResponseType = Array<{
|
|
33
33
|
raw: string;
|
|
@@ -118,7 +118,7 @@ export declare class DocumentReaderCaptureWebComponent extends HTMLElement {
|
|
|
118
118
|
disconnectedCallback(): void;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
export declare type DocumentReaderDetailType = DetailEvent<
|
|
121
|
+
export declare type DocumentReaderDetailType = DetailEvent<EventActions, DocumentReaderResponseType>;
|
|
122
122
|
|
|
123
123
|
export declare interface DocumentReaderImage {
|
|
124
124
|
data: string;
|
|
@@ -383,7 +383,6 @@ export declare enum EventActions {
|
|
|
383
383
|
PRESS_SKIP_BUTTON = "PRESS_SKIP_BUTTON",
|
|
384
384
|
PRESS_CAPTURE_BUTTON = "PRESS_CAPTURE_BUTTON",
|
|
385
385
|
PRESS_CHANGE_CAMERA_BUTTON = "PRESS_CHANGE_CAMERA_BUTTON",
|
|
386
|
-
PRESS_REMOTE_DEVICE_BUTTON = "PRESS_REMOTE_DEVICE_BUTTON",
|
|
387
386
|
PRESS_MIRRORING_BUTTON = "PRESS_MIRRORING_BUTTON",
|
|
388
387
|
PRESS_CONNECT_BUTTON = "PRESS_CONNECT_BUTTON",
|
|
389
388
|
PRESS_DISCONNECT_BUTTON = "PRESS_DISCONNECT_BUTTON",
|
|
@@ -399,9 +398,7 @@ export declare enum EventActions {
|
|
|
399
398
|
FILE_PROCESS_STARTED = "FILE_PROCESS_STARTED",
|
|
400
399
|
PROCESS_STARTED = "PROCESS_STARTED",
|
|
401
400
|
PROCESS_FINISHED = "PROCESS_FINISHED",
|
|
402
|
-
SERVICE_INITIALIZED = "SERVICE_INITIALIZED"
|
|
403
|
-
REMOTE_TRANSACTION_UPLOADED = "REMOTE_TRANSACTION_UPLOADED",
|
|
404
|
-
REMOTE_PROCESS_FINISHED = "REMOTE_PROCESS_FINISHED"
|
|
401
|
+
SERVICE_INITIALIZED = "SERVICE_INITIALIZED"
|
|
405
402
|
}
|
|
406
403
|
|
|
407
404
|
export declare enum FrameLineCap {
|
|
@@ -509,7 +506,6 @@ export declare interface PackageParams {
|
|
|
509
506
|
|
|
510
507
|
export declare interface ProcessingRequest extends BaseRequest {
|
|
511
508
|
metadata?: Record<string, any>;
|
|
512
|
-
delegateURL?: string;
|
|
513
509
|
processParam: DocumentReaderProcessParam;
|
|
514
510
|
imagesList?: Array<DocumentReaderImage>;
|
|
515
511
|
imageInputParam?: ImageInputParamType;
|
|
@@ -546,32 +542,11 @@ declare type TProcessingListener = ({ isProcessing }: {
|
|
|
546
542
|
isProcessing: boolean;
|
|
547
543
|
}) => void;
|
|
548
544
|
|
|
549
|
-
export declare interface TransactionEvent {
|
|
550
|
-
action: EventActions.REMOTE_TRANSACTION_UPLOADED;
|
|
551
|
-
data: TransactionStatusInfo;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
545
|
export declare interface TransactionInfo {
|
|
555
546
|
tag: string;
|
|
556
547
|
transactionId: string;
|
|
557
548
|
}
|
|
558
549
|
|
|
559
|
-
export declare type TransactionsListResponse = {
|
|
560
|
-
items: TransactionStatusInfo[];
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
export declare enum TransactionStateStatus {
|
|
564
|
-
STARTED = 0,
|
|
565
|
-
UPLOADED = 1,
|
|
566
|
-
PROCESSED = 2
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
export declare type TransactionStatusInfo = {
|
|
570
|
-
id: number;
|
|
571
|
-
state: TransactionStateStatus;
|
|
572
|
-
updatedAt: string;
|
|
573
|
-
};
|
|
574
|
-
|
|
575
550
|
export declare type TScenarioParams = {
|
|
576
551
|
name: string;
|
|
577
552
|
desc: string;
|
|
@@ -609,7 +584,7 @@ export { }
|
|
|
609
584
|
|
|
610
585
|
declare global {
|
|
611
586
|
interface HTMLElementEventMap {
|
|
612
|
-
'document-reader': CustomEvent<DocumentReaderDetailType
|
|
587
|
+
'document-reader': CustomEvent<DocumentReaderDetailType>;
|
|
613
588
|
'camera-snapshot': CustomEvent<CameraSnapshotDetailType>;
|
|
614
589
|
}
|
|
615
590
|
interface Window {
|