';
}
public function enqueue(string $hook): void
{
if (substr($hook, -strlen(self::PAGE_SLUG)) !== self::PAGE_SLUG) {
return;
}
$asset_file = WPWAND_NEW_DIR . 'build/welcome.asset.php';
if (!is_readable($asset_file)) {
return;
}
$asset = require $asset_file;
wp_enqueue_script(
self::HANDLE,
WPWAND_NEW_URL . 'build/welcome.js',
$asset['dependencies'],
$asset['version'],
true
);
// No webfont request here on purpose: hitting fonts.googleapis.com from wp-admin is a
// third-party round trip nobody asked for and a wordpress.org review flag. Every rule in the
// stylesheet reads --wpwand-font, which names Inter first and then the platform UI stack, so
// a machine without Inter renders one consistent typeface rather than two.
if (is_readable(WPWAND_NEW_DIR . 'build/style-welcome.css')) {
wp_enqueue_style(
self::HANDLE,
WPWAND_NEW_URL . 'build/style-welcome.css',
[],
(string) filemtime(WPWAND_NEW_DIR . 'build/style-welcome.css')
);
}
$brand = Brand::resolve();
wp_localize_script(self::HANDLE, 'wpwandWelcome', [
'brand' => $brand['name'],
'settingsUrl' => esc_url_raw(admin_url('admin.php?page=wpwand')),
]);
if (function_exists('wp_set_script_translations')) {
wp_set_script_translations(self::HANDLE, 'ai-content-generation');
}
}
}