ngx-scandoc 1.2.2 → 1.2.4
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 +2 -0
- package/esm2020/core/components/scan/scan.component.mjs +5 -3
- package/esm2020/core/components/webcam/webcam/webcam.component.mjs +7 -6
- package/esm2020/core/interfaces/config.mjs +1 -1
- package/esm2020/providers/auth.provider.mjs +68 -17
- package/esm2020/providers/interceptor.provider.mjs +11 -5
- package/fesm2015/ngx-scandoc.mjs +86 -27
- package/fesm2015/ngx-scandoc.mjs.map +1 -1
- package/fesm2020/ngx-scandoc.mjs +86 -27
- package/fesm2020/ngx-scandoc.mjs.map +1 -1
- package/package.json +1 -1
- package/providers/auth.provider.d.ts +9 -4
|
@@ -10,7 +10,7 @@ export class HttpErrorInterceptor {
|
|
|
10
10
|
}
|
|
11
11
|
intercept(req, next) {
|
|
12
12
|
//console.log(req.url);
|
|
13
|
-
if (req.url.indexOf('
|
|
13
|
+
if (req.url.indexOf('/ks/') >= 0 || req.url.indexOf('/assets/') >= 0) {
|
|
14
14
|
return next.handle(req);
|
|
15
15
|
}
|
|
16
16
|
const authProvider = this.injector.get(AuthProvider);
|
|
@@ -24,6 +24,7 @@ export class HttpErrorInterceptor {
|
|
|
24
24
|
return next.handle(req);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
console.log('AUTH II');
|
|
27
28
|
this.inflightAuthRequest = authProvider.accesToken;
|
|
28
29
|
return this.inflightAuthRequest.pipe(share(), switchMap((token) => {
|
|
29
30
|
// unset request inflight
|
|
@@ -40,9 +41,14 @@ export class HttpErrorInterceptor {
|
|
|
40
41
|
tokenExpired = find ? true : false;
|
|
41
42
|
}
|
|
42
43
|
console.log(err);
|
|
43
|
-
if (err.status === 401 || tokenExpired) {
|
|
44
|
-
authProvider.
|
|
45
|
-
|
|
44
|
+
if (err.status === 401 || err.status === 403 || tokenExpired) {
|
|
45
|
+
return authProvider.refreshToken().pipe(switchMap((token) => {
|
|
46
|
+
const transaction = req.headers.get('TransactionID');
|
|
47
|
+
const authReq = req.clone({
|
|
48
|
+
headers: this.getHeaders(token, transaction || ''),
|
|
49
|
+
});
|
|
50
|
+
return next.handle(authReq);
|
|
51
|
+
}));
|
|
46
52
|
}
|
|
47
53
|
else {
|
|
48
54
|
return throwError(() => new Error('' + (err && err.status ? ':' + err.status : '')));
|
|
@@ -68,4 +74,4 @@ HttpErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0",
|
|
|
68
74
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HttpErrorInterceptor, decorators: [{
|
|
69
75
|
type: Injectable
|
|
70
76
|
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
71
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
77
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJjZXB0b3IucHJvdmlkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtc2NhbmRvYy9zcmMvcHJvdmlkZXJzL2ludGVyY2VwdG9yLnByb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFHTCxXQUFXLEdBR1osTUFBTSxzQkFBc0IsQ0FBQztBQUM5QixPQUFPLEVBQUUsVUFBVSxFQUFZLE1BQU0sZUFBZSxDQUFDO0FBQ3JELE9BQU8sRUFBYyxVQUFVLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFDOUMsT0FBTyxFQUFFLFVBQVUsRUFBRSxLQUFLLEVBQUUsU0FBUyxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDOUQsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUFpQixDQU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gICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICByZXR1cm4gbmV4dC5oYW5kbGUoYXV0aFJlcSk7XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgcmV0dXJuIHRocm93RXJyb3IoXG4gICAgICAgICAgICAoKSA9PiBuZXcgRXJyb3IoJycgKyAoZXJyICYmIGVyci5zdGF0dXMgPyAnOicgKyBlcnIuc3RhdHVzIDogJycpKVxuICAgICAgICAgICk7XG4gICAgICAgIH1cbiAgICAgIH0pXG4gICAgKTtcbiAgfVxuXG4gIHByaXZhdGUgZ2V0SGVhZGVycyh0b2tlbjogc3RyaW5nLCBUcmFuc2FjdGlvbklEOiBzdHJpbmcpIHtcbiAgICBpZiAoVHJhbnNhY3Rpb25JRCkge1xuICAgICAgcmV0dXJuIG5ldyBIdHRwSGVhZGVycyh7XG4gICAgICAgICdDb250ZW50LVR5cGUnOiAnYXBwbGljYXRpb24vanNvbicsXG4gICAgICAgIEF1dGhvcml6YXRpb246IHRva2VuLFxuICAgICAgICBUcmFuc2FjdGlvbklELFxuICAgICAgfSk7XG4gICAgfVxuICAgIHJldHVybiBuZXcgSHR0cEhlYWRlcnMoe1xuICAgICAgJ0NvbnRlbnQtVHlwZSc6ICdhcHBsaWNhdGlvbi9qc29uJyxcbiAgICAgIEF1dGhvcml6YXRpb246IHRva2VuLFxuICAgIH0pO1xuICB9XG59XG4iXX0=
|
package/fesm2015/ngx-scandoc.mjs
CHANGED
|
@@ -522,7 +522,7 @@ class WebcamComponent extends BaseComponent {
|
|
|
522
522
|
});
|
|
523
523
|
}
|
|
524
524
|
onResize() {
|
|
525
|
-
this.videoReady.next(false);
|
|
525
|
+
// this.videoReady.next(false);
|
|
526
526
|
this.resizeStage();
|
|
527
527
|
}
|
|
528
528
|
/**
|
|
@@ -632,7 +632,7 @@ class WebcamComponent extends BaseComponent {
|
|
|
632
632
|
return this.height;
|
|
633
633
|
}
|
|
634
634
|
updatecanvasSize() {
|
|
635
|
-
console.log(this.width, this.height);
|
|
635
|
+
// console.log(this.width, this.height);
|
|
636
636
|
const landscape = this.width > this.height;
|
|
637
637
|
const aspect = this.videoSize.width / this.videoSize.height;
|
|
638
638
|
let width = this.width;
|
|
@@ -759,7 +759,7 @@ class WebcamComponent extends BaseComponent {
|
|
|
759
759
|
: WebcamComponent.DEFAULT_IMAGE_TYPE;
|
|
760
760
|
let _canvas = document.createElement('canvas'); //this.canvasSnapshot.nativeElement;
|
|
761
761
|
const { width, height } = this.videoSize;
|
|
762
|
-
console.log(width, height);
|
|
762
|
+
// console.log(width, height);
|
|
763
763
|
const { padding, top, rWidth, rHeight } = this.snapRectangle;
|
|
764
764
|
_canvas.width = rWidth;
|
|
765
765
|
_canvas.height = rHeight;
|
|
@@ -1047,6 +1047,7 @@ class WebcamComponent extends BaseComponent {
|
|
|
1047
1047
|
* Init webcam live view
|
|
1048
1048
|
*/
|
|
1049
1049
|
initWebcam(deviceId, userVideoTrackConstraints) {
|
|
1050
|
+
console.log('INIT WEBCAM');
|
|
1050
1051
|
const _video = this.nativeVideoElement;
|
|
1051
1052
|
// const videoStreamer = this.videoStreamer.nativeElement;
|
|
1052
1053
|
// const videoSmall = document.createElement('video');
|
|
@@ -1107,7 +1108,7 @@ class WebcamComponent extends BaseComponent {
|
|
|
1107
1108
|
get cardRectangle() {
|
|
1108
1109
|
const _canvas = this.canvas.nativeElement;
|
|
1109
1110
|
const docSize = this.type === 'selfie' ? 1 : 86 / 55;
|
|
1110
|
-
console.log(_canvas.width, _canvas.height);
|
|
1111
|
+
// console.log(_canvas.width, _canvas.height);
|
|
1111
1112
|
let padding = 10;
|
|
1112
1113
|
let rWidth = _canvas.width - 2 * padding;
|
|
1113
1114
|
let rHeight = rWidth / docSize;
|
|
@@ -1119,7 +1120,7 @@ class WebcamComponent extends BaseComponent {
|
|
|
1119
1120
|
top = (_canvas.height - rHeight) / 2;
|
|
1120
1121
|
padding = (_canvas.width - rWidth) / 2;
|
|
1121
1122
|
}
|
|
1122
|
-
console.log(padding, top, rWidth, rHeight);
|
|
1123
|
+
// console.log(padding, top, rWidth, rHeight);
|
|
1123
1124
|
return { padding, top, rWidth, rHeight };
|
|
1124
1125
|
}
|
|
1125
1126
|
get snapRectangle() {
|
|
@@ -1838,38 +1839,88 @@ class AuthProvider {
|
|
|
1838
1839
|
this.http = http;
|
|
1839
1840
|
this.config = config;
|
|
1840
1841
|
this.token = '';
|
|
1842
|
+
this.refresh_token = '';
|
|
1841
1843
|
this.tokenTimestamps = {
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
+
Time: 0,
|
|
1845
|
+
Client: 0,
|
|
1846
|
+
SubClient: 0,
|
|
1844
1847
|
};
|
|
1845
1848
|
}
|
|
1849
|
+
setSubClient(name) {
|
|
1850
|
+
this.subClient = name;
|
|
1851
|
+
}
|
|
1846
1852
|
setConfig() { }
|
|
1847
1853
|
get tokenExpired() {
|
|
1848
|
-
|
|
1854
|
+
console.log(this.tokenTimestamps, this.token);
|
|
1855
|
+
if (this.token == '' || this.tokenTimestamps.Time === 0) {
|
|
1849
1856
|
console.log('EXPIRED');
|
|
1850
1857
|
return true;
|
|
1851
1858
|
}
|
|
1852
|
-
const {
|
|
1853
|
-
|
|
1859
|
+
const { Time } = this.tokenTimestamps;
|
|
1860
|
+
const tokenDate = moment(Time);
|
|
1861
|
+
const isValid = moment(tokenDate).isBefore(moment().add(5, 'minutes'));
|
|
1862
|
+
console.log('VALID', isValid);
|
|
1863
|
+
return !isValid;
|
|
1854
1864
|
}
|
|
1855
1865
|
resetToken() {
|
|
1856
|
-
this.token = '';
|
|
1866
|
+
// this.token = '';
|
|
1857
1867
|
}
|
|
1858
1868
|
get accesToken() {
|
|
1859
|
-
|
|
1869
|
+
console.log('AT');
|
|
1870
|
+
return this.tokenExpired ? this.fetchToken() : of(this.token);
|
|
1871
|
+
}
|
|
1872
|
+
fetchToken() {
|
|
1873
|
+
if (this.token && this.refresh_token) {
|
|
1874
|
+
return this.refreshToken();
|
|
1875
|
+
}
|
|
1876
|
+
return this.getToken();
|
|
1877
|
+
}
|
|
1878
|
+
refreshToken() {
|
|
1879
|
+
const { path, refresh } = this.config;
|
|
1880
|
+
return this.http
|
|
1881
|
+
.post(`${path}${refresh}`, {
|
|
1882
|
+
refresh_token: this.refresh_token,
|
|
1883
|
+
})
|
|
1884
|
+
.pipe(tap((token) => {
|
|
1885
|
+
// console.log(this.token);
|
|
1886
|
+
this.token = token.access_token;
|
|
1887
|
+
this.updateToken();
|
|
1888
|
+
// this.token = token.access_token;
|
|
1889
|
+
// console.log('TOKEN', this.token);
|
|
1890
|
+
// this.refresh_token = token.refresh_token;
|
|
1891
|
+
// const decoded: any = jwt_decode(this.token);
|
|
1892
|
+
// console.log(decoded);
|
|
1893
|
+
// const { Time, Client, SubClient } = decoded;
|
|
1894
|
+
// this.tokenTimestamps = { Time, Client, SubClient };
|
|
1895
|
+
}), map((data) => data.access_token));
|
|
1896
|
+
}
|
|
1897
|
+
get user_key() {
|
|
1898
|
+
return this.config.clientId;
|
|
1899
|
+
}
|
|
1900
|
+
get sub_client() {
|
|
1901
|
+
return this.config.tokenName ? this.config.tokenName : this.subClient;
|
|
1902
|
+
}
|
|
1903
|
+
updateToken() {
|
|
1904
|
+
const decoded = jwt_decode(this.token);
|
|
1905
|
+
console.log(decoded);
|
|
1906
|
+
const { Time, Client, SubClient } = decoded;
|
|
1907
|
+
this.tokenTimestamps = { Time, Client, SubClient };
|
|
1860
1908
|
}
|
|
1861
1909
|
getToken() {
|
|
1910
|
+
console.log('GET');
|
|
1911
|
+
const { path, login } = this.config;
|
|
1862
1912
|
return this.http
|
|
1863
|
-
.post(
|
|
1864
|
-
|
|
1865
|
-
|
|
1913
|
+
.post(`${path}${login}`, {
|
|
1914
|
+
user_key: this.user_key,
|
|
1915
|
+
sub_client: this.sub_client,
|
|
1866
1916
|
})
|
|
1867
|
-
.pipe(
|
|
1868
|
-
this.token
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
this.
|
|
1872
|
-
|
|
1917
|
+
.pipe(tap((token) => {
|
|
1918
|
+
console.log(this.token);
|
|
1919
|
+
this.token = token.access_token;
|
|
1920
|
+
console.log('TOKEN', this.token);
|
|
1921
|
+
this.refresh_token = token.refresh_token;
|
|
1922
|
+
this.updateToken();
|
|
1923
|
+
}), map((data) => data.access_token));
|
|
1873
1924
|
}
|
|
1874
1925
|
}
|
|
1875
1926
|
AuthProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: AuthProvider, deps: [{ token: i1$1.HttpClient }, { token: 'configAuth' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -2811,6 +2862,8 @@ class ScanComponent extends BaseComponent {
|
|
|
2811
2862
|
},
|
|
2812
2863
|
// CallBackUrl: 'http://demo:5000/report/extracted/',
|
|
2813
2864
|
};
|
|
2865
|
+
this.frontImage = 'data:image/jpeg;base64,' + payload.DataFields.FrontImage;
|
|
2866
|
+
this.backImage = 'data:image/jpeg;base64,' + payload.DataFields.BackImage;
|
|
2814
2867
|
if (!this.scanBlastData[1].image) {
|
|
2815
2868
|
payload.Settings.IgnoreBackImage = true;
|
|
2816
2869
|
}
|
|
@@ -2976,10 +3029,10 @@ class ScanComponent extends BaseComponent {
|
|
|
2976
3029
|
}
|
|
2977
3030
|
}
|
|
2978
3031
|
ScanComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScanComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i1$2.TranslateService }, { token: NgxScandocCameraProvider }, { token: i0.Injector }, { token: LayoutProvider }, { token: AuthProvider }], target: i0.ɵɵFactoryTarget.Component });
|
|
2979
|
-
ScanComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScanComponent, selector: "ngx-scan", inputs: { type: "type", dialogs: "dialogs", showDialog: "showDialog" }, outputs: { actions: "actions" }, host: { listeners: { "window:resize": "onResize($event)" }, properties: { "class.mobile": "this.class" } }, viewQueries: [{ propertyName: "wraper", first: true, predicate: ["wraper"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<section *ngIf=\"result\">\n <ngx-scan-results\n (action)=\"selfie()\"\n [form]=\"form\"\n [model]=\"model\"\n [images]=\"images\"\n ></ngx-scan-results>\n\n <footer>\n <div class=\"actions\">\n <button class=\"mr-4\" mat-raised-button (click)=\"retake()\">\n {{ \"scandoc.reTake\" | translate }}\n </button>\n <button\n [disabled]=\"error || form.invalid\"\n class=\"ml-4\"\n mat-raised-button\n (click)=\"use()\"\n >\n {{ \"scandoc.useData\" | translate }}\n </button>\n </div>\n </footer>\n</section>\n\n<section *ngIf=\"!result && documentTypeSelected\">\n <div #wraper class=\"wraper\">\n <div class=\"loading\" *ngIf=\"!cameraReady && !preview\">\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n\n <ng-container *ngIf=\"!error\">\n <ngx-scandoc-webcam\n *ngIf=\"!preview && !scaning\"\n class=\"main\"\n [imageQuality]=\"1\"\n #webcam\n type=\"document\"\n [trigger]=\"trigger\"\n [imageHandler]=\"imageHandler\"\n (imageCapture)=\"handleImage($event)\"\n [allowCameraSwitch]=\"allowCameraSwitch\"\n [videoOptions]=\"videoOptions\"\n [switchCamera]=\"cameraProvider.nextWebcamObservable\"\n (cameraSwitched)=\"cameraWasSwitched($event)\"\n (initError)=\"handleInitError($event)\"\n [width]=\"width\"\n [height]=\"height\"\n (destroyed)=\"cameraOff($event)\"\n (videoReady)=\"videoReady($event)\"\n >\n </ngx-scandoc-webcam>\n </ng-container>\n <div\n class=\"previewData\"\n *ngIf=\"preview\"\n style=\"z-index: 20; position: absolute; width: 100%; height: 100%\"\n >\n <div class=\"p-16 error\" *ngIf=\"error\">\n <div>\n <div class=\"title\">\n <mat-icon>error_outline</mat-icon\n ><span class=\"ml-8\">{{\n \"scandoc.unableToDetectId\" | translate\n }}</span>\n </div>\n\n <ng-container *ngIf=\"errorCode === '1001'\">\n <div>\n {{ \"scandoc.extraction.c1001\" | translate }}\n </div>\n </ng-container>\n <ng-container *ngIf=\"errorCode === '1002'\">\n <div>\n {{ \"scandoc.extraction.c1002\" | translate }}\n </div>\n </ng-container>\n\n <ul *ngIf=\"errorCode === '1000'\">\n <li>\n {{ \"scandoc.placeIdCloseToDevice\" | translate }}\n </li>\n <li>\n {{ \"scandoc.ensureSufficientLight\" | translate }}\n </li>\n <li>\n {{ \"scandoc.holdDocumentSteady\" | translate }}\n </li>\n <li>\n {{ \"scandoc.makeSureAllEdgesOfTheIdAreVisible\" | translate }}\n </li>\n <li>\n {{\n \"scandoc.makeSureThereAreNoGlareAndShadowsOnTheId\" | translate\n }}\n </li>\n </ul>\n </div>\n </div>\n\n <div class=\"scanPreview\" *ngIf=\"!error && !scaning\">\n <!-- <div class=\"py-16\" style=\"font-size: 16px\">\n {{\n \"scandoc.ensureAllTextsAreVisible\"\n | translate\n }}\n </div> -->\n <div\n class=\"image\"\n [style.background-image]=\"'url(' + preview + ')'\"\n ></div>\n </div>\n </div>\n </div>\n\n <footer>\n <div class=\"displayInfo\" *ngIf=\"!preview && cameraReady\">\n {{ displayInfo | translate }}\n </div>\n <!-- <div style=\"height: 26px\">\n <div\n style=\"text-align: center; font-size: 18px\"\n *ngIf=\"idScan && !preview && cameraReady\"\n >\n <ng-container *ngIf=\"idScan === 'BACK'\">\n Turn document and:\n {{ \"scandoc.captureBack\" | translate }}\n </ng-container>\n <ng-container *ngIf=\"idScan === 'FRONT'\">\n Turn document and:\n {{ \"scandoc.captureFront\" | translate }}\n </ng-container>\n </div>\n </div> -->\n\n <div class=\"actions\" *ngIf=\"preview\">\n <button class=\"mr-4\" mat-raised-button (click)=\"retry()\">\n {{ \"scandoc.retry\" | translate }}\n </button>\n\n <button\n [disabled]=\"error\"\n class=\"ml-4\"\n mat-raised-button\n (click)=\"continue()\"\n >\n {{ \"scandoc.continueWithSelectedImage\" | translate }}\n </button>\n </div>\n </footer>\n</section>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1;background-color:#f5f5f5;overflow:hidden}section{flex:1;display:flex;flex-direction:column;position:relative;overflow:hidden}.wraper{position:relative;overflow:hidden;display:flex;flex-direction:column;flex:1}.wraper .loading{position:absolute;inset:0;z-index:20;background-color:#f5f5f5}.documentTurnOver{position:absolute;width:100%;height:100%;top:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.documentTurnOver mat-icon{width:200px;color:#fff;height:200px;font-size:100px}.displayInfo{text-align:center;flex:1;width:100%;background-color:#000;height:50px;display:flex;flex-direction:row;align-items:center;justify-content:center;color:#fff;z-index:200}.displayInfo.mobile{font-size:12px}.preview{width:100%;border-radius:1%}footer button{box-shadow:none!important;height:45px;min-height:45px;text-transform:uppercase}footer .actions{display:flex;flex-direction:row;align-items:center;padding:8px}footer .actions button{flex:1}.error{display:flex;align-items:center;justify-content:center;flex:1}.error .title{font-size:20px;margin-bottom:8px}.error .title mat-icon{margin-right:8px}.error ul{font-size:18px;list-style-type:none}mat-card{box-shadow:none!important}.mr-4{margin-right:4px}.ml-4{margin-left:4px}.p-16{padding:16px}.p-8{padding:8px}.py-16{padding:16px 0}.w-100-p{width:100%}.scanPreview{padding:16px}.scanPreview .image{background-position:center;background-repeat:no-repeat;background-size:contain}.empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: WebcamComponent, selector: "ngx-scandoc-webcam", inputs: ["imageHandler", "id", "type", "width", "height", "videoOptions", "allowCameraSwitch", "mirrorImage", "captureImageData", "imageType", "imageQuality", "trigger", "switchCamera"], outputs: ["imageCapture", "initError", "imageClick", "cameraSwitched", "videoReady", "destroyed"] }, { kind: "component", type: i7$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i9.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: ScanResultsComponent, selector: "ngx-scan-results", inputs: ["model", "images", "form"], outputs: ["action"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3032
|
+
ScanComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScanComponent, selector: "ngx-scan", inputs: { type: "type", dialogs: "dialogs", showDialog: "showDialog" }, outputs: { actions: "actions" }, host: { listeners: { "window:resize": "onResize($event)" }, properties: { "class.mobile": "this.class" } }, viewQueries: [{ propertyName: "wraper", first: true, predicate: ["wraper"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<section *ngIf=\"result\">\n <ngx-scan-results\n (action)=\"selfie()\"\n [form]=\"form\"\n [model]=\"model\"\n [images]=\"images\"\n ></ngx-scan-results>\n<!-- <div style=\"display:none\">\n<img [src]=\"frontImage\">\n<img [src]=\"backImage\">\n</div> -->\n\n <footer>\n <div class=\"actions\">\n <button class=\"mr-4\" mat-raised-button (click)=\"retake()\">\n {{ \"scandoc.reTake\" | translate }}\n </button>\n <button\n [disabled]=\"error || form.invalid\"\n class=\"ml-4\"\n mat-raised-button\n (click)=\"use()\"\n >\n {{ \"scandoc.useData\" | translate }}\n </button>\n </div>\n </footer>\n</section>\n\n<section *ngIf=\"!result && documentTypeSelected\">\n <div #wraper class=\"wraper\">\n <div class=\"loading\" *ngIf=\"!cameraReady && !preview\">\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n\n <ng-container *ngIf=\"!error\">\n <ngx-scandoc-webcam\n *ngIf=\"!preview && !scaning\"\n class=\"main\"\n [imageQuality]=\"1\"\n #webcam\n type=\"document\"\n [trigger]=\"trigger\"\n [imageHandler]=\"imageHandler\"\n (imageCapture)=\"handleImage($event)\"\n [allowCameraSwitch]=\"allowCameraSwitch\"\n [videoOptions]=\"videoOptions\"\n [switchCamera]=\"cameraProvider.nextWebcamObservable\"\n (cameraSwitched)=\"cameraWasSwitched($event)\"\n (initError)=\"handleInitError($event)\"\n [width]=\"width\"\n [height]=\"height\"\n (destroyed)=\"cameraOff($event)\"\n (videoReady)=\"videoReady($event)\"\n >\n </ngx-scandoc-webcam>\n </ng-container>\n <div\n class=\"previewData\"\n *ngIf=\"preview\"\n style=\"z-index: 20; position: absolute; width: 100%; height: 100%\"\n >\n <div class=\"p-16 error\" *ngIf=\"error\">\n <div>\n <div class=\"title\">\n <mat-icon>error_outline</mat-icon\n ><span class=\"ml-8\">{{\n \"scandoc.unableToDetectId\" | translate\n }}</span>\n </div>\n\n <ng-container *ngIf=\"errorCode === '1001'\">\n <div>\n {{ \"scandoc.extraction.c1001\" | translate }}\n </div>\n </ng-container>\n <ng-container *ngIf=\"errorCode === '1002'\">\n <div>\n {{ \"scandoc.extraction.c1002\" | translate }}\n </div>\n </ng-container>\n\n <ul *ngIf=\"errorCode === '1000'\">\n <li>\n {{ \"scandoc.placeIdCloseToDevice\" | translate }}\n </li>\n <li>\n {{ \"scandoc.ensureSufficientLight\" | translate }}\n </li>\n <li>\n {{ \"scandoc.holdDocumentSteady\" | translate }}\n </li>\n <li>\n {{ \"scandoc.makeSureAllEdgesOfTheIdAreVisible\" | translate }}\n </li>\n <li>\n {{\n \"scandoc.makeSureThereAreNoGlareAndShadowsOnTheId\" | translate\n }}\n </li>\n </ul>\n </div>\n </div>\n\n <div class=\"scanPreview\" *ngIf=\"!error && !scaning\">\n <!-- <div class=\"py-16\" style=\"font-size: 16px\">\n {{\n \"scandoc.ensureAllTextsAreVisible\"\n | translate\n }}\n </div> -->\n <div\n class=\"image\"\n [style.background-image]=\"'url(' + preview + ')'\"\n ></div>\n </div>\n </div>\n </div>\n\n <footer>\n <div class=\"displayInfo\" *ngIf=\"!preview && cameraReady\">\n {{ displayInfo | translate }}\n </div>\n <!-- <div style=\"height: 26px\">\n <div\n style=\"text-align: center; font-size: 18px\"\n *ngIf=\"idScan && !preview && cameraReady\"\n >\n <ng-container *ngIf=\"idScan === 'BACK'\">\n Turn document and:\n {{ \"scandoc.captureBack\" | translate }}\n </ng-container>\n <ng-container *ngIf=\"idScan === 'FRONT'\">\n Turn document and:\n {{ \"scandoc.captureFront\" | translate }}\n </ng-container>\n </div>\n </div> -->\n\n <div class=\"actions\" *ngIf=\"preview\">\n <button class=\"mr-4\" mat-raised-button (click)=\"retry()\">\n {{ \"scandoc.retry\" | translate }}\n </button>\n\n <button\n [disabled]=\"error\"\n class=\"ml-4\"\n mat-raised-button\n (click)=\"continue()\"\n >\n {{ \"scandoc.continueWithSelectedImage\" | translate }}\n </button>\n </div>\n </footer>\n</section>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1;background-color:#f5f5f5;overflow:hidden}section{flex:1;display:flex;flex-direction:column;position:relative;overflow:hidden}.wraper{position:relative;overflow:hidden;display:flex;flex-direction:column;flex:1}.wraper .loading{position:absolute;inset:0;z-index:20;background-color:#f5f5f5}.documentTurnOver{position:absolute;width:100%;height:100%;top:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.documentTurnOver mat-icon{width:200px;color:#fff;height:200px;font-size:100px}.displayInfo{text-align:center;flex:1;width:100%;background-color:#000;height:50px;display:flex;flex-direction:row;align-items:center;justify-content:center;color:#fff;z-index:200}.displayInfo.mobile{font-size:12px}.preview{width:100%;border-radius:1%}footer button{box-shadow:none!important;height:45px;min-height:45px;text-transform:uppercase}footer .actions{display:flex;flex-direction:row;align-items:center;padding:8px}footer .actions button{flex:1}.error{display:flex;align-items:center;justify-content:center;flex:1}.error .title{font-size:20px;margin-bottom:8px}.error .title mat-icon{margin-right:8px}.error ul{font-size:18px;list-style-type:none}mat-card{box-shadow:none!important}.mr-4{margin-right:4px}.ml-4{margin-left:4px}.p-16{padding:16px}.p-8{padding:8px}.py-16{padding:16px 0}.w-100-p{width:100%}.scanPreview{padding:16px}.scanPreview .image{background-position:center;background-repeat:no-repeat;background-size:contain}.empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: WebcamComponent, selector: "ngx-scandoc-webcam", inputs: ["imageHandler", "id", "type", "width", "height", "videoOptions", "allowCameraSwitch", "mirrorImage", "captureImageData", "imageType", "imageQuality", "trigger", "switchCamera"], outputs: ["imageCapture", "initError", "imageClick", "cameraSwitched", "videoReady", "destroyed"] }, { kind: "component", type: i7$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i6.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i9.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: ScanResultsComponent, selector: "ngx-scan-results", inputs: ["model", "images", "form"], outputs: ["action"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2980
3033
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScanComponent, decorators: [{
|
|
2981
3034
|
type: Component,
|
|
2982
|
-
args: [{ selector: 'ngx-scan', changeDetection: ChangeDetectionStrategy.OnPush, template: "<section *ngIf=\"result\">\n <ngx-scan-results\n (action)=\"selfie()\"\n [form]=\"form\"\n [model]=\"model\"\n [images]=\"images\"\n ></ngx-scan-results>\n\n <footer>\n <div class=\"actions\">\n <button class=\"mr-4\" mat-raised-button (click)=\"retake()\">\n {{ \"scandoc.reTake\" | translate }}\n </button>\n <button\n [disabled]=\"error || form.invalid\"\n class=\"ml-4\"\n mat-raised-button\n (click)=\"use()\"\n >\n {{ \"scandoc.useData\" | translate }}\n </button>\n </div>\n </footer>\n</section>\n\n<section *ngIf=\"!result && documentTypeSelected\">\n <div #wraper class=\"wraper\">\n <div class=\"loading\" *ngIf=\"!cameraReady && !preview\">\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n\n <ng-container *ngIf=\"!error\">\n <ngx-scandoc-webcam\n *ngIf=\"!preview && !scaning\"\n class=\"main\"\n [imageQuality]=\"1\"\n #webcam\n type=\"document\"\n [trigger]=\"trigger\"\n [imageHandler]=\"imageHandler\"\n (imageCapture)=\"handleImage($event)\"\n [allowCameraSwitch]=\"allowCameraSwitch\"\n [videoOptions]=\"videoOptions\"\n [switchCamera]=\"cameraProvider.nextWebcamObservable\"\n (cameraSwitched)=\"cameraWasSwitched($event)\"\n (initError)=\"handleInitError($event)\"\n [width]=\"width\"\n [height]=\"height\"\n (destroyed)=\"cameraOff($event)\"\n (videoReady)=\"videoReady($event)\"\n >\n </ngx-scandoc-webcam>\n </ng-container>\n <div\n class=\"previewData\"\n *ngIf=\"preview\"\n style=\"z-index: 20; position: absolute; width: 100%; height: 100%\"\n >\n <div class=\"p-16 error\" *ngIf=\"error\">\n <div>\n <div class=\"title\">\n <mat-icon>error_outline</mat-icon\n ><span class=\"ml-8\">{{\n \"scandoc.unableToDetectId\" | translate\n }}</span>\n </div>\n\n <ng-container *ngIf=\"errorCode === '1001'\">\n <div>\n {{ \"scandoc.extraction.c1001\" | translate }}\n </div>\n </ng-container>\n <ng-container *ngIf=\"errorCode === '1002'\">\n <div>\n {{ \"scandoc.extraction.c1002\" | translate }}\n </div>\n </ng-container>\n\n <ul *ngIf=\"errorCode === '1000'\">\n <li>\n {{ \"scandoc.placeIdCloseToDevice\" | translate }}\n </li>\n <li>\n {{ \"scandoc.ensureSufficientLight\" | translate }}\n </li>\n <li>\n {{ \"scandoc.holdDocumentSteady\" | translate }}\n </li>\n <li>\n {{ \"scandoc.makeSureAllEdgesOfTheIdAreVisible\" | translate }}\n </li>\n <li>\n {{\n \"scandoc.makeSureThereAreNoGlareAndShadowsOnTheId\" | translate\n }}\n </li>\n </ul>\n </div>\n </div>\n\n <div class=\"scanPreview\" *ngIf=\"!error && !scaning\">\n <!-- <div class=\"py-16\" style=\"font-size: 16px\">\n {{\n \"scandoc.ensureAllTextsAreVisible\"\n | translate\n }}\n </div> -->\n <div\n class=\"image\"\n [style.background-image]=\"'url(' + preview + ')'\"\n ></div>\n </div>\n </div>\n </div>\n\n <footer>\n <div class=\"displayInfo\" *ngIf=\"!preview && cameraReady\">\n {{ displayInfo | translate }}\n </div>\n <!-- <div style=\"height: 26px\">\n <div\n style=\"text-align: center; font-size: 18px\"\n *ngIf=\"idScan && !preview && cameraReady\"\n >\n <ng-container *ngIf=\"idScan === 'BACK'\">\n Turn document and:\n {{ \"scandoc.captureBack\" | translate }}\n </ng-container>\n <ng-container *ngIf=\"idScan === 'FRONT'\">\n Turn document and:\n {{ \"scandoc.captureFront\" | translate }}\n </ng-container>\n </div>\n </div> -->\n\n <div class=\"actions\" *ngIf=\"preview\">\n <button class=\"mr-4\" mat-raised-button (click)=\"retry()\">\n {{ \"scandoc.retry\" | translate }}\n </button>\n\n <button\n [disabled]=\"error\"\n class=\"ml-4\"\n mat-raised-button\n (click)=\"continue()\"\n >\n {{ \"scandoc.continueWithSelectedImage\" | translate }}\n </button>\n </div>\n </footer>\n</section>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1;background-color:#f5f5f5;overflow:hidden}section{flex:1;display:flex;flex-direction:column;position:relative;overflow:hidden}.wraper{position:relative;overflow:hidden;display:flex;flex-direction:column;flex:1}.wraper .loading{position:absolute;inset:0;z-index:20;background-color:#f5f5f5}.documentTurnOver{position:absolute;width:100%;height:100%;top:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.documentTurnOver mat-icon{width:200px;color:#fff;height:200px;font-size:100px}.displayInfo{text-align:center;flex:1;width:100%;background-color:#000;height:50px;display:flex;flex-direction:row;align-items:center;justify-content:center;color:#fff;z-index:200}.displayInfo.mobile{font-size:12px}.preview{width:100%;border-radius:1%}footer button{box-shadow:none!important;height:45px;min-height:45px;text-transform:uppercase}footer .actions{display:flex;flex-direction:row;align-items:center;padding:8px}footer .actions button{flex:1}.error{display:flex;align-items:center;justify-content:center;flex:1}.error .title{font-size:20px;margin-bottom:8px}.error .title mat-icon{margin-right:8px}.error ul{font-size:18px;list-style-type:none}mat-card{box-shadow:none!important}.mr-4{margin-right:4px}.ml-4{margin-left:4px}.p-16{padding:16px}.p-8{padding:8px}.py-16{padding:16px 0}.w-100-p{width:100%}.scanPreview{padding:16px}.scanPreview .image{background-position:center;background-repeat:no-repeat;background-size:contain}.empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center}\n"] }]
|
|
3035
|
+
args: [{ selector: 'ngx-scan', changeDetection: ChangeDetectionStrategy.OnPush, template: "<section *ngIf=\"result\">\n <ngx-scan-results\n (action)=\"selfie()\"\n [form]=\"form\"\n [model]=\"model\"\n [images]=\"images\"\n ></ngx-scan-results>\n<!-- <div style=\"display:none\">\n<img [src]=\"frontImage\">\n<img [src]=\"backImage\">\n</div> -->\n\n <footer>\n <div class=\"actions\">\n <button class=\"mr-4\" mat-raised-button (click)=\"retake()\">\n {{ \"scandoc.reTake\" | translate }}\n </button>\n <button\n [disabled]=\"error || form.invalid\"\n class=\"ml-4\"\n mat-raised-button\n (click)=\"use()\"\n >\n {{ \"scandoc.useData\" | translate }}\n </button>\n </div>\n </footer>\n</section>\n\n<section *ngIf=\"!result && documentTypeSelected\">\n <div #wraper class=\"wraper\">\n <div class=\"loading\" *ngIf=\"!cameraReady && !preview\">\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n\n <ng-container *ngIf=\"!error\">\n <ngx-scandoc-webcam\n *ngIf=\"!preview && !scaning\"\n class=\"main\"\n [imageQuality]=\"1\"\n #webcam\n type=\"document\"\n [trigger]=\"trigger\"\n [imageHandler]=\"imageHandler\"\n (imageCapture)=\"handleImage($event)\"\n [allowCameraSwitch]=\"allowCameraSwitch\"\n [videoOptions]=\"videoOptions\"\n [switchCamera]=\"cameraProvider.nextWebcamObservable\"\n (cameraSwitched)=\"cameraWasSwitched($event)\"\n (initError)=\"handleInitError($event)\"\n [width]=\"width\"\n [height]=\"height\"\n (destroyed)=\"cameraOff($event)\"\n (videoReady)=\"videoReady($event)\"\n >\n </ngx-scandoc-webcam>\n </ng-container>\n <div\n class=\"previewData\"\n *ngIf=\"preview\"\n style=\"z-index: 20; position: absolute; width: 100%; height: 100%\"\n >\n <div class=\"p-16 error\" *ngIf=\"error\">\n <div>\n <div class=\"title\">\n <mat-icon>error_outline</mat-icon\n ><span class=\"ml-8\">{{\n \"scandoc.unableToDetectId\" | translate\n }}</span>\n </div>\n\n <ng-container *ngIf=\"errorCode === '1001'\">\n <div>\n {{ \"scandoc.extraction.c1001\" | translate }}\n </div>\n </ng-container>\n <ng-container *ngIf=\"errorCode === '1002'\">\n <div>\n {{ \"scandoc.extraction.c1002\" | translate }}\n </div>\n </ng-container>\n\n <ul *ngIf=\"errorCode === '1000'\">\n <li>\n {{ \"scandoc.placeIdCloseToDevice\" | translate }}\n </li>\n <li>\n {{ \"scandoc.ensureSufficientLight\" | translate }}\n </li>\n <li>\n {{ \"scandoc.holdDocumentSteady\" | translate }}\n </li>\n <li>\n {{ \"scandoc.makeSureAllEdgesOfTheIdAreVisible\" | translate }}\n </li>\n <li>\n {{\n \"scandoc.makeSureThereAreNoGlareAndShadowsOnTheId\" | translate\n }}\n </li>\n </ul>\n </div>\n </div>\n\n <div class=\"scanPreview\" *ngIf=\"!error && !scaning\">\n <!-- <div class=\"py-16\" style=\"font-size: 16px\">\n {{\n \"scandoc.ensureAllTextsAreVisible\"\n | translate\n }}\n </div> -->\n <div\n class=\"image\"\n [style.background-image]=\"'url(' + preview + ')'\"\n ></div>\n </div>\n </div>\n </div>\n\n <footer>\n <div class=\"displayInfo\" *ngIf=\"!preview && cameraReady\">\n {{ displayInfo | translate }}\n </div>\n <!-- <div style=\"height: 26px\">\n <div\n style=\"text-align: center; font-size: 18px\"\n *ngIf=\"idScan && !preview && cameraReady\"\n >\n <ng-container *ngIf=\"idScan === 'BACK'\">\n Turn document and:\n {{ \"scandoc.captureBack\" | translate }}\n </ng-container>\n <ng-container *ngIf=\"idScan === 'FRONT'\">\n Turn document and:\n {{ \"scandoc.captureFront\" | translate }}\n </ng-container>\n </div>\n </div> -->\n\n <div class=\"actions\" *ngIf=\"preview\">\n <button class=\"mr-4\" mat-raised-button (click)=\"retry()\">\n {{ \"scandoc.retry\" | translate }}\n </button>\n\n <button\n [disabled]=\"error\"\n class=\"ml-4\"\n mat-raised-button\n (click)=\"continue()\"\n >\n {{ \"scandoc.continueWithSelectedImage\" | translate }}\n </button>\n </div>\n </footer>\n</section>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1;background-color:#f5f5f5;overflow:hidden}section{flex:1;display:flex;flex-direction:column;position:relative;overflow:hidden}.wraper{position:relative;overflow:hidden;display:flex;flex-direction:column;flex:1}.wraper .loading{position:absolute;inset:0;z-index:20;background-color:#f5f5f5}.documentTurnOver{position:absolute;width:100%;height:100%;top:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.documentTurnOver mat-icon{width:200px;color:#fff;height:200px;font-size:100px}.displayInfo{text-align:center;flex:1;width:100%;background-color:#000;height:50px;display:flex;flex-direction:row;align-items:center;justify-content:center;color:#fff;z-index:200}.displayInfo.mobile{font-size:12px}.preview{width:100%;border-radius:1%}footer button{box-shadow:none!important;height:45px;min-height:45px;text-transform:uppercase}footer .actions{display:flex;flex-direction:row;align-items:center;padding:8px}footer .actions button{flex:1}.error{display:flex;align-items:center;justify-content:center;flex:1}.error .title{font-size:20px;margin-bottom:8px}.error .title mat-icon{margin-right:8px}.error ul{font-size:18px;list-style-type:none}mat-card{box-shadow:none!important}.mr-4{margin-right:4px}.ml-4{margin-left:4px}.p-16{padding:16px}.p-8{padding:8px}.py-16{padding:16px 0}.w-100-p{width:100%}.scanPreview{padding:16px}.scanPreview .image{background-position:center;background-repeat:no-repeat;background-size:contain}.empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center}\n"] }]
|
|
2983
3036
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i1$2.TranslateService }, { type: NgxScandocCameraProvider }, { type: i0.Injector }, { type: LayoutProvider }, { type: AuthProvider }]; }, propDecorators: { type: [{
|
|
2984
3037
|
type: Input
|
|
2985
3038
|
}], dialogs: [{
|
|
@@ -4159,7 +4212,7 @@ class HttpErrorInterceptor {
|
|
|
4159
4212
|
}
|
|
4160
4213
|
intercept(req, next) {
|
|
4161
4214
|
//console.log(req.url);
|
|
4162
|
-
if (req.url.indexOf('
|
|
4215
|
+
if (req.url.indexOf('/ks/') >= 0 || req.url.indexOf('/assets/') >= 0) {
|
|
4163
4216
|
return next.handle(req);
|
|
4164
4217
|
}
|
|
4165
4218
|
const authProvider = this.injector.get(AuthProvider);
|
|
@@ -4173,6 +4226,7 @@ class HttpErrorInterceptor {
|
|
|
4173
4226
|
return next.handle(req);
|
|
4174
4227
|
}
|
|
4175
4228
|
}
|
|
4229
|
+
console.log('AUTH II');
|
|
4176
4230
|
this.inflightAuthRequest = authProvider.accesToken;
|
|
4177
4231
|
return this.inflightAuthRequest.pipe(share(), switchMap((token) => {
|
|
4178
4232
|
// unset request inflight
|
|
@@ -4189,9 +4243,14 @@ class HttpErrorInterceptor {
|
|
|
4189
4243
|
tokenExpired = find ? true : false;
|
|
4190
4244
|
}
|
|
4191
4245
|
console.log(err);
|
|
4192
|
-
if (err.status === 401 || tokenExpired) {
|
|
4193
|
-
authProvider.
|
|
4194
|
-
|
|
4246
|
+
if (err.status === 401 || err.status === 403 || tokenExpired) {
|
|
4247
|
+
return authProvider.refreshToken().pipe(switchMap((token) => {
|
|
4248
|
+
const transaction = req.headers.get('TransactionID');
|
|
4249
|
+
const authReq = req.clone({
|
|
4250
|
+
headers: this.getHeaders(token, transaction || ''),
|
|
4251
|
+
});
|
|
4252
|
+
return next.handle(authReq);
|
|
4253
|
+
}));
|
|
4195
4254
|
}
|
|
4196
4255
|
else {
|
|
4197
4256
|
return throwError(() => new Error('' + (err && err.status ? ':' + err.status : '')));
|