File: //tmp/dnssec-fix.js
const ORDER_POSTS = {
quick_fix: { action: 'https://support.panomity.com/cart/priority-support/DNS-Quick-Fix/&step=0', id: '867', cycle: 'Once' },
cleanup: { action: 'https://support.panomity.com/cart/priority-support/DNSMail-Security-Cleanup/&step=0', id: '868', cycle: 'Once' }
};
function submitHostBillOrder(plan) {
const cfg = ORDER_POSTS[plan];
if (!cfg) return false;
const form = document.createElement('form');
form.method = 'post';
form.action = cfg.action;
for (const [name, value] of Object.entries({ action: 'add', id: cfg.id, cycle: cfg.cycle })) {
const input = document.createElement('input');
input.type = 'hidden';
input.name = name;
input.value = value;
form.appendChild(input);
}
document.body.appendChild(form);
form.submit();
return true;
}
async function recordLandingLead(plan, extra = {}) {
try {
const payload = Object.assign({ source: 'seo_landing', intent: 'landing_checkout', plan, domain: '', page: window.location.pathname }, extra || {});
await fetch('/v1/leads', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
});
} catch (e) { /* lead tracking must never block checkout */ }
}
async function recordQualifiedLandingLead(form) {
const data = new FormData(form);
const plan = String(data.get('plan') || 'cleanup');
const status = form.querySelector('.quoteStatus');
if (status) status.textContent = 'Anfrage wird gespeichert…';
await recordLandingLead(plan, {
intent: 'qualified_fix_request',
domain: String(data.get('domain') || '').trim().toLowerCase(),
contact_email: String(data.get('email') || '').trim(),
message: String(data.get('message') || '').trim(),
page: window.location.pathname + '#qualified-request'
});
if (status) status.textContent = 'Gespeichert. Der Kontakt erscheint im Revenue-Report.';
}
document.querySelectorAll('[data-qualified-form]').forEach((form) => {
form.addEventListener('submit', async (event) => {
event.preventDefault();
await recordQualifiedLandingLead(form);
});
});
document.addEventListener('click', async (event) => {
const cta = event.target.closest('[data-service-lead]');
if (!cta) return;
const plan = cta.dataset.serviceLead;
const fallbackUrl = cta.href;
event.preventDefault();
await recordLandingLead(plan);
if (submitHostBillOrder(plan)) return;
window.location.href = fallbackUrl;
});