import { showDrilldownUpsell } from '../ui/drilldown-upsell';
import { isPremiumUser } from '../utils/premium';


/**
 * Wire delegated click handling for drill-down triggers across Insights.
 *
 * @param {object} store
 */
export function initDrilldownTriggers(store) {
    const insightsPage = document.querySelector('.linkcentral-insights');
    if (!insightsPage) {
        return;
    }

    insightsPage.addEventListener('click', (event) => {
        const trigger = event.target.closest('.linkcentral-drilldown-trigger');
        if (!trigger) {
            return;
        }

        event.preventDefault();

        if (!isPremiumUser()) {
            showDrilldownUpsell();
            return;
        }

        
    });
}
