export function businessReadinessQuiz(form: FormTs) {
form.setTitle(() => '🚀 Are You Ready to Start a Business?');
// ============ SCORING SYSTEM ============
const scores = form.state<Record<string, number>>({});
const updateScore = (category: string, points: number) => {
scores.update(current => ({ ...current, [category]: points }));
};
const getTotalScore = () => {
const s = scores();
return Object.values(s).reduce((sum, val) => sum + (val || 0), 0);
};
const getMaxScore = () => 100;
const getScorePercentage = () => Math.round((getTotalScore() / getMaxScore()) * 100);
const getReadinessLevel = (): 'not-ready' | 'getting-ready' | 'almost-ready' | 'ready' => {
const pct = getScorePercentage();
if (pct >= 75) return 'ready';
if (pct >= 55) return 'almost-ready';
if (pct >= 35) return 'getting-ready';
return 'not-ready';
};
const getReadinessLabel = () => {
const level = getReadinessLevel();
const labels = {
'not-ready': '🔴 Not Ready Yet - Keep Building',
'getting-ready': '🟡 Getting Ready - Almost There',
'almost-ready': '🟠 Almost Ready - Final Preparations',
'ready': '🟢 Ready to Launch!'
};
return labels[level];
};
const getReadinessColor = () => {
const level = getReadinessLevel();
const colors = {
'not-ready': '#dc2626',
'getting-ready': '#ca8a04',
'almost-ready': '#ea580c',
'ready': '#16a34a'
};
return colors[level];
};
// ============ COMPLETION SCREEN ============
form.configureCompletionScreen({
type: 'text',
title: () => getReadinessLabel(),
message: () => {
const pct = getScorePercentage();
const level = getReadinessLevel();
const messages = {
'not-ready': `Your readiness score is ${pct}%. Starting a business is a big step, and you're wise to assess your readiness. Focus on the areas in your report before taking the leap.`,
'getting-ready': `Your readiness score is ${pct}%. You're building a solid foundation! Your report shows specific areas to strengthen before launching.`,
'almost-ready': `Your readiness score is ${pct}%. You're nearly there! Fine-tune the remaining areas and you'll be ready to start.`,
'ready': `Congratulations! Your readiness score is ${pct}%. You have what it takes to start your business. Your report includes final checklists and next steps.`
};
return messages[level];
}
});
// ============ PAGES SETUP ============
const pages = form.addPages('quiz-pages', {
heightMode: 'current-page'
});
// ============ PAGE 1: Mindset & Motivation ============
const page1 = pages.addPage('mindset', { mobileBreakpoint: 500 });
page1.addRow(row => {
row.addTextPanel('header1', {
label: 'Step 1 of 7: Mindset & Motivation',
computedValue: () => 'The entrepreneurial mindset',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page1.addSpacer({ height: '24px' });
page1.addRow(row => {
row.addRadioButton('whyStart', {
label: 'Why do you want to start a business?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'passion', name: '🔥 Deep passion for solving a specific problem' },
{ id: 'opportunity', name: '💡 Spotted a clear market opportunity' },
{ id: 'freedom', name: '🦅 Want freedom and independence' },
{ id: 'money', name: '💰 Financial opportunity' },
{ id: 'escape', name: '🏃 Escaping my current job' }
],
onValueChange: (val) => {
const points = { passion: 10, opportunity: 10, freedom: 6, money: 4, escape: 2 };
updateScore('why', points[val as keyof typeof points] || 0);
}
});
});
page1.addRow(row => {
row.addRatingScale('riskTolerance', {
label: 'How comfortable are you with financial uncertainty?',
isRequired: true,
preset: 'likert-5',
lowLabel: 'Very uncomfortable',
highLabel: 'Very comfortable',
size: 'md',
alignment: 'center',
variant: 'buttons',
onValueChange: (val) => {
if (val == null) return;
const points = [2, 4, 6, 8, 10];
updateScore('risk', points[val - 1] || 0);
}
});
});
page1.addRow(row => {
row.addRadioButton('failure', {
label: 'If this business fails, how would you feel?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'learn', name: '📚 Valuable learning experience, would try again' },
{ id: 'setback', name: '⏸️ Temporary setback, would recover' },
{ id: 'devastated', name: '😰 Financially/emotionally devastated' }
],
onValueChange: (val) => {
const points = { learn: 5, setback: 3, devastated: 0 };
updateScore('failure', points[val as keyof typeof points] || 0);
}
});
});
page1.addRow(row => {
row.addTextPanel('mindsetScore', {
computedValue: () => {
const s = scores();
const score = (s['why'] || 0) + (s['risk'] || 0) + (s['failure'] || 0);
return `🧠 Mindset Score: ${score}/25`;
},
customStyles: () => {
const s = scores();
const score = (s['why'] || 0) + (s['risk'] || 0) + (s['failure'] || 0);
const color = score >= 18 ? '#059669' : score >= 12 ? '#ca8a04' : '#dc2626';
return {
fontSize: '1rem',
fontWeight: '600',
color: color,
textAlign: 'center',
padding: '12px',
background: score >= 18 ? '#ecfdf5' : score >= 12 ? '#fefce8' : '#fef2f2',
borderRadius: '8px',
marginTop: '1rem',
border: `2px solid ${color}`
};
}
});
});
// ============ PAGE 2: Financial Readiness ============
const page2 = pages.addPage('financial', { mobileBreakpoint: 500 });
page2.addRow(row => {
row.addTextPanel('header2', {
label: 'Step 2 of 7: Financial Readiness',
computedValue: () => 'Can you fund your entrepreneurial journey?',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page2.addSpacer({ height: '24px' });
page2.addRow(row => {
row.addRadioButton('runway', {
label: 'How many months of personal expenses can you cover without income?',
tooltip: 'Most businesses take 1-2 years to become profitable',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'twelve-plus', name: '💪 12+ months - well prepared' },
{ id: 'six-twelve', name: '✅ 6-12 months - solid buffer' },
{ id: 'three-six', name: '⚠️ 3-6 months - tight' },
{ id: 'under-three', name: '😰 Less than 3 months' }
],
onValueChange: (val) => {
const points = { 'twelve-plus': 10, 'six-twelve': 7, 'three-six': 4, 'under-three': 1 };
updateScore('runway', points[val as keyof typeof points] || 0);
}
});
});
page2.addRow(row => {
row.addRadioButton('startupCapital', {
label: 'Do you have access to startup capital?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'funded', name: '💰 Yes, enough to fully fund my idea' },
{ id: 'some', name: '💵 Some savings, may need additional funding' },
{ id: 'bootstrap', name: '🔧 Can bootstrap with minimal capital' },
{ id: 'none', name: '❌ No capital available' }
],
onValueChange: (val) => {
const points = { funded: 10, some: 7, bootstrap: 5, none: 2 };
updateScore('capital', points[val as keyof typeof points] || 0);
}
});
});
page2.addRow(row => {
row.addTextPanel('financialScore', {
computedValue: () => {
const s = scores();
const score = (s['runway'] || 0) + (s['capital'] || 0);
return `💰 Financial Readiness Score: ${score}/20`;
},
customStyles: {
fontSize: '1rem',
fontWeight: '600',
color: '#1e40af',
textAlign: 'center',
padding: '12px',
background: '#dbeafe',
borderRadius: '8px',
marginTop: '1rem'
}
});
});
// ============ PAGE 3: Business Idea Validation ============
const page3 = pages.addPage('idea', { mobileBreakpoint: 500 });
page3.addRow(row => {
row.addTextPanel('header3', {
label: 'Step 3 of 7: Business Idea',
computedValue: () => 'How validated is your business concept?',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page3.addSpacer({ height: '24px' });
page3.addRow(row => {
row.addRadioButton('ideaClarity', {
label: 'How clear is your business idea?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'crystal', name: '🎯 Crystal clear - specific problem, solution, and target customer' },
{ id: 'good', name: '📝 Good idea - still refining some details' },
{ id: 'general', name: '💭 General direction - exploring options' },
{ id: 'exploring', name: '🔍 Still exploring - no specific idea yet' }
],
onValueChange: (val) => {
const points = { crystal: 8, good: 5, general: 3, exploring: 1 };
updateScore('clarity', points[val as keyof typeof points] || 0);
}
});
});
page3.addRow(row => {
row.addSuggestionChips('validation', {
label: 'Which validation steps have you completed?',
isRequired: true,
suggestions: [
{ id: 'research', name: '📊 Market research' },
{ id: 'interviews', name: '💬 Customer interviews' },
{ id: 'prototype', name: '🔧 Built a prototype/MVP' },
{ id: 'preorders', name: '💵 Pre-orders/waitlist' },
{ id: 'paying', name: '✅ Paying customers' }
],
min: 0,
alignment: 'center',
onValueChange: (val) => {
if (!val) return;
// Weighted scoring
let points = 0;
if (val.includes('research')) points += 2;
if (val.includes('interviews')) points += 3;
if (val.includes('prototype')) points += 3;
if (val.includes('preorders')) points += 4;
if (val.includes('paying')) points += 5;
updateScore('validation', Math.min(points, 12));
}
});
});
page3.addRow(row => {
row.addTextPanel('ideaScore', {
computedValue: () => {
const s = scores();
const score = (s['clarity'] || 0) + (s['validation'] || 0);
return `💡 Idea Validation Score: ${score}/20`;
},
customStyles: {
fontSize: '1rem',
fontWeight: '600',
color: '#1e40af',
textAlign: 'center',
padding: '12px',
background: '#dbeafe',
borderRadius: '8px',
marginTop: '1rem'
}
});
});
// ============ PAGE 4: Skills & Experience ============
const page4 = pages.addPage('skills', { mobileBreakpoint: 500 });
page4.addRow(row => {
row.addTextPanel('header4', {
label: 'Step 4 of 7: Skills & Experience',
computedValue: () => 'Do you have what it takes?',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page4.addSpacer({ height: '24px' });
page4.addRow(row => {
row.addMatrixQuestion('skillsMatrix', {
label: 'Rate your skills in these key areas:',
isRequired: true,
rows: [
{ id: 'industry', label: 'Industry Knowledge', description: 'Experience in your target industry' },
{ id: 'sales', label: 'Sales & Marketing', description: 'Ability to sell and attract customers' },
{ id: 'operations', label: 'Operations', description: 'Getting things done, execution' }
],
columns: [
{ id: 'beginner', label: 'Beginner' },
{ id: 'intermediate', label: 'Intermediate' },
{ id: 'advanced', label: 'Advanced' },
{ id: 'expert', label: 'Expert' }
],
selectionMode: 'single',
striped: true,
fullWidth: true,
onValueChange: (val) => {
if (!val) return;
const pointsMap: Record<string, Record<string, number>> = {
industry: { beginner: 1, intermediate: 3, advanced: 4, expert: 5 },
sales: { beginner: 1, intermediate: 3, advanced: 4, expert: 5 },
operations: { beginner: 1, intermediate: 2, advanced: 3, expert: 5 }
};
let total = 0;
for (const [row, col] of Object.entries(val)) {
if (col && pointsMap[row]) {
total += pointsMap[row][col as string] || 0;
}
}
updateScore('skills', total);
}
});
});
page4.addRow(row => {
row.addTextPanel('skillsScore', {
computedValue: () => {
const s = scores();
return `🛠️ Skills Score: ${s['skills'] || 0}/15`;
},
customStyles: {
fontSize: '1rem',
fontWeight: '600',
color: '#1e40af',
textAlign: 'center',
padding: '12px',
background: '#dbeafe',
borderRadius: '8px',
marginTop: '1rem'
}
});
});
// ============ PAGE 5: Support System ============
const page5 = pages.addPage('support', { mobileBreakpoint: 500 });
page5.addRow(row => {
row.addTextPanel('header5', {
label: 'Step 5 of 7: Support System',
computedValue: () => 'No entrepreneur succeeds alone',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page5.addSpacer({ height: '24px' });
page5.addRow(row => {
row.addRadioButton('familySupport', {
label: 'Does your family/partner support your entrepreneurial plans?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'fully', name: '💪 Fully supportive and involved' },
{ id: 'supportive', name: '✅ Supportive, though not involved' },
{ id: 'neutral', name: '🤷 Neutral/undecided' },
{ id: 'resistant', name: '😟 Resistant or unsupportive' }
],
onValueChange: (val) => {
const points = { fully: 8, supportive: 6, neutral: 3, resistant: 1 };
updateScore('family', points[val as keyof typeof points] || 0);
}
});
});
page5.addRow(row => {
row.addSuggestionChips('network', {
label: 'What support resources do you have access to?',
isRequired: true,
suggestions: [
{ id: 'mentor', name: '🧭 Mentor/advisor' },
{ id: 'network', name: '🤝 Business network' },
{ id: 'partner', name: '👥 Co-founder' },
{ id: 'community', name: '🏘️ Entrepreneur community' },
{ id: 'legal', name: '⚖️ Legal/accounting help' }
],
min: 0,
alignment: 'center',
onValueChange: (val) => {
if (!val) return;
let points = val.length * 2;
// Bonus for mentor
if (val.includes('mentor')) points += 2;
updateScore('network', Math.min(points, 12));
}
});
});
page5.addRow(row => {
row.addTextPanel('supportScore', {
computedValue: () => {
const s = scores();
const score = (s['family'] || 0) + (s['network'] || 0);
return `🤝 Support System Score: ${score}/20`;
},
customStyles: {
fontSize: '1rem',
fontWeight: '600',
color: '#1e40af',
textAlign: 'center',
padding: '12px',
background: '#dbeafe',
borderRadius: '8px',
marginTop: '1rem'
}
});
});
// ============ PAGE 6: Results ============
const page6 = pages.addPage('results', { mobileBreakpoint: 500 });
page6.addRow(row => {
row.addTextPanel('header6', {
label: 'Step 6 of 7: Your Results',
computedValue: () => 'Your entrepreneurial readiness assessment',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page6.addSpacer({ height: '24px' });
page6.addRow(row => {
row.addTextPanel('bigResult', {
computedValue: () => getReadinessLabel(),
customStyles: {
fontSize: '1.5rem',
fontWeight: '800',
textAlign: 'center',
color: getReadinessColor(),
padding: '20px',
background: '#f9fafb',
borderRadius: '12px',
border: `3px solid ${getReadinessColor()}`
}
});
});
page6.addRow(row => {
row.addTextPanel('scoreDisplay', {
computedValue: () => {
const total = getTotalScore();
const pct = getScorePercentage();
return `Readiness Score: ${total}/${getMaxScore()} (${pct}%)`;
},
customStyles: {
fontSize: '1.1rem',
fontWeight: '600',
textAlign: 'center',
color: '#374151',
marginTop: '10px'
}
});
});
page6.addRow(row => {
row.addTextPanel('recommendation', {
computedValue: () => {
const level = getReadinessLevel();
const recommendations = {
'not-ready': '🔴 Focus on building savings, validating your idea, and developing key skills before taking the leap.',
'getting-ready': '🟡 You\'re making progress! Strengthen your weakest areas and continue building your runway.',
'almost-ready': '🟠 You\'re close! Address the remaining gaps and start creating your launch plan.',
'ready': '🟢 You have a strong foundation! Start taking action on your business plan.'
};
return recommendations[level];
},
customStyles: {
fontSize: '0.95rem',
color: '#4b5563',
textAlign: 'center',
padding: '15px',
background: '#f3f4f6',
borderRadius: '8px',
marginTop: '15px',
lineHeight: '1.5'
}
});
});
// Collapsible breakdown
const detailsSection = page6.addSubform('detailsBreakdown', {
title: '📊 Score Breakdown (click to expand)',
isCollapsible: true,
customStyles: {
marginTop: '1rem',
background: '#f9fafb',
borderRadius: '8px'
}
});
detailsSection.addRow(row => {
row.addTextPanel('mindsetDetail', {
label: '🧠 Mindset',
computedValue: () => {
const s = scores();
const score = (s['why'] || 0) + (s['risk'] || 0) + (s['failure'] || 0);
return `${score}/25`;
},
customStyles: {
fontSize: '0.9rem',
padding: '8px 12px',
background: '#dbeafe',
borderRadius: '6px'
}
}, '1fr');
row.addTextPanel('financialDetail', {
label: '💰 Financial',
computedValue: () => {
const s = scores();
const score = (s['runway'] || 0) + (s['capital'] || 0);
return `${score}/20`;
},
customStyles: {
fontSize: '0.9rem',
padding: '8px 12px',
background: '#dbeafe',
borderRadius: '6px'
}
}, '1fr');
});
detailsSection.addRow(row => {
row.addTextPanel('ideaDetail', {
label: '💡 Idea Validation',
computedValue: () => {
const s = scores();
const score = (s['clarity'] || 0) + (s['validation'] || 0);
return `${score}/20`;
},
customStyles: {
fontSize: '0.9rem',
padding: '8px 12px',
background: '#dbeafe',
borderRadius: '6px'
}
}, '1fr');
row.addTextPanel('skillsDetail', {
label: '🛠️ Skills',
computedValue: () => `${scores()['skills'] || 0}/15`,
customStyles: {
fontSize: '0.9rem',
padding: '8px 12px',
background: '#dbeafe',
borderRadius: '6px'
}
}, '1fr');
});
detailsSection.addRow(row => {
row.addTextPanel('supportDetail', {
label: '🤝 Support System',
computedValue: () => {
const s = scores();
const score = (s['family'] || 0) + (s['network'] || 0);
return `${score}/20`;
},
customStyles: {
fontSize: '0.9rem',
padding: '8px 12px',
background: '#dbeafe',
borderRadius: '6px'
}
}, '1fr');
row.addEmpty('1fr');
});
// ============ PAGE 7: Lead Capture ============
const page7 = pages.addPage('lead-capture', { mobileBreakpoint: 500 });
page7.addRow(row => {
row.addTextPanel('header7', {
label: 'Step 7 of 7: Get Your Report',
computedValue: () => 'Receive your personalized entrepreneur roadmap',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page7.addSpacer({ height: '24px' });
page7.addRow(row => {
row.addTextPanel('leadCapture', {
label: '📧 Get Your Entrepreneur Readiness Report',
computedValue: () => 'Enter your details for a detailed PDF with your personalized action plan',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280'
}
});
});
page7.addRow(row => {
row.addTextbox('name', {
label: 'Your Name',
isRequired: true,
placeholder: 'John Smith'
}, '1fr');
row.addEmail('email', {
label: 'Email',
isRequired: true,
placeholder: 'john@email.com'
}, '1fr');
});
page7.addRow(row => {
row.addDropdown('timeline', {
label: 'When do you plan to start?',
options: [
{ id: 'now', name: '🚀 Ready now' },
{ id: '3-months', name: '📅 Within 3 months' },
{ id: '6-months', name: '📆 Within 6 months' },
{ id: 'year', name: '📋 Within a year' },
{ id: 'exploring', name: '🔍 Just exploring' }
],
placeholder: 'Select timeline'
}, '1fr');
row.addDropdown('businessType', {
label: 'Business Type',
options: [
{ id: 'product', name: '📦 Physical Product' },
{ id: 'service', name: '💼 Service Business' },
{ id: 'saas', name: '💻 Software/SaaS' },
{ id: 'content', name: '📱 Content/Creator' },
{ id: 'other', name: '🎯 Other/Not Sure' }
],
placeholder: 'Select type'
}, '1fr');
});
page7.addRow(row => {
row.addCheckboxList('consent', {
options: [
{ id: 'report', name: '📄 Send me my detailed readiness report', isRequired: true },
{ id: 'course', name: '📚 Send me free entrepreneur resources' },
{ id: 'coaching', name: '📞 Connect me with a business coach' }
],
defaultValue: ['report'],
orientation: 'vertical'
});
});
// ============ PDF REPORT ============
form.configurePdf('readiness-report', pdf => {
pdf.configure({
filename: 'entrepreneur-readiness-report.pdf',
pageSize: 'A4',
allowUserDownload: true,
downloadButtonLabel: '📄 Download Your Report',
header: {
title: 'Entrepreneur Readiness Assessment',
subtitle: 'Your Personal Business Launch Roadmap'
},
footer: {
text: 'Generated by FormTs Business Readiness Quiz',
showPageNumbers: true
}
});
pdf.addSection('Executive Summary', section => {
section.addRow(row => {
row.addField('Readiness Level', getReadinessLabel());
row.addField('Overall Score', `${getScorePercentage()}%`);
});
section.addRow(row => {
row.addField('Assessment Date', new Date().toLocaleDateString());
row.addField('Total Points', `${getTotalScore()} / ${getMaxScore()}`);
});
});
pdf.addSection('Category Breakdown', section => {
const s = scores();
section.addTable(
['Category', 'Score', 'Max', 'Status'],
[
['Mindset', `${(s['why'] || 0) + (s['risk'] || 0) + (s['failure'] || 0)}`, '25', (s['why'] || 0) + (s['risk'] || 0) + (s['failure'] || 0) >= 18 ? '✅ Strong' : '⚠️ Develop'],
['Financial Readiness', `${(s['runway'] || 0) + (s['capital'] || 0)}`, '20', (s['runway'] || 0) + (s['capital'] || 0) >= 14 ? '✅ Strong' : '⚠️ Develop'],
['Idea Validation', `${(s['clarity'] || 0) + (s['validation'] || 0)}`, '20', (s['clarity'] || 0) + (s['validation'] || 0) >= 14 ? '✅ Strong' : '⚠️ Develop'],
['Skills', `${s['skills'] || 0}`, '15', (s['skills'] || 0) >= 10 ? '✅ Strong' : '⚠️ Develop'],
['Support System', `${(s['family'] || 0) + (s['network'] || 0)}`, '20', (s['family'] || 0) + (s['network'] || 0) >= 14 ? '✅ Strong' : '⚠️ Develop']
]
);
});
pdf.addPageBreak();
pdf.addSection('Your Personalized Action Plan', section => {
const level = getReadinessLevel();
const s = scores();
if (level === 'not-ready' || level === 'getting-ready') {
section.addText('Phase 1: Build Your Foundation (Next 3-6 Months)');
section.addSpacer(5);
if ((s['runway'] || 0) + (s['capital'] || 0) < 14) {
section.addText('• Financial: Build 6-12 months of runway before quitting your job');
}
if ((s['clarity'] || 0) + (s['validation'] || 0) < 14) {
section.addText('• Validation: Talk to 20+ potential customers about your idea');
}
if ((s['skills'] || 0) < 10) {
section.addText('• Skills: Take courses or get experience in your weak areas');
}
} else {
section.addText('Phase 1: Launch Preparation (Next 1-3 Months)');
section.addSpacer(5);
section.addText('• Finalize your business plan and financial projections');
section.addText('• Set up legal structure (LLC, etc.) and business banking');
section.addText('• Build your minimum viable product or service offering');
section.addText('• Create your launch marketing plan');
}
});
pdf.addSection('Resources & Next Steps', section => {
section.addText('Recommended Resources:');
section.addText('• "The Lean Startup" by Eric Ries');
section.addText('• "The $100 Startup" by Chris Guillebeau');
section.addText('• SCORE.org - Free mentoring for entrepreneurs');
section.addText('• Local Small Business Development Center (SBDC)');
section.addSpacer(10);
section.addText('Take this quiz again in 3 months to track your progress!');
});
});
// ============ SUBMIT BUTTON ============
form.configureSubmitButton({
label: () => `🚀 Get My Report (${getScorePercentage()}% Ready)`
});
form.configureSubmitBehavior({
sendToServer: true
});
}