export function influencerMarketingCalculator(form: FormTs) {
// Base rates per post by platform and tier
const platformRates: Record<string, Record<string, number>> = {
'instagram': {
'nano': 100,
'micro': 500,
'mid': 2500,
'macro': 10000,
'mega': 50000
},
'tiktok': {
'nano': 75,
'micro': 400,
'mid': 2000,
'macro': 8000,
'mega': 40000
},
'youtube': {
'nano': 200,
'micro': 1000,
'mid': 5000,
'macro': 20000,
'mega': 100000
},
'twitter': {
'nano': 50,
'micro': 250,
'mid': 1000,
'macro': 5000,
'mega': 25000
},
'linkedin': {
'nano': 150,
'micro': 750,
'mid': 3000,
'macro': 12000,
'mega': 60000
}
};
// Content type multipliers
const contentMultipliers: Record<string, number> = {
'static-post': 1.0,
'carousel': 1.3,
'story': 0.5,
'reel-short': 1.5,
'video-long': 2.5,
'live-stream': 2.0,
'blog-review': 1.8
};
// Usage rights multipliers
const usageMultipliers: Record<string, number> = {
'organic': 1.0,
'paid-30': 1.5,
'paid-90': 2.0,
'paid-perpetual': 3.0,
'whitelisting': 2.5
};
// Exclusivity multipliers
const exclusivityMultipliers: Record<string, number> = {
'none': 1.0,
'30-days': 1.25,
'90-days': 1.5,
'6-months': 2.0,
'1-year': 2.5
};
form.addRow(row => {
row.addTextPanel('header', {
computedValue: () => 'Influencer Marketing Budget Calculator',
customStyles: { 'font-size': '1.5rem', 'font-weight': '600', 'color': '#1e293b' }
});
});
form.addSpacer({ height: 20 });
// Platform & Influencer Section
const influencerSection = form.addSubform('influencerDetails', { title: '๐ฑ Platform & Influencer' });
influencerSection.addRow(row => {
row.addDropdown('platform', {
label: 'Primary Platform',
options: [
{ id: 'instagram', name: 'Instagram' },
{ id: 'tiktok', name: 'TikTok' },
{ id: 'youtube', name: 'YouTube' },
{ id: 'twitter', name: 'Twitter / X' },
{ id: 'linkedin', name: 'LinkedIn' }
],
defaultValue: 'instagram',
isRequired: true
}, '1fr');
row.addDropdown('tier', {
label: 'Influencer Tier',
options: [
{ id: 'nano', name: 'Nano (1K - 10K followers)' },
{ id: 'micro', name: 'Micro (10K - 100K followers)' },
{ id: 'mid', name: 'Mid-Tier (100K - 500K followers)' },
{ id: 'macro', name: 'Macro (500K - 1M followers)' },
{ id: 'mega', name: 'Mega (1M+ followers)' }
],
defaultValue: 'micro',
isRequired: true
}, '1fr');
});
influencerSection.addRow(row => {
row.addDropdown('niche', {
label: 'Content Niche',
options: [
{ id: 'lifestyle', name: 'Lifestyle / General' },
{ id: 'fashion', name: 'Fashion & Beauty' },
{ id: 'fitness', name: 'Fitness & Health' },
{ id: 'tech', name: 'Tech & Gaming' },
{ id: 'food', name: 'Food & Travel' },
{ id: 'business', name: 'Business & Finance' },
{ id: 'parenting', name: 'Parenting & Family' },
{ id: 'entertainment', name: 'Entertainment' }
],
defaultValue: 'lifestyle',
isRequired: true
}, '1fr');
row.addDropdown('engagement', {
label: 'Engagement Rate',
options: [
{ id: 'low', name: 'Below Average (< 2%)' },
{ id: 'average', name: 'Average (2% - 4%)' },
{ id: 'good', name: 'Good (4% - 6%)' },
{ id: 'excellent', name: 'Excellent (6%+)' }
],
defaultValue: 'average',
isRequired: true
}, '1fr');
});
// Content Deliverables Section
const contentSection = form.addSubform('contentDetails', { title: '๐ฌ Content Deliverables' });
contentSection.addRow(row => {
row.addDropdown('contentType', {
label: 'Primary Content Type',
options: () => {
const platform = influencerSection.dropdown('platform')?.value() || 'instagram';
if (platform === 'youtube') {
return [
{ id: 'video-long', name: 'Dedicated Video' },
{ id: 'reel-short', name: 'YouTube Shorts' },
{ id: 'live-stream', name: 'Live Stream Integration' },
{ id: 'blog-review', name: 'Video + Description Review' }
];
} else if (platform === 'tiktok') {
return [
{ id: 'reel-short', name: 'TikTok Video' },
{ id: 'live-stream', name: 'TikTok Live' },
{ id: 'carousel', name: 'Photo Slideshow' }
];
} else if (platform === 'linkedin' || platform === 'twitter') {
return [
{ id: 'static-post', name: 'Text Post' },
{ id: 'carousel', name: 'Carousel / Thread' },
{ id: 'reel-short', name: 'Short Video' },
{ id: 'blog-review', name: 'Article / Long-form' }
];
} else {
return [
{ id: 'static-post', name: 'Static Post' },
{ id: 'carousel', name: 'Carousel Post' },
{ id: 'story', name: 'Stories Only' },
{ id: 'reel-short', name: 'Reel / Short Video' },
{ id: 'live-stream', name: 'Live Stream' }
];
}
},
defaultValue: 'static-post',
isRequired: true
}, '1fr');
row.addInteger('postCount', {
label: 'Number of Posts',
min: 1,
max: 20,
defaultValue: 1,
isRequired: true
}, '1fr');
});
contentSection.addRow(row => {
row.addCheckbox('includeStories', {
label: 'Include Stories (3-5 frames)',
defaultValue: false,
isVisible: () => {
const platform = influencerSection.dropdown('platform')?.value();
return platform === 'instagram';
}
}, '1fr');
row.addCheckbox('includeLink', {
label: 'Include Swipe-Up / Link in Bio',
defaultValue: true
}, '1fr');
});
contentSection.addRow(row => {
row.addInteger('revisions', {
label: 'Revision Rounds Included',
min: 0,
max: 5,
defaultValue: 2
}, '1fr');
row.addCheckbox('brandedHashtags', {
label: 'Custom Branded Hashtag',
defaultValue: false
}, '1fr');
});
// Rights & Terms Section
const rightsSection = form.addSubform('rightsDetails', { title: '๐ Usage Rights & Terms' });
rightsSection.addRow(row => {
row.addDropdown('usageRights', {
label: 'Content Usage Rights',
options: [
{ id: 'organic', name: 'Organic Only (Creator\'s Feed)' },
{ id: 'paid-30', name: 'Paid Ads Use (30 days) (+50%)' },
{ id: 'paid-90', name: 'Paid Ads Use (90 days) (+100%)' },
{ id: 'paid-perpetual', name: 'Perpetual Rights (+200%)' },
{ id: 'whitelisting', name: 'Whitelisting / Spark Ads (+150%)' }
],
defaultValue: 'organic',
isRequired: true
}, '1fr');
row.addDropdown('exclusivity', {
label: 'Category Exclusivity',
options: [
{ id: 'none', name: 'No Exclusivity' },
{ id: '30-days', name: '30 Days (+25%)' },
{ id: '90-days', name: '90 Days (+50%)' },
{ id: '6-months', name: '6 Months (+100%)' },
{ id: '1-year', name: '1 Year (+150%)' }
],
defaultValue: 'none',
isRequired: true
}, '1fr');
});
rightsSection.addRow(row => {
row.addCheckbox('contractedCreator', {
label: 'Long-term Ambassador Deal (-15%)',
defaultValue: false
}, '1fr');
row.addCheckbox('productGifting', {
label: 'Product Gifting Only (Reduces Fee)',
defaultValue: false
}, '1fr');
});
// Campaign Scale Section
const scaleSection = form.addSubform('scaleDetails', { title: '๐ Campaign Scale' });
scaleSection.addRow(row => {
row.addInteger('influencerCount', {
label: 'Number of Influencers',
min: 1,
max: 100,
defaultValue: 1,
isRequired: true
}, '1fr');
row.addDropdown('campaignDuration', {
label: 'Campaign Duration',
options: [
{ id: 'one-time', name: 'One-Time Post' },
{ id: '1-month', name: '1 Month Campaign' },
{ id: '3-months', name: '3 Month Campaign (-10%)' },
{ id: '6-months', name: '6 Month Campaign (-15%)' },
{ id: '12-months', name: '12 Month Campaign (-20%)' }
],
defaultValue: 'one-time',
isRequired: true
}, '1fr');
});
form.addSpacer({ height: 20, showLine: true, lineStyle: 'dashed' });
// Price Summary Section
const summarySection = form.addSubform('summary', { title: '๐ฐ Budget Estimate', isCollapsible: false });
summarySection.addRow(row => {
row.addPriceDisplay('baseRate', {
label: 'Base Creator Fee',
computedValue: () => {
const platform = influencerSection.dropdown('platform')?.value() || 'instagram';
const tier = influencerSection.dropdown('tier')?.value() || 'micro';
const contentType = contentSection.dropdown('contentType')?.value() || 'static-post';
const postCount = contentSection.integer('postCount')?.value() || 1;
const niche = influencerSection.dropdown('niche')?.value() || 'lifestyle';
const engagement = influencerSection.dropdown('engagement')?.value() || 'average';
const rates = platformRates[platform] || platformRates['instagram'];
let baseRate = rates?.[tier] ?? 500;
// Niche multiplier
if (niche === 'business' || niche === 'fashion') baseRate *= 1.2;
else if (niche === 'tech') baseRate *= 1.15;
// Engagement multiplier
if (engagement === 'low') baseRate *= 0.8;
else if (engagement === 'good') baseRate *= 1.2;
else if (engagement === 'excellent') baseRate *= 1.5;
// Content type multiplier
const contentMult = contentMultipliers?.[contentType] ?? 1.0;
baseRate *= contentMult;
return baseRate * postCount;
},
variant: 'default'
}, '1fr');
row.addPriceDisplay('addonsTotal', {
label: 'Content Add-ons',
computedValue: () => {
const platform = influencerSection.dropdown('platform')?.value() || 'instagram';
const tier = influencerSection.dropdown('tier')?.value() || 'micro';
const rates = platformRates[platform] || platformRates['instagram'];
const baseRate = rates?.[tier] ?? 500;
let addons = 0;
if (contentSection.checkbox('includeStories')?.value()) {
addons += baseRate * 0.3; // Stories add 30% of base
}
if (contentSection.checkbox('brandedHashtags')?.value()) {
addons += 50; // Flat fee for branded hashtag tracking
}
const revisions = contentSection.integer('revisions')?.value() || 2;
if (revisions > 2) {
addons += (revisions - 2) * 50; // $50 per extra revision
}
return addons;
},
variant: 'default',
prefix: '+'
}, '1fr');
});
summarySection.addRow(row => {
row.addPriceDisplay('usageRightsCost', {
label: 'Usage Rights Premium',
computedValue: () => {
const platform = influencerSection.dropdown('platform')?.value() || 'instagram';
const tier = influencerSection.dropdown('tier')?.value() || 'micro';
const contentType = contentSection.dropdown('contentType')?.value() || 'static-post';
const postCount = contentSection.integer('postCount')?.value() || 1;
const usageRights = rightsSection.dropdown('usageRights')?.value() || 'organic';
const rates = platformRates[platform] || platformRates['instagram'];
let baseRate = rates?.[tier] ?? 500;
const contentMult = contentMultipliers?.[contentType] ?? 1.0;
baseRate *= contentMult * postCount;
const usageMult = usageMultipliers?.[usageRights] ?? 1.0;
return baseRate * (usageMult - 1);
},
variant: 'default',
prefix: '+'
}, '1fr');
row.addPriceDisplay('exclusivityCost', {
label: 'Exclusivity Premium',
computedValue: () => {
const platform = influencerSection.dropdown('platform')?.value() || 'instagram';
const tier = influencerSection.dropdown('tier')?.value() || 'micro';
const contentType = contentSection.dropdown('contentType')?.value() || 'static-post';
const postCount = contentSection.integer('postCount')?.value() || 1;
const exclusivity = rightsSection.dropdown('exclusivity')?.value() || 'none';
const rates = platformRates[platform] || platformRates['instagram'];
let baseRate = rates?.[tier] ?? 500;
const contentMult = contentMultipliers?.[contentType] ?? 1.0;
baseRate *= contentMult * postCount;
const exclusivityMult = exclusivityMultipliers?.[exclusivity] ?? 1.0;
return baseRate * (exclusivityMult - 1);
},
variant: 'default',
prefix: '+'
}, '1fr');
});
summarySection.addRow(row => {
row.addPriceDisplay('perInfluencer', {
label: 'Per Influencer Total',
computedValue: () => {
const platform = influencerSection.dropdown('platform')?.value() || 'instagram';
const tier = influencerSection.dropdown('tier')?.value() || 'micro';
const contentType = contentSection.dropdown('contentType')?.value() || 'static-post';
const postCount = contentSection.integer('postCount')?.value() || 1;
const niche = influencerSection.dropdown('niche')?.value() || 'lifestyle';
const engagement = influencerSection.dropdown('engagement')?.value() || 'average';
const usageRights = rightsSection.dropdown('usageRights')?.value() || 'organic';
const exclusivity = rightsSection.dropdown('exclusivity')?.value() || 'none';
const contractedCreator = rightsSection.checkbox('contractedCreator')?.value();
const productGifting = rightsSection.checkbox('productGifting')?.value();
const rates = platformRates[platform] || platformRates['instagram'];
let baseRate = rates?.[tier] ?? 500;
// Niche multiplier
if (niche === 'business' || niche === 'fashion') baseRate *= 1.2;
else if (niche === 'tech') baseRate *= 1.15;
// Engagement multiplier
if (engagement === 'low') baseRate *= 0.8;
else if (engagement === 'good') baseRate *= 1.2;
else if (engagement === 'excellent') baseRate *= 1.5;
// Content type and count
const contentMult = contentMultipliers?.[contentType] ?? 1.0;
let total = baseRate * contentMult * postCount;
// Add-ons
if (contentSection.checkbox('includeStories')?.value()) {
total += baseRate * 0.3;
}
if (contentSection.checkbox('brandedHashtags')?.value()) {
total += 50;
}
const revisions = contentSection.integer('revisions')?.value() || 2;
if (revisions > 2) {
total += (revisions - 2) * 50;
}
// Usage rights
total *= usageMultipliers?.[usageRights] ?? 1.0;
// Exclusivity
total *= exclusivityMultipliers?.[exclusivity] ?? 1.0;
// Discounts
if (contractedCreator) total *= 0.85;
if (productGifting) total *= 0.7;
return Math.round(total);
},
variant: 'default'
});
});
const finalSection = form.addSubform('final', {
title: '๐งพ Campaign Total',
isCollapsible: false,
sticky: 'bottom'
});
finalSection.addRow(row => {
row.addPriceDisplay('totalBudget', {
label: 'Total Campaign Budget',
computedValue: () => {
const platform = influencerSection.dropdown('platform')?.value() || 'instagram';
const tier = influencerSection.dropdown('tier')?.value() || 'micro';
const contentType = contentSection.dropdown('contentType')?.value() || 'static-post';
const postCount = contentSection.integer('postCount')?.value() || 1;
const niche = influencerSection.dropdown('niche')?.value() || 'lifestyle';
const engagement = influencerSection.dropdown('engagement')?.value() || 'average';
const usageRights = rightsSection.dropdown('usageRights')?.value() || 'organic';
const exclusivity = rightsSection.dropdown('exclusivity')?.value() || 'none';
const contractedCreator = rightsSection.checkbox('contractedCreator')?.value();
const productGifting = rightsSection.checkbox('productGifting')?.value();
const influencerCount = scaleSection.integer('influencerCount')?.value() || 1;
const campaignDuration = scaleSection.dropdown('campaignDuration')?.value() || 'one-time';
const rates = platformRates[platform] || platformRates['instagram'];
let baseRate = rates?.[tier] ?? 500;
// Niche & engagement
if (niche === 'business' || niche === 'fashion') baseRate *= 1.2;
else if (niche === 'tech') baseRate *= 1.15;
if (engagement === 'low') baseRate *= 0.8;
else if (engagement === 'good') baseRate *= 1.2;
else if (engagement === 'excellent') baseRate *= 1.5;
const contentMult = contentMultipliers?.[contentType] ?? 1.0;
let perInfluencer = baseRate * contentMult * postCount;
// Add-ons
if (contentSection.checkbox('includeStories')?.value()) perInfluencer += baseRate * 0.3;
if (contentSection.checkbox('brandedHashtags')?.value()) perInfluencer += 50;
const revisions = contentSection.integer('revisions')?.value() || 2;
if (revisions > 2) perInfluencer += (revisions - 2) * 50;
// Rights multipliers
perInfluencer *= usageMultipliers?.[usageRights] ?? 1.0;
perInfluencer *= exclusivityMultipliers?.[exclusivity] ?? 1.0;
// Discounts
if (contractedCreator) perInfluencer *= 0.85;
if (productGifting) perInfluencer *= 0.7;
let total = perInfluencer * influencerCount;
// Campaign duration discount
if (campaignDuration === '3-months') total *= 0.9;
else if (campaignDuration === '6-months') total *= 0.85;
else if (campaignDuration === '12-months') total *= 0.8;
return Math.round(total);
},
variant: 'large'
});
});
finalSection.addRow(row => {
row.addTextPanel('rangeNote', {
computedValue: () => {
const total = (() => {
const platform = influencerSection.dropdown('platform')?.value() || 'instagram';
const tier = influencerSection.dropdown('tier')?.value() || 'micro';
const rates = platformRates[platform] || platformRates['instagram'];
let baseRate = rates?.[tier] ?? 500;
const influencerCount = scaleSection.integer('influencerCount')?.value() || 1;
return baseRate * influencerCount;
})();
const low = Math.round(total * 0.7);
const high = Math.round(total * 1.5);
return `Typical range: $${low.toLocaleString()} - $${high.toLocaleString()}`;
},
customStyles: { 'font-size': '0.9rem', 'color': '#64748b', 'text-align': 'center' }
});
});
finalSection.addRow(row => {
row.addTextPanel('disclaimer', {
computedValue: () => 'Rates are industry estimates. Actual rates vary by individual creator.',
customStyles: { 'font-size': '0.85rem', 'color': '#64748b', 'font-style': 'italic' }
});
});
form.configureSubmitButton({
label: 'Get Detailed Proposal'
});
}