import { initializeAIs } from 'backend/apiManager'; $w.onReady(() => { console.log("Frontend Header Initialized..."); // Initialize AIs initializeAIs(); console.log("AccOff AI and VivaFlex AI initialized from the header."); }); // HEADER: Front-End Initialization import { masterAPI } from 'backend/masterAPI.jsw'; // Backend Connection $w.onReady(() => { console.log("Front-End Crown Initialized"); // Event Listeners for Core Actions $w("#setupStudioButton").onClick(() => setupStudio()); $w("#dailyTasksButton").onClick(() => fetchDailyTasks()); $w("#generateReportsButton").onClick(() => generateReports()); $w("#marketingTasksButton").onClick(() => initiateMarketingCampaign()); }); // BODY: Core Functions // Studio Setup Function async function setupStudio() { const result = await masterAPI("initializeStudio"); logResult("Studio Setup", result); } // Fetch Daily Tasks async function fetchDailyTasks() { const result = await masterAPI("fetchDailyTasks"); logResult("Daily Tasks", result); } // Generate Financial Reports async function generateReports() { const result = await masterAPI("generateReports"); logResult("Financial Reports", result); } // Initiate Marketing Campaigns async function initiateMarketingCampaign() { const result = await masterAPI("runMarketing"); logResult("Marketing Campaign", result); } // FOOTER: Utility Functions function logResult(task, result) { if (result.status === "success") { console.log(`${task} Completed:`, result.message); } else { console.error(`${task} Failed:`, result.message); } } import { masterAPI } from 'backend/apiManager'; $w.onReady(() => { console.log("Frontend Body Initialized..."); // Button triggers for AI functionalities $w("#activateButton").onClick(async () => { try { const response = await masterAPI("activateAI", {}); $w("#outputMessage").text = response.message; } catch (error) { console.error("Activation Error:", error.message); } }); $w("#syncButton").onClick(async () => { try { const response = await masterAPI("syncAIs", {}); $w("#outputMessage").text = response.message; } catch (error) { console.error("Sync Error:", error.message); } }); });
top of page
bottom of page
$w.onReady(() => { console.log("Frontend Footer Initialized..."); // Display AI status setInterval(() => { const accOffStatus = document.getElementById('accOffStatus'); const vivaflexStatus = document.getElementById('vivaflexStatus'); if (document.getElementById('accOff') && document.getElementById('vivaflex')) { accOffStatus.textContent = "Connected"; vivaflexStatus.textContent = "Connected"; } }, 5000); // Update every 5 seconds });