@arrowhealth/bridge-sdk
Version:
Bridge SDK provides web applications the ability to integrate with the Bridge Platform.
4 lines (3 loc) • 3.71 kB
JavaScript
/* Bridge SDK provided by Novo Health 2021-present. All rights reserved. */
var e,n;!function(e){e.ADVANCEDMD="advancedmd",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.HENO="heno",e.IKNOWMED="iknowmed",e.NETHEALTH="nethealth",e.NETSMART="netsmart",e.NEXTGEN="nextgen",e.OFFICEALLY="Office Ally",e.ONCOEMR="oncoemr",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.THRIVE="thrive",e.TEBRA="tebra",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::on_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",o,!1);const E=e=>n(e.detail,e.detail.srcWindow);return window.addEventListener(e,E),()=>{0==--t&&window.removeEventListener(e,E)}}const i="BRIDGE_EVENT";function o(e){if("string"!=typeof e.data)return;let n;try{n=JSON.parse(e.data)}catch(e){return}n.eventType===i&&(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.8.0";function d(e=!1){return new Promise((t=>{a||t(null);const i=E(n.GET_PAGE,(({data:e})=>{i(),t(e)}));f(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)}));f(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)}));f(n.GET_PLATFORM)}))}function N(e=0){f(n.SET_BADGE_COUNT,e)}function u(){f(n.SHOW_TILE)}function A(){f(n.HIDE_TILE)}function O(){f(n.ENABLE_TILE)}function w(){f(n.DISABLE_TILE)}function I(){f(n.CAPTURE_USER_EVENTS)}function R(){f(n.RELEASE_USER_EVENTS)}function p(){f(n.CLOSE_APP)}function P(e){f(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)}));f(n.GET_OPEN_ENCOUNTER)}))}function g(e){return E(n.SET_OPEN_ENCOUNTER,(n=>e(n.data)))}function l(e){return E(n.SET_PATIENT_INFO,(n=>e(n.data)))}function f(e,n){let t=window.parent;window.opener&&(t=window.opener),window!==t?window.name?function(e,n,t){const E={event:n,eventType:i,...t};e.postMessage(JSON.stringify(E),"*")}(t,e,{appId:window.name,data:n}):console.warn("No app id assigned. Cannot post request."):console.warn("Cannot post message to self. No parent window found.")}export{e as PlatformKind,I as captureUserEvents,p as closeApp,w as disableTile,O as enableTile,S as getOpenEncounter,d as getPage,s as getPatient,c as getPlatform,A as hideTile,a as inBridge,T as inIframe,r as inPopout,g as onOpenEncounterChanged,l as onPatientChanged,P as pushNotification,R as releaseUserEvents,N as setBadgeCount,u as showTile,_ as version};
//# sourceMappingURL=bridge.min.mjs.map