export function privacyPolicyCalculator(form: FormTs) {
// Base prices by platform type
const platformPrices: Record<string, number> = {
'website': 350,
'mobile-app': 500,
'saas': 650,
'ecommerce': 550,
'multi-platform': 800
};
// Compliance framework prices
const compliancePrices: Record<string, number> = {
'basic': 0,
'gdpr': 300,
'ccpa': 250,
'gdpr-ccpa': 450,
'international': 600
};
// Data type additional costs
const dataTypePrices: Record<string, number> = {
'basic-contact': 0,
'financial': 150,
'health': 250,
'biometric': 300,
'location': 100,
'children': 350,
'sensitive': 200
};
// Third-party integration costs
const integrationPrices: Record<string, number> = {
'analytics': 50,
'advertising': 100,
'social-media': 75,
'payment': 100,
'crm': 50,
'email-marketing': 50,
'cloud-storage': 50,
'ai-ml': 150
};
form.addRow(row => {
row.addTextPanel('header', {
computedValue: () => 'Privacy Policy Cost Calculator',
customStyles: { 'font-size': '1.5rem', 'font-weight': '600', 'color': '#1e293b' }
});
});
form.addSpacer({ height: 20 });
// Platform Section
const platformSection = form.addSubform('platform', { title: '๐ Platform & Compliance' });
platformSection.addRow(row => {
row.addDropdown('platformType', {
label: 'Platform Type',
options: [
{ id: 'website', name: 'Website Only' },
{ id: 'mobile-app', name: 'Mobile App' },
{ id: 'saas', name: 'SaaS / Web Application' },
{ id: 'ecommerce', name: 'E-commerce Store' },
{ id: 'multi-platform', name: 'Multi-Platform (Web + Mobile)' }
],
defaultValue: 'website',
isRequired: true
}, '1fr');
row.addDropdown('compliance', {
label: 'Compliance Requirements',
options: [
{ id: 'basic', name: 'Basic (General best practices)' },
{ id: 'gdpr', name: 'GDPR Compliant (EU)' },
{ id: 'ccpa', name: 'CCPA/CPRA Compliant (California)' },
{ id: 'gdpr-ccpa', name: 'GDPR + CCPA Combined' },
{ id: 'international', name: 'International (Multi-jurisdiction)' }
],
defaultValue: 'basic',
isRequired: true
}, '1fr');
});
platformSection.addRow(row => {
row.addDropdown('businessType', {
label: 'Business Type',
options: [
{ id: 'b2c', name: 'B2C (Consumer-facing)' },
{ id: 'b2b', name: 'B2B (Business-facing)' },
{ id: 'b2b2c', name: 'B2B2C (Both)' },
{ id: 'marketplace', name: 'Marketplace / Platform' }
],
defaultValue: 'b2c',
isRequired: true
}, '1fr');
row.addDropdown('dataVolume', {
label: 'User Data Volume',
options: [
{ id: 'small', name: 'Small (< 10,000 users)' },
{ id: 'medium', name: 'Medium (10,000 - 100,000 users)' },
{ id: 'large', name: 'Large (100,000 - 1M users)' },
{ id: 'enterprise', name: 'Enterprise (1M+ users)' }
],
defaultValue: 'small',
isRequired: true
}, '1fr');
});
// Data Collection Section
const dataSection = form.addSubform('dataCollection', { title: '๐ Data Collection Types' });
dataSection.addRow(row => {
row.addCheckbox('basicContact', {
label: 'Basic Contact Info (name, email, phone)',
defaultValue: true
}, '1fr');
row.addCheckbox('financial', {
label: 'Financial Data (payment, billing)',
defaultValue: false
}, '1fr');
});
dataSection.addRow(row => {
row.addCheckbox('health', {
label: 'Health / Medical Information',
defaultValue: false
}, '1fr');
row.addCheckbox('biometric', {
label: 'Biometric Data (fingerprint, face ID)',
defaultValue: false
}, '1fr');
});
dataSection.addRow(row => {
row.addCheckbox('location', {
label: 'Location / Geolocation Data',
defaultValue: false
}, '1fr');
row.addCheckbox('children', {
label: 'Children\'s Data (under 13/16)',
defaultValue: false
}, '1fr');
});
dataSection.addRow(row => {
row.addCheckbox('sensitive', {
label: 'Other Sensitive Data (race, religion, political)',
defaultValue: false
}, '1fr');
});
// Third-Party Integrations Section
const integrationsSection = form.addSubform('integrations', { title: '๐ Third-Party Integrations' });
integrationsSection.addRow(row => {
row.addCheckbox('analytics', {
label: 'Analytics (Google Analytics, etc.)',
defaultValue: true
}, '1fr');
row.addCheckbox('advertising', {
label: 'Advertising / Remarketing',
defaultValue: false
}, '1fr');
});
integrationsSection.addRow(row => {
row.addCheckbox('socialMedia', {
label: 'Social Media Plugins',
defaultValue: false
}, '1fr');
row.addCheckbox('payment', {
label: 'Payment Processors',
defaultValue: false
}, '1fr');
});
integrationsSection.addRow(row => {
row.addCheckbox('crm', {
label: 'CRM Systems',
defaultValue: false
}, '1fr');
row.addCheckbox('emailMarketing', {
label: 'Email Marketing Tools',
defaultValue: false
}, '1fr');
});
integrationsSection.addRow(row => {
row.addCheckbox('cloudStorage', {
label: 'Cloud Storage Providers',
defaultValue: false
}, '1fr');
row.addCheckbox('aiMl', {
label: 'AI / Machine Learning Services',
defaultValue: false
}, '1fr');
});
// Additional Services Section
const servicesSection = form.addSubform('services', { title: 'โจ Additional Services' });
servicesSection.addRow(row => {
row.addCheckbox('legalReview', {
label: 'Attorney Review & Consultation',
defaultValue: true
}, '1fr');
row.addCheckbox('cookiePolicy', {
label: 'Cookie Policy (Separate document)',
defaultValue: false
}, '1fr');
});
servicesSection.addRow(row => {
row.addDropdown('revisions', {
label: 'Revision Rounds',
options: [
{ id: '1', name: '1 Round (Included)' },
{ id: '2', name: '2 Rounds (+$100)' },
{ id: '3', name: '3 Rounds (+$200)' },
{ id: 'unlimited', name: 'Unlimited (+$350)' }
],
defaultValue: '1'
}, '1fr');
row.addDropdown('turnaround', {
label: 'Turnaround Time',
options: [
{ id: 'standard', name: 'Standard (5-7 days)' },
{ id: 'expedited', name: 'Expedited (3 days) (+25%)' },
{ id: 'rush', name: 'Rush (24-48 hrs) (+50%)' }
],
defaultValue: 'standard'
}, '1fr');
});
servicesSection.addRow(row => {
row.addCheckbox('annualUpdate', {
label: 'Annual Update Service (+$250/year)',
defaultValue: false
}, '1fr');
row.addCheckbox('multiLanguage', {
label: 'Multi-Language Version (+$200/language)',
defaultValue: false
}, '1fr');
});
servicesSection.addRow(row => {
row.addInteger('languages', {
label: 'Number of Additional Languages',
min: 1,
max: 10,
defaultValue: 1,
isVisible: () => servicesSection.checkbox('multiLanguage')?.value() === true
}, '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('baseCost', {
label: 'Base Policy Cost',
computedValue: () => {
const platform = platformSection.dropdown('platformType')?.value() || 'website';
const compliance = platformSection.dropdown('compliance')?.value() || 'basic';
const platformPrice = platformPrices?.[platform] ?? 350;
const compliancePrice = compliancePrices?.[compliance] ?? 0;
return platformPrice + compliancePrice;
},
variant: 'default'
}, '1fr');
row.addPriceDisplay('dataCost', {
label: 'Data Type Coverage',
computedValue: () => {
let total = 0;
if (dataSection.checkbox('financial')?.value()) total += dataTypePrices['financial'] ?? 0;
if (dataSection.checkbox('health')?.value()) total += dataTypePrices['health'] ?? 0;
if (dataSection.checkbox('biometric')?.value()) total += dataTypePrices['biometric'] ?? 0;
if (dataSection.checkbox('location')?.value()) total += dataTypePrices['location'] ?? 0;
if (dataSection.checkbox('children')?.value()) total += dataTypePrices['children'] ?? 0;
if (dataSection.checkbox('sensitive')?.value()) total += dataTypePrices['sensitive'] ?? 0;
return total;
},
variant: 'default',
prefix: '+'
}, '1fr');
});
summarySection.addRow(row => {
row.addPriceDisplay('integrationsCost', {
label: 'Third-Party Disclosures',
computedValue: () => {
let total = 0;
if (integrationsSection.checkbox('analytics')?.value()) total += integrationPrices['analytics'] ?? 0;
if (integrationsSection.checkbox('advertising')?.value()) total += integrationPrices['advertising'] ?? 0;
if (integrationsSection.checkbox('socialMedia')?.value()) total += integrationPrices['social-media'] ?? 0;
if (integrationsSection.checkbox('payment')?.value()) total += integrationPrices['payment'] ?? 0;
if (integrationsSection.checkbox('crm')?.value()) total += integrationPrices['crm'] ?? 0;
if (integrationsSection.checkbox('emailMarketing')?.value()) total += integrationPrices['email-marketing'] ?? 0;
if (integrationsSection.checkbox('cloudStorage')?.value()) total += integrationPrices['cloud-storage'] ?? 0;
if (integrationsSection.checkbox('aiMl')?.value()) total += integrationPrices['ai-ml'] ?? 0;
return total;
},
variant: 'default',
prefix: '+'
}, '1fr');
row.addPriceDisplay('servicesCost', {
label: 'Additional Services',
computedValue: () => {
let total = 0;
if (servicesSection.checkbox('legalReview')?.value()) total += 250;
if (servicesSection.checkbox('cookiePolicy')?.value()) total += 200;
const revisions = servicesSection.dropdown('revisions')?.value() || '1';
if (revisions === '2') total += 100;
else if (revisions === '3') total += 200;
else if (revisions === 'unlimited') total += 350;
if (servicesSection.checkbox('annualUpdate')?.value()) total += 250;
if (servicesSection.checkbox('multiLanguage')?.value()) {
const langs = servicesSection.integer('languages')?.value() || 1;
total += 200 * langs;
}
return total;
},
variant: 'default',
prefix: '+'
}, '1fr');
});
const finalSection = form.addSubform('final', {
title: '๐งพ Total Cost',
isCollapsible: false,
sticky: 'bottom'
});
finalSection.addRow(row => {
row.addPriceDisplay('totalCost', {
label: 'Total Investment',
computedValue: () => {
const platform = platformSection.dropdown('platformType')?.value() || 'website';
const compliance = platformSection.dropdown('compliance')?.value() || 'basic';
const turnaround = servicesSection.dropdown('turnaround')?.value() || 'standard';
// Base cost
const platformPrice = platformPrices?.[platform] ?? 350;
const compliancePrice = compliancePrices?.[compliance] ?? 0;
let total = platformPrice + compliancePrice;
// Data types
if (dataSection.checkbox('financial')?.value()) total += dataTypePrices['financial'] ?? 0;
if (dataSection.checkbox('health')?.value()) total += dataTypePrices['health'] ?? 0;
if (dataSection.checkbox('biometric')?.value()) total += dataTypePrices['biometric'] ?? 0;
if (dataSection.checkbox('location')?.value()) total += dataTypePrices['location'] ?? 0;
if (dataSection.checkbox('children')?.value()) total += dataTypePrices['children'] ?? 0;
if (dataSection.checkbox('sensitive')?.value()) total += dataTypePrices['sensitive'] ?? 0;
// Integrations
if (integrationsSection.checkbox('analytics')?.value()) total += integrationPrices['analytics'] ?? 0;
if (integrationsSection.checkbox('advertising')?.value()) total += integrationPrices['advertising'] ?? 0;
if (integrationsSection.checkbox('socialMedia')?.value()) total += integrationPrices['social-media'] ?? 0;
if (integrationsSection.checkbox('payment')?.value()) total += integrationPrices['payment'] ?? 0;
if (integrationsSection.checkbox('crm')?.value()) total += integrationPrices['crm'] ?? 0;
if (integrationsSection.checkbox('emailMarketing')?.value()) total += integrationPrices['email-marketing'] ?? 0;
if (integrationsSection.checkbox('cloudStorage')?.value()) total += integrationPrices['cloud-storage'] ?? 0;
if (integrationsSection.checkbox('aiMl')?.value()) total += integrationPrices['ai-ml'] ?? 0;
// Turnaround multiplier
if (turnaround === 'expedited') total *= 1.25;
else if (turnaround === 'rush') total *= 1.50;
// Services
if (servicesSection.checkbox('legalReview')?.value()) total += 250;
if (servicesSection.checkbox('cookiePolicy')?.value()) total += 200;
const revisions = servicesSection.dropdown('revisions')?.value() || '1';
if (revisions === '2') total += 100;
else if (revisions === '3') total += 200;
else if (revisions === 'unlimited') total += 350;
if (servicesSection.checkbox('annualUpdate')?.value()) total += 250;
if (servicesSection.checkbox('multiLanguage')?.value()) {
const langs = servicesSection.integer('languages')?.value() || 1;
total += 200 * langs;
}
return Math.round(total);
},
variant: 'large'
});
});
finalSection.addRow(row => {
row.addTextPanel('disclaimer', {
computedValue: () => 'This estimate is for planning purposes only. Final pricing depends on specific requirements and complexity. Privacy policies must comply with applicable laws in your jurisdiction.',
customStyles: { 'font-size': '0.8rem', 'color': '#64748b', 'font-style': 'italic' }
});
});
form.configureSubmitButton({
label: 'Request Consultation'
});
}