prelaunch information until a Marketplace URL exists; * otherwise primary upgrade CTA + comparison + price. * - pro_installed_inactive -> local "Activate MarginBeacon Pro" (WP plugins flow), no purchase push. * - pro_active_not_entitled -> "Complete your Pro license setup" + "Manage license" (project route). * - pro_active -> renders nothing (no CTA, no price, no locked badge). * * @package Kayvandra\MarginBeacon */ declare(strict_types=1); namespace Kayvandra\MarginBeacon\Admin\License; use Kayvandra\MarginBeacon\Admin\Navigation\Tabs; use Kayvandra\MarginBeacon\Support\Capabilities; use Kayvandra\MarginBeacon\Support\ProductDests; use Kayvandra\MarginBeacon\Support\ProMarketplace; use Kayvandra\MarginBeacon\Support\UpgradeStateResolver; /** * State-aware upgrade card for the MarginBeacon dashboard. */ final class UpgradeCtaCard { /** * @var UpgradeStateResolver */ private $resolver; /** * @param UpgradeStateResolver|null $resolver Optional injected resolver. */ public function __construct( ?UpgradeStateResolver $resolver = null ) { $this->resolver = $resolver ?? new UpgradeStateResolver(); } /** * Resolved state for the current request. * * @return string */ public function state() { return $this->resolver->resolve(); } /** * Whether any card should render on the current request. * * @return bool */ public function should_render() { if ( ! Capabilities::current_user_can_manage() ) { return false; } // Paid channels do not receive an upgrade card. return ! $this->resolver->is_pro_active_entitled() && ! $this->resolver->is_direct(); } /** * Render the state-appropriate card. * * @return void */ public function render() { if ( ! $this->should_render() ) { return; } switch ( $this->state() ) { case UpgradeStateResolver::STATE_PRO_INSTALLED_INACTIVE: $this->render_activation(); break; case UpgradeStateResolver::STATE_PRO_ACTIVE_NOT_ENTITLED: $this->render_license_setup(); break; case UpgradeStateResolver::STATE_FREE_ONLY: default: $this->render_upgrade(); break; } } /** * Free-only: primary upgrade CTA. * * @return void */ private function render_upgrade() { $marketplace = ProMarketplace::url(); $has_channel = '' !== $marketplace; $price = $has_channel ? ProductDests::pro_price_display() : ''; ?>

resolver->is_pro_active_entitled() ) { return; } ?>