As the window message API could change in the future, typescript types should be exported that ensure that apps are listening & emitting the proper events, i.e.
import { ClappyButtonMessage } from 'clappy-button';
const successMessage: ClappyButtonMessage = { app: 'clappy-button', event: 'success', instanceId: 'cb1' };
window.postMessage(successMessage)
As the window message API could change in the future, typescript types should be exported that ensure that apps are listening & emitting the proper events, i.e.