@regulaforensics/vp-frontend-face-components 7.1.1684-nightly → 7.1.1685-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 CHANGED
@@ -7,6 +7,7 @@
7
7
  - [Install via CDN](#install-via-cdn)
8
8
  - [Settings](#settings)
9
9
  - [Customization](#customization)
10
+ - [Package Resources](#package-resources)
10
11
  - [Events](#events)
11
12
  - [Response](#response)
12
13
  - [Custom Translations](#custom-translations)
@@ -18,7 +19,7 @@
18
19
 
19
20
  ## Overview
20
21
 
21
- The Face SDK Web Components let you add automatic capture of a user's selfie and liveness check to your web site. The components capture a face from the device camera and can either simply detect a face on the captured photo or confirm the face <a href="https://docs.regulaforensics.com/develop/overview/#liveness-detection" target="_blank">liveness</a>.
22
+ The Face SDK Web Components let you add automatic capture of a user's selfie and liveness check to your web site. The components capture a face from the device camera and can either simply detect a face on the captured photo or confirm the <a href="https://docs.regulaforensics.com/develop/face-sdk/overview/introduction/#liveness-assessment" target="_blank">face liveness</a>.
22
23
 
23
24
  The available components are the following:
24
25
 
@@ -114,6 +115,8 @@ Note that we have removed the `videoRecording` setting. Now you should use `reco
114
115
 
115
116
  You can set any parameter using `settings`. Find below examples of applying all the settings at once as well as using just some of them.
116
117
 
118
+ Note that `settings` must be applied **after** the component has been added to the page’s DOM (for example, after calling `container.append(faceCapturEl)`). If settings are applied before the component is added to the DOM, they may not take effect.
119
+
117
120
  An example of using all the settings:
118
121
 
119
122
  ````javascript
@@ -189,9 +192,9 @@ Here are all the available settings:
189
192
 
190
193
  | Setting | Info | Data type | Default value | Values | Used in |
191
194
  |:--------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------:|:--------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|---------------------------------|
192
- | `locale` | Language of the component. | `string` | `en` | `ru`, `en`, `de`, `pl`, `it`, `hu`, `zh`, `sk`, `uk`, `fr`, `es`, `pt`, `ar`, `nl`, `id`, `vi`, `ko`, `ms`, `ro`, `el`, `tr`, `ja`, `cs`, `th`, `hi`, `bn`, `he`, `fi`, `sv`, `da`, `hr`, `no` | `face-liveness`, `face-capture` |
195
+ | `locale` | Language of the component. The value is determined based on the following priority:<br><br>1. `locale` component attribute takes the highest priority if explicitly set.<br>2. If `locale` is not set, the system checks the `html.lang` attribute.<br>3. If no `html.lang` attribute is available, the system attempts to determine the language from `window.navigator`.<br>4. If none of the above are available, the default value `en` is used. | `string` | `en` | `ru`, `en`, `de`, `pl`, `it`, `hu`, `zh`, `sk`, `uk`, `fr`, `es`, `pt`, `ar`, `nl`, `id`, `vi`, `ko`, `ms`, `ro`, `el`, `tr`, `ja`, `cs`, `th`, `hi`, `bn`, `he`, `fi`, `sv`, `da`, `hr`, `no` | `face-liveness`, `face-capture` |
193
196
  | `url` | Backend URL. | `string` | `https://faceapi.regulaforensics.com/` | any url | `face-liveness` |
194
- | `copyright` | Whether to show the Regula copyright footer. | `boolean` | `true` | `true`, `false` | `face-liveness`, `face-capture` |
197
+ | `copyright` | Whether to show the Regula copyright footer. | `boolean` | `true` | `true`, `false` | `face-liveness`, `face-capture` |
195
198
  | `cameraId` | Ability to select a camera by defining the camera ID. | `string` | `undefined` | `camera id string value` | `face-liveness`, `face-capture` |
196
199
  | `changeCamera` | Whether to show the "Camera Switch" button. Note that if `livenessType = 0` (active liveness), the button will not be displayed on mobile devices regardless of the `changeCamera` setting. | `boolean` | `true` | `true`, `false` | `face-liveness`, `face-capture` |
197
200
  | `startScreen` | Whether to show the Start screen with video instructions. If `true`, the start screen is shown. If `false`, no start screen is shown and instead the camera of the device is turned on automatically to capture a face. | `boolean` | `true` | `true`, `false` | `face-liveness`, `face-capture` |
@@ -257,10 +260,12 @@ component.settings = {
257
260
  ```
258
261
 
259
262
  ### CSS Parts
260
- To customize the appearance, use the part attribute and define the desired CSS properties. (Note: The specificity of the ::part styles is greater than that of the styles set via settings). Examples:
261
263
 
262
- ```css
264
+ To customize the appearance, use the `::part` attribute to define the desired CSS properties. Note that `::part` styles take precedence over styles set via settings.
265
+
266
+ For example:
263
267
 
268
+ ```javascript
264
269
  /** general component overlay */
265
270
  face-liveness {
266
271
  background-color: #e6e6e6;
@@ -357,7 +362,37 @@ face-liveness::part(retry-screen-subtitle-text) {
357
362
  }
358
363
  ```
359
364
 
360
- For more details about ::part() CSS pseudo-elements, see the article at [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/CSS/::part).
365
+ For more details about `::part()` CSS pseudo-elements, see the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/::part" target="_blank">MDN Web Docs article</a>.
366
+
367
+ ## Package Resources
368
+
369
+ For proper operation, Face SDK Web Components require several package files:
370
+
371
+ * WASM (`Liveness.wasm`, `Liveness.data`)
372
+ * worker (`Liveness.worker.js`)
373
+
374
+ By default, these files are downloaded from Regula servers, but you can set your own sources. To do this, perform the following steps:
375
+
376
+ **1.** Retrieve the current worker path from the component settings. This path points to where the files are currently being loaded from (on Regula servers):
377
+
378
+ ```javascript
379
+ const component = document.querySelector('face-liveness');
380
+ const workerPath = component.settings.workerPath;
381
+ ```
382
+
383
+ **2.** Upload all files (`Liveness.worker.js`, `Liveness.wasm`, `Liveness.data`) to your own location.
384
+
385
+ !!! warning
386
+ The files must be located in the same directory and have the same names as called before.
387
+
388
+ **3.** Update the `workerPath` setting to your custom host directory where all three files are located:
389
+
390
+ ```javascript
391
+ const component = document.querySelector('face-liveness');
392
+ component.settings.workerPath = 'https://<CUSTOM_PATH_TO_WASM_AND_WORKER_FILES_PATH>';
393
+ ```
394
+
395
+ To decrease file size, on your server you can apply the desired <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding" target="_blank">compression method</a>.
361
396
 
362
397
 
363
398
  ## Events
@@ -386,7 +421,7 @@ The generated event object (`event.detail`) contains three fields that describe
386
421
  }
387
422
  ```
388
423
 
389
- Type of actions:
424
+ ### Type of actions
390
425
 
391
426
  | Type of action | Description of the action | The component |
392
427
  |:-------------------------|:---------------------------------------------------------------------------------------|:-------------------------------|
@@ -416,7 +451,7 @@ In cases of unsuccessful work, the `data` field will contain the following field
416
451
  }
417
452
  ```
418
453
 
419
- Table of event causes:
454
+ ### Table of event causes
420
455
 
421
456
  | Reason | Description of the reason |
422
457
  |:----------------------------|:--------------------------------------------------------------------------------------------------------|
@@ -436,21 +471,16 @@ Table of event causes:
436
471
  | `INCORRECT_CAMERA_ID` | No camera with the specified ID found. |
437
472
  | `WEBSERVICE_NOT_COMPATIBLE` | The web service and component versions are incompatible. |
438
473
  | `HTTP_NOT_SUPPORTED` | The web component does not work over the HTTP protocol, use HTTPS instead. |
439
- | `CANCELLED` | The user has clicked by close button |
440
-
441
- The table below describes the cases of event generation:
474
+ | `CANCELLED` | The user has clicked the Close button. |
442
475
 
443
- ### face-liveness & face-capture
476
+ ### Cases of event generation
444
477
 
445
478
  <table>
446
479
  <thead>
447
480
  <tr>
448
- <th>Event condition </th>
481
+ <th>Event condition</th>
449
482
  <th>Event type</th>
450
- <th>
451
-
452
- Event object `event.detail`
453
- </th>
483
+ <th>Event object `event.detail`</th>
454
484
  <th>Description</th>
455
485
  </tr>
456
486
  </thead>
@@ -458,12 +488,7 @@ Event object `event.detail`
458
488
  <tr>
459
489
  <td>The component is mounted in the DOM.</td>
460
490
  <td>
461
-
462
- `face-liveness`
463
- <br>
464
- <br>
465
- `face-capture`
466
-
491
+ `face-liveness`<br><br>`face-capture`
467
492
  </td>
468
493
  <td>
469
494
 
@@ -476,7 +501,6 @@ Event object `event.detail`
476
501
 
477
502
  </td>
478
503
  <td>
479
-
480
504
  To receive this event, you must wrap the component in another element (for example, a div) and add an addEventListener to it. When the component appears in the DOM, the event will pop up.
481
505
 
482
506
  For example:
@@ -489,15 +513,11 @@ For example:
489
513
 
490
514
  </td>
491
515
  </tr>
516
+
492
517
  <tr>
493
- <td>The "Get started" button is pressed.</td>
518
+ <td>The "Get started" button was pressed.</td>
494
519
  <td>
495
-
496
- `face-liveness`
497
- <br>
498
- <br>
499
- `face-capture`
500
-
520
+ `face-liveness`<br><br>`face-capture`
501
521
  </td>
502
522
  <td>
503
523
 
@@ -511,15 +531,11 @@ For example:
511
531
  </td>
512
532
  <td></td>
513
533
  </tr>
534
+
514
535
  <tr>
515
- <td>The "Retry" button is pressed.</td>
536
+ <td>The "Retry" button was pressed.</td>
516
537
  <td>
517
-
518
- `face-liveness`
519
- <br>
520
- <br>
521
- `face-capture`
522
-
538
+ `face-liveness`<br><br>`face-capture`
523
539
  </td>
524
540
  <td>
525
541
 
@@ -533,37 +549,75 @@ For example:
533
549
  </td>
534
550
  <td></td>
535
551
  </tr>
552
+
536
553
  <tr>
537
- <td>The "Close" button is pressed.</td>
554
+ <td>The "Close" button was pressed.</td>
538
555
  <td>
539
-
540
- `face-liveness`
541
- <br>
542
- <br>
543
556
  `face-capture`
544
-
545
557
  </td>
546
558
  <td>
547
559
 
548
560
  ```javascript
549
561
  {
550
562
  action: "CLOSE",
551
- data: null
563
+ data: {
564
+ reason: "CANCELLED",
565
+ status: 0
566
+ }
552
567
  }
553
568
  ```
554
569
 
555
570
  </td>
556
571
  <td></td>
557
572
  </tr>
573
+
558
574
  <tr>
559
- <td>The work of the component is completed successfully.</td>
575
+ <td>The liveness assessment session had not started, but the "Close" button was pressed.</td>
576
+ <td>
577
+ `face-liveness`
578
+ </td>
560
579
  <td>
561
580
 
581
+ ```javascript
582
+ {
583
+ action: "CLOSE",
584
+ data: {
585
+ reason: "CANCELLED",
586
+ status: 0
587
+ }
588
+ }
589
+ ```
590
+
591
+ </td>
592
+ <td></td>
593
+ </tr>
594
+
595
+ <tr>
596
+ <td>The liveness assessment session had started before the "Close" button was pressed.</td>
597
+ <td>
562
598
  `face-liveness`
563
- <br>
564
- <br>
565
- `face-capture`
599
+ </td>
600
+ <td>
601
+
602
+ ```javascript
603
+ {
604
+ action: "CLOSE",
605
+ data: {
606
+ reason: "CANCELLED",
607
+ transactionId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
608
+ status: 0
609
+ }
610
+ }
611
+ ```
566
612
 
613
+ </td>
614
+ <td></td>
615
+ </tr>
616
+
617
+ <tr>
618
+ <td>The work of the component is completed successfully.</td>
619
+ <td>
620
+ `face-liveness`<br><br>`face-capture`
567
621
  </td>
568
622
  <td>
569
623
 
@@ -571,24 +625,41 @@ For example:
571
625
  {
572
626
  action: "PROCESS_FINISHED",
573
627
  data: {
574
- response: { ... },
575
- status: 1
576
- },
628
+ response: { ... },
629
+ status: 1
630
+ }
577
631
  }
578
632
  ```
579
633
 
580
634
  </td>
581
635
  <td></td>
582
636
  </tr>
637
+
583
638
  <tr>
584
639
  <td>The work of the component failed.</td>
585
640
  <td>
586
-
587
- `face-liveness`
588
- <br>
589
- <br>
590
641
  `face-capture`
642
+ </td>
643
+ <td>
644
+
645
+ ```javascript
646
+ {
647
+ action: "PROCESS_FINISHED",
648
+ data: {
649
+ reason: "An event has occurred",
650
+ status: 0
651
+ }
652
+ }
653
+ ```
591
654
 
655
+ </td>
656
+ <td></td>
657
+ </tr>
658
+
659
+ <tr>
660
+ <td>The liveness assessment session had not started, but the work of the component failed.</td>
661
+ <td>
662
+ `face-liveness`
592
663
  </td>
593
664
  <td>
594
665
 
@@ -598,22 +669,61 @@ For example:
598
669
  data: {
599
670
  reason: "An event has occurred",
600
671
  status: 0
601
- },
672
+ }
673
+ }
674
+ ```
675
+
676
+ </td>
677
+ <td></td>
678
+ </tr>
679
+
680
+ <tr>
681
+ <td>The liveness assessment session had started, and then the work of the component failed.</td>
682
+ <td>
683
+ `face-liveness`
684
+ </td>
685
+ <td>
686
+
687
+ ```javascript
688
+ {
689
+ action: "PROCESS_FINISHED",
690
+ data: {
691
+ reason: "An event has occurred",
692
+ transactionId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
693
+ status: 0
694
+ }
602
695
  }
603
696
  ```
604
697
 
605
698
  </td>
606
699
  <td></td>
607
700
  </tr>
701
+
608
702
  <tr>
609
703
  <td>The work of the component finished by timeout.</td>
704
+ <td>
705
+ `face-capture`
706
+ </td>
610
707
  <td>
611
708
 
612
- `face-liveness`
613
- <br>
614
- <br>
615
- `face-capture`
709
+ ```javascript
710
+ {
711
+ action: "PROCESS_FINISHED",
712
+ data: {
713
+ reason: "TIMEOUT_ERROR",
714
+ status: 0
715
+ }
716
+ }
717
+ ```
616
718
 
719
+ </td>
720
+ <td></td>
721
+ </tr>
722
+
723
+ <tr>
724
+ <td>The work of the component finished by timeout.</td>
725
+ <td>
726
+ `face-liveness`
617
727
  </td>
618
728
  <td>
619
729
 
@@ -621,30 +731,46 @@ For example:
621
731
  {
622
732
  action: "PROCESS_FINISHED",
623
733
  data: {
624
- reason: "TIMEOUT_ERROR"
734
+ reason: "TIMEOUT_ERROR",
735
+ transactionId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
625
736
  status: 0
626
- },
737
+ }
627
738
  }
628
739
  ```
629
740
 
630
741
  </td>
631
742
  <td></td>
632
743
  </tr>
744
+
633
745
  <tr>
634
746
  <td>The component is initialized and ready to work.</td>
635
747
  <td>
636
-
637
- `face-liveness`
638
- <br>
639
- <br>
640
748
  `face-capture`
749
+ </td>
750
+ <td>
751
+
752
+ ```javascript
753
+ {
754
+ action: "SERVICE_INITIALIZED",
755
+ data: null
756
+ }
757
+ ```
641
758
 
759
+ </td>
760
+ <td></td>
761
+ </tr>
762
+
763
+ <tr>
764
+ <td>The component is initialized and ready to work.</td>
765
+ <td>
766
+ `face-liveness`
642
767
  </td>
643
768
  <td>
644
769
 
645
770
  ```javascript
646
771
  {
647
772
  action: "SERVICE_INITIALIZED",
773
+ transactionId: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
648
774
  data: null
649
775
  }
650
776
  ```
@@ -652,6 +778,7 @@ For example:
652
778
  </td>
653
779
  <td></td>
654
780
  </tr>
781
+
655
782
  </tbody>
656
783
  </table>
657
784
 
@@ -769,7 +896,6 @@ The list of labels used in the component:
769
896
  | **turnHeadLeft** | Turn head left a bit to look straight | `face-liveness`, `face-capture` |
770
897
  | **turnHeadRight** | Turn head right a bit to look straight | `face-liveness`, `face-capture` |
771
898
 
772
-
773
899
  ## Examples
774
900
 
775
901
  You can find examples of using the components on the <a href="https://github.com/regulaforensics/face-web-components-samples" target="_blank">Samples page</a>.
package/dist/index.d.ts CHANGED
@@ -180,7 +180,48 @@ export declare class FaceLivenessWebComponent extends HTMLElement {
180
180
  disconnectedCallback(): void;
181
181
  }
182
182
 
183
- export declare type FaceTranslations = Partial<Record<Labels, string>>;
183
+ export declare interface FaceTranslations {
184
+ showOnlyOneFace?: string;
185
+ preparingCamera?: string;
186
+ allowAccessCamera?: string;
187
+ somethingWentWrong?: string;
188
+ incorrectCameraId?: string;
189
+ checkCameraId?: string;
190
+ preparingService?: string;
191
+ allowAccessToCamera?: string;
192
+ error?: string;
193
+ versionNotSupported?: string;
194
+ updateBrowser?: string;
195
+ licenseError?: string;
196
+ licenseExpired?: string;
197
+ onlyPortraitOrientation?: string;
198
+ turnDeviceIntoPortrait?: string;
199
+ tryAgain?: string;
200
+ noCameraAvailable?: string;
201
+ checkCameraConnection?: string;
202
+ noMaskSunglassesHeaddress?: string;
203
+ ambientLighting?: string;
204
+ lookStraight?: string;
205
+ fitYourFace?: string;
206
+ moveCloser?: string;
207
+ moveAway?: string;
208
+ holdSteady?: string;
209
+ turnHead?: string;
210
+ processing?: string;
211
+ retryButtonText?: string;
212
+ followGuidelinesText?: string;
213
+ letsTryAgainTitle?: string;
214
+ noCameraPermission?: string;
215
+ goButton?: string;
216
+ centerFaceTurnHead?: string;
217
+ centerFace?: string;
218
+ selfieTime?: string;
219
+ errorCode?: string;
220
+ illumination?: string;
221
+ cameraLevel?: string;
222
+ noAccessories?: string;
223
+ getReady?: string;
224
+ }
184
225
 
185
226
  export declare class FullScreenContainer extends HTMLElement {
186
227
  private _root;
@@ -202,11 +243,7 @@ export declare interface IFaceLiveness extends IFaceDetection {
202
243
  'device-orientation'?: boolean;
203
244
  }
204
245
 
205
- declare type Labels = 'showOnlyOneFace' | 'preparingCamera' | 'allowAccessCamera' | 'somethingWentWrong' | 'incorrectCameraId' | 'checkCameraId' | 'preparingService' | 'allowAccessToCamera' | 'error' | 'versionNotSupported' | 'updateBrowser' | 'licenseError' | 'licenseExpired' | 'onlyPortraitOrientation' | 'turnDeviceIntoPortrait' | 'tryAgain' | 'noCameraAvailable' | 'checkCameraConnection' | 'noMaskSunglassesHeaddress' | 'ambientLighting' | 'lookStraight' | 'fitYourFace' | 'moveCloser' | 'moveAway' | 'holdSteady' | 'turnHead' | 'removeOcclusion' | 'turnHeadUp' | 'turnHeadDown' | 'turnHeadLeft' | 'turnHeadRight' | 'blinkYourEyes' | 'processing' | 'retryButtonText' | 'followGuidelinesText' | 'letsTryAgainTitle' | 'noCameraPermission' | 'goButton' | 'centerFaceTurnHead' | 'centerFace' | 'selfieTime' | 'errorCode' | 'illumination' | 'cameraLevel' | 'noAccessories' | 'getReady' | 'httpNotSupported' | 'webServerNotCompatible' | 'processCompleted';
206
-
207
- declare type Languages = 'ru' | 'en' | 'de' | 'pl' | 'it' | 'hu' | 'zh' | 'sk' | 'uk' | 'fr' | 'es' | 'pt' | 'ar' | 'nl' | 'id' | 'vi' | 'ko' | 'ms' | 'ro' | 'el' | 'tr' | 'ja' | 'cs' | 'th' | 'hi' | 'bn' | 'he' | 'fi' | 'sv' | 'da' | 'hr' | 'no';
208
-
209
- export declare type Locales = Languages | string;
246
+ export declare type Locales = 'ru' | 'en' | 'de' | 'pl' | 'it' | 'hu' | 'zh' | 'sk' | 'uk' | 'fr' | 'es' | 'pt' | 'ar' | 'nl' | 'id' | 'vi' | 'ko' | 'ms' | 'ro' | 'el' | 'tr' | 'ja' | 'cs' | 'th' | 'hi' | 'bn' | 'he' | 'fi' | 'sv' | 'da' | 'hr' | 'no' | string;
210
247
 
211
248
  export declare const RecordingProcess: {
212
249
  readonly ASYNCHRONOUS_UPLOAD: 0;