@ekyc_qoobiss/qbs-ect-cmp 1.7.1 → 1.8.1

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 (29) hide show
  1. package/dist/cjs/agreement-check_16.cjs.entry.js +71 -19
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/qbs-ect-cmp.cjs.js +2 -2
  4. package/dist/collection/collection-manifest.json +2 -2
  5. package/dist/collection/components/controls/camera/camera.js +19 -0
  6. package/dist/collection/components/flow/id-double-side/id-double-side.js +16 -1
  7. package/dist/collection/components/flow/id-single-side/id-single-side.js +14 -1
  8. package/dist/collection/components/flow/landing-validation/landing-validation.js +9 -1
  9. package/dist/collection/components/flow/sms-code-validation/sms-code-validation.js +2 -2
  10. package/dist/collection/components/flow/user-liveness/user-liveness.js +14 -1
  11. package/dist/collection/helpers/ApiCall.js +2 -0
  12. package/dist/collection/helpers/Stream.js +6 -0
  13. package/dist/collection/helpers/store.js +2 -0
  14. package/dist/collection/libs/FaceML5Detector/FaceML5Detector.js +14 -10
  15. package/dist/collection/libs/IDML5Detector/IDML5Detector.js +5 -3
  16. package/dist/esm/agreement-check_16.entry.js +71 -19
  17. package/dist/esm/loader.js +2 -2
  18. package/dist/esm/qbs-ect-cmp.js +2 -2
  19. package/dist/qbs-ect-cmp/{p-7fade4fa.entry.js → p-026b6e20.entry.js} +2 -2
  20. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
  21. package/dist/types/components/controls/camera/camera.d.ts +2 -0
  22. package/dist/types/components/flow/id-double-side/id-double-side.d.ts +1 -0
  23. package/dist/types/components/flow/id-single-side/id-single-side.d.ts +1 -0
  24. package/dist/types/components/flow/user-liveness/user-liveness.d.ts +1 -0
  25. package/dist/types/components.d.ts +1 -0
  26. package/dist/types/helpers/Stream.d.ts +3 -0
  27. package/dist/types/helpers/store.d.ts +2 -0
  28. package/dist/types/models/IAddRequest.d.ts +2 -0
  29. package/package.json +2 -2
@@ -301,6 +301,8 @@ const { state, onChange } = createStore({
301
301
  cameraIds: [],
302
302
  cameraId: '',
303
303
  hasIdBack: false,
304
+ agreementsValidation: true,
305
+ phoneValidation: true,
304
306
  apiBaseUrl: 'https://apiro.id-kyc.com',
305
307
  });
