ngx-scandoc 15.2.1 → 15.2.3

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.
@@ -801,6 +801,15 @@ class ScanProvider {
801
801
  const $request = this.http.post(this.config.stateLessPath, data);
802
802
  return $request;
803
803
  }
804
+ sendErrorLog(data) {
805
+ return this.http.post(this.config.errorLoggingPath, data);
806
+ }
807
+ /**
808
+ *
809
+ * @param data
810
+ * @returns
811
+ * @deprecated
812
+ */
804
813
  sendLog(data) {
805
814
  const { TransactionID } = data.Response;
806
815
  const $request = this.http.post(this.config.errorLoggingPath, data, {
@@ -2568,7 +2577,6 @@ class ScanComponent extends BaseComponent {
2568
2577
  this.scanImageTimestamps.load = time;
2569
2578
  if (webcamImage.imageAsDataUrl) {
2570
2579
  this.scannedImages.push(webcamImage);
2571
- this.handleLongValidationError(webcamImage, 'worker');
2572
2580
  }
2573
2581
  this.cd.detectChanges();
2574
2582
  if (this.scannedImages.length > 0 && !this.validation) {
@@ -2606,9 +2614,10 @@ class ScanComponent extends BaseComponent {
2606
2614
  this.displayInfo = 'scandoc.info.c' + resp.InfoCode;
2607
2615
  // console.timeEnd('validationPOST');
2608
2616
  // console.log('AnalysisTime', resp.AnalysisTime);
2609
- const { DocType, Series, Side, InfoCode } = resp;
2617
+ const { DocType, Series, Side, InfoCode, TransactionID } = resp;
2618
+ this.handleLongValidationError(TransactionID, images[0].imageAsDataUrl.split(',')[1]);
2610
2619
  // if (InfoCode === '1006' && this.idScan) {
2611
- // this.handleLongValidationError(image);
2620
+ // this.handleLongVaylidationError(image);
2612
2621
  // }
2613
2622
  // console.warn(resp.Validated, this.numberOfValidations);
2614
2623
  if (resp.DetectedBlurValue) {
@@ -2717,9 +2726,24 @@ class ScanComponent extends BaseComponent {
2717
2726
  // }
2718
2727
  // this.scanProvider.sendLog(this.logData).subscribe();
2719
2728
  // console.log('LOG DATA', this.logData);
2720
- this.__subs(this.scanProvider.sendLog(this.logData)).subscribe();
2729
+ // this.__subs(this.scanProvider.sendLog(this.logData)).subscribe();
2721
2730
  }
2722
- handleLongValidationError(img, type = 'plain') {
2731
+ sendErrorLog(TransactionID, image) {
2732
+ const { browser, os, device } = this.deviceService;
2733
+ const FrontImage = this.scanBlastData[0]?.image ? this.getImgBase64(0) : null;
2734
+ const out = {
2735
+ OS: os,
2736
+ Device: device,
2737
+ Browser: browser,
2738
+ TransactionID,
2739
+ AcceptTermsAndConditions: true,
2740
+ FrontImage: FrontImage || image,
2741
+ BackImage: FrontImage ? image : '',
2742
+ };
2743
+ console.log(out);
2744
+ this.__subs(this.scanProvider.sendErrorLog(out)).subscribe();
2745
+ }
2746
+ handleLongValidationError(TransactionID, image) {
2723
2747
  // save current image after 10sec
2724
2748
  let MANUAL_INTERVAL = this.scanProvider.config.manualScanDelay;
2725
2749
  const diff = (Date.now() - this.startTime) / 1000;
@@ -2732,6 +2756,9 @@ class ScanComponent extends BaseComponent {
2732
2756
  if (this.scanProvider.config.manualModeEnabled) {
2733
2757
  this.promptManual = true;
2734
2758
  }
2759
+ if (this.scanProvider.config.errorLogging) {
2760
+ this.sendErrorLog(TransactionID, image);
2761
+ }
2735
2762
  // }
2736
2763
  this.startTime = Date.now();
2737
2764
  });
@@ -3014,14 +3041,14 @@ class ScanComponent extends BaseComponent {
3014
3041
  }
3015
3042
  use() {
3016
3043
  // save images??
3017
- if (this.scanProvider.config.sendLog) {
3018
- this.logData.ExpectedOutput = JSON.parse(JSON.stringify(this.model));
3019
- if (this.logData.ExpectedOutput?._avatar) {
3020
- delete this.logData.ExpectedOutput._avatar;
3021
- }
3022
- this.__subs(this.scanProvider.sendLog(this.logData)).subscribe();
3023
- console.log(this.logData);
3024
- }
3044
+ // if (this.scanProvider.config.sendLog) {
3045
+ // this.logData.ExpectedOutput = JSON.parse(JSON.stringify(this.model));
3046
+ // if (this.logData.ExpectedOutput?._avatar) {
3047
+ // delete this.logData.ExpectedOutput._avatar;
3048
+ // }
3049
+ // // this.__subs(this.scanProvider.sendLog(this.logData)).subscribe();
3050
+ // console.log(this.logData);
3051
+ // }
3025
3052
  this.actions.emit({
3026
3053
  type: 'scanDataClose',
3027
3054
  data: {