export function onboardingFlowFeedbackSurvey(form: FormTs) {
// Onboarding Flow Feedback - Multi-page step-by-step onboarding evaluation
// Demonstrates: addPages (multi-page wizard), RatingScale (CES), StarRating, EmojiRating, MatrixQuestion
// ============================================
// HEADER
// ============================================
form.addRow(row => {
row.addTextPanel('header', {
label: 'Onboarding Experience Feedback',
computedValue: () => "Help us improve the getting-started experience. Rate each step of your onboarding journey.",
customStyles: {
backgroundColor: '#6366f1',
color: 'white',
padding: '24px',
borderRadius: '12px',
textAlign: 'center'
}
});
});
// ============================================
// MULTI-PAGE ONBOARDING REVIEW
// ============================================
const pages = form.addPages('onboardingPages', {
heightMode: 'current-page'
});
// ----------------------------------------
// PAGE 1: Account Creation
// ----------------------------------------
const page1 = pages.addPage('accountCreation');
page1.addRow(row => {
row.addTextPanel('page1Title', {
label: 'Step 1 of 4: Account Creation',
customStyles: {
backgroundColor: '#e0e7ff',
color: '#3730a3',
padding: '12px 16px',
borderRadius: '8px',
fontWeight: 'bold',
textAlign: 'center'
}
});
});
const signupSection = page1.addSubform('signupSection', {
title: 'Sign-up Experience'
});
signupSection.addRow(row => {
row.addRatingScale('signupEffort', {
preset: 'ces',
label: 'How easy was it to create your account?',
lowLabel: 'Very difficult',
highLabel: 'Very easy',
size: 'md',
alignment: 'center',
isRequired: true
});
});
signupSection.addSpacer({ height: '16px' });
signupSection.addRow(row => {
row.addCheckboxList('signupIssues', {
label: 'Did you experience any issues? (Select all that apply)',
options: [
{ id: 'none', name: 'No issues' },
{ id: 'email-verification', name: 'Email verification problems' },
{ id: 'password-requirements', name: 'Confusing password requirements' },
{ id: 'social-login', name: 'Social login not working' },
{ id: 'too-long', name: 'Form was too long' },
{ id: 'errors', name: 'Technical errors' }
],
orientation: 'vertical'
});
});
page1.addRow(row => {
row.addButton('nextPage1', {
label: 'Next: Profile Setup →',
onClick: () => pages.goToPage('profileSetup')
});
});
// ----------------------------------------
// PAGE 2: Profile Setup
// ----------------------------------------
const page2 = pages.addPage('profileSetup');
page2.addRow(row => {
row.addTextPanel('page2Title', {
label: 'Step 2 of 4: Profile Setup',
customStyles: {
backgroundColor: '#e0e7ff',
color: '#3730a3',
padding: '12px 16px',
borderRadius: '8px',
fontWeight: 'bold',
textAlign: 'center'
}
});
});
const profileSection = page2.addSubform('profileSection', {
title: 'Profile Configuration'
});
profileSection.addRow(row => {
row.addStarRating('profileRating', {
label: 'Rate the profile setup experience',
maxStars: 5,
size: 'lg',
alignment: 'center'
});
});
profileSection.addSpacer({ height: '16px' });
profileSection.addRow(row => {
row.addRadioButton('profileRelevance', {
label: 'Were the profile questions relevant to your needs?',
options: [
{ id: 'very-relevant', name: 'Very relevant' },
{ id: 'somewhat-relevant', name: 'Somewhat relevant' },
{ id: 'not-relevant', name: 'Not relevant' },
{ id: 'too-personal', name: 'Too personal/intrusive' }
],
orientation: 'vertical'
});
});
profileSection.addSpacer();
profileSection.addRow(row => {
row.addTextarea('profileFeedback', {
label: 'Any suggestions for the profile setup?',
placeholder: 'What would make this step better?',
rows: 2,
autoExpand: true
});
});
page2.addRow(row => {
row.addButton('backPage2', {
label: '← Back',
onClick: () => pages.goToPage('accountCreation')
}, '1fr');
row.addButton('nextPage2', {
label: 'Next: First Action →',
onClick: () => pages.goToPage('firstAction')
}, '1fr');
});
// ----------------------------------------
// PAGE 3: First Action / Tutorial
// ----------------------------------------
const page3 = pages.addPage('firstAction');
page3.addRow(row => {
row.addTextPanel('page3Title', {
label: 'Step 3 of 4: Tutorial & First Action',
customStyles: {
backgroundColor: '#e0e7ff',
color: '#3730a3',
padding: '12px 16px',
borderRadius: '8px',
fontWeight: 'bold',
textAlign: 'center'
}
});
});
const tutorialSection = page3.addSubform('tutorialSection', {
title: 'Tutorial Experience'
});
tutorialSection.addRow(row => {
row.addThumbRating('completedTutorial', {
label: 'Did you complete the tutorial?',
showLabels: true,
upLabel: 'Yes',
downLabel: 'No/Skipped',
size: 'lg',
alignment: 'center'
});
});
tutorialSection.addSpacer({ height: '16px' });
tutorialSection.addRow(row => {
row.addMatrixQuestion('tutorialMatrix', {
label: 'Rate the tutorial on these aspects:',
rows: [
{ id: 'clarity', label: 'Instructions were clear', isRequired: true },
{ id: 'length', label: 'Length was appropriate', isRequired: true },
{ id: 'helpful', label: 'Content was helpful', isRequired: true },
{ id: 'engaging', label: 'Tutorial was engaging', isRequired: false }
],
columns: [
{ id: 'strongly-agree', label: 'Strongly Agree' },
{ id: 'agree', label: 'Agree' },
{ id: 'neutral', label: 'Neutral' },
{ id: 'disagree', label: 'Disagree' },
{ id: 'strongly-disagree', label: 'Strongly Disagree' }
],
striped: true,
fullWidth: true,
isVisible: () => tutorialSection.thumbRating('completedTutorial')?.value() === 'up'
});
});
// Skip reason for those who didn't complete
tutorialSection.addRow(row => {
row.addCheckboxList('skipReason', {
label: 'Why did you skip or not complete the tutorial?',
options: [
{ id: 'too-long', name: 'It was too long' },
{ id: 'already-know', name: 'I already know how to use similar products' },
{ id: 'not-relevant', name: 'Content seemed not relevant' },
{ id: 'confusing', name: 'It was confusing' },
{ id: 'just-explore', name: 'I prefer to explore on my own' }
],
orientation: 'vertical',
isVisible: () => tutorialSection.thumbRating('completedTutorial')?.value() === 'down'
});
});
page3.addRow(row => {
row.addButton('backPage3', {
label: '← Back',
onClick: () => pages.goToPage('profileSetup')
}, '1fr');
row.addButton('nextPage3', {
label: 'Next: Overall Experience →',
onClick: () => pages.goToPage('overall')
}, '1fr');
});
// ----------------------------------------
// PAGE 4: Overall Experience
// ----------------------------------------
const page4 = pages.addPage('overall');
page4.addRow(row => {
row.addTextPanel('page4Title', {
label: 'Step 4 of 4: Overall Experience',
customStyles: {
backgroundColor: '#d1fae5',
color: '#065f46',
padding: '12px 16px',
borderRadius: '8px',
fontWeight: 'bold',
textAlign: 'center'
}
});
});
const overallSection = page4.addSubform('overallSection', {
title: 'Overall Onboarding Assessment',
customStyles: () => {
const effort = overallSection.ratingScale('overallEffort')?.value();
if (effort && effort >= 6) return { backgroundColor: '#d1fae5', padding: '16px', borderRadius: '8px' };
if (effort && effort <= 3) return { backgroundColor: '#fee2e2', padding: '16px', borderRadius: '8px' };
return { backgroundColor: '#f8fafc', padding: '16px', borderRadius: '8px' };
}
});
overallSection.addRow(row => {
row.addRatingScale('overallEffort', {
preset: 'ces',
label: 'Overall, how easy was the entire onboarding process?',
lowLabel: 'Very difficult',
highLabel: 'Very easy',
size: 'lg',
alignment: 'center',
isRequired: true
});
});
overallSection.addSpacer({ height: '20px' });
overallSection.addRow(row => {
row.addEmojiRating('readiness', {
label: 'After onboarding, how ready do you feel to use the product?',
preset: 'custom',
emojis: [
{ id: 'lost', emoji: '😵', label: 'Still lost' },
{ id: 'unsure', emoji: '🤔', label: 'Unsure' },
{ id: 'okay', emoji: '😐', label: 'Okay' },
{ id: 'confident', emoji: '😊', label: 'Confident' },
{ id: 'ready', emoji: '🚀', label: 'Ready to go!' }
],
size: 'lg',
showLabels: true,
alignment: 'center'
});
});
overallSection.addSpacer({ height: '20px' });
overallSection.addRow(row => {
row.addSlider('timeSpent', {
label: 'Approximately how many minutes did onboarding take?',
min: 1,
max: 30,
step: 1,
showValue: true,
unit: 'min',
defaultValue: 5
});
});
// Time perception
overallSection.addSpacer({ height: '16px' });
overallSection.addRow(row => {
row.addRadioButton('timeFelt', {
label: () => {
const time = overallSection.slider('timeSpent')?.value();
return `Did ${time || 'the'} minutes feel...`;
},
options: [
{ id: 'too-short', name: 'Too short (needed more guidance)' },
{ id: 'just-right', name: 'Just right' },
{ id: 'too-long', name: 'Too long' }
],
orientation: 'horizontal'
});
});
// Improvement suggestion
const improvementSection = page4.addSubform('improvementSection', {
title: 'Help Us Improve'
});
improvementSection.addRow(row => {
row.addSuggestionChips('whatToImprove', {
label: 'What would you most like us to improve?',
suggestions: [
{ id: 'simpler', name: 'Make it simpler' },
{ id: 'faster', name: 'Make it faster' },
{ id: 'more-guidance', name: 'More guidance' },
{ id: 'less-steps', name: 'Fewer steps' },
{ id: 'skip-option', name: 'Option to skip' },
{ id: 'video-tutorial', name: 'Video tutorials' },
{ id: 'live-help', name: 'Live help option' }
],
max: 3,
alignment: 'center'
});
});
improvementSection.addSpacer();
improvementSection.addRow(row => {
row.addTextarea('additionalFeedback', {
label: 'Any other feedback on the onboarding experience?',
placeholder: 'Share your thoughts...',
rows: 3,
autoExpand: true
});
});
page4.addRow(row => {
row.addButton('backPage4', {
label: '← Back',
onClick: () => pages.goToPage('firstAction')
});
});
// ============================================
// SUMMARY SECTION (Outside pages, always visible)
// ============================================
const summarySection = form.addSubform('summarySection', {
title: 'Your Feedback Summary',
isVisible: () => {
const signupEffort = signupSection.ratingScale('signupEffort')?.value();
const overallEffort = overallSection.ratingScale('overallEffort')?.value();
return signupEffort !== null && overallEffort !== null;
}
});
summarySection.addRow(row => {
row.addTextPanel('summary', {
computedValue: () => {
const signupEffort = signupSection.ratingScale('signupEffort')?.value();
const profileRating = profileSection.starRating('profileRating')?.value();
const completedTutorial = tutorialSection.thumbRating('completedTutorial')?.value();
const overallEffort = overallSection.ratingScale('overallEffort')?.value();
const readiness = overallSection.emojiRating('readiness')?.value();
const timeSpent = overallSection.slider('timeSpent')?.value();
const improvements = improvementSection.suggestionChips('whatToImprove')?.value() || [];
if (!signupEffort || !overallEffort) return '';
const readinessLabels: Record<string, string> = {
'lost': 'Still lost',
'unsure': 'Unsure',
'okay': 'Okay',
'confident': 'Confident',
'ready': 'Ready to go!'
};
let summary = `🚀 Onboarding Feedback Summary\n`;
summary += `${'═'.repeat(30)}\n\n`;
summary += `Step Ratings:\n`;
summary += ` Account Creation: ${signupEffort}/7 effort\n`;
if (profileRating) summary += ` Profile Setup: ${'★'.repeat(profileRating)}${'☆'.repeat(5 - profileRating)}\n`;
summary += ` Tutorial: ${completedTutorial === 'up' ? 'Completed ✓' : 'Skipped'}\n`;
summary += `\n`;
summary += `Overall Effort: ${overallEffort}/7\n`;
if (readiness) summary += `Readiness: ${readinessLabels[readiness] || readiness}\n`;
if (timeSpent) summary += `Time Spent: ~${timeSpent} minutes\n`;
if (improvements.length > 0) {
summary += `\nAreas to Improve: ${improvements.join(', ')}`;
}
return summary;
},
customStyles: () => {
const effort = overallSection.ratingScale('overallEffort')?.value();
const baseStyles = {
padding: '16px',
borderRadius: '8px',
whiteSpace: 'pre-wrap',
fontFamily: 'monospace',
fontSize: '14px'
};
if (effort && effort >= 6) {
return { ...baseStyles, backgroundColor: '#d1fae5', borderLeft: '4px solid #10b981' };
} else if (effort && effort <= 3) {
return { ...baseStyles, backgroundColor: '#fee2e2', borderLeft: '4px solid #ef4444' };
}
return { ...baseStyles, backgroundColor: '#fef3c7', borderLeft: '4px solid #f59e0b' };
}
});
});
// ============================================
// FORM CONFIGURATION
// ============================================
form.configureSubmitButton({
label: 'Submit Onboarding Feedback',
isVisible: () => {
const signupEffort = signupSection.ratingScale('signupEffort')?.value();
const overallEffort = overallSection.ratingScale('overallEffort')?.value();
return signupEffort !== null && overallEffort !== null;
}
});
form.configureCompletionScreen({
type: 'text',
title: 'Thank You for Your Feedback!',
message: "Your insights help us create a better onboarding experience for new users. We're constantly improving based on feedback like yours."
});
}