@ekyc_qoobiss/qbs-ect-cmp 3.6.58 → 3.6.61

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-9c2605e3.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-32c06882.js';
3
3
 
4
4
  const agreementCheckCss = "";
5
5
 
@@ -4750,7 +4750,7 @@ const CaptureError = class {
4750
4750
  this.eventCaptureErrorDone.emit();
4751
4751
  }
4752
4752
  render() {
4753
- 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), h("p", { class: "font-size-1" }, this.reason)), 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))))));
4753
+ 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))))));
4754
4754
  }
4755
4755
  };
4756
4756
  CaptureError.style = captureErrorCss;
@@ -5204,7 +5204,7 @@ function v4(options, buf, offset) {
5204
5204
  }
5205
5205
 
5206
5206
  const name = "@ekyc_qoobiss/qbs-ect-cmp";
5207
- const version$1 = "3.6.58";
5207
+ const version$1 = "3.6.61";
5208
5208
  const description = "Person Identification Component";
5209
5209
  const main = "./dist/index.cjs.js";
5210
5210
  const module = "./dist/index.js";
@@ -5535,21 +5535,33 @@ const IdentificationComponent = class {
5535
5535
  currentBlock = h("sms-code-validation", null);
5536
5536
  }
5537
5537
  else if (state.flowStatus == FlowStatus.IDFRONT) {
5538
+ if (state.debug)
5539
+ console.log('identification-component | render | IDFRONT');
5538
5540
  currentBlock = h("process-id", { mode: "front" });
5539
5541
  }
5540
5542
  else if (state.flowStatus == FlowStatus.IDBACK) {
5543
+ if (state.debug)
5544
+ console.log('identification-component | render | IDBACK');
5541
5545
  currentBlock = h("process-id", { mode: "back" });
5542
5546
  }
5543
5547
  else if (state.flowStatus == FlowStatus.IDTILT) {
5548
+ if (state.debug)
5549
+ console.log('identification-component | render | TILT');
5544
5550
  currentBlock = h("process-id", { mode: "tilt" });
5545
5551
  }
5546
5552
  else if (state.flowStatus == FlowStatus.LIVENESS) {
5553
+ if (state.debug)
5554
+ console.log('identification-component | render | LIVENESS');
5547
5555
  currentBlock = h("user-liveness", { mode: "selfie" });
5548
5556
  }
5549
5557
  else if (state.flowStatus == FlowStatus.LIVENESSGESTURE) {
5558
+ if (state.debug)
5559
+ console.log('identification-component | render | LIVENESSGESTURE');
5550
5560
  currentBlock = h("user-liveness", { mode: "selfieGesture" });
5551
5561
  }
5552
5562
  else if (state.flowStatus == FlowStatus.COMPLETE) {
5563
+ if (state.debug)
5564
+ console.log('identification-component | render | COMPLETE');
5553
5565
  currentBlock = h("end-redirect", null);
5554
5566
  }
