export function careerPathMatchQuiz(form: FormTs) {
form.setTitle(() => '🎯 Which Career Path Matches Your Strengths?');
// ============ SCORING SYSTEM ============
const scores = form.state<Record<string, number>>({});
const updateScore = (category: string, points: number) => {
scores.update(current => ({ ...current, [category]: (current[category] || 0) + points }));
};
const resetScores = () => {
scores.set({});
};
type CareerPath = 'tech' | 'creative' | 'business' | 'healthcare' | 'education';
const getTopCareerPath = (): CareerPath => {
const s = scores();
const paths: CareerPath[] = ['tech', 'creative', 'business', 'healthcare', 'education'];
let topPath: CareerPath = 'tech';
let maxScore = 0;
for (const path of paths) {
if ((s[path] || 0) > maxScore) {
maxScore = s[path] || 0;
topPath = path;
}
}
return topPath;
};
const getCareerLabel = (path: CareerPath) => {
const labels = {
tech: '💻 Technology & Engineering',
creative: '🎨 Creative & Design',
business: '📊 Business & Finance',
healthcare: '🏥 Healthcare & Science',
education: '📚 Education & Social Services'
};
return labels[path];
};
const getCareerDescription = (path: CareerPath) => {
const descriptions = {
tech: 'You thrive in analytical environments where you can solve complex problems and build innovative solutions. Consider roles like Software Developer, Data Scientist, Systems Architect, or Cybersecurity Analyst.',
creative: 'You have a natural talent for visual thinking and self-expression. Your creativity makes you perfect for roles like UX Designer, Marketing Creative, Video Producer, or Brand Strategist.',
business: 'You excel at strategic thinking and driving results. Your analytical mind and leadership potential make you ideal for Management Consulting, Financial Analysis, Product Management, or Entrepreneurship.',
healthcare: 'You\'re driven by helping others and have strong scientific aptitude. Consider paths like Nursing, Physical Therapy, Medical Research, Pharmacy, or Public Health.',
education: 'You find fulfillment in empowering others and creating positive change. Teaching, Counseling, Social Work, Training & Development, or Nonprofit Leadership would suit your strengths.'
};
return descriptions[path];
};
const getCareerEmoji = (path: CareerPath) => {
const emojis = { tech: '💻', creative: '🎨', business: '📊', healthcare: '🏥', education: '📚' };
return emojis[path];
};
const getCareerColor = (path: CareerPath) => {
const colors = {
tech: '#2563eb',
creative: '#9333ea',
business: '#059669',
healthcare: '#dc2626',
education: '#ea580c'
};
return colors[path];
};
// ============ COMPLETION SCREEN ============
form.configureCompletionScreen({
type: 'text',
title: () => `Your Ideal Career Path: ${getCareerLabel(getTopCareerPath())}`,
message: () => getCareerDescription(getTopCareerPath())
});
// ============ PAGES SETUP ============
const pages = form.addPages('quiz-pages', { heightMode: 'current-page' });
// ============ PAGE 1: Work Preferences ============
const page1 = pages.addPage('work-preferences', { mobileBreakpoint: 500 });
page1.addRow(row => {
row.addTextPanel('header1', {
label: 'Step 1 of 5: Work Preferences',
computedValue: () => 'What kind of work environment energizes you?',
customStyles: { fontSize: '0.9rem', color: '#6b7280', marginBottom: '1rem' }
});
});
page1.addSpacer({ height: '24px' });
page1.addRow(row => {
row.addRadioButton('workEnvironment', {
label: 'What type of environment do you prefer?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'structured', name: '🏢 Structured office with clear processes' },
{ id: 'flexible', name: '🏠 Flexible/remote with autonomy' },
{ id: 'collaborative', name: '👥 Team-based and collaborative' },
{ id: 'fast-paced', name: '⚡ Fast-paced and dynamic' },
{ id: 'quiet', name: '📚 Quiet and focused' }
],
onValueChange: (val) => {
if (val === 'structured') { updateScore('business', 3); updateScore('healthcare', 2); }
if (val === 'flexible') { updateScore('tech', 3); updateScore('creative', 2); }
if (val === 'collaborative') { updateScore('education', 3); updateScore('creative', 2); }
if (val === 'fast-paced') { updateScore('business', 3); updateScore('tech', 2); }
if (val === 'quiet') { updateScore('healthcare', 3); updateScore('tech', 2); }
}
});
});
page1.addRow(row => {
row.addRadioButton('workMotivation', {
label: 'What motivates you most at work?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'solving', name: '🧩 Solving complex problems' },
{ id: 'creating', name: '✨ Creating something new' },
{ id: 'leading', name: '🎯 Achieving targets and leading teams' },
{ id: 'helping', name: '💚 Helping people directly' },
{ id: 'teaching', name: '🌱 Teaching and developing others' }
],
onValueChange: (val) => {
if (val === 'solving') { updateScore('tech', 4); updateScore('healthcare', 2); }
if (val === 'creating') { updateScore('creative', 4); updateScore('tech', 1); }
if (val === 'leading') { updateScore('business', 4); updateScore('education', 1); }
if (val === 'helping') { updateScore('healthcare', 4); updateScore('education', 2); }
if (val === 'teaching') { updateScore('education', 4); updateScore('healthcare', 1); }
}
});
});
// ============ PAGE 2: Skills & Strengths ============
const page2 = pages.addPage('skills', { mobileBreakpoint: 500 });
page2.addRow(row => {
row.addTextPanel('header2', {
label: 'Step 2 of 5: Skills & Strengths',
computedValue: () => 'What are your natural talents?',
customStyles: { fontSize: '0.9rem', color: '#6b7280', marginBottom: '1rem' }
});
});
page2.addSpacer({ height: '24px' });
page2.addRow(row => {
row.addMatrixQuestion('skillsMatrix', {
label: 'Rate your proficiency in these areas:',
isRequired: true,
rows: [
{ id: 'analytical', label: 'Analytical Thinking', description: 'Logic, data analysis, problem-solving' },
{ id: 'creative', label: 'Creative Expression', description: 'Design, writing, artistic skills' },
{ id: 'communication', label: 'Communication', description: 'Speaking, writing, persuading' },
{ id: 'technical', label: 'Technical Skills', description: 'Computers, tools, systems' }
],
columns: [
{ id: 'weak', label: 'Developing' },
{ id: 'moderate', label: 'Competent' },
{ id: 'strong', label: 'Proficient' },
{ id: 'expert', label: 'Expert' }
],
selectionMode: 'single',
striped: true,
fullWidth: true,
onValueChange: (val) => {
if (!val) return;
const pointsMap: Record<string, number> = { weak: 1, moderate: 2, strong: 3, expert: 4 };
if (val['analytical']) {
const pts = pointsMap[val['analytical'] as string] || 0;
updateScore('tech', pts);
updateScore('business', pts);
}
if (val['creative']) {
const pts = pointsMap[val['creative'] as string] || 0;
updateScore('creative', pts * 1.5);
}
if (val['communication']) {
const pts = pointsMap[val['communication'] as string] || 0;
updateScore('education', pts);
updateScore('business', pts);
}
if (val['technical']) {
const pts = pointsMap[val['technical'] as string] || 0;
updateScore('tech', pts * 1.5);
updateScore('healthcare', pts * 0.5);
}
}
});
});
// ============ PAGE 3: Interests ============
const page3 = pages.addPage('interests', { mobileBreakpoint: 500 });
page3.addRow(row => {
row.addTextPanel('header3', {
label: 'Step 3 of 5: Interests',
computedValue: () => 'What subjects fascinate you?',
customStyles: { fontSize: '0.9rem', color: '#6b7280', marginBottom: '1rem' }
});
});
page3.addSpacer({ height: '24px' });
page3.addRow(row => {
row.addSuggestionChips('topInterests', {
label: 'Select your top 3 interests:',
isRequired: true,
min: 1,
max: 3,
suggestions: [
{ id: 'tech-innovation', name: '🤖 Technology & Innovation' },
{ id: 'art-design', name: '🎨 Art & Design' },
{ id: 'finance-markets', name: '💹 Finance & Markets' },
{ id: 'science-research', name: '🔬 Science & Research' },
{ id: 'psychology-behavior', name: '🧠 Psychology & Behavior' },
{ id: 'social-impact', name: '🌍 Social Impact' },
{ id: 'health-wellness', name: '💪 Health & Wellness' },
{ id: 'media-content', name: '📱 Media & Content' }
],
onValueChange: (val) => {
if (!val) return;
for (const interest of val) {
if (interest === 'tech-innovation') { updateScore('tech', 4); }
if (interest === 'art-design') { updateScore('creative', 4); }
if (interest === 'finance-markets') { updateScore('business', 4); }
if (interest === 'science-research') { updateScore('healthcare', 4); updateScore('tech', 1); }
if (interest === 'psychology-behavior') { updateScore('education', 3); updateScore('healthcare', 2); }
if (interest === 'social-impact') { updateScore('education', 4); }
if (interest === 'health-wellness') { updateScore('healthcare', 4); }
if (interest === 'media-content') { updateScore('creative', 3); updateScore('business', 1); }
}
}
});
});
page3.addRow(row => {
row.addRadioButton('learningStyle', {
label: 'How do you prefer to learn new things?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'hands-on', name: '🔧 Hands-on experimentation' },
{ id: 'reading', name: '📖 Reading and research' },
{ id: 'visual', name: '👁️ Visual learning (videos, diagrams)' },
{ id: 'discussion', name: '💬 Discussion and collaboration' },
{ id: 'courses', name: '🎓 Structured courses and training' }
],
onValueChange: (val) => {
if (val === 'hands-on') { updateScore('tech', 2); updateScore('creative', 2); }
if (val === 'reading') { updateScore('healthcare', 2); updateScore('business', 1); }
if (val === 'visual') { updateScore('creative', 3); }
if (val === 'discussion') { updateScore('education', 3); updateScore('business', 1); }
if (val === 'courses') { updateScore('business', 2); updateScore('healthcare', 1); }
}
});
});
// ============ PAGE 4: Values & Goals ============
const page4 = pages.addPage('values', { mobileBreakpoint: 500 });
page4.addRow(row => {
row.addTextPanel('header4', {
label: 'Step 4 of 5: Values & Goals',
computedValue: () => 'What matters most in your career?',
customStyles: { fontSize: '0.9rem', color: '#6b7280', marginBottom: '1rem' }
});
});
page4.addSpacer({ height: '24px' });
page4.addRow(row => {
row.addRatingScale('salaryImportance', {
label: 'How important is high earning potential?',
isRequired: true,
preset: 'custom',
min: 1,
max: 5,
lowLabel: 'Not important',
highLabel: 'Very important',
size: 'md',
variant: 'segmented',
onValueChange: (val) => {
if (val == null) return;
if (val >= 4) { updateScore('business', 3); updateScore('tech', 2); }
if (val <= 2) { updateScore('education', 2); updateScore('healthcare', 1); }
}
});
});
page4.addRow(row => {
row.addRatingScale('stabilityImportance', {
label: 'How important is job stability?',
isRequired: true,
preset: 'custom',
min: 1,
max: 5,
lowLabel: 'Prefer variety',
highLabel: 'Need stability',
size: 'md',
variant: 'segmented',
onValueChange: (val) => {
if (val == null) return;
if (val >= 4) { updateScore('healthcare', 3); updateScore('education', 2); }
if (val <= 2) { updateScore('creative', 2); updateScore('business', 1); }
}
});
});
page4.addRow(row => {
row.addRadioButton('careerGoal', {
label: 'What\'s your primary career goal?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'expert', name: '🏆 Become a recognized expert in my field' },
{ id: 'leader', name: '👔 Lead teams and organizations' },
{ id: 'entrepreneur', name: '🚀 Start my own business/venture' },
{ id: 'balance', name: '⚖️ Achieve work-life balance' },
{ id: 'impact', name: '🌟 Make a meaningful difference' }
],
onValueChange: (val) => {
if (val === 'expert') { updateScore('tech', 2); updateScore('healthcare', 2); }
if (val === 'leader') { updateScore('business', 4); }
if (val === 'entrepreneur') { updateScore('business', 3); updateScore('creative', 2); }
if (val === 'balance') { updateScore('education', 2); updateScore('healthcare', 1); }
if (val === 'impact') { updateScore('education', 3); updateScore('healthcare', 2); }
}
});
});
// ============ PAGE 5: Results ============
const page5 = pages.addPage('results', { mobileBreakpoint: 500 });
page5.addRow(row => {
row.addTextPanel('header5', {
label: 'Step 5 of 5: Your Career Match',
computedValue: () => 'Based on your responses, here\'s your ideal career path',
customStyles: { fontSize: '0.9rem', color: '#6b7280', marginBottom: '1rem' }
});
});
page5.addSpacer({ height: '24px' });
page5.addRow(row => {
row.addTextPanel('mainResult', {
computedValue: () => getCareerLabel(getTopCareerPath()),
customStyles: () => ({
fontSize: '1.5rem',
fontWeight: '800',
textAlign: 'center',
color: getCareerColor(getTopCareerPath()),
padding: '20px',
background: '#f9fafb',
borderRadius: '12px',
border: `3px solid ${getCareerColor(getTopCareerPath())}`
})
});
});
page5.addRow(row => {
row.addTextPanel('resultDescription', {
computedValue: () => getCareerDescription(getTopCareerPath()),
customStyles: {
fontSize: '1rem',
color: '#374151',
textAlign: 'center',
padding: '15px',
lineHeight: '1.6',
marginTop: '15px'
}
});
});
// Collapsible score breakdown
const breakdown = page5.addSubform('scoreBreakdown', {
title: '📊 Full Score Breakdown (click to expand)',
isCollapsible: true,
customStyles: { marginTop: '1rem', background: '#f9fafb', borderRadius: '8px' }
});
breakdown.addRow(row => {
row.addTextPanel('techScore', {
label: '💻 Technology',
computedValue: () => `${scores()['tech'] || 0} points`,
customStyles: { fontSize: '0.9rem', padding: '8px 12px', background: '#dbeafe', borderRadius: '6px' }
}, '1fr');
row.addTextPanel('creativeScore', {
label: '🎨 Creative',
computedValue: () => `${scores()['creative'] || 0} points`,
customStyles: { fontSize: '0.9rem', padding: '8px 12px', background: '#f3e8ff', borderRadius: '6px' }
}, '1fr');
});
breakdown.addRow(row => {
row.addTextPanel('businessScore', {
label: '📊 Business',
computedValue: () => `${scores()['business'] || 0} points`,
customStyles: { fontSize: '0.9rem', padding: '8px 12px', background: '#dcfce7', borderRadius: '6px' }
}, '1fr');
row.addTextPanel('healthcareScore', {
label: '🏥 Healthcare',
computedValue: () => `${scores()['healthcare'] || 0} points`,
customStyles: { fontSize: '0.9rem', padding: '8px 12px', background: '#fee2e2', borderRadius: '6px' }
}, '1fr');
});
breakdown.addRow(row => {
row.addTextPanel('educationScore', {
label: '📚 Education',
computedValue: () => `${scores()['education'] || 0} points`,
customStyles: { fontSize: '0.9rem', padding: '8px 12px', background: '#ffedd5', borderRadius: '6px' }
}, '1fr');
row.addEmpty('1fr');
});
// ============ PAGE 6: Lead Capture ============
const page6 = pages.addPage('lead-capture', { mobileBreakpoint: 500 });
page6.addRow(row => {
row.addTextPanel('header6', {
label: 'Step 6 of 6: Get Your Career Guide',
computedValue: () => 'Enter your details to receive your personalized career action plan',
customStyles: { fontSize: '0.9rem', color: '#6b7280', marginBottom: '1rem' }
});
});
page6.addSpacer({ height: '24px' });
page6.addRow(row => {
row.addTextbox('name', { label: 'Your Name', isRequired: true, placeholder: 'Jane Doe' }, '1fr');
row.addEmail('email', { label: 'Email', isRequired: true, placeholder: 'jane@email.com' }, '1fr');
});
page6.addRow(row => {
row.addDropdown('experience', {
label: 'Years of Work Experience',
options: [
{ id: 'student', name: 'Student / New Graduate' },
{ id: '1-3', name: '1-3 years' },
{ id: '4-7', name: '4-7 years' },
{ id: '8-15', name: '8-15 years' },
{ id: '15+', name: '15+ years' }
],
placeholder: 'Select experience level'
}, '1fr');
row.addDropdown('education', {
label: 'Highest Education',
options: [
{ id: 'high-school', name: 'High School' },
{ id: 'bachelor', name: 'Bachelor\'s Degree' },
{ id: 'master', name: 'Master\'s Degree' },
{ id: 'phd', name: 'PhD / Doctorate' },
{ id: 'other', name: 'Other / Self-taught' }
],
placeholder: 'Select education'
}, '1fr');
});
page6.addRow(row => {
row.addCheckboxList('consent', {
options: [
{ id: 'report', name: '📄 Send me my personalized career report', isRequired: true },
{ id: 'tips', name: '💡 Send me career tips and job market insights' },
{ id: 'coaching', name: '📞 I\'m interested in career coaching' }
],
defaultValue: ['report'],
orientation: 'vertical'
});
});
// ============ PDF REPORT ============
form.configurePdf('career-report', pdf => {
pdf.configure({
filename: 'career-path-match-report.pdf',
pageSize: 'A4',
allowUserDownload: true,
downloadButtonLabel: '📄 Download Career Report',
header: { title: 'Career Path Match Report', subtitle: 'Personalized Career Analysis' },
footer: { text: 'Generated by FormTs Career Assessment', showPageNumbers: true }
});
pdf.addSection('Your Career Match', section => {
section.addRow(row => {
row.addField('Best Match', getCareerLabel(getTopCareerPath()));
row.addField('Assessment Date', new Date().toLocaleDateString());
});
section.addText(getCareerDescription(getTopCareerPath()));
});
pdf.addSection('Score Breakdown', section => {
const s = scores();
section.addTable(
['Career Path', 'Score', 'Match Level'],
[
['Technology & Engineering', `${s['tech'] || 0}`, (s['tech'] || 0) >= 15 ? '✅ Strong' : '➖ Moderate'],
['Creative & Design', `${s['creative'] || 0}`, (s['creative'] || 0) >= 15 ? '✅ Strong' : '➖ Moderate'],
['Business & Finance', `${s['business'] || 0}`, (s['business'] || 0) >= 15 ? '✅ Strong' : '➖ Moderate'],
['Healthcare & Science', `${s['healthcare'] || 0}`, (s['healthcare'] || 0) >= 15 ? '✅ Strong' : '➖ Moderate'],
['Education & Social Services', `${s['education'] || 0}`, (s['education'] || 0) >= 15 ? '✅ Strong' : '➖ Moderate']
]
);
});
pdf.addPageBreak();
pdf.addSection('Recommended Next Steps', section => {
section.addText('1. Research roles in your matched career path');
section.addText('2. Identify skills gaps and create a learning plan');
section.addText('3. Connect with professionals in your target field');
section.addText('4. Update your resume to highlight relevant strengths');
section.addText('5. Start networking on LinkedIn and industry events');
});
});
// ============ SUBMIT BUTTON ============
form.configureSubmitButton({
label: () => `🎯 Get My Career Guide`
});
form.configureSubmitBehavior({ sendToServer: true });
}