@ekyc_qoobiss/qbs-ect-cmp 1.9.7 → 1.9.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.
@@ -309,10 +309,23 @@ AgreementInfoValues.Agreement = 'Îmi exprim acordul pentru prelucrarea datelor
309
309
  class AgreementCheckValues extends GlobalValues {
310
310
  }
311
311
  AgreementCheckValues.ButtonYes = 'Sunt de acord';
312
- AgreementCheckValues.ButtonNo = 'Nu sunt de acord';
312
+ AgreementCheckValues.ButtonNo = 'Nu sunt de acord';
313
+ class ApiUrls {
314
+ constructor() {
315
+ this.uriEnv = '';
316
+ this.OtpSend = this.uriEnv + 'validation/otp/send';
317
+ this.OtpCheck = this.uriEnv + 'validation/otp/send';
318
+ this.IdentityInsert = this.uriEnv + 'validation/identity/insert';
319
+ this.UploadCapture = this.uriEnv + 'validation/upload/capture';
320
+ this.GetAgreement = this.uriEnv + 'validation/agreement/content';
321
+ this.GenerateAgreement = this.uriEnv + 'validation/agreement/generate';
322
+ this.uriEnv = state.environment == 'QA' ? '/dev_' : '/';
323
+ }
324
+ }
313
325
 
314
326
  const { state, onChange } = createStore({
315
327
  flowStatus: FlowStatus.LANDING,
328
+ environment: 'PROD',
316
329
  requestId: '',
317
330
  initialised: false,
318
331
  token: '',
@@ -335,6 +348,7 @@ class ApiCall {
335
348
  reader.onload = () => resolve(reader.result);
336
349
  reader.onerror = error => reject(error);
337
350
  });
351
+ this.urls = new ApiUrls();
338
352
  }
