ngx-scandoc 15.2.3 → 17.0.0
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 +1 -1
- package/core/components/scan-results/scan-results.component.d.ts +1 -1
- package/core/components/webcam/webcam/webcam.component.d.ts +1 -1
- package/dialogs/components/scan-profile/scan-profile.component.d.ts +1 -1
- package/{esm2020 → esm2022}/core/components/camera-switch/camera-switch.component.mjs +4 -4
- package/{esm2020 → esm2022}/core/components/components.module.mjs +21 -21
- package/{esm2020 → esm2022}/core/components/manual-scan/manual-scan.component.mjs +4 -4
- package/{esm2020 → esm2022}/core/components/scan/scan.component.mjs +4 -4
- package/{esm2020 → esm2022}/core/components/scan-results/scan-results.component.mjs +4 -4
- package/{esm2020 → esm2022}/core/components/webcam/webcam/webcam.component.mjs +4 -4
- package/{esm2020 → esm2022}/core/components/webcam/webcam.module.mjs +5 -5
- package/{esm2020 → esm2022}/core/pipes/pipes.module.mjs +5 -5
- package/{esm2020 → esm2022}/core/pipes/safeResourceUrl.pipe.mjs +4 -4
- package/{esm2020 → esm2022}/core/shared/material.module.mjs +85 -85
- package/{esm2020 → esm2022}/dialogs/components/blank/blank.component.mjs +4 -4
- package/{esm2020 → esm2022}/dialogs/components/confirm/confirm.component.mjs +4 -4
- package/{esm2020 → esm2022}/dialogs/components/loading/loading.component.mjs +4 -4
- package/{esm2020 → esm2022}/dialogs/components/prompt-manual/prompt-manual.component.mjs +4 -4
- package/{esm2020 → esm2022}/dialogs/components/scan-profile/scan-profile.component.mjs +4 -4
- package/{esm2020 → esm2022}/dialogs/components/scan-selfie/scan-selfie.component.mjs +4 -4
- package/{esm2020 → esm2022}/dialogs/components/turn-document/turn-document.component.mjs +4 -4
- package/{esm2020 → esm2022}/dialogs/dialogs.core.provider.mjs +4 -4
- package/{esm2020 → esm2022}/dialogs/dialogs.module.mjs +35 -35
- package/esm2022/forms/form.module.mjs +87 -0
- package/{esm2020 → esm2022}/forms/types/avatar.type.mjs +6 -6
- package/{esm2020 → esm2022}/forms/types/profile.image.type.mjs +6 -6
- package/{esm2020 → esm2022}/forms/types/title.type.mjs +6 -6
- package/{esm2020 → esm2022}/lib/ngx-scandoc.module.mjs +5 -5
- package/{esm2020 → esm2022}/providers/auth.provider.mjs +4 -4
- package/{esm2020 → esm2022}/providers/camera.provider.mjs +4 -4
- package/{esm2020 → esm2022}/providers/interceptor.provider.mjs +4 -4
- package/{esm2020 → esm2022}/providers/layout.provider.mjs +4 -4
- package/{esm2020 → esm2022}/providers/scan.form.mjs +4 -4
- package/{esm2020 → esm2022}/providers/scan.provider.mjs +4 -4
- package/{esm2020 → esm2022}/providers/translate-loader.provider.mjs +4 -4
- package/{esm2020 → esm2022}/providers/translation.provider.mjs +4 -4
- package/{esm2020 → esm2022}/providers/webrtc.provider.mjs +4 -4
- package/{fesm2020 → fesm2022}/ngx-scandoc.mjs +268 -268
- package/{fesm2020 → fesm2022}/ngx-scandoc.mjs.map +1 -1
- package/package.json +14 -20
- package/esm2020/forms/form.module.mjs +0 -87
- package/fesm2015/ngx-scandoc.mjs +0 -4477
- package/fesm2015/ngx-scandoc.mjs.map +0 -1
- /package/{esm2020 → esm2022}/core/app.worker.mjs +0 -0
- /package/{esm2020 → esm2022}/core/components/base.component.mjs +0 -0
- /package/{esm2020 → esm2022}/core/components/webcam/domain/webcam-image.mjs +0 -0
- /package/{esm2020 → esm2022}/core/components/webcam/domain/webcam-init-error.mjs +0 -0
- /package/{esm2020 → esm2022}/core/components/webcam/domain/webcam-mirror-properties.mjs +0 -0
- /package/{esm2020 → esm2022}/core/components/webcam/util/webcam.util.mjs +0 -0
- /package/{esm2020 → esm2022}/core/helpers/object-utils.mjs +0 -0
- /package/{esm2020 → esm2022}/core/interfaces/config.mjs +0 -0
- /package/{esm2020 → esm2022}/core/interfaces/guest.data.mjs +0 -0
- /package/{esm2020 → esm2022}/core/tokens/config.tokens.mjs +0 -0
- /package/{esm2020 → esm2022}/ngx-scandoc.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
package/fesm2015/ngx-scandoc.mjs
DELETED
|
@@ -1,4477 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, Input, HostListener, ViewChild, Output, NgModule, InjectionToken, Optional, Inject, HostBinding, Pipe, ViewContainerRef } from '@angular/core';
|
|
3
|
-
import * as i2$1 from '@angular/common';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
5
|
-
import { Subject, of, from, Observable, tap, distinctUntilChanged, switchMap as switchMap$1, throwError, forkJoin } from 'rxjs';
|
|
6
|
-
import { takeUntil, map, switchMap, tap as tap$1, catchError, share, retry } from 'rxjs/operators';
|
|
7
|
-
import * as i1 from '@angular/cdk/layout';
|
|
8
|
-
import * as i2 from '@angular/cdk/platform';
|
|
9
|
-
import { PlatformModule } from '@angular/cdk/platform';
|
|
10
|
-
import * as i5 from '@angular/forms';
|
|
11
|
-
import { FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
12
|
-
import moment from 'moment';
|
|
13
|
-
import * as i1$1 from '@angular/common/http';
|
|
14
|
-
import { HttpHeaders, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
15
|
-
import * as i4$1 from 'ngx-device-detector';
|
|
16
|
-
import jwt_decode from 'jwt-decode';
|
|
17
|
-
import * as i6$1 from '@angular/material/icon';
|
|
18
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
19
|
-
import * as i3 from '@angular/material/button';
|
|
20
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
21
|
-
import * as i8 from '@angular/material/progress-bar';
|
|
22
|
-
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
23
|
-
import * as i4 from '@ngx-translate/core';
|
|
24
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
25
|
-
import * as i6 from '@angular/material/card';
|
|
26
|
-
import { MatCardModule } from '@angular/material/card';
|
|
27
|
-
import * as i7 from '@ngx-formly/core';
|
|
28
|
-
import { FormlyModule } from '@ngx-formly/core';
|
|
29
|
-
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
30
|
-
import { MatBadgeModule } from '@angular/material/badge';
|
|
31
|
-
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
32
|
-
import { MatChipsModule } from '@angular/material/chips';
|
|
33
|
-
import * as i6$3 from '@angular/material/core';
|
|
34
|
-
import { MatNativeDateModule } from '@angular/material/core';
|
|
35
|
-
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
36
|
-
import * as i1$3 from '@angular/material/dialog';
|
|
37
|
-
import { MatDialogModule, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|
38
|
-
import * as i6$2 from '@angular/material/input';
|
|
39
|
-
import { MatInputModule } from '@angular/material/input';
|
|
40
|
-
import { MatListModule } from '@angular/material/list';
|
|
41
|
-
import { MatMenuModule } from '@angular/material/menu';
|
|
42
|
-
import { MatPaginatorModule } from '@angular/material/paginator';
|
|
43
|
-
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
44
|
-
import * as i5$1 from '@angular/material/select';
|
|
45
|
-
import { MatSelectModule } from '@angular/material/select';
|
|
46
|
-
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
47
|
-
import { MatSliderModule } from '@angular/material/slider';
|
|
48
|
-
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
|
49
|
-
import { MatTableModule } from '@angular/material/table';
|
|
50
|
-
import { MatTabsModule } from '@angular/material/tabs';
|
|
51
|
-
import { FieldType, FormlyMaterialModule } from '@ngx-formly/material';
|
|
52
|
-
import { FormlySelectModule } from '@ngx-formly/core/select';
|
|
53
|
-
import { AvatarModule } from 'ngx-avatars';
|
|
54
|
-
import * as i4$2 from '@angular/material/form-field';
|
|
55
|
-
import { FormlyMatDatepickerModule } from '@ngx-formly/material/datepicker';
|
|
56
|
-
import * as i1$2 from '@angular/platform-browser';
|
|
57
|
-
import { webSocket } from 'rxjs/webSocket';
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Container class for a captured webcam image
|
|
61
|
-
* @author basst314, davidshen84
|
|
62
|
-
*/
|
|
63
|
-
class WebcamImage {
|
|
64
|
-
constructor(imageAsDataUrl, mimeType, imageData, resized) {
|
|
65
|
-
this._mimeType = mimeType;
|
|
66
|
-
this._imageAsDataUrl = imageAsDataUrl;
|
|
67
|
-
this._imageData = imageData;
|
|
68
|
-
this._imageResized = resized;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Extracts the Base64 data out of the given dataUrl.
|
|
72
|
-
* @param dataUrl the given dataUrl
|
|
73
|
-
* @param mimeType the mimeType of the data
|
|
74
|
-
*/
|
|
75
|
-
static getDataFromDataUrl(dataUrl, mimeType) {
|
|
76
|
-
return dataUrl.replace(`data:${mimeType};base64,`, '');
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Get the base64 encoded image data
|
|
80
|
-
* @returns base64 data of the image
|
|
81
|
-
*/
|
|
82
|
-
get imageAsBase64() {
|
|
83
|
-
return this._imageAsBase64
|
|
84
|
-
? this._imageAsBase64
|
|
85
|
-
: (this._imageAsBase64 = WebcamImage.getDataFromDataUrl(this._imageAsDataUrl, this._mimeType));
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Get the encoded image as dataUrl
|
|
89
|
-
* @returns the dataUrl of the image
|
|
90
|
-
*/
|
|
91
|
-
get imageAsDataUrl() {
|
|
92
|
-
return this._imageAsDataUrl;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Get the ImageData object associated with the canvas' 2d context.
|
|
96
|
-
* @returns the ImageData of the canvas's 2d context.
|
|
97
|
-
*/
|
|
98
|
-
get imageData() {
|
|
99
|
-
return this._imageData;
|
|
100
|
-
}
|
|
101
|
-
get imageResized() {
|
|
102
|
-
return this._imageResized;
|
|
103
|
-
}
|
|
104
|
-
get dataUrl() {
|
|
105
|
-
const canvas = document.createElement('canvas');
|
|
106
|
-
const { width, height } = this._imageData;
|
|
107
|
-
canvas.width = width;
|
|
108
|
-
canvas.height = height;
|
|
109
|
-
const ctx = canvas.getContext('2d');
|
|
110
|
-
if (ctx) {
|
|
111
|
-
ctx.putImageData(this._imageData, 0, 0);
|
|
112
|
-
}
|
|
113
|
-
return canvas.toDataURL(this._mimeType, 1);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
class BaseComponent {
|
|
118
|
-
constructor() {
|
|
119
|
-
this.$destroy = new Subject();
|
|
120
|
-
}
|
|
121
|
-
__subs(observable) {
|
|
122
|
-
return observable.pipe(takeUntil(this.$destroy));
|
|
123
|
-
}
|
|
124
|
-
__destroy() {
|
|
125
|
-
this.$destroy.next(true);
|
|
126
|
-
this.$destroy.complete();
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
class NgxScandocCameraProvider {
|
|
131
|
-
constructor(platform) {
|
|
132
|
-
this.platform = platform;
|
|
133
|
-
this.selfie$ = new Subject();
|
|
134
|
-
this.rectPosition = {
|
|
135
|
-
l: 0,
|
|
136
|
-
t: 0,
|
|
137
|
-
h: 0,
|
|
138
|
-
w: 0,
|
|
139
|
-
_w: 0,
|
|
140
|
-
_h: 0,
|
|
141
|
-
};
|
|
142
|
-
this.switchCamera = new Subject();
|
|
143
|
-
this.$showSwitchSelfie = new Subject();
|
|
144
|
-
this.cameraReady = false;
|
|
145
|
-
this.$showSwitch = new Subject();
|
|
146
|
-
this.cameraSwitched = new Subject();
|
|
147
|
-
this.devices = new Subject();
|
|
148
|
-
this.multipleWebcamsAvailable = false;
|
|
149
|
-
this.id = Math.random();
|
|
150
|
-
console.warn('PROVIDER INIT', this.id);
|
|
151
|
-
this.setup();
|
|
152
|
-
}
|
|
153
|
-
get hintPosition() {
|
|
154
|
-
return this.rectPosition.t + this.rectPosition.h + 5;
|
|
155
|
-
}
|
|
156
|
-
getDevices() {
|
|
157
|
-
if (this.mediaDevices) {
|
|
158
|
-
return of(this.mediaDevices);
|
|
159
|
-
}
|
|
160
|
-
return this.devices.asObservable();
|
|
161
|
-
}
|
|
162
|
-
preloadVideo() {
|
|
163
|
-
return from(navigator.mediaDevices.getUserMedia({ video: true })).pipe(map((mediaStream) => {
|
|
164
|
-
console.warn(mediaStream);
|
|
165
|
-
if (!this.platform.FIREFOX) {
|
|
166
|
-
mediaStream.getTracks().forEach((track) => {
|
|
167
|
-
track.stop();
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
}));
|
|
171
|
-
}
|
|
172
|
-
setup() {
|
|
173
|
-
console.warn('SETUP');
|
|
174
|
-
this.$showSwitch.subscribe((s) => {
|
|
175
|
-
console.log(s);
|
|
176
|
-
});
|
|
177
|
-
// console.time('device');
|
|
178
|
-
const devices$ = this.preloadVideo().pipe(switchMap(() => from(navigator.mediaDevices.enumerateDevices()).pipe(map((inputDevices) => inputDevices.filter((m) => m.kind == 'videoinput')))));
|
|
179
|
-
devices$.subscribe((mediaDevices) => {
|
|
180
|
-
console.log('[DEVICES]', mediaDevices, mediaDevices.map((d) => d.label));
|
|
181
|
-
this.mediaDevices = mediaDevices;
|
|
182
|
-
this.multipleWebcamsAvailable = mediaDevices && mediaDevices.length > 1;
|
|
183
|
-
this.devices.next(mediaDevices);
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
setDefault() {
|
|
187
|
-
if (this.deviceId) {
|
|
188
|
-
this.switchCamera.next(this.deviceId);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
selectCamera(event) {
|
|
192
|
-
this.switchCamera.next(event.value);
|
|
193
|
-
}
|
|
194
|
-
cameraWasSwitched(deviceId) {
|
|
195
|
-
console.log('[active device]', deviceId);
|
|
196
|
-
this.deviceId = deviceId;
|
|
197
|
-
this.cameraReady = true;
|
|
198
|
-
}
|
|
199
|
-
get webcamObservable() {
|
|
200
|
-
return this.switchCamera.asObservable();
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
NgxScandocCameraProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocCameraProvider, deps: [{ token: i2.Platform }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
204
|
-
NgxScandocCameraProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocCameraProvider, providedIn: 'root' });
|
|
205
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocCameraProvider, decorators: [{
|
|
206
|
-
type: Injectable,
|
|
207
|
-
args: [{
|
|
208
|
-
providedIn: 'root',
|
|
209
|
-
}]
|
|
210
|
-
}], ctorParameters: function () { return [{ type: i2.Platform }]; } });
|
|
211
|
-
|
|
212
|
-
class WebcamComponent extends BaseComponent {
|
|
213
|
-
onResize() {
|
|
214
|
-
this.cameraProvider.rectPosition.t = 0;
|
|
215
|
-
// this.videoReady.next(false);
|
|
216
|
-
if (this.resizeTimeout) {
|
|
217
|
-
clearTimeout(this.resizeTimeout);
|
|
218
|
-
}
|
|
219
|
-
this.resizeTimeout = setTimeout(() => {
|
|
220
|
-
this.drawRectangle();
|
|
221
|
-
}, 50);
|
|
222
|
-
}
|
|
223
|
-
constructor(breakpointObserver, platform, cd, zone, cameraProvider) {
|
|
224
|
-
super();
|
|
225
|
-
this.breakpointObserver = breakpointObserver;
|
|
226
|
-
this.platform = platform;
|
|
227
|
-
this.cd = cd;
|
|
228
|
-
this.zone = zone;
|
|
229
|
-
this.cameraProvider = cameraProvider;
|
|
230
|
-
this.canvasSize = { width: 0, height: 0 };
|
|
231
|
-
this.showVideo = false;
|
|
232
|
-
this.setupAttempt = 0;
|
|
233
|
-
this.canvasData = {
|
|
234
|
-
ctx: null,
|
|
235
|
-
ctxO: null,
|
|
236
|
-
};
|
|
237
|
-
this.chunks = [];
|
|
238
|
-
this.cameraSwitched = new EventEmitter();
|
|
239
|
-
this.videoReady = new EventEmitter();
|
|
240
|
-
this.imageCapture = new EventEmitter();
|
|
241
|
-
this.initError = new EventEmitter();
|
|
242
|
-
}
|
|
243
|
-
ngAfterViewInit() {
|
|
244
|
-
console.warn('[video] start');
|
|
245
|
-
// initial load
|
|
246
|
-
this.__subs(this.cameraProvider.getDevices()).subscribe((resp) => {
|
|
247
|
-
this.init();
|
|
248
|
-
});
|
|
249
|
-
// camera switch
|
|
250
|
-
this.__subs(this.cameraProvider.webcamObservable).subscribe((device) => {
|
|
251
|
-
const videoTrackConstraints = this.setConstraints();
|
|
252
|
-
this.stopAllTracks();
|
|
253
|
-
this.showVideo = false;
|
|
254
|
-
this.cd.detectChanges();
|
|
255
|
-
videoTrackConstraints.deviceId = device;
|
|
256
|
-
this.setup(videoTrackConstraints);
|
|
257
|
-
});
|
|
258
|
-
this.__subs(this.trigger).subscribe((time) => this.takeSnapshot(time));
|
|
259
|
-
}
|
|
260
|
-
get video() {
|
|
261
|
-
return this.videoRef.nativeElement;
|
|
262
|
-
}
|
|
263
|
-
get isMobile() {
|
|
264
|
-
return this.platform.ANDROID || this.platform.IOS;
|
|
265
|
-
}
|
|
266
|
-
setConstraints() {
|
|
267
|
-
const out = {};
|
|
268
|
-
console.warn('MOBILE', this.isMobile);
|
|
269
|
-
switch (this.type) {
|
|
270
|
-
default:
|
|
271
|
-
if (this.isMobile) {
|
|
272
|
-
out.video = { height: { ideal: 1600 }, width: { ideal: 1600 } };
|
|
273
|
-
out.video.facingMode = 'environment';
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
out.video = {
|
|
277
|
-
width: {
|
|
278
|
-
min: 1280,
|
|
279
|
-
ideal: 1920,
|
|
280
|
-
max: 2900,
|
|
281
|
-
},
|
|
282
|
-
height: {
|
|
283
|
-
min: 720,
|
|
284
|
-
ideal: 1080,
|
|
285
|
-
max: 2900,
|
|
286
|
-
},
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
break;
|
|
290
|
-
case 'selfie':
|
|
291
|
-
if (this.isMobile) {
|
|
292
|
-
out.video = { height: { ideal: 1600 }, width: { ideal: 1600 } };
|
|
293
|
-
out.video.facingMode = 'user';
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
out.video = {
|
|
297
|
-
frameRate: { min: 10 },
|
|
298
|
-
height: { ideal: 1080 },
|
|
299
|
-
width: { ideal: 1920 },
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
break;
|
|
303
|
-
}
|
|
304
|
-
return out.video;
|
|
305
|
-
}
|
|
306
|
-
get activeTrackSettings() {
|
|
307
|
-
return this.mediaStream.getVideoTracks()[0].getSettings();
|
|
308
|
-
}
|
|
309
|
-
get activeTrackCapabilities() {
|
|
310
|
-
try {
|
|
311
|
-
return this.mediaStream.getVideoTracks()[0].getCapabilities();
|
|
312
|
-
}
|
|
313
|
-
catch (e) {
|
|
314
|
-
return {};
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
init() {
|
|
318
|
-
this.__subs(this.cameraProvider.getDevices()).subscribe((resp) => {
|
|
319
|
-
console.warn('DEVICES', resp);
|
|
320
|
-
const videoTrackConstraints = this.setConstraints();
|
|
321
|
-
this.setupAttempt = 0;
|
|
322
|
-
this.setup(videoTrackConstraints);
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
setDeviceId(stream) {
|
|
326
|
-
this.mediaStream = stream;
|
|
327
|
-
this.cameraProvider.deviceId = this.activeTrackSettings.deviceId;
|
|
328
|
-
this.startVideo();
|
|
329
|
-
}
|
|
330
|
-
setup(videoTrackConstraints) {
|
|
331
|
-
console.warn('videoTrackConstraints', videoTrackConstraints);
|
|
332
|
-
console.time('device');
|
|
333
|
-
this.__subs(from(navigator.mediaDevices.getUserMedia({
|
|
334
|
-
video: videoTrackConstraints,
|
|
335
|
-
}))).subscribe((stream) => {
|
|
336
|
-
console.timeEnd('device');
|
|
337
|
-
stream.getTracks().forEach((t) => {
|
|
338
|
-
var _a, _b;
|
|
339
|
-
//console.warn(t.getConstraints());
|
|
340
|
-
if (!this.isMobile) {
|
|
341
|
-
try {
|
|
342
|
-
if (!t.getCapabilities) {
|
|
343
|
-
this.setDeviceId(stream);
|
|
344
|
-
return;
|
|
345
|
-
}
|
|
346
|
-
const settings = t.getSettings();
|
|
347
|
-
const cap = t.getCapabilities();
|
|
348
|
-
const con = t.getConstraints();
|
|
349
|
-
console.warn(cap, con);
|
|
350
|
-
console.warn(settings);
|
|
351
|
-
const max = (_a = cap.width) === null || _a === void 0 ? void 0 : _a.max;
|
|
352
|
-
const min = (_b = cap.width) === null || _b === void 0 ? void 0 : _b.min;
|
|
353
|
-
const currentWidth = settings.width;
|
|
354
|
-
const currentHeight = settings.height;
|
|
355
|
-
const conWidth = con.width;
|
|
356
|
-
const conHeight = con.width;
|
|
357
|
-
console.warn('CAPS', min, max, 'CURENT', currentWidth, currentHeight);
|
|
358
|
-
if (max &&
|
|
359
|
-
currentWidth &&
|
|
360
|
-
max > currentWidth &&
|
|
361
|
-
conWidth != max &&
|
|
362
|
-
currentWidth != 1920) {
|
|
363
|
-
console.log('[SET NEW RESOLUTION] ', max, currentWidth);
|
|
364
|
-
this.setupAttempt++;
|
|
365
|
-
if (this.setupAttempt < 4) {
|
|
366
|
-
this.setup(videoTrackConstraints);
|
|
367
|
-
}
|
|
368
|
-
else {
|
|
369
|
-
this.setDeviceId(stream);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
else {
|
|
373
|
-
this.setDeviceId(stream);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
catch (error) {
|
|
377
|
-
console.warn(error);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
else {
|
|
381
|
-
console.warn('MOBILE VIDEO START');
|
|
382
|
-
this.setDeviceId(stream);
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
}, (er) => {
|
|
386
|
-
this.setupAttempt++;
|
|
387
|
-
console.warn('ERROR', er);
|
|
388
|
-
if (this.setupAttempt < 4) {
|
|
389
|
-
if (er instanceof OverconstrainedError) {
|
|
390
|
-
if (!this.isMobile) {
|
|
391
|
-
this.setup(videoTrackConstraints);
|
|
392
|
-
}
|
|
393
|
-
// this.setup({
|
|
394
|
-
// height: 720,
|
|
395
|
-
// width: 1280,
|
|
396
|
-
// });
|
|
397
|
-
//}
|
|
398
|
-
}
|
|
399
|
-
else {
|
|
400
|
-
this.setup(videoTrackConstraints);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
startVideo() {
|
|
406
|
-
console.log('START VIDEO');
|
|
407
|
-
this.video.srcObject = this.mediaStream;
|
|
408
|
-
this.video.onloadedmetadata = (data) => {
|
|
409
|
-
console.log(data);
|
|
410
|
-
this.video.play();
|
|
411
|
-
this.showVideo = true;
|
|
412
|
-
this.cd.detectChanges();
|
|
413
|
-
console.log('VIDEO PLAY');
|
|
414
|
-
};
|
|
415
|
-
this.video.onplay = () => {
|
|
416
|
-
this.videoReady.next(true);
|
|
417
|
-
console.log(this.video.videoWidth, this.video.videoHeight);
|
|
418
|
-
this.drawRectangle();
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
setCanvas() {
|
|
422
|
-
let _canvas = document.createElement('canvas'); //this.canvasSnapshot.nativeElement;
|
|
423
|
-
const { videoWidth, videoHeight } = this.video;
|
|
424
|
-
const aspect = videoWidth / videoHeight;
|
|
425
|
-
const canvasSmalSize = 384;
|
|
426
|
-
const smallSize = {
|
|
427
|
-
w: 0,
|
|
428
|
-
h: 0,
|
|
429
|
-
};
|
|
430
|
-
if (videoWidth >= videoHeight) {
|
|
431
|
-
smallSize.w = canvasSmalSize;
|
|
432
|
-
smallSize.h = canvasSmalSize / aspect;
|
|
433
|
-
}
|
|
434
|
-
else {
|
|
435
|
-
smallSize.h = canvasSmalSize;
|
|
436
|
-
smallSize.h = canvasSmalSize * aspect;
|
|
437
|
-
}
|
|
438
|
-
//console.log('SZ', smallSize);
|
|
439
|
-
_canvas.width = videoWidth;
|
|
440
|
-
_canvas.height = videoHeight;
|
|
441
|
-
const ctx = _canvas.getContext('2d', {
|
|
442
|
-
// alpha: false,
|
|
443
|
-
// powerPreference: 'high-performance',
|
|
444
|
-
// antialias: false,
|
|
445
|
-
// depth: false,
|
|
446
|
-
// desynchronized: true,
|
|
447
|
-
// willReadFrequently: true,
|
|
448
|
-
});
|
|
449
|
-
const canvas = document.createElement('canvas'); // needs an initial size
|
|
450
|
-
canvas.height = smallSize.h;
|
|
451
|
-
canvas.width = smallSize.w;
|
|
452
|
-
const ctxO = canvas.getContext('2d', {
|
|
453
|
-
// alpha: false,
|
|
454
|
-
// powerPreference: 'high-performance',
|
|
455
|
-
// antialias: false,
|
|
456
|
-
// depth: false,
|
|
457
|
-
// desynchronized: true,
|
|
458
|
-
// willReadFrequently: true,
|
|
459
|
-
});
|
|
460
|
-
this.canvasData.ctx = ctx;
|
|
461
|
-
this.canvasData.ctxO = ctxO;
|
|
462
|
-
this.canvasData.canvas = canvas;
|
|
463
|
-
this.canvasData._canvas = _canvas;
|
|
464
|
-
this.canvasData.size = smallSize;
|
|
465
|
-
// const stream = this.video.captureStream(5);
|
|
466
|
-
// const mediaRecorder = new MediaRecorder(stream);
|
|
467
|
-
// mediaRecorder.start();
|
|
468
|
-
// mediaRecorder.ondataavailable = (e:any) => {
|
|
469
|
-
// console.log(e)
|
|
470
|
-
// this.chunks.push(e.data);
|
|
471
|
-
// var url = window.URL.createObjectURL(e.data);
|
|
472
|
-
// var anchor = document.createElement('a');
|
|
473
|
-
// anchor.download = 'myfile.webm';
|
|
474
|
-
// anchor.href = url;
|
|
475
|
-
// anchor.click();
|
|
476
|
-
// };
|
|
477
|
-
}
|
|
478
|
-
takeSelfie() {
|
|
479
|
-
const mimeType = 'image/jpeg';
|
|
480
|
-
const { videoWidth, offsetWidth, videoHeight } = this.video;
|
|
481
|
-
let _canvas = document.createElement('canvas'); //this.canvasSnapshot.nativeElement;
|
|
482
|
-
const { w, h } = this.cameraProvider.rectPosition;
|
|
483
|
-
const aspect = videoWidth / offsetWidth;
|
|
484
|
-
// console.log(videoWidth, offsetWidth, l, t, w, h);
|
|
485
|
-
_canvas.width = w * aspect;
|
|
486
|
-
_canvas.height = h * aspect;
|
|
487
|
-
const dx = videoWidth - w * aspect;
|
|
488
|
-
const dy = videoHeight - h * aspect;
|
|
489
|
-
const x = dx / 2;
|
|
490
|
-
const y = dy / 2;
|
|
491
|
-
const ctx = _canvas.getContext('2d', {
|
|
492
|
-
alpha: false,
|
|
493
|
-
powerPreference: 'high-performance',
|
|
494
|
-
antialias: false,
|
|
495
|
-
depth: false,
|
|
496
|
-
desynchronized: true,
|
|
497
|
-
});
|
|
498
|
-
if (ctx) {
|
|
499
|
-
ctx.drawImage(this.video, x, y, w * aspect, h * aspect, 0, 0, w * aspect, h * aspect);
|
|
500
|
-
const imgAsUrl = _canvas.toDataURL(mimeType, 1);
|
|
501
|
-
this.imageCapture.emit(new WebcamImage(imgAsUrl, mimeType, new ImageData(1, 1), null));
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
humanFileSize(bytes, si = false, dp = 1) {
|
|
505
|
-
const thresh = si ? 1000 : 1024;
|
|
506
|
-
if (Math.abs(bytes) < thresh) {
|
|
507
|
-
return bytes + ' B';
|
|
508
|
-
}
|
|
509
|
-
const units = si
|
|
510
|
-
? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
|
511
|
-
: ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
512
|
-
let u = -1;
|
|
513
|
-
const r = Math.pow(10, dp);
|
|
514
|
-
do {
|
|
515
|
-
bytes /= thresh;
|
|
516
|
-
++u;
|
|
517
|
-
} while (Math.round(Math.abs(bytes) * r) / r >= thresh &&
|
|
518
|
-
u < units.length - 1);
|
|
519
|
-
return bytes.toFixed(dp) + ' ' + units[u];
|
|
520
|
-
}
|
|
521
|
-
takeSnapshot(time) {
|
|
522
|
-
if (this.type !== 'document') {
|
|
523
|
-
this.takeSelfie();
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
// console.warn('SNAP', time);
|
|
527
|
-
if (!this.showVideo) {
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
this.zone.runOutsideAngular(() => {
|
|
531
|
-
const canvasSmalSize = 384;
|
|
532
|
-
const mimeType = 'image/jpeg';
|
|
533
|
-
// let _canvas: HTMLCanvasElement = document.createElement('canvas'); //this.canvasSnapshot.nativeElement;
|
|
534
|
-
const { videoWidth, videoHeight } = this.video;
|
|
535
|
-
// _canvas.width = videoWidth;
|
|
536
|
-
// _canvas.height = videoHeight;
|
|
537
|
-
// console.log(videoWidth, videoHeight);
|
|
538
|
-
// const ctx: any = _canvas.getContext('2d', {
|
|
539
|
-
// alpha: false,
|
|
540
|
-
// powerPreference: 'high-performance',
|
|
541
|
-
// antialias: false,
|
|
542
|
-
// depth: false,
|
|
543
|
-
// desynchronized: true,
|
|
544
|
-
// });
|
|
545
|
-
// const canvas = document.createElement('canvas'); // needs an initial size
|
|
546
|
-
// canvas.height = canvasSmalSize;
|
|
547
|
-
// canvas.width = canvasSmalSize;
|
|
548
|
-
// const ctxO: any = canvas.getContext('2d', {
|
|
549
|
-
// alpha: false,
|
|
550
|
-
// powerPreference: 'high-performance',
|
|
551
|
-
// antialias: false,
|
|
552
|
-
// depth: false,
|
|
553
|
-
// desynchronized: true,
|
|
554
|
-
// });
|
|
555
|
-
const { ctx, ctxO, canvas, _canvas, size } = this.canvasData;
|
|
556
|
-
if (ctx && ctxO) {
|
|
557
|
-
ctx.imageSmoothingEnabled = false;
|
|
558
|
-
const drawStart = Date.now();
|
|
559
|
-
ctx.clearRect(0, 0, videoWidth, videoHeight);
|
|
560
|
-
ctxO.clearRect(0, 0, size.w, size.h);
|
|
561
|
-
ctx.drawImage(this.video, 0, 0);
|
|
562
|
-
//console.time('drawVideo');
|
|
563
|
-
ctxO.drawImage(_canvas, 0, 0, size.w, size.h);
|
|
564
|
-
//console.timeEnd('drawVideo');
|
|
565
|
-
//console.time('DRAW');
|
|
566
|
-
// const imData: any = ctx.getImageData(0, 0, videoWidth, videoHeight);
|
|
567
|
-
console.log(canvas.width, _canvas.width);
|
|
568
|
-
//console.timeEnd('DRAW');
|
|
569
|
-
//console.time('CTX');
|
|
570
|
-
const resize = canvas.toDataURL('image/jpeg');
|
|
571
|
-
const canvasData = _canvas.toDataURL(mimeType, 1);
|
|
572
|
-
console.log(this.humanFileSize(canvasData.length));
|
|
573
|
-
console.log(this.humanFileSize(resize.length));
|
|
574
|
-
console.log(new Date().toISOString());
|
|
575
|
-
//console.timeEnd('CTX');
|
|
576
|
-
const currentTime = new Date().getTime();
|
|
577
|
-
const diff = currentTime - time;
|
|
578
|
-
// total time for pack one image
|
|
579
|
-
const drawTime = Date.now() - drawStart;
|
|
580
|
-
//console.warn('DRAW TIME', drawTime);
|
|
581
|
-
const delayMax = drawTime < 60 ? 100 : 200;
|
|
582
|
-
const delay = diff > delayMax ? 0 : delayMax - diff;
|
|
583
|
-
const timeout = setTimeout(() => {
|
|
584
|
-
this.imageCapture.emit(new WebcamImage(canvasData, mimeType, '', resize));
|
|
585
|
-
clearTimeout(timeout);
|
|
586
|
-
}, delay);
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
stopAllTracks() {
|
|
591
|
-
this.showVideo = false;
|
|
592
|
-
if (this.mediaStream && this.mediaStream.getTracks) {
|
|
593
|
-
// getTracks() returns all media tracks (video+audio)
|
|
594
|
-
this.mediaStream.getTracks().forEach((track) => {
|
|
595
|
-
// console.log(track);
|
|
596
|
-
track.enabled = false;
|
|
597
|
-
this.cd.detectChanges();
|
|
598
|
-
track.stop();
|
|
599
|
-
this.video.srcObject.removeTrack(track);
|
|
600
|
-
this.mediaStream.removeTrack(track);
|
|
601
|
-
this.cd.detectChanges();
|
|
602
|
-
});
|
|
603
|
-
this.video.srcObject = null;
|
|
604
|
-
// this.video.src = null;
|
|
605
|
-
this.video.load();
|
|
606
|
-
}
|
|
607
|
-
// this.__subs(this.stopVideoTracks()).subscribe()
|
|
608
|
-
}
|
|
609
|
-
drawRectangle() {
|
|
610
|
-
this.zone.run(() => {
|
|
611
|
-
const _canvas = this.canvas.nativeElement;
|
|
612
|
-
let padding = 10;
|
|
613
|
-
if (!this.isMobile && _canvas.width !== _canvas.height) {
|
|
614
|
-
padding = 40;
|
|
615
|
-
}
|
|
616
|
-
const ctx = _canvas.getContext('2d');
|
|
617
|
-
ctx.clearRect(0, 0, _canvas.width, _canvas.height);
|
|
618
|
-
const { width, height } = _canvas;
|
|
619
|
-
console.log('CANVAS', width, height);
|
|
620
|
-
let { videoWidth, videoHeight } = this.video;
|
|
621
|
-
// video will be scaled to max canvas height
|
|
622
|
-
const aspect = videoWidth / videoHeight;
|
|
623
|
-
// if (videoHeight < height) {
|
|
624
|
-
// videoHeight = height;
|
|
625
|
-
// videoWidth = height*aspect;
|
|
626
|
-
// }
|
|
627
|
-
console.log('VIDEO', videoWidth, videoHeight);
|
|
628
|
-
const docSize = this.type === 'selfie' ? 1 : 86 / 55;
|
|
629
|
-
let _height;
|
|
630
|
-
let _width;
|
|
631
|
-
if (videoWidth >= videoHeight) {
|
|
632
|
-
_width = width;
|
|
633
|
-
_height = _width / aspect;
|
|
634
|
-
if (_height > height) {
|
|
635
|
-
_height = height;
|
|
636
|
-
_width = aspect * _height;
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
else {
|
|
640
|
-
_height = height;
|
|
641
|
-
_width = aspect * _height;
|
|
642
|
-
if (_width > width) {
|
|
643
|
-
_width = width;
|
|
644
|
-
_height = _width / aspect;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
console.log('CALC', _width, _height);
|
|
648
|
-
let w, h;
|
|
649
|
-
if (_width <= _height) {
|
|
650
|
-
w = _width - 2 * padding;
|
|
651
|
-
h = w / docSize;
|
|
652
|
-
}
|
|
653
|
-
else {
|
|
654
|
-
h = _height - 2 * padding;
|
|
655
|
-
w = docSize * h;
|
|
656
|
-
}
|
|
657
|
-
if (w > _width) {
|
|
658
|
-
w = _width - 2 * padding;
|
|
659
|
-
h = w / docSize;
|
|
660
|
-
}
|
|
661
|
-
h = Math.floor(h);
|
|
662
|
-
w = Math.floor(w);
|
|
663
|
-
console.log(w, h);
|
|
664
|
-
const left = Math.floor((width - w) / 2);
|
|
665
|
-
const top = Math.floor((height - h) / 2);
|
|
666
|
-
ctx.strokeStyle = 'white';
|
|
667
|
-
// ctx.strokeRect(left, top, _width, _height);
|
|
668
|
-
ctx.fillStyle = 'rgba(255, 255, 255, 0.2)';
|
|
669
|
-
// ctx.shadowColor = 'white';
|
|
670
|
-
ctx.shadowBlur = 15;
|
|
671
|
-
ctx.beginPath();
|
|
672
|
-
// Draw using 5px for border radius on all sides
|
|
673
|
-
// stroke it but no fill
|
|
674
|
-
const radius = this.isMobile ? 10 : 30;
|
|
675
|
-
ctx.roundRect(left, top, w, h, radius);
|
|
676
|
-
ctx.stroke();
|
|
677
|
-
ctx.fill();
|
|
678
|
-
this.cameraProvider.rectPosition = {
|
|
679
|
-
l: left,
|
|
680
|
-
t: top,
|
|
681
|
-
w,
|
|
682
|
-
h,
|
|
683
|
-
_w: _width,
|
|
684
|
-
_h: _height,
|
|
685
|
-
};
|
|
686
|
-
this.setCanvas();
|
|
687
|
-
// ctx.stroke();
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
ngOnDestroy() {
|
|
691
|
-
this.video.pause();
|
|
692
|
-
// this.video.getTracks().forEach((track: any) => {
|
|
693
|
-
// track.stop();
|
|
694
|
-
// this.video.srcObject.removeTrack(track);
|
|
695
|
-
// });
|
|
696
|
-
this.stopAllTracks();
|
|
697
|
-
if (this.triggerSubscription) {
|
|
698
|
-
this.triggerSubscription.unsubscribe();
|
|
699
|
-
}
|
|
700
|
-
this.__destroy();
|
|
701
|
-
console.warn('[VIDEO] destroyed');
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
WebcamComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: WebcamComponent, deps: [{ token: i1.BreakpointObserver }, { token: i2.Platform }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: NgxScandocCameraProvider }], target: i0.ɵɵFactoryTarget.Component });
|
|
705
|
-
WebcamComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: WebcamComponent, selector: "ngx-scandoc-webcam", inputs: { imageHandler: "imageHandler", type: "type", trigger: "trigger" }, outputs: { cameraSwitched: "cameraSwitched", videoReady: "videoReady", imageCapture: "imageCapture", initError: "initError" }, host: { listeners: { "window:resize": "onResize($event)" } }, viewQueries: [{ propertyName: "canvas", first: true, predicate: ["canvas"], descendants: true, static: true }, { propertyName: "videoRef", first: true, predicate: ["video"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"webcam-wrapper\">\n <video #video autoplay muted style=\"display: block\" playsinline></video>\n\n <div class=\"rectangle\">\n <canvas\n #canvas\n [ngStyle]=\"{ visibility: showVideo ? 'visible' : 'hidden' }\"\n [width]=\"video.offsetWidth\"\n [height]=\"video.offsetHeight\"\n ></canvas>\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:row;flex:1;transform:transale3d(0,0,0);background-color:#000;overflow:hidden}.webcam-wrapper{display:flex;overflow:hidden;flex-direction:row;flex:1;position:relative}.webcam-wrapper video{overflow:hidden;flex:1;object-fit:contain}.webcam-wrapper canvas{transform:translateZ(0);display:block;position:absolute;z-index:20;left:0;top:0}.webcam-wrapper .rectangle{position:absolute;left:0;top:0;display:flex;flex-direction:row;align-items:center;justify-content:center;width:100%;height:100%}\n"], dependencies: [{ kind: "directive", type: i2$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
706
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: WebcamComponent, decorators: [{
|
|
707
|
-
type: Component,
|
|
708
|
-
args: [{ selector: 'ngx-scandoc-webcam', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"webcam-wrapper\">\n <video #video autoplay muted style=\"display: block\" playsinline></video>\n\n <div class=\"rectangle\">\n <canvas\n #canvas\n [ngStyle]=\"{ visibility: showVideo ? 'visible' : 'hidden' }\"\n [width]=\"video.offsetWidth\"\n [height]=\"video.offsetHeight\"\n ></canvas>\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:row;flex:1;transform:transale3d(0,0,0);background-color:#000;overflow:hidden}.webcam-wrapper{display:flex;overflow:hidden;flex-direction:row;flex:1;position:relative}.webcam-wrapper video{overflow:hidden;flex:1;object-fit:contain}.webcam-wrapper canvas{transform:translateZ(0);display:block;position:absolute;z-index:20;left:0;top:0}.webcam-wrapper .rectangle{position:absolute;left:0;top:0;display:flex;flex-direction:row;align-items:center;justify-content:center;width:100%;height:100%}\n"] }]
|
|
709
|
-
}], ctorParameters: function () { return [{ type: i1.BreakpointObserver }, { type: i2.Platform }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: NgxScandocCameraProvider }]; }, propDecorators: { imageHandler: [{
|
|
710
|
-
type: Input
|
|
711
|
-
}], type: [{
|
|
712
|
-
type: Input
|
|
713
|
-
}], trigger: [{
|
|
714
|
-
type: Input
|
|
715
|
-
}], onResize: [{
|
|
716
|
-
type: HostListener,
|
|
717
|
-
args: ['window:resize', ['$event']]
|
|
718
|
-
}], canvas: [{
|
|
719
|
-
type: ViewChild,
|
|
720
|
-
args: ['canvas', { static: true }]
|
|
721
|
-
}], videoRef: [{
|
|
722
|
-
type: ViewChild,
|
|
723
|
-
args: ['video', { static: true }]
|
|
724
|
-
}], cameraSwitched: [{
|
|
725
|
-
type: Output
|
|
726
|
-
}], videoReady: [{
|
|
727
|
-
type: Output
|
|
728
|
-
}], imageCapture: [{
|
|
729
|
-
type: Output
|
|
730
|
-
}], initError: [{
|
|
731
|
-
type: Output
|
|
732
|
-
}] } });
|
|
733
|
-
|
|
734
|
-
const COMPONENTS = [
|
|
735
|
-
WebcamComponent
|
|
736
|
-
];
|
|
737
|
-
class WebcamModule {
|
|
738
|
-
static forRoot() {
|
|
739
|
-
return {
|
|
740
|
-
ngModule: WebcamModule,
|
|
741
|
-
providers: [],
|
|
742
|
-
};
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
WebcamModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: WebcamModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
746
|
-
WebcamModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: WebcamModule, declarations: [WebcamComponent], imports: [CommonModule, PlatformModule], exports: [WebcamComponent] });
|
|
747
|
-
WebcamModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: WebcamModule, imports: [CommonModule, PlatformModule] });
|
|
748
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: WebcamModule, decorators: [{
|
|
749
|
-
type: NgModule,
|
|
750
|
-
args: [{
|
|
751
|
-
imports: [CommonModule, PlatformModule],
|
|
752
|
-
declarations: [COMPONENTS],
|
|
753
|
-
exports: [COMPONENTS],
|
|
754
|
-
providers: [],
|
|
755
|
-
}]
|
|
756
|
-
}] });
|
|
757
|
-
|
|
758
|
-
const AUTH_CONFIG_TOKEN = new InjectionToken('configAuth');
|
|
759
|
-
const SCAN_CONFIG_TOKEN = new InjectionToken('scanConfig');
|
|
760
|
-
|
|
761
|
-
class ScanProvider {
|
|
762
|
-
constructor(http, injector) {
|
|
763
|
-
this.http = http;
|
|
764
|
-
this.injector = injector;
|
|
765
|
-
// enableVerification = true;
|
|
766
|
-
this.config = this.injector.get(SCAN_CONFIG_TOKEN);
|
|
767
|
-
this.canStoreImages = this.config.canStoreImages;
|
|
768
|
-
}
|
|
769
|
-
genderList() {
|
|
770
|
-
return {
|
|
771
|
-
M: 'MALE',
|
|
772
|
-
'M/M': 'MALE',
|
|
773
|
-
F: 'FEMALE',
|
|
774
|
-
'F/F': 'FEMALE',
|
|
775
|
-
};
|
|
776
|
-
}
|
|
777
|
-
get enableVerification() {
|
|
778
|
-
return this.config.enableVerification;
|
|
779
|
-
}
|
|
780
|
-
addGuest(guestData) {
|
|
781
|
-
const data = {
|
|
782
|
-
AcceptTermsAndConditions: true,
|
|
783
|
-
DataFields: Object.assign({ GuestImageType: 'base64' }, guestData),
|
|
784
|
-
Settings: {},
|
|
785
|
-
};
|
|
786
|
-
const $request = this.http.put(this.config.guestAddPath, data);
|
|
787
|
-
return $request;
|
|
788
|
-
}
|
|
789
|
-
stateless(DocumentFaceImage, LiveFaceImage) {
|
|
790
|
-
const data = {
|
|
791
|
-
AcceptTermsAndConditions: true,
|
|
792
|
-
DataFields: {
|
|
793
|
-
DocumentFaceImageType: 'base64',
|
|
794
|
-
DocumentFaceImage,
|
|
795
|
-
LiveFaceImageType: 'base64',
|
|
796
|
-
LiveFaceImage,
|
|
797
|
-
},
|
|
798
|
-
};
|
|
799
|
-
const $request = this.http.post(this.config.stateLessPath, data);
|
|
800
|
-
return $request;
|
|
801
|
-
}
|
|
802
|
-
sendErrorLog(data) {
|
|
803
|
-
return this.http.post(this.config.errorLoggingPath, data);
|
|
804
|
-
}
|
|
805
|
-
/**
|
|
806
|
-
*
|
|
807
|
-
* @param data
|
|
808
|
-
* @returns
|
|
809
|
-
* @deprecated
|
|
810
|
-
*/
|
|
811
|
-
sendLog(data) {
|
|
812
|
-
const { TransactionID } = data.Response;
|
|
813
|
-
const $request = this.http.post(this.config.errorLoggingPath, data, {
|
|
814
|
-
headers: new HttpHeaders({
|
|
815
|
-
TransactionID,
|
|
816
|
-
}),
|
|
817
|
-
});
|
|
818
|
-
return $request;
|
|
819
|
-
}
|
|
820
|
-
burst(Images, BlurValues) {
|
|
821
|
-
const data = {
|
|
822
|
-
AcceptTermsAndConditions: true,
|
|
823
|
-
DataFields: {
|
|
824
|
-
Images,
|
|
825
|
-
BlurValues,
|
|
826
|
-
},
|
|
827
|
-
};
|
|
828
|
-
const $request = this.http.post(this.config.validationPath, data);
|
|
829
|
-
return $request;
|
|
830
|
-
}
|
|
831
|
-
countries() {
|
|
832
|
-
if (this.countryNames) {
|
|
833
|
-
return of(this.countryNames);
|
|
834
|
-
}
|
|
835
|
-
return this.http.get('/assets/data/countries2.json').pipe(map((data) => {
|
|
836
|
-
this.countriesData = data.data;
|
|
837
|
-
return this.countriesData;
|
|
838
|
-
}));
|
|
839
|
-
}
|
|
840
|
-
get countryNames() {
|
|
841
|
-
return [
|
|
842
|
-
{ label: 'Aruba', value: 'AW' },
|
|
843
|
-
{ label: 'Afghanistan', value: 'AF' },
|
|
844
|
-
{ label: 'Angola', value: 'AO' },
|
|
845
|
-
{ label: 'Anguilla', value: 'AI' },
|
|
846
|
-
{ label: 'Åland Islands', value: 'AX' },
|
|
847
|
-
{ label: 'Albania', value: 'AL' },
|
|
848
|
-
{ label: 'Andorra', value: 'AD' },
|
|
849
|
-
{ label: 'United Arab Emirates', value: 'AE' },
|
|
850
|
-
{ label: 'Argentina', value: 'AR' },
|
|
851
|
-
{ label: 'Armenia', value: 'AM' },
|
|
852
|
-
{ label: 'American Samoa', value: 'AS' },
|
|
853
|
-
{ label: 'Antarctica', value: 'AQ' },
|
|
854
|
-
{ label: 'French Southern and Antarctic Lands', value: 'TF' },
|
|
855
|
-
{ label: 'Antigua and Barbuda', value: 'AG' },
|
|
856
|
-
{ label: 'Australia', value: 'AU' },
|
|
857
|
-
{ label: 'Austria', value: 'AT' },
|
|
858
|
-
{ label: 'Azerbaijan', value: 'AZ' },
|
|
859
|
-
{ label: 'Burundi', value: 'BI' },
|
|
860
|
-
{ label: 'Belgium', value: 'BE' },
|
|
861
|
-
{ label: 'Benin', value: 'BJ' },
|
|
862
|
-
{ label: 'Burkina Faso', value: 'BF' },
|
|
863
|
-
{ label: 'Bangladesh', value: 'BD' },
|
|
864
|
-
{ label: 'Bulgaria', value: 'BG' },
|
|
865
|
-
{ label: 'Bahrain', value: 'BH' },
|
|
866
|
-
{ label: 'Bahamas', value: 'BS' },
|
|
867
|
-
{ label: 'Bosnia and Herzegovina', value: 'BA' },
|
|
868
|
-
{ label: 'Saint Barthélemy', value: 'BL' },
|
|
869
|
-
{ label: 'Saint Helena, Ascension and Tristan da Cunha', value: 'SH' },
|
|
870
|
-
{ label: 'Belarus', value: 'BY' },
|
|
871
|
-
{ label: 'Belize', value: 'BZ' },
|
|
872
|
-
{ label: 'Bermuda', value: 'BM' },
|
|
873
|
-
{ label: 'Bolivia', value: 'BO' },
|
|
874
|
-
{ label: 'Caribbean Netherlands', value: 'BQ' },
|
|
875
|
-
{ label: 'Brazil', value: 'BR' },
|
|
876
|
-
{ label: 'Barbados', value: 'BB' },
|
|
877
|
-
{ label: 'Brunei', value: 'BN' },
|
|
878
|
-
{ label: 'Bhutan', value: 'BT' },
|
|
879
|
-
{ label: 'Bouvet Island', value: 'BV' },
|
|
880
|
-
{ label: 'Botswana', value: 'BW' },
|
|
881
|
-
{ label: 'Central African Republic', value: 'CF' },
|
|
882
|
-
{ label: 'Canada', value: 'CA' },
|
|
883
|
-
{ label: 'Cocos (Keeling) Islands', value: 'CC' },
|
|
884
|
-
{ label: 'Switzerland', value: 'CH' },
|
|
885
|
-
{ label: 'Chile', value: 'CL' },
|
|
886
|
-
{ label: 'China', value: 'CN' },
|
|
887
|
-
{ label: 'Ivory Coast', value: 'CI' },
|
|
888
|
-
{ label: 'Cameroon', value: 'CM' },
|
|
889
|
-
{ label: 'DR Congo', value: 'CD' },
|
|
890
|
-
{ label: 'Republic of the Congo', value: 'CG' },
|
|
891
|
-
{ label: 'Cook Islands', value: 'CK' },
|
|
892
|
-
{ label: 'Colombia', value: 'CO' },
|
|
893
|
-
{ label: 'Comoros', value: 'KM' },
|
|
894
|
-
{ label: 'Cape Verde', value: 'CV' },
|
|
895
|
-
{ label: 'Costa Rica', value: 'CR' },
|
|
896
|
-
{ label: 'Cuba', value: 'CU' },
|
|
897
|
-
{ label: 'Curaçao', value: 'CW' },
|
|
898
|
-
{ label: 'Christmas Island', value: 'CX' },
|
|
899
|
-
{ label: 'Cayman Islands', value: 'KY' },
|
|
900
|
-
{ label: 'Cyprus', value: 'CY' },
|
|
901
|
-
{ label: 'Czechia', value: 'CZ' },
|
|
902
|
-
{ label: 'Germany', value: 'DE' },
|
|
903
|
-
{ label: 'Djibouti', value: 'DJ' },
|
|
904
|
-
{ label: 'Dominica', value: 'DM' },
|
|
905
|
-
{ label: 'Denmark', value: 'DK' },
|
|
906
|
-
{ label: 'Dominican Republic', value: 'DO' },
|
|
907
|
-
{ label: 'Algeria', value: 'DZ' },
|
|
908
|
-
{ label: 'Ecuador', value: 'EC' },
|
|
909
|
-
{ label: 'Egypt', value: 'EG' },
|
|
910
|
-
{ label: 'Eritrea', value: 'ER' },
|
|
911
|
-
{ label: 'Western Sahara', value: 'EH' },
|
|
912
|
-
{ label: 'Spain', value: 'ES' },
|
|
913
|
-
{ label: 'Estonia', value: 'EE' },
|
|
914
|
-
{ label: 'Ethiopia', value: 'ET' },
|
|
915
|
-
{ label: 'Finland', value: 'FI' },
|
|
916
|
-
{ label: 'Fiji', value: 'FJ' },
|
|
917
|
-
{ label: 'Falkland Islands', value: 'FK' },
|
|
918
|
-
{ label: 'France', value: 'FR' },
|
|
919
|
-
{ label: 'Faroe Islands', value: 'FO' },
|
|
920
|
-
{ label: 'Micronesia', value: 'FM' },
|
|
921
|
-
{ label: 'Gabon', value: 'GA' },
|
|
922
|
-
{ label: 'United Kingdom', value: 'GB' },
|
|
923
|
-
{ label: 'Georgia', value: 'GE' },
|
|
924
|
-
{ label: 'Guernsey', value: 'GG' },
|
|
925
|
-
{ label: 'Ghana', value: 'GH' },
|
|
926
|
-
{ label: 'Gibraltar', value: 'GI' },
|
|
927
|
-
{ label: 'Guinea', value: 'GN' },
|
|
928
|
-
{ label: 'Guadeloupe', value: 'GP' },
|
|
929
|
-
{ label: 'Gambia', value: 'GM' },
|
|
930
|
-
{ label: 'Guinea-Bissau', value: 'GW' },
|
|
931
|
-
{ label: 'Equatorial Guinea', value: 'GQ' },
|
|
932
|
-
{ label: 'Greece', value: 'GR' },
|
|
933
|
-
{ label: 'Grenada', value: 'GD' },
|
|
934
|
-
{ label: 'Greenland', value: 'GL' },
|
|
935
|
-
{ label: 'Guatemala', value: 'GT' },
|
|
936
|
-
{ label: 'French Guiana', value: 'GF' },
|
|
937
|
-
{ label: 'Guam', value: 'GU' },
|
|
938
|
-
{ label: 'Guyana', value: 'GY' },
|
|
939
|
-
{ label: 'Hong Kong', value: 'HK' },
|
|
940
|
-
{ label: 'Heard Island and McDonald Islands', value: 'HM' },
|
|
941
|
-
{ label: 'Honduras', value: 'HN' },
|
|
942
|
-
{ label: 'Croatia', value: 'HR' },
|
|
943
|
-
{ label: 'Haiti', value: 'HT' },
|
|
944
|
-
{ label: 'Hungary', value: 'HU' },
|
|
945
|
-
{ label: 'Indonesia', value: 'ID' },
|
|
946
|
-
{ label: 'Isle of Man', value: 'IM' },
|
|
947
|
-
{ label: 'India', value: 'IN' },
|
|
948
|
-
{ label: 'British Indian Ocean Territory', value: 'IO' },
|
|
949
|
-
{ label: 'Ireland', value: 'IE' },
|
|
950
|
-
{ label: 'Iran', value: 'IR' },
|
|
951
|
-
{ label: 'Iraq', value: 'IQ' },
|
|
952
|
-
{ label: 'Iceland', value: 'IS' },
|
|
953
|
-
{ label: 'Israel', value: 'IL' },
|
|
954
|
-
{ label: 'Italy', value: 'IT' },
|
|
955
|
-
{ label: 'Jamaica', value: 'JM' },
|
|
956
|
-
{ label: 'Jersey', value: 'JE' },
|
|
957
|
-
{ label: 'Jordan', value: 'JO' },
|
|
958
|
-
{ label: 'Japan', value: 'JP' },
|
|
959
|
-
{ label: 'Kazakhstan', value: 'KZ' },
|
|
960
|
-
{ label: 'Kenya', value: 'KE' },
|
|
961
|
-
{ label: 'Kyrgyzstan', value: 'KG' },
|
|
962
|
-
{ label: 'Cambodia', value: 'KH' },
|
|
963
|
-
{ label: 'Kiribati', value: 'KI' },
|
|
964
|
-
{ label: 'Saint Kitts and Nevis', value: 'KN' },
|
|
965
|
-
{ label: 'South Korea', value: 'KR' },
|
|
966
|
-
{ label: 'Kuwait', value: 'KW' },
|
|
967
|
-
{ label: 'Laos', value: 'LA' },
|
|
968
|
-
{ label: 'Lebanon', value: 'LB' },
|
|
969
|
-
{ label: 'Liberia', value: 'LR' },
|
|
970
|
-
{ label: 'Libya', value: 'LY' },
|
|
971
|
-
{ label: 'Saint Lucia', value: 'LC' },
|
|
972
|
-
{ label: 'Liechtenstein', value: 'LI' },
|
|
973
|
-
{ label: 'Sri Lanka', value: 'LK' },
|
|
974
|
-
{ label: 'Lesotho', value: 'LS' },
|
|
975
|
-
{ label: 'Lithuania', value: 'LT' },
|
|
976
|
-
{ label: 'Luxembourg', value: 'LU' },
|
|
977
|
-
{ label: 'Latvia', value: 'LV' },
|
|
978
|
-
{ label: 'Macau', value: 'MO' },
|
|
979
|
-
{ label: 'Saint Martin', value: 'MF' },
|
|
980
|
-
{ label: 'Morocco', value: 'MA' },
|
|
981
|
-
{ label: 'Monaco', value: 'MC' },
|
|
982
|
-
{ label: 'Moldova', value: 'MD' },
|
|
983
|
-
{ label: 'Madagascar', value: 'MG' },
|
|
984
|
-
{ label: 'Maldives', value: 'MV' },
|
|
985
|
-
{ label: 'Mexico', value: 'MX' },
|
|
986
|
-
{ label: 'Marshall Islands', value: 'MH' },
|
|
987
|
-
{ label: 'Macedonia', value: 'MK' },
|
|
988
|
-
{ label: 'Mali', value: 'ML' },
|
|
989
|
-
{ label: 'Malta', value: 'MT' },
|
|
990
|
-
{ label: 'Myanmar', value: 'MM' },
|
|
991
|
-
{ label: 'Montenegro', value: 'ME' },
|
|
992
|
-
{ label: 'Mongolia', value: 'MN' },
|
|
993
|
-
{ label: 'Northern Mariana Islands', value: 'MP' },
|
|
994
|
-
{ label: 'Mozambique', value: 'MZ' },
|
|
995
|
-
{ label: 'Mauritania', value: 'MR' },
|
|
996
|
-
{ label: 'Montserrat', value: 'MS' },
|
|
997
|
-
{ label: 'Martinique', value: 'MQ' },
|
|
998
|
-
{ label: 'Mauritius', value: 'MU' },
|
|
999
|
-
{ label: 'Malawi', value: 'MW' },
|
|
1000
|
-
{ label: 'Malaysia', value: 'MY' },
|
|
1001
|
-
{ label: 'Mayotte', value: 'YT' },
|
|
1002
|
-
{ label: 'Namibia', value: 'NA' },
|
|
1003
|
-
{ label: 'New Caledonia', value: 'NC' },
|
|
1004
|
-
{ label: 'Niger', value: 'NE' },
|
|
1005
|
-
{ label: 'Norfolk Island', value: 'NF' },
|
|
1006
|
-
{ label: 'Nigeria', value: 'NG' },
|
|
1007
|
-
{ label: 'Nicaragua', value: 'NI' },
|
|
1008
|
-
{ label: 'Niue', value: 'NU' },
|
|
1009
|
-
{ label: 'Netherlands', value: 'NL' },
|
|
1010
|
-
{ label: 'Norway', value: 'NO' },
|
|
1011
|
-
{ label: 'Nepal', value: 'NP' },
|
|
1012
|
-
{ label: 'Nauru', value: 'NR' },
|
|
1013
|
-
{ label: 'New Zealand', value: 'NZ' },
|
|
1014
|
-
{ label: 'Oman', value: 'OM' },
|
|
1015
|
-
{ label: 'Pakistan', value: 'PK' },
|
|
1016
|
-
{ label: 'Panama', value: 'PA' },
|
|
1017
|
-
{ label: 'Pitcairn Islands', value: 'PN' },
|
|
1018
|
-
{ label: 'Peru', value: 'PE' },
|
|
1019
|
-
{ label: 'Philippines', value: 'PH' },
|
|
1020
|
-
{ label: 'Palau', value: 'PW' },
|
|
1021
|
-
{ label: 'Papua New Guinea', value: 'PG' },
|
|
1022
|
-
{ label: 'Poland', value: 'PL' },
|
|
1023
|
-
{ label: 'Puerto Rico', value: 'PR' },
|
|
1024
|
-
{ label: 'North Korea', value: 'KP' },
|
|
1025
|
-
{ label: 'Portugal', value: 'PT' },
|
|
1026
|
-
{ label: 'Paraguay', value: 'PY' },
|
|
1027
|
-
{ label: 'Palestine', value: 'PS' },
|
|
1028
|
-
{ label: 'French Polynesia', value: 'PF' },
|
|
1029
|
-
{ label: 'Qatar', value: 'QA' },
|
|
1030
|
-
{ label: 'Réunion', value: 'RE' },
|
|
1031
|
-
{ label: 'Romania', value: 'RO' },
|
|
1032
|
-
{ label: 'Russia', value: 'RU' },
|
|
1033
|
-
{ label: 'Rwanda', value: 'RW' },
|
|
1034
|
-
{ label: 'Saudi Arabia', value: 'SA' },
|
|
1035
|
-
{ label: 'Sudan', value: 'SD' },
|
|
1036
|
-
{ label: 'Senegal', value: 'SN' },
|
|
1037
|
-
{ label: 'Singapore', value: 'SG' },
|
|
1038
|
-
{ label: 'South Georgia', value: 'GS' },
|
|
1039
|
-
{ label: 'Svalbard and Jan Mayen', value: 'SJ' },
|
|
1040
|
-
{ label: 'Solomon Islands', value: 'SB' },
|
|
1041
|
-
{ label: 'Sierra Leone', value: 'SL' },
|
|
1042
|
-
{ label: 'El Salvador', value: 'SV' },
|
|
1043
|
-
{ label: 'San Marino', value: 'SM' },
|
|
1044
|
-
{ label: 'Somalia', value: 'SO' },
|
|
1045
|
-
{ label: 'Saint Pierre and Miquelon', value: 'PM' },
|
|
1046
|
-
{ label: 'Serbia', value: 'RS' },
|
|
1047
|
-
{ label: 'South Sudan', value: 'SS' },
|
|
1048
|
-
{ label: 'São Tomé and Príncipe', value: 'ST' },
|
|
1049
|
-
{ label: 'Suriname', value: 'SR' },
|
|
1050
|
-
{ label: 'Slovakia', value: 'SK' },
|
|
1051
|
-
{ label: 'Slovenia', value: 'SI' },
|
|
1052
|
-
{ label: 'Sweden', value: 'SE' },
|
|
1053
|
-
{ label: 'Swaziland', value: 'SZ' },
|
|
1054
|
-
{ label: 'Seychelles', value: 'SC' },
|
|
1055
|
-
{ label: 'Syria', value: 'SY' },
|
|
1056
|
-
{ label: 'Turks and Caicos Islands', value: 'TC' },
|
|
1057
|
-
{ label: 'Chad', value: 'TD' },
|
|
1058
|
-
{ label: 'Togo', value: 'TG' },
|
|
1059
|
-
{ label: 'Thailand', value: 'TH' },
|
|
1060
|
-
{ label: 'Tajikistan', value: 'TJ' },
|
|
1061
|
-
{ label: 'Tokelau', value: 'TK' },
|
|
1062
|
-
{ label: 'Turkmenistan', value: 'TM' },
|
|
1063
|
-
{ label: 'Timor-Leste', value: 'TL' },
|
|
1064
|
-
{ label: 'Tonga', value: 'TO' },
|
|
1065
|
-
{ label: 'Trinidad and Tobago', value: 'TT' },
|
|
1066
|
-
{ label: 'Tunisia', value: 'TN' },
|
|
1067
|
-
{ label: 'Turkey', value: 'TR' },
|
|
1068
|
-
{ label: 'Tuvalu', value: 'TV' },
|
|
1069
|
-
{ label: 'Taiwan', value: 'TW' },
|
|
1070
|
-
{ label: 'Tanzania', value: 'TZ' },
|
|
1071
|
-
{ label: 'Uganda', value: 'UG' },
|
|
1072
|
-
{ label: 'Ukraine', value: 'UA' },
|
|
1073
|
-
{ label: 'United States Minor Outlying Islands', value: 'UM' },
|
|
1074
|
-
{ label: 'Uruguay', value: 'UY' },
|
|
1075
|
-
{ label: 'United States', value: 'US' },
|
|
1076
|
-
{ label: 'Uzbekistan', value: 'UZ' },
|
|
1077
|
-
{ label: 'Vatican City', value: 'VA' },
|
|
1078
|
-
{ label: 'Saint Vincent and the Grenadines', value: 'VC' },
|
|
1079
|
-
{ label: 'Venezuela', value: 'VE' },
|
|
1080
|
-
{ label: 'British Virgin Islands', value: 'VG' },
|
|
1081
|
-
{ label: 'United States Virgin Islands', value: 'VI' },
|
|
1082
|
-
{ label: 'Vietnam', value: 'VN' },
|
|
1083
|
-
{ label: 'Vanuatu', value: 'VU' },
|
|
1084
|
-
{ label: 'Wallis and Futuna', value: 'WF' },
|
|
1085
|
-
{ label: 'Samoa', value: 'WS' },
|
|
1086
|
-
{ label: 'Yemen', value: 'YE' },
|
|
1087
|
-
{ label: 'South Africa', value: 'ZA' },
|
|
1088
|
-
{ label: 'Zambia', value: 'ZM' },
|
|
1089
|
-
{ label: 'Zimbabwe', value: 'ZW' },
|
|
1090
|
-
];
|
|
1091
|
-
}
|
|
1092
|
-
countryList() {
|
|
1093
|
-
return {
|
|
1094
|
-
AFG: 'AF',
|
|
1095
|
-
ALB: 'AL',
|
|
1096
|
-
DZA: 'DZ',
|
|
1097
|
-
ASM: 'AS',
|
|
1098
|
-
AND: 'AD',
|
|
1099
|
-
AGO: 'AO',
|
|
1100
|
-
AIA: 'AI',
|
|
1101
|
-
ATG: 'AG',
|
|
1102
|
-
ARG: 'AR',
|
|
1103
|
-
ARM: 'AM',
|
|
1104
|
-
ABW: 'AW',
|
|
1105
|
-
AUS: 'AU',
|
|
1106
|
-
AUT: 'AT',
|
|
1107
|
-
AZE: 'AZ',
|
|
1108
|
-
BHS: 'BS',
|
|
1109
|
-
BHR: 'BH',
|
|
1110
|
-
BGD: 'BD',
|
|
1111
|
-
BRB: 'BB',
|
|
1112
|
-
BLR: 'BY',
|
|
1113
|
-
BEL: 'BE',
|
|
1114
|
-
BLZ: 'BZ',
|
|
1115
|
-
BEN: 'BJ',
|
|
1116
|
-
BMU: 'BM',
|
|
1117
|
-
BTN: 'BT',
|
|
1118
|
-
BOL: 'BO',
|
|
1119
|
-
BIH: 'BA',
|
|
1120
|
-
BWA: 'BW',
|
|
1121
|
-
BRA: 'BR',
|
|
1122
|
-
VGB: 'VG',
|
|
1123
|
-
BRN: 'BN',
|
|
1124
|
-
BGR: 'BG',
|
|
1125
|
-
BFA: 'BF',
|
|
1126
|
-
BDI: 'BI',
|
|
1127
|
-
KHM: 'KH',
|
|
1128
|
-
CMR: 'CM',
|
|
1129
|
-
CAN: 'CA',
|
|
1130
|
-
CPV: 'CV',
|
|
1131
|
-
CAF: 'CF',
|
|
1132
|
-
TCD: 'TD',
|
|
1133
|
-
CHL: 'CL',
|
|
1134
|
-
CHN: 'CN',
|
|
1135
|
-
HKG: 'HK',
|
|
1136
|
-
MAC: 'MO',
|
|
1137
|
-
COL: 'CO',
|
|
1138
|
-
COM: 'KM',
|
|
1139
|
-
COG: 'CG',
|
|
1140
|
-
CRI: 'CR',
|
|
1141
|
-
CIV: 'CI',
|
|
1142
|
-
HRV: 'HR',
|
|
1143
|
-
CUB: 'CU',
|
|
1144
|
-
CYP: 'CY',
|
|
1145
|
-
CZE: 'CZ',
|
|
1146
|
-
DNK: 'DK',
|
|
1147
|
-
DJI: 'DJ',
|
|
1148
|
-
DMA: 'DM',
|
|
1149
|
-
DOM: 'DO',
|
|
1150
|
-
ECU: 'EC',
|
|
1151
|
-
EGY: 'EG',
|
|
1152
|
-
SLV: 'SV',
|
|
1153
|
-
GNQ: 'GQ',
|
|
1154
|
-
ERI: 'ER',
|
|
1155
|
-
EST: 'EE',
|
|
1156
|
-
ETH: 'ET',
|
|
1157
|
-
FRO: 'FO',
|
|
1158
|
-
FJI: 'FJ',
|
|
1159
|
-
FIN: 'FI',
|
|
1160
|
-
FRA: 'FR',
|
|
1161
|
-
GUF: 'GF',
|
|
1162
|
-
PYF: 'PF',
|
|
1163
|
-
GAB: 'GA',
|
|
1164
|
-
GMB: 'GM',
|
|
1165
|
-
GEO: 'GE',
|
|
1166
|
-
DEU: 'DE',
|
|
1167
|
-
GHA: 'GH',
|
|
1168
|
-
GRC: 'GR',
|
|
1169
|
-
GRL: 'GL',
|
|
1170
|
-
GRD: 'GD',
|
|
1171
|
-
GLP: 'GP',
|
|
1172
|
-
GUM: 'GU',
|
|
1173
|
-
GTM: 'GT',
|
|
1174
|
-
GNB: 'GW',
|
|
1175
|
-
HTI: 'HT',
|
|
1176
|
-
HND: 'HN',
|
|
1177
|
-
ISL: 'IS',
|
|
1178
|
-
IDN: 'ID',
|
|
1179
|
-
IRQ: 'IQ',
|
|
1180
|
-
ITA: 'IT',
|
|
1181
|
-
JPN: 'JP',
|
|
1182
|
-
JOR: 'JO',
|
|
1183
|
-
KAZ: 'KZ',
|
|
1184
|
-
KEN: 'KE',
|
|
1185
|
-
KIR: 'KI',
|
|
1186
|
-
PRK: 'KP',
|
|
1187
|
-
KOR: 'KR',
|
|
1188
|
-
KWT: 'KW',
|
|
1189
|
-
KGZ: 'KG',
|
|
1190
|
-
LAO: 'LA',
|
|
1191
|
-
LVA: 'LV',
|
|
1192
|
-
LBN: 'LB',
|
|
1193
|
-
LSO: 'LS',
|
|
1194
|
-
LBR: 'LR',
|
|
1195
|
-
LBY: 'LY',
|
|
1196
|
-
LIE: 'LI',
|
|
1197
|
-
LTU: 'LT',
|
|
1198
|
-
LUX: 'LU',
|
|
1199
|
-
MDG: 'MG',
|
|
1200
|
-
MWI: 'MW',
|
|
1201
|
-
MYS: 'MY',
|
|
1202
|
-
MDV: 'MV',
|
|
1203
|
-
MLI: 'ML',
|
|
1204
|
-
MLT: 'MT',
|
|
1205
|
-
MHL: 'MH',
|
|
1206
|
-
MTQ: 'MQ',
|
|
1207
|
-
MRT: 'MR',
|
|
1208
|
-
MUS: 'MU',
|
|
1209
|
-
MEX: 'MX',
|
|
1210
|
-
FSM: 'FM',
|
|
1211
|
-
MDA: 'MD',
|
|
1212
|
-
MCO: 'MC',
|
|
1213
|
-
MNG: 'MN',
|
|
1214
|
-
MNE: 'ME',
|
|
1215
|
-
MSR: 'MS',
|
|
1216
|
-
MAR: 'MA',
|
|
1217
|
-
MOZ: 'MZ',
|
|
1218
|
-
MMR: 'MM',
|
|
1219
|
-
NAM: 'NA',
|
|
1220
|
-
NRU: 'NR',
|
|
1221
|
-
NPL: 'NP',
|
|
1222
|
-
NLD: 'NL',
|
|
1223
|
-
ANT: 'AN',
|
|
1224
|
-
NCL: 'NC',
|
|
1225
|
-
NZL: 'NZ',
|
|
1226
|
-
NIC: 'NI',
|
|
1227
|
-
NER: 'NE',
|
|
1228
|
-
NGA: 'NG',
|
|
1229
|
-
MNP: 'MP',
|
|
1230
|
-
NOR: 'NO',
|
|
1231
|
-
OMN: 'OM',
|
|
1232
|
-
PAK: 'PK',
|
|
1233
|
-
PLW: 'PW',
|
|
1234
|
-
PSE: 'PS',
|
|
1235
|
-
PAN: 'PA',
|
|
1236
|
-
PNG: 'PG',
|
|
1237
|
-
PRY: 'PY',
|
|
1238
|
-
PER: 'PE',
|
|
1239
|
-
PHL: 'PH',
|
|
1240
|
-
PCN: 'PN',
|
|
1241
|
-
POL: 'PL',
|
|
1242
|
-
PRT: 'PT',
|
|
1243
|
-
PRI: 'PR',
|
|
1244
|
-
QAT: 'QA',
|
|
1245
|
-
REU: 'RE',
|
|
1246
|
-
ROU: 'RO',
|
|
1247
|
-
RUS: 'RU',
|
|
1248
|
-
RWA: 'RW',
|
|
1249
|
-
KNA: 'KN',
|
|
1250
|
-
LCA: 'LC',
|
|
1251
|
-
VCT: 'VC',
|
|
1252
|
-
WSM: 'WS',
|
|
1253
|
-
SMR: 'SM',
|
|
1254
|
-
STP: 'ST',
|
|
1255
|
-
SAU: 'SA',
|
|
1256
|
-
SEN: 'SN',
|
|
1257
|
-
SRB: 'RS',
|
|
1258
|
-
SYC: 'SC',
|
|
1259
|
-
SLE: 'SL',
|
|
1260
|
-
SGP: 'SG',
|
|
1261
|
-
SVK: 'SK',
|
|
1262
|
-
SVN: 'SI',
|
|
1263
|
-
SLB: 'SB',
|
|
1264
|
-
SOM: 'SO',
|
|
1265
|
-
ZAF: 'ZA',
|
|
1266
|
-
ESP: 'ES',
|
|
1267
|
-
LKA: 'LK',
|
|
1268
|
-
SDN: 'SD',
|
|
1269
|
-
SUR: 'SR',
|
|
1270
|
-
SWZ: 'SZ',
|
|
1271
|
-
SWE: 'SE',
|
|
1272
|
-
CHE: 'CH',
|
|
1273
|
-
SYR: 'SY',
|
|
1274
|
-
TJK: 'TJ',
|
|
1275
|
-
TZA: 'TZ',
|
|
1276
|
-
THA: 'TH',
|
|
1277
|
-
TLS: 'TL',
|
|
1278
|
-
TGO: 'TG',
|
|
1279
|
-
TON: 'TO',
|
|
1280
|
-
TTO: 'TT',
|
|
1281
|
-
TUN: 'TN',
|
|
1282
|
-
TUR: 'TR',
|
|
1283
|
-
TKM: 'TM',
|
|
1284
|
-
TUV: 'TV',
|
|
1285
|
-
UGA: 'UG',
|
|
1286
|
-
UKR: 'UA',
|
|
1287
|
-
ARE: 'AE',
|
|
1288
|
-
GBR: 'GB',
|
|
1289
|
-
USA: 'US',
|
|
1290
|
-
URY: 'UY',
|
|
1291
|
-
UZB: 'UZ',
|
|
1292
|
-
VUT: 'VU',
|
|
1293
|
-
VEN: 'VE',
|
|
1294
|
-
VNM: 'VN',
|
|
1295
|
-
VIR: 'VI',
|
|
1296
|
-
YEM: 'YE',
|
|
1297
|
-
ZMB: 'ZM',
|
|
1298
|
-
ZWE: 'ZW',
|
|
1299
|
-
};
|
|
1300
|
-
}
|
|
1301
|
-
get fields() {
|
|
1302
|
-
return [
|
|
1303
|
-
{
|
|
1304
|
-
key: 'Birth Date',
|
|
1305
|
-
form: 'birthDate',
|
|
1306
|
-
type: 'date',
|
|
1307
|
-
main: false,
|
|
1308
|
-
blastKey: 'BirthDate',
|
|
1309
|
-
},
|
|
1310
|
-
{
|
|
1311
|
-
key: 'Given Name',
|
|
1312
|
-
form: 'firstName',
|
|
1313
|
-
ucFirst: true,
|
|
1314
|
-
type: 'string',
|
|
1315
|
-
main: true,
|
|
1316
|
-
blastKey: 'Name',
|
|
1317
|
-
},
|
|
1318
|
-
{
|
|
1319
|
-
key: 'Surname',
|
|
1320
|
-
form: 'lastName',
|
|
1321
|
-
ucFirst: true,
|
|
1322
|
-
type: 'string',
|
|
1323
|
-
main: true,
|
|
1324
|
-
blastKey: 'Surname',
|
|
1325
|
-
},
|
|
1326
|
-
{
|
|
1327
|
-
key: 'Sex',
|
|
1328
|
-
form: 'gender',
|
|
1329
|
-
type: 'gender',
|
|
1330
|
-
main: false,
|
|
1331
|
-
blastKey: 'Gender',
|
|
1332
|
-
},
|
|
1333
|
-
{
|
|
1334
|
-
key: 'Document Class Name',
|
|
1335
|
-
type: 'string',
|
|
1336
|
-
form: 'documentType',
|
|
1337
|
-
main: false,
|
|
1338
|
-
blastKey: 'docType',
|
|
1339
|
-
},
|
|
1340
|
-
{
|
|
1341
|
-
key: 'Document Number',
|
|
1342
|
-
type: 'string',
|
|
1343
|
-
form: 'documentNumber',
|
|
1344
|
-
main: false,
|
|
1345
|
-
blastKey: 'DocumentNumber',
|
|
1346
|
-
},
|
|
1347
|
-
{
|
|
1348
|
-
key: 'Issuing State Code',
|
|
1349
|
-
type: 'country',
|
|
1350
|
-
form: 'issueStateCode',
|
|
1351
|
-
blastKey: 'CountryOfIssue',
|
|
1352
|
-
main: false,
|
|
1353
|
-
},
|
|
1354
|
-
{
|
|
1355
|
-
key: 'Expiration Date',
|
|
1356
|
-
type: 'date',
|
|
1357
|
-
form: 'expirationDate',
|
|
1358
|
-
blastKey: 'ExpiryDate',
|
|
1359
|
-
main: false,
|
|
1360
|
-
},
|
|
1361
|
-
{
|
|
1362
|
-
key: 'Issue Date',
|
|
1363
|
-
type: 'date',
|
|
1364
|
-
form: 'issueDate',
|
|
1365
|
-
blastKey: 'IssuedDate',
|
|
1366
|
-
main: false,
|
|
1367
|
-
},
|
|
1368
|
-
{
|
|
1369
|
-
key: 'Birth Place',
|
|
1370
|
-
type: 'string',
|
|
1371
|
-
form: 'birthPlace',
|
|
1372
|
-
blastKey: 'PlaceOfBirth',
|
|
1373
|
-
main: false,
|
|
1374
|
-
},
|
|
1375
|
-
{
|
|
1376
|
-
key: 'Issuing Authority',
|
|
1377
|
-
type: 'string',
|
|
1378
|
-
form: 'issuingPlace',
|
|
1379
|
-
blastKey: 'IssuingAuthority',
|
|
1380
|
-
main: false,
|
|
1381
|
-
},
|
|
1382
|
-
{
|
|
1383
|
-
key: 'Nationality Code',
|
|
1384
|
-
type: 'country',
|
|
1385
|
-
form: 'nationality',
|
|
1386
|
-
main: false,
|
|
1387
|
-
blastKey: 'Nationality',
|
|
1388
|
-
},
|
|
1389
|
-
{
|
|
1390
|
-
key: 'street1',
|
|
1391
|
-
type: 'string',
|
|
1392
|
-
form: 'street1',
|
|
1393
|
-
main: false,
|
|
1394
|
-
blastKey: 'AddressStreet',
|
|
1395
|
-
},
|
|
1396
|
-
{
|
|
1397
|
-
key: 'city',
|
|
1398
|
-
type: 'string',
|
|
1399
|
-
form: 'city',
|
|
1400
|
-
main: false,
|
|
1401
|
-
blastKey: 'AddressCity',
|
|
1402
|
-
},
|
|
1403
|
-
{
|
|
1404
|
-
key: 'country',
|
|
1405
|
-
type: 'country',
|
|
1406
|
-
form: 'country',
|
|
1407
|
-
main: false,
|
|
1408
|
-
blastKey: 'Country',
|
|
1409
|
-
},
|
|
1410
|
-
{
|
|
1411
|
-
key: 'zip',
|
|
1412
|
-
type: 'string',
|
|
1413
|
-
form: 'zip',
|
|
1414
|
-
main: false,
|
|
1415
|
-
blastKey: 'AddressZip',
|
|
1416
|
-
},
|
|
1417
|
-
];
|
|
1418
|
-
}
|
|
1419
|
-
parseBlast(results) {
|
|
1420
|
-
const countries = this.countryList();
|
|
1421
|
-
const genders = this.genderList();
|
|
1422
|
-
const data = this.fields;
|
|
1423
|
-
const validatedAddressFields = [
|
|
1424
|
-
'AddressCity',
|
|
1425
|
-
'AddressZip',
|
|
1426
|
-
'AddressCounty',
|
|
1427
|
-
'AddressStreet',
|
|
1428
|
-
].filter((key) => results[key].Validated);
|
|
1429
|
-
// if no address is validated
|
|
1430
|
-
if (validatedAddressFields.length === 0) {
|
|
1431
|
-
if (results.Address.Validated) {
|
|
1432
|
-
results.AddressStreet = results.Address;
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
const out = data.map((itm) => {
|
|
1436
|
-
const res = results[itm.blastKey];
|
|
1437
|
-
if (res) {
|
|
1438
|
-
const value = res.RecommendedValue || '';
|
|
1439
|
-
switch (itm.type) {
|
|
1440
|
-
case 'string':
|
|
1441
|
-
itm.value = value;
|
|
1442
|
-
if (itm.ucFirst) {
|
|
1443
|
-
const name = value.toLowerCase();
|
|
1444
|
-
itm.value = name.charAt(0).toUpperCase() + name.slice(1);
|
|
1445
|
-
}
|
|
1446
|
-
break;
|
|
1447
|
-
case 'date':
|
|
1448
|
-
itm.value = value ? moment(value, 'DD.MM.YYYY').toDate() : null;
|
|
1449
|
-
// if (value.indexOf('/Date') >= 0) {
|
|
1450
|
-
// console.log(value);
|
|
1451
|
-
// const timestamp = value.replace(/\D/gm, '');
|
|
1452
|
-
// //itm.value = moment.unix(timestamp / 1000).toDate();
|
|
1453
|
-
// itm.value = moment(
|
|
1454
|
-
// timestamp - moment(timestamp, 'x').utcOffset() * 60 * 1000,
|
|
1455
|
-
// 'x',
|
|
1456
|
-
// ).toDate();
|
|
1457
|
-
// }
|
|
1458
|
-
break;
|
|
1459
|
-
case 'country':
|
|
1460
|
-
itm.value = countries[value] || null;
|
|
1461
|
-
break;
|
|
1462
|
-
case 'gender':
|
|
1463
|
-
itm.value = genders[value] || null;
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
return itm;
|
|
1467
|
-
});
|
|
1468
|
-
const model = {};
|
|
1469
|
-
out.forEach((element) => {
|
|
1470
|
-
console.log(element);
|
|
1471
|
-
model[element.form] = element.value;
|
|
1472
|
-
});
|
|
1473
|
-
model.documentType = results.Metadata.DocumentType;
|
|
1474
|
-
console.log(model);
|
|
1475
|
-
return {
|
|
1476
|
-
fields: out,
|
|
1477
|
-
model,
|
|
1478
|
-
};
|
|
1479
|
-
}
|
|
1480
|
-
blastPost(data) {
|
|
1481
|
-
// const $request = this.api.http.get('/assets/json/blastscan.json');
|
|
1482
|
-
const $request = this.http.post(this.config.extractionPath, data);
|
|
1483
|
-
return $request.pipe(map((m) => {
|
|
1484
|
-
if (m.Metadata && m.Metadata.length > 0) {
|
|
1485
|
-
const metadata = m.Metadata[0];
|
|
1486
|
-
m.Data.Country = {
|
|
1487
|
-
RecommendedValue: metadata.Country,
|
|
1488
|
-
};
|
|
1489
|
-
m.Data.Metadata = metadata;
|
|
1490
|
-
}
|
|
1491
|
-
return m;
|
|
1492
|
-
}));
|
|
1493
|
-
}
|
|
1494
|
-
blobToDataUrl(file) {
|
|
1495
|
-
return Observable.create((obs) => {
|
|
1496
|
-
const reader = new FileReader();
|
|
1497
|
-
reader.onerror = (err) => obs.error(err);
|
|
1498
|
-
reader.onabort = (err) => obs.error(err);
|
|
1499
|
-
reader.onload = () => {
|
|
1500
|
-
obs.next(reader.result);
|
|
1501
|
-
};
|
|
1502
|
-
reader.onloadend = () => obs.complete();
|
|
1503
|
-
return reader.readAsDataURL(file);
|
|
1504
|
-
});
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
ScanProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScanProvider, deps: [{ token: i1$1.HttpClient }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1508
|
-
ScanProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScanProvider, providedIn: 'root' });
|
|
1509
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScanProvider, decorators: [{
|
|
1510
|
-
type: Injectable,
|
|
1511
|
-
args: [{
|
|
1512
|
-
providedIn: 'root',
|
|
1513
|
-
}]
|
|
1514
|
-
}], ctorParameters: function () { return [{ type: i1$1.HttpClient }, { type: i0.Injector }]; } });
|
|
1515
|
-
|
|
1516
|
-
class LayoutProvider {
|
|
1517
|
-
constructor(breakpointObserver, platform) {
|
|
1518
|
-
this.breakpointObserver = breakpointObserver;
|
|
1519
|
-
this.platform = platform;
|
|
1520
|
-
this.isMobile = false;
|
|
1521
|
-
this.breakpoint$ = this.breakpointObserver
|
|
1522
|
-
.observe(['(min-width: 768px)'])
|
|
1523
|
-
.pipe(tap((value) => console.log(value)), distinctUntilChanged());
|
|
1524
|
-
}
|
|
1525
|
-
init() {
|
|
1526
|
-
this.breakpoint$.subscribe((v) => {
|
|
1527
|
-
this.isMobile = !v.matches || this.platform.IOS || this.platform.ANDROID;
|
|
1528
|
-
document.body.className = this.isMobile ? 'mobile' : 'desktop';
|
|
1529
|
-
});
|
|
1530
|
-
}
|
|
1531
|
-
}
|
|
1532
|
-
LayoutProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LayoutProvider, deps: [{ token: i1.BreakpointObserver }, { token: i2.Platform }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1533
|
-
LayoutProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LayoutProvider, providedIn: 'root' });
|
|
1534
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LayoutProvider, decorators: [{
|
|
1535
|
-
type: Injectable,
|
|
1536
|
-
args: [{
|
|
1537
|
-
providedIn: 'root',
|
|
1538
|
-
}]
|
|
1539
|
-
}], ctorParameters: function () { return [{ type: i1.BreakpointObserver }, { type: i2.Platform }]; } });
|
|
1540
|
-
|
|
1541
|
-
class NgxScandocAuthProvider {
|
|
1542
|
-
constructor(http, injector) {
|
|
1543
|
-
this.http = http;
|
|
1544
|
-
this.injector = injector;
|
|
1545
|
-
this.config = this.injector.get(AUTH_CONFIG_TOKEN);
|
|
1546
|
-
this.token = '';
|
|
1547
|
-
this.refresh_token = '';
|
|
1548
|
-
this.tokenTimestamps = {
|
|
1549
|
-
Time: 0,
|
|
1550
|
-
Client: 0,
|
|
1551
|
-
SubClient: 0,
|
|
1552
|
-
};
|
|
1553
|
-
}
|
|
1554
|
-
setSubClient(name) {
|
|
1555
|
-
this.subClient = name;
|
|
1556
|
-
}
|
|
1557
|
-
setConfig() { }
|
|
1558
|
-
get tokenExpired() {
|
|
1559
|
-
if (this.token == '' || this.tokenTimestamps.Time === 0) {
|
|
1560
|
-
console.log('EXPIRED');
|
|
1561
|
-
return true;
|
|
1562
|
-
}
|
|
1563
|
-
const { Time } = this.tokenTimestamps;
|
|
1564
|
-
const tokenDate = moment(Time);
|
|
1565
|
-
const isValid = moment(tokenDate).isBefore(moment().add(5, 'minutes'));
|
|
1566
|
-
return !isValid;
|
|
1567
|
-
}
|
|
1568
|
-
resetToken() {
|
|
1569
|
-
// this.token = '';
|
|
1570
|
-
}
|
|
1571
|
-
get accesToken() {
|
|
1572
|
-
return this.tokenExpired ? this.fetchToken() : of(this.token);
|
|
1573
|
-
}
|
|
1574
|
-
fetchToken() {
|
|
1575
|
-
if (this.token && this.refresh_token) {
|
|
1576
|
-
return this.refreshToken();
|
|
1577
|
-
}
|
|
1578
|
-
return this.getToken();
|
|
1579
|
-
}
|
|
1580
|
-
refreshToken() {
|
|
1581
|
-
const { path, refresh } = this.config;
|
|
1582
|
-
return this.http
|
|
1583
|
-
.post(`${path}${refresh}`, {
|
|
1584
|
-
refresh_token: this.refresh_token,
|
|
1585
|
-
})
|
|
1586
|
-
.pipe(tap$1((token) => {
|
|
1587
|
-
// console.log(this.token);
|
|
1588
|
-
this.token = token.access_token;
|
|
1589
|
-
this.updateToken();
|
|
1590
|
-
// this.token = token.access_token;
|
|
1591
|
-
// console.log('TOKEN', this.token);
|
|
1592
|
-
// this.refresh_token = token.refresh_token;
|
|
1593
|
-
// const decoded: any = jwt_decode(this.token);
|
|
1594
|
-
// console.log(decoded);
|
|
1595
|
-
// const { Time, Client, SubClient } = decoded;
|
|
1596
|
-
// this.tokenTimestamps = { Time, Client, SubClient };
|
|
1597
|
-
}), map((data) => data.access_token));
|
|
1598
|
-
}
|
|
1599
|
-
get user_key() {
|
|
1600
|
-
return this.config.clientId;
|
|
1601
|
-
}
|
|
1602
|
-
get sub_client() {
|
|
1603
|
-
return this.config.tokenName ? this.config.tokenName : this.subClient;
|
|
1604
|
-
}
|
|
1605
|
-
updateToken() {
|
|
1606
|
-
const decoded = jwt_decode(this.token);
|
|
1607
|
-
const { Time, Client, SubClient } = decoded;
|
|
1608
|
-
this.tokenTimestamps = { Time, Client, SubClient };
|
|
1609
|
-
}
|
|
1610
|
-
getToken() {
|
|
1611
|
-
const { path, login, version, clientId, tokenName } = this.config;
|
|
1612
|
-
if (version == 'v1') {
|
|
1613
|
-
return this.http
|
|
1614
|
-
.post(`${path}`, {
|
|
1615
|
-
clientId: clientId,
|
|
1616
|
-
token: tokenName,
|
|
1617
|
-
})
|
|
1618
|
-
.pipe(map((data) => data.accessToken), tap$1((token) => {
|
|
1619
|
-
this.token = token;
|
|
1620
|
-
const decoded = jwt_decode(this.token);
|
|
1621
|
-
const { iat, exp } = decoded;
|
|
1622
|
-
this.tokenTimestamps = { iat, exp, Time: 0 };
|
|
1623
|
-
}));
|
|
1624
|
-
}
|
|
1625
|
-
return this.http
|
|
1626
|
-
.post(`${path}${login}`, {
|
|
1627
|
-
user_key: this.user_key,
|
|
1628
|
-
sub_client: this.sub_client,
|
|
1629
|
-
})
|
|
1630
|
-
.pipe(tap$1((token) => {
|
|
1631
|
-
this.token = token.access_token;
|
|
1632
|
-
this.refresh_token = token.refresh_token;
|
|
1633
|
-
this.updateToken();
|
|
1634
|
-
}), map((data) => data.access_token));
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
NgxScandocAuthProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocAuthProvider, deps: [{ token: i1$1.HttpClient }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1638
|
-
NgxScandocAuthProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocAuthProvider, providedIn: 'root' });
|
|
1639
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocAuthProvider, decorators: [{
|
|
1640
|
-
type: Injectable,
|
|
1641
|
-
args: [{
|
|
1642
|
-
providedIn: 'root',
|
|
1643
|
-
}]
|
|
1644
|
-
}], ctorParameters: function () { return [{ type: i1$1.HttpClient }, { type: i0.Injector }]; } });
|
|
1645
|
-
|
|
1646
|
-
const TRANSLATION_PROVIDER = new InjectionToken('Injection token for translation providers.');
|
|
1647
|
-
class NgxScanDocTranslationProvider {
|
|
1648
|
-
constructor(translate, injector,
|
|
1649
|
-
//@Optional() @Inject(SCAN_CONFIG_TOKEN) config: ScanConfig,
|
|
1650
|
-
providers, platformLocation) {
|
|
1651
|
-
this.translate = translate;
|
|
1652
|
-
this.injector = injector;
|
|
1653
|
-
this.platformLocation = platformLocation;
|
|
1654
|
-
console.log('MM', Math.random());
|
|
1655
|
-
this.customLoader = this.translate.currentLoader;
|
|
1656
|
-
//console.log('config',config)
|
|
1657
|
-
// console.log(this.translate)
|
|
1658
|
-
if (providers && providers.length > 0) {
|
|
1659
|
-
for (const provider of providers) {
|
|
1660
|
-
this.addTranslationFolder(provider.name, provider.source);
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
|
-
path(path) {
|
|
1665
|
-
return path;
|
|
1666
|
-
// const baseHref = this.platformLocation
|
|
1667
|
-
// .getBaseHrefFromDOM()
|
|
1668
|
-
// .split('/')
|
|
1669
|
-
// .join('');
|
|
1670
|
-
// return baseHref != '' ? `/${baseHref}${path}` : path;
|
|
1671
|
-
}
|
|
1672
|
-
setDefaultLang(lang) {
|
|
1673
|
-
this.defaultLang = lang;
|
|
1674
|
-
this.translate.setDefaultLang(this.defaultLang);
|
|
1675
|
-
}
|
|
1676
|
-
registerTranslationFolder(name = '', path = '') {
|
|
1677
|
-
console.log(name, path, this.userLang, this.defaultLang);
|
|
1678
|
-
if (!this.customLoader.providerRegistered(name)) {
|
|
1679
|
-
this.customLoader.registerProvider(name, this.path(path));
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
addTranslationFolder(name = '', path = '') {
|
|
1683
|
-
console.log(name, path, this.userLang, this.defaultLang);
|
|
1684
|
-
if (!this.customLoader.providerRegistered(name)) {
|
|
1685
|
-
this.customLoader.registerProvider(name, this.path(path));
|
|
1686
|
-
if (this.userLang) {
|
|
1687
|
-
const existCurrentLang = this.translate.currentLang ? true : false;
|
|
1688
|
-
this.loadTranslation(this.userLang, this.defaultLang, !existCurrentLang);
|
|
1689
|
-
}
|
|
1690
|
-
else {
|
|
1691
|
-
this.loadTranslation(this.defaultLang);
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
}
|
|
1695
|
-
loadTranslation(lang, fallback, useLang = true) {
|
|
1696
|
-
this.translate.getTranslation(lang).subscribe((resp) => {
|
|
1697
|
-
this.onTranslationChanged(lang);
|
|
1698
|
-
if (useLang) {
|
|
1699
|
-
setTimeout(() => {
|
|
1700
|
-
this.translate.use(lang);
|
|
1701
|
-
}, 20);
|
|
1702
|
-
}
|
|
1703
|
-
// this.translate.reloadLang(lang)
|
|
1704
|
-
}, () => {
|
|
1705
|
-
if (fallback && fallback !== lang) {
|
|
1706
|
-
this.loadTranslation(fallback);
|
|
1707
|
-
}
|
|
1708
|
-
});
|
|
1709
|
-
}
|
|
1710
|
-
updateTranslation(lang, fallback) {
|
|
1711
|
-
return this.translate.getTranslation(lang).pipe(catchError(() => {
|
|
1712
|
-
if (fallback && fallback !== lang) {
|
|
1713
|
-
return this.updateTranslation(fallback);
|
|
1714
|
-
}
|
|
1715
|
-
return this.translate.use(lang);
|
|
1716
|
-
}), switchMap(() => {
|
|
1717
|
-
this.onTranslationChanged(lang);
|
|
1718
|
-
return this.translate.use(lang);
|
|
1719
|
-
}));
|
|
1720
|
-
}
|
|
1721
|
-
onTranslationChanged(lang) {
|
|
1722
|
-
this.translate.onTranslationChange.next({
|
|
1723
|
-
lang,
|
|
1724
|
-
translations: this.customLoader.getFullTranslationJSON(lang),
|
|
1725
|
-
});
|
|
1726
|
-
}
|
|
1727
|
-
use(lang) {
|
|
1728
|
-
this.customLoader.init(lang);
|
|
1729
|
-
return this.updateTranslation(lang);
|
|
1730
|
-
}
|
|
1731
|
-
forms(item, namespace = null) {
|
|
1732
|
-
if (item.fieldGroup) {
|
|
1733
|
-
item.fieldGroup = item.fieldGroup.map((field) => this.forms(field));
|
|
1734
|
-
}
|
|
1735
|
-
const prefix = namespace ? namespace + '.' : '';
|
|
1736
|
-
if (item.props &&
|
|
1737
|
-
(item.props.label || item.props.placeholder || item.props.options)) {
|
|
1738
|
-
if (!item.expressions) {
|
|
1739
|
-
item.expressions = {};
|
|
1740
|
-
}
|
|
1741
|
-
if (item.props.label) {
|
|
1742
|
-
item.expressions['props.label'] = this.translate.stream(prefix + item.props.label);
|
|
1743
|
-
}
|
|
1744
|
-
if (item.props.placeholder) {
|
|
1745
|
-
item.expressions['props.placeholder'] = this.translate.stream(prefix + item.props.placeholder);
|
|
1746
|
-
}
|
|
1747
|
-
if (Array.isArray(item.props.options)) {
|
|
1748
|
-
item.expressions['props.options'] = item.props.options.map((m) => {
|
|
1749
|
-
// console.log(m);
|
|
1750
|
-
if (m.label) {
|
|
1751
|
-
m.label = this.translate.instant(prefix + m.label);
|
|
1752
|
-
}
|
|
1753
|
-
return m;
|
|
1754
|
-
});
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
return item;
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
|
-
NgxScanDocTranslationProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScanDocTranslationProvider, deps: [{ token: i4.TranslateService }, { token: i0.Injector }, { token: TRANSLATION_PROVIDER, optional: true }, { token: i2$1.PlatformLocation }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1761
|
-
NgxScanDocTranslationProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScanDocTranslationProvider, providedIn: 'root' });
|
|
1762
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScanDocTranslationProvider, decorators: [{
|
|
1763
|
-
type: Injectable,
|
|
1764
|
-
args: [{
|
|
1765
|
-
providedIn: 'root',
|
|
1766
|
-
}]
|
|
1767
|
-
}], ctorParameters: function () {
|
|
1768
|
-
return [{ type: i4.TranslateService }, { type: i0.Injector }, { type: undefined, decorators: [{
|
|
1769
|
-
type: Optional
|
|
1770
|
-
}, {
|
|
1771
|
-
type: Inject,
|
|
1772
|
-
args: [TRANSLATION_PROVIDER]
|
|
1773
|
-
}] }, { type: i2$1.PlatformLocation }];
|
|
1774
|
-
} });
|
|
1775
|
-
|
|
1776
|
-
class NgxScandocFieldsProvider {
|
|
1777
|
-
constructor(translate, provider) {
|
|
1778
|
-
this.translate = translate;
|
|
1779
|
-
this.provider = provider;
|
|
1780
|
-
this.selfie$ = new Subject();
|
|
1781
|
-
}
|
|
1782
|
-
update() {
|
|
1783
|
-
return [
|
|
1784
|
-
{
|
|
1785
|
-
fieldGroupClassName: 'px-16',
|
|
1786
|
-
fieldGroup: [
|
|
1787
|
-
{
|
|
1788
|
-
wrappers: [],
|
|
1789
|
-
type: 'checkbox',
|
|
1790
|
-
key: 'profile',
|
|
1791
|
-
class: 'checkbox ',
|
|
1792
|
-
defaultValue: true,
|
|
1793
|
-
props: {
|
|
1794
|
-
label: 'scandoc.form.scan.document.update.profile',
|
|
1795
|
-
},
|
|
1796
|
-
},
|
|
1797
|
-
{
|
|
1798
|
-
wrappers: [],
|
|
1799
|
-
type: 'checkbox',
|
|
1800
|
-
class: 'checkbox ',
|
|
1801
|
-
key: 'document',
|
|
1802
|
-
defaultValue: true,
|
|
1803
|
-
props: {
|
|
1804
|
-
label: 'scandoc.form.scan.document.update.document',
|
|
1805
|
-
},
|
|
1806
|
-
},
|
|
1807
|
-
{
|
|
1808
|
-
wrappers: [],
|
|
1809
|
-
type: 'checkbox',
|
|
1810
|
-
class: 'checkbox ',
|
|
1811
|
-
key: 'attachment',
|
|
1812
|
-
defaultValue: true,
|
|
1813
|
-
props: {
|
|
1814
|
-
label: 'scandoc.form.scan.document.update.attachment',
|
|
1815
|
-
},
|
|
1816
|
-
},
|
|
1817
|
-
].map((item) => this.translate.forms(item)),
|
|
1818
|
-
},
|
|
1819
|
-
];
|
|
1820
|
-
}
|
|
1821
|
-
document() {
|
|
1822
|
-
if (this.customFields) {
|
|
1823
|
-
return this.customFields;
|
|
1824
|
-
}
|
|
1825
|
-
return [
|
|
1826
|
-
{
|
|
1827
|
-
className: 'w-100-p',
|
|
1828
|
-
fieldGroupClassName: 'form-flex-row profile-details',
|
|
1829
|
-
fieldGroup: [
|
|
1830
|
-
{
|
|
1831
|
-
className: 'w-100-p ',
|
|
1832
|
-
fieldGroupClassName: 'card-group',
|
|
1833
|
-
fieldGroup: [
|
|
1834
|
-
{
|
|
1835
|
-
type: 'title',
|
|
1836
|
-
props: {
|
|
1837
|
-
label: 'scandoc.form.scan.document.guestDetailsTitle',
|
|
1838
|
-
},
|
|
1839
|
-
},
|
|
1840
|
-
{
|
|
1841
|
-
type: 'profile-image',
|
|
1842
|
-
key: '_avatar',
|
|
1843
|
-
props: {
|
|
1844
|
-
label: 'scandoc.form.scan.document.firstName',
|
|
1845
|
-
},
|
|
1846
|
-
},
|
|
1847
|
-
{
|
|
1848
|
-
type: 'input',
|
|
1849
|
-
key: 'firstName',
|
|
1850
|
-
className: 'small',
|
|
1851
|
-
props: {
|
|
1852
|
-
label: 'scandoc.form.scan.document.firstName',
|
|
1853
|
-
required: true,
|
|
1854
|
-
},
|
|
1855
|
-
},
|
|
1856
|
-
{
|
|
1857
|
-
type: 'input',
|
|
1858
|
-
key: 'lastName',
|
|
1859
|
-
className: 'small',
|
|
1860
|
-
props: {
|
|
1861
|
-
label: 'scandoc.form.scan.document.lastName',
|
|
1862
|
-
required: true,
|
|
1863
|
-
},
|
|
1864
|
-
},
|
|
1865
|
-
{
|
|
1866
|
-
className: 'small',
|
|
1867
|
-
key: 'secondName',
|
|
1868
|
-
type: 'input',
|
|
1869
|
-
props: {
|
|
1870
|
-
label: 'scandoc.form.scan.document.secondLastName',
|
|
1871
|
-
},
|
|
1872
|
-
hideExpression: 'model.hideSecondLastName',
|
|
1873
|
-
},
|
|
1874
|
-
{
|
|
1875
|
-
type: 'input',
|
|
1876
|
-
key: 'middleName',
|
|
1877
|
-
className: 'small',
|
|
1878
|
-
props: {
|
|
1879
|
-
label: 'scandoc.form.scan.document.middleName',
|
|
1880
|
-
},
|
|
1881
|
-
},
|
|
1882
|
-
{
|
|
1883
|
-
className: '',
|
|
1884
|
-
fieldGroupClassName: 'form-flex-row space-between',
|
|
1885
|
-
fieldGroup: [
|
|
1886
|
-
{
|
|
1887
|
-
type: 'datepicker',
|
|
1888
|
-
key: 'birthDate',
|
|
1889
|
-
className: 'w-100-p small mr-8',
|
|
1890
|
-
props: {
|
|
1891
|
-
label: 'scandoc.form.scan.document.birthDate',
|
|
1892
|
-
},
|
|
1893
|
-
},
|
|
1894
|
-
{
|
|
1895
|
-
type: 'select',
|
|
1896
|
-
key: 'gender',
|
|
1897
|
-
className: 'w-100-p small ml-8',
|
|
1898
|
-
props: {
|
|
1899
|
-
label: 'scandoc.form.scan.document.gender',
|
|
1900
|
-
options: [
|
|
1901
|
-
{ value: 'MALE', label: 'MALE' },
|
|
1902
|
-
{ value: 'FEMALE', label: 'FEMALE' },
|
|
1903
|
-
{ value: 'NA', label: 'N/A' },
|
|
1904
|
-
],
|
|
1905
|
-
},
|
|
1906
|
-
},
|
|
1907
|
-
],
|
|
1908
|
-
},
|
|
1909
|
-
{
|
|
1910
|
-
className: '',
|
|
1911
|
-
fieldGroupClassName: 'form-flex-row space-between',
|
|
1912
|
-
fieldGroup: [
|
|
1913
|
-
{
|
|
1914
|
-
type: 'input',
|
|
1915
|
-
key: 'birthPlace',
|
|
1916
|
-
className: 'small w-100-p mr-8',
|
|
1917
|
-
props: {
|
|
1918
|
-
label: 'scandoc.form.scan.document.birthPlace',
|
|
1919
|
-
},
|
|
1920
|
-
},
|
|
1921
|
-
{
|
|
1922
|
-
type: 'select',
|
|
1923
|
-
key: 'birthCountry',
|
|
1924
|
-
className: 'small w-100-p ml-8',
|
|
1925
|
-
props: {
|
|
1926
|
-
label: 'scandoc.form.scan.document.birthCountry',
|
|
1927
|
-
options: this.provider.countries(),
|
|
1928
|
-
},
|
|
1929
|
-
},
|
|
1930
|
-
],
|
|
1931
|
-
},
|
|
1932
|
-
{
|
|
1933
|
-
className: 'small',
|
|
1934
|
-
key: 'nationality',
|
|
1935
|
-
type: 'select',
|
|
1936
|
-
props: {
|
|
1937
|
-
label: 'scandoc.form.scan.document.nationality',
|
|
1938
|
-
// appearance: 'outline',
|
|
1939
|
-
// options: this.profileProvider.nationalities(),
|
|
1940
|
-
options: this.provider.countries(),
|
|
1941
|
-
},
|
|
1942
|
-
},
|
|
1943
|
-
],
|
|
1944
|
-
},
|
|
1945
|
-
{
|
|
1946
|
-
className: 'w-100-p',
|
|
1947
|
-
fieldGroupClassName: 'form-flex-column',
|
|
1948
|
-
fieldGroup: [
|
|
1949
|
-
{
|
|
1950
|
-
className: 'w-100-p',
|
|
1951
|
-
fieldGroupClassName: 'card-group',
|
|
1952
|
-
fieldGroup: [
|
|
1953
|
-
{
|
|
1954
|
-
type: 'title',
|
|
1955
|
-
props: {
|
|
1956
|
-
label: 'scandoc.form.scan.document.documentTitle',
|
|
1957
|
-
},
|
|
1958
|
-
},
|
|
1959
|
-
{
|
|
1960
|
-
type: 'select',
|
|
1961
|
-
key: 'documentType',
|
|
1962
|
-
props: {
|
|
1963
|
-
label: 'scandoc.form.scan.document.documentType',
|
|
1964
|
-
options: [
|
|
1965
|
-
{ value: 'ID', label: 'Identity Document' },
|
|
1966
|
-
{ value: 'PASS', label: 'Passport' },
|
|
1967
|
-
{ value: 'DL', label: 'Driver Licence' },
|
|
1968
|
-
],
|
|
1969
|
-
// valueProp: 'id',
|
|
1970
|
-
// labelProp: 'value',
|
|
1971
|
-
required: true,
|
|
1972
|
-
},
|
|
1973
|
-
},
|
|
1974
|
-
{
|
|
1975
|
-
type: 'input',
|
|
1976
|
-
key: 'documentNumber',
|
|
1977
|
-
props: {
|
|
1978
|
-
label: 'scandoc.form.scan.document.documentNumber',
|
|
1979
|
-
required: true,
|
|
1980
|
-
},
|
|
1981
|
-
},
|
|
1982
|
-
{
|
|
1983
|
-
className: '',
|
|
1984
|
-
fieldGroupClassName: 'form-flex-row space-between',
|
|
1985
|
-
fieldGroup: [
|
|
1986
|
-
{
|
|
1987
|
-
type: 'datepicker',
|
|
1988
|
-
key: 'issueDate',
|
|
1989
|
-
className: 'small mr-8',
|
|
1990
|
-
props: {
|
|
1991
|
-
label: 'scandoc.form.scan.document.issueDate',
|
|
1992
|
-
},
|
|
1993
|
-
},
|
|
1994
|
-
{
|
|
1995
|
-
type: 'datepicker',
|
|
1996
|
-
key: 'expirationDate',
|
|
1997
|
-
className: 'small ml-8',
|
|
1998
|
-
props: {
|
|
1999
|
-
label: 'scandoc.form.scan.document.expirationDate',
|
|
2000
|
-
},
|
|
2001
|
-
},
|
|
2002
|
-
],
|
|
2003
|
-
},
|
|
2004
|
-
{
|
|
2005
|
-
type: 'select',
|
|
2006
|
-
key: 'issueStateCode',
|
|
2007
|
-
props: {
|
|
2008
|
-
label: 'scandoc.form.scan.document.issuingStateCode',
|
|
2009
|
-
options: this.provider.countries(),
|
|
2010
|
-
},
|
|
2011
|
-
},
|
|
2012
|
-
{
|
|
2013
|
-
type: 'input',
|
|
2014
|
-
key: 'issuingPlace',
|
|
2015
|
-
props: {
|
|
2016
|
-
label: 'scandoc.form.scan.document.issuingPlace',
|
|
2017
|
-
required: false,
|
|
2018
|
-
},
|
|
2019
|
-
},
|
|
2020
|
-
],
|
|
2021
|
-
},
|
|
2022
|
-
{
|
|
2023
|
-
className: 'w-100-p',
|
|
2024
|
-
fieldGroupClassName: 'card-group',
|
|
2025
|
-
fieldGroup: [
|
|
2026
|
-
{
|
|
2027
|
-
type: 'title',
|
|
2028
|
-
props: {
|
|
2029
|
-
label: 'scandoc.form.scan.document.addressTitle',
|
|
2030
|
-
badge: 'communications',
|
|
2031
|
-
},
|
|
2032
|
-
},
|
|
2033
|
-
{
|
|
2034
|
-
className: 'small',
|
|
2035
|
-
key: 'country',
|
|
2036
|
-
type: 'select',
|
|
2037
|
-
props: {
|
|
2038
|
-
required: true,
|
|
2039
|
-
label: 'scandoc.form.profile.address.country',
|
|
2040
|
-
options: this.provider.countries(),
|
|
2041
|
-
},
|
|
2042
|
-
// expressionProperties: {
|
|
2043
|
-
// 'props.disabled': (model: any) => !model.newAddress,
|
|
2044
|
-
// },
|
|
2045
|
-
hooks: {
|
|
2046
|
-
onInit: (model) => {
|
|
2047
|
-
console.log(model);
|
|
2048
|
-
},
|
|
2049
|
-
},
|
|
2050
|
-
},
|
|
2051
|
-
{
|
|
2052
|
-
className: '',
|
|
2053
|
-
fieldGroupClassName: 'form-flex-row space-between',
|
|
2054
|
-
fieldGroup: [
|
|
2055
|
-
{
|
|
2056
|
-
className: 'mr-8 w-100-p',
|
|
2057
|
-
key: 'zip',
|
|
2058
|
-
type: 'input',
|
|
2059
|
-
props: {
|
|
2060
|
-
label: 'scandoc.form.profile.address.zip',
|
|
2061
|
-
labelProp: (item) => {
|
|
2062
|
-
return `${item.zip} (${item.city})`;
|
|
2063
|
-
},
|
|
2064
|
-
set: (field, option) => {
|
|
2065
|
-
// console.log(option, field);
|
|
2066
|
-
field.formControl.setValue(option.value.zip);
|
|
2067
|
-
// set CITY
|
|
2068
|
-
field.form.get('city').setValue(option.value.city);
|
|
2069
|
-
},
|
|
2070
|
-
filter: (key, field) => {
|
|
2071
|
-
// return this.profileProvider.zipCodes({
|
|
2072
|
-
// countryCode: field.form.get('country').value,
|
|
2073
|
-
// zip: key,
|
|
2074
|
-
// });
|
|
2075
|
-
},
|
|
2076
|
-
},
|
|
2077
|
-
// expressionProperties: {
|
|
2078
|
-
// 'props.disabled': (model: any) =>
|
|
2079
|
-
// !model.newAddress,
|
|
2080
|
-
// },
|
|
2081
|
-
},
|
|
2082
|
-
{
|
|
2083
|
-
className: 'small w-100-p ml-8',
|
|
2084
|
-
key: 'city',
|
|
2085
|
-
type: 'input',
|
|
2086
|
-
props: {
|
|
2087
|
-
label: 'scandoc.form.profile.address.city',
|
|
2088
|
-
},
|
|
2089
|
-
},
|
|
2090
|
-
],
|
|
2091
|
-
},
|
|
2092
|
-
{
|
|
2093
|
-
className: 'small w-100-p',
|
|
2094
|
-
key: 'street1',
|
|
2095
|
-
type: 'input',
|
|
2096
|
-
props: {
|
|
2097
|
-
label: 'scandoc.form.profile.address.street',
|
|
2098
|
-
},
|
|
2099
|
-
},
|
|
2100
|
-
],
|
|
2101
|
-
},
|
|
2102
|
-
],
|
|
2103
|
-
},
|
|
2104
|
-
],
|
|
2105
|
-
},
|
|
2106
|
-
].map((item) => this.translate.forms(item));
|
|
2107
|
-
}
|
|
2108
|
-
}
|
|
2109
|
-
NgxScandocFieldsProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocFieldsProvider, deps: [{ token: NgxScanDocTranslationProvider }, { token: ScanProvider }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2110
|
-
NgxScandocFieldsProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocFieldsProvider, providedIn: 'root' });
|
|
2111
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocFieldsProvider, decorators: [{
|
|
2112
|
-
type: Injectable,
|
|
2113
|
-
args: [{
|
|
2114
|
-
providedIn: 'root',
|
|
2115
|
-
}]
|
|
2116
|
-
}], ctorParameters: function () { return [{ type: NgxScanDocTranslationProvider }, { type: ScanProvider }]; } });
|
|
2117
|
-
|
|
2118
|
-
class ScanResultsComponent extends BaseComponent {
|
|
2119
|
-
constructor(cameraProvider, formProvider, provider, cd, zone) {
|
|
2120
|
-
super();
|
|
2121
|
-
this.cameraProvider = cameraProvider;
|
|
2122
|
-
this.formProvider = formProvider;
|
|
2123
|
-
this.provider = provider;
|
|
2124
|
-
this.cd = cd;
|
|
2125
|
-
this.zone = zone;
|
|
2126
|
-
this.action = new EventEmitter();
|
|
2127
|
-
}
|
|
2128
|
-
ngOnInit() {
|
|
2129
|
-
console.time('fields');
|
|
2130
|
-
this.fields = this.formProvider.document();
|
|
2131
|
-
console.timeEnd('fields');
|
|
2132
|
-
this.__subs(this.data).subscribe((resp) => {
|
|
2133
|
-
this.zone.run(() => {
|
|
2134
|
-
switch (resp.type) {
|
|
2135
|
-
case 'avatar':
|
|
2136
|
-
this.model._avatar = resp.data;
|
|
2137
|
-
this.form = new FormGroup({});
|
|
2138
|
-
console.log(this.model);
|
|
2139
|
-
break;
|
|
2140
|
-
case 'model':
|
|
2141
|
-
this.model = resp.data;
|
|
2142
|
-
break;
|
|
2143
|
-
}
|
|
2144
|
-
console.timeEnd('results');
|
|
2145
|
-
this.cd.detectChanges();
|
|
2146
|
-
});
|
|
2147
|
-
});
|
|
2148
|
-
}
|
|
2149
|
-
ngOnDestroy() {
|
|
2150
|
-
this.__destroy();
|
|
2151
|
-
}
|
|
2152
|
-
selfie() {
|
|
2153
|
-
this.action.emit({ selfie: true });
|
|
2154
|
-
}
|
|
2155
|
-
}
|
|
2156
|
-
ScanResultsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScanResultsComponent, deps: [{ token: NgxScandocCameraProvider }, { token: NgxScandocFieldsProvider }, { token: ScanProvider }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
2157
|
-
ScanResultsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ScanResultsComponent, selector: "ngx-scan-results", inputs: { data: "data", images: "images", form: "form" }, outputs: { action: "action" }, usesInheritance: true, ngImport: i0, template: "<div *ngIf=\"model\" class=\"wraper\">\n <div style=\"flex: 1\">\n\n\n <form class=\"py-0 w-100-p\" [formGroup]=\"form\">\n <formly-form fxFlex [form]=\"form\" [fields]=\"fields\" [model]=\"model\">\n </formly-form>\n </form>\n </div>\n <div style=\"flex: 1\" >\n <mat-card appearance=\"outlined\" style=\"margin:0px 4px; padding: 16px\" class=\"images\">\n <h3>{{ \"scandoc.result.images\" | translate }}</h3>\n <ng-container *ngFor=\"let img of model.images\">\n <div fxLayout=\"column\">\n <ng-container *ngIf=\"img.side === 0\">\n <div class=\"title\">\n {{ \"scandoc.result.frontSide\" | translate }}\n </div>\n </ng-container>\n <ng-container *ngIf=\"img.side === 1\">\n <div class=\"title\">{{ \"scandoc.result.backSide\" | translate }}</div>\n </ng-container>\n <img\n class=\"preview\"\n style=\"max-width: 460px; border-radius: 1rem\"\n [src]=\"img.data\"\n />\n </div>\n </ng-container>\n </mat-card>\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1;overflow-y:auto;overflow-x:hidden}.images .title{padding:8px 0;font-weight:600}.images img{margin-bottom:16px;width:100%}.wraper{padding:4px;flex:1;display:flex;flex-direction:row}mat-card{box-shadow:none!important}.selfieContainer{display:flex;flex-direction:row;align-items:center}.selfieContainer .selfie{width:150px}.selfieContainer .selfie .preview{width:120px;height:120px;border-radius:80px}.selfieContainer .button{box-shadow:none;border:1px solid rgba(0,0,0,.1)}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "component", type: i6.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "component", type: i7.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }, { kind: "directive", type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] });
|
|
2158
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScanResultsComponent, decorators: [{
|
|
2159
|
-
type: Component,
|
|
2160
|
-
args: [{ selector: 'ngx-scan-results', template: "<div *ngIf=\"model\" class=\"wraper\">\n <div style=\"flex: 1\">\n\n\n <form class=\"py-0 w-100-p\" [formGroup]=\"form\">\n <formly-form fxFlex [form]=\"form\" [fields]=\"fields\" [model]=\"model\">\n </formly-form>\n </form>\n </div>\n <div style=\"flex: 1\" >\n <mat-card appearance=\"outlined\" style=\"margin:0px 4px; padding: 16px\" class=\"images\">\n <h3>{{ \"scandoc.result.images\" | translate }}</h3>\n <ng-container *ngFor=\"let img of model.images\">\n <div fxLayout=\"column\">\n <ng-container *ngIf=\"img.side === 0\">\n <div class=\"title\">\n {{ \"scandoc.result.frontSide\" | translate }}\n </div>\n </ng-container>\n <ng-container *ngIf=\"img.side === 1\">\n <div class=\"title\">{{ \"scandoc.result.backSide\" | translate }}</div>\n </ng-container>\n <img\n class=\"preview\"\n style=\"max-width: 460px; border-radius: 1rem\"\n [src]=\"img.data\"\n />\n </div>\n </ng-container>\n </mat-card>\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1;overflow-y:auto;overflow-x:hidden}.images .title{padding:8px 0;font-weight:600}.images img{margin-bottom:16px;width:100%}.wraper{padding:4px;flex:1;display:flex;flex-direction:row}mat-card{box-shadow:none!important}.selfieContainer{display:flex;flex-direction:row;align-items:center}.selfieContainer .selfie{width:150px}.selfieContainer .selfie .preview{width:120px;height:120px;border-radius:80px}.selfieContainer .button{box-shadow:none;border:1px solid rgba(0,0,0,.1)}\n"] }]
|
|
2161
|
-
}], ctorParameters: function () { return [{ type: NgxScandocCameraProvider }, { type: NgxScandocFieldsProvider }, { type: ScanProvider }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; }, propDecorators: { data: [{
|
|
2162
|
-
type: Input
|
|
2163
|
-
}], images: [{
|
|
2164
|
-
type: Input
|
|
2165
|
-
}], form: [{
|
|
2166
|
-
type: Input
|
|
2167
|
-
}], action: [{
|
|
2168
|
-
type: Output
|
|
2169
|
-
}] } });
|
|
2170
|
-
|
|
2171
|
-
class ManualScanComponent extends BaseComponent {
|
|
2172
|
-
get class() {
|
|
2173
|
-
return this.isMobile;
|
|
2174
|
-
}
|
|
2175
|
-
onResize() {
|
|
2176
|
-
if (this.wraper) {
|
|
2177
|
-
this.width = this.wraper.nativeElement.clientWidth;
|
|
2178
|
-
this.height = this.wraper.nativeElement.clientHeight;
|
|
2179
|
-
setTimeout(() => {
|
|
2180
|
-
var _a;
|
|
2181
|
-
const video = (_a = this.wraper) === null || _a === void 0 ? void 0 : _a.nativeElement.querySelector('video');
|
|
2182
|
-
if (video) {
|
|
2183
|
-
// console.log(video.clientWidth, video.clientHeight);
|
|
2184
|
-
this.videoWidth = video.clientWidth;
|
|
2185
|
-
this.videoHeight = video.clientHeight;
|
|
2186
|
-
}
|
|
2187
|
-
this.cd.detectChanges();
|
|
2188
|
-
}, 100);
|
|
2189
|
-
this.cd.detectChanges();
|
|
2190
|
-
}
|
|
2191
|
-
}
|
|
2192
|
-
constructor(cameraProvider, cd, layoutProvider, zone) {
|
|
2193
|
-
super();
|
|
2194
|
-
this.cameraProvider = cameraProvider;
|
|
2195
|
-
this.cd = cd;
|
|
2196
|
-
this.layoutProvider = layoutProvider;
|
|
2197
|
-
this.zone = zone;
|
|
2198
|
-
this.action = new EventEmitter();
|
|
2199
|
-
this.videoOptions = {
|
|
2200
|
-
width: 1920,
|
|
2201
|
-
height: 1080,
|
|
2202
|
-
facingMode: 'environment',
|
|
2203
|
-
};
|
|
2204
|
-
this.cameraReady = false;
|
|
2205
|
-
this.scanBlastData = [
|
|
2206
|
-
{
|
|
2207
|
-
title: 'scandoc.front',
|
|
2208
|
-
description: 'scandoc.frontDescription',
|
|
2209
|
-
side: 'FRONT',
|
|
2210
|
-
},
|
|
2211
|
-
{
|
|
2212
|
-
title: 'scandoc.back',
|
|
2213
|
-
description: 'scandoc.backDescription',
|
|
2214
|
-
disabled: true,
|
|
2215
|
-
side: 'BACK',
|
|
2216
|
-
},
|
|
2217
|
-
];
|
|
2218
|
-
this.error = false;
|
|
2219
|
-
this.scaning = false;
|
|
2220
|
-
this.documentTypeSelected = false;
|
|
2221
|
-
this.preview = null;
|
|
2222
|
-
this.scanDatas = [];
|
|
2223
|
-
this.trigger = new Subject();
|
|
2224
|
-
// switch to next / previous / specific webcam; true/false: forward/backwards, string: deviceId
|
|
2225
|
-
this.nextWebcam = new Subject();
|
|
2226
|
-
this.isMobile = false;
|
|
2227
|
-
}
|
|
2228
|
-
ngOnInit() {
|
|
2229
|
-
this.__subs(this.layoutProvider.breakpoint$).subscribe((v) => {
|
|
2230
|
-
this.zone.run(() => {
|
|
2231
|
-
this.isMobile = !v.matches;
|
|
2232
|
-
setTimeout(() => {
|
|
2233
|
-
console.log('WTF');
|
|
2234
|
-
this.cd.detectChanges();
|
|
2235
|
-
}, 200);
|
|
2236
|
-
});
|
|
2237
|
-
console.log('MNOBILE', this.isMobile);
|
|
2238
|
-
});
|
|
2239
|
-
}
|
|
2240
|
-
get nextWebcamObservable() {
|
|
2241
|
-
return this.nextWebcam.asObservable();
|
|
2242
|
-
}
|
|
2243
|
-
cameraWasSwitched(deviceId) {
|
|
2244
|
-
console.log('[active device]', deviceId);
|
|
2245
|
-
// this.deviceId = deviceId;
|
|
2246
|
-
// this.cameraReady = true;
|
|
2247
|
-
// this.defaultDevice = deviceId;
|
|
2248
|
-
setTimeout(() => {
|
|
2249
|
-
this.onResize();
|
|
2250
|
-
// this.scan();
|
|
2251
|
-
}, 300);
|
|
2252
|
-
}
|
|
2253
|
-
handleInitError(error) {
|
|
2254
|
-
console.log(error);
|
|
2255
|
-
}
|
|
2256
|
-
resolutionLimit(file) {
|
|
2257
|
-
const minWidth = 1280;
|
|
2258
|
-
const minHeight = 720;
|
|
2259
|
-
return new Observable((observer) => {
|
|
2260
|
-
const img = new Image();
|
|
2261
|
-
img.src = window.URL.createObjectURL(file);
|
|
2262
|
-
img.onload = () => {
|
|
2263
|
-
const width = img.naturalWidth;
|
|
2264
|
-
const height = img.naturalHeight;
|
|
2265
|
-
let valid = false;
|
|
2266
|
-
if (width > height) {
|
|
2267
|
-
valid = width >= minWidth && height >= minHeight;
|
|
2268
|
-
}
|
|
2269
|
-
else {
|
|
2270
|
-
valid = width >= minHeight && height >= minWidth;
|
|
2271
|
-
}
|
|
2272
|
-
observer.next(valid);
|
|
2273
|
-
};
|
|
2274
|
-
img.onerror = (error) => {
|
|
2275
|
-
observer.error(error);
|
|
2276
|
-
};
|
|
2277
|
-
});
|
|
2278
|
-
}
|
|
2279
|
-
getImgBase64(num) {
|
|
2280
|
-
return this.scanBlastData[num].image.dataUrl.split(',')[1];
|
|
2281
|
-
}
|
|
2282
|
-
getBase64(file) {
|
|
2283
|
-
return new Observable((observer) => {
|
|
2284
|
-
const reader = new FileReader();
|
|
2285
|
-
reader.readAsDataURL(file);
|
|
2286
|
-
reader.onload = () => {
|
|
2287
|
-
observer.next(reader.result);
|
|
2288
|
-
};
|
|
2289
|
-
reader.onerror = (error) => {
|
|
2290
|
-
observer.error(error);
|
|
2291
|
-
};
|
|
2292
|
-
});
|
|
2293
|
-
}
|
|
2294
|
-
handleFileInput(target, event, side) {
|
|
2295
|
-
const files = target.files;
|
|
2296
|
-
this.selectedSide = side;
|
|
2297
|
-
console.log(files);
|
|
2298
|
-
const file = files.item(0);
|
|
2299
|
-
this.resolutionLimit(file)
|
|
2300
|
-
.pipe(switchMap$1((valid) => {
|
|
2301
|
-
return valid ? this.getBase64(file) : of(false);
|
|
2302
|
-
}))
|
|
2303
|
-
.subscribe((imageAsDataUrl) => {
|
|
2304
|
-
// console.log(imageAsDataUrl);
|
|
2305
|
-
event.target.value = null;
|
|
2306
|
-
if (!imageAsDataUrl) {
|
|
2307
|
-
console.warn('MIN RES');
|
|
2308
|
-
// this.dialogs.alert(
|
|
2309
|
-
// 'core.page.error',
|
|
2310
|
-
// this.translate.instant(
|
|
2311
|
-
// 'pms.dialogs.components.scanProfile.minResolution'
|
|
2312
|
-
// )
|
|
2313
|
-
// );
|
|
2314
|
-
}
|
|
2315
|
-
else {
|
|
2316
|
-
side.image = {
|
|
2317
|
-
_imageAsDataUrl: imageAsDataUrl,
|
|
2318
|
-
imageAsDataUrl: imageAsDataUrl,
|
|
2319
|
-
};
|
|
2320
|
-
if (this.selectedSide.side === 'FRONT') {
|
|
2321
|
-
this.scanBlastData[1].disabled = false;
|
|
2322
|
-
}
|
|
2323
|
-
}
|
|
2324
|
-
this.cd.detectChanges();
|
|
2325
|
-
});
|
|
2326
|
-
}
|
|
2327
|
-
cameraOff(ev) { }
|
|
2328
|
-
ngOnDestroy() { }
|
|
2329
|
-
singleScan(side) {
|
|
2330
|
-
this.scanType = side.side;
|
|
2331
|
-
this.preview = null;
|
|
2332
|
-
this.selectedSide = side;
|
|
2333
|
-
this.selectedSide.image = null;
|
|
2334
|
-
this.documentTypeSelected = true;
|
|
2335
|
-
this.scanBlastData[1].disabled = false;
|
|
2336
|
-
this.cameraProvider.$showSwitch.next(true);
|
|
2337
|
-
this.cd.detectChanges();
|
|
2338
|
-
setTimeout(() => {
|
|
2339
|
-
this.onResize();
|
|
2340
|
-
}, 10);
|
|
2341
|
-
}
|
|
2342
|
-
scanBlastFinish() {
|
|
2343
|
-
this.action.emit(this.scanBlastData);
|
|
2344
|
-
}
|
|
2345
|
-
get scanBlastCanUpload() {
|
|
2346
|
-
return this.scanBlastData[0].image ? true : false;
|
|
2347
|
-
}
|
|
2348
|
-
handleImage(webcamImage) {
|
|
2349
|
-
console.log('[received webcam image]', webcamImage);
|
|
2350
|
-
this.webcamImage = webcamImage;
|
|
2351
|
-
this.preview = webcamImage.imageAsDataUrl;
|
|
2352
|
-
this.cameraProvider.$showSwitch.next(false);
|
|
2353
|
-
this.cd.detectChanges();
|
|
2354
|
-
}
|
|
2355
|
-
continue() {
|
|
2356
|
-
this.documentTypeSelected = false;
|
|
2357
|
-
setTimeout(() => {
|
|
2358
|
-
this.selectedSide.image = this.webcamImage;
|
|
2359
|
-
if (this.selectedSide.side === 'FRONT') {
|
|
2360
|
-
this.scanBlastData[1].disabled = false;
|
|
2361
|
-
}
|
|
2362
|
-
this.cd.detectChanges();
|
|
2363
|
-
}, 200);
|
|
2364
|
-
}
|
|
2365
|
-
retry() {
|
|
2366
|
-
this.preview = false;
|
|
2367
|
-
this.cameraProvider.$showSwitch.next(true);
|
|
2368
|
-
// this.result = false;
|
|
2369
|
-
if (this.error) {
|
|
2370
|
-
this.documentTypeSelected = false;
|
|
2371
|
-
this.scanBlastData.forEach((element) => {
|
|
2372
|
-
element.image = null;
|
|
2373
|
-
});
|
|
2374
|
-
}
|
|
2375
|
-
this.error = false;
|
|
2376
|
-
}
|
|
2377
|
-
triggerSnapshot() {
|
|
2378
|
-
this.trigger.next(0);
|
|
2379
|
-
}
|
|
2380
|
-
scan() {
|
|
2381
|
-
console.log('SCAN');
|
|
2382
|
-
this.triggerSnapshot();
|
|
2383
|
-
this.scanDatas[0] = true;
|
|
2384
|
-
console.log(this.cameraProvider);
|
|
2385
|
-
this.cd.detectChanges();
|
|
2386
|
-
}
|
|
2387
|
-
rotateBase64Image(base64data) {
|
|
2388
|
-
return new Observable((observer) => {
|
|
2389
|
-
const canvas = document.createElement('canvas');
|
|
2390
|
-
const ctx = canvas.getContext('2d');
|
|
2391
|
-
var image = new Image();
|
|
2392
|
-
image.src = base64data;
|
|
2393
|
-
image.onload = () => {
|
|
2394
|
-
console.log(canvas);
|
|
2395
|
-
canvas.width = image.height;
|
|
2396
|
-
canvas.height = image.width;
|
|
2397
|
-
if (ctx) {
|
|
2398
|
-
ctx.rotate((90 * Math.PI) / 180);
|
|
2399
|
-
ctx.translate(0, -canvas.width);
|
|
2400
|
-
ctx.drawImage(image, 0, 0);
|
|
2401
|
-
observer.next(canvas.toDataURL());
|
|
2402
|
-
}
|
|
2403
|
-
else {
|
|
2404
|
-
observer.error({ type: 'generic error' });
|
|
2405
|
-
}
|
|
2406
|
-
};
|
|
2407
|
-
image.onerror = (e) => {
|
|
2408
|
-
observer.error(e);
|
|
2409
|
-
};
|
|
2410
|
-
});
|
|
2411
|
-
}
|
|
2412
|
-
singleScanRotate(side) {
|
|
2413
|
-
console.log(side);
|
|
2414
|
-
this.rotateBase64Image(side.image.imageAsDataUrl).subscribe((data) => {
|
|
2415
|
-
side.image = { imageAsDataUrl: data };
|
|
2416
|
-
this.cd.detectChanges();
|
|
2417
|
-
});
|
|
2418
|
-
}
|
|
2419
|
-
videoReady(event) {
|
|
2420
|
-
console.log('READY', event);
|
|
2421
|
-
this.cameraReady = event;
|
|
2422
|
-
}
|
|
2423
|
-
singleScanRemove(side) {
|
|
2424
|
-
side.image = null;
|
|
2425
|
-
if (side.side === 'FRONT') {
|
|
2426
|
-
this.scanBlastData[1].disabled = true;
|
|
2427
|
-
}
|
|
2428
|
-
this.cd.detectChanges();
|
|
2429
|
-
}
|
|
2430
|
-
}
|
|
2431
|
-
ManualScanComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ManualScanComponent, deps: [{ token: NgxScandocCameraProvider }, { token: i0.ChangeDetectorRef }, { token: LayoutProvider }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
2432
|
-
ManualScanComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ManualScanComponent, selector: "ngx-manual-scan", outputs: { action: "action" }, 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: "\n\n<ng-container *ngIf=\"!result\">\n\n<ng-container *ngIf=\"!documentTypeSelected\">\n <section\n class=\"scanBlastWraper\"\n ngClass.lt-md=\"mobile\"\n fxFlex\n fxLayout=\"column\"\n >\n <div class=\"scanBlast\" fxFlex fxLayout.lt-md=\"column\" fxLayout=\"row\">\n <mat-card\n appearance=\"outlined\"\n style=\"display: flex; flex-direction: column\"\n fxLayout=\"column\"\n *ngFor=\"let side of scanBlastData\"\n >\n <div ngClass.lt-sm=\"small\" class=\"head\">\n <div class=\"title\" fxFlex>{{ side.title | translate }}</div>\n </div>\n <div class=\"actions\" style=\"display: flex; flex-direction: row\">\n <button\n (click)=\"singleScan(side)\"\n [disabled]=\"side.disabled\"\n style=\"margin-right: 4px\"\n mat-raised-button\n >\n <div class=\"buttonWrap\">\n <mat-icon>camera</mat-icon>\n <div>\n {{ \"scandoc.scanCamera\" | translate }}\n </div>\n </div>\n </button>\n <button\n (click)=\"file.click()\"\n [disabled]=\"side.disabled\"\n style=\"margin-left: 4px\"\n mat-raised-button\n >\n <input\n accept=\"image/*\"\n type=\"file\"\n style=\"display: none\"\n (change)=\"handleFileInput($event.target, $event, side)\"\n #file\n />\n <div class=\"buttonWrap\">\n <mat-icon>file_upload</mat-icon>\n <div>\n {{ \"scandoc.useFromDisk\" | translate }}\n </div>\n </div>\n </button>\n </div>\n <div class=\"content\" style=\"display: flex\">\n <div style=\"flex: 1\" class=\"previewPlaceholder\">\n <div class=\"description\">\n <ng-container *ngIf=\"side.image\">\n <div class=\"imgWrap\">\n <div\n style=\"flex: 1\"\n class=\"image\"\n [style.background-image]=\"\n 'url(' + side.image.imageAsDataUrl + ')'\n \"\n ></div>\n\n <div\n class=\"btnActions\"\n fxLayout.lt-md=\"column\"\n fxLayout=\"row\"\n style=\"display: flex; flex-direction: row\"\n >\n <button\n (click)=\"singleScanRemove(side)\"\n class=\"mr-4 remButton flex\"\n mat-raised-button\n >\n <div class=\"buttonWrap\">\n <mat-icon>delete</mat-icon>\n <div class=\"label\">\n {{ \"scandoc.remove\" | translate }}\n </div>\n </div>\n </button>\n <button\n class=\"ml-4 rotateButton flex\"\n mat-raised-button\n (click)=\"singleScanRotate(side)\"\n >\n <div class=\"buttonWrap\">\n <mat-icon>rotate_90_degrees_cw</mat-icon>\n <div class=\"label\">\n {{ \"scandoc.rotate\" | translate }}\n </div>\n </div>\n </button>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"!side.image\">\n <div class=\"empty\">\n {{ side.description | translate }}\n </div>\n </ng-container>\n </div>\n </div>\n </div>\n </mat-card>\n </div>\n <footer>\n <div\n class=\"px-8 pb-8\"\n style=\"padding: 0px 8px 8px 8px; display: flex; flex-direction: row\"\n >\n <button\n (click)=\"scanBlastFinish()\"\n [disabled]=\"!scanBlastCanUpload\"\n style=\"flex: 1\"\n mat-raised-button\n >\n {{ \"scandoc.upload\" | translate }}\n </button>\n </div>\n </footer>\n </section>\n</ng-container>\n\n<div\n style=\"position: relative; display: flex; flex-direction: column; flex: 1\"\n *ngIf=\"documentTypeSelected\"\n>\n <div\n style=\"display: flex; flex-direction: row; flex: 1\"\n #wraper\n class=\"wraper\"\n >\n <div\n style=\"\n position: absolute;\n top: 0px;\n left: 0px;\n right: 0px;\n bottom: 0px;\n z-index: 20;\n background-color: whitesmoke;\n \"\n *ngIf=\"!cameraReady && !preview\"\n >\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 flex\"\n\n #webcam\n [trigger]=\"trigger\"\n (imageCapture)=\"handleImage($event)\"\n(videoReady)=\"videoReady($event)\"\n (cameraSwitched)=\"cameraWasSwitched($event)\"\n (initError)=\"handleInitError($event)\"\n type=\"manual\"\n\n (destroyed)=\"cameraOff($event)\"\n >\n </ngx-scandoc-webcam>\n </ng-container>\n <div\n class=\"previewData\"\n *ngIf=\"preview\"\n style=\"\n display: flex;\n flex-direction: row;\n flex: 1;\n z-index: 20;\n position: absolute;\n width: 100%;\n height: 100%;\n \"\n >\n <div class=\"p-16 error\" *ngIf=\"error\">\n <div>\n <div class=\"title\" fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <mat-icon>error_outline</mat-icon\n ><span class=\"ml-8\">{{\n \"pms.dialogs.components.scanProfile.unableToDetectId\" | translate\n }}</span>\n </div>\n\n <ul>\n <li>\n {{\n \"pms.dialogs.components.scanProfile.placeIdCloseToDevice\"\n | translate\n }}\n </li>\n <li>\n {{\n \"pms.dialogs.components.scanProfile.ensureSufficientLight\"\n | translate\n }}\n </li>\n <li>\n {{\n \"pms.dialogs.components.scanProfile.holdDocumentSteady\"\n | translate\n }}\n </li>\n <li>\n {{\n \"pms.dialogs.components.scanProfile.makeSureAllEdgesOfTheIdAreVisible\"\n | translate\n }}\n </li>\n <li>\n {{\n \"pms.dialogs.components.scanProfile.makeSureThereAreNoGlareAndShadowsOnTheId\"\n | translate\n }}\n </li>\n </ul>\n </div>\n </div>\n\n <div\n class=\"scanPreview\"\n style=\"display: flex; flex-direction: column; flex: 1\"\n *ngIf=\"!error && !scaning\"\n >\n <!-- <div class=\"py-16\" style=\"font-size: 16px\">\n {{\n \"pms.dialogs.components.scanProfile.ensureAllTextsAreVisible\"\n | translate\n }}\n </div> -->\n <div\n style=\"flex: 1\"\n class=\"image\"\n [style.background-image]=\"'url(' + preview + ')'\"\n ></div>\n </div>\n </div>\n </div>\n\n <footer fxLayout=\"row\" class=\"p-8\">\n <!-- <div class=\"displayInfo\" *ngIf=\"!preview && cameraReady\">\n {{ displayInfo }}\n </div>\n <div style=\"height: 26px;\">\n <div style=\"text-align: center; font-size: 18px;\" *ngIf=\"idScan && !preview && cameraReady\">\n <ng-container *ngIf=\"idScan === 'BACK'\">\n Turn document and:\n {{ \"pms.dialogs.components.scanProfile.captureBack\" | translate }}\n </ng-container>\n <ng-container *ngIf=\"idScan === 'FRONT'\">\n Turn document and:\n {{ \"pms.dialogs.components.scanProfile.captureFront\" | translate }}\n </ng-container>\n </div>\n </div> -->\n\n <button\n [disabled]=\"!cameraReady\"\n class=\"w-100-p\"\n *ngIf=\"!preview\"\n mat-raised-button\n (click)=\"scan()\"\n >\n <ng-container>\n <ng-container *ngIf=\"scanType === 'FRONT'\">{{\n \"scandoc.captureFront\" | translate\n }}</ng-container>\n <ng-container *ngIf=\"scanType === 'BACK'\">{{\n \"scandoc.captureBack\" | translate\n }}</ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"scanSide === 1\">{{\n \"pms.dialogs.components.scanProfile.captureBackOfId\" | translate\n }}</ng-container>\n </button>\n\n <div\n class=\"w-100-p\"\n *ngIf=\"preview\"\n style=\"display: flex; flex-direction: row; align-items: center; flex: 1\"\n >\n <button class=\"flex mr-4\" mat-raised-button (click)=\"retry()\">\n {{ \"scandoc.retry\" | translate }}\n </button>\n\n <button\n [disabled]=\"error\"\n class=\"ml-4 flex\"\n mat-raised-button\n (click)=\"continue()\"\n >\n {{ \"scandoc.continueWithSelectedImage\" | translate }}\n </button>\n </div>\n </footer>\n</div>\n</ng-container>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1;background-color:#f5f5f5}:host.mobile .buttonWrap div{font-size:11px!important}:host.mobile .scanBlastWraper .head{height:30px!important}:host.mobile .scanBlastWraper .head .title{font-size:12px!important}:host.mobile .scanBlastWraper .scanBlast{flex-direction:column}:host.mobile .scanBlastWraper mat-card{margin:4px!important}:host.mobile .scanBlastWraper .description{flex-direction:row!important}:host.mobile .scanBlastWraper .description .imgWrap{padding:0!important}:host.mobile .scanBlastWraper .description .btnActions{position:absolute;right:0}:host.mobile .scanBlastWraper .description button{margin:0!important;position:absolute;right:16px}:host.mobile .scanBlastWraper .description button.rotateButton{top:58px}:host.mobile .scanBlastWraper .description button.remButton{top:8px}:host.mobile .scanBlastWraper .description button mat-icon{margin:0!important}:host.mobile .scanBlastWraper .description button div.label{display:none}.page-header{display:flex;flex-direction:row;align-items:center}.page-header button{height:100%}.debug{position:absolute;left:0;width:100%;height:80px;top:0;border-bottom:1px solid #ccc;background-color:#f8f8f8;display:flex;overflow:hidden;color:#000}.debug img{height:50px;border:1px solid #000}.displayInfo{text-align:center;height:20px;flex:1;position:absolute;width:100%;background-color:#000;height:30px;bottom:55px;left:0;line-height:30px;color:#fff;z-index:200}.element{margin-bottom:8px}.element label{font-size:14px}.element div{font-size:18px}.wraper{position:relative;overflow:hidden}.preview{width:100%;border-radius:1%}.documentTypeWraper{width:400px}.documentTypeWraper .label{font-size:14px;margin-bottom:20px}.documentTypeWraper button{box-shadow:none}.overPane{position:absolute;width:100%;height:100%;top:0;left:0}.overPane app-webcam{clip-path:url(#myClip)}.subhead{height:55px;padding-top:8px}.rectangle{z-index:2;position:absolute;top:50%;left:50%;width:85.6mm;height:53.98mm;transform:translate(-50%,-50%);box-sizing:border-box;border:2px dashed #459be5;border-radius:3mm}.mask{z-index:1;position:absolute;width:100%;height:100%;background-position:center center;background-size:380mm;background-repeat:no-repeat}.label{font-size:11px;margin-top:4px}footer button{box-shadow:none!important;height:45px;min-height:45px;text-transform:uppercase}h4{font-size:16px}.images .title{padding:8px 0;font-weight:600}.images img{margin-bottom:16px}.error .title{font-size:22px}.error ul{font-size:18px}.photo{width:120px;height:120px;overflow:hidden}.signature{width:200px}mat-card{box-shadow:none!important}.scanBlastWraper{overflow:hidden;display:flex;flex-direction:column;flex:1}.scanBlastWraper button{text-transform:uppercase;overflow:hidden}.scanBlastWraper .buttonWrap{display:flex;flex-direction:row;align-items:center;justify-content:center}.scanBlast{display:flex;flex-direction:row;flex:1;padding:0 4px}.scanBlast mat-card{padding:0;box-shadow:none;margin:8px 4px;flex:1}.scanBlast mat-card .head{display:flex;flex-direction:row;align-items:center;justify-items:center;border-bottom:1px solid rgba(0,0,0,.12);height:60px;padding:8px}.scanBlast mat-card .head.small{height:30px!important;padding:4px 8px!important}.scanBlast mat-card .head.small .title{font-size:12px!important;margin-left:4px!important}.scanBlast mat-card .head button{max-width:120px;height:40px;box-shadow:none;border:1px solid rgba(0,0,0,.12)}.scanBlast mat-card .head .title{margin-left:16px;color:#459ae5;font-size:16px}.scanBlast mat-card .content{margin:8px;flex:1}.scanBlast mat-card .description{text-align:center;color:#888}.scanBlast mat-card .actions{background-color:#e9e9e9;display:flex;flex-direction:row}.scanBlast mat-card .actions .mat-button-disabled{background-color:#fff!important}.scanBlast mat-card .actions button{box-shadow:none;width:50%;margin:8px;height:40px;font-size:12px}.scanBlast mat-card .actions button mat-icon{margin-right:8px}.scanBlast mat-card .previewPlaceholder{flex:1;border-radius:6px;display:flex;flex-direction:column}.scanBlast mat-card .previewPlaceholder .description{display:flex;flex:1;flex-direction:column;justify-content:center}.scanBlast mat-card .previewPlaceholder button{box-shadow:none;margin-top:8px;height:40px;font-size:12px}.scanBlast mat-card .previewPlaceholder button mat-icon{margin-right:8px}.scanBlast mat-card .previewPlaceholder .imgWrap{flex-direction:column;flex:1;display:flex;padding:8px;background-color:#f5f5f5;border-radius:4px}.scanBlast mat-card .previewPlaceholder .imgWrap img{width:100%;border-radius:4px}.scanBlast mat-card .previewPlaceholder .imgWrap .image{background-position:center;background-repeat:no-repeat;background-size:contain}.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}.result{display:flex;flex-direction:column}.result .wrap{overflow:auto;flex:1;display:flex;flex-direction:row}.result .wrap .panel{flex:1}.result .wrap form{display:flex;flex-direction:row;padding:0 16px;width:100%}.result .wrap form formly-form{flex:1}.flex{flex:1}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: WebcamComponent, selector: "ngx-scandoc-webcam", inputs: ["imageHandler", "type", "trigger"], outputs: ["cameraSwitched", "videoReady", "imageCapture", "initError"] }, { kind: "component", type: i6.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i8.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] });
|
|
2433
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ManualScanComponent, decorators: [{
|
|
2434
|
-
type: Component,
|
|
2435
|
-
args: [{ selector: 'ngx-manual-scan', template: "\n\n<ng-container *ngIf=\"!result\">\n\n<ng-container *ngIf=\"!documentTypeSelected\">\n <section\n class=\"scanBlastWraper\"\n ngClass.lt-md=\"mobile\"\n fxFlex\n fxLayout=\"column\"\n >\n <div class=\"scanBlast\" fxFlex fxLayout.lt-md=\"column\" fxLayout=\"row\">\n <mat-card\n appearance=\"outlined\"\n style=\"display: flex; flex-direction: column\"\n fxLayout=\"column\"\n *ngFor=\"let side of scanBlastData\"\n >\n <div ngClass.lt-sm=\"small\" class=\"head\">\n <div class=\"title\" fxFlex>{{ side.title | translate }}</div>\n </div>\n <div class=\"actions\" style=\"display: flex; flex-direction: row\">\n <button\n (click)=\"singleScan(side)\"\n [disabled]=\"side.disabled\"\n style=\"margin-right: 4px\"\n mat-raised-button\n >\n <div class=\"buttonWrap\">\n <mat-icon>camera</mat-icon>\n <div>\n {{ \"scandoc.scanCamera\" | translate }}\n </div>\n </div>\n </button>\n <button\n (click)=\"file.click()\"\n [disabled]=\"side.disabled\"\n style=\"margin-left: 4px\"\n mat-raised-button\n >\n <input\n accept=\"image/*\"\n type=\"file\"\n style=\"display: none\"\n (change)=\"handleFileInput($event.target, $event, side)\"\n #file\n />\n <div class=\"buttonWrap\">\n <mat-icon>file_upload</mat-icon>\n <div>\n {{ \"scandoc.useFromDisk\" | translate }}\n </div>\n </div>\n </button>\n </div>\n <div class=\"content\" style=\"display: flex\">\n <div style=\"flex: 1\" class=\"previewPlaceholder\">\n <div class=\"description\">\n <ng-container *ngIf=\"side.image\">\n <div class=\"imgWrap\">\n <div\n style=\"flex: 1\"\n class=\"image\"\n [style.background-image]=\"\n 'url(' + side.image.imageAsDataUrl + ')'\n \"\n ></div>\n\n <div\n class=\"btnActions\"\n fxLayout.lt-md=\"column\"\n fxLayout=\"row\"\n style=\"display: flex; flex-direction: row\"\n >\n <button\n (click)=\"singleScanRemove(side)\"\n class=\"mr-4 remButton flex\"\n mat-raised-button\n >\n <div class=\"buttonWrap\">\n <mat-icon>delete</mat-icon>\n <div class=\"label\">\n {{ \"scandoc.remove\" | translate }}\n </div>\n </div>\n </button>\n <button\n class=\"ml-4 rotateButton flex\"\n mat-raised-button\n (click)=\"singleScanRotate(side)\"\n >\n <div class=\"buttonWrap\">\n <mat-icon>rotate_90_degrees_cw</mat-icon>\n <div class=\"label\">\n {{ \"scandoc.rotate\" | translate }}\n </div>\n </div>\n </button>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"!side.image\">\n <div class=\"empty\">\n {{ side.description | translate }}\n </div>\n </ng-container>\n </div>\n </div>\n </div>\n </mat-card>\n </div>\n <footer>\n <div\n class=\"px-8 pb-8\"\n style=\"padding: 0px 8px 8px 8px; display: flex; flex-direction: row\"\n >\n <button\n (click)=\"scanBlastFinish()\"\n [disabled]=\"!scanBlastCanUpload\"\n style=\"flex: 1\"\n mat-raised-button\n >\n {{ \"scandoc.upload\" | translate }}\n </button>\n </div>\n </footer>\n </section>\n</ng-container>\n\n<div\n style=\"position: relative; display: flex; flex-direction: column; flex: 1\"\n *ngIf=\"documentTypeSelected\"\n>\n <div\n style=\"display: flex; flex-direction: row; flex: 1\"\n #wraper\n class=\"wraper\"\n >\n <div\n style=\"\n position: absolute;\n top: 0px;\n left: 0px;\n right: 0px;\n bottom: 0px;\n z-index: 20;\n background-color: whitesmoke;\n \"\n *ngIf=\"!cameraReady && !preview\"\n >\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 flex\"\n\n #webcam\n [trigger]=\"trigger\"\n (imageCapture)=\"handleImage($event)\"\n(videoReady)=\"videoReady($event)\"\n (cameraSwitched)=\"cameraWasSwitched($event)\"\n (initError)=\"handleInitError($event)\"\n type=\"manual\"\n\n (destroyed)=\"cameraOff($event)\"\n >\n </ngx-scandoc-webcam>\n </ng-container>\n <div\n class=\"previewData\"\n *ngIf=\"preview\"\n style=\"\n display: flex;\n flex-direction: row;\n flex: 1;\n z-index: 20;\n position: absolute;\n width: 100%;\n height: 100%;\n \"\n >\n <div class=\"p-16 error\" *ngIf=\"error\">\n <div>\n <div class=\"title\" fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <mat-icon>error_outline</mat-icon\n ><span class=\"ml-8\">{{\n \"pms.dialogs.components.scanProfile.unableToDetectId\" | translate\n }}</span>\n </div>\n\n <ul>\n <li>\n {{\n \"pms.dialogs.components.scanProfile.placeIdCloseToDevice\"\n | translate\n }}\n </li>\n <li>\n {{\n \"pms.dialogs.components.scanProfile.ensureSufficientLight\"\n | translate\n }}\n </li>\n <li>\n {{\n \"pms.dialogs.components.scanProfile.holdDocumentSteady\"\n | translate\n }}\n </li>\n <li>\n {{\n \"pms.dialogs.components.scanProfile.makeSureAllEdgesOfTheIdAreVisible\"\n | translate\n }}\n </li>\n <li>\n {{\n \"pms.dialogs.components.scanProfile.makeSureThereAreNoGlareAndShadowsOnTheId\"\n | translate\n }}\n </li>\n </ul>\n </div>\n </div>\n\n <div\n class=\"scanPreview\"\n style=\"display: flex; flex-direction: column; flex: 1\"\n *ngIf=\"!error && !scaning\"\n >\n <!-- <div class=\"py-16\" style=\"font-size: 16px\">\n {{\n \"pms.dialogs.components.scanProfile.ensureAllTextsAreVisible\"\n | translate\n }}\n </div> -->\n <div\n style=\"flex: 1\"\n class=\"image\"\n [style.background-image]=\"'url(' + preview + ')'\"\n ></div>\n </div>\n </div>\n </div>\n\n <footer fxLayout=\"row\" class=\"p-8\">\n <!-- <div class=\"displayInfo\" *ngIf=\"!preview && cameraReady\">\n {{ displayInfo }}\n </div>\n <div style=\"height: 26px;\">\n <div style=\"text-align: center; font-size: 18px;\" *ngIf=\"idScan && !preview && cameraReady\">\n <ng-container *ngIf=\"idScan === 'BACK'\">\n Turn document and:\n {{ \"pms.dialogs.components.scanProfile.captureBack\" | translate }}\n </ng-container>\n <ng-container *ngIf=\"idScan === 'FRONT'\">\n Turn document and:\n {{ \"pms.dialogs.components.scanProfile.captureFront\" | translate }}\n </ng-container>\n </div>\n </div> -->\n\n <button\n [disabled]=\"!cameraReady\"\n class=\"w-100-p\"\n *ngIf=\"!preview\"\n mat-raised-button\n (click)=\"scan()\"\n >\n <ng-container>\n <ng-container *ngIf=\"scanType === 'FRONT'\">{{\n \"scandoc.captureFront\" | translate\n }}</ng-container>\n <ng-container *ngIf=\"scanType === 'BACK'\">{{\n \"scandoc.captureBack\" | translate\n }}</ng-container>\n </ng-container>\n\n <ng-container *ngIf=\"scanSide === 1\">{{\n \"pms.dialogs.components.scanProfile.captureBackOfId\" | translate\n }}</ng-container>\n </button>\n\n <div\n class=\"w-100-p\"\n *ngIf=\"preview\"\n style=\"display: flex; flex-direction: row; align-items: center; flex: 1\"\n >\n <button class=\"flex mr-4\" mat-raised-button (click)=\"retry()\">\n {{ \"scandoc.retry\" | translate }}\n </button>\n\n <button\n [disabled]=\"error\"\n class=\"ml-4 flex\"\n mat-raised-button\n (click)=\"continue()\"\n >\n {{ \"scandoc.continueWithSelectedImage\" | translate }}\n </button>\n </div>\n </footer>\n</div>\n</ng-container>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1;background-color:#f5f5f5}:host.mobile .buttonWrap div{font-size:11px!important}:host.mobile .scanBlastWraper .head{height:30px!important}:host.mobile .scanBlastWraper .head .title{font-size:12px!important}:host.mobile .scanBlastWraper .scanBlast{flex-direction:column}:host.mobile .scanBlastWraper mat-card{margin:4px!important}:host.mobile .scanBlastWraper .description{flex-direction:row!important}:host.mobile .scanBlastWraper .description .imgWrap{padding:0!important}:host.mobile .scanBlastWraper .description .btnActions{position:absolute;right:0}:host.mobile .scanBlastWraper .description button{margin:0!important;position:absolute;right:16px}:host.mobile .scanBlastWraper .description button.rotateButton{top:58px}:host.mobile .scanBlastWraper .description button.remButton{top:8px}:host.mobile .scanBlastWraper .description button mat-icon{margin:0!important}:host.mobile .scanBlastWraper .description button div.label{display:none}.page-header{display:flex;flex-direction:row;align-items:center}.page-header button{height:100%}.debug{position:absolute;left:0;width:100%;height:80px;top:0;border-bottom:1px solid #ccc;background-color:#f8f8f8;display:flex;overflow:hidden;color:#000}.debug img{height:50px;border:1px solid #000}.displayInfo{text-align:center;height:20px;flex:1;position:absolute;width:100%;background-color:#000;height:30px;bottom:55px;left:0;line-height:30px;color:#fff;z-index:200}.element{margin-bottom:8px}.element label{font-size:14px}.element div{font-size:18px}.wraper{position:relative;overflow:hidden}.preview{width:100%;border-radius:1%}.documentTypeWraper{width:400px}.documentTypeWraper .label{font-size:14px;margin-bottom:20px}.documentTypeWraper button{box-shadow:none}.overPane{position:absolute;width:100%;height:100%;top:0;left:0}.overPane app-webcam{clip-path:url(#myClip)}.subhead{height:55px;padding-top:8px}.rectangle{z-index:2;position:absolute;top:50%;left:50%;width:85.6mm;height:53.98mm;transform:translate(-50%,-50%);box-sizing:border-box;border:2px dashed #459be5;border-radius:3mm}.mask{z-index:1;position:absolute;width:100%;height:100%;background-position:center center;background-size:380mm;background-repeat:no-repeat}.label{font-size:11px;margin-top:4px}footer button{box-shadow:none!important;height:45px;min-height:45px;text-transform:uppercase}h4{font-size:16px}.images .title{padding:8px 0;font-weight:600}.images img{margin-bottom:16px}.error .title{font-size:22px}.error ul{font-size:18px}.photo{width:120px;height:120px;overflow:hidden}.signature{width:200px}mat-card{box-shadow:none!important}.scanBlastWraper{overflow:hidden;display:flex;flex-direction:column;flex:1}.scanBlastWraper button{text-transform:uppercase;overflow:hidden}.scanBlastWraper .buttonWrap{display:flex;flex-direction:row;align-items:center;justify-content:center}.scanBlast{display:flex;flex-direction:row;flex:1;padding:0 4px}.scanBlast mat-card{padding:0;box-shadow:none;margin:8px 4px;flex:1}.scanBlast mat-card .head{display:flex;flex-direction:row;align-items:center;justify-items:center;border-bottom:1px solid rgba(0,0,0,.12);height:60px;padding:8px}.scanBlast mat-card .head.small{height:30px!important;padding:4px 8px!important}.scanBlast mat-card .head.small .title{font-size:12px!important;margin-left:4px!important}.scanBlast mat-card .head button{max-width:120px;height:40px;box-shadow:none;border:1px solid rgba(0,0,0,.12)}.scanBlast mat-card .head .title{margin-left:16px;color:#459ae5;font-size:16px}.scanBlast mat-card .content{margin:8px;flex:1}.scanBlast mat-card .description{text-align:center;color:#888}.scanBlast mat-card .actions{background-color:#e9e9e9;display:flex;flex-direction:row}.scanBlast mat-card .actions .mat-button-disabled{background-color:#fff!important}.scanBlast mat-card .actions button{box-shadow:none;width:50%;margin:8px;height:40px;font-size:12px}.scanBlast mat-card .actions button mat-icon{margin-right:8px}.scanBlast mat-card .previewPlaceholder{flex:1;border-radius:6px;display:flex;flex-direction:column}.scanBlast mat-card .previewPlaceholder .description{display:flex;flex:1;flex-direction:column;justify-content:center}.scanBlast mat-card .previewPlaceholder button{box-shadow:none;margin-top:8px;height:40px;font-size:12px}.scanBlast mat-card .previewPlaceholder button mat-icon{margin-right:8px}.scanBlast mat-card .previewPlaceholder .imgWrap{flex-direction:column;flex:1;display:flex;padding:8px;background-color:#f5f5f5;border-radius:4px}.scanBlast mat-card .previewPlaceholder .imgWrap img{width:100%;border-radius:4px}.scanBlast mat-card .previewPlaceholder .imgWrap .image{background-position:center;background-repeat:no-repeat;background-size:contain}.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}.result{display:flex;flex-direction:column}.result .wrap{overflow:auto;flex:1;display:flex;flex-direction:row}.result .wrap .panel{flex:1}.result .wrap form{display:flex;flex-direction:row;padding:0 16px;width:100%}.result .wrap form formly-form{flex:1}.flex{flex:1}\n"] }]
|
|
2436
|
-
}], ctorParameters: function () { return [{ type: NgxScandocCameraProvider }, { type: i0.ChangeDetectorRef }, { type: LayoutProvider }, { type: i0.NgZone }]; }, propDecorators: { action: [{
|
|
2437
|
-
type: Output
|
|
2438
|
-
}], wraper: [{
|
|
2439
|
-
type: ViewChild,
|
|
2440
|
-
args: ['wraper']
|
|
2441
|
-
}], class: [{
|
|
2442
|
-
type: HostBinding,
|
|
2443
|
-
args: ['class.mobile']
|
|
2444
|
-
}], onResize: [{
|
|
2445
|
-
type: HostListener,
|
|
2446
|
-
args: ['window:resize', ['$event']]
|
|
2447
|
-
}] } });
|
|
2448
|
-
|
|
2449
|
-
class ScanComponent extends BaseComponent {
|
|
2450
|
-
get class() {
|
|
2451
|
-
return this.isMobile;
|
|
2452
|
-
}
|
|
2453
|
-
onResize() {
|
|
2454
|
-
if (this.result) {
|
|
2455
|
-
this.cd.detectChanges();
|
|
2456
|
-
}
|
|
2457
|
-
}
|
|
2458
|
-
constructor(cd, zone, cameraProvider, injector, layoutProvider, platform, deviceService, auth // private api: ServerProvider
|
|
2459
|
-
) {
|
|
2460
|
-
super();
|
|
2461
|
-
this.cd = cd;
|
|
2462
|
-
this.zone = zone;
|
|
2463
|
-
this.cameraProvider = cameraProvider;
|
|
2464
|
-
this.injector = injector;
|
|
2465
|
-
this.layoutProvider = layoutProvider;
|
|
2466
|
-
this.platform = platform;
|
|
2467
|
-
this.deviceService = deviceService;
|
|
2468
|
-
this.auth = auth;
|
|
2469
|
-
this.scanBlastData = [
|
|
2470
|
-
{
|
|
2471
|
-
title: 'pms.dialogs.components.scanProfile.front',
|
|
2472
|
-
description: 'pms.dialogs.components.scanProfile.frontDescription',
|
|
2473
|
-
side: 'FRONT',
|
|
2474
|
-
},
|
|
2475
|
-
{
|
|
2476
|
-
title: 'pms.dialogs.components.scanProfile.back',
|
|
2477
|
-
description: 'pms.dialogs.components.scanProfile.backDescription',
|
|
2478
|
-
disabled: true,
|
|
2479
|
-
side: 'BACK',
|
|
2480
|
-
},
|
|
2481
|
-
];
|
|
2482
|
-
this.type = 'desktop';
|
|
2483
|
-
this.actions = new EventEmitter();
|
|
2484
|
-
this.scanResults = new Subject();
|
|
2485
|
-
this.scanSecondSide = false;
|
|
2486
|
-
this.startTime = 0;
|
|
2487
|
-
this.scanInProgress = false;
|
|
2488
|
-
// webcam snapshot trigger
|
|
2489
|
-
this.documentTypeSelected = false;
|
|
2490
|
-
this.preview = null;
|
|
2491
|
-
this.errorCode = '1000';
|
|
2492
|
-
this.displayInfo = 'scandoc.info.position';
|
|
2493
|
-
this.verificationErrorSent = false;
|
|
2494
|
-
this.error = false;
|
|
2495
|
-
this.cameraReady = false;
|
|
2496
|
-
this.scaning = false;
|
|
2497
|
-
this.promptManual = false;
|
|
2498
|
-
this.imageHandler = new Subject();
|
|
2499
|
-
this.manualDataSet = false;
|
|
2500
|
-
this.logData = {
|
|
2501
|
-
AcceptTermsAndConditions: true,
|
|
2502
|
-
Request: null,
|
|
2503
|
-
Response: null,
|
|
2504
|
-
ExpectedOutput: null,
|
|
2505
|
-
};
|
|
2506
|
-
this.blurValues = [];
|
|
2507
|
-
this.scanDatas = [];
|
|
2508
|
-
this.idScan = null;
|
|
2509
|
-
this.validation = false;
|
|
2510
|
-
this.scannedImages = [];
|
|
2511
|
-
this.scanDelay = 0;
|
|
2512
|
-
this.trigger = new Subject();
|
|
2513
|
-
// switch to next / previous / specific webcam; true/false: forward/backwards, string: deviceId
|
|
2514
|
-
this.nextWebcam = new Subject();
|
|
2515
|
-
this.imageVerified = false;
|
|
2516
|
-
this.form = new FormGroup({});
|
|
2517
|
-
this.manual = false;
|
|
2518
|
-
this.isMobile = this.platform.IOS || this.platform.ANDROID;
|
|
2519
|
-
this.showDialog = false;
|
|
2520
|
-
this.scanImageTimestamps = {
|
|
2521
|
-
time: 0,
|
|
2522
|
-
load: 0,
|
|
2523
|
-
};
|
|
2524
|
-
this.numberOfValidations = 0;
|
|
2525
|
-
this.validationDebug = [];
|
|
2526
|
-
this.scanProvider = this.injector.get(ScanProvider);
|
|
2527
|
-
if (!this.scanProvider.config.development) {
|
|
2528
|
-
// console = {
|
|
2529
|
-
// log: (...args: any) => {},
|
|
2530
|
-
// time: (...args: any) => {},
|
|
2531
|
-
// timeEnd: (...args: any) => {},
|
|
2532
|
-
// warn: (...args: any) => {},
|
|
2533
|
-
// error: (...args: any) => {},
|
|
2534
|
-
// };
|
|
2535
|
-
}
|
|
2536
|
-
}
|
|
2537
|
-
resetLogData() {
|
|
2538
|
-
this.logData = {
|
|
2539
|
-
Request: null,
|
|
2540
|
-
Response: null,
|
|
2541
|
-
ExpectedOutput: null,
|
|
2542
|
-
AcceptTermsAndConditions: true,
|
|
2543
|
-
};
|
|
2544
|
-
}
|
|
2545
|
-
init() {
|
|
2546
|
-
this.auth.accesToken.subscribe();
|
|
2547
|
-
this.resetLogData();
|
|
2548
|
-
// this.result=true;
|
|
2549
|
-
// this.result ={};
|
|
2550
|
-
console.log('INIT SCAN');
|
|
2551
|
-
}
|
|
2552
|
-
continue() {
|
|
2553
|
-
this.documentTypeSelected = false;
|
|
2554
|
-
setTimeout(() => {
|
|
2555
|
-
this.selectedSide.image = this.webcamImage;
|
|
2556
|
-
if (this.selectedSide.side === 'FRONT') {
|
|
2557
|
-
this.scanBlastData[1].disabled = false;
|
|
2558
|
-
}
|
|
2559
|
-
this.cd.detectChanges();
|
|
2560
|
-
}, 200);
|
|
2561
|
-
}
|
|
2562
|
-
scan() {
|
|
2563
|
-
this.trigger.next(new Date().getTime());
|
|
2564
|
-
}
|
|
2565
|
-
handleImage(webcamImage) {
|
|
2566
|
-
if (this.startTime === 0) {
|
|
2567
|
-
this.startTime = Date.now();
|
|
2568
|
-
}
|
|
2569
|
-
// console.log('[received webcam image]', webcamImage);
|
|
2570
|
-
this.zone.runOutsideAngular(() => {
|
|
2571
|
-
const time = new Date().getTime();
|
|
2572
|
-
if (this.scanImageTimestamps.load > 0) {
|
|
2573
|
-
const { load } = this.scanImageTimestamps;
|
|
2574
|
-
const diff = time - load;
|
|
2575
|
-
// console.log('time:', diff);
|
|
2576
|
-
this.scanDelay = diff;
|
|
2577
|
-
}
|
|
2578
|
-
this.scanImageTimestamps.load = time;
|
|
2579
|
-
if (webcamImage.imageAsDataUrl) {
|
|
2580
|
-
this.scannedImages.push(webcamImage);
|
|
2581
|
-
}
|
|
2582
|
-
this.cd.detectChanges();
|
|
2583
|
-
if (this.scannedImages.length > 0 && !this.validation) {
|
|
2584
|
-
// if (this.scanProvider.config.development) {
|
|
2585
|
-
// this.scannedImages.forEach((img) => {
|
|
2586
|
-
// const consoleBackground =
|
|
2587
|
-
// "font-size:100px;background-image: url('" +
|
|
2588
|
-
// img.imageResized +
|
|
2589
|
-
// "');background-size: contain; background-repeat: no-repeat;";
|
|
2590
|
-
// console.log('%c ', consoleBackground);
|
|
2591
|
-
// });
|
|
2592
|
-
// }
|
|
2593
|
-
// this.frontImage = webcamImage.imageResized;
|
|
2594
|
-
// console.timeEnd('scan');
|
|
2595
|
-
// console.time('scan');
|
|
2596
|
-
// get last 10
|
|
2597
|
-
// console.log('CAPTURED:', this.scannedImages.length);
|
|
2598
|
-
const images = this.scannedImages.slice(-5);
|
|
2599
|
-
// set images to 0
|
|
2600
|
-
this.scannedImages = [];
|
|
2601
|
-
const imagesArray = images.map((m) => m.imageResized.split(',')[1]);
|
|
2602
|
-
this.validation = true;
|
|
2603
|
-
// console.log('BURST');
|
|
2604
|
-
this.handleBurstData(imagesArray, images);
|
|
2605
|
-
}
|
|
2606
|
-
else {
|
|
2607
|
-
if (this.cameraReady) {
|
|
2608
|
-
this.scan();
|
|
2609
|
-
}
|
|
2610
|
-
}
|
|
2611
|
-
});
|
|
2612
|
-
}
|
|
2613
|
-
handleBurstData(imagesArray, images, type = 'plain') {
|
|
2614
|
-
this.__subs(this.scanProvider.burst(imagesArray, this.blurValues)).subscribe((resp) => {
|
|
2615
|
-
this.displayInfo = 'scandoc.info.c' + resp.InfoCode;
|
|
2616
|
-
// console.timeEnd('validationPOST');
|
|
2617
|
-
// console.log('AnalysisTime', resp.AnalysisTime);
|
|
2618
|
-
const { DocType, Series, Side, InfoCode, TransactionID } = resp;
|
|
2619
|
-
this.handleLongValidationError(TransactionID, images[0].imageAsDataUrl.split(',')[1]);
|
|
2620
|
-
// if (InfoCode === '1006' && this.idScan) {
|
|
2621
|
-
// this.handleLongVaylidationError(image);
|
|
2622
|
-
// }
|
|
2623
|
-
// console.warn(resp.Validated, this.numberOfValidations);
|
|
2624
|
-
if (resp.DetectedBlurValue) {
|
|
2625
|
-
this.blurValues.push(resp.DetectedBlurValue);
|
|
2626
|
-
}
|
|
2627
|
-
else {
|
|
2628
|
-
this.blurValues = [];
|
|
2629
|
-
}
|
|
2630
|
-
console.log();
|
|
2631
|
-
if (resp.Validated) {
|
|
2632
|
-
this.numberOfValidations++;
|
|
2633
|
-
this.validationDebug.push(resp);
|
|
2634
|
-
}
|
|
2635
|
-
else {
|
|
2636
|
-
this.numberOfValidations = 0;
|
|
2637
|
-
this.validationDebug = [];
|
|
2638
|
-
}
|
|
2639
|
-
if (resp.Validated) {
|
|
2640
|
-
this.displayInfo = '';
|
|
2641
|
-
// console.log('[SCANNED INDEX]', resp.Index);
|
|
2642
|
-
const selectedImage = images[resp.Index];
|
|
2643
|
-
// this.preview = this.webcamImage.imageAsDataUrl;
|
|
2644
|
-
this.cd.detectChanges();
|
|
2645
|
-
let image = selectedImage;
|
|
2646
|
-
console.warn(type);
|
|
2647
|
-
if (type == 'worker') {
|
|
2648
|
-
//const dataUrl = this.handleBitmapImage(selectedImage.bitmap);
|
|
2649
|
-
image = selectedImage.imageAsDataUrl;
|
|
2650
|
-
}
|
|
2651
|
-
if (InfoCode === '1007') {
|
|
2652
|
-
// For ID ask for other side
|
|
2653
|
-
if (Side === 'FRONT') {
|
|
2654
|
-
this.scanBlastData[0].image = image;
|
|
2655
|
-
}
|
|
2656
|
-
else {
|
|
2657
|
-
this.scanBlastData[1].image = image;
|
|
2658
|
-
}
|
|
2659
|
-
if (this.scanBlastData[0].image && this.scanBlastData[1].image) {
|
|
2660
|
-
// console.warn('UPLOAD');
|
|
2661
|
-
if (type == 'worker') {
|
|
2662
|
-
this.imageHandler.next({ type: 'stop' });
|
|
2663
|
-
}
|
|
2664
|
-
//console.warn('DEBUG', Side, this.validationDebug);
|
|
2665
|
-
this.scanBlastFinish();
|
|
2666
|
-
}
|
|
2667
|
-
else {
|
|
2668
|
-
this.blurValues = [];
|
|
2669
|
-
this.numberOfValidations = 0;
|
|
2670
|
-
// console.warn('DEBUG',Side,this.validationDebug)
|
|
2671
|
-
this.validationDebug = [];
|
|
2672
|
-
const num = Side === 'FRONT' ? 1 : 0;
|
|
2673
|
-
this.scanSecondSide = true;
|
|
2674
|
-
this.singleScan(this.scanBlastData[num]);
|
|
2675
|
-
this.idScan = this.scanBlastData[num].side;
|
|
2676
|
-
if (!this.showDialog) {
|
|
2677
|
-
this.showDialog = true;
|
|
2678
|
-
this.cd.detectChanges();
|
|
2679
|
-
}
|
|
2680
|
-
// reset manual scan popup interval
|
|
2681
|
-
this.verificationErrorSent = false;
|
|
2682
|
-
this.startTime = Date.now();
|
|
2683
|
-
this.displayInfo = 'scandoc.info.turn';
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
else {
|
|
2687
|
-
// console.warn('DEBUG', Side, this.validationDebug);
|
|
2688
|
-
this.scanBlastData[0].image = image;
|
|
2689
|
-
// console.warn('UPLOAD');
|
|
2690
|
-
if (type == 'worker') {
|
|
2691
|
-
this.imageHandler.next({ type: 'stop' });
|
|
2692
|
-
}
|
|
2693
|
-
this.scanBlastFinish();
|
|
2694
|
-
}
|
|
2695
|
-
this.scannedImages = [];
|
|
2696
|
-
// this.scanBlastData[0].image = selectedImage;
|
|
2697
|
-
//this.scanBlastFinish();
|
|
2698
|
-
}
|
|
2699
|
-
else {
|
|
2700
|
-
this.validation = false;
|
|
2701
|
-
this.scan();
|
|
2702
|
-
}
|
|
2703
|
-
});
|
|
2704
|
-
}
|
|
2705
|
-
closeDialog() {
|
|
2706
|
-
this.showDialog = false;
|
|
2707
|
-
this.validation = false;
|
|
2708
|
-
this.scan();
|
|
2709
|
-
}
|
|
2710
|
-
handleInitError(error) {
|
|
2711
|
-
console.log(error);
|
|
2712
|
-
}
|
|
2713
|
-
get scanBlastCanUpload() {
|
|
2714
|
-
return this.scanBlastData[0].image ? true : false;
|
|
2715
|
-
}
|
|
2716
|
-
manualMode(type = 'plain') {
|
|
2717
|
-
this.manual = true;
|
|
2718
|
-
this.promptManual = false;
|
|
2719
|
-
this.scanInProgress = false;
|
|
2720
|
-
this.cameraProvider.$showSwitch.next(false);
|
|
2721
|
-
this.cd.detectChanges();
|
|
2722
|
-
}
|
|
2723
|
-
handleExtractionError(data) {
|
|
2724
|
-
this.logData.ExpectedOutput = {};
|
|
2725
|
-
// if (this.logData.ExpectedOutput?._avatar) {
|
|
2726
|
-
// delete this.logData.ExpectedOutput._avatar;
|
|
2727
|
-
// }
|
|
2728
|
-
// this.scanProvider.sendLog(this.logData).subscribe();
|
|
2729
|
-
// console.log('LOG DATA', this.logData);
|
|
2730
|
-
// this.__subs(this.scanProvider.sendLog(this.logData)).subscribe();
|
|
2731
|
-
}
|
|
2732
|
-
sendErrorLog(TransactionID, image) {
|
|
2733
|
-
var _a;
|
|
2734
|
-
const { browser, os, device } = this.deviceService;
|
|
2735
|
-
const FrontImage = ((_a = this.scanBlastData[0]) === null || _a === void 0 ? void 0 : _a.image) ? this.getImgBase64(0) : null;
|
|
2736
|
-
const out = {
|
|
2737
|
-
OS: os,
|
|
2738
|
-
Device: device,
|
|
2739
|
-
Browser: browser,
|
|
2740
|
-
TransactionID,
|
|
2741
|
-
AcceptTermsAndConditions: true,
|
|
2742
|
-
FrontImage: FrontImage || image,
|
|
2743
|
-
BackImage: FrontImage ? image : '',
|
|
2744
|
-
};
|
|
2745
|
-
console.log(out);
|
|
2746
|
-
this.__subs(this.scanProvider.sendErrorLog(out)).subscribe();
|
|
2747
|
-
}
|
|
2748
|
-
handleLongValidationError(TransactionID, image) {
|
|
2749
|
-
// save current image after 10sec
|
|
2750
|
-
let MANUAL_INTERVAL = this.scanProvider.config.manualScanDelay;
|
|
2751
|
-
const diff = (Date.now() - this.startTime) / 1000;
|
|
2752
|
-
const showDialog = diff > MANUAL_INTERVAL;
|
|
2753
|
-
if (showDialog && !this.verificationErrorSent) {
|
|
2754
|
-
this.verificationErrorSent = true;
|
|
2755
|
-
console.warn('[HANDLE ERROR]');
|
|
2756
|
-
this.zone.run(() => {
|
|
2757
|
-
// if (!this.scanSecondSide) {
|
|
2758
|
-
if (this.scanProvider.config.manualModeEnabled) {
|
|
2759
|
-
this.promptManual = true;
|
|
2760
|
-
}
|
|
2761
|
-
if (this.scanProvider.config.errorLogging) {
|
|
2762
|
-
this.sendErrorLog(TransactionID, image);
|
|
2763
|
-
}
|
|
2764
|
-
// }
|
|
2765
|
-
this.startTime = Date.now();
|
|
2766
|
-
});
|
|
2767
|
-
// this.verificationErrorSent = true;
|
|
2768
|
-
// const dataUrl = this.handleBitmapImage(img.bitmap);
|
|
2769
|
-
// console.warn('SENT');
|
|
2770
|
-
// // this.displayInfo = 'Cant detect document!';
|
|
2771
|
-
// this.logData.Request = this.__subs(
|
|
2772
|
-
// this.scanProvider.sendLog({
|
|
2773
|
-
// AcceptTermsAndConditions: true,
|
|
2774
|
-
// ExpectedOutput: {},
|
|
2775
|
-
// Request: {
|
|
2776
|
-
// verification: dataUrl.split(',')[1],
|
|
2777
|
-
// },
|
|
2778
|
-
// Response: {
|
|
2779
|
-
// TransactionID: uuidv4(),
|
|
2780
|
-
// },
|
|
2781
|
-
// })
|
|
2782
|
-
// ).subscribe();
|
|
2783
|
-
}
|
|
2784
|
-
}
|
|
2785
|
-
ngAfterViewInit() {
|
|
2786
|
-
// this.result = true;
|
|
2787
|
-
this.cameraProvider.$showSwitch.next(true);
|
|
2788
|
-
this.cd.detectChanges();
|
|
2789
|
-
// this.scanResults.next({ type: 'model', data: {} });
|
|
2790
|
-
this.__subs(this.cameraProvider.webcamObservable).subscribe((resp) => {
|
|
2791
|
-
this.cameraReady = false;
|
|
2792
|
-
this.scanInProgress = false;
|
|
2793
|
-
this.scannedImages = [];
|
|
2794
|
-
});
|
|
2795
|
-
this.__subs(this.cameraProvider.selfie$).subscribe((resp) => {
|
|
2796
|
-
this.selfie();
|
|
2797
|
-
});
|
|
2798
|
-
this.autoScan();
|
|
2799
|
-
this.__subs(this.layoutProvider.breakpoint$).subscribe((v) => {
|
|
2800
|
-
this.isMobile = !v.matches || this.platform.IOS || this.platform.ANDROID;
|
|
2801
|
-
console.log('MNOBILE', this.isMobile);
|
|
2802
|
-
});
|
|
2803
|
-
}
|
|
2804
|
-
handleBitmapImage(bitmap) {
|
|
2805
|
-
const { width, height } = bitmap;
|
|
2806
|
-
const offscreenSmall = document.createElement('canvas');
|
|
2807
|
-
offscreenSmall.width = width;
|
|
2808
|
-
offscreenSmall.height = height;
|
|
2809
|
-
const ctx = offscreenSmall.getContext('bitmaprenderer');
|
|
2810
|
-
if (ctx) {
|
|
2811
|
-
ctx.imageSmoothingEnabled = false;
|
|
2812
|
-
ctx.transferFromImageBitmap(bitmap);
|
|
2813
|
-
bitmap.close();
|
|
2814
|
-
const data = ctx.canvas.toDataURL('image/jpeg');
|
|
2815
|
-
return data;
|
|
2816
|
-
}
|
|
2817
|
-
return null;
|
|
2818
|
-
}
|
|
2819
|
-
autoScan() {
|
|
2820
|
-
const side = this.scanBlastData[0];
|
|
2821
|
-
this.idScan = null;
|
|
2822
|
-
this.singleScan(side);
|
|
2823
|
-
}
|
|
2824
|
-
singleScan(side) {
|
|
2825
|
-
this.scanType = side.side;
|
|
2826
|
-
this.preview = null;
|
|
2827
|
-
this.selectedSide = side;
|
|
2828
|
-
this.selectedSide.image = null;
|
|
2829
|
-
this.documentTypeSelected = true;
|
|
2830
|
-
this.scanBlastData[1].disabled = false;
|
|
2831
|
-
this.cd.detectChanges();
|
|
2832
|
-
}
|
|
2833
|
-
manualScanData(data) {
|
|
2834
|
-
console.log(data);
|
|
2835
|
-
this.scanBlastData = data;
|
|
2836
|
-
this.manual = false;
|
|
2837
|
-
this.manualDataSet = true;
|
|
2838
|
-
this.scanBlastFinish();
|
|
2839
|
-
}
|
|
2840
|
-
getImgBase64(num) {
|
|
2841
|
-
console.log('GET 64');
|
|
2842
|
-
// if (this.manualDataSet) {
|
|
2843
|
-
return this.scanBlastData[num].image._imageAsDataUrl.split(',')[1];
|
|
2844
|
-
// }
|
|
2845
|
-
// return this.scanBlastData[num].image.dataUrl.split(',')[1];
|
|
2846
|
-
}
|
|
2847
|
-
scanBlastFinish() {
|
|
2848
|
-
const { browser, os, device } = this.deviceService;
|
|
2849
|
-
this.zone.run(() => {
|
|
2850
|
-
this.cameraProvider.$showSwitch.next(false);
|
|
2851
|
-
});
|
|
2852
|
-
console.time('upload');
|
|
2853
|
-
if (this.type === 'mobile') {
|
|
2854
|
-
this.actions.emit({ data: this.scanBlastData });
|
|
2855
|
-
this.retake();
|
|
2856
|
-
return;
|
|
2857
|
-
}
|
|
2858
|
-
this.idScan = null;
|
|
2859
|
-
// const loading = this.dialogs.loading();
|
|
2860
|
-
this.scaning = true;
|
|
2861
|
-
this.cd.detectChanges();
|
|
2862
|
-
console.time('payload');
|
|
2863
|
-
const payload = {
|
|
2864
|
-
AcceptTermsAndConditions: true,
|
|
2865
|
-
DataFields: {
|
|
2866
|
-
DeviceInfo: {
|
|
2867
|
-
OS: os,
|
|
2868
|
-
Device: device,
|
|
2869
|
-
Browser: browser,
|
|
2870
|
-
},
|
|
2871
|
-
FrontImageType: 'base64',
|
|
2872
|
-
FrontImageCropped: false,
|
|
2873
|
-
BackImageType: 'base64',
|
|
2874
|
-
BackImageCropped: false,
|
|
2875
|
-
FrontImage: this.getImgBase64(0),
|
|
2876
|
-
BackImage: this.scanBlastData[1].image ? this.getImgBase64(1) : null,
|
|
2877
|
-
},
|
|
2878
|
-
Settings: {
|
|
2879
|
-
ShouldValidate: true,
|
|
2880
|
-
ShouldReturnDocumentImage: true,
|
|
2881
|
-
ShouldReturnFaceIfDetected: true,
|
|
2882
|
-
SkipImageSizeCheck: true,
|
|
2883
|
-
CanStoreImages: this.scanProvider.canStoreImages,
|
|
2884
|
-
},
|
|
2885
|
-
// CallBackUrl: 'http://demo:5000/report/extracted/',
|
|
2886
|
-
};
|
|
2887
|
-
this.frontImage = 'data:image/jpeg;base64,' + payload.DataFields.FrontImage;
|
|
2888
|
-
this.backImage = 'data:image/jpeg;base64,' + payload.DataFields.BackImage;
|
|
2889
|
-
if (!this.scanBlastData[1].image) {
|
|
2890
|
-
payload.Settings.IgnoreBackImage = true;
|
|
2891
|
-
}
|
|
2892
|
-
this.logData.Request = JSON.parse(JSON.stringify(payload));
|
|
2893
|
-
console.timeEnd('payload');
|
|
2894
|
-
this.__subs(this.scanProvider.blastPost(payload).pipe(catchError((e) => {
|
|
2895
|
-
if (this.manualDataSet) {
|
|
2896
|
-
// console.warn('MANUAL DATA SET',e);
|
|
2897
|
-
this.logData.Response = JSON.parse(JSON.stringify(e.error));
|
|
2898
|
-
this.handleExtractionError({});
|
|
2899
|
-
}
|
|
2900
|
-
this.zone.run(() => {
|
|
2901
|
-
this.error = true;
|
|
2902
|
-
this.preview = true;
|
|
2903
|
-
this.cd.detectChanges();
|
|
2904
|
-
});
|
|
2905
|
-
// console.log('EEE', e);
|
|
2906
|
-
return e;
|
|
2907
|
-
}))).subscribe((data) => {
|
|
2908
|
-
var _a, _b, _c;
|
|
2909
|
-
//console.log(data);
|
|
2910
|
-
const results = data.Data;
|
|
2911
|
-
console.timeEnd('upload');
|
|
2912
|
-
console.time('parse');
|
|
2913
|
-
// data.InfoCode = '1001';
|
|
2914
|
-
console.time('p');
|
|
2915
|
-
this.logData.Response = JSON.parse(JSON.stringify(data));
|
|
2916
|
-
console.timeEnd('p');
|
|
2917
|
-
//loading.close();
|
|
2918
|
-
this.documentTypeSelected = true;
|
|
2919
|
-
this.scaning = false;
|
|
2920
|
-
if (data.InfoCode === '1001') {
|
|
2921
|
-
this.error = true;
|
|
2922
|
-
console.log('[ERROR] 1001');
|
|
2923
|
-
this.errorCode = '1001';
|
|
2924
|
-
// this.scanSide = 0;
|
|
2925
|
-
this.preview = true;
|
|
2926
|
-
this.cd.detectChanges();
|
|
2927
|
-
return;
|
|
2928
|
-
}
|
|
2929
|
-
if (data.InfoCode === '1002') {
|
|
2930
|
-
this.error = true;
|
|
2931
|
-
console.log('[ERROR] 1002');
|
|
2932
|
-
this.errorCode = '1002';
|
|
2933
|
-
// this.scanSide = 0;
|
|
2934
|
-
this.preview = true;
|
|
2935
|
-
this.cd.detectChanges();
|
|
2936
|
-
return;
|
|
2937
|
-
}
|
|
2938
|
-
if (results && data.Metadata.length > 0 && data.InfoCode === '1000') {
|
|
2939
|
-
// console.log('Extraction time', data.AnalysisTime);
|
|
2940
|
-
// this.zone.run(() => {
|
|
2941
|
-
// console.time('parseblast');
|
|
2942
|
-
const result = this.scanProvider.parseBlast(results);
|
|
2943
|
-
// console.timeEnd('parseblast');
|
|
2944
|
-
// console.log('RES', this.result);
|
|
2945
|
-
// this.cd.detectChanges();
|
|
2946
|
-
const model = result.model;
|
|
2947
|
-
if ((_a = data.ImageData) === null || _a === void 0 ? void 0 : _a.FaceImage) {
|
|
2948
|
-
model._avatar =
|
|
2949
|
-
'data:image/jpeg;base64,' + ((_b = data.ImageData) === null || _b === void 0 ? void 0 : _b.FaceImage);
|
|
2950
|
-
}
|
|
2951
|
-
if ((_c = data.ImageData) === null || _c === void 0 ? void 0 : _c.Documents) {
|
|
2952
|
-
const { Documents } = data.ImageData;
|
|
2953
|
-
model.images = Documents.map((image, i) => {
|
|
2954
|
-
return { data: 'data:image/jpeg;base64,' + Documents[i] };
|
|
2955
|
-
});
|
|
2956
|
-
}
|
|
2957
|
-
this.model = model;
|
|
2958
|
-
// console.log('MODEL', this.model);
|
|
2959
|
-
this.actions.emit({
|
|
2960
|
-
type: 'scanFinish',
|
|
2961
|
-
data: {
|
|
2962
|
-
model: this.model,
|
|
2963
|
-
images: this.images,
|
|
2964
|
-
results,
|
|
2965
|
-
},
|
|
2966
|
-
});
|
|
2967
|
-
if (!this.scanProvider.config.hideResults) {
|
|
2968
|
-
this.zone.run(() => {
|
|
2969
|
-
this.result = true;
|
|
2970
|
-
// console.time('ff');
|
|
2971
|
-
this.cd.detectChanges();
|
|
2972
|
-
this.scanResults.next({ type: 'model', data: model });
|
|
2973
|
-
// this.cd.detectChanges();
|
|
2974
|
-
// });
|
|
2975
|
-
// console.timeEnd('ff');
|
|
2976
|
-
});
|
|
2977
|
-
}
|
|
2978
|
-
}
|
|
2979
|
-
else {
|
|
2980
|
-
console.log('ERROR');
|
|
2981
|
-
if (this.manualDataSet) {
|
|
2982
|
-
this.handleExtractionError(data);
|
|
2983
|
-
}
|
|
2984
|
-
// this.scanSide = 0;
|
|
2985
|
-
this.zone.run(() => {
|
|
2986
|
-
this.error = true;
|
|
2987
|
-
this.preview = true;
|
|
2988
|
-
this.cd.detectChanges();
|
|
2989
|
-
});
|
|
2990
|
-
// this.documentTypeSelected = false;
|
|
2991
|
-
// this.retry();
|
|
2992
|
-
}
|
|
2993
|
-
// this.cd.detectChanges();
|
|
2994
|
-
console.timeEnd('parse');
|
|
2995
|
-
}, (err) => {
|
|
2996
|
-
// loading.close();
|
|
2997
|
-
// this.scanSide = 0;
|
|
2998
|
-
this.error = true;
|
|
2999
|
-
this.preview = true;
|
|
3000
|
-
this.documentTypeSelected = true;
|
|
3001
|
-
this.scaning = false;
|
|
3002
|
-
});
|
|
3003
|
-
}
|
|
3004
|
-
retry() {
|
|
3005
|
-
this.preview = false;
|
|
3006
|
-
this.validation = false;
|
|
3007
|
-
this.errorCode = '1000';
|
|
3008
|
-
this.result = false;
|
|
3009
|
-
this.idScan = null;
|
|
3010
|
-
this.cameraProvider.$showSwitch.next(true);
|
|
3011
|
-
if (this.error) {
|
|
3012
|
-
this.documentTypeSelected = false;
|
|
3013
|
-
this.scanBlastData.forEach((element) => {
|
|
3014
|
-
element.image = null;
|
|
3015
|
-
});
|
|
3016
|
-
}
|
|
3017
|
-
this.error = false;
|
|
3018
|
-
this.startTime = Date.now();
|
|
3019
|
-
this.autoScan();
|
|
3020
|
-
this.scan();
|
|
3021
|
-
this.cd.detectChanges();
|
|
3022
|
-
}
|
|
3023
|
-
retake() {
|
|
3024
|
-
this.validation = false;
|
|
3025
|
-
this.preview = false;
|
|
3026
|
-
this.error = false;
|
|
3027
|
-
this.result = false;
|
|
3028
|
-
this.scanSide = 0;
|
|
3029
|
-
this.cameraProvider.$showSwitch.next(true);
|
|
3030
|
-
this.imageVerified = false;
|
|
3031
|
-
this.scanDatas = [];
|
|
3032
|
-
this.scaning = false;
|
|
3033
|
-
this.images = [];
|
|
3034
|
-
this.scanInProgress = false;
|
|
3035
|
-
this.startTime = Date.now();
|
|
3036
|
-
this.idScan = null;
|
|
3037
|
-
this.documentTypeSelected = false;
|
|
3038
|
-
this.scanBlastData.forEach((m) => {
|
|
3039
|
-
m.image = null;
|
|
3040
|
-
});
|
|
3041
|
-
this.scanSecondSide = false;
|
|
3042
|
-
this.autoScan();
|
|
3043
|
-
this.cd.detectChanges();
|
|
3044
|
-
}
|
|
3045
|
-
use() {
|
|
3046
|
-
// save images??
|
|
3047
|
-
// if (this.scanProvider.config.sendLog) {
|
|
3048
|
-
// this.logData.ExpectedOutput = JSON.parse(JSON.stringify(this.model));
|
|
3049
|
-
// if (this.logData.ExpectedOutput?._avatar) {
|
|
3050
|
-
// delete this.logData.ExpectedOutput._avatar;
|
|
3051
|
-
// }
|
|
3052
|
-
// // this.__subs(this.scanProvider.sendLog(this.logData)).subscribe();
|
|
3053
|
-
// console.log(this.logData);
|
|
3054
|
-
// }
|
|
3055
|
-
this.actions.emit({
|
|
3056
|
-
type: 'scanDataClose',
|
|
3057
|
-
data: {
|
|
3058
|
-
model: this.model,
|
|
3059
|
-
images: this.images,
|
|
3060
|
-
},
|
|
3061
|
-
});
|
|
3062
|
-
}
|
|
3063
|
-
selfie() {
|
|
3064
|
-
var _a;
|
|
3065
|
-
const avatar = (_a = this.model) === null || _a === void 0 ? void 0 : _a._avatar;
|
|
3066
|
-
this.dialogs
|
|
3067
|
-
.scanSelfie({ avatar })
|
|
3068
|
-
.afterClosed()
|
|
3069
|
-
.subscribe((resp) => {
|
|
3070
|
-
if (resp) {
|
|
3071
|
-
console.log(resp);
|
|
3072
|
-
if (this.scanProvider.enableVerification) {
|
|
3073
|
-
this.imageVerified = true;
|
|
3074
|
-
}
|
|
3075
|
-
this.scanResults.next({
|
|
3076
|
-
type: 'avatar',
|
|
3077
|
-
data: resp.imageAsDataUrl,
|
|
3078
|
-
});
|
|
3079
|
-
// this.model._avatar = resp.imageAsDataUrl;
|
|
3080
|
-
this.cd.detectChanges();
|
|
3081
|
-
}
|
|
3082
|
-
});
|
|
3083
|
-
}
|
|
3084
|
-
cameraOff(ev) {
|
|
3085
|
-
this.cameraReady = false;
|
|
3086
|
-
this.cd.detectChanges();
|
|
3087
|
-
}
|
|
3088
|
-
videoReady(event) {
|
|
3089
|
-
console.log('READY', event);
|
|
3090
|
-
this.cameraReady = event;
|
|
3091
|
-
if (this.cameraReady && !this.scanInProgress && !this.manual) {
|
|
3092
|
-
this.scanInProgress = true;
|
|
3093
|
-
setTimeout(() => {
|
|
3094
|
-
this.scan();
|
|
3095
|
-
}, 20);
|
|
3096
|
-
}
|
|
3097
|
-
}
|
|
3098
|
-
manualSet(key) {
|
|
3099
|
-
if (key) {
|
|
3100
|
-
if (this.scanProvider.config.showManualMode) {
|
|
3101
|
-
this.manualMode();
|
|
3102
|
-
}
|
|
3103
|
-
else {
|
|
3104
|
-
this.actions.emit({
|
|
3105
|
-
type: 'manualMode',
|
|
3106
|
-
data: {},
|
|
3107
|
-
});
|
|
3108
|
-
}
|
|
3109
|
-
}
|
|
3110
|
-
else {
|
|
3111
|
-
this.promptManual = false;
|
|
3112
|
-
}
|
|
3113
|
-
}
|
|
3114
|
-
ngOnDestroy() {
|
|
3115
|
-
if (this.scanTimeout) {
|
|
3116
|
-
clearTimeout(this.scanTimeout);
|
|
3117
|
-
}
|
|
3118
|
-
if (this.imageHandlerSubscription) {
|
|
3119
|
-
this.imageHandlerSubscription.unsubscribe();
|
|
3120
|
-
}
|
|
3121
|
-
console.log('DESTROXY');
|
|
3122
|
-
this.__destroy();
|
|
3123
|
-
}
|
|
3124
|
-
}
|
|
3125
|
-
ScanComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScanComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: NgxScandocCameraProvider }, { token: i0.Injector }, { token: LayoutProvider }, { token: i2.Platform }, { token: i4$1.DeviceDetectorService }, { token: NgxScandocAuthProvider }], target: i0.ɵɵFactoryTarget.Component });
|
|
3126
|
-
ScanComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", 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" } }, usesInheritance: true, ngImport: i0, template: "<ng-container\n *ngIf=\"cameraProvider.rectPosition.t > 0 && displayInfo && !result && !manual\"\n>\n <div class=\"hint\" [ngStyle]=\"{ top: cameraProvider.hintPosition + 'px' }\">\n <span class=\"text\">\n {{ displayInfo | translate }}\n </span>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"showDialog\">\n <div class=\"pageTurn\">\n <div class=\"content\">\n <div class=\"inner\">\n <mat-icon>360</mat-icon>\n <div class=\"text\">\n <ng-container *ngIf=\"idScan === 'BACK'\">\n {{ \"scandoc.turnAndCapture.back\" | translate }}\n </ng-container>\n <ng-container *ngIf=\"idScan === 'FRONT'\">\n {{ \"scandoc.turnAndCapture.front\" | translate }}\n </ng-container>\n </div>\n </div>\n <footer>\n <button (click)=\"closeDialog()\" mat-raised-button>Ok</button>\n </footer>\n </div>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"promptManual\">\n <div class=\"manualMode\">\n <div class=\"content\">\n <div class=\"inner\">\n <mat-icon>screenshot</mat-icon>\n <div class=\"text\">\n {{ \"scandoc.manual\" | translate }}\n </div>\n </div>\n <footer>\n <button\n style=\"margin-right: 8px\"\n (click)=\"manualSet(true)\"\n mat-raised-button\n >\n {{ \"scandoc.yes\" | translate }}\n </button>\n <button\n style=\"margin-left: 8px\"\n (click)=\"manualSet(false)\"\n mat-raised-button\n >\n {{ \"scandoc.no\" | translate }}\n </button>\n </footer>\n </div>\n </div>\n</ng-container>\n<ng-container *ngIf=\"result\">\n <section>\n <ngx-scan-results\n (action)=\"selfie()\"\n [form]=\"form\"\n [data]=\"scanResults\"\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</ng-container>\n\n<ng-container *ngIf=\"manual\">\n <section>\n <ngx-manual-scan (action)=\"manualScanData($event)\"></ngx-manual-scan>\n </section>\n</ng-container>\n<ng-container *ngIf=\"!result && documentTypeSelected && !manual\">\n <section>\n <div #wraper class=\"wraper\">\n <div class=\"loading\" *ngIf=\"(!cameraReady && !preview) || scaning\">\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 #webcam\n type=\"document\"\n [trigger]=\"trigger\"\n [imageHandler]=\"imageHandler\"\n (imageCapture)=\"handleImage($event)\"\n (initError)=\"handleInitError($event)\"\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=\"\n z-index: 20;\n display: flex;\n position: absolute;\n width: 100%;\n height: 100%;\n \"\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 *ngIf=\"preview\">\n <!-- <div class=\"displayInfo\" *ngIf=\"!preview && cameraReady\">\n <ng-container *ngIf=\"displayInfo\">\n {{ displayInfo | translate }}\n </ng-container>\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</ng-container>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1;background-color:#f5f5f5;overflow:hidden;position:relative}:host.mobile .hint{font-size:13px}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}.manualMode{position:absolute;width:100%;height:100%;z-index:200;top:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.manualMode .content{margin-top:20px;background-color:#fff;border-radius:6px;max-width:300px;width:100%;display:flex;flex-direction:column;padding:30px 20px 0}.manualMode .inner{display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:14px}.manualMode .inner mat-icon{width:60px;height:60px;font-size:60px}.manualMode .inner .text{margin:20px 0}.manualMode footer{display:flex;flex-direction:row;align-items:center;justify-content:center;padding-bottom:20px}.manualMode footer button{min-width:140px;box-shadow:none;border:1px solid #ccc}.pageTurn{position:absolute;width:100%;height:100%;z-index:200;top:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.pageTurn .content{background-color:#fff;border-radius:6px;max-width:300px;width:100%;display:flex;flex-direction:column;padding:30px 20px 0}.pageTurn .inner{display:flex;flex-direction:column;align-items:center;justify-content:center}.pageTurn .inner mat-icon{width:60px;height:60px;font-size:60px}.pageTurn .inner .text{margin:20px 0;font-size:14px}.pageTurn footer{display:flex;flex-direction:row;align-items:center;justify-content:center;padding-bottom:20px}.pageTurn footer button{min-width:200px;box-shadow:none;border:1px solid #ccc}.hint{position:absolute;z-index:5;font-size:18px;line-height:18px;display:flex;flex-direction:row;align-items:center;justify-content:center;width:100%}.hint .text{border-radius:3px;padding:4px 8px;background-color:#000;color:#fff;text-align:center;display:inline;-webkit-box-decoration-break:clone;box-decoration-break:clone}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: WebcamComponent, selector: "ngx-scandoc-webcam", inputs: ["imageHandler", "type", "trigger"], outputs: ["cameraSwitched", "videoReady", "imageCapture", "initError"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i8.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: ScanResultsComponent, selector: "ngx-scan-results", inputs: ["data", "images", "form"], outputs: ["action"] }, { kind: "component", type: ManualScanComponent, selector: "ngx-manual-scan", outputs: ["action"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3127
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScanComponent, decorators: [{
|
|
3128
|
-
type: Component,
|
|
3129
|
-
args: [{ selector: 'ngx-scan', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container\n *ngIf=\"cameraProvider.rectPosition.t > 0 && displayInfo && !result && !manual\"\n>\n <div class=\"hint\" [ngStyle]=\"{ top: cameraProvider.hintPosition + 'px' }\">\n <span class=\"text\">\n {{ displayInfo | translate }}\n </span>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"showDialog\">\n <div class=\"pageTurn\">\n <div class=\"content\">\n <div class=\"inner\">\n <mat-icon>360</mat-icon>\n <div class=\"text\">\n <ng-container *ngIf=\"idScan === 'BACK'\">\n {{ \"scandoc.turnAndCapture.back\" | translate }}\n </ng-container>\n <ng-container *ngIf=\"idScan === 'FRONT'\">\n {{ \"scandoc.turnAndCapture.front\" | translate }}\n </ng-container>\n </div>\n </div>\n <footer>\n <button (click)=\"closeDialog()\" mat-raised-button>Ok</button>\n </footer>\n </div>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"promptManual\">\n <div class=\"manualMode\">\n <div class=\"content\">\n <div class=\"inner\">\n <mat-icon>screenshot</mat-icon>\n <div class=\"text\">\n {{ \"scandoc.manual\" | translate }}\n </div>\n </div>\n <footer>\n <button\n style=\"margin-right: 8px\"\n (click)=\"manualSet(true)\"\n mat-raised-button\n >\n {{ \"scandoc.yes\" | translate }}\n </button>\n <button\n style=\"margin-left: 8px\"\n (click)=\"manualSet(false)\"\n mat-raised-button\n >\n {{ \"scandoc.no\" | translate }}\n </button>\n </footer>\n </div>\n </div>\n</ng-container>\n<ng-container *ngIf=\"result\">\n <section>\n <ngx-scan-results\n (action)=\"selfie()\"\n [form]=\"form\"\n [data]=\"scanResults\"\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</ng-container>\n\n<ng-container *ngIf=\"manual\">\n <section>\n <ngx-manual-scan (action)=\"manualScanData($event)\"></ngx-manual-scan>\n </section>\n</ng-container>\n<ng-container *ngIf=\"!result && documentTypeSelected && !manual\">\n <section>\n <div #wraper class=\"wraper\">\n <div class=\"loading\" *ngIf=\"(!cameraReady && !preview) || scaning\">\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 #webcam\n type=\"document\"\n [trigger]=\"trigger\"\n [imageHandler]=\"imageHandler\"\n (imageCapture)=\"handleImage($event)\"\n (initError)=\"handleInitError($event)\"\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=\"\n z-index: 20;\n display: flex;\n position: absolute;\n width: 100%;\n height: 100%;\n \"\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 *ngIf=\"preview\">\n <!-- <div class=\"displayInfo\" *ngIf=\"!preview && cameraReady\">\n <ng-container *ngIf=\"displayInfo\">\n {{ displayInfo | translate }}\n </ng-container>\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</ng-container>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1;background-color:#f5f5f5;overflow:hidden;position:relative}:host.mobile .hint{font-size:13px}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}.manualMode{position:absolute;width:100%;height:100%;z-index:200;top:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.manualMode .content{margin-top:20px;background-color:#fff;border-radius:6px;max-width:300px;width:100%;display:flex;flex-direction:column;padding:30px 20px 0}.manualMode .inner{display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:14px}.manualMode .inner mat-icon{width:60px;height:60px;font-size:60px}.manualMode .inner .text{margin:20px 0}.manualMode footer{display:flex;flex-direction:row;align-items:center;justify-content:center;padding-bottom:20px}.manualMode footer button{min-width:140px;box-shadow:none;border:1px solid #ccc}.pageTurn{position:absolute;width:100%;height:100%;z-index:200;top:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.pageTurn .content{background-color:#fff;border-radius:6px;max-width:300px;width:100%;display:flex;flex-direction:column;padding:30px 20px 0}.pageTurn .inner{display:flex;flex-direction:column;align-items:center;justify-content:center}.pageTurn .inner mat-icon{width:60px;height:60px;font-size:60px}.pageTurn .inner .text{margin:20px 0;font-size:14px}.pageTurn footer{display:flex;flex-direction:row;align-items:center;justify-content:center;padding-bottom:20px}.pageTurn footer button{min-width:200px;box-shadow:none;border:1px solid #ccc}.hint{position:absolute;z-index:5;font-size:18px;line-height:18px;display:flex;flex-direction:row;align-items:center;justify-content:center;width:100%}.hint .text{border-radius:3px;padding:4px 8px;background-color:#000;color:#fff;text-align:center;display:inline;-webkit-box-decoration-break:clone;box-decoration-break:clone}\n"] }]
|
|
3130
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: NgxScandocCameraProvider }, { type: i0.Injector }, { type: LayoutProvider }, { type: i2.Platform }, { type: i4$1.DeviceDetectorService }, { type: NgxScandocAuthProvider }]; }, propDecorators: { type: [{
|
|
3131
|
-
type: Input
|
|
3132
|
-
}], dialogs: [{
|
|
3133
|
-
type: Input
|
|
3134
|
-
}], actions: [{
|
|
3135
|
-
type: Output
|
|
3136
|
-
}], showDialog: [{
|
|
3137
|
-
type: Input
|
|
3138
|
-
}], class: [{
|
|
3139
|
-
type: HostBinding,
|
|
3140
|
-
args: ['class.mobile']
|
|
3141
|
-
}], onResize: [{
|
|
3142
|
-
type: HostListener,
|
|
3143
|
-
args: ['window:resize', ['$event']]
|
|
3144
|
-
}] } });
|
|
3145
|
-
|
|
3146
|
-
class MaterialModule {
|
|
3147
|
-
}
|
|
3148
|
-
MaterialModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3149
|
-
MaterialModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: MaterialModule, imports: [MatNativeDateModule,
|
|
3150
|
-
MatDatepickerModule,
|
|
3151
|
-
MatCardModule,
|
|
3152
|
-
MatMenuModule,
|
|
3153
|
-
MatIconModule,
|
|
3154
|
-
MatButtonModule,
|
|
3155
|
-
MatDialogModule,
|
|
3156
|
-
MatInputModule,
|
|
3157
|
-
MatSnackBarModule,
|
|
3158
|
-
MatProgressBarModule,
|
|
3159
|
-
MatTableModule,
|
|
3160
|
-
MatProgressSpinnerModule,
|
|
3161
|
-
MatPaginatorModule,
|
|
3162
|
-
MatSelectModule,
|
|
3163
|
-
MatCheckboxModule,
|
|
3164
|
-
MatChipsModule,
|
|
3165
|
-
MatBadgeModule,
|
|
3166
|
-
MatListModule,
|
|
3167
|
-
MatTabsModule,
|
|
3168
|
-
MatSliderModule,
|
|
3169
|
-
MatSlideToggleModule], exports: [MatNativeDateModule,
|
|
3170
|
-
MatDatepickerModule,
|
|
3171
|
-
MatSelectModule,
|
|
3172
|
-
MatCardModule,
|
|
3173
|
-
MatMenuModule,
|
|
3174
|
-
MatIconModule,
|
|
3175
|
-
MatButtonModule,
|
|
3176
|
-
MatDialogModule,
|
|
3177
|
-
MatInputModule,
|
|
3178
|
-
MatSnackBarModule,
|
|
3179
|
-
MatProgressBarModule,
|
|
3180
|
-
MatProgressSpinnerModule,
|
|
3181
|
-
MatTableModule,
|
|
3182
|
-
MatPaginatorModule,
|
|
3183
|
-
MatChipsModule,
|
|
3184
|
-
MatBadgeModule,
|
|
3185
|
-
MatCheckboxModule,
|
|
3186
|
-
MatListModule,
|
|
3187
|
-
MatTabsModule,
|
|
3188
|
-
MatSlideToggleModule,
|
|
3189
|
-
MatAutocompleteModule] });
|
|
3190
|
-
MaterialModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MaterialModule, imports: [MatNativeDateModule,
|
|
3191
|
-
MatDatepickerModule,
|
|
3192
|
-
MatCardModule,
|
|
3193
|
-
MatMenuModule,
|
|
3194
|
-
MatIconModule,
|
|
3195
|
-
MatButtonModule,
|
|
3196
|
-
MatDialogModule,
|
|
3197
|
-
MatInputModule,
|
|
3198
|
-
MatSnackBarModule,
|
|
3199
|
-
MatProgressBarModule,
|
|
3200
|
-
MatTableModule,
|
|
3201
|
-
MatProgressSpinnerModule,
|
|
3202
|
-
MatPaginatorModule,
|
|
3203
|
-
MatSelectModule,
|
|
3204
|
-
MatCheckboxModule,
|
|
3205
|
-
MatChipsModule,
|
|
3206
|
-
MatBadgeModule,
|
|
3207
|
-
MatListModule,
|
|
3208
|
-
MatTabsModule,
|
|
3209
|
-
MatSliderModule,
|
|
3210
|
-
MatSlideToggleModule, MatNativeDateModule,
|
|
3211
|
-
MatDatepickerModule,
|
|
3212
|
-
MatSelectModule,
|
|
3213
|
-
MatCardModule,
|
|
3214
|
-
MatMenuModule,
|
|
3215
|
-
MatIconModule,
|
|
3216
|
-
MatButtonModule,
|
|
3217
|
-
MatDialogModule,
|
|
3218
|
-
MatInputModule,
|
|
3219
|
-
MatSnackBarModule,
|
|
3220
|
-
MatProgressBarModule,
|
|
3221
|
-
MatProgressSpinnerModule,
|
|
3222
|
-
MatTableModule,
|
|
3223
|
-
MatPaginatorModule,
|
|
3224
|
-
MatChipsModule,
|
|
3225
|
-
MatBadgeModule,
|
|
3226
|
-
MatCheckboxModule,
|
|
3227
|
-
MatListModule,
|
|
3228
|
-
MatTabsModule,
|
|
3229
|
-
MatSlideToggleModule,
|
|
3230
|
-
MatAutocompleteModule] });
|
|
3231
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MaterialModule, decorators: [{
|
|
3232
|
-
type: NgModule,
|
|
3233
|
-
args: [{
|
|
3234
|
-
imports: [
|
|
3235
|
-
MatNativeDateModule,
|
|
3236
|
-
MatDatepickerModule,
|
|
3237
|
-
MatCardModule,
|
|
3238
|
-
MatMenuModule,
|
|
3239
|
-
MatIconModule,
|
|
3240
|
-
MatButtonModule,
|
|
3241
|
-
MatDialogModule,
|
|
3242
|
-
MatInputModule,
|
|
3243
|
-
MatSnackBarModule,
|
|
3244
|
-
MatProgressBarModule,
|
|
3245
|
-
MatTableModule,
|
|
3246
|
-
MatProgressSpinnerModule,
|
|
3247
|
-
MatPaginatorModule,
|
|
3248
|
-
MatSelectModule,
|
|
3249
|
-
MatCheckboxModule,
|
|
3250
|
-
MatChipsModule,
|
|
3251
|
-
MatBadgeModule,
|
|
3252
|
-
MatListModule,
|
|
3253
|
-
MatTabsModule,
|
|
3254
|
-
MatSliderModule,
|
|
3255
|
-
MatSlideToggleModule,
|
|
3256
|
-
],
|
|
3257
|
-
exports: [
|
|
3258
|
-
MatNativeDateModule,
|
|
3259
|
-
MatDatepickerModule,
|
|
3260
|
-
MatSelectModule,
|
|
3261
|
-
MatCardModule,
|
|
3262
|
-
MatMenuModule,
|
|
3263
|
-
MatIconModule,
|
|
3264
|
-
MatButtonModule,
|
|
3265
|
-
MatDialogModule,
|
|
3266
|
-
MatInputModule,
|
|
3267
|
-
MatSnackBarModule,
|
|
3268
|
-
MatProgressBarModule,
|
|
3269
|
-
MatProgressSpinnerModule,
|
|
3270
|
-
MatTableModule,
|
|
3271
|
-
MatPaginatorModule,
|
|
3272
|
-
MatChipsModule,
|
|
3273
|
-
MatBadgeModule,
|
|
3274
|
-
MatCheckboxModule,
|
|
3275
|
-
MatListModule,
|
|
3276
|
-
MatTabsModule,
|
|
3277
|
-
MatSlideToggleModule,
|
|
3278
|
-
MatAutocompleteModule,
|
|
3279
|
-
],
|
|
3280
|
-
providers: [],
|
|
3281
|
-
}]
|
|
3282
|
-
}] });
|
|
3283
|
-
|
|
3284
|
-
class AvatarTypeComponent extends FieldType {
|
|
3285
|
-
constructor(cd) {
|
|
3286
|
-
super();
|
|
3287
|
-
this.cd = cd;
|
|
3288
|
-
this.width = 'w-120';
|
|
3289
|
-
this.padding = 'px-32 pt-8 pb-8';
|
|
3290
|
-
}
|
|
3291
|
-
ngOnChange() { }
|
|
3292
|
-
selfie() { }
|
|
3293
|
-
;
|
|
3294
|
-
ngAfterViewInit() {
|
|
3295
|
-
if (this.to.width) {
|
|
3296
|
-
this.width = this.to.width;
|
|
3297
|
-
}
|
|
3298
|
-
if (this.to.padding) {
|
|
3299
|
-
this.padding = this.to.padding;
|
|
3300
|
-
}
|
|
3301
|
-
this.cd.detectChanges();
|
|
3302
|
-
}
|
|
3303
|
-
}
|
|
3304
|
-
AvatarTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AvatarTypeComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3305
|
-
AvatarTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AvatarTypeComponent, selector: "app-formly-avatar-type", usesInheritance: true, ngImport: i0, template: `
|
|
3306
|
-
<mat-card appearance="outlined" style="margin: 4px; padding:16px">
|
|
3307
|
-
<div class="card-title">{{ 'scandoc.result.avatar' | translate }}</div>
|
|
3308
|
-
<div class="selfieContainer">
|
|
3309
|
-
<div class="selfie">
|
|
3310
|
-
<img *ngIf="model?._avatar" class="preview" [src]="model._avatar" />
|
|
3311
|
-
</div>
|
|
3312
|
-
<button (click)="selfie()" mat-raised-button>
|
|
3313
|
-
{{ 'scandoc.result.takeSelfie' | translate }}
|
|
3314
|
-
</button>
|
|
3315
|
-
</div>
|
|
3316
|
-
</mat-card>
|
|
3317
|
-
`, isInline: true, styles: ["mat-card{border-radius:0;box-shadow:none!important}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i6.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] });
|
|
3318
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AvatarTypeComponent, decorators: [{
|
|
3319
|
-
type: Component,
|
|
3320
|
-
args: [{ selector: 'app-formly-avatar-type', template: `
|
|
3321
|
-
<mat-card appearance="outlined" style="margin: 4px; padding:16px">
|
|
3322
|
-
<div class="card-title">{{ 'scandoc.result.avatar' | translate }}</div>
|
|
3323
|
-
<div class="selfieContainer">
|
|
3324
|
-
<div class="selfie">
|
|
3325
|
-
<img *ngIf="model?._avatar" class="preview" [src]="model._avatar" />
|
|
3326
|
-
</div>
|
|
3327
|
-
<button (click)="selfie()" mat-raised-button>
|
|
3328
|
-
{{ 'scandoc.result.takeSelfie' | translate }}
|
|
3329
|
-
</button>
|
|
3330
|
-
</div>
|
|
3331
|
-
</mat-card>
|
|
3332
|
-
`, styles: ["mat-card{border-radius:0;box-shadow:none!important}\n"] }]
|
|
3333
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
|
3334
|
-
|
|
3335
|
-
class TitleTypeComponent extends FieldType {
|
|
3336
|
-
constructor(cd) {
|
|
3337
|
-
super();
|
|
3338
|
-
this.cd = cd;
|
|
3339
|
-
}
|
|
3340
|
-
ngOnInit() {
|
|
3341
|
-
this.opt = {
|
|
3342
|
-
badge: this.to.badge,
|
|
3343
|
-
};
|
|
3344
|
-
}
|
|
3345
|
-
ngAfterViewInit() {
|
|
3346
|
-
this.cd.detectChanges();
|
|
3347
|
-
}
|
|
3348
|
-
}
|
|
3349
|
-
TitleTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TitleTypeComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3350
|
-
TitleTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TitleTypeComponent, selector: "app-formly-title-type", usesInheritance: true, ngImport: i0, template: `
|
|
3351
|
-
<div class="card-title">
|
|
3352
|
-
{{ to.label }}
|
|
3353
|
-
</div>
|
|
3354
|
-
`, isInline: true, styles: [""] });
|
|
3355
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TitleTypeComponent, decorators: [{
|
|
3356
|
-
type: Component,
|
|
3357
|
-
args: [{ selector: 'app-formly-title-type', template: `
|
|
3358
|
-
<div class="card-title">
|
|
3359
|
-
{{ to.label }}
|
|
3360
|
-
</div>
|
|
3361
|
-
` }]
|
|
3362
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
|
3363
|
-
|
|
3364
|
-
class ProfileImageTypeComponent extends FieldType {
|
|
3365
|
-
constructor(cd, cameraProvider, scanProvider) {
|
|
3366
|
-
super();
|
|
3367
|
-
this.cd = cd;
|
|
3368
|
-
this.cameraProvider = cameraProvider;
|
|
3369
|
-
this.scanProvider = scanProvider;
|
|
3370
|
-
}
|
|
3371
|
-
selfie() {
|
|
3372
|
-
this.cameraProvider.selfie$.next(true);
|
|
3373
|
-
}
|
|
3374
|
-
ngOnChange() { }
|
|
3375
|
-
ngAfterViewInit() { }
|
|
3376
|
-
}
|
|
3377
|
-
ProfileImageTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProfileImageTypeComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: NgxScandocCameraProvider }, { token: ScanProvider }], target: i0.ɵɵFactoryTarget.Component });
|
|
3378
|
-
ProfileImageTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ProfileImageTypeComponent, selector: "app-formly-profile-image-type", usesInheritance: true, ngImport: i0, template: `
|
|
3379
|
-
<mat-form-field>
|
|
3380
|
-
<mat-label>{{ 'scandoc.result.avatar' | translate }} </mat-label>
|
|
3381
|
-
<input matInput style="display:none" />
|
|
3382
|
-
<div class="selfieContainer">
|
|
3383
|
-
<div class="selfie">
|
|
3384
|
-
<img *ngIf="model?._avatar" class="preview" [src]="model._avatar" />
|
|
3385
|
-
</div>
|
|
3386
|
-
<button
|
|
3387
|
-
*ngIf="scanProvider.enableVerification"
|
|
3388
|
-
(click)="selfie()"
|
|
3389
|
-
mat-raised-button
|
|
3390
|
-
>
|
|
3391
|
-
{{ 'scandoc.result.takeSelfie' | translate }}
|
|
3392
|
-
</button>
|
|
3393
|
-
</div>
|
|
3394
|
-
</mat-form-field>
|
|
3395
|
-
`, isInline: true, styles: [".selfieContainer{display:flex;flex-direction:column;align-items:center;justify-content:center}.selfieContainer button{margin-top:6px;box-shadow:none!important;border:1px solid rgba(0,0,0,.12);text-transform:uppercase;font-size:12px}.selfie{width:126px;height:126px;border-radius:70px;background:whitesmoke;display:flex;flex-direction:column;align-items:center;justify-content:center}.selfie img{width:120px;height:120px;border-radius:60px}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$2.MatLabel, selector: "mat-label" }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i6$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] });
|
|
3396
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProfileImageTypeComponent, decorators: [{
|
|
3397
|
-
type: Component,
|
|
3398
|
-
args: [{ selector: 'app-formly-profile-image-type', template: `
|
|
3399
|
-
<mat-form-field>
|
|
3400
|
-
<mat-label>{{ 'scandoc.result.avatar' | translate }} </mat-label>
|
|
3401
|
-
<input matInput style="display:none" />
|
|
3402
|
-
<div class="selfieContainer">
|
|
3403
|
-
<div class="selfie">
|
|
3404
|
-
<img *ngIf="model?._avatar" class="preview" [src]="model._avatar" />
|
|
3405
|
-
</div>
|
|
3406
|
-
<button
|
|
3407
|
-
*ngIf="scanProvider.enableVerification"
|
|
3408
|
-
(click)="selfie()"
|
|
3409
|
-
mat-raised-button
|
|
3410
|
-
>
|
|
3411
|
-
{{ 'scandoc.result.takeSelfie' | translate }}
|
|
3412
|
-
</button>
|
|
3413
|
-
</div>
|
|
3414
|
-
</mat-form-field>
|
|
3415
|
-
`, styles: [".selfieContainer{display:flex;flex-direction:column;align-items:center;justify-content:center}.selfieContainer button{margin-top:6px;box-shadow:none!important;border:1px solid rgba(0,0,0,.12);text-transform:uppercase;font-size:12px}.selfie{width:126px;height:126px;border-radius:70px;background:whitesmoke;display:flex;flex-direction:column;align-items:center;justify-content:center}.selfie img{width:120px;height:120px;border-radius:60px}\n"] }]
|
|
3416
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: NgxScandocCameraProvider }, { type: ScanProvider }]; } });
|
|
3417
|
-
|
|
3418
|
-
class AppFormModule {
|
|
3419
|
-
}
|
|
3420
|
-
AppFormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3421
|
-
AppFormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: AppFormModule, declarations: [TitleTypeComponent,
|
|
3422
|
-
AvatarTypeComponent,
|
|
3423
|
-
ProfileImageTypeComponent], imports: [CommonModule,
|
|
3424
|
-
FormsModule,
|
|
3425
|
-
FormlyMatDatepickerModule,
|
|
3426
|
-
FormlySelectModule,
|
|
3427
|
-
MaterialModule,
|
|
3428
|
-
AvatarModule,
|
|
3429
|
-
TranslateModule,
|
|
3430
|
-
FormlyMaterialModule, i7.FormlyModule], exports: [FormlyModule] });
|
|
3431
|
-
AppFormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppFormModule, imports: [CommonModule,
|
|
3432
|
-
FormsModule,
|
|
3433
|
-
FormlyMatDatepickerModule,
|
|
3434
|
-
FormlySelectModule,
|
|
3435
|
-
MaterialModule,
|
|
3436
|
-
AvatarModule,
|
|
3437
|
-
TranslateModule,
|
|
3438
|
-
FormlyMaterialModule,
|
|
3439
|
-
FormlyModule.forChild({
|
|
3440
|
-
types: [
|
|
3441
|
-
{
|
|
3442
|
-
name: 'title',
|
|
3443
|
-
component: TitleTypeComponent,
|
|
3444
|
-
wrappers: [],
|
|
3445
|
-
},
|
|
3446
|
-
{
|
|
3447
|
-
name: 'profile-image',
|
|
3448
|
-
component: ProfileImageTypeComponent,
|
|
3449
|
-
wrappers: [],
|
|
3450
|
-
},
|
|
3451
|
-
],
|
|
3452
|
-
}), FormlyModule] });
|
|
3453
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppFormModule, decorators: [{
|
|
3454
|
-
type: NgModule,
|
|
3455
|
-
args: [{
|
|
3456
|
-
declarations: [
|
|
3457
|
-
TitleTypeComponent,
|
|
3458
|
-
AvatarTypeComponent,
|
|
3459
|
-
ProfileImageTypeComponent,
|
|
3460
|
-
],
|
|
3461
|
-
imports: [
|
|
3462
|
-
CommonModule,
|
|
3463
|
-
FormsModule,
|
|
3464
|
-
FormlyMatDatepickerModule,
|
|
3465
|
-
FormlySelectModule,
|
|
3466
|
-
MaterialModule,
|
|
3467
|
-
AvatarModule,
|
|
3468
|
-
TranslateModule,
|
|
3469
|
-
FormlyMaterialModule,
|
|
3470
|
-
FormlyModule.forChild({
|
|
3471
|
-
types: [
|
|
3472
|
-
{
|
|
3473
|
-
name: 'title',
|
|
3474
|
-
component: TitleTypeComponent,
|
|
3475
|
-
wrappers: [],
|
|
3476
|
-
},
|
|
3477
|
-
{
|
|
3478
|
-
name: 'profile-image',
|
|
3479
|
-
component: ProfileImageTypeComponent,
|
|
3480
|
-
wrappers: [],
|
|
3481
|
-
},
|
|
3482
|
-
],
|
|
3483
|
-
}),
|
|
3484
|
-
],
|
|
3485
|
-
providers: [],
|
|
3486
|
-
exports: [FormlyModule],
|
|
3487
|
-
}]
|
|
3488
|
-
}] });
|
|
3489
|
-
|
|
3490
|
-
class CameraSwitchComponent {
|
|
3491
|
-
constructor(cameraProvider) {
|
|
3492
|
-
this.cameraProvider = cameraProvider;
|
|
3493
|
-
}
|
|
3494
|
-
ngAfterViewInit() {
|
|
3495
|
-
// this.cameraProvider.setDefault();
|
|
3496
|
-
}
|
|
3497
|
-
ngOnDestroy() { }
|
|
3498
|
-
}
|
|
3499
|
-
CameraSwitchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CameraSwitchComponent, deps: [{ token: NgxScandocCameraProvider }], target: i0.ɵɵFactoryTarget.Component });
|
|
3500
|
-
CameraSwitchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CameraSwitchComponent, selector: "ngx-scan-camera-switch", ngImport: i0, template: "<mat-form-field\n style=\"font-size: 14px; margin-top: 8px\"\n class=\"w-100-p mr-16 mt-8\"\n\n>\n <mat-label> {{ \"scandoc.camera\" | translate }} </mat-label>\n <mat-select\n (selectionChange)=\"cameraProvider.selectCamera($event)\"\n [(ngModel)]=\"cameraProvider.deviceId\"\n >\n <mat-option\n *ngFor=\"let device of cameraProvider.mediaDevices\"\n [value]=\"device.deviceId\"\n >\n {{ device.label }}\n </mat-option>\n </mat-select>\n</mat-form-field>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1}\n"], dependencies: [{ kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4$2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$2.MatLabel, selector: "mat-label" }, { kind: "component", type: i5$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "component", type: i6$3.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] });
|
|
3501
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CameraSwitchComponent, decorators: [{
|
|
3502
|
-
type: Component,
|
|
3503
|
-
args: [{ selector: 'ngx-scan-camera-switch', template: "<mat-form-field\n style=\"font-size: 14px; margin-top: 8px\"\n class=\"w-100-p mr-16 mt-8\"\n\n>\n <mat-label> {{ \"scandoc.camera\" | translate }} </mat-label>\n <mat-select\n (selectionChange)=\"cameraProvider.selectCamera($event)\"\n [(ngModel)]=\"cameraProvider.deviceId\"\n >\n <mat-option\n *ngFor=\"let device of cameraProvider.mediaDevices\"\n [value]=\"device.deviceId\"\n >\n {{ device.label }}\n </mat-option>\n </mat-select>\n</mat-form-field>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1}\n"] }]
|
|
3504
|
-
}], ctorParameters: function () { return [{ type: NgxScandocCameraProvider }]; } });
|
|
3505
|
-
|
|
3506
|
-
//import { NgxScandocCameraProvider } from '../../providers/camera.provider';
|
|
3507
|
-
class CoreComponentsModule {
|
|
3508
|
-
static forRoot() {
|
|
3509
|
-
return {
|
|
3510
|
-
ngModule: CoreComponentsModule,
|
|
3511
|
-
providers: [],
|
|
3512
|
-
};
|
|
3513
|
-
}
|
|
3514
|
-
}
|
|
3515
|
-
CoreComponentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CoreComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3516
|
-
CoreComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: CoreComponentsModule, declarations: [ScanComponent,
|
|
3517
|
-
ScanResultsComponent,
|
|
3518
|
-
CameraSwitchComponent,
|
|
3519
|
-
ManualScanComponent], imports: [CommonModule,
|
|
3520
|
-
FormsModule,
|
|
3521
|
-
TranslateModule, WebcamModule, MaterialModule,
|
|
3522
|
-
AppFormModule,
|
|
3523
|
-
ReactiveFormsModule], exports: [WebcamModule,
|
|
3524
|
-
ScanComponent,
|
|
3525
|
-
CameraSwitchComponent,
|
|
3526
|
-
ManualScanComponent] });
|
|
3527
|
-
CoreComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CoreComponentsModule, imports: [CommonModule,
|
|
3528
|
-
FormsModule,
|
|
3529
|
-
TranslateModule,
|
|
3530
|
-
WebcamModule.forRoot(),
|
|
3531
|
-
MaterialModule,
|
|
3532
|
-
AppFormModule,
|
|
3533
|
-
ReactiveFormsModule, WebcamModule] });
|
|
3534
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CoreComponentsModule, decorators: [{
|
|
3535
|
-
type: NgModule,
|
|
3536
|
-
args: [{
|
|
3537
|
-
imports: [
|
|
3538
|
-
CommonModule,
|
|
3539
|
-
FormsModule,
|
|
3540
|
-
TranslateModule,
|
|
3541
|
-
WebcamModule.forRoot(),
|
|
3542
|
-
MaterialModule,
|
|
3543
|
-
AppFormModule,
|
|
3544
|
-
ReactiveFormsModule,
|
|
3545
|
-
],
|
|
3546
|
-
declarations: [
|
|
3547
|
-
ScanComponent,
|
|
3548
|
-
ScanResultsComponent,
|
|
3549
|
-
CameraSwitchComponent,
|
|
3550
|
-
ManualScanComponent,
|
|
3551
|
-
],
|
|
3552
|
-
exports: [
|
|
3553
|
-
WebcamModule,
|
|
3554
|
-
ScanComponent,
|
|
3555
|
-
CameraSwitchComponent,
|
|
3556
|
-
ManualScanComponent,
|
|
3557
|
-
],
|
|
3558
|
-
providers: [],
|
|
3559
|
-
}]
|
|
3560
|
-
}] });
|
|
3561
|
-
|
|
3562
|
-
class SafeResourceUrlPipe {
|
|
3563
|
-
constructor(sanitizer) {
|
|
3564
|
-
this.sanitizer = sanitizer;
|
|
3565
|
-
}
|
|
3566
|
-
transform(style) {
|
|
3567
|
-
return this.sanitizer.bypassSecurityTrustResourceUrl(style);
|
|
3568
|
-
// return this.sanitizer.bypassSecurityTrustStyle(style);
|
|
3569
|
-
// return this.sanitizer.bypassSecurityTrustXxx(style); - see docs
|
|
3570
|
-
}
|
|
3571
|
-
}
|
|
3572
|
-
SafeResourceUrlPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SafeResourceUrlPipe, deps: [{ token: i1$2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
3573
|
-
SafeResourceUrlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SafeResourceUrlPipe, name: "safeResourceUrl" });
|
|
3574
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SafeResourceUrlPipe, decorators: [{
|
|
3575
|
-
type: Pipe,
|
|
3576
|
-
args: [{ name: 'safeResourceUrl' }]
|
|
3577
|
-
}], ctorParameters: function () { return [{ type: i1$2.DomSanitizer }]; } });
|
|
3578
|
-
|
|
3579
|
-
class CorePipesModule {
|
|
3580
|
-
}
|
|
3581
|
-
CorePipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CorePipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3582
|
-
CorePipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: CorePipesModule, declarations: [SafeResourceUrlPipe], exports: [SafeResourceUrlPipe] });
|
|
3583
|
-
CorePipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CorePipesModule });
|
|
3584
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CorePipesModule, decorators: [{
|
|
3585
|
-
type: NgModule,
|
|
3586
|
-
args: [{
|
|
3587
|
-
declarations: [SafeResourceUrlPipe],
|
|
3588
|
-
imports: [],
|
|
3589
|
-
exports: [
|
|
3590
|
-
SafeResourceUrlPipe,
|
|
3591
|
-
],
|
|
3592
|
-
}]
|
|
3593
|
-
}] });
|
|
3594
|
-
|
|
3595
|
-
class BlankComponent {
|
|
3596
|
-
constructor(dialogRef, data, cd) {
|
|
3597
|
-
this.dialogRef = dialogRef;
|
|
3598
|
-
this.data = data;
|
|
3599
|
-
this.cd = cd;
|
|
3600
|
-
this.initSet = false;
|
|
3601
|
-
}
|
|
3602
|
-
setModel(model) {
|
|
3603
|
-
this.data.data.model = model;
|
|
3604
|
-
this.init();
|
|
3605
|
-
}
|
|
3606
|
-
init() {
|
|
3607
|
-
var _a, _b;
|
|
3608
|
-
this.initSet = true;
|
|
3609
|
-
(_a = this.body) === null || _a === void 0 ? void 0 : _a.clear();
|
|
3610
|
-
const componentRef = (_b = this.body) === null || _b === void 0 ? void 0 : _b.createComponent(this.data.component);
|
|
3611
|
-
componentRef.instance.data = this.data.data;
|
|
3612
|
-
// componentRef.instance.dialogs = this.dialogs;
|
|
3613
|
-
componentRef.instance.dialogRef = this.dialogRef;
|
|
3614
|
-
if (componentRef.instance.init) {
|
|
3615
|
-
componentRef.instance.init();
|
|
3616
|
-
}
|
|
3617
|
-
this.cd.detectChanges();
|
|
3618
|
-
}
|
|
3619
|
-
ngAfterViewInit() {
|
|
3620
|
-
if (!this.initSet) {
|
|
3621
|
-
this.init();
|
|
3622
|
-
}
|
|
3623
|
-
}
|
|
3624
|
-
}
|
|
3625
|
-
BlankComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BlankComponent, deps: [{ token: i1$3.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
3626
|
-
BlankComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: BlankComponent, selector: "ngx-scandoc-blank", viewQueries: [{ propertyName: "body", first: true, predicate: ["body"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-template #body></ng-template>\n", styles: [":host{display:flex;flex:1;flex-direction:column;overflow:hidden;height:100%}\n"] });
|
|
3627
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BlankComponent, decorators: [{
|
|
3628
|
-
type: Component,
|
|
3629
|
-
args: [{ selector: 'ngx-scandoc-blank', template: "<ng-template #body></ng-template>\n", styles: [":host{display:flex;flex:1;flex-direction:column;overflow:hidden;height:100%}\n"] }]
|
|
3630
|
-
}], ctorParameters: function () {
|
|
3631
|
-
return [{ type: i1$3.MatDialogRef }, { type: undefined, decorators: [{
|
|
3632
|
-
type: Inject,
|
|
3633
|
-
args: [MAT_DIALOG_DATA]
|
|
3634
|
-
}] }, { type: i0.ChangeDetectorRef }];
|
|
3635
|
-
}, propDecorators: { body: [{
|
|
3636
|
-
type: ViewChild,
|
|
3637
|
-
args: ['body', { read: ViewContainerRef, static: true }]
|
|
3638
|
-
}] } });
|
|
3639
|
-
|
|
3640
|
-
class LoadingComponent {
|
|
3641
|
-
}
|
|
3642
|
-
LoadingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3643
|
-
LoadingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: LoadingComponent, selector: "ngx-scandoc-loading", ngImport: i0, template: "<div style=\"width:240px;\">\n\n <div class=\"pb-16\" style=\"font-size: 18px;padding-bottom:16px;\">\n Loading...\n </div>\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: i8.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }] });
|
|
3644
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: LoadingComponent, decorators: [{
|
|
3645
|
-
type: Component,
|
|
3646
|
-
args: [{ selector: 'ngx-scandoc-loading', template: "<div style=\"width:240px;\">\n\n <div class=\"pb-16\" style=\"font-size: 18px;padding-bottom:16px;\">\n Loading...\n </div>\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n</div>\n" }]
|
|
3647
|
-
}] });
|
|
3648
|
-
|
|
3649
|
-
class ConfirmComponent {
|
|
3650
|
-
onEnterPress(e) {
|
|
3651
|
-
this.action(true);
|
|
3652
|
-
}
|
|
3653
|
-
onEscapePress(e) {
|
|
3654
|
-
this.action(false);
|
|
3655
|
-
}
|
|
3656
|
-
constructor(dialogRef, data) {
|
|
3657
|
-
this.dialogRef = dialogRef;
|
|
3658
|
-
this.data = data;
|
|
3659
|
-
this.showDetails = false;
|
|
3660
|
-
this.images = {
|
|
3661
|
-
alert: 'page-lost.svg',
|
|
3662
|
-
prompt: 'bedroom.svg',
|
|
3663
|
-
dirty: 'opps.svg',
|
|
3664
|
-
};
|
|
3665
|
-
this.options = {};
|
|
3666
|
-
}
|
|
3667
|
-
ngOnInit() {
|
|
3668
|
-
console.log(this.data);
|
|
3669
|
-
this.options = this.data.options || {};
|
|
3670
|
-
this.type = this.options.type || this.data.type || 'prompt';
|
|
3671
|
-
}
|
|
3672
|
-
action(key) {
|
|
3673
|
-
this.dialogRef.close(key);
|
|
3674
|
-
}
|
|
3675
|
-
close() { }
|
|
3676
|
-
}
|
|
3677
|
-
ConfirmComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfirmComponent, deps: [{ token: i1$3.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
3678
|
-
ConfirmComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ConfirmComponent, selector: "ngx-scandoc-confirm", host: { listeners: { "document:keyup.enter": "onEnterPress($event)", "document:keyup.escape": "onEscapePress($event)" } }, ngImport: i0, template: "<header class=\"page-header\" fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <div class=\"title\" ngClass.lt-sm=\"title-small\">\n {{ data.title | translate }}\n\n <!-- {{ data.text.statusText }} {{ data.text.status }} -->\n </div>\n\n <span fxFlex></span>\n\n <!-- <div class=\"separator\"></div>\n\n <button mat-button (click)=\"close()\">\n <mat-icon>close</mat-icon>\n </button> -->\n <!-- <mat-icon class=\"mr-16\" style=\"color:#888;\">info_outline</mat-icon> -->\n</header>\n\n<div fxLayout=\"column\" fxLayoutAlign=\"center center\">\n <!-- <img\n style=\"height: 240px; margin: 34px 0px;display: none;\"\n [src]=\"'/assets/images/illustrations/' + images[type]\"\n /> -->\n <!-- <img style=\"width:60px;\" src=\"/assets/images/illustrations/door-lock.png\"> -->\n\n <div class=\"text\" *ngIf=\"data.text\">\n <span [innerHtml]=\"data.text\"></span>\n </div>\n</div>\n\n<!-- -->\n\n<footer>\n <div class=\"actions\" fxLayout=\"row\" fxLayoutAlign=\"end center\">\n <button\n *ngIf=\"!data.alert && !options?.hideCancelButton\"\n (click)=\"action(false)\"\n mat-raised-button\n >\n {{ data.cancel || \"scandoc.cancel\" | translate }}\n </button>\n\n <button\n *ngIf=\"data.no && !options?.hideNoButton\"\n (click)=\"action('no')\"\n mat-raised-button\n >\n {{ data.no }}\n </button>\n <button\n *ngIf=\"!data.hideOkButton && !options?.hideOkButton\"\n (click)=\"action(true)\"\n mat-raised-button\n >\n <ng-container *ngIf=\"!data.alert\">\n {{ data.ok || \"scandoc.confirm\" | translate }}\n </ng-container>\n\n <ng-container *ngIf=\"data.alert\">\n {{ data.ok || \"scandoc.ok\" | translate }}\n </ng-container>\n </button>\n </div>\n</footer>\n", styles: [":host{display:flex;flex-direction:column;flex:1;height:100%;width:100%}.title{font-size:18px}.text{padding:0 30px;text-align:center;font-size:16px;margin:40px 0}.actions{min-height:60px;padding:0 20px}.actions button{min-width:120px;margin-right:16px;text-transform:uppercase;box-shadow:none;border:1px solid rgba(0,0,0,.12)}footer{background-color:#fff}footer button{box-shadow:none!important;border:1px solid rgba(0,0,0,.12);font-size:13px}\n", ".page-header{z-index:2000;height:64px;padding:0;overflow:hidden;background-color:#fff;border-bottom:1px solid rgba(0,0,0,.12)}.page-header .title{padding-left:24px;line-height:64px;font-size:18px}.page-header .separator{width:1px;background-color:#0000001f;height:100%}.page-header .total{line-height:64px}.page-header .total span{font-weight:700}.page-footer{height:64px}.page-footer button{margin-left:24px;box-shadow:none!important}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] });
|
|
3679
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfirmComponent, decorators: [{
|
|
3680
|
-
type: Component,
|
|
3681
|
-
args: [{ selector: 'ngx-scandoc-confirm', template: "<header class=\"page-header\" fxLayout=\"row\" fxLayoutAlign=\"start center\">\n <div class=\"title\" ngClass.lt-sm=\"title-small\">\n {{ data.title | translate }}\n\n <!-- {{ data.text.statusText }} {{ data.text.status }} -->\n </div>\n\n <span fxFlex></span>\n\n <!-- <div class=\"separator\"></div>\n\n <button mat-button (click)=\"close()\">\n <mat-icon>close</mat-icon>\n </button> -->\n <!-- <mat-icon class=\"mr-16\" style=\"color:#888;\">info_outline</mat-icon> -->\n</header>\n\n<div fxLayout=\"column\" fxLayoutAlign=\"center center\">\n <!-- <img\n style=\"height: 240px; margin: 34px 0px;display: none;\"\n [src]=\"'/assets/images/illustrations/' + images[type]\"\n /> -->\n <!-- <img style=\"width:60px;\" src=\"/assets/images/illustrations/door-lock.png\"> -->\n\n <div class=\"text\" *ngIf=\"data.text\">\n <span [innerHtml]=\"data.text\"></span>\n </div>\n</div>\n\n<!-- -->\n\n<footer>\n <div class=\"actions\" fxLayout=\"row\" fxLayoutAlign=\"end center\">\n <button\n *ngIf=\"!data.alert && !options?.hideCancelButton\"\n (click)=\"action(false)\"\n mat-raised-button\n >\n {{ data.cancel || \"scandoc.cancel\" | translate }}\n </button>\n\n <button\n *ngIf=\"data.no && !options?.hideNoButton\"\n (click)=\"action('no')\"\n mat-raised-button\n >\n {{ data.no }}\n </button>\n <button\n *ngIf=\"!data.hideOkButton && !options?.hideOkButton\"\n (click)=\"action(true)\"\n mat-raised-button\n >\n <ng-container *ngIf=\"!data.alert\">\n {{ data.ok || \"scandoc.confirm\" | translate }}\n </ng-container>\n\n <ng-container *ngIf=\"data.alert\">\n {{ data.ok || \"scandoc.ok\" | translate }}\n </ng-container>\n </button>\n </div>\n</footer>\n", styles: [":host{display:flex;flex-direction:column;flex:1;height:100%;width:100%}.title{font-size:18px}.text{padding:0 30px;text-align:center;font-size:16px;margin:40px 0}.actions{min-height:60px;padding:0 20px}.actions button{min-width:120px;margin-right:16px;text-transform:uppercase;box-shadow:none;border:1px solid rgba(0,0,0,.12)}footer{background-color:#fff}footer button{box-shadow:none!important;border:1px solid rgba(0,0,0,.12);font-size:13px}\n", ".page-header{z-index:2000;height:64px;padding:0;overflow:hidden;background-color:#fff;border-bottom:1px solid rgba(0,0,0,.12)}.page-header .title{padding-left:24px;line-height:64px;font-size:18px}.page-header .separator{width:1px;background-color:#0000001f;height:100%}.page-header .total{line-height:64px}.page-header .total span{font-weight:700}.page-footer{height:64px}.page-footer button{margin-left:24px;box-shadow:none!important}\n"] }]
|
|
3682
|
-
}], ctorParameters: function () {
|
|
3683
|
-
return [{ type: i1$3.MatDialogRef }, { type: undefined, decorators: [{
|
|
3684
|
-
type: Inject,
|
|
3685
|
-
args: [MAT_DIALOG_DATA]
|
|
3686
|
-
}] }];
|
|
3687
|
-
}, propDecorators: { onEnterPress: [{
|
|
3688
|
-
type: HostListener,
|
|
3689
|
-
args: ['document:keyup.enter', ['$event']]
|
|
3690
|
-
}], onEscapePress: [{
|
|
3691
|
-
type: HostListener,
|
|
3692
|
-
args: ['document:keyup.escape', ['$event']]
|
|
3693
|
-
}] } });
|
|
3694
|
-
|
|
3695
|
-
class ScanSelfieComponent extends BaseComponent {
|
|
3696
|
-
constructor(cd, dialogRef, cameraProvider, scanProvider, dialogs) {
|
|
3697
|
-
super();
|
|
3698
|
-
this.cd = cd;
|
|
3699
|
-
this.dialogRef = dialogRef;
|
|
3700
|
-
this.cameraProvider = cameraProvider;
|
|
3701
|
-
this.scanProvider = scanProvider;
|
|
3702
|
-
this.dialogs = dialogs;
|
|
3703
|
-
this.actions = new EventEmitter();
|
|
3704
|
-
this.cameraReady = false;
|
|
3705
|
-
this.preview = null;
|
|
3706
|
-
this.trigger = new Subject();
|
|
3707
|
-
this.form = new FormGroup({});
|
|
3708
|
-
}
|
|
3709
|
-
handleImage(webcamImage) {
|
|
3710
|
-
// console.log('[received webcam image]', webcamImage);
|
|
3711
|
-
this.cameraProvider.$showSwitchSelfie.next(false);
|
|
3712
|
-
this.webcamImage = webcamImage;
|
|
3713
|
-
this.preview = webcamImage.imageAsDataUrl;
|
|
3714
|
-
this.cd.detectChanges();
|
|
3715
|
-
}
|
|
3716
|
-
handleInitError(error) {
|
|
3717
|
-
console.log(error);
|
|
3718
|
-
}
|
|
3719
|
-
videoReady(ev) {
|
|
3720
|
-
this.cameraReady = ev;
|
|
3721
|
-
}
|
|
3722
|
-
ngAfterViewInit() {
|
|
3723
|
-
this.cameraProvider.$showSwitchSelfie.next(true);
|
|
3724
|
-
this.cd.detectChanges();
|
|
3725
|
-
}
|
|
3726
|
-
ngOnDestroy() {
|
|
3727
|
-
this.__destroy();
|
|
3728
|
-
}
|
|
3729
|
-
retry() {
|
|
3730
|
-
this.preview = false;
|
|
3731
|
-
this.cameraProvider.$showSwitchSelfie.next(true);
|
|
3732
|
-
this.cd.detectChanges();
|
|
3733
|
-
}
|
|
3734
|
-
scan() {
|
|
3735
|
-
this.trigger.next(new Date().getTime());
|
|
3736
|
-
}
|
|
3737
|
-
continue() {
|
|
3738
|
-
var _a, _b;
|
|
3739
|
-
console.log(this.data);
|
|
3740
|
-
if (this.scanProvider.enableVerification && this.data.avatar) {
|
|
3741
|
-
const loading = this.dialogs.loading();
|
|
3742
|
-
console.log(this.data.avatar);
|
|
3743
|
-
this.__subs(this.scanProvider.stateless(this.data.avatar.split(',')[1], (_a = this.webcamImage) === null || _a === void 0 ? void 0 : _a.imageAsDataUrl.split(',')[1])).subscribe((resp) => {
|
|
3744
|
-
var _a, _b;
|
|
3745
|
-
loading.close();
|
|
3746
|
-
if ((_a = resp.Data) === null || _a === void 0 ? void 0 : _a.Verified) {
|
|
3747
|
-
(_b = this.dialogRef) === null || _b === void 0 ? void 0 : _b.close(this.webcamImage);
|
|
3748
|
-
}
|
|
3749
|
-
else {
|
|
3750
|
-
this.dialogs.alert('Verification failed!', "We can't verify that your selfie is same as image on document.");
|
|
3751
|
-
}
|
|
3752
|
-
console.log(resp);
|
|
3753
|
-
}, (err) => {
|
|
3754
|
-
var _a;
|
|
3755
|
-
loading.close();
|
|
3756
|
-
(_a = this.dialogRef) === null || _a === void 0 ? void 0 : _a.close(this.webcamImage);
|
|
3757
|
-
});
|
|
3758
|
-
}
|
|
3759
|
-
else {
|
|
3760
|
-
(_b = this.dialogRef) === null || _b === void 0 ? void 0 : _b.close(this.webcamImage);
|
|
3761
|
-
}
|
|
3762
|
-
// this.dialogRef.close(this.webcamImage)
|
|
3763
|
-
}
|
|
3764
|
-
close() {
|
|
3765
|
-
this.dialogRef.close(null);
|
|
3766
|
-
}
|
|
3767
|
-
}
|
|
3768
|
-
ScanSelfieComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScanSelfieComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$3.MatDialogRef }, { token: NgxScandocCameraProvider }, { token: ScanProvider }, { token: NgxScandocDialogsCoreProvider }], target: i0.ɵɵFactoryTarget.Component });
|
|
3769
|
-
ScanSelfieComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ScanSelfieComponent, selector: "ngx-scandoc-selfie", outputs: { actions: "actions" }, usesInheritance: true, ngImport: i0, template: "<header class=\"page-header\">\n <div class=\"title\">\n {{ \"scandoc.result.takeSelfie\" | translate }}\n </div>\n\n <span style=\"flex: 1\"></span>\n\n <ng-container *ngIf=\"cameraProvider.$showSwitchSelfie | async\">\n <div class=\"separator\"></div>\n <div style=\"padding: 0px 16px\">\n <ngx-scan-camera-switch></ngx-scan-camera-switch>\n </div>\n </ng-container>\n\n <ng-container>\n <div class=\"separator\"></div>\n\n <button mat-button (click)=\"close()\">\n <mat-icon>close</mat-icon>\n </button>\n </ng-container>\n</header>\n\n\n<div class=\"flex-column flex\">\n <div #wraper class=\"wraper flex flex-row\">\n <div\n style=\"\n position: absolute;\n top: 0px;\n left: 0px;\n right: 0px;\n bottom: 0px;\n z-index: 20;\n background-color: whitesmoke;\n \"\n *ngIf=\"!cameraReady && !preview\"\n >\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n\n <ng-container>\n <ngx-scandoc-webcam\n *ngIf=\"!preview\"\n class=\"main flex\"\n #webcam\n [trigger]=\"trigger\"\n (imageCapture)=\"handleImage($event)\"\n (initError)=\"handleInitError($event)\"\n (videoReady)=\"videoReady($event)\"\n type=\"selfie\"\n >\n </ngx-scandoc-webcam>\n </ng-container>\n <div\n class=\"previewData\"\n *ngIf=\"preview\"\n style=\"\n z-index: 20;\n position: absolute;\n width: 100%;\n height: 100%;\n flex: 1;\n display: flex;\n flex-direction: row;\n \"\n >\n <div\n class=\"scanPreview\"\n style=\"display: flex; flex-direction: column; flex: 1\"\n >\n <div\n style=\"flex: 1\"\n class=\"image\"\n [style.background-image]=\"'url(' + preview + ')'\"\n ></div>\n </div>\n </div>\n </div>\n\n <footer class=\"p-8 flex-row\">\n <button\n [disabled]=\"!cameraReady\"\n class=\"w-100-p\"\n *ngIf=\"!preview\"\n mat-raised-button\n (click)=\"scan()\"\n >\n <ng-container> {{ \"scandoc.result.takeSelfie\" | translate }} </ng-container>\n </button>\n\n <div\n class=\"w-100-p flex-row flex\"\n *ngIf=\"preview\"\n style=\"align-items: center\"\n >\n <button style=\"flex: 1\" class=\"mr-4\" mat-raised-button (click)=\"retry()\">\n {{ \"scandoc.retry\" | translate }}\n </button>\n\n <button\n style=\"flex: 1\"\n class=\"ml-4\"\n mat-raised-button\n (click)=\"continue()\"\n >\n {{ \"scandoc.continueWithSelectedImage\" | translate }}\n </button>\n </div>\n </footer>\n</div>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1;background-color:#f5f5f5}.flex{flex:1}.flex-column{display:flex;flex-direction:column}.flex-row{display:flex;flex-direction:row}.wraper{position:relative;overflow:hidden}h3{color:#459ae5;font-size:16px}.preview{width:100%;border-radius:1%}.subhead{height:55px;padding-top:8px}footer button{box-shadow:none!important;height:45px;min-height:45px;border:1px solid rgba(0,0,0,.12);text-transform:uppercase}.error .title{font-size:22px}.error ul{font-size:18px}.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}.page-header{display:flex;flex-direction:row;align-items:center}.page-header button{height:100%}@media only screen and (max-width: 768px){header .title{font-size:12px!important;line-height:18px!important}}\n", ".page-header{z-index:2000;height:64px;padding:0;overflow:hidden;background-color:#fff;border-bottom:1px solid rgba(0,0,0,.12)}.page-header .title{padding-left:24px;line-height:64px;font-size:18px}.page-header .separator{width:1px;background-color:#0000001f;height:100%}.page-header .total{line-height:64px}.page-header .total span{font-weight:700}.page-footer{height:64px}.page-footer button{margin-left:24px;box-shadow:none!important}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i8.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: WebcamComponent, selector: "ngx-scandoc-webcam", inputs: ["imageHandler", "type", "trigger"], outputs: ["cameraSwitched", "videoReady", "imageCapture", "initError"] }, { kind: "component", type: CameraSwitchComponent, selector: "ngx-scan-camera-switch" }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3770
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScanSelfieComponent, decorators: [{
|
|
3771
|
-
type: Component,
|
|
3772
|
-
args: [{ selector: 'ngx-scandoc-selfie', changeDetection: ChangeDetectionStrategy.OnPush, template: "<header class=\"page-header\">\n <div class=\"title\">\n {{ \"scandoc.result.takeSelfie\" | translate }}\n </div>\n\n <span style=\"flex: 1\"></span>\n\n <ng-container *ngIf=\"cameraProvider.$showSwitchSelfie | async\">\n <div class=\"separator\"></div>\n <div style=\"padding: 0px 16px\">\n <ngx-scan-camera-switch></ngx-scan-camera-switch>\n </div>\n </ng-container>\n\n <ng-container>\n <div class=\"separator\"></div>\n\n <button mat-button (click)=\"close()\">\n <mat-icon>close</mat-icon>\n </button>\n </ng-container>\n</header>\n\n\n<div class=\"flex-column flex\">\n <div #wraper class=\"wraper flex flex-row\">\n <div\n style=\"\n position: absolute;\n top: 0px;\n left: 0px;\n right: 0px;\n bottom: 0px;\n z-index: 20;\n background-color: whitesmoke;\n \"\n *ngIf=\"!cameraReady && !preview\"\n >\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n\n <ng-container>\n <ngx-scandoc-webcam\n *ngIf=\"!preview\"\n class=\"main flex\"\n #webcam\n [trigger]=\"trigger\"\n (imageCapture)=\"handleImage($event)\"\n (initError)=\"handleInitError($event)\"\n (videoReady)=\"videoReady($event)\"\n type=\"selfie\"\n >\n </ngx-scandoc-webcam>\n </ng-container>\n <div\n class=\"previewData\"\n *ngIf=\"preview\"\n style=\"\n z-index: 20;\n position: absolute;\n width: 100%;\n height: 100%;\n flex: 1;\n display: flex;\n flex-direction: row;\n \"\n >\n <div\n class=\"scanPreview\"\n style=\"display: flex; flex-direction: column; flex: 1\"\n >\n <div\n style=\"flex: 1\"\n class=\"image\"\n [style.background-image]=\"'url(' + preview + ')'\"\n ></div>\n </div>\n </div>\n </div>\n\n <footer class=\"p-8 flex-row\">\n <button\n [disabled]=\"!cameraReady\"\n class=\"w-100-p\"\n *ngIf=\"!preview\"\n mat-raised-button\n (click)=\"scan()\"\n >\n <ng-container> {{ \"scandoc.result.takeSelfie\" | translate }} </ng-container>\n </button>\n\n <div\n class=\"w-100-p flex-row flex\"\n *ngIf=\"preview\"\n style=\"align-items: center\"\n >\n <button style=\"flex: 1\" class=\"mr-4\" mat-raised-button (click)=\"retry()\">\n {{ \"scandoc.retry\" | translate }}\n </button>\n\n <button\n style=\"flex: 1\"\n class=\"ml-4\"\n mat-raised-button\n (click)=\"continue()\"\n >\n {{ \"scandoc.continueWithSelectedImage\" | translate }}\n </button>\n </div>\n </footer>\n</div>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1;background-color:#f5f5f5}.flex{flex:1}.flex-column{display:flex;flex-direction:column}.flex-row{display:flex;flex-direction:row}.wraper{position:relative;overflow:hidden}h3{color:#459ae5;font-size:16px}.preview{width:100%;border-radius:1%}.subhead{height:55px;padding-top:8px}footer button{box-shadow:none!important;height:45px;min-height:45px;border:1px solid rgba(0,0,0,.12);text-transform:uppercase}.error .title{font-size:22px}.error ul{font-size:18px}.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}.page-header{display:flex;flex-direction:row;align-items:center}.page-header button{height:100%}@media only screen and (max-width: 768px){header .title{font-size:12px!important;line-height:18px!important}}\n", ".page-header{z-index:2000;height:64px;padding:0;overflow:hidden;background-color:#fff;border-bottom:1px solid rgba(0,0,0,.12)}.page-header .title{padding-left:24px;line-height:64px;font-size:18px}.page-header .separator{width:1px;background-color:#0000001f;height:100%}.page-header .total{line-height:64px}.page-header .total span{font-weight:700}.page-footer{height:64px}.page-footer button{margin-left:24px;box-shadow:none!important}\n"] }]
|
|
3773
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1$3.MatDialogRef }, { type: NgxScandocCameraProvider }, { type: ScanProvider }, { type: NgxScandocDialogsCoreProvider }]; }, propDecorators: { actions: [{
|
|
3774
|
-
type: Output
|
|
3775
|
-
}] } });
|
|
3776
|
-
|
|
3777
|
-
class TurnDocumentComponent {
|
|
3778
|
-
constructor(dialogRef, data) {
|
|
3779
|
-
this.dialogRef = dialogRef;
|
|
3780
|
-
this.data = data;
|
|
3781
|
-
}
|
|
3782
|
-
ngOnInit() {
|
|
3783
|
-
console.log(this.data);
|
|
3784
|
-
}
|
|
3785
|
-
close() {
|
|
3786
|
-
console.log(this.dialogRef);
|
|
3787
|
-
this.dialogRef.close();
|
|
3788
|
-
}
|
|
3789
|
-
}
|
|
3790
|
-
TurnDocumentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TurnDocumentComponent, deps: [{ token: i1$3.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
3791
|
-
TurnDocumentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TurnDocumentComponent, selector: "ngx-scandoc-turn-document", ngImport: i0, template: "<div class=\"inner\" fxLayout=\"column\" fxLayoutAlign=\"center center\">\n <!-- <img\n style=\"height: 240px; margin: 34px 0px;display: none;\"\n [src]=\"'/assets/images/illustrations/' + images[type]\"\n /> -->\n <!-- <img style=\"width:60px;\" src=\"/assets/images/illustrations/door-lock.png\"> -->\n\n <mat-icon>360</mat-icon>\n <div class=\"text\">\n <ng-container *ngIf=\"data.idScan === 'BACK'\">\n {{ \"scandoc.turnAndCapture.back\" | translate }}\n </ng-container>\n <ng-container *ngIf=\"data.idScan === 'FRONT'\">\n {{ \"scandoc.turnAndCapture.front\" | translate }}\n </ng-container>\n </div>\n</div>\n\n<!-- -->\n\n<footer>\n <button (click)=\"close()\" mat-raised-button>Ok</button>\n</footer>\n", styles: [":host{display:flex;flex-direction:column;flex:1;height:100%;width:100%}.inner{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:30px 20px 0}.inner mat-icon{width:60px;height:60px;font-size:60px}.inner .text{margin:20px 0}footer{display:flex;flex-direction:row;align-items:center;justify-content:center;padding-bottom:20px}footer button{min-width:200px;box-shadow:none;border:1px solid #ccc}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] });
|
|
3792
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TurnDocumentComponent, decorators: [{
|
|
3793
|
-
type: Component,
|
|
3794
|
-
args: [{ selector: 'ngx-scandoc-turn-document', template: "<div class=\"inner\" fxLayout=\"column\" fxLayoutAlign=\"center center\">\n <!-- <img\n style=\"height: 240px; margin: 34px 0px;display: none;\"\n [src]=\"'/assets/images/illustrations/' + images[type]\"\n /> -->\n <!-- <img style=\"width:60px;\" src=\"/assets/images/illustrations/door-lock.png\"> -->\n\n <mat-icon>360</mat-icon>\n <div class=\"text\">\n <ng-container *ngIf=\"data.idScan === 'BACK'\">\n {{ \"scandoc.turnAndCapture.back\" | translate }}\n </ng-container>\n <ng-container *ngIf=\"data.idScan === 'FRONT'\">\n {{ \"scandoc.turnAndCapture.front\" | translate }}\n </ng-container>\n </div>\n</div>\n\n<!-- -->\n\n<footer>\n <button (click)=\"close()\" mat-raised-button>Ok</button>\n</footer>\n", styles: [":host{display:flex;flex-direction:column;flex:1;height:100%;width:100%}.inner{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:30px 20px 0}.inner mat-icon{width:60px;height:60px;font-size:60px}.inner .text{margin:20px 0}footer{display:flex;flex-direction:row;align-items:center;justify-content:center;padding-bottom:20px}footer button{min-width:200px;box-shadow:none;border:1px solid #ccc}\n"] }]
|
|
3795
|
-
}], ctorParameters: function () {
|
|
3796
|
-
return [{ type: i1$3.MatDialogRef }, { type: undefined, decorators: [{
|
|
3797
|
-
type: Inject,
|
|
3798
|
-
args: [MAT_DIALOG_DATA]
|
|
3799
|
-
}] }];
|
|
3800
|
-
} });
|
|
3801
|
-
|
|
3802
|
-
class PromptManualComponent {
|
|
3803
|
-
constructor(dialogRef, data) {
|
|
3804
|
-
this.dialogRef = dialogRef;
|
|
3805
|
-
this.data = data;
|
|
3806
|
-
}
|
|
3807
|
-
ngOnInit() {
|
|
3808
|
-
console.log(this.data);
|
|
3809
|
-
}
|
|
3810
|
-
close(key) {
|
|
3811
|
-
console.log(this.dialogRef);
|
|
3812
|
-
this.dialogRef.close(key);
|
|
3813
|
-
}
|
|
3814
|
-
}
|
|
3815
|
-
PromptManualComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromptManualComponent, deps: [{ token: i1$3.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
3816
|
-
PromptManualComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: PromptManualComponent, selector: "ngx-scandoc-prompt-manual", ngImport: i0, template: "<div class=\"inner\" fxLayout=\"column\" fxLayoutAlign=\"center center\">\n <!-- <img\n style=\"height: 240px; margin: 34px 0px;display: none;\"\n [src]=\"'/assets/images/illustrations/' + images[type]\"\n /> -->\n <!-- <img style=\"width:60px;\" src=\"/assets/images/illustrations/door-lock.png\"> -->\n\n <mat-icon>screenshot_keyboard</mat-icon>\n <div class=\"text\">\n {{ \"scandoc.manual\" | translate }}\n </div>\n</div>\n\n<!-- -->\n\n<footer>\n <button style=\"margin-right: 8px\" (click)=\"close(true)\" mat-raised-button>\n {{ \"scandoc.yes\" | translate }}\n </button>\n <button style=\"margin-left: 8px\" (click)=\"close(false)\" mat-raised-button>\n {{ \"scandoc.no\" | translate }}\n </button>\n</footer>\n", styles: [":host{display:flex;flex-direction:column;flex:1;height:100%;width:100%}.inner{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:30px 20px 0}.inner mat-icon{width:60px;height:60px;font-size:60px}.inner .text{margin:20px 0}footer{display:flex;flex-direction:row;align-items:center;justify-content:center;padding-bottom:10px}footer button{max-width:120px;box-shadow:none;border:1px solid #ccc;flex:1}\n"], dependencies: [{ kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] });
|
|
3817
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PromptManualComponent, decorators: [{
|
|
3818
|
-
type: Component,
|
|
3819
|
-
args: [{ selector: 'ngx-scandoc-prompt-manual', template: "<div class=\"inner\" fxLayout=\"column\" fxLayoutAlign=\"center center\">\n <!-- <img\n style=\"height: 240px; margin: 34px 0px;display: none;\"\n [src]=\"'/assets/images/illustrations/' + images[type]\"\n /> -->\n <!-- <img style=\"width:60px;\" src=\"/assets/images/illustrations/door-lock.png\"> -->\n\n <mat-icon>screenshot_keyboard</mat-icon>\n <div class=\"text\">\n {{ \"scandoc.manual\" | translate }}\n </div>\n</div>\n\n<!-- -->\n\n<footer>\n <button style=\"margin-right: 8px\" (click)=\"close(true)\" mat-raised-button>\n {{ \"scandoc.yes\" | translate }}\n </button>\n <button style=\"margin-left: 8px\" (click)=\"close(false)\" mat-raised-button>\n {{ \"scandoc.no\" | translate }}\n </button>\n</footer>\n", styles: [":host{display:flex;flex-direction:column;flex:1;height:100%;width:100%}.inner{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:30px 20px 0}.inner mat-icon{width:60px;height:60px;font-size:60px}.inner .text{margin:20px 0}footer{display:flex;flex-direction:row;align-items:center;justify-content:center;padding-bottom:10px}footer button{max-width:120px;box-shadow:none;border:1px solid #ccc;flex:1}\n"] }]
|
|
3820
|
-
}], ctorParameters: function () {
|
|
3821
|
-
return [{ type: i1$3.MatDialogRef }, { type: undefined, decorators: [{
|
|
3822
|
-
type: Inject,
|
|
3823
|
-
args: [MAT_DIALOG_DATA]
|
|
3824
|
-
}] }];
|
|
3825
|
-
} });
|
|
3826
|
-
|
|
3827
|
-
class NgxScandocDialogsCoreProvider {
|
|
3828
|
-
constructor(matDialog) {
|
|
3829
|
-
this.matDialog = matDialog;
|
|
3830
|
-
this.components = {
|
|
3831
|
-
ScanProfile: { component: ScanProfileComponent },
|
|
3832
|
-
Loading: { component: LoadingComponent },
|
|
3833
|
-
ConfirmComponent: { component: ConfirmComponent },
|
|
3834
|
-
TurnDocumentComponent: { component: TurnDocumentComponent },
|
|
3835
|
-
ScanSelfie: { component: ScanSelfieComponent },
|
|
3836
|
-
PromptManual: { component: PromptManualComponent },
|
|
3837
|
-
};
|
|
3838
|
-
this.blank = BlankComponent;
|
|
3839
|
-
}
|
|
3840
|
-
getComponent(name) {
|
|
3841
|
-
if (!this.components[name]) {
|
|
3842
|
-
console.warn('Component missing', name, this.components);
|
|
3843
|
-
}
|
|
3844
|
-
return this.components[name].component;
|
|
3845
|
-
}
|
|
3846
|
-
open(config, withComponent = true) {
|
|
3847
|
-
// console.log(config);
|
|
3848
|
-
const panelClass = config.panelClass ? config.panelClass : config.name;
|
|
3849
|
-
const component = this.getComponent(config.name);
|
|
3850
|
-
const dialogRef = this.matDialog.open(this.blank, {
|
|
3851
|
-
panelClass,
|
|
3852
|
-
data: {
|
|
3853
|
-
data: config.data,
|
|
3854
|
-
withComponent,
|
|
3855
|
-
component,
|
|
3856
|
-
},
|
|
3857
|
-
autoFocus: false,
|
|
3858
|
-
width: config.width || '',
|
|
3859
|
-
height: config.height || '',
|
|
3860
|
-
maxWidth: config.maxWidth || '',
|
|
3861
|
-
minWidth: config.minWidth || '',
|
|
3862
|
-
maxHeight: config.maxHeight || '',
|
|
3863
|
-
minHeight: config.minHeight || '',
|
|
3864
|
-
position: config.position || {},
|
|
3865
|
-
hasBackdrop: config.hasBackdrop === undefined ? true : config.hasBackdrop,
|
|
3866
|
-
disableClose: config.disableClose === undefined ? true : config.disableClose,
|
|
3867
|
-
});
|
|
3868
|
-
return dialogRef;
|
|
3869
|
-
}
|
|
3870
|
-
scanProfile(data) {
|
|
3871
|
-
return this.open({
|
|
3872
|
-
name: 'ScanProfile',
|
|
3873
|
-
panelClass: 'ScanProfileComponent',
|
|
3874
|
-
data,
|
|
3875
|
-
});
|
|
3876
|
-
}
|
|
3877
|
-
// Generic loading dialog
|
|
3878
|
-
loading(title = '') {
|
|
3879
|
-
return this.open({
|
|
3880
|
-
name: 'Loading',
|
|
3881
|
-
data: { title },
|
|
3882
|
-
});
|
|
3883
|
-
}
|
|
3884
|
-
alert(title, text) {
|
|
3885
|
-
return this.open({
|
|
3886
|
-
name: 'ConfirmComponent',
|
|
3887
|
-
maxWidth: '600px',
|
|
3888
|
-
panelClass: 'DialogNoPadding',
|
|
3889
|
-
minWidth: '440px',
|
|
3890
|
-
data: { title, text, alert: true },
|
|
3891
|
-
});
|
|
3892
|
-
}
|
|
3893
|
-
turnDocument(idScan) {
|
|
3894
|
-
return this.open({
|
|
3895
|
-
name: 'TurnDocumentComponent',
|
|
3896
|
-
maxWidth: '400px',
|
|
3897
|
-
panelClass: 'DialogNoPadding',
|
|
3898
|
-
minWidth: '300px',
|
|
3899
|
-
data: { idScan },
|
|
3900
|
-
}).afterClosed();
|
|
3901
|
-
}
|
|
3902
|
-
promptManual() {
|
|
3903
|
-
return this.open({
|
|
3904
|
-
name: 'PromptManual',
|
|
3905
|
-
maxWidth: '400px',
|
|
3906
|
-
panelClass: 'DialogNoPadding',
|
|
3907
|
-
minWidth: '300px',
|
|
3908
|
-
data: {},
|
|
3909
|
-
}).afterClosed();
|
|
3910
|
-
}
|
|
3911
|
-
// public scanMobile(data: any) {
|
|
3912
|
-
// return this.open({
|
|
3913
|
-
// name: 'ScanMobileComponent',
|
|
3914
|
-
// maxWidth: '600px',
|
|
3915
|
-
// panelClass: 'DialogNoPadding',
|
|
3916
|
-
// minWidth: '440px',
|
|
3917
|
-
// data,
|
|
3918
|
-
// });
|
|
3919
|
-
// }
|
|
3920
|
-
scanSelfie(data) {
|
|
3921
|
-
return this.open({
|
|
3922
|
-
name: 'ScanSelfie',
|
|
3923
|
-
panelClass: 'ScanProfileComponent',
|
|
3924
|
-
data,
|
|
3925
|
-
});
|
|
3926
|
-
}
|
|
3927
|
-
}
|
|
3928
|
-
NgxScandocDialogsCoreProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocDialogsCoreProvider, deps: [{ token: i1$3.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3929
|
-
NgxScandocDialogsCoreProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocDialogsCoreProvider, providedIn: 'root' });
|
|
3930
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocDialogsCoreProvider, decorators: [{
|
|
3931
|
-
type: Injectable,
|
|
3932
|
-
args: [{
|
|
3933
|
-
providedIn: 'root',
|
|
3934
|
-
}]
|
|
3935
|
-
}], ctorParameters: function () { return [{ type: i1$3.MatDialog }]; } });
|
|
3936
|
-
|
|
3937
|
-
class ScanProfileComponent extends BaseComponent {
|
|
3938
|
-
handleTouchMove(event) {
|
|
3939
|
-
// console.log(event);
|
|
3940
|
-
if (event.touches.length > 1) {
|
|
3941
|
-
event.preventDefault();
|
|
3942
|
-
}
|
|
3943
|
-
// console.log(document.body.style.zoom);
|
|
3944
|
-
if (event.scale !== 1) {
|
|
3945
|
-
// event.preventDefault();
|
|
3946
|
-
// event.stopImmediatePropagation();
|
|
3947
|
-
}
|
|
3948
|
-
}
|
|
3949
|
-
constructor(dialogs, cameraProvider, scanProvider, dialogRef, platform) {
|
|
3950
|
-
super();
|
|
3951
|
-
this.dialogs = dialogs;
|
|
3952
|
-
this.cameraProvider = cameraProvider;
|
|
3953
|
-
this.scanProvider = scanProvider;
|
|
3954
|
-
this.dialogRef = dialogRef;
|
|
3955
|
-
this.platform = platform;
|
|
3956
|
-
this.type = 'desktop';
|
|
3957
|
-
this.showDialog = false;
|
|
3958
|
-
}
|
|
3959
|
-
ngAfterViewInit() {
|
|
3960
|
-
// console.log(this.cameraProvider)
|
|
3961
|
-
}
|
|
3962
|
-
ngOnDestroy() {
|
|
3963
|
-
this.__destroy();
|
|
3964
|
-
console.log('DES');
|
|
3965
|
-
}
|
|
3966
|
-
actions(event) {
|
|
3967
|
-
var _a, _b, _c;
|
|
3968
|
-
switch (event.type) {
|
|
3969
|
-
case 'scanFinish':
|
|
3970
|
-
if (this.scanProvider.config.hideResults) {
|
|
3971
|
-
(_a = this.dialogRef) === null || _a === void 0 ? void 0 : _a.close(event.data);
|
|
3972
|
-
}
|
|
3973
|
-
break;
|
|
3974
|
-
case 'manualMode':
|
|
3975
|
-
(_b = this.dialogRef) === null || _b === void 0 ? void 0 : _b.close({ manual: true });
|
|
3976
|
-
break;
|
|
3977
|
-
case 'scanDataClose':
|
|
3978
|
-
(_c = this.dialogRef) === null || _c === void 0 ? void 0 : _c.close(event.data);
|
|
3979
|
-
break;
|
|
3980
|
-
case 'turnDocumentOver':
|
|
3981
|
-
this.__subs(this.dialogs.turnDocument(event.side)).subscribe(() => {
|
|
3982
|
-
this.showDialog = false;
|
|
3983
|
-
});
|
|
3984
|
-
break;
|
|
3985
|
-
}
|
|
3986
|
-
}
|
|
3987
|
-
close() {
|
|
3988
|
-
var _a;
|
|
3989
|
-
(_a = this.dialogRef) === null || _a === void 0 ? void 0 : _a.close();
|
|
3990
|
-
}
|
|
3991
|
-
}
|
|
3992
|
-
ScanProfileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScanProfileComponent, deps: [{ token: NgxScandocDialogsCoreProvider }, { token: NgxScandocCameraProvider }, { token: ScanProvider }, { token: i1$3.MatDialogRef }, { token: i2.Platform }], target: i0.ɵɵFactoryTarget.Component });
|
|
3993
|
-
ScanProfileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ScanProfileComponent, selector: "ngx-scandoc-profile", inputs: { type: "type" }, host: { listeners: { "touchmove": "handleTouchMove($event)" } }, usesInheritance: true, ngImport: i0, template: "<header class=\"page-header\">\n <div class=\"title\" >\n {{ \"scandoc.title\" | translate }}\n </div>\n\n <span style=\"flex: 1\"></span>\n\n <ng-container *ngIf=\"cameraProvider.$showSwitch| async\">\n <div class=\"separator\"></div>\n <div style=\"padding: 0px 16px\">\n <ngx-scan-camera-switch></ngx-scan-camera-switch>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"type === 'desktop'\">\n <div class=\"separator\"></div>\n\n <button mat-button (click)=\"close()\">\n <mat-icon>close</mat-icon>\n </button>\n </ng-container>\n</header>\n\n<ngx-scan\n (actions)=\"actions($event)\"\n [showDialog]=\"showDialog\"\n [dialogs]=\"dialogs\"\n></ngx-scan>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1;background-color:#f5f5f5;overflow:hidden}.page-header{display:flex;flex-direction:row;align-items:center}.page-header button{height:100%}@media only screen and (max-width: 768px){header .title{font-size:12px!important;line-height:18px!important}}\n", ".page-header{z-index:2000;height:64px;padding:0;overflow:hidden;background-color:#fff;border-bottom:1px solid rgba(0,0,0,.12)}.page-header .title{padding-left:24px;line-height:64px;font-size:18px}.page-header .separator{width:1px;background-color:#0000001f;height:100%}.page-header .total{line-height:64px}.page-header .total span{font-weight:700}.page-footer{height:64px}.page-footer button{margin-left:24px;box-shadow:none!important}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: ScanComponent, selector: "ngx-scan", inputs: ["type", "dialogs", "showDialog"], outputs: ["actions"] }, { kind: "component", type: CameraSwitchComponent, selector: "ngx-scan-camera-switch" }, { kind: "pipe", type: i2$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3994
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScanProfileComponent, decorators: [{
|
|
3995
|
-
type: Component,
|
|
3996
|
-
args: [{ selector: 'ngx-scandoc-profile', changeDetection: ChangeDetectionStrategy.OnPush, template: "<header class=\"page-header\">\n <div class=\"title\" >\n {{ \"scandoc.title\" | translate }}\n </div>\n\n <span style=\"flex: 1\"></span>\n\n <ng-container *ngIf=\"cameraProvider.$showSwitch| async\">\n <div class=\"separator\"></div>\n <div style=\"padding: 0px 16px\">\n <ngx-scan-camera-switch></ngx-scan-camera-switch>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"type === 'desktop'\">\n <div class=\"separator\"></div>\n\n <button mat-button (click)=\"close()\">\n <mat-icon>close</mat-icon>\n </button>\n </ng-container>\n</header>\n\n<ngx-scan\n (actions)=\"actions($event)\"\n [showDialog]=\"showDialog\"\n [dialogs]=\"dialogs\"\n></ngx-scan>\n", styles: [":host{display:flex;flex-direction:column!important;flex:1;background-color:#f5f5f5;overflow:hidden}.page-header{display:flex;flex-direction:row;align-items:center}.page-header button{height:100%}@media only screen and (max-width: 768px){header .title{font-size:12px!important;line-height:18px!important}}\n", ".page-header{z-index:2000;height:64px;padding:0;overflow:hidden;background-color:#fff;border-bottom:1px solid rgba(0,0,0,.12)}.page-header .title{padding-left:24px;line-height:64px;font-size:18px}.page-header .separator{width:1px;background-color:#0000001f;height:100%}.page-header .total{line-height:64px}.page-header .total span{font-weight:700}.page-footer{height:64px}.page-footer button{margin-left:24px;box-shadow:none!important}\n"] }]
|
|
3997
|
-
}], ctorParameters: function () { return [{ type: NgxScandocDialogsCoreProvider }, { type: NgxScandocCameraProvider }, { type: ScanProvider }, { type: i1$3.MatDialogRef }, { type: i2.Platform }]; }, propDecorators: { type: [{
|
|
3998
|
-
type: Input
|
|
3999
|
-
}], handleTouchMove: [{
|
|
4000
|
-
type: HostListener,
|
|
4001
|
-
args: ['touchmove', ['$event']]
|
|
4002
|
-
}] } });
|
|
4003
|
-
|
|
4004
|
-
//import { NgxScandocCameraProvider } from '../providers/camera.provider';
|
|
4005
|
-
//import { NgxScandocCameraProvider } from '../providers/camera.provider';
|
|
4006
|
-
class DialogsModule {
|
|
4007
|
-
static forRoot() {
|
|
4008
|
-
return {
|
|
4009
|
-
ngModule: DialogsModule,
|
|
4010
|
-
providers: [NgxScandocDialogsCoreProvider],
|
|
4011
|
-
};
|
|
4012
|
-
}
|
|
4013
|
-
}
|
|
4014
|
-
DialogsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DialogsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4015
|
-
DialogsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: DialogsModule, declarations: [ScanProfileComponent,
|
|
4016
|
-
BlankComponent,
|
|
4017
|
-
LoadingComponent,
|
|
4018
|
-
ConfirmComponent,
|
|
4019
|
-
TurnDocumentComponent,
|
|
4020
|
-
ScanSelfieComponent,
|
|
4021
|
-
PromptManualComponent], imports: [
|
|
4022
|
-
// QRCodeModule,
|
|
4023
|
-
ReactiveFormsModule,
|
|
4024
|
-
CommonModule,
|
|
4025
|
-
FormsModule,
|
|
4026
|
-
AppFormModule,
|
|
4027
|
-
TranslateModule,
|
|
4028
|
-
MaterialModule, CoreComponentsModule, CorePipesModule
|
|
4029
|
-
], exports: [ScanProfileComponent,
|
|
4030
|
-
LoadingComponent,
|
|
4031
|
-
BlankComponent,
|
|
4032
|
-
TurnDocumentComponent,
|
|
4033
|
-
MaterialModule,
|
|
4034
|
-
ScanSelfieComponent,
|
|
4035
|
-
PromptManualComponent,
|
|
4036
|
-
CoreComponentsModule] });
|
|
4037
|
-
DialogsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DialogsModule, imports: [
|
|
4038
|
-
// QRCodeModule,
|
|
4039
|
-
ReactiveFormsModule,
|
|
4040
|
-
CommonModule,
|
|
4041
|
-
FormsModule,
|
|
4042
|
-
AppFormModule,
|
|
4043
|
-
TranslateModule,
|
|
4044
|
-
MaterialModule,
|
|
4045
|
-
CoreComponentsModule.forRoot(),
|
|
4046
|
-
CorePipesModule, MaterialModule,
|
|
4047
|
-
CoreComponentsModule
|
|
4048
|
-
] });
|
|
4049
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DialogsModule, decorators: [{
|
|
4050
|
-
type: NgModule,
|
|
4051
|
-
args: [{
|
|
4052
|
-
declarations: [
|
|
4053
|
-
ScanProfileComponent,
|
|
4054
|
-
BlankComponent,
|
|
4055
|
-
LoadingComponent,
|
|
4056
|
-
ConfirmComponent,
|
|
4057
|
-
TurnDocumentComponent,
|
|
4058
|
-
ScanSelfieComponent,
|
|
4059
|
-
PromptManualComponent,
|
|
4060
|
-
],
|
|
4061
|
-
exports: [
|
|
4062
|
-
ScanProfileComponent,
|
|
4063
|
-
LoadingComponent,
|
|
4064
|
-
BlankComponent,
|
|
4065
|
-
TurnDocumentComponent,
|
|
4066
|
-
MaterialModule,
|
|
4067
|
-
ScanSelfieComponent,
|
|
4068
|
-
PromptManualComponent,
|
|
4069
|
-
CoreComponentsModule,
|
|
4070
|
-
],
|
|
4071
|
-
imports: [
|
|
4072
|
-
// QRCodeModule,
|
|
4073
|
-
ReactiveFormsModule,
|
|
4074
|
-
CommonModule,
|
|
4075
|
-
FormsModule,
|
|
4076
|
-
AppFormModule,
|
|
4077
|
-
TranslateModule,
|
|
4078
|
-
MaterialModule,
|
|
4079
|
-
CoreComponentsModule.forRoot(),
|
|
4080
|
-
CorePipesModule,
|
|
4081
|
-
// FlexModule,
|
|
4082
|
-
// FlexLayoutModule,
|
|
4083
|
-
],
|
|
4084
|
-
providers: [],
|
|
4085
|
-
}]
|
|
4086
|
-
}] });
|
|
4087
|
-
|
|
4088
|
-
class HttpErrorInterceptor {
|
|
4089
|
-
constructor(injector) {
|
|
4090
|
-
this.injector = injector;
|
|
4091
|
-
this.authProvider = this.injector.get(NgxScandocAuthProvider);
|
|
4092
|
-
}
|
|
4093
|
-
intercept(req, next) {
|
|
4094
|
-
//console.log(req.url);
|
|
4095
|
-
if (req.url.indexOf('/ks/') >= 0 || req.url.indexOf('/assets/') >= 0) {
|
|
4096
|
-
return next.handle(req);
|
|
4097
|
-
}
|
|
4098
|
-
// const authProvider = this.injector.get(AuthProvider);
|
|
4099
|
-
if (this.authProvider.config.validDomains) {
|
|
4100
|
-
const valid = this.authProvider.config.validDomains
|
|
4101
|
-
.map((domain) => {
|
|
4102
|
-
return req.url.indexOf(domain) >= 0;
|
|
4103
|
-
})
|
|
4104
|
-
.filter((m) => m).length > 0;
|
|
4105
|
-
if (!valid) {
|
|
4106
|
-
return next.handle(req);
|
|
4107
|
-
}
|
|
4108
|
-
}
|
|
4109
|
-
this.inflightAuthRequest = this.authProvider.accesToken;
|
|
4110
|
-
return this.inflightAuthRequest.pipe(share(), switchMap((token) => {
|
|
4111
|
-
// unset request inflight
|
|
4112
|
-
this.inflightAuthRequest = null;
|
|
4113
|
-
const transaction = req.headers.get('TransactionID');
|
|
4114
|
-
const authReq = req.clone({
|
|
4115
|
-
headers: this.getHeaders(token, transaction || ''),
|
|
4116
|
-
});
|
|
4117
|
-
return next.handle(authReq);
|
|
4118
|
-
}), catchError((err) => {
|
|
4119
|
-
let tokenExpired = false;
|
|
4120
|
-
if (err.errors) {
|
|
4121
|
-
const find = err.erros.find((es) => es.indexOf('Invalid token') > -1);
|
|
4122
|
-
tokenExpired = find ? true : false;
|
|
4123
|
-
}
|
|
4124
|
-
console.log(err);
|
|
4125
|
-
if (err.status === 401 || err.status === 403 || tokenExpired) {
|
|
4126
|
-
return this.authProvider.refreshToken().pipe(switchMap((token) => {
|
|
4127
|
-
const transaction = req.headers.get('TransactionID');
|
|
4128
|
-
const authReq = req.clone({
|
|
4129
|
-
headers: this.getHeaders(token, transaction || ''),
|
|
4130
|
-
});
|
|
4131
|
-
return next.handle(authReq);
|
|
4132
|
-
}));
|
|
4133
|
-
}
|
|
4134
|
-
else {
|
|
4135
|
-
return throwError(() => err);
|
|
4136
|
-
}
|
|
4137
|
-
}));
|
|
4138
|
-
}
|
|
4139
|
-
getHeaders(token, TransactionID) {
|
|
4140
|
-
if (TransactionID) {
|
|
4141
|
-
return new HttpHeaders({
|
|
4142
|
-
'Content-Type': 'application/json',
|
|
4143
|
-
Authorization: token,
|
|
4144
|
-
TransactionID,
|
|
4145
|
-
});
|
|
4146
|
-
}
|
|
4147
|
-
return new HttpHeaders({
|
|
4148
|
-
'Content-Type': 'application/json',
|
|
4149
|
-
Authorization: token,
|
|
4150
|
-
});
|
|
4151
|
-
}
|
|
4152
|
-
}
|
|
4153
|
-
HttpErrorInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpErrorInterceptor, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4154
|
-
HttpErrorInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpErrorInterceptor });
|
|
4155
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HttpErrorInterceptor, decorators: [{
|
|
4156
|
-
type: Injectable
|
|
4157
|
-
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
4158
|
-
|
|
4159
|
-
class Iso11649Reference {
|
|
4160
|
-
constructor() {
|
|
4161
|
-
this.FORMAT_RF = /^RF[0-9]{2}[A-Z0-9]{1,21}$/;
|
|
4162
|
-
this.CHARCODE_A = 'A'.charCodeAt(0);
|
|
4163
|
-
this.CHARCODE_0 = '0'.charCodeAt(0);
|
|
4164
|
-
}
|
|
4165
|
-
validate(rawValue) {
|
|
4166
|
-
const value = rawValue.replace(/ /g, '');
|
|
4167
|
-
// console.log(value);
|
|
4168
|
-
if (!value.match(this.FORMAT_RF)) {
|
|
4169
|
-
return false;
|
|
4170
|
-
// throw new Error('Invalid Creditor Reference format; expecting: \'' + this.FORMAT_RF + '\', found: \'' + value + '\'');
|
|
4171
|
-
}
|
|
4172
|
-
return (this.computeWithoutCheck(value.substring(4, value.length) + value.substring(0, 4)) === 1);
|
|
4173
|
-
}
|
|
4174
|
-
computeWithoutCheck(rawValue) {
|
|
4175
|
-
return this.mod97(rawValue);
|
|
4176
|
-
}
|
|
4177
|
-
mod97(value) {
|
|
4178
|
-
let buffer = 0;
|
|
4179
|
-
let charCode;
|
|
4180
|
-
for (let i = 0; i < value.length; ++i) {
|
|
4181
|
-
charCode = value.charCodeAt(i);
|
|
4182
|
-
buffer =
|
|
4183
|
-
charCode +
|
|
4184
|
-
(charCode >= this.CHARCODE_A
|
|
4185
|
-
? buffer * 100 - this.CHARCODE_A + 10
|
|
4186
|
-
: buffer * 10 - this.CHARCODE_0);
|
|
4187
|
-
if (buffer > 1000000) {
|
|
4188
|
-
buffer %= 97;
|
|
4189
|
-
}
|
|
4190
|
-
}
|
|
4191
|
-
return buffer % 97;
|
|
4192
|
-
}
|
|
4193
|
-
}
|
|
4194
|
-
class ObjectUtils {
|
|
4195
|
-
static getValue(target, key) {
|
|
4196
|
-
if (!target) {
|
|
4197
|
-
return undefined;
|
|
4198
|
-
}
|
|
4199
|
-
const keys = key.split('.');
|
|
4200
|
-
key = '';
|
|
4201
|
-
do {
|
|
4202
|
-
key += keys.shift();
|
|
4203
|
-
const value = target[key];
|
|
4204
|
-
if (value !== undefined && (typeof value === 'object' || !keys.length)) {
|
|
4205
|
-
target = value;
|
|
4206
|
-
key = '';
|
|
4207
|
-
}
|
|
4208
|
-
else if (!keys.length) {
|
|
4209
|
-
target = undefined;
|
|
4210
|
-
}
|
|
4211
|
-
else {
|
|
4212
|
-
key += '.';
|
|
4213
|
-
}
|
|
4214
|
-
} while (keys.length);
|
|
4215
|
-
return target;
|
|
4216
|
-
}
|
|
4217
|
-
static deepCopy(inputObj) {
|
|
4218
|
-
let newObj = inputObj;
|
|
4219
|
-
if (inputObj && typeof inputObj === 'object') {
|
|
4220
|
-
newObj =
|
|
4221
|
-
Object.prototype.toString.call(inputObj) === '[object Array]' ? [] : {};
|
|
4222
|
-
for (const i of Object.keys(inputObj)) {
|
|
4223
|
-
newObj[i] = this.deepCopy(inputObj[i]);
|
|
4224
|
-
}
|
|
4225
|
-
if (Object.prototype.toString.call(inputObj) === '[object Map]') {
|
|
4226
|
-
newObj = new Map();
|
|
4227
|
-
inputObj.forEach((v, k) => {
|
|
4228
|
-
newObj.set(k, this.deepCopy(v));
|
|
4229
|
-
});
|
|
4230
|
-
}
|
|
4231
|
-
}
|
|
4232
|
-
return newObj;
|
|
4233
|
-
}
|
|
4234
|
-
static copy(item) {
|
|
4235
|
-
return JSON.parse(JSON.stringify(item));
|
|
4236
|
-
}
|
|
4237
|
-
static compare(a, b, isAsc) {
|
|
4238
|
-
return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
|
|
4239
|
-
}
|
|
4240
|
-
static merge(...objects) {
|
|
4241
|
-
const result = {};
|
|
4242
|
-
objects.forEach((source) => {
|
|
4243
|
-
Object.keys(source).forEach((prop) => {
|
|
4244
|
-
if (prop in result && Array.isArray(result[prop])) {
|
|
4245
|
-
result[prop] = result[prop].concat(source[prop]);
|
|
4246
|
-
}
|
|
4247
|
-
else if (prop in result && typeof result[prop] === 'object') {
|
|
4248
|
-
result[prop] = ObjectUtils.merge(result[prop], source[prop]);
|
|
4249
|
-
}
|
|
4250
|
-
else {
|
|
4251
|
-
result[prop] = source[prop];
|
|
4252
|
-
}
|
|
4253
|
-
});
|
|
4254
|
-
});
|
|
4255
|
-
return result;
|
|
4256
|
-
}
|
|
4257
|
-
}
|
|
4258
|
-
|
|
4259
|
-
class ComponentTranslationModel {
|
|
4260
|
-
constructor(obj) {
|
|
4261
|
-
this.name = obj && obj.name;
|
|
4262
|
-
this.path = obj && obj.path;
|
|
4263
|
-
this.json = (obj && obj.json) || [];
|
|
4264
|
-
}
|
|
4265
|
-
}
|
|
4266
|
-
class TranslateLoaderProvider {
|
|
4267
|
-
constructor(http) {
|
|
4268
|
-
this.http = http;
|
|
4269
|
-
// private prefix = null;
|
|
4270
|
-
this.suffix = '.json';
|
|
4271
|
-
this.providers = [];
|
|
4272
|
-
this.queue = [];
|
|
4273
|
-
}
|
|
4274
|
-
ngOnDestroy() {
|
|
4275
|
-
console.log('TRANSLATE DESTROY');
|
|
4276
|
-
}
|
|
4277
|
-
registerProvider(name, path) {
|
|
4278
|
-
const registered = this.providers.find((provider) => provider.name === name);
|
|
4279
|
-
if (registered) {
|
|
4280
|
-
registered.path = path;
|
|
4281
|
-
}
|
|
4282
|
-
else {
|
|
4283
|
-
this.providers.push(new ComponentTranslationModel({ name: name, path: path }));
|
|
4284
|
-
}
|
|
4285
|
-
}
|
|
4286
|
-
providerRegistered(name) {
|
|
4287
|
-
return this.providers.find((x) => x.name === name) ? true : false;
|
|
4288
|
-
}
|
|
4289
|
-
getComponentToFetch(lang) {
|
|
4290
|
-
const observableBatch = [];
|
|
4291
|
-
if (!this.queue[lang]) {
|
|
4292
|
-
this.queue[lang] = [];
|
|
4293
|
-
}
|
|
4294
|
-
this.providers.forEach((component) => {
|
|
4295
|
-
if (!this.isComponentInQueue(lang, component.name)) {
|
|
4296
|
-
this.queue[lang].push(component.name);
|
|
4297
|
-
const translationUrl = `${component.path}/${lang}${this.suffix}?v=${Date.now()}`;
|
|
4298
|
-
observableBatch.push(this.http.get(translationUrl).pipe(map((res) => {
|
|
4299
|
-
component.json[lang] = res;
|
|
4300
|
-
}), retry(3), catchError(() => throwError(`Failed to load ${translationUrl}`))));
|
|
4301
|
-
}
|
|
4302
|
-
});
|
|
4303
|
-
return observableBatch;
|
|
4304
|
-
}
|
|
4305
|
-
init(lang) {
|
|
4306
|
-
if (this.queue[lang] === undefined) {
|
|
4307
|
-
this.queue[lang] = [];
|
|
4308
|
-
}
|
|
4309
|
-
}
|
|
4310
|
-
isComponentInQueue(lang, name) {
|
|
4311
|
-
return (this.queue[lang] || []).find((x) => x === name) ? true : false;
|
|
4312
|
-
}
|
|
4313
|
-
getFullTranslationJSON(lang) {
|
|
4314
|
-
let result = {};
|
|
4315
|
-
this.providers
|
|
4316
|
-
.slice(0)
|
|
4317
|
-
.sort((a, b) => {
|
|
4318
|
-
if (a.name === 'app') {
|
|
4319
|
-
return 1;
|
|
4320
|
-
}
|
|
4321
|
-
if (b.name === 'app') {
|
|
4322
|
-
return -1;
|
|
4323
|
-
}
|
|
4324
|
-
return a.name.localeCompare(b.name);
|
|
4325
|
-
})
|
|
4326
|
-
.forEach((model) => {
|
|
4327
|
-
if (model.json && model.json[lang]) {
|
|
4328
|
-
result = ObjectUtils.merge(result, model.json[lang]);
|
|
4329
|
-
}
|
|
4330
|
-
});
|
|
4331
|
-
return result;
|
|
4332
|
-
}
|
|
4333
|
-
getTranslation(lang) {
|
|
4334
|
-
let hasFailures = false;
|
|
4335
|
-
const batch = [
|
|
4336
|
-
...this.getComponentToFetch(lang).map((observable) => {
|
|
4337
|
-
return observable.pipe(catchError((error) => {
|
|
4338
|
-
hasFailures = true;
|
|
4339
|
-
return of(error);
|
|
4340
|
-
}));
|
|
4341
|
-
}),
|
|
4342
|
-
];
|
|
4343
|
-
return new Observable((observer) => {
|
|
4344
|
-
if (batch.length > 0) {
|
|
4345
|
-
forkJoin(batch).subscribe(() => {
|
|
4346
|
-
const fullTranslation = this.getFullTranslationJSON(lang);
|
|
4347
|
-
if (fullTranslation) {
|
|
4348
|
-
observer.next(fullTranslation);
|
|
4349
|
-
}
|
|
4350
|
-
if (hasFailures) {
|
|
4351
|
-
observer.error('Failed to load some resources');
|
|
4352
|
-
}
|
|
4353
|
-
else {
|
|
4354
|
-
observer.complete();
|
|
4355
|
-
}
|
|
4356
|
-
}, (err) => {
|
|
4357
|
-
observer.error('Failed to load some resources');
|
|
4358
|
-
});
|
|
4359
|
-
}
|
|
4360
|
-
else {
|
|
4361
|
-
const fullTranslation = this.getFullTranslationJSON(lang);
|
|
4362
|
-
if (fullTranslation) {
|
|
4363
|
-
observer.next(fullTranslation);
|
|
4364
|
-
observer.complete();
|
|
4365
|
-
}
|
|
4366
|
-
}
|
|
4367
|
-
});
|
|
4368
|
-
}
|
|
4369
|
-
}
|
|
4370
|
-
TranslateLoaderProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TranslateLoaderProvider, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4371
|
-
TranslateLoaderProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TranslateLoaderProvider, providedIn: 'root' });
|
|
4372
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TranslateLoaderProvider, decorators: [{
|
|
4373
|
-
type: Injectable,
|
|
4374
|
-
args: [{
|
|
4375
|
-
providedIn: 'root',
|
|
4376
|
-
}]
|
|
4377
|
-
}], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
|
|
4378
|
-
|
|
4379
|
-
class webRtcProvider {
|
|
4380
|
-
constructor() {
|
|
4381
|
-
this.pc = new RTCPeerConnection();
|
|
4382
|
-
}
|
|
4383
|
-
connect(id = 1) {
|
|
4384
|
-
this.subject = webSocket('wss://localhost:3000?id=' + id);
|
|
4385
|
-
}
|
|
4386
|
-
setup() {
|
|
4387
|
-
this.connect(1);
|
|
4388
|
-
// try {
|
|
4389
|
-
// this.pc = new RTCPeerConnection({
|
|
4390
|
-
// iceServers: [
|
|
4391
|
-
// { urls: 'stun:stun.services.mozilla.com' },
|
|
4392
|
-
// { urls: 'stun:stun.l.google.com:19302' },
|
|
4393
|
-
// ],
|
|
4394
|
-
// });
|
|
4395
|
-
// } catch (error) {
|
|
4396
|
-
// console.log(error);
|
|
4397
|
-
// this.pc = new RTCPeerConnection({
|
|
4398
|
-
// iceServers: [
|
|
4399
|
-
// { urls: 'stun:stun.services.mozilla.com' },
|
|
4400
|
-
// { urls: 'stun:stun.l.google.com:19302' },
|
|
4401
|
-
// ],
|
|
4402
|
-
// });
|
|
4403
|
-
// }
|
|
4404
|
-
// this.pc.onicecandidate = (event) => {
|
|
4405
|
-
// event.candidate
|
|
4406
|
-
// ? this.sendMessage({ ice: event.candidate })
|
|
4407
|
-
// : console.log('Sent All Ice');
|
|
4408
|
-
// };
|
|
4409
|
-
// if (this.pc) {
|
|
4410
|
-
// from(this.pc.createOffer())
|
|
4411
|
-
// .pipe(switchMap((offer) => from(this.pc.setLocalDescription(offer))))
|
|
4412
|
-
// .subscribe((data: any) => {
|
|
4413
|
-
// this.sendMessage({
|
|
4414
|
-
// type: 'offer',
|
|
4415
|
-
// sdp: this.pc.localDescription,
|
|
4416
|
-
// });
|
|
4417
|
-
// });
|
|
4418
|
-
// }
|
|
4419
|
-
}
|
|
4420
|
-
sendMessage(data) {
|
|
4421
|
-
console.log(data);
|
|
4422
|
-
this.subject.next(JSON.stringify(data));
|
|
4423
|
-
}
|
|
4424
|
-
}
|
|
4425
|
-
webRtcProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: webRtcProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4426
|
-
webRtcProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: webRtcProvider, providedIn: 'root' });
|
|
4427
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: webRtcProvider, decorators: [{
|
|
4428
|
-
type: Injectable,
|
|
4429
|
-
args: [{
|
|
4430
|
-
providedIn: 'root',
|
|
4431
|
-
}]
|
|
4432
|
-
}], ctorParameters: function () { return []; } });
|
|
4433
|
-
|
|
4434
|
-
class NgxScandocModule {
|
|
4435
|
-
static forRoot(config) {
|
|
4436
|
-
return {
|
|
4437
|
-
ngModule: NgxScandocModule,
|
|
4438
|
-
providers: [
|
|
4439
|
-
{ provide: AUTH_CONFIG_TOKEN, useValue: config.auth },
|
|
4440
|
-
ScanProvider,
|
|
4441
|
-
{ provide: SCAN_CONFIG_TOKEN, useValue: config.scan },
|
|
4442
|
-
{
|
|
4443
|
-
provide: HTTP_INTERCEPTORS,
|
|
4444
|
-
useClass: HttpErrorInterceptor,
|
|
4445
|
-
multi: true,
|
|
4446
|
-
},
|
|
4447
|
-
NgxScanDocTranslationProvider,
|
|
4448
|
-
NgxScandocCameraProvider,
|
|
4449
|
-
// NgxScandocAuthProvider,
|
|
4450
|
-
],
|
|
4451
|
-
};
|
|
4452
|
-
}
|
|
4453
|
-
constructor() {
|
|
4454
|
-
}
|
|
4455
|
-
}
|
|
4456
|
-
NgxScandocModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4457
|
-
NgxScandocModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocModule, imports: [DialogsModule], exports: [DialogsModule] });
|
|
4458
|
-
NgxScandocModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocModule, imports: [DialogsModule.forRoot(), DialogsModule] });
|
|
4459
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: NgxScandocModule, decorators: [{
|
|
4460
|
-
type: NgModule,
|
|
4461
|
-
args: [{
|
|
4462
|
-
declarations: [],
|
|
4463
|
-
imports: [DialogsModule.forRoot()],
|
|
4464
|
-
exports: [DialogsModule],
|
|
4465
|
-
}]
|
|
4466
|
-
}], ctorParameters: function () { return []; } });
|
|
4467
|
-
|
|
4468
|
-
/*
|
|
4469
|
-
* Public API Surface of ngx-scandoc
|
|
4470
|
-
*/
|
|
4471
|
-
|
|
4472
|
-
/**
|
|
4473
|
-
* Generated bundle index. Do not edit.
|
|
4474
|
-
*/
|
|
4475
|
-
|
|
4476
|
-
export { AUTH_CONFIG_TOKEN, AppFormModule, BlankComponent, CameraSwitchComponent, CoreComponentsModule, CorePipesModule, DialogsModule, HttpErrorInterceptor, LoadingComponent, ManualScanComponent, MaterialModule, NgxScanDocTranslationProvider, NgxScandocAuthProvider, NgxScandocDialogsCoreProvider, NgxScandocFieldsProvider, NgxScandocModule, PromptManualComponent, SCAN_CONFIG_TOKEN, SafeResourceUrlPipe, ScanComponent, ScanProfileComponent, ScanProvider, ScanSelfieComponent, TranslateLoaderProvider, TurnDocumentComponent, WebcamComponent, WebcamModule, webRtcProvider };
|
|
4477
|
-
//# sourceMappingURL=ngx-scandoc.mjs.map
|