import { state } from './state.js'; import { navigate } from './router.js'; const QUICK_START_KEY = 'migrator_quick_start_dismissed'; export function shouldShowQuickStart() { try { return localStorage.getItem(QUICK_START_KEY) !== '1'; } catch { return true; } } export function dismissQuickStart() { try { localStorage.setItem(QUICK_START_KEY, '1'); } catch {} } export function resetQuickStart() { try { localStorage.removeItem(QUICK_START_KEY); } catch {} } function onboardingStatus() { return { adobeConnected: !!state.auth.adobe, docusignConnected: !!state.auth.docusign, docusignAccountChosen: !!state.auth.docusign && !state.auth.docusignAccountSelectionRequired, templatesLoaded: (state.templates || []).length > 0, }; } function stepBadge(done, pendingLabel = 'Next') { if (done) return 'Done'; return `${pendingLabel}`; } function quickStartStepsMarkup() { const s = onboardingStatus(); return `
1. Connect Adobe Sign
Use the Adobe Sign chip in the top bar so the app can load your source templates.
${stepBadge(s.adobeConnected)}
2. Connect DocuSign
Use the Docusign chip to sign in and authorize the app for this browser session.
${stepBadge(s.docusignConnected, s.adobeConnected ? 'Next' : 'After Adobe')}
3. Choose the right DocuSign account
If your login has multiple accounts, select the exact target account before migrating anything.
${stepBadge(s.docusignAccountChosen, s.docusignConnected ? 'Next' : 'After Sign-In')}
4. Review templates and blockers
Start on Templates, scan the readiness badges, and use dry-run or single-template migration first.
${stepBadge(s.templatesLoaded, s.docusignAccountChosen && s.adobeConnected ? 'Next' : 'Pending')}
5. Verify after migration
Use Verification to send a test envelope and History to confirm what succeeded or failed.
Recommended
`; } export function quickStartCardMarkup() { return `
Quick Start
New here? This is the shortest safe path through the tool.
ℹ️ This app helps you migrate templates from Adobe Sign into DocuSign, review blockers and warnings, and send verification envelopes after migration.
${quickStartStepsMarkup()}
`; } export function bindQuickStartCard(root = document) { root.getElementById?.('btn-open-help-guide')?.addEventListener('click', () => navigate('#/help')); root.getElementById?.('btn-hide-quick-start')?.addEventListener('click', () => { dismissQuickStart(); root.getElementById('quick-start-card')?.remove(); }); } export function renderHelp() { const outlet = document.getElementById('router-outlet'); outlet.innerHTML = `
🧭 This app helps you migrate templates from Adobe Sign into DocuSign, review blockers and warnings, and send verification envelopes after migration.
Recommended First-Time Flow
${quickStartStepsMarkup()}
What Each Screen Is For
Templates
Your main workspace. Review Adobe templates, readiness badges, blockers, and launch migrations.
Migration Results
See the most recent migration outcomes, including successes, partials, and failures.
Issues & Warnings
Focus on templates that need manual review before you migrate them confidently.
Verification
Send a test envelope after migration to validate the template works in DocuSign.
History & Audit
Review what was migrated, when it happened, and what account/session produced it.
Settings
Manage connections, default verification recipients, and reopen quick-start guidance.
Tips
Pick the right DocuSign account. If you have many accounts, migrations go into the one you selected for this browser session.
Start with one template. Migrate a single clean template first before running a larger batch.
Use readiness badges. Blocked and Caveats are there to save you time before migration.
Verify afterward. A successful migration does not replace a real signing test.
If Something Looks Wrong
If no templates appear, reconnect Adobe Sign and refresh the Templates page.
If DocuSign signs you into the wrong place, use Choose Account or Switch Account.
If the Templates page shows an error banner, fix that first before trying to migrate.
`; document.getElementById('btn-help-go-templates')?.addEventListener('click', () => navigate('#/templates')); }