From 17e478e996ed8acb52d97fa42781248ea50b7997 Mon Sep 17 00:00:00 2001 From: Paul Huliganga Date: Tue, 21 Apr 2026 11:41:45 -0400 Subject: [PATCH] =?UTF-8?q?feat(ui-phase-21):=20settings=20view=20?= =?UTF-8?q?=E2=80=94=20verification=20defaults,=20migration=20defaults?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three sections: Verification (test recipient name/email, auto-void timer), Migration Defaults (overwrite toggle, include documents toggle), Connections (read-only auth status + account IDs from /api/auth/status). Save writes to localStorage key 'migrator_settings'. Values pre-read by migration options modal and verification send dialog. Co-Authored-By: Claude Sonnet 4.6 --- web/static/js/settings.js | 184 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 web/static/js/settings.js diff --git a/web/static/js/settings.js b/web/static/js/settings.js new file mode 100644 index 0000000..8795596 --- /dev/null +++ b/web/static/js/settings.js @@ -0,0 +1,184 @@ +// Settings view — verification defaults, migration defaults, connection info + +import { api } from './api.js'; +import { state } from './state.js'; +import { escHtml } from './utils.js'; + +const SETTINGS_KEY = 'migrator_settings'; + +export function loadSettings() { + try { return JSON.parse(localStorage.getItem(SETTINGS_KEY)) || {}; } + catch { return {}; } +} + +export function saveSettings(settings) { + localStorage.setItem(SETTINGS_KEY, JSON.stringify(settings)); +} + +export function renderSettings() { + const outlet = document.getElementById('router-outlet'); + const s = loadSettings(); + + outlet.innerHTML = ` + + + +
+
+
Verification
+
Default recipient for test envelopes
+
+
+
+
+
Test Recipient Name
+
Pre-filled in the Send Test dialog on the Verification screen
+
+
+ +
+
+
+
+
Test Recipient Email
+
Pre-filled in the Send Test dialog
+
+
+ +
+
+
+
+
Auto-Void Timer (hours)
+
Reminder to void test envelopes after this many hours (display only — no automatic action)
+
+
+ +
+
+
+
+ + +
+
+
Migration Defaults
+
Pre-set options in the migration options modal
+
+
+
+
+
Overwrite Existing by Default
+
When on, the Overwrite Existing toggle in the migration modal starts enabled
+
+
+ +
+
+
+
+
Include Documents by Default
+
Embed PDFs in the DocuSign template payload
+
+
+ +
+
+
+
+ + +
+
+
Connections
+
Current platform connection status (connect via top bar)
+
+
+
Loading…
+
+
+ + +
+ + +
+ `; + + // Wire toggles + document.querySelectorAll('.toggle').forEach(btn => { + btn.addEventListener('click', () => { + btn.classList.toggle('on'); + btn.setAttribute('aria-checked', btn.classList.contains('on')); + }); + }); + + // Save + document.getElementById('btn-save-settings')?.addEventListener('click', () => { + const updated = { + testRecipientName: document.getElementById('set-recipient-name')?.value.trim() || '', + testRecipientEmail: document.getElementById('set-recipient-email')?.value.trim() || '', + autoVoidHours: parseInt(document.getElementById('set-auto-void')?.value) || 24, + defaultOverwrite: document.getElementById('set-overwrite')?.classList.contains('on') || false, + defaultIncludeDocs: document.getElementById('set-include-docs')?.classList.contains('on') !== false, + }; + saveSettings(updated); + const confirm = document.getElementById('save-confirm'); + if (confirm) { + confirm.style.display = 'inline'; + setTimeout(() => { confirm.style.display = 'none'; }, 2500); + } + }); + + // Load connection info + _loadConnInfo(); +} + +async function _loadConnInfo() { + const connEl = document.getElementById('settings-conn-info'); + if (!connEl) return; + + try { + const data = await api.auth.status(); + connEl.innerHTML = ` +
+ Adobe Sign + ${data.adobe ? 'Connected' : 'Not connected'} + + ${data.adobe ? '● Connected' : '○ Disconnected'} + +
+
+ DocuSign + ${data.docusign ? 'Connected' : 'Not connected'} + + ${data.docusign ? '● Connected' : '○ Disconnected'} + +
+
+ DocuSign Account ID + ${escHtml(data.docusign_account_id || '—')} + +
+
+ API Environment + ${escHtml(data.base_url || '—')} + +
+ `; + } catch (e) { + connEl.innerHTML = `
Failed to load connection info: ${escHtml(e.message)}
`; + } +}