export function consultingFeedback(form: FormTs) {
// Consulting Engagement Feedback - Comprehensive B2B engagement review
// Demonstrates: RatingScale (NPS), StarRating, MatrixQuestion, Slider (ROI), Pages, computed values
// ============================================
// HEADER
// ============================================
form.addRow(row => {
row.addTextPanel('header', {
label: 'Engagement Feedback Survey',
computedValue: () => 'Your feedback helps us deliver even greater value. Please share your experience with our consulting engagement.',
customStyles: {
background: 'linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%)',
color: 'white',
padding: '28px',
borderRadius: '12px',
textAlign: 'center'
}
});
});
// ============================================
// MULTI-PAGE WIZARD
// ============================================
const pages = form.addPages('surveyPages', { heightMode: 'current-page' });
// ============================================
// PAGE 1: Engagement Overview
// ============================================
const page1 = pages.addPage('engagementOverview');
page1.addRow(row => {
row.addTextPanel('page1Title', {
label: 'Engagement Details',
customStyles: {
fontSize: '18px',
fontWeight: 'bold',
color: '#1e3a5f',
marginBottom: '8px'
}
});
});
page1.addRow(row => {
row.addDropdown('serviceType', {
label: 'What type of consulting service did you receive?',
options: [
{ id: 'strategy', name: 'Strategy Consulting' },
{ id: 'management', name: 'Management Consulting' },
{ id: 'digital', name: 'Digital Transformation' },
{ id: 'operations', name: 'Operations Improvement' },
{ id: 'hr', name: 'HR & Organizational' },
{ id: 'finance', name: 'Financial Advisory' },
{ id: 'technology', name: 'Technology Consulting' },
{ id: 'marketing', name: 'Marketing Strategy' },
{ id: 'other', name: 'Other' }
],
isRequired: true,
placeholder: 'Select service type...'
}, '1fr');
row.addDropdown('engagementDuration', {
label: 'Engagement duration',
options: [
{ id: 'less-1-month', name: 'Less than 1 month' },
{ id: '1-3-months', name: '1-3 months' },
{ id: '3-6-months', name: '3-6 months' },
{ id: '6-12-months', name: '6-12 months' },
{ id: 'over-12-months', name: 'Over 12 months' }
],
isRequired: true
}, '1fr');
});
page1.addRow(row => {
row.addTextbox('projectName', {
label: 'Project/Engagement name (optional)',
placeholder: 'e.g., Digital Transformation Initiative'
}, '1fr');
row.addDatepicker('completionDate', {
label: 'Completion date',
maxDate: () => new Date().toISOString().split('T')[0]
}, '1fr');
});
page1.addRow(row => {
row.addRadioButton('clientRole', {
label: 'Your role in this engagement',
options: [
{ id: 'sponsor', name: 'Executive Sponsor' },
{ id: 'project-lead', name: 'Project Lead' },
{ id: 'stakeholder', name: 'Key Stakeholder' },
{ id: 'team-member', name: 'Team Member' },
{ id: 'end-user', name: 'End User' }
],
orientation: 'horizontal'
});
});
// Navigation
page1.addSpacer({ height: '20px' });
page1.addRow(row => {
row.addButton('toPage2', {
label: 'Next: Consultant Evaluation',
onClick: () => pages.goToPage('consultantEval')
});
});
// ============================================
// PAGE 2: Consultant Evaluation
// ============================================
const page2 = pages.addPage('consultantEval');
page2.addRow(row => {
row.addTextPanel('page2Title', {
label: 'Consultant Team Evaluation',
customStyles: {
fontSize: '18px',
fontWeight: 'bold',
color: '#1e3a5f',
marginBottom: '8px'
}
});
});
page2.addRow(row => {
row.addTextbox('leadConsultant', {
label: 'Lead consultant name (optional)',
placeholder: 'Enter name if you remember'
});
});
// Consultant competency matrix
page2.addRow(row => {
row.addMatrixQuestion('consultantRatings', {
label: 'Rate the consulting team on the following competencies',
rows: [
{ id: 'expertise', label: 'Industry/Domain Expertise', isRequired: true },
{ id: 'problem-solving', label: 'Problem-Solving Ability', isRequired: true },
{ id: 'communication', label: 'Communication Skills', isRequired: true },
{ id: 'responsiveness', label: 'Responsiveness', isRequired: true },
{ id: 'professionalism', label: 'Professionalism', isRequired: false },
{ id: 'collaboration', label: 'Collaboration with Your Team', isRequired: false }
],
columns: [
{ id: '1', label: 'Poor' },
{ id: '2', label: 'Fair' },
{ id: '3', label: 'Good' },
{ id: '4', label: 'Very Good' },
{ id: '5', label: 'Excellent' }
],
fullWidth: true
});
});
// Consultant highlights
page2.addSpacer({ height: '16px' });
page2.addRow(row => {
row.addTextarea('consultantStrengths', {
label: 'What did the consulting team do particularly well?',
placeholder: 'Share specific examples of excellent work...',
rows: 3
});
});
// Navigation
page2.addSpacer({ height: '20px' });
page2.addRow(row => {
row.addButton('backToPage1', {
label: 'Back',
onClick: () => pages.goToPage('engagementOverview')
}, '1fr');
row.addButton('toPage3', {
label: 'Next: Deliverables & Quality',
onClick: () => pages.goToPage('deliverables')
}, '1fr');
});
// ============================================
// PAGE 3: Deliverables & Quality
// ============================================
const page3 = pages.addPage('deliverables');
page3.addRow(row => {
row.addTextPanel('page3Title', {
label: 'Deliverables & Quality',
customStyles: {
fontSize: '18px',
fontWeight: 'bold',
color: '#1e3a5f',
marginBottom: '8px'
}
});
});
page3.addRow(row => {
row.addStarRating('deliverableQuality', {
label: 'Quality of Deliverables',
maxStars: 5,
size: 'lg',
alignment: 'center'
});
});
page3.addRow(row => {
row.addStarRating('recommendationQuality', {
label: 'Actionability of Recommendations',
maxStars: 5,
size: 'lg',
alignment: 'center'
});
});
page3.addRow(row => {
row.addStarRating('timeliness', {
label: 'Timeliness of Delivery',
maxStars: 5,
size: 'lg',
alignment: 'center'
});
});
// Deliverable matrix
page3.addSpacer({ height: '16px' });
page3.addRow(row => {
row.addMatrixQuestion('deliverableRatings', {
label: 'Rate the following aspects of the deliverables',
rows: [
{ id: 'clarity', label: 'Clarity & Organization', isRequired: false },
{ id: 'insights', label: 'Depth of Insights', isRequired: false },
{ id: 'data', label: 'Data & Evidence Quality', isRequired: false },
{ id: 'relevance', label: 'Relevance to Your Needs', isRequired: false },
{ id: 'presentation', label: 'Presentation Quality', isRequired: false }
],
columns: [
{ id: '1', label: 'Poor' },
{ id: '2', label: 'Fair' },
{ id: '3', label: 'Good' },
{ id: '4', label: 'Very Good' },
{ id: '5', label: 'Excellent' }
],
fullWidth: true
});
});
// Scope alignment
page3.addRow(row => {
row.addRadioButton('scopeAlignment', {
label: 'Did the engagement meet the agreed scope and objectives?',
options: [
{ id: 'exceeded', name: 'Exceeded expectations' },
{ id: 'met', name: 'Fully met expectations' },
{ id: 'mostly', name: 'Mostly met expectations' },
{ id: 'partially', name: 'Partially met expectations' },
{ id: 'not-met', name: 'Did not meet expectations' }
],
orientation: 'vertical'
});
});
// Scope issues follow-up
page3.addRow(row => {
row.addTextarea('scopeIssues', {
label: 'What expectations were not met?',
placeholder: 'Please explain what was missing or different from expectations...',
rows: 3,
isVisible: () => {
const scope = page3.radioButton('scopeAlignment')?.value();
return scope === 'partially' || scope === 'not-met';
},
isRequired: () => {
const scope = page3.radioButton('scopeAlignment')?.value();
return scope === 'partially' || scope === 'not-met';
}
});
});
// Navigation
page3.addSpacer({ height: '20px' });
page3.addRow(row => {
row.addButton('backToPage2', {
label: 'Back',
onClick: () => pages.goToPage('consultantEval')
}, '1fr');
row.addButton('toPage4', {
label: 'Next: Value & ROI',
onClick: () => pages.goToPage('valueRoi')
}, '1fr');
});
// ============================================
// PAGE 4: Value & ROI
// ============================================
const page4 = pages.addPage('valueRoi');
page4.addRow(row => {
row.addTextPanel('page4Title', {
label: 'Value & Return on Investment',
customStyles: {
fontSize: '18px',
fontWeight: 'bold',
color: '#1e3a5f',
marginBottom: '8px'
}
});
});
// Value perception
page4.addRow(row => {
row.addRatingScale('valueForMoney', {
label: 'How would you rate the value received relative to the investment?',
preset: 'satisfaction',
alignment: 'center',
isRequired: true
});
});
// ROI Slider
page4.addRow(row => {
row.addSlider('estimatedROI', {
label: 'Estimated ROI of this engagement',
min: -50,
max: 500,
step: 10,
defaultValue: 100,
unit: '%',
showValue: true
});
});
page4.addRow(row => {
row.addTextPanel('roiContext', {
computedValue: () => {
const roi = page4.slider('estimatedROI')?.value() ?? 100;
if (roi < 0) return '📉 The investment did not generate positive returns';
if (roi < 100) return '⚖️ The investment returned less than its cost';
if (roi === 100) return '✓ Break-even - investment returned its cost';
if (roi < 200) return '📈 Good return on investment';
if (roi < 300) return '🎯 Strong return on investment';
return '🚀 Exceptional return on investment';
},
customStyles: () => {
const roi = page4.slider('estimatedROI')?.value() ?? 100;
const base = { padding: '10px', borderRadius: '6px', textAlign: 'center', fontSize: '14px' };
if (roi < 0) return { ...base, backgroundColor: '#fee2e2', color: '#991b1b' };
if (roi < 100) return { ...base, backgroundColor: '#fef3c7', color: '#92400e' };
if (roi < 200) return { ...base, backgroundColor: '#d1fae5', color: '#065f46' };
return { ...base, backgroundColor: '#cffafe', color: '#0e7490' };
}
});
});
// Value drivers
page4.addSpacer({ height: '16px' });
page4.addRow(row => {
row.addCheckboxList('valueDrivers', {
label: 'What value did this engagement deliver? (Select all that apply)',
options: [
{ id: 'cost-savings', name: 'Cost savings/efficiency gains' },
{ id: 'revenue-growth', name: 'Revenue growth opportunities' },
{ id: 'risk-reduction', name: 'Risk reduction' },
{ id: 'capability', name: 'New capabilities/knowledge transfer' },
{ id: 'strategy', name: 'Clear strategic direction' },
{ id: 'process', name: 'Improved processes' },
{ id: 'alignment', name: 'Better organizational alignment' },
{ id: 'innovation', name: 'Innovation/new ideas' }
],
orientation: 'vertical'
});
});
// Implementation status
page4.addRow(row => {
row.addRadioButton('implementationStatus', {
label: 'What is the status of implementing the recommendations?',
options: [
{ id: 'fully', name: 'Fully implemented' },
{ id: 'in-progress', name: 'Implementation in progress' },
{ id: 'planned', name: 'Planned for future' },
{ id: 'partial', name: 'Partially implemented' },
{ id: 'not-started', name: 'Not yet started' },
{ id: 'not-planned', name: 'No plans to implement' }
],
orientation: 'vertical'
});
});
// Implementation barriers
page4.addRow(row => {
row.addTextarea('implementationBarriers', {
label: 'What barriers are preventing implementation?',
placeholder: 'Share any challenges you face in implementing recommendations...',
rows: 2,
isVisible: () => {
const status = page4.radioButton('implementationStatus')?.value();
return status === 'not-started' || status === 'not-planned';
}
});
});
// Navigation
page4.addSpacer({ height: '20px' });
page4.addRow(row => {
row.addButton('backToPage3', {
label: 'Back',
onClick: () => pages.goToPage('deliverables')
}, '1fr');
row.addButton('toPage5', {
label: 'Next: Overall & Recommendation',
onClick: () => pages.goToPage('overall')
}, '1fr');
});
// ============================================
// PAGE 5: Overall Satisfaction & Recommendation
// ============================================
const page5 = pages.addPage('overall');
page5.addRow(row => {
row.addTextPanel('page5Title', {
label: 'Overall Assessment',
customStyles: {
fontSize: '18px',
fontWeight: 'bold',
color: '#1e3a5f',
marginBottom: '8px'
}
});
});
// NPS
page5.addRow(row => {
row.addRatingScale('npsScore', {
label: 'How likely are you to recommend our consulting services to a colleague?',
preset: 'nps',
showCategoryLabel: true,
showSegmentColors: true,
showConfettiOnPromoter: true,
isRequired: true
});
});
// NPS follow-up
page5.addRow(row => {
row.addTextarea('npsReason', {
label: () => {
const category = page5.ratingScale('npsScore')?.npsCategory();
if (category === 'promoter') return 'What would you tell a colleague about us?';
if (category === 'passive') return 'What would make you more likely to recommend us?';
if (category === 'detractor') return 'What could we have done differently?';
return 'Please explain your rating';
},
placeholder: 'Share your thoughts...',
rows: 3,
isVisible: () => page5.ratingScale('npsScore')?.value() !== null
});
});
// Future engagement
page5.addRow(row => {
row.addRadioButton('futureEngagement', {
label: 'How likely are you to engage us for future projects?',
options: [
{ id: 'definitely', name: 'Definitely' },
{ id: 'very-likely', name: 'Very likely' },
{ id: 'likely', name: 'Likely' },
{ id: 'uncertain', name: 'Uncertain' },
{ id: 'unlikely', name: 'Unlikely' }
],
orientation: 'horizontal'
});
});
// Areas for improvement
const improvementsSection = page5.addSubform('improvements', {
title: 'Areas for Improvement',
isVisible: () => {
const nps = page5.ratingScale('npsScore')?.value();
return nps !== null && nps !== undefined && nps <= 6;
},
customStyles: { backgroundColor: '#fef3c7', padding: '16px', borderRadius: '8px' }
});
improvementsSection.addRow(row => {
row.addSuggestionChips('improvementAreas', {
label: 'Which areas need the most improvement?',
suggestions: [
{ id: 'expertise', name: 'Industry Expertise' },
{ id: 'communication', name: 'Communication' },
{ id: 'responsiveness', name: 'Responsiveness' },
{ id: 'deliverables', name: 'Deliverable Quality' },
{ id: 'pricing', name: 'Pricing/Value' },
{ id: 'timeline', name: 'Timeline Management' },
{ id: 'collaboration', name: 'Team Collaboration' },
{ id: 'recommendations', name: 'Actionable Recommendations' }
],
max: 3,
alignment: 'center'
});
});
// Highlights (for promoters)
const highlightsSection = page5.addSubform('highlights', {
title: 'What Made This Engagement Stand Out?',
isVisible: () => {
const nps = page5.ratingScale('npsScore')?.value();
return nps !== null && nps !== undefined && nps >= 9;
},
customStyles: { backgroundColor: '#d1fae5', padding: '16px', borderRadius: '8px' }
});
highlightsSection.addRow(row => {
row.addSuggestionChips('highlights', {
label: 'What made this engagement exceptional?',
suggestions: [
{ id: 'expertise', name: 'Deep Expertise' },
{ id: 'insights', name: 'Valuable Insights' },
{ id: 'team', name: 'Great Team' },
{ id: 'communication', name: 'Clear Communication' },
{ id: 'results', name: 'Measurable Results' },
{ id: 'partnership', name: 'True Partnership' },
{ id: 'innovation', name: 'Innovative Approach' },
{ id: 'value', name: 'Exceptional Value' }
],
max: 4,
alignment: 'center'
});
});
// Additional comments
page5.addSpacer({ height: '16px' });
page5.addRow(row => {
row.addTextarea('additionalComments', {
label: 'Any other feedback or suggestions for improvement?',
placeholder: 'Share any additional thoughts...',
rows: 4,
autoExpand: true
});
});
// Follow-up permission
const contactSection = page5.addSubform('contact', {
title: 'Follow-Up'
});
contactSection.addRow(row => {
row.addCheckbox('allowFollowUp', {
label: 'I would be open to a brief follow-up call to discuss my feedback'
});
});
contactSection.addRow(row => {
row.addCheckbox('allowTestimonial', {
label: 'I would consider providing a testimonial or case study'
});
});
contactSection.addRow(row => {
row.addTextbox('contactName', {
label: 'Your name',
placeholder: 'Your name',
isVisible: () =>
contactSection.checkbox('allowFollowUp')?.value() === true ||
contactSection.checkbox('allowTestimonial')?.value() === true
}, '1fr');
row.addEmail('contactEmail', {
label: 'Email address',
placeholder: 'your@email.com',
isVisible: () =>
contactSection.checkbox('allowFollowUp')?.value() === true ||
contactSection.checkbox('allowTestimonial')?.value() === true
}, '1fr');
});
// Summary
const summarySection = page5.addSubform('summary', {
title: 'Engagement Feedback Summary',
isVisible: () => page5.ratingScale('npsScore')?.value() !== null
});
summarySection.addRow(row => {
row.addTextPanel('summaryContent', {
computedValue: () => {
const nps = page5.ratingScale('npsScore')?.value();
const category = page5.ratingScale('npsScore')?.npsCategory();
const valueRating = page4.ratingScale('valueForMoney')?.value();
const roi = page4.slider('estimatedROI')?.value() ?? 100;
const scope = page3.radioButton('scopeAlignment')?.value();
const future = page5.radioButton('futureEngagement')?.value();
if (nps === null || nps === undefined) return '';
let emoji = category === 'promoter' ? '🤝' : category === 'passive' ? '📊' : '📋';
let summary = `${emoji} Engagement Summary\n`;
summary += `${'═'.repeat(24)}\n\n`;
// NPS
summary += `Recommendation Score: ${nps}/10 (${category})\n`;
// Value
if (valueRating) {
const valueLabels: Record<number, string> = {
1: 'Very Poor Value',
2: 'Poor Value',
3: 'Fair Value',
4: 'Good Value',
5: 'Excellent Value'
};
summary += `Value Rating: ${valueLabels[valueRating]}\n`;
}
// ROI
summary += `Estimated ROI: ${roi}%\n`;
// Scope
if (scope) {
const scopeLabels: Record<string, string> = {
'exceeded': '✅ Exceeded expectations',
'met': '✅ Met expectations',
'mostly': '⚠️ Mostly met',
'partially': '⚠️ Partially met',
'not-met': '❌ Did not meet'
};
summary += `\nScope: ${scopeLabels[scope] || scope}`;
}
// Future
if (future) {
const futureLabels: Record<string, string> = {
'definitely': '🔄 Will definitely engage again',
'very-likely': '🔄 Very likely to engage again',
'likely': '🔄 Likely to engage again',
'uncertain': '❓ Future engagement uncertain',
'unlikely': '❌ Unlikely to engage again'
};
summary += `\n${futureLabels[future] || future}`;
}
return summary;
},
customStyles: () => {
const category = page5.ratingScale('npsScore')?.npsCategory();
const base = {
padding: '16px',
borderRadius: '8px',
whiteSpace: 'pre-wrap',
fontFamily: 'monospace',
fontSize: '14px'
};
if (category === 'promoter') return { ...base, backgroundColor: '#d1fae5', borderLeft: '4px solid #10b981' };
if (category === 'passive') return { ...base, backgroundColor: '#fef3c7', borderLeft: '4px solid #f59e0b' };
return { ...base, backgroundColor: '#fee2e2', borderLeft: '4px solid #ef4444' };
}
});
});
// Back button
page5.addSpacer({ height: '20px' });
page5.addRow(row => {
row.addButton('backToPage4', {
label: 'Back',
onClick: () => pages.goToPage('valueRoi')
});
});
// ============================================
// FORM CONFIGURATION
// ============================================
form.configureSubmitButton({
label: 'Submit Feedback',
isVisible: () => page5.ratingScale('npsScore')?.value() !== null
});
form.configureCompletionScreen({
type: 'text',
title: 'Thank You for Your Feedback!',
message: 'Your insights are invaluable in helping us improve our services. We appreciate the time you took to share your experience and look forward to the opportunity to serve you again.'
});
}