@ekyc_qoobiss/qbs-ect-cmp 3.6.43 → 3.6.44
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.
- package/dist/cjs/{TranslationUtils-dd73945b.js → TranslationUtils-2d932eab.js} +1 -1
- package/dist/cjs/agreement-check_17.cjs.entry.js +4 -4
- package/dist/cjs/random-actions.cjs.entry.js +1 -1
- package/dist/collection/components/flow/sms-code-validation/sms-code-validation.js +1 -1
- package/dist/collection/components/flow/sms-send/sms-send.js +1 -1
- package/dist/collection/helpers/ApiCall.js +1 -1
- package/dist/esm/{TranslationUtils-741a728a.js → TranslationUtils-0039c82d.js} +1 -1
- package/dist/esm/agreement-check_17.entry.js +4 -4
- package/dist/esm/random-actions.entry.js +1 -1
- package/dist/qbs-ect-cmp/{p-a130edd5.entry.js → p-0c1eead0.entry.js} +1 -1
- package/dist/qbs-ect-cmp/{p-87c689d6.js → p-b969ca3e.js} +1 -1
- package/dist/qbs-ect-cmp/{p-a4babb67.entry.js → p-fca9e256.entry.js} +2 -2
- package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
- package/dist/types/models/IAddRequest.d.ts +1 -1
- package/dist/types/models/IOtpCheck.d.ts +1 -1
- package/dist/types/models/IOtpSend.d.ts +1 -1
- package/package.json +1 -1
|
@@ -484,7 +484,7 @@ class ApiCall {
|
|
|
484
484
|
state.requestId = jsonResp.requestId;
|
|
485
485
|
}
|
|
486
486
|
state.phoneNumber = jsonResp.phoneNumber;
|
|
487
|
-
state.flowStatus = exports.FlowStatus[jsonResp.
|
|
487
|
+
state.flowStatus = exports.FlowStatus[jsonResp.state];
|
|
488
488
|
return true;
|
|
489
489
|
}
|
|
490
490
|
async UploadFileForRequestB64(requestId, type, file) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-41696e0e.js');
|
|
6
|
-
const TranslationUtils = require('./TranslationUtils-
|
|
6
|
+
const TranslationUtils = require('./TranslationUtils-2d932eab.js');
|
|
7
7
|
|
|
8
8
|
var MobileOS;
|
|
9
9
|
(function (MobileOS) {
|
|
@@ -5287,7 +5287,7 @@ function v4(options, buf, offset) {
|
|
|
5287
5287
|
}
|
|
5288
5288
|
|
|
5289
5289
|
const name = "@ekyc_qoobiss/qbs-ect-cmp";
|
|
5290
|
-
const version$1 = "3.6.
|
|
5290
|
+
const version$1 = "3.6.44";
|
|
5291
5291
|
const description = "Person Identification Component";
|
|
5292
5292
|
const main = "./dist/index.cjs.js";
|
|
5293
5293
|
const module$1 = "./dist/index.js";
|
|
@@ -8931,7 +8931,7 @@ const SmsCodeValidation = class {
|
|
|
8931
8931
|
try {
|
|
8932
8932
|
this.canSend = false;
|
|
8933
8933
|
var codeChecked = await this.baseComponent.apiCall.CheckOTPCode(TranslationUtils.state.requestId, this.code);
|
|
8934
|
-
TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus[codeChecked.
|
|
8934
|
+
TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus[codeChecked.state];
|
|
8935
8935
|
}
|
|
8936
8936
|
catch (e) {
|
|
8937
8937
|
this.apiErrorEvent.emit(e);
|
|
@@ -8985,7 +8985,7 @@ const SmsSend = class {
|
|
|
8985
8985
|
this.canSend = false;
|
|
8986
8986
|
var codeSent = await this.baseComponent.apiCall.SendOTPCode(TranslationUtils.state.requestId, this.phoneNumber);
|
|
8987
8987
|
if (codeSent.sent === true) {
|
|
8988
|
-
TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus[codeSent.
|
|
8988
|
+
TranslationUtils.state.flowStatus = TranslationUtils.FlowStatus[codeSent.state];
|
|
8989
8989
|
}
|
|
8990
8990
|
}
|
|
8991
8991
|
catch (e) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-41696e0e.js');
|
|
6
|
-
const TranslationUtils = require('./TranslationUtils-
|
|
6
|
+
const TranslationUtils = require('./TranslationUtils-2d932eab.js');
|
|
7
7
|
|
|
8
8
|
const randomActionsCss = "";
|
|
9
9
|
|
|
@@ -18,7 +18,7 @@ export class SmsCodeValidation {
|
|
|
18
18
|
try {
|
|
19
19
|
this.canSend = false;
|
|
20
20
|
var codeChecked = await this.baseComponent.apiCall.CheckOTPCode(store.requestId, this.code);
|
|
21
|
-
store.flowStatus = FlowStatus[codeChecked.
|
|
21
|
+
store.flowStatus = FlowStatus[codeChecked.state];
|
|
22
22
|
}
|
|
23
23
|
catch (e) {
|
|
24
24
|
this.apiErrorEvent.emit(e);
|
|
@@ -18,7 +18,7 @@ export class SmsSend {
|
|
|
18
18
|
this.canSend = false;
|
|
19
19
|
var codeSent = await this.baseComponent.apiCall.SendOTPCode(store.requestId, this.phoneNumber);
|
|
20
20
|
if (codeSent.sent === true) {
|
|
21
|
-
store.flowStatus = FlowStatus[codeSent.
|
|
21
|
+
store.flowStatus = FlowStatus[codeSent.state];
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
catch (e) {
|
|
@@ -156,7 +156,7 @@ export class ApiCall {
|
|
|
156
156
|
store.requestId = jsonResp.requestId;
|
|
157
157
|
}
|
|
158
158
|
store.phoneNumber = jsonResp.phoneNumber;
|
|
159
|
-
store.flowStatus = FlowStatus[jsonResp.
|
|
159
|
+
store.flowStatus = FlowStatus[jsonResp.state];
|
|
160
160
|
return true;
|
|
161
161
|
}
|
|
162
162
|
async UploadFileForRequestB64(requestId, type, file) {
|
|
@@ -482,7 +482,7 @@ class ApiCall {
|
|
|
482
482
|
state.requestId = jsonResp.requestId;
|
|
483
483
|
}
|
|
484
484
|
state.phoneNumber = jsonResp.phoneNumber;
|
|
485
|
-
state.flowStatus = FlowStatus[jsonResp.
|
|
485
|
+
state.flowStatus = FlowStatus[jsonResp.state];
|
|
486
486
|
return true;
|
|
487
487
|
}
|
|
488
488
|
async UploadFileForRequestB64(requestId, type, file) {
|
|
@@ -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, s as state, F as FlowMoments, a as FlowSteps, T as Translations, S as SessionKeys, b as FlowStatus, I as IdCaptureValues, O as OrderStatuses, c as SelfieCaptureValues } from './TranslationUtils-
|
|
2
|
+
import { A as ApiCall, s as state, F as FlowMoments, a as FlowSteps, T as Translations, S as SessionKeys, b as FlowStatus, I as IdCaptureValues, O as OrderStatuses, c as SelfieCaptureValues } from './TranslationUtils-0039c82d.js';
|
|
3
3
|
|
|
4
4
|
var MobileOS;
|
|
5
5
|
(function (MobileOS) {
|
|
@@ -5283,7 +5283,7 @@ function v4(options, buf, offset) {
|
|
|
5283
5283
|
}
|
|
5284
5284
|
|
|
5285
5285
|
const name = "@ekyc_qoobiss/qbs-ect-cmp";
|
|
5286
|
-
const version$1 = "3.6.
|
|
5286
|
+
const version$1 = "3.6.44";
|
|
5287
5287
|
const description = "Person Identification Component";
|
|
5288
5288
|
const main = "./dist/index.cjs.js";
|
|
5289
5289
|
const module = "./dist/index.js";
|
|
@@ -8927,7 +8927,7 @@ const SmsCodeValidation = class {
|
|
|
8927
8927
|
try {
|
|
8928
8928
|
this.canSend = false;
|
|
8929
8929
|
var codeChecked = await this.baseComponent.apiCall.CheckOTPCode(state.requestId, this.code);
|
|
8930
|
-
state.flowStatus = FlowStatus[codeChecked.
|
|
8930
|
+
state.flowStatus = FlowStatus[codeChecked.state];
|
|
8931
8931
|
}
|
|
8932
8932
|
catch (e) {
|
|
8933
8933
|
this.apiErrorEvent.emit(e);
|
|
@@ -8981,7 +8981,7 @@ const SmsSend = class {
|
|
|
8981
8981
|
this.canSend = false;
|
|
8982
8982
|
var codeSent = await this.baseComponent.apiCall.SendOTPCode(state.requestId, this.phoneNumber);
|
|
8983
8983
|
if (codeSent.sent === true) {
|
|
8984
|
-
state.flowStatus = FlowStatus[codeSent.
|
|
8984
|
+
state.flowStatus = FlowStatus[codeSent.state];
|
|
8985
8985
|
}
|
|
8986
8986
|
}
|
|
8987
8987
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as s}from"./p-8942656c.js";import{T as i}from"./p-
|
|
1
|
+
import{r as t,h as s}from"./p-8942656c.js";import{T as i}from"./p-b969ca3e.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.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 h{}h.FlowStatusKey="qbs-ect-flowstatus",h.RequestIdKey="qbs-ect-requestid",h.TokenKey="qbs-ect-token",h.InitialisedKey="qbs-ect-initialised",h.HasIdBackKey="qbs-ect-has-id-back",h.AgreementValidationKey="qbs-ect-agreement-validation",h.PhoneValidationKey="qbs-ect-phone-validation",h.RefreshDoneKey="qbs-ect-refresh-done";class d{constructor(){this.uriEnv="/",this.uriEnv="QA"==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+"flowstate/startflow",this.NextFlowState=this.uriEnv+"flowstate/getnextstate"}}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))))},h="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:h,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"},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=>{l.debug="QA"==t})),u("flowStatus",(t=>{sessionStorage.setItem(h.FlowStatusKey,o[t])})),u("token",(t=>{sessionStorage.setItem(h.TokenKey,t)})),u("requestId",(t=>{sessionStorage.setItem(h.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"}(p||(p={})),function(t){t[t.Initialized="initialized"]="Initialized",t[t.Finalized="finalized"]="Finalized",t[t.None="none"]="None"}(w||(w={}));class b{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(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},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.status],!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],!(e in["IdFront","IdBack","Selfie"])||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){let i={requestId:l.requestId,redirectId:l.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: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({requesId:l.requestId,cameraIsAccessible:t}));return o[e.state]}async GetNextFlowState(){let t=await this.get(this.urls.StartFlow+"?requesId="+l.requestId);return o[t.state]}}const f=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 b).GetTranslations(t);if(e)return e}catch(e){return console.error(`Error loading locale: ${t}`,e),null}}};export{b as A,w as F,r as I,i as O,h as S,f as T,p 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 h{}h.FlowStatusKey="qbs-ect-flowstatus",h.RequestIdKey="qbs-ect-requestid",h.TokenKey="qbs-ect-token",h.InitialisedKey="qbs-ect-initialised",h.HasIdBackKey="qbs-ect-has-id-back",h.AgreementValidationKey="qbs-ect-agreement-validation",h.PhoneValidationKey="qbs-ect-phone-validation",h.RefreshDoneKey="qbs-ect-refresh-done";class d{constructor(){this.uriEnv="/",this.uriEnv="QA"==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+"flowstate/startflow",this.NextFlowState=this.uriEnv+"flowstate/getnextstate"}}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))))},h="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:h,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"},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=>{l.debug="QA"==t})),u("flowStatus",(t=>{sessionStorage.setItem(h.FlowStatusKey,o[t])})),u("token",(t=>{sessionStorage.setItem(h.TokenKey,t)})),u("requestId",(t=>{sessionStorage.setItem(h.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"}(p||(p={})),function(t){t[t.Initialized="initialized"]="Initialized",t[t.Finalized="finalized"]="Finalized",t[t.None="none"]="None"}(w||(w={}));class b{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(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},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],!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],!(e in["IdFront","IdBack","Selfie"])||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){let i={requestId:l.requestId,redirectId:l.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: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({requesId:l.requestId,cameraIsAccessible:t}));return o[e.state]}async GetNextFlowState(){let t=await this.get(this.urls.StartFlow+"?requesId="+l.requestId);return o[t.state]}}const f=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 b).GetTranslations(t);if(e)return e}catch(e){return console.error(`Error loading locale: ${t}`,e),null}}};export{b as A,w as F,r as I,i as O,h as S,f as T,p as a,o as b,c,l as s}
|