export function integrationFeedbackForm(form: FormTs) {
// Integration Experience Survey - Technical implementation feedback
// Demonstrates: StarRating, EmojiRating, MatrixQuestion, RatingScale, Slider, ThumbRating, CheckboxList, dynamic styling
// ============================================
// HEADER
// ============================================
form.addRow(row => {
row.addTextPanel('header', {
label: 'Integration Feedback',
computedValue: () => 'Help us improve the integration experience for future customers.',
customStyles: {
backgroundColor: '#4f46e5',
color: 'white',
padding: '28px',
borderRadius: '12px',
textAlign: 'center'
}
});
});
// ============================================
// SECTION 1: Integration Details
// ============================================
const detailsSection = form.addSubform('details', {
title: 'Integration Details'
});
detailsSection.addRow(row => {
row.addDropdown('integrationType', {
label: 'Integration Type',
options: [
{ id: 'rest-api', name: 'REST API' },
{ id: 'graphql', name: 'GraphQL API' },
{ id: 'webhooks', name: 'Webhooks' },
{ id: 'sdk', name: 'SDK/Library' },
{ id: 'native', name: 'Native Integration' },
{ id: 'zapier', name: 'Zapier/Automation' },
{ id: 'custom', name: 'Custom Integration' },
{ id: 'other', name: 'Other' }
],
placeholder: 'Select integration type...',
isRequired: true
}, '1fr');
row.addDropdown('complexity', {
label: 'Integration Complexity',
options: [
{ id: 'simple', name: 'Simple (hours)' },
{ id: 'moderate', name: 'Moderate (days)' },
{ id: 'complex', name: 'Complex (weeks)' },
{ id: 'enterprise', name: 'Enterprise (months)' }
],
placeholder: 'Select complexity...'
}, '1fr');
});
detailsSection.addRow(row => {
row.addDropdown('techStack', {
label: 'Your Primary Tech Stack',
options: [
{ id: 'js-node', name: 'JavaScript/Node.js' },
{ id: 'python', name: 'Python' },
{ id: 'java', name: 'Java' },
{ id: 'csharp', name: 'C#/.NET' },
{ id: 'php', name: 'PHP' },
{ id: 'ruby', name: 'Ruby' },
{ id: 'go', name: 'Go' },
{ id: 'other', name: 'Other' }
],
placeholder: 'Select tech stack...'
}, '1fr');
row.addDropdown('implementerRole', {
label: 'Your Role',
options: [
{ id: 'backend', name: 'Backend Developer' },
{ id: 'fullstack', name: 'Full-Stack Developer' },
{ id: 'frontend', name: 'Frontend Developer' },
{ id: 'devops', name: 'DevOps/SRE' },
{ id: 'architect', name: 'Solution Architect' },
{ id: 'sysadmin', name: 'System Administrator' },
{ id: 'manager', name: 'Technical Manager' }
],
placeholder: 'Select your role...'
}, '1fr');
});
// ============================================
// SECTION 2: Overall Experience
// ============================================
const overallSection = form.addSubform('overall', {
title: 'Overall Integration Experience'
});
overallSection.addRow(row => {
row.addEmojiRating('overallExperience', {
label: 'How was your overall integration experience?',
preset: 'effort',
size: 'lg',
alignment: 'center',
showLabels: true
});
});
overallSection.addRow(row => {
row.addSlider('timeToIntegrate', {
label: 'How long did the integration take? (hours)',
min: 1,
max: 100,
step: 1,
showValue: true,
unit: 'hrs',
defaultValue: 8
});
});
overallSection.addRow(row => {
row.addRadioButton('timeVsExpected', {
label: 'Compared to your expectation, the integration took:',
options: [
{ id: 'much-less', name: 'Much less time' },
{ id: 'less', name: 'Less time' },
{ id: 'as-expected', name: 'About as expected' },
{ id: 'more', name: 'More time' },
{ id: 'much-more', name: 'Much more time' }
],
orientation: 'horizontal'
});
});
// ============================================
// SECTION 3: Documentation Quality
// ============================================
const docsSection = form.addSubform('docs', {
title: 'Documentation Quality'
});
docsSection.addRow(row => {
row.addMatrixQuestion('docsRating', {
label: 'Rate the documentation:',
rows: [
{ id: 'clarity', label: 'Clarity & Readability', description: 'Easy to understand', isRequired: true },
{ id: 'completeness', label: 'Completeness', description: 'Covered all needed topics', isRequired: true },
{ id: 'accuracy', label: 'Accuracy', description: 'Correct and up-to-date', isRequired: true },
{ id: 'examples', label: 'Code Examples', description: 'Useful and working examples', isRequired: true },
{ id: 'navigation', label: 'Navigation', description: 'Easy to find information', isRequired: false },
{ id: 'search', label: 'Search Functionality', description: 'Finding specific topics', 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,
striped: true
});
});
docsSection.addRow(row => {
row.addThumbRating('docsHelpful', {
label: 'Was the documentation helpful enough to complete the integration?',
showLabels: true,
upLabel: 'Yes, sufficient',
downLabel: 'No, needed more',
alignment: 'center'
});
});
docsSection.addRow(row => {
row.addTextarea('docsMissing', {
label: 'What was missing or unclear in the documentation?',
placeholder: 'Describe any gaps, unclear sections, or missing examples...',
rows: 3,
autoExpand: true,
isVisible: () => docsSection.thumbRating('docsHelpful')?.value() === 'down'
});
});
// ============================================
// SECTION 4: Technical Implementation
// ============================================
const techSection = form.addSubform('technical', {
title: 'Technical Implementation'
});
techSection.addRow(row => {
row.addStarRating('apiDesign', {
label: 'Rate the API/Integration design',
maxStars: 5,
size: 'lg',
alignment: 'center',
showCounter: true
});
});
techSection.addRow(row => {
row.addRatingScale('easeOfSetup', {
label: 'How easy was the initial setup?',
preset: 'likert-5',
lowLabel: 'Very Difficult',
highLabel: 'Very Easy',
alignment: 'center'
});
});
techSection.addRow(row => {
row.addCheckboxList('technicalChallenges', {
label: 'What challenges did you encounter? (Select all that apply)',
options: [
{ id: 'auth', name: 'Authentication/Authorization' },
{ id: 'rate-limits', name: 'Rate limiting issues' },
{ id: 'error-handling', name: 'Error handling/messages' },
{ id: 'data-format', name: 'Data format/schema issues' },
{ id: 'versioning', name: 'API versioning' },
{ id: 'testing', name: 'Testing/sandbox environment' },
{ id: 'performance', name: 'Performance/latency' },
{ id: 'webhooks', name: 'Webhook reliability' },
{ id: 'none', name: 'No significant challenges' }
],
orientation: 'vertical'
});
});
techSection.addSpacer({ height: '15px' });
techSection.addRow(row => {
row.addTextarea('challengeDetails', {
label: 'Describe the most significant technical challenge',
placeholder: 'What was the issue? How did you resolve it?',
rows: 3,
autoExpand: true,
isVisible: () => {
const challenges = techSection.checkboxList('technicalChallenges')?.value() || [];
return challenges.length > 0 && !challenges.includes('none');
}
});
});
// ============================================
// SECTION 5: Support Experience
// ============================================
const supportSection = form.addSubform('support', {
title: 'Support & Assistance'
});
supportSection.addRow(row => {
row.addThumbRating('neededSupport', {
label: 'Did you need to contact support during integration?',
showLabels: true,
upLabel: 'Yes',
downLabel: 'No',
alignment: 'center'
});
});
supportSection.addRow(row => {
row.addStarRating('supportQuality', {
label: 'How would you rate the support you received?',
maxStars: 5,
size: 'lg',
alignment: 'center',
showCounter: true,
isVisible: () => supportSection.thumbRating('neededSupport')?.value() === 'up'
});
});
supportSection.addRow(row => {
row.addRadioButton('supportChannel', {
label: 'Which support channel did you use?',
options: [
{ id: 'docs', name: 'Documentation/self-service' },
{ id: 'email', name: 'Email support' },
{ id: 'chat', name: 'Live chat' },
{ id: 'community', name: 'Community/forums' },
{ id: 'slack', name: 'Slack/Discord' },
{ id: 'phone', name: 'Phone support' },
{ id: 'dedicated', name: 'Dedicated success manager' }
],
orientation: 'vertical',
isVisible: () => supportSection.thumbRating('neededSupport')?.value() === 'up'
});
});
// ============================================
// SECTION 6: Outcome & Satisfaction
// ============================================
const outcomeSection = form.addSubform('outcome', {
title: 'Integration Outcome'
});
outcomeSection.addRow(row => {
row.addRadioButton('integrationStatus', {
label: 'Current integration status',
options: [
{ id: 'production', name: 'Live in production' },
{ id: 'staging', name: 'In staging/testing' },
{ id: 'development', name: 'Still in development' },
{ id: 'paused', name: 'Paused/blocked' },
{ id: 'abandoned', name: 'Abandoned' }
],
orientation: 'vertical'
});
});
outcomeSection.addRow(row => {
row.addTextarea('blockerDetails', {
label: 'What is blocking your integration?',
placeholder: 'Describe the blocker and what would help you move forward...',
rows: 3,
autoExpand: true,
isVisible: () => {
const status = outcomeSection.radioButton('integrationStatus')?.value();
return status === 'paused' || status === 'abandoned';
}
});
});
outcomeSection.addRow(row => {
row.addRatingScale('nps', {
preset: 'nps',
label: 'How likely are you to recommend our integration to other developers?',
showCategoryLabel: true,
showSegmentColors: true,
isRequired: true
});
});
outcomeSection.addRow(row => {
row.addThumbRating('wouldIntegrateAgain', {
label: 'Would you build another integration with us?',
showLabels: true,
upLabel: 'Yes',
downLabel: 'No',
alignment: 'center'
});
});
// ============================================
// SECTION 7: Improvements
// ============================================
const improvementsSection = form.addSubform('improvements', {
title: 'Suggestions for Improvement'
});
improvementsSection.addSpacer({ height: '10px' });
improvementsSection.addRow(row => {
row.addTextarea('topImprovement', {
label: 'What one thing would most improve the integration experience?',
placeholder: 'Share your top suggestion...',
rows: 3,
autoExpand: true
});
});
improvementsSection.addRow(row => {
row.addTextarea('additionalFeedback', {
label: 'Any additional feedback for our engineering team?',
placeholder: 'Technical suggestions, feature requests, or other thoughts...',
rows: 3,
autoExpand: true
});
});
// ============================================
// SECTION 8: Summary
// ============================================
const summarySection = form.addSubform('summary', {
title: 'Integration Feedback Summary',
isVisible: () => outcomeSection.ratingScale('nps')?.value() !== null
});
summarySection.addRow(row => {
row.addTextPanel('summaryContent', {
computedValue: () => {
const integrationType = detailsSection.dropdown('integrationType')?.value();
const complexity = detailsSection.dropdown('complexity')?.value();
const overallExp = overallSection.emojiRating('overallExperience')?.value();
const timeSpent = overallSection.slider('timeToIntegrate')?.value();
const apiRating = techSection.starRating('apiDesign')?.value();
const npsScore = outcomeSection.ratingScale('nps')?.value();
const npsCategory = outcomeSection.ratingScale('nps')?.npsCategory();
const status = outcomeSection.radioButton('integrationStatus')?.value();
const challenges = techSection.checkboxList('technicalChallenges')?.value() || [];
const typeLabels: Record<string, string> = {
'rest-api': 'REST API',
'graphql': 'GraphQL API',
'webhooks': 'Webhooks',
'sdk': 'SDK/Library',
'native': 'Native Integration',
'zapier': 'Zapier/Automation',
'custom': 'Custom',
'other': 'Other'
};
const expLabels: Record<string, string> = {
'very-hard': 'Very Difficult',
'hard': 'Difficult',
'neutral': 'Moderate',
'easy': 'Easy',
'very-easy': 'Very Easy'
};
const statusLabels: Record<string, string> = {
'production': 'Live',
'staging': 'Testing',
'development': 'In Dev',
'paused': 'Paused',
'abandoned': 'Abandoned'
};
let statusIcon = '🟡';
if (npsCategory === 'promoter') statusIcon = '🟢';
if (npsCategory === 'detractor') statusIcon = '🔴';
let summary = `${statusIcon} Integration Feedback Summary\n`;
summary += `${'═'.repeat(32)}\n\n`;
if (integrationType) {
summary += `🔌 Type: ${typeLabels[integrationType] || integrationType}\n`;
}
if (complexity) {
summary += `📊 Complexity: ${complexity.charAt(0).toUpperCase() + complexity.slice(1)}\n`;
}
if (overallExp) {
summary += `🎯 Experience: ${expLabels[overallExp] || overallExp}\n`;
}
if (timeSpent) {
summary += `⏱️ Time: ${timeSpent} hours\n`;
}
if (apiRating) {
summary += `⭐ API Design: ${apiRating}/5\n`;
}
if (npsScore !== null && npsScore !== undefined) {
summary += `\n📈 Developer NPS: ${npsScore}/10 (${npsCategory?.charAt(0).toUpperCase()}${npsCategory?.slice(1)})\n`;
}
if (status) {
summary += `📦 Status: ${statusLabels[status] || status}\n`;
}
if (challenges.length > 0 && !challenges.includes('none')) {
summary += `\n⚠️ Challenges: ${challenges.length} reported`;
}
return summary;
},
customStyles: () => {
const npsCategory = outcomeSection.ratingScale('nps')?.npsCategory();
const baseStyles = {
padding: '20px',
borderRadius: '8px',
whiteSpace: 'pre-wrap',
fontFamily: 'monospace',
fontSize: '14px'
};
if (npsCategory === 'promoter') {
return { ...baseStyles, backgroundColor: '#d1fae5', borderLeft: '4px solid #10b981' };
} else if (npsCategory === 'passive') {
return { ...baseStyles, backgroundColor: '#fef3c7', borderLeft: '4px solid #f59e0b' };
} else if (npsCategory === 'detractor') {
return { ...baseStyles, backgroundColor: '#fee2e2', borderLeft: '4px solid #ef4444' };
}
return { ...baseStyles, backgroundColor: '#f1f5f9', borderLeft: '4px solid #94a3b8' };
}
});
});
// ============================================
// FORM CONFIGURATION
// ============================================
form.configureSubmitButton({
label: 'Submit Integration Feedback',
isVisible: () => outcomeSection.ratingScale('nps')?.value() !== null
});
form.configureCompletionScreen({
type: 'text',
title: 'Thank You for Your Developer Feedback!',
message: 'Your technical insights help us build a better integration experience. Our engineering team reviews all feedback to improve documentation, APIs, and developer tools.'
});
}