export function insuranceClaimFeedback(form: FormTs) {
// Insurance Claim Process Feedback - CES-focused claim experience survey
// Demonstrates: RatingScale (CES), MatrixQuestion, StarRating, Slider, ThumbRating, conditional visibility, dynamic labels
// ============================================
// HEADER
// ============================================
form.addRow(row => {
row.addTextPanel('header', {
label: 'Your Claim Experience Matters',
computedValue: () => 'Help us improve our claims process for you and other policyholders',
customStyles: {
background: 'linear-gradient(135deg, #1e40af 0%, #3b82f6 100%)',
color: 'white',
padding: '24px',
borderRadius: '12px',
textAlign: 'center'
}
});
});
// ============================================
// SECTION 1: Claim Information
// ============================================
const claimSection = form.addSubform('claimSection', {
title: 'Claim Details',
customStyles: { backgroundColor: '#eff6ff', padding: '16px', borderRadius: '12px' }
});
claimSection.addRow(row => {
row.addDropdown('claimType', {
label: 'Type of claim',
options: [
{ id: 'auto-accident', name: 'Auto - Accident/Collision' },
{ id: 'auto-theft', name: 'Auto - Theft/Vandalism' },
{ id: 'auto-glass', name: 'Auto - Windshield/Glass' },
{ id: 'home-damage', name: 'Home - Property Damage' },
{ id: 'home-theft', name: 'Home - Theft/Burglary' },
{ id: 'home-liability', name: 'Home - Liability' },
{ id: 'health', name: 'Health Insurance' },
{ id: 'life', name: 'Life Insurance' },
{ id: 'travel', name: 'Travel Insurance' },
{ id: 'other', name: 'Other' }
],
isRequired: true
}, '1fr');
row.addDropdown('claimOutcome', {
label: 'Claim outcome',
options: [
{ id: 'approved-full', name: 'Approved - Full amount' },
{ id: 'approved-partial', name: 'Approved - Partial amount' },
{ id: 'denied', name: 'Denied' },
{ id: 'withdrawn', name: 'Withdrawn by me' },
{ id: 'pending', name: 'Still in progress' }
],
isRequired: true
}, '1fr');
});
claimSection.addRow(row => {
row.addDropdown('claimDuration', {
label: 'How long did the claim process take?',
options: [
{ id: 'same-day', name: 'Same day' },
{ id: '2-3-days', name: '2-3 days' },
{ id: '1-week', name: 'About 1 week' },
{ id: '2-weeks', name: '1-2 weeks' },
{ id: '1-month', name: '2-4 weeks' },
{ id: 'longer', name: 'More than a month' }
]
}, '1fr');
row.addDropdown('filingMethod', {
label: 'How did you file the claim?',
options: [
{ id: 'online', name: 'Online/Website' },
{ id: 'app', name: 'Mobile App' },
{ id: 'phone', name: 'Phone call' },
{ id: 'agent', name: 'Through my agent' },
{ id: 'in-person', name: 'In person' },
{ id: 'email', name: 'Email' }
]
}, '1fr');
});
// ============================================
// SECTION 2: Customer Effort Score (CES)
// ============================================
const cesSection = form.addSubform('cesSection', {
title: 'Ease of Claims Process',
customStyles: () => {
const ces = cesSection.ratingScale('effortScore')?.value();
if (ces !== null && ces !== undefined) {
if (ces <= 2) return { backgroundColor: '#d1fae5', padding: '16px', borderRadius: '12px' };
if (ces >= 6) return { backgroundColor: '#fee2e2', padding: '16px', borderRadius: '12px' };
}
return { padding: '16px', borderRadius: '12px', border: '1px solid #bfdbfe' };
}
});
cesSection.addRow(row => {
row.addRatingScale('effortScore', {
preset: 'ces',
label: 'How much effort did you have to put forth to handle your claim?',
lowLabel: 'Very Low Effort',
highLabel: 'Very High Effort',
alignment: 'center',
size: 'lg',
isRequired: true
});
});
cesSection.addRow(row => {
row.addTextPanel('cesExplanation', {
computedValue: () => {
const ces = cesSection.ratingScale('effortScore')?.value();
if (ces === null || ces === undefined) return '';
if (ces <= 2) return '✅ Great! We aimed to make this easy for you.';
if (ces <= 4) return '📊 Thanks for the feedback. We want to do better.';
return '⚠️ We apologize for the difficulty. Your feedback will help us improve.';
},
customStyles: {
textAlign: 'center',
fontSize: '14px',
padding: '8px',
fontStyle: 'italic'
},
isVisible: () => cesSection.ratingScale('effortScore')?.value() !== null
});
});
// ============================================
// SECTION 3: Process Stage Ratings
// ============================================
const stagesSection = form.addSubform('stagesSection', {
title: 'Process Stage Feedback',
isVisible: () => cesSection.ratingScale('effortScore')?.value() !== null,
customStyles: { backgroundColor: '#eff6ff', padding: '16px', borderRadius: '12px' }
});
stagesSection.addRow(row => {
row.addMatrixQuestion('stageRatings', {
label: 'Please rate each stage of the claims process:',
rows: [
{ id: 'filing', label: 'Filing/Submitting the claim', isRequired: true },
{ id: 'documentation', label: 'Providing documentation' },
{ id: 'communication', label: 'Updates and communication' },
{ id: 'adjuster', label: 'Adjuster/Inspector interaction' },
{ id: 'resolution', label: 'Final resolution/payment' }
],
columns: [
{ id: '1', label: 'Very Difficult' },
{ id: '2', label: 'Difficult' },
{ id: '3', label: 'Neutral' },
{ id: '4', label: 'Easy' },
{ id: '5', label: 'Very Easy' },
{ id: 'na', label: 'N/A' }
],
striped: true,
fullWidth: true
});
});
// ============================================
// SECTION 4: Communication Quality
// ============================================
const communicationSection = form.addSubform('communicationSection', {
title: 'Communication & Transparency',
isVisible: () => cesSection.ratingScale('effortScore')?.value() !== null,
customStyles: { padding: '16px', borderRadius: '12px', border: '1px solid #bfdbfe' }
});
communicationSection.addRow(row => {
row.addStarRating('responseTime', {
label: 'Response time to inquiries',
maxStars: 5,
size: 'lg',
alignment: 'center'
}, '1fr');
row.addStarRating('clarityRating', {
label: 'Clarity of information provided',
maxStars: 5,
size: 'lg',
alignment: 'center'
}, '1fr');
});
communicationSection.addRow(row => {
row.addStarRating('updateFrequency', {
label: 'Frequency of status updates',
maxStars: 5,
size: 'lg',
alignment: 'center'
}, '1fr');
row.addStarRating('staffKnowledge', {
label: 'Staff knowledge and helpfulness',
maxStars: 5,
size: 'lg',
alignment: 'center'
}, '1fr');
});
// ============================================
// SECTION 5: Outcome Fairness (conditional)
// ============================================
const fairnessSection = form.addSubform('fairnessSection', {
title: 'Outcome Assessment',
isVisible: () => {
const outcome = claimSection.dropdown('claimOutcome')?.value();
return outcome === 'approved-full' || outcome === 'approved-partial' || outcome === 'denied';
},
customStyles: { backgroundColor: '#eff6ff', padding: '16px', borderRadius: '12px' }
});
fairnessSection.addRow(row => {
row.addRatingScale('fairnessRating', {
preset: 'likert-5',
label: () => {
const outcome = claimSection.dropdown('claimOutcome')?.value();
if (outcome === 'denied') return 'The denial decision was explained clearly and felt fair';
return 'The settlement amount was fair and reasonable';
},
lowLabel: 'Strongly Disagree',
highLabel: 'Strongly Agree',
alignment: 'center'
});
});
// For denied/partial claims - additional questions
const denialSection = form.addSubform('denialSection', {
isVisible: () => {
const outcome = claimSection.dropdown('claimOutcome')?.value();
return outcome === 'denied' || outcome === 'approved-partial';
},
customStyles: { padding: '16px', borderRadius: '12px', backgroundColor: '#fef3c7' }
});
denialSection.addRow(row => {
row.addRadioButton('explanationClarity', {
label: () => {
const outcome = claimSection.dropdown('claimOutcome')?.value();
if (outcome === 'denied') return 'Was the reason for denial clearly explained?';
return 'Was the partial approval clearly explained?';
},
options: [
{ id: 'very-clear', name: 'Yes, very clearly' },
{ id: 'somewhat', name: 'Somewhat, but had questions' },
{ id: 'unclear', name: 'No, it was confusing' },
{ id: 'no-explanation', name: 'No explanation was provided' }
],
orientation: 'vertical'
});
});
denialSection.addRow(row => {
row.addThumbRating('appealInfo', {
label: 'Were you informed about your appeal options?',
showLabels: true,
upLabel: 'Yes',
downLabel: 'No',
alignment: 'center',
size: 'lg'
});
});
// ============================================
// SECTION 6: High Effort Follow-up
// ============================================
const painPointsSection = form.addSubform('painPointsSection', {
title: 'Help Us Understand the Friction',
isVisible: () => {
const ces = cesSection.ratingScale('effortScore')?.value();
return ces !== null && ces !== undefined && ces >= 5;
},
customStyles: { backgroundColor: '#fee2e2', padding: '16px', borderRadius: '12px' }
});
painPointsSection.addRow(row => {
row.addCheckboxList('painPoints', {
label: 'What made the process difficult? (select all that apply)',
options: [
{ id: 'documentation', name: 'Too much documentation required' },
{ id: 'unclear-requirements', name: 'Unclear requirements' },
{ id: 'long-wait', name: 'Long wait times' },
{ id: 'multiple-contacts', name: 'Had to contact multiple times' },
{ id: 'repeat-info', name: 'Had to repeat information' },
{ id: 'difficult-portal', name: 'Difficult online portal' },
{ id: 'phone-hold', name: 'Long phone hold times' },
{ id: 'unhelpful-staff', name: 'Unhelpful staff' },
{ id: 'lost-paperwork', name: 'Lost/Misplaced paperwork' },
{ id: 'changing-info', name: 'Received conflicting information' }
],
orientation: 'vertical'
});
});
painPointsSection.addSpacer();
painPointsSection.addRow(row => {
row.addTextarea('painPointDetails', {
label: 'Please describe the specific challenges you faced',
placeholder: 'Your detailed feedback helps us identify and fix problems...',
rows: 3,
autoExpand: true
});
});
// ============================================
// SECTION 7: Overall Satisfaction
// ============================================
const satisfactionSection = form.addSubform('satisfactionSection', {
title: 'Overall Assessment',
isVisible: () => cesSection.ratingScale('effortScore')?.value() !== null
});
satisfactionSection.addRow(row => {
row.addStarRating('overallSatisfaction', {
label: 'Overall satisfaction with the claims experience',
maxStars: 5,
size: 'xl',
alignment: 'center',
showConfettiOnMax: true
});
});
satisfactionSection.addRow(row => {
row.addRatingScale('npsScore', {
preset: 'nps',
label: 'How likely are you to recommend our insurance to others?',
showCategoryLabel: true,
showSegmentColors: true
});
});
satisfactionSection.addRow(row => {
row.addThumbRating('wouldRenew', {
label: 'Based on this claims experience, will you renew your policy?',
showLabels: true,
upLabel: 'Yes, will renew',
downLabel: 'Reconsidering',
alignment: 'center',
size: 'lg'
});
});
// Follow-up for reconsidering renewal
satisfactionSection.addRow(row => {
row.addTextarea('renewalConcerns', {
label: 'What would need to change for you to confidently renew?',
placeholder: 'Your feedback helps us improve...',
rows: 2,
autoExpand: true,
isVisible: () => satisfactionSection.thumbRating('wouldRenew')?.value() === 'down'
});
});
// ============================================
// SECTION 8: Additional Comments
// ============================================
const commentsSection = form.addSubform('commentsSection', {
title: 'Additional Feedback',
isVisible: () => cesSection.ratingScale('effortScore')?.value() !== null
});
commentsSection.addSpacer();
commentsSection.addRow(row => {
row.addTextarea('additionalComments', {
label: 'Any other comments about your claims experience?',
placeholder: 'Your feedback is valuable to us...',
rows: 3,
autoExpand: true
});
});
commentsSection.addRow(row => {
row.addCheckbox('contactMe', {
label: 'Please contact me to discuss my experience'
});
});
commentsSection.addRow(row => {
row.addTextbox('contactPhone', {
label: 'Phone number',
placeholder: '(555) 123-4567',
isVisible: () => commentsSection.checkbox('contactMe')?.value() === true
}, '1fr');
row.addTextbox('bestTime', {
label: 'Best time to call',
placeholder: 'Morning, afternoon, or specific time',
isVisible: () => commentsSection.checkbox('contactMe')?.value() === true
}, '1fr');
});
// ============================================
// SUMMARY
// ============================================
const summarySection = form.addSubform('summary', {
title: 'Feedback Summary',
isVisible: () => cesSection.ratingScale('effortScore')?.value() !== null
});
summarySection.addRow(row => {
row.addTextPanel('summaryContent', {
computedValue: () => {
const ces = cesSection.ratingScale('effortScore')?.value();
const claimType = claimSection.dropdown('claimType')?.value();
const outcome = claimSection.dropdown('claimOutcome')?.value();
const overall = satisfactionSection.starRating('overallSatisfaction')?.value();
const nps = satisfactionSection.ratingScale('npsScore')?.value();
const npsCategory = satisfactionSection.ratingScale('npsScore')?.npsCategory();
const wouldRenew = satisfactionSection.thumbRating('wouldRenew')?.value();
const cesLabel = ces !== null && ces !== undefined ?
(ces <= 2 ? 'Low Effort ✅' : ces <= 4 ? 'Moderate Effort' : 'High Effort ⚠️') : 'Not rated';
const outcomeLabels: Record<string, string> = {
'approved-full': '✅ Approved (Full)',
'approved-partial': '⚠️ Approved (Partial)',
'denied': '❌ Denied',
'withdrawn': '↩️ Withdrawn',
'pending': '⏳ In Progress'
};
let summary = '📋 Claims Feedback Summary\n';
summary += '═'.repeat(25) + '\n\n';
summary += `Claim Type: ${claimType || 'Not specified'}\n`;
summary += `Outcome: ${outcomeLabels[outcome || ''] || 'Not specified'}\n`;
summary += `\nCustomer Effort: ${ces}/7 (${cesLabel})\n`;
if (overall) {
summary += `Satisfaction: ${'★'.repeat(overall)}${'☆'.repeat(5 - overall)}\n`;
}
if (nps !== null && nps !== undefined) {
summary += `NPS: ${nps}/10 (${npsCategory})\n`;
}
summary += `\nRenewal Intent: ${wouldRenew === 'up' ? 'Will Renew' : wouldRenew === 'down' ? 'Reconsidering ⚠️' : 'Not answered'}`;
return summary;
},
customStyles: {
padding: '16px',
borderRadius: '12px',
backgroundColor: '#eff6ff',
whiteSpace: 'pre-wrap',
fontFamily: 'monospace',
fontSize: '13px',
borderLeft: '4px solid #3b82f6'
}
});
});
// ============================================
// FORM CONFIGURATION
// ============================================
form.configureSubmitButton({
label: 'Submit Claim Feedback',
isVisible: () => cesSection.ratingScale('effortScore')?.value() !== null
});
form.configureCompletionScreen({
type: 'text',
title: 'Thank You for Your Feedback',
message: 'Your feedback helps us improve our claims process for all policyholders. We take every response seriously and use this information to make the claims experience better.'
});
}