| 1 |
(function () { |
| 2 |
function typoCssVarsForEl(typo, prefix, el) { |
| 3 |
if (!typo) return; |
| 4 |
if (typo.family) el.style.setProperty(prefix + 'font-family', "'" + typo.family + "', sans-serif"); |
| 5 |
if (typo.weight) el.style.setProperty(prefix + 'font-weight', typo.weight); |
| 6 |
if (typo.transform) el.style.setProperty(prefix + 'text-transform', typo.transform); |
| 7 |
if (typo.style) el.style.setProperty(prefix + 'font-style', typo.style); |
| 8 |
if (typo.decoration) el.style.setProperty(prefix + 'text-decoration', typo.decoration); |
| 9 |
var su = typo.sizeUnit || 'px'; |
| 10 |
if (typo.sizeDesktop !== '' && typo.sizeDesktop != null) el.style.setProperty(prefix + 'font-size-d', typo.sizeDesktop + su); |
| 11 |
if (typo.sizeTablet !== '' && typo.sizeTablet != null) el.style.setProperty(prefix + 'font-size-t', typo.sizeTablet + su); |
| 12 |
if (typo.sizeMobile !== '' && typo.sizeMobile != null) el.style.setProperty(prefix + 'font-size-m', typo.sizeMobile + su); |
| 13 |
var lhu = typo.lineHeightUnit || 'px'; |
| 14 |
if (typo.lineHeightDesktop !== '' && typo.lineHeightDesktop != null) el.style.setProperty(prefix + 'line-height-d', typo.lineHeightDesktop + lhu); |
| 15 |
if (typo.lineHeightTablet !== '' && typo.lineHeightTablet != null) el.style.setProperty(prefix + 'line-height-t', typo.lineHeightTablet + lhu); |
| 16 |
if (typo.lineHeightMobile !== '' && typo.lineHeightMobile != null) el.style.setProperty(prefix + 'line-height-m', typo.lineHeightMobile + lhu); |
| 17 |
var lsu = typo.letterSpacingUnit || 'px'; |
| 18 |
if (typo.letterSpacingDesktop !== '' && typo.letterSpacingDesktop != null) { el.style.setProperty(prefix + 'letter-spacing-d', typo.letterSpacingDesktop + lsu); el.style.setProperty(prefix + 'letter-spacing', typo.letterSpacingDesktop + lsu); } |
| 19 |
if (typo.letterSpacingTablet !== '' && typo.letterSpacingTablet != null) el.style.setProperty(prefix + 'letter-spacing-t', typo.letterSpacingTablet + lsu); |
| 20 |
if (typo.letterSpacingMobile !== '' && typo.letterSpacingMobile != null) el.style.setProperty(prefix + 'letter-spacing-m', typo.letterSpacingMobile + lsu); |
| 21 |
var wsu = typo.wordSpacingUnit || 'px'; |
| 22 |
if (typo.wordSpacingDesktop !== '' && typo.wordSpacingDesktop != null) { el.style.setProperty(prefix + 'word-spacing-d', typo.wordSpacingDesktop + wsu); el.style.setProperty(prefix + 'word-spacing', typo.wordSpacingDesktop + wsu); } |
| 23 |
if (typo.wordSpacingTablet !== '' && typo.wordSpacingTablet != null) el.style.setProperty(prefix + 'word-spacing-t', typo.wordSpacingTablet + wsu); |
| 24 |
if (typo.wordSpacingMobile !== '' && typo.wordSpacingMobile != null) el.style.setProperty(prefix + 'word-spacing-m', typo.wordSpacingMobile + wsu); |
| 25 |
} |
| 26 |
|
| 27 |
function init() { |
| 28 |
document.querySelectorAll('.bkbg-aff-app').forEach(function (el) { |
| 29 |
if (el.dataset.rendered) return; |
| 30 |
el.dataset.rendered = '1'; |
| 31 |
|
| 32 |
var opts; |
| 33 |
try { opts = JSON.parse(el.dataset.opts || '{}'); } catch (e) { opts = {}; } |
| 34 |
|
| 35 |
var o = Object.assign({ |
| 36 |
eyebrow: 'Partner Program', |
| 37 |
heading: 'Earn While You Share', |
| 38 |
subtext: 'Join our affiliate program and earn generous commissions for every customer you refer.', |
| 39 |
commission: '30%', |
| 40 |
commissionLabel: 'recurring commission', |
| 41 |
commissionNote: 'on every sale, every month, for life', |
| 42 |
steps: [ |
| 43 |
{ icon: '🔗', title: 'Sign Up Free', description: 'Create your affiliate account in minutes.' }, |
| 44 |
{ icon: '📢', title: 'Share Your Link', description: 'Promote via blog, email, social, or any channel.' }, |
| 45 |
{ icon: '💰', title: 'Earn Commission', description: 'Get paid automatically every month.' } |
| 46 |
], |
| 47 |
showBenefits: true, |
| 48 |
benefits: [ |
| 49 |
{ text: '30-day cookie window' }, |
| 50 |
{ text: 'Real-time tracking dashboard' }, |
| 51 |
{ text: 'Monthly payouts via PayPal' }, |
| 52 |
{ text: 'Dedicated affiliate manager' }, |
| 53 |
{ text: 'Marketing materials provided' } |
| 54 |
], |
| 55 |
showStats: true, |
| 56 |
stats: [ |
| 57 |
{ number: '2,400+', label: 'Active Affiliates' }, |
| 58 |
{ number: '$1.2M', label: 'Paid Out' }, |
| 59 |
{ number: '4.8� |
| 60 |
', label: 'Affiliate Rating' } |
| 61 |
], |
| 62 |
ctaLabel: 'Join the Program', |
| 63 |
ctaUrl: '#', |
| 64 |
ctaSecondaryLabel: 'Learn More', |
| 65 |
ctaSecondaryUrl: '#', |
| 66 |
showSecondary: true, |
| 67 |
layout: 'split', |
| 68 |
bgColor: '#0f172a', |
| 69 |
accentColor: '#6366f1', |
| 70 |
commissionBg: '#6366f1', |
| 71 |
commissionColor: '#ffffff', |
| 72 |
headingColor: '#ffffff', |
| 73 |
subColor: '#94a3b8', |
| 74 |
eyebrowColor: '#a5b4fc', |
| 75 |
stepCardBg: '#1e293b', |
| 76 |
stepTitleColor: '#f1f5f9', |
| 77 |
stepDescColor: '#94a3b8', |
| 78 |
benefitColor: '#e2e8f0', |
| 79 |
statNumColor: '#6366f1', |
| 80 |
statLabelColor: '#94a3b8', |
| 81 |
ctaBg: '#6366f1', |
| 82 |
ctaColor: '#ffffff', |
| 83 |
maxWidth: 1100, |
| 84 |
paddingTop: 80, |
| 85 |
paddingBottom: 80 |
| 86 |
}, opts); |
| 87 |
|
| 88 |
el.parentElement && (el.parentElement.style.background = o.bgColor); |
| 89 |
|
| 90 |
/* Typography CSS vars */ |
| 91 |
el.style.setProperty('--bkbg-aff-eyebrow-sz', (o.eyebrowFontSize || 13) + 'px'); |
| 92 |
el.style.setProperty('--bkbg-aff-heading-sz', (o.headingFontSize || 38) + 'px'); |
| 93 |
el.style.setProperty('--bkbg-aff-subtext-sz', (o.subtextFontSize || 18) + 'px'); |
| 94 |
typoCssVarsForEl(o.eyebrowTypo, '--bkbg-aff-eyebrow-', el); |
| 95 |
typoCssVarsForEl(o.headingTypo, '--bkbg-aff-heading-', el); |
| 96 |
typoCssVarsForEl(o.subtextTypo, '--bkbg-aff-subtext-', el); |
| 97 |
|
| 98 |
var inner = document.createElement('div'); |
| 99 |
inner.className = 'bkbg-aff-inner'; |
| 100 |
inner.style.cssText = 'max-width:' + o.maxWidth + 'px;margin:0 auto;padding:' + o.paddingTop + 'px 24px ' + o.paddingBottom + 'px;'; |
| 101 |
|
| 102 |
/* Text block */ |
| 103 |
var textBlock = document.createElement('div'); |
| 104 |
textBlock.className = 'bkbg-aff-text-block'; |
| 105 |
|
| 106 |
var eyebrow = document.createElement('p'); |
| 107 |
eyebrow.className = 'bkbg-aff-eyebrow'; |
| 108 |
eyebrow.style.cssText = 'color:' + o.eyebrowColor; |
| 109 |
eyebrow.innerHTML = o.eyebrow; |
| 110 |
|
| 111 |
var heading = document.createElement('h2'); |
| 112 |
heading.className = 'bkbg-aff-heading'; |
| 113 |
heading.style.cssText = 'color:' + o.headingColor; |
| 114 |
heading.innerHTML = o.heading; |
| 115 |
|
| 116 |
var sub = document.createElement('p'); |
| 117 |
sub.className = 'bkbg-aff-sub'; |
| 118 |
sub.style.cssText = 'color:' + o.subColor; |
| 119 |
sub.innerHTML = o.subtext; |
| 120 |
|
| 121 |
textBlock.appendChild(eyebrow); |
| 122 |
textBlock.appendChild(heading); |
| 123 |
textBlock.appendChild(sub); |
| 124 |
inner.appendChild(textBlock); |
| 125 |
|
| 126 |
/* Commission badge */ |
| 127 |
var commDiv = document.createElement('div'); |
| 128 |
commDiv.className = 'bkbg-aff-commission'; |
| 129 |
|
| 130 |
var badge = document.createElement('div'); |
| 131 |
badge.className = 'bkbg-aff-commission-badge'; |
| 132 |
badge.style.cssText = 'background:' + o.commissionBg + ';color:' + o.commissionColor; |
| 133 |
|
| 134 |
var cval = document.createElement('div'); |
| 135 |
cval.className = 'bkbg-aff-commission-value'; |
| 136 |
cval.textContent = o.commission; |
| 137 |
|
| 138 |
var clbl = document.createElement('div'); |
| 139 |
clbl.className = 'bkbg-aff-commission-label'; |
| 140 |
clbl.textContent = o.commissionLabel; |
| 141 |
|
| 142 |
var cnote = document.createElement('div'); |
| 143 |
cnote.className = 'bkbg-aff-commission-note'; |
| 144 |
cnote.textContent = o.commissionNote; |
| 145 |
|
| 146 |
badge.appendChild(cval); |
| 147 |
badge.appendChild(clbl); |
| 148 |
badge.appendChild(cnote); |
| 149 |
commDiv.appendChild(badge); |
| 150 |
inner.appendChild(commDiv); |
| 151 |
|
| 152 |
/* Steps */ |
| 153 |
var stepsGrid = document.createElement('div'); |
| 154 |
stepsGrid.className = 'bkbg-aff-steps'; |
| 155 |
|
| 156 |
(o.steps || []).forEach(function (step) { |
| 157 |
var card = document.createElement('div'); |
| 158 |
card.className = 'bkbg-aff-step-card'; |
| 159 |
card.style.background = o.stepCardBg; |
| 160 |
|
| 161 |
var icon = document.createElement('div'); |
| 162 |
icon.className = 'bkbg-aff-step-icon'; |
| 163 |
icon.textContent = step.icon; |
| 164 |
|
| 165 |
var title = document.createElement('div'); |
| 166 |
title.className = 'bkbg-aff-step-title'; |
| 167 |
title.style.color = o.stepTitleColor; |
| 168 |
title.textContent = step.title; |
| 169 |
|
| 170 |
var desc = document.createElement('div'); |
| 171 |
desc.className = 'bkbg-aff-step-desc'; |
| 172 |
desc.style.color = o.stepDescColor; |
| 173 |
desc.textContent = step.description; |
| 174 |
|
| 175 |
card.appendChild(icon); |
| 176 |
card.appendChild(title); |
| 177 |
card.appendChild(desc); |
| 178 |
stepsGrid.appendChild(card); |
| 179 |
}); |
| 180 |
inner.appendChild(stepsGrid); |
| 181 |
|
| 182 |
/* Benefits */ |
| 183 |
if (o.showBenefits && o.benefits && o.benefits.length) { |
| 184 |
var benWrap = document.createElement('div'); |
| 185 |
benWrap.className = 'bkbg-aff-benefits'; |
| 186 |
|
| 187 |
o.benefits.forEach(function (b) { |
| 188 |
var item = document.createElement('span'); |
| 189 |
item.className = 'bkbg-aff-benefit'; |
| 190 |
item.style.color = o.benefitColor; |
| 191 |
|
| 192 |
var check = document.createElement('em'); |
| 193 |
check.className = 'bkbg-aff-benefit-check'; |
| 194 |
check.style.color = o.accentColor; |
| 195 |
check.textContent = '✓'; |
| 196 |
|
| 197 |
item.appendChild(check); |
| 198 |
item.appendChild(document.createTextNode(' ' + b.text)); |
| 199 |
benWrap.appendChild(item); |
| 200 |
}); |
| 201 |
inner.appendChild(benWrap); |
| 202 |
} |
| 203 |
|
| 204 |
/* Stats */ |
| 205 |
if (o.showStats && o.stats && o.stats.length) { |
| 206 |
var statsRow = document.createElement('div'); |
| 207 |
statsRow.className = 'bkbg-aff-stats'; |
| 208 |
|
| 209 |
o.stats.forEach(function (s) { |
| 210 |
var stat = document.createElement('div'); |
| 211 |
stat.className = 'bkbg-aff-stat'; |
| 212 |
|
| 213 |
var num = document.createElement('div'); |
| 214 |
num.className = 'bkbg-aff-stat-num'; |
| 215 |
num.style.color = o.statNumColor; |
| 216 |
num.textContent = s.number; |
| 217 |
|
| 218 |
var lbl = document.createElement('div'); |
| 219 |
lbl.className = 'bkbg-aff-stat-label'; |
| 220 |
lbl.style.color = o.statLabelColor; |
| 221 |
lbl.textContent = s.label; |
| 222 |
|
| 223 |
stat.appendChild(num); |
| 224 |
stat.appendChild(lbl); |
| 225 |
statsRow.appendChild(stat); |
| 226 |
}); |
| 227 |
inner.appendChild(statsRow); |
| 228 |
} |
| 229 |
|
| 230 |
/* CTAs */ |
| 231 |
var ctaRow = document.createElement('div'); |
| 232 |
ctaRow.className = 'bkbg-aff-ctas'; |
| 233 |
|
| 234 |
var primary = document.createElement('a'); |
| 235 |
primary.className = 'bkbg-aff-cta-primary'; |
| 236 |
primary.href = o.ctaUrl; |
| 237 |
primary.style.cssText = 'background:' + o.ctaBg + ';color:' + o.ctaColor; |
| 238 |
primary.textContent = o.ctaLabel; |
| 239 |
ctaRow.appendChild(primary); |
| 240 |
|
| 241 |
if (o.showSecondary) { |
| 242 |
var secondary = document.createElement('a'); |
| 243 |
secondary.className = 'bkbg-aff-cta-secondary'; |
| 244 |
secondary.href = o.ctaSecondaryUrl; |
| 245 |
secondary.style.cssText = 'color:' + o.accentColor + ';border-color:' + o.accentColor; |
| 246 |
secondary.textContent = o.ctaSecondaryLabel; |
| 247 |
ctaRow.appendChild(secondary); |
| 248 |
} |
| 249 |
inner.appendChild(ctaRow); |
| 250 |
|
| 251 |
el.appendChild(inner); |
| 252 |
}); |
| 253 |
} |
| 254 |
|
| 255 |
if (document.readyState !== 'loading') { init(); } |
| 256 |
else { document.addEventListener('DOMContentLoaded', init); } |
| 257 |
})(); |
| 258 |
|