ngx-scandoc 15.2.2 → 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.
- package/core/components/scan/scan.component.d.ts +2 -0
- package/core/interfaces/config.d.ts +1 -0
- package/esm2020/core/components/scan/scan.component.mjs +44 -53
- package/esm2020/core/interfaces/config.mjs +1 -1
- package/esm2020/providers/scan.provider.mjs +12 -2
- package/fesm2015/ngx-scandoc.mjs +55 -54
- package/fesm2015/ngx-scandoc.mjs.map +1 -1
- package/fesm2020/ngx-scandoc.mjs +54 -53
- package/fesm2020/ngx-scandoc.mjs.map +1 -1
- package/package.json +1 -1
- package/providers/scan.provider.d.ts +8 -1
- package/src/assets/i18n/de.json +3 -1
- package/src/assets/i18n/en.json +3 -2
- package/src/assets/i18n/hr.json +3 -1
- package/src/assets/i18n/it.json +3 -1
package/fesm2020/ngx-scandoc.mjs
CHANGED
|
@@ -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, {
|
|
@@ -810,11 +819,12 @@ class ScanProvider {
|
|
|
810
819
|
});
|
|
811
820
|
return $request;
|
|
812
821
|
}
|
|
813
|
-
burst(Images) {
|
|
822
|
+
burst(Images, BlurValues) {
|
|
814
823
|
const data = {
|
|
815
824
|
AcceptTermsAndConditions: true,
|
|
816
825
|
DataFields: {
|
|
817
826
|
Images,
|
|
827
|
+
BlurValues,
|
|
818
828
|
},
|
|
819
829
|
};
|
|
820
830
|
const $request = this.http.post(this.config.validationPath, data);
|
|
@@ -2492,6 +2502,7 @@ class ScanComponent extends BaseComponent {
|
|
|
2492
2502
|
Response: null,
|
|
2493
2503
|
ExpectedOutput: null,
|
|
2494
2504
|
};
|
|
2505
|
+
this.blurValues = [];
|
|
2495
2506
|
this.scanDatas = [];
|
|
2496
2507
|
this.idScan = null;
|
|
2497
2508
|
this.validation = false;
|
|
@@ -2566,7 +2577,6 @@ class ScanComponent extends BaseComponent {
|
|
|
2566
2577
|
this.scanImageTimestamps.load = time;
|
|
2567
2578
|
if (webcamImage.imageAsDataUrl) {
|
|
2568
2579
|
this.scannedImages.push(webcamImage);
|
|
2569
|
-
this.handleLongValidationError(webcamImage, 'worker');
|
|
2570
2580
|
}
|
|
2571
2581
|
this.cd.detectChanges();
|
|
2572
2582
|
if (this.scannedImages.length > 0 && !this.validation) {
|
|
@@ -2589,6 +2599,7 @@ class ScanComponent extends BaseComponent {
|
|
|
2589
2599
|
this.scannedImages = [];
|
|
2590
2600
|
const imagesArray = images.map((m) => m.imageResized.split(',')[1]);
|
|
2591
2601
|
this.validation = true;
|
|
2602
|
+
// console.log('BURST');
|
|
2592
2603
|
this.handleBurstData(imagesArray, images);
|
|
2593
2604
|
}
|
|
2594
2605
|
else {
|
|
@@ -2599,15 +2610,23 @@ class ScanComponent extends BaseComponent {
|
|
|
2599
2610
|
});
|
|
2600
2611
|
}
|
|
2601
2612
|
handleBurstData(imagesArray, images, type = 'plain') {
|
|
2602
|
-
this.__subs(this.scanProvider.burst(imagesArray)).subscribe((resp) => {
|
|
2613
|
+
this.__subs(this.scanProvider.burst(imagesArray, this.blurValues)).subscribe((resp) => {
|
|
2603
2614
|
this.displayInfo = 'scandoc.info.c' + resp.InfoCode;
|
|
2604
2615
|
// console.timeEnd('validationPOST');
|
|
2605
2616
|
// console.log('AnalysisTime', resp.AnalysisTime);
|
|
2606
|
-
const { DocType, Series, Side, InfoCode } = resp;
|
|
2617
|
+
const { DocType, Series, Side, InfoCode, TransactionID } = resp;
|
|
2618
|
+
this.handleLongValidationError(TransactionID, images[0].imageAsDataUrl.split(',')[1]);
|
|
2607
2619
|
// if (InfoCode === '1006' && this.idScan) {
|
|
2608
|
-
// this.
|
|
2620
|
+
// this.handleLongVaylidationError(image);
|
|
2609
2621
|
// }
|
|
2610
2622
|
// console.warn(resp.Validated, this.numberOfValidations);
|
|
2623
|
+
if (resp.DetectedBlurValue) {
|
|
2624
|
+
this.blurValues.push(resp.DetectedBlurValue);
|
|
2625
|
+
}
|
|
2626
|
+
else {
|
|
2627
|
+
this.blurValues = [];
|
|
2628
|
+
}
|
|
2629
|
+
console.log();
|
|
2611
2630
|
if (resp.Validated) {
|
|
2612
2631
|
this.numberOfValidations++;
|
|
2613
2632
|
this.validationDebug.push(resp);
|
|
@@ -2616,7 +2635,7 @@ class ScanComponent extends BaseComponent {
|
|
|
2616
2635
|
this.numberOfValidations = 0;
|
|
2617
2636
|
this.validationDebug = [];
|
|
2618
2637
|
}
|
|
2619
|
-
if (
|
|
2638
|
+
if (resp.Validated) {
|
|
2620
2639
|
this.displayInfo = '';
|
|
2621
2640
|
// console.log('[SCANNED INDEX]', resp.Index);
|
|
2622
2641
|
const selectedImage = images[resp.Index];
|
|
@@ -2645,6 +2664,7 @@ class ScanComponent extends BaseComponent {
|
|
|
2645
2664
|
this.scanBlastFinish();
|
|
2646
2665
|
}
|
|
2647
2666
|
else {
|
|
2667
|
+
this.blurValues = [];
|
|
2648
2668
|
this.numberOfValidations = 0;
|
|
2649
2669
|
// console.warn('DEBUG',Side,this.validationDebug)
|
|
2650
2670
|
this.validationDebug = [];
|
|
@@ -2706,9 +2726,24 @@ class ScanComponent extends BaseComponent {
|
|
|
2706
2726
|
// }
|
|
2707
2727
|
// this.scanProvider.sendLog(this.logData).subscribe();
|
|
2708
2728
|
// console.log('LOG DATA', this.logData);
|
|
2709
|
-
this.__subs(this.scanProvider.sendLog(this.logData)).subscribe();
|
|
2729
|
+
// this.__subs(this.scanProvider.sendLog(this.logData)).subscribe();
|
|
2730
|
+
}
|
|
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();
|
|
2710
2745
|
}
|
|
2711
|
-
handleLongValidationError(
|
|
2746
|
+
handleLongValidationError(TransactionID, image) {
|
|
2712
2747
|
// save current image after 10sec
|
|
2713
2748
|
let MANUAL_INTERVAL = this.scanProvider.config.manualScanDelay;
|
|
2714
2749
|
const diff = (Date.now() - this.startTime) / 1000;
|
|
@@ -2721,6 +2756,9 @@ class ScanComponent extends BaseComponent {
|
|
|
2721
2756
|
if (this.scanProvider.config.manualModeEnabled) {
|
|
2722
2757
|
this.promptManual = true;
|
|
2723
2758
|
}
|
|
2759
|
+
if (this.scanProvider.config.errorLogging) {
|
|
2760
|
+
this.sendErrorLog(TransactionID, image);
|
|
2761
|
+
}
|
|
2724
2762
|
// }
|
|
2725
2763
|
this.startTime = Date.now();
|
|
2726
2764
|
});
|
|
@@ -2760,43 +2798,6 @@ class ScanComponent extends BaseComponent {
|
|
|
2760
2798
|
this.isMobile = !v.matches || this.platform.IOS || this.platform.ANDROID;
|
|
2761
2799
|
console.log('MNOBILE', this.isMobile);
|
|
2762
2800
|
});
|
|
2763
|
-
// this.imageHandlerSubscription = this.imageHandler.subscribe(
|
|
2764
|
-
// (webcamImage: any) => {
|
|
2765
|
-
// // return;
|
|
2766
|
-
// if (this.startTime === 0) {
|
|
2767
|
-
// this.startTime = Date.now();
|
|
2768
|
-
// }
|
|
2769
|
-
// this.zone.runOutsideAngular(() => {
|
|
2770
|
-
// if (webcamImage.base64) {
|
|
2771
|
-
// const time = new Date().getTime();
|
|
2772
|
-
// if (this.scanImageTimestamps.load > 0) {
|
|
2773
|
-
// const { load } = this.scanImageTimestamps;
|
|
2774
|
-
// const diff = time - load;
|
|
2775
|
-
// // console.warn('TIME', diff);
|
|
2776
|
-
// this.scanDelay = diff;
|
|
2777
|
-
// }
|
|
2778
|
-
// this.scanImageTimestamps.load = time;
|
|
2779
|
-
// this.scannedImages.push(webcamImage);
|
|
2780
|
-
// this.handleLongValidationError(webcamImage, 'worker');
|
|
2781
|
-
// }
|
|
2782
|
-
// // this.cd.detectChanges();
|
|
2783
|
-
// if (this.scannedImages.length > 4 && !this.validation) {
|
|
2784
|
-
// // get last 10
|
|
2785
|
-
// console.timeEnd('validationTOTAL_UI');
|
|
2786
|
-
// console.time('validationTOTAL_UI');
|
|
2787
|
-
// const images = this.scannedImages.slice(-5);
|
|
2788
|
-
// // set images to 0
|
|
2789
|
-
// this.scannedImages = [];
|
|
2790
|
-
// console.log(images);
|
|
2791
|
-
// const imagesArray = images.map((m) => m.base64.split(',')[1]);
|
|
2792
|
-
// this.validation = true;
|
|
2793
|
-
// // this.handleBurstData(imagesArray, images, 'worker');
|
|
2794
|
-
// console.time('validationPOST');
|
|
2795
|
-
// }
|
|
2796
|
-
// this.cd.detectChanges();
|
|
2797
|
-
// });
|
|
2798
|
-
// }
|
|
2799
|
-
// );
|
|
2800
2801
|
}
|
|
2801
2802
|
handleBitmapImage(bitmap) {
|
|
2802
2803
|
const { width, height } = bitmap;
|
|
@@ -3040,14 +3041,14 @@ class ScanComponent extends BaseComponent {
|
|
|
3040
3041
|
}
|
|
3041
3042
|
use() {
|
|
3042
3043
|
// save images??
|
|
3043
|
-
if (this.scanProvider.config.sendLog) {
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
}
|
|
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
|
+
// }
|
|
3051
3052
|
this.actions.emit({
|
|
3052
3053
|
type: 'scanDataClose',
|
|
3053
3054
|
data: {
|