5555
5567
  else if (state.flowStatus == FlowStatus.ERROREND) {
@@ -8684,6 +8696,8 @@ const ProcessId = class {
8684
8696
  async captureIdImage(event) {
8685
8697
  if (state.debug)
8686
8698
  console.log('process-id | captureIdImage');
8699
+ if (this.mode == 'tilt')
8700
+ return;
8687
8701
  let idPhoto = event.detail;
8688
8702
  if (idPhoto.size == 0) {
8689
8703
  if (state.debug)
@@ -8697,7 +8711,10 @@ const ProcessId = class {
8697
8711
  var uploadResult = await ApiCall.instance.UploadFileForRequestB64(state.requestId, this.flow.capture.photoType, frontCapture);
8698
8712
  if (state.debug)
8699
8713
  console.log('process-id | captureIdImage | uploadResult: ' + uploadResult);
8700
- if (!uploadResult) {
8714
+ if (uploadResult.isValid) {
8715
+ state.flowStatus = FlowStatus[uploadResult.state];
8716
+ }
8717
+ else {
8701
8718
  this.switchCamera();
8702
8719
  this.triggerErrorFlow();
8703
8720
  }
@@ -8726,7 +8743,10 @@ const ProcessId = class {
8726
8743
  var uploadResult = await ApiCall.instance.UploadFileForRequestB64(state.requestId, this.flow.capture.recType, captureRec);
8727
8744
  if (state.debug)
8728
8745
  console.log('process-id | capturedIdRecording | uploadResult: ' + uploadResult);
8729
- if (!uploadResult) {
8746
+ if (uploadResult.saved) {
8747
+ state.flowStatus = FlowStatus[uploadResult.state];
8748
+ }
8749
+ else {
8730
8750
  this.triggerErrorFlow();
8731
8751
  }
8732
8752
  this.recordingResultCount = 0;
@@ -8735,17 +8755,26 @@ const ProcessId = class {
8735
8755
  if (state.debug)
8736
8756
  console.log('process-id | verificationFinished');
8737
8757
  this.verificationReceived = Date.now();
8738
- while (Date.now() - this.verificationReceived < 25000) {
8739
- await delay(2000);
8740
- let currentStatus = await ApiCall.instance.GetFlowState();
8758
+ let initialStatus = state.flowStatus;
8759
+ let statusChanged = false;
8760
+ while (Date.now() - this.verificationReceived < 25000 && !statusChanged) {
8761
+ await delay(1000);
8762
+ statusChanged = initialStatus != state.flowStatus;
8763
+ }
8764
+ let currentStatus = await ApiCall.instance.GetFlowState();
8765
+ if (statusChanged) {
8766
+ state.flowStatus = currentStatus;
8767
+ }
8768
+ else {
8741
8769
  if (currentStatus != state.flowStatus) {
8742
8770
  state.flowStatus = currentStatus;
8743
- break;
8771
+ }
8772
+ else {
8773
+ this.triggerUploadFailedFlow();
8744
8774
  }
8745
8775
  }
8746
8776
  if (state.debug)
8747
8777
  console.log('process-id | verificationFinished | waitingFinished ');
8748
- this.triggerErrorFlow();
8749
8778
  }
8750
8779
  async componentDidLoad() {
8751
8780
  if (state.debug)
@@ -8756,6 +8785,10 @@ const ProcessId = class {
8756
8785
  this.errorReason = 'Invalid';
8757
8786
  this.showInvalid = true;
8758
8787
  }
8788
+ triggerUploadFailedFlow() {
8789
+ this.errorReason = 'Upload Failed';
8790
+ this.showInvalid = true;
8791
+ }
8759
8792
  async disconnectedCallback() {
8760
8793
  if (state.debug)
8761
8794
  console.log('process-id | disconnectedCallback');
@@ -9070,7 +9103,10 @@ const UserLiveness = class {
9070
9103
  try {
9071
9104
  var uploadPhoto = new File([selfiePhoto], this.flow.capture.fileName, { type: 'image/png' });
9072
9105
  let photoUploaded = await ApiCall.instance.UploadFileForRequestB64(state.requestId, this.flow.capture.photoType, uploadPhoto);
9073
- if (!photoUploaded) {
9106
+ if (photoUploaded.isValid) {
9107
+ state.flowStatus = FlowStatus[photoUploaded.state];
9108
+ }
9109
+ else {
9074
9110
  this.triggerErrorFlow();
9075
9111
  }
9076
9112
  }
@@ -9094,7 +9130,10 @@ const UserLiveness = class {
9094
9130
  try {
9095
9131
  let uploadRec = new File([selfieRecording], this.flow.capture.recName + mimeType.extension, { type: mimeType.type });
9096
9132
  let uplodDone = await ApiCall.instance.UploadFileForRequestB64(state.requestId, this.flow.capture.recType, uploadRec);
9097
- if (!uplodDone) {
9133
+ if (uplodDone.saved) {
9134
+ state.flowStatus = FlowStatus[uplodDone.state];
9135
+ }
9136
+ else {
9098
9137
  this.triggerErrorFlow();
9099
9138
  }
9100
9139
  }
@@ -9109,16 +9148,29 @@ const UserLiveness = class {
9109
9148
  }
9110
9149
  }
9111
9150
  async verificationFinished() {
9151
+ if (state.debug)
9152
+ console.log('user-liveness | verificationFinished');
9112
9153
  this.verificationReceived = Date.now();
9113
- while (Date.now() - this.verificationReceived < 25000) {
9114
- await delay(2000);
9115
- let currentStatus = await ApiCall.instance.GetFlowState();
9154
+ let initialStatus = state.flowStatus;
9155
+ let statusChanged = false;
9156
+ while (Date.now() - this.verificationReceived < 25000 && !statusChanged) {
9157
+ await delay(1000);
9158
+ statusChanged = initialStatus != state.flowStatus;
9159
+ }
9160
+ let currentStatus = await ApiCall.instance.GetFlowState();
9161
+ if (statusChanged) {
9162
+ state.flowStatus = currentStatus;
9163
+ }
9164
+ else {
9116
9165
  if (currentStatus != state.flowStatus) {
9117
9166
  state.flowStatus = currentStatus;
9118
- break;
9167
+ }
9168
+ else {
9169
+ this.triggerUploadFailedFlow();
9119
9170
  }
9120
9171
  }
9121
- this.triggerErrorFlow();
9172
+ if (state.debug)
9173
+ console.log('user-liveness | verificationFinished | waitingFinished ');
9122
9174
  }
9123
9175
  async disconnectedCallback() {
9124
9176
  await BaseComponent.finalize(this.currentStep);
@@ -9127,6 +9179,10 @@ const UserLiveness = class {
9127
9179
  this.errorReason = 'Invalid';
9128
9180
  this.showError = true;
9129
9181
  }
9182
+ triggerUploadFailedFlow() {
9183
+ this.errorReason = 'Upload Failed';
9184
+ this.showError = true;
9185
+ }
9130
9186
  render() {
9131
9187
  let howTo = h("how-to-info", null);
9132
9188
  let capture = h("selfie-capture", null);
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h } from './index-cf54a432.js';
2
- import { T as Translations } from './TranslationUtils-9c2605e3.js';
2
+ import { T as Translations } from './TranslationUtils-32c06882.js';
3
3
 
4
4
  const randomActionsCss = "";
5
5
 
@@ -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.IDFRONT=6]="IDFRONT",t[t.IDBACK=7]="IDBACK",t[t.IDTILT=8]="IDTILT",t[t.LIVENESS=9]="LIVENESS",t[t.LIVENESSGESTURE=10]="LIVENESSGESTURE",t[t.COMPLETE=11]="COMPLETE",t[t.ERROREND=12]="ERROREND",t[t.CAMERAERROR=13]="CAMERAERROR",t[t.ABORTED=14]="ABORTED",t[t.NONE=15]="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 d{}d.FlowStatusKey="qbs-ect-flowstatus",d.RequestIdKey="qbs-ect-requestid",d.TokenKey="qbs-ect-token",d.InitialisedKey="qbs-ect-initialised",d.HasIdBackKey="qbs-ect-has-id-back",d.AgreementValidationKey="qbs-ect-agreement-validation",d.PhoneValidationKey="qbs-ect-phone-validation",d.RefreshDoneKey="qbs-ect-refresh-done";class h{constructor(){this.uriEnv="/",this.uriEnv=["QA","DEMO"].includes(l.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"}}const{state:l,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))))},d="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:d,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},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 w,p;u("environment",(t=>{l.debug="QA"==t})),u("flowStatus",(t=>{sessionStorage.setItem(d.FlowStatusKey,o[t])})),u("token",(t=>{sessionStorage.setItem(d.TokenKey,t)})),u("requestId",(t=>{sessionStorage.setItem(d.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"}(w||(w={})),function(t){t[t.Initialized="initialized"]="Initialized",t[t.Finalized="finalized"]="Finalized",t[t.None="none"]="None"}(p||(p={}));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(l.apiBaseUrl+t,{method:"POST",body:e,headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+l.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(l.apiBaseUrl+t,{method:"POST",body:e,headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+l.token}});return await this.http(n)}catch(i){this.AddLog("Error in post ",i);var a=new Request(l.apiBaseUrl+t,{method:"POST",body:e,headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+l.token}});return await this.http(a)}}}async get(t,e=!0){var i=new Request(l.apiBaseUrl+t,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+l.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(l.apiBaseUrl+t,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+l.token}});return await this.http(s)}catch(e){this.AddLog("Error in get ",e);var n=new Request(l.apiBaseUrl+t,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"IDKYC-TOKEN "+l.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){l.debug&&console.log("Calling identity request with store:"+JSON.stringify(l));let i={requestId:l.requestId,clientDeviceInfo:JSON.stringify(t),redirectId:l.redirectId,phoneNumber:l.phoneNumber,version:e,demoMode:"DEMO"==l.environment},s=await this.post(this.urls.IdentityInsert,JSON.stringify(i));return""==l.requestId&&(l.requestId=s.requestId),l.phoneNumber=s.phoneNumber,l.flowStatus=o[s.state],l.logSteps=s.logSteps,!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 l.flowStatus=o[n.state],!["IdFront","IdBack","Selfie"].includes(e)||n.isValid}async GetAgreement(t){return(await this.get(this.urls.GetAgreement+"?type="+t+"&requestId="+l.requestId)).htmlText}async GenerateAgreement(t){let e={requestId:l.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:l.requestId,link:t,phoneNumber:e};return(await this.post(this.urls.SendLink,JSON.stringify(i))).sent}async AddLog(t,e){try{let i={requestId:l.requestId,action:o[l.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==l.logSteps)return;let i={requestId:l.requestId,redirectId:l.redirectId,step:w[t],moment:p[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:l.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:l.requestId,cameraIsAccessible:t}));return o[e.state]}async GetNextFlowState(){let t=await this.get(this.urls.NextFlowState+"?requestId="+l.requestId);return o[t.state]}async GetFlowState(){let t=await this.get(this.urls.CurrentFlowState+"?requestId="+l.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(l.langIso&&""!=l.langIso)return l.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,p as F,r as I,i as O,d as S,b as T,w as a,o as b,c,l 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.IDFRONT=6]="IDFRONT",t[t.IDBACK=7]="IDBACK",t[t.IDTILT=8]="IDTILT",t[t.LIVENESS=9]="LIVENESS",t[t.LIVENESSGESTURE=10]="LIVENESSGESTURE",t[t.COMPLETE=11]="COMPLETE",t[t.ERROREND=12]="ERROREND",t[t.CAMERAERROR=13]="CAMERAERROR",t[t.ABORTED=14]="ABORTED",t[t.NONE=15]="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"}}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},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.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 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,!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 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]}}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}