Enterprise UI redesign — Phases 14–22 (Docusign-branded migration console) #1

Merged
paulh merged 24 commits from ui-redesign into master 2026-04-21 15:30:44 -05:00
1 changed files with 20 additions and 9 deletions
Showing only changes of commit 5eee7e0ab4 - Show all commits

View File

@ -4,7 +4,8 @@ import { api } from './api.js';
import { state } from './state.js';
import { escHtml, formatDateTime } from './utils.js';
const POLL_MS = 5000;
const POLL_MS = 30_000; // DocuSign rate-limit guidance: no more than once per 15 min in prod
const POLL_TIMEOUT = 300_000; // 5 minutes — treat as manual quick-test only; prod should use DS Connect
const _envelopes = {}; // { adobeId: { envelopeId, status, sentAt, completedAt, polling } }
function getSettings() {
@ -115,6 +116,9 @@ function _verifyRow(t, settings) {
} else if (env.status === 'voided') {
statusCell = '<span class="badge badge-gray">Voided</span>';
actionsCell = `<button class="btn btn-primary btn-sm btn-send-test" data-id="${escHtml(t.adobe_id)}">Send Again</button>`;
} else if (env.status === 'timeout') {
statusCell = '<span class="badge badge-amber">Timed Out</span>';
actionsCell = `<button class="btn btn-primary btn-sm btn-send-test" data-id="${escHtml(t.adobe_id)}">Send Again</button>`;
} else {
statusCell = `<span class="badge badge-amber">${escHtml(env.status || 'pending')}</span>`;
}
@ -211,19 +215,23 @@ function _startPolling(adobeId, envelopeId) {
const env = _envelopes[adobeId];
if (!env || env.polling) return;
env.polling = true;
const deadline = Date.now() + POLL_TIMEOUT;
const poll = async () => {
try {
const data = await api.verify.status(envelopeId);
if (_envelopes[adobeId]) {
_envelopes[adobeId].status = data.status;
_envelopes[adobeId].completedAt = data.completed_at;
if (!_envelopes[adobeId]) return;
_envelopes[adobeId].status = data.status;
_envelopes[adobeId].completedAt = data.completed_at;
_updateVerifyRow(adobeId);
if (data.status === 'completed' || data.status === 'voided') {
_envelopes[adobeId].polling = false;
} else if (Date.now() >= deadline) {
_envelopes[adobeId].polling = false;
_envelopes[adobeId].status = 'timeout';
_updateVerifyRow(adobeId);
if (data.status !== 'completed' && data.status !== 'voided') {
setTimeout(poll, POLL_MS);
} else {
_envelopes[adobeId].polling = false;
}
} else {
setTimeout(poll, POLL_MS);
}
} catch (e) {
console.warn('Polling error:', e.message);
@ -252,6 +260,9 @@ function _updateVerifyRow(adobeId) {
} else if (env.status === 'voided') {
statusEl.innerHTML = '<span class="badge badge-gray">Voided</span>';
actionsEl.innerHTML = `<button class="btn btn-primary btn-sm btn-send-test" data-id="${escHtml(adobeId)}">Send Again</button>`;
} else if (env.status === 'timeout') {
statusEl.innerHTML = '<span class="badge badge-amber">Timed Out</span>';
actionsEl.innerHTML = `<button class="btn btn-primary btn-sm btn-send-test" data-id="${escHtml(adobeId)}">Send Again</button>`;
}
// Re-wire newly injected buttons