@ekyc_qoobiss/qbs-ect-cmp 3.6.55 → 3.6.57

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.
@@ -58,6 +58,8 @@ export class ProcessId {
58
58
  howToDone: false,
59
59
  };
60
60
  }
61
+ if (store.debug)
62
+ console.log('process-id | initFlow');
61
63
  }
62
64
  howToDone() {
63
65
  this.flow.howToDone = true;
@@ -75,8 +77,12 @@ export class ProcessId {
75
77
  }
76
78
  }
77
79
  async captureIdImage(event) {
80
+ if (store.debug)
81
+ console.log('process-id | captureIdImage');
78
82
  let idPhoto = event.detail;
79
83
  if (idPhoto.size == 0) {
84
+ if (store.debug)
85
+ console.log('process-id | captureIdImage | Empty id photo');
80
86
  await ApiCall.instance.AddLog({ message: 'Empty id photo', blobData: idPhoto }, getLogMessage());
81
87
  this.triggerErrorFlow();
82
88
  return;
@@ -84,6 +90,8 @@ export class ProcessId {
84
90
  try {
85
91
  let frontCapture = new File([idPhoto], this.flow.capture.fileName, { type: 'image/png' });
86
92
  var uploadResult = await ApiCall.instance.UploadFileForRequestB64(store.requestId, this.flow.capture.photoType, frontCapture);
93
+ if (store.debug)
94
+ console.log('process-id | captureIdImage | uploadResult: ' + uploadResult);
87
95
  if (!uploadResult) {
88
96
  this.switchCamera();
89
97
  this.triggerErrorFlow();
@@ -94,12 +102,16 @@ export class ProcessId {
94
102
  }
95
103
  }
96
104
  async capturedIdRecording(event) {
105
+ if (store.debug)
106
+ console.log('process-id | capturedIdRecording');
97
107
  let idRecording = event.detail;
98
108
  if (idRecording.size == 0 && this.recordingResultCount == 0) {
99
109
  this.recordingResultCount++;
100
110
  return;
101
111
  }
102
112
  if (idRecording.size == 0) {
113
+ if (store.debug)
114
+ console.log('process-id | capturedIdRecording | Empty ID recording');
103
115
  await ApiCall.instance.AddLog({ message: 'Empty ID recording', blobData: idRecording }, getLogMessage());
104
116
  this.triggerErrorFlow();
105
117
  return;
@@ -107,12 +119,16 @@ export class ProcessId {
107
119
  let mimeType = idRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
108
120
  let captureRec = new File([idRecording], this.flow.capture.recName + mimeType.extension, { type: mimeType.type });
109
121
  var uploadResult = await ApiCall.instance.UploadFileForRequestB64(store.requestId, this.flow.capture.recType, captureRec);
122
+ if (store.debug)
123
+ console.log('process-id | capturedIdRecording | uploadResult: ' + uploadResult);
110
124
  if (!uploadResult) {
111
125
  this.triggerErrorFlow();
112
126
  }
113
127
  this.recordingResultCount = 0;
114
128
  }
115
129
  async verificationFinished() {
130
+ if (store.debug)
131
+ console.log('process-id | verificationFinished');
116
132
  this.verificationReceived = Date.now();
117
133
  while (Date.now() - this.verificationReceived < 25000) {
118
134
  await delay(2000);
@@ -122,9 +138,13 @@ export class ProcessId {
122
138
  break;
123
139
  }
124
140
  }
141
+ if (store.debug)
142
+ console.log('process-id | verificationFinished | waitingFinished ');
125
143
  this.triggerErrorFlow();
126
144
  }
127
145
  async componentDidLoad() {
146
+ if (store.debug)
147
+ console.log('process-id | componentDidLoad');
128
148
  await BaseComponent.initialize(this.currentStep);
129
149
  }
130
150
  triggerErrorFlow() {
@@ -132,9 +152,13 @@ export class ProcessId {
132
152
  this.showInvalid = true;
133
153
  }
134
154
  async disconnectedCallback() {
155
+ if (store.debug)
156
+ console.log('process-id | disconnectedCallback');
135
157
  await BaseComponent.finalize(this.currentStep);
136
158
  }
137
159
  switchCamera() {
160
+ if (store.debug)
161
+ console.log('process-id | switchCamera');
138
162
  if (this.captureRetryCount == 1) {
139
163
  Cameras.switchCamera();
140
164
  this.captureRetryCount = 0;
@@ -6,7 +6,7 @@ import { BaseComponent } from '../../base-component';
6
6
  import { Translations } from '../../../helpers/TranslationUtils';
7
7
  import { ApiCall } from '../../../helpers/ApiCall';
8
8
  export class SmsSend {
9
- constructor() { this.buttonText = undefined; this.title = undefined; this.phoneNumber = undefined; this.prefilledPhone = false; this.canSend = false; }
9
+ constructor() { this.buttonText = undefined; this.title = undefined; this.details = undefined; this.phoneNumber = undefined; this.prefilledPhone = false; this.canSend = false; }
10
10
  async doAction() {
11
11
  try {
12
12
  this.canSend = false;
@@ -26,6 +26,7 @@ export class SmsSend {
26
26
  this.translations = await Translations.getValues();
27
27
  this.buttonText = this.translations.PhoneValidationValues.Button;
28
28
  this.title = this.translations.PhoneValidationValues.Title;
29
+ this.details = this.translations.PhoneValidationValues.Description;
29
30
  if (store.phoneNumber && store.phoneNumber != '') {
30
31
  this.phoneNumber = store.phoneNumber;
31
32
  this.prefilledPhone = true;
@@ -44,7 +45,7 @@ export class SmsSend {
44
45
  ev.target.value = this.phoneNumber;
45
46
  }
46
47
  render() {
47
- return (h("div", { class: "container" }, h("div", { class: "row row-validare" }, h("div", null, h("h1", { class: "text-center" }, this.title)), h("div", { class: "input-container mb-15" }, h("label", { class: "font-size-18 mb-1" }, h("b", null, this.translations.PhoneValidationValues.Label)), h("input", { type: "tel", id: "phoneInput", class: "main-input", disabled: this.prefilledPhone, onInput: ev => this.handleChangePhone(ev), value: this.phoneNumber })), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { id: "action", disabled: !this.canSend, class: "main-button", onClick: () => this.doAction() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
48
+ return (h("div", { class: "container" }, h("div", { class: "row row-validare" }, h("div", null, h("h1", { class: "text-center" }, this.title), h("p", { class: "main-text font-size-2 mt-15 mb-20 text-center" }, this.details)), h("div", { class: "input-container mb-15" }, h("label", { class: "font-size-18 mb-1" }, h("b", null, this.translations.PhoneValidationValues.Label)), h("input", { type: "tel", id: "phoneInput", class: "main-input", disabled: this.prefilledPhone, onInput: ev => this.handleChangePhone(ev), value: this.phoneNumber })), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { id: "action", disabled: !this.canSend, class: "main-button", onClick: () => this.doAction() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
48
49
  }
49
50
  static get is() { return "sms-send"; }
50
51
  static get originalStyleUrls() {
@@ -61,6 +62,7 @@ export class SmsSend {
61
62
  return {
62
63
  "buttonText": {},
63
64
  "title": {},
65
+ "details": {},
64
66
  "phoneNumber": {},
65
67
  "prefilledPhone": {},
66
68
  "canSend": {}
@@ -1,7 +1,7 @@
1
1
  import { Browser } from '../models/IDevice';
2
2
  import store from './store';
3
3
  export class Cameras {
4
- async GetCameras(deviceInfo) {
4
+ static async GetCameras(deviceInfo) {
5
5
  var allDevices = [];
6
6
  const devices = await navigator.mediaDevices.enumerateDevices();
7
7
  const videoDevices = devices.filter(device => device.kind === 'videoinput');
@@ -64,7 +64,7 @@ export class Cameras {
64
64
  }
65
65
  return allDevices;
66
66
  }
67
- GetConstraints(selectedDeviceId, device, portrait = false, audio = true) {
67
+ static GetConstraints(selectedDeviceId, device, portrait = false, audio = true) {
68
68
  let constraints = {
69
69
  audio: audio,
70
70
  };
@@ -100,7 +100,7 @@ export class Cameras {
100
100
  constraints.video = mediaTrack;
101
101
  return constraints;
102
102
  }
103
- GetRecommendedCamera(cameras) {
103
+ static GetRecommendedCamera(cameras) {
104
104
  if (cameras && cameras.length > 0) {
105
105
  var recommDevice = cameras.find(c => c.recommended);
106
106
  if (recommDevice) {
@@ -110,12 +110,16 @@ export class Cameras {
110
110
  return null;
111
111
  }
112
112
  static async InitCameras(device) {
113
+ if (store.debug)
114
+ console.log('cameras | initCameras');
113
115
  try {
114
- let cam = new Cameras();
115
- let cameras = (await cam.GetCameras(device)).filter(c => c.facingMode == 'environment');
116
- var recommCamera = cam.GetRecommendedCamera(cameras);
117
- store.cameraIds = cameras.map(camera => camera.deviceId);
116
+ let cameras = await Cameras.GetCameras(device);
117
+ let envCameras = cameras.filter(c => c.facingMode == 'environment');
118
+ var recommCamera = Cameras.GetRecommendedCamera(envCameras);
119
+ store.cameraIds = envCameras.map(camera => camera.deviceId);
118
120
  store.cameraId = recommCamera === null || recommCamera === void 0 ? void 0 : recommCamera.deviceId;
121
+ if (store.debug)
122
+ console.log(`cameras | initCameras | cameraIds ${store.cameraIds} | cameraId ${store.cameraId}`);
119
123
  return true;
120
124
  }
121
125
  catch (e) {
@@ -38,24 +38,36 @@ export class Stream {
38
38
  this.streamPaused = false;
39
39
  this.recordedChunks = [];
40
40
  this.videoSize = { width: 0, height: 0 };
41
+ if (store.debug)
42
+ console.log('stream | constructor');
41
43
  this.initFacePose();
42
44
  this.idML5Detector = IDML5Detector.getInstance(this, store.device.isMobile);
43
45
  this.faceML5Detector = FaceML5Detector.getInstance(this, store.device.isMobile);
44
46
  this.verificationMode = mode;
45
47
  }
46
48
  static getNewInstance(mode) {
49
+ if (store.debug)
50
+ console.log('stream | getNewInstance');
47
51
  if (!Stream.instance) {
52
+ if (store.debug)
53
+ console.log('stream | getNewInstance | new instance');
48
54
  Stream.instance = new Stream(mode);
49
55
  }
50
56
  return Stream.instance;
51
57
  }
52
58
  autoCapturing() {
59
+ if (store.debug)
60
+ console.log('stream | autoCapturing');
53
61
  this.callbackAutoCapturing();
54
62
  }
55
63
  timeElapsed() {
64
+ if (store.debug)
65
+ console.log('stream | timeElapsed');
56
66
  this.callbackTimeElapsed();
57
67
  }
58
68
  verificationReady() {
69
+ if (store.debug)
70
+ console.log('stream | verificationReady');
59
71
  this.verificationFinished();
60
72
  }
61
73
  updateHtmlElements(videoElement, canvasElement, component) {
@@ -65,6 +77,8 @@ export class Stream {
65
77
  this.faceML5Detector.updateHtmlElements(this.videoElement, this.canvasElement, component);
66
78
  }
67
79
  startStream(stream) {
80
+ if (store.debug)
81
+ console.log('stream | startStream');
68
82
  if (this.stream)
69
83
  this.stream.getTracks().forEach((track) => track.stop());
70
84
  this.stream = stream;
@@ -96,6 +110,8 @@ export class Stream {
96
110
  this.recordStream();
97
111
  }
98
112
  recordStream() {
113
+ if (store.debug)
114
+ console.log('stream | recordStream');
99
115
  if (this.mediaRecorder && this.mediaRecorder.state == 'recording')
100
116
  return;
101
117
  var options = { mimeType: Stream.webmMimeType.mime, videoBitsPerSecond: 1500000 };
@@ -106,9 +122,13 @@ export class Stream {
106
122
  this.recordedChunks = [];
107
123
  this.mediaRecorder = new MediaRecorder(this.stream, options);
108
124
  this.mediaRecorder.ondataavailable = event => {
125
+ if (store.debug)
126
+ console.log('stream | recordStream | ondataavailable');
109
127
  this.recordedChunks.push(event.data);
110
128
  };
111
129
  this.mediaRecorder.onstop = _e => {
130
+ if (store.debug)
131
+ console.log('stream | recordStream | onstop');
112
132
  var rec = new Blob(this.recordedChunks, {
113
133
  type: options.mimeType.split(';')[0],
114
134
  });
@@ -139,6 +159,8 @@ export class Stream {
139
159
  return !(this.stream && this.stream.getTracks && this.stream.getTracks().length > 0);
140
160
  }
141
161
  async takePhoto() {
162
+ if (store.debug)
163
+ console.log('stream | takePhoto');
142
164
  const canvas = document.createElement('canvas');
143
165
  canvas.style.visibility = 'hidden';
144
166
  canvas.width = this.videoElement.videoWidth;
@@ -146,12 +168,16 @@ export class Stream {
146
168
  return await this.getFrame(canvas);
147
169
  }
148
170
  getFrame(canvas) {
171
+ if (store.debug)
172
+ console.log('stream | getFrame');
149
173
  return new Promise(resolve => {
150
174
  const context = canvas.getContext('2d');
151
175
  context.drawImage(this.videoElement, 0, 0, canvas.width, canvas.height);
152
176
  canvas.toBlob((frame) => {
153
177
  if (frame.type === ImageFormat.JPEG && !store.device.isAppleDevice) {
154
178
  try {
179
+ if (store.debug)
180
+ console.log('stream | getFrame | addExifInImg');
155
181
  addExifInImg(frame, this.stream.getTracks()[0], this.videoSize).then(updatedFrame => resolve(updatedFrame));
156
182
  }
157
183
  catch (e) {
@@ -160,6 +186,8 @@ export class Stream {
160
186
  }
161
187
  }
162
188
  else {
189
+ if (store.debug)
190
+ console.log('stream | getFrame | resolve');
163
191
  resolve(frame);
164
192
  }
165
193
  }, ImageFormat.PNG, 1);
@@ -5,6 +5,7 @@ import id_white_svg from '../../assets/canvas-masks/id_white.svg';
5
5
  import id_green_svg from '../../assets/canvas-masks/id_green.svg';
6
6
  import { delay } from '../../utils/utils';
7
7
  import { VerificationMode } from '../../models/IVerificationMode';
8
+ import store from '../../helpers/store';
8
9
  export class IDML5Detector {
9
10
  static getInstance(stream, isMobile) {
10
11
  if (!IDML5Detector.instance) {
@@ -61,6 +62,8 @@ export class IDML5Detector {
61
62
  }
62
63
  if (results[0].label == this.targetedLabel && results[0].confidence > 0.9 && !this.checked) {
63
64
  this.checked = true;
65
+ if (store.debug)
66
+ console.log('idml5detector | gotResults | autoCapturing');
64
67
  this.stream.autoCapturing();
65
68
  await this.drawFrame('green');
66
69
  }