@ekyc_qoobiss/qbs-ect-cmp 2.0.6 → 2.0.8

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.
@@ -1896,11 +1896,14 @@ class ML5 {
1896
1896
  });
1897
1897
  }
1898
1898
  loaded() {
1899
- console.log('ML5 LOADED!!!');
1899
+ if (state.debug)
1900
+ console.log('ML5 LOADED!!!');
1900
1901
  }
1901
1902
  gotResults(error, results) {
1902
- console.log(error);
1903
- console.log(results);
1903
+ if (state.debug)
1904
+ console.log(error);
1905
+ if (state.debug)
1906
+ console.log(results);
1904
1907
  }
1905
1908
  }
1906
1909
 
@@ -2241,15 +2244,12 @@ class FaceML5Detector {
2241
2244
  const faceBox = result[0].detection.box;
2242
2245
  const { top, left, bottom, right } = faceBox;
2243
2246
  const { imageHeight, imageWidth } = result[0].detection;
2244
- const topIndent = top * 100 / imageHeight;
2245
- const leftIndent = left * 100 / imageWidth;
2246
- const rightIndent = (imageWidth - right) * 100 / imageWidth;
2247
- const bottomIndent = (imageHeight - bottom) * 100 / imageHeight;
2247
+ const topIndent = (top * 100) / imageHeight;
2248
+ const leftIndent = (left * 100) / imageWidth;
2249
+ const rightIndent = ((imageWidth - right) * 100) / imageWidth;
2250
+ const bottomIndent = ((imageHeight - bottom) * 100) / imageHeight;
2248
2251
  // console.log('indent: '+topIndent+' | '+leftIndent+' | '+rightIndent+' | '+bottomIndent);
2249
- return !(topIndent < this.Y_OFFSET_FROM_FRAME ||
2250
- leftIndent < this.X_OFFSET_FROM_FRAME ||
2251
- rightIndent < this.X_OFFSET_FROM_FRAME ||
2252
- bottomIndent < this.Y_OFFSET_FROM_FRAME);
2252
+ return !(topIndent < this.Y_OFFSET_FROM_FRAME || leftIndent < this.X_OFFSET_FROM_FRAME || rightIndent < this.X_OFFSET_FROM_FRAME || bottomIndent < this.Y_OFFSET_FROM_FRAME);
2253
2253
  }
