postMessage contract between the embed iframe
(/embed) and its host wrappers. Zero dependencies.
Most integrations don’t install this directly. Use
@revinel/browser
(vanilla) or @revinel/react (React) instead; they depend on this package and expose
a friendlier API. Reach for @revinel/embeds only when building a custom host integration.Install
What’s in it
RevinelEmbedMessage: the typed union of messages the embed posts (revinel:resize/ready/checkout/error).isEmbedMessage(event, iframe): trust guard,trueonly when aMessageEventcame fromiframe’s own window and origin. Call this before trusting any inbound message.handleEmbedMessage(data, handlers): parse a validated payload and dispatch it toonResize/onReady/onCheckout/onError.buildEmbedUrl({ appUrl, workspaceId, theme }): build the/embediframe URL.EMBED_THEMES/RevinelEmbedTheme,DEFAULT_EMBED_APP_URL,DEFAULT_EMBED_HEIGHT.