function handleIframeResult( eventFromIframe ) {
	if ( eventFromIframe.origin === 'https://subscribe.wordpress.com' && eventFromIframe.data ) {
		const data = JSON.parse( eventFromIframe.data );
		if ( data && data.action === 'close' ) {
			window.removeEventListener( 'message', handleIframeResult );
			tb_remove();
		}
	}
}
/**
 * Since "close" button is inside our checkout iframe, in order to close it, it has to pass a message to higher scope to close the modal.
 *
 * @param {event} eventFromIframe - message event that gets emmited in the checkout iframe.
 * @listens message
 */
Since "close" button is inside our checkout iframe, in order to close it, it has to pass a message to higher scope to close the modal.
@param {event} eventFromIframe - message event that gets emmited in the checkout iframe.
@listens message
Since " close " button is inside our checkout iframe in order to close it it has to pass a message to higher scope to close the modal . @param { event } eventFromIframe - message event that gets emmited in the checkout iframe . @listens message
function handleIframeResult( eventFromIframe ) {
	if ( eventFromIframe.origin === 'https://subscribe.wordpress.com' && eventFromIframe.data ) {
		const data = JSON.parse( eventFromIframe.data );
		if ( data && data.action === 'close' ) {
			window.removeEventListener( 'message', handleIframeResult );
			tb_remove();
		}
	}
}
function handleIframeResult ( eventFromIframe ) { if ( eventFromIframe . origin === 'https://subscribe.wordpress.com' && eventFromIframe . data ) { const data = JSON . parse ( eventFromIframe . data ) ; if ( data && data . action === 'close' ) { window . removeEventListener ( 'message' , handleIframeResult ) ; tb_remove ( ) ; } } }
Since "close" button is inside our checkout iframe, in order to close it, it has to pass a message to higher scope to close the modal.
Since " close " button is inside our checkout iframe in order to close it it has to pass a message to higher scope to close the modal .