ngx-scandoc 15.1.9 → 15.2.1

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.
@@ -357,12 +357,16 @@ class WebcamComponent extends BaseComponent {
357
357
  if (max &&
358
358
  currentWidth &&
359
359
  max > currentWidth &&
360
- conWidth != max) {
361
- console.log('[SET NEW RESOLUTION]');
360
+ conWidth != max &&
361
+ currentWidth != 1920) {
362
+ console.log('[SET NEW RESOLUTION] ', max, currentWidth);
362
363
  this.setupAttempt++;
363
364
  if (this.setupAttempt < 4) {
364
365
  this.setup(videoTrackConstraints);
365
366
  }
367
+ else {
368
+ this.setDeviceId(stream);
369
+ }
366
370
  }
367
371
  else {
368
372
  this.setDeviceId(stream);
@@ -759,7 +763,7 @@ class ScanProvider {
759
763
  this.injector = injector;
760
764
  // enableVerification = true;
761
765
  this.config = this.injector.get(SCAN_CONFIG_TOKEN);
762
- this.canStoreImages = this.config.development;
766
+ this.canStoreImages = this.config.canStoreImages;
763
767
  }
764
768
  genderList() {
765
769
  return {
@@ -806,11 +810,12 @@ class ScanProvider {
806
810
  });
807
811
  return $request;
808
812
  }
809
- burst(Images) {
813
+ burst(Images, BlurValues) {
810
814
  const data = {
811
815
  AcceptTermsAndConditions: true,
812
816
  DataFields: {
813
817
  Images,
818
+ BlurValues,
814
819
  },
815
820
  };
816
821
  const $request = this.http.post(this.config.validationPath, data);
@@ -2488,6 +2493,7 @@ class ScanComponent extends BaseComponent {
2488
2493
  Response: null,
2489
2494
  ExpectedOutput: null,
2490
2495
  };
2496
+ this.blurValues = [];
2491
2497
  this.scanDatas = [];
2492
2498
  this.idScan = null;
2493
2499
  this.validation = false;
@@ -2585,6 +2591,7 @@ class ScanComponent extends BaseComponent {
2585
2591
  this.scannedImages = [];
2586
2592
  const imagesArray = images.map((m) => m.imageResized.split(',')[1]);
2587
2593
  this.validation = true;
2594
+ // console.log('BURST');
2588
2595
  this.handleBurstData(imagesArray, images);
2589
2596
  }
2590
2597
  else {
@@ -2595,7 +2602,7 @@ class ScanComponent extends BaseComponent {
2595
2602
  });
2596
2603
  }
2597
2604
  handleBurstData(imagesArray, images, type = 'plain') {
2598
- this.__subs(this.scanProvider.burst(imagesArray)).subscribe((resp) => {
2605
+ this.__subs(this.scanProvider.burst(imagesArray, this.blurValues)).subscribe((resp) => {
2599
2606
  this.displayInfo = 'scandoc.info.c' + resp.InfoCode;
2600
2607
  // console.timeEnd('validationPOST');
2601
2608
  // console.log('AnalysisTime', resp.AnalysisTime);
@@ -2604,6 +2611,13 @@ class ScanComponent extends BaseComponent {
2604
2611
  // this.handleLongValidationError(image);
2605
2612
  // }
2606
2613
  // console.warn(resp.Validated, this.numberOfValidations);
2614
+ if (resp.DetectedBlurValue) {
2615
+ this.blurValues.push(resp.DetectedBlurValue);
2616
+ }
2617
+ else {
2618
+ this.blurValues = [];
2619
+ }
2620
+ console.log();
2607
2621
  if (resp.Validated) {
2608
2622
  this.numberOfValidations++;
2609
2623
  this.validationDebug.push(resp);
@@ -2612,7 +2626,7 @@ class ScanComponent extends BaseComponent {
2612
2626
  this.numberOfValidations = 0;
2613
2627
  this.validationDebug = [];
2614
2628
  }
2615
- if (this.numberOfValidations >= 3) {
2629
+ if (resp.Validated) {
2616
2630
  this.displayInfo = '';
2617
2631
  // console.log('[SCANNED INDEX]', resp.Index);
2618
2632
  const selectedImage = images[resp.Index];
@@ -2641,6 +2655,7 @@ class ScanComponent extends BaseComponent {
2641
2655
  this.scanBlastFinish();
2642
2656
  }
2643
2657
  else {
2658
+ this.blurValues = [];
2644
2659
  this.numberOfValidations = 0;
2645
2660
  // console.warn('DEBUG',Side,this.validationDebug)
2646
2661
  this.validationDebug = [];
@@ -2756,43 +2771,6 @@ class ScanComponent extends BaseComponent {
2756
2771
  this.isMobile = !v.matches || this.platform.IOS || this.platform.ANDROID;
2757
2772
  console.log('MNOBILE', this.isMobile);
2758
2773
  });
2759
- // this.imageHandlerSubscription = this.imageHandler.subscribe(
2760
- // (webcamImage: any) => {
2761
- // // return;
2762
- // if (this.startTime === 0) {
2763
- // this.startTime = Date.now();
2764
- // }
2765
- // this.zone.runOutsideAngular(() => {
2766
- // if (webcamImage.base64) {
2767
- // const time = new Date().getTime();
2768
- // if (this.scanImageTimestamps.load > 0) {
2769
- // const { load } = this.scanImageTimestamps;
2770
- // const diff = time - load;
2771
- // // console.warn('TIME', diff);
2772
- // this.scanDelay = diff;
2773
- // }
2774
- // this.scanImageTimestamps.load = time;
2775
- // this.scannedImages.push(webcamImage);
2776
- // this.handleLongValidationError(webcamImage, 'worker');
2777
- // }
2778
- // // this.cd.detectChanges();
2779
- // if (this.scannedImages.length > 4 && !this.validation) {
2780
- // // get last 10
2781
- // console.timeEnd('validationTOTAL_UI');
2782
- // console.time('validationTOTAL_UI');
2783
- // const images = this.scannedImages.slice(-5);
2784
- // // set images to 0
2785
- // this.scannedImages = [];
2786
- // console.log(images);
2787
- // const imagesArray = images.map((m) => m.base64.split(',')[1]);
2788
- // this.validation = true;
2789
- // // this.handleBurstData(imagesArray, images, 'worker');
2790
- // console.time('validationPOST');
2791
- // }
2792
- // this.cd.detectChanges();
2793
- // });
2794
- // }
2795
- // );
2796
2774
  }
2797
2775
  handleBitmapImage(bitmap) {
2798
2776
  const { width, height } = bitmap;
@@ -3036,7 +3014,7 @@ class ScanComponent extends BaseComponent {
3036
3014
  }
3037
3015
  use() {
3038
3016
  // save images??
3039
- if (this.scanProvider.canStoreImages) {
3017
+ if (this.scanProvider.config.sendLog) {
3040
3018
  this.logData.ExpectedOutput = JSON.parse(JSON.stringify(this.model));
3041
3019
  if (this.logData.ExpectedOutput?._avatar) {
3042
3020
  delete this.logData.ExpectedOutput._avatar;