export function gdprComplianceCalculator(form: FormTs) {
// Base prices for different services
const documentPrices: Record<string, number> = {
'privacy-policy': 500,
'cookie-policy': 300,
'dpa': 600,
'ria': 800,
'dpia': 1200,
'ropa': 700,
'data-breach-procedure': 500,
'retention-policy': 400,
'consent-forms': 350,
'employee-privacy-notice': 400
};
// Company size multipliers
const sizeMultipliers: Record<string, number> = {
'micro': 0.7,
'small': 1.0,
'medium': 1.5,
'large': 2.5,
'enterprise': 4.0
};
// Industry complexity multipliers
const industryMultipliers: Record<string, number> = {
'general': 1.0,
'ecommerce': 1.2,
'healthcare': 1.8,
'finance': 1.7,
'education': 1.3,
'hr-recruitment': 1.4,
'marketing': 1.3,
'technology': 1.4,
'government': 1.6
};
// DPO monthly rates by engagement type
const dpoRates: Record<string, number> = {
'none': 0,
'consulting': 500,
'part-time': 1500,
'full-time': 4000,
'outsourced': 800
};
form.addRow(row => {
row.addTextPanel('header', {
computedValue: () => 'GDPR Compliance Cost Calculator',
customStyles: { 'font-size': '1.5rem', 'font-weight': '600', 'color': '#1e293b' }
});
});
form.addSpacer({ height: 20 });
// Company Profile Section
const companySection = form.addSubform('companyProfile', { title: '๐ข Company Profile' });
companySection.addRow(row => {
row.addDropdown('companySize', {
label: 'Company Size',
options: [
{ id: 'micro', name: 'Micro (1-9 employees)' },
{ id: 'small', name: 'Small (10-49 employees)' },
{ id: 'medium', name: 'Medium (50-249 employees)' },
{ id: 'large', name: 'Large (250-999 employees)' },
{ id: 'enterprise', name: 'Enterprise (1000+ employees)' }
],
defaultValue: 'small',
isRequired: true
}, '1fr');
row.addDropdown('industry', {
label: 'Industry',
options: [
{ id: 'general', name: 'General Business' },
{ id: 'ecommerce', name: 'E-commerce / Retail' },
{ id: 'healthcare', name: 'Healthcare / Medical' },
{ id: 'finance', name: 'Finance / Insurance' },
{ id: 'education', name: 'Education' },
{ id: 'hr-recruitment', name: 'HR / Recruitment' },
{ id: 'marketing', name: 'Marketing / Advertising' },
{ id: 'technology', name: 'Technology / SaaS' },
{ id: 'government', name: 'Government / Public Sector' }
],
defaultValue: 'general',
isRequired: true
}, '1fr');
});
companySection.addRow(row => {
row.addDropdown('dataVolume', {
label: 'Personal Data Processing Volume',
options: [
{ id: 'low', name: 'Low (< 1,000 records)' },
{ id: 'medium', name: 'Medium (1,000 - 10,000 records)' },
{ id: 'high', name: 'High (10,000 - 100,000 records)' },
{ id: 'very-high', name: 'Very High (100,000+ records)' }
],
defaultValue: 'medium',
isRequired: true
}, '1fr');
row.addDropdown('currentStatus', {
label: 'Current Compliance Status',
options: [
{ id: 'none', name: 'No existing compliance' },
{ id: 'partial', name: 'Partial compliance' },
{ id: 'review', name: 'Needs review/update' }
],
defaultValue: 'none',
isRequired: true
}, '1fr');
});
// Documentation Section
const docsSection = form.addSubform('documentation', { title: '๐ Required Documentation' });
docsSection.addRow(row => {
row.addCheckbox('privacyPolicy', {
label: 'Privacy Policy',
defaultValue: true
}, '1fr');
row.addCheckbox('cookiePolicy', {
label: 'Cookie Policy',
defaultValue: true
}, '1fr');
});
docsSection.addRow(row => {
row.addCheckbox('dpa', {
label: 'Data Processing Agreements (DPA)',
defaultValue: true
}, '1fr');
row.addCheckbox('ropa', {
label: 'Records of Processing Activities (ROPA)',
defaultValue: true
}, '1fr');
});
docsSection.addRow(row => {
row.addCheckbox('ria', {
label: 'Risk Impact Assessment',
defaultValue: false
}, '1fr');
row.addCheckbox('dpia', {
label: 'Data Protection Impact Assessment (DPIA)',
defaultValue: false
}, '1fr');
});
docsSection.addRow(row => {
row.addCheckbox('breachProcedure', {
label: 'Data Breach Procedure',
defaultValue: true
}, '1fr');
row.addCheckbox('retentionPolicy', {
label: 'Data Retention Policy',
defaultValue: true
}, '1fr');
});
docsSection.addRow(row => {
row.addCheckbox('consentForms', {
label: 'Consent Forms & Mechanisms',
defaultValue: false
}, '1fr');
row.addCheckbox('employeeNotice', {
label: 'Employee Privacy Notice',
defaultValue: false
}, '1fr');
});
// DPO Services Section
const dpoSection = form.addSubform('dpoServices', { title: '๐ค Data Protection Officer (DPO)' });
dpoSection.addRow(row => {
row.addDropdown('dpoType', {
label: 'DPO Services',
options: [
{ id: 'none', name: 'No DPO services needed' },
{ id: 'consulting', name: 'DPO Consulting (as needed)' },
{ id: 'outsourced', name: 'Outsourced DPO (monthly)' },
{ id: 'part-time', name: 'Part-time DPO (monthly)' },
{ id: 'full-time', name: 'Full-time DPO (monthly)' }
],
defaultValue: 'none',
isRequired: true
}, '1fr');
row.addInteger('dpoMonths', {
label: 'Contract Duration (months)',
min: 1,
max: 36,
defaultValue: 12,
isVisible: () => {
const dpoType = dpoSection.dropdown('dpoType')?.value();
return dpoType !== 'none' && dpoType !== 'consulting';
}
}, '1fr');
});
// Training Section
const trainingSection = form.addSubform('training', { title: '๐ Training & Awareness' });
trainingSection.addRow(row => {
row.addCheckbox('staffTraining', {
label: 'Staff GDPR Training',
defaultValue: true
}, '1fr');
row.addInteger('trainingParticipants', {
label: 'Number of Participants',
min: 1,
max: 500,
defaultValue: 10,
isVisible: () => trainingSection.checkbox('staffTraining')?.value() === true
}, '1fr');
});
trainingSection.addRow(row => {
row.addCheckbox('managementTraining', {
label: 'Management/Leadership Training',
defaultValue: false
}, '1fr');
row.addCheckbox('specialistTraining', {
label: 'Specialist Training (IT/HR/Marketing)',
defaultValue: false
}, '1fr');
});
// Additional Services Section
const addonsSection = form.addSubform('additionalServices', { title: 'โจ Additional Services' });
addonsSection.addRow(row => {
row.addCheckbox('gapAnalysis', {
label: 'Initial Gap Analysis & Assessment',
defaultValue: true
}, '1fr');
row.addCheckbox('vendorAudit', {
label: 'Vendor/Third-party Audit',
defaultValue: false
}, '1fr');
});
addonsSection.addRow(row => {
row.addCheckbox('cookieImplementation', {
label: 'Cookie Consent Implementation',
defaultValue: false
}, '1fr');
row.addCheckbox('dsarProcess', {
label: 'DSAR Process Setup',
defaultValue: false
}, '1fr');
});
addonsSection.addRow(row => {
row.addCheckbox('ongoingSupport', {
label: 'Ongoing Compliance Support (12 months)',
defaultValue: false
}, '1fr');
row.addCheckbox('annualReview', {
label: 'Annual Compliance Review',
defaultValue: false
}, '1fr');
});
form.addSpacer({ height: 20, showLine: true, lineStyle: 'dashed' });
// Summary Section
const summarySection = form.addSubform('summary', { title: '๐ฐ Cost Estimate', isCollapsible: false });
summarySection.addRow(row => {
row.addPriceDisplay('documentationCost', {
label: 'Documentation',
computedValue: () => {
const size = companySection.dropdown('companySize')?.value() || 'small';
const industry = companySection.dropdown('industry')?.value() || 'general';
const sizeMult = sizeMultipliers?.[size] ?? 1.0;
const industryMult = industryMultipliers?.[industry] ?? 1.0;
let total = 0;
if (docsSection.checkbox('privacyPolicy')?.value()) total += documentPrices['privacy-policy'] ?? 0;
if (docsSection.checkbox('cookiePolicy')?.value()) total += documentPrices['cookie-policy'] ?? 0;
if (docsSection.checkbox('dpa')?.value()) total += documentPrices['dpa'] ?? 0;
if (docsSection.checkbox('ropa')?.value()) total += documentPrices['ropa'] ?? 0;
if (docsSection.checkbox('ria')?.value()) total += documentPrices['ria'] ?? 0;
if (docsSection.checkbox('dpia')?.value()) total += documentPrices['dpia'] ?? 0;
if (docsSection.checkbox('breachProcedure')?.value()) total += documentPrices['data-breach-procedure'] ?? 0;
if (docsSection.checkbox('retentionPolicy')?.value()) total += documentPrices['retention-policy'] ?? 0;
if (docsSection.checkbox('consentForms')?.value()) total += documentPrices['consent-forms'] ?? 0;
if (docsSection.checkbox('employeeNotice')?.value()) total += documentPrices['employee-privacy-notice'] ?? 0;
return Math.round(total * sizeMult * industryMult);
},
variant: 'default'
}, '1fr');
row.addPriceDisplay('dpoCost', {
label: 'DPO Services',
computedValue: () => {
const dpoType = dpoSection.dropdown('dpoType')?.value() || 'none';
const months = dpoSection.integer('dpoMonths')?.value() || 12;
const rate = dpoRates?.[dpoType] ?? 0;
if (dpoType === 'consulting') {
return rate; // One-time consulting fee
}
return rate * months;
},
variant: 'default'
}, '1fr');
});
summarySection.addRow(row => {
row.addPriceDisplay('trainingCost', {
label: 'Training',
computedValue: () => {
let total = 0;
const participants = trainingSection.integer('trainingParticipants')?.value() || 10;
if (trainingSection.checkbox('staffTraining')?.value()) {
total += Math.min(participants * 50, 2000); // $50/person, max $2000
}
if (trainingSection.checkbox('managementTraining')?.value()) {
total += 800;
}
if (trainingSection.checkbox('specialistTraining')?.value()) {
total += 1200;
}
return total;
},
variant: 'default'
}, '1fr');
row.addPriceDisplay('addonsCost', {
label: 'Additional Services',
computedValue: () => {
const size = companySection.dropdown('companySize')?.value() || 'small';
const sizeMult = sizeMultipliers?.[size] ?? 1.0;
let total = 0;
if (addonsSection.checkbox('gapAnalysis')?.value()) total += 1500;
if (addonsSection.checkbox('vendorAudit')?.value()) total += 2000;
if (addonsSection.checkbox('cookieImplementation')?.value()) total += 800;
if (addonsSection.checkbox('dsarProcess')?.value()) total += 1200;
if (addonsSection.checkbox('ongoingSupport')?.value()) total += 3600;
if (addonsSection.checkbox('annualReview')?.value()) total += 1000;
return Math.round(total * sizeMult);
},
variant: 'default'
}, '1fr');
});
const finalSection = form.addSubform('final', {
title: '๐งพ Total Investment',
isCollapsible: false,
sticky: 'bottom'
});
finalSection.addRow(row => {
row.addPriceDisplay('totalCost', {
label: 'Total Compliance Cost',
computedValue: () => {
const size = companySection.dropdown('companySize')?.value() || 'small';
const industry = companySection.dropdown('industry')?.value() || 'general';
const sizeMult = sizeMultipliers?.[size] ?? 1.0;
const industryMult = industryMultipliers?.[industry] ?? 1.0;
// Documentation
let docTotal = 0;
if (docsSection.checkbox('privacyPolicy')?.value()) docTotal += documentPrices['privacy-policy'] ?? 0;
if (docsSection.checkbox('cookiePolicy')?.value()) docTotal += documentPrices['cookie-policy'] ?? 0;
if (docsSection.checkbox('dpa')?.value()) docTotal += documentPrices['dpa'] ?? 0;
if (docsSection.checkbox('ropa')?.value()) docTotal += documentPrices['ropa'] ?? 0;
if (docsSection.checkbox('ria')?.value()) docTotal += documentPrices['ria'] ?? 0;
if (docsSection.checkbox('dpia')?.value()) docTotal += documentPrices['dpia'] ?? 0;
if (docsSection.checkbox('breachProcedure')?.value()) docTotal += documentPrices['data-breach-procedure'] ?? 0;
if (docsSection.checkbox('retentionPolicy')?.value()) docTotal += documentPrices['retention-policy'] ?? 0;
if (docsSection.checkbox('consentForms')?.value()) docTotal += documentPrices['consent-forms'] ?? 0;
if (docsSection.checkbox('employeeNotice')?.value()) docTotal += documentPrices['employee-privacy-notice'] ?? 0;
docTotal = Math.round(docTotal * sizeMult * industryMult);
// DPO
const dpoType = dpoSection.dropdown('dpoType')?.value() || 'none';
const months = dpoSection.integer('dpoMonths')?.value() || 12;
const rate = dpoRates?.[dpoType] ?? 0;
const dpoCost = dpoType === 'consulting' ? rate : rate * months;
// Training
let trainingTotal = 0;
const participants = trainingSection.integer('trainingParticipants')?.value() || 10;
if (trainingSection.checkbox('staffTraining')?.value()) {
trainingTotal += Math.min(participants * 50, 2000);
}
if (trainingSection.checkbox('managementTraining')?.value()) {
trainingTotal += 800;
}
if (trainingSection.checkbox('specialistTraining')?.value()) {
trainingTotal += 1200;
}
// Addons
let addonsTotal = 0;
if (addonsSection.checkbox('gapAnalysis')?.value()) addonsTotal += 1500;
if (addonsSection.checkbox('vendorAudit')?.value()) addonsTotal += 2000;
if (addonsSection.checkbox('cookieImplementation')?.value()) addonsTotal += 800;
if (addonsSection.checkbox('dsarProcess')?.value()) addonsTotal += 1200;
if (addonsSection.checkbox('ongoingSupport')?.value()) addonsTotal += 3600;
if (addonsSection.checkbox('annualReview')?.value()) addonsTotal += 1000;
addonsTotal = Math.round(addonsTotal * sizeMult);
return docTotal + dpoCost + trainingTotal + addonsTotal;
},
variant: 'large'
});
});
finalSection.addRow(row => {
row.addTextPanel('disclaimer', {
computedValue: () => 'This estimate is for planning purposes only. Actual costs may vary based on specific requirements, complexity, and scope of work. A detailed assessment is recommended before engagement.',
customStyles: { 'font-size': '0.8rem', 'color': '#64748b', 'font-style': 'italic' }
});
});
form.configureSubmitButton({
label: 'Request Consultation'
});
}