/**
 * Admin SPA extension hooks (WordPress hooks API).
 *
 * Pro can register filters before/after this script loads:
 *
 * ```js
 * wp.hooks.addFilter( 'jocbm.adminNav', 'my-pro', ( nav ) => {
 *   nav.push( { id: 'license', label: 'License', icon: 'admin-network' } );
 *   return nav;
 * } );
 * wp.hooks.addFilter( 'jocbm.shellRoutes', 'my-pro', ( routes ) =>
 *   routes.concat( 'license' )
 * );
 * wp.hooks.addFilter( 'jocbm.renderShellPage', 'my-pro', ( page, route, ctx ) => {
 *   if ( route === 'license' ) {
 *     return wp.element.createElement( LicensePage, { onNavigate: ctx.navigate } );
 *   }
 *   return page;
 * } );
 * ```
 */
export const HOOKS = {
	ADMIN_NAV: 'jocbm.adminNav',
	SHELL_ROUTES: 'jocbm.shellRoutes',
	RENDER_SHELL_PAGE: 'jocbm.renderShellPage',
	RENDER_FULLSCREEN_PAGE: 'jocbm.renderFullscreenPage',
	FALLBACK_SHELL_ROUTE: 'jocbm.fallbackShellRoute',
	DEFAULT_ROUTE: 'jocbm.defaultRoute',
	ADMIN_READY: 'jocbm.adminReady',
};

/**
 * @return {boolean}
 */
export function isProActive() {
	return Boolean(
		typeof jocbmAdmin !== 'undefined' && jocbmAdmin.isPro
	);
}
