export function testPrepCalculator(form: FormTs) {
form.addRow(row => {
row.addTextPanel('header', {
computedValue: () => 'Test Prep Calculator',
customStyles: { 'font-size': '1.5rem', 'font-weight': '600', 'color': '#1e293b' }
});
});
form.addSpacer({ height: 20 });
// Test Selection Section
const testSection = form.addSubform('test', { title: '📝 Test Selection' });
testSection.addRow(row => {
row.addDropdown('testType', {
label: 'Test Type',
options: [
{ id: 'sat', name: 'SAT' },
{ id: 'act', name: 'ACT' },
{ id: 'psat', name: 'PSAT/NMSQT' },
{ id: 'gre', name: 'GRE' },
{ id: 'gmat', name: 'GMAT' },
{ id: 'lsat', name: 'LSAT' },
{ id: 'mcat', name: 'MCAT' },
{ id: 'ap', name: 'AP Exams' },
{ id: 'ielts', name: 'IELTS' },
{ id: 'toefl', name: 'TOEFL' }
],
defaultValue: 'sat',
isRequired: true
}, '1fr');
row.addDropdown('targetScore', {
label: 'Score Goal',
options: [
{ id: 'basic', name: 'Basic Improvement (50-100 points)' },
{ id: 'moderate', name: 'Moderate Improvement (100-200 points)' },
{ id: 'significant', name: 'Significant Improvement (200+ points)' },
{ id: 'top', name: 'Top Scores (90th+ percentile)' }
],
defaultValue: 'moderate',
tooltip: 'Higher goals may require more prep'
}, '1fr');
});
testSection.addRow(row => {
row.addDropdown('timeline', {
label: 'Preparation Timeline',
options: [
{ id: '1-month', name: '1 Month (Intensive)' },
{ id: '2-month', name: '2 Months' },
{ id: '3-month', name: '3 Months (Recommended)' },
{ id: '6-month', name: '6 Months' },
{ id: '12-month', name: '12 Months (Long-term)' }
],
defaultValue: '3-month'
}, '1fr');
row.addInteger('currentScore', {
label: 'Current/Practice Score (Optional)',
min: 0,
max: 1600,
placeholder: 'e.g., 1200',
tooltip: 'Your baseline score if known'
}, '1fr');
});
// Prep Method Section
const methodSection = form.addSubform('method', { title: '📚 Preparation Method' });
methodSection.addRow(row => {
row.addRadioButton('prepMethod', {
label: 'Primary Prep Method',
options: [
{ id: 'self-study', name: 'Self-Study (Books & Online Resources)' },
{ id: 'online-course', name: 'Online Course (Video Lessons + Practice)' },
{ id: 'group-class', name: 'Group Class (In-person or Live Online)' },
{ id: 'private-tutor', name: 'Private Tutoring (1-on-1)' },
{ id: 'bootcamp', name: 'Intensive Bootcamp' }
],
defaultValue: 'online-course',
isRequired: true
});
});
methodSection.addRow(row => {
row.addDropdown('courseLevel', {
label: 'Course/Package Level',
options: [
{ id: 'basic', name: 'Basic - Core content only' },
{ id: 'standard', name: 'Standard - Content + practice tests' },
{ id: 'premium', name: 'Premium - All features + support' },
{ id: 'elite', name: 'Elite - VIP access + guarantees' }
],
defaultValue: 'standard',
isVisible: () => ['online-course', 'group-class', 'bootcamp'].includes(methodSection.radioButton('prepMethod')?.value() || '')
}, '1fr');
row.addInteger('tutoringHours', {
label: 'Tutoring Hours',
min: 5,
max: 200,
defaultValue: 20,
isVisible: () => methodSection.radioButton('prepMethod')?.value() === 'private-tutor',
tooltip: 'Total hours with tutor'
}, '1fr');
});
methodSection.addRow(row => {
row.addDropdown('tutorExperience', {
label: 'Tutor Experience Level',
options: [
{ id: 'student', name: 'Peer Tutor (College Student)' },
{ id: 'experienced', name: 'Experienced Tutor (2-5 years)' },
{ id: 'expert', name: 'Expert Tutor (5+ years, top scores)' },
{ id: 'elite', name: 'Elite Tutor (Perfect scores, 10+ years)' }
],
defaultValue: 'experienced',
isVisible: () => methodSection.radioButton('prepMethod')?.value() === 'private-tutor'
});
});
// Materials Section
const materialsSection = form.addSubform('materials', { title: '📖 Study Materials' });
materialsSection.addRow(row => {
row.addCheckbox('officialGuide', {
label: 'Official Test Guide',
defaultValue: true,
tooltip: 'Official prep book from test maker'
}, '1fr');
row.addCheckbox('practiceTests', {
label: 'Additional Practice Tests',
defaultValue: true,
tooltip: 'Extra official or simulated tests'
}, '1fr');
});
materialsSection.addRow(row => {
row.addCheckbox('prepBooks', {
label: 'Supplementary Prep Books',
defaultValue: false,
tooltip: 'Strategy guides, subject reviews'
}, '1fr');
row.addCheckbox('flashcards', {
label: 'Flashcard System',
defaultValue: false,
tooltip: 'Vocabulary/concept flashcards'
}, '1fr');
});
materialsSection.addRow(row => {
row.addCheckbox('onlineBank', {
label: 'Question Bank Subscription',
defaultValue: false,
tooltip: 'Access to thousands of practice questions'
}, '1fr');
row.addCheckbox('mobileApp', {
label: 'Premium Mobile App',
defaultValue: false,
tooltip: 'Study on-the-go features'
}, '1fr');
});
// Additional Services Section
const servicesSection = form.addSubform('services', { title: '✨ Additional Services' });
servicesSection.addRow(row => {
row.addCheckbox('diagnosticTest', {
label: 'Diagnostic Assessment',
defaultValue: false,
tooltip: 'Identify strengths and weaknesses'
}, '1fr');
row.addCheckbox('studyPlan', {
label: 'Personalized Study Plan',
defaultValue: false,
tooltip: 'Custom schedule and strategy'
}, '1fr');
});
servicesSection.addRow(row => {
row.addCheckbox('essayReview', {
label: 'Essay Scoring/Review',
defaultValue: false,
tooltip: 'Expert feedback on practice essays',
isVisible: () => ['sat', 'act', 'gre', 'gmat', 'lsat'].includes(testSection.dropdown('testType')?.value() || '')
}, '1fr');
row.addCheckbox('scoreGuarantee', {
label: 'Score Guarantee',
defaultValue: false,
tooltip: 'Money back if score goal not met'
}, '1fr');
});
servicesSection.addRow(row => {
row.addCheckbox('collegeConsulting', {
label: 'College Admissions Consulting',
defaultValue: false,
tooltip: 'Application strategy advice',
isVisible: () => ['sat', 'act', 'psat'].includes(testSection.dropdown('testType')?.value() || '')
}, '1fr');
row.addCheckbox('testRegistration', {
label: 'Test Registration Fee',
defaultValue: true,
tooltip: 'Include actual test fee'
}, '1fr');
});
form.addSpacer({ height: 20, showLine: true, lineStyle: 'dashed' });
// Pricing Breakdown
const breakdownSection = form.addSubform('breakdown', { title: '📊 Cost Breakdown', isCollapsible: true });
breakdownSection.addRow(row => {
row.addPriceDisplay('prepMethodCost', {
label: 'Preparation Method',
computedValue: () => {
const prepMethod = methodSection.radioButton('prepMethod')?.value() || 'online-course';
const courseLevel = methodSection.dropdown('courseLevel')?.value() || 'standard';
const tutoringHours = methodSection.integer('tutoringHours')?.value() || 20;
const tutorExperience = methodSection.dropdown('tutorExperience')?.value() || 'experienced';
const testType = testSection.dropdown('testType')?.value() || 'sat';
// Test complexity multiplier
const testMultipliers: Record<string, number> = {
'sat': 1, 'act': 1, 'psat': 0.7, 'gre': 1.2, 'gmat': 1.3,
'lsat': 1.4, 'mcat': 1.8, 'ap': 0.6, 'ielts': 0.8, 'toefl': 0.8
};
const testMult = testMultipliers[testType] || 1;
if (prepMethod === 'self-study') {
return Math.round(50 * testMult);
} else if (prepMethod === 'online-course') {
const levelPrices: Record<string, number> = { 'basic': 200, 'standard': 500, 'premium': 1000, 'elite': 1500 };
return Math.round((levelPrices[courseLevel] || 500) * testMult);
} else if (prepMethod === 'group-class') {
const levelPrices: Record<string, number> = { 'basic': 500, 'standard': 900, 'premium': 1500, 'elite': 2500 };
return Math.round((levelPrices[courseLevel] || 900) * testMult);
} else if (prepMethod === 'private-tutor') {
const hourlyRates: Record<string, number> = { 'student': 40, 'experienced': 80, 'expert': 150, 'elite': 300 };
return Math.round((hourlyRates[tutorExperience] || 80) * tutoringHours * testMult);
} else if (prepMethod === 'bootcamp') {
const levelPrices: Record<string, number> = { 'basic': 1500, 'standard': 2500, 'premium': 4000, 'elite': 6000 };
return Math.round((levelPrices[courseLevel] || 2500) * testMult);
}
return 0;
},
variant: 'default'
}, '1fr');
row.addPriceDisplay('materialsCost', {
label: 'Study Materials',
computedValue: () => {
let cost = 0;
if (materialsSection.checkbox('officialGuide')?.value()) cost += 35;
if (materialsSection.checkbox('practiceTests')?.value()) cost += 40;
if (materialsSection.checkbox('prepBooks')?.value()) cost += 60;
if (materialsSection.checkbox('flashcards')?.value()) cost += 25;
if (materialsSection.checkbox('onlineBank')?.value()) cost += 100;
if (materialsSection.checkbox('mobileApp')?.value()) cost += 50;
return cost;
},
variant: 'default'
}, '1fr');
});
breakdownSection.addRow(row => {
row.addPriceDisplay('servicesCost', {
label: 'Additional Services',
computedValue: () => {
let cost = 0;
if (servicesSection.checkbox('diagnosticTest')?.value()) cost += 75;
if (servicesSection.checkbox('studyPlan')?.value()) cost += 100;
if (servicesSection.checkbox('essayReview')?.value()) cost += 150;
if (servicesSection.checkbox('scoreGuarantee')?.value()) cost += 200;
if (servicesSection.checkbox('collegeConsulting')?.value()) cost += 500;
return cost;
},
variant: 'default'
}, '1fr');
row.addPriceDisplay('testFee', {
label: 'Test Registration',
computedValue: () => {
if (!servicesSection.checkbox('testRegistration')?.value()) return 0;
const testType = testSection.dropdown('testType')?.value() || 'sat';
const testFees: Record<string, number> = {
'sat': 60, 'act': 65, 'psat': 18, 'gre': 220, 'gmat': 275,
'lsat': 200, 'mcat': 330, 'ap': 98, 'ielts': 250, 'toefl': 245
};
return testFees[testType] || 100;
},
variant: 'default'
}, '1fr');
});
// Quote Section
const quoteSection = form.addSubform('quote', { title: '💰 Your Investment', isCollapsible: false });
quoteSection.addRow(row => {
row.addPriceDisplay('totalCost', {
label: 'Total Test Prep Cost',
computedValue: () => {
const prepMethod = methodSection.radioButton('prepMethod')?.value() || 'online-course';
const courseLevel = methodSection.dropdown('courseLevel')?.value() || 'standard';
const tutoringHours = methodSection.integer('tutoringHours')?.value() || 20;
const tutorExperience = methodSection.dropdown('tutorExperience')?.value() || 'experienced';
const testType = testSection.dropdown('testType')?.value() || 'sat';
const testMultipliers: Record<string, number> = {
'sat': 1, 'act': 1, 'psat': 0.7, 'gre': 1.2, 'gmat': 1.3,
'lsat': 1.4, 'mcat': 1.8, 'ap': 0.6, 'ielts': 0.8, 'toefl': 0.8
};
const testMult = testMultipliers[testType] || 1;
let prepCost = 0;
if (prepMethod === 'self-study') {
prepCost = 50 * testMult;
} else if (prepMethod === 'online-course') {
const levelPrices: Record<string, number> = { 'basic': 200, 'standard': 500, 'premium': 1000, 'elite': 1500 };
prepCost = (levelPrices[courseLevel] || 500) * testMult;
} else if (prepMethod === 'group-class') {
const levelPrices: Record<string, number> = { 'basic': 500, 'standard': 900, 'premium': 1500, 'elite': 2500 };
prepCost = (levelPrices[courseLevel] || 900) * testMult;
} else if (prepMethod === 'private-tutor') {
const hourlyRates: Record<string, number> = { 'student': 40, 'experienced': 80, 'expert': 150, 'elite': 300 };
prepCost = (hourlyRates[tutorExperience] || 80) * tutoringHours * testMult;
} else if (prepMethod === 'bootcamp') {
const levelPrices: Record<string, number> = { 'basic': 1500, 'standard': 2500, 'premium': 4000, 'elite': 6000 };
prepCost = (levelPrices[courseLevel] || 2500) * testMult;
}
// Materials
let materials = 0;
if (materialsSection.checkbox('officialGuide')?.value()) materials += 35;
if (materialsSection.checkbox('practiceTests')?.value()) materials += 40;
if (materialsSection.checkbox('prepBooks')?.value()) materials += 60;
if (materialsSection.checkbox('flashcards')?.value()) materials += 25;
if (materialsSection.checkbox('onlineBank')?.value()) materials += 100;
if (materialsSection.checkbox('mobileApp')?.value()) materials += 50;
// Services
let services = 0;
if (servicesSection.checkbox('diagnosticTest')?.value()) services += 75;
if (servicesSection.checkbox('studyPlan')?.value()) services += 100;
if (servicesSection.checkbox('essayReview')?.value()) services += 150;
if (servicesSection.checkbox('scoreGuarantee')?.value()) services += 200;
if (servicesSection.checkbox('collegeConsulting')?.value()) services += 500;
// Test fee
let testFee = 0;
if (servicesSection.checkbox('testRegistration')?.value()) {
const testFees: Record<string, number> = {
'sat': 60, 'act': 65, 'psat': 18, 'gre': 220, 'gmat': 275,
'lsat': 200, 'mcat': 330, 'ap': 98, 'ielts': 250, 'toefl': 245
};
testFee = testFees[testType] || 100;
}
return Math.round((prepCost + materials + services + testFee) * 100) / 100;
},
variant: 'large'
});
});
quoteSection.addRow(row => {
row.addTextPanel('costPerPoint', {
computedValue: () => {
const targetScore = testSection.dropdown('targetScore')?.value() || 'moderate';
const pointGoals: Record<string, number> = { 'basic': 75, 'moderate': 150, 'significant': 250, 'top': 350 };
const points = pointGoals[targetScore] || 150;
// Calculate total (simplified)
const prepMethod = methodSection.radioButton('prepMethod')?.value() || 'online-course';
let total = 500; // Simplified estimate
if (prepMethod === 'self-study') total = 150;
else if (prepMethod === 'private-tutor') total = 2000;
else if (prepMethod === 'bootcamp') total = 3000;
const costPerPoint = Math.round(total / points);
return `Approximately $${costPerPoint} per point improvement`;
},
customStyles: { 'font-size': '0.9rem', 'color': '#059669', 'text-align': 'center' }
});
});
// Summary Section
const summarySection = form.addSubform('summary', {
title: '📋 Summary',
isCollapsible: false,
sticky: 'bottom'
});
summarySection.addRow(row => {
row.addTextPanel('summaryText', {
computedValue: () => {
const testType = testSection.dropdown('testType')?.value() || 'sat';
const prepMethod = methodSection.radioButton('prepMethod')?.value() || 'online-course';
const timeline = testSection.dropdown('timeline')?.value() || '3-month';
const testLabels: Record<string, string> = {
'sat': 'SAT', 'act': 'ACT', 'psat': 'PSAT', 'gre': 'GRE', 'gmat': 'GMAT',
'lsat': 'LSAT', 'mcat': 'MCAT', 'ap': 'AP', 'ielts': 'IELTS', 'toefl': 'TOEFL'
};
const methodLabels: Record<string, string> = {
'self-study': 'self-study', 'online-course': 'online course', 'group-class': 'group class',
'private-tutor': 'private tutoring', 'bootcamp': 'bootcamp'
};
const timelineLabels: Record<string, string> = {
'1-month': '1 month', '2-month': '2 months', '3-month': '3 months', '6-month': '6 months', '12-month': '12 months'
};
return `${testLabels[testType]} prep via ${methodLabels[prepMethod]} over ${timelineLabels[timeline]}`;
},
customStyles: { 'font-size': '0.95rem', 'font-weight': '500', 'text-align': 'center', 'color': '#1e293b' }
});
});
summarySection.addRow(row => {
row.addTextPanel('disclaimer', {
computedValue: () => 'Prices are estimates based on average market rates. Actual costs vary by provider and location.',
customStyles: { 'font-size': '0.8rem', 'color': '#64748b', 'text-align': 'center' }
});
});
form.configureSubmitButton({
label: 'Start Prep'
});
}