Smart Multi-Country Referral Program Configurator

Smart Multi-Country Referral Program Configurator

Design and customize your global referral program.

General Program Settings

Country-Specific Configuration

Add each country participating in the program and set their unique rewards. Rewards for the Advocate (referrer) and their Friend (referred).

Program Rules & Eligibility

Program Configuration Summary

Advocate Reward: ${advocate}

Friend Reward: ${friend}

`; }); summaryHtml += `
`; summaryHtml += `

Rules & Conditions

Eligibility: ${getValue('eligibility')}

Successful Referral: ${getValue('conditions')}

Terms: ${getValue('terms')}

`; summaryContent.innerHTML = summaryHtml; }; // --- PDF Download Logic --- downloadPdfBtn.addEventListener('click', () => { if (typeof window.jspdf === 'undefined') { return; } const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'p', unit: 'pt', format: 'letter' }); const getValue = id => document.getElementById(id).value; const page = { width: doc.internal.pageSize.getWidth(), height: doc.internal.pageSize.getHeight(), margin: 72 }; page.contentWidth = page.width - page.margin * 2; let y = page.margin; const addSection = (title, content) => { const titleHeight = doc.getTextDimensions(title).h; const contentLines = doc.splitTextToSize(content, page.contentWidth); const contentHeight = contentLines.length * 12 * 1.5; if (y + titleHeight + contentHeight > page.height - page.margin) { doc.addPage(); y = page.margin; } doc.setFont('times', 'bold'); doc.setFontSize(14); doc.text(title, page.margin, y); y += 20; doc.setFont('times', 'normal'); doc.setFontSize(11); doc.text(contentLines, page.margin, y, { lineHeightFactor: 1.5 }); y += contentHeight + 25; }; // PDF Content doc.setFont('times', 'bold'); doc.setFontSize(22); doc.text('Referral Program Configuration', page.width / 2, y, { align: 'center' }); y += 20; doc.setFontSize(14); doc.setFont('times', 'normal'); doc.text(getValue('companyName'), page.width / 2, y, { align: 'center' }); y += 15; doc.text(`Date: ${new Date().toLocaleDateString()}`, page.width / 2, y, { align: 'center' }); y += 40; addSection('I. General Program Details', `Program Name: ${getValue('programName')}\nProgram URL: ${getValue('programUrl')}`); // Country Rewards Section doc.setFont('times', 'bold'); doc.setFontSize(14); doc.text('II. Country-Specific Rewards', page.margin, y); y += 20; document.querySelectorAll('.dynamic-country').forEach(block => { const country = block.querySelector('.country-select').value; const currency = block.querySelector('.country-currency').value; const advocate = block.querySelector('.advocate-reward').value; const friend = block.querySelector('.friend-reward').value; const countryText = `Country: ${country} (${currency})\n - Advocate Reward: ${advocate}\n - Friend Reward: ${friend}`; const lines = doc.splitTextToSize(countryText, page.contentWidth); if (y + lines.length * 12 * 1.5 > page.height - page.margin) { doc.addPage(); y = page.margin; } doc.setFont('times', 'normal'); doc.setFontSize(11); doc.text(lines, page.margin, y, { lineHeightFactor: 1.5 }); y += lines.length * 12 * 1.5 + 10; }); y += 15; addSection('III. Rules & Eligibility', `Advocate Eligibility:\n${getValue('eligibility')}`); addSection('IV. Conditions for a Successful Referral', getValue('conditions')); addSection('V. General Terms', getValue('terms')); doc.save(`${getValue('programName') || 'Referral-Program'}.pdf`); }); // --- Initial Setup --- addCountryBlock("USA", "$20 Credit", "20% off first purchase"); switchTab('general'); });
Scroll to Top