2254
2254
  async checkFacePose(results) {
2255
2255
  let face = new FaceLandmarks(results[0], this.width, this.height);
@@ -2258,17 +2258,18 @@ class FaceML5Detector {
2258
2258
  if (this.frontFace == null) {
2259
2259
  this.frontFace = face;
2260
2260
  // await this.drawFrame('green');
2261
- console.log('face ok');
2261
+ if (state.debug)
2262
+ console.log('face ok');
2262
2263
  }
2263
2264
  else if (this.frontFace != null && this.presentedFacePose == null) {
2264
2265
  let ff = this.frontFace;
2265
- if (face.nose.y < ff.nose.y - (ff.eyesDistance() * 0.4))
2266
+ if (face.nose.y < ff.nose.y - ff.eyesDistance() * 0.4)
2266
2267
  this.presentedFacePose = FacePose.LookUp;
2267
- if (face.nose.y > ff.nose.y + (ff.eyesDistance() * 0.4))
2268
+ if (face.nose.y > ff.nose.y + ff.eyesDistance() * 0.4)
2268
2269
  this.presentedFacePose = FacePose.LookDown;
2269
- if (face.nose.x > ff.nose.x + (ff.eyesDistance() * 0.5))
2270
+ if (face.nose.x > ff.nose.x + ff.eyesDistance() * 0.5)
2270
2271
  this.presentedFacePose = FacePose.LookLeft;
2271
- if (face.nose.x < ff.nose.x - (ff.eyesDistance() * 0.5))
2272
+ if (face.nose.x < ff.nose.x - ff.eyesDistance() * 0.5)
2272
2273
  this.presentedFacePose = FacePose.LookRight;
2273
2274
  /*
2274
2275
  if (
@@ -6105,6 +6106,7 @@ const IdentificationComponent = class {
6105
6106
  }
6106
6107
  constructor(hostRef) {
6107
6108
  index.registerInstance(this, hostRef);
6109
+ this.logInit = {};
6108
6110
  this.token = undefined;
6109
6111
  this.order_id = undefined;
6110
6112
  this.api_url = undefined;
@@ -6123,11 +6125,12 @@ const IdentificationComponent = class {
6123
6125
  if (this.env && this.env != '') {
6124
6126
  state.environment = this.env;
6125
6127
  }
6126
- this.logInit = {
6127
- store_values: { request_id: state.requestId, redirect_id: state.redirectId, token: state.token },
6128
- session_values: { request_id: sessionStorage.getItem(SessionKeys.RequestIdKey), token: sessionStorage.getItem(SessionKeys.TokenKey) },
6129
- paramete_values: { request_id: this.order_id, redirect_id: this.redirect_id, token: this.token },
6130
- };
6128
+ if (state.debug)
6129
+ this.logInit = {
6130
+ store_values: { request_id: state.requestId, redirect_id: state.redirectId, token: state.token },
6131
+ session_values: { request_id: sessionStorage.getItem(SessionKeys.RequestIdKey), token: sessionStorage.getItem(SessionKeys.TokenKey) },
6132
+ paramete_values: { request_id: this.order_id, redirect_id: this.redirect_id, token: this.token },
6133
+ };
6131
6134
  if (this.token) {
6132
6135
  if (state.debug)
6133
6136
  console.log('Store Token set with property value: ' + this.token);
@@ -6199,7 +6202,8 @@ const IdentificationComponent = class {
6199
6202
  return;
6200
6203
  }
6201
6204
  try {
6202
- this.apiCall.AddLog(this.logInit);
6205
+ if (state.debug)
6206
+ this.apiCall.AddLog(this.logInit);
6203
6207
  }
6204
6208
  catch (_a) { }
6205
6209
  try {
@@ -9243,6 +9247,8 @@ const MobileRedirect = class {
9243
9247
  }
9244
9248
  componentWillRender() { }
9245
9249
  async componentDidLoad() {
9250
+ Events.init(window);
9251
+ Events.flowStarted();
9246
9252
  await this.delay(5000);
9247
9253
  await this.checkStatus();
9248
9254
  while (this.orderStatus == OrderStatuses.Capturing || this.orderStatus == OrderStatuses.Waiting) {
@@ -9266,7 +9272,6 @@ const MobileRedirect = class {
9266
9272
  if (this.orderStatus == OrderStatuses.Aborted) {
9267
9273
  this.waitingMobile = false;
9268
9274
  this.infoTextTop = MobileRedirectValues.InfoAborted;
9269
- Events.init(window);
9270
9275
  Events.flowAborted();
9271
9276
  }
9272
9277
  }
@@ -41,6 +41,8 @@ export class MobileRedirect {
41
41
  }
42
42
  componentWillRender() { }
43
43
  async componentDidLoad() {
44
+ Events.init(window);
45
+ Events.flowStarted();
44
46
  await this.delay(5000);
45
47
  await this.checkStatus();
46
48
  while (this.orderStatus == OrderStatuses.Capturing || this.orderStatus == OrderStatuses.Waiting) {
@@ -64,7 +66,6 @@ export class MobileRedirect {
64
66
  if (this.orderStatus == OrderStatuses.Aborted) {
65
67
  this.waitingMobile = false;
66
68
  this.infoTextTop = MobileRedirectValues.InfoAborted;
67
- Events.init(window);
68
69
  Events.flowAborted();
69
70
  }
70
71
  }
@@ -100,6 +100,7 @@ export class IdentificationComponent {
100
100
  store.flowStatus = FlowStatus.ERROREND;
101
101
  }
102
102
  constructor() {
103
+ this.logInit = {};
103
104
  this.token = undefined;
104
105
  this.order_id = undefined;
105
106
  this.api_url = undefined;
@@ -118,11 +119,12 @@ export class IdentificationComponent {
118
119
  if (this.env && this.env != '') {
119
120
  store.environment = this.env;
120
121
  }
121
- this.logInit = {
122
- store_values: { request_id: store.requestId, redirect_id: store.redirectId, token: store.token },
123
- session_values: { request_id: sessionStorage.getItem(SessionKeys.RequestIdKey), token: sessionStorage.getItem(SessionKeys.TokenKey) },
124
- paramete_values: { request_id: this.order_id, redirect_id: this.redirect_id, token: this.token },
125
- };
122
+ if (store.debug)
123
+ this.logInit = {
124
+ store_values: { request_id: store.requestId, redirect_id: store.redirectId, token: store.token },
125
+ session_values: { request_id: sessionStorage.getItem(SessionKeys.RequestIdKey), token: sessionStorage.getItem(SessionKeys.TokenKey) },
126
+ paramete_values: { request_id: this.order_id, redirect_id: this.redirect_id, token: this.token },
127
+ };
126
128
  if (this.token) {
127
129
  if (store.debug)
128
130
  console.log('Store Token set with property value: ' + this.token);
@@ -194,7 +196,8 @@ export class IdentificationComponent {
194
196
  return;
195
197
  }
196
198
  try {
197
- this.apiCall.AddLog(this.logInit);
199
+ if (store.debug)
200
+ this.apiCall.AddLog(this.logInit);
198
201
  }
199
202
  catch (_a) { }
200
203
  try {
@@ -26,10 +26,13 @@ export class ML5 {
26
26
  });
27
27
  }
28
28
  loaded() {
29
- console.log('ML5 LOADED!!!');
29
+ if (store.debug)
30
+ console.log('ML5 LOADED!!!');
30
31
  }
31
32
  gotResults(error, results) {
32
- console.log(error);
33
- console.log(results);
33
+ if (store.debug)
34
+ console.log(error);
35
+ if (store.debug)
36
+ console.log(results);
34
37
  }
35
38
  }
@@ -7,6 +7,7 @@ import face_white_svg from '../../assets/canvas-masks/face_white.svg';
7
7
  // @ts-ignore
8
8
  import face_green_svg from '../../assets/canvas-masks/face_green.svg';
9
9
  import { GlobalValues } from '../../helpers/textValues';
10
+ import store from '../../helpers/store';
10
11
  export class FaceML5Detector {
11
12
  static getInstance(stream, isMobile) {
12
13
  if (!FaceML5Detector.instance) {
@@ -146,15 +147,12 @@ export class FaceML5Detector {
146
147
  const faceBox = result[0].detection.box;
147
148
  const { top, left, bottom, right } = faceBox;
148
149
  const { imageHeight, imageWidth } = result[0].detection;
149
- const topIndent = top * 100 / imageHeight;
150
- const leftIndent = left * 100 / imageWidth;
151
- const rightIndent = (imageWidth - right) * 100 / imageWidth;
152
- const bottomIndent = (imageHeight - bottom) * 100 / imageHeight;
150
+ const topIndent = (top * 100) / imageHeight;
151
+ const leftIndent = (left * 100) / imageWidth;
152
+ const rightIndent = ((imageWidth - right) * 100) / imageWidth;
153
+ const bottomIndent = ((imageHeight - bottom) * 100) / imageHeight;
153
154
  // console.log('indent: '+topIndent+' | '+leftIndent+' | '+rightIndent+' | '+bottomIndent);
154
- return !(topIndent < this.Y_OFFSET_FROM_FRAME ||
155
- leftIndent < this.X_OFFSET_FROM_FRAME ||
156
- rightIndent < this.X_OFFSET_FROM_FRAME ||
157
- bottomIndent < this.Y_OFFSET_FROM_FRAME);
155
+ return !(topIndent < this.Y_OFFSET_FROM_FRAME || leftIndent < this.X_OFFSET_FROM_FRAME || rightIndent < this.X_OFFSET_FROM_FRAME || bottomIndent < this.Y_OFFSET_FROM_FRAME);
158
156
  }
159
157
  async checkFacePose(results) {
160
158
  let face = new FaceLandmarks(results[0], this.width, this.height);
@@ -163,17 +161,18 @@ export class FaceML5Detector {
163
161
  if (this.frontFace == null) {
164
162
  this.frontFace = face;
165
163
  // await this.drawFrame('green');
166
- console.log('face ok');
164
+ if (store.debug)
165
+ console.log('face ok');
167
166
  }
168
167
  else if (this.frontFace != null && this.presentedFacePose == null) {
169
168
  let ff = this.frontFace;
170
- if (face.nose.y < ff.nose.y - (ff.eyesDistance() * 0.4))
169
+ if (face.nose.y < ff.nose.y - ff.eyesDistance() * 0.4)
171
170
  this.presentedFacePose = FacePose.LookUp;
172
- if (face.nose.y > ff.nose.y + (ff.eyesDistance() * 0.4))
171
+ if (face.nose.y > ff.nose.y + ff.eyesDistance() * 0.4)
173
172
  this.presentedFacePose = FacePose.LookDown;
174
- if (face.nose.x > ff.nose.x + (ff.eyesDistance() * 0.5))
173
+ if (face.nose.x > ff.nose.x + ff.eyesDistance() * 0.5)
175
174
  this.presentedFacePose = FacePose.LookLeft;
176
- if (face.nose.x < ff.nose.x - (ff.eyesDistance() * 0.5))
175
+ if (face.nose.x < ff.nose.x - ff.eyesDistance() * 0.5)
177
176
  this.presentedFacePose = FacePose.LookRight;
178
177
  /*
179
178
  if (
@@ -1892,11 +1892,14 @@ class ML5 {
1892
1892
  });
1893
1893
  }
1894
1894
  loaded() {
1895
- console.log('ML5 LOADED!!!');
1895
+ if (state.debug)
1896
+ console.log('ML5 LOADED!!!');
1896
1897
  }
1897
1898
  gotResults(error, results) {
1898
- console.log(error);
1899
- console.log(results);
1899
+ if (state.debug)
1900
+ console.log(error);
1901
+ if (state.debug)
1902
+ console.log(results);
1900
1903
  }
1901
1904
  }
1902
1905
 
@@ -2237,15 +2240,12 @@ class FaceML5Detector {
2237
2240
  const faceBox = result[0].detection.box;
2238
2241
  const { top, left, bottom, right } = faceBox;
2239
2242
  const { imageHeight, imageWidth } = result[0].detection;
2240
- const topIndent = top * 100 / imageHeight;
2241
- const leftIndent = left * 100 / imageWidth;
2242
- const rightIndent = (imageWidth - right) * 100 / imageWidth;
2243
- const bottomIndent = (imageHeight - bottom) * 100 / imageHeight;
2243
+ const topIndent = (top * 100) / imageHeight;
2244
+ const leftIndent = (left * 100) / imageWidth;
2245
+ const rightIndent = ((imageWidth - right) * 100) / imageWidth;
2246
+ const bottomIndent = ((imageHeight - bottom) * 100) / imageHeight;
2244
2247
  // console.log('indent: '+topIndent+' | '+leftIndent+' | '+rightIndent+' | '+bottomIndent);
2245
- return !(topIndent < this.Y_OFFSET_FROM_FRAME ||
2246
- leftIndent < this.X_OFFSET_FROM_FRAME ||
2247
- rightIndent < this.X_OFFSET_FROM_FRAME ||
2248
- bottomIndent < this.Y_OFFSET_FROM_FRAME);
2248
+ return !(topIndent < this.Y_OFFSET_FROM_FRAME || leftIndent < this.X_OFFSET_FROM_FRAME || rightIndent < this.X_OFFSET_FROM_FRAME || bottomIndent < this.Y_OFFSET_FROM_FRAME);
2249
2249
  }
2250
2250
  async checkFacePose(results) {
2251
2251
  let face = new FaceLandmarks(results[0], this.width, this.height);
@@ -2254,17 +2254,18 @@ class FaceML5Detector {
2254
2254
  if (this.frontFace == null) {
2255
2255
  this.frontFace = face;
2256
2256
  // await this.drawFrame('green');
2257
- console.log('face ok');
2257
+ if (state.debug)
2258
+ console.log('face ok');
2258
2259
  }
2259
2260
  else if (this.frontFace != null && this.presentedFacePose == null) {
2260
2261
  let ff = this.frontFace;
2261
- if (face.nose.y < ff.nose.y - (ff.eyesDistance() * 0.4))
2262
+ if (face.nose.y < ff.nose.y - ff.eyesDistance() * 0.4)
2262
2263
  this.presentedFacePose = FacePose.LookUp;
2263
- if (face.nose.y > ff.nose.y + (ff.eyesDistance() * 0.4))
2264
+ if (face.nose.y > ff.nose.y + ff.eyesDistance() * 0.4)
2264
2265
  this.presentedFacePose = FacePose.LookDown;
2265
- if (face.nose.x > ff.nose.x + (ff.eyesDistance() * 0.5))
2266
+ if (face.nose.x > ff.nose.x + ff.eyesDistance() * 0.5)
2266
2267
  this.presentedFacePose = FacePose.LookLeft;
2267
- if (face.nose.x < ff.nose.x - (ff.eyesDistance() * 0.5))
2268
+ if (face.nose.x < ff.nose.x - ff.eyesDistance() * 0.5)
2268
2269
  this.presentedFacePose = FacePose.LookRight;
2269
2270
  /*
2270
2271
  if (
@@ -6101,6 +6102,7 @@ const IdentificationComponent = class {
6101
6102
  }
6102
6103
  constructor(hostRef) {
6103
6104
  registerInstance(this, hostRef);
6105
+ this.logInit = {};
6104
6106
  this.token = undefined;
6105
6107
  this.order_id = undefined;
6106
6108
  this.api_url = undefined;
@@ -6119,11 +6121,12 @@ const IdentificationComponent = class {
6119
6121
  if (this.env && this.env != '') {
6120
6122
  state.environment = this.env;
6121
6123
  }
6122
- this.logInit = {
6123
- store_values: { request_id: state.requestId, redirect_id: state.redirectId, token: state.token },
6124
- session_values: { request_id: sessionStorage.getItem(SessionKeys.RequestIdKey), token: sessionStorage.getItem(SessionKeys.TokenKey) },
6125
- paramete_values: { request_id: this.order_id, redirect_id: this.redirect_id, token: this.token },
6126
- };
6124
+ if (state.debug)
6125
+ this.logInit = {
6126
+ store_values: { request_id: state.requestId, redirect_id: state.redirectId, token: state.token },
6127
+ session_values: { request_id: sessionStorage.getItem(SessionKeys.RequestIdKey), token: sessionStorage.getItem(SessionKeys.TokenKey) },
6128
+ paramete_values: { request_id: this.order_id, redirect_id: this.redirect_id, token: this.token },
6129
+ };
6127
6130
  if (this.token) {
6128
6131
  if (state.debug)
6129
6132
  console.log('Store Token set with property value: ' + this.token);
@@ -6195,7 +6198,8 @@ const IdentificationComponent = class {
6195
6198
  return;
6196
6199
  }
6197
6200
  try {
6198
- this.apiCall.AddLog(this.logInit);
6201
+ if (state.debug)
6202
+ this.apiCall.AddLog(this.logInit);
6199
6203
  }
6200
6204
  catch (_a) { }
6201
6205
  try {
@@ -9239,6 +9243,8 @@ const MobileRedirect = class {
9239
9243
  }
9240
9244
  componentWillRender() { }
9241
9245
  async componentDidLoad() {
9246
+ Events.init(window);
9247
+ Events.flowStarted();
9242
9248
  await this.delay(5000);
9243
9249
  await this.checkStatus();
9244
9250
  while (this.orderStatus == OrderStatuses.Capturing || this.orderStatus == OrderStatuses.Waiting) {
@@ -9262,7 +9268,6 @@ const MobileRedirect = class {
9262
9268
  if (this.orderStatus == OrderStatuses.Aborted) {
9263
9269
  this.waitingMobile = false;
9264
9270
  this.infoTextTop = MobileRedirectValues.InfoAborted;
9265
- Events.init(window);
9266
9271
  Events.flowAborted();
9267
9272
  }
9268
9273
  }