export function financialAdvisor(form: FormTs) {
// Financial Advisor Review Form - Evaluate wealth advisor performance
// Demonstrates: MatrixQuestion for trust metrics, Multiple StarRatings, RatingScale (NPS), Slider, EmojiRating, SuggestionChips, dynamic styling
// ============================================
// HEADER
// ============================================
form.addRow(row => {
row.addTextPanel('header', {
label: 'Financial Advisor Feedback',
computedValue: () => 'Your confidential feedback helps us serve you better',
customStyles: {
backgroundColor: '#0f172a',
color: 'white',
padding: '24px',
borderRadius: '12px',
textAlign: 'center'
}
});
});
// ============================================
// SECTION 1: Advisor & Relationship Info
// ============================================
const advisorSection = form.addSubform('advisor', {
title: 'Your Advisor'
});
advisorSection.addRow(row => {
row.addTextbox('advisorName', {
label: 'Advisor Name',
placeholder: 'Enter your advisor\'s name',
isRequired: true
}, '1fr');
row.addDropdown('relationshipLength', {
label: 'How long have you worked together?',
options: [
{ id: 'new', name: 'Less than 1 year' },
{ id: '1-3', name: '1-3 years' },
{ id: '3-5', name: '3-5 years' },
{ id: '5-10', name: '5-10 years' },
{ id: '10+', name: 'More than 10 years' }
],
placeholder: 'Select duration',
isRequired: true
}, '1fr');
});
advisorSection.addRow(row => {
row.addDropdown('primaryService', {
label: 'Primary service received',
options: [
{ id: 'wealth', name: 'Wealth Management' },
{ id: 'retirement', name: 'Retirement Planning' },
{ id: 'investment', name: 'Investment Advisory' },
{ id: 'tax', name: 'Tax Planning' },
{ id: 'estate', name: 'Estate Planning' },
{ id: 'insurance', name: 'Insurance Planning' },
{ id: 'comprehensive', name: 'Comprehensive Financial Planning' }
],
placeholder: 'Select service'
}, '1fr');
row.addDropdown('meetingFrequency', {
label: 'How often do you meet?',
options: [
{ id: 'monthly', name: 'Monthly' },
{ id: 'quarterly', name: 'Quarterly' },
{ id: 'semi', name: 'Semi-annually' },
{ id: 'annual', name: 'Annually' },
{ id: 'as-needed', name: 'As needed' }
],
placeholder: 'Select frequency'
}, '1fr');
});
// ============================================
// SECTION 2: Trust & Confidence
// ============================================
const trustSection = form.addSubform('trust', {
title: 'Trust & Confidence',
isVisible: () => advisorSection.textbox('advisorName')?.value() !== null && advisorSection.textbox('advisorName')?.value() !== '',
customStyles: () => {
const trust = trustSection.slider('trustLevel')?.value() || 0;
if (trust >= 8) return { backgroundColor: '#d1fae5', padding: '16px', borderRadius: '8px' };
if (trust >= 5) return { backgroundColor: '#fef3c7', padding: '16px', borderRadius: '8px' };
if (trust >= 1) return { backgroundColor: '#fee2e2', padding: '16px', borderRadius: '8px' };
return { padding: '16px', borderRadius: '8px', border: '1px dashed #cbd5e1' };
}
});
trustSection.addRow(row => {
row.addSlider('trustLevel', {
label: () => {
const trust = trustSection.slider('trustLevel')?.value() || 0;
if (trust >= 9) return 'How much do you trust your advisor? VERY HIGH TRUST';
if (trust >= 7) return 'How much do you trust your advisor? HIGH TRUST';
if (trust >= 5) return 'How much do you trust your advisor? MODERATE TRUST';
if (trust >= 3) return 'How much do you trust your advisor? LOW TRUST';
return 'How much do you trust your advisor?';
},
min: 1,
max: 10,
step: 1,
defaultValue: 7,
showValue: true
});
});
trustSection.addRow(row => {
row.addMatrixQuestion('trustMatrix', {
label: 'Rate your confidence in each area',
rows: [
{ id: 'best-interest', label: 'Acts in my best interest', description: 'Puts your needs first', isRequired: true },
{ id: 'transparency', label: 'Transparent about fees', description: 'Clear about costs', isRequired: true },
{ id: 'honest', label: 'Honest and straightforward', description: 'Tells it like it is', isRequired: true },
{ id: 'confidential', label: 'Maintains confidentiality', description: 'Protects your information', isRequired: false },
{ id: 'ethical', label: 'High ethical standards', description: 'Professional integrity', isRequired: false }
],
columns: [
{ id: '1', label: 'Not Confident' },
{ id: '2', label: 'Somewhat' },
{ id: '3', label: 'Confident' },
{ id: '4', label: 'Very Confident' },
{ id: '5', label: 'Completely' }
],
striped: true,
fullWidth: true
});
});
// ============================================
// SECTION 3: Expertise & Knowledge
// ============================================
const expertiseSection = form.addSubform('expertise', {
title: 'Expertise & Knowledge',
isVisible: () => advisorSection.textbox('advisorName')?.value() !== null && advisorSection.textbox('advisorName')?.value() !== ''
});
expertiseSection.addRow(row => {
row.addStarRating('financialKnowledge', {
label: 'Financial & Investment Knowledge',
tooltip: 'Understanding of markets, products, and strategies',
maxStars: 5,
size: 'lg',
alignment: 'left'
}, '1fr');
row.addStarRating('planningSkills', {
label: 'Financial Planning Skills',
tooltip: 'Ability to create comprehensive plans',
maxStars: 5,
size: 'lg',
alignment: 'left'
}, '1fr');
});
expertiseSection.addRow(row => {
row.addStarRating('riskManagement', {
label: 'Risk Assessment & Management',
tooltip: 'Understanding your risk tolerance',
maxStars: 5,
size: 'lg',
alignment: 'left'
}, '1fr');
row.addStarRating('marketInsights', {
label: 'Market & Economic Insights',
tooltip: 'Keeping you informed of trends',
maxStars: 5,
size: 'lg',
alignment: 'left'
}, '1fr');
});
expertiseSection.addRow(row => {
row.addEmojiRating('confidenceInAdvice', {
label: 'How confident are you in the advice you receive?',
preset: 'satisfaction',
size: 'lg',
showLabels: true,
alignment: 'center'
});
});
// ============================================
// SECTION 4: Communication & Service
// ============================================
const communicationSection = form.addSubform('communication', {
title: 'Communication & Service',
isVisible: () => advisorSection.textbox('advisorName')?.value() !== null && advisorSection.textbox('advisorName')?.value() !== ''
});
communicationSection.addRow(row => {
row.addMatrixQuestion('communicationMatrix', {
label: 'Rate your advisor\'s communication',
rows: [
{ id: 'responsive', label: 'Responsiveness', description: 'Returns calls/emails promptly', isRequired: true },
{ id: 'proactive', label: 'Proactive Outreach', description: 'Reaches out with updates', isRequired: true },
{ id: 'explains', label: 'Clear Explanations', description: 'Explains concepts understandably', isRequired: true },
{ id: 'listens', label: 'Active Listening', description: 'Understands your concerns', isRequired: true },
{ id: 'available', label: 'Availability', description: 'Easy to reach when needed', isRequired: false }
],
columns: [
{ id: '1', label: 'Poor' },
{ id: '2', label: 'Fair' },
{ id: '3', label: 'Good' },
{ id: '4', label: 'Very Good' },
{ id: '5', label: 'Excellent' }
],
striped: true,
fullWidth: true
});
});
communicationSection.addRow(row => {
row.addCheckboxList('communicationChannels', {
label: 'Which communication methods work best for you?',
options: [
{ id: 'phone', name: 'Phone calls' },
{ id: 'email', name: 'Email updates' },
{ id: 'video', name: 'Video meetings' },
{ id: 'in-person', name: 'In-person meetings' },
{ id: 'portal', name: 'Client portal' },
{ id: 'text', name: 'Text messages' }
],
orientation: 'horizontal'
});
});
// ============================================
// SECTION 5: Value & Results
// ============================================
const valueSection = form.addSubform('value', {
title: 'Value & Results',
isVisible: () => advisorSection.textbox('advisorName')?.value() !== null && advisorSection.textbox('advisorName')?.value() !== ''
});
valueSection.addRow(row => {
row.addStarRating('valueForFees', {
label: 'Value for fees paid',
tooltip: 'Is the service worth what you pay?',
maxStars: 5,
size: 'lg',
alignment: 'center'
}, '1fr');
row.addStarRating('goalProgress', {
label: 'Progress toward your financial goals',
tooltip: 'Are you on track?',
maxStars: 5,
size: 'lg',
alignment: 'center'
}, '1fr');
});
valueSection.addRow(row => {
row.addRadioButton('performanceSatisfaction', {
label: 'How satisfied are you with portfolio performance (relative to expectations)?',
options: [
{ id: 'very', name: 'Very satisfied - Exceeded expectations' },
{ id: 'satisfied', name: 'Satisfied - Met expectations' },
{ id: 'neutral', name: 'Neutral - About what I expected' },
{ id: 'dissatisfied', name: 'Dissatisfied - Below expectations' },
{ id: 'very-dissatisfied', name: 'Very dissatisfied' }
],
orientation: 'vertical'
});
});
valueSection.addRow(row => {
row.addSuggestionChips('additionalServices', {
label: 'What additional services would be valuable to you?',
suggestions: [
{ id: 'tax', name: 'Tax Optimization' },
{ id: 'estate', name: 'Estate Planning' },
{ id: 'insurance', name: 'Insurance Review' },
{ id: 'education', name: 'College Planning' },
{ id: 'charitable', name: 'Charitable Giving' },
{ id: 'business', name: 'Business Planning' },
{ id: 'family', name: 'Family Meetings' },
{ id: 'reports', name: 'Enhanced Reporting' }
],
max: 3,
alignment: 'center'
});
});
// ============================================
// SECTION 6: Overall Rating & Recommendation
// ============================================
const overallSection = form.addSubform('overall', {
title: 'Overall Assessment',
isVisible: () => advisorSection.textbox('advisorName')?.value() !== null && advisorSection.textbox('advisorName')?.value() !== '',
customStyles: () => {
const nps = overallSection.ratingScale('advisorNps')?.npsCategory();
if (nps === 'promoter') return { backgroundColor: '#d1fae5', padding: '16px', borderRadius: '8px' };
if (nps === 'passive') return { backgroundColor: '#fef3c7', padding: '16px', borderRadius: '8px' };
if (nps === 'detractor') return { backgroundColor: '#fee2e2', padding: '16px', borderRadius: '8px' };
return { padding: '16px', borderRadius: '8px', border: '1px dashed #cbd5e1' };
}
});
overallSection.addRow(row => {
row.addStarRating('overallRating', {
label: () => {
const name = advisorSection.textbox('advisorName')?.value() || 'your advisor';
return `Overall satisfaction with ${name}`;
},
maxStars: 5,
size: 'xl',
alignment: 'center',
showConfettiOnMax: true
});
});
overallSection.addRow(row => {
row.addRatingScale('advisorNps', {
preset: 'nps',
label: 'How likely are you to recommend this advisor to friends or family?',
showSegmentColors: true,
showCategoryLabel: true,
showConfettiOnPromoter: true,
alignment: 'center',
isRequired: true
});
});
overallSection.addRow(row => {
row.addRadioButton('continueWorking', {
label: 'Do you plan to continue working with this advisor?',
options: [
{ id: 'definitely', name: 'Definitely yes - Long-term relationship' },
{ id: 'likely', name: 'Likely yes' },
{ id: 'unsure', name: 'Unsure - Need to evaluate' },
{ id: 'unlikely', name: 'Unlikely - Considering alternatives' },
{ id: 'no', name: 'No - Planning to change advisors' }
],
orientation: 'vertical'
});
});
// Concern section for at-risk clients
const concernSection = form.addSubform('concerns', {
title: 'We Want to Help',
isVisible: () => {
const cont = overallSection.radioButton('continueWorking')?.value();
return cont === 'unsure' || cont === 'unlikely' || cont === 'no';
},
customStyles: {
backgroundColor: '#fef3c7',
padding: '16px',
borderRadius: '8px',
borderLeft: '4px solid #f59e0b'
}
});
concernSection.addRow(row => {
row.addTextarea('concernDetails', {
label: 'Please help us understand your concerns',
placeholder: 'What would need to change for you to feel more confident in this relationship?',
rows: 3,
autoExpand: true
});
});
concernSection.addRow(row => {
row.addCheckbox('contactMe', {
label: 'I would like someone from the firm to contact me about my concerns'
});
});
// ============================================
// SECTION 7: Additional Feedback
// ============================================
const feedbackSection = form.addSubform('feedback', {
title: 'Additional Comments',
isVisible: () => overallSection.starRating('overallRating')?.value() !== null
});
feedbackSection.addSpacer();
feedbackSection.addRow(row => {
row.addTextarea('additionalFeedback', {
label: 'Any additional feedback for your advisor or our firm?',
placeholder: 'Share any other thoughts, suggestions, or specific experiences...',
rows: 3,
autoExpand: true
});
});
// ============================================
// SECTION 8: Summary
// ============================================
const summarySection = form.addSubform('summary', {
title: 'Feedback Summary',
isVisible: () => overallSection.starRating('overallRating')?.value() !== null
});
summarySection.addRow(row => {
row.addTextPanel('summaryContent', {
computedValue: () => {
const advisorName = advisorSection.textbox('advisorName')?.value() || 'Advisor';
const duration = advisorSection.dropdown('relationshipLength')?.value();
const overall = overallSection.starRating('overallRating')?.value();
const nps = overallSection.ratingScale('advisorNps')?.npsCategory();
const trust = trustSection.slider('trustLevel')?.value();
const knowledge = expertiseSection.starRating('financialKnowledge')?.value();
const planning = expertiseSection.starRating('planningSkills')?.value();
const value = valueSection.starRating('valueForFees')?.value();
const continueWork = overallSection.radioButton('continueWorking')?.value();
if (!overall) return '';
const durationLabels: Record<string, string> = {
'new': '< 1 year',
'1-3': '1-3 years',
'3-5': '3-5 years',
'5-10': '5-10 years',
'10+': '10+ years'
};
const continueLabels: Record<string, string> = {
'definitely': 'Long-term',
'likely': 'Likely',
'unsure': 'Evaluating',
'unlikely': 'At Risk',
'no': 'Leaving'
};
let summary = `ADVISOR SCORECARD\n`;
summary += `${'═'.repeat(24)}\n\n`;
summary += `Advisor: ${advisorName}\n`;
summary += `Tenure: ${durationLabels[duration || ''] || 'Unknown'}\n`;
summary += `\n${'─'.repeat(24)}\n\n`;
summary += `Overall: ${'★'.repeat(overall)}${'☆'.repeat(5 - overall)} (${overall}/5)\n`;
if (trust) {
summary += `Trust Level: ${trust}/10\n`;
}
if (knowledge) {
summary += `Knowledge: ${'★'.repeat(knowledge)}${'☆'.repeat(5 - knowledge)}\n`;
}
if (value) {
summary += `Value: ${'★'.repeat(value)}${'☆'.repeat(5 - value)}\n`;
}
if (nps) {
summary += `\nNPS: ${nps.charAt(0).toUpperCase() + nps.slice(1)}\n`;
}
if (continueWork) {
summary += `Retention: ${continueLabels[continueWork]}`;
}
return summary;
},
customStyles: () => {
const nps = overallSection.ratingScale('advisorNps')?.npsCategory();
const baseStyles = {
padding: '16px',
borderRadius: '8px',
whiteSpace: 'pre-wrap',
fontFamily: 'monospace',
fontSize: '13px'
};
if (nps === 'promoter') {
return { ...baseStyles, backgroundColor: '#d1fae5', borderLeft: '4px solid #10b981' };
} else if (nps === 'passive') {
return { ...baseStyles, backgroundColor: '#fef3c7', borderLeft: '4px solid #f59e0b' };
} else if (nps === 'detractor') {
return { ...baseStyles, backgroundColor: '#fee2e2', borderLeft: '4px solid #ef4444' };
}
return { ...baseStyles, backgroundColor: '#f8fafc', borderLeft: '4px solid #64748b' };
}
});
});
// ============================================
// FORM CONFIGURATION
// ============================================
form.configureSubmitButton({
label: 'Submit Feedback',
isVisible: () => overallSection.ratingScale('advisorNps')?.value() !== null
});
form.configureCompletionScreen({
type: 'text',
title: 'Thank You for Your Feedback',
message: 'Your confidential feedback is invaluable in helping us maintain the highest standards of financial advice and client service. We take every response seriously.'
});
}