@ekyc_qoobiss/qbs-ect-cmp 3.6.63 → 3.6.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/cjs/{TranslationUtils-fbb2c39c.js → TranslationUtils-eeb71e60.js} +15 -10
  2. package/dist/cjs/agreement-check_17.cjs.entry.js +135 -73
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/qbs-ect-cmp.cjs.js +1 -1
  5. package/dist/cjs/random-actions.cjs.entry.js +1 -1
  6. package/dist/collection/components/common/how-to-info/how-to-info.js +3 -17
  7. package/dist/collection/components/flow/process-id/process-id.js +50 -42
  8. package/dist/collection/components/flow/user-liveness/user-liveness.js +47 -38
  9. package/dist/collection/components/identification-component/identification-component.js +48 -4
  10. package/dist/collection/models/FlowStatus.js +15 -11
  11. package/dist/esm/{TranslationUtils-32c06882.js → TranslationUtils-21a568f6.js} +15 -10
  12. package/dist/esm/agreement-check_17.entry.js +135 -73
  13. package/dist/esm/loader.js +1 -1
  14. package/dist/esm/qbs-ect-cmp.js +1 -1
  15. package/dist/esm/random-actions.entry.js +1 -1
  16. package/dist/qbs-ect-cmp/p-2735b5f4.js +1 -0
  17. package/dist/qbs-ect-cmp/{p-deb65af1.entry.js → p-3695074a.entry.js} +2 -2
  18. package/dist/qbs-ect-cmp/{p-fc771dd3.entry.js → p-4fef4884.entry.js} +1 -1
  19. package/dist/qbs-ect-cmp/qbs-ect-cmp.esm.js +1 -1
  20. package/dist/types/components/common/how-to-info/how-to-info.d.ts +1 -2
  21. package/dist/types/components/flow/process-id/process-id.d.ts +3 -1
  22. package/dist/types/components/flow/user-liveness/user-liveness.d.ts +3 -2
  23. package/dist/types/components.d.ts +0 -1
  24. package/dist/types/models/CaptureFlow.d.ts +0 -1
  25. package/dist/types/models/FlowStatus.d.ts +15 -10
  26. package/package.json +1 -1
  27. package/dist/qbs-ect-cmp/p-601c9197.js +0 -1
