Promotional Offer Copy Generator
Create high-converting copy for your next campaign.
$
%
Your generated copy options will appear here.
Final Copy Preview
Select a copy variation from the previous tab to see a preview here.
PDF Export Format
${copy.cta}
`; card.addEventListener('click', () => { document.querySelectorAll('.copy-card').forEach(c => c.classList.remove('selected')); card.classList.add('selected'); selectedCopy = copy; }); copyResultsContainer.appendChild(card); }); }; const updateExportPreview = () => { const summaryContainer = document.getElementById('summary-container'); const placeholder = document.getElementById('export-placeholder'); if (selectedCopy) { placeholder.style.display = 'none'; summaryContainer.innerHTML = `${selectedCopy.headline}
${selectedCopy.body}
${selectedCopy.cta}
`; } else { placeholder.style.display = 'block'; summaryContainer.innerHTML = ''; summaryContainer.appendChild(placeholder); } }; const downloadPDF = () => { if (!selectedCopy) { alert('Please generate and select a copy variation first.'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const theme = document.querySelector('input[name="theme"]:checked').value; const page = { width: doc.internal.pageSize.getWidth(), height: doc.internal.pageSize.getHeight() }; const margin = 60; let y = margin; const productName = document.getElementById('productName').value || 'Promotional Offer'; if (theme === 'email_copy') { doc.setFont('helvetica', 'bold'); doc.setFontSize(16); doc.text(`Email Copy for: ${productName}`, margin, y); y += 30; doc.setFont('helvetica', 'bold'); doc.setFontSize(11); doc.text('Subject / Headline:', margin, y); y+= 15; doc.setFont('helvetica', 'normal'); doc.text(selectedCopy.headline, margin, y, { maxWidth: page.width - margin * 2 }); y += 50; doc.setFont('helvetica', 'bold'); doc.setFontSize(11); doc.text('Body:', margin, y); y+= 15; doc.setFont('helvetica', 'normal'); const bodyLines = doc.splitTextToSize(selectedCopy.body, page.width - margin * 2); doc.text(bodyLines, margin, y); y += bodyLines.length * 14 + 30; doc.setFont('helvetica', 'bold'); doc.setFontSize(11); doc.text('Call to Action:', margin, y); y+= 15; doc.setFont('helvetica', 'normal'); doc.text(selectedCopy.cta, margin, y); } else { // ad_copy doc.setFont('helvetica', 'bold'); doc.setFontSize(24); doc.text(selectedCopy.headline, page.width/2, y, { align: 'center', maxWidth: page.width - margin * 2 }); y += doc.splitTextToSize(selectedCopy.headline, page.width - margin * 2).length * 24 + 40; doc.setFont('helvetica', 'normal'); doc.setFontSize(12); doc.text(selectedCopy.body, page.width/2, y, { align: 'center', maxWidth: page.width - margin * 2 - 40 }); y += doc.splitTextToSize(selectedCopy.body, page.width - margin * 2 - 40).length * 14 + 60; doc.setFillColor(37, 99, 235); doc.roundedRect(page.width/2 - 100, y, 200, 40, 5, 5, 'F'); doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.setTextColor(255,255,255); doc.text(selectedCopy.cta, page.width/2, y+25, { align: 'center' }); } doc.save(`${productName.replace(/\s+/g, '-').toLowerCase()}-promo-copy.pdf`); }; // Event Listeners tabs.forEach((tab, index) => tab.addEventListener('click', () => showTab(index))); prevBtn.addEventListener('click', () => navigateTab(-1)); nextBtn.addEventListener('click', () => navigateTab(1)); generateBtn.addEventListener('click', generateCopy); offerTypeSelect.addEventListener('change', handleOfferTypeChange); downloadPdfBtn.addEventListener('click', downloadPDF); // Initialization showTab(0); handleOfferTypeChange(); });