339
353
  async http(request) {
340
354
  const response = await fetch(request);
@@ -370,17 +384,17 @@ class ApiCall {
370
384
  }
371
385
  async SendOTPCode(requestId, phoneNumber) {
372
386
  let data = { requestId: requestId, phone: phoneNumber };
373
- let jsonResp = await this.post('/validation/otp/send', JSON.stringify(data));
387
+ let jsonResp = await this.post(this.urls.OtpSend, JSON.stringify(data));
374
388
  return jsonResp.sent;
375
389
  }
376
390
  async CheckOTPCode(requestId, otpCode) {
377
391
  let data = { requestId: requestId, otp: otpCode };
378
- let jsonResp = await this.post('/validation/otp/check', JSON.stringify(data));
392
+ let jsonResp = await this.post(this.urls.OtpCheck, JSON.stringify(data));
379
393
  return jsonResp.valid;
380
394
  }
381
395
  async AddIdentificationRequest(requestId, deviceInfo) {
382
396
  let data = { requestId: requestId, clientDeviceInfo: deviceInfo };
383
- let jsonResp = await this.post('/validation/identity/insert', JSON.stringify(data));
397
+ let jsonResp = await this.post(this.urls.IdentityInsert, JSON.stringify(data));
384
398
  state.hasIdBack = jsonResp.hasIdBack;
385
399
  state.agreementsValidation = jsonResp.agreementsValidation;
386
400
  state.phoneValidation = jsonResp.phoneValidation;
@@ -392,7 +406,7 @@ class ApiCall {
392
406
  type: type,
393
407
  data: await this.toBase64(file),
394
408
  };
395
- let respJson = await this.post('/validation/upload/capture', JSON.stringify(data));
409
+ let respJson = await this.post(this.urls.UploadCapture, JSON.stringify(data));
396
410
  if (!state.hasIdBack && type == 'IdFront') {
397
411
  return respJson.isValid;
398
412
  }
@@ -402,12 +416,12 @@ class ApiCall {
402
416
  return true;
403
417
  }
404
418
  async GetAgreement(agreementType) {
405
- let resp = await this.get('/validation/agreement/content?type=' + agreementType + '&requestId=' + state.requestId);
419
+ let resp = await this.get(this.urls.GetAgreement + '?type=' + agreementType + '&requestId=' + state.requestId);
406
420
  return resp.htmlText;
407
421
  }
408
422
  async GenerateAgreement(agreementType) {
409
423
  let data = { requestId: state.requestId, documentType: agreementType };
410
- let resp = await this.post('/validation/agreement/generate', JSON.stringify(data));
424
+ let resp = await this.post(this.urls.GenerateAgreement, JSON.stringify(data));
411
425
  return resp.generation;
412
426
  }
413
427
  }
@@ -5498,7 +5512,8 @@ const IdDoubleSide = class {
5498
5512
  this.showHowTo = undefined;
5499
5513
  this.front = undefined;
5500
5514
  this.flow = {
5501
- done: false,
5515
+ photoDone: false,
5516
+ recordingDone: false,
5502
5517
  verificationFinished: false,
5503
5518
  photoFile: null,
5504
5519
  photoFileName: '',
@@ -5541,7 +5556,7 @@ const IdDoubleSide = class {
5541
5556
  let idPhoto = event.detail;
5542
5557
  try {
5543
5558
  this.flow.photoFile = new File([idPhoto], this.flow.photoFileName, { type: 'image/png' });
5544
- await this.runFlow();
5559
+ await this.endFlow();
5545
5560
  }
5546
5561
  catch (e) {
5547
5562
  this.apiErrorEvent.emit(e);
@@ -5551,7 +5566,7 @@ const IdDoubleSide = class {
5551
5566
  let idPhoto = event.detail;
5552
5567
  try {
5553
5568
  this.flow.photoFile = new File([idPhoto], this.flow.photoFileName, { type: 'image/png' });
5554
- await this.runFlow();
5569
+ await this.endFlow();
5555
5570
  }
5556
5571
  catch (e) {
5557
5572
  this.apiErrorEvent.emit(e);
@@ -5563,7 +5578,7 @@ const IdDoubleSide = class {
5563
5578
  let extension = mimeType.split('/')[1];
5564
5579
  try {
5565
5580
  this.flow.recordingFile = new File([idRecording], this.flow.recordingFileName + extension, { type: mimeType });
5566
- await this.runFlow();
5581
+ this.endFlow();
5567
5582
  }
5568
5583
  catch (e) {
5569
5584
  this.apiErrorEvent.emit(e);
@@ -5571,39 +5586,30 @@ const IdDoubleSide = class {
5571
5586
  }
5572
5587
  async verificationFinished(_event) {
5573
5588
  this.flow.verificationFinished = true;
5574
- if (this.flow.done) {
5575
- state.flowStatus = FlowStatus.LIVENESS;
5576
- }
5589
+ this.endFlow();
5577
5590
  }
5578
- async runFlow() {
5579
- if (this.flow.photoFile == null || this.flow.recordingFile == null || this.flow.done) {
5591
+ async uploadPhoto() {
5592
+ if (this.flow.photoFile == null || this.flow.photoDone) {
5580
5593
  return;
5581
5594
  }
5582
- let uploadedPhoto = await this.apiCall.UploadFileForRequestB64(state.requestId, this.flow.photoUploadType, this.flow.photoFile);
5583
- if (uploadedPhoto === false) {
5584
- this.flow.done = false;
5595
+ this.flow.photoDone = await this.apiCall.UploadFileForRequestB64(state.requestId, this.flow.photoUploadType, this.flow.photoFile);
5596
+ if (this.flow.photoDone) {
5597
+ this.endFlow();
5598
+ }
5599
+ else {
5585
5600
  this.flow.photoFile = null;
5586
5601
  this.flow.recordingFile = null;
5587
5602
  this.switchCamera();
5588
5603
  this.showInvalid = true;
5604
+ }
5605
+ }
5606
+ async uploadRecording() {
5607
+ if (this.flow.recordingFile == null || this.flow.recordingDone) {
5589
5608
  return;
5590
5609
  }
5591
- let uploadedRecording = await this.apiCall.UploadFileForRequestB64(state.requestId, this.flow.recordingUploadType, this.flow.recordingFile);
5592
- if (uploadedRecording === true) {
5593
- if (this.front) {
5594
- this.flow.photoFileName = 'idBackImage.png';
5595
- this.flow.recordingFileName = 'idBackVideo.';
5596
- this.flow.photoUploadType = 'IdBack';
5597
- this.flow.recordingUploadType = 'IdBackVideo';
5598
- this.front = false;
5599
- this.showHowTo = true;
5600
- }
5601
- else {
5602
- this.flow.done = true;
5603
- if (this.flow.verificationFinished) {
5604
- state.flowStatus = FlowStatus.LIVENESS;
5605
- }
5606
- }
5610
+ this.flow.recordingDone = await this.apiCall.UploadFileForRequestB64(state.requestId, this.flow.recordingUploadType, this.flow.recordingFile);
5611
+ if (this.flow.recordingDone) {
5612
+ await this.endFlow();
5607
5613
  }
5608
5614
  else {
5609
5615
  this.flow.photoFile = null;
@@ -5611,6 +5617,29 @@ const IdDoubleSide = class {
5611
5617
  this.showInvalid = true;
5612
5618
  }
5613
5619
  }
5620
+ endFlow() {
5621
+ if (!this.flow.photoDone) {
5622
+ return;
5623
+ }
5624
+ if (!this.flow.recordingDone) {
5625
+ return;
5626
+ }
5627
+ if (this.front) {
5628
+ this.flow.photoFileName = 'idBackImage.png';
5629
+ this.flow.recordingFileName = 'idBackVideo.';
5630
+ this.flow.photoUploadType = 'IdBack';
5631
+ this.flow.recordingUploadType = 'IdBackVideo';
5632
+ this.flow.photoFile = null;
5633
+ this.flow.recordingFile = null;
5634
+ this.front = false;
5635
+ this.showHowTo = true;
5636
+ return;
5637
+ }
5638
+ if (!this.flow.verificationFinished) {
5639
+ return;
5640
+ }
5641
+ state.flowStatus = FlowStatus.LIVENESS;
5642
+ }
5614
5643
  switchCamera() {
5615
5644
  if (this.captureRetryCount == 2) {
5616
5645
  let camIndex = state.cameraIds.indexOf(state.cameraId);
@@ -5642,7 +5671,8 @@ const IdSingleSide = class {
5642
5671
  this.showHowTo = undefined;
5643
5672
  this.idFlow = {
5644
5673
  verificationFinished: false,
5645
- done: false,
5674
+ photoDone: false,
5675
+ recordingDone: false,
5646
5676
  photoFile: null,
5647
5677
  recordingFile: null,
5648
5678
  };
@@ -5663,7 +5693,7 @@ const IdSingleSide = class {
5663
5693
  let idPhoto = event.detail;
5664
5694
  try {
5665
5695
  this.idFlow.photoFile = new File([idPhoto], 'idImage.png', { type: 'image/png' });
5666
- await this.runIdFlow();
5696
+ await this.uploadPhoto();
5667
5697
  }
5668
5698
  catch (e) {
5669
5699
  this.apiErrorEvent.emit(e);
@@ -5671,9 +5701,7 @@ const IdSingleSide = class {
5671
5701
  }
5672
5702
  async verificationFinished(_event) {
5673
5703
  this.idFlow.verificationFinished = true;
5674
- if (this.idFlow.done) {
5675
- state.flowStatus = FlowStatus.LIVENESS;
5676
- }
5704
+ this.endFlow();
5677
5705
  }
5678
5706
  async capturedIdRecording(event) {
5679
5707
  let idRecording = event.detail;
@@ -5682,30 +5710,35 @@ const IdSingleSide = class {
5682
5710
  if (state.flowStatus == FlowStatus.ID) {
5683
5711
  try {
5684
5712
  this.idFlow.recordingFile = new File([idRecording], 'idVideo.' + extension, { type: mimeType });
5685
- await this.runIdFlow();
5713
+ await this.uploadRecording();
5686
5714
  }
5687
5715
  catch (e) {
5688
5716
  this.apiErrorEvent.emit(e);
5689
5717
  }
5690
5718
  }
5691
5719
  }
5692
- async runIdFlow() {
5693
- if (this.idFlow.photoFile == null || this.idFlow.recordingFile == null || this.idFlow.done) {
5720
+ async uploadPhoto() {
5721
+ if (this.idFlow.photoFile == null || this.idFlow.photoDone) {
5694
5722
  return;
5695
5723
  }
5696
- let uploadedPhoto = await this.apiCall.UploadFileForRequestB64(state.requestId, 'IdFront', this.idFlow.photoFile);
5697
- if (uploadedPhoto === false) {
5698
- this.idFlow.done = false;
5724
+ this.idFlow.photoDone = await this.apiCall.UploadFileForRequestB64(state.requestId, 'IdFront', this.idFlow.photoFile);
5725
+ if (this.idFlow.photoDone) {
5726
+ this.endFlow();
5727
+ }
5728
+ else {
5699
5729
  this.idFlow.photoFile = null;
5700
5730
  this.idFlow.recordingFile = null;
5701
5731
  this.switchCamera();
5702
5732
  this.showTimeout = true;
5733
+ }
5734
+ }
5735
+ async uploadRecording() {
5736
+ if (this.idFlow.recordingFile == null || this.idFlow.recordingDone) {
5703
5737
  return;
5704
5738
  }
5705
- let uploadedRecording = await this.apiCall.UploadFileForRequestB64(state.requestId, 'IdFrontVideo', this.idFlow.recordingFile);
5706
- this.idFlow.done = uploadedRecording;
5707
- if (uploadedRecording === true && this.idFlow.verificationFinished) {
5708
- state.flowStatus = FlowStatus.LIVENESS;
5739
+ this.idFlow.recordingDone = await this.apiCall.UploadFileForRequestB64(state.requestId, 'IdFrontVideo', this.idFlow.recordingFile);
5740
+ if (this.idFlow.recordingDone) {
5741
+ this.endFlow();
5709
5742
  }
5710
5743
  else {
5711
5744
  this.idFlow.photoFile = null;
@@ -5713,6 +5746,18 @@ const IdSingleSide = class {
5713
5746
  this.showTimeout = true;
5714
5747
  }
5715
5748
  }
5749
+ endFlow() {
5750
+ if (!this.idFlow.photoDone) {
5751
+ return;
5752
+ }
5753
+ if (!this.idFlow.recordingDone) {
5754
+ return;
5755
+ }
5756
+ if (!this.idFlow.verificationFinished) {
5757
+ return;
5758
+ }
5759
+ state.flowStatus = FlowStatus.LIVENESS;
5760
+ }
5716
5761
  switchCamera() {
5717
5762
  if (this.captureRetryCount == 2) {
5718
5763
  let camIndex = state.cameraIds.indexOf(state.cameraId);
@@ -5830,11 +5875,11 @@ const IdentificationComponent = class {
5830
5875
  this.token = undefined;
5831
5876
  this.order_id = undefined;
5832
5877
  this.api_url = undefined;
5878
+ this.env = undefined;
5833
5879
  this.idSide = '';
5834
5880
  this.errorMessage = undefined;
5835
5881
  ML5.getInstance();
5836
5882
  this.device = initDevice();
5837
- this.apiCall = new ApiCall();
5838
5883
  }
5839
5884
  async componentWillLoad() {
5840
5885
  Events.init(window);
@@ -5846,6 +5891,10 @@ const IdentificationComponent = class {
5846
5891
  sessionStorage.setItem(SessionKeys.RequestIdKey, state.requestId);
5847
5892
  }
5848
5893
  state.apiBaseUrl = this.api_url;
5894
+ if (this.env == 'QA') {
5895
+ state.environment = 'QA';
5896
+ }
5897
+ this.apiCall = new ApiCall();
5849
5898
  await this.initializeRequest();
5850
5899
  }
5851
5900
  componentWillRender() {
@@ -6187,15 +6236,16 @@ const UserLiveness = class {
6187
6236
  constructor(hostRef) {
6188
6237
  index.registerInstance(this, hostRef);
6189
6238
  this.apiErrorEvent = index.createEvent(this, "apiError", 7);
6239
+ this.device = undefined;
6240
+ this.showError = undefined;
6241
+ this.showHowTo = undefined;
6190
6242
  this.selfieFlow = {
6191
- done: false,
6243
+ photoDone: false,
6244
+ recordingDone: false,
6192
6245
  verificationFinished: false,
6193
6246
  photoFile: null,
6194
6247
  recordingFile: null,
6195
6248
  };
6196
- this.device = undefined;
6197
- this.showError = undefined;
6198
- this.showHowTo = undefined;
6199
6249
  this.apiCall = new ApiCall();
6200
6250
  }
6201
6251
  componentWillLoad() {
@@ -6214,7 +6264,7 @@ const UserLiveness = class {
6214
6264
  let selfiePhoto = event.detail;
6215
6265
  try {
6216
6266
  this.selfieFlow.photoFile = new File([selfiePhoto], 'selfie.png', { type: 'image/png' });
6217
- await this.runSelfieFlow();
6267
+ await this.uploadPhoto();
6218
6268
  }
6219
6269
  catch (e) {
6220
6270
  this.apiErrorEvent.emit(e);
@@ -6226,7 +6276,7 @@ const UserLiveness = class {
6226
6276
  let extension = mimeType.split('/')[1];
6227
6277
  try {
6228
6278
  this.selfieFlow.recordingFile = new File([selfieRecording], 'selfieVideo.' + extension, { type: mimeType });
6229
- await this.runSelfieFlow();
6279
+ await this.uploadRecording();
6230
6280
  }
6231
6281
  catch (e) {
6232
6282
  this.apiErrorEvent.emit(e);
@@ -6234,26 +6284,30 @@ const UserLiveness = class {
6234
6284
  }
6235
6285
  async verificationFinished(_event) {
6236
6286
  this.selfieFlow.verificationFinished = true;
6237
- if (this.selfieFlow.done) {
6238
- state.flowStatus = FlowStatus.COMPLETE;
6239
- }
6287
+ this.endFlow();
6240
6288
  }
6241
- async runSelfieFlow() {
6242
- if (this.selfieFlow.photoFile == null || this.selfieFlow.recordingFile == null || this.selfieFlow.done) {
6289
+ async uploadPhoto() {
6290
+ if (this.selfieFlow.photoFile == null || this.selfieFlow.photoDone) {
6243
6291
  return;
6244
6292
  }
6245
- let uploadPhoto = await this.apiCall.UploadFileForRequestB64(state.requestId, 'Selfie', this.selfieFlow.photoFile);
6246
- if (uploadPhoto === false) {
6247
- this.selfieFlow.done = false;
6293
+ this.selfieFlow.photoDone = await this.apiCall.UploadFileForRequestB64(state.requestId, 'Selfie', this.selfieFlow.photoFile);
6294
+ if (this.selfieFlow.photoDone) {
6295
+ this.endFlow();
6296
+ }
6297
+ else {
6248
6298
  this.selfieFlow.photoFile = null;
6249
6299
  this.selfieFlow.recordingFile = null;
6250
6300
  this.showError = true;
6251
6301
  return;
6252
6302
  }
6253
- let uploadRecording = await this.apiCall.UploadFileForRequestB64(state.requestId, 'SelfieVideo', this.selfieFlow.recordingFile);
6254
- this.selfieFlow.done = uploadRecording;
6255
- if (uploadRecording == true && this.selfieFlow.verificationFinished) {
6256
- state.flowStatus = FlowStatus.COMPLETE;
6303
+ }
6304
+ async uploadRecording() {
6305
+ if (this.selfieFlow.recordingFile == null || this.selfieFlow.recordingDone) {
6306
+ return;
6307
+ }
6308
+ this.selfieFlow.recordingDone = await this.apiCall.UploadFileForRequestB64(state.requestId, 'SelfieVideo', this.selfieFlow.recordingFile);
6309
+ if (this.selfieFlow.recordingDone) {
6310
+ this.endFlow();
6257
6311
  }
6258
6312
  else {
6259
6313
  this.selfieFlow.photoFile = null;
@@ -6261,6 +6315,18 @@ const UserLiveness = class {
6261
6315
  this.showError = true;
6262
6316
  }
6263
6317
  }
6318
+ endFlow() {
6319
+ if (!this.selfieFlow.photoDone) {
6320
+ return;
6321
+ }
6322
+ if (!this.selfieFlow.recordingDone) {
6323
+ return;
6324
+ }
6325
+ if (!this.selfieFlow.verificationFinished) {
6326
+ return;
6327
+ }
6328
+ state.flowStatus = FlowStatus.LIVENESS;
6329
+ }
6264
6330
  render() {
6265
6331
  let howTo = index.h("how-to-info", { idSide: "" });
6266
6332
  let capture = index.h("selfie-capture", { device: this.device, id: "camera" });
@@ -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,"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],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"verificationFinished","verificationFinished"],[0,"takePhoto","takePhoto"]]],[0,"selfie-capture",{"device":[16],"videoStarted":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"demoEnded":[32],"demoVideo":[32],"uploadingLink":[32],"captureHeight":[32],"captureWidth":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32]}],[0,"id-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"capture-error",{"type":[1]}],[0,"how-to-info",{"idSide":[1,"id-side"],"topTitle":[32],"subTitle":[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],"env":[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],"selfieFlow":[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],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"verificationFinished","verificationFinished"],[0,"takePhoto","takePhoto"]]],[0,"selfie-capture",{"device":[16],"videoStarted":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"demoEnded":[32],"demoVideo":[32],"uploadingLink":[32],"captureHeight":[32],"captureWidth":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32]}],[0,"id-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"capture-error",{"type":[1]}],[0,"how-to-info",{"idSide":[1,"id-side"],"topTitle":[32],"subTitle":[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
 
@@ -17,7 +17,7 @@ const patchBrowser = () => {
17
17
  };
18
18
 
19
19
  patchBrowser().then(options => {
20
- 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],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"verificationFinished","verificationFinished"],[0,"takePhoto","takePhoto"]]],[0,"selfie-capture",{"device":[16],"videoStarted":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"demoEnded":[32],"demoVideo":[32],"uploadingLink":[32],"captureHeight":[32],"captureWidth":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32]}],[0,"id-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"capture-error",{"type":[1]}],[0,"how-to-info",{"idSide":[1,"id-side"],"topTitle":[32],"subTitle":[32],"imagePath":[32],"buttonText":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"device":[16],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
20
+ return index.bootstrapLazy([["loader-dots.cjs",[[1,"loader-dots"]]],["agreement-check_16.cjs",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"env":[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],"selfieFlow":[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],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"verificationFinished","verificationFinished"],[0,"takePhoto","takePhoto"]]],[0,"selfie-capture",{"device":[16],"videoStarted":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"demoEnded":[32],"demoVideo":[32],"uploadingLink":[32],"captureHeight":[32],"captureWidth":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32]}],[0,"id-capture",{"device":[16],"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"changeTitle","eventChangeTitle"],[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"capture-error",{"type":[1]}],[0,"how-to-info",{"idSide":[1,"id-side"],"topTitle":[32],"subTitle":[32],"imagePath":[32],"buttonText":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"device":[16],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
21
21
  });
22
22
 
23
23
  exports.setNonce = index.setNonce;
@@ -11,7 +11,8 @@ export class IdDoubleSide {
11
11
  this.showHowTo = undefined;
12
12
  this.front = undefined;
13
13
  this.flow = {
14
- done: false,
14
+ photoDone: false,
15
+ recordingDone: false,
15
16
  verificationFinished: false,
16
17
  photoFile: null,
17
18
  photoFileName: '',
@@ -54,7 +55,7 @@ export class IdDoubleSide {
54
55
  let idPhoto = event.detail;
55
56
  try {
56
57
  this.flow.photoFile = new File([idPhoto], this.flow.photoFileName, { type: 'image/png' });
57
- await this.runFlow();
58
+ await this.endFlow();
58
59
  }
59
60
  catch (e) {
60
61
  this.apiErrorEvent.emit(e);
@@ -64,7 +65,7 @@ export class IdDoubleSide {
64
65
  let idPhoto = event.detail;
65
66
  try {
66
67
  this.flow.photoFile = new File([idPhoto], this.flow.photoFileName, { type: 'image/png' });
67
- await this.runFlow();
68
+ await this.endFlow();
68
69
  }
69
70
  catch (e) {
70
71
  this.apiErrorEvent.emit(e);
@@ -76,7 +77,7 @@ export class IdDoubleSide {
76
77
  let extension = mimeType.split('/')[1];
77
78
  try {
78
79
  this.flow.recordingFile = new File([idRecording], this.flow.recordingFileName + extension, { type: mimeType });
79
- await this.runFlow();
80
+ this.endFlow();
80
81
  }
81
82
  catch (e) {
82
83
  this.apiErrorEvent.emit(e);
@@ -84,39 +85,30 @@ export class IdDoubleSide {
84
85
  }
85
86
  async verificationFinished(_event) {
86
87
  this.flow.verificationFinished = true;
87
- if (this.flow.done) {
88
- store.flowStatus = FlowStatus.LIVENESS;
89
- }
88
+ this.endFlow();
90
89
  }
91
- async runFlow() {
92
- if (this.flow.photoFile == null || this.flow.recordingFile == null || this.flow.done) {
90
+ async uploadPhoto() {
91
+ if (this.flow.photoFile == null || this.flow.photoDone) {
93
92
  return;
94
93
  }
95
- let uploadedPhoto = await this.apiCall.UploadFileForRequestB64(store.requestId, this.flow.photoUploadType, this.flow.photoFile);
96
- if (uploadedPhoto === false) {
97
- this.flow.done = false;
94
+ this.flow.photoDone = await this.apiCall.UploadFileForRequestB64(store.requestId, this.flow.photoUploadType, this.flow.photoFile);
95
+ if (this.flow.photoDone) {
96
+ this.endFlow();
97
+ }
98
+ else {
98
99
  this.flow.photoFile = null;
99
100
  this.flow.recordingFile = null;
100
101
  this.switchCamera();
101
102
  this.showInvalid = true;
103
+ }
104
+ }
105
+ async uploadRecording() {
106
+ if (this.flow.recordingFile == null || this.flow.recordingDone) {
102
107
  return;
103
108
  }
104
- let uploadedRecording = await this.apiCall.UploadFileForRequestB64(store.requestId, this.flow.recordingUploadType, this.flow.recordingFile);
105
- if (uploadedRecording === true) {
106
- if (this.front) {
107
- this.flow.photoFileName = 'idBackImage.png';
108
- this.flow.recordingFileName = 'idBackVideo.';
109
- this.flow.photoUploadType = 'IdBack';
110
- this.flow.recordingUploadType = 'IdBackVideo';
111
- this.front = false;
112
- this.showHowTo = true;
113
- }
114
- else {
115
- this.flow.done = true;
116
- if (this.flow.verificationFinished) {
117
- store.flowStatus = FlowStatus.LIVENESS;
118
- }
119
- }
109
+ this.flow.recordingDone = await this.apiCall.UploadFileForRequestB64(store.requestId, this.flow.recordingUploadType, this.flow.recordingFile);
110
+ if (this.flow.recordingDone) {
111
+ await this.endFlow();
120
112
  }
121
113
  else {
122
114
  this.flow.photoFile = null;
@@ -124,6 +116,29 @@ export class IdDoubleSide {
124
116
  this.showInvalid = true;
125
117
  }
126
118
  }
119
+ endFlow() {
120
+ if (!this.flow.photoDone) {
121
+ return;
122
+ }
123
+ if (!this.flow.recordingDone) {
124
+ return;
125
+ }
126
+ if (this.front) {
127
+ this.flow.photoFileName = 'idBackImage.png';
128
+ this.flow.recordingFileName = 'idBackVideo.';
129
+ this.flow.photoUploadType = 'IdBack';
130
+ this.flow.recordingUploadType = 'IdBackVideo';
131
+ this.flow.photoFile = null;
132
+ this.flow.recordingFile = null;
133
+ this.front = false;
134
+ this.showHowTo = true;
135
+ return;
136
+ }
137
+ if (!this.flow.verificationFinished) {
138
+ return;
139
+ }
140
+ store.flowStatus = FlowStatus.LIVENESS;
141
+ }
127
142
  switchCamera() {
128
143
  if (this.captureRetryCount == 2) {
129
144
  let camIndex = store.cameraIds.indexOf(store.cameraId);