@arrowhealth/bridge-sdk
Version:
Bridge SDK provides web applications the ability to integrate with the Bridge Platform.
4 lines (3 loc) • 3.91 kB
JavaScript
/* Bridge SDK provided by Novo Health 2021-present. All rights reserved. */
var e,n;!function(e){e.ADVANCEDMD="advancedmd",e.ATHELAS="athelas",e.ATHENA="Athena",e.AZALEA="azalea",e.AZARA="azara",e.CAREECO="careeco",e.CLINICIENT="clinicient",e.CROSSTX="crosstx",e.ECW="eCW",e.ELATION="Elation",e.EMPOWER="empower",e.GGASTRO="ggastro",e.HELLONOTE="hellonote",e.HENO="heno",e.IKNOWMED="iknowmed",e.MATRIXCARE="matrixcare",e.MODMED="modmed",e.NETHEALTH="nethealth",e.NETSMART="netsmart",e.NEXTGEN="nextgen",e.OFFICEALLY="Office Ally",e.ONCOEMR="oncoemr",e.POINTCLICKCARE="pointclickcare",e.PRACTICEFUSION="practicefusion",e.PROMPT="prompt",e.PTEVERYWHERE="pteverywhere",e.PTPRACTICEPRO="ptpracticepro",e.RAINTREE="raintree",e.SIRRUS="sirrus",e.STRATAEMR="strataemr",e.STRATUS="stratus",e.STRIDE="stride",e.THRIVE="thrive",e.TEBRA="tebra",e.TOUCHWORKS="touchworks",e.TURBOPT="turbopt",e.WEBPT="webpt",e.OTHER="Other"}(e||(e={})),function(e){e.CAPTURE_USER_EVENTS="bridge::capture_user_events",e.CLOSE_APP="bridge::close_app",e.DISABLE_TILE="bridge::disable_tile",e.ENABLE_TILE="bridge::enable_tile",e.GET_OPEN_ENCOUNTER="bridge::get_open_encounter",e.GET_PAGE="bridge::get_page",e.GET_PATIENT_INFO="bridge::get_patient",e.GET_PLATFORM="bridge::get_platform",e.HIDE_TILE="bridge::hide_tile",e.LOGIN="bridge::login",e.LOGOUT="bridge::logout",e.SET_OPEN_ENCOUNTER="bridge::set_open_encounter",e.PUSH_NOTIFICATION="bridge::push_notification",e.RELEASE_USER_EVENTS="bridge::release_user_events",e.SET_BADGE_COUNT="bridge::set_badge_count",e.SET_PATIENT_INFO="bridge::set_patient",e.SHOW_TILE="bridge::show_tile",e.DEPRECATED_GET_AUTH_USER="bridge::get_auth_user"}(n||(n={}));let t=0;function E(e,n){0===t++&&window.addEventListener("message",i,!1);const E=e=>n(e.detail,e.detail.srcWindow);return window.addEventListener(e,E),()=>{window.removeEventListener(e,E),0===--t&&window.removeEventListener("message",i)}}const o="BRIDGE_EVENT";function i(e){if("string"!=typeof e.data)return;let n;try{n=JSON.parse(e.data)}catch{return}n.eventType===o&&(n.srcWindow=e.source,window.dispatchEvent(new CustomEvent(n.event,{detail:n})))}const r=!(!window.opener||window.opener===window),T=!r&&window.parent!==window,a=(window.name+"").includes("bridge_"),_="2.9.3";function d(e=!1){return new Promise(t=>{a||t(null);const o=E(n.GET_PAGE,({data:e})=>{o(),t(e)});C(n.GET_PAGE,{deep:e})})}async function s(){return new Promise(e=>{a||e(null);const t=E(n.GET_PATIENT_INFO,({data:n})=>{t(),e(n)});C(n.GET_PATIENT_INFO)})}async function c(){return new Promise(e=>{a||e(null);const t=E(n.GET_PLATFORM,({data:n})=>{t(),e(n)});C(n.GET_PLATFORM)})}function N(e=0){C(n.SET_BADGE_COUNT,e)}function A(){C(n.SHOW_TILE)}function O(){C(n.HIDE_TILE)}function u(){C(n.ENABLE_TILE)}function w(){C(n.DISABLE_TILE)}function R(){C(n.CAPTURE_USER_EVENTS)}function I(){C(n.RELEASE_USER_EVENTS)}function p(){C(n.CLOSE_APP)}function P(e){C(n.PUSH_NOTIFICATION,e)}function S(){return new Promise(e=>{a||e(null);const t=E(n.GET_OPEN_ENCOUNTER,({data:n})=>{t(),e(n)});C(n.GET_OPEN_ENCOUNTER)})}function l(e){return E(n.SET_OPEN_ENCOUNTER,n=>e(n.data))}function g(e){return E(n.SET_PATIENT_INFO,n=>e(n.data))}function C(e,n){let t=window.parent;window.opener&&(t=window.opener),window!==t?window.name?function(e,n,t){const E={event:n,eventType:o,...t};e.postMessage(JSON.stringify(E),"*")}(t,e,{appId:window.name,data:n,sdkVersion:_}):console.warn("No app id assigned. Cannot post request."):console.warn("Cannot post message to self. No parent window found.")}export{e as PlatformKind,R as captureUserEvents,p as closeApp,w as disableTile,u as enableTile,S as getOpenEncounter,d as getPage,s as getPatient,c as getPlatform,O as hideTile,a as inBridge,T as inIframe,r as inPopout,l as onOpenEncounterChanged,g as onPatientChanged,P as pushNotification,I as releaseUserEvents,N as setBadgeCount,A as showTile,_ as version};
//# sourceMappingURL=bridge.min.mjs.map