<?php
/**
 * Reusable Pro showcase card for the setup wizard (rendered only on Free).
 *
 * Vars in scope (from including template):
 *   $features array — list of strings to render as bullets
 *   $card_title string — optional, defaults to "💎 With Pro you also unlock"
 *
 * @package SkyEmagSync
 */

defined( 'ABSPATH' ) || exit;

if ( SkyEmagSync\Plugin::is_premium() ) {
	return; // Pro installs never see showcase cards.
}

$features = isset( $features ) ? (array) $features : [];
if ( empty( $features ) ) {
	return;
}
$card_title = isset( $card_title ) && $card_title
	? $card_title
	: __( '💎 With Pro you also unlock', 'skyservers-product-sync-for-emag' );

// Route directly to the public Freemius checkout. The Freemius SDK's
// internal pricing admin page is not registered when the SDK runs in
// is_org_compliant mode (the configuration required for WordPress.org
// distribution), so the previous get_upgrade_url() target landed on a
// "Sorry, you are not allowed to access this page" WordPress wall.
$upgrade_url = SkyEmagSync\Admin\Menu::upgrade_url();
?>
<div class="skyemag-showcase-card">
	<h4><?php echo esc_html( $card_title ); ?></h4>
	<ul>
		<?php foreach ( $features as $feature ) : ?>
			<li><?php echo esc_html( $feature ); ?></li>
		<?php endforeach; ?>
	</ul>
	<a href="<?php echo esc_url( $upgrade_url ); ?>"
	   class="button-link" target="_blank" rel="noopener">
		<?php esc_html_e( 'See full Pro comparison →', 'skyservers-product-sync-for-emag' ); ?>
	</a>
</div>
