@eka-care/abha-stg 0.0.39 → 0.0.41

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.
@@ -14,7 +14,7 @@ var Oo=a=>{throw TypeError(a)};var Bs=(a,_,$)=>_.has(a)||Oo("Cannot "+$);var Ft=
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var f$3=reactExports,k$3=Symbol.for("react.element"),l$8=Symbol.for("react.fragment"),m$3=Object.prototype.hasOwnProperty,n$3=f$3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p$6={key:!0,ref:!0,__self:!0,__source:!0};function q$2(a,_,$){var _e,et={},tt=null,rt=null;$!==void 0&&(tt=""+$),_.key!==void 0&&(tt=""+_.key),_.ref!==void 0&&(rt=_.ref);for(_e in _)m$3.call(_,_e)&&!p$6.hasOwnProperty(_e)&&(et[_e]=_[_e]);if(a&&a.defaultProps)for(_e in _=a.defaultProps,_)et[_e]===void 0&&(et[_e]=_[_e]);return{$$typeof:k$3,type:a,key:tt,ref:rt,props:et,_owner:n$3.current}}reactJsxRuntime_production_min.Fragment=l$8;reactJsxRuntime_production_min.jsx=q$2;reactJsxRuntime_production_min.jsxs=q$2;jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports,ABHA_V3_SKIP_STATES=(a=>(a.ABHA_END="abha_end",a.CONFIRM_MOBILE_OTP="confirm_mobile_otp",a.ABHA_CREATE="abha_create",a.ABHA_SELECT="abha_select",a))(ABHA_V3_SKIP_STATES||{}),APPOINTMENT_CHANNEL=(a=>(a.PRACTO="Practo",a.COVID_CONNECT="Covid-Connect",a.CORPORATE_CONNECT="Corporate-Connect",a.SPHERE_INDIA_PSYCHOLOGY="SPPS",a.SPHERE_INDIA_COVID="SPCO",a.TALK_TO_DOCTOR="TTD",a.SECOND_OPINION="SECO",a.EMERGENCY="EMCY",a.CORPORATE_CONNECT_INIT="CC-Init",a.WALKIN="Walkin",a.WALKINQR="Walkin-Scan",a.OFFLINE="Offline",a.ON_PAD="ON-PAD",a.UHI_HPD="UHI_HPD",a.UHI_DCM="UHI_DCM",a.IVR="IVR",a.STAFF="Staff",a.DOCTOR="Doctor",a.FOLLOW_UP="FOLLOW-UP",a.ONLINE_APPOINTMENT="Online-Appointment",a.PACKAGE="PACKAGE",a.PATIENT_REQUESTED="Patient-Requested",a.ABHA="ABHA",a))(APPOINTMENT_CHANNEL||{}),APPOINTMENT_STATUS=(a=>(a.CANCELLED="CN",a.ABORTED="AB",a.NO_SHOW="NS",a.NO_SHOW_DOCTOR="NSD",a.NO_SHOW_STAFF="NSS",a.COMPLETED="CM",a.RESCHEDULED="RE",a.ONGOING="OG",a.BOOKED="BK",a.PARKED="PA",a.PROVISIONAL_CANCELLED="PC",a.COMPLETED_NO_PRESCRIPTION="CMNP",a.DOCTOR_RESCHEDULED="RED",a.DOCTOR_CANCELLED="CND",a.STAFF_RESCHEDULED="RES",a.STAFF_CANCELLED="CNS",a.PAYMENT_NOT_RECEIVED="PNR",a.INITIATED="IN",a.RESERVED="RV",a.CHECKED_IN="CK",a))(APPOINTMENT_STATUS||{});const bookedAptWhitelist=new Set(["BK","PA"]),completedQueueStatus=["CM","CMNP"],otherQueueStatus=["CN","CNS","CND","RE","RES","RED","AB","NS","NSD","NSS"],followupQueueStatus=["IN","RV","PC","RE"],completedAptWhitelist=new Set(completedQueueStatus),followupAptWhileWhitelist=new Set(followupQueueStatus),otherAptWhitelist=new Set(otherQueueStatus),opdAptWhitelist=new Set(["CK","OG"]);[...Array.from(completedAptWhitelist),...Array.from(followupAptWhileWhitelist),...Array.from(bookedAptWhitelist),...Array.from(opdAptWhitelist),...Array.from(otherAptWhitelist)];var AUTH_METHOD=(a=>(a[a.EMAIL=1]="EMAIL",a[a.MOBILE=2]="MOBILE",a[a.ABHA=7]="ABHA",a))(AUTH_METHOD||{}),LOADING_STATE=(a=>(a.IDLE="IDLE",a.LOADING="LOADING",a.RESOLVED="RESOLVED",a.REJECTED="REJECTED",a))(LOADING_STATE||{}),ABHA_AUTH_FLOW_METHOD=(a=>(a.PHR_ADDRESS="phr_address",a.MOBILE="mobile",a.ABHA_NUMBER="abha_number",a.AADHAR_NUMBER="aadhaar_number",a.REGISTRATION_TYPE="registration_type",a))(ABHA_AUTH_FLOW_METHOD||{}),REGISTRATION_TYPE=(a=>(a.LOGIN="login",a.CREATE="create",a))(REGISTRATION_TYPE||{}),DISCOUNT_TYPE=(a=>(a.PERCENTAGE="PERCENTAGE",a.AMOUNT="AMOUNT",a))(DISCOUNT_TYPE||{}),RECEIPT_PAYMENT_MODE_ID=(a=>(a.CASH="CASH",a.UPI="UPI",a.DEBIT_CARD="DEBIT_CARD",a.GPAY="GPAY",a.PAYTM="PAYTM",a.CREDIT_CARD="CREDIT_CARD",a.OTHER="OTHER",a.EKA_POSTPAY="EKA_POSTPAY",a.EKA_PREPAID="EKA_PREPAID",a.EKA_WALLET="EKA_WALLET",a))(RECEIPT_PAYMENT_MODE_ID||{}),RECEIPT_PAYMENT_MODE_NAME=(a=>(a.CASH="Cash",a.UPI="UPI",a.DEBIT_CARD="Debit Card",a.GPAY="GPay",a.PAYTM="Paytm",a.CREDIT_CARD="Credit Card",a.OTHER="Other",a.EKA_POSTPAY="Eka Payment",a.EKA_PREPAID="Eka Prepaid",a))(RECEIPT_PAYMENT_MODE_NAME||{}),QUEUE_CARD_ACTIONS=(a=>(a.TAGS="TAGS",a.VISIT_TYPE="VITY",a.PAYMENT_STATUS="PAYS",a.ASSESSMENT_STATUS="ASST",a.PAST_VISITS="PRES",a.CREATE_ABHA="ABHA",a.ADD_VITALS_AND_LAB_RESULTS="AVLR",a.ADD_ADDRESS="ADDR",a.REQUEST_RECORDS="RMDR",a.REQUEST_PAYMENT="REQP",a.ARCHIVE_APPOINTMENT="AAPT",a.CREATE_CERTIFICATE="CRMC",a.REFER_TO_DOCTOR="RTOD",a.SEND_GOOGLE_REVIEW_LINK="SGRL",a.MARK_NO_SHOW="MNSH",a.CREATE_TEMPLATE="CATP",a.FOLLOW_UP="FLWU",a.ABHA_ID="ABHA_ID",a.UPLOAD_MEDICAL_RECORDS="UPMR",a.RESUME="RESUME",a.CHECK_IN="CHECK_IN",a.EXIT="EXIT",a.WRITE_RX="WRITE_RX",a.START_VISIT="START_VISIT",a.RECEIPT="RECEIPT",a.ORDER_MEDICINE="ORDER_MEDICINE",a.PRINT_RX="PRINT_RX",a.QUESTIONAIRE="SAQU",a.LABEL="LABEL",a.NOTES="NOTES",a))(QUEUE_CARD_ACTIONS||{});APPOINTMENT_STATUS.BOOKED,APPOINTMENT_STATUS.PARKED;APPOINTMENT_STATUS.CHECKED_IN,APPOINTMENT_STATUS.ONGOING;APPOINTMENT_STATUS.COMPLETED,APPOINTMENT_STATUS.COMPLETED_NO_PRESCRIPTION;APPOINTMENT_STATUS.CANCELLED,APPOINTMENT_STATUS.STAFF_CANCELLED,APPOINTMENT_STATUS.DOCTOR_CANCELLED,APPOINTMENT_STATUS.RESCHEDULED,APPOINTMENT_STATUS.STAFF_RESCHEDULED,APPOINTMENT_STATUS.DOCTOR_RESCHEDULED,APPOINTMENT_STATUS.ABORTED,APPOINTMENT_STATUS.NO_SHOW,APPOINTMENT_STATUS.NO_SHOW_DOCTOR,APPOINTMENT_STATUS.NO_SHOW_STAFF;APPOINTMENT_STATUS.INITIATED,APPOINTMENT_STATUS.RESERVED,APPOINTMENT_STATUS.PROVISIONAL_CANCELLED,APPOINTMENT_STATUS.RESCHEDULED;RECEIPT_PAYMENT_MODE_NAME.CASH,RECEIPT_PAYMENT_MODE_ID.CASH,RECEIPT_PAYMENT_MODE_ID.CASH,RECEIPT_PAYMENT_MODE_NAME.CREDIT_CARD,RECEIPT_PAYMENT_MODE_ID.CREDIT_CARD,RECEIPT_PAYMENT_MODE_ID.CREDIT_CARD,RECEIPT_PAYMENT_MODE_NAME.DEBIT_CARD,RECEIPT_PAYMENT_MODE_ID.DEBIT_CARD,RECEIPT_PAYMENT_MODE_ID.DEBIT_CARD,RECEIPT_PAYMENT_MODE_NAME.PAYTM,RECEIPT_PAYMENT_MODE_ID.PAYTM,RECEIPT_PAYMENT_MODE_ID.PAYTM,RECEIPT_PAYMENT_MODE_NAME.GPAY,RECEIPT_PAYMENT_MODE_ID.GPAY,RECEIPT_PAYMENT_MODE_ID.GPAY,RECEIPT_PAYMENT_MODE_NAME.UPI,RECEIPT_PAYMENT_MODE_ID.UPI,RECEIPT_PAYMENT_MODE_ID.UPI,RECEIPT_PAYMENT_MODE_NAME.OTHER,RECEIPT_PAYMENT_MODE_ID.OTHER,RECEIPT_PAYMENT_MODE_ID.OTHER;RECEIPT_PAYMENT_MODE_ID.CASH,RECEIPT_PAYMENT_MODE_NAME.CASH,RECEIPT_PAYMENT_MODE_ID.CREDIT_CARD,RECEIPT_PAYMENT_MODE_NAME.CREDIT_CARD,RECEIPT_PAYMENT_MODE_ID.DEBIT_CARD,RECEIPT_PAYMENT_MODE_NAME.DEBIT_CARD,RECEIPT_PAYMENT_MODE_ID.PAYTM,RECEIPT_PAYMENT_MODE_NAME.PAYTM,RECEIPT_PAYMENT_MODE_ID.GPAY,RECEIPT_PAYMENT_MODE_NAME.GPAY,RECEIPT_PAYMENT_MODE_ID.UPI,RECEIPT_PAYMENT_MODE_NAME.UPI,RECEIPT_PAYMENT_MODE_ID.OTHER,RECEIPT_PAYMENT_MODE_NAME.OTHER;DISCOUNT_TYPE.AMOUNT,DISCOUNT_TYPE.PERCENTAGE;APPOINTMENT_STATUS.CANCELLED,APPOINTMENT_STATUS.ABORTED,APPOINTMENT_STATUS.ONGOING,APPOINTMENT_STATUS.COMPLETED,APPOINTMENT_STATUS.RESCHEDULED,APPOINTMENT_STATUS.BOOKED,APPOINTMENT_STATUS.CHECKED_IN,APPOINTMENT_STATUS.NO_SHOW,APPOINTMENT_STATUS.INITIATED;APPOINTMENT_STATUS.COMPLETED_NO_PRESCRIPTION+"",APPOINTMENT_STATUS.COMPLETED,APPOINTMENT_STATUS.DOCTOR_CANCELLED+"",APPOINTMENT_STATUS.CANCELLED,APPOINTMENT_STATUS.STAFF_CANCELLED+"",APPOINTMENT_STATUS.CANCELLED,APPOINTMENT_STATUS.NO_SHOW_DOCTOR+"",APPOINTMENT_STATUS.NO_SHOW,APPOINTMENT_STATUS.NO_SHOW_STAFF+"",APPOINTMENT_STATUS.NO_SHOW,APPOINTMENT_STATUS.DOCTOR_RESCHEDULED+"",APPOINTMENT_STATUS.RESCHEDULED,APPOINTMENT_STATUS.STAFF_RESCHEDULED+"",APPOINTMENT_STATUS.RESCHEDULED;APPOINTMENT_CHANNEL.WALKIN,APPOINTMENT_CHANNEL.FOLLOW_UP,APPOINTMENT_CHANNEL.PATIENT_REQUESTED,APPOINTMENT_CHANNEL.OFFLINE,APPOINTMENT_CHANNEL.STAFF,APPOINTMENT_CHANNEL.DOCTOR,APPOINTMENT_CHANNEL.ONLINE_APPOINTMENT,APPOINTMENT_CHANNEL.ABHA;QUEUE_CARD_ACTIONS.TAGS,QUEUE_CARD_ACTIONS.VISIT_TYPE,QUEUE_CARD_ACTIONS.RECEIPT,QUEUE_CARD_ACTIONS.CREATE_ABHA,QUEUE_CARD_ACTIONS.ADD_VITALS_AND_LAB_RESULTS,QUEUE_CARD_ACTIONS.UPLOAD_MEDICAL_RECORDS;const PROD={AORTA_HOST:"https://auth.eka.care",AORTA_GO_HOST:"https://aortago.eka.care",TRYST_HOST:"https://tryst.eka.care",AXON_HOST:"https://axon.eka.care",PARCHI_HOST:"https://parchi.eka.care",CURIO_HOST:"https://eka.care",AVATAR_HOST:"https://a.eka.care",PTDIR_HOST:"https://ptdir.eka.care",TELE_HOST:"https://mweb.eka.care",METROLPOLIS_HOST:"https://consultation.metropolisindia.com",LUCID_WS_HOST:"https://lucid-ws.eka.care",LUCID_HOST:"https://lucid.eka.care",DEEPTHOUGHT_HOST:"https://deepthought.eka.care",NDHM_HOST:"https://ndhm.eka.care",LOGIN_HOST:"https://login.eka.care",HUB:"https://hub.eka.care",RECEIPT_DOMAIN:"https://doc-receipts.eka.care"},DEV={AORTA_HOST:"https://aorta.dev.eka.care",AORTA_GO_HOST:"https://aortago.dev.eka.care",TRYST_HOST:"https://tryst.dev.eka.care",AXON_HOST:"https://axon.dev.eka.care",PARCHI_HOST:"https://parchi.dev.eka.care",CURIO_HOST:"https://curio.dev.eka.care",AVATAR_HOST:"https://eka-avatar.dev.eka.care",PTDIR_HOST:"https://ptdir.dev.eka.care",TELE_HOST:"https://mweb.dev.eka.care",METROLPOLIS_HOST:"https://consultation.metropolisindia.com",LUCID_WS_HOST:"https://lucid-ws.dev.eka.care",LUCID_HOST:"https://lucid.dev.eka.care",DEEPTHOUGHT_HOST:"https://deepthought.dev.eka.care",NDHM_HOST:"https://ndhm.dev.eka.care",LOGIN_HOST:"https://login.dev.eka.care",HUB:"https://hub.dev.eka.care",RECEIPT_DOMAIN:"https://doc-receipt.s3.ap-south-1.amazonaws.com"};let envVar=DEV,client_id="",extraHeaders=null;const setEnv=({env:a,clientId:_,extraHeaders:$})=>{envVar=a==="PROD"?PROD:DEV,client_id=_,$&&(extraHeaders=$)},setIndividualEnv=({clientId:a,env:_,extraHeaders:$})=>{a&&(client_id=a),_&&(envVar=_==="PROD"?PROD:DEV),$&&(extraHeaders={...extraHeaders,...$})},GET_AORTA_GO_HOST=()=>envVar.AORTA_GO_HOST,GET_NDHM_HOST=()=>envVar.NDHM_HOST,GET_CLIENT_ID=()=>client_id,GET_EXTRA_HEADERS=()=>extraHeaders;function pushToMxpDataLayer({data:a}){typeof window<"u"&&(window.mxpDataLayer=window.mxpDataLayer||[],window.mxpDataLayer.push(a))}function sendApiFailedEvent({category:a="api-failed",url:_,params:$}){pushToMxpDataLayer({data:{name:a,data:{url:_,...$}}}),{...$}}async function refreshToken(){if(await updateToken())return!0;const _=new Headers;_.append("Content-Type","application/json"),_.set("client-id",GET_CLIENT_ID());const $=JSON.stringify({}),_e={method:"POST",headers:_,body:$,redirect:"follow",credentials:"include",mode:"cors"};try{const et=GET_AORTA_GO_HOST();if((await fetch(`${et}/emr/v3/auth/refresh`,{..._e,body:JSON.stringify({})})).status===401)return!1}catch{return!1}return!0}async function fetchWrapper(a,_={},$=!0,_e=!1){var et,tt;try{const rt=((tt=(et=window==null?void 0:window.Eka)==null?void 0:et.getSessionToken)==null?void 0:tt.call(et))||"",nt=new Headers(_.headers);let it,at;!nt.get("client-id")&&!_e&&nt.set("client-id",GET_CLIENT_ID()),rt&&!nt.get("auth")&&nt.set("auth",rt);const st=GET_EXTRA_HEADERS();st&&Object.keys(st).forEach(ot=>{nt.set(ot,st[ot])});const ct=await fetch(a,{..._,headers:nt});return window&&(at=window.location.pathname,it=nt.get("client-id")),ct.status===401&&$&&await refreshToken()?await fetchWrapper(a,_,!1):(ct.status>401&&sendApiFailedEvent({url:a,params:{responseStatus:ct.status}}),ct)}catch(rt){throw sendApiFailedEvent({url:a,params:{error:`${rt.message||rt}`}}),console.error(rt),rt}}let androidRefreshCB=[];async function refreshCallback(a){androidRefreshCB.forEach(_=>_(!0)),androidRefreshCB=[]}async function updateToken(){var a,_,$,_e,et,tt;if(typeof window<"u"){if(typeof((a=window==null?void 0:window.Eka)==null?void 0:a.updateToken)=="function")return(_=window.parent)==null||_.postMessage({type:"REFRESH_TOKEN"},"*"),window.refreshCallback=window.refreshCallback||refreshCallback,new Promise(rt=>{var nt;androidRefreshCB.push(rt),(nt=window==null?void 0:window.Eka)==null||nt.updateToken("refreshCallback")});if(typeof((et=(_e=($=window==null?void 0:window.webkit)==null?void 0:$.messageHandlers)==null?void 0:_e.statusCodeHandler)==null?void 0:et.postMessage)=="function")return(tt=window.parent)==null||tt.postMessage({type:"REFRESH_TOKEN"},"*"),window.refreshCallback=window.refreshCallback||refreshCallback,new Promise(rt=>{var nt,it,at;androidRefreshCB.push(rt),(at=(it=(nt=window==null?void 0:window.webkit)==null?void 0:nt.messageHandlers)==null?void 0:it.statusCodeHandler)==null||at.postMessage(JSON.stringify({status:401}))})}return!1}async function postAuthInitV2({method:a,identifier:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({method:a,identifier:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_AORTA_GO_HOST();return await(await fetchWrapper(`${tt}/v2/auth/init`,et)).json()}catch(tt){console.error(tt)}return{}}async function postAuthVerifyV2({txn_id:a,code:_,token:$}){const _e=new Headers;_e.append("Content-Type","application/json");const et=JSON.stringify({txn_id:a,..._?{code:_}:{},...$?{token:$}:{}}),tt={method:"POST",headers:_e,body:et,redirect:"follow",credentials:"include"};try{const rt=GET_AORTA_GO_HOST();return await(await fetchWrapper(`${rt}/v2/auth/verify`,tt)).json()}catch(rt){console.error(rt)}return{}}async function getProfilePhrUser(){const a=new Headers;a.append("Content-Type","application/json");const _={method:"GET",headers:a,redirect:"follow",credentials:"include"};try{const $=GET_AORTA_GO_HOST();return await(await fetchWrapper(`${$}/profiles/v1/patient`,_)).json()}catch($){return console.error("profilePhrUser error =>",$),[]}}async function getProfilesPatient(){const a=new Headers;a.append("Content-Type","application/json");const _={method:"GET",headers:a,redirect:"follow",credentials:"include"},$=GET_EXTRA_HEADERS(),_e=$==null?void 0:$["X-User-ID"];if(!_e)return{};try{const et=GET_AORTA_GO_HOST();return await(await fetchWrapper(`${et}/profiles/v1/patient/${_e}`,_)).json()}catch(et){return console.error("profilePhrUser error =>",et),{}}}async function postProfileSwitch({oid:a}){const _=new Headers;_.append("Content-Type","application/json");const $=JSON.stringify({oid:a}),_e={method:"POST",headers:_,body:$,redirect:"follow",credentials:"include"};try{const et=GET_AORTA_GO_HOST();return await(await fetchWrapper(`${et}/v1/profile/switch`,_e)).json()}catch(et){console.error("postProfileSwitchError: ",et)}return{}}async function postAuthLogoutV2(){console.log("inside postAuthLogoutV2 api call");const a=new Headers;a.append("Content-Type","application/json");const _=JSON.stringify({}),_e=`${GET_AORTA_GO_HOST()}/v2/auth/logout`,et={method:"POST",headers:a,body:_,redirect:"follow",credentials:"include"};try{const tt=await fetchWrapper(_e,et);return tt.ok?!0:(console.log("Logout failed with status",tt==null?void 0:tt.status),!1)}catch(tt){return console.error("Logout API failed:",tt),!1}}async function postAbdmLoginInit({method:a,identifier:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({method:a,identifier:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/na/v1/profile/login/init`,et)).json()}catch(tt){console.error("postAbdmLoginInit error =>",tt)}return{}}async function postAbdmLoginVerify({txn_id:a,otp:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({txn_id:a,otp:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/na/v1/profile/login/verify`,et)).json()}catch(tt){console.error("postAbdmLoginVerify error =>",tt)}return{}}async function postRegisterAadhaarInit({aadhaar_number:a}){const _=new Headers;_.append("Content-Type","application/json");const $=JSON.stringify({aadhaar_number:a}),_e={method:"POST",headers:_,body:$,redirect:"follow",credentials:"include"};try{const et=GET_NDHM_HOST();return await(await fetchWrapper(`${et}/abdm/na/v1/registration/aadhaar/init`,_e)).json()}catch{}return{}}async function postRegisterMobileInit({mobile_number:a}){const _=new Headers;_.append("Content-Type","application/json");const $=JSON.stringify({mobile_number:a}),_e={method:"POST",headers:_,body:$,redirect:"follow",credentials:"include"};try{const et=GET_NDHM_HOST();return await(await fetchWrapper(`${et}/abdm/na/v1/registration/mobile/init`,_e)).json()}catch(et){console.error(et)}return{}}async function postRegisterAadhaarVerify({txn_id:a,mobile:_,otp:$}){const _e=new Headers;_e.append("Content-Type","application/json");const et=JSON.stringify({txn_id:a,mobile:_,otp:$}),tt={method:"POST",headers:_e,body:et,redirect:"follow",credentials:"include"};try{const rt=GET_NDHM_HOST();return await(await fetchWrapper(`${rt}/abdm/na/v1/registration/aadhaar/verify`,tt)).json()}catch{}return{}}async function postRegisterAadhaarMobileVerify({txn_id:a,otp:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({txn_id:a,otp:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/na/v1/registration/aadhaar/mobile/verify`,et)).json()}catch{}return{}}async function postRegisterAadhaarResendOtp({txn_id:a}){const _=new Headers;_.append("Content-Type","application/json");const $=JSON.stringify({txn_id:a}),_e={method:"POST",headers:_,body:$,redirect:"follow",credentials:"include"};try{const et=GET_NDHM_HOST();return await(await fetchWrapper(`${et}/abdm/na/v1/registration/aadhaar/resend`,_e)).json()}catch{}return{}}async function postRegisterAadhaarMobileResendOtp({txn_id:a}){const _=new Headers;_.append("Content-Type","application/json");const $=JSON.stringify({txn_id:a}),_e={method:"POST",headers:_,body:$,redirect:"follow",credentials:"include"};try{const et=GET_NDHM_HOST();return await(await fetchWrapper(`${et}/abdm/na/v1/registration/aadhaar/mobile/resend`,_e)).json()}catch{}return{}}async function postRegisterAadhaarCreatePhr({abha_address:a,txn_id:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({abha_address:a,txn_id:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/na/v1/registration/aadhaar/create-phr`,et)).json()}catch(tt){console.error("postRegisterAadhaarCreatePhr ==>",tt)}return{}}async function postAbdmRegisterMobileCreatePhr({abha_address:a,address:_,first_name:$,last_name:_e,day_of_birth:et,month_of_birth:tt,year_of_birth:rt,gender:nt,middle_name:it,pincode:at,txn_id:st}){const ct=new Headers;ct.append("Content-Type","application/json");const ot=JSON.stringify({abha_address:a,profile:{address:_,day_of_birth:et,first_name:$,gender:nt,last_name:_e,middle_name:it,month_of_birth:tt,pincode:at,year_of_birth:rt},txn_id:st}),pt={method:"POST",headers:ct,body:ot,redirect:"follow",credentials:"include"};try{const ht=GET_NDHM_HOST();return await(await fetchWrapper(`${ht}/abdm/na/v1/registration/mobile/create-phr`,pt)).json()}catch(ht){console.error("postAbdmRegisterMobileCreatePhr error =>",ht)}return{}}async function postAbdmProfileLoginPhr({txn_id:a,phr_address:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({txn_id:a,phr_address:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/na/v1/profile/login/phr`,et)).json()}catch(tt){console.error("postAbdmProfileLoginPhr error =>",tt)}return{}}async function getAbdmRegisterSuggest({txn_id:a,fn:_,mn:$,ln:_e,dob:et}){const tt=new Headers;tt.append("Content-Type","application/json");const rt={method:"GET",headers:tt,redirect:"follow",credentials:"include"};try{const nt=GET_NDHM_HOST();return await(await fetchWrapper(`${nt}/abdm/na/v1/registration/suggest?transactionId=${a}&fn=${_||""}&mn=${$||""}&ln=${_e||""}&dob=${et||""}`,rt)).json()}catch(nt){console.error("postAbdmLoginVerify error =>",nt)}return{}}async function postAbdmRegisterAbhaNumberCreatePhr({abha_address:a,txn_id:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({abha_address:a,txn_id:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/na/v1/registration/abha-number/create-phr`,et)).json()}catch(tt){console.error("postAbdmRegisterAbhaNumberCreatePhr ==>",tt)}return{}}async function postAbdmRegisterPhrCheck({abha_address:a}){const _=new Headers;_.append("Content-Type","application/json");const $=JSON.stringify({abha_address:a}),_e={method:"POST",headers:_,body:$,redirect:"follow",credentials:"include"};try{const et=GET_NDHM_HOST();return await(await fetchWrapper(`${et}/abdm/na/v1/registration/phr/check`,_e)).json()}catch(et){console.error("postAbdmRegisterPhrCheck ==>",et)}return{}}async function postAbdmProfileEka({abha_address:a,address:_,first_name:$,last_name:_e,day_of_birth:et,month_of_birth:tt,year_of_birth:rt,gender:nt,middle_name:it,pincode:at}){const st=new Headers;st.append("Content-Type","application/json");const ct=JSON.stringify({abha_address:a,profile:{address:_,day_of_birth:et,first_name:$,gender:nt,last_name:_e,middle_name:it,month_of_birth:tt,pincode:at,year_of_birth:rt}}),ot={method:"POST",headers:st,body:ct,redirect:"follow",credentials:"include"};try{const pt=GET_NDHM_HOST();return await(await fetchWrapper(`${pt}/abdm/v1/profile/eka`,ot)).json()}catch(pt){console.error("postAbdmProfileEka error =>",pt)}return{}}async function postAbdmProfileEkaLinkPhr({abha_address:a,oid:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({abha_address:a,oid:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/v1/profile/eka/link-phr`,et)).json()}catch(tt){console.error("postAbdmProfileLinkPhr ==>",tt)}return{}}async function postAbdmRegisterMobileVerify({txn_id:a,otp:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({txn_id:a,otp:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/na/v1/registration/mobile/verify`,et)).json()}catch{}return{}}async function postAbdmRegisterMobileResendOtp({txn_id:a}){const _=new Headers;_.append("Content-Type","application/json");const $={method:"POST",headers:_,body:JSON.stringify({txn_id:a}),redirect:"follow",credentials:"include"};try{const _e=GET_NDHM_HOST();return await(await fetchWrapper(`${_e}/abdm/na/v1/registration/mobile/resend`,$)).json()}catch{}return{}}async function getPincodeDetails({pincode:a}){const $=`${GET_NDHM_HOST()}/abdm/na/v1/registration/pincode/${a}`,_e=new Headers;_e.append("Content-Type","application/json");const et={method:"GET",headers:_e,redirect:"follow",credentials:"include"};try{return await(await fetchWrapper($,et)).json()}catch(tt){console.error(tt)}return{}}var reactDom={exports:{}},reactDom_production_min={},scheduler={exports:{}},scheduler_production_min={};/**
17
+ */var f$3=reactExports,k$3=Symbol.for("react.element"),l$8=Symbol.for("react.fragment"),m$3=Object.prototype.hasOwnProperty,n$3=f$3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p$6={key:!0,ref:!0,__self:!0,__source:!0};function q$2(a,_,$){var _e,et={},tt=null,rt=null;$!==void 0&&(tt=""+$),_.key!==void 0&&(tt=""+_.key),_.ref!==void 0&&(rt=_.ref);for(_e in _)m$3.call(_,_e)&&!p$6.hasOwnProperty(_e)&&(et[_e]=_[_e]);if(a&&a.defaultProps)for(_e in _=a.defaultProps,_)et[_e]===void 0&&(et[_e]=_[_e]);return{$$typeof:k$3,type:a,key:tt,ref:rt,props:et,_owner:n$3.current}}reactJsxRuntime_production_min.Fragment=l$8;reactJsxRuntime_production_min.jsx=q$2;reactJsxRuntime_production_min.jsxs=q$2;jsxRuntime.exports=reactJsxRuntime_production_min;var jsxRuntimeExports=jsxRuntime.exports,ABHA_V3_SKIP_STATES=(a=>(a.ABHA_END="abha_end",a.CONFIRM_MOBILE_OTP="confirm_mobile_otp",a.ABHA_CREATE="abha_create",a.ABHA_SELECT="abha_select",a))(ABHA_V3_SKIP_STATES||{}),APPOINTMENT_CHANNEL=(a=>(a.PRACTO="Practo",a.COVID_CONNECT="Covid-Connect",a.CORPORATE_CONNECT="Corporate-Connect",a.SPHERE_INDIA_PSYCHOLOGY="SPPS",a.SPHERE_INDIA_COVID="SPCO",a.TALK_TO_DOCTOR="TTD",a.SECOND_OPINION="SECO",a.EMERGENCY="EMCY",a.CORPORATE_CONNECT_INIT="CC-Init",a.WALKIN="Walkin",a.WALKINQR="Walkin-Scan",a.OFFLINE="Offline",a.ON_PAD="ON-PAD",a.UHI_HPD="UHI_HPD",a.UHI_DCM="UHI_DCM",a.IVR="IVR",a.STAFF="Staff",a.DOCTOR="Doctor",a.FOLLOW_UP="FOLLOW-UP",a.ONLINE_APPOINTMENT="Online-Appointment",a.PACKAGE="PACKAGE",a.PATIENT_REQUESTED="Patient-Requested",a.ABHA="ABHA",a))(APPOINTMENT_CHANNEL||{}),APPOINTMENT_STATUS=(a=>(a.CANCELLED="CN",a.ABORTED="AB",a.NO_SHOW="NS",a.NO_SHOW_DOCTOR="NSD",a.NO_SHOW_STAFF="NSS",a.COMPLETED="CM",a.RESCHEDULED="RE",a.ONGOING="OG",a.BOOKED="BK",a.PARKED="PA",a.PROVISIONAL_CANCELLED="PC",a.COMPLETED_NO_PRESCRIPTION="CMNP",a.DOCTOR_RESCHEDULED="RED",a.DOCTOR_CANCELLED="CND",a.STAFF_RESCHEDULED="RES",a.STAFF_CANCELLED="CNS",a.PAYMENT_NOT_RECEIVED="PNR",a.INITIATED="IN",a.RESERVED="RV",a.CHECKED_IN="CK",a))(APPOINTMENT_STATUS||{});const bookedAptWhitelist=new Set(["BK","PA"]),completedQueueStatus=["CM","CMNP"],otherQueueStatus=["CN","CNS","CND","RE","RES","RED","AB","NS","NSD","NSS"],followupQueueStatus=["IN","RV","PC","RE"],completedAptWhitelist=new Set(completedQueueStatus),followupAptWhileWhitelist=new Set(followupQueueStatus),otherAptWhitelist=new Set(otherQueueStatus),opdAptWhitelist=new Set(["CK","OG"]);[...Array.from(completedAptWhitelist),...Array.from(followupAptWhileWhitelist),...Array.from(bookedAptWhitelist),...Array.from(opdAptWhitelist),...Array.from(otherAptWhitelist)];var AUTH_METHOD=(a=>(a[a.EMAIL=1]="EMAIL",a[a.MOBILE=2]="MOBILE",a[a.ABHA=7]="ABHA",a))(AUTH_METHOD||{}),LOADING_STATE=(a=>(a.IDLE="IDLE",a.LOADING="LOADING",a.RESOLVED="RESOLVED",a.REJECTED="REJECTED",a))(LOADING_STATE||{}),ABHA_AUTH_FLOW_METHOD=(a=>(a.PHR_ADDRESS="phr_address",a.MOBILE="mobile",a.ABHA_NUMBER="abha_number",a.AADHAR_NUMBER="aadhaar_number",a.REGISTRATION_TYPE="registration_type",a))(ABHA_AUTH_FLOW_METHOD||{}),REGISTRATION_TYPE=(a=>(a.LOGIN="login",a.CREATE="create",a))(REGISTRATION_TYPE||{}),DISCOUNT_TYPE=(a=>(a.PERCENTAGE="PERCENTAGE",a.AMOUNT="AMOUNT",a))(DISCOUNT_TYPE||{}),RECEIPT_PAYMENT_MODE_ID=(a=>(a.CASH="CASH",a.UPI="UPI",a.DEBIT_CARD="DEBIT_CARD",a.GPAY="GPAY",a.PAYTM="PAYTM",a.CREDIT_CARD="CREDIT_CARD",a.OTHER="OTHER",a.EKA_POSTPAY="EKA_POSTPAY",a.EKA_PREPAID="EKA_PREPAID",a.EKA_WALLET="EKA_WALLET",a))(RECEIPT_PAYMENT_MODE_ID||{}),RECEIPT_PAYMENT_MODE_NAME=(a=>(a.CASH="Cash",a.UPI="UPI",a.DEBIT_CARD="Debit Card",a.GPAY="GPay",a.PAYTM="Paytm",a.CREDIT_CARD="Credit Card",a.OTHER="Other",a.EKA_POSTPAY="Eka Payment",a.EKA_PREPAID="Eka Prepaid",a))(RECEIPT_PAYMENT_MODE_NAME||{}),QUEUE_CARD_ACTIONS=(a=>(a.TAGS="TAGS",a.VISIT_TYPE="VITY",a.PAYMENT_STATUS="PAYS",a.ASSESSMENT_STATUS="ASST",a.PAST_VISITS="PRES",a.CREATE_ABHA="ABHA",a.ADD_VITALS_AND_LAB_RESULTS="AVLR",a.ADD_ADDRESS="ADDR",a.REQUEST_RECORDS="RMDR",a.REQUEST_PAYMENT="REQP",a.ARCHIVE_APPOINTMENT="AAPT",a.CREATE_CERTIFICATE="CRMC",a.REFER_TO_DOCTOR="RTOD",a.SEND_GOOGLE_REVIEW_LINK="SGRL",a.MARK_NO_SHOW="MNSH",a.CREATE_TEMPLATE="CATP",a.FOLLOW_UP="FLWU",a.ABHA_ID="ABHA_ID",a.UPLOAD_MEDICAL_RECORDS="UPMR",a.RESUME="RESUME",a.CHECK_IN="CHECK_IN",a.EXIT="EXIT",a.WRITE_RX="WRITE_RX",a.START_VISIT="START_VISIT",a.RECEIPT="RECEIPT",a.ORDER_MEDICINE="ORDER_MEDICINE",a.PRINT_RX="PRINT_RX",a.QUESTIONAIRE="SAQU",a.LABEL="LABEL",a.NOTES="NOTES",a))(QUEUE_CARD_ACTIONS||{});APPOINTMENT_STATUS.BOOKED,APPOINTMENT_STATUS.PARKED;APPOINTMENT_STATUS.CHECKED_IN,APPOINTMENT_STATUS.ONGOING;APPOINTMENT_STATUS.COMPLETED,APPOINTMENT_STATUS.COMPLETED_NO_PRESCRIPTION;APPOINTMENT_STATUS.CANCELLED,APPOINTMENT_STATUS.STAFF_CANCELLED,APPOINTMENT_STATUS.DOCTOR_CANCELLED,APPOINTMENT_STATUS.RESCHEDULED,APPOINTMENT_STATUS.STAFF_RESCHEDULED,APPOINTMENT_STATUS.DOCTOR_RESCHEDULED,APPOINTMENT_STATUS.ABORTED,APPOINTMENT_STATUS.NO_SHOW,APPOINTMENT_STATUS.NO_SHOW_DOCTOR,APPOINTMENT_STATUS.NO_SHOW_STAFF;APPOINTMENT_STATUS.INITIATED,APPOINTMENT_STATUS.RESERVED,APPOINTMENT_STATUS.PROVISIONAL_CANCELLED,APPOINTMENT_STATUS.RESCHEDULED;RECEIPT_PAYMENT_MODE_NAME.CASH,RECEIPT_PAYMENT_MODE_ID.CASH,RECEIPT_PAYMENT_MODE_ID.CASH,RECEIPT_PAYMENT_MODE_NAME.CREDIT_CARD,RECEIPT_PAYMENT_MODE_ID.CREDIT_CARD,RECEIPT_PAYMENT_MODE_ID.CREDIT_CARD,RECEIPT_PAYMENT_MODE_NAME.DEBIT_CARD,RECEIPT_PAYMENT_MODE_ID.DEBIT_CARD,RECEIPT_PAYMENT_MODE_ID.DEBIT_CARD,RECEIPT_PAYMENT_MODE_NAME.PAYTM,RECEIPT_PAYMENT_MODE_ID.PAYTM,RECEIPT_PAYMENT_MODE_ID.PAYTM,RECEIPT_PAYMENT_MODE_NAME.GPAY,RECEIPT_PAYMENT_MODE_ID.GPAY,RECEIPT_PAYMENT_MODE_ID.GPAY,RECEIPT_PAYMENT_MODE_NAME.UPI,RECEIPT_PAYMENT_MODE_ID.UPI,RECEIPT_PAYMENT_MODE_ID.UPI,RECEIPT_PAYMENT_MODE_NAME.OTHER,RECEIPT_PAYMENT_MODE_ID.OTHER,RECEIPT_PAYMENT_MODE_ID.OTHER;RECEIPT_PAYMENT_MODE_ID.CASH,RECEIPT_PAYMENT_MODE_NAME.CASH,RECEIPT_PAYMENT_MODE_ID.CREDIT_CARD,RECEIPT_PAYMENT_MODE_NAME.CREDIT_CARD,RECEIPT_PAYMENT_MODE_ID.DEBIT_CARD,RECEIPT_PAYMENT_MODE_NAME.DEBIT_CARD,RECEIPT_PAYMENT_MODE_ID.PAYTM,RECEIPT_PAYMENT_MODE_NAME.PAYTM,RECEIPT_PAYMENT_MODE_ID.GPAY,RECEIPT_PAYMENT_MODE_NAME.GPAY,RECEIPT_PAYMENT_MODE_ID.UPI,RECEIPT_PAYMENT_MODE_NAME.UPI,RECEIPT_PAYMENT_MODE_ID.OTHER,RECEIPT_PAYMENT_MODE_NAME.OTHER;DISCOUNT_TYPE.AMOUNT,DISCOUNT_TYPE.PERCENTAGE;APPOINTMENT_STATUS.CANCELLED,APPOINTMENT_STATUS.ABORTED,APPOINTMENT_STATUS.ONGOING,APPOINTMENT_STATUS.COMPLETED,APPOINTMENT_STATUS.RESCHEDULED,APPOINTMENT_STATUS.BOOKED,APPOINTMENT_STATUS.CHECKED_IN,APPOINTMENT_STATUS.NO_SHOW,APPOINTMENT_STATUS.INITIATED;APPOINTMENT_STATUS.COMPLETED_NO_PRESCRIPTION+"",APPOINTMENT_STATUS.COMPLETED,APPOINTMENT_STATUS.DOCTOR_CANCELLED+"",APPOINTMENT_STATUS.CANCELLED,APPOINTMENT_STATUS.STAFF_CANCELLED+"",APPOINTMENT_STATUS.CANCELLED,APPOINTMENT_STATUS.NO_SHOW_DOCTOR+"",APPOINTMENT_STATUS.NO_SHOW,APPOINTMENT_STATUS.NO_SHOW_STAFF+"",APPOINTMENT_STATUS.NO_SHOW,APPOINTMENT_STATUS.DOCTOR_RESCHEDULED+"",APPOINTMENT_STATUS.RESCHEDULED,APPOINTMENT_STATUS.STAFF_RESCHEDULED+"",APPOINTMENT_STATUS.RESCHEDULED;APPOINTMENT_CHANNEL.WALKIN,APPOINTMENT_CHANNEL.FOLLOW_UP,APPOINTMENT_CHANNEL.PATIENT_REQUESTED,APPOINTMENT_CHANNEL.OFFLINE,APPOINTMENT_CHANNEL.STAFF,APPOINTMENT_CHANNEL.DOCTOR,APPOINTMENT_CHANNEL.ONLINE_APPOINTMENT,APPOINTMENT_CHANNEL.ABHA;QUEUE_CARD_ACTIONS.TAGS,QUEUE_CARD_ACTIONS.VISIT_TYPE,QUEUE_CARD_ACTIONS.RECEIPT,QUEUE_CARD_ACTIONS.CREATE_ABHA,QUEUE_CARD_ACTIONS.ADD_VITALS_AND_LAB_RESULTS,QUEUE_CARD_ACTIONS.UPLOAD_MEDICAL_RECORDS;const PROD={AORTA_HOST:"https://auth.eka.care",AORTA_GO_HOST:"https://aortago.eka.care",TRYST_HOST:"https://tryst.eka.care",AXON_HOST:"https://axon.eka.care",PARCHI_HOST:"https://parchi.eka.care",CURIO_HOST:"https://eka.care",AVATAR_HOST:"https://a.eka.care",PTDIR_HOST:"https://ptdir.eka.care",TELE_HOST:"https://mweb.eka.care",METROLPOLIS_HOST:"https://consultation.metropolisindia.com",LUCID_WS_HOST:"https://lucid-ws.eka.care",LUCID_HOST:"https://lucid.eka.care",DEEPTHOUGHT_HOST:"https://deepthought.eka.care",NDHM_HOST:"https://api.eka.care",LOGIN_HOST:"https://login.eka.care",HUB:"https://hub.eka.care",RECEIPT_DOMAIN:"https://doc-receipts.eka.care"},DEV={AORTA_HOST:"https://aorta.dev.eka.care",AORTA_GO_HOST:"https://aortago.dev.eka.care",TRYST_HOST:"https://tryst.dev.eka.care",AXON_HOST:"https://axon.dev.eka.care",PARCHI_HOST:"https://parchi.dev.eka.care",CURIO_HOST:"https://curio.dev.eka.care",AVATAR_HOST:"https://eka-avatar.dev.eka.care",PTDIR_HOST:"https://ptdir.dev.eka.care",TELE_HOST:"https://mweb.dev.eka.care",METROLPOLIS_HOST:"https://consultation.metropolisindia.com",LUCID_WS_HOST:"https://lucid-ws.dev.eka.care",LUCID_HOST:"https://lucid.dev.eka.care",DEEPTHOUGHT_HOST:"https://deepthought.dev.eka.care",NDHM_HOST:"https://api.dev.eka.care",LOGIN_HOST:"https://login.dev.eka.care",HUB:"https://hub.dev.eka.care",RECEIPT_DOMAIN:"https://doc-receipt.s3.ap-south-1.amazonaws.com"};let envVar=DEV,client_id="",extraHeaders=null;const setEnv=({env:a,clientId:_,extraHeaders:$})=>{envVar=a==="PROD"?PROD:DEV,client_id=_,$&&(extraHeaders=$)},setIndividualEnv=({clientId:a,env:_,extraHeaders:$})=>{a&&(client_id=a),_&&(envVar=_==="PROD"?PROD:DEV),$&&(extraHeaders={...extraHeaders,...$})},GET_AORTA_GO_HOST=()=>envVar.AORTA_GO_HOST,GET_NDHM_HOST=()=>envVar.NDHM_HOST,GET_CLIENT_ID=()=>client_id,GET_EXTRA_HEADERS=()=>extraHeaders;function pushToMxpDataLayer({data:a}){typeof window<"u"&&(window.mxpDataLayer=window.mxpDataLayer||[],window.mxpDataLayer.push(a))}function sendApiFailedEvent({category:a="api-failed",url:_,params:$}){pushToMxpDataLayer({data:{name:a,data:{url:_,...$}}}),{...$}}async function refreshToken(){if(await updateToken())return!0;const _=new Headers;_.append("Content-Type","application/json"),_.set("client-id",GET_CLIENT_ID());const $=JSON.stringify({}),_e={method:"POST",headers:_,body:$,redirect:"follow",credentials:"include",mode:"cors"};try{const et=GET_AORTA_GO_HOST();if((await fetch(`${et}/emr/v3/auth/refresh`,{..._e,body:JSON.stringify({})})).status===401)return!1}catch{return!1}return!0}async function fetchWrapper(a,_={},$=!0,_e=!1){var et,tt;try{const rt=((tt=(et=window==null?void 0:window.Eka)==null?void 0:et.getSessionToken)==null?void 0:tt.call(et))||"",nt=new Headers(_.headers);let it,at;!nt.get("client-id")&&!_e&&nt.set("client-id",GET_CLIENT_ID()),rt&&!nt.get("auth")&&nt.set("auth",rt);const st=GET_EXTRA_HEADERS();st&&Object.keys(st).forEach(ot=>{nt.set(ot,st[ot])});const ct=await fetch(a,{..._,headers:nt});return window&&(at=window.location.pathname,it=nt.get("client-id")),ct.status===401&&$&&await refreshToken()?await fetchWrapper(a,_,!1):(ct.status>401&&sendApiFailedEvent({url:a,params:{responseStatus:ct.status}}),ct)}catch(rt){throw sendApiFailedEvent({url:a,params:{error:`${rt.message||rt}`}}),console.error(rt),rt}}let androidRefreshCB=[];async function refreshCallback(a){androidRefreshCB.forEach(_=>_(!0)),androidRefreshCB=[]}async function updateToken(){var a,_,$,_e,et,tt;if(typeof window<"u"){if(typeof((a=window==null?void 0:window.Eka)==null?void 0:a.updateToken)=="function")return(_=window.parent)==null||_.postMessage({type:"REFRESH_TOKEN"},"*"),window.refreshCallback=window.refreshCallback||refreshCallback,new Promise(rt=>{var nt;androidRefreshCB.push(rt),(nt=window==null?void 0:window.Eka)==null||nt.updateToken("refreshCallback")});if(typeof((et=(_e=($=window==null?void 0:window.webkit)==null?void 0:$.messageHandlers)==null?void 0:_e.statusCodeHandler)==null?void 0:et.postMessage)=="function")return(tt=window.parent)==null||tt.postMessage({type:"REFRESH_TOKEN"},"*"),window.refreshCallback=window.refreshCallback||refreshCallback,new Promise(rt=>{var nt,it,at;androidRefreshCB.push(rt),(at=(it=(nt=window==null?void 0:window.webkit)==null?void 0:nt.messageHandlers)==null?void 0:it.statusCodeHandler)==null||at.postMessage(JSON.stringify({status:401}))})}return!1}async function postAuthInitV2({method:a,identifier:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({method:a,identifier:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_AORTA_GO_HOST();return await(await fetchWrapper(`${tt}/v2/auth/init`,et)).json()}catch(tt){console.error(tt)}return{}}async function postAuthVerifyV2({txn_id:a,code:_,token:$}){const _e=new Headers;_e.append("Content-Type","application/json");const et=JSON.stringify({txn_id:a,..._?{code:_}:{},...$?{token:$}:{}}),tt={method:"POST",headers:_e,body:et,redirect:"follow",credentials:"include"};try{const rt=GET_AORTA_GO_HOST();return await(await fetchWrapper(`${rt}/v2/auth/verify`,tt)).json()}catch(rt){console.error(rt)}return{}}async function getProfilePhrUser(){const a=new Headers;a.append("Content-Type","application/json");const _={method:"GET",headers:a,redirect:"follow",credentials:"include"};try{const $=GET_AORTA_GO_HOST();return await(await fetchWrapper(`${$}/profiles/v1/patient`,_)).json()}catch($){return console.error("profilePhrUser error =>",$),[]}}async function getProfilesPatient(){const a=new Headers;a.append("Content-Type","application/json");const _={method:"GET",headers:a,redirect:"follow",credentials:"include"},$=GET_EXTRA_HEADERS(),_e=$==null?void 0:$["X-User-ID"];if(!_e)return{};try{const et=GET_AORTA_GO_HOST();return await(await fetchWrapper(`${et}/profiles/v1/patient/${_e}`,_)).json()}catch(et){return console.error("profilePhrUser error =>",et),{}}}async function postProfileSwitch({oid:a}){const _=new Headers;_.append("Content-Type","application/json");const $=JSON.stringify({oid:a}),_e={method:"POST",headers:_,body:$,redirect:"follow",credentials:"include"};try{const et=GET_AORTA_GO_HOST();return await(await fetchWrapper(`${et}/v1/profile/switch`,_e)).json()}catch(et){console.error("postProfileSwitchError: ",et)}return{}}async function postAuthLogoutV2(){console.log("inside postAuthLogoutV2 api call");const a=new Headers;a.append("Content-Type","application/json");const _=JSON.stringify({}),_e=`${GET_AORTA_GO_HOST()}/v2/auth/logout`,et={method:"POST",headers:a,body:_,redirect:"follow",credentials:"include"};try{const tt=await fetchWrapper(_e,et);return tt.ok?!0:(console.log("Logout failed with status",tt==null?void 0:tt.status),!1)}catch(tt){return console.error("Logout API failed:",tt),!1}}async function postAbdmLoginInit({method:a,identifier:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({method:a,identifier:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/na/v1/profile/login/init`,et)).json()}catch(tt){console.error("postAbdmLoginInit error =>",tt)}return{}}async function postAbdmLoginVerify({txn_id:a,otp:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({txn_id:a,otp:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/na/v1/profile/login/verify`,et)).json()}catch(tt){console.error("postAbdmLoginVerify error =>",tt)}return{}}async function postRegisterAadhaarInit({aadhaar_number:a}){const _=new Headers;_.append("Content-Type","application/json");const $=JSON.stringify({aadhaar_number:a}),_e={method:"POST",headers:_,body:$,redirect:"follow",credentials:"include"};try{const et=GET_NDHM_HOST();return await(await fetchWrapper(`${et}/abdm/na/v1/registration/aadhaar/init`,_e)).json()}catch{}return{}}async function postRegisterMobileInit({mobile_number:a}){const _=new Headers;_.append("Content-Type","application/json");const $=JSON.stringify({mobile_number:a}),_e={method:"POST",headers:_,body:$,redirect:"follow",credentials:"include"};try{const et=GET_NDHM_HOST();return await(await fetchWrapper(`${et}/abdm/na/v1/registration/mobile/init`,_e)).json()}catch(et){console.error(et)}return{}}async function postRegisterAadhaarVerify({txn_id:a,mobile:_,otp:$}){const _e=new Headers;_e.append("Content-Type","application/json");const et=JSON.stringify({txn_id:a,mobile:_,otp:$}),tt={method:"POST",headers:_e,body:et,redirect:"follow",credentials:"include"};try{const rt=GET_NDHM_HOST();return await(await fetchWrapper(`${rt}/abdm/na/v1/registration/aadhaar/verify`,tt)).json()}catch{}return{}}async function postRegisterAadhaarMobileVerify({txn_id:a,otp:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({txn_id:a,otp:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/na/v1/registration/aadhaar/mobile/verify`,et)).json()}catch{}return{}}async function postRegisterAadhaarResendOtp({txn_id:a}){const _=new Headers;_.append("Content-Type","application/json");const $=JSON.stringify({txn_id:a}),_e={method:"POST",headers:_,body:$,redirect:"follow",credentials:"include"};try{const et=GET_NDHM_HOST();return await(await fetchWrapper(`${et}/abdm/na/v1/registration/aadhaar/resend`,_e)).json()}catch{}return{}}async function postRegisterAadhaarMobileResendOtp({txn_id:a}){const _=new Headers;_.append("Content-Type","application/json");const $=JSON.stringify({txn_id:a}),_e={method:"POST",headers:_,body:$,redirect:"follow",credentials:"include"};try{const et=GET_NDHM_HOST();return await(await fetchWrapper(`${et}/abdm/na/v1/registration/aadhaar/mobile/resend`,_e)).json()}catch{}return{}}async function postRegisterAadhaarCreatePhr({abha_address:a,txn_id:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({abha_address:a,txn_id:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/na/v1/registration/aadhaar/create-phr`,et)).json()}catch(tt){console.error("postRegisterAadhaarCreatePhr ==>",tt)}return{}}async function postAbdmRegisterMobileCreatePhr({abha_address:a,address:_,first_name:$,last_name:_e,day_of_birth:et,month_of_birth:tt,year_of_birth:rt,gender:nt,middle_name:it,pincode:at,txn_id:st}){const ct=new Headers;ct.append("Content-Type","application/json");const ot=JSON.stringify({abha_address:a,profile:{address:_,day_of_birth:et,first_name:$,gender:nt,last_name:_e,middle_name:it,month_of_birth:tt,pincode:at,year_of_birth:rt},txn_id:st}),pt={method:"POST",headers:ct,body:ot,redirect:"follow",credentials:"include"};try{const ht=GET_NDHM_HOST();return await(await fetchWrapper(`${ht}/abdm/na/v1/registration/mobile/create-phr`,pt)).json()}catch(ht){console.error("postAbdmRegisterMobileCreatePhr error =>",ht)}return{}}async function postAbdmProfileLoginPhr({txn_id:a,phr_address:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({txn_id:a,phr_address:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/na/v1/profile/login/phr`,et)).json()}catch(tt){console.error("postAbdmProfileLoginPhr error =>",tt)}return{}}async function getAbdmRegisterSuggest({txn_id:a,fn:_,mn:$,ln:_e,dob:et}){const tt=new Headers;tt.append("Content-Type","application/json");const rt={method:"GET",headers:tt,redirect:"follow",credentials:"include"};try{const nt=GET_NDHM_HOST();return await(await fetchWrapper(`${nt}/abdm/na/v1/registration/suggest?transactionId=${a}&fn=${_||""}&mn=${$||""}&ln=${_e||""}&dob=${et||""}`,rt)).json()}catch(nt){console.error("postAbdmLoginVerify error =>",nt)}return{}}async function postAbdmRegisterAbhaNumberCreatePhr({abha_address:a,txn_id:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({abha_address:a,txn_id:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/na/v1/registration/abha-number/create-phr`,et)).json()}catch(tt){console.error("postAbdmRegisterAbhaNumberCreatePhr ==>",tt)}return{}}async function postAbdmRegisterPhrCheck({abha_address:a}){const _=new Headers;_.append("Content-Type","application/json");const $=JSON.stringify({abha_address:a}),_e={method:"POST",headers:_,body:$,redirect:"follow",credentials:"include"};try{const et=GET_NDHM_HOST();return await(await fetchWrapper(`${et}/abdm/na/v1/registration/phr/check`,_e)).json()}catch(et){console.error("postAbdmRegisterPhrCheck ==>",et)}return{}}async function postAbdmProfileEka({abha_address:a,address:_,first_name:$,last_name:_e,day_of_birth:et,month_of_birth:tt,year_of_birth:rt,gender:nt,middle_name:it,pincode:at}){const st=new Headers;st.append("Content-Type","application/json");const ct=JSON.stringify({abha_address:a,profile:{address:_,day_of_birth:et,first_name:$,gender:nt,last_name:_e,middle_name:it,month_of_birth:tt,pincode:at,year_of_birth:rt}}),ot={method:"POST",headers:st,body:ct,redirect:"follow",credentials:"include"};try{const pt=GET_NDHM_HOST();return await(await fetchWrapper(`${pt}/abdm/v1/profile/eka`,ot)).json()}catch(pt){console.error("postAbdmProfileEka error =>",pt)}return{}}async function postAbdmProfileEkaLinkPhr({abha_address:a,oid:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({abha_address:a,oid:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/v1/profile/eka/link-phr`,et)).json()}catch(tt){console.error("postAbdmProfileLinkPhr ==>",tt)}return{}}async function postAbdmRegisterMobileVerify({txn_id:a,otp:_}){const $=new Headers;$.append("Content-Type","application/json");const _e=JSON.stringify({txn_id:a,otp:_}),et={method:"POST",headers:$,body:_e,redirect:"follow",credentials:"include"};try{const tt=GET_NDHM_HOST();return await(await fetchWrapper(`${tt}/abdm/na/v1/registration/mobile/verify`,et)).json()}catch{}return{}}async function postAbdmRegisterMobileResendOtp({txn_id:a}){const _=new Headers;_.append("Content-Type","application/json");const $={method:"POST",headers:_,body:JSON.stringify({txn_id:a}),redirect:"follow",credentials:"include"};try{const _e=GET_NDHM_HOST();return await(await fetchWrapper(`${_e}/abdm/na/v1/registration/mobile/resend`,$)).json()}catch{}return{}}async function getPincodeDetails({pincode:a}){const $=`${GET_NDHM_HOST()}/abdm/na/v1/registration/pincode/${a}`,_e=new Headers;_e.append("Content-Type","application/json");const et={method:"GET",headers:_e,redirect:"follow",credentials:"include"};try{return await(await fetchWrapper($,et)).json()}catch(tt){console.error(tt)}return{}}var reactDom={exports:{}},reactDom_production_min={},scheduler={exports:{}},scheduler_production_min={};/**
18
18
  * @license React
19
19
  * scheduler.production.min.js
20
20
  *
@@ -143,4 +143,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
143
143
  pds2-transition-colors pds2-duration-200
144
144
  `,tabIndex:-1,ref:et,children:jsxRuntimeExports.jsx("p",{className:`${$?"pds2-text-text-brand Body2Semibold":"pds2-text-text-01 Body2Medium"}`,children:a})})}const CreateEkaProfileScreen=()=>{const a=useAuthAbhaStore(xt=>xt.screen),_=useAuthAbhaStore(xt=>xt.selectedAbhaAddress),$=useAuthAbhaStore(xt=>xt.setBottomsheetErrorInfo),_e=useAuthAbhaStore(xt=>xt.clearAbhaAuthStore),et=useAuthAbhaStore(xt=>xt.goBackLoginScreen),[tt,rt]=reactExports.useState(LOADING_STATE.IDLE),[nt,it]=reactExports.useState({firstname:"",lastname:"",date_of_birth:"",pincode:"",gender:""}),[at,st]=reactExports.useState({firstname:"",lastname:"",date_of_birth:"",pincode:"",gender:""}),[ct,ot]=reactExports.useState(null),{mutateAsync:pt}=usePostProfileSwitch(),[ht,ft]=reactExports.useState(!1),gt=useAuthAbhaStore(xt=>xt.ekaProfileInfo),lt=useAuthAbhaStore(xt=>xt.setEkaProfileInfo),dt=useAuthAbhaStore(xt=>xt.setScreen),ut=a[a.length-1],mt=useAuthAbhaStore(xt=>xt.aadhaarVerificationSkipStateStatus),yt=queryClient.getQueryData(["abdmProfilePhrResponse"]),Et=useAuthAbhaStore(xt=>xt.abhaAuthFlowMethod);reactExports.useState({firstname:"",lastname:"",date_of_birth:"",pincode:"",gender:""}),useAuthAbhaStore(xt=>xt.isDocAppRequest);const St=useAuthAbhaStore(xt=>xt.clientId),At=useAuthAbhaStore(xt=>xt.isEkaAppLogin),Mt=useAuthAbhaStore(xt=>xt.isNewLoginOrCreateFlow),Nt=useAuthAbhaStore(xt=>xt.txnId),Rt=GET_EXTRA_HEADERS(),[Pt,Lt]=reactExports.useState(null),Ot=useAuthAbhaStore(xt=>xt.abhaAuthFlowMethod),Tt=({name:xt,data:Ct={}})=>{var kt,It;const Dt={...{login_platform:St,is_eka_app_login:At?"true":"false",is_new_login_or_create_flow:Mt?"true":"false",txn_id:Nt||"missing txnId",oid:Rt!=null&&Rt["X-User-ID"]?"true":"false",access_token:Rt!=null&&Rt.auth?"true":"false",flow:Ot??""},...Ct};handleSendEvent({eventName:xt,eventData:Dt}),(It=(kt=window.curio)==null?void 0:kt.pushToMixpanel)==null||It.call(kt,xt,Dt)};reactExports.useEffect(()=>{Tt({name:"page_view",data:{page_view:"create_profile_screen"}})},[St]),reactExports.useEffect(()=>{var xt;if((xt=window.EkaAbha)!=null&&xt.changeStatusBarColor)return window.EkaAbha.changeStatusBarColor("#F2F4F7"),()=>{var Ct,wt;(Ct=window.EkaAbha)!=null&&Ct.changeStatusBarColor&&((wt=window==null?void 0:window.EkaAbha)==null||wt.changeStatusBarColor("#FFFFFF"))}},[]),reactExports.useEffect(()=>{if(yt){const{first_name:xt,last_name:Ct,gender:wt,pincode:Dt,day_of_birth:kt,month_of_birth:It,year_of_birth:jt}=yt,$t=kt===0?1:kt,Bt=`${jt}-${String(It===0?1:It).padStart(2,"0")}-${String($t).padStart(2,"0")}`;Tt({name:"profile_data_set_from_phr_cache",data:{source:"phr_cache",date_of_birth:Bt,firstname:xt??"missing",lastname:Ct??"missing",gender:wt??"missing",pincode:Dt??"missing",dob_day:kt??"missing",dob_month:It??"missing",dob_year:jt??"missing",flow:Ot??""}}),it({firstname:xt,lastname:Ct,gender:wt,pincode:Dt,date_of_birth:Bt});return}if(gt){let xt="1983",Ct="01",wt="01";if(gt.date_of_birth){const kt=gt.date_of_birth.split("-");xt=kt[0],Ct=kt[1]==="00"||!kt[1]?"01":kt[1],wt=kt[2]==="00"||!kt[2]?"01":kt[2]}const Dt=`${xt}-${String(Ct).padStart(2,"0")}-${String(wt).padStart(2,"0")}`;it({firstname:gt.firstname,lastname:gt.lastname,gender:gt.gender,pincode:gt.pincode,date_of_birth:Dt,oid:gt.oid}),Tt({name:"profile_data_set_from_eka_profile",data:{source:"eka_profile",date_of_birth:(gt==null?void 0:gt.date_of_birth)??"missing",firstname:(gt==null?void 0:gt.firstname)??"missing",lastname:(gt==null?void 0:gt.lastname)??"missing",gender:(gt==null?void 0:gt.gender)??"missing",pincode:(gt==null?void 0:gt.pincode)??"missing",oid:(gt==null?void 0:gt.oid)??"missing"}})}},[yt,gt]);const _t=reactExports.useMemo(()=>!!(nt.firstname&&!at.firstname&&nt.date_of_birth&&!at.date_of_birth&&nt.pincode&&!at.pincode&&nt.gender&&!at.gender),[nt,at]),bt=async()=>{var Ct,wt,Dt,kt;const xt={firstname:"",lastname:"",date_of_birth:"",pincode:"",gender:""};if(st(xt),nt.firstname.trim()||(xt.firstname="Enter Name"),nt.lastname.trim()||(xt.lastname="This field is required"),nt.date_of_birth||(xt.date_of_birth="Enter DOB"),nt.gender||(xt.gender="Select Gender"),nt.pincode||(xt.pincode="Enter Valid Pincode"),!!_t){if(Tt({name:"create_profile_screen_clicks",data:{type:"create_profile"}}),rt(LOADING_STATE.LOADING),ut===SCREEN_NAMES.CREATE_EKA_PROFILE){if(Tt({name:"navigate_to_create_abha_address_screen",data:{type:"next",pincode_entered:(nt==null?void 0:nt.pincode)??"unknown",eka_profile_info_pincode:(gt==null?void 0:gt.pincode)??"unknown",flow_type:Et||"unknown_method"}}),Et===ABHA_AUTH_FLOW_METHOD.MOBILE){const It=await getPincodeDetails({pincode:Number(nt.pincode)});if(It!=null&&It.error){Lt(It!=null&&It.error?"Invalid Pincode":null),rt(LOADING_STATE.REJECTED),Tt({name:"pincode_api_failed",data:{type:"error",error:It==null?void 0:It.error}});return}if(Tt({name:"pincode_api_success",data:{type:"verify",pincode_received:!!It.pincode,txn_id:Nt}}),It!=null&&It.pincode){ot(null),lt(nt),Tt({name:"eka_profile_info_set",data:{firstname:nt==null?void 0:nt.firstname,lastname:nt==null?void 0:nt.lastname,gender:nt==null?void 0:nt.gender,pincode:nt==null?void 0:nt.pincode,date_of_birth:nt==null?void 0:nt.date_of_birth}}),dt(SCREEN_NAMES.CREATE_ABHA_ADDRESS);return}Tt({name:"no_action_on_pincode",data:{type:"verify",pincode_entered:!!It.pincode,txn_id:Nt}});return}else if(Et===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER){lt(nt),Tt({name:"eka_profile_info_set",data:{firstname:nt==null?void 0:nt.firstname,lastname:nt==null?void 0:nt.lastname,gender:nt==null?void 0:nt.gender,pincode:nt==null?void 0:nt.pincode,date_of_birth:nt==null?void 0:nt.date_of_birth}}),dt(SCREEN_NAMES.CREATE_ABHA_ADDRESS);return}}if(ut===SCREEN_NAMES.CREATE_PHR_EKA_PROFILE){if(!_){Tt({name:"abha_create_eka_profile_abha_address_missing",data:{platform:St}});return}const[It,jt,$t]=nt.date_of_birth?(Ct=nt==null?void 0:nt.date_of_birth)==null?void 0:Ct.split("-"):["","",""],Kt={abha_address:_,day_of_birth:parseInt($t),first_name:nt.firstname,gender:nt.gender,last_name:nt.lastname||"",month_of_birth:parseInt(jt),pincode:nt.pincode,year_of_birth:parseInt(It)};Tt({name:"profile_eka_process_started",data:{platform:St,date_of_birth:(nt==null?void 0:nt.date_of_birth)||null,dob_day:$t||null,dob_month:jt||null,dob_year:It||null}});const{error:Bt,eka:Ht,action:Vt}=await postAbdmProfileEka({...Kt});if(Vt){Tt({name:"profile_eka_process_failed",data:{platform:St,error_message:((wt=Vt==null?void 0:Vt.cta)==null?void 0:wt.title)||"unknown_error",error_message_exists:!!((Dt=Vt==null?void 0:Vt.cta)!=null&&Dt.title)}}),$(Vt);return}if(Bt||!Ht||!Ht.oid){Tt({name:"profile_process_failed",data:{platform:St,error_message:Bt||"Unknown error",eka_oid:(Ht==null?void 0:Ht.oid)||"missing",eka_exists:!!Ht,date_of_birth:(nt==null?void 0:nt.date_of_birth)||"missing",dob_day:$t||"missing",dob_month:jt||"missing",dob_year:It||"missing",parsed_date_valid:!!(parseInt($t)&&parseInt(jt)&&parseInt(It)),firstname:(nt==null?void 0:nt.firstname)||"missing",gender:(nt==null?void 0:nt.gender)||"missing",pincode:(nt==null?void 0:nt.pincode)||"missing"}}),rt(LOADING_STATE.REJECTED),ot(Bt||"Something went wrong. Please try again.");return}Tt({name:"profile_eka_process_success",data:{platform:St,eka:Ht}}),Tt({name:"profile_switch_process_started",data:{platform:St,error_message:Bt,eka:Ht}});const Qt=await pt({oid:Ht.oid});if(Qt.error){Tt({name:"profile_switch_process_failed",data:{platform:St,error_message:Qt.error||"Something went wrong, please try again",error_message_exists:!!Qt.error}}),rt(LOADING_STATE.REJECTED),ot(((kt=Qt.error)==null?void 0:kt.message)||"Something went wrong, please try again");return}Tt({name:"profile_switch_process_success",data:{platform:St,eka:Ht}}),rt(LOADING_STATE.RESOLVED);return}}},vt=()=>{et();const xt=useAuthAbhaStore.getState().isEkaAppLogin;_e(),useAuthAbhaStore.setState({isEkaAppLogin:xt})};return jsxRuntimeExports.jsxs("div",{className:"pds2-w-full pds2-flex pds2-flex-col pds2-bg-bg-01 pds2-h-full",children:[jsxRuntimeExports.jsx(Pds2Header,{title:"Create ABHA Address",prefixIcon:jsxRuntimeExports.jsx("button",{className:"pds2-w-24 pds2-h-24 pds2-rounded-full pds2-flex pds2-items-center pds2-justify-center ripple",onClick:()=>ft(!0),children:jsxRuntimeExports.jsx(n$2,{className:""})}),className:"pds2-bg-bg-white"}),jsxRuntimeExports.jsx(AbhaStepper,{}),jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-flex-col pds2-flex-1 pds2-p-8 pds2-overflow-y-auto",children:[jsxRuntimeExports.jsx("div",{className:"pds2-flex pds2-items-center pds2-justify-between"}),jsxRuntimeExports.jsx(UserDetailsForm,{profileData:nt,setProfileData:it,error:at,setError:st,pincodeApiError:Pt})]}),ct&&jsxRuntimeExports.jsx("div",{className:"pds2-p-16 pds2-text-text-error pds2-text-center",children:ct}),jsxRuntimeExports.jsxs("div",{className:"pds2-sticky pds2-bottom-0 pds2-bg-bg-white pds2-w-full",children:[_&&mt===ABHA_V3_SKIP_STATES.ABHA_END?jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-items-center pds2-justify-between pds2-w-full pds2-px-16 pds2-py-6 pds2-bg-border-brand-02",children:[jsxRuntimeExports.jsxs("div",{className:"",children:[jsxRuntimeExports.jsx("span",{className:"pds2-text-text-03 Body2Regular",children:"Creating for: "}),jsxRuntimeExports.jsx("span",{className:"pds2-text-text-01 Body2Semibold",children:_})]}),jsxRuntimeExports.jsx("button",{onClick:et,className:"Body2Semibold pds2-text-text-brand pds2-rounded-full ripple pds2-px-8 pds2-py-2",children:"Change"})]}):null,jsxRuntimeExports.jsx("div",{className:"pds2-p-16 pds2-w-full",children:jsxRuntimeExports.jsx(Pds2Button,{className:"pds2-w-full",title:"Create Profile",state:tt===LOADING_STATE.LOADING?"disabled":"enabled",onClick:bt,isLoading:tt===LOADING_STATE.LOADING})})]}),jsxRuntimeExports.jsx(AbhaErrorBottomSheet,{onSubmitClick:vt}),jsxRuntimeExports.jsx(ExitPopup,{open:ht,setOpen:ft})]})},genders=[{id:"M",name:"Male"},{id:"F",name:"Female"},{id:"O",name:"Other"}],UserDetailsForm=({profileData:a,setProfileData:_,error:$,setError:_e,pincodeApiError:et})=>{const tt=({event:st,name:ct})=>{const ot=st.target.value;let pt="";switch(ct){case"firstname":ot.trim()?pt="":pt="This field is required";break;case"lastname":!ot||ot.length<0?pt="This field is required":pt="";break;case"pincode":!ot||isNaN(Number(ot))||ot.length!=6?pt="Pincode must consist of exactly 6 digits":pt="";break;case"date_of_birth":!ot||ot>new Date().toISOString().split("T")[0]?pt="Date of Birth is invalid":pt="";break}_e({...$,[ct]:pt}),_({...a,[ct]:ot})},rt=st=>{_({...a,gender:st}),_e({...$,gender:""})},nt=(st,ct)=>ct!=null&&ct.pincode||!((st.firstname??"").trim()!==""&&(st.gender??"").trim()!==""&&(st.date_of_birth??"").trim()!=="")?!1:!st.pincode||(st.pincode+"").length!==6,it=useAuthAbhaStore(st=>st.ekaProfileInfo),at=useAuthAbhaStore(st=>st.abhaAuthFlowMethod);return jsxRuntimeExports.jsxs("form",{className:"pds2-flex pds2-flex-col pds2-space-y-32 pds2-pt-16 pds2-px-16",children:[jsxRuntimeExports.jsxs("label",{className:"pds2-space-y-8",children:[jsxRuntimeExports.jsxs("div",{className:"Body3Medium pds2-text-text-04",children:["Your name",jsxRuntimeExports.jsx("span",{className:"pds2-text-text-error Body3Semibold",children:"*"})]}),jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-gap-8",children:[jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-flex-col",children:[jsxRuntimeExports.jsx(Pds2InputField,{isMandatory:!0,textColor:"pds2-text-text-01",padding:"pds2-px-16 pds2-py-12",borderRadius:"pds2-rounded-12",borderStyle:"focus-within:pds2-ring-2 focus-within:pds2-ring-border-brand-01 focus-within:pds2-ring-offset-2",placeholder:"Firstname",value:a.firstname,onChange:st=>tt({event:st,name:"firstname"}),autoCapitalize:"on",disabled:!!(it!=null&&it.firstname)&&at===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER,error:$.firstname}),$.firstname&&jsxRuntimeExports.jsx("div",{className:"Body3Medium pds2-text-text-error pds2-mt-4",children:$.firstname})]}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Pds2InputField,{textColor:"pds2-text-text-01",padding:"pds2-px-16 pds2-py-12",borderRadius:"pds2-rounded-12",borderStyle:"focus-within:pds2-ring-2 focus-within:pds2-ring-border-brand-01 focus-within:pds2-ring-offset-2",placeholder:"Lastname",value:a.lastname,onChange:st=>tt({event:st,name:"lastname"}),autoCapitalize:"on",disabled:!!(it!=null&&it.lastname)&&at===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER})})]})]}),jsxRuntimeExports.jsxs("div",{className:"pds2-space-y-8",children:[jsxRuntimeExports.jsxs("div",{className:"pds2-space-y-4",children:[jsxRuntimeExports.jsxs("div",{className:"Body3Medium pds2-text-text-04",children:["Gender",jsxRuntimeExports.jsx("span",{className:"pds2-text-text-error Body3Semibold",children:"*"})]}),jsxRuntimeExports.jsx("div",{className:"pds2-flex pds2-gap-16",children:genders.map((st,ct)=>jsxRuntimeExports.jsx("div",{className:`${$.gender?"pds2-border-2 pds2-rounded-12 pds2-border-text-error placeholder:pds2-text-text-error":"focus-within:pds2-ring-2 focus-within:pds2-ring-border-brand-01 focus-within:pds2-ring-offset-2 placeholder:pds2-text-text-04"}`,children:jsxRuntimeExports.jsx(Pds2SingleInputChip,{isSelected:st.id===a.gender,title:st.name,onSelect:()=>rt(st.id)})},ct))}),$.gender&&jsxRuntimeExports.jsx("div",{className:"Body3Medium pds2-text-text-error pds2-mt-2",children:$.gender})]}),jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-flex-col",children:[jsxRuntimeExports.jsx(Pds2InputField,{label:"Date of Birth",isMandatory:!0,textColor:"pds2-text-text-01",padding:"pds2-px-16 pds2-py-12",borderRadius:"pds2-rounded-12",borderStyle:"focus-within:pds2-ring-2 focus-within:pds2-ring-border-brand-01 focus-within:pds2-ring-offset-2",value:a.date_of_birth,disabled:!!(it!=null&&it.date_of_birth)&&at===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER,onChange:st=>tt({event:st,name:"date_of_birth"}),type:"date",maxDate:new Date().toISOString().split("T")[0],error:$.date_of_birth}),$.date_of_birth&&jsxRuntimeExports.jsx("div",{className:"Body3Medium pds2-text-text-error pds2-mt-2",children:$.date_of_birth})]})]}),jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-flex-col pds2-space-y-4",children:[jsxRuntimeExports.jsx(Pds2InputField,{label:"Pincode",isMandatory:!0,textColor:"pds2-text-text-01",padding:"pds2-px-16 pds2-py-12",borderRadius:"pds2-rounded-12",borderStyle:nt(a,it)||et?"pds2-border-1 pds2-border-text-error":"",value:a.pincode,placeholder:"Enter Pincode",disabled:!!(it!=null&&it.pincode)&&at===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER,onChange:st=>{st.target.value.length>6||tt({event:st,name:"pincode"})},type:"number",error:nt(a,it)?$.pincode:"",textStyle:nt(a,it)||et?"placeholder:pds2-text-text-error":"placeholder:pds2-text-text-04"}),et||$.pincode&&jsxRuntimeExports.jsx("div",{className:"Body3Medium pds2-text-text-error pds2-mt-4",children:$.pincode})]})]})},useGetProfilesPhrUser=()=>useQuery({queryKey:["profilesPhrUserResponse"],queryFn:async()=>{const a=await getProfilePhrUser();var _;return Array.isArray(a)?_=a==null?void 0:a.filter(_e=>!_e["health-ids"]||_e["health-ids"].length===0):_=[],{profiles:_}}}),GetAllProfilesScreen=()=>{const a=useAuthAbhaStore(ft=>ft.setScreen);useAuthAbhaStore(ft=>ft.screen),useAuthAbhaStore(ft=>ft.goBackLoginScreen),useAuthAbhaStore(ft=>ft.clearAbhaAuthStore);const[_,$]=reactExports.useState(!1);reactExports.useState("");const _e=useAuthAbhaStore(ft=>ft.clientId),et=useAuthAbhaStore(ft=>ft.aadhaarVerificationSkipStateStatus),tt=useAuthAbhaStore(ft=>ft.isEkaAppLogin),rt=useAuthAbhaStore(ft=>ft.isNewLoginOrCreateFlow),nt=useAuthAbhaStore(ft=>ft.txnId),it=GET_EXTRA_HEADERS(),at=useAuthAbhaStore(ft=>ft.abhaAuthFlowMethod),st=({name:ft,data:gt={}})=>{var ut,mt;const dt={...{login_platform:_e,is_eka_app_login:tt?"true":"false",is_new_login_or_create_flow:rt?"true":"false",txn_id:nt||"missing txnId",oid:it!=null&&it["X-User-ID"]?"true":"false",access_token:it!=null&&it.auth?"true":"false",flow:at??""},...gt};handleSendEvent({eventName:ft,eventData:dt}),(mt=(ut=window.curio)==null?void 0:ut.pushToMixpanel)==null||mt.call(ut,ft,dt)};reactExports.useEffect(()=>{if(_e==="doctor"){st({name:"page_view",data:{platform:_e,page_view:"get-all-profiles-screen"}}),st({name:"redirect_to_create_eka_profile_screen",data:{type:"next"}}),a(SCREEN_NAMES.CREATE_EKA_PROFILE);return}},[_e]);let ct=!1;tt?ct=!1:tt||(_e==="doctor"?ct=!1:ct=!0);const{data:ot,error:pt,isLoading:ht}=ct?useGetProfilesPhrUser():{data:null,error:null,isLoading:!1};return reactExports.useEffect(()=>{if(_e==="doctor")return;(async()=>{!ht&&ot&&($(!0),await new Promise(gt=>setTimeout(gt,2e3)),$(!1),!ot.profiles||ot.profiles.length<1?et===ABHA_V3_SKIP_STATES.ABHA_END?(st({name:"redirect_to_create_phr_eka_profile_screen",data:{type:"next",skip_state:et}}),a(SCREEN_NAMES.CREATE_PHR_EKA_PROFILE)):(st({name:"redirect_to_create_eka_profile_screen",data:{type:"next",skip_state:et}}),a(SCREEN_NAMES.CREATE_EKA_PROFILE)):(st({name:"redirect_to_select_eka_profile_screen",data:{type:"next",skip_state:et}}),a(SCREEN_NAMES.SELECT_EKA_PROFILE)))})()},[ht,ot]),_?jsxRuntimeExports.jsx(AbhaVerificationStatus,{loading:!0,loadingText:"In progress...",successText:""}):null},LoginWithAbhaScreen=()=>{const a=useAuthAbhaStore(tt=>tt.setAbhaAuthFlowMethod),_=useAuthAbhaStore(tt=>tt.clientId),$=useAuthAbhaStore(tt=>tt.clearAbhaAuthStore);reactExports.useEffect(()=>{var tt;if(handleSendEvent({eventName:"page_view",eventData:{page_view:"abha_login_screen",platform:_}}),a(ABHA_AUTH_FLOW_METHOD.MOBILE),(tt=window.EkaAbha)!=null&&tt.changeStatusBarColor)return window.EkaAbha.changeStatusBarColor("#F2F4F7"),()=>{var rt,nt;(rt=window.EkaAbha)!=null&&rt.changeStatusBarColor&&((nt=window==null?void 0:window.EkaAbha)==null||nt.changeStatusBarColor("#FFFFFF"))}},[]);const _e=()=>{var rt;(rt=window.EkaAbha)==null||rt.onAbhaClose();const tt=useAuthAbhaStore.getState().isNewLoginOrCreateFlow;$(),useAuthAbhaStore.setState({isNewLoginOrCreateFlow:tt}),unMount()},et=["eka-web","phr"];return jsxRuntimeExports.jsxs("div",{className:"pds2-bg-bg-white pds2-h-full",children:[!et.includes(_)&&jsxRuntimeExports.jsx(Pds2Header,{prefixIcon:jsxRuntimeExports.jsx("button",{onClick:_e,children:jsxRuntimeExports.jsx(n$2,{})}),title:"",className:"pds2-bg-bg-01"}),jsxRuntimeExports.jsx(AbhaStepper,{}),jsxRuntimeExports.jsx(LoginWithDifferentMethods,{}),jsxRuntimeExports.jsx(OtherLoginMethods,{})]})},OtherLoginMethods=()=>{const a=useAuthAbhaStore(_e=>_e.setAbhaAuthFlowMethod),_=useAuthAbhaStore(_e=>_e.abhaAuthFlowMethod),$=[{method:ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER,title:"ABHA Number",icon:jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4ml1lwu00000tfs1okl7hs9.webp",alt:"ABHA Number Icon",className:"pds2-h-24 pds2-w-24",loading:"lazy"})},{method:ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS,title:"ABHA Address",icon:jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4ml1lwu00000tfs1okl7hs9.webp",alt:"ABHA Address Icon",className:"pds2-h-24 pds2-w-24",loading:"lazy"})},{method:ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER,title:"Aadhaar Number",icon:jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm5mcdm3h00070tfs9fjkepff.webp",alt:"Aadhaar Number Icon",className:"pds2-h-24 pds2-w-24",loading:"lazy"})},{method:ABHA_AUTH_FLOW_METHOD.MOBILE,title:"Mobile Number",icon:jsxRuntimeExports.jsx(n$1,{className:"pds2-w-20 pds2-h-20 pds2-text-icon-success-02"})}];return jsxRuntimeExports.jsxs("div",{className:"pds2-p-16 pds2-space-y-16",children:[jsxRuntimeExports.jsx(TextSeparator,{title:"Other login options for ABHA"}),jsxRuntimeExports.jsx("div",{className:"pds2-space-y-16",children:$.filter(_e=>_e.method!==_).map(_e=>jsxRuntimeExports.jsx(Pds2CustomButton,{prefixIcon:_e.icon,title:_e.title,suffixIcon:jsxRuntimeExports.jsx(c$2,{className:"pds2-ml-auto pds2-h-16 pds2-w-16 pds2-text-text-04 -pds2-rotate-90","aria-hidden":"true"}),onClick:()=>a(_e.method)},_e.method))})]})},LoginWithDifferentMethods=()=>{const a=useAuthAbhaStore(Lt=>Lt.setScreen),_=useAuthAbhaStore(Lt=>Lt.abhaAuthFlowMethod||ABHA_AUTH_FLOW_METHOD.MOBILE),$=useAuthAbhaStore(Lt=>Lt.setRegistrationType),_e=useAuthAbhaStore(Lt=>Lt.setAadhaarInitResponse),[et,tt]=reactExports.useState(""),[rt,nt]=reactExports.useState(""),[it,at]=reactExports.useState(LOADING_STATE.IDLE),st=useAuthAbhaStore(Lt=>Lt.setLoginIdentifierValue),ct=useAuthAbhaStore(Lt=>Lt.setSelectedAbhaAddress),[ot,pt]=reactExports.useState(!1),ht=useAuthAbhaStore(Lt=>Lt.initAbhaAppMobileNumber),ft=useAuthAbhaStore(Lt=>Lt.setBottomsheetErrorInfo),[gt,lt]=React.useState(null),[dt,ut]=reactExports.useState(""),mt=useAuthAbhaStore(Lt=>Lt.clientId),yt=useAuthAbhaStore(Lt=>Lt.isEkaAppLogin);reactExports.useEffect(()=>{if(ht&&_===ABHA_AUTH_FLOW_METHOD.MOBILE){tt(ht),pt(ht.length===10),nt(null);return}tt(""),nt(null),pt(!1)},[_]);const Et=Lt=>{rt&&nt(null);const Ot=Lt.target.value;switch(_){case ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS:if(Ot.length>20)return;break;case ABHA_AUTH_FLOW_METHOD.MOBILE:if(Ot&&!/^[0-9]+$/.test(Ot)||Ot.length>10)return;break;case ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER:if(!/^[\d-]*$/.test(Ot)||Ot.length>17)return;break;case ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER:if(Ot&&!/^[0-9]+$/.test(Ot)||Ot.length>12)return;break}if(_===ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER){const Tt=Lt.target.value.replace(/-/g,"");let _t="";Tt.length>0&&(_t+=Tt.slice(0,2)),Tt.length>2&&(_t+=`-${Tt.slice(2,6)}`),Tt.length>6&&(_t+=`-${Tt.slice(6,10)}`),Tt.length>10&&(_t+=`-${Tt.slice(10,14)}`),tt(_t)}else tt(Ot.trim())},St=({inputVal:Lt})=>{rt&&nt(null),Lt.length===12&&tt(Lt)},At=reactExports.useCallback(()=>{const Lt=_===ABHA_AUTH_FLOW_METHOD.MOBILE&&!!ht;if(_===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER)return jsxRuntimeExports.jsx(SpacedInputComponent,{numberOfInputs:3,length:4,placeholder:"XXXX",onSubmit:St});const Ot={value:et,onChange:Et,..._===ABHA_AUTH_FLOW_METHOD.MOBILE&&{type:"tel",placeholder:"Mobile Number",disabled:Lt,PrefixComponent:jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-items-center pds2-gap-x-8 pds2-border-r pds2-border-border-brand-02 pds2-pr-24",children:[jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4mlct2900000tg98p8u967s.webp",alt:"India Flag",className:"pds2-w-24 pds2-h-24"}),jsxRuntimeExports.jsx("span",{className:"pds2-text-text-black",children:"+91"})]})},..._===ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER&&{placeholder:"00-0000-0000-0000",padding:"pds2-p-18",textStyle:"Body2Regular pds2-text-center pds2-text-lg",borderStyle:"focus-within:pds2-border-border-brand-01",type:"tel"},..._===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS&&{placeholder:"Enter ABHA Address"}};return jsxRuntimeExports.jsx(Pds2InputField,{...Ot})},[_,et,rt]),Mt=(Lt=gt)=>{Lt&&(useAuthAbhaStore.setState({isLoggedInFromRedirect:!0}),ut(et),useAuthAbhaStore.setState({initAbhaAppMobileNumber:et}),useAuthAbhaStore.setState({abhaAuthFlowMethod:ABHA_AUTH_FLOW_METHOD.MOBILE}),a(SCREEN_NAMES.CREATE_ABHA_WITH_AADHAAR),ft(null))},Nt=async()=>{at(LOADING_STATE.LOADING);let Lt="";if(!yt){const{txn_id:xt,error:Ct}=await postAuthInitV2({method:AUTH_METHOD.ABHA});if(!xt||Ct){nt((Ct==null?void 0:Ct.message)||"Something went wrong. Please try again."),at(LOADING_STATE.REJECTED);return}Lt=xt,console.log("triggering logout api in login with abha screen"),await postAuthLogoutV2()}$(REGISTRATION_TYPE.LOGIN);const Ot=_===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS?`${et}@sbx`:et;console.log("loginIdentifier",Ot);const{txn_id:Tt,error:_t,action:bt,hint:vt}=await postAbdmLoginInit({method:_,identifier:Ot});if(console.log("after postAbdmLoginInit",bt),console.log("after postAbdmLoginInit",bt),bt){lt(bt),ft(bt);return}if(_t){nt(_t||"Something went wrong. Please try again."),at(LOADING_STATE.REJECTED);return}if(!Tt){nt("Something went wrong. Please try again."),at(LOADING_STATE.REJECTED);return}_===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS&&ct(Ot),_e({authTxnId:Lt,txnId:Tt,aadhaarOtpSentToHint:vt||null}),st(Ot),at(LOADING_STATE.RESOLVED),handleSendEvent({eventName:"abha_login_submitted",eventData:{type:"next",platform:mt}}),a(SCREEN_NAMES.VERIFY_OTP_LOGIN_WITH_ABHA)},Rt=React.useMemo(()=>{switch(_){case ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS:return et.length>=4&&et.length<=20;case ABHA_AUTH_FLOW_METHOD.MOBILE:return et.length===10;case ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER:return et.length===17;case ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER:return et.length===12}},[_,et]),Pt=React.useMemo(()=>{switch(_){case ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER:return"Enter your ABHA Number";case ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS:return"Enter your ABHA Address";case ABHA_AUTH_FLOW_METHOD.MOBILE:return"Enter your Mobile Number";case ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER:return"Enter your Aadhaar Number";default:return"Enter your ABHA Number"}},[_]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"pds2-p-16 pds2-bg-bg-01 pds2-space-y-12 pds2-text-center pds2-rounded-b-24",children:[jsxRuntimeExports.jsx("div",{className:"pds2-flex pds2-justify-center pds2-items-center pds2-gap-16",children:jsxRuntimeExports.jsx("div",{className:"pds2-bg-bg-white pds2-rounded-16",children:jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4ml1lwu00000tfs1okl7hs9.webp",alt:"abha",className:"pds2-w-64 pds2-h-64"})})}),jsxRuntimeExports.jsx("div",{className:"Heading3Semibold pds2-text-text-black",children:"Log in With ABHA"}),jsxRuntimeExports.jsx("div",{className:"pds2-text-text-black pds2-mt-2",children:Pt}),jsxRuntimeExports.jsx("div",{className:"pds2-space-y-12",children:jsxRuntimeExports.jsxs("div",{className:"pds2-relative",children:[At(),_===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS&&jsxRuntimeExports.jsx("div",{className:"pds2-absolute pds2-right-16 pds2-top-16 Body1Regular pds2-text-text-03",children:"@sbx"})]})}),rt&&jsxRuntimeExports.jsx("div",{className:"pds2-text-text-error Body3Regular",children:rt}),jsxRuntimeExports.jsx(Pds2Button,{title:"Next",IconComponent:()=>jsxRuntimeExports.jsx(c$2,{className:"pds2-w-16 pds2-h-16 -pds2-rotate-90 pds2-ml-8"}),state:!Rt||!ot||it===LOADING_STATE.LOADING?"disabled":"enabled",isLoading:it===LOADING_STATE.LOADING,onClick:Nt,className:"pds2-w-full"}),jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-flex-row pds2-justify-center pds2-items-center pds2-bg-bg-white pds2-w-fit pds2-px-12 pds2-bg-opacity-60 pds2-rounded-12 pds2-mx-auto",children:[jsxRuntimeExports.jsx("div",{className:"pds2-text-text-04 Body3Regular",children:"Don’t have ABHA?"}),jsxRuntimeExports.jsx(Pds2CustomButton,{className:"pds2-text-text-brand Body3Semibold pds2-pl-4 pds2-pr-0 pds2-py-4 ripple pds2-border-none pds2-bg-transparent",width:"pds2-w-fit",title:"Register Now",onClick:()=>{a(SCREEN_NAMES.CREATE_ABHA_WITH_AADHAAR)}})]})]}),jsxRuntimeExports.jsx(AbhaErrorBottomSheet,{onSubmitClick:Mt})]})},usePostAbdmProfileLoginPhr=()=>{const a=useAuthAbhaStore(_=>_.setSelectedAbhaAddress);return useMutation({mutationFn:({txn_id:_,phr_address:$})=>postAbdmProfileLoginPhr({txn_id:_,phr_address:$}),onSuccess(_){_.profile&&(queryClient.setQueryData(["abdmProfilePhrResponse"],_.profile),a(_.profile.abha_address))}})},SelectAbhaFromListScreen=()=>{var Kt;const[a,_]=reactExports.useState(null),$=useAuthAbhaStore(Bt=>Bt.setScreen),_e=useAuthAbhaStore(Bt=>Bt.goBackLoginScreen),et=useAuthAbhaStore(Bt=>Bt.txnId),tt=useAuthAbhaStore(Bt=>Bt.authTxnId),rt=useAuthAbhaStore(Bt=>Bt.abhaAddressList),nt=useAuthAbhaStore(Bt=>Bt.setBottomsheetErrorInfo),it=useAuthAbhaStore(Bt=>Bt.clearAbhaAuthStore),at=useAuthAbhaStore(Bt=>Bt.setSelectedAbhaAddress),st=useAuthAbhaStore(Bt=>Bt.abhaAuthFlowMethod);useAuthAbhaStore(Bt=>Bt.loginIdentifierValue);const[ct,ot]=reactExports.useState(""),[pt,ht]=reactExports.useState(!1),ft=useAuthAbhaStore(Bt=>Bt.setEkaProfileInfo),gt=useAuthAbhaStore(Bt=>Bt.setAbhaAuthFlowMethod),lt=useAuthAbhaStore(Bt=>Bt.setAadhaarVerificationSkipStateStatus),[dt,ut]=reactExports.useState(LOADING_STATE.IDLE),mt=["M","F","O","U"],{mutateAsync:yt}=usePostAuthVerifyV2(),{mutateAsync:Et}=usePostAbdmProfileLoginPhr(),St=useAuthAbhaStore(Bt=>Bt.ekaProfileInfo);useAuthAbhaStore(Bt=>Bt.registrationType);const At=useAuthAbhaStore(Bt=>Bt.clientId),Mt=useAuthAbhaStore(Bt=>Bt.isEkaAppLogin),Nt=useAuthAbhaStore(Bt=>Bt.setRegistrationType),Rt=useAuthAbhaStore(Bt=>Bt.abhaAuthFlowMethod),Pt=useAuthAbhaStore(Bt=>Bt.identityValue),Lt=useAuthAbhaStore(Bt=>Bt.setMobileInitResponse),[Ot,Tt]=reactExports.useState({aadhaar:LOADING_STATE.IDLE,mobile:LOADING_STATE.IDLE}),_t=useAuthAbhaStore(Bt=>Bt.setAadhaarInitResponse),bt=useAuthAbhaStore(Bt=>Bt.setSelectedAbhaFlow),vt=useAuthAbhaStore(Bt=>Bt.isNewLoginOrCreateFlow),xt=GET_EXTRA_HEADERS(),Ct=useAuthAbhaStore(Bt=>Bt.setLoginIdentifierValue),[wt,Dt]=reactExports.useState(!1),kt=({name:Bt,data:Ht={}})=>{var Xt,Yt;const Qt={...{login_platform:At,is_eka_app_login:Mt?"true":"false",is_new_login_or_create_flow:vt?"true":"false",txn_id:et||"missing txnId",oid:xt!=null&&xt["X-User-ID"]?"true":"false",access_token:xt!=null&&xt.auth?"true":"false",flow:Rt??""},...Ht};handleSendEvent({eventName:Bt,eventData:Qt}),(Yt=(Xt=window.curio)==null?void 0:Xt.pushToMixpanel)==null||Yt.call(Xt,Bt,Qt)},It=async()=>{kt({name:"abha_login_select_abha_init_started",data:{method:Rt,platform:At}});const Bt=(Ht,Vt)=>{Tt(Qt=>({...Qt,[Ht]:Vt}))};if(Nt(REGISTRATION_TYPE.CREATE),Rt===ABHA_AUTH_FLOW_METHOD.MOBILE){const{txn_id:Ht,hint:Vt,error:Qt,action:Xt}=await postRegisterMobileInit({mobile_number:Pt});if(Ht&&Vt){kt({name:"abha_login_select_abha_mobile_init_success",data:{method:Rt,platform:At,txn_id:Ht}}),Lt({authTxnId:tt,txnId:Ht,mobileOtpSentToHint:Vt}),bt("mobile"),Bt("mobile",LOADING_STATE.RESOLVED),Nt(REGISTRATION_TYPE.CREATE),$(SCREEN_NAMES.ABHA_PHONE_NUMBER_VERIFICATION);return}kt({name:"abha_login_select_abha_init_failed",data:{method:Rt,platform:At,reason:Qt||"unknown",reason_exists:!!Qt}}),Bt("mobile",LOADING_STATE.REJECTED),Xt?nt(Xt):ot(Qt||"Something went wrong")}else if(Rt===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER){kt({name:"abha_fetching_profiles",data:{method:Rt,platform:At}}),$(SCREEN_NAMES.GET_ALL_PROFILES);return}},jt=async()=>{var Gt,qt,nr,lr,ar,er;if(st===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER&&a){ut(LOADING_STATE.LOADING),setIndividualEnv({extraHeaders:{auth:""}}),Mt||await postAuthLogoutV2()||kt({name:"logout_api_failed_before_init_on_continue_click",data:{method:Rt,platform:At,reason:"logout_api_response_false"}});const{txn_id:Ut,error:zt,action:Wt,hint:Jt}=await postAbdmLoginInit({method:ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS,identifier:a.abha_address});if(kt({name:"abha_abdm_login_init_triggered",data:{flow_step_type:"init",authTxnId:tt,ndhmTxnId:Ut,method:Rt}}),console.log("after postAbdmLoginInit",Wt),console.log("after postAbdmLoginInit",Wt),Wt){kt({name:"abha_abdm_login_init_abha_error_action",data:{method:Rt,platform:At,action:((Gt=Wt==null?void 0:Wt.cta)==null?void 0:Gt.title)||"unknown",action_exists:!!((qt=Wt==null?void 0:Wt.cta)!=null&&qt.title)}}),nt(Wt);return}if(zt){kt({name:"abha_abdm_login_init_failed",data:{method:Rt,platform:At,reason:zt||"unknown",reason_exists:!!zt}}),ut(LOADING_STATE.REJECTED),ot(zt||"Something went wrong. Please try again.");return}if(!Ut){ot("Something went wrong. Please try again.");return}kt({name:"abha_login_init_success",data:{flow_step_type:"init",authTxnId:tt,ndhmTxnId:Ut,hint:Jt}}),_t({authTxnId:tt,txnId:Ut,aadhaarOtpSentToHint:Jt||null}),ut(LOADING_STATE.RESOLVED),Ct(a.abha_address),gt(ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS),$(SCREEN_NAMES.VERIFY_OTP_LOGIN_WITH_ABHA);return}if(!a)return;if(at(a.abha_address),console.log(dt,"from abha"),!et){kt({name:"abha_login_select_abha_txnId_not_found",data:{platform:At,reason:"txnId missing",reason_exists:!0}});return}ut(LOADING_STATE.LOADING),kt({name:"abha_login_select_abha_verify_start",data:{platform:At,txn_id:et}});const{error:Bt,eka:Ht,profile:Vt,action:Qt,skip_state:Xt}=await Et({txn_id:et,phr_address:a.abha_address});if(Qt){kt({name:"abha_login_select_abha_error_action",data:{platform:At,txn_id:et,action:((nr=Qt==null?void 0:Qt.cta)==null?void 0:nr.title)||"unknown",action_exists:!!((lr=Qt==null?void 0:Qt.cta)!=null&&lr.title)}}),nt(Qt);return}if(Bt||!Ht){kt({name:"abha_login_select_abha_abdm_error",data:{platform:At,txn_id:et,error_message:Bt||"eka object missing",error_exists:!!Bt}}),ut(LOADING_STATE.REJECTED),ot(Bt);return}if(!Xt){ot("skip State is missing");return}if(kt({name:"abha_login_select_abha_verify_success",data:{platform:At,txn_id:et,skip_state:Xt}}),lt(Xt),Vt&&(kt({name:"abha_login_select_abha_profile_received",data:{platform:At}}),ft({date_of_birth:`${Vt.year_of_birth}-${String(Vt.month_of_birth).padStart(2,"0")}-${String(Vt.day_of_birth).padStart(2,"0")}`,firstname:Vt.first_name,lastname:Vt.last_name,pincode:Vt.pincode,gender:Vt.gender,name:Vt.first_name+" "+Vt.last_name,mobile:Vt.mobile,oid:Ht==null?void 0:Ht.oid,middlename:Vt.middle_name,abha_address:Vt.abha_address,abha_number:Vt.abha_number}),at(Vt.abha_address)),Mt){if(!Ht.oid){kt({name:"abha_login_select_abha_oid_null",data:{platform:At,oid:(Ht==null?void 0:Ht.oid)??"null_or_undefined"}}),ut(LOADING_STATE.REJECTED);return}const Ut=mt.includes(Vt==null?void 0:Vt.gender)?Vt==null?void 0:Vt.gender:void 0,zt={oid:(Ht==null?void 0:Ht.oid)||"",fln:(Vt==null?void 0:Vt.first_name)+" "+(Vt==null?void 0:Vt.last_name),dob:`${Vt==null?void 0:Vt.year_of_birth}-${String(Vt==null?void 0:Vt.month_of_birth).padStart(2,"0")}-${String(Vt==null?void 0:Vt.day_of_birth).padStart(2,"0")}`,gen:Ut,mobile:Vt==null?void 0:Vt.mobile,at:"",fn:(Vt==null?void 0:Vt.first_name)||"",mn:(Vt==null?void 0:Vt.middle_name)||"",ln:(Vt==null?void 0:Vt.last_name)||"","health-ids":Vt!=null&&Vt.abha_address?[Vt.abha_address]:void 0,abha_number:(Vt==null?void 0:Vt.abha_number)||""},Wt=getMockAuthVerifyResponse(zt);if(ut(LOADING_STATE.RESOLVED),kt({name:"abha_login_select_abha_inside_app_success",data:{platform:At,oid:Ht.oid}}),window.EkaAbha&&window.EkaAbha.onAbhaSuccess){(ar=window.EkaAbha)==null||ar.onAbhaSuccess(JSON.stringify({response:Wt}));return}onAbhaSuccess({response:Wt}),unMount();return}if(!Ht.min_token||!tt){kt({name:"abha_login_select_abha_min_token_missing",data:{platform:At,oid:(Ht==null?void 0:Ht.oid)??"missing_oid",min_token:(Ht==null?void 0:Ht.min_token)??"missing_min_token",auth_txnId:tt??"missing_authTxnId"}}),ut(LOADING_STATE.REJECTED),ot(Bt||"Something went wrong. Please try again.");return}const Yt=await yt({txn_id:tt,token:Ht.min_token,...Ht.oid?{oid:Ht.oid}:null});if(!Yt.data){kt({name:"abha_login_select_abha_auth_verify_failed",data:{platform:At,oid:(Ht==null?void 0:Ht.oid)??"missing_oid",min_token:(Ht==null?void 0:Ht.min_token)??"missing_min_token",auth_txnId:tt??"missing_authTxnId"}}),ut(LOADING_STATE.REJECTED),ot(((er=Yt.error)==null?void 0:er.message)||"Something went wrong, please try again");return}ut(LOADING_STATE.RESOLVED),kt({name:"abha_login_select_abha_auth_verify_success",data:{platform:At,oid:Ht.oid,min_token:Ht==null?void 0:Ht.min_token,auth_txnId:tt}})},$t=()=>{const Bt=useAuthAbhaStore.getState().initAbhaAppMobileNumber,Ht=useAuthAbhaStore.getState().isEkaAppLogin;_e(),it(),useAuthAbhaStore.setState({initAbhaAppMobileNumber:Bt}),useAuthAbhaStore.setState({isEkaAppLogin:Ht})};return jsxRuntimeExports.jsxs("div",{className:"pds2-w-full pds2-flex pds2-flex-col pds2-h-full pds2-bg-bg-01",children:[jsxRuntimeExports.jsx(Pds2Header,{title:"Select ABHA to continue",prefixIcon:jsxRuntimeExports.jsx("button",{className:"pds2-w-24 pds2-h-24 pds2-rounded-full pds2-flex pds2-items-center pds2-justify-center ripple",onClick:()=>ht(!0),children:jsxRuntimeExports.jsx(n$2,{})}),suffixIcon:((Kt=rt==null?void 0:rt[0])==null?void 0:Kt.kyc_verified)&&jsxRuntimeExports.jsx(e$1,{onClick:()=>Dt(Bt=>!Bt),className:"pds2-w-20 pds2-h-20 pds2-text-icon-03 pds2-text-[2rem] hover:pds2-cursor-pointer"}),className:"pds2-border-b pds2-border-bg-seperator-dark pds2-bg-bg-white"}),jsxRuntimeExports.jsx(AbhaStepper,{}),wt&&jsxRuntimeExports.jsx("div",{onMouseLeave:()=>Dt(!1),className:"pds2-absolute pds2-right-10 pds2-top-45 pds2-mt-2 pds2-z-50 pds2-animate-fade-in",children:jsxRuntimeExports.jsx(TooltipContent,{})}),jsxRuntimeExports.jsxs("div",{className:"pds2-flex-1 pds2-overflow-y-auto pds2-flex pds2-flex-col pds2-p-16 pds2-space-y-16",children:[jsxRuntimeExports.jsxs("div",{className:"pds2-text-text-03 Body1Regular pds2-text-center",children:["We found ",rt==null?void 0:rt.length," ABHA addresses ",jsxRuntimeExports.jsx("br",{})," select one you want to log in with"]}),jsxRuntimeExports.jsx(AbhaList,{list:rt,selectedAbha:a,setSelectedAbha:_,handleContinueClick:jt}),((rt==null?void 0:rt.length)??0)<6&&(st===ABHA_AUTH_FLOW_METHOD.MOBILE||st===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER)&&jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-flex-col pds2-gap-16",children:[jsxRuntimeExports.jsx(TextSeparator,{title:"or"}),jsxRuntimeExports.jsx(Pds2CustomButton,{title:"Create new ABHA Address",prefixIcon:jsxRuntimeExports.jsx(l$6,{}),className:"pds2-justify-center pds2-text-text-brand pds2-bg-border-brand-02 pds2-border-border-03 Body1Semibold",onClick:It})]})]}),st===ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER&&jsxRuntimeExports.jsxs("div",{className:"pds2-text-center pds2-bg-bg-02 pds2-py-8",children:[jsxRuntimeExports.jsx("span",{className:"pds2-text-text-03 Body2Regular",children:"Your ABHA No: "}),jsxRuntimeExports.jsx("span",{className:"pds2-text-text-01 Body2Semibold",children:St==null?void 0:St.abha_number})]}),jsxRuntimeExports.jsxs("div",{className:"pds2-bg-bg-white pds2-shadow-lg pds2-w-full pds2-sticky pds2-bottom-0 pds2-border-border-brand-02 pds2-p-16 z-10",children:[ct&&jsxRuntimeExports.jsx("div",{className:"pds2-text-text-error pds2-text-center pds2-mb-4",children:ct}),jsxRuntimeExports.jsx(Pds2Button,{title:"Continue",state:a===null||dt===LOADING_STATE.LOADING?"disabled":"enabled",isLoading:dt===LOADING_STATE.LOADING,className:"pds2-w-full",onClick:jt})]}),jsxRuntimeExports.jsx(AbhaErrorBottomSheet,{onSubmitClick:$t}),jsxRuntimeExports.jsx(ExitPopup,{open:pt,setOpen:ht})]})},AbhaList=({list:a,selectedAbha:_,setSelectedAbha:$,handleContinueClick:_e})=>jsxRuntimeExports.jsx("div",{className:"pds2-bg-bg-white pds2-rounded-16 pds2-border pds2-border-border-brand-02 pds2-w-full pds2-relative",children:a==null?void 0:a.map((et,tt)=>jsxRuntimeExports.jsxs(React.Fragment,{children:[jsxRuntimeExports.jsxs("label",{className:"pds2-p-16 pds2-flex pds2-space-x-8",children:[jsxRuntimeExports.jsx("input",{className:"pds2-self-start pds2-mt-4 pds2-w-14 pds2-h-14 pds2-p-2 checked:pds2-accent-text-brand",type:"radio",value:et.abha_address,checked:(_==null?void 0:_.abha_address)===et.abha_address,onChange:()=>{$(et)},onKeyDown:rt=>rt.key==="Enter"&&_e()}),jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-flex-col pds2-space-y-4 pds2-flex-1",children:[jsxRuntimeExports.jsxs("div",{className:"TitlesSubheadline pds2-text-text-primary pds2-flex pds2-flex-row pds2-items-center pds2-justify-between",children:[jsxRuntimeExports.jsx("div",{children:et==null?void 0:et.abha_address}),jsxRuntimeExports.jsx("div",{className:"pds2-flex pds2-flex-row pds2-items-center",children:(et==null?void 0:et.kyc_verified)&&(et.kyc_verified==="VERIFIED"?jsxRuntimeExports.jsx("div",{className:"Label1Bold pds2-rounded-full pds2-h-full",children:jsxRuntimeExports.jsx(t$1,{className:"pds2-w-16 pds2-h-16 pds2-text-icon-success-02 pds2-text-[2rem]"})}):jsxRuntimeExports.jsx("div",{className:"Label1Bold pds2-rounded-full pds2-h-full",children:jsxRuntimeExports.jsx(s$3,{className:"pds2-w-16 pds2-h-16 pds2-text-icon-orange-300 pds2-text-[2rem]"})}))})]}),jsxRuntimeExports.jsx("div",{className:"pds2-text-text-03 Body3Regular pds2-flex pds2-flex-row pds2-items-center pds2-gap-x-4",children:(et==null?void 0:et.name)&&jsxRuntimeExports.jsx("div",{className:"Body3Regular pds2-text-text-03",children:et.name})})]})]}),tt!==a.length-1&&jsxRuntimeExports.jsx("div",{className:"pds2-px-16",children:jsxRuntimeExports.jsx("div",{className:"pds2-bg-border-03 pds2-h-1 pds2-w-full"})})]},et.abha_address))}),TooltipContent=()=>jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-flex-col pds2-py-14 pds2-bg-bg-purple-800 pds2-rounded-16 pds2-w-150 pds2-animate-slide-up",children:[jsxRuntimeExports.jsxs("div",{className:" pds2-px-16 pds2-flex pds2-flex-row pds2-items-center pds2-gap-x-8 pds2-py-6",children:[jsxRuntimeExports.jsx("div",{className:"pds2-bg-bg-white pds2-rounded-full",children:jsxRuntimeExports.jsx(s$3,{className:"pds2-w-16 pds2-h-16 pds2-text-icon-orange-400"})}),jsxRuntimeExports.jsx("div",{className:"pds2-text-text-invert",children:"Non KYC"})]}),jsxRuntimeExports.jsxs("div",{className:" pds2-px-16 pds2-flex pds2-flex-row pds2-items-center pds2-gap-x-8 pds2-py-6 pds2-border-t-1 pds2-border-[#FFFFFF4D]",children:[jsxRuntimeExports.jsx("div",{className:"pds2-bg-bg-white pds2-rounded-full",children:jsxRuntimeExports.jsx(t$1,{className:"pds2-w-16 pds2-h-16 pds2-text-icon-success-02"})}),jsxRuntimeExports.jsx("div",{className:"pds2-text-text-invert",children:"KYC"})]})]}),SelectEkaProfileScreen=()=>{var Lt;const a=useAuthAbhaStore(Ot=>Ot.setScreen),_=useAuthAbhaStore(Ot=>Ot.setEkaProfileInfo),$=useAuthAbhaStore(Ot=>Ot.registrationType),_e=useAuthAbhaStore(Ot=>Ot.goBackLoginScreen),[et,tt]=reactExports.useState(null),rt=useAuthAbhaStore(Ot=>Ot.setBottomsheetErrorInfo),nt=useAuthAbhaStore(Ot=>Ot.clearAbhaAuthStore),[it,at]=reactExports.useState(LOADING_STATE.IDLE),[st,ct]=reactExports.useState(!1),[ot,pt]=reactExports.useState(null),ht=useAuthAbhaStore(Ot=>Ot.selectedAbhaAddress),ft=useAuthAbhaStore(Ot=>Ot.aadhaarVerificationSkipStateStatus),{mutateAsync:gt}=usePostProfileSwitch(),lt=queryClient.getQueryData(["profilesPhrUserResponse"]),dt=useAuthAbhaStore(Ot=>Ot.clientId),ut=useAuthAbhaStore(Ot=>Ot.isEkaAppLogin),mt=useAuthAbhaStore(Ot=>Ot.isNewLoginOrCreateFlow),yt=useAuthAbhaStore(Ot=>Ot.txnId),Et=GET_EXTRA_HEADERS(),St=useAuthAbhaStore(Ot=>Ot.abhaAuthFlowMethod),At=({name:Ot,data:Tt={}})=>{var vt,xt;const bt={...{login_platform:dt,is_eka_app_login:ut?"true":"false",is_new_login_or_create_flow:mt?"true":"false",txn_id:yt||"missing txnId",oid:Et!=null&&Et["X-User-ID"]?"true":"false",access_token:Et!=null&&Et.auth?"true":"false",flow:St??""},...Tt};handleSendEvent({eventName:Ot,eventData:bt}),(xt=(vt=window.curio)==null?void 0:vt.pushToMixpanel)==null||xt.call(vt,Ot,bt)};reactExports.useEffect(()=>{At({name:"choose_eka_profile_screen",data:{platform:dt,type:"select"}})},[dt]);const Mt=()=>{if(At({name:"create_family_profile_clicks",data:{platform:dt,type:"create",skip_state:ft}}),ft===ABHA_V3_SKIP_STATES.ABHA_END){At({name:"navigate_to_create_phr_profile_screen",data:{platform:dt}}),a(SCREEN_NAMES.CREATE_PHR_EKA_PROFILE);return}At({name:"navigate_to_create_eka_profile_screen",data:{platform:dt}}),a(SCREEN_NAMES.CREATE_EKA_PROFILE)},Nt=async({profile:Ot})=>{At({name:"select_profile_clicks",data:{platform:dt,oid:Ot.oid}}),tt(Ot.oid)},Rt=async()=>{var vt,xt,Ct,wt;if(At({name:"continue_click_on_choose_eka_profile",data:{platform:dt,selectedProfileOid:et,registrationType:$,skip_state:ft}}),et&&ft===ABHA_V3_SKIP_STATES.ABHA_CREATE){const Dt=lt==null?void 0:lt.profiles.find(kt=>kt.oid===et);if(!Dt){At({name:"continue_click_profile_not_found",data:{platform:dt,oid:et||"unknown_oid",oid_exists:!!et}});return}At({name:"navigate_to_create_eka_profile_screen_from_abha_create",data:{platform:dt,oid:Dt.oid}}),_({oid:Dt.oid,date_of_birth:Dt.dob,firstname:Dt.fn,lastname:Dt.ln,pincode:"",gender:Dt.gen,mobile:Dt.mobile,name:Dt.fln,middlename:Dt.mn,abha_address:(vt=Dt==null?void 0:Dt["health-ids"])==null?void 0:vt[0],abha_number:Dt.abha_number}),a(SCREEN_NAMES.CREATE_EKA_PROFILE);return}if(!ht||!et){At({name:"continue_click_missing_profile_or_abha",data:{platform:dt,oid:et||"missing_oid",oid_exists:!!et}});return}At({name:"linking_abha_to_profile_start",data:{platform:dt,oid:et||"missing_oid",oid_exists:!!et}}),at(LOADING_STATE.LOADING);const{error:Ot,action:Tt,eka:_t}=await postAbdmProfileEkaLinkPhr({abha_address:ht,oid:et});if(Tt){At({name:"linking_abha_to_profile_error_action",data:{platform:dt,oid:et||"missing_oid",oid_exists:!!et}}),rt(Tt);return}if(Ot||!_t||!_t.oid){At({name:"linking_abha_to_profile_failed",data:{platform:dt,oid:et||"missing_oid",oid_exists:!!et,error:Ot||"No EKA/OID",error_exists:!!Ot}}),at(LOADING_STATE.REJECTED),pt(Ot||"Something went wrong. Please try again.");return}const bt=await gt({oid:_t.oid});if(bt.error){At({name:"profile_switch_failed_after_link",data:{platform:dt,oid:(_t==null?void 0:_t.oid)||"missing_oid",oid_exists:!!(_t!=null&&_t.oid),error:((xt=bt.error)==null?void 0:xt.message)||"unknown_error",error_exists:!!((Ct=bt.error)!=null&&Ct.message)}}),at(LOADING_STATE.REJECTED),pt(((wt=bt.error)==null?void 0:wt.message)||"Something went wrong, please try again");return}At({name:"linking_abha_to_profile_success",data:{platform:dt,oid:_t.oid}}),at(LOADING_STATE.RESOLVED)},Pt=()=>{_e();const Ot=useAuthAbhaStore.getState().isEkaAppLogin;nt(),useAuthAbhaStore.setState({isEkaAppLogin:Ot})};return jsxRuntimeExports.jsxs("div",{className:"pds2-w-full pds2-h-full pds2-flex pds2-flex-col pds2-bg-bg-01",children:[jsxRuntimeExports.jsx(Pds2Header,{title:"Select Eka Profile",prefixIcon:jsxRuntimeExports.jsx("button",{className:"pds2-w-24 pds2-h-24 pds2-rounded-full pds2-flex pds2-items-center pds2-justify-center ripple",onClick:()=>ct(!0),children:jsxRuntimeExports.jsx(n$2,{})}),className:"pds2-border-b pds2-border-bg-seperator-dark pds2-bg-bg-white"}),jsxRuntimeExports.jsx(AbhaStepper,{}),jsxRuntimeExports.jsxs("div",{className:"pds2-flex-1 pds2-flex pds2-flex-col pds2-relative pds2-bg-bg-01 pds2-overflow-y-auto",children:[jsxRuntimeExports.jsxs("div",{className:"pds2-flex-1 pds2-overflow-y-auto pds2-px-16 pds2-pt-24 pds2-pb-32",children:[jsxRuntimeExports.jsxs("div",{className:"pds2-space-y-16 pds2-flex pds2-flex-col pds2-items-center pds2-text-center",children:[jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm6agrs5000090tfwfz984x5b.webp",alt:"Link ABHA",className:"pds2-w-163"}),jsxRuntimeExports.jsxs("div",{className:"pds2-space-y-4",children:[jsxRuntimeExports.jsx("div",{className:"pds2-text-text-01 Heading3Semibold",children:"Choose an Eka Profile"}),jsxRuntimeExports.jsx("span",{className:"Body1Regular pds2-text-text-03",children:"Select the person for whom you want to create an ABHA address."})]})]}),jsxRuntimeExports.jsxs("div",{className:"pds2-w-full pds2-flex pds2-flex-col pds2-justify-center pds2-space-y-12 pds2-mt-24",children:[jsxRuntimeExports.jsx("div",{className:"pds2-text-text-03 Body2Medium pds2-text-center",children:"Select Eka Profile"}),jsxRuntimeExports.jsx("div",{className:"pds2-space-y-8",children:(Lt=lt==null?void 0:lt.profiles)==null?void 0:Lt.map(Ot=>{const Tt=et===Ot.oid;return jsxRuntimeExports.jsxs("label",{className:`pds2-flex pds2-items-center pds2-gap-x-8 pds2-cursor-pointer pds2-p-16 pds2-rounded-16 pds2-bg-bg-white pds2-border
145
145
  pds2-border-border-03 hover:pds2-bg-bg-hover-01
146
- pds2-transition-colors`,children:[jsxRuntimeExports.jsx("input",{type:"radio",name:"ekaProfile",value:Ot.oid,checked:Tt,onChange:()=>Nt({profile:Ot}),className:"pds2-self-start pds2-mt-4 pds2-w-14 pds2-h-14",onKeyDown:_t=>_t.key==="Enter"&&Rt()}),jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-flex-row pds2-items-center pds2-gap-x-8 pds2-flex-1",children:[jsxRuntimeExports.jsx("div",{className:"TitlesSubheadline pds2-text-text-primary",children:Ot.fln}),jsxRuntimeExports.jsx("span",{className:"pds2-ml-auto pds2-text-text-brand pds2-text-14 pds2-font-600",children:"Link"})]})]},Ot.oid)})}),jsxRuntimeExports.jsx(TextSeparator,{title:"or"}),jsxRuntimeExports.jsx(Pds2CustomButton,{title:"Create new Family Member",prefixIcon:jsxRuntimeExports.jsx(l$6,{}),className:"pds2-justify-center pds2-text-text-brand pds2-border-bg-fab-bg-brand-04 Body1Semibold",onClick:Mt})]})]}),jsxRuntimeExports.jsxs("div",{className:"pds2-sticky pds2-bottom-0 pds2-left-0 pds2-right-0 pds2-bg-bg-white pds2-shadow-lg pds2-p-16",children:[ot&&jsxRuntimeExports.jsx("div",{className:"pds2-text-text-error pds2-text-center pds2-mb-8",children:ot}),jsxRuntimeExports.jsx(Pds2Button,{title:"Continue",state:et===null||it===LOADING_STATE.LOADING?"disabled":"enabled",isLoading:it===LOADING_STATE.LOADING,className:"pds2-w-full",onClick:Rt})]})]}),jsxRuntimeExports.jsx(AbhaErrorBottomSheet,{onSubmitClick:Pt}),jsxRuntimeExports.jsx(ExitPopup,{open:st,setOpen:ct})]})},LoginorCreateAbhaScreen=()=>{const a=useAuthAbhaStore(_e=>_e.clientId);reactExports.useEffect(()=>{var _e;if((_e=window.EkaAbha)!=null&&_e.changeStatusBarColor)return window.EkaAbha.changeStatusBarColor("#F2F4F7"),()=>{var et,tt;(et=window.EkaAbha)!=null&&et.changeStatusBarColor&&((tt=window==null?void 0:window.EkaAbha)==null||tt.changeStatusBarColor("#FFFFFF"))}},[]);const _=()=>{var _e;(_e=window.EkaAbha)==null||_e.onAbhaClose(),unMount()},$=["eka-web","phr"];return jsxRuntimeExports.jsxs("div",{className:"pds2-h-full pds2-overflow-y-auto",children:[!$.includes(a)&&jsxRuntimeExports.jsx(Pds2Header,{prefixIcon:jsxRuntimeExports.jsx("button",{onClick:_,children:jsxRuntimeExports.jsx(n$2,{})}),title:"",className:"pds2-bg-bg-01"}),jsxRuntimeExports.jsx(LoginOrCreateWithDifferentMethods,{})]})},LoginOrCreateWithDifferentMethods=()=>{const a=useAuthAbhaStore(Wt=>Wt.abhaAuthFlowMethod||ABHA_AUTH_FLOW_METHOD.MOBILE),_=useAuthAbhaStore(Wt=>Wt.setAbhaAuthFlowMethod),[$,_e]=reactExports.useState(""),[et,tt]=reactExports.useState(LOADING_STATE.IDLE),rt=useAuthAbhaStore(Wt=>Wt.isEkaAppLogin),[nt,it]=reactExports.useState(""),at=useAuthAbhaStore(Wt=>Wt.setSelectedAbhaAddress),st=useAuthAbhaStore(Wt=>Wt.setLoginIdentifierValue),ct=useAuthAbhaStore(Wt=>Wt.setScreen),[ot,pt]=reactExports.useState({aadhaar:LOADING_STATE.IDLE,mobile:LOADING_STATE.IDLE}),ht=useAuthAbhaStore(Wt=>Wt.setRegistrationType),ft=useAuthAbhaStore(Wt=>Wt.setAadhaarInitResponse),gt=useAuthAbhaStore(Wt=>Wt.setMobileInitResponse),lt=useAuthAbhaStore(Wt=>Wt.initAbhaAppMobileNumber),dt=useAuthAbhaStore(Wt=>Wt.initAbhaAppIdentifierType),ut=useAuthAbhaStore(Wt=>Wt.initAbhaAppIdentifier),[mt,yt]=reactExports.useState(""),[Et,St]=reactExports.useState(!1),[At,Mt]=reactExports.useState(!1),[Nt,Rt]=reactExports.useState(""),[Pt,Lt]=reactExports.useState(""),[Ot,Tt]=reactExports.useState(""),[_t,bt]=reactExports.useState(""),vt=useAuthAbhaStore(Wt=>Wt.isNewLoginOrCreateFlow),xt=useAuthAbhaStore(Wt=>Wt.setIsNewLoginOrCreateFlow),Ct=useAuthAbhaStore(Wt=>Wt.clientId),wt=reactExports.useRef(!1),Dt=useAuthAbhaStore(Wt=>Wt.isInitApiTriggered),kt=useAuthAbhaStore(Wt=>Wt.setIsInitApiTriggered),It=useAuthAbhaStore(Wt=>Wt.setIdentityValue);useAuthAbhaStore(Wt=>Wt.identityValue);const jt=GET_EXTRA_HEADERS(),$t=useAuthAbhaStore(Wt=>Wt.setSelectedAbhaFlow),Kt=useAuthAbhaStore(Wt=>Wt.isDocAppRequest),Bt=useAuthAbhaStore(Wt=>Wt.txnId);reactExports.useEffect(()=>{Ht({name:"abha_login_or_create_screen",data:{flow:a.toString()}})}),reactExports.useEffect(()=>{ut&&dt===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS?(Tt(ut),_e(ut.split("@")[0]),lr(!0),zt(!0),_(ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS)):ut&&dt===ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER?(_e(ut),Lt(ut),lr(!0),er(!0),_(ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER)):ut&&dt===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER?(Rt(ut),Mt(!0),_e(ut),_(ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER)):ut&&dt===ABHA_AUTH_FLOW_METHOD.MOBILE?(yt(ut),_e(ut),St(ut.length===10),it(null),_(ABHA_AUTH_FLOW_METHOD.MOBILE)):(_e(""),it(null),St(!1),lr(!1),zt(!1),er(!1),_(ABHA_AUTH_FLOW_METHOD.MOBILE))},[dt]),reactExports.useEffect(()=>{Dt||wt.current||mt&&mt.length===10&&(kt(!0),wt.current=!0,qt("auto_submit_mobile"))},[mt]),reactExports.useEffect(()=>{Dt||wt.current||Nt&&Nt.length===12&&(kt(!0),wt.current=!0,qt("auto_submit_aadhaar"))},[Nt]),reactExports.useEffect(()=>{Dt||wt.current||Pt&&Pt.length===17&&(kt(!0),wt.current=!0,qt("auto_submit_abha"))},[Pt]),reactExports.useEffect(()=>{Dt||wt.current||Ot&&Ot.includes("@sbx")&&(kt(!0),wt.current=!0,qt("auto_submit_phr"))},[Ot]);const Ht=({name:Wt,data:Jt={}})=>{var hr,br;const or={...{login_platform:Ct,is_eka_app_login:rt?"true":"false",is_new_login_or_create_flow:vt?"true":"false",oid:jt!=null&&jt["X-User-ID"]?"true":"false",access_token:jt!=null&&jt.auth?"true":"false",txn_id:Bt||"missing txnId",flow:a??""},...Jt};handleSendEvent({eventName:Wt,eventData:or}),(br=(hr=window.curio)==null?void 0:hr.pushToMixpanel)==null||br.call(hr,Wt,or)},Vt=React.useMemo(()=>{switch(a){case ABHA_AUTH_FLOW_METHOD.MOBILE:return"Enter your Mobile Number";case ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER:return"Enter your Aadhaar Number";default:return""}},[a]),Qt=Wt=>{const Jt=Wt.target.value;switch(a){case ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS:if(Jt.length>20)return;bt(Jt),_e(Jt);break;case ABHA_AUTH_FLOW_METHOD.MOBILE:if(Jt&&!/^[0-9]+$/.test(Jt)||Jt.length>10)return;yt(Jt),St(!0),_e(Jt);break;case ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER:if(!/^[\d-]*$/.test(Jt)||Jt.length>17)return;const ur=Wt.target.value.replace(/-/g,"");let or="";return ur.length>0&&(or+=ur.slice(0,2)),ur.length>2&&(or+=`-${ur.slice(2,6)}`),ur.length>6&&(or+=`-${ur.slice(6,10)}`),ur.length>10&&(or+=`-${ur.slice(10,14)}`),Lt(or),_e(or.trim());case ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER:if(Jt&&!/^[0-9]+$/.test(Jt)||Jt.length>12)return;Rt(Jt),Mt(!0),_e(Jt);break}_e(Jt.trim())};ABHA_AUTH_FLOW_METHOD.MOBILE;const Xt=React.useMemo(()=>{switch(a){case ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS:return $.length>=4&&$.length<=20;case ABHA_AUTH_FLOW_METHOD.MOBILE:return $.length===10;case ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER:return $.length===17;case ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER:return $.length===12}},[a,$]),Yt=(Wt,Jt)=>{pt(ur=>({...ur,[Wt]:Jt}))},Gt=({inputVal:Wt})=>{Wt.length===12&&(_e(Wt),Rt(Wt),Mt(!0))};reactExports.useEffect(()=>{console.log("selectedMethod changed:==================>",a)},[a]);const qt=async Wt=>{var or,hr,br;xt(!0),Ht({name:"abha_login_next_click",data:{flow_step_type:Wt}}),tt(LOADING_STATE.LOADING),ht(REGISTRATION_TYPE.LOGIN);let Jt="";if(!rt){const xr=await postAuthLogoutV2();Ht({name:xr?"abha_logout_success":"abha_logout_failure",data:{platform:Ct}});const{txn_id:_r,error:gr}=await postAuthInitV2({method:AUTH_METHOD.ABHA});if(!_r||gr){Ht({name:"abha_auth_init_failure",data:{flow_step_type:"init",authTxnId:Jt,error_message:gr||"missing_txnId_or_unknown_error",error_message_exists:!!gr,txn_id_exists:!!_r}}),it((gr==null?void 0:gr.message)||"Something went wrong. Please try again."),tt(LOADING_STATE.REJECTED);return}Jt=_r,Ht({name:"abha_auth_init_success.",data:{flow_step_type:"init",auth_txnId:Jt}})}const ur=a===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS?`${$}@sbx`:$;if(a===ABHA_AUTH_FLOW_METHOD.MOBILE||a===ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER||a===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS){const{txn_id:xr,error:_r,action:gr,hint:Nr}=await postAbdmLoginInit({method:a,identifier:ur});if(It(ur),Ht({name:"abha_login_init_triggered",data:{flow_step_type:"init",authTxnId:Jt,ndhmTxnId:xr,method:a}}),a===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS&&at(ur),_r||!xr){if(((or=gr==null?void 0:gr.cta)==null?void 0:or.pid)==="abha_mobile_enroll"&&a===ABHA_AUTH_FLOW_METHOD.MOBILE){Yt("mobile",LOADING_STATE.LOADING),ht(REGISTRATION_TYPE.CREATE);const{txn_id:jr,hint:qr,error:Fr,action:$r}=await postRegisterMobileInit({mobile_number:$});if(It($),$t("mobile"),jr&&qr){gt({authTxnId:Jt,txnId:jr,mobileOtpSentToHint:qr}),Ht({name:"abha_mobile_registration_init_success",data:{flow_step_type:"init",authTxnId:Jt,ndhmTxnId:xr,error_message:Fr,error_action:gr}}),Yt("mobile",LOADING_STATE.RESOLVED),tt(LOADING_STATE.RESOLVED),ht(REGISTRATION_TYPE.CREATE),ct(SCREEN_NAMES.ABHA_PHONE_NUMBER_VERIFICATION);return}if(Yt("mobile",LOADING_STATE.REJECTED),Ht({name:"abha_mobile_registration_init_failure",data:{flow_step_type:"init",authTxnId:Jt,error_message:Fr||"unknown_error",error_message_exists:!!Fr,error_action_exists:!!$r}}),$r){if((hr=$r==null?void 0:$r.cta)!=null&&hr.pid)return ct(SCREEN_NAMES.LOGIN_OR_CREATE_ABHA)}else it(Fr||"Something went wrong");it(Fr||"Something went wrong. Please try again."),tt(LOADING_STATE.REJECTED);return}Ht({name:"abha_login_init_failure",data:{flow_step_type:"init",authTxnId:Jt,error_message:_r||"unknown_error",error_message_exists:!!_r,error_action_exists:!!gr}}),it(_r||"Something went wrong. Please try again."),tt(LOADING_STATE.REJECTED);return}Ht({name:"abha_login_init_success",data:{flow_step_type:"init",authTxnId:Jt,ndhmTxnId:xr,hint:Nr}}),ft({authTxnId:Jt,txnId:xr,aadhaarOtpSentToHint:Nr||null}),st(ur),tt(LOADING_STATE.RESOLVED),ct(SCREEN_NAMES.VERIFY_OTP_LOGIN_WITH_ABHA);return}if(a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER){Yt("aadhaar",LOADING_STATE.LOADING),Ht({name:"aadhaar_registration_init_start",data:{flow_step_type:"init",authTxnId:Jt,aadhaarNumber:$}});const{txn_id:xr,hint:_r,error:gr,action:Nr}=await postRegisterAadhaarInit({aadhaar_number:$});if(It($),$t("aadhaar"),xr&&_r){ft({authTxnId:Jt,txnId:xr,aadhaarOtpSentToHint:_r}),Ht({name:"aadhaar_registration_init_success",data:{flow_step_type:"verify",ndhmTxnId:xr,authTxnId:Jt}}),Yt("aadhaar",LOADING_STATE.RESOLVED),ht(REGISTRATION_TYPE.CREATE),tt(LOADING_STATE.RESOLVED),ct(SCREEN_NAMES.ABHA_OTP_AND_MOBILE);return}if(Ht({name:"abha_registration_init_failure",data:{error_message:gr||"unknown_error",error_message_exists:!!gr,auth_txn_id:Jt,error_action:Nr,error_action_exists:!!Nr}}),Yt("aadhaar",LOADING_STATE.REJECTED),tt(LOADING_STATE.REJECTED),Nr||gr){(br=Nr==null?void 0:Nr.cta)!=null&&br.pid?ct(SCREEN_NAMES.LOGIN_OR_CREATE_ABHA):it(gr||"Something went wrong");return}}},[nr,lr]=reactExports.useState(!1),[ar,er]=reactExports.useState(!1),[Ut,zt]=reactExports.useState(!1);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"pds2-pt-22 pds2-p-16 pds2-bg-bg-01 pds2-space-y-16 pds2-text-center pds2-rounded-b-24",children:[jsxRuntimeExports.jsx(AbhaStepper,{}),jsxRuntimeExports.jsx("div",{className:"pds2-flex pds2-justify-center pds2-items-center pds2-gap-16",children:jsxRuntimeExports.jsx("div",{className:"pds2-bg-bg-white pds2-rounded-16",children:jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4ml1lwu00000tfs1okl7hs9.webp",alt:"abha",className:"pds2-w-64 pds2-h-64"})})}),jsxRuntimeExports.jsx("div",{className:"Heading3Semibold pds2-text-text-black",children:Ct==="phr"?"Login or Create your ABHA":Kt?"Add Patient via ABHA":"Create your ABHA"}),jsxRuntimeExports.jsx("div",{className:"pds2-text-text-03",style:{marginTop:"4px"},children:a===ABHA_AUTH_FLOW_METHOD.MOBILE?"Enter your Mobile Number":a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER?"Enter your Aadhaar Number":a===ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER?"Enter your ABHA Number":a===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS?"Enter your ABHA Address":Vt}),(a===ABHA_AUTH_FLOW_METHOD.MOBILE||a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER)&&jsxRuntimeExports.jsxs("div",{className:"pds2-relative pds2-flex pds2-bg-bg-seperator-dark pds2-rounded-12 pds2-mt-4",children:[jsxRuntimeExports.jsx("div",{className:"pds2-absolute pds2-top-0 pds2-bottom-0 pds2-bg-bg-white pds2-rounded-12 pds2-transition-all pds2-duration-300",style:{left:a===ABHA_AUTH_FLOW_METHOD.MOBILE?0:"50%",width:"50%",boxShadow:"0px 10px 4px -6px #18274B17"}}),jsxRuntimeExports.jsxs("button",{onClick:()=>_(ABHA_AUTH_FLOW_METHOD.MOBILE),className:"pds2-flex-1 pds2-py-6 pds2-flex pds2-items-center pds2-justify-center pds2-gap-8 pds2-relative pds2-z-10",children:[jsxRuntimeExports.jsx(n$1,{className:"pds2-w-14 pds2-h-14 pds2-text-icon-success-02"}),jsxRuntimeExports.jsx("span",{className:`pds2-text-base ${a===ABHA_AUTH_FLOW_METHOD.MOBILE?"pds2-font-bold pds2-text-fg-default":"pds2-font-normal pds2-text-fg-subtle"}`,style:a===ABHA_AUTH_FLOW_METHOD.MOBILE?{fontWeight:700}:{fontWeight:400},children:"Mobile"})]}),jsxRuntimeExports.jsxs("button",{onClick:()=>_(ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER),className:"pds2-flex-1 pds2-py-6 pds2-flex pds2-items-center pds2-justify-center pds2-gap-8 pds2-relative pds2-z-10",children:[jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm5mcdm3h00070tfs9fjkepff.webp",alt:"Aadhaar",className:"pds2-w-24 pds2-h-24"}),jsxRuntimeExports.jsx("span",{className:`pds2-text-base ${a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER?"pds2-font-bold pds2-text-fg-default":"pds2-font-normal pds2-text-fg-subtle"}`,style:a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER?{fontWeight:700}:{fontWeight:400},children:"Aadhaar"})]})]}),(a===ABHA_AUTH_FLOW_METHOD.MOBILE||a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER)&&jsxRuntimeExports.jsx("div",{className:"pds2-mt-16 pds2-w-full pds2-max-w-md pds2-mx-auto pds2-px-4 pds2-relative",children:a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER?jsxRuntimeExports.jsx(SpacedInputComponent,{initialValues:dt===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER?(ut==null?void 0:ut.match(/.{1,4}/g))??void 0:void 0,disabled:dt===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER&&!!ut,numberOfInputs:3,length:4,placeholder:"XXXX",onSubmit:Gt,setIsValid:Mt}):jsxRuntimeExports.jsx(Pds2InputField,{value:dt===ABHA_AUTH_FLOW_METHOD.MOBILE?ut||"":mt,disabled:dt===ABHA_AUTH_FLOW_METHOD.MOBILE&&!!ut,onChange:Qt,type:"tel",placeholder:"Mobile Number",inputMode:"numeric",autoFocus:!0,maxLength:10,PrefixComponent:jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-items-center pds2-gap-x-8 pds2-border-r pds2-border-border-brand-02 pds2-pr-24",children:[jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4mlct2900000tg98p8u967s.webp",alt:"India Flag",className:"pds2-w-24 pds2-h-24"}),jsxRuntimeExports.jsx("span",{className:"pds2-text-text-black pds2-text-sm",children:"+91"})]})})}),nt&&(a===ABHA_AUTH_FLOW_METHOD.MOBILE||a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER)&&jsxRuntimeExports.jsx("div",{className:"pds2-text-text-error Body3Regular",children:nt}),(a===ABHA_AUTH_FLOW_METHOD.MOBILE||a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER)&&jsxRuntimeExports.jsx(Pds2Button,{title:"Next",IconComponent:()=>jsxRuntimeExports.jsx(c$2,{className:"pds2-w-16 pds2-h-16 -pds2-rotate-90 pds2-ml-8"}),state:!Xt||et===LOADING_STATE.LOADING?"disabled":"enabled",isLoading:et===LOADING_STATE.LOADING,onClick:()=>qt("aadhaar_or_mobile_on_click"),className:"pds2-w-full"})]}),jsxRuntimeExports.jsxs("div",{className:"pds2-m-16 pds2-bg-bg-white pds2-rounded-16 pds2-border pds2-border-border-03 pds2-overflow-hidden",children:[jsxRuntimeExports.jsxs("button",{onClick:()=>lr(!nr),className:"pds2-w-full pds2-flex pds2-items-center pds2-justify-between pds2-p-16 pds2-bg-bg-white hover:pds2-bg-bg-02 pds2-transition-colors",children:[jsxRuntimeExports.jsx("span",{className:"pds2-text-text-03",children:"Other login options for ABHA"}),jsxRuntimeExports.jsx(c$2,{className:`pds2-w-16 pds2-h-16 pds2-text-text-03 pds2-transition-transform ${nr?"pds2-rotate-180":""}`})]}),jsxRuntimeExports.jsxs("div",{className:`pds2-overflow-hidden pds2-transition-all pds2-duration-300 ${nr?"pds2-max-h-126 pds2-opacity-100":"pds2-max-h-0 pds2-opacity-0"}`,children:[jsxRuntimeExports.jsxs("button",{onClick:()=>{lr(!1),_(ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER),er(!0)},className:"pds2-w-full pds2-flex pds2-items-center pds2-justify-between pds2-p-12 hover:pds2-bg-bg-02 pds2-transition-colors",children:[jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-items-center pds2-gap-12",children:[jsxRuntimeExports.jsx("div",{className:"pds2-w-40 pds2-h-40 pds2-rounded-full pds2-bg-bg-02 pds2-flex pds2-items-center pds2-justify-center",children:jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4ml1lwu00000tfs1okl7hs9.webp",alt:"ABHA",className:"pds2-w-24 pds2-h-24"})}),jsxRuntimeExports.jsx("span",{className:"Body1Regular pds2-text-text-black",children:"Login with ABHA Number"})]}),jsxRuntimeExports.jsx(c$2,{className:"pds2-w-16 pds2-h-16 -pds2-rotate-90 pds2-text-text-03"})]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{lr(!1),_(ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS),zt(!0)},className:"pds2-w-full pds2-flex pds2-items-center pds2-justify-between pds2-p-12 hover:pds2-bg-bg-02 pds2-transition-colors",children:[jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-items-center pds2-gap-12",children:[jsxRuntimeExports.jsx("div",{className:"pds2-w-40 pds2-h-40 pds2-rounded-full pds2-bg-bg-02 pds2-flex pds2-items-center pds2-justify-center",children:jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4ml1lwu00000tfs1okl7hs9.webp",alt:"ABHA",className:"pds2-w-24 pds2-h-24"})}),jsxRuntimeExports.jsx("span",{className:"Body1Regular pds2-text-text-black",children:"Login with ABHA Address"})]}),jsxRuntimeExports.jsx(c$2,{className:"pds2-w-16 pds2-h-16 -pds2-rotate-90 pds2-text-text-03"})]})]})]}),jsxRuntimeExports.jsx(AbhaBottomSheet,{isOpen:ar,setIsOpen:er,setFlowMethod:_,children:jsxRuntimeExports.jsxs("div",{className:"pds2-p-24 pds2-text-center pds2-h-full pds2-flex pds2-flex-col",children:[jsxRuntimeExports.jsx("div",{className:"pds2-flex pds2-justify-end pds2-mb-16",children:jsxRuntimeExports.jsx("button",{onClick:()=>{it(null),er(!1),_(ABHA_AUTH_FLOW_METHOD.MOBILE)},className:"pds2-w-24 pds2-h-24 pds2-flex pds2-items-center pds2-justify-center pds2-text-text-03 hover:pds2-text-text-black",children:"✕"})}),jsxRuntimeExports.jsxs("div",{className:"pds2-flex-1 pds2-flex pds2-flex-col pds2-justify-start",children:[jsxRuntimeExports.jsx("div",{className:"pds2-flex pds2-justify-center pds2-mb-16",children:jsxRuntimeExports.jsx("div",{className:"pds2-w-64 pds2-h-64 pds2-rounded-full pds2-bg-bg-01 pds2-flex pds2-items-center pds2-justify-center",children:jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4ml1lwu00000tfs1okl7hs9.webp",alt:"ABHA Logo",className:"pds2-w-48 pds2-h-48"})})}),jsxRuntimeExports.jsx("h2",{className:"Heading3Semibold pds2-text-text-black",children:"Login with ABHA Number"}),jsxRuntimeExports.jsx("p",{className:"Body2Regular pds2-text-text-03 pds2-mb-24",children:"Enter your 14 digit ABHA Number"}),jsxRuntimeExports.jsx(Pds2InputField,{value:dt===ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER?ut||"":Pt,disabled:dt===ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER&&!!ut,onChange:Qt,placeholder:"00-0000-0000-0000",padding:"pds2-p-18",textStyle:"Body2Regular pds2-text-center pds2-text-lg",borderStyle:"focus-within:pds2-border-border-brand-01",type:"tel",inputMode:"numeric",autoFocus:!0,onKeyDown:Wt=>{Wt.key==="Enter"&&qt("after_enter_abha_number_on_click_by_user")}}),nt&&jsxRuntimeExports.jsx("div",{className:"pds2-text-text-error Body3Regular pds2-mt-12",children:nt}),jsxRuntimeExports.jsx(Pds2Button,{title:"Next",IconComponent:()=>jsxRuntimeExports.jsx(c$2,{className:"pds2-w-16 pds2-h-16 -pds2-rotate-90 pds2-ml-8"}),state:!$||et===LOADING_STATE.LOADING?"disabled":"enabled",onClick:()=>qt("after_enter_abha_number_on_click_by_user"),className:`pds2-w-full ${nt?"pds2-mt-12":"pds2-mt-24"}`,isLoading:et===LOADING_STATE.LOADING})]})]})}),jsxRuntimeExports.jsx(AbhaBottomSheet,{isOpen:Ut,setIsOpen:zt,setFlowMethod:_,children:jsxRuntimeExports.jsxs("div",{className:"pds2-p-24 pds2-text-center pds2-h-full pds2-flex pds2-flex-col",children:[jsxRuntimeExports.jsx("div",{className:"pds2-flex pds2-justify-end pds2-mb-16",children:jsxRuntimeExports.jsx("button",{onClick:()=>{it(null),zt(!1),_(ABHA_AUTH_FLOW_METHOD.MOBILE)},className:"pds2-w-24 pds2-h-24 pds2-flex pds2-items-center pds2-justify-center pds2-text-text-03 hover:pds2-text-text-black",children:"✕"})}),jsxRuntimeExports.jsxs("div",{className:"pds2-flex-1 pds2-flex pds2-flex-col pds2-justify-start",children:[jsxRuntimeExports.jsx("div",{className:"pds2-flex pds2-justify-center pds2-mb-16",children:jsxRuntimeExports.jsx("div",{className:"pds2-w-64 pds2-h-64 pds2-rounded-full pds2-bg-bg-01 pds2-flex pds2-items-center pds2-justify-center",children:jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4ml1lwu00000tfs1okl7hs9.webp",alt:"ABHA Logo",className:"pds2-w-48 pds2-h-48"})})}),jsxRuntimeExports.jsx("h2",{className:"Heading3Semibold pds2-text-text-black",children:"Login with ABHA Address"}),jsxRuntimeExports.jsx("p",{className:"Body2Regular pds2-text-text-03 pds2-mb-24",children:"Enter your ABHA Address below"}),jsxRuntimeExports.jsxs("div",{className:"pds2-relative",children:[jsxRuntimeExports.jsx(Pds2InputField,{value:dt===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS?(ut==null?void 0:ut.split("@")[0])||"":_t,disabled:dt===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS&&!!ut,onChange:Qt,placeholder:"Enter ABHA Address",inputMode:"text",autoFocus:!0,onKeyDown:Wt=>{Wt.key==="Enter"&&qt("after_enter_abha_address_on_click_by_user")}}),jsxRuntimeExports.jsx("div",{className:"pds2-absolute pds2-right-16 pds2-top-16 Body1Regular pds2-text-text-03",children:"@sbx"})]}),nt&&jsxRuntimeExports.jsx("div",{className:"pds2-text-text-error Body3Regular pds2-mt-12",children:nt}),jsxRuntimeExports.jsx(Pds2Button,{title:"Next",IconComponent:()=>jsxRuntimeExports.jsx(c$2,{className:"pds2-w-16 pds2-h-16 -pds2-rotate-90 pds2-ml-8"}),state:!$||et===LOADING_STATE.LOADING?"disabled":"enabled",onClick:()=>qt("after_enter_abha_address_on_click_by_user"),className:`pds2-w-full ${nt?"pds2-mt-12":"pds2-mt-24"}`,isLoading:et===LOADING_STATE.LOADING})]})]})})]})},AbhaBottomSheet=({isOpen:a,setIsOpen:_,children:$,setFlowMethod:_e,overlayClassName:et="pds2-bg-text-black pds2-bg-opacity-50"})=>{const[tt,rt]=reactExports.useState(a);return reactExports.useEffect(()=>{if(a)rt(!0);else{const nt=setTimeout(()=>rt(!1),300);return()=>clearTimeout(nt)}},[a]),tt?jsxRuntimeExports.jsxs("div",{className:`pds2-absolute pds2-inset-0 pds2-z-50 pds2-flex pds2-items-end pds2-transition-all pds2-duration-300 ${a?"pds2-opacity-100":"pds2-opacity-0 pointer-events-none"}`,children:[jsxRuntimeExports.jsx("div",{className:`pds2-absolute pds2-inset-0 ${et} pds2-transition-opacity pds2-duration-300`,style:{backgroundColor:"rgba(0, 0, 0, 0.5)"},onClick:()=>{_(!1),_e(ABHA_AUTH_FLOW_METHOD.MOBILE)}}),jsxRuntimeExports.jsx("div",{className:`pds2-relative pds2-bg-bg-white pds2-rounded-t-24 pds2-w-full pds2-transition-transform pds2-duration-300 ${a?"pds2-translate-y-0":"pds2-translate-y-full"}`,style:{height:"75%",maxHeight:"600px",overflowY:"auto"},children:$})]}):null},ScreenStack=()=>{const a=useAuthAbhaStore($=>$.screen);switch(a[a.length-1]){case SCREEN_NAMES.LOGIN_WITH_ABHA:return jsxRuntimeExports.jsx(LoginWithAbhaScreen,{});case SCREEN_NAMES.VERIFY_OTP_LOGIN_WITH_ABHA:return jsxRuntimeExports.jsx(AbhaLoginOtpVerifyScreen,{});case SCREEN_NAMES.CREATE_ABHA_WITH_AADHAAR:return jsxRuntimeExports.jsx(CreateAbhaWithAadhaarScreen,{});case SCREEN_NAMES.ABHA_OTP_AND_MOBILE:return jsxRuntimeExports.jsx(AbhaOtpAndMobileScreen,{});case SCREEN_NAMES.ABHA_PHONE_NUMBER_VERIFICATION:return jsxRuntimeExports.jsx(AbhaPhoneNumberVerificationScreen,{});case SCREEN_NAMES.AADHAAR_VERIFICATION_STATUS:return jsxRuntimeExports.jsx(AbhaAadhaarVerificationStatusScreen,{});case SCREEN_NAMES.ABHA_MOBILE_LINKING_STATUS:return jsxRuntimeExports.jsx(AbhaMobileLinkingStatusScreen,{});case SCREEN_NAMES.SELECT_ABHA_FROM_LIST:return jsxRuntimeExports.jsx(SelectAbhaFromListScreen,{});case SCREEN_NAMES.SELECT_EKA_PROFILE:return jsxRuntimeExports.jsx(SelectEkaProfileScreen,{});case SCREEN_NAMES.CREATE_ABHA_ADDRESS:return jsxRuntimeExports.jsx(CreateAbhaAddressScreen,{});case SCREEN_NAMES.CREATE_EKA_PROFILE:return jsxRuntimeExports.jsx(CreateEkaProfileScreen,{});case SCREEN_NAMES.CREATE_PHR_EKA_PROFILE:return jsxRuntimeExports.jsx(CreateEkaProfileScreen,{});case SCREEN_NAMES.GET_ALL_PROFILES:return jsxRuntimeExports.jsx(GetAllProfilesScreen,{});case SCREEN_NAMES.LOGIN_OR_CREATE_ABHA:return jsxRuntimeExports.jsx(LoginorCreateAbhaScreen,{});default:return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}},queryClient=new QueryClient;function App(){return reactExports.useEffect(()=>()=>{unMount()},[]),jsxRuntimeExports.jsx(QueryClientProvider,{client:queryClient,children:jsxRuntimeExports.jsx("div",{className:"pds2-h-full pds2-w-full pds2-bg-bg-white",style:{borderRadius:GET_CLIENT_ID()==="www-eka"?"1.5rem":void 0,position:"relative",height:GET_CLIENT_ID()==="www-eka"?"75vh":GET_CLIENT_ID()==="doc-web"?"100%":"100vh",overflowY:"auto",paddingTop:GET_CLIENT_ID()==="androiddoc"||GET_CLIENT_ID()==="doctor-app-ios"||GET_CLIENT_ID()==="doctor-ipad-ios"?"1rem":"0rem"},children:jsxRuntimeExports.jsx(ScreenStack,{})})})}const d=[[0,1,2,3,4,5,6,7,8,9],[1,2,3,4,0,6,7,8,9,5],[2,3,4,0,1,7,8,9,5,6],[3,4,0,1,2,8,9,5,6,7],[4,0,1,2,3,9,5,6,7,8],[5,9,8,7,6,0,4,3,2,1],[6,5,9,8,7,1,0,4,3,2],[7,6,5,9,8,2,1,0,4,3],[8,7,6,5,9,3,2,1,0,4],[9,8,7,6,5,4,3,2,1,0]],p=[[0,1,2,3,4,5,6,7,8,9],[1,5,7,6,2,8,3,0,9,4],[5,8,0,3,7,9,6,1,4,2],[8,9,1,6,0,4,3,5,2,7],[9,4,5,3,1,2,6,8,7,0],[4,2,8,6,5,7,3,9,0,1],[2,7,9,3,8,0,6,4,1,5],[7,0,4,6,9,1,3,2,5,8]];function verhoeffValidate(a){let _=0;const $=a.split("").reverse().map(_e=>parseInt(_e,10));for(let _e=0;_e<$.length;_e++)_=d[_][p[_e%8][$[_e]]];return _===0}function isValidAadhaar(a){return/^\d{12}$/.test(a)?verhoeffValidate(a):!1}const abhaRegex=/^[0-9]{14}$/;function luhnCheck(a){let _=0,$=!1;for(let _e=a.length-1;_e>=0;_e--){let et=parseInt(a[_e],10);$&&(et*=2,et>9&&(et-=9)),_+=et,$=!$}return _%10===0}function isValidABHA(a){return!abhaRegex.test(a)||a.split("").every($=>$===a[0])?!1:luhnCheck(a)}const isValidMobile=a=>/^[6-9]\d{9}$/.test(a),setIdentifier=(a,_)=>{useAuthAbhaStore.getState().setInitAbhaAppIdentifierType(a),useAuthAbhaStore.getState().setInitAbhaAppIdentifier(_)},handleIdentifier=(a,_,$)=>{if(a){const _e=a.replace(/-/g,"");if(_){setIdentifier(_,a);return}if(_e.endsWith("@sbx")){setIdentifier("phr_address",_e);return}if(/^\d+$/.test(_e)){const tt=_e.length;if(tt===12&&isValidAadhaar(_e)){setIdentifier("aadhaar_number",_e);return}if(tt===14&&isValidABHA(_e)){const rt=`${_e.slice(0,2)}-${_e.slice(2,6)}-${_e.slice(6,10)}-${_e.slice(10,14)}`;setIdentifier("abha_number",rt);return}if(tt===10&&isValidMobile(_e)){setIdentifier("mobile",_e);return}console.warn("Unknown numeric identifier type");return}console.warn("Unknown identifier type")}else console.warn("No identifier provided")};let PopupReactNode=null,unMount,onAbhaSuccess;function initAbhaApp(a){console.log("clear the abha auth store for every sdk invocation",a),useAuthAbhaStore.getState().clearAbhaAuthStore();const{clientId:_,containerId:$,urlParams:_e,method:et,data:tt,appVersion:rt,onSuccess:nt,onError:it,onAbhaClose:at}=a,{mobile:st,accessToken:ct,oid:ot,identifier:pt,identifier_type:ht}=tt||{};console.log("recieved identifier, identifier_type",pt,ht),handleSendEvent({eventName:"recieved_init_identifiers",eventData:{identifier:pt||"",identifier_type:ht||""}});const ft={};ct&&(ft.auth=ct),ot&&(ft["X-User-ID"]=ot),console.log("set headers in headers"),console.log("invoked initAbhaApp",ft);const gt=ft!==null&&("auth"in ft||"X-User-ID"in ft);useAuthAbhaStore.getState().setIsEkaAppLogin(gt),_==="doc-web"&&useAuthAbhaStore.getState().setIsEkaAppLogin(!0),console.log("clientId ",_),console.log("isEkaAppLogin",useAuthAbhaStore.getState().isEkaAppLogin),_==="androiddoc"||_==="doctor-app-ios"||_==="doctor-ipad-ios"||_==="doc-web"?useAuthAbhaStore.getState().setClientId("doctor"):_==="androidp"||_==="patient-app-ios"?useAuthAbhaStore.getState().setClientId("phr"):_==="www-eka"?useAuthAbhaStore.getState().setClientId("eka-web"):(console.log("here"),useAuthAbhaStore.getState().setClientId("phr"));let lt=!1;handleSendEvent({eventName:"init_abha_app",eventData:{platform:_,method:et||"",mobile:st||"",accessToken:ct||"",oid:ot||"",appVersion:rt||"",isEkaAppLogin:gt.toString(),container_id:$}}),onTrack("init_abha_app",{platform:_,method:et||"",mobile:st||"",accessToken:ft.auth||"",oid:ft["X-User-ID"]||"",appVersion:rt||"",isEkaAppLogin:gt.toString(),container_id:$}),(_==="androiddoc"||_==="doctor-app-ios"||_==="doctor-ipad-ios"||_==="doc-web")&&(lt=!0,useAuthAbhaStore.getState().setIsDocAppRequest(lt)),useAuthAbhaStore.getState().setInitAbhaAppMethod(et==="create_abha_with_mobile"?"create_abha_with_mobile":"login_with_abha"),setEnv({clientId:_,env:"DEV",...ft&&{extraHeaders:ft}}),console.log("isProd is",!1);const ut=SCREEN_NAMES.LOGIN_OR_CREATE_ABHA;useAuthAbhaStore.getState().setInitState({screen:[ut],urlParams:_e});const yt=ht&&["mobile","aadhaar_number","abha_number","phr_address"].includes(ht)?ht:void 0;handleIdentifier(pt,yt),useAuthAbhaStore.getState().setAbhaAuthFlowMethod(ABHA_AUTH_FLOW_METHOD.MOBILE);const Et=()=>{useAuthAbhaStore.getState().clearAbhaAuthStore(),queryClient.removeQueries(),PopupReactNode==null||PopupReactNode.unmount(),at()},St=document.getElementById($);if(!St){const At=`Element with id ${$} not found`;console.error(At),it({error:At}),Et();return}return onAbhaSuccess=nt,PopupReactNode=createRoot(St),PopupReactNode.render(jsxRuntimeExports.jsx(App,{})),unMount=Et,window.closeAbhaApp=Et,Et}window.initAbhaApp=initAbhaApp;function onTrack(a,_={}){var et;const $=useAuthAbhaStore.getState().clientId||"unknown-platform",_e={..._,platform:$};console.log("Tracking Event:",a,_e),(et=window.curio)!=null&&et.pushToMixpanel?(console.log("Pushing to Mixpanel:",a,_e),window.curio.pushToMixpanel(a,_e)):(console.log("Curio not available. Queuing event:",a,_e),console.error("Curio not available. Could not push event to Mixpanel."))}
146
+ pds2-transition-colors`,children:[jsxRuntimeExports.jsx("input",{type:"radio",name:"ekaProfile",value:Ot.oid,checked:Tt,onChange:()=>Nt({profile:Ot}),className:"pds2-self-start pds2-mt-4 pds2-w-14 pds2-h-14",onKeyDown:_t=>_t.key==="Enter"&&Rt()}),jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-flex-row pds2-items-center pds2-gap-x-8 pds2-flex-1",children:[jsxRuntimeExports.jsx("div",{className:"TitlesSubheadline pds2-text-text-primary",children:Ot.fln}),jsxRuntimeExports.jsx("span",{className:"pds2-ml-auto pds2-text-text-brand pds2-text-14 pds2-font-600",children:"Link"})]})]},Ot.oid)})}),jsxRuntimeExports.jsx(TextSeparator,{title:"or"}),jsxRuntimeExports.jsx(Pds2CustomButton,{title:"Create new Family Member",prefixIcon:jsxRuntimeExports.jsx(l$6,{}),className:"pds2-justify-center pds2-text-text-brand pds2-border-bg-fab-bg-brand-04 Body1Semibold",onClick:Mt})]})]}),jsxRuntimeExports.jsxs("div",{className:"pds2-sticky pds2-bottom-0 pds2-left-0 pds2-right-0 pds2-bg-bg-white pds2-shadow-lg pds2-p-16",children:[ot&&jsxRuntimeExports.jsx("div",{className:"pds2-text-text-error pds2-text-center pds2-mb-8",children:ot}),jsxRuntimeExports.jsx(Pds2Button,{title:"Continue",state:et===null||it===LOADING_STATE.LOADING?"disabled":"enabled",isLoading:it===LOADING_STATE.LOADING,className:"pds2-w-full",onClick:Rt})]})]}),jsxRuntimeExports.jsx(AbhaErrorBottomSheet,{onSubmitClick:Pt}),jsxRuntimeExports.jsx(ExitPopup,{open:st,setOpen:ct})]})},LoginorCreateAbhaScreen=()=>{const a=useAuthAbhaStore(_e=>_e.clientId);reactExports.useEffect(()=>{var _e;if((_e=window.EkaAbha)!=null&&_e.changeStatusBarColor)return window.EkaAbha.changeStatusBarColor("#F2F4F7"),()=>{var et,tt;(et=window.EkaAbha)!=null&&et.changeStatusBarColor&&((tt=window==null?void 0:window.EkaAbha)==null||tt.changeStatusBarColor("#FFFFFF"))}},[]);const _=()=>{var _e;(_e=window.EkaAbha)==null||_e.onAbhaClose(),unMount()},$=["eka-web","phr"];return jsxRuntimeExports.jsxs("div",{className:"pds2-h-full pds2-overflow-y-auto",children:[!$.includes(a)&&jsxRuntimeExports.jsx(Pds2Header,{prefixIcon:jsxRuntimeExports.jsx("button",{onClick:_,children:jsxRuntimeExports.jsx(n$2,{})}),title:"",className:"pds2-bg-bg-01"}),jsxRuntimeExports.jsx(LoginOrCreateWithDifferentMethods,{})]})},LoginOrCreateWithDifferentMethods=()=>{const a=useAuthAbhaStore(Wt=>Wt.abhaAuthFlowMethod||ABHA_AUTH_FLOW_METHOD.MOBILE),_=useAuthAbhaStore(Wt=>Wt.setAbhaAuthFlowMethod),[$,_e]=reactExports.useState(""),[et,tt]=reactExports.useState(LOADING_STATE.IDLE),rt=useAuthAbhaStore(Wt=>Wt.isEkaAppLogin),[nt,it]=reactExports.useState(""),at=useAuthAbhaStore(Wt=>Wt.setSelectedAbhaAddress),st=useAuthAbhaStore(Wt=>Wt.setLoginIdentifierValue),ct=useAuthAbhaStore(Wt=>Wt.setScreen),[ot,pt]=reactExports.useState({aadhaar:LOADING_STATE.IDLE,mobile:LOADING_STATE.IDLE}),ht=useAuthAbhaStore(Wt=>Wt.setRegistrationType),ft=useAuthAbhaStore(Wt=>Wt.setAadhaarInitResponse),gt=useAuthAbhaStore(Wt=>Wt.setMobileInitResponse),lt=useAuthAbhaStore(Wt=>Wt.initAbhaAppMobileNumber),dt=useAuthAbhaStore(Wt=>Wt.initAbhaAppIdentifierType),ut=useAuthAbhaStore(Wt=>Wt.initAbhaAppIdentifier),[mt,yt]=reactExports.useState(""),[Et,St]=reactExports.useState(!1),[At,Mt]=reactExports.useState(!1),[Nt,Rt]=reactExports.useState(""),[Pt,Lt]=reactExports.useState(""),[Ot,Tt]=reactExports.useState(""),[_t,bt]=reactExports.useState(""),vt=useAuthAbhaStore(Wt=>Wt.isNewLoginOrCreateFlow),xt=useAuthAbhaStore(Wt=>Wt.setIsNewLoginOrCreateFlow),Ct=useAuthAbhaStore(Wt=>Wt.clientId),wt=reactExports.useRef(!1),Dt=useAuthAbhaStore(Wt=>Wt.isInitApiTriggered),kt=useAuthAbhaStore(Wt=>Wt.setIsInitApiTriggered),It=useAuthAbhaStore(Wt=>Wt.setIdentityValue);useAuthAbhaStore(Wt=>Wt.identityValue);const jt=GET_EXTRA_HEADERS(),$t=useAuthAbhaStore(Wt=>Wt.setSelectedAbhaFlow),Kt=useAuthAbhaStore(Wt=>Wt.isDocAppRequest),Bt=useAuthAbhaStore(Wt=>Wt.txnId);reactExports.useEffect(()=>{Ht({name:"abha_login_or_create_screen",data:{flow:a.toString()}})}),reactExports.useEffect(()=>{ut&&dt===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS?(Tt(ut),_e(ut.split("@")[0]),lr(!0),zt(!0),_(ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS)):ut&&dt===ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER?(_e(ut),Lt(ut),lr(!0),er(!0),_(ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER)):ut&&dt===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER?(Rt(ut),Mt(!0),_e(ut),_(ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER)):ut&&dt===ABHA_AUTH_FLOW_METHOD.MOBILE?(yt(ut),_e(ut),St(ut.length===10),it(null),_(ABHA_AUTH_FLOW_METHOD.MOBILE)):(_e(""),it(null),St(!1),lr(!1),zt(!1),er(!1),_(ABHA_AUTH_FLOW_METHOD.MOBILE))},[dt]),reactExports.useEffect(()=>{Dt||wt.current||mt&&mt.length===10&&(kt(!0),wt.current=!0,qt("auto_submit_mobile"))},[mt]),reactExports.useEffect(()=>{Dt||wt.current||Nt&&Nt.length===12&&(kt(!0),wt.current=!0,qt("auto_submit_aadhaar"))},[Nt]),reactExports.useEffect(()=>{Dt||wt.current||Pt&&Pt.length===17&&(kt(!0),wt.current=!0,qt("auto_submit_abha"))},[Pt]),reactExports.useEffect(()=>{Dt||wt.current||Ot&&Ot.includes("@sbx")&&(kt(!0),wt.current=!0,qt("auto_submit_phr"))},[Ot]);const Ht=({name:Wt,data:Jt={}})=>{var hr,br;const or={...{login_platform:Ct,is_eka_app_login:rt?"true":"false",is_new_login_or_create_flow:vt?"true":"false",oid:jt!=null&&jt["X-User-ID"]?"true":"false",access_token:jt!=null&&jt.auth?"true":"false",txn_id:Bt||"missing txnId",flow:a??""},...Jt};handleSendEvent({eventName:Wt,eventData:or}),(br=(hr=window.curio)==null?void 0:hr.pushToMixpanel)==null||br.call(hr,Wt,or)},Vt=React.useMemo(()=>{switch(a){case ABHA_AUTH_FLOW_METHOD.MOBILE:return"Enter your Mobile Number";case ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER:return"Enter your Aadhaar Number";default:return""}},[a]),Qt=Wt=>{const Jt=Wt.target.value;switch(a){case ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS:if(Jt.length>20)return;bt(Jt),_e(Jt);break;case ABHA_AUTH_FLOW_METHOD.MOBILE:if(Jt&&!/^[0-9]+$/.test(Jt)||Jt.length>10)return;yt(Jt),St(!0),_e(Jt);break;case ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER:if(!/^[\d-]*$/.test(Jt)||Jt.length>17)return;const ur=Wt.target.value.replace(/-/g,"");let or="";return ur.length>0&&(or+=ur.slice(0,2)),ur.length>2&&(or+=`-${ur.slice(2,6)}`),ur.length>6&&(or+=`-${ur.slice(6,10)}`),ur.length>10&&(or+=`-${ur.slice(10,14)}`),Lt(or),_e(or.trim());case ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER:if(Jt&&!/^[0-9]+$/.test(Jt)||Jt.length>12)return;Rt(Jt),Mt(!0),_e(Jt);break}_e(Jt.trim())};ABHA_AUTH_FLOW_METHOD.MOBILE;const Xt=React.useMemo(()=>{switch(a){case ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS:return $.length>=4&&$.length<=20;case ABHA_AUTH_FLOW_METHOD.MOBILE:return $.length===10;case ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER:return $.length===17;case ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER:return $.length===12}},[a,$]),Yt=(Wt,Jt)=>{pt(ur=>({...ur,[Wt]:Jt}))},Gt=({inputVal:Wt})=>{Wt.length===12&&(_e(Wt),Rt(Wt),Mt(!0))};reactExports.useEffect(()=>{console.log("selectedMethod changed:==================>",a)},[a]);const qt=async Wt=>{var or,hr,br;xt(!0),Ht({name:"abha_login_next_click",data:{flow_step_type:Wt}}),tt(LOADING_STATE.LOADING),ht(REGISTRATION_TYPE.LOGIN);let Jt="";if(!rt){const xr=await postAuthLogoutV2();Ht({name:xr?"abha_logout_success":"abha_logout_failure",data:{platform:Ct}});const{txn_id:_r,error:gr}=await postAuthInitV2({method:AUTH_METHOD.ABHA});if(!_r||gr){Ht({name:"abha_auth_init_failure",data:{flow_step_type:"init",authTxnId:Jt,error_message:gr||"missing_txnId_or_unknown_error",error_message_exists:!!gr,txn_id_exists:!!_r}}),it((gr==null?void 0:gr.message)||"Something went wrong. Please try again."),tt(LOADING_STATE.REJECTED);return}Jt=_r,Ht({name:"abha_auth_init_success.",data:{flow_step_type:"init",auth_txnId:Jt}})}const ur=a===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS?`${$}@sbx`:$;if(a===ABHA_AUTH_FLOW_METHOD.MOBILE||a===ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER||a===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS){const{txn_id:xr,error:_r,action:gr,hint:Nr}=await postAbdmLoginInit({method:a,identifier:ur});if(It(ur),Ht({name:"abha_login_init_triggered",data:{flow_step_type:"init",authTxnId:Jt,ndhmTxnId:xr,method:a}}),a===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS&&at(ur),_r||!xr){if(((or=gr==null?void 0:gr.cta)==null?void 0:or.pid)==="abha_mobile_enroll"&&a===ABHA_AUTH_FLOW_METHOD.MOBILE){Yt("mobile",LOADING_STATE.LOADING),ht(REGISTRATION_TYPE.CREATE);const{txn_id:jr,hint:qr,error:Fr,action:$r}=await postRegisterMobileInit({mobile_number:$});if(It($),$t("mobile"),jr&&qr){gt({authTxnId:Jt,txnId:jr,mobileOtpSentToHint:qr}),Ht({name:"abha_mobile_registration_init_success",data:{flow_step_type:"init",authTxnId:Jt,ndhmTxnId:xr,error_message:Fr,error_action:gr}}),Yt("mobile",LOADING_STATE.RESOLVED),tt(LOADING_STATE.RESOLVED),ht(REGISTRATION_TYPE.CREATE),ct(SCREEN_NAMES.ABHA_PHONE_NUMBER_VERIFICATION);return}if(Yt("mobile",LOADING_STATE.REJECTED),Ht({name:"abha_mobile_registration_init_failure",data:{flow_step_type:"init",authTxnId:Jt,error_message:Fr||"unknown_error",error_message_exists:!!Fr,error_action_exists:!!$r}}),$r){if((hr=$r==null?void 0:$r.cta)!=null&&hr.pid)return ct(SCREEN_NAMES.LOGIN_OR_CREATE_ABHA)}else it(Fr||"Something went wrong");it(Fr||"Something went wrong. Please try again."),tt(LOADING_STATE.REJECTED);return}Ht({name:"abha_login_init_failure",data:{flow_step_type:"init",authTxnId:Jt,error_message:_r||"unknown_error",error_message_exists:!!_r,error_action_exists:!!gr}}),it(_r||"Something went wrong. Please try again."),tt(LOADING_STATE.REJECTED);return}Ht({name:"abha_login_init_success",data:{flow_step_type:"init",authTxnId:Jt,ndhmTxnId:xr,hint:Nr}}),ft({authTxnId:Jt,txnId:xr,aadhaarOtpSentToHint:Nr||null}),st(ur),tt(LOADING_STATE.RESOLVED),ct(SCREEN_NAMES.VERIFY_OTP_LOGIN_WITH_ABHA);return}if(a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER){Yt("aadhaar",LOADING_STATE.LOADING),Ht({name:"aadhaar_registration_init_start",data:{flow_step_type:"init",authTxnId:Jt,aadhaarNumber:$}});const{txn_id:xr,hint:_r,error:gr,action:Nr}=await postRegisterAadhaarInit({aadhaar_number:$});if(It($),$t("aadhaar"),xr&&_r){ft({authTxnId:Jt,txnId:xr,aadhaarOtpSentToHint:_r}),Ht({name:"aadhaar_registration_init_success",data:{flow_step_type:"verify",ndhmTxnId:xr,authTxnId:Jt}}),Yt("aadhaar",LOADING_STATE.RESOLVED),ht(REGISTRATION_TYPE.CREATE),tt(LOADING_STATE.RESOLVED),ct(SCREEN_NAMES.ABHA_OTP_AND_MOBILE);return}if(Ht({name:"abha_registration_init_failure",data:{error_message:gr||"unknown_error",error_message_exists:!!gr,auth_txn_id:Jt,error_action:Nr,error_action_exists:!!Nr}}),Yt("aadhaar",LOADING_STATE.REJECTED),tt(LOADING_STATE.REJECTED),Nr||gr){(br=Nr==null?void 0:Nr.cta)!=null&&br.pid?ct(SCREEN_NAMES.LOGIN_OR_CREATE_ABHA):it(gr||"Something went wrong");return}}},[nr,lr]=reactExports.useState(!1),[ar,er]=reactExports.useState(!1),[Ut,zt]=reactExports.useState(!1);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"pds2-pt-22 pds2-p-16 pds2-bg-bg-01 pds2-space-y-16 pds2-text-center pds2-rounded-b-24",children:[jsxRuntimeExports.jsx(AbhaStepper,{}),jsxRuntimeExports.jsx("div",{className:"pds2-flex pds2-justify-center pds2-items-center pds2-gap-16",children:jsxRuntimeExports.jsx("div",{className:"pds2-bg-bg-white pds2-rounded-16",children:jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4ml1lwu00000tfs1okl7hs9.webp",alt:"abha",className:"pds2-w-64 pds2-h-64"})})}),jsxRuntimeExports.jsx("div",{className:"Heading3Semibold pds2-text-text-black",children:Ct==="phr"?"Login or Create your ABHA":Kt?"Add Patient via ABHA":"Create your ABHA"}),jsxRuntimeExports.jsx("div",{className:"pds2-text-text-03",style:{marginTop:"4px"},children:a===ABHA_AUTH_FLOW_METHOD.MOBILE?"Enter your Mobile Number":a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER?"Enter your Aadhaar Number":a===ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER?"Enter your ABHA Number":a===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS?"Enter your ABHA Address":Vt}),(a===ABHA_AUTH_FLOW_METHOD.MOBILE||a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER)&&jsxRuntimeExports.jsxs("div",{className:"pds2-relative pds2-flex pds2-bg-bg-seperator-dark pds2-rounded-12 pds2-mt-4",children:[jsxRuntimeExports.jsx("div",{className:"pds2-absolute pds2-top-0 pds2-bottom-0 pds2-bg-bg-white pds2-rounded-12 pds2-transition-all pds2-duration-300",style:{left:a===ABHA_AUTH_FLOW_METHOD.MOBILE?0:"50%",width:"50%",boxShadow:"0px 10px 4px -6px #18274B17"}}),jsxRuntimeExports.jsxs("button",{onClick:()=>{_(ABHA_AUTH_FLOW_METHOD.MOBILE),it("")},className:"pds2-flex-1 pds2-py-6 pds2-flex pds2-items-center pds2-justify-center pds2-gap-8 pds2-relative pds2-z-10",children:[jsxRuntimeExports.jsx(n$1,{className:"pds2-w-14 pds2-h-14 pds2-text-icon-success-02"}),jsxRuntimeExports.jsx("span",{className:`pds2-text-base ${a===ABHA_AUTH_FLOW_METHOD.MOBILE?"pds2-font-bold pds2-text-fg-default":"pds2-font-normal pds2-text-fg-subtle"}`,style:a===ABHA_AUTH_FLOW_METHOD.MOBILE?{fontWeight:700}:{fontWeight:400},children:"Mobile"})]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{_(ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER),it("")},className:"pds2-flex-1 pds2-py-6 pds2-flex pds2-items-center pds2-justify-center pds2-gap-8 pds2-relative pds2-z-10",children:[jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm5mcdm3h00070tfs9fjkepff.webp",alt:"Aadhaar",className:"pds2-w-24 pds2-h-24"}),jsxRuntimeExports.jsx("span",{className:`pds2-text-base ${a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER?"pds2-font-bold pds2-text-fg-default":"pds2-font-normal pds2-text-fg-subtle"}`,style:a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER?{fontWeight:700}:{fontWeight:400},children:"Aadhaar"})]})]}),(a===ABHA_AUTH_FLOW_METHOD.MOBILE||a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER)&&jsxRuntimeExports.jsx("div",{className:"pds2-mt-16 pds2-w-full pds2-max-w-md pds2-mx-auto pds2-px-4 pds2-relative",children:a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER?jsxRuntimeExports.jsx(SpacedInputComponent,{initialValues:dt===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER?(ut==null?void 0:ut.match(/.{1,4}/g))??void 0:void 0,disabled:dt===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER&&!!ut,numberOfInputs:3,length:4,placeholder:"XXXX",onSubmit:Gt,setIsValid:Mt}):jsxRuntimeExports.jsx(Pds2InputField,{value:dt===ABHA_AUTH_FLOW_METHOD.MOBILE?ut||"":mt,disabled:dt===ABHA_AUTH_FLOW_METHOD.MOBILE&&!!ut,onChange:Qt,type:"tel",placeholder:"Mobile Number",inputMode:"numeric",autoFocus:!0,maxLength:10,PrefixComponent:jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-items-center pds2-gap-x-8 pds2-border-r pds2-border-border-brand-02 pds2-pr-24",children:[jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4mlct2900000tg98p8u967s.webp",alt:"India Flag",className:"pds2-w-24 pds2-h-24"}),jsxRuntimeExports.jsx("span",{className:"pds2-text-text-black pds2-text-sm",children:"+91"})]})})}),nt&&(a===ABHA_AUTH_FLOW_METHOD.MOBILE||a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER)&&jsxRuntimeExports.jsx("div",{className:"pds2-text-text-error Body3Regular",children:nt}),(a===ABHA_AUTH_FLOW_METHOD.MOBILE||a===ABHA_AUTH_FLOW_METHOD.AADHAR_NUMBER)&&jsxRuntimeExports.jsx(Pds2Button,{title:"Next",IconComponent:()=>jsxRuntimeExports.jsx(c$2,{className:"pds2-w-16 pds2-h-16 -pds2-rotate-90 pds2-ml-8"}),state:!Xt||et===LOADING_STATE.LOADING?"disabled":"enabled",isLoading:et===LOADING_STATE.LOADING,onClick:()=>qt("aadhaar_or_mobile_on_click"),className:"pds2-w-full"})]}),jsxRuntimeExports.jsxs("div",{className:"pds2-m-16 pds2-bg-bg-white pds2-rounded-16 pds2-border pds2-border-border-03 pds2-overflow-hidden",children:[jsxRuntimeExports.jsxs("button",{onClick:()=>lr(!nr),className:"pds2-w-full pds2-flex pds2-items-center pds2-justify-between pds2-p-16 pds2-bg-bg-white hover:pds2-bg-bg-02 pds2-transition-colors",children:[jsxRuntimeExports.jsx("span",{className:"pds2-text-text-03",children:"Other login options for ABHA"}),jsxRuntimeExports.jsx(c$2,{className:`pds2-w-16 pds2-h-16 pds2-text-text-03 pds2-transition-transform ${nr?"pds2-rotate-180":""}`})]}),jsxRuntimeExports.jsxs("div",{className:`pds2-overflow-hidden pds2-transition-all pds2-duration-300 ${nr?"pds2-max-h-126 pds2-opacity-100":"pds2-max-h-0 pds2-opacity-0"}`,children:[jsxRuntimeExports.jsxs("button",{onClick:()=>{lr(!1),_(ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER),er(!0),it("")},className:"pds2-w-full pds2-flex pds2-items-center pds2-justify-between pds2-p-12 hover:pds2-bg-bg-02 pds2-transition-colors",children:[jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-items-center pds2-gap-12",children:[jsxRuntimeExports.jsx("div",{className:"pds2-w-40 pds2-h-40 pds2-rounded-full pds2-bg-bg-02 pds2-flex pds2-items-center pds2-justify-center",children:jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4ml1lwu00000tfs1okl7hs9.webp",alt:"ABHA",className:"pds2-w-24 pds2-h-24"})}),jsxRuntimeExports.jsx("span",{className:"Body1Regular pds2-text-text-black",children:"Login with ABHA Number"})]}),jsxRuntimeExports.jsx(c$2,{className:"pds2-w-16 pds2-h-16 -pds2-rotate-90 pds2-text-text-03"})]}),jsxRuntimeExports.jsxs("button",{onClick:()=>{lr(!1),_(ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS),zt(!0),it("")},className:"pds2-w-full pds2-flex pds2-items-center pds2-justify-between pds2-p-12 hover:pds2-bg-bg-02 pds2-transition-colors",children:[jsxRuntimeExports.jsxs("div",{className:"pds2-flex pds2-items-center pds2-gap-12",children:[jsxRuntimeExports.jsx("div",{className:"pds2-w-40 pds2-h-40 pds2-rounded-full pds2-bg-bg-02 pds2-flex pds2-items-center pds2-justify-center",children:jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4ml1lwu00000tfs1okl7hs9.webp",alt:"ABHA",className:"pds2-w-24 pds2-h-24"})}),jsxRuntimeExports.jsx("span",{className:"Body1Regular pds2-text-text-black",children:"Login with ABHA Address"})]}),jsxRuntimeExports.jsx(c$2,{className:"pds2-w-16 pds2-h-16 -pds2-rotate-90 pds2-text-text-03"})]})]})]}),jsxRuntimeExports.jsx(AbhaBottomSheet,{isOpen:ar,setIsOpen:er,setFlowMethod:_,children:jsxRuntimeExports.jsxs("div",{className:"pds2-p-24 pds2-text-center pds2-h-full pds2-flex pds2-flex-col",children:[jsxRuntimeExports.jsx("div",{className:"pds2-flex pds2-justify-end pds2-mb-16",children:jsxRuntimeExports.jsx("button",{onClick:()=>{it(null),er(!1),_(ABHA_AUTH_FLOW_METHOD.MOBILE)},className:"pds2-w-24 pds2-h-24 pds2-flex pds2-items-center pds2-justify-center pds2-text-text-03 hover:pds2-text-text-black",children:"✕"})}),jsxRuntimeExports.jsxs("div",{className:"pds2-flex-1 pds2-flex pds2-flex-col pds2-justify-start",children:[jsxRuntimeExports.jsx("div",{className:"pds2-flex pds2-justify-center pds2-mb-16",children:jsxRuntimeExports.jsx("div",{className:"pds2-w-64 pds2-h-64 pds2-rounded-full pds2-bg-bg-01 pds2-flex pds2-items-center pds2-justify-center",children:jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4ml1lwu00000tfs1okl7hs9.webp",alt:"ABHA Logo",className:"pds2-w-48 pds2-h-48"})})}),jsxRuntimeExports.jsx("h2",{className:"Heading3Semibold pds2-text-text-black",children:"Login with ABHA Number"}),jsxRuntimeExports.jsx("p",{className:"Body2Regular pds2-text-text-03 pds2-mb-24",children:"Enter your 14 digit ABHA Number"}),jsxRuntimeExports.jsx(Pds2InputField,{value:dt===ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER?ut||"":Pt,disabled:dt===ABHA_AUTH_FLOW_METHOD.ABHA_NUMBER&&!!ut,onChange:Qt,placeholder:"00-0000-0000-0000",padding:"pds2-p-18",textStyle:"Body2Regular pds2-text-center pds2-text-lg",borderStyle:"focus-within:pds2-border-border-brand-01",type:"tel",inputMode:"numeric",autoFocus:!0,onKeyDown:Wt=>{Wt.key==="Enter"&&qt("after_enter_abha_number_on_click_by_user")}}),nt&&jsxRuntimeExports.jsx("div",{className:"pds2-text-text-error Body3Regular pds2-mt-12",children:nt}),jsxRuntimeExports.jsx(Pds2Button,{title:"Next",IconComponent:()=>jsxRuntimeExports.jsx(c$2,{className:"pds2-w-16 pds2-h-16 -pds2-rotate-90 pds2-ml-8"}),state:!$||et===LOADING_STATE.LOADING?"disabled":"enabled",onClick:()=>qt("after_enter_abha_number_on_click_by_user"),className:`pds2-w-full ${nt?"pds2-mt-12":"pds2-mt-24"}`,isLoading:et===LOADING_STATE.LOADING})]})]})}),jsxRuntimeExports.jsx(AbhaBottomSheet,{isOpen:Ut,setIsOpen:zt,setFlowMethod:_,children:jsxRuntimeExports.jsxs("div",{className:"pds2-p-24 pds2-text-center pds2-h-full pds2-flex pds2-flex-col",children:[jsxRuntimeExports.jsx("div",{className:"pds2-flex pds2-justify-end pds2-mb-16",children:jsxRuntimeExports.jsx("button",{onClick:()=>{it(null),zt(!1),_(ABHA_AUTH_FLOW_METHOD.MOBILE)},className:"pds2-w-24 pds2-h-24 pds2-flex pds2-items-center pds2-justify-center pds2-text-text-03 hover:pds2-text-text-black",children:"✕"})}),jsxRuntimeExports.jsxs("div",{className:"pds2-flex-1 pds2-flex pds2-flex-col pds2-justify-start",children:[jsxRuntimeExports.jsx("div",{className:"pds2-flex pds2-justify-center pds2-mb-16",children:jsxRuntimeExports.jsx("div",{className:"pds2-w-64 pds2-h-64 pds2-rounded-full pds2-bg-bg-01 pds2-flex pds2-items-center pds2-justify-center",children:jsxRuntimeExports.jsx("img",{src:"https://cdn.eka.care/vagus/cm4ml1lwu00000tfs1okl7hs9.webp",alt:"ABHA Logo",className:"pds2-w-48 pds2-h-48"})})}),jsxRuntimeExports.jsx("h2",{className:"Heading3Semibold pds2-text-text-black",children:"Login with ABHA Address"}),jsxRuntimeExports.jsx("p",{className:"Body2Regular pds2-text-text-03 pds2-mb-24",children:"Enter your ABHA Address below"}),jsxRuntimeExports.jsxs("div",{className:"pds2-relative",children:[jsxRuntimeExports.jsx(Pds2InputField,{value:dt===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS?(ut==null?void 0:ut.split("@")[0])||"":_t,disabled:dt===ABHA_AUTH_FLOW_METHOD.PHR_ADDRESS&&!!ut,onChange:Qt,placeholder:"Enter ABHA Address",inputMode:"text",autoFocus:!0,onKeyDown:Wt=>{Wt.key==="Enter"&&qt("after_enter_abha_address_on_click_by_user")}}),jsxRuntimeExports.jsx("div",{className:"pds2-absolute pds2-right-16 pds2-top-16 Body1Regular pds2-text-text-03",children:"@sbx"})]}),nt&&jsxRuntimeExports.jsx("div",{className:"pds2-text-text-error Body3Regular pds2-mt-12",children:nt}),jsxRuntimeExports.jsx(Pds2Button,{title:"Next",IconComponent:()=>jsxRuntimeExports.jsx(c$2,{className:"pds2-w-16 pds2-h-16 -pds2-rotate-90 pds2-ml-8"}),state:!$||et===LOADING_STATE.LOADING?"disabled":"enabled",onClick:()=>qt("after_enter_abha_address_on_click_by_user"),className:`pds2-w-full ${nt?"pds2-mt-12":"pds2-mt-24"}`,isLoading:et===LOADING_STATE.LOADING})]})]})})]})},AbhaBottomSheet=({isOpen:a,setIsOpen:_,children:$,setFlowMethod:_e,overlayClassName:et="pds2-bg-text-black pds2-bg-opacity-50"})=>{const[tt,rt]=reactExports.useState(a);return reactExports.useEffect(()=>{if(a)rt(!0);else{const nt=setTimeout(()=>rt(!1),300);return()=>clearTimeout(nt)}},[a]),tt?jsxRuntimeExports.jsxs("div",{className:`pds2-absolute pds2-inset-0 pds2-z-50 pds2-flex pds2-items-end pds2-transition-all pds2-duration-300 ${a?"pds2-opacity-100":"pds2-opacity-0 pointer-events-none"}`,children:[jsxRuntimeExports.jsx("div",{className:`pds2-absolute pds2-inset-0 ${et} pds2-transition-opacity pds2-duration-300`,style:{backgroundColor:"rgba(0, 0, 0, 0.5)"},onClick:()=>{_(!1),_e(ABHA_AUTH_FLOW_METHOD.MOBILE)}}),jsxRuntimeExports.jsx("div",{className:`pds2-relative pds2-bg-bg-white pds2-rounded-t-24 pds2-w-full pds2-transition-transform pds2-duration-300 ${a?"pds2-translate-y-0":"pds2-translate-y-full"}`,style:{height:"75%",maxHeight:"600px",overflowY:"auto"},children:$})]}):null},ScreenStack=()=>{const a=useAuthAbhaStore($=>$.screen);switch(a[a.length-1]){case SCREEN_NAMES.LOGIN_WITH_ABHA:return jsxRuntimeExports.jsx(LoginWithAbhaScreen,{});case SCREEN_NAMES.VERIFY_OTP_LOGIN_WITH_ABHA:return jsxRuntimeExports.jsx(AbhaLoginOtpVerifyScreen,{});case SCREEN_NAMES.CREATE_ABHA_WITH_AADHAAR:return jsxRuntimeExports.jsx(CreateAbhaWithAadhaarScreen,{});case SCREEN_NAMES.ABHA_OTP_AND_MOBILE:return jsxRuntimeExports.jsx(AbhaOtpAndMobileScreen,{});case SCREEN_NAMES.ABHA_PHONE_NUMBER_VERIFICATION:return jsxRuntimeExports.jsx(AbhaPhoneNumberVerificationScreen,{});case SCREEN_NAMES.AADHAAR_VERIFICATION_STATUS:return jsxRuntimeExports.jsx(AbhaAadhaarVerificationStatusScreen,{});case SCREEN_NAMES.ABHA_MOBILE_LINKING_STATUS:return jsxRuntimeExports.jsx(AbhaMobileLinkingStatusScreen,{});case SCREEN_NAMES.SELECT_ABHA_FROM_LIST:return jsxRuntimeExports.jsx(SelectAbhaFromListScreen,{});case SCREEN_NAMES.SELECT_EKA_PROFILE:return jsxRuntimeExports.jsx(SelectEkaProfileScreen,{});case SCREEN_NAMES.CREATE_ABHA_ADDRESS:return jsxRuntimeExports.jsx(CreateAbhaAddressScreen,{});case SCREEN_NAMES.CREATE_EKA_PROFILE:return jsxRuntimeExports.jsx(CreateEkaProfileScreen,{});case SCREEN_NAMES.CREATE_PHR_EKA_PROFILE:return jsxRuntimeExports.jsx(CreateEkaProfileScreen,{});case SCREEN_NAMES.GET_ALL_PROFILES:return jsxRuntimeExports.jsx(GetAllProfilesScreen,{});case SCREEN_NAMES.LOGIN_OR_CREATE_ABHA:return jsxRuntimeExports.jsx(LoginorCreateAbhaScreen,{});default:return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}},queryClient=new QueryClient;function App(){return reactExports.useEffect(()=>()=>{unMount()},[]),jsxRuntimeExports.jsx(QueryClientProvider,{client:queryClient,children:jsxRuntimeExports.jsx("div",{className:"pds2-h-full pds2-w-full pds2-bg-bg-white",style:{borderRadius:GET_CLIENT_ID()==="www-eka"?"1.5rem":void 0,position:"relative",height:GET_CLIENT_ID()==="www-eka"?"75vh":GET_CLIENT_ID()==="doc-web"?"100%":"100vh",overflowY:"auto",paddingTop:GET_CLIENT_ID()==="androiddoc"||GET_CLIENT_ID()==="doctor-app-ios"||GET_CLIENT_ID()==="doctor-ipad-ios"?"1rem":"0rem"},children:jsxRuntimeExports.jsx(ScreenStack,{})})})}const d=[[0,1,2,3,4,5,6,7,8,9],[1,2,3,4,0,6,7,8,9,5],[2,3,4,0,1,7,8,9,5,6],[3,4,0,1,2,8,9,5,6,7],[4,0,1,2,3,9,5,6,7,8],[5,9,8,7,6,0,4,3,2,1],[6,5,9,8,7,1,0,4,3,2],[7,6,5,9,8,2,1,0,4,3],[8,7,6,5,9,3,2,1,0,4],[9,8,7,6,5,4,3,2,1,0]],p=[[0,1,2,3,4,5,6,7,8,9],[1,5,7,6,2,8,3,0,9,4],[5,8,0,3,7,9,6,1,4,2],[8,9,1,6,0,4,3,5,2,7],[9,4,5,3,1,2,6,8,7,0],[4,2,8,6,5,7,3,9,0,1],[2,7,9,3,8,0,6,4,1,5],[7,0,4,6,9,1,3,2,5,8]];function verhoeffValidate(a){let _=0;const $=a.split("").reverse().map(_e=>parseInt(_e,10));for(let _e=0;_e<$.length;_e++)_=d[_][p[_e%8][$[_e]]];return _===0}function isValidAadhaar(a){return/^\d{12}$/.test(a)?verhoeffValidate(a):!1}const abhaRegex=/^[0-9]{14}$/;function luhnCheck(a){let _=0,$=!1;for(let _e=a.length-1;_e>=0;_e--){let et=parseInt(a[_e],10);$&&(et*=2,et>9&&(et-=9)),_+=et,$=!$}return _%10===0}function isValidABHA(a){return!abhaRegex.test(a)||a.split("").every($=>$===a[0])?!1:luhnCheck(a)}const isValidMobile=a=>/^[6-9]\d{9}$/.test(a),setIdentifier=(a,_)=>{useAuthAbhaStore.getState().setInitAbhaAppIdentifierType(a),useAuthAbhaStore.getState().setInitAbhaAppIdentifier(_)},handleIdentifier=(a,_,$)=>{if(a){const _e=a.replace(/-/g,"");if(_){setIdentifier(_,a);return}if(_e.endsWith("@sbx")){setIdentifier("phr_address",_e);return}if(/^\d+$/.test(_e)){const tt=_e.length;if(tt===12&&isValidAadhaar(_e)){setIdentifier("aadhaar_number",_e);return}if(tt===14&&isValidABHA(_e)){const rt=`${_e.slice(0,2)}-${_e.slice(2,6)}-${_e.slice(6,10)}-${_e.slice(10,14)}`;setIdentifier("abha_number",rt);return}if(tt===10&&isValidMobile(_e)){setIdentifier("mobile",_e);return}console.warn("Unknown numeric identifier type");return}console.warn("Unknown identifier type")}else console.warn("No identifier provided")};let PopupReactNode=null,unMount,onAbhaSuccess;function initAbhaApp(a){console.log("clear the abha auth store for every sdk invocation",a),useAuthAbhaStore.getState().clearAbhaAuthStore();const{clientId:_,containerId:$,urlParams:_e,method:et,data:tt,appVersion:rt,onSuccess:nt,onError:it,onAbhaClose:at}=a,{mobile:st,accessToken:ct,oid:ot,identifier:pt,identifier_type:ht}=tt||{};console.log("recieved identifier, identifier_type",pt,ht),handleSendEvent({eventName:"recieved_init_identifiers",eventData:{identifier:pt||"",identifier_type:ht||""}});const ft={};ct&&(ft.auth=ct),ot&&(ft["X-User-ID"]=ot),console.log("set headers in headers"),console.log("invoked initAbhaApp",ft);const gt=ft!==null&&("auth"in ft||"X-User-ID"in ft);useAuthAbhaStore.getState().setIsEkaAppLogin(gt),_==="doc-web"&&useAuthAbhaStore.getState().setIsEkaAppLogin(!0),console.log("clientId ",_),console.log("isEkaAppLogin",useAuthAbhaStore.getState().isEkaAppLogin),_==="androiddoc"||_==="doctor-app-ios"||_==="doctor-ipad-ios"||_==="doc-web"?useAuthAbhaStore.getState().setClientId("doctor"):_==="androidp"||_==="patient-app-ios"?useAuthAbhaStore.getState().setClientId("phr"):_==="www-eka"?useAuthAbhaStore.getState().setClientId("eka-web"):(console.log("here"),useAuthAbhaStore.getState().setClientId("phr"));let lt=!1;handleSendEvent({eventName:"init_abha_app",eventData:{platform:_,method:et||"",mobile:st||"",accessToken:ct||"",oid:ot||"",appVersion:rt||"",isEkaAppLogin:gt.toString(),container_id:$}}),onTrack("init_abha_app",{platform:_,method:et||"",mobile:st||"",accessToken:ft.auth||"",oid:ft["X-User-ID"]||"",appVersion:rt||"",isEkaAppLogin:gt.toString(),container_id:$}),(_==="androiddoc"||_==="doctor-app-ios"||_==="doctor-ipad-ios"||_==="doc-web")&&(lt=!0,useAuthAbhaStore.getState().setIsDocAppRequest(lt)),useAuthAbhaStore.getState().setInitAbhaAppMethod(et==="create_abha_with_mobile"?"create_abha_with_mobile":"login_with_abha"),setEnv({clientId:_,env:"DEV",...ft&&{extraHeaders:ft}}),console.log("isProd is",!1);const ut=SCREEN_NAMES.LOGIN_OR_CREATE_ABHA;useAuthAbhaStore.getState().setInitState({screen:[ut],urlParams:_e});const yt=ht&&["mobile","aadhaar_number","abha_number","phr_address"].includes(ht)?ht:void 0;handleIdentifier(pt,yt),useAuthAbhaStore.getState().setAbhaAuthFlowMethod(ABHA_AUTH_FLOW_METHOD.MOBILE);const Et=()=>{useAuthAbhaStore.getState().clearAbhaAuthStore(),queryClient.removeQueries(),PopupReactNode==null||PopupReactNode.unmount(),at()},St=document.getElementById($);if(!St){const At=`Element with id ${$} not found`;console.error(At),it({error:At}),Et();return}return onAbhaSuccess=nt,PopupReactNode=createRoot(St),PopupReactNode.render(jsxRuntimeExports.jsx(App,{})),unMount=Et,window.closeAbhaApp=Et,Et}window.initAbhaApp=initAbhaApp;function onTrack(a,_={}){var et;const $=useAuthAbhaStore.getState().clientId||"unknown-platform",_e={..._,platform:$};console.log("Tracking Event:",a,_e),(et=window.curio)!=null&&et.pushToMixpanel?(console.log("Pushing to Mixpanel:",a,_e),window.curio.pushToMixpanel(a,_e)):(console.log("Curio not available. Queuing event:",a,_e),console.error("Curio not available. Could not push event to Mixpanel."))}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eka-care/abha-stg",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "VITE_APP_MODE=DEBUG vite",