@regulaforensics/vp-frontend-document-components 7.2.1714-nightly → 7.2.1716-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)
@@ -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
 
package/dist/index.d.ts CHANGED
@@ -6,6 +6,12 @@ import { Response as Response_2 } from '@regulaforensics/document-reader-webclie
6
6
  import { Result } from '@regulaforensics/document-reader-webclient';
7
7
  import { TextFieldType } from '@regulaforensics/document-reader-webclient';
8
8
 
9
+ export declare interface BaseRequest {
10
+ tag?: string;
11
+ tenant?: string;
12
+ env?: string;
13
+ }
14
+
9
15
  export declare enum CameraFacingMode {
10
16
  user = "user",
11
17
  environment = "environment"
@@ -21,7 +27,7 @@ declare enum CameraSnapshotAttributes {
21
27
  closeButton = "close-button"
22
28
  }
23
29
 
24
- export declare type CameraSnapshotDetailType = DetailEvent<Exclude<EventActions, EventActions.REMOTE_TRANSACTION_UPLOADED>, CameraSnapshotResponseType>;
30
+ export declare type CameraSnapshotDetailType = DetailEvent<EventActions, CameraSnapshotResponseType>;
25
31
 
26
32
  export declare type CameraSnapshotResponseType = Array<{
27
33
  raw: string;
@@ -112,7 +118,7 @@ export declare class DocumentReaderCaptureWebComponent extends HTMLElement {
112
118
  disconnectedCallback(): void;
113
119
  }
114
120
 
115
- export declare type DocumentReaderDetailType = DetailEvent<Exclude<EventActions, EventActions.REMOTE_TRANSACTION_UPLOADED>, DocumentReaderResponseType>;
121
+ export declare type DocumentReaderDetailType = DetailEvent<EventActions, DocumentReaderResponseType>;
116
122
 
117
123
  export declare interface DocumentReaderImage {
118
124
  data: string;
@@ -222,6 +228,7 @@ export declare class DocumentReaderService {
222
228
  isPrepared: boolean;
223
229
  isInitialized: boolean;
224
230
  isProcessing: boolean;
231
+ _initProcess: Promise<License> | null;
225
232
  initData: License | null;
226
233
  recognizerProcessParam: ProcessingRequest;
227
234
  imageProcessParam: ImageProcessingRequest;
@@ -242,6 +249,9 @@ export declare class DocumentReaderService {
242
249
  initialize(initData?: {
243
250
  license: string | undefined;
244
251
  }): Promise<License>;
252
+ doInitialize(initData?: {
253
+ license: string | undefined;
254
+ }): Promise<License>;
245
255
  processImageBase64(base64ImagesArray: Array<string>, params: ProcessingRequest): Promise<Response_2>;
246
256
  process(imageDataArray: Array<ImageData>, params?: ProcessingRequest): Promise<Response_2>;
247
257
  processImage(imageDataArray: Array<ImageData>, params?: ProcessingRequest): Promise<Response_2>;
@@ -371,7 +381,6 @@ export declare enum EventActions {
371
381
  PRESS_SKIP_BUTTON = "PRESS_SKIP_BUTTON",
372
382
  PRESS_CAPTURE_BUTTON = "PRESS_CAPTURE_BUTTON",
373
383
  PRESS_CHANGE_CAMERA_BUTTON = "PRESS_CHANGE_CAMERA_BUTTON",
374
- PRESS_REMOTE_DEVICE_BUTTON = "PRESS_REMOTE_DEVICE_BUTTON",
375
384
  PRESS_MIRRORING_BUTTON = "PRESS_MIRRORING_BUTTON",
376
385
  PRESS_CONNECT_BUTTON = "PRESS_CONNECT_BUTTON",
377
386
  PRESS_DISCONNECT_BUTTON = "PRESS_DISCONNECT_BUTTON",
@@ -387,9 +396,7 @@ export declare enum EventActions {
387
396
  FILE_PROCESS_STARTED = "FILE_PROCESS_STARTED",
388
397
  PROCESS_STARTED = "PROCESS_STARTED",
389
398
  PROCESS_FINISHED = "PROCESS_FINISHED",
390
- SERVICE_INITIALIZED = "SERVICE_INITIALIZED",
391
- REMOTE_TRANSACTION_UPLOADED = "REMOTE_TRANSACTION_UPLOADED",
392
- REMOTE_PROCESS_FINISHED = "REMOTE_PROCESS_FINISHED"
399
+ SERVICE_INITIALIZED = "SERVICE_INITIALIZED"
393
400
  }
394
401
 
395
402
  export declare enum FrameLineCap {
@@ -434,8 +441,7 @@ export declare interface ImageInputParamType {
434
441
  resolutionType: number;
435
442
  }
436
443
 
437
- export declare interface ImageProcessingRequest {
438
- tag?: string;
444
+ export declare interface ImageProcessingRequest extends BaseRequest {
439
445
  imageInputParam?: ImageInputParamType;
440
446
  processParam: Pick<DocumentReaderProcessParam, 'returnPackageForReprocess' | 'returnUncroppedImage' | 'scenario' | 'backendProcessing'>;
441
447
  }
@@ -496,10 +502,8 @@ export declare interface PackageParams {
496
502
  metadata?: Record<string, any>;
497
503
  }
498
504
 
499
- export declare interface ProcessingRequest {
505
+ export declare interface ProcessingRequest extends BaseRequest {
500
506
  metadata?: Record<string, any>;
501
- tag?: string;
502
- delegateURL?: string;
503
507
  processParam: DocumentReaderProcessParam;
504
508
  imagesList?: Array<DocumentReaderImage>;
505
509
  imageInputParam?: ImageInputParamType;
@@ -536,32 +540,11 @@ declare type TProcessingListener = ({ isProcessing }: {
536
540
  isProcessing: boolean;
537
541
  }) => void;
538
542
 
539
- export declare interface TransactionEvent {
540
- action: EventActions.REMOTE_TRANSACTION_UPLOADED;
541
- data: TransactionStatusInfo;
542
- }
543
-
544
543
  export declare interface TransactionInfo {
545
544
  tag: string;
546
545
  transactionId: string;
547
546
  }
548
547
 
549
- export declare type TransactionsListResponse = {
550
- items: TransactionStatusInfo[];
551
- };
552
-
553
- export declare enum TransactionStateStatus {
554
- STARTED = 0,
555
- UPLOADED = 1,
556
- PROCESSED = 2
557
- }
558
-
559
- export declare type TransactionStatusInfo = {
560
- id: number;
561
- state: TransactionStateStatus;
562
- updatedAt: string;
563
- };
564
-
565
548
  export declare type TScenarioParams = {
566
549
  name: string;
567
550
  desc: string;
@@ -599,7 +582,7 @@ export { }
599
582
 
600
583
  declare global {
601
584
  interface HTMLElementEventMap {
602
- 'document-reader': CustomEvent<DocumentReaderDetailType | TransactionEvent>;
585
+ 'document-reader': CustomEvent<DocumentReaderDetailType>;
603
586
  'camera-snapshot': CustomEvent<CameraSnapshotDetailType>;
604
587
  }
605
588
  interface Window {