@regulaforensics/vp-frontend-document-components 7.5.1963-nightly → 7.5.1964-rc
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 +16 -44
- package/dist/index.d.ts +18 -42
- package/dist/main.iife.js +50 -24
- package/dist/main.js +15374 -12087
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -268,7 +268,6 @@ After adding `DocumentReaderService` to the global variable, you can change the
|
|
|
268
268
|
| **scenario** | Recognition scenario. | string | 'MrzAndLocate' | 'MrzAndLocate', 'MrzOrLocate', 'Mrz', 'Locate' |
|
|
269
269
|
| **multipageProcessing** | Whether to enable multi-page document processing mode. | boolean | `true` | `true`, `false` |
|
|
270
270
|
| **timeout** | Recognition timeout in milliseconds. After this time process will be finished. | number | 2000 | numbers > 0 |
|
|
271
|
-
| **timeoutFromFirstDetect** | Start the countdown from the moment the document is detected. | number | 5000 | numbers > 0 |
|
|
272
271
|
| **resultTypeOutput** | Types of results to return in response. [] - all available types. | number[] | [] | `1` - DocumentImageResult, `3` - TextDataResult, `5` - DocBarCodeInfo, `6` - GraphicsResult, `8` - DocumentTypesCandidatesResult, `9` - ChosenDocumentTypeResult, `20` - AuthenticityResult, `15` - LexicalAnalysisResult, `17` - TextDataResult, `18` - TextDataResult, `19` - GraphicsResult, `30` - ImageQualityResult, `33` - StatusResult, `36` - TextResult, `37` - ImagesResult, `85` - DocumentPositionResult, `102` - TextDataResult, `103` - GraphicsResult, `50` - LicenseResult, `49` - EncryptedRCLResult |
|
|
273
272
|
| **returnPackageForReprocess** | When enabled, returns the package for reprocessing on the backend. | boolean | `false` | `true`, `false` |
|
|
274
273
|
| **imageQa** | When enabled, image quality checks status affects document optical and overall status. | | | |
|
|
@@ -278,6 +277,7 @@ After adding `DocumentReaderService` to the global variable, you can change the
|
|
|
278
277
|
| **glaresCheckParams** | Settings for glare check. | | | |
|
|
279
278
|
| **imageOutputMaxHeight** | This parameter allows setting maximum height in pixels of output images and thus reducing image size to desired. Does not change the aspect ratio. Changes disabled if equals to 0. | number | 0 | numbers > 0 |
|
|
280
279
|
| **imageOutputMaxWidth** | This parameter allows setting maximum width in pixels of output images and thus reducing image size to desired. Does not change the aspect ratio. Changes disabled if equals to 0. | number | 0 | numbers > 0 |
|
|
280
|
+
| **fieldTypesFilter** | List of text field types to extract. If empty, all text fields from template will be extracted. Narrowing the list can shorten processing time. | number[] | [] | |
|
|
281
281
|
| **dateFormat** | This option allows you to set dates format so that solution will return dates in this format. For example, if you supply 'MM/dd/yyyy', and document have printed date '09 JUL 2020' for the date os issue, you will get '07/09/2020' as a result. By default it is set to system locale default (where the service is running). | string | | 'MM/dd/yyyy' |
|
|
282
282
|
| **measureSystem** | This option allows you to set the system of measurement used for converting original values in document to output result values. Metric by default. | number | 0 | `0` - Metric, `1` - Imperial |
|
|
283
283
|
| **imageDpiOutMax** | This parameter controls maximum resolution in dpi of output images. Resolution will remain original in case 0 is supplied. By default is set to return images in response with resolution not greater than 300 dpi for all scenarios except FullAuth. In FullAuth scenario this limit is 1000 dpi by default. | number | | numbers > 0 |
|
|
@@ -425,7 +425,6 @@ Available fields of `event.detail.data` object:
|
|
|
425
425
|
| `NO_CAMERA` | There is no camera available |
|
|
426
426
|
| `INCORRECT_CAMERA_ID` | Camera with this ID was not found |
|
|
427
427
|
| `CONNECTION_ERROR` | Connection errors |
|
|
428
|
-
| `BAD_CONFIGURATION` | Incompatible component settings are installed |
|
|
429
428
|
|
|
430
429
|
#### Remote action data
|
|
431
430
|
|
|
@@ -1017,11 +1016,10 @@ See all component's settings and attributes in the following table.
|
|
|
1017
1016
|
| **multipleFileInput** | **multiple** | Whether to allow uploading more than one file via the file system. Can be set to `true` only if `startScreen` is `true`. | boolean | `true` | `true`, `false` | `document-reader`, `camera-snapshot` |
|
|
1018
1017
|
| **cameraId** | **camera-id** | Ability to select a camera. You can get the device ID using [navigator.mediaDevices.enumerateDevices()](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices). | string | `undefined` | `camera id string value` | `document-reader`, `camera-snapshot` |
|
|
1019
1018
|
| **devLicense** | **license** | To use the component on test environments, set the base64 license value to the `license` attribute. | string | `undefined` | `base64 license value` | `document-reader` |
|
|
1020
|
-
| **regulaLogo** | **copyright** | Show Regula copyright footer.
|
|
1019
|
+
| **regulaLogo** | **copyright** | Show Regula copyright footer. | boolean | `true` | `true`, `false` | `document-reader`, `camera-snapshot` |
|
|
1021
1020
|
| **changeCameraButton** | **change-camera** | Show the camera switch button. | boolean | `false` | `true`, `false` | `document-reader`, `camera-snapshot` |
|
|
1022
1021
|
| **closeButton** | **close-button** | Show the close button. | boolean | `true` | `true`, `false` | `document-reader`, `camera-snapshot` |
|
|
1023
1022
|
| **captureButton** | **capture-button** | Show the capture button. | boolean | `true` | `true`, `false` | `document-reader` |
|
|
1024
|
-
| **copyright** | | Show Regula copyright footer. | boolean | `true` | `true`, `false` | `document-reader`, `camera-snapshot` |
|
|
1025
1023
|
| **skipButton** | | Show the skip button for the second page. | boolean | `true` | `true`, `false` | `document-reader` |
|
|
1026
1024
|
| **captureMode** | | Sets the capture mode. Mode `auto` - recognition starts immediately after the camera starts working. Mode `captureFrame` - recognition of the frame received after pressing the capture button. Mode `captureVideo` - recognition begins after pressing the button, pressing the button again will send the received frame for processing. | string | `auto` | `auto`, `captureVideo`, `captureFrame` | `document-reader` |
|
|
1027
1025
|
| **resolution** | | Sets the resolution of the video stream from the camera. | object | `{ width: 1920, height: 1080 }` | `{ width: number, height: number }` | `document-reader`, `camera-snapshot` |
|
|
@@ -1047,7 +1045,7 @@ See all component's settings and attributes in the following table.
|
|
|
1047
1045
|
| **cameraFrame** | | Show the capture frame. | boolean | `true` | `true`, `false` | `document-reader` |
|
|
1048
1046
|
| **captureButtonDelay** | | Show the capture button after delay. | number | `undefined` | `any number` | `document-reader` |
|
|
1049
1047
|
| **nonce** | | Sets the unique nonce value to maintain the CSP policy. | string | `undefined` | `unique nonce value` | `document-reader`, `camera-snapshot` |
|
|
1050
|
-
| **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` |
|
|
1048
|
+
| **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` |
|
|
1051
1049
|
| **videoCaptureMotionControl** | | Enables device shaking control. | boolean | `false` | `true`, `false` | `document-reader` |
|
|
1052
1050
|
| **fromCameraButton** | | Show the camera button. | boolean | `true` | `true`, `false` | `document-reader`, `camera-snapshot` |
|
|
1053
1051
|
| **uploadFileButton** | | Show the files button. | boolean | `true` | `true`, `false` | `document-reader`, `camera-snapshot` |
|
|
@@ -1063,7 +1061,6 @@ You can send the results to the backend for further processing:
|
|
|
1063
1061
|
```javascript
|
|
1064
1062
|
window.RegulaDocumentSDK.recognizerProcessParam = {
|
|
1065
1063
|
processParam: {
|
|
1066
|
-
scenario: InternalScenarios.MrzAndLocate,
|
|
1067
1064
|
backendProcessing: {
|
|
1068
1065
|
serviceURL: 'YOUR_SERVICE_URL',
|
|
1069
1066
|
httpHeaders: { // you can set http headers if necessary
|
|
@@ -1093,19 +1090,11 @@ For cases when user's main device lacks camera or does not succeed to scan with
|
|
|
1093
1090
|
you have an option to delegate scanning to another available device (i.e. phone).
|
|
1094
1091
|
|
|
1095
1092
|
#### 1. "From other phone" action may be configured on the start screen:
|
|
1096
|
-
-
|
|
1093
|
+
- configure [backend reprocessing](#backend-reprocessing)
|
|
1094
|
+
- add 'delegateURL' and 'tag':
|
|
1097
1095
|
```javascript
|
|
1098
1096
|
processor.recognizerProcessParam = {
|
|
1099
|
-
|
|
1100
|
-
scenario: InternalScenarios.MrzAndLocate,
|
|
1101
|
-
},
|
|
1102
|
-
delegateProcessing: {
|
|
1103
|
-
delegateURL: 'https://your-page.com?tag={tag}', // the page which will be used by other device
|
|
1104
|
-
serviceURL: 'https://my-service.com', // your backend service
|
|
1105
|
-
httpHeaders: { // http headers if needed
|
|
1106
|
-
header: 'value'
|
|
1107
|
-
}
|
|
1108
|
-
},
|
|
1097
|
+
delegateURL: 'https://your-page.com?tag={tag}', // the page which will be used by other device
|
|
1109
1098
|
tag: 123 // your session id, will be added to delegateURL in place of {tag} substring
|
|
1110
1099
|
}
|
|
1111
1100
|
```
|
|
@@ -1118,35 +1107,22 @@ you have an option to delegate scanning to another available device (i.e. phone)
|
|
|
1118
1107
|
|
|
1119
1108
|
#### 2. Configure Delegate page component on delegateURL:
|
|
1120
1109
|
- configure [backend reprocessing](#backend-reprocessing)
|
|
1121
|
-
- backendProcessing setting for the device and delegateProcessing setting for the main page must match
|
|
1122
|
-
- set transaction tag
|
|
1123
|
-
```javascript
|
|
1124
|
-
processor.recognizerProcessParam = {
|
|
1125
|
-
tag: new URL(window.location.href).searchParams.get('tag') // assume session Id tag was added to URL params
|
|
1126
|
-
}
|
|
1127
|
-
```
|
|
1128
1110
|
- use the same tag as on the main page
|
|
1129
1111
|
```javascript
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1112
|
+
window.RegulaDocumentSDK.recognizerProcessParam = {
|
|
1113
|
+
tag: 123 // your session id, i.e. it can be extracted from your delegate page URL
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1116
|
+
element.settings = {
|
|
1117
|
+
startScreen: false, // From camera recognition is expected
|
|
1118
|
+
}
|
|
1134
1119
|
```
|
|
1135
1120
|
- use finalizePackage() to send the data for further reprocessing
|
|
1136
1121
|
|
|
1137
|
-
### Appearance Customization
|
|
1138
|
-
|
|
1139
|
-
#### CSS part
|
|
1140
|
-
|
|
1141
|
-
Using ::part CSS pseudo-elements, you can set your own styles for component elements. Select the element you need in the developer console and use its part name to customize it.
|
|
1142
1122
|
|
|
1143
|
-
|
|
1144
|
-
document-reader::part(container) {
|
|
1145
|
-
background: red;
|
|
1146
|
-
}
|
|
1147
|
-
```
|
|
1123
|
+
### Appearance Customization
|
|
1148
1124
|
|
|
1149
|
-
####
|
|
1125
|
+
#### Font and Colors
|
|
1150
1126
|
|
|
1151
1127
|
Using CSS variables, you can change the font and the main colors of the components. See the table for the details.
|
|
1152
1128
|
|
|
@@ -1242,7 +1218,7 @@ See the following table with localized labels, used in the components.
|
|
|
1242
1218
|
| **keepDeviceStill** | Hold the device still | `document-reader` |
|
|
1243
1219
|
| **positionDocumentCenter** | Position the document in the center | `camera-snapshot` |
|
|
1244
1220
|
| **uploadPhoto** | Upload a photo | `camera-snapshot` |
|
|
1245
|
-
| **
|
|
1221
|
+
| **scanQRCode** | Scan QR code | `document-reader` |
|
|
1246
1222
|
| **openPhoneCamera** | Open the camera on your mobile device, scan the QR code, and follow the link | `document-reader` |
|
|
1247
1223
|
| **pleaseWait** | Please wait... | `document-reader` |
|
|
1248
1224
|
| **mobileDevice** | Mobile device | `document-reader` |
|
|
@@ -1257,8 +1233,6 @@ See the following table with localized labels, used in the components.
|
|
|
1257
1233
|
| **fromFilesDesktop** | Pick a document from the files and upload it | `document-reader` |
|
|
1258
1234
|
| **fromMobileDesktop** | Use your mobile camera to capture a document | `document-reader` |
|
|
1259
1235
|
| **fromGalleryMobile** | Pick a document from the gallery and upload it | `document-reader` |
|
|
1260
|
-
| **returnToComputer** | Return to the computer | `document-reader` |
|
|
1261
|
-
| **documentCaptured** | Your document has been captured | `document-reader` |
|
|
1262
1236
|
|
|
1263
1237
|
## Document Reader Processor
|
|
1264
1238
|
|
|
@@ -1612,8 +1586,6 @@ In the given examples, change the `workerPath` parameter value to your custom so
|
|
|
1612
1586
|
|
|
1613
1587
|
**Attention!** The files must be located in the same directory and have the same names as were previously specified.
|
|
1614
1588
|
|
|
1615
|
-
To decrease files size, you can apply compression. On your server, you need to determine which <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding" target="_blank">compression method</a> is used for the files.
|
|
1616
|
-
|
|
1617
1589
|
## Potential Problems
|
|
1618
1590
|
|
|
1619
1591
|
UI components and SDK use the `getUserMedia` method to display the video stream from the camera. This feature is available only in secure contexts (HTTPS).
|
package/dist/index.d.ts
CHANGED
|
@@ -3,11 +3,9 @@ import { DocumentFormat } from '@regulaforensics/document-reader-webclient';
|
|
|
3
3
|
import { GetTransactionsByTagResponse } from '@regulaforensics/document-reader-webclient';
|
|
4
4
|
import { MeasureSystem } from '@regulaforensics/document-reader-webclient';
|
|
5
5
|
import { MRZFormat } from '@regulaforensics/document-reader-webclient';
|
|
6
|
-
import { ProcessResponse } from '@regulaforensics/document-reader-webclient';
|
|
7
6
|
import { Response as Response_2 } from '@regulaforensics/document-reader-webclient';
|
|
8
7
|
import { Result } from '@regulaforensics/document-reader-webclient';
|
|
9
8
|
import { TextFieldType } from '@regulaforensics/document-reader-webclient';
|
|
10
|
-
import { TransactionInfo } from '@regulaforensics/document-reader-webclient';
|
|
11
9
|
|
|
12
10
|
export declare interface BaseRequest {
|
|
13
11
|
tag?: string;
|
|
@@ -42,7 +40,6 @@ export declare interface CameraSnapshotSettings {
|
|
|
42
40
|
locale?: Locales | string;
|
|
43
41
|
multipleFileInput?: boolean;
|
|
44
42
|
regulaLogo?: boolean;
|
|
45
|
-
copyright?: boolean;
|
|
46
43
|
cameraId?: string;
|
|
47
44
|
changeCameraButton?: boolean;
|
|
48
45
|
closeButton?: boolean;
|
|
@@ -149,8 +146,8 @@ export declare class DocumentReaderProcessor {
|
|
|
149
146
|
isInitialized: boolean;
|
|
150
147
|
videoElement: HTMLVideoElement | null;
|
|
151
148
|
constructor(videoElement?: HTMLVideoElement);
|
|
152
|
-
get recognizeListener(): ((data: Response_2
|
|
153
|
-
set recognizeListener(listener: ((data: Response_2
|
|
149
|
+
get recognizeListener(): ((data: Response_2) => void) | null;
|
|
150
|
+
set recognizeListener(listener: ((data: Response_2) => void) | null);
|
|
154
151
|
get streamParam(): Partial<StreamParams>;
|
|
155
152
|
set streamParam(params: Partial<StreamParams>);
|
|
156
153
|
get recognizerProcessParam(): ProcessingRequest;
|
|
@@ -224,7 +221,9 @@ export declare interface DocumentReaderProcessParam {
|
|
|
224
221
|
};
|
|
225
222
|
}
|
|
226
223
|
|
|
227
|
-
export declare type DocumentReaderResponseType = Response_2
|
|
224
|
+
export declare type DocumentReaderResponseType = Response_2 & {
|
|
225
|
+
TransactionInfo?: TransactionInfo;
|
|
226
|
+
};
|
|
228
227
|
|
|
229
228
|
export declare class DocumentReaderService {
|
|
230
229
|
private _worker;
|
|
@@ -232,12 +231,11 @@ export declare class DocumentReaderService {
|
|
|
232
231
|
private _initializeListener;
|
|
233
232
|
private _processingListener;
|
|
234
233
|
private _queueService;
|
|
235
|
-
private _initProcess;
|
|
236
|
-
onFinalize: TOnFinalize | null;
|
|
237
234
|
isAutoPrepare: boolean;
|
|
238
235
|
isPrepared: boolean;
|
|
239
236
|
isInitialized: boolean;
|
|
240
237
|
isProcessing: boolean;
|
|
238
|
+
_initProcess: Promise<License> | null;
|
|
241
239
|
initData: License | null;
|
|
242
240
|
recognizerProcessParam: ProcessingRequest;
|
|
243
241
|
imageProcessParam: ImageProcessingRequest;
|
|
@@ -261,14 +259,13 @@ export declare class DocumentReaderService {
|
|
|
261
259
|
doInitialize(initData?: {
|
|
262
260
|
license: string | undefined;
|
|
263
261
|
}): Promise<License>;
|
|
264
|
-
private doProcess;
|
|
265
262
|
processImageBase64(base64ImagesArray: Array<string>, params: ProcessingRequest): Promise<Response_2>;
|
|
266
263
|
process(imageDataArray: Array<ImageData>, params?: ProcessingRequest): Promise<Response_2>;
|
|
267
264
|
processImage(imageDataArray: Array<ImageData>, params?: ProcessingRequest): Promise<Response_2>;
|
|
268
265
|
startNewPage(): Promise<void>;
|
|
269
266
|
startNewDocument(metadata?: Record<string, any>): Promise<NewTransaction>;
|
|
270
267
|
createBackendTransaction(metadata?: Record<string, any>): Promise<NewTransaction>;
|
|
271
|
-
finalizePackage(): Promise<
|
|
268
|
+
finalizePackage(): Promise<TransactionInfo>;
|
|
272
269
|
addDataToPackage(data: Uint8ClampedArray, params: PackageParams): Promise<void>;
|
|
273
270
|
shutdown(): void;
|
|
274
271
|
}
|
|
@@ -386,8 +383,7 @@ export declare enum ErrorTypes {
|
|
|
386
383
|
INCORRECT_CAMERA_ID = "INCORRECT_CAMERA_ID",
|
|
387
384
|
CONNECTION_ERROR = "CONNECTION_ERROR",
|
|
388
385
|
HTTP_NOT_SUPPORTED = "HTTP_NOT_SUPPORTED",
|
|
389
|
-
INSECURE_PAGE_CONTEXT = "INSECURE_PAGE_CONTEXT"
|
|
390
|
-
BAD_CONFIGURATION = "BAD_CONFIGURATION"
|
|
386
|
+
INSECURE_PAGE_CONTEXT = "INSECURE_PAGE_CONTEXT"
|
|
391
387
|
}
|
|
392
388
|
|
|
393
389
|
export declare enum EventActions {
|
|
@@ -506,7 +502,13 @@ export declare enum MirrorType {
|
|
|
506
502
|
|
|
507
503
|
export declare interface NewTransaction {
|
|
508
504
|
ContainerList: ContainerList;
|
|
509
|
-
TransactionInfo:
|
|
505
|
+
TransactionInfo: {
|
|
506
|
+
ComputerName: string;
|
|
507
|
+
DateTime: string;
|
|
508
|
+
SystemInfo: string;
|
|
509
|
+
Tag: string;
|
|
510
|
+
TransactionID: string;
|
|
511
|
+
};
|
|
510
512
|
sessionLogFolder: string;
|
|
511
513
|
}
|
|
512
514
|
|
|
@@ -518,23 +520,13 @@ export declare interface PackageParams {
|
|
|
518
520
|
|
|
519
521
|
export declare interface ProcessingRequest extends BaseRequest {
|
|
520
522
|
metadata?: Record<string, any>;
|
|
521
|
-
|
|
522
|
-
serviceURL: string;
|
|
523
|
-
delegateURL: string;
|
|
524
|
-
httpHeaders?: Record<string, string>;
|
|
525
|
-
};
|
|
523
|
+
delegateURL?: string;
|
|
526
524
|
processParam: DocumentReaderProcessParam;
|
|
527
525
|
imagesList?: Array<DocumentReaderImage>;
|
|
528
526
|
imageInputParam?: ImageInputParamType;
|
|
529
527
|
}
|
|
530
528
|
|
|
531
|
-
|
|
532
|
-
licensing_code: number;
|
|
533
|
-
reject_message: string;
|
|
534
|
-
reject_reason: number;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
declare type RecognizeListener = (data: Response_2 | ProcessRejectResponse) => void;
|
|
529
|
+
declare type RecognizeListener = (data: Response_2) => void;
|
|
538
530
|
|
|
539
531
|
export declare type Resolution = Partial<WidthAndHeight>;
|
|
540
532
|
|
|
@@ -557,8 +549,6 @@ declare type TInitializeListener = ({ isInitialized }: {
|
|
|
557
549
|
isInitialized: boolean;
|
|
558
550
|
}) => void;
|
|
559
551
|
|
|
560
|
-
declare type TOnFinalize = (transaction: TransactionIdentifier) => void;
|
|
561
|
-
|
|
562
552
|
declare type TPrepareListener = ({ isPrepared }: {
|
|
563
553
|
isPrepared: boolean;
|
|
564
554
|
}) => void;
|
|
@@ -572,8 +562,7 @@ export declare interface TransactionEvent {
|
|
|
572
562
|
data: GetTransactionsByTagResponse;
|
|
573
563
|
}
|
|
574
564
|
|
|
575
|
-
export declare interface
|
|
576
|
-
metadata?: unknown;
|
|
565
|
+
export declare interface TransactionInfo {
|
|
577
566
|
tag: string;
|
|
578
567
|
transactionId: string;
|
|
579
568
|
}
|
|
@@ -609,7 +598,6 @@ export declare interface VideoData {
|
|
|
609
598
|
export declare interface VideoRecordSettings {
|
|
610
599
|
delay?: number;
|
|
611
600
|
duration?: number;
|
|
612
|
-
bitrate?: number;
|
|
613
601
|
}
|
|
614
602
|
|
|
615
603
|
export declare interface WidthAndHeight {
|
|
@@ -629,15 +617,3 @@ declare global {
|
|
|
629
617
|
RegulaDocumentSDK: DocumentReaderService;
|
|
630
618
|
}
|
|
631
619
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
declare namespace v3 {
|
|
635
|
-
var DNS: string;
|
|
636
|
-
var URL: string;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
declare namespace v5 {
|
|
641
|
-
var DNS: string;
|
|
642
|
-
var URL: string;
|
|
643
|
-
}
|