From 1bca73dde54ac3ca036def2fe45092cfe8fc77a9 Mon Sep 17 00:00:00 2001 From: Brian O'Kelley Date: Fri, 2 Jan 2026 19:48:20 -0500 Subject: [PATCH 1/2] Add unified account management system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add migration 100 for user_stakeholders and action_items tables - Create account-management-db.ts service for stakeholders and action items - Add momentum-check.ts job for analyzing outreach and creating action items - Enhance admin-users.html with action items panel and My Accounts tab - Reorganize admin sidebar with Account Management section - Add API routes for action items (list, create, complete, dismiss, snooze) - Add dry-run and preview endpoints for momentum check testing - Update outreach service to auto-assign stakeholders 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .changeset/many-doors-shine.md | 10 + server/public/admin-sidebar.js | 22 +- server/public/admin-users.html | 466 ++++++++++++++- server/src/addie/jobs/momentum-check.ts | 534 ++++++++++++++++++ .../src/addie/services/proactive-outreach.ts | 41 +- server/src/db/account-management-db.ts | 489 ++++++++++++++++ .../099_update_outreach_messages.sql | 33 ++ .../db/migrations/100_account_management.sql | 232 ++++++++ server/src/routes/admin-insights.ts | 337 ++++++++++- 9 files changed, 2142 insertions(+), 22 deletions(-) create mode 100644 .changeset/many-doors-shine.md create mode 100644 server/src/addie/jobs/momentum-check.ts create mode 100644 server/src/db/account-management-db.ts create mode 100644 server/src/db/migrations/099_update_outreach_messages.sql create mode 100644 server/src/db/migrations/100_account_management.sql diff --git a/.changeset/many-doors-shine.md b/.changeset/many-doors-shine.md new file mode 100644 index 0000000000..8973ad0967 --- /dev/null +++ b/.changeset/many-doors-shine.md @@ -0,0 +1,10 @@ +--- +--- + +Add unified account management system with action items, user stakeholders, and momentum tracking. + +- New migration for user_stakeholders and action_items tables +- Database service for managing account assignments and action items +- Momentum check job for analyzing outreach history and creating action items +- Admin UI with action items panel and My Accounts tab +- Reorganized admin sidebar with Account Management section diff --git a/server/public/admin-sidebar.js b/server/public/admin-sidebar.js index d04134e414..6c42624457 100644 --- a/server/public/admin-sidebar.js +++ b/server/public/admin-sidebar.js @@ -15,11 +15,11 @@ ] }, { - label: 'Members', + label: 'Account Management', items: [ + { href: '/admin/users', label: 'Users & Actions', icon: '👤' }, { href: '/admin/prospects', label: 'Prospects', icon: '🎯' }, - { href: '/admin/members', label: 'Members', icon: '🏢' }, - { href: '/admin/users', label: 'Users', icon: '👤' }, + { href: '/admin/members', label: 'Organizations', icon: '🏢' }, ] }, { @@ -37,14 +37,6 @@ { href: '/admin/billing', label: 'Stripe Linking', icon: '🔗' }, ] }, - { - label: 'Engagement', - items: [ - { href: '/admin/insights', label: 'Member Insights', icon: '🧠' }, - { href: '/admin/insight-types', label: 'Insight Types', icon: '🏷️' }, - { href: '/admin/outreach', label: 'Outreach', icon: '📣' }, - ] - }, { label: 'System', items: [ @@ -57,6 +49,14 @@ { href: '/admin/analytics', label: 'Analytics', icon: '📈' }, { href: '/admin/audit', label: 'Audit Log', icon: '📜' }, ] + }, + { + label: 'Settings', + items: [ + { href: '/admin/insight-types', label: 'Insight Types', icon: '🏷️' }, + { href: '/admin/outreach', label: 'Outreach Config', icon: '📣' }, + { href: '/admin/insights', label: 'Raw Insights', icon: '🧠' }, + ] } ] }; diff --git a/server/public/admin-users.html b/server/public/admin-users.html index 7d297e528e..673f62d435 100644 --- a/server/public/admin-users.html +++ b/server/public/admin-users.html @@ -4,7 +4,7 @@ - Admin - Users - AdCP Registry + Admin - Users & Actions - AgenticAdvertising.org @@ -483,6 +483,193 @@ color: var(--color-text-heading); } + /* Action Items Panel */ + .action-items-panel { + background: var(--color-bg-card); + border-radius: var(--radius-md); + padding: var(--space-5); + margin-bottom: var(--space-5); + box-shadow: var(--shadow-xs); + } + .action-items-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: var(--space-4); + } + .action-items-header h2 { + margin: 0; + font-size: var(--text-lg); + color: var(--color-text-heading); + } + .action-items-stats { + display: flex; + gap: var(--space-4); + font-size: var(--text-sm); + } + .action-stat { + display: flex; + align-items: center; + gap: var(--space-1); + } + .action-stat-count { + font-weight: var(--font-bold); + color: var(--color-text-heading); + } + .action-stat-label { + color: var(--color-text-secondary); + } + .action-stat-high .action-stat-count { color: var(--color-error-600); } + .action-stat-medium .action-stat-count { color: var(--color-warning-600); } + .action-stat-low .action-stat-count { color: var(--color-success-600); } + .action-items-list { + display: flex; + flex-direction: column; + gap: var(--space-3); + } + .action-item-card { + display: flex; + justify-content: space-between; + align-items: flex-start; + padding: var(--space-4); + background: var(--color-gray-50); + border-radius: var(--radius-md); + border-left: 3px solid var(--color-gray-400); + } + .action-item-card.priority-high { border-left-color: var(--color-error-500); } + .action-item-card.priority-medium { border-left-color: var(--color-warning-500); } + .action-item-card.priority-low { border-left-color: var(--color-success-500); } + .action-item-content { + flex: 1; + min-width: 0; + } + .action-item-title { + font-weight: var(--font-medium); + color: var(--color-text-heading); + margin-bottom: var(--space-1); + } + .action-item-meta { + font-size: var(--text-sm); + color: var(--color-text-secondary); + display: flex; + gap: var(--space-3); + flex-wrap: wrap; + } + .action-item-user { + color: var(--color-brand); + font-weight: var(--font-medium); + } + .action-type-badge { + display: inline-block; + padding: 2px var(--space-2); + border-radius: var(--radius-sm); + font-size: var(--text-xs); + font-weight: var(--font-medium); + } + .action-type-nudge { background: var(--color-warning-100); color: var(--color-warning-700); } + .action-type-warm_lead { background: var(--color-info-100); color: var(--color-info-700); } + .action-type-momentum { background: var(--color-success-100); color: var(--color-success-700); } + .action-type-feedback { background: var(--color-primary-100); color: var(--color-primary-700); } + .action-type-alert { background: var(--color-error-100); color: var(--color-error-700); } + .action-type-follow_up { background: #9c27b020; color: #9c27b0; } + .action-type-celebration { background: #f3e8ff; color: #7c3aed; } + .action-item-actions { + display: flex; + gap: var(--space-2); + flex-shrink: 0; + } + .empty-actions { + text-align: center; + padding: var(--space-6); + color: var(--color-text-secondary); + font-size: var(--text-sm); + } + + /* Tab Navigation */ + .tab-nav { + display: flex; + gap: var(--space-1); + border-bottom: var(--border-1) solid var(--color-gray-200); + margin-bottom: var(--space-5); + } + .tab-btn { + padding: var(--space-3) var(--space-4); + border: none; + background: none; + cursor: pointer; + color: var(--color-text-secondary); + font-size: var(--text-sm); + font-weight: var(--font-medium); + border-bottom: 2px solid transparent; + margin-bottom: -1px; + transition: var(--transition-all); + } + .tab-btn:hover { + color: var(--color-text-heading); + } + .tab-btn.active { + color: var(--color-brand); + border-bottom-color: var(--color-brand); + } + .tab-content { + display: none; + } + .tab-content.active { + display: block; + } + + /* My Accounts View */ + .accounts-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); + gap: var(--space-4); + } + .account-card { + background: var(--color-gray-50); + border-radius: var(--radius-md); + padding: var(--space-4); + position: relative; + } + .account-card-header { + display: flex; + justify-content: space-between; + align-items: flex-start; + margin-bottom: var(--space-3); + } + .account-name { + font-weight: var(--font-medium); + color: var(--color-text-heading); + } + .account-email { + font-size: var(--text-sm); + color: var(--color-text-secondary); + } + .account-role-badge { + padding: 2px var(--space-2); + border-radius: var(--radius-sm); + font-size: var(--text-xs); + font-weight: var(--font-medium); + } + .role-owner { background: var(--color-primary-100); color: var(--color-primary-700); } + .role-interested { background: var(--color-info-100); color: var(--color-info-700); } + .role-connected { background: var(--color-gray-200); color: var(--color-gray-600); } + .account-stats { + display: flex; + gap: var(--space-4); + font-size: var(--text-sm); + color: var(--color-text-secondary); + margin-bottom: var(--space-3); + } + .account-actions-count { + display: flex; + align-items: center; + gap: var(--space-1); + } + .account-actions-count.has-items { + color: var(--color-warning-600); + font-weight: var(--font-medium); + } + /* Responsive table */ @media (max-width: 768px) { .users-table thead { display: none; } @@ -516,11 +703,35 @@