/**
 * Redirect to Square Hosted Checkout after CF7 AJAX submission.
 */
( function () {
	document.addEventListener( 'wpcf7submit', function ( event ) {
		var detail = event.detail || {};
		var api = detail.apiResponse || {};
		var redirect = api.redirect || '';

		if ( redirect ) {
			window.location.href = redirect;
		}
	} );
}() );
