export function franchiseReadinessQuiz(form: FormTs) {
form.setTitle(() => '🏪 Are You Ready to Franchise?');
// ============ 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' | 'developing' | 'almost-ready' | 'ready' => {
const pct = getScorePercentage();
if (pct >= 80) return 'ready';
if (pct >= 60) return 'almost-ready';
if (pct >= 40) return 'developing';
return 'not-ready';
};
const getReadinessLabel = () => {
const level = getReadinessLevel();
const labels = {
'not-ready': '🔴 Not Ready Yet',
'developing': '🟡 Building Foundation',
'almost-ready': '🟢 Almost Ready',
'ready': '✅ Franchise Ready!'
};
return labels[level];
};
const getReadinessColor = () => {
const level = getReadinessLevel();
const colors = {
'not-ready': '#dc2626',
'developing': '#ca8a04',
'almost-ready': '#059669',
'ready': '#16a34a'
};
return colors[level];
};
const getReadinessAdvice = () => {
const level = getReadinessLevel();
const advice = {
'not-ready': 'Your business needs more development before franchising. Focus on building a stronger foundation with documented systems, proven profitability, and brand recognition. Consider working with a franchise consultant to identify gaps.',
'developing': 'You\'re making progress toward franchise readiness. Key areas need strengthening - focus on documenting your operations, building your brand, and proving your business model in multiple scenarios before expanding.',
'almost-ready': 'You\'re close to being franchise-ready! Fine-tune your operations manual, strengthen your support systems, and ensure your financial projections are solid. A franchise attorney can help with the legal framework.',
'ready': 'Congratulations! Your business shows strong franchise potential. You have the systems, brand strength, and financial foundation to support franchisees. Consider engaging franchise development experts to help structure your offering.'
};
return advice[level];
};
// ============ COMPLETION SCREEN ============
form.configureCompletionScreen({
type: 'text',
title: () => getReadinessLabel(),
message: () => `Your franchise readiness score is ${getScorePercentage()}%. ${getReadinessAdvice()}`
});
// ============ PAGES SETUP ============
const pages = form.addPages('quiz-pages', { heightMode: 'current-page' });
// ============ PAGE 1: Business Foundation ============
const page1 = pages.addPage('foundation', { mobileBreakpoint: 500 });
page1.addRow(row => {
row.addTextPanel('header1', {
label: 'Step 1 of 6: Business Foundation',
computedValue: () => 'Is your business model ready to be replicated?',
customStyles: { fontSize: '0.9rem', color: '#6b7280', marginBottom: '1rem' }
});
});
page1.addSpacer({ height: '24px' });
page1.addRow(row => {
row.addDropdown('yearsOperating', {
label: 'How long has your business been operating?',
isRequired: true,
options: [
{ id: 'under-1', name: 'Less than 1 year' },
{ id: '1-2', name: '1-2 years' },
{ id: '3-5', name: '3-5 years' },
{ id: '5-10', name: '5-10 years' },
{ id: 'over-10', name: 'Over 10 years' }
],
placeholder: 'Select years in business',
onValueChange: (val) => {
const points: Record<string, number> = { 'under-1': 2, '1-2': 5, '3-5': 8, '5-10': 10, 'over-10': 10 };
updateScore('years', points[val as string] || 0);
}
}, '1fr');
row.addDropdown('locations', {
label: 'How many locations do you operate?',
isRequired: true,
options: [
{ id: '1', name: '1 location' },
{ id: '2-3', name: '2-3 locations' },
{ id: '4-5', name: '4-5 locations' },
{ id: '6+', name: '6+ locations' }
],
placeholder: 'Select location count',
onValueChange: (val) => {
const points: Record<string, number> = { '1': 3, '2-3': 7, '4-5': 9, '6+': 10 };
updateScore('locations', points[val as string] || 0);
}
}, '1fr');
});
page1.addRow(row => {
row.addRadioButton('profitability', {
label: 'Is your business consistently profitable?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'highly', name: '💰 Yes, highly profitable for 3+ years' },
{ id: 'profitable', name: '✅ Yes, profitable for 1-2 years' },
{ id: 'breakeven', name: '➖ Breaking even' },
{ id: 'loss', name: '❌ Not yet profitable' }
],
onValueChange: (val) => {
const points: Record<string, number> = { highly: 10, profitable: 7, breakeven: 3, loss: 0 };
updateScore('profitability', points[val as string] || 0);
}
});
});
// ============ PAGE 2: Systems & Documentation ============
const page2 = pages.addPage('systems', { mobileBreakpoint: 500 });
page2.addRow(row => {
row.addTextPanel('header2', {
label: 'Step 2 of 6: Systems & Documentation',
computedValue: () => 'Can your business operations be taught to others?',
customStyles: { fontSize: '0.9rem', color: '#6b7280', marginBottom: '1rem' }
});
});
page2.addSpacer({ height: '24px' });
page2.addRow(row => {
row.addMatrixQuestion('systemsMatrix', {
label: 'Rate the documentation level of these business areas:',
isRequired: true,
rows: [
{ id: 'operations', label: 'Daily Operations', description: 'SOPs, checklists, procedures' },
{ id: 'training', label: 'Training Materials', description: 'Employee onboarding, skills training' },
{ id: 'marketing', label: 'Marketing Playbook', description: 'Brand guidelines, campaigns, strategies' },
{ id: 'financial', label: 'Financial Systems', description: 'Accounting, reporting, budgeting' }
],
columns: [
{ id: 'none', label: 'None' },
{ id: 'basic', label: 'Basic' },
{ id: 'good', label: 'Good' },
{ id: 'excellent', label: 'Excellent' }
],
selectionMode: 'single',
striped: true,
fullWidth: true,
onValueChange: (val) => {
if (!val) return;
const pointsMap: Record<string, number> = { none: 0, basic: 1, good: 2, excellent: 3 };
let total = 0;
for (const [, col] of Object.entries(val)) {
total += pointsMap[col as string] || 0;
}
updateScore('systems', Math.round(total * 2.5)); // Max 30 points
}
});
});
page2.addRow(row => {
row.addRadioButton('techSystems', {
label: 'Do you have technology systems that can be replicated?',
tooltip: 'POS systems, inventory management, CRM, etc.',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'comprehensive', name: '💻 Yes, comprehensive tech stack in place' },
{ id: 'partial', name: '📱 Some systems, others need development' },
{ id: 'basic', name: '📊 Basic tools only (spreadsheets, etc.)' },
{ id: 'none', name: '❌ No standardized technology' }
],
onValueChange: (val) => {
const points: Record<string, number> = { comprehensive: 10, partial: 6, basic: 3, none: 0 };
updateScore('tech', points[val as string] || 0);
}
});
});
// ============ PAGE 3: Brand & Market ============
const page3 = pages.addPage('brand', { mobileBreakpoint: 500 });
page3.addRow(row => {
row.addTextPanel('header3', {
label: 'Step 3 of 6: Brand & Market',
computedValue: () => 'Is your brand strong enough to attract franchisees?',
customStyles: { fontSize: '0.9rem', color: '#6b7280', marginBottom: '1rem' }
});
});
page3.addSpacer({ height: '24px' });
page3.addRow(row => {
row.addRatingScale('brandRecognition', {
label: 'How strong is your brand recognition in your market?',
isRequired: true,
preset: 'custom',
min: 1,
max: 5,
lowLabel: 'Unknown',
highLabel: 'Market Leader',
size: 'md',
variant: 'segmented',
onValueChange: (val) => {
if (val == null) return;
updateScore('brand', val * 2); // Max 10 points
}
});
});
page3.addRow(row => {
row.addSuggestionChips('brandAssets', {
label: 'Which brand assets do you have? (select all)',
isRequired: true,
min: 1,
suggestions: [
{ id: 'trademark', name: '™️ Registered Trademark' },
{ id: 'logo', name: '🎨 Professional Logo & Guidelines' },
{ id: 'website', name: '🌐 Strong Web Presence' },
{ id: 'social', name: '📱 Active Social Media' },
{ id: 'reviews', name: '⭐ Positive Online Reviews' },
{ id: 'pr', name: '📰 Media Coverage' }
],
onValueChange: (val) => {
if (!val) return;
// Each asset worth up to 1.5 points, max 9
updateScore('brandAssets', Math.min(Math.round(val.length * 1.5), 9));
}
});
});
page3.addRow(row => {
row.addRadioButton('marketDemand', {
label: 'Is there proven demand for your product/service?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'high', name: '📈 Strong growth market with proven demand' },
{ id: 'moderate', name: '📊 Stable market with steady demand' },
{ id: 'niche', name: '🎯 Niche market with specific audience' },
{ id: 'unknown', name: '❓ Unproven or declining market' }
],
onValueChange: (val) => {
const points: Record<string, number> = { high: 8, moderate: 6, niche: 4, unknown: 2 };
updateScore('market', points[val as string] || 0);
}
});
});
// ============ PAGE 4: Financial Readiness ============
const page4 = pages.addPage('financial', { mobileBreakpoint: 500 });
page4.addRow(row => {
row.addTextPanel('header4', {
label: 'Step 4 of 6: Financial Readiness',
computedValue: () => 'Do you have the financial resources to support franchisees?',
customStyles: { fontSize: '0.9rem', color: '#6b7280', marginBottom: '1rem' }
});
});
page4.addSpacer({ height: '24px' });
page4.addRow(row => {
row.addDropdown('capitalAvailable', {
label: 'Capital available for franchise development',
isRequired: true,
options: [
{ id: 'under-50k', name: 'Under $50,000' },
{ id: '50k-100k', name: '$50,000 - $100,000' },
{ id: '100k-250k', name: '$100,000 - $250,000' },
{ id: '250k-500k', name: '$250,000 - $500,000' },
{ id: 'over-500k', name: 'Over $500,000' }
],
placeholder: 'Select capital range',
onValueChange: (val) => {
const points: Record<string, number> = { 'under-50k': 2, '50k-100k': 4, '100k-250k': 6, '250k-500k': 8, 'over-500k': 10 };
updateScore('capital', points[val as string] || 0);
}
}, '1fr');
row.addDropdown('annualRevenue', {
label: 'Annual revenue (per location)',
isRequired: true,
options: [
{ id: 'under-250k', name: 'Under $250,000' },
{ id: '250k-500k', name: '$250,000 - $500,000' },
{ id: '500k-1m', name: '$500,000 - $1 million' },
{ id: '1m-5m', name: '$1 - $5 million' },
{ id: 'over-5m', name: 'Over $5 million' }
],
placeholder: 'Select revenue range',
onValueChange: (val) => {
const points: Record<string, number> = { 'under-250k': 2, '250k-500k': 4, '500k-1m': 6, '1m-5m': 8, 'over-5m': 10 };
updateScore('revenue', points[val as string] || 0);
}
}, '1fr');
});
page4.addRow(row => {
row.addRadioButton('unitEconomics', {
label: 'Can you demonstrate clear unit economics to potential franchisees?',
tooltip: 'Startup costs, operating costs, revenue projections, ROI timeline',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'detailed', name: '📊 Yes, detailed P&L with 3+ years of data' },
{ id: 'basic', name: '📈 Basic financials available' },
{ id: 'developing', name: '📝 Working on financial modeling' },
{ id: 'no', name: '❌ Not yet documented' }
],
onValueChange: (val) => {
const points: Record<string, number> = { detailed: 10, basic: 6, developing: 3, no: 0 };
updateScore('unitEcon', points[val as string] || 0);
}
});
});
// ============ PAGE 5: Support Capability ============
const page5 = pages.addPage('support', { mobileBreakpoint: 500 });
page5.addRow(row => {
row.addTextPanel('header5', {
label: 'Step 5 of 6: Support Capability',
computedValue: () => 'Can you support franchisees for long-term success?',
customStyles: { fontSize: '0.9rem', color: '#6b7280', marginBottom: '1rem' }
});
});
page5.addSpacer({ height: '24px' });
page5.addRow(row => {
row.addRadioButton('teamCapacity', {
label: 'Do you have a team to support franchise operations?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'dedicated', name: '👥 Dedicated franchise support team' },
{ id: 'existing', name: '🏢 Existing team can support initially' },
{ id: 'hire', name: '📋 Plan to hire for franchise support' },
{ id: 'solo', name: '👤 Currently operating solo' }
],
onValueChange: (val) => {
const points: Record<string, number> = { dedicated: 10, existing: 7, hire: 4, solo: 2 };
updateScore('team', points[val as string] || 0);
}
});
});
page5.addRow(row => {
row.addCheckboxList('supportCapabilities', {
label: 'Which support services can you provide?',
orientation: 'vertical',
options: [
{ id: 'siteSelection', name: '📍 Site selection assistance' },
{ id: 'buildout', name: '🏗️ Buildout/design support' },
{ id: 'training', name: '🎓 Initial training program' },
{ id: 'ongoing', name: '🔄 Ongoing operational support' },
{ id: 'marketing', name: '📢 Marketing support' },
{ id: 'tech', name: '💻 Technology/systems support' }
],
onValueChange: (val) => {
if (!val) return;
// Each capability worth ~1.7 points, max 10
updateScore('support', Math.min(Math.round(val.length * 1.7), 10));
}
});
});
page5.addRow(row => {
row.addRadioButton('legalReady', {
label: 'Have you consulted with a franchise attorney?',
isRequired: true,
orientation: 'horizontal',
options: [
{ id: 'yes', name: 'Yes, FDD prepared' },
{ id: 'started', name: 'In progress' },
{ id: 'no', name: 'Not yet' }
],
onValueChange: (val) => {
const points: Record<string, number> = { yes: 5, started: 3, no: 0 };
updateScore('legal', points[val as string] || 0);
}
});
});
// ============ PAGE 6: Results ============
const page6 = pages.addPage('results', { mobileBreakpoint: 500 });
page6.addRow(row => {
row.addTextPanel('header6', {
label: 'Step 6 of 6: Your Franchise Readiness Score',
computedValue: () => 'Here\'s your franchise expansion readiness assessment',
customStyles: { fontSize: '0.9rem', color: '#6b7280', marginBottom: '1rem' }
});
});
page6.addSpacer({ height: '24px' });
page6.addRow(row => {
row.addTextPanel('mainScore', {
computedValue: () => `${getScorePercentage()}%`,
customStyles: () => ({
fontSize: '3rem',
fontWeight: '800',
textAlign: 'center',
color: getReadinessColor(),
padding: '20px',
background: '#f9fafb',
borderRadius: '12px',
border: `4px solid ${getReadinessColor()}`
})
});
});
page6.addRow(row => {
row.addTextPanel('readinessLevel', {
computedValue: () => getReadinessLabel(),
customStyles: () => ({
fontSize: '1.3rem',
fontWeight: '700',
textAlign: 'center',
color: getReadinessColor(),
marginTop: '10px'
})
});
});
page6.addRow(row => {
row.addTextPanel('advice', {
computedValue: () => getReadinessAdvice(),
customStyles: {
fontSize: '0.95rem',
color: '#374151',
textAlign: 'center',
padding: '15px',
background: '#f3f4f6',
borderRadius: '8px',
lineHeight: '1.6',
marginTop: '15px'
}
});
});
// Score breakdown
const breakdown = page6.addSubform('scoreBreakdown', {
title: '📊 Detailed Score Breakdown',
isCollapsible: true,
customStyles: { marginTop: '1rem', background: '#f9fafb', borderRadius: '8px' }
});
breakdown.addRow(row => {
row.addTextPanel('foundationScore', {
label: '🏢 Business Foundation',
computedValue: () => {
const s = scores();
const total = (s['years'] || 0) + (s['locations'] || 0) + (s['profitability'] || 0);
return `${total}/30`;
},
customStyles: { fontSize: '0.9rem', padding: '8px', background: '#dbeafe', borderRadius: '6px' }
}, '1fr');
row.addTextPanel('systemsScore', {
label: '📋 Systems & Documentation',
computedValue: () => {
const s = scores();
const total = (s['systems'] || 0) + (s['tech'] || 0);
return `${total}/20`;
},
customStyles: { fontSize: '0.9rem', padding: '8px', background: '#dcfce7', borderRadius: '6px' }
}, '1fr');
});
breakdown.addRow(row => {
row.addTextPanel('brandScore', {
label: '🏪 Brand & Market',
computedValue: () => {
const s = scores();
const total = (s['brand'] || 0) + (s['brandAssets'] || 0) + (s['market'] || 0);
return `${total}/27`;
},
customStyles: { fontSize: '0.9rem', padding: '8px', background: '#fef3c7', borderRadius: '6px' }
}, '1fr');
row.addTextPanel('financialScore', {
label: '💰 Financial Readiness',
computedValue: () => {
const s = scores();
const total = (s['capital'] || 0) + (s['revenue'] || 0) + (s['unitEcon'] || 0);
return `${total}/30`;
},
customStyles: { fontSize: '0.9rem', padding: '8px', background: '#fee2e2', borderRadius: '6px' }
}, '1fr');
});
breakdown.addRow(row => {
row.addTextPanel('supportScore', {
label: '🤝 Support Capability',
computedValue: () => {
const s = scores();
const total = (s['team'] || 0) + (s['support'] || 0) + (s['legal'] || 0);
return `${total}/25`;
},
customStyles: { fontSize: '0.9rem', padding: '8px', background: '#f3e8ff', 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: 'Get Your Franchise Readiness Report',
computedValue: () => 'Download your detailed assessment and action plan',
customStyles: { fontSize: '0.9rem', color: '#6b7280', marginBottom: '1rem' }
});
});
page7.addSpacer({ height: '24px' });
page7.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');
});
page7.addRow(row => {
row.addTextbox('company', { label: 'Business Name', isRequired: true, placeholder: 'ABC Company' }, '1fr');
row.addTextbox('phone', { label: 'Phone', placeholder: '(555) 123-4567' }, '1fr');
});
page7.addRow(row => {
row.addDropdown('timeline', {
label: 'Franchise Development Timeline',
options: [
{ id: 'exploring', name: 'Just exploring the idea' },
{ id: '6-12', name: 'Within 6-12 months' },
{ id: '1-2', name: '1-2 years' },
{ id: 'ready', name: 'Ready to start now' }
],
placeholder: 'Select your timeline'
});
});
page7.addRow(row => {
row.addCheckboxList('consent', {
options: [
{ id: 'report', name: '📄 Send me my franchise readiness report', isRequired: true },
{ id: 'resources', name: '📚 Send me franchise development resources' },
{ id: 'consultant', name: '📞 Connect me with a franchise consultant' }
],
defaultValue: ['report'],
orientation: 'vertical'
});
});
// ============ PDF REPORT ============
form.configurePdf('franchise-report', pdf => {
pdf.configure({
filename: 'franchise-readiness-report.pdf',
pageSize: 'A4',
allowUserDownload: true,
downloadButtonLabel: '📄 Download Franchise Report',
header: { title: 'Franchise Readiness Assessment', subtitle: 'Expansion Readiness Report' },
footer: { text: 'Generated by FormTs Franchise Assessment', showPageNumbers: true }
});
pdf.addSection('Executive Summary', section => {
section.addRow(row => {
row.addField('Readiness Score', `${getScorePercentage()}%`);
row.addField('Readiness Level', getReadinessLabel());
});
section.addRow(row => {
row.addField('Assessment Date', new Date().toLocaleDateString());
row.addField('Max Possible Score', '100%');
});
section.addSpacer(10);
section.addText(getReadinessAdvice());
});
pdf.addSection('Category Breakdown', section => {
const s = scores();
section.addTable(
['Category', 'Score', 'Max', 'Status'],
[
['Business Foundation', `${(s['years'] || 0) + (s['locations'] || 0) + (s['profitability'] || 0)}`, '30', getScorePercentage() >= 70 ? '✅ Strong' : '⚠️ Needs Work'],
['Systems & Documentation', `${(s['systems'] || 0) + (s['tech'] || 0)}`, '20', (s['systems'] || 0) >= 15 ? '✅ Strong' : '⚠️ Needs Work'],
['Brand & Market', `${(s['brand'] || 0) + (s['brandAssets'] || 0) + (s['market'] || 0)}`, '27', (s['brand'] || 0) >= 6 ? '✅ Strong' : '⚠️ Needs Work'],
['Financial Readiness', `${(s['capital'] || 0) + (s['revenue'] || 0) + (s['unitEcon'] || 0)}`, '30', (s['unitEcon'] || 0) >= 6 ? '✅ Strong' : '⚠️ Needs Work'],
['Support Capability', `${(s['team'] || 0) + (s['support'] || 0) + (s['legal'] || 0)}`, '25', (s['team'] || 0) >= 7 ? '✅ Strong' : '⚠️ Needs Work']
]
);
});
pdf.addPageBreak();
pdf.addSection('Recommended Next Steps', section => {
const level = getReadinessLevel();
if (level === 'not-ready' || level === 'developing') {
section.addText('1. Document all operational procedures and create an operations manual');
section.addText('2. Prove consistent profitability across multiple months/years');
section.addText('3. Develop and protect your brand with trademark registration');
section.addText('4. Build technology systems that can be replicated');
section.addText('5. Consider opening a second company-owned location to test replicability');
} else {
section.addText('1. Engage a franchise attorney to prepare your FDD');
section.addText('2. Develop comprehensive training programs');
section.addText('3. Build your franchise support infrastructure');
section.addText('4. Create detailed financial projections for franchisees');
section.addText('5. Develop your franchisee recruitment strategy');
}
});
});
// ============ SUBMIT BUTTON ============
form.configureSubmitButton({
label: () => `🏪 Get My Franchise Report (${getScorePercentage()}%)`
});
form.configureSubmitBehavior({ sendToServer: true });
}