export function cookieConsentImplementationCalculator(form: FormTs) {
// CMP platform pricing (annual)
const cmpPricing: Record<string, { name: string; monthly: number; setup: number }> = {
'free': { name: 'Free/Basic CMP', monthly: 0, setup: 500 },
'basic': { name: 'Basic Paid CMP', monthly: 15, setup: 300 },
'professional': { name: 'Professional CMP', monthly: 50, setup: 200 },
'enterprise': { name: 'Enterprise CMP', monthly: 200, setup: 0 },
'custom': { name: 'Custom Solution', monthly: 0, setup: 5000 }
};
// Website complexity multipliers
const complexityMultipliers: Record<string, number> = {
'simple': 0.8,
'standard': 1.0,
'complex': 1.5,
'enterprise': 2.0
};
// Traffic tier pricing
const trafficPricing: Record<string, number> = {
'small': 0,
'medium': 25,
'large': 75,
'very-large': 200
};
form.addRow(row => {
row.addTextPanel('header', {
computedValue: () => 'Cookie Consent Implementation Calculator',
customStyles: { 'font-size': '1.5rem', 'font-weight': '600', 'color': '#1e293b' }
});
});
form.addSpacer({ height: 20 });
// Website Profile Section
const websiteSection = form.addSubform('websiteProfile', { title: '🌐 Website Profile' });
websiteSection.addRow(row => {
row.addDropdown('websiteType', {
label: 'Website Type',
options: [
{ id: 'simple', name: 'Simple website (brochure, blog)' },
{ id: 'standard', name: 'Standard (CMS, some integrations)' },
{ id: 'complex', name: 'Complex (e-commerce, many integrations)' },
{ id: 'enterprise', name: 'Enterprise (multiple sites, apps)' }
],
defaultValue: 'standard',
isRequired: true
}, '1fr');
row.addDropdown('platform', {
label: 'Website Platform',
options: [
{ id: 'wordpress', name: 'WordPress' },
{ id: 'shopify', name: 'Shopify' },
{ id: 'wix', name: 'Wix / Squarespace' },
{ id: 'custom', name: 'Custom / Framework' },
{ id: 'spa', name: 'Single Page App (React, Vue, etc.)' },
{ id: 'other', name: 'Other CMS' }
],
defaultValue: 'wordpress',
isRequired: true
}, '1fr');
});
websiteSection.addRow(row => {
row.addDropdown('trafficVolume', {
label: 'Monthly Traffic',
options: [
{ id: 'small', name: 'Under 50,000 visitors' },
{ id: 'medium', name: '50,000 - 500,000 visitors' },
{ id: 'large', name: '500,000 - 5 million visitors' },
{ id: 'very-large', name: 'Over 5 million visitors' }
],
defaultValue: 'medium',
isRequired: true
}, '1fr');
row.addInteger('domainCount', {
label: 'Number of Domains/Subdomains',
min: 1,
max: 100,
defaultValue: 1
}, '1fr');
});
// Compliance Requirements Section
const complianceSection = form.addSubform('compliance', { title: '📜 Compliance Requirements' });
complianceSection.addRow(row => {
row.addCheckbox('gdpr', {
label: 'GDPR (European Union)',
defaultValue: true
}, '1fr');
row.addCheckbox('ccpa', {
label: 'CCPA/CPRA (California)',
defaultValue: true
}, '1fr');
});
complianceSection.addRow(row => {
row.addCheckbox('lgpd', {
label: 'LGPD (Brazil)',
defaultValue: false
}, '1fr');
row.addCheckbox('otherRegulations', {
label: 'Other regional regulations',
defaultValue: false
}, '1fr');
});
complianceSection.addRow(row => {
row.addCheckbox('tcfCompliance', {
label: 'IAB TCF 2.2 compliance (for ads)',
defaultValue: false
}, '1fr');
row.addCheckbox('gppCompliance', {
label: 'GPP (Global Privacy Platform)',
defaultValue: false
}, '1fr');
});
// CMP Selection Section
const cmpSection = form.addSubform('cmpSelection', { title: '🔧 Consent Management Platform' });
cmpSection.addRow(row => {
row.addDropdown('cmpType', {
label: 'CMP Solution',
options: [
{ id: 'free', name: 'Free/Basic CMP (Cookiebot Free, etc.)' },
{ id: 'basic', name: 'Basic Paid CMP (~$15/mo)' },
{ id: 'professional', name: 'Professional CMP (~$50/mo)' },
{ id: 'enterprise', name: 'Enterprise CMP (~$200+/mo)' },
{ id: 'custom', name: 'Custom-built solution' }
],
defaultValue: 'basic',
isRequired: true
}, '1fr');
});
cmpSection.addRow(row => {
row.addCheckbox('customBanner', {
label: 'Custom banner design (match branding)',
defaultValue: true
}, '1fr');
row.addCheckbox('multiLanguage', {
label: 'Multi-language support',
defaultValue: false
}, '1fr');
});
cmpSection.addRow(row => {
row.addInteger('languageCount', {
label: 'Number of Languages',
min: 2,
max: 50,
defaultValue: 3,
isVisible: () => cmpSection.checkbox('multiLanguage')?.value() === true
}, '1fr');
});
// Implementation Services Section
const servicesSection = form.addSubform('services', { title: '⚙️ Implementation Services' });
servicesSection.addRow(row => {
row.addCheckbox('cookieAudit', {
label: 'Cookie audit & categorization',
defaultValue: true
}, '1fr');
row.addCheckbox('scriptBlocking', {
label: 'Script blocking implementation',
defaultValue: true
}, '1fr');
});
servicesSection.addRow(row => {
row.addCheckbox('gtmIntegration', {
label: 'Google Tag Manager integration',
defaultValue: false
}, '1fr');
row.addCheckbox('analyticsSetup', {
label: 'Consent-aware analytics setup',
defaultValue: false
}, '1fr');
});
servicesSection.addRow(row => {
row.addCheckbox('policyPage', {
label: 'Cookie policy page creation',
defaultValue: true
}, '1fr');
row.addCheckbox('preferencesCenter', {
label: 'Advanced preferences center',
defaultValue: false
}, '1fr');
});
servicesSection.addRow(row => {
row.addCheckbox('testing', {
label: 'Cross-browser testing & QA',
defaultValue: true
}, '1fr');
row.addCheckbox('documentation', {
label: 'Implementation documentation',
defaultValue: false
}, '1fr');
});
// Ongoing Services Section
const ongoingSection = form.addSubform('ongoing', { title: '🔄 Ongoing Management' });
ongoingSection.addRow(row => {
row.addCheckbox('monthlyAudit', {
label: 'Monthly cookie audit',
defaultValue: false
}, '1fr');
row.addCheckbox('quarterlyReview', {
label: 'Quarterly compliance review',
defaultValue: false
}, '1fr');
});
ongoingSection.addRow(row => {
row.addCheckbox('supportRetainer', {
label: 'Support retainer (updates & issues)',
defaultValue: false
}, '1fr');
row.addCheckbox('regulatoryUpdates', {
label: 'Regulatory change monitoring',
defaultValue: false
}, '1fr');
});
form.addSpacer({ height: 20, showLine: true, lineStyle: 'dashed' });
// Cost Summary Section
const summarySection = form.addSubform('summary', { title: '📊 Cost Breakdown', isCollapsible: false });
summarySection.addRow(row => {
row.addPriceDisplay('setupCost', {
label: 'Initial Setup & Implementation',
computedValue: () => {
const complexity = websiteSection.dropdown('websiteType')?.value() || 'standard';
const platform = websiteSection.dropdown('platform')?.value() || 'wordpress';
const domainCount = websiteSection.integer('domainCount')?.value() || 1;
const cmpType = cmpSection.dropdown('cmpType')?.value() || 'basic';
// Base implementation cost
let baseCost = 800;
baseCost *= complexityMultipliers[complexity] || 1;
// Platform adjustments
if (platform === 'spa' || platform === 'custom') baseCost *= 1.5;
// CMP setup costs
baseCost += cmpPricing[cmpType]?.setup || 300;
// Multi-domain
if (domainCount > 1) baseCost += (domainCount - 1) * 200;
// Compliance additions
let regulationCount = 0;
if (complianceSection.checkbox('gdpr')?.value()) regulationCount++;
if (complianceSection.checkbox('ccpa')?.value()) regulationCount++;
if (complianceSection.checkbox('lgpd')?.value()) regulationCount++;
if (complianceSection.checkbox('otherRegulations')?.value()) regulationCount++;
if (regulationCount > 2) baseCost += (regulationCount - 2) * 300;
if (complianceSection.checkbox('tcfCompliance')?.value()) baseCost += 500;
if (complianceSection.checkbox('gppCompliance')?.value()) baseCost += 400;
// CMP customization
if (cmpSection.checkbox('customBanner')?.value()) baseCost += 400;
if (cmpSection.checkbox('multiLanguage')?.value()) {
const langCount = cmpSection.integer('languageCount')?.value() || 3;
baseCost += langCount * 100;
}
// Services
if (servicesSection.checkbox('cookieAudit')?.value()) baseCost += 300;
if (servicesSection.checkbox('scriptBlocking')?.value()) baseCost += 400;
if (servicesSection.checkbox('gtmIntegration')?.value()) baseCost += 350;
if (servicesSection.checkbox('analyticsSetup')?.value()) baseCost += 300;
if (servicesSection.checkbox('policyPage')?.value()) baseCost += 200;
if (servicesSection.checkbox('preferencesCenter')?.value()) baseCost += 500;
if (servicesSection.checkbox('testing')?.value()) baseCost += 250;
if (servicesSection.checkbox('documentation')?.value()) baseCost += 200;
return Math.round(baseCost);
},
variant: 'default'
}, '1fr');
row.addPriceDisplay('cmpCost', {
label: 'CMP Subscription',
computedValue: () => {
const cmpType = cmpSection.dropdown('cmpType')?.value() || 'basic';
const traffic = websiteSection.dropdown('trafficVolume')?.value() || 'medium';
const domainCount = websiteSection.integer('domainCount')?.value() || 1;
let monthlyCost = cmpPricing[cmpType]?.monthly || 15;
monthlyCost += trafficPricing[traffic] || 0;
// Multi-domain typically requires higher tier
if (domainCount > 1 && cmpType !== 'enterprise' && cmpType !== 'custom') {
monthlyCost += (domainCount - 1) * 10;
}
return monthlyCost;
},
variant: 'default',
suffix: '/month'
}, '1fr');
});
summarySection.addRow(row => {
row.addPriceDisplay('ongoingServices', {
label: 'Ongoing Management Services',
computedValue: () => {
let monthlyCost = 0;
if (ongoingSection.checkbox('monthlyAudit')?.value()) monthlyCost += 150;
if (ongoingSection.checkbox('quarterlyReview')?.value()) monthlyCost += 75; // ~$300/quarter
if (ongoingSection.checkbox('supportRetainer')?.value()) monthlyCost += 200;
if (ongoingSection.checkbox('regulatoryUpdates')?.value()) monthlyCost += 100;
return monthlyCost;
},
variant: 'default',
suffix: '/month'
}, '1fr');
});
const finalSection = form.addSubform('final', {
title: '💰 Total Cost Estimate',
isCollapsible: false,
sticky: 'bottom'
});
finalSection.addRow(row => {
row.addPriceDisplay('firstYearCost', {
label: 'First Year Total',
computedValue: () => {
const complexity = websiteSection.dropdown('websiteType')?.value() || 'standard';
const platform = websiteSection.dropdown('platform')?.value() || 'wordpress';
const domainCount = websiteSection.integer('domainCount')?.value() || 1;
const cmpType = cmpSection.dropdown('cmpType')?.value() || 'basic';
const traffic = websiteSection.dropdown('trafficVolume')?.value() || 'medium';
// Setup cost calculation
let setupCost = 800;
setupCost *= complexityMultipliers[complexity] || 1;
if (platform === 'spa' || platform === 'custom') setupCost *= 1.5;
setupCost += cmpPricing[cmpType]?.setup || 300;
if (domainCount > 1) setupCost += (domainCount - 1) * 200;
let regulationCount = 0;
if (complianceSection.checkbox('gdpr')?.value()) regulationCount++;
if (complianceSection.checkbox('ccpa')?.value()) regulationCount++;
if (complianceSection.checkbox('lgpd')?.value()) regulationCount++;
if (complianceSection.checkbox('otherRegulations')?.value()) regulationCount++;
if (regulationCount > 2) setupCost += (regulationCount - 2) * 300;
if (complianceSection.checkbox('tcfCompliance')?.value()) setupCost += 500;
if (complianceSection.checkbox('gppCompliance')?.value()) setupCost += 400;
if (cmpSection.checkbox('customBanner')?.value()) setupCost += 400;
if (cmpSection.checkbox('multiLanguage')?.value()) {
setupCost += (cmpSection.integer('languageCount')?.value() || 3) * 100;
}
if (servicesSection.checkbox('cookieAudit')?.value()) setupCost += 300;
if (servicesSection.checkbox('scriptBlocking')?.value()) setupCost += 400;
if (servicesSection.checkbox('gtmIntegration')?.value()) setupCost += 350;
if (servicesSection.checkbox('analyticsSetup')?.value()) setupCost += 300;
if (servicesSection.checkbox('policyPage')?.value()) setupCost += 200;
if (servicesSection.checkbox('preferencesCenter')?.value()) setupCost += 500;
if (servicesSection.checkbox('testing')?.value()) setupCost += 250;
if (servicesSection.checkbox('documentation')?.value()) setupCost += 200;
// Monthly CMP cost
let monthlyCmp = cmpPricing[cmpType]?.monthly || 15;
monthlyCmp += trafficPricing[traffic] || 0;
if (domainCount > 1 && cmpType !== 'enterprise' && cmpType !== 'custom') {
monthlyCmp += (domainCount - 1) * 10;
}
// Monthly services
let monthlyServices = 0;
if (ongoingSection.checkbox('monthlyAudit')?.value()) monthlyServices += 150;
if (ongoingSection.checkbox('quarterlyReview')?.value()) monthlyServices += 75;
if (ongoingSection.checkbox('supportRetainer')?.value()) monthlyServices += 200;
if (ongoingSection.checkbox('regulatoryUpdates')?.value()) monthlyServices += 100;
return Math.round(setupCost + (monthlyCmp * 12) + (monthlyServices * 12));
},
variant: 'large'
}, '1fr');
row.addPriceDisplay('ongoingAnnual', {
label: 'Ongoing Annual Cost',
computedValue: () => {
const cmpType = cmpSection.dropdown('cmpType')?.value() || 'basic';
const traffic = websiteSection.dropdown('trafficVolume')?.value() || 'medium';
const domainCount = websiteSection.integer('domainCount')?.value() || 1;
// Monthly CMP
let monthlyCmp = cmpPricing[cmpType]?.monthly || 15;
monthlyCmp += trafficPricing[traffic] || 0;
if (domainCount > 1 && cmpType !== 'enterprise' && cmpType !== 'custom') {
monthlyCmp += (domainCount - 1) * 10;
}
// Monthly services
let monthlyServices = 0;
if (ongoingSection.checkbox('monthlyAudit')?.value()) monthlyServices += 150;
if (ongoingSection.checkbox('quarterlyReview')?.value()) monthlyServices += 75;
if (ongoingSection.checkbox('supportRetainer')?.value()) monthlyServices += 200;
if (ongoingSection.checkbox('regulatoryUpdates')?.value()) monthlyServices += 100;
return Math.round((monthlyCmp * 12) + (monthlyServices * 12));
},
variant: 'large',
suffix: '/year'
}, '1fr');
});
finalSection.addRow(row => {
row.addTextPanel('disclaimer', {
computedValue: () => 'This calculator provides estimates only. Actual costs depend on specific website requirements, chosen CMP vendor, and implementation complexity. Consult with a privacy professional for accurate project scoping.',
customStyles: { 'font-size': '0.8rem', 'color': '#64748b', 'font-style': 'italic' }
});
});
form.configureSubmitButton({
label: 'Get Implementation Quote'
});
}