@@ -1 +1 @@
1
- import{r as t,h as s}from"./p-8942656c.js";import{T as i}from"./p-601c9197.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-2735b5f4.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{p as e,b as t}from"./p-8942656c.js";export{s as setNonce}from"./p-8942656c.js";(()=>{const t=import.meta.url,o={};return""!==t&&(o.resourcesUrl=new URL(".",t).href),e(o)})().then((e=>t([["p-054dc5b3",[[1,"loader-dots"]]],["p-fc771dd3",[[0,"random-actions"]]],["p-deb65af1",[[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,"howToInfoDone","howToDone"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoIdCapture","captureIdImage"],[0,"recordingIdCapture","capturedIdRecording"]]],[0,"user-liveness",{mode:[1],showError:[32],showTimeout:[32],flow:[32],howToDone:[32]},[[0,"howToInfoDone","howToDoneEvent"],[0,"timeElapsed","timeElapsed"],[0,"captureErrorDone","captureErrorDone"],[0,"photoSelfieCapture","captureSelfieImage"],[0,"recordingSelfieCapture","capturedSelfieRecording"]]],[0,"agreement-info",{agreementsChecked:[32],termsChecked:[32],openAgreements:[32],openTerms:[32]},[[0,"agreementAcceptance","agreementAcceptanceEmitted"]]],[0,"camera-error",{title:[32],description:[32],buttonDisabled:[32],demoVideo:[32]}],[0,"end-redirect"],[0,"error-end",{message:[1],errorTitle:[1,"error-title"]}],[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,"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,"how-to-info",{topTitle:[32],subTitle:[32],imagePath:[32],buttonText:[32],buttonEnabled:[32]}],[0,"camera-comp",{modelPath:[1,"model-path"],probabilityThreshold:[2,"probability-threshold"],captureMode:[1,"capture-mode"]}]]]],e)));
1
+ import{p as e,b as t}from"./p-8942656c.js";export{s as setNonce}from"./p-8942656c.js";(()=>{const t=import.meta.url,r={};return""!==t&&(r.resourcesUrl=new URL(".",t).href),e(r)})().then((e=>t([["p-054dc5b3",[[1,"loader-dots"]]],["p-4fef4884",[[0,"random-actions"]]],["p-3695074a",[[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]},[[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",{topTitle:[32],subTitle:[32],imagePath:[32],buttonText:[32],buttonEnabled:[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,"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"]}]]]],e)));
@@ -7,12 +7,11 @@ export declare class HowToInfo {
7
7
  imagePath: string;
8
8
  buttonText: string;
9
9
  buttonEnabled: boolean;
10
- eventHowToInfoDone: EventEmitter;
11
10
  apiErrorEvent: EventEmitter<any>;
12
11
  constructor();
13
12
  componentDidLoad(): Promise<void>;
14
13
  disconnectedCallback(): Promise<void>;
15
- buttonClick(): void;
14
+ buttonClick(): Promise<void>;
16
15
  componentWillLoad(): Promise<void>;
17
16
  render(): any;
18
17
  }
@@ -4,6 +4,7 @@ export declare class ProcessId {
4
4
  private recordingResultCount;
5
5
  private currentStep;
6
6
  private errorReason;
7
+ private verificationReceived;
7
8
  mode: string;
8
9
  private showTimeout;
9
10
  private showInvalid;
@@ -12,11 +13,12 @@ export declare class ProcessId {
12
13
  constructor();
13
14
  componentWillLoad(): void;
14
15
  initFlow(): void;
15
- howToDone(): void;
16
16
  timeElapsed(): void;
17
17
  captureErrorDone(): void;
18
18
  captureIdImage(event: any): Promise<void>;
19
19
  capturedIdRecording(event: any): Promise<void>;
20
+ verificationFinished(): Promise<void>;
21
+ private triggerUploadFailedFlow;
20
22
  componentDidLoad(): Promise<void>;
21
23
  private triggerErrorFlow;
22
24
  disconnectedCallback(): Promise<void>;
@@ -4,20 +4,21 @@ export declare class UserLiveness {
4
4
  showError: boolean;
5
5
  showTimeout: boolean;
6
6
  private flow;
7
- private howToDone;
8
7
  private recordingResultCount;
9
8
  private recordingRetryCount;
10
9
  private currentStep;
11
10
  private errorReason;
11
+ private verificationReceived;
12
12
  apiErrorEvent: EventEmitter<any>;
13
13
  constructor();
14
14
  componentDidLoad(): Promise<void>;
15
15
  componentWillLoad(): void;
16
- howToDoneEvent(): void;
17
16
  timeElapsed(): void;
18
17
  captureErrorDone(): void;
19
18
  captureSelfieImage(event: any): Promise<void>;
20
19
  capturedSelfieRecording(event: any): Promise<void>;
20
+ verificationFinished(): Promise<void>;
21
+ private triggerUploadFailedFlow;
21
22
  disconnectedCallback(): Promise<void>;
22
23
  private triggerErrorFlow;
23
24
  render(): any;
@@ -296,7 +296,6 @@ declare namespace LocalJSX {
296
296
  }
297
297
  interface HowToInfo {
298
298
  "onApiError"?: (event: HowToInfoCustomEvent<any>) => void;
299
- "onHowToInfoDone"?: (event: HowToInfoCustomEvent<any>) => void;
300
299
  }
301
300
  interface IdCapture {
302
301
  "onApiError"?: (event: IdCaptureCustomEvent<any>) => void;
@@ -1,6 +1,5 @@
1
1
  export interface CaptureFlow {
2
2
  capture: CaptureSide;
3
- howToDone: boolean;
4
3
  }
5
4
  export interface CaptureSide {
6
5
  fileName: string;
@@ -5,16 +5,21 @@ export declare enum FlowStatus {
5
5
  PHONE = 3,
6
6
  CODE = 4,
7
7
  CODEERROR = 5,
8
- IDFRONT = 6,
9
- IDBACK = 7,
10
- IDTILT = 8,
11
- LIVENESS = 9,
12
- LIVENESSGESTURE = 10,
13
- COMPLETE = 11,
14
- ERROREND = 12,
15
- CAMERAERROR = 13,
16
- ABORTED = 14,
17
- NONE = 15
8
+ IDFRONTHOWTO = 6,
9
+ IDFRONT = 7,
10
+ IDBACKHOWTO = 8,
11
+ IDBACK = 9,
12
+ IDTILTHOWTO = 10,
13
+ IDTILT = 11,
14
+ LIVENESSHOWTO = 12,
15
+ LIVENESS = 13,
16
+ LIVENESSGESTUREHOWTO = 14,
17
+ LIVENESSGESTURE = 15,
18
+ COMPLETE = 16,
19
+ ERROREND = 17,
20
+ CAMERAERROR = 18,
21
+ ABORTED = 19,
22
+ NONE = 20
18
23
  }
19
24
  export interface FlowResult {
20
25
  state: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekyc_qoobiss/qbs-ect-cmp",
3
- "version": "3.6.63",
3
+ "version": "3.6.65",
4
4
  "description": "Person Identification Component",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.js",
@@ -1 +0,0 @@
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}