export function automationRoiQuiz(form: FormTs) {
form.setTitle(() => '💰 How Much Is Manual Work Costing You?');
// ============ STATE ============
const inputs = form.state<{
employees: number;
avgHourlyRate: number;
hoursOnManualTasks: number;
taskCategories: string[];
errorRate: number;
growthRate: number;
}>({
employees: 10,
avgHourlyRate: 35,
hoursOnManualTasks: 10,
taskCategories: [],
errorRate: 5,
growthRate: 20
});
// ============ CALCULATIONS ============
const getWeeklyManualHours = () => {
const i = inputs();
return i.employees * i.hoursOnManualTasks;
};
const getAnnualManualHours = () => getWeeklyManualHours() * 52;
const getAnnualManualCost = () => {
const i = inputs();
return getAnnualManualHours() * i.avgHourlyRate;
};
const getErrorCost = () => {
const i = inputs();
const baseCost = getAnnualManualCost();
return baseCost * (i.errorRate / 100) * 0.3; // Errors cost ~30% of task value to fix
};
const getOpportunityCost = () => {
const i = inputs();
// Lost productivity from context switching, waiting, etc.
return getAnnualManualCost() * 0.15;
};
const getTotalCurrentCost = () => {
return getAnnualManualCost() + getErrorCost() + getOpportunityCost();
};
const getAutomationSavings = () => {
// Assume 70% of manual work can be automated
return getTotalCurrentCost() * 0.7;
};
const get3YearSavings = () => {
const i = inputs();
const year1 = getAutomationSavings();
const year2 = year1 * (1 + i.growthRate / 100);
const year3 = year2 * (1 + i.growthRate / 100);
return year1 + year2 + year3;
};
const getHoursReclaimed = () => {
return Math.round(getAnnualManualHours() * 0.7);
};
const getFTEEquivalent = () => {
return (getHoursReclaimed() / 2080).toFixed(1); // 2080 = 40hrs * 52 weeks
};
const formatCurrency = (amount: number): string => {
if (amount >= 1000000) {
return `$${(amount / 1000000).toFixed(1)}M`;
} else if (amount >= 1000) {
return `$${(amount / 1000).toFixed(0)}K`;
}
return `$${amount.toFixed(0)}`;
};
const getSavingsLevel = (): 'low' | 'medium' | 'high' | 'massive' => {
const savings = getAutomationSavings();
if (savings >= 500000) return 'massive';
if (savings >= 100000) return 'high';
if (savings >= 25000) return 'medium';
return 'low';
};
const getSavingsColor = () => {
const level = getSavingsLevel();
const colors = { massive: '#059669', high: '#10b981', medium: '#f59e0b', low: '#6b7280' };
return colors[level];
};
// ============ COMPLETION SCREEN ============
form.configureCompletionScreen({
type: 'text',
title: () => `💰 You Could Save ${formatCurrency(getAutomationSavings())}/Year`,
message: () => {
const savings = getAutomationSavings();
const hours = getHoursReclaimed();
return `By automating repetitive tasks, you could save ${formatCurrency(savings)} annually and reclaim ${hours.toLocaleString()} hours. That's equivalent to ${getFTEEquivalent()} full-time employees worth of productive time redirected to high-value work.`;
}
});
// ============ PAGES SETUP ============
const pages = form.addPages('quiz-pages', {
heightMode: 'current-page'
});
// ============ PAGE 1: Team Size ============
const page1 = pages.addPage('team-size', { mobileBreakpoint: 500 });
page1.addRow(row => {
row.addTextPanel('header1', {
label: 'Step 1 of 5: Your Team',
computedValue: () => 'Let\'s understand your team size and costs',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page1.addSpacer({ height: '24px' });
page1.addRow(row => {
row.addSlider('employeeCount', {
label: 'How many employees do manual/repetitive tasks?',
isRequired: true,
min: 1,
max: 200,
step: 1,
defaultValue: 10,
unit: 'employees',
showValue: true,
tooltip: 'Include full-time, part-time, and contractors who perform repetitive manual tasks',
onValueChange: (val) => {
if (val == null) return;
inputs.update(current => ({ ...current, employees: val }));
}
});
});
page1.addRow(row => {
row.addSlider('avgSalary', {
label: 'Average hourly rate (fully-loaded cost)',
isRequired: true,
min: 15,
max: 150,
step: 5,
defaultValue: 35,
unit: '$/hour',
showValue: true,
tooltip: 'Include salary, benefits, taxes, and overhead. Typically 1.3-1.5x base salary.',
onValueChange: (val) => {
if (val == null) return;
inputs.update(current => ({ ...current, avgHourlyRate: val }));
}
});
});
page1.addRow(row => {
row.addDropdown('industry', {
label: 'What industry are you in?',
isRequired: true,
tooltip: 'Your industry affects automation opportunities and typical error costs',
options: [
{ id: 'tech', name: '💻 Technology / SaaS' },
{ id: 'finance', name: '🏦 Finance / Banking' },
{ id: 'healthcare', name: '🏥 Healthcare' },
{ id: 'retail', name: '🛒 Retail / E-commerce' },
{ id: 'manufacturing', name: '🏭 Manufacturing' },
{ id: 'professional', name: '💼 Professional Services' },
{ id: 'other', name: '📦 Other' }
],
placeholder: 'Select industry'
});
});
// ============ PAGE 2: Manual Tasks ============
const page2 = pages.addPage('manual-tasks', { mobileBreakpoint: 500 });
page2.addRow(row => {
row.addTextPanel('header2', {
label: 'Step 2 of 5: Manual Work',
computedValue: () => 'How much time is spent on repetitive tasks?',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page2.addSpacer({ height: '24px' });
page2.addRow(row => {
row.addSlider('hoursPerWeek', {
label: 'Hours per employee per week on manual/repetitive tasks',
isRequired: true,
min: 1,
max: 40,
step: 1,
defaultValue: 10,
unit: 'hours/week',
showValue: true,
tooltip: 'Estimate time spent on tasks that could potentially be automated',
onValueChange: (val) => {
if (val == null) return;
inputs.update(current => ({ ...current, hoursOnManualTasks: val }));
}
});
});
page2.addRow(row => {
row.addSuggestionChips('taskTypes', {
label: 'What types of manual tasks are most common? (Select all that apply)',
isRequired: true,
suggestions: [
{ id: 'data-entry', name: 'Data Entry' },
{ id: 'reporting', name: 'Reports & Dashboards' },
{ id: 'email', name: 'Email Processing' },
{ id: 'scheduling', name: 'Scheduling' },
{ id: 'invoicing', name: 'Invoicing' },
{ id: 'onboarding', name: 'Onboarding' },
{ id: 'approvals', name: 'Approvals' },
{ id: 'document', name: 'Document Processing' }
],
min: 1,
alignment: 'left',
onValueChange: (val) => {
inputs.update(current => ({ ...current, taskCategories: val as string[] }));
}
});
});
page2.addRow(row => {
row.addTextPanel('weeklyImpact', {
computedValue: () => {
const hours = getWeeklyManualHours();
return `📊 Your team spends ~${hours.toLocaleString()} hours/week on manual tasks`;
},
customStyles: {
fontSize: '1rem',
fontWeight: '600',
color: '#dc2626',
textAlign: 'center',
padding: '12px',
background: '#fef2f2',
borderRadius: '8px',
marginTop: '1rem'
}
});
});
// ============ PAGE 3: Impact Assessment ============
const page3 = pages.addPage('impact', { mobileBreakpoint: 500 });
page3.addRow(row => {
row.addTextPanel('header3', {
label: 'Step 3 of 5: Business Impact',
computedValue: () => 'How do manual processes affect your business?',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page3.addSpacer({ height: '24px' });
page3.addRow(row => {
row.addSlider('errorRate', {
label: 'Estimated error rate on manual tasks',
isRequired: true,
min: 0,
max: 25,
step: 1,
defaultValue: 5,
unit: '%',
showValue: true,
tooltip: 'Percentage of manual tasks that require corrections or rework',
onValueChange: (val) => {
if (val == null) return;
inputs.update(current => ({ ...current, errorRate: val }));
}
});
});
page3.addRow(row => {
row.addSlider('growthRate', {
label: 'Expected annual business growth rate',
isRequired: true,
min: 0,
max: 100,
step: 5,
defaultValue: 20,
unit: '%',
showValue: true,
tooltip: 'Projected year-over-year growth in revenue or headcount',
onValueChange: (val) => {
if (val == null) return;
inputs.update(current => ({ ...current, growthRate: val }));
}
});
});
page3.addRow(row => {
row.addRatingScale('bottleneck', {
label: 'How much are manual processes limiting your growth?',
isRequired: true,
preset: 'likert-5',
lowLabel: 'Not at all',
highLabel: 'Critical bottleneck',
size: 'md',
alignment: 'center',
variant: 'segmented'
});
});
// ============ PAGE 4: Results ============
const page4 = pages.addPage('results', { mobileBreakpoint: 500 });
page4.addRow(row => {
row.addTextPanel('header4', {
label: 'Step 4 of 5: Your ROI Analysis',
computedValue: () => 'See how much automation could save you',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page4.addSpacer({ height: '24px' });
page4.addRow(row => {
row.addTextPanel('bigNumber', {
computedValue: () => `${formatCurrency(getAutomationSavings())}`,
customStyles: {
fontSize: '3rem',
fontWeight: '800',
textAlign: 'center',
color: getSavingsColor(),
padding: '20px',
background: '#f0fdf4',
borderRadius: '12px',
border: `3px solid ${getSavingsColor()}`
}
});
});
page4.addRow(row => {
row.addTextPanel('savingsLabel', {
computedValue: () => 'Potential Annual Savings from Automation',
customStyles: {
fontSize: '1.1rem',
fontWeight: '600',
textAlign: 'center',
color: '#374151',
marginTop: '0.5rem'
}
});
});
page4.addSpacer({ height: '20px' });
page4.addRow(row => {
row.addTextPanel('breakdown', {
label: '📊 Cost Breakdown',
computedValue: () => '',
customStyles: {
fontSize: '1rem',
fontWeight: '600',
color: '#1f2937'
}
});
});
page4.addRow(row => {
row.addTextPanel('laborCost', {
computedValue: () => `Direct Labor Cost: ${formatCurrency(getAnnualManualCost())}/year`,
customStyles: {
fontSize: '0.95rem',
color: '#4b5563',
padding: '10px 15px',
background: '#f9fafb',
borderRadius: '6px'
}
});
});
page4.addRow(row => {
row.addTextPanel('errorCostDisplay', {
computedValue: () => `Error & Rework Cost: ${formatCurrency(getErrorCost())}/year`,
customStyles: {
fontSize: '0.95rem',
color: '#4b5563',
padding: '10px 15px',
background: '#f9fafb',
borderRadius: '6px',
marginTop: '0.5rem'
}
});
});
page4.addRow(row => {
row.addTextPanel('opportunityCostDisplay', {
computedValue: () => `Opportunity Cost: ${formatCurrency(getOpportunityCost())}/year`,
customStyles: {
fontSize: '0.95rem',
color: '#4b5563',
padding: '10px 15px',
background: '#f9fafb',
borderRadius: '6px',
marginTop: '0.5rem'
}
});
});
page4.addRow(row => {
row.addTextPanel('totalCost', {
computedValue: () => `Total Current Cost: ${formatCurrency(getTotalCurrentCost())}/year`,
customStyles: {
fontSize: '1rem',
fontWeight: '600',
color: '#dc2626',
padding: '12px 15px',
background: '#fef2f2',
borderRadius: '6px',
marginTop: '0.5rem'
}
});
});
page4.addSpacer({ height: '15px' });
page4.addRow(row => {
row.addTextPanel('additionalMetrics', {
label: '⏱️ Time Impact',
computedValue: () => '',
customStyles: {
fontSize: '1rem',
fontWeight: '600',
color: '#1f2937'
}
});
});
page4.addRow(row => {
row.addTextPanel('hoursReclaimed', {
computedValue: () => `Hours Reclaimed: ${getHoursReclaimed().toLocaleString()} hours/year`,
customStyles: {
fontSize: '0.95rem',
color: '#059669',
padding: '10px 15px',
background: '#ecfdf5',
borderRadius: '6px'
}
});
});
page4.addRow(row => {
row.addTextPanel('fteEquivalent', {
computedValue: () => `FTE Equivalent: ${getFTEEquivalent()} full-time employees`,
customStyles: {
fontSize: '0.95rem',
color: '#059669',
padding: '10px 15px',
background: '#ecfdf5',
borderRadius: '6px',
marginTop: '0.5rem'
}
});
});
page4.addRow(row => {
row.addTextPanel('threeYearSavings', {
computedValue: () => `3-Year Projected Savings: ${formatCurrency(get3YearSavings())}`,
customStyles: {
fontSize: '1.1rem',
fontWeight: '600',
color: '#059669',
padding: '15px',
background: '#d1fae5',
borderRadius: '8px',
marginTop: '1rem',
textAlign: 'center'
}
});
});
// ============ PAGE 5: Lead Capture ============
const page5 = pages.addPage('lead-capture', { mobileBreakpoint: 500 });
page5.addRow(row => {
row.addTextPanel('header5', {
label: 'Step 5 of 5: Get Your Report',
computedValue: () => 'Enter your details to receive your personalized ROI report',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page5.addSpacer({ height: '24px' });
page5.addRow(row => {
row.addTextPanel('leadCapture', {
label: '📧 Get Your Full ROI Report',
computedValue: () => 'Enter your details to receive a detailed PDF with automation recommendations',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280'
}
});
});
page5.addRow(row => {
row.addTextbox('name', {
label: 'Your Name',
isRequired: true,
placeholder: 'John Smith'
}, '1fr');
row.addEmail('email', {
label: 'Work Email',
isRequired: true,
placeholder: 'john@company.com'
}, '1fr');
});
page5.addRow(row => {
row.addTextbox('company', {
label: 'Company Name',
isRequired: true,
placeholder: 'Acme Inc.'
}, '1fr');
row.addTextbox('phone', {
label: 'Phone (optional)',
placeholder: '+1 (555) 123-4567'
}, '1fr');
});
page5.addRow(row => {
row.addCheckboxList('consent', {
options: [
{ id: 'report', name: '📄 Send me the detailed ROI report', isRequired: true },
{ id: 'consultation', name: '📞 I\'d like a free automation consultation' },
{ id: 'case-studies', name: '📚 Send me automation case studies' }
],
defaultValue: ['report'],
orientation: 'vertical'
});
});
// ============ PDF REPORT ============
form.configurePdf('roi-report', pdf => {
pdf.configure({
filename: 'automation-roi-report.pdf',
pageSize: 'A4',
allowUserDownload: true,
downloadButtonLabel: '📄 Download ROI Report',
header: {
title: 'Automation ROI Analysis',
subtitle: 'Your Manual Work Cost Assessment'
},
footer: {
text: 'Generated by FormTs Automation ROI Calculator',
showPageNumbers: true
}
});
pdf.addSection('Executive Summary', section => {
section.addRow(row => {
row.addField('Potential Annual Savings', formatCurrency(getAutomationSavings()));
row.addField('3-Year Projected Savings', formatCurrency(get3YearSavings()));
});
section.addRow(row => {
row.addField('Hours Reclaimed/Year', `${getHoursReclaimed().toLocaleString()}`);
row.addField('FTE Equivalent', getFTEEquivalent());
});
});
pdf.addSection('Current Cost Analysis', section => {
section.addTable(
['Cost Category', 'Annual Cost', 'Percentage'],
[
['Direct Labor', formatCurrency(getAnnualManualCost()), `${Math.round((getAnnualManualCost() / getTotalCurrentCost()) * 100)}%`],
['Errors & Rework', formatCurrency(getErrorCost()), `${Math.round((getErrorCost() / getTotalCurrentCost()) * 100)}%`],
['Opportunity Cost', formatCurrency(getOpportunityCost()), `${Math.round((getOpportunityCost() / getTotalCurrentCost()) * 100)}%`],
['Total', formatCurrency(getTotalCurrentCost()), '100%']
]
);
});
pdf.addSection('Key Metrics', section => {
const i = inputs();
section.addRow(row => {
row.addField('Team Size', `${i.employees} employees`);
row.addField('Avg Hourly Rate', `$${i.avgHourlyRate}/hr`);
});
section.addRow(row => {
row.addField('Weekly Manual Hours', `${getWeeklyManualHours().toLocaleString()}`);
row.addField('Annual Manual Hours', `${getAnnualManualHours().toLocaleString()}`);
});
});
pdf.addPageBreak();
pdf.addSection('Automation Recommendations', section => {
const tasks = inputs().taskCategories;
section.addText('Based on your manual tasks, here are priority automation opportunities:');
section.addSpacer(10);
if (tasks.includes('data-entry')) {
section.addText('📝 DATA ENTRY: Implement API integrations between systems, use OCR for document scanning, set up automated data validation rules.');
}
if (tasks.includes('reporting')) {
section.addText('📊 REPORTING: Set up automated dashboards with real-time data, schedule report generation and distribution, use templates for recurring reports.');
}
if (tasks.includes('email')) {
section.addText('📧 EMAIL: Deploy email automation tools, use templates and snippets, implement AI-assisted responses for common queries.');
}
if (tasks.includes('invoicing')) {
section.addText('💳 INVOICING: Automate invoice generation from sales data, set up automatic payment reminders, integrate with accounting software.');
}
if (tasks.includes('onboarding')) {
section.addText('👋 ONBOARDING: Create automated welcome sequences, use digital forms for paperwork, set up self-service portals.');
}
if (tasks.includes('approvals')) {
section.addText('✅ APPROVALS: Implement workflow automation tools, set up auto-approval rules for low-risk items, use digital signatures.');
}
});
pdf.addSection('Implementation Roadmap', section => {
section.addText('Phase 1 (Months 1-2): Quick wins - automate highest-volume, simplest tasks');
section.addText('Phase 2 (Months 3-4): Core workflows - tackle main business processes');
section.addText('Phase 3 (Months 5-6): Integration - connect systems and optimize');
section.addText('Phase 4 (Ongoing): Continuous improvement and expansion');
});
});
// ============ SUBMIT BUTTON ============
form.configureSubmitButton({
label: () => `💰 Get My Full ROI Report (Save ${formatCurrency(getAutomationSavings())}/yr)`
});
form.configureSubmitBehavior({
sendToServer: true
});
}