import getOrigin from "coral-common/utils/getOrigin" ; param fallbackID function getCurrentScriptOrigin ( fallbackID ? ) { let script = document . currentScript as HTMLScriptElement | null ; if ( ! script && fallbackID ) { script = document . getElementById ( fallbackID ) as HTMLScriptElement | null ; if ( ! script ) { script = document . querySelector ( `.${ fallbackID }` ) ; } } if ( ! script ) { if ( process . env . NODE_ENV === "development" ) { return window . location . origin ; } throw new Error ( "Current script not found" ) ; } return getOrigin ( script . src ) ; } export default getCurrentScriptOrigin ;