assets->enqueue( self::HANDLE, 'js/block-recovery-editor.js', [ 'wp-data', 'wp-blocks', 'wp-editor', 'wp-api-fetch' ] ); templately()->assets->localize( self::HANDLE, 'templatelyBlockRecoveryEditor', [ 'postId' => $post_id, 'trigger' => Report::TRIGGER_ON_OPEN, 'reason' => $reason, 'readyTimeoutMs' => self::READY_TIMEOUT_MS, ] ); } /** * Why a post qualifies for on-open repair, or '' when it does not. * * @param int $post_id * @return string 'provenance' | 'queued' | 'both' | '' */ public static function eligibility( int $post_id ): string { $provenance = metadata_exists( 'post', $post_id, BaseRunner::META_SESSION_KEY ); $queued = Queue::is_pending( $post_id ); if ( $provenance && $queued ) { return 'both'; } if ( $provenance ) { return 'provenance'; } if ( $queued ) { return 'queued'; } return ''; } }