@ekyc_qoobiss/qbs-ect-cmp 3.6.82 → 3.6.84

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.
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cf54a432.js';
2
- import { A as ApiCall, T as Translations, F as FlowMoments, a as FlowSteps, s as state, S as SessionKeys, b as FlowStatus, I as IdCaptureValues, O as OrderStatuses, c as SelfieCaptureValues } from './TranslationUtils-57159270.js';
2
+ import { A as ApiCall, T as Translations, F as FlowMoments, a as FlowSteps, s as state, S as SessionKeys, b as FlowStatus, I as IdCaptureValues, O as OrderStatuses, c as SelfieCaptureValues } from './TranslationUtils-ecf807c7.js';
3
3
 
4
4
  const agreementCheckCss = "";
5
5
 
@@ -1518,6 +1518,10 @@ const blobToBase64 = (blob) => {
1518
1518
  reader.readAsDataURL(blob);
1519
1519
  });
1520
1520
  };
1521
+ const base64Size = (base64Data) => {
1522
+ const kb = Math.ceil((base64Data.length * 6) / 8 / 1000);
1523
+ return kb / 1000;
1524
+ };
1521
1525
  const delay = ms => new Promise(res => setTimeout(res, ms));
1522
1526
  const getLogMessage = (param_req_id = '', param_redirect_id = '', param_token = '') => {
1523
1527
  return {
@@ -4721,7 +4725,7 @@ CameraError.style = cameraErrorCss;
4721
4725
  const captureErrorCss = "";
4722
4726
 
4723
4727
  const CaptureError = class {
4724
- constructor(hostRef) { registerInstance(this, hostRef); this.eventCaptureErrorDone = createEvent(this, "captureErrorDone", 7); this.type = undefined; this.reason = undefined; this.buttonEnabled = undefined; this.buttonText = undefined; }
4728
+ constructor(hostRef) { registerInstance(this, hostRef); this.eventCaptureErrorDone = createEvent(this, "captureErrorDone", 7); this.type = undefined; this.reason = undefined; this.error = undefined; this.buttonEnabled = undefined; this.buttonText = undefined; }
4725
4729
  async componentWillLoad() {
4726
4730
  this.translations = await Translations.getValues();
4727
4731
  this.buttonEnabled = false;
@@ -4763,7 +4767,7 @@ const CaptureError = class {
4763
4767
  }
4764
4768
  }
4765
4769
  render() {
4766
- return (h("div", { class: "container" }, h("div", { class: "row" }, h("h1", { class: "color-red" }, this.titleR1), h("h1", { class: "color-red" }, this.titleR2), h("div", null, h("p", { class: "color-red font-weight-bold font-size-25 mt-5" }, this.descriptionR1), h("p", { class: "color-red font-weight-bold font-size-25 mt-5" }, this.descriptionR2), state.debug ? h("p", { class: "font-size-1" }, this.reason) : null), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", type: "button", disabled: !this.buttonEnabled, onClick: () => this.buttonClick() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
4770
+ return (h("div", { class: "container" }, h("div", { class: "row" }, h("h1", { class: "color-red" }, this.titleR1), h("h1", { class: "color-red" }, this.titleR2), h("div", null, h("p", { class: "color-red font-weight-bold font-size-25 mt-5" }, this.descriptionR1), h("p", { class: "color-red font-weight-bold font-size-25 mt-5" }, this.descriptionR2), state.debug ? h("p", { class: "font-size-1" }, `${this.reason} ${this.error}`) : null), h("div", { class: "pos-relative show-bottom" }, h("div", { class: "btn-buletin" }, h("button", { class: "main-button", type: "button", disabled: !this.buttonEnabled, onClick: () => this.buttonClick() }, this.buttonText), h("p", { class: "main-text font-size-18 text-right mb-0" }, this.translations.GlobalValues.FooterText))))));
4767
4771
  }
4768
4772
  };
4769
4773
  CaptureError.style = captureErrorCss;
@@ -5248,7 +5252,7 @@ function v4(options, buf, offset) {
5248
5252
  }
5249
5253
 
5250
5254
  const name = "@ekyc_qoobiss/qbs-ect-cmp";
5251
- const version$1 = "3.6.82";
5255
+ const version$1 = "3.6.84";
5252
5256
  const description = "Person Identification Component";
5253
5257
  const main = "./dist/index.cjs.js";
5254
5258
  const module = "./dist/index.js";
@@ -8715,6 +8719,8 @@ const ProcessId = class {
8715
8719
  recName: 'idVideo.',
8716
8720
  photoType: CaptureUploadTypes.IdFront,
8717
8721
  recType: CaptureUploadTypes.IdFrontVideo,
8722
+ imageSize: 0,
8723
+ videoSize: 0,
8718
8724
  };
8719
8725
  }
8720
8726
  else if (this.mode == 'back') {
@@ -8724,6 +8730,8 @@ const ProcessId = class {
8724
8730
  recName: 'idBackVideo.',
8725
8731
  photoType: CaptureUploadTypes.IdBack,
8726
8732
  recType: CaptureUploadTypes.IdBackVideo,
8733
+ imageSize: 0,
8734
+ videoSize: 0,
8727
8735
  };
8728
8736
  }
8729
8737
  else if (this.mode == 'tilt') {
@@ -8733,6 +8741,8 @@ const ProcessId = class {
8733
8741
  recName: 'idTiltVideo.',
8734
8742
  photoType: CaptureUploadTypes.None,
8735
8743
  recType: CaptureUploadTypes.TiltVideo,
8744
+ imageSize: 0,
8745
+ videoSize: 0,
8736
8746
  };
8737
8747
  }
8738
8748
  if (state.debug)
@@ -8765,7 +8775,9 @@ const ProcessId = class {
8765
8775
  }
8766
8776
  try {
8767
8777
  let frontCapture = new File([idPhoto], this.flow.fileName, { type: 'image/png' });
8768
- var uploadResult = await ApiCall.instance.UploadFileForRequestB64(state.requestId, this.flow.photoType, frontCapture);
8778
+ let b64Data = await blobToBase64(frontCapture);
8779
+ this.flow.imageSize = base64Size(b64Data);
8780
+ var uploadResult = await ApiCall.instance.UploadFileForRequestB64(state.requestId, this.flow.photoType, b64Data);
8769
8781
  if (state.debug)
8770
8782
  console.log('process-id | captureIdImage | uploadResult: ' + uploadResult);
8771
8783
  if (uploadResult.isValid) {
@@ -8797,7 +8809,9 @@ const ProcessId = class {
8797
8809
  }
8798
8810
  let mimeType = idRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
8799
8811
  let captureRec = new File([idRecording], this.flow.recName + mimeType.extension, { type: mimeType.type });
8800
- var uploadResult = await ApiCall.instance.UploadFileForRequestB64(state.requestId, this.flow.recType, captureRec);
8812
+ let b64Data = await blobToBase64(captureRec);
8813
+ this.flow.videoSize = base64Size(b64Data);
8814
+ var uploadResult = await ApiCall.instance.UploadFileForRequestB64(state.requestId, this.flow.recType, b64Data);
8801
8815
  if (state.debug)
8802
8816
  console.log('process-id | capturedIdRecording | uploadResult: ' + uploadResult);
8803
8817
  if (uploadResult.saved) {
@@ -8812,7 +8826,7 @@ const ProcessId = class {
8812
8826
  if (state.debug)
8813
8827
  console.log('process-id | verificationFinished');
8814
8828
  this.verificationReceived = Date.now();
8815
- while (Date.now() - this.verificationReceived < 30000) {
8829
+ while (Date.now() - this.verificationReceived < 90000) {
8816
8830
  await delay(2000);
8817
8831
  if (this.showInvalid || this.showTimeout)
8818
8832
  return;
@@ -8851,7 +8865,7 @@ const ProcessId = class {
8851
8865
  }
8852
8866
  }
8853
8867
  render() {
8854
- let error = h("capture-error", { type: "ID", reason: this.errorReason });
8868
+ let error = h("capture-error", { type: "ID", reason: this.errorReason, error: `image:${this.flow.imageSize}mb video:${this.flow.videoSize}mb` });
8855
8869
  let capture = h("id-capture", null);
8856
8870
  if (this.showInvalid || this.showTimeout) {
8857
8871
  return error;
@@ -9112,6 +9126,8 @@ const UserLiveness = class {
9112
9126
  recName: 'selfieVideo.',
9113
9127
  photoType: CaptureUploadTypes.Selfie,
9114
9128
  recType: CaptureUploadTypes.SelfieVideo,
9129
+ imageSize: 0,
9130
+ videoSize: 0,
9115
9131
  };
9116
9132
  }
9117
9133
  else if (this.mode == 'selfieGesture') {
@@ -9121,6 +9137,8 @@ const UserLiveness = class {
9121
9137
  recName: 'selfieTiltVideo.',
9122
9138
  photoType: CaptureUploadTypes.None,
9123
9139
  recType: CaptureUploadTypes.SelfieGestureVideo,
9140
+ imageSize: 0,
9141
+ videoSize: 0,
9124
9142
  };
9125
9143
  }
9126
9144
  }
@@ -9147,7 +9165,9 @@ const UserLiveness = class {
9147
9165
  }
9148
9166
  try {
9149
9167
  var uploadPhoto = new File([selfiePhoto], this.flow.fileName, { type: 'image/png' });
9150
- let photoUploaded = await ApiCall.instance.UploadFileForRequestB64(state.requestId, this.flow.photoType, uploadPhoto);
9168
+ let b64Data = await blobToBase64(uploadPhoto);
9169
+ this.flow.imageSize = base64Size(b64Data);
9170
+ let photoUploaded = await ApiCall.instance.UploadFileForRequestB64(state.requestId, this.flow.photoType, b64Data);
9151
9171
  if (photoUploaded.isValid) {
9152
9172
  state.flowStatus = FlowStatus[photoUploaded.state];
9153
9173
  }
@@ -9174,7 +9194,9 @@ const UserLiveness = class {
9174
9194
  let mimeType = selfieRecording.type == Stream.mp4MimeType.type ? Stream.mp4MimeType : Stream.webmMimeType;
9175
9195
  try {
9176
9196
  let uploadRec = new File([selfieRecording], this.flow.recName + mimeType.extension, { type: mimeType.type });
9177
- let uplodDone = await ApiCall.instance.UploadFileForRequestB64(state.requestId, this.flow.recType, uploadRec);
9197
+ let b64Data = await blobToBase64(uploadRec);
9198
+ this.flow.videoSize = base64Size(b64Data);
9199
+ let uplodDone = await ApiCall.instance.UploadFileForRequestB64(state.requestId, this.flow.recType, b64Data);
9178
9200
  if (uplodDone.saved) {
9179
9201
  state.flowStatus = FlowStatus[uplodDone.state];
9180
9202
  }
@@ -9196,7 +9218,7 @@ const UserLiveness = class {
9196
9218
  if (state.debug)
9197
9219
  console.log('user-liveness | verificationFinished');
9198
9220
  this.verificationReceived = Date.now();
9199
- while (Date.now() - this.verificationReceived < 30000) {
9221
+ while (Date.now() - this.verificationReceived < 90000) {
9200
9222
  await delay(2000);
9201
9223
  if (this.showError || this.showTimeout)
9202
9224
  return;
@@ -9218,7 +9240,7 @@ const UserLiveness = class {
9218
9240
  }
9219
9241
  render() {
9220
9242
  let capture = h("selfie-capture", null);
9221
- let error = h("capture-error", { type: "LIVENESS", reason: this.errorReason });
9243
+ let error = h("capture-error", { type: "LIVENESS", reason: this.errorReason, error: `image:${this.flow.imageSize}mb video:${this.flow.videoSize}mb` });
9222
9244
  if (this.showError || this.showTimeout) {
9223
9245
  return error;
9224
9246
  }
@@ -11,7 +11,7 @@ const patchEsm = () => {
11
11
  const defineCustomElements = (win, options) => {
12
12
  if (typeof window === 'undefined') return Promise.resolve();
13
13
  return patchEsm().then(() => {
14
- return bootstrapLazy([["loader-dots",[[1,"loader-dots"]]],["random-actions",[[0,"random-actions"]]],["agreement-check_18",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"env":[1537],"redirect_id":[1537],"phone_number":[1537],"lang_iso":[1537],"errorMessage":[32],"errorTitle":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"],[0,"apiError","apiErrorEmitter"],[9,"scroll","handleScroll"]]],[0,"process-id",{"mode":[1],"showTimeout":[32],"showInvalid":[32],"flow":[32]},[[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"recordingIdCapture","capturedIdRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"user-liveness",{"mode":[1],"showError":[32],"showTimeout":[32],"flow":[32]},[[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],"buttonDisabled":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"camera-error",{"title":[32],"description":[32],"buttonDisabled":[32],"demoVideo":[32]}],[0,"end-redirect"],[0,"error-end",{"message":[1],"errorTitle":[1,"error-title"]}],[0,"how-to-info",{"showVideo":[32],"topTitle":[32],"subTitle":[32],"imagePath":[32],"buttonText":[32],"buttonEnabled":[32],"demoVideo":[32],"image":[32],"imageLoaded":[32]}],[0,"landing-validation",{"warningText":[32],"buttonDisabled":[32]}],[0,"mobile-redirect",{"infoTextTop":[32],"infoTextBottom":[32],"contact":[32],"invalidValue":[32],"waitingMobile":[32],"orderStatus":[32],"redirectLink":[32],"qrCode":[32],"prefilledPhone":[32]}],[0,"sms-code-validation",{"title":[32],"details":[32],"buttonText":[32],"code":[32],"canSend":[32]}],[0,"sms-send",{"buttonText":[32],"title":[32],"details":[32],"phoneNumber":[32],"prefilledPhone":[32],"canSend":[32]}],[0,"state-transition"],[0,"id-capture",{"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"selfie-capture",{"videoStarted":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"demoEnded":[32],"demoVideo":[32],"captureHeight":[32],"captureWidth":[32]},[[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32],"buttonEnabled":[32],"scrollClass":[32]}],[0,"capture-error",{"type":[1],"reason":[1],"buttonEnabled":[32],"buttonText":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
14
+ return bootstrapLazy([["loader-dots",[[1,"loader-dots"]]],["random-actions",[[0,"random-actions"]]],["agreement-check_18",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"env":[1537],"redirect_id":[1537],"phone_number":[1537],"lang_iso":[1537],"errorMessage":[32],"errorTitle":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"],[0,"apiError","apiErrorEmitter"],[9,"scroll","handleScroll"]]],[0,"process-id",{"mode":[1],"showTimeout":[32],"showInvalid":[32],"flow":[32]},[[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"recordingIdCapture","capturedIdRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"user-liveness",{"mode":[1],"showError":[32],"showTimeout":[32],"flow":[32]},[[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],"buttonDisabled":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"camera-error",{"title":[32],"description":[32],"buttonDisabled":[32],"demoVideo":[32]}],[0,"end-redirect"],[0,"error-end",{"message":[1],"errorTitle":[1,"error-title"]}],[0,"how-to-info",{"showVideo":[32],"topTitle":[32],"subTitle":[32],"imagePath":[32],"buttonText":[32],"buttonEnabled":[32],"demoVideo":[32],"image":[32],"imageLoaded":[32]}],[0,"landing-validation",{"warningText":[32],"buttonDisabled":[32]}],[0,"mobile-redirect",{"infoTextTop":[32],"infoTextBottom":[32],"contact":[32],"invalidValue":[32],"waitingMobile":[32],"orderStatus":[32],"redirectLink":[32],"qrCode":[32],"prefilledPhone":[32]}],[0,"sms-code-validation",{"title":[32],"details":[32],"buttonText":[32],"code":[32],"canSend":[32]}],[0,"sms-send",{"buttonText":[32],"title":[32],"details":[32],"phoneNumber":[32],"prefilledPhone":[32],"canSend":[32]}],[0,"state-transition"],[0,"id-capture",{"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"selfie-capture",{"videoStarted":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"demoEnded":[32],"demoVideo":[32],"captureHeight":[32],"captureWidth":[32]},[[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32],"buttonEnabled":[32],"scrollClass":[32]}],[0,"capture-error",{"type":[1],"reason":[1],"error":[1],"buttonEnabled":[32],"buttonText":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
15
15
  });
16
16
  };
17
17
 
@@ -14,5 +14,5 @@ const patchBrowser = () => {
14
14
  };
15
15
 
16
16
  patchBrowser().then(options => {
17
- return bootstrapLazy([["loader-dots",[[1,"loader-dots"]]],["random-actions",[[0,"random-actions"]]],["agreement-check_18",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"env":[1537],"redirect_id":[1537],"phone_number":[1537],"lang_iso":[1537],"errorMessage":[32],"errorTitle":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"],[0,"apiError","apiErrorEmitter"],[9,"scroll","handleScroll"]]],[0,"process-id",{"mode":[1],"showTimeout":[32],"showInvalid":[32],"flow":[32]},[[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"recordingIdCapture","capturedIdRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"user-liveness",{"mode":[1],"showError":[32],"showTimeout":[32],"flow":[32]},[[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],"buttonDisabled":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"camera-error",{"title":[32],"description":[32],"buttonDisabled":[32],"demoVideo":[32]}],[0,"end-redirect"],[0,"error-end",{"message":[1],"errorTitle":[1,"error-title"]}],[0,"how-to-info",{"showVideo":[32],"topTitle":[32],"subTitle":[32],"imagePath":[32],"buttonText":[32],"buttonEnabled":[32],"demoVideo":[32],"image":[32],"imageLoaded":[32]}],[0,"landing-validation",{"warningText":[32],"buttonDisabled":[32]}],[0,"mobile-redirect",{"infoTextTop":[32],"infoTextBottom":[32],"contact":[32],"invalidValue":[32],"waitingMobile":[32],"orderStatus":[32],"redirectLink":[32],"qrCode":[32],"prefilledPhone":[32]}],[0,"sms-code-validation",{"title":[32],"details":[32],"buttonText":[32],"code":[32],"canSend":[32]}],[0,"sms-send",{"buttonText":[32],"title":[32],"details":[32],"phoneNumber":[32],"prefilledPhone":[32],"canSend":[32]}],[0,"state-transition"],[0,"id-capture",{"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"selfie-capture",{"videoStarted":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"demoEnded":[32],"demoVideo":[32],"captureHeight":[32],"captureWidth":[32]},[[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32],"buttonEnabled":[32],"scrollClass":[32]}],[0,"capture-error",{"type":[1],"reason":[1],"buttonEnabled":[32],"buttonText":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
17
+ return bootstrapLazy([["loader-dots",[[1,"loader-dots"]]],["random-actions",[[0,"random-actions"]]],["agreement-check_18",[[1,"identification-component",{"token":[1537],"order_id":[1537],"api_url":[1537],"env":[1537],"redirect_id":[1537],"phone_number":[1537],"lang_iso":[1537],"errorMessage":[32],"errorTitle":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"],[0,"apiError","apiErrorEmitter"],[9,"scroll","handleScroll"]]],[0,"process-id",{"mode":[1],"showTimeout":[32],"showInvalid":[32],"flow":[32]},[[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"recordingIdCapture","capturedIdRecording"],[0,"verificationFinished","verificationFinished"]]],[0,"user-liveness",{"mode":[1],"showError":[32],"showTimeout":[32],"flow":[32]},[[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],"buttonDisabled":[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"camera-error",{"title":[32],"description":[32],"buttonDisabled":[32],"demoVideo":[32]}],[0,"end-redirect"],[0,"error-end",{"message":[1],"errorTitle":[1,"error-title"]}],[0,"how-to-info",{"showVideo":[32],"topTitle":[32],"subTitle":[32],"imagePath":[32],"buttonText":[32],"buttonEnabled":[32],"demoVideo":[32],"image":[32],"imageLoaded":[32]}],[0,"landing-validation",{"warningText":[32],"buttonDisabled":[32]}],[0,"mobile-redirect",{"infoTextTop":[32],"infoTextBottom":[32],"contact":[32],"invalidValue":[32],"waitingMobile":[32],"orderStatus":[32],"redirectLink":[32],"qrCode":[32],"prefilledPhone":[32]}],[0,"sms-code-validation",{"title":[32],"details":[32],"buttonText":[32],"code":[32],"canSend":[32]}],[0,"sms-send",{"buttonText":[32],"title":[32],"details":[32],"phoneNumber":[32],"prefilledPhone":[32],"canSend":[32]}],[0,"state-transition"],[0,"id-capture",{"videoStarted":[32],"cameraSize":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"showDemo":[32],"demoVideo":[32]},[[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"selfie-capture",{"videoStarted":[32],"captureTaken":[32],"verified":[32],"titleMesage":[32],"demoEnded":[32],"demoVideo":[32],"captureHeight":[32],"captureWidth":[32]},[[0,"videoStarted","eventVideoStarted"],[0,"takePhoto","takePhoto"],[0,"verificationFinished","verificationFinished"]]],[0,"agreement-check",{"agreementType":[1,"agreement-type"],"htmlContent":[32],"buttonEnabled":[32],"scrollClass":[32]}],[0,"capture-error",{"type":[1],"reason":[1],"error":[1],"buttonEnabled":[32],"buttonText":[32]}],[0,"camera-comp",{"modelPath":[1,"model-path"],"probabilityThreshold":[2,"probability-threshold"],"captureMode":[1,"capture-mode"]}]]]], options);
18
18
  });
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h } from './index-cf54a432.js';
2
- import { T as Translations } from './TranslationUtils-57159270.js';
2
+ import { T as Translations } from './TranslationUtils-ecf807c7.js';
3
3
 
4
4
  const randomActionsCss = "";
5
5
 
@@ -1 +1 @@
1
- import{r as t,h as s}from"./p-8942656c.js";import{T as i}from"./p-8552ab44.js";const o=class{constructor(s){t(this,s)}async componentWillLoad(){this.translations=await i.getValues()}buttonClick(){}render(){return s("div",{class:"container"},s("div",{class:"row"},s("div",{class:"text-center"},s("h1",null,this.topTitle)),s("div",{class:"pos-relative show-bottom"},s("div",{class:"btn-buletin"},s("button",{class:"main-button",onClick:()=>this.buttonClick()},this.buttonText),s("p",{class:"main-text font-size-18 text-right mb-0"},this.translations.GlobalValues.FooterText)))))}};o.style="";export{o as random_actions}
1
+ import{r as t,h as s}from"./p-8942656c.js";import{T as i}from"./p-8a9ec85f.js";const o=class{constructor(s){t(this,s)}async componentWillLoad(){this.translations=await i.getValues()}buttonClick(){}render(){return s("div",{class:"container"},s("div",{class:"row"},s("div",{class:"text-center"},s("h1",null,this.topTitle)),s("div",{class:"pos-relative show-bottom"},s("div",{class:"btn-buletin"},s("button",{class:"main-button",onClick:()=>this.buttonClick()},this.buttonText),s("p",{class:"main-text font-size-18 text-right mb-0"},this.translations.GlobalValues.FooterText)))))}};o.style="";export{o as random_actions}
@@ -1 +1 @@
1
- import{a as t,f as e}from"./p-8942656c.js";var i;!function(t){t[t.Capturing=0]="Capturing",t[t.FinishedCapturing=1]="FinishedCapturing",t[t.Waiting=2]="Waiting",t[t.NotFound=3]="NotFound",t[t.Aborted=4]="Aborted"}(i||(i={}));const s=t=>!("isConnected"in t)||t.isConnected,n=(()=>{let t;return(...e)=>{t&&clearTimeout(t),t=setTimeout((()=>{t=0,(t=>{for(let e of t.keys())t.set(e,t.get(e).filter(s))})(...e)}),2e3)}})(),a=t=>"function"==typeof t?t():t;var o;!function(t){t[t.LANDING=0]="LANDING",t[t.MOBILE=1]="MOBILE",t[t.AGREEMENT=2]="AGREEMENT",t[t.PHONE=3]="PHONE",t[t.CODE=4]="CODE",t[t.CODEERROR=5]="CODEERROR",t[t.IDFRONTHOWTO=6]="IDFRONTHOWTO",t[t.IDFRONT=7]="IDFRONT",t[t.IDBACKHOWTO=8]="IDBACKHOWTO",t[t.IDBACK=9]="IDBACK",t[t.IDTILTHOWTO=10]="IDTILTHOWTO",t[t.IDTILT=11]="IDTILT",t[t.LIVENESSHOWTO=12]="LIVENESSHOWTO",t[t.LIVENESS=13]="LIVENESS",t[t.LIVENESSGESTUREHOWTO=14]="LIVENESSGESTUREHOWTO",t[t.LIVENESSGESTURE=15]="LIVENESSGESTURE",t[t.COMPLETE=16]="COMPLETE",t[t.ERROREND=17]="ERROREND",t[t.CAMERAERROR=18]="CAMERAERROR",t[t.ABORTED=19]="ABORTED",t[t.NONE=20]="NONE"}(o||(o={}));class r{}r.IDPoseDemoMapping={0:"https://ekyc.blob.core.windows.net/$web/animations/id/id_front.mp4",1:"https://ekyc.blob.core.windows.net/$web/animations/id/id_front_tilt.mp4",2:"https://ekyc.blob.core.windows.net/$web/animations/id/id_rotate.mp4",3:"https://ekyc.blob.core.windows.net/$web/animations/id/id_back.mp4",4:"https://ekyc.blob.core.windows.net/$web/animations/id/id_back_tilt.mp4"};class c{}c.FacePoseDemoMapping={0:"https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_rotate_left.mp4",1:"https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_rotate_right.mp4",2:"https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_back.mp4",3:"https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_front.mp4",4:"https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_main.mp4"};class l{}l.FlowStatusKey="qbs-ect-flowstatus",l.RequestIdKey="qbs-ect-requestid",l.TokenKey="qbs-ect-token",l.InitialisedKey="qbs-ect-initialised",l.HasIdBackKey="qbs-ect-has-id-back",l.AgreementValidationKey="qbs-ect-agreement-validation",l.PhoneValidationKey="qbs-ect-phone-validation",l.RefreshDoneKey="qbs-ect-refresh-done";class h{constructor(){this.uriEnv="/",this.uriEnv=["QA","DEMO"].includes(d.environment)?"/dev_":"/",this.OtpSend=this.uriEnv+"validation/otp/send",this.OtpCheck=this.uriEnv+"validation/otp/check",this.IdentityInsert=this.uriEnv+"validation/identity/insert",this.UploadCapture=this.uriEnv+"validation/upload/capture",this.GetAgreement=this.uriEnv+"validation/agreement/content",this.GenerateAgreement=this.uriEnv+"validation/agreement/generate",this.SendLink=this.uriEnv+"validation/otp/sendlink",this.GetStatus=this.uriEnv+"validation/identity/status",this.AddLog=this.uriEnv+"validation/logs/add",this.AddStep=this.uriEnv+"validation/logs/step",this.AbortRequest=this.uriEnv+"validation/identity/abort",this.Translations=this.uriEnv+"validation/translations/get",this.StartFlow=this.uriEnv+"validation/flowstate/startflow",this.NextFlowState=this.uriEnv+"validation/flowstate/nextstate",this.CurrentFlowState=this.uriEnv+"validation/flowstate/currentstate",this.NextStateForCaptureError=this.uriEnv+"validation/flowstate/nextstateforcaptureerror"}}const{state:d,onChange:u}=(()=>{const i=((t,e=((t,e)=>t!==e))=>{const i=a(t);let s=new Map(Object.entries(null!=i?i:{}));const n={dispose:[],get:[],set:[],reset:[]},o=()=>{var e;s=new Map(Object.entries(null!==(e=a(t))&&void 0!==e?e:{})),n.reset.forEach((t=>t()))},r=t=>(n.get.forEach((e=>e(t))),s.get(t)),c=(t,i)=>{const a=s.get(t);e(i,a,t)&&(s.set(t,i),n.set.forEach((e=>e(t,i,a))))},l="undefined"==typeof Proxy?{}:new Proxy(i,{get:(t,e)=>r(e),ownKeys:()=>Array.from(s.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(t,e)=>s.has(e),set:(t,e,i)=>(c(e,i),!0)}),h=(t,e)=>(n[t].push(e),()=>{((t,e)=>{const i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],t.length--)})(n[t],e)});return{state:l,get:r,set:c,on:h,onChange:(e,i)=>{const s=h("set",((t,s)=>{t===e&&i(s)})),n=h("reset",(()=>i(a(t)[e])));return()=>{s(),n()}},use:(...t)=>{const e=t.reduce(((t,e)=>(e.set&&t.push(h("set",e.set)),e.get&&t.push(h("get",e.get)),e.reset&&t.push(h("reset",e.reset)),e.dispose&&t.push(h("dispose",e.dispose)),t)),[]);return()=>e.forEach((t=>t()))},dispose:()=>{n.dispose.forEach((t=>t())),o()},reset:o,forceUpdate:t=>{const e=s.get(t);n.set.forEach((i=>i(t,e,e)))}}})({flowStatus:o.NONE,environment:"PROD",debug:!1,requestId:"",redirectId:"",token:"",cameraIds:[],cameraId:"",phoneNumber:"",apiBaseUrl:"https://apiro.id-kyc.com",device:null,langIso:"ro",logSteps:!1,modelsPath:""},void 0);return i.use((()=>{if("function"!=typeof t)return{};const i=new Map;return{dispose:()=>i.clear(),get:e=>{const s=t();s&&((t,e,i)=>{const s=t.get(e);s?s.includes(i)||s.push(i):t.set(e,[i])})(i,e,s)},set:t=>{const s=i.get(t);s&&i.set(t,s.filter(e)),n(i)},reset:()=>{i.forEach((t=>t.forEach(e))),n(i)}}})()),i})();var p,w;u("environment",(t=>{d.debug="QA"==t})),u("flowStatus",(t=>{sessionStorage.setItem(l.FlowStatusKey,o[t])})),u("token",(t=>{sessionStorage.setItem(l.TokenKey,t)})),u("requestId",(t=>{sessionStorage.setItem(l.RequestIdKey,t)})),function(t){t[t.ComponentLoaded="component-loaded"]="ComponentLoaded",t[t.MobileRedirect="mobile-redirect"]="MobileRedirect",t[t.Landing="landing"]="Landing",t[t.Agreements="agreements"]="Agreements",t[t.OtpSend="otp-send"]="OtpSend",t[t.OtpCheck="otp-check"]="OtpCheck",t[t.CiFront="ci-front"]="CiFront",t[t.CiFrontHowTo="ci-front-how-to"]="CiFrontHowTo",t[t.CiFrontCapture="ci-front-capture"]="CiFrontCapture",t[t.CiBack="ci-back"]="CiBack",t[t.CiBackHowTo="ci-back-how-to"]="CiBackHowTo",t[t.CiBackCapture="ci-back-capture"]="CiBackCapture",t[t.CiTilt="ci-tilt"]="CiTilt",t[t.CiError="ci-error"]="CiError",t[t.SelfieHowTo="selfie-how-to"]="SelfieHowTo",t[t.SelfieTilt="selfie-tilt"]="SelfieTilt",t[t.SelfieCapture="selfie-capture"]="SelfieCapture",t[t.Selfie="selfie"]="Selfie",t[t.SelfieError="selfie-error"]="SelfieError",t[t.End="end"]="End",t[t.CameraError="camera-error"]="CameraError",t[t.Default="default"]="Default"}(p||(p={})),function(t){t[t.Initialized="initialized"]="Initialized",t[t.Finalized="finalized"]="Finalized",t[t.None="none"]="None"}(w||(w={}));class f{static getInstance(){return f.instance||(f.instance=new f),f.instance}constructor(){this.serviceErrors=["Service Unavailable","Unauthorized"],this.toBase64=t=>new Promise(((e,i)=>{const s=new FileReader;s.readAsDataURL(t),s.onload=()=>e(s.result),s.onerror=t=>i(t)})),this.urls=new h}async http(t){const e=await fetch(t);if(!e.ok)throw new Error(e.statusText);try{return await e.json()}catch(t){throw new Error("No json found in response "+t)}}async post(t,e,i=!0){var s=new Request(d.apiBaseUrl+t,{method:"POST",body:e,headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+d.token}});try{return await this.http(s)}catch(s){if(!i||this.serviceErrors.includes(s.message))throw s;this.AddLog("Error in post ",s);try{var n=new Request(d.apiBaseUrl+t,{method:"POST",body:e,headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+d.token}});return await this.http(n)}catch(i){this.AddLog("Error in post ",i);var a=new Request(d.apiBaseUrl+t,{method:"POST",body:e,headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+d.token}});return await this.http(a)}}}async get(t,e=!0){var i=new Request(d.apiBaseUrl+t,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+d.token}});try{return await this.http(i)}catch(i){if(!e||this.serviceErrors.includes(i.message))throw i;this.AddLog("Error in get ",i);try{var s=new Request(d.apiBaseUrl+t,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+d.token}});return await this.http(s)}catch(e){this.AddLog("Error in get ",e);var n=new Request(d.apiBaseUrl+t,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+d.token}});return await this.http(n)}}}async SendOTPCode(t,e){let i={requestId:t,phone:e};return await this.post(this.urls.OtpSend,JSON.stringify(i))}async CheckOTPCode(t,e){let i={requestId:t,otp:e};return await this.post(this.urls.OtpCheck,JSON.stringify(i))}async AddIdentificationRequest(t,e){d.debug&&console.log("Calling identity request with store:"+JSON.stringify(d));let i={requestId:d.requestId,clientDeviceInfo:JSON.stringify(t),redirectId:d.redirectId,phoneNumber:d.phoneNumber,version:e,demoMode:"DEMO"==d.environment},s=await this.post(this.urls.IdentityInsert,JSON.stringify(i));return""==d.requestId&&(d.requestId=s.requestId),d.phoneNumber=s.phoneNumber,d.flowStatus=o[s.state],d.logSteps=s.logSteps,d.debug=s.debug,d.modelsPath=s.modelsPath,!0}async UploadFileForRequestB64(t,e,i){let s={requestId:t,type:e,data:await this.toBase64(i)},n=await this.post(this.urls.UploadCapture,JSON.stringify(s));return d.debug&&console.log(`apicall | uploadfileforrequestb64 | ${n}`),n}async GetAgreement(t){return(await this.get(this.urls.GetAgreement+"?type="+t+"&requestId="+d.requestId)).htmlText}async GenerateAgreement(t){let e={requestId:d.requestId,documentType:t};return(await this.post(this.urls.GenerateAgreement,JSON.stringify(e))).generation}async GetStatus(t){let e=await this.get(this.urls.GetStatus+"?orderId="+t);return i[e.status]}async SendLink(t,e){let i={requestId:d.requestId,link:t,phoneNumber:e};return(await this.post(this.urls.SendLink,JSON.stringify(i))).sent}async AddLog(t,e){try{let i={requestId:d.requestId,action:o[d.flowStatus],message:JSON.stringify({error:t,context:e})};return(await this.post(this.urls.AddLog,JSON.stringify(i),!1)).saved}catch(t){}}async AddStep(t,e){if(0==d.logSteps)return;let i={requestId:d.requestId,redirectId:d.redirectId,step:p[t],moment:w[e],timestamp:(new Date).toISOString()};return(await this.post(this.urls.AddStep,JSON.stringify(i))).saved}async AbortRequest(){return await this.post(this.urls.AbortRequest,JSON.stringify({requestId:d.requestId}))}async GetTranslations(t){return await this.get(this.urls.Translations+"?langIso="+t)}async LandingValidationStartFlow(t){let e=await this.post(this.urls.StartFlow,JSON.stringify({requestId:d.requestId,cameraIsAccessible:t}));return o[e.state]}async GetNextFlowState(){let t=await this.get(this.urls.NextFlowState+"?requestId="+d.requestId);return o[t.state]}async GetFlowState(){let t=await this.get(this.urls.CurrentFlowState+"?requestId="+d.requestId);return o[t.state]}async GetNextStateForCaptureError(){let t=await this.get(this.urls.NextStateForCaptureError+"?requestId="+d.requestId);return o[t.state]}}const b=new class{async getValues(){return this.values||(this.values=await this.fetchTranslations()),this.values}getLocale(t=document.body){if(d.langIso&&""!=d.langIso)return d.langIso;{const e=t.closest("[lang]");return e?e.lang:"ro"}}async fetchTranslations(){const t=this.getLocale();try{const e=(new f).GetTranslations(t);if(e)return e}catch(e){return console.error(`Error loading locale: ${t}`,e),null}}};export{f as A,w as F,r as I,i as O,l as S,b as T,p as a,o as b,c,d as s}
1
+ import{a as t,f as e}from"./p-8942656c.js";var i;!function(t){t[t.Capturing=0]="Capturing",t[t.FinishedCapturing=1]="FinishedCapturing",t[t.Waiting=2]="Waiting",t[t.NotFound=3]="NotFound",t[t.Aborted=4]="Aborted"}(i||(i={}));const s=t=>!("isConnected"in t)||t.isConnected,n=(()=>{let t;return(...e)=>{t&&clearTimeout(t),t=setTimeout((()=>{t=0,(t=>{for(let e of t.keys())t.set(e,t.get(e).filter(s))})(...e)}),2e3)}})(),a=t=>"function"==typeof t?t():t;var o;!function(t){t[t.LANDING=0]="LANDING",t[t.MOBILE=1]="MOBILE",t[t.AGREEMENT=2]="AGREEMENT",t[t.PHONE=3]="PHONE",t[t.CODE=4]="CODE",t[t.CODEERROR=5]="CODEERROR",t[t.IDFRONTHOWTO=6]="IDFRONTHOWTO",t[t.IDFRONT=7]="IDFRONT",t[t.IDBACKHOWTO=8]="IDBACKHOWTO",t[t.IDBACK=9]="IDBACK",t[t.IDTILTHOWTO=10]="IDTILTHOWTO",t[t.IDTILT=11]="IDTILT",t[t.LIVENESSHOWTO=12]="LIVENESSHOWTO",t[t.LIVENESS=13]="LIVENESS",t[t.LIVENESSGESTUREHOWTO=14]="LIVENESSGESTUREHOWTO",t[t.LIVENESSGESTURE=15]="LIVENESSGESTURE",t[t.COMPLETE=16]="COMPLETE",t[t.ERROREND=17]="ERROREND",t[t.CAMERAERROR=18]="CAMERAERROR",t[t.ABORTED=19]="ABORTED",t[t.NONE=20]="NONE"}(o||(o={}));class r{}r.IDPoseDemoMapping={0:"https://ekyc.blob.core.windows.net/$web/animations/id/id_front.mp4",1:"https://ekyc.blob.core.windows.net/$web/animations/id/id_front_tilt.mp4",2:"https://ekyc.blob.core.windows.net/$web/animations/id/id_rotate.mp4",3:"https://ekyc.blob.core.windows.net/$web/animations/id/id_back.mp4",4:"https://ekyc.blob.core.windows.net/$web/animations/id/id_back_tilt.mp4"};class c{}c.FacePoseDemoMapping={0:"https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_rotate_left.mp4",1:"https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_rotate_right.mp4",2:"https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_back.mp4",3:"https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_tilt_front.mp4",4:"https://ekyc.blob.core.windows.net/$web/animations/selfie/selfie_main.mp4"};class l{}l.FlowStatusKey="qbs-ect-flowstatus",l.RequestIdKey="qbs-ect-requestid",l.TokenKey="qbs-ect-token",l.InitialisedKey="qbs-ect-initialised",l.HasIdBackKey="qbs-ect-has-id-back",l.AgreementValidationKey="qbs-ect-agreement-validation",l.PhoneValidationKey="qbs-ect-phone-validation",l.RefreshDoneKey="qbs-ect-refresh-done";class d{constructor(){this.uriEnv="/",this.uriEnv=["QA","DEMO"].includes(h.environment)?"/dev_":"/",this.OtpSend=this.uriEnv+"validation/otp/send",this.OtpCheck=this.uriEnv+"validation/otp/check",this.IdentityInsert=this.uriEnv+"validation/identity/insert",this.UploadCapture=this.uriEnv+"validation/upload/capture",this.GetAgreement=this.uriEnv+"validation/agreement/content",this.GenerateAgreement=this.uriEnv+"validation/agreement/generate",this.SendLink=this.uriEnv+"validation/otp/sendlink",this.GetStatus=this.uriEnv+"validation/identity/status",this.AddLog=this.uriEnv+"validation/logs/add",this.AddStep=this.uriEnv+"validation/logs/step",this.AbortRequest=this.uriEnv+"validation/identity/abort",this.Translations=this.uriEnv+"validation/translations/get",this.StartFlow=this.uriEnv+"validation/flowstate/startflow",this.NextFlowState=this.uriEnv+"validation/flowstate/nextstate",this.CurrentFlowState=this.uriEnv+"validation/flowstate/currentstate",this.NextStateForCaptureError=this.uriEnv+"validation/flowstate/nextstateforcaptureerror"}}const{state:h,onChange:u}=(()=>{const i=((t,e=((t,e)=>t!==e))=>{const i=a(t);let s=new Map(Object.entries(null!=i?i:{}));const n={dispose:[],get:[],set:[],reset:[]},o=()=>{var e;s=new Map(Object.entries(null!==(e=a(t))&&void 0!==e?e:{})),n.reset.forEach((t=>t()))},r=t=>(n.get.forEach((e=>e(t))),s.get(t)),c=(t,i)=>{const a=s.get(t);e(i,a,t)&&(s.set(t,i),n.set.forEach((e=>e(t,i,a))))},l="undefined"==typeof Proxy?{}:new Proxy(i,{get:(t,e)=>r(e),ownKeys:()=>Array.from(s.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(t,e)=>s.has(e),set:(t,e,i)=>(c(e,i),!0)}),d=(t,e)=>(n[t].push(e),()=>{((t,e)=>{const i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],t.length--)})(n[t],e)});return{state:l,get:r,set:c,on:d,onChange:(e,i)=>{const s=d("set",((t,s)=>{t===e&&i(s)})),n=d("reset",(()=>i(a(t)[e])));return()=>{s(),n()}},use:(...t)=>{const e=t.reduce(((t,e)=>(e.set&&t.push(d("set",e.set)),e.get&&t.push(d("get",e.get)),e.reset&&t.push(d("reset",e.reset)),e.dispose&&t.push(d("dispose",e.dispose)),t)),[]);return()=>e.forEach((t=>t()))},dispose:()=>{n.dispose.forEach((t=>t())),o()},reset:o,forceUpdate:t=>{const e=s.get(t);n.set.forEach((i=>i(t,e,e)))}}})({flowStatus:o.NONE,environment:"PROD",debug:!1,requestId:"",redirectId:"",token:"",cameraIds:[],cameraId:"",phoneNumber:"",apiBaseUrl:"https://apiro.id-kyc.com",device:null,langIso:"ro",logSteps:!1,modelsPath:""},void 0);return i.use((()=>{if("function"!=typeof t)return{};const i=new Map;return{dispose:()=>i.clear(),get:e=>{const s=t();s&&((t,e,i)=>{const s=t.get(e);s?s.includes(i)||s.push(i):t.set(e,[i])})(i,e,s)},set:t=>{const s=i.get(t);s&&i.set(t,s.filter(e)),n(i)},reset:()=>{i.forEach((t=>t.forEach(e))),n(i)}}})()),i})();var p,w;u("environment",(t=>{h.debug="QA"==t})),u("flowStatus",(t=>{sessionStorage.setItem(l.FlowStatusKey,o[t])})),u("token",(t=>{sessionStorage.setItem(l.TokenKey,t)})),u("requestId",(t=>{sessionStorage.setItem(l.RequestIdKey,t)})),function(t){t[t.ComponentLoaded="component-loaded"]="ComponentLoaded",t[t.MobileRedirect="mobile-redirect"]="MobileRedirect",t[t.Landing="landing"]="Landing",t[t.Agreements="agreements"]="Agreements",t[t.OtpSend="otp-send"]="OtpSend",t[t.OtpCheck="otp-check"]="OtpCheck",t[t.CiFront="ci-front"]="CiFront",t[t.CiFrontHowTo="ci-front-how-to"]="CiFrontHowTo",t[t.CiFrontCapture="ci-front-capture"]="CiFrontCapture",t[t.CiBack="ci-back"]="CiBack",t[t.CiBackHowTo="ci-back-how-to"]="CiBackHowTo",t[t.CiBackCapture="ci-back-capture"]="CiBackCapture",t[t.CiTilt="ci-tilt"]="CiTilt",t[t.CiError="ci-error"]="CiError",t[t.SelfieHowTo="selfie-how-to"]="SelfieHowTo",t[t.SelfieTilt="selfie-tilt"]="SelfieTilt",t[t.SelfieCapture="selfie-capture"]="SelfieCapture",t[t.Selfie="selfie"]="Selfie",t[t.SelfieError="selfie-error"]="SelfieError",t[t.End="end"]="End",t[t.CameraError="camera-error"]="CameraError",t[t.Default="default"]="Default"}(p||(p={})),function(t){t[t.Initialized="initialized"]="Initialized",t[t.Finalized="finalized"]="Finalized",t[t.None="none"]="None"}(w||(w={}));class f{static getInstance(){return f.instance||(f.instance=new f),f.instance}constructor(){this.serviceErrors=["Service Unavailable","Unauthorized"],this.urls=new d}async http(t){const e=await fetch(t);if(!e.ok)throw new Error(e.statusText);try{return await e.json()}catch(t){throw new Error("No json found in response "+t)}}async post(t,e,i=!0){var s=new Request(h.apiBaseUrl+t,{method:"POST",body:e,headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+h.token}});try{return await this.http(s)}catch(s){if(!i||this.serviceErrors.includes(s.message))throw s;this.AddLog("Error in post ",s);try{var n=new Request(h.apiBaseUrl+t,{method:"POST",body:e,headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+h.token}});return await this.http(n)}catch(i){this.AddLog("Error in post ",i);var a=new Request(h.apiBaseUrl+t,{method:"POST",body:e,headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+h.token}});return await this.http(a)}}}async get(t,e=!0){var i=new Request(h.apiBaseUrl+t,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+h.token}});try{return await this.http(i)}catch(i){if(!e||this.serviceErrors.includes(i.message))throw i;this.AddLog("Error in get ",i);try{var s=new Request(h.apiBaseUrl+t,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+h.token}});return await this.http(s)}catch(e){this.AddLog("Error in get ",e);var n=new Request(h.apiBaseUrl+t,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+h.token}});return await this.http(n)}}}async SendOTPCode(t,e){let i={requestId:t,phone:e};return await this.post(this.urls.OtpSend,JSON.stringify(i))}async CheckOTPCode(t,e){let i={requestId:t,otp:e};return await this.post(this.urls.OtpCheck,JSON.stringify(i))}async AddIdentificationRequest(t,e){h.debug&&console.log("Calling identity request with store:"+JSON.stringify(h));let i={requestId:h.requestId,clientDeviceInfo:JSON.stringify(t),redirectId:h.redirectId,phoneNumber:h.phoneNumber,version:e,demoMode:"DEMO"==h.environment},s=await this.post(this.urls.IdentityInsert,JSON.stringify(i));return""==h.requestId&&(h.requestId=s.requestId),h.phoneNumber=s.phoneNumber,h.flowStatus=o[s.state],h.logSteps=s.logSteps,h.debug=s.debug,h.modelsPath=s.modelsPath,!0}async UploadFileForRequestB64(t,e,i){let s={requestId:t,type:e,data:i},n=await this.post(this.urls.UploadCapture,JSON.stringify(s));return h.debug&&console.log(`apicall | uploadfileforrequestb64 | ${n}`),n}async GetAgreement(t){return(await this.get(this.urls.GetAgreement+"?type="+t+"&requestId="+h.requestId)).htmlText}async GenerateAgreement(t){let e={requestId:h.requestId,documentType:t};return(await this.post(this.urls.GenerateAgreement,JSON.stringify(e))).generation}async GetStatus(t){let e=await this.get(this.urls.GetStatus+"?orderId="+t);return i[e.status]}async SendLink(t,e){let i={requestId:h.requestId,link:t,phoneNumber:e};return(await this.post(this.urls.SendLink,JSON.stringify(i))).sent}async AddLog(t,e){try{let i={requestId:h.requestId,action:o[h.flowStatus],message:JSON.stringify({error:t,context:e})};return(await this.post(this.urls.AddLog,JSON.stringify(i),!1)).saved}catch(t){}}async AddStep(t,e){if(0==h.logSteps)return;let i={requestId:h.requestId,redirectId:h.redirectId,step:p[t],moment:w[e],timestamp:(new Date).toISOString()};return(await this.post(this.urls.AddStep,JSON.stringify(i))).saved}async AbortRequest(){return await this.post(this.urls.AbortRequest,JSON.stringify({requestId:h.requestId}))}async GetTranslations(t){return await this.get(this.urls.Translations+"?langIso="+t)}async LandingValidationStartFlow(t){let e=await this.post(this.urls.StartFlow,JSON.stringify({requestId:h.requestId,cameraIsAccessible:t}));return o[e.state]}async GetNextFlowState(){let t=await this.get(this.urls.NextFlowState+"?requestId="+h.requestId);return o[t.state]}async GetFlowState(){let t=await this.get(this.urls.CurrentFlowState+"?requestId="+h.requestId);return o[t.state]}async GetNextStateForCaptureError(){let t=await this.get(this.urls.NextStateForCaptureError+"?requestId="+h.requestId);return o[t.state]}}const b=new class{async getValues(){return this.values||(this.values=await this.fetchTranslations()),this.values}getLocale(t=document.body){if(h.langIso&&""!=h.langIso)return h.langIso;{const e=t.closest("[lang]");return e?e.lang:"ro"}}async fetchTranslations(){const t=this.getLocale();try{const e=(new f).GetTranslations(t);if(e)return e}catch(e){return console.error(`Error loading locale: ${t}`,e),null}}};export{f as A,w as F,r as I,i as O,l as S,b as T,p as a,o as b,c,h as s}