Back

100% Statements 2/2
100% Branches 2/2
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17                          7x 7x    
import { getScriptData } from '@automattic/jetpack-script-data';
 
/**
 * Whether this site is connected to WordPress.com.
 *
 * The tus upload pipeline needs a WordPress.com upload JWT, so upload paths
 * branch on this: connected sites get the real VideoPress uploader, and only
 * disconnected ones (local Docker, unconnected installs) fall back to plain
 * `wp/v2/media`.
 *
 * @return True when the site has a positive WordPress.com blog id.
 */
export function isWpcomConnected(): boolean {
	const blogId = getScriptData()?.site?.wpcom?.blog_id;
	return typeof blogId === 'number' && blogId > 0;
}