exceeded ?? false; $exceeded_limits = $site_options->exceededLimits ?? array(); $usage = $site_options->usageSummary ?? null; // Determine CTA strategy $cta_type = 'default'; $cta_title = ''; $cta_message = ''; $cta_button = __('Upgrade Now', 'allaccessible'); $cta_url = $addon_url; // Use app addon URL, not marketing site if ($exceeded && !empty($exceeded_limits)) { // URGENT: They've exceeded limits $cta_type = 'urgent'; $cta_title = __('Usage Limit Exceeded!', 'allaccessible'); $cta_message = sprintf( __('Your widget is currently using free features only. Upgrade to %s to restore premium functionality and increase your limits.', 'allaccessible'), '' . ($account_tier === 'free' ? 'Starter' : 'Enterprise') . '' ); $cta_button = $account_tier === 'free' ? __('Upgrade to Starter', 'allaccessible') : __('Upgrade to Enterprise', 'allaccessible'); } elseif ($usage) { // Check if approaching limits (>80%) $approaching_limit = false; $approaching_metric = ''; foreach ($usage as $key => $metric) { if (isset($metric->percent) && $metric->percent >= 80 && $metric->percent < 100) { $approaching_limit = true; $approaching_metric = str_replace('_', ' ', ucwords($key, '_')); break; } } if ($approaching_limit) { $cta_type = 'warning'; $cta_title = __('Approaching Your Limit', 'allaccessible'); $cta_message = sprintf( __('You\'re using over 80%% of your %s. Upgrade before you hit the limit to avoid service interruption.', 'allaccessible'), '' . esc_html($approaching_metric) . '' ); $cta_button = __('Upgrade Before Limit', 'allaccessible'); } elseif ($account_tier === 'free') { // Free users with no issues - feature upsell $cta_type = 'feature'; $cta_title = __('Unlock Premium Features', 'allaccessible'); $cta_message = __('Get AI-powered accessibility fixes, monthly compliance audits, custom widget styling, and priority support.', 'allaccessible'); $cta_button = __('Start 7-Day Trial', 'allaccessible'); } elseif ($account_tier === 'starter' || $account_tier === 'legacy') { // Starter users - upsell add-ons $cta_type = 'feature'; $cta_title = __('Scale with Add-Ons', 'allaccessible'); $cta_message = __('Need more pageviews, AI fixes, or audits? Add custom limits to your plan or upgrade to Enterprise for unlimited access.', 'allaccessible'); $cta_button = __('Explore Add-Ons', 'allaccessible'); } } if (!$cta_title) { return; // No CTA to show } // Map CTA type → admin-v2 component variants. // `feature` uses the AI-flavored card (gradient + sparkle button) since the // feature upsell highlights AllAccessible AI / agentic remediation. // `urgent` + `warning` use semantic banner variants for time-sensitive states. // `default` falls back to a featured (primary-tinted) card. $variants = array( 'urgent' => array('card' => 'aacx-v2__card aacx-v2__card--elevated', 'banner' => 'aacx-v2__banner aacx-v2__banner--danger', 'btn' => 'aacx-v2__btn aacx-v2__btn--primary aacx-v2__btn--lg'), 'warning' => array('card' => 'aacx-v2__card aacx-v2__card--elevated', 'banner' => 'aacx-v2__banner aacx-v2__banner--warn', 'btn' => 'aacx-v2__btn aacx-v2__btn--primary aacx-v2__btn--lg'), 'feature' => array('card' => 'aacx-v2__card aacx-v2__card--elevated aacx-v2__card--ai', 'banner' => '', 'btn' => 'aacx-v2__btn aacx-v2__btn--ai aacx-v2__btn--lg'), 'default' => array('card' => 'aacx-v2__card aacx-v2__card--elevated aacx-v2__card--featured', 'banner' => '', 'btn' => 'aacx-v2__btn aacx-v2__btn--primary aacx-v2__btn--lg'), ); $variant = $variants[$cta_type] ?? $variants['default']; ?>

array())); ?>