import { BaseExtensionMessageData } from "./types" ; export function sendMessageToDashboard < T extends BaseExtensionMessageData > ( message , targetOrigin ) { if ( ! ! window . parent ) { window . parent . postMessage ( message , targetOrigin ) ; } } export function sendMessageToExtension < T extends BaseExtensionMessageData > ( message , targetOrigin ) { const appFrame = document . querySelector ( "#extension-app" ) ; if ( ! ! appFrame ?. contentWindow ) { appFrame . contentWindow . postMessage ( message , targetOrigin ) ; } }