get_site_suffix(); // Use the plain hostname for the Atomic activity log URL — get_site_suffix() can // include '::' for subdirectory installs, which would break the URL. This matches // the approach used by jetpack-mu-wpcom for the sidebar Activity Log link. $site_host = wp_parse_url( home_url(), PHP_URL_HOST ); $activity_log_site = ( is_string( $site_host ) && '' !== $site_host ) ? $site_host : $site_suffix; // On Atomic link to WPCOM activity log; on self-hosted link to the local wp-admin page. $activity_log_url = ( new Host() )->is_woa_site() ? 'https://wordpress.com/activity-log/' . $activity_log_site : admin_url( 'admin.php?page=jetpack-activity-log' ); wp_enqueue_script( 'jetpack-ai-admin', plugins_url( '_inc/build/jetpack-ai-admin.js', JETPACK__PLUGIN_FILE ), $script_deps, $script_version, true ); wp_set_script_translations( 'jetpack-ai-admin', 'jetpack' ); wp_add_inline_script( 'jetpack-ai-admin', 'var jetpackAiSettings = ' . wp_json_encode( array( 'blogId' => $blog_id ? (int) $blog_id : 0, 'activityLogUrl' => $activity_log_url, 'siteAdminUrl' => admin_url(), 'apiRoot' => esc_url_raw( rest_url() ), 'apiNonce' => wp_create_nonce( 'wp_rest' ), 'pluginUrl' => plugins_url( '', JETPACK__PLUGIN_FILE ), // Route through the Jetpack redirect service so the upgrade // destination for the MCP upsell can be retargeted without // shipping a code change. 'upgradeUrl' => Redirect::get_url( 'jetpack-ai-upgrade-url-for-jetpack-sites' ), ), JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . ';', 'before' ); wp_enqueue_style( 'jetpack-ai-admin', plugins_url( '_inc/build/jetpack-ai-admin.css', JETPACK__PLUGIN_FILE ), array( 'wp-components' ), $script_version ); } /** * Override the base render() to skip wrap_ui entirely. * * Wrap_ui renders the Jetpack masthead header and static footer, which * duplicate the header/footer that AdminPage (React) already provides. * Calling page_render() directly lets AdminPage own the full layout. */ public function render() { $this->page_render(); } /** * Render the page container. The React app mounts into this div. * * AdminPage from @automattic/jetpack-components handles the full-page layout. */ public function page_render() { ?>