// Main application script document.addEventListener('DOMContentLoaded', function() { initializeDashboard(); setupEventListeners(); }); // Initialize dashboard with mock data function initializeDashboard() { // Mock data for demonstration const mockStats = { activeUsers: 245, webhookEvents: 1567, monthlyRevenue: '$12,450' }; const mockActivity = [ { type: 'purchase', user: 'john@example.com', plan: 'Premium Plan', time: '2 hours ago', status: 'success' }, { type: 'cancellation', user: 'jane@example.com', plan: 'Basic Plan', time: '5 hours ago', status: 'warning' }, { type: 'webhook', user: 'system', plan: 'N/A', time: '1 day ago', status: 'info' }, { type: 'upgrade', user: 'mike@example.com', plan: 'Enterprise Plan', time: '2 days ago', status: 'success' } ]; // Update dashboard stats updateDashboardStats(mockStats); updateRecentActivity(mockActivity); } // Update dashboard statistics function updateDashboardStats(stats) { const activeUsersElement = document.getElementById('activeUsersCount'); const webhookEventsElement = document.getElementById('webhookEventsCount'); const monthlyRevenueElement = document.getElementById('monthlyRevenue'); if (activeUsersElement) activeUsersElement.textContent = stats.activeUsers; if (webhookEventsElement) textContent = stats.webhookEvents; if (monthlyRevenueElement) textContent = stats.monthlyRevenue; } // Update recent activity feed function updateRecentActivity(activities) { const activityContainer = document.getElementById('recentActivity'); if (!activityContainer) return; activityContainer.innerHTML = activities.map(activity => `
${activity.user} - ${activity.type}
${activity.plan}
${activity.time}
${activity.status}