306
308
  onChange('flowStatus', value => {
@@ -362,6 +364,8 @@ class ApiCall {
362
364
  let data = { requestId: requestId, clientDeviceInfo: deviceInfo };
363
365
  let jsonResp = await this.post('/validation/identity/insert', JSON.stringify(data));
364
366
  state.hasIdBack = jsonResp.hasIdBack;
367
+ state.agreementsValidation = jsonResp.agreementsValidation;
368
+ state.phoneValidation = jsonResp.phoneValidation;
365
369
  return true;
366
370
  }
367
371
  async UploadFileForRequestB64(requestId, type, file) {
@@ -1810,14 +1814,17 @@ class IDML5Detector {
1810
1814
  this.delay(2000).then(() => this.classifyVideo());
1811
1815
  }
1812
1816
  classifyVideo() {
1813
- if (this.full == 2 && this.tilted == 1) {
1817
+ if (this.full == 1 && this.tilted == 1) {
1814
1818
  if (this.start == null)
1815
1819
  this.start = Date.now();
1816
1820
  if (Date.now() > this.start + 3000) {
1817
1821
  this.continue = false;
1818
- this.stream.autoCapturing();
1822
+ this.stream.verificationReady();
1819
1823
  }
1820
1824
  }
1825
+ if (this.full == 1 && this.tilted == 0) {
1826
+ this.stream.autoCapturing();
1827
+ }
1821
1828
  if (Date.now() - this.initTime >= this.MAX_DETECTION) {
1822
1829
  this.continue = false;
1823
1830
  this.stream.timeElapsed();
@@ -1839,7 +1846,6 @@ class IDML5Detector {
1839
1846
  this.stream.changeIDPose(IDPose.Tilted);
1840
1847
  }
1841
1848
  if (this.full == 1 && this.tilted == 1) {
1842
- this.full = 2;
1843
1849
  this.stream.stopAnimation();
1844
1850
  this.drawFrame('green', true);
1845
1851
  }
@@ -2030,7 +2036,7 @@ class FaceML5Detector {
2030
2036
  this.start = Date.now();
2031
2037
  if (Date.now() > this.start + 3000) {
2032
2038
  this.continue = false;
2033
- this.stream.autoCapturing();
2039
+ this.stream.verificationReady();
2034
2040
  }
2035
2041
  }
2036
2042
  if (Date.now() - this.initTime >= this.MAX_DETECTION) {
@@ -2054,6 +2060,7 @@ class FaceML5Detector {
2054
2060
  if (this.isSingleFace(results) && this.checkProbability(results) && this.checkFaceSize(results) && this.checkFaceIndent(results)) {
2055
2061
  if (!this.validFaceFound) {
2056
2062
  this.validFaceFound = true;
2063
+ this.stream.autoCapturing();
2057
2064
  this.frontFace = new FaceLandmarks(results[0], this.width, this.height);
2058
2065
  this.stream.stopAnimation();
2059
2066
  await this.drawFrame('green');
@@ -2164,18 +2171,21 @@ class FaceML5Detector {
2164
2171
  this.validFacePose = true;
2165
2172
  this.stream.stopAnimation();
2166
2173
  await this.drawFrame('green');
2167
- this.stream.changeFacePose();
2168
- }
2169
- }
2170
- if (this.validFacePose && this.requestedFacePose != null) {
2171
- if (face.leftEyeNoseDistanceX() < face.rightEyeNoseDistanceX() * 1.2 &&
2172
- face.leftEyeNoseDistanceX() > face.rightEyeNoseDistanceX() * 0.8 &&
2173
- Math.abs(face.eyesLevel()) < this.height * 0.1) {
2174
2174
  this.validFaceFoundAgain = true;
2175
- this.stream.stopAnimation();
2176
- this.drawFrame('green', true);
2175
+ //this.stream.changeFacePose();
2177
2176
  }
2178
2177
  }
2178
+ // if (this.validFacePose && this.requestedFacePose != null) {
2179
+ // if (
2180
+ // face.leftEyeNoseDistanceX() < face.rightEyeNoseDistanceX() * 1.2 &&
2181
+ // face.leftEyeNoseDistanceX() > face.rightEyeNoseDistanceX() * 0.8 &&
2182
+ // Math.abs(face.eyesLevel()) < this.height * 0.1
2183
+ // ) {
2184
+ // this.validFaceFoundAgain = true;
2185
+ // this.stream.stopAnimation();
2186
+ // this.drawFrame('green', true);
2187
+ // }
2188
+ // }
2179
2189
  }
2180
2190
  }
2181
2191
 
@@ -4715,6 +4725,9 @@ class Stream {
4715
4725
  setCallbackTimeElapsed(fun) {
4716
4726
  this.callbackTimeElapsed = fun;
4717
4727
  }
4728
+ setVerificationFinished(fun) {
4729
+ this.verificationFinished = fun;
4730
+ }
4718
4731
  static getInstance(device, modelPath) {
4719
4732
  if (!Stream.instance) {
4720
4733
  Stream.instance = new Stream(device, modelPath);
@@ -4730,6 +4743,9 @@ class Stream {
4730
4743
  timeElapsed() {
4731
4744
  this.callbackTimeElapsed();
4732
4745
  }
4746
+ verificationReady() {
4747
+ this.verificationFinished();
4748
+ }
4733
4749
  updateHtmlElements(videoElement, canvasElement, component) {
4734
4750
  this.videoElement = videoElement;
4735
4751
  this.canvasElement = canvasElement;
@@ -4890,6 +4906,7 @@ const Camera = class {
4890
4906
  this.eventTimeElapsed = index.createEvent(this, "timeElapsed", 7);
4891
4907
  this.eventChangeTitle = index.createEvent(this, "changeTitle", 7);
4892
4908
  this.eventStopAnimation = index.createEvent(this, "stopAnimation", 7);
4909
+ this.verificationFinished = index.createEvent(this, "verificationFinished", 7);
4893
4910
  this.callbackErrors = (error, isError) => {
4894
4911
  if (isError) {
4895
4912
  this.errorCameraEvent.emit(error);
@@ -4923,6 +4940,9 @@ const Camera = class {
4923
4940
  this.callbackVideoStarted = () => {
4924
4941
  this.eventVideoStarted.emit(this.component.getBoundingClientRect());
4925
4942
  };
4943
+ this.callbackVerificationFinished = () => {
4944
+ this.verificationFinished.emit();
4945
+ };
4926
4946
  this.modelPath = undefined;
4927
4947
  this.device = undefined;
4928
4948
  this.probabilityThreshold = undefined;
@@ -4963,6 +4983,7 @@ const Camera = class {
4963
4983
  stream.setCallbackStopAnimation(this.callbackStopAnimation);
4964
4984
  stream.setCallbackVideoStarted(this.callbackVideoStarted);
4965
4985
  stream.setCallbackTimeElapsed(this.callbackTimeElapsed);
4986
+ stream.setVerificationFinished(this.callbackVerificationFinished);
4966
4987
  }
4967
4988
  get component() { return index.getElement(this); }
4968
4989
  };
@@ -5452,6 +5473,7 @@ const IdDoubleSide = class {
5452
5473
  this.front = undefined;
5453
5474
  this.flow = {
5454
5475
  done: false,
5476
+ verificationFinished: false,
5455
5477
  photoFile: null,
5456
5478
  photoFileName: '',
5457
5479
  photoUploadType: '',
@@ -5521,6 +5543,12 @@ const IdDoubleSide = class {
5521
5543
  this.apiErrorEvent.emit(e);
5522
5544
  }
5523
5545
  }
5546
+ async verificationFinished(_event) {
5547
+ this.flow.verificationFinished = true;
5548
+ if (this.flow.done) {
5549
+ state.flowStatus = FlowStatus.LIVENESS;
5550
+ }
5551
+ }
5524
5552
  async runFlow() {
5525
5553
  if (this.flow.photoFile == null || this.flow.recordingFile == null || this.flow.done) {
5526
5554
  return;
@@ -5546,7 +5574,9 @@ const IdDoubleSide = class {
5546
5574
  }
5547
5575
  else {
5548
5576
  this.flow.done = true;
5549
- state.flowStatus = FlowStatus.LIVENESS;
5577
+ if (this.flow.verificationFinished) {
5578
+ state.flowStatus = FlowStatus.LIVENESS;
5579
+ }
5550
5580
  }
5551
5581
  }
5552
5582
  else {
@@ -5585,6 +5615,7 @@ const IdSingleSide = class {
5585
5615
  this.showTimeout = undefined;
5586
5616
  this.showHowTo = undefined;
5587
5617
  this.idFlow = {
5618
+ verificationFinished: false,
5588
5619
  done: false,
5589
5620
  photoFile: null,
5590
5621
  recordingFile: null,
@@ -5612,6 +5643,12 @@ const IdSingleSide = class {
5612
5643
  this.apiErrorEvent.emit(e);
5613
5644
  }
5614
5645
  }
5646
+ async verificationFinished(_event) {
5647
+ this.idFlow.verificationFinished = true;
5648
+ if (this.idFlow.done) {
5649
+ state.flowStatus = FlowStatus.LIVENESS;
5650
+ }
5651
+ }
5615
5652
  async capturedIdRecording(event) {
5616
5653
  let idRecording = event.detail;
5617
5654
  let mimeType = idRecording.type.split(';')[0];
@@ -5641,7 +5678,7 @@ const IdSingleSide = class {
5641
5678
  }
5642
5679
  let uploadedRecording = await this.apiCall.UploadFileForRequestB64(state.requestId, 'IdFrontVideo', this.idFlow.recordingFile);
5643
5680
  this.idFlow.done = uploadedRecording;
5644
- if (uploadedRecording === true) {
5681
+ if (uploadedRecording === true && this.idFlow.verificationFinished) {
5645
5682
  state.flowStatus = FlowStatus.LIVENESS;
5646
5683
  }
5647
5684
  else {
@@ -5888,7 +5925,15 @@ const LandingValidation = class {
5888
5925
  }
5889
5926
  async startFlow() {
5890
5927
  if (state.initialised) {
5891
- state.flowStatus = FlowStatus.AGREEMENT;
5928
+ if (state.agreementsValidation) {
5929
+ state.flowStatus = FlowStatus.AGREEMENT;
5930
+ }
5931
+ else if (state.phoneValidation) {
5932
+ state.flowStatus = FlowStatus.PHONE;
5933
+ }
5934
+ else {
5935
+ state.flowStatus = FlowStatus.ID;
5936
+ }
5892
5937
  }
5893
5938
  }
5894
5939
  render() {
@@ -6019,7 +6064,7 @@ const SmsCodeValidation = class {
6019
6064
  try {
6020
6065
  if (state.flowStatus == FlowStatus.CODE || state.flowStatus == FlowStatus.CODEERROR) {
6021
6066
  var codeChecked = await this.apiCall.CheckOTPCode(state.requestId, this.code);
6022
- if (typeof codeChecked === 'boolean' && codeChecked) {
6067
+ if (codeChecked === true) {
6023
6068
  state.flowStatus = FlowStatus.ID;
6024
6069
  }
6025
6070
  else {
@@ -6028,7 +6073,7 @@ const SmsCodeValidation = class {
6028
6073
  }
6029
6074
  if (state.flowStatus == FlowStatus.PHONE) {
6030
6075
  var codeSent = await this.apiCall.SendOTPCode(state.requestId, this.phoneNumber);
6031
- if (typeof codeSent === 'boolean' && codeSent) {
6076
+ if (codeSent === true) {
6032
6077
  state.flowStatus = FlowStatus.CODE;
6033
6078
  }
6034
6079
  }
@@ -6088,6 +6133,7 @@ const UserLiveness = class {
6088
6133
  this.apiErrorEvent = index.createEvent(this, "apiError", 7);
6089
6134
  this.selfieFlow = {
6090
6135
  done: false,
6136
+ verificationFinished: false,
6091
6137
  photoFile: null,
6092
6138
  recordingFile: null,
6093
6139
  };
@@ -6130,6 +6176,12 @@ const UserLiveness = class {
6130
6176
  this.apiErrorEvent.emit(e);
6131
6177
  }
6132
6178
  }
6179
+ async verificationFinished(_event) {
6180
+ this.selfieFlow.verificationFinished = true;
6181
+ if (this.selfieFlow.done) {
6182
+ state.flowStatus = FlowStatus.COMPLETE;
6183
+ }
6184
+ }
6133
6185
  async runSelfieFlow() {
6134
6186
  if (this.selfieFlow.photoFile == null || this.selfieFlow.recordingFile == null || this.selfieFlow.done) {
6135
6187
  return;
@@ -6144,7 +6196,7 @@ const UserLiveness = class {
6144
6196
  }
6145
6197
  let uploadRecording = await this.apiCall.UploadFileForRequestB64(state.requestId, 'SelfieVideo', this.selfieFlow.recordingFile);
6146
6198
  this.selfieFlow.done = uploadRecording;
6147
- if (uploadRecording == true) {
6199
+ if (uploadRecording == true && this.selfieFlow.verificationFinished) {
6148
6200
  state.flowStatus = FlowStatus.COMPLETE;
6149
6201
  }
6150
6202
  else {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-be29a2a8.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Esm v2.19.3 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Esm v2.20.0 | MIT Licensed | https://stenciljs.com
9
9
  */
10
10
  const patchEsm = () => {
11
11
  return index.promiseResolve();
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["loader-dots.cjs",[[1,"loader-dots"]]],["agreement-check_16.cjs",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"idSide":[32],"errorMessage":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"],[0,"apiError","apiErrorEmitter"]]],[0,"id-double-side",{"device":[16],"showTimeout":[32],"showInvalid":[32],"showHowTo":[32],"front":[32],"flow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"photoIdBackCapture","captureIdBackImage"],[0,"recordingIdCapture","capturedIdRecording"]]],[0,"id-single-side",{"device":[16],"showTimeout":[32],"showHowTo":[32],"idFlow":[32]},[[0,"captureErrorDone","captureErrorDone"],[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"photoIdCapture","captureIdImage"],[0,"recordingIdCapture","capturedIdRecording"]]],[0,"user-liveness",{"device":[16],"showError":[32],"showHowTo":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoSelfieCapture","captureSelfieImage"],[0,"recordingSelfieCapture","capturedSelfieRecording"]]],[0,"agreement-info",{"agreementsChecked":[32],"termsChecked":[32],"openAgreements":[32],"openTerms":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"end-redirect"],[0,"error-end",{"message":[1]}],[0,"landing-validation",{"device":[16],"warningText":[32]}],[0,"sms-code-validation",{"title":[32],"details":[32],"buttonText":[32],"phoneNumber":[32],"code":[32]}],[0,"id-back-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"titleMesage":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"stopAnimation","eventStopAnimation"],[0,"takePhoto","takePhoto"]]],[0,"selfie-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"titleMesage":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"stopAnimation","eventStopAnimation"],[0,"takePhoto","takePhoto"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32]}],[0,"id-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"titleMesage":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"stopAnimation","eventStopAnimation"],[0,"takePhoto","takePhoto"]]],[0,"capture-error",{"type":[1]}],[0,"how-to-info",{"idSide":[1,"id-side"],"topTitle":[32],"subTitle":[32],"descriptionR1":[32],"descriptionR2":[32],"descriptionR3":[32],"imagePath":[32],"buttonText":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"device":[16],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
17
+ return index.bootstrapLazy([["loader-dots.cjs",[[1,"loader-dots"]]],["agreement-check_16.cjs",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"idSide":[32],"errorMessage":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"],[0,"apiError","apiErrorEmitter"]]],[0,"id-double-side",{"device":[16],"showTimeout":[32],"showInvalid":[32],"showHowTo":[32],"front":[32],"flow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"photoIdBackCapture","captureIdBackImage"],[0,"recordingIdCapture","capturedIdRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"id-single-side",{"device":[16],"showTimeout":[32],"showHowTo":[32],"idFlow":[32]},[[0,"captureErrorDone","captureErrorDone"],[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"photoIdCapture","captureIdImage"],[0,"verificationFinished","verificationFinished"],[0,"recordingIdCapture","capturedIdRecording"]]],[0,"user-liveness",{"device":[16],"showError":[32],"showHowTo":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoSelfieCapture","captureSelfieImage"],[0,"recordingSelfieCapture","capturedSelfieRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-info",{"agreementsChecked":[32],"termsChecked":[32],"openAgreements":[32],"openTerms":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"end-redirect"],[0,"error-end",{"message":[1]}],[0,"landing-validation",{"device":[16],"warningText":[32]}],[0,"sms-code-validation",{"title":[32],"details":[32],"buttonText":[32],"phoneNumber":[32],"code":[32]}],[0,"id-back-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"titleMesage":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"stopAnimation","eventStopAnimation"],[0,"takePhoto","takePhoto"]]],[0,"selfie-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"titleMesage":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"stopAnimation","eventStopAnimation"],[0,"takePhoto","takePhoto"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32]}],[0,"id-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"titleMesage":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"stopAnimation","eventStopAnimation"],[0,"takePhoto","takePhoto"]]],[0,"capture-error",{"type":[1]}],[0,"how-to-info",{"idSide":[1,"id-side"],"topTitle":[32],"subTitle":[32],"descriptionR1":[32],"descriptionR2":[32],"descriptionR3":[32],"imagePath":[32],"buttonText":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"device":[16],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -3,7 +3,7 @@
3
3
  const index = require('./index-be29a2a8.js');
4
4
 
5
5
  /*
6
- Stencil Client Patch Browser v2.19.3 | MIT Licensed | https://stenciljs.com
6
+ Stencil Client Patch Browser v2.20.0 | MIT Licensed | https://stenciljs.com
7
7
  */
8
8
  const patchBrowser = () => {
9
9
  const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('qbs-ect-cmp.cjs.js', document.baseURI).href));
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["loader-dots.cjs",[[1,"loader-dots"]]],["agreement-check_16.cjs",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"idSide":[32],"errorMessage":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"],[0,"apiError","apiErrorEmitter"]]],[0,"id-double-side",{"device":[16],"showTimeout":[32],"showInvalid":[32],"showHowTo":[32],"front":[32],"flow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"photoIdBackCapture","captureIdBackImage"],[0,"recordingIdCapture","capturedIdRecording"]]],[0,"id-single-side",{"device":[16],"showTimeout":[32],"showHowTo":[32],"idFlow":[32]},[[0,"captureErrorDone","captureErrorDone"],[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"photoIdCapture","captureIdImage"],[0,"recordingIdCapture","capturedIdRecording"]]],[0,"user-liveness",{"device":[16],"showError":[32],"showHowTo":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoSelfieCapture","captureSelfieImage"],[0,"recordingSelfieCapture","capturedSelfieRecording"]]],[0,"agreement-info",{"agreementsChecked":[32],"termsChecked":[32],"openAgreements":[32],"openTerms":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"end-redirect"],[0,"error-end",{"message":[1]}],[0,"landing-validation",{"device":[16],"warningText":[32]}],[0,"sms-code-validation",{"title":[32],"details":[32],"buttonText":[32],"phoneNumber":[32],"code":[32]}],[0,"id-back-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"titleMesage":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"stopAnimation","eventStopAnimation"],[0,"takePhoto","takePhoto"]]],[0,"selfie-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"titleMesage":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"stopAnimation","eventStopAnimation"],[0,"takePhoto","takePhoto"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32]}],[0,"id-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"titleMesage":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"stopAnimation","eventStopAnimation"],[0,"takePhoto","takePhoto"]]],[0,"capture-error",{"type":[1]}],[0,"how-to-info",{"idSide":[1,"id-side"],"topTitle":[32],"subTitle":[32],"descriptionR1":[32],"descriptionR2":[32],"descriptionR3":[32],"imagePath":[32],"buttonText":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"device":[16],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
18
+ return index.bootstrapLazy([["loader-dots.cjs",[[1,"loader-dots"]]],["agreement-check_16.cjs",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"idSide":[32],"errorMessage":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"],[0,"apiError","apiErrorEmitter"]]],[0,"id-double-side",{"device":[16],"showTimeout":[32],"showInvalid":[32],"showHowTo":[32],"front":[32],"flow":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"photoIdBackCapture","captureIdBackImage"],[0,"recordingIdCapture","capturedIdRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"id-single-side",{"device":[16],"showTimeout":[32],"showHowTo":[32],"idFlow":[32]},[[0,"captureErrorDone","captureErrorDone"],[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"photoIdCapture","captureIdImage"],[0,"verificationFinished","verificationFinished"],[0,"recordingIdCapture","capturedIdRecording"]]],[0,"user-liveness",{"device":[16],"showError":[32],"showHowTo":[32]},[[0,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoSelfieCapture","captureSelfieImage"],[0,"recordingSelfieCapture","capturedSelfieRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-info",{"agreementsChecked":[32],"termsChecked":[32],"openAgreements":[32],"openTerms":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"end-redirect"],[0,"error-end",{"message":[1]}],[0,"landing-validation",{"device":[16],"warningText":[32]}],[0,"sms-code-validation",{"title":[32],"details":[32],"buttonText":[32],"phoneNumber":[32],"code":[32]}],[0,"id-back-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"titleMesage":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"stopAnimation","eventStopAnimation"],[0,"takePhoto","takePhoto"]]],[0,"selfie-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"titleMesage":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"stopAnimation","eventStopAnimation"],[0,"takePhoto","takePhoto"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32]}],[0,"id-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"titleMesage":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"stopAnimation","eventStopAnimation"],[0,"takePhoto","takePhoto"]]],[0,"capture-error",{"type":[1]}],[0,"how-to-info",{"idSide":[1,"id-side"],"topTitle":[32],"subTitle":[32],"descriptionR1":[32],"descriptionR2":[32],"descriptionR3":[32],"imagePath":[32],"buttonText":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"device":[16],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
19
19
  });
@@ -20,8 +20,8 @@
20
20
  ],
21
21
  "compiler": {
22
22
  "name": "@stencil/core",
23
- "version": "2.19.3",
24
- "typescriptVersion": "4.7.4"
23
+ "version": "2.20.0",
24
+ "typescriptVersion": "4.8.4"
25
25
  },
26
26
  "collections": [],
27
27
  "bundles": []
@@ -37,6 +37,9 @@ export class Camera {
37
37
  this.callbackVideoStarted = () => {
38
38
  this.eventVideoStarted.emit(this.component.getBoundingClientRect());
39
39
  };
40
+ this.callbackVerificationFinished = () => {
41
+ this.verificationFinished.emit();
42
+ };
40
43
  this.modelPath = undefined;
41
44
  this.device = undefined;
42
45
  this.probabilityThreshold = undefined;
@@ -77,6 +80,7 @@ export class Camera {
77
80
  stream.setCallbackStopAnimation(this.callbackStopAnimation);
78
81
  stream.setCallbackVideoStarted(this.callbackVideoStarted);
79
82
  stream.setCallbackTimeElapsed(this.callbackTimeElapsed);
83
+ stream.setVerificationFinished(this.callbackVerificationFinished);
80
84
  }
81
85
  static get is() { return "camera-comp"; }
82
86
  static get originalStyleUrls() {
@@ -300,6 +304,21 @@ export class Camera {
300
304
  "resolved": "any",
301
305
  "references": {}
302
306
  }
307
+ }, {
308
+ "method": "verificationFinished",
309
+ "name": "verificationFinished",
310
+ "bubbles": true,
311
+ "cancelable": true,
312
+ "composed": true,
313
+ "docs": {
314
+ "tags": [],
315
+ "text": ""
316
+ },
317
+ "complexType": {
318
+ "original": "any",
319
+ "resolved": "any",
320
+ "references": {}
321
+ }
303
322
  }];
304
323
  }
305
324
  static get elementRef() { return "component"; }
@@ -12,6 +12,7 @@ export class IdDoubleSide {
12
12
  this.front = undefined;
13
13
  this.flow = {
14
14
  done: false,
15
+ verificationFinished: false,
15
16
  photoFile: null,
16
17
  photoFileName: '',
17
18
  photoUploadType: '',
@@ -81,6 +82,12 @@ export class IdDoubleSide {
81
82
  this.apiErrorEvent.emit(e);
82
83
  }
83
84
  }
85
+ async verificationFinished(_event) {
86
+ this.flow.verificationFinished = true;
87
+ if (this.flow.done) {
88
+ store.flowStatus = FlowStatus.LIVENESS;
89
+ }
90
+ }
84
91
  async runFlow() {
85
92
  if (this.flow.photoFile == null || this.flow.recordingFile == null || this.flow.done) {
86
93
  return;
@@ -106,7 +113,9 @@ export class IdDoubleSide {
106
113
  }
107
114
  else {
108
115
  this.flow.done = true;
109
- store.flowStatus = FlowStatus.LIVENESS;
116
+ if (this.flow.verificationFinished) {
117
+ store.flowStatus = FlowStatus.LIVENESS;
118
+ }
110
119
  }
111
120
  }
112
121
  else {
@@ -231,6 +240,12 @@ export class IdDoubleSide {
231
240
  "target": undefined,
232
241
  "capture": false,
233
242
  "passive": false
243
+ }, {
244
+ "name": "verificationFinished",
245
+ "method": "verificationFinished",
246
+ "target": undefined,
247
+ "capture": false,
248
+ "passive": false
234
249
  }];
235
250
  }
236
251
  }
@@ -9,6 +9,7 @@ export class IdSingleSide {
9
9
  this.showTimeout = undefined;
10
10
  this.showHowTo = undefined;
11
11
  this.idFlow = {
12
+ verificationFinished: false,
12
13
  done: false,
13
14
  photoFile: null,
14
15
  recordingFile: null,
@@ -36,6 +37,12 @@ export class IdSingleSide {
36
37
  this.apiErrorEvent.emit(e);
37
38
  }
38
39
  }
40
+ async verificationFinished(_event) {
41
+ this.idFlow.verificationFinished = true;
42
+ if (this.idFlow.done) {
43
+ store.flowStatus = FlowStatus.LIVENESS;
44
+ }
45
+ }
39
46
  async capturedIdRecording(event) {
40
47
  let idRecording = event.detail;
41
48
  let mimeType = idRecording.type.split(';')[0];
@@ -65,7 +72,7 @@ export class IdSingleSide {
65
72
  }
66
73
  let uploadedRecording = await this.apiCall.UploadFileForRequestB64(store.requestId, 'IdFrontVideo', this.idFlow.recordingFile);
67
74
  this.idFlow.done = uploadedRecording;
68
- if (uploadedRecording === true) {
75
+ if (uploadedRecording === true && this.idFlow.verificationFinished) {
69
76
  store.flowStatus = FlowStatus.LIVENESS;
70
77
  }
71
78
  else {
@@ -175,6 +182,12 @@ export class IdSingleSide {
175
182
  "target": undefined,
176
183
  "capture": false,
177
184
  "passive": false
185
+ }, {
186
+ "name": "verificationFinished",
187
+ "method": "verificationFinished",
188
+ "target": undefined,
189
+ "capture": false,
190
+ "passive": false
178
191
  }, {
179
192
  "name": "recordingIdCapture",
180
193
  "method": "capturedIdRecording",
@@ -31,7 +31,15 @@ export class LandingValidation {
31
31
  }
32
32
  async startFlow() {
33
33
  if (store.initialised) {
34
- store.flowStatus = FlowStatus.AGREEMENT;
34
+ if (store.agreementsValidation) {
35
+ store.flowStatus = FlowStatus.AGREEMENT;
36
+ }
37
+ else if (store.phoneValidation) {
38
+ store.flowStatus = FlowStatus.PHONE;
39
+ }
40
+ else {
41
+ store.flowStatus = FlowStatus.ID;
42
+ }
35
43
  }
36
44
  }
37
45
  render() {
@@ -16,7 +16,7 @@ export class SmsCodeValidation {
16
16
  try {
17
17
  if (store.flowStatus == FlowStatus.CODE || store.flowStatus == FlowStatus.CODEERROR) {
18
18
  var codeChecked = await this.apiCall.CheckOTPCode(store.requestId, this.code);
19
- if (typeof codeChecked === 'boolean' && codeChecked) {
19
+ if (codeChecked === true) {
20
20
  store.flowStatus = FlowStatus.ID;
21
21
  }
22
22
  else {
@@ -25,7 +25,7 @@ export class SmsCodeValidation {
25
25
  }
26
26
  if (store.flowStatus == FlowStatus.PHONE) {
27
27
  var codeSent = await this.apiCall.SendOTPCode(store.requestId, this.phoneNumber);
28
- if (typeof codeSent === 'boolean' && codeSent) {
28
+ if (codeSent === true) {
29
29
  store.flowStatus = FlowStatus.CODE;
30
30
  }
31
31
  }
@@ -6,6 +6,7 @@ export class UserLiveness {
6
6
  constructor() {
7
7
  this.selfieFlow = {
8
8
  done: false,
9
+ verificationFinished: false,
9
10
  photoFile: null,
10
11
  recordingFile: null,
11
12
  };
@@ -48,6 +49,12 @@ export class UserLiveness {
48
49
  this.apiErrorEvent.emit(e);
49
50
  }
50
51
  }
52
+ async verificationFinished(_event) {
53
+ this.selfieFlow.verificationFinished = true;
54
+ if (this.selfieFlow.done) {
55
+ store.flowStatus = FlowStatus.COMPLETE;
56
+ }
57
+ }
51
58
  async runSelfieFlow() {
52
59
  if (this.selfieFlow.photoFile == null || this.selfieFlow.recordingFile == null || this.selfieFlow.done) {
53
60
  return;
@@ -62,7 +69,7 @@ export class UserLiveness {
62
69
  }
63
70
  let uploadRecording = await this.apiCall.UploadFileForRequestB64(store.requestId, 'SelfieVideo', this.selfieFlow.recordingFile);
64
71
  this.selfieFlow.done = uploadRecording;
65
- if (uploadRecording == true) {
72
+ if (uploadRecording == true && this.selfieFlow.verificationFinished) {
66
73
  store.flowStatus = FlowStatus.COMPLETE;
67
74
  }
68
75
  else {
@@ -167,6 +174,12 @@ export class UserLiveness {
167
174
  "target": undefined,
168
175
  "capture": false,
169
176
  "passive": false
177
+ }, {
178
+ "name": "verificationFinished",
179
+ "method": "verificationFinished",
180
+ "target": undefined,
181
+ "capture": false,
182
+ "passive": false
170
183
  }];
171
184
  }
172
185
  }
@@ -54,6 +54,8 @@ export class ApiCall {
54
54
  let data = { requestId: requestId, clientDeviceInfo: deviceInfo };
55
55
  let jsonResp = await this.post('/validation/identity/insert', JSON.stringify(data));
56
56
  store.hasIdBack = jsonResp.hasIdBack;
57
+ store.agreementsValidation = jsonResp.agreementsValidation;
58
+ store.phoneValidation = jsonResp.phoneValidation;
57
59
  return true;
58
60
  }
59
61
  async UploadFileForRequestB64(requestId, type, file) {
@@ -59,6 +59,9 @@ export class Stream {
59
59
  setCallbackTimeElapsed(fun) {
60
60
  this.callbackTimeElapsed = fun;
61
61
  }
62
+ setVerificationFinished(fun) {
63
+ this.verificationFinished = fun;
64
+ }
62
65
  static getInstance(device, modelPath) {
63
66
  if (!Stream.instance) {
64
67
  Stream.instance = new Stream(device, modelPath);
@@ -74,6 +77,9 @@ export class Stream {
74
77
  timeElapsed() {
75
78
  this.callbackTimeElapsed();
76
79
  }
80
+ verificationReady() {
81
+ this.verificationFinished();
82
+ }
77
83
  updateHtmlElements(videoElement, canvasElement, component) {
78
84
  this.videoElement = videoElement;
79
85
  this.canvasElement = canvasElement;
@@ -9,6 +9,8 @@ const { state, onChange } = createStore({
9
9
  cameraIds: [],
10
10
  cameraId: '',
11
11
  hasIdBack: false,
12
+ agreementsValidation: true,
13
+ phoneValidation: true,
12
14
  apiBaseUrl: 'https://apiro.id-kyc.com',
13
15
  });
14
16
  onChange('flowStatus', value => {
@@ -56,7 +56,7 @@ export class FaceML5Detector {
56
56
  this.start = Date.now();
57
57
  if (Date.now() > this.start + 3000) {
58
58
  this.continue = false;
59
- this.stream.autoCapturing();
59
+ this.stream.verificationReady();
60
60
  }
61
61
  }
62
62
  if (Date.now() - this.initTime >= this.MAX_DETECTION) {
@@ -80,6 +80,7 @@ export class FaceML5Detector {
80
80
  if (this.isSingleFace(results) && this.checkProbability(results) && this.checkFaceSize(results) && this.checkFaceIndent(results)) {
81
81
  if (!this.validFaceFound) {
82
82
  this.validFaceFound = true;
83
+ this.stream.autoCapturing();
83
84
  this.frontFace = new FaceLandmarks(results[0], this.width, this.height);
84
85
  this.stream.stopAnimation();
85
86
  await this.drawFrame('green');
@@ -190,17 +191,20 @@ export class FaceML5Detector {
190
191
  this.validFacePose = true;
191
192
  this.stream.stopAnimation();
192
193
  await this.drawFrame('green');
193
- this.stream.changeFacePose();
194
- }
195
- }
196
- if (this.validFacePose && this.requestedFacePose != null) {
197
- if (face.leftEyeNoseDistanceX() < face.rightEyeNoseDistanceX() * 1.2 &&
198
- face.leftEyeNoseDistanceX() > face.rightEyeNoseDistanceX() * 0.8 &&
199
- Math.abs(face.eyesLevel()) < this.height * 0.1) {
200
194
  this.validFaceFoundAgain = true;
201
- this.stream.stopAnimation();
202
- this.drawFrame('green', true);
195
+ //this.stream.changeFacePose();
203
196
  }
204
197
  }
198
+ // if (this.validFacePose && this.requestedFacePose != null) {
199
+ // if (
200
+ // face.leftEyeNoseDistanceX() < face.rightEyeNoseDistanceX() * 1.2 &&
201
+ // face.leftEyeNoseDistanceX() > face.rightEyeNoseDistanceX() * 0.8 &&
202
+ // Math.abs(face.eyesLevel()) < this.height * 0.1
203
+ // ) {
204
+ // this.validFaceFoundAgain = true;
205
+ // this.stream.stopAnimation();
206
+ // this.drawFrame('green', true);
207
+ // }
208
+ // }
205
209
  }
206
210
  }
@@ -34,14 +34,17 @@ export class IDML5Detector {
34
34
  this.delay(2000).then(() => this.classifyVideo());
35
35
  }
36
36
  classifyVideo() {
37
- if (this.full == 2 && this.tilted == 1) {
37
+ if (this.full == 1 && this.tilted == 1) {
38
38
  if (this.start == null)
39
39
  this.start = Date.now();
40
40
  if (Date.now() > this.start + 3000) {
41
41
  this.continue = false;
42
- this.stream.autoCapturing();
42
+ this.stream.verificationReady();
43
43
  }
44
44
  }
45
+ if (this.full == 1 && this.tilted == 0) {
46
+ this.stream.autoCapturing();
47
+ }
45
48
  if (Date.now() - this.initTime >= this.MAX_DETECTION) {
46
49
  this.continue = false;
47
50
  this.stream.timeElapsed();
@@ -63,7 +66,6 @@ export class IDML5Detector {
63
66
  this.stream.changeIDPose(IDPose.Tilted);
64
67
  }
65
68
  if (this.full == 1 && this.tilted == 1) {
66
- this.full = 2;
67
69
  this.stream.stopAnimation();
68
70
  this.drawFrame('green', true);
69
71
  }