kwikid-forms 0.6.45 → 0.6.47

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.
@@ -50,7 +50,7 @@
50
50
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
51
51
  PERFORMANCE OF THIS SOFTWARE.
52
52
  ***************************************************************************** */
53
- /* global Reflect, Promise, SuppressedError, Symbol */
53
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
54
54
  var extendStatics = function (d, b) {
55
55
  extendStatics = Object.setPrototypeOf ||
56
56
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -186,8 +186,8 @@
186
186
  }
187
187
  function __generator(thisArg, body) {
188
188
  var _ = { label: 0, sent: function () { if (t[0] & 1)
189
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
190
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
189
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
190
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
191
191
  function verb(n) { return function (v) { return step([n, v]); }; }
192
192
  function step(op) {
193
193
  if (f)
@@ -342,7 +342,7 @@
342
342
  if (!Symbol.asyncIterator)
343
343
  throw new TypeError("Symbol.asyncIterator is not defined.");
344
344
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
345
- return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
345
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
346
346
  function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
347
347
  function verb(n, f) { if (g[n]) {
348
348
  i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); };
@@ -466,18 +466,26 @@
466
466
  env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
467
467
  env.hasError = true;
468
468
  }
469
+ var r, s = 0;
469
470
  function next() {
470
- while (env.stack.length) {
471
- var rec = env.stack.pop();
471
+ while (r = env.stack.pop()) {
472
472
  try {
473
- var result = rec.dispose && rec.dispose.call(rec.value);
474
- if (rec.async)
475
- return Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
473
+ if (!r.async && s === 1)
474
+ return s = 0, env.stack.push(r), Promise.resolve().then(next);
475
+ if (r.dispose) {
476
+ var result = r.dispose.call(r.value);
477
+ if (r.async)
478
+ return s |= 2, Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
479
+ }
480
+ else
481
+ s |= 1;
476
482
  }
477
483
  catch (e) {
478
484
  fail(e);
479
485
  }
480
486
  }
487
+ if (s === 1)
488
+ return env.hasError ? Promise.reject(env.error) : Promise.resolve();
481
489
  if (env.hasError)
482
490
  throw env.error;
483
491
  }
@@ -872,6 +880,10 @@
872
880
  isFacematchFromServer: false,
873
881
  sources: []
874
882
  },
883
+ liveliness: {
884
+ isEnabled: false,
885
+ isLivelinessFromServer: false
886
+ },
875
887
  watermark: {
876
888
  isEnabled: false,
877
889
  isWatermarkFromServer: false,
@@ -5183,11 +5195,15 @@
5183
5195
  if (response) {
5184
5196
  this.resetCamera();
5185
5197
  var image = response === null || response === void 0 ? void 0 : response.image_url;
5186
- var imageOcr = response === null || response === void 0 ? void 0 : response.image_ocr;
5187
- var imageFacematch = response === null || response === void 0 ? void 0 : response.image_facematch;
5188
- var imageWatermark = response === null || response === void 0 ? void 0 : response.image_watermark;
5189
- var imageData = imageOcr || imageFacematch || imageWatermark
5190
- ? Object.assign(Object.assign(Object.assign({ image: image }, (imageOcr && { ocr: imageOcr })), (imageFacematch && { facematch: imageFacematch })), (imageWatermark && { watermark: imageWatermark })) : image;
5198
+ var imageOcr_1 = response === null || response === void 0 ? void 0 : response.image_ocr;
5199
+ var imageFacematch_1 = response === null || response === void 0 ? void 0 : response.image_facematch;
5200
+ var imageLiveliness_1 = response === null || response === void 0 ? void 0 : response.image_liveliness;
5201
+ var imageWatermark_1 = response === null || response === void 0 ? void 0 : response.image_watermark;
5202
+ var isCheckCameraFeatures = function () {
5203
+ return (imageOcr_1 || imageLiveliness_1 || imageFacematch_1 || imageWatermark_1);
5204
+ };
5205
+ var imageData = isCheckCameraFeatures()
5206
+ ? Object.assign(Object.assign(Object.assign(Object.assign({ image: image }, (imageOcr_1 && { ocr: imageOcr_1 })), (imageFacematch_1 && { facematch: imageFacematch_1 })), (imageLiveliness_1 && { liveliness: imageLiveliness_1 })), (imageWatermark_1 && { watermark: imageWatermark_1 })) : image;
5191
5207
  this.formData[field_1.key] = kwikidToolkit.getObjectDeepCopy([imageData]);
5192
5208
  this.cameraData[field_1.key] = kwikidToolkit.getObjectDeepCopy(imageData);
5193
5209
  this.mediaFiles[field_1.key] = kwikidToolkit.getObjectDeepCopy([imageData]);
@@ -6523,9 +6539,9 @@
6523
6539
  * This is a api upload mocking method. Set's to loading at first at point when API is called and then changes the status to random status after 2 seconds of delay showing a mocked response from API.
6524
6540
  */
6525
6541
  KwikIDFormViewComponent.prototype.uploadFile = function (field, file) {
6526
- var _a, _b, _c, _d, _e, _f;
6542
+ var _a, _b, _c, _d, _e, _f, _g, _h;
6527
6543
  return __awaiter(this, void 0, void 0, function () {
6528
- var _15, ocrPayload, facematchPayload, facematchSources, facematchSources_1, facematchSources_1_1, facematchSourceConfig, source, sourceValue, facematchSource, e_10_1, watermarkPayload, watermarkSources, watermarkSources_1, watermarkSources_1_1, watermarkSourceConfig, source, sourceValue, watermarkSource, e_11_1, imageUploadPayload;
6544
+ var _15, ocrPayload, facematchPayload, facematchSources, facematchSources_1, facematchSources_1_1, facematchSourceConfig, source, sourceValue, facematchSource, e_10_1, watermarkPayload, watermarkSources, watermarkSources_1, watermarkSources_1_1, watermarkSourceConfig, source, sourceValue, watermarkSource, e_11_1, livelinessPayload, imageUploadPayload;
6529
6545
  var e_10, _16, e_11, _17;
6530
6546
  return __generator(this, function (_18) {
6531
6547
  switch (_18.label) {
@@ -6677,12 +6693,18 @@
6677
6693
  finally { if (e_11) throw e_11.error; }
6678
6694
  return [7 /*endfinally*/];
6679
6695
  case 18:
6680
- imageUploadPayload = Object.assign(Object.assign(Object.assign({ image: file }, ((ocrPayload === null || ocrPayload === void 0 ? void 0 : ocrPayload.isEnabled) && {
6696
+ livelinessPayload = {};
6697
+ if (kwikidToolkit.isNotEmptyValue((_h = (_g = field === null || field === void 0 ? void 0 : field.properties) === null || _g === void 0 ? void 0 : _g.features) === null || _h === void 0 ? void 0 : _h.liveliness)) {
6698
+ livelinessPayload = field.properties.features.liveliness;
6699
+ }
6700
+ imageUploadPayload = Object.assign(Object.assign(Object.assign(Object.assign({ image: file }, ((ocrPayload === null || ocrPayload === void 0 ? void 0 : ocrPayload.isEnabled) && {
6681
6701
  ocr: ocrPayload
6682
6702
  })), ((facematchPayload === null || facematchPayload === void 0 ? void 0 : facematchPayload.isEnabled) && {
6683
6703
  facematch: facematchPayload
6684
6704
  })), ((watermarkPayload === null || watermarkPayload === void 0 ? void 0 : watermarkPayload.isEnabled) && {
6685
6705
  watermark: watermarkPayload
6706
+ })), ((livelinessPayload === null || livelinessPayload === void 0 ? void 0 : livelinessPayload.isEnabled) && {
6707
+ liveliness: livelinessPayload
6686
6708
  }));
6687
6709
  this.triggerLogs(ELogEventType$1.FORM__API_REQUEST_UPLOAD_IMAGE, {
6688
6710
  field_key: field.key,