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