A continuation of Janady13/ai_deployment / index.html. The complete source identity, every recorded occurrence, and linked equations are on its first page.
Source transcript · continued
Download complete source text ↓2,523 lines · 106.4 KB
tier: 'growth',
audience: 950,
price: 299,
conversion: 4.8,
lift: 0.18,
prompts: ['Launch CFO-grade dashboards in 7 minutes', 'Adaptive pricing guardrails tuned to your cohort', 'AI ops concierge to execute approved experiments']
},
{
id: 'academy',
title: 'Revenue Academy Entryway',
badge: 'Freemium',
description: 'Deliver daily insights, guided tutorials, and sandbox automations before gating premium deployment capabilities.',
levers: ['Time-boxed trial automations with upgrade hooks', 'Personalized curriculum from Git-tagged notebooks', 'Community leaderboard tied to experiment velocity'],
kpi: 'Targets 12% trial-to-paid lift',
tier: 'freemium',
audience: 4200,
price: 79,
conversion: 5.6,
lift: 0.12,
prompts: ['Unlock full automation runs & 24/7 agent coverage', 'Deploy revenue blueprints straight from Git workflows', 'Win founders-only briefings & case studies']
},
{
id: 'enterprise',
title: 'Enterprise Revenue Command',
badge: 'Enterprise',
description: 'Gate compliance automation, multi-region deployments, and revenue risk modeling behind executive approvals.',
levers: ['SOC2-ready evidence room linked to Git history', 'Custom guardrails & audit bots for procurement', 'Dedicated deployment SRE & rollback automations'],
kpi: 'Targets $1.2M ARR expansion',
tier: 'enterprise',
audience: 180,
price: 1200,
conversion: 9.5,
lift: 0.22,
prompts: ['Executive-ready forecasting with math-first narratives', 'Deterministic release governance & rollback memos', 'Private automation fabric with air-gapped agents']
},
{
id: 'partners',
title: 'Channel Partner Gateway',
badge: 'Alliances',
description: 'Enable co-selling partners to demo curated automations before revenue sharing unlocks advanced commission tooling.',
levers: ['Deal room paywall tied to signed partner IDs', 'Automated co-marketing asset drops when quotas hit', 'Joint pipeline scoring with shared attribution dashboards'],
kpi: 'Targets +35% sourced pipeline',
tier: 'growth',
audience: 600,
price: 499,
conversion: 7.2,
lift: 0.16,
prompts: ['Sync partner CRM telemetry into AI_Brain analytics', 'Auto-generate enablement packs for priority plays', 'Unlock revenue sharing ledger & payout automations']
}
];
const connectionBadge = document.getElementById('connectionBadge');
const connectionDot = document.getElementById('connectionDot');
const connectionStatus = document.getElementById('connectionStatus');
const connectionDetail = document.getElementById('connectionDetail');
const connectionChips = document.getElementById('connectionChips');
const repoForm = document.getElementById('repoForm');
const syncButton = document.getElementById('syncRepo');
const launchSetup = document.getElementById('launchSetup');
const viewDocs = document.getElementById('viewDocs');
const dynamicCopy = document.getElementById('dynamicCopy');
const connectorGrid = document.getElementById('connectorGrid');
const connectorSummary = document.getElementById('connectorSummary');
const investmentForm = document.getElementById('investmentForm');
const roundSizeInput = document.getElementById('roundSize');
const minTicketInput = document.getElementById('minTicket');
const arrTargetInput = document.getElementById('arrTarget');
const closeDateInput = document.getElementById('closeDate');
const investorFocusInput = document.getElementById('investorFocus');
const syndicateSummary = document.getElementById('syndicateSummary');
const investorGrid = document.getElementById('investorGrid');
const publicOfferForm = document.getElementById('publicOfferForm');
const offerSlugInput = document.getElementById('offerSlug');
const offerHeadlineInput = document.getElementById('offerHeadline');
const offerChannelInput = document.getElementById('offerChannel');
const offerPromiseInput = document.getElementById('offerPromise');
const publicOfferOutput = document.getElementById('publicOfferOutput');
const generatePublicOffer = document.getElementById('generatePublicOffer');
const copyPublicOffer = document.getElementById('copyPublicOffer');
const entrywayGrid = document.getElementById('entrywayGrid');
const paywallForm = document.getElementById('paywallForm');
const paywallTier = document.getElementById('paywallTier');
const paywallAudience = document.getElementById('paywallAudience');
const paywallPrice = document.getElementById('paywallPrice');
const paywallConversion = document.getElementById('paywallConversion');
const paywallFeatures = document.getElementById('paywallFeatures');
const paywallSummary = document.getElementById('paywallSummary');
const paywallPriceValue = document.getElementById('paywallPriceValue');
const paywallConversionValue = document.getElementById('paywallConversionValue');
const simulatePaywall = document.getElementById('simulatePaywall');
const copyPaywallPlan = document.getElementById('copyPaywallPlan');
const planOutput = document.getElementById('planOutput');
const planForm = document.getElementById('planForm');
const objectiveInput = document.getElementById('objective');
const kpiInput = document.getElementById('kpi');
const contextInput = document.getElementById('context');
const clearPlan = document.getElementById('clearPlan');
const copyPlan = document.getElementById('copyPlan');
const modulesBoard = document.getElementById('modulesBoard');
const pipelineTimeline = document.getElementById('pipelineTimeline');
const deploymentGrid = document.getElementById('deploymentGrid');
const consoleLog = document.getElementById('consoleLog');
const commandForm = document.getElementById('commandForm');
const clearConsole = document.getElementById('clearConsole');
const tabButtons = document.querySelectorAll('.tab-button');
const tabPanels = document.querySelectorAll('.tab-panel');
const commandType = document.getElementById('commandType');
const intensity = document.getElementById('intensity');
const notes = document.getElementById('notes');
const arrChartCanvas = document.getElementById('arrChart');
const conversionChartCanvas = document.getElementById('conversionChart');
const metricCards = document.querySelectorAll('.metric-card .metric-value');
let connectedRepo = JSON.parse(localStorage.getItem('aiBrainRepo') || 'null');
const savedConnectorState = JSON.parse(localStorage.getItem('aiBrainConnectors') || '[]');
const storedOffer = JSON.parse(localStorage.getItem('aiBrainPublicOffer') || 'null');
let activeConnectors = new Set(Array.isArray(savedConnectorState) ? savedConnectorState : []);
let publicOfferClipboard = '';
let investorPulseTimer = null;
let activeModules = new Set();
let syncCount = Number(localStorage.getItem('aiBrainSyncCount') || '0');
let consoleLines = [];
let activeEntryway = null;
let paywallPlanText = '';
function updateConnectionUI() {
if (connectedRepo) {
connectionBadge.classList.add('connected');
connectionBadge.innerHTML = `<span aria-hidden="true">●</span> Connected to ${connectedRepo.name}`;
connectionDot.classList.add('online');
connectionStatus.textContent = `Connected: ${connectedRepo.url}`;
connectionDetail.textContent = `Branch ${connectedRepo.branch} • ${connectedRepo.runtime.toUpperCase()} runtime • Region ${connectedRepo.region}`;
connectionChips.innerHTML = `
<span class="chip">git status: clean</span>
<span class="chip">sync count: ${syncCount}</span>
<span class="chip">last sync: ${connectedRepo.lastSync || 'pending'}</span>
`;
syncButton.disabled = false;
syncButton.innerHTML = '<span>⟳</span> Sync with AI_Brain Repo';
} else {
connectionBadge.classList.remove('connected');
connectionBadge.innerHTML = '<span aria-hidden="true">●</span> Waiting for AI_Brain repository link';
connectionDot.classList.remove('online');
connectionStatus.textContent = 'Disconnected from AI_Brain';
connectionDetail.textContent = 'Provide the repository URL and default branch to initialize continuous revenue intelligence deployments.';
connectionChips.innerHTML = '<span class="chip">git status: unknown</span><span class="chip">CI pipeline: pending</span>';
syncButton.disabled = true;
syncButton.innerHTML = '<span>⟳</span> Sync unavailable';
}
renderInvestors();
updateConnectorSummary();
updateSyndicateSummary();
updatePublicOfferPreview();
updatePaywallSummary();
}
function formatCurrency(value) {
if (Number.isNaN(value)) return '$0';
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
maximumFractionDigits: value >= 1000 ? 0 : 2
}).format(value);
}
function syncSliderDisplays() {
if (paywallPriceValue) {
paywallPriceValue.textContent = formatCurrency(Number(paywallPrice.value));
}
if (paywallConversionValue) {
paywallConversionValue.textContent = `${Number(paywallConversion.value).toFixed(1)}%`;
}
}
function highlightEntryways() {
if (!entrywayGrid) return;
entrywayGrid.querySelectorAll('.entryway-card').forEach(card => {
card.classList.toggle('active', card.dataset.entryway === (activeEntryway?.id || ''));
});
}
function setActiveEntryway(entryway) {
if (!entryway) return;
activeEntryway = entryway;
if (paywallTier) paywallTier.value = entryway.tier;
if (paywallAudience) paywallAudience.value = entryway.audience;
if (paywallPrice) paywallPrice.value = entryway.price;
if (paywallConversion) paywallConversion.value = entryway.conversion;
if (paywallFeatures) paywallFeatures.value = entryway.prompts.join('\n');
syncSliderDisplays();
updatePaywallSummary();
highlightEntryways();
}
function renderEntryways() {
if (!entrywayGrid) return;
entrywayGrid.innerHTML = '';
entryways.forEach(entryway => {
const card = document.createElement('article');
card.className = 'entryway-card';
card.setAttribute('role', 'listitem');
card.dataset.entryway = entryway.id;
card.innerHTML = `
<span class="entryway-badge">${entryway.badge}</span>
<h3>${entryway.title}</h3>
<p>${entryway.description}</p>
<ul>${entryway.levers.map(lever => `<li>${lever}</li>`).join('')}</ul>
<footer>
<span>${entryway.kpi}</span>
<button type="button" class="primary" data-entryway="${entryway.id}">Load Scenario</button>
</footer>
`;
entrywayGrid.appendChild(card);
});
if (!activeEntryway && entryways.length) {
setActiveEntryway(entryways[0]);
} else {
highlightEntryways();
}
}
function flashPaywallSummary() {
if (!paywallSummary) return;
paywallSummary.classList.remove('flash');
void paywallSummary.offsetWidth;
paywallSummary.classList.add('flash');
setTimeout(() => paywallSummary.classList.remove('flash'), 800);
}
function updatePaywallSummary(flash = false) {
if (!paywallSummary) return;
syncSliderDisplays();
const tierNames = {
freemium: 'Freemium Accelerator',
growth: 'Growth Lab',
enterprise: 'Enterprise Command'
};
const tierValue = paywallTier ? paywallTier.value : 'growth';
const tierLabel = tierNames[tierValue] || tierValue;
const audience = Math.max(0, Number(paywallAudience?.value || 0));
const price = Math.max(0, Number(paywallPrice?.value || 0));
const conversionRate = Math.max(0, Number(paywallConversion?.value || 0));
const baseConversions = audience * (conversionRate / 100);
const lift = connectedRepo ? (activeEntryway?.lift || 0) : 0;
const conversions = baseConversions * (1 + lift);
const monthlyRevenue = price * conversions;
const annualRevenue = monthlyRevenue * 12;
const repoLine = connectedRepo
? `Synced repo: ${connectedRepo.name} • ${connectedRepo.branch} • ${connectedRepo.region}`
: 'Connect your AI_Brain repository to persist experiments & unlock lift.';
const liftCopy = connectedRepo
? `AI automation lift applied: +${Math.round((lift || 0) * 100)}% conversions.`
: 'AI automation lift pending repository connection.';
const entrywayLabel = activeEntryway ? activeEntryway.title : 'Custom Monetization Gate';
const prompts = paywallFeatures?.value.trim().split(/\n+/).filter(Boolean) || [];
const promptList = prompts.length
? `<ul>${prompts.map(prompt => `<li>${prompt}</li>`).join('')}</ul>`
: '<p>Add prompts describing the conversion moments you will emphasize.</p>';
paywallPlanText = `${entrywayLabel} • ${tierLabel}\n${repoLine}\nMonthly audience: ${audience.toLocaleString()}\nPrice: ${formatCurrency(price)}\nConversion rate: ${conversionRate.toFixed(1)}%\nConversions/mo: ${Math.round(conversions).toLocaleString()}\nMRR: ${formatCurrency(monthlyRevenue)}\nARR: ${formatCurrency(annualRevenue)}\n${liftCopy}\nPrompts:\n${prompts.length ? prompts.map((prompt, index) => `${index + 1}. ${prompt}`).join('\n') : 'No prompts defined yet.'}`;
paywallSummary.innerHTML = `
<strong>${entrywayLabel} • ${tierLabel}</strong>
<p>${repoLine}</p>
<p>${liftCopy}</p>
<p>Projected conversions: <strong>${Math.round(conversions).toLocaleString()}</strong> / month</p>
<p>Projected revenue: <strong>${formatCurrency(monthlyRevenue)}</strong> MRR (${formatCurrency(annualRevenue)} ARR)</p>
${promptList}
`;
if (flash) {
flashPaywallSummary();
}
}
function flashElement(element, className = 'flash-highlight') {
if (!element) return;
element.classList.remove(className);
void element.offsetWidth;
element.classList.add(className);
setTimeout(() => element.classList.remove(className), 900);
}
function persistConnectors() {
localStorage.setItem('aiBrainConnectors', JSON.stringify([...activeConnectors]));
}
function renderConnectors() {
if (!connectorGrid) return;
connectorGrid.innerHTML = '';
connectors.forEach(connector => {
const button = document.createElement('button');
button.type = 'button';
button.className = 'connector-toggle';
button.dataset.connector = connector.id;
button.setAttribute('role', 'listitem');
if (activeConnectors.has(connector.id)) {
button.classList.add('active');
}
button.innerHTML = `
<strong>${connector.name}</strong>
<span>${connector.description}</span>
<div class="connector-meta">
<span>${connector.category} • ${connector.reach}</span>
<span>+${Math.round((connector.boost - 1) * 100)}% lift • ${connector.audience.toLocaleString()} prospects</span>
</div>
`;
connectorGrid.appendChild(button);
});
}
function initConnectorInteractions() {
if (!connectorGrid) return;
connectorGrid.addEventListener('click', event => {
const button = event.target.closest('button[data-connector]');
if (!button) return;
toggleConnector(button.dataset.connector, button);
});
}
function toggleConnector(connectorId, button) {
if (!connectorId) return;
if (activeConnectors.has(connectorId)) {
activeConnectors.delete(connectorId);
if (button) button.classList.remove('active');
} else {
activeConnectors.add(connectorId);
if (button) button.classList.add('active');
}
persistConnectors();
updateConnectorSummary(true);
updateSyndicateSummary(true);
updatePublicOfferPreview(true);
}
function updateConnectorSummary(flash = false) {
if (!connectorSummary) return;
const selected = [...activeConnectors].map(id => connectorIndex[id]).filter(Boolean);
if (!selected.length) {
connectorSummary.innerHTML = `
<strong>Select connectors to broadcast your offers outside GitHub.</strong>
<p>Combine payment networks, creator channels, and partner automation to unlock global reach.</p>
`;
return;
}
const totalAudience = selected.reduce((sum, connector) => sum + connector.audience, 0);
const avgBoost = selected.reduce((sum, connector) => sum + connector.boost, 0) / selected.length;
const connectorsList = selected.map(connector => connector.name).join(', ');
const repoLine = connectedRepo
? `Synced with ${connectedRepo.name} • ${connectedRepo.branch}`
: 'Connect the AI_Brain repo to sync automations and offer telemetry.';
connectorSummary.innerHTML = `
<strong>${selected.length} connectors active • ${totalAudience.toLocaleString()} prospects reachable</strong>
<p>${repoLine}</p>
<p>Estimated amplification: <strong>+${Math.round((avgBoost - 1) * 100)}%</strong> via ${connectorsList}.</p>
`;
if (flash) {
flashElement(connectorSummary);
}
}
function updateSyndicateSummary(flash = false) {
if (!syndicateSummary) return;
const roundSize = Number(roundSizeInput?.value || 0);
const minTicket = Number(minTicketInput?.value || 0);
const arrTarget = Number(arrTargetInput?.value || 0);
const focus = investorFocusInput?.value.trim() || 'Automation-focused operators & community builders';
const connectorsSelected = [...activeConnectors].map(id => connectorIndex[id]).filter(Boolean);
const connectorsLift = connectorsSelected.reduce((sum, connector) => sum + Math.max(0, connector.boost - 1), 0);
const baseCommitments = investors.reduce((total, investor) => total + investor.ticket * (investor.interest / 100), 0);
const commitCapacity = baseCommitments * (1 + connectorsLift);
const readiness = roundSize > 0 ? Math.min(100, Math.round((commitCapacity / roundSize) * 100)) : 0;
const shortfall = roundSize > 0 ? Math.max(0, roundSize - commitCapacity) : 0;
const repoLine = connectedRepo
? `GitOps ready • ${connectedRepo.name} (${connectedRepo.branch}) • ${connectedRepo.region}`
: 'Connect the AI_Brain repo to embed diligence packets and auto-sync demos.';
const connectorsLine = connectorsSelected.length
? `${connectorsSelected.length} connectors active (${connectorsSelected.map(connector => connector.name).join(', ')})`
: 'No external connectors activated yet.';
const arrLine = arrTarget ? `Post-round ARR target: ${formatCurrency(arrTarget)}` : 'Define an ARR target to calibrate growth automations.';
const closeCopy = closeDateInput?.value
? `Target close: ${new Date(`${closeDateInput.value}T00:00:00`).toLocaleDateString()}`
: 'Set a close date to schedule investor cadences.';
const minTicketLine = minTicket ? `Minimum ticket: ${formatCurrency(minTicket)}` : 'Specify a minimum ticket size to focus outreach.';
syndicateSummary.innerHTML = `
<strong>${commitCapacity ? formatCurrency(commitCapacity) : '$0'} in ready commitments • ${readiness}% of ${roundSize ? formatCurrency(roundSize) : 'goal'}</strong>
<p>${repoLine}</p>
<p>${connectorsLine}</p>
<p>${minTicketLine} • ${arrLine}</p>
<p>${focus}</p>
<p>${closeCopy}${roundSize && shortfall > 0 ? ` • Shortfall ${formatCurrency(shortfall)}` : readiness >= 100 && roundSize ? ' • Goal fully covered' : ''}</p>
`;
if (flash) {
flashElement(syndicateSummary);
}
}
function renderInvestors() {
if (!investorGrid) return;
investorGrid.innerHTML = '';
investors.forEach(investor => {
const card = document.createElement('article');
card.className = 'investor-card';
card.dataset.investor = investor.id;
card.setAttribute('role', 'listitem');
card.innerHTML = `
<header>
<strong>${investor.name}</strong>
<span class="badge">${investor.region}</span>
</header>
<p>${investor.focus}</p>
<div class="interest-track">
<div class="interest-bar" style="width:${Math.round(investor.interest)}%"></div>
</div>
<div class="connector-meta">
<span>Typical ticket: ${formatCurrency(investor.ticket)}</span>
<span>${Math.round(investor.interest)}% warm</span>
</div>
<small style="color: var(--muted);">${investor.note}</small>
<small style="color: var(--muted);">Last signal: ${investor.lastSignal}${connectedRepo ? ` • ${connectedRepo.name} webhook ready` : ''}</small>
`;
investorGrid.appendChild(card);
});
}
function simulateInvestorPulse() {
if (!investorGrid) return;
if (investorPulseTimer) {
clearInterval(investorPulseTimer);
}
investorPulseTimer = setInterval(() => {
const candidate = investors[Math.floor(Math.random() * investors.length)];
const delta = (Math.random() * 10) - 4;
candidate.interest = Math.max(35, Math.min(98, Math.round(candidate.interest + delta)));
const minutes = Math.floor(Math.random() * 45) + 5;
candidate.lastSignal = `${minutes}m ago`;
renderInvestors();
updateSyndicateSummary();
}, 7000);
}
function sanitizeSlug(value) {
return (value || '')
.toLowerCase()
.replace(/[^a-z0-9-]/g, '-')
.replace(/-+/g, '-')
.replace(/^-|-$/g, '') || 'ai-revenue-brain';
}
function updatePublicOfferPreview(flash = false) {
if (!publicOfferOutput) return;
const slugValue = sanitizeSlug(offerSlugInput?.value || '');
if (offerSlugInput && slugValue !== offerSlugInput.value) {
offerSlugInput.value = slugValue;
}
const headline = offerHeadlineInput?.value.trim() || 'Invest in deterministic revenue automation';
const channel = offerChannelInput?.value || 'website';
const promise = offerPromiseInput?.value.trim() || 'Access the AI Revenue Brain automation stack, offer blueprints, and go-to-market agents.';
const channelLabel = channelLabels[channel] || channel;
const connectorsSelected = [...activeConnectors].map(id => connectorIndex[id]?.name).filter(Boolean);
const connectorsLine = connectorsSelected.length ? connectorsSelected.join(', ') : 'Direct GitHub sync + email capture';
const repoLine = connectedRepo
? `Synced to ${connectedRepo.url} • Branch ${connectedRepo.branch} • Region ${connectedRepo.region}`
: 'Connect the AI_Brain repo to auto stream live metrics to the offer page.';
const shareUrl = `https://launch.ai-brain.io/${slugValue}`;
const embedCode = `<script src="https://launch.ai-brain.io/embed.js" data-slug="${slugValue}" data-channel="${channel}" async></script>`;
publicOfferClipboard = `${headline}\n${shareUrl}\nChannel: ${channelLabel}\nPromise: ${promise}\nConnectors: ${connectorsLine}\n${repoLine}`;
publicOfferOutput.innerHTML = `
<strong>${headline}</strong>
<p>${promise}</p>
<p><strong>Channel:</strong> ${channelLabel}</p>
<p><strong>Share URL:</strong> <code>${shareUrl}</code></p>
<p><strong>Embed:</strong> <code>${embedCode.replace(/</g, '<').replace(/>/g, '>')}</code></p>
<p>${repoLine}</p>
<p>Active connectors: ${connectorsLine}</p>
`;
if (flash) {
flashElement(publicOfferOutput);
}
localStorage.setItem('aiBrainPublicOffer', JSON.stringify({
slug: slugValue,
headline,
channel,
promise
}));
}
function handleGeneratePublicOffer() {
updatePublicOfferPreview(true);
}
async function copyPublicOfferLink() {
if (!publicOfferClipboard) return;
if (!copyPublicOffer) return;
try {
await navigator.clipboard.writeText(publicOfferClipboard);
copyPublicOffer.textContent = 'Copied!';
} catch (error) {
copyPublicOffer.textContent = 'Copy unavailable';
}
setTimeout(() => {
if (copyPublicOffer) {
copyPublicOffer.textContent = 'Copy Share Link';
}
}, 2000);
}
function seedCloseDate() {
if (!closeDateInput || closeDateInput.value) return;
const future = new Date();
future.setDate(future.getDate() + 45);
closeDateInput.value = future.toISOString().split('T')[0];
}
function loadStoredOffer() {
if (!storedOffer || !publicOfferForm) return;
if (storedOffer.slug && offerSlugInput) offerSlugInput.value = storedOffer.slug;
if (storedOffer.headline && offerHeadlineInput) offerHeadlineInput.value = storedOffer.headline;
if (storedOffer.channel && offerChannelInput) offerChannelInput.value = storedOffer.channel;
if (storedOffer.promise && offerPromiseInput) offerPromiseInput.value = storedOffer.promise;
}
async function copyPaywallBrief() {
if (!paywallPlanText) return;
if (!copyPaywallPlan) return;
try {
await navigator.clipboard.writeText(paywallPlanText);
copyPaywallPlan.textContent = 'Copied!';
} catch (error) {
copyPaywallPlan.textContent = 'Copy unavailable';
}
setTimeout(() => {
copyPaywallPlan.textContent = 'Copy Monetization Brief';
}, 2000);
}
function initEntrywayInteractions() {
if (!entrywayGrid) return;
entrywayGrid.addEventListener('click', event => {
const trigger = event.target.closest('button[data-entryway]');
if (!trigger) return;
const entryway = entryways.find(item => item.id === trigger.dataset.entryway);
if (entryway) {
setActiveEntryway(entryway);
if (paywallForm) {
window.scrollTo({ top: paywallForm.offsetTop - 120, behavior: 'smooth' });
}
}
});
}
function initPaywallForm() {
if (!paywallForm) return;
paywallForm.addEventListener('input', event => {
if (['paywallPrice', 'paywallConversion', 'paywallAudience', 'paywallTier', 'paywallFeatures'].includes(event.target.id)) {
updatePaywallSummary();
}
});
if (simulatePaywall) {
simulatePaywall.addEventListener('click', () => updatePaywallSummary(true));
}
if (copyPaywallPlan) {
copyPaywallPlan.addEventListener('click', copyPaywallBrief);
}
}
function activateTab(targetId) {
if (!targetId) return;
tabButtons.forEach(button => {
const isActive = button.dataset.target === targetId;
button.classList.toggle('active', isActive);
button.setAttribute('aria-selected', isActive ? 'true' : 'false');
});
tabPanels.forEach(panel => {
const match = panel.id === targetId;
if (match) {
panel.removeAttribute('hidden');
panel.classList.add('active');
} else {
panel.setAttribute('hidden', '');
panel.classList.remove('active');
}
});
}
function initTabs() {
if (!tabButtons.length) return;
tabButtons.forEach(button => {
button.addEventListener('click', () => {
const targetId = button.dataset.target;
activateTab(targetId);
const panel = document.getElementById(targetId);
if (panel) {
window.scrollTo({ top: panel.offsetTop - 90, behavior: 'smooth' });
}
});
});
const hashTarget = window.location.hash.replace('#', '');
if (['modules', 'pipelines', 'deployment', 'console'].includes(hashTarget)) {
activateTab(hashTarget);
} else {
activateTab('modules');
}
}
function renderModules() {
modulesBoard.innerHTML = '';
modules.forEach(module => {
const card = document.createElement('article');
card.className = 'module-card';
card.setAttribute('role', 'listitem');
card.innerHTML = `
<div>
<h3>${module.title}</h3>
<p>${module.description}</p>
</div>
<div class="module-metrics">
${module.tags.map(tag => `<span class="module-tag">${tag}</span>`).join('')}
</div>
<div class="module-footer">
<span>${module.cycle}</span>
<button type="button" class="secondary" data-module="${module.id}">Activate</button>
</div>
<span class="module-tag" style="position:absolute; top:1.5rem; right:1.5rem; background: rgba(249, 115, 22, 0.15); color: var(--accent);">${module.impact}</span>
`;
modulesBoard.appendChild(card);
});
}
function renderPipelineTimeline() {
pipelineTimeline.innerHTML = '';
pipelineSteps.forEach(item => {
const step = document.createElement('div');
step.className = 'timeline-step';
step.dataset.step = item.step;
step.innerHTML = `<strong>${item.title}</strong><p>${item.detail}</p>`;
pipelineTimeline.appendChild(step);
});
}
function renderDeploymentGrid() {
deploymentGrid.innerHTML = '';
deployments.forEach(item => {
const card = document.createElement('article');
card.className = 'module-card';
card.innerHTML = `
<h3>${item.title}</h3>
<p>${item.copy}</p>
<ul style="margin:0; padding-left:1.1rem; color: var(--muted); display:grid; gap:0.5rem;">
${item.bullets.map(b => `<li>${b}</li>`).join('')}
</ul>
`;
deploymentGrid.appendChild(card);
});
}
function animateMetrics() {
metricCards.forEach(card => {
const target = parseFloat(card.dataset.target);
let current = 0;
const isSeconds = card.textContent.endsWith('s');
const duration = 1500;
const start = performance.now();
function update(now) {
const progress = Math.min((now - start) / duration, 1);
current = target * progress;
card.textContent = isSeconds ? `${current.toFixed(1)}s` : `${Math.round(current)}%`;
if (progress < 1) requestAnimationFrame(update);
}
requestAnimationFrame(update);
});
}
function drawCharts() {
const arrCtx = arrChartCanvas.getContext('2d');
const conversionCtx = conversionChartCanvas.getContext('2d');
function drawGradient(ctx, width, height, startColor, endColor) {
const gradient = ctx.createLinearGradient(0, 0, width, height);
gradient.addColorStop(0, startColor);
gradient.addColorStop(1, endColor);
return gradient;
}
function renderLine(ctx, data, color) {
const width = ctx.canvas.width;
const height = ctx.canvas.height;
ctx.clearRect(0, 0, width, height);
ctx.lineWidth = 2.4;
ctx.strokeStyle = color;
ctx.beginPath();
const padding = 28;
const innerWidth = width - padding * 2;
const innerHeight = height - padding * 2;
const max = Math.max(...data);
const min = Math.min(...data);
data.forEach((point, index) => {
const x = padding + (innerWidth / (data.length - 1)) * index;
const y = padding + innerHeight - ((point - min) / (max - min || 1)) * innerHeight;
if (index === 0) {
ctx.moveTo(x, y);
} else {
ctx.lineTo(x, y);
}
});
ctx.stroke();
ctx.fillStyle = drawGradient(ctx, width, height, color + '33', 'transparent');
ctx.lineTo(padding + innerWidth, height - padding);
ctx.lineTo(padding, height - padding);
ctx.closePath();
ctx.fill();
}
const arrData = [1.2, 1.5, 1.75, 1.9, 2.3, 2.8, 3.4];
const conversionData = [2.1, 2.4, 2.6, 3.1, 3.5, 3.9, 4.2];
renderLine(arrCtx, arrData, '#6366f1');
renderLine(conversionCtx, conversionData, '#f97316');
}
function handleModuleToggle(button) {
const moduleId = button.dataset.module;
if (activeModules.has(moduleId)) {
activeModules.delete(moduleId);
button.textContent = 'Activate';
button.closest('.module-card').classList.remove('active');
} else {
activeModules.add(moduleId);
button.textContent = 'Active';
button.closest('.module-card').classList.add('active');
}
}
function generatePlan(event) {
event.preventDefault();
if (!connectedRepo) {
planOutput.textContent = 'Connect the AI_Brain repository first to scope automation and deployment targets.';
return;
}
if (!activeModules.size) {
planOutput.textContent = 'Activate at least one module to construct an execution blueprint.';
return;
}
const objective = objectiveInput.value.trim() || 'Drive net-new revenue expansion';
const kpi = kpiInput.value.trim() || 'Increase ARR by 15%';
const context = contextInput.value.trim() || 'Standard guardrails with compliance-first review process.';
const selectedModules = modules.filter(module => activeModules.has(module.id));
const steps = selectedModules.map((module, index) => {
return `${index + 1}. ${module.title}: ${module.description}`;
}).join('\n');
const timestamp = new Date().toLocaleString();
planOutput.textContent = `AI Revenue Sprint • ${timestamp}\nRepository: ${connectedRepo.url} (${connectedRepo.branch})\nObjective: ${objective}\nPrimary KPI: ${kpi}\nGuardrails: ${context}\n\nExecution Steps:\n${steps}\n\nGitOps Instructions:\n- Create feature branch: feature/revenue-${Date.now().toString(36)}\n- Commit automation manifests & analytics notebooks\n- Open PR with statistical QA summary\n- Trigger deployment pipeline in ${connectedRepo.region}`;
}
async function copyPlanToClipboard() {
const text = planOutput.textContent.trim();
if (!text) return;
try {
await navigator.clipboard.writeText(text);
copyPlan.textContent = 'Copied!';
setTimeout(() => copyPlan.textContent = 'Copy to Clipboard', 2000);
} catch (error) {
copyPlan.textContent = 'Copy not available';
setTimeout(() => copyPlan.textContent = 'Copy to Clipboard', 2000);
}
}
function clearPlanOutput() {
planOutput.textContent = 'Select modules and describe your outcome to generate a deployment-ready sprint plan.';
objectiveInput.value = '';
kpiInput.value = '';
contextInput.value = '';
}
function logToConsole(lines) {
consoleLines.push(...lines);
if (consoleLines.length > 120) {
consoleLines = consoleLines.slice(-120);
}
consoleLog.innerHTML = consoleLines.map(line => `<div class="console-line">${line}</div>`).join('');
consoleLog.scrollTop = consoleLog.scrollHeight;
}
function executeCommand(event) {
event.preventDefault();
if (!connectedRepo) {
logToConsole(['<span>system</span>: Connect the AI_Brain repository before executing commands.']);
return;
}
const routine = commandType.value;
const intensityMode = intensity.value;
const noteText = notes.value.trim();
const id = Math.random().toString(36).slice(2, 8);
const start = new Date().toLocaleTimeString();
logToConsole([
`<span>${start}</span> • Routine ${routine} (${intensityMode}) initiated for ${connectedRepo.name}.`]
);
setTimeout(() => {
logToConsole([
`<span>${new Date().toLocaleTimeString()}</span> • Running containerized agents...`,
`<span>${new Date().toLocaleTimeString()}</span> • Git fetch origin/${connectedRepo.branch} ✓`
]);
}, 450);
setTimeout(() => {
const actions = {
sync: 'Repository analytics complete, 0 drifts detected.',
forecast: 'Forecast notebooks updated, Monte Carlo variance within guardrails.',
experiment: 'Experiment templates generated, sequential testing enabled.',
deploy: 'Production deployment dry-run succeeded, awaiting approval.'
};
logToConsole([
`<span>${new Date().toLocaleTimeString()}</span> • ${actions[routine]}`,
noteText ? `<span>note</span> • ${noteText}` : ''
].filter(Boolean));
}, 1200);
setTimeout(() => {
logToConsole([`<span>${new Date().toLocaleTimeString()}</span> • Routine ${routine} completed • run-id ${id}`]);
}, 1900);
}
function clearConsoleLog() {
consoleLines = [];
consoleLog.innerHTML = '';
}
function simulateSync() {
if (!connectedRepo) return;
syncButton.disabled = true;
syncButton.innerHTML = '<span>…</span> Syncing...';
setTimeout(() => {
syncCount += 1;
const timestamp = new Date().toLocaleString();
connectedRepo.lastSync = timestamp;
localStorage.setItem('aiBrainRepo', JSON.stringify(connectedRepo));
localStorage.setItem('aiBrainSyncCount', syncCount.toString());
updateConnectionUI();
logToConsole([`<span>${timestamp}</span> • Repository synced successfully.`]);
}, 1200);
}
function initModulesInteractions() {
modulesBoard.addEventListener('click', event => {
if (event.target.matches('button[data-module]')) {
handleModuleToggle(event.target);
}
});
}
function handleLaunchSetup() {
const offset = document.getElementById('repository').offsetTop - 70;
window.scrollTo({ top: offset, behavior: 'smooth' });
}
function handleViewDocs() {
const docLines = [
'Integration Steps:',
'1. Fork AI_Brain or connect via GitHub App.',
'2. Run ./scripts/bootstrap_revenue_brain.sh',
'3. Configure env vars: STRIPE_KEY, CRM_TOKEN, AD_PLATFORM_KEYS',
'4. Push changes and open PR; CI enforces statistical QA gates.',
'5. Merge to deploy via infra/revenue-brain.yaml'
];
alert(docLines.join('\n'));
}
function rotateDynamicCopy() {
const messages = [
'Strategize, orchestrate, and automate high-performing growth systems—powered by deterministic math/ML reasoning and full GitOps discipline.',
'Quantify revenue lift with Bayesian forecasts and AI agents that merge through your AI_Brain repo automatically.',
'Automate cross-channel marketing, pricing, and RevOps workflows with reproducible Git-tracked intelligence.'
];
let index = 0;
setInterval(() => {
index = (index + 1) % messages.length;
dynamicCopy.style.opacity = 0;
setTimeout(() => {
dynamicCopy.textContent = messages[index];
dynamicCopy.style.opacity = 1;
}, 250);
}, 6000);
}
function handleNavHighlight() {
const nav = document.querySelector('nav');
const navLinks = document.querySelectorAll('.nav-links a');
const sections = [...navLinks].map(link => document.querySelector(link.getAttribute('href')));
function onScroll() {
if (window.scrollY > 80) {
nav.classList.add('scrolled');
} else {
nav.classList.remove('scrolled');
}
const scrollPos = window.scrollY + 120;
sections.forEach((section, index) => {
if (!section) return;
const top = section.offsetTop;
const bottom = top + section.offsetHeight;
const link = navLinks[index];
if (scrollPos >= top && scrollPos < bottom) {
link.classList.add('active');
} else {
link.classList.remove('active');
}
});
}
window.addEventListener('scroll', onScroll, { passive: true });
onScroll();
}
function initNavLinkClicks() {
document.querySelectorAll('.nav-links a').forEach(link => {
link.addEventListener('click', event => {
event.preventDefault();
const hash = link.getAttribute('href').replace('#', '');
if (['modules', 'pipelines', 'deployment', 'console'].includes(hash)) {
activateTab(hash);
}
const target = document.getElementById(hash) || document.querySelector(link.getAttribute('href'));
if (target) {
window.scrollTo({ top: target.offsetTop - 70, behavior: 'smooth' });
}
});
});
}
function initFormHandlers() {
repoForm.addEventListener('submit', event => {
event.preventDefault();
const url = repoForm.repoUrl.value.trim();
const branch = repoForm.branch.value.trim();
if (!url || !branch) return;
const region = repoForm.deployRegion.value;
const runtime = repoForm.runtime.value;
connectedRepo = {
url,
branch,
region,
runtime,
name: url.split('/').slice(-1)[0] || 'AI_Brain'
};
localStorage.setItem('aiBrainRepo', JSON.stringify(connectedRepo));
updateConnectionUI();
logToConsole([`<span>${new Date().toLocaleTimeString()}</span> • Repository ${connectedRepo.url} connected.`]);
});
planForm.addEventListener('submit', generatePlan);
clearPlan.addEventListener('click', clearPlanOutput);
copyPlan.addEventListener('click', copyPlanToClipboard);
commandForm.addEventListener('submit', executeCommand);
clearConsole.addEventListener('click', clearConsoleLog);
syncButton.addEventListener('click', simulateSync);
launchSetup.addEventListener('click', handleLaunchSetup);
viewDocs.addEventListener('click', handleViewDocs);
if (investmentForm) {
const refreshSyndicate = event => updateSyndicateSummary(event.type === 'change');
investmentForm.addEventListener('input', refreshSyndicate);
investmentForm.addEventListener('change', refreshSyndicate);
}
if (publicOfferForm) {
publicOfferForm.addEventListener('input', () => updatePublicOfferPreview());
}
if (generatePublicOffer) {
generatePublicOffer.addEventListener('click', handleGeneratePublicOffer);
}
if (copyPublicOffer) {
copyPublicOffer.addEventListener('click', copyPublicOfferLink);
}
}
function bootstrap() {
seedCloseDate();
loadStoredOffer();
renderConnectors();
renderEntryways();
renderModules();
renderPipelineTimeline();
renderDeploymentGrid();
renderInvestors();
updateConnectionUI();
initEntrywayInteractions();
initConnectorInteractions();
initPaywallForm();
initTabs();
animateMetrics();
drawCharts();
initModulesInteractions();
rotateDynamicCopy();
handleNavHighlight();
initNavLinkClicks();
initFormHandlers();
updateConnectorSummary();
updateSyndicateSummary();
updatePublicOfferPreview();
updatePaywallSummary();
simulateInvestorPulse();
}
window.addEventListener('load', bootstrap);
</script>
</body>
</html>