Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Redesign portal around task-first account flow

rcourtmanfa32599cd73d
diff --git a/internal/cloudcp/portal/dist/build_manifest.json b/internal/cloudcp/portal/dist/build_manifest.json
index 782625818c..4741528a63 100644
--- a/internal/cloudcp/portal/dist/build_manifest.json
+++ b/internal/cloudcp/portal/dist/build_manifest.json
@@ -1,5 +1,5 @@
{
- "source_hash": "f940112feac696aba21cbd51366cf23604824096f45f386e40358d2854d6c778",
+ "source_hash": "8b864021aef6e9d6dd5967577c1ba7540113e4ce64ed0099e5aebc0214530d61",
"build_inputs": [
"package.json",
"tsconfig.json",
diff --git a/internal/cloudcp/portal/dist/portal_app.css b/internal/cloudcp/portal/dist/portal_app.css
index 04475fc3dc..2d80ae561b 100644
--- a/internal/cloudcp/portal/dist/portal_app.css
+++ b/internal/cloudcp/portal/dist/portal_app.css
@@ -611,23 +611,23 @@ header .logout-btn:hover,
color: var(--ink);
}
.portal-shell[data-shell-section=overview] .portal-content-panel-overview,
-.portal-shell[data-shell-section=services] .portal-content-panel-services,
+.portal-shell[data-shell-section=billing] .portal-content-panel-billing,
.portal-shell[data-shell-section=support] .portal-content-panel-support,
.portal-shell[data-shell-section=workspaces] .portal-content-panel-overview,
-.portal-shell[data-shell-section=team] .portal-content-panel-overview {
+.portal-shell[data-shell-section=access] .portal-content-panel-overview {
display: block !important;
}
.portal-shell[data-shell-section=overview] .account-content-panel-overview,
.portal-shell[data-shell-section=workspaces] .account-content-panel-workspaces,
-.portal-shell[data-shell-section=team] .account-content-panel-team {
+.portal-shell[data-shell-section=access] .account-content-panel-access {
display: block !important;
}
.portal-shell[data-shell-section=overview] .account-content-panel-workspaces,
-.portal-shell[data-shell-section=overview] .account-content-panel-team,
+.portal-shell[data-shell-section=overview] .account-content-panel-access,
.portal-shell[data-shell-section=workspaces] .account-content-panel-overview,
-.portal-shell[data-shell-section=workspaces] .account-content-panel-team,
-.portal-shell[data-shell-section=team] .account-content-panel-overview,
-.portal-shell[data-shell-section=team] .account-content-panel-workspaces {
+.portal-shell[data-shell-section=workspaces] .account-content-panel-access,
+.portal-shell[data-shell-section=access] .account-content-panel-overview,
+.portal-shell[data-shell-section=access] .account-content-panel-workspaces {
display: none !important;
}
.portal-support-link,
@@ -732,7 +732,7 @@ header .logout-btn:hover,
}
.account-content-panel-overview,
.account-content-panel-workspaces,
-.account-content-panel-team {
+.account-content-panel-access {
padding: 0;
border: none;
border-radius: 0;
@@ -810,6 +810,141 @@ header .logout-btn:hover,
border-radius: 0;
background: transparent;
}
+.overview-task-grid,
+.billing-overview-grid {
+ display: grid;
+ gap: 14px;
+}
+.overview-task-grid {
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+}
+.billing-overview-grid {
+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
+ margin-bottom: 14px;
+}
+.overview-task-card,
+.billing-task-card {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ min-width: 0;
+ padding: 16px;
+ border: 1px solid var(--line);
+ border-radius: var(--radius-lg);
+ background: var(--panel);
+ box-shadow: var(--shadow-sm);
+}
+.overview-task-card h4,
+.billing-task-card h3 {
+ margin: 0;
+ font-family: var(--font-display);
+ font-size: 18px;
+ line-height: 1.08;
+ letter-spacing: -0.022em;
+ font-weight: 710;
+ color: var(--ink);
+}
+.overview-task-card p,
+.billing-task-card p,
+.billing-task-note {
+ margin: 0;
+ font-size: 13px;
+ line-height: 1.55;
+ color: var(--ink-soft);
+}
+.overview-task-card-attention {
+ background:
+ linear-gradient(
+ 180deg,
+ #fff7ed,
+ #ffffff 62%);
+}
+.overview-task-card-next {
+ background:
+ linear-gradient(
+ 180deg,
+ #ecfeff,
+ #ffffff 62%);
+}
+.billing-task-card-muted {
+ background: var(--panel-strong);
+}
+.overview-task-list,
+.billing-task-points {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+}
+.overview-task-item,
+.billing-task-point {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ padding-top: 10px;
+ border-top: 1px solid var(--line);
+}
+.overview-task-item:first-child,
+.billing-task-point:first-child {
+ padding-top: 0;
+ border-top: none;
+}
+.overview-task-item strong,
+.billing-task-point strong {
+ font-size: 13px;
+ color: var(--ink);
+}
+.overview-task-item span,
+.billing-task-point span {
+ font-size: 12px;
+ line-height: 1.5;
+ color: var(--ink-soft);
+}
+.overview-task-item-action {
+ flex-direction: row;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+}
+.overview-task-copy {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ min-width: 0;
+}
+.overview-task-actions,
+.overview-task-summary-bar,
+.billing-task-actions {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ flex-wrap: wrap;
+}
+.overview-task-actions,
+.billing-task-actions {
+ margin-top: auto;
+}
+.overview-task-summary-bar {
+ margin-top: 14px;
+}
+.overview-task-summary-pill {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ min-height: 34px;
+ padding: 0 12px;
+ border: 1px solid var(--line);
+ border-radius: 999px;
+ background: rgba(255, 255, 255, 0.8);
+ font-size: 12px;
+ color: var(--ink-soft);
+}
+.overview-task-summary-pill strong {
+ font-size: 10px;
+ font-weight: 800;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--ink-muted);
+}
.account-overview-main-column,
.account-overview-side-column {
display: flex;
@@ -2665,6 +2800,8 @@ header .logout-btn:hover,
.team-management-grid,
.team-review-grid,
.account-overview-secondary,
+ .overview-task-grid,
+ .billing-overview-grid,
.service-shell,
.service-action-list,
.service-empty-shell,
@@ -2804,6 +2941,7 @@ header .logout-btn:hover,
.service-empty-shell,
.service-empty-intro,
.workspace-operations-shell,
+ .overview-task-grid,
.account-overview-card,
.account-overview-secondary,
.overview-quick-actions,
diff --git a/internal/cloudcp/portal/dist/portal_app.js b/internal/cloudcp/portal/dist/portal_app.js
index 129090c0b6..ea7c8f3cf5 100644
--- a/internal/cloudcp/portal/dist/portal_app.js
+++ b/internal/cloudcp/portal/dist/portal_app.js
@@ -23,7 +23,7 @@
function roleCapabilityCopy(role) {
switch (normalizedTeamRole(role)) {
case "owner":
- return "Full account control, including billing, team access, and workspace control.";
+ return "Full account control, including billing, access control, and workspace control.";
case "admin":
return "Can manage workspaces and billing for this account.";
case "tech":
@@ -363,7 +363,7 @@
return;
case "toggle-team":
event.preventDefault();
- deps.setShellSection("team");
+ deps.setShellSection("access");
deps.runtime.ensureTeamVisible(accountID);
return;
case "invite-member":
@@ -1243,7 +1243,7 @@
switch (action) {
case "open-service-panel":
event.preventDefault();
- deps.setShellSection("services");
+ deps.setShellSection("billing");
deps.toggleServicePanel(panelID);
deps.focusElement(focusID);
return;
@@ -1778,7 +1778,7 @@
}
function renderServiceActionRow(id, kicker, title, actionLabel, description, panelID, focusID, highlights) {
var meta = highlights.join(" \u2022 ");
- return '<article class="service-action-row"><div class="service-action-main"><div class="service-action-tags service-action-tags-tight"><span class="service-card-kicker">' + kicker + '</span><span class="service-action-meta-chip">' + escapeHTML(meta) + '</span></div><div class="service-action-copy"><h3>' + title + "</h3><p>" + description + '</p></div></div><div class="service-action-cta"><button class="btn-secondary service-action-button" type="button" id="' + id + '" data-account-service-action="open-service-panel" data-account-service-panel="' + panelID + '" data-account-service-focus="' + focusID + '" data-shell-target="services">' + escapeHTML(actionLabel) + "</button></div></article>";
+ return '<article class="service-action-row"><div class="service-action-main"><div class="service-action-tags service-action-tags-tight"><span class="service-card-kicker">' + kicker + '</span><span class="service-action-meta-chip">' + escapeHTML(meta) + '</span></div><div class="service-action-copy"><h3>' + title + "</h3><p>" + description + '</p></div></div><div class="service-action-cta"><button class="btn-secondary service-action-button" type="button" id="' + id + '" data-account-service-action="open-service-panel" data-account-service-panel="' + panelID + '" data-account-service-focus="' + focusID + '" data-shell-target="billing">' + escapeHTML(actionLabel) + "</button></div></article>";
}
function renderSectionContextChips(chips) {
if (!chips.length) return "";
@@ -1814,28 +1814,10 @@
}
return results;
}
- function renderAttentionPanel(workspaces) {
- var attention = attentionWorkspaces(workspaces);
- var suspendedCount = countWorkspacesByState(workspaces, "suspended");
- if (!attention.length) {
- return '<div class="overview-side-card overview-side-card-stable"><div class="account-panel-kicker">Attention</div><h4>' + escapeHTML(suspendedCount > 0 ? "No active blockers" : "Fleet is clear") + "</h4><p>" + escapeHTML(
- suspendedCount > 0 ? "Active workspaces are healthy. Suspended workspaces stay parked until you resume them." : "Every active workspace currently reports a healthy status."
- ) + '</p><div class="overview-stable-list"><div class="overview-stable-item"><strong>Healthy now</strong><span>' + escapeHTML(
- suspendedCount > 0 ? "Active workspaces are clear for routine use." : "All active workspaces are clear for routine use."
- ) + "</span></div>" + (suspendedCount > 0 ? '<div class="overview-stable-item"><strong>Suspended stays parked</strong><span>' + escapeHTML(String(suspendedCount) + " workspace" + (suspendedCount === 1 ? " is" : "s are") + " suspended and intentionally out of day-to-day use.") + "</span></div>" : "") + '<div class="overview-stable-item"><strong>Use Team only for change</strong><span>Keep roster edits explicit instead of mixing them into normal workspace work.</span></div><div class="overview-stable-item"><strong>Keep billing separate</strong><span>Use account services only when the task is commercial, not operational.</span></div></div></div>';
- }
- var items = attention.slice(0, 3).map(function(workspace) {
- return '<div class="overview-alert-row"><div class="overview-alert-main"><strong>' + escapeHTML(workspace.display_name) + "</strong><span>" + escapeHTML(workspaceStatusCopy(workspace)) + "</span></div>" + healthBadgeHTML(workspace) + "</div>";
- }).join("");
- return '<div class="overview-side-card"><div class="account-panel-kicker">Attention</div><h4>Needs review</h4><p>These workspaces should be checked before you treat the workspace list as fully healthy.</p><div class="overview-alert-list">' + items + "</div></div>";
- }
- function renderOverviewMetricStrip(totalCount, readyCount, checkingCount, unhealthyCount, suspendedCount) {
- return '<div class="account-overview-metrics account-overview-metrics-header"><div class="account-panel-kicker">Live status</div><div class="account-metric-strip"><div class="account-stat-card account-stat-card-inline"><span class="account-stat-label">Total</span><span class="account-stat-value">' + String(totalCount) + '</span></div><div class="account-stat-card account-stat-card-inline"><span class="account-stat-label">Ready now</span><span class="account-stat-value account-stat-healthy">' + String(readyCount) + '</span></div><div class="account-stat-card account-stat-card-inline"><span class="account-stat-label">Checking</span><span class="account-stat-value account-stat-checking">' + String(checkingCount) + '</span></div><div class="account-stat-card account-stat-card-inline"><span class="account-stat-label">Needs attention</span><span class="account-stat-value account-stat-unhealthy">' + String(unhealthyCount) + '</span></div><div class="account-stat-card account-stat-card-inline"><span class="account-stat-label">Suspended</span><span class="account-stat-value">' + String(suspendedCount) + "</span></div></div></div>";
- }
function renderAccountContextStrip(account) {
var workspaceLabel = workspaceCountLabel((account.workspaces || []).length);
var billingLabel = account.has_billing ? "Billing enabled" : "Billing offline";
- return '<section class="portal-account-context"><div class="portal-account-context-copy"><div class="portal-account-context-meta"><span class="account-eyebrow">' + escapeHTML(accountKindLabel(account)) + '</span><span class="portal-account-context-separator">/</span><span class="portal-account-context-access">' + escapeHTML(titleCase(account.role)) + ' access</span></div><div class="portal-account-context-row"><h2>' + escapeHTML(account.name) + '</h2><div class="portal-account-context-chips"><span class="account-context-chip">' + escapeHTML(account.kind_label) + '</span><span class="account-context-chip">' + escapeHTML(titleCase(account.role)) + '</span><span class="account-context-chip">' + escapeHTML(workspaceLabel) + "</span></div></div><p>" + escapeHTML(account.kind === "msp" ? "Hosted workspace account for workspace access, team control, and billing." : "Hosted account for workspace access, team control, and billing.") + '</p></div><div class="portal-account-context-summary"><div class="portal-account-context-stat"><span>Access</span><strong>' + escapeHTML(titleCase(account.role)) + '</strong></div><div class="portal-account-context-stat"><span>Workspaces</span><strong>' + escapeHTML(workspaceLabel) + '</strong></div><div class="portal-account-context-stat"><span>Billing</span><strong>' + escapeHTML(billingLabel) + "</strong></div></div></section>";
+ return '<section class="portal-account-context"><div class="portal-account-context-copy"><div class="portal-account-context-meta"><span class="account-eyebrow">' + escapeHTML(accountKindLabel(account)) + '</span><span class="portal-account-context-separator">/</span><span class="portal-account-context-access">' + escapeHTML(titleCase(account.role)) + ' access</span></div><div class="portal-account-context-row"><h2>' + escapeHTML(account.name) + '</h2><div class="portal-account-context-chips"><span class="account-context-chip">' + escapeHTML(account.kind_label) + '</span><span class="account-context-chip">' + escapeHTML(titleCase(account.role)) + '</span><span class="account-context-chip">' + escapeHTML(workspaceLabel) + "</span></div></div><p>" + escapeHTML(account.kind === "msp" ? "Hosted workspace account for workspace access, access control, and billing." : "Hosted account for workspace access, access control, and billing.") + '</p></div><div class="portal-account-context-summary"><div class="portal-account-context-stat"><span>Access</span><strong>' + escapeHTML(titleCase(account.role)) + '</strong></div><div class="portal-account-context-stat"><span>Workspaces</span><strong>' + escapeHTML(workspaceLabel) + '</strong></div><div class="portal-account-context-stat"><span>Billing</span><strong>' + escapeHTML(billingLabel) + "</strong></div></div></section>";
}
function shellSectionButton(section, activeSection, index, title, copy, badge) {
var badgeHTML = badge ? '<span class="portal-shell-nav-badge">' + escapeHTML(badge) + "</span>" : "";
@@ -1845,15 +1827,19 @@
var hosted = hasHostedAccounts(accounts);
var workspaces = collectWorkspaces(accounts);
var totalWorkspaces = workspaces.length;
- var readyWorkspaces = countReadyWorkspaces(workspaces);
+ var readyWorkspaces2 = countReadyWorkspaces(workspaces);
+ var attentionCount = attentionWorkspaces(workspaces).length;
+ var hostedBillingCount = 0;
var canManage = false;
for (var i = 0; i < accounts.length; i += 1) {
if (accounts[i].can_manage) {
canManage = true;
- break;
+ }
+ if (accounts[i].has_billing) {
+ hostedBillingCount += 1;
}
}
- return '<aside class="portal-shell-nav" aria-label="Pulse Account sections"><div class="portal-shell-nav-header"><div class="portal-shell-nav-eyebrow">Pulse Account</div><div class="portal-shell-nav-title">Account center</div><div class="portal-shell-nav-support">' + (hosted ? "Workspaces, account access, and commercial services" : "Commercial account services and support") + '</div></div><div class="portal-shell-nav-group">' + shellSectionButton("overview", activeSection, "01", "Overview", hosted ? "Status, priorities, and next actions" : "Account summary and access state", hosted ? String(totalWorkspaces) + " total" : "Summary") + shellSectionButton("workspaces", activeSection, "02", hosted ? "Workspaces" : "Workspace access", hosted ? "Workspace access and lifecycle actions" : "No workspaces are attached yet", hosted ? String(readyWorkspaces) + " ready" : "None") + shellSectionButton("team", activeSection, "03", "Team", hosted ? "Access and team roster" : "Account membership", canManage ? "Manage" : "View") + shellSectionButton("services", activeSection, "04", "Account services", "Licenses, billing, refunds, and privacy", "4 tools") + shellSectionButton("support", activeSection, "05", "Support", hosted ? "Escalation and account support" : supportEmail || "Support contact", supportEmail ? "Email" : "Help") + "</div></aside>";
+ return '<aside class="portal-shell-nav" aria-label="Pulse Account sections"><div class="portal-shell-nav-header"><div class="portal-shell-nav-eyebrow">Pulse Account</div><div class="portal-shell-nav-title">Account tasks</div><div class="portal-shell-nav-support">' + (hosted ? "Start with the job you need to finish: workspace work, access, billing, then escalation." : "Use billing tools first and escalate only when the self-serve path stops.") + '</div></div><div class="portal-shell-nav-group">' + shellSectionButton("overview", activeSection, "01", "Overview", "What needs attention, what is ready, and the next obvious action.", attentionCount > 0 ? String(attentionCount) + " review" : hosted ? String(readyWorkspaces2) + " ready" : "Summary") + shellSectionButton("workspaces", activeSection, "02", "Workspaces", hosted ? "Open a workspace, review lifecycle state, or create one." : "No hosted workspaces are attached yet.", hosted ? String(readyWorkspaces2) + " ready" : "None") + shellSectionButton("access", activeSection, "03", "Access", hosted ? "Invite people, change roles, and remove account access." : "Account access and membership controls.", canManage ? "Manage" : "View") + shellSectionButton("billing", activeSection, "04", "Billing", hostedBillingCount > 0 ? "Hosted billing first, then self-hosted licenses, refunds, and privacy only when relevant." : "Self-hosted billing, licenses, refunds, and privacy.", hostedBillingCount > 0 ? hostedBillingCount > 1 ? "Hosted +" : "Hosted" : "Self-hosted") + shellSectionButton("support", activeSection, "05", "Support", "Escalation only after the workspace, access, or billing path is exhausted.", supportEmail ? "Email" : "Help") + "</div></aside>";
}
function renderWorkspaceCard(account, workspace, accountAPIBasePath) {
var status = workspaceHealthState(workspace);
@@ -1876,27 +1862,88 @@
}
return '<article class="workspace-row workspace-row-health-' + escapeAttr(status) + " workspace-row-state-" + escapeAttr(state || "unknown") + '" data-workspace-row="' + escapeAttr(workspace.id) + '"><div class="workspace-row-primary"><div class="workspace-row-heading"><h4 class="workspace-name">' + escapeHTML(workspace.display_name) + '</h4><div class="workspace-meta">' + metaParts.join("") + '</div></div><div class="workspace-row-note">' + escapeHTML(workspaceRowNote(workspace)) + '</div></div><div class="workspace-row-status-cell workspace-row-status-cell-badge">' + healthBadgeHTML(workspace) + '</div><div class="workspace-row-status-cell workspace-row-status-cell-badge"><span class="badge badge-' + escapeHTML(state || "unknown") + '">' + escapeHTML(titleCase(state || "Unknown")) + '</span></div><div class="workspace-actions">' + openAction + manageAction + "</div></article>";
}
- function renderAccountOverviewSection(account) {
+ function readyWorkspaces(workspaces) {
+ var results = [];
+ for (var i = 0; i < workspaces.length; i += 1) {
+ if (String(workspaces[i].state || "") === "active" && workspaceHealthState(workspaces[i]) === "healthy") {
+ results.push(workspaces[i]);
+ }
+ }
+ return results;
+ }
+ function renderWorkspaceHandoffForm(accountID, workspaceID, accountAPIBasePath, label, buttonClassName = "btn-secondary btn-compact") {
+ if (!accountAPIBasePath) {
+ return '<button class="' + escapeAttr(buttonClassName) + '" type="button" data-shell-action="activate-section" data-shell-section="workspaces">' + escapeHTML(label) + "</button>";
+ }
+ return '<form method="POST" action="' + escapeAttr(accountAPIBasePath + "/" + accountID + "/tenants/" + workspaceID + "/handoff") + '"><button type="submit" class="' + escapeAttr(buttonClassName) + '">' + escapeHTML(label) + "</button></form>";
+ }
+ function renderOverviewAttentionCard(workspaces) {
+ var attention = attentionWorkspaces(workspaces);
+ if (!attention.length) {
+ return '<article class="overview-task-card"><div class="account-panel-kicker">Needs attention</div><h4>Nothing urgent</h4><p>No active workspace is currently asking for review.</p><div class="overview-task-list"><div class="overview-task-item"><strong>Healthy now</strong><span>Active workspaces look clear for routine use.</span></div><div class="overview-task-item"><strong>Suspended stays parked</strong><span>Suspended workspaces stay out of the way until you deliberately resume them.</span></div></div></article>';
+ }
+ return '<article class="overview-task-card overview-task-card-attention"><div class="account-panel-kicker">Needs attention</div><h4>Review these first</h4><p>These workspaces still need a human check before you treat the account as settled.</p><div class="overview-task-list">' + attention.slice(0, 3).map(function(workspace) {
+ return '<div class="overview-task-item"><strong>' + escapeHTML(workspace.display_name) + "</strong><span>" + escapeHTML(workspaceStatusCopy(workspace)) + "</span></div>";
+ }).join("") + "</div></article>";
+ }
+ function renderOverviewReadyCard(account, workspaces, accountAPIBasePath) {
+ var ready = readyWorkspaces(workspaces);
+ if (!ready.length) {
+ return '<article class="overview-task-card"><div class="account-panel-kicker">Ready</div><h4>No workspace is ready yet</h4><p>Use Workspaces to review current state before you start routine work.</p></article>';
+ }
+ return '<article class="overview-task-card"><div class="account-panel-kicker">Ready</div><h4>Open and work</h4><p>These workspaces are active and healthy right now.</p><div class="overview-task-list">' + ready.slice(0, 3).map(function(workspace) {
+ return '<div class="overview-task-item overview-task-item-action"><div class="overview-task-copy"><strong>' + escapeHTML(workspace.display_name) + "</strong><span>" + escapeHTML(workspaceRowNote(workspace)) + "</span></div>" + renderWorkspaceHandoffForm(account.id, workspace.id, accountAPIBasePath, "Open workspace") + "</div>";
+ }).join("") + "</div></article>";
+ }
+ function renderOverviewNextActionCard(account, workspaces, accountAPIBasePath) {
+ var attention = attentionWorkspaces(workspaces);
+ var ready = readyWorkspaces(workspaces);
+ var primaryAction = "";
+ var secondaryAction = "";
+ var title = "";
+ var description = "";
+ if (attention.length) {
+ title = "Review workspace health";
+ description = "Open Workspaces and resolve the pending health or lifecycle questions before you do anything else.";
+ primaryAction = '<button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="workspaces">Review workspaces</button>';
+ secondaryAction = account.can_manage ? '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="access">Review access</button>' : "";
+ } else if (ready.length) {
+ title = "Open the next workspace";
+ description = "The most obvious next step is to open a ready workspace and continue the actual work there.";
+ primaryAction = renderWorkspaceHandoffForm(account.id, ready[0].id, accountAPIBasePath, "Open " + ready[0].display_name, "btn-primary btn-compact");
+ secondaryAction = ready.length > 1 ? '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="workspaces">See all workspaces</button>' : "";
+ } else if (account.kind === "msp" && account.can_manage) {
+ title = "Create the next workspace";
+ description = "There is no ready workspace yet, so the next clear action is to create one from the Workspaces section.";
+ primaryAction = '<button class="btn-primary btn-compact" type="button" data-action="toggle-add-workspace" data-account-id="' + escapeAttr(account.id) + '">Create workspace</button>';
+ secondaryAction = '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="access">Manage access</button>';
+ } else if (account.has_billing && account.can_manage) {
+ title = "Handle billing in its own place";
+ description = "Operational work is clear, so the next separate task is billing if that is what you came here to change.";
+ primaryAction = '<button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="billing">Open billing</button>';
+ secondaryAction = '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="access">Review access</button>';
+ } else {
+ title = "Choose the right task path";
+ description = "If this is an access change, go to Access. If it is a billing or license issue, go to Billing. Support is only for escalation.";
+ primaryAction = '<button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="' + (account.can_manage ? "access" : "billing") + '">' + (account.can_manage ? "Open access" : "Open billing") + "</button>";
+ secondaryAction = '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="support">Escalate</button>';
+ }
+ return '<article class="overview-task-card overview-task-card-next"><div class="account-panel-kicker">Next action</div><h4>' + escapeHTML(title) + "</h4><p>" + escapeHTML(description) + '</p><div class="overview-task-actions">' + primaryAction + secondaryAction + "</div></article>";
+ }
+ function renderAccountOverviewSection(account, accountAPIBasePath) {
var workspaces = Array.isArray(account.workspaces) ? account.workspaces : [];
var totalCount = workspaces.length;
var readyCount = countReadyWorkspaces(workspaces);
- var healthyCount = countWorkspacesByHealth(workspaces, "healthy");
var checkingCount = countWorkspacesByHealth(workspaces, "checking");
var unhealthyCount = countWorkspacesByHealth(workspaces, "unhealthy");
var suspendedCount = countWorkspacesByState(workspaces, "suspended");
- var postureTitle = unhealthyCount > 0 ? "Needs review" : checkingCount > 0 ? "Still settling" : suspendedCount > 0 ? "Active workspaces are stable" : "Workspaces are stable";
- var postureCopy = unhealthyCount > 0 ? "One or more workspaces still need attention before this account looks healthy." : checkingCount > 0 ? "Most workspaces look healthy, but some are still waiting on a completed health check." : suspendedCount > 0 ? "Active workspaces are healthy while suspended workspaces stay parked until you resume them." : "All workspaces are healthy and ready for routine use.";
- var nextStepTitle = unhealthyCount > 0 ? "Start in workspaces" : checkingCount > 0 ? "Review pending checks" : suspendedCount > 0 ? "Next step" : "Next step";
- var nextStepCopy = unhealthyCount > 0 ? "One or more workspaces need review before you treat this account as healthy." : checkingCount > 0 ? "The fleet is mostly healthy, but there are still workspaces waiting on a completed health check." : suspendedCount > 0 ? "Active workspaces look stable. Resume a suspended workspace only when you are ready to bring it back into regular use." : "Everything looks stable. Move into Team or Account services only if you need to change access or billing.";
- var nextStepChecklist = unhealthyCount > 0 ? '<div class="overview-next-checklist"><div class="overview-next-check"><strong>1. Review attention items</strong><span>Open the fleet and inspect any workspace marked as checking or needs attention.</span></div><div class="overview-next-check"><strong>2. Resolve access blockers</strong><span>Use Team if the right people are not already attached to the hosted account.</span></div><div class="overview-next-check"><strong>3. Escalate billing separately</strong><span>Keep account billing or self-hosted license work out of the workspace review flow.</span></div></div>' : checkingCount > 0 ? '<div class="overview-next-checklist"><div class="overview-next-check"><strong>1. Verify pending checks</strong><span>Open the workspaces still settling and confirm they are safe to operate.</span></div><div class="overview-next-check"><strong>2. Keep access deliberate</strong><span>Change Team only if a pending workspace needs a different mix of access.</span></div><div class="overview-next-check"><strong>3. Keep commercial work separate</strong><span>Use account services or billing only when the workspace state is already understood.</span></div></div>' : '<div class="overview-next-checklist"><div class="overview-next-check"><strong>1. Open a workspace for the next operational task</strong><span>Move into Workspaces when you are ready to do workspace work.</span></div><div class="overview-next-check"><strong>2. Change access in Team only</strong><span>Keep roster changes explicit instead of mixing them into routine workspace work.</span></div><div class="overview-next-check"><strong>3. Keep billing and privacy separate</strong><span>Licenses, refunds, privacy, and self-hosted billing stay in their own section.</span></div></div>';
- var nextStepActions = '<div class="overview-next-actions"><button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="workspaces">Open workspaces</button><button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="' + (account.can_manage ? "team" : "services") + '">' + (account.can_manage ? "Review team access" : "Open account services") + "</button></div>";
- var accountScopeCopy = account.kind === "msp" ? "Manage client workspaces, billing, and team access from one place." : "Manage workspaces, billing, and team access from one place.";
- var overviewBriefStrip = '<div class="account-overview-brief-strip"><div class="account-overview-brief-point account-overview-brief-point-wide"><strong>Account scope</strong><span>' + escapeHTML(accountScopeCopy) + '</span></div><div class="account-overview-brief-point"><strong>Workspace path</strong><span>Use Workspaces for tenant access and lifecycle changes, and Team only when access needs to change.</span></div><div class="account-overview-brief-point"><strong>Commercial path</strong><span>Keep licenses, refunds, privacy, and self-hosted billing in Account services instead of mixing them into workspace work.</span></div></div>';
- return '<section class="account-content-panel account-content-panel-overview"><div class="account-stage-header account-stage-header-overview"><div><div class="account-panel-kicker">Overview</div><h3>Workspace status</h3><p>Review workspace status first, then move into the next section.</p>' + renderSectionContextChips([
- String(totalCount) + " total",
+ var attentionCount = attentionWorkspaces(workspaces).length;
+ return '<section class="account-content-panel account-content-panel-overview"><div class="account-stage-header account-stage-header-overview overview-stage-header"><div><div class="account-panel-kicker">Overview</div><h3>Account brief</h3><p>Start with the immediate question, not the platform model.</p>' + renderSectionContextChips([
+ String(attentionCount) + " attention",
String(readyCount) + " ready",
- suspendedCount > 0 ? String(suspendedCount) + " suspended" : "All active"
- ]) + renderOverviewMetricStrip(totalCount, readyCount, checkingCount, unhealthyCount, suspendedCount) + '</div></div><div class="account-command-deck"><div class="account-overview-main-column"><div class="account-overview-card account-overview-briefing-card"><div class="account-overview-lead"><div class="account-panel-kicker">Workspace summary</div><h3>' + escapeHTML(postureTitle) + "</h3><p>" + escapeHTML(postureCopy) + "</p>" + overviewBriefStrip + '</div><div class="account-overview-next-block"><div class="account-panel-kicker">Next move</div><h4>' + escapeHTML(nextStepTitle) + "</h4><p>" + escapeHTML(nextStepCopy) + "</p>" + nextStepChecklist + nextStepActions + '</div></div></div><div class="account-overview-side-column">' + renderAttentionPanel(workspaces) + "</div></div></section>";
+ String(totalCount) + " total",
+ suspendedCount > 0 ? String(suspendedCount) + " suspended" : "No suspended"
+ ]) + '</div></div><div class="overview-task-grid">' + renderOverviewAttentionCard(workspaces) + renderOverviewReadyCard(account, workspaces, accountAPIBasePath) + renderOverviewNextActionCard(account, workspaces, accountAPIBasePath) + '</div><div class="overview-task-summary-bar"><div class="overview-task-summary-pill"><strong>Healthy</strong><span>' + String(countWorkspacesByHealth(workspaces, "healthy")) + '</span></div><div class="overview-task-summary-pill"><strong>Checking</strong><span>' + String(checkingCount) + '</span></div><div class="overview-task-summary-pill"><strong>Needs attention</strong><span>' + String(unhealthyCount) + '</span></div><div class="overview-task-summary-pill"><strong>Suspended</strong><span>' + String(suspendedCount) + "</span></div></div></section>";
}
function renderAccountWorkspaceSection(account, accountAPIBasePath) {
var workspaces = Array.isArray(account.workspaces) ? account.workspaces : [];
@@ -1909,41 +1956,46 @@
if (account.kind === "msp") {
workspaceHeaderActions += '<button type="button" class="btn-secondary btn-compact" data-action="toggle-add-workspace" data-account-id="' + escapeAttr(account.id) + '">Add workspace</button>';
}
- if (account.has_billing) {
- workspaceHeaderActions += '<button type="button" class="btn-secondary btn-compact" data-action="open-billing" data-account-id="' + escapeAttr(account.id) + '">Manage billing</button>';
- }
- workspaceHeaderActions += '<button type="button" class="btn-secondary btn-compact" data-action="toggle-team" data-account-id="' + escapeAttr(account.id) + '" data-shell-target="team">Manage team</button>';
var workspaceDeskActions = "";
if (account.kind === "msp") {
workspaceDeskActions += '<button type="button" class="btn-secondary btn-compact" data-action="toggle-add-workspace" data-account-id="' + escapeAttr(account.id) + '">Add workspace</button>';
addWorkspaceForm = '<div class="add-workspace-form" id="add-ws-form-' + escapeAttr(account.id) + '"><label for="ws-name-' + escapeAttr(account.id) + '">Workspace name (for example, a client name)</label><input type="text" id="ws-name-' + escapeAttr(account.id) + '" placeholder="Acme Corp" maxlength="80" autocomplete="off"><div class="form-actions"><button type="button" class="btn-primary" data-action="create-workspace" data-account-id="' + escapeAttr(account.id) + '">Create workspace</button><button type="button" class="btn-secondary" data-action="toggle-add-workspace" data-account-id="' + escapeAttr(account.id) + '">Cancel</button><div class="spinner" id="ws-spinner-' + escapeAttr(account.id) + '" hidden></div></div></div>';
}
- if (account.has_billing) {
- workspaceDeskActions += '<button type="button" class="btn-secondary btn-compact" data-action="open-billing" data-account-id="' + escapeAttr(account.id) + '">Manage billing</button>';
- }
- workspaceDeskActions += '<button type="button" class="btn-secondary btn-compact" data-action="toggle-team" data-account-id="' + escapeAttr(account.id) + '" data-shell-target="team">Manage team</button>';
- workspaceManagement = '<section class="workspace-management-panel" id="workspace-management-' + escapeAttr(account.id) + '"><div class="workspace-management-header"><div><div class="account-panel-kicker">Workspace management</div><h3>Lifecycle</h3><p>Inspect one workspace at a time and keep account-level actions separate.</p></div><button type="button" class="btn-secondary btn-compact" id="workspace-management-close-' + escapeAttr(account.id) + '" data-action="clear-workspace-selection" data-account-id="' + escapeAttr(account.id) + '">Close panel</button></div><div class="workspace-management-empty" id="workspace-management-empty-' + escapeAttr(account.id) + '"><div class="workspace-management-empty-copy">Pick one workspace for lifecycle review. Keep hosted billing, team changes, and new workspace creation in account actions.</div><div class="workspace-management-empty-shell"><div class="workspace-management-empty-actions-card"><div class="workspace-management-empty-actions-copy"><div class="account-panel-kicker">Account actions</div><h4>Keep account-wide actions separate</h4><p>Use this area for new workspaces, hosted billing, and team changes. Keep row actions focused on a single workspace.</p></div><div class="workspace-management-empty-actions">' + workspaceDeskActions + "</div>" + addWorkspaceForm + '</div><div class="workspace-management-empty-rules"><div class="workspace-management-empty-rule"><strong>Inspect status</strong><span>Open the workspace first and confirm whether it is routine work, review work, or a parked suspended system.</span></div><div class="workspace-management-empty-rule"><strong>Confirm lifecycle</strong><span>Check active, checking, failed, or suspended state before you take the next step.</span></div><div class="workspace-management-empty-rule"><strong>Stay deliberate</strong><span>Review one workspace at a time instead of mixing fleet and account actions together.</span></div></div></div></div><div class="workspace-management-content" id="workspace-management-content-' + escapeAttr(account.id) + '" hidden><div class="workspace-management-meta" id="workspace-management-meta-' + escapeAttr(account.id) + '"></div><h4 id="workspace-management-title-' + escapeAttr(account.id) + '"></h4><p class="workspace-management-summary" id="workspace-management-summary-' + escapeAttr(account.id) + '"></p><div class="workspace-management-facts"><div class="workspace-management-fact"><span>Health</span><strong id="workspace-management-health-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Lifecycle</span><strong id="workspace-management-lifecycle-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Created</span><strong id="workspace-management-created-' + escapeAttr(account.id) + '"></strong></div></div><div class="workspace-management-guidance" id="workspace-management-guidance-' + escapeAttr(account.id) + '"></div><div class="workspace-management-actions"><button type="button" class="btn-danger" id="workspace-management-action-' + escapeAttr(account.id) + '" data-action="workspace-action" data-account-id="' + escapeAttr(account.id) + '">Manage workspace</button></div></div></section>';
+ workspaceManagement = '<section class="workspace-management-panel" id="workspace-management-' + escapeAttr(account.id) + '"><div class="workspace-management-header"><div><div class="account-panel-kicker">Workspace management</div><h3>Lifecycle</h3><p>Inspect one workspace at a time and keep account-level actions separate.</p></div><button type="button" class="btn-secondary btn-compact" id="workspace-management-close-' + escapeAttr(account.id) + '" data-action="clear-workspace-selection" data-account-id="' + escapeAttr(account.id) + '">Close panel</button></div><div class="workspace-management-empty" id="workspace-management-empty-' + escapeAttr(account.id) + '"><div class="workspace-management-empty-copy">Pick one workspace for lifecycle review. Keep access and billing changes in their own sections.</div><div class="workspace-management-empty-shell"><div class="workspace-management-empty-actions-card"><div class="workspace-management-empty-actions-copy"><div class="account-panel-kicker">Workspace tasks</div><h4>Keep this section workspace-only</h4><p>Create a workspace here when you need one. Access changes belong in Access, and billing changes belong in Billing.</p></div><div class="workspace-management-empty-actions">' + workspaceDeskActions + "</div>" + addWorkspaceForm + '</div><div class="workspace-management-empty-rules"><div class="workspace-management-empty-rule"><strong>Inspect status</strong><span>Open the workspace first and confirm whether it is routine work, review work, or a parked suspended system.</span></div><div class="workspace-management-empty-rule"><strong>Confirm lifecycle</strong><span>Check active, checking, failed, or suspended state before you take the next step.</span></div><div class="workspace-management-empty-rule"><strong>Stay deliberate</strong><span>Review one workspace at a time instead of mixing fleet and account actions together.</span></div></div></div></div><div class="workspace-management-content" id="workspace-management-content-' + escapeAttr(account.id) + '" hidden><div class="workspace-management-meta" id="workspace-management-meta-' + escapeAttr(account.id) + '"></div><h4 id="workspace-management-title-' + escapeAttr(account.id) + '"></h4><p class="workspace-management-summary" id="workspace-management-summary-' + escapeAttr(account.id) + '"></p><div class="workspace-management-facts"><div class="workspace-management-fact"><span>Health</span><strong id="workspace-management-health-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Lifecycle</span><strong id="workspace-management-lifecycle-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Created</span><strong id="workspace-management-created-' + escapeAttr(account.id) + '"></strong></div></div><div class="workspace-management-guidance" id="workspace-management-guidance-' + escapeAttr(account.id) + '"></div><div class="workspace-management-actions"><button type="button" class="btn-danger" id="workspace-management-action-' + escapeAttr(account.id) + '" data-action="workspace-action" data-account-id="' + escapeAttr(account.id) + '">Manage workspace</button></div></div></section>';
}
var workspaceHTML = workspaces.length ? '<div class="workspace-list-wrap"><div class="workspace-list-toolbar"><div class="workspace-list-summary">Open a workspace to work in it. Use the lifecycle view only when you are reviewing state or making account-level changes.</div></div><div class="workspace-list-head"><span>Workspace</span><span>Health</span><span>Lifecycle</span><span>Actions</span></div><div class="workspace-list">' + workspaces.map(function(workspace) {
return renderWorkspaceCard(account, workspace, accountAPIBasePath);
}).join("") + "</div></div>" : '<div class="empty-state"><p>No hosted workspaces yet. Create one to get started.</p></div>';
- return '<section class="account-content-panel account-content-panel-workspaces"><div class="account-stage-header"><div class="account-stage-header-row"><div><div class="account-panel-kicker">Workspace overview</div><h3>Workspaces</h3><p>Open workspaces, review status, and keep lifecycle actions explicit.</p>' + renderSectionContextChips([
+ return '<section class="account-content-panel account-content-panel-workspaces"><div class="account-stage-header"><div class="account-stage-header-row"><div><div class="account-panel-kicker">Workspaces</div><h3>Workspaces</h3><p>Open a workspace, review lifecycle state, or create a new one without mixing in access or billing work.</p>' + renderSectionContextChips([
String(workspaces.length) + " total",
String(readyCount) + " ready",
String(suspendedCount) + " suspended"
]) + '</div><div class="account-stage-header-actions">' + workspaceHeaderActions + '</div></div></div><div class="workspace-operations-shell workspace-operations-shell-idle" id="workspace-operations-shell-' + escapeAttr(account.id) + '"><div class="workspace-operations-main">' + workspaceHTML + '</div><div class="workspace-operations-detail" id="workspace-operations-detail-' + escapeAttr(account.id) + '">' + workspaceManagement + "</div></div></section>";
}
- function renderAccountTeamSection(account) {
- var accessPolicy = '<div class="team-policy-panel"><div class="team-panel-heading"><h4>Access model</h4><p>Assign the smallest role that still lets someone do the work they own on this account.</p></div><div class="team-policy-list"><div class="team-policy-row"><strong>Owner</strong><span>Billing, team access, and full account control.</span></div><div class="team-policy-row"><strong>Admin</strong><span>Workspace control plus billing for the account.</span></div><div class="team-policy-row"><strong>Tech</strong><span>Workspace control without billing ownership.</span></div><div class="team-policy-row"><strong>Read-only</strong><span>Workspace review and verification without control-plane changes.</span></div></div></div>';
- var reviewDesk = '<div class="team-review-shell"><div class="team-review-strip"><div class="team-panel-heading team-panel-heading-tight"><div class="account-panel-kicker">Access review</div><h4>Keep access disciplined</h4><p>Use the roster as a controlled access list, not a dumping ground for vague shared access.</p></div><div class="team-review-grid"><div class="team-review-card"><strong>Owners stay rare</strong><span>Reserve Owner for billing, team, and full account control. Default to Admin, Tech, or Read-only first.</span></div><div class="team-review-card"><strong>Keep access narrow</strong><span>Use Tech for workspace control and Read-only for verification instead of handing out broader access.</span></div><div class="team-review-card"><strong>Remove stale access fast</strong><span>If someone no longer owns the work, remove them instead of leaving dormant access attached to the account.</span></div></div></div></div>';
- return '<section class="account-content-panel account-content-panel-team"><section class="team-management-panel team-section team-section-shell" id="team-section-' + escapeAttr(account.id) + '" data-actor-role="' + escapeAttr(account.role) + '"><div class="team-management-header"><div><div class="account-panel-kicker">Team management</div><h3>Account access</h3><p>Owners govern billing and access. Admins and techs keep workspace operations moving day to day.</p>' + renderSectionContextChips([
+ function renderAccountAccessSection(account) {
+ var accessPolicy = '<div class="team-policy-panel"><div class="team-panel-heading"><h4>Role rules</h4><p>Invite the smallest role that still lets someone do the work they actually own on this account.</p></div><div class="team-policy-list"><div class="team-policy-row"><strong>Owner</strong><span>Billing, access control, and full account control.</span></div><div class="team-policy-row"><strong>Admin</strong><span>Workspace control plus billing for the account.</span></div><div class="team-policy-row"><strong>Tech</strong><span>Workspace control without billing ownership.</span></div><div class="team-policy-row"><strong>Read-only</strong><span>Workspace review and verification without control-plane changes.</span></div></div></div>';
+ var reviewDesk = '<div class="team-review-shell"><div class="team-review-strip"><div class="team-panel-heading team-panel-heading-tight"><div class="account-panel-kicker">Access review</div><h4>Keep access explicit</h4><p>Use the roster as a controlled access list, not a vague shared bucket.</p></div><div class="team-review-grid"><div class="team-review-card"><strong>Owners stay rare</strong><span>Reserve Owner for billing, access control, and full account control. Default to Admin, Tech, or Read-only first.</span></div><div class="team-review-card"><strong>Keep access narrow</strong><span>Use Tech for workspace control and Read-only for verification instead of handing out broader access.</span></div><div class="team-review-card"><strong>Remove stale access fast</strong><span>If someone no longer owns the work, remove them instead of leaving dormant access attached to the account.</span></div></div></div></div>';
+ return '<section class="account-content-panel account-content-panel-access"><section class="team-management-panel team-section team-section-shell" id="team-section-' + escapeAttr(account.id) + '" data-actor-role="' + escapeAttr(account.role) + '"><div class="team-management-header"><div><div class="account-panel-kicker">Access</div><h3>People and roles</h3><p>Invite people, change roles, and remove stale access without mixing that work into workspace operations.</p>' + renderSectionContextChips([
account.can_manage ? "Managed roster" : "View only",
- "Least privilege",
- "Workspace access"
- ]) + '</div><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="workspaces">Close team view</button></div><div class="team-management-stats" id="team-stats-' + escapeAttr(account.id) + '"></div><div class="team-management-grid"><div class="team-roster-column"><div class="team-roster"><div class="team-panel-heading"><h4>People on this account</h4><p>Keep the roster small and role assignment explicit. The people listed here are the ones who can manage these workspaces.</p></div><div class="team-roster-list" id="team-list-' + escapeAttr(account.id) + '"><div class="team-list-message">Loading\u2026</div></div></div>' + reviewDesk + '</div><div class="team-side-column"><div class="team-operations-panel"><div class="team-panel-heading team-panel-heading-tight"><div class="account-panel-kicker">Access controls</div><h4>Invite and role policy</h4><p>Keep the roster deliberate. Invite the smallest role first, then tighten access as responsibilities become clearer.</p></div><div class="team-operations-grid"><div class="team-invite-panel"><div class="team-panel-heading"><h4>Invite someone new</h4><p>Add another person with the minimum role they need for this account.</p></div><div class="team-invite"><div><label for="invite-email-' + escapeAttr(account.id) + '">Email</label><input type="email" id="invite-email-' + escapeAttr(account.id) + '" placeholder="[email protected]" autocomplete="off"></div><div><label for="invite-role-' + escapeAttr(account.id) + '">Role</label><select id="invite-role-' + escapeAttr(account.id) + '"><option value="admin">Admin</option><option value="tech">Tech</option><option value="read_only">Read-only</option></select></div><button type="button" class="btn-primary btn-compact" data-action="invite-member" data-account-id="' + escapeAttr(account.id) + '">Invite</button></div></div>' + accessPolicy + "</div></div></div></div></section></section>";
+ "Invite",
+ "Roles",
+ "Remove access"
+ ]) + '</div><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="workspaces">Back to workspaces</button></div><div class="team-management-stats" id="team-stats-' + escapeAttr(account.id) + '"></div><div class="team-management-grid"><div class="team-roster-column"><div class="team-roster"><div class="team-panel-heading"><h4>People on this account</h4><p>Every person here can reach this hosted account. Keep the list small and the role choice explicit.</p></div><div class="team-roster-list" id="team-list-' + escapeAttr(account.id) + '"><div class="team-list-message">Loading\u2026</div></div></div>' + reviewDesk + '</div><div class="team-side-column"><div class="team-operations-panel"><div class="team-panel-heading team-panel-heading-tight"><div class="account-panel-kicker">Access controls</div><h4>Invite, role, remove</h4><p>Use this column when you need to add someone, tighten a role, or remove access that no longer belongs here.</p></div><div class="team-operations-grid"><div class="team-invite-panel"><div class="team-panel-heading"><h4>Invite someone new</h4><p>Add a person with the minimum role they need for this account.</p></div><div class="team-invite"><div><label for="invite-email-' + escapeAttr(account.id) + '">Email</label><input type="email" id="invite-email-' + escapeAttr(account.id) + '" placeholder="[email protected]" autocomplete="off"></div><div><label for="invite-role-' + escapeAttr(account.id) + '">Role</label><select id="invite-role-' + escapeAttr(account.id) + '"><option value="admin">Admin</option><option value="tech">Tech</option><option value="read_only">Read-only</option></select></div><button type="button" class="btn-primary btn-compact" data-action="invite-member" data-account-id="' + escapeAttr(account.id) + '">Invite</button></div></div>' + accessPolicy + "</div></div></div></div></section></section>";
+ }
+ function renderHostedBillingCards(accounts) {
+ var hostedBillingAccounts = accounts.filter(function(account) {
+ return account.has_billing;
+ });
+ if (!hostedBillingAccounts.length) {
+ return '<div class="billing-task-card billing-task-card-muted"><div class="account-panel-kicker">Hosted billing</div><h3>No hosted billing attached</h3><p>Use the self-hosted billing tools below only if you are managing a self-hosted purchase.</p></div>';
+ }
+ return hostedBillingAccounts.map(function(account) {
+ var actionHTML = account.can_manage ? '<button type="button" class="btn-primary btn-compact" data-action="open-billing" data-account-id="' + escapeAttr(account.id) + '">Open hosted billing</button>' : '<div class="billing-task-note">An owner or admin on this account needs to open hosted billing.</div>';
+ return '<article class="billing-task-card"><div class="account-panel-kicker">Hosted billing</div><h3>' + escapeHTML(account.name) + '</h3><p>Invoices, payment methods, and hosted subscription changes for this account live here.</p><div class="billing-task-points"><div class="billing-task-point"><strong>Use when hosted billing is the job</strong><span>Keep workspace lifecycle work in Workspaces and access changes in Access.</span></div><div class="billing-task-point"><strong>Stay account-specific</strong><span>Open billing from the exact hosted account you want to change.</span></div></div><div class="billing-task-actions">' + actionHTML + "</div></article>";
+ }).join("");
}
function renderSupportSection(context) {
- return '<section class="portal-support-panel"><div class="account-panel-kicker">Support</div><h2>Support</h2><p>Use this section when hosted access looks wrong, billing behaves unexpectedly, or you need help with commercial requests.</p>' + renderSectionContextChips(["Hosted issues", "Commercial requests", context.bootstrap.support_email ? "Email" : "Support"]) + '<div class="portal-support-brief-strip"><div class="portal-support-brief-card"><strong>Hosted path</strong><span>Workspace access, team control, tenant handoff, and hosted billing stay on the hosted account route.</span></div><div class="portal-support-brief-card"><strong>Commercial path</strong><span>Self-hosted billing, licenses, refunds, and privacy requests stay in Account services until escalation is needed.</span></div><div class="portal-support-brief-card"><strong>Escalate with context</strong><span>Include the exact account, workspace, section, and failed action so support can continue the same path immediately.</span></div></div><div class="portal-support-layout"><div class="portal-support-route-grid"><div class="portal-support-route-card"><div class="account-panel-kicker">Hosted account</div><h3>Hosted support</h3><p>Use this route when tenant handoff, workspace access, team control, or hosted billing looks wrong.</p><div class="portal-support-points"><div class="portal-support-point"><strong>Route here for hosted issues</strong><span>Access, handoff, team, and hosted billing all belong on the hosted account path.</span></div><div class="portal-support-point"><strong>Keep the account context intact</strong><span>Include the account, workspace, and action that failed so support can pick up the same issue quickly.</span></div></div><div class="portal-support-actions"><a class="portal-support-link" href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a></div></div><div class="portal-support-route-card"><div class="account-panel-kicker">Commercial</div><h3>Commercial requests</h3><p>Self-hosted subscriptions, license recovery, refunds, and privacy requests all route through Account services first.</p><div class="portal-support-points"><div class="portal-support-point"><strong>Start in Account services</strong><span>Use Billing, Licenses, Refunds, or Privacy before escalating a commercial issue.</span></div><div class="portal-support-point"><strong>Escalate from the same path</strong><span>Keep the request in one place instead of splitting it between billing and account sections.</span></div></div><div class="portal-support-actions"><button type="button" class="btn-secondary" data-shell-action="activate-section" data-shell-section="services">Open account services</button></div></div></div><div class="portal-support-runbook"><div class="account-panel-kicker">Escalation guide</div><h3>Choose the right path</h3><p>Keep hosted workspace issues, commercial requests, and pure support escalation on their own paths so the next person does not have to reconstruct the account state.</p><div class="portal-support-runbook-brief"><div class="portal-support-runbook-brief-card"><strong>Confirm scope</strong><span>Decide first whether the issue is a hosted workspace problem, a commercial self-service request, or direct support escalation.</span></div><div class="portal-support-runbook-brief-card"><strong>Keep paths separate</strong><span>Workspace and team problems stay out of billing, refund, privacy, and license work.</span></div><div class="portal-support-runbook-brief-card"><strong>Escalate with facts</strong><span>Bring the exact account, workspace, section, and failed action so support starts with the same state you saw.</span></div></div><div class="portal-support-runbook-grid"><div class="portal-support-runbook-section"><div class="portal-support-runbook-section-title">Route checklist</div><div class="portal-support-runbook-list"><div class="portal-support-runbook-step"><strong>1. Confirm the scope</strong><span>Decide whether the problem is a hosted workspace issue, a commercial self-service request, or direct support escalation.</span></div><div class="portal-support-runbook-step"><strong>2. Keep hosted and commercial separate</strong><span>Workspace and team problems stay in their own sections. Billing, license, refund, and privacy work stay in Account services.</span></div><div class="portal-support-runbook-step"><strong>3. Escalate with context</strong><span>Include the account, workspace, and exact failed action so the escalation path starts with the same facts you saw.</span></div></div></div><div class="portal-support-runbook-section"><div class="portal-support-runbook-section-title">Escalation packet</div><div class="portal-support-handoff-note"><strong>Include in the escalation</strong><span>Account name, workspace name if relevant, the section you were in, the exact button or request that failed, and whether the issue was hosted or commercial.</span></div></div></div></div></div></section>';
+ return '<section class="portal-support-panel"><div class="account-panel-kicker">Support</div><h2>Escalation</h2><p>Come here only after the workspace, access, or billing path has stopped you.</p>' + renderSectionContextChips(["Escalation only", "Bring context", context.bootstrap.support_email ? "Email" : "Support"]) + '<div class="portal-support-layout"><div class="portal-support-route-grid"><div class="portal-support-route-card"><div class="account-panel-kicker">Hosted account</div><h3>Hosted problems</h3><p>Use support for hosted issues only after you have already tried the Workspaces or Access path.</p><div class="portal-support-points"><div class="portal-support-point"><strong>Use after the hosted path fails</strong><span>Workspace access, lifecycle, and account access should already be narrowed before you escalate.</span></div><div class="portal-support-point"><strong>Keep the account context intact</strong><span>Include the account, workspace, and action that failed so support can pick up the same issue quickly.</span></div></div><div class="portal-support-actions"><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="workspaces">Open workspaces</button><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="access">Open access</button><a class="portal-support-link" href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a></div></div><div class="portal-support-route-card"><div class="account-panel-kicker">Billing</div><h3>Billing and self-hosted issues</h3><p>Use this route only after hosted billing or the self-hosted billing tools have failed to complete the request cleanly.</p><div class="portal-support-points"><div class="portal-support-point"><strong>Start in Billing</strong><span>Hosted billing, licenses, refunds, and privacy should already be narrowed to one failed request.</span></div><div class="portal-support-point"><strong>Escalate from the same path</strong><span>Bring the billing tool or hosted billing action that failed instead of reopening the story from scratch.</span></div></div><div class="portal-support-actions"><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="billing">Open billing</button><a class="portal-support-link" href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a></div></div></div><div class="portal-support-runbook"><div class="account-panel-kicker">Escalation packet</div><h3>What to send</h3><p>Keep the packet short and concrete so support can pick up the exact failed path immediately.</p><div class="portal-support-runbook-list"><div class="portal-support-runbook-step"><strong>1. Name the path</strong><span>Say whether the failed path was Workspaces, Access, or Billing.</span></div><div class="portal-support-runbook-step"><strong>2. Name the account</strong><span>Include the hosted account and workspace when relevant, or the billing email for self-hosted work.</span></div><div class="portal-support-runbook-step"><strong>3. Name the action</strong><span>Include the exact button, form, or billing tool that failed and what happened next.</span></div></div></div></div></section>';
}
function renderHeaderHTML(context) {
if (context.bootstrap.authenticated) {
@@ -1955,15 +2007,17 @@
var accounts = Array.isArray(context.bootstrap.accounts) ? context.bootstrap.accounts : [];
var hosted = hasHostedAccounts(accounts);
var activeSection = context.activeSection || "overview";
- var serviceHeading = hosted ? "Self-hosted commercial services" : "Account services";
- var serviceNote = hosted ? "Hosted workspace changes stay in Workspaces and Team. Use this area only for self-hosted commercial requests." : "Use these account tools for self-hosted licenses, billing, refunds, and privacy actions.";
+ var hostedBillingCount = accounts.filter(function(account) {
+ return account.has_billing;
+ }).length;
+ var billingNote = hosted ? "Hosted billing lives here when it applies. Self-hosted licenses, refunds, and privacy stay separate underneath it." : "Use this billing surface for self-hosted subscriptions, licenses, refunds, and privacy requests.";
var hostedContent = accounts.map(function(account) {
- return '<section class="account-surface"><div class="account-surface-body">' + renderAccountOverviewSection(account) + renderAccountWorkspaceSection(account, context.accountAPIBasePath) + renderAccountTeamSection(account) + "</div></section>";
+ return '<section class="account-surface"><div class="account-surface-body">' + renderAccountOverviewSection(account, context.accountAPIBasePath) + renderAccountWorkspaceSection(account, context.accountAPIBasePath) + renderAccountAccessSection(account) + "</div></section>";
}).join("");
- return '<div class="portal-shell" data-shell-section="' + activeSection + '"><div class="portal-shell-layout">' + renderShellNavigation(accounts, context.bootstrap.support_email || "", activeSection) + '<div class="portal-shell-main">' + (accounts.length === 1 ? renderAccountContextStrip(accounts[0]) : "") + '<section class="portal-content-panel portal-content-panel-overview"><div id="accounts-root">' + hostedContent + '</div></section><section class="portal-content-panel portal-content-panel-services service-section" id="account-services-section"><div class="service-header"><div><div class="account-panel-kicker">Account services</div><h2>' + serviceHeading + "</h2>" + renderSectionContextChips([
- hosted ? "Self-hosted only" : "Commercial",
- "4 tools"
- ]) + '</div><div class="service-note">' + serviceNote + '</div></div><div class="service-shell"><aside class="service-shell-sidebar"><div class="service-shell-sidebar-head"><div class="account-panel-kicker">Service navigator</div><h3>Self-hosted tools</h3><p>Pick one commercial request and keep it separate from workspace and team changes.</p></div><div class="service-action-list">' + renderServiceActionRow("open-manage-service", "Billing", "Manage subscriptions", "Billing", "Open Stripe for self-hosted plan, invoice, and payment changes.", "manage-service-panel", "manage-inline-email", ["Plan changes", "Invoices"]) + renderServiceActionRow("open-retrieve-service", "Licenses", "Retrieve licenses", "Licenses", "Recover the latest active self-hosted license and invoice link.", "retrieve-service-panel", "retrieve-inline-email", ["Latest active license", "Invoice lookup"]) + renderServiceActionRow("open-refund-service", "Refunds", "Refund requests", "Refunds", "Request a self-serve refund when the purchase is still eligible.", "refund-service-panel", "refund-inline-email", ["Eligibility check", "Revocation"]) + renderServiceActionRow("open-data-service", "Privacy", "Data and privacy", "Privacy", "Request export or deletion for commercial account data.", "data-service-panel", "data-export-email", ["Export", "Deletion"]) + '</div><div class="service-inline-support"><div class="account-panel-kicker">Commercial routing</div><h4>Keep this request separate</h4><p>Hosted workspace work stays in Workspaces and Team. Use Support only when a self-hosted billing, license, refund, or privacy request cannot complete cleanly.</p><div class="service-inline-support-points"><div class="service-inline-support-point"><strong>Hosted stays hosted</strong><span>Tenant handoff, team access, and hosted billing do not belong in this commercial section.</span></div><div class="service-inline-support-point"><strong>Escalate with context</strong><span>Bring the service name and exact failed action if a commercial request needs support.</span></div></div><div class="service-inline-support-actions"><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="support">Open support</button></div></div></aside><div class="service-shell-main"><div class="service-detail-shell"><div class="service-panel service-panel-empty visible" id="service-panel-empty"><div class="account-panel-kicker">Service brief</div><h3>Choose a service to begin</h3><p>Use one self-hosted request at a time. Each service verifies commercial identity first, then keeps billing, license, refund, or privacy work contained in one place.</p><div class="service-empty-shell"><div class="service-empty-primary"><div class="service-empty-section service-empty-section-compact"><div class="service-empty-column-title">What each tool does</div><div class="service-empty-flow-list"><div class="service-empty-flow"><strong>Billing</strong><span>Stripe customer portal access for invoices, payment methods, and plan changes.</span></div><div class="service-empty-flow"><strong>Licenses</strong><span>Recover the latest active self-hosted license and the matching invoice link.</span></div><div class="service-empty-flow"><strong>Refunds</strong><span>Check eligibility before revoking active commercial access.</span></div><div class="service-empty-flow"><strong>Privacy</strong><span>Request export or deletion without leaving Pulse Account.</span></div></div></div><div class="service-empty-section service-empty-section-compact"><div class="service-empty-column-title">Before you start</div><div class="service-empty-points service-empty-points-stack"><div class="service-empty-point"><strong>One request</strong><span>Keep a single commercial task active instead of bouncing across sections.</span></div><div class="service-empty-point"><strong>Identity first</strong><span>Verification happens before any sensitive account action opens.</span></div><div class="service-empty-point"><strong>Stay focused</strong><span>Keep one commercial request in flight instead of bouncing between services.</span></div></div></div></div><div class="service-empty-side"><div class="service-empty-section service-empty-section-support"><div class="service-empty-column-title">Escalation</div><div class="service-empty-checklist"><div class="service-empty-check"><strong>Escalate quickly</strong><span>If billing, licenses, refunds, or privacy do not behave as expected, escalate from this section.</span></div><div class="service-empty-check"><strong>Commercial packet</strong><span>Bring the service name, commercial email, and the exact failed action so support starts with the same request state.</span></div></div><div class="service-empty-support">Need help with billing, refund, privacy, or license requests? <a class="portal-support-link" href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a></div><div class="service-empty-actions"><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="support">Open support</button></div></div></div></div></div><div class="service-panel" id="manage-service-panel"><div id="manage-service-root"></div></div><div class="service-panel" id="retrieve-service-panel"><div id="retrieve-service-root"></div></div><div class="service-panel" id="refund-service-panel"><div id="refund-service-root"></div></div><div class="service-panel" id="data-service-panel"><h3>Data and privacy</h3><p>Request export or deletion of the commercial data tied to an email address. Payment data held directly by Stripe still requires support handling.</p><div class="subsection"><div id="data-export-root"></div></div><div class="subsection"><div id="data-delete-root"></div></div><div class="helper-text">Payment-card data stays with Stripe. For Stripe deletion support, contact <a href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a>.</div></div></div></div></div></section><section class="portal-content-panel portal-content-panel-support">' + renderSupportSection(context) + "</section></div></div></div>";
+ return '<div class="portal-shell" data-shell-section="' + activeSection + '"><div class="portal-shell-layout">' + renderShellNavigation(accounts, context.bootstrap.support_email || "", activeSection) + '<div class="portal-shell-main">' + (accounts.length === 1 ? renderAccountContextStrip(accounts[0]) : "") + '<section class="portal-content-panel portal-content-panel-overview"><div id="accounts-root">' + hostedContent + '</div></section><section class="portal-content-panel portal-content-panel-billing service-section" id="billing-section"><div class="service-header billing-header"><div><div class="account-panel-kicker">Billing</div><h2>Billing</h2>' + renderSectionContextChips([
+ hostedBillingCount > 0 ? "Hosted billing" : "No hosted billing",
+ "Self-hosted tools"
+ ]) + '</div><div class="service-note">' + billingNote + '</div></div><div class="billing-overview-grid">' + renderHostedBillingCards(accounts) + '</div><div class="service-shell"><aside class="service-shell-sidebar"><div class="service-shell-sidebar-head"><div class="account-panel-kicker">Self-hosted billing</div><h3>Self-hosted tools</h3><p>Use these only when the job is a self-hosted purchase, license, refund, or privacy request.</p></div><div class="service-action-list">' + renderServiceActionRow("open-manage-service", "Self-hosted billing", "Manage subscriptions", "Billing", "Open Stripe for self-hosted plan, invoice, and payment changes.", "manage-service-panel", "manage-inline-email", ["Plan changes", "Invoices"]) + renderServiceActionRow("open-retrieve-service", "Licenses", "Retrieve licenses", "Licenses", "Recover the latest active self-hosted license and invoice link.", "retrieve-service-panel", "retrieve-inline-email", ["Latest active license", "Invoice lookup"]) + renderServiceActionRow("open-refund-service", "Refunds", "Refund requests", "Refunds", "Request a self-serve refund when the purchase is still eligible.", "refund-service-panel", "refund-inline-email", ["Eligibility check", "Revocation"]) + renderServiceActionRow("open-data-service", "Privacy", "Data and privacy", "Privacy", "Request export or deletion for commercial account data.", "data-service-panel", "data-export-email", ["Export", "Deletion"]) + '</div><div class="service-inline-support"><div class="account-panel-kicker">Escalation</div><h4>Keep the billing request contained</h4><p>Use Support only when a hosted billing or self-hosted billing request cannot complete cleanly from this section.</p><div class="service-inline-support-points"><div class="service-inline-support-point"><strong>Hosted billing first when present</strong><span>Use the hosted billing cards above before you touch the self-hosted tools.</span></div><div class="service-inline-support-point"><strong>Escalate with context</strong><span>Bring the billing tool or hosted billing action and the exact failed step if you need support.</span></div></div><div class="service-inline-support-actions"><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="support">Open support</button></div></div></aside><div class="service-shell-main"><div class="service-detail-shell"><div class="service-panel service-panel-empty visible" id="service-panel-empty"><div class="account-panel-kicker">Billing brief</div><h3>Choose the billing task</h3><p>Pick one self-hosted billing request at a time. Verification happens first so billing, license, refund, or privacy work stays contained.</p><div class="service-empty-shell"><div class="service-empty-primary"><div class="service-empty-section service-empty-section-compact"><div class="service-empty-column-title">What each tool does</div><div class="service-empty-flow-list"><div class="service-empty-flow"><strong>Billing</strong><span>Stripe customer portal access for self-hosted invoices, payment methods, and plan changes.</span></div><div class="service-empty-flow"><strong>Licenses</strong><span>Recover the latest active self-hosted license and the matching invoice link.</span></div><div class="service-empty-flow"><strong>Refunds</strong><span>Check eligibility before revoking active commercial access.</span></div><div class="service-empty-flow"><strong>Privacy</strong><span>Request export or deletion without leaving Pulse Account.</span></div></div></div><div class="service-empty-section service-empty-section-compact"><div class="service-empty-column-title">Before you start</div><div class="service-empty-points service-empty-points-stack"><div class="service-empty-point"><strong>One request</strong><span>Keep a single billing request active instead of bouncing across sections.</span></div><div class="service-empty-point"><strong>Identity first</strong><span>Verification happens before any sensitive account action opens.</span></div><div class="service-empty-point"><strong>Stay focused</strong><span>Use the hosted billing cards above when the request is tied to a hosted workspace account.</span></div></div></div></div><div class="service-empty-side"><div class="service-empty-section service-empty-section-support"><div class="service-empty-column-title">Escalation</div><div class="service-empty-checklist"><div class="service-empty-check"><strong>Escalate quickly</strong><span>If hosted billing or the self-hosted tools do not behave as expected, escalate from this section.</span></div><div class="service-empty-check"><strong>Billing packet</strong><span>Bring the billing tool, commercial email, and the exact failed action so support starts with the same request state.</span></div></div><div class="service-empty-support">Need help with billing, refund, privacy, or license requests? <a class="portal-support-link" href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a></div><div class="service-empty-actions"><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="support">Open support</button></div></div></div></div></div><div class="service-panel" id="manage-service-panel"><div id="manage-service-root"></div></div><div class="service-panel" id="retrieve-service-panel"><div id="retrieve-service-root"></div></div><div class="service-panel" id="refund-service-panel"><div id="refund-service-root"></div></div><div class="service-panel" id="data-service-panel"><h3>Data and privacy</h3><p>Request export or deletion of the commercial data tied to an email address. Payment data held directly by Stripe still requires support handling.</p><div class="subsection"><div id="data-export-root"></div></div><div class="subsection"><div id="data-delete-root"></div></div><div class="helper-text">Payment-card data stays with Stripe. For Stripe deletion support, contact <a href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a>.</div></div></div></div></div></section><section class="portal-content-panel portal-content-panel-support">' + renderSupportSection(context) + "</section></div></div></div>";
}
function renderSignedOutPortalHTML(context) {
var statusHTML = "";
@@ -2283,10 +2337,10 @@
installShell({
store: deps.store,
onSectionChange: function(section) {
- if (section === "team") {
+ if (section === "access") {
var accounts = deps.store.getBootstrap().accounts || [];
- if (accounts[0]) {
- accountRuntime.ensureTeamVisible(accounts[0].id);
+ for (var i = 0; i < accounts.length; i += 1) {
+ accountRuntime.ensureTeamVisible(accounts[i].id);
}
}
}
diff --git a/internal/cloudcp/portal/frontend/src/account_controller.test.ts b/internal/cloudcp/portal/frontend/src/account_controller.test.ts
index 3afe7da40a..210ff0ecf9 100644
--- a/internal/cloudcp/portal/frontend/src/account_controller.test.ts
+++ b/internal/cloudcp/portal/frontend/src/account_controller.test.ts
@@ -47,7 +47,7 @@ describe('account controller', function() {
expect(runtime.openBilling).toHaveBeenCalledWith('acct_1');
document.getElementById('team')?.dispatchEvent(new MouseEvent('click', { bubbles: true }));
- expect(setShellSection).toHaveBeenCalledWith('team');
+ expect(setShellSection).toHaveBeenCalledWith('access');
expect(runtime.ensureTeamVisible).toHaveBeenCalledWith('acct_1');
document.getElementById('invite')?.dispatchEvent(new MouseEvent('click', { bubbles: true }));
diff --git a/internal/cloudcp/portal/frontend/src/account_controller.ts b/internal/cloudcp/portal/frontend/src/account_controller.ts
index 6a30072cc2..4e75bed034 100644
--- a/internal/cloudcp/portal/frontend/src/account_controller.ts
+++ b/internal/cloudcp/portal/frontend/src/account_controller.ts
@@ -3,7 +3,7 @@ import type { AccountRuntime } from './account_runtime';
export interface AccountControllerDeps {
runtime: AccountRuntime;
- setShellSection: (section: 'overview' | 'workspaces' | 'team' | 'services' | 'support') => void;
+ setShellSection: (section: 'overview' | 'workspaces' | 'access' | 'billing' | 'support') => void;
}
export function installAccountController(deps: AccountControllerDeps): void {
@@ -27,7 +27,7 @@ export function installAccountController(deps: AccountControllerDeps): void {
return;
case 'toggle-team':
event.preventDefault();
- deps.setShellSection('team');
+ deps.setShellSection('access');
deps.runtime.ensureTeamVisible(accountID);
return;
case 'invite-member':
diff --git a/internal/cloudcp/portal/frontend/src/account_view.ts b/internal/cloudcp/portal/frontend/src/account_view.ts
index 42c6566c17..8be733d0ea 100644
--- a/internal/cloudcp/portal/frontend/src/account_view.ts
+++ b/internal/cloudcp/portal/frontend/src/account_view.ts
@@ -33,7 +33,7 @@ function roleLabel(role: string): string {
function roleCapabilityCopy(role: string): string {
switch (normalizedTeamRole(role)) {
case 'owner':
- return 'Full account control, including billing, team access, and workspace control.';
+ return 'Full account control, including billing, access control, and workspace control.';
case 'admin':
return 'Can manage workspaces and billing for this account.';
case 'tech':
diff --git a/internal/cloudcp/portal/frontend/src/app.test.ts b/internal/cloudcp/portal/frontend/src/app.test.ts
index 60442173a0..a39fb07b5c 100644
--- a/internal/cloudcp/portal/frontend/src/app.test.ts
+++ b/internal/cloudcp/portal/frontend/src/app.test.ts
@@ -335,7 +335,7 @@ describe('portal app', function() {
});
await app.startupRefresh;
- document.querySelector('[data-action="toggle-team"][data-account-id="acct_1"]')?.dispatchEvent(new MouseEvent('click', { bubbles: true }));
+ document.querySelector('[data-shell-action="activate-section"][data-shell-section="access"]')?.dispatchEvent(new MouseEvent('click', { bubbles: true }));
await flushAsync();
expect(fetchMock).toHaveBeenNthCalledWith(2, '/api/accounts/acct_1/members');
diff --git a/internal/cloudcp/portal/frontend/src/app.ts b/internal/cloudcp/portal/frontend/src/app.ts
index 3401e2a768..f1ec173acc 100644
--- a/internal/cloudcp/portal/frontend/src/app.ts
+++ b/internal/cloudcp/portal/frontend/src/app.ts
@@ -71,10 +71,10 @@ export function installPortalApp(deps: PortalAppDeps): PortalApp {
installShell({
store: deps.store,
onSectionChange: function(section) {
- if (section === 'team') {
+ if (section === 'access') {
var accounts = deps.store.getBootstrap().accounts || [];
- if (accounts[0]) {
- accountRuntime.ensureTeamVisible(accounts[0].id);
+ for (var i = 0; i < accounts.length; i += 1) {
+ accountRuntime.ensureTeamVisible(accounts[i].id);
}
}
},
diff --git a/internal/cloudcp/portal/frontend/src/services_controller.test.ts b/internal/cloudcp/portal/frontend/src/services_controller.test.ts
index 6abad50eb5..e37ea52af5 100644
--- a/internal/cloudcp/portal/frontend/src/services_controller.test.ts
+++ b/internal/cloudcp/portal/frontend/src/services_controller.test.ts
@@ -33,7 +33,7 @@ describe('services controller', function() {
'<button id="refund" data-account-service-action="refund-inline-submit">Refund</button>';
document.getElementById('open')?.dispatchEvent(new MouseEvent('click', { bubbles: true }));
- expect(deps.setShellSection).toHaveBeenCalledWith('services');
+ expect(deps.setShellSection).toHaveBeenCalledWith('billing');
expect(deps.toggleServicePanel).toHaveBeenCalledWith('retrieve-service-panel');
expect(deps.focusElement).toHaveBeenCalledWith('retrieve-inline-email');
diff --git a/internal/cloudcp/portal/frontend/src/services_controller.ts b/internal/cloudcp/portal/frontend/src/services_controller.ts
index 8e938daa87..58a46de56c 100644
--- a/internal/cloudcp/portal/frontend/src/services_controller.ts
+++ b/internal/cloudcp/portal/frontend/src/services_controller.ts
@@ -1,7 +1,7 @@
import { asHTMLElement } from './services_view';
export interface ServicesControllerDeps {
- setShellSection: (section: 'overview' | 'workspaces' | 'team' | 'services' | 'support') => void;
+ setShellSection: (section: 'overview' | 'workspaces' | 'access' | 'billing' | 'support') => void;
toggleServicePanel: (panelID: string) => void;
focusElement: (id: string) => void;
requestVerificationCode: (flowID: 'manage' | 'retrieve' | 'export' | 'delete') => void;
@@ -24,7 +24,7 @@ export function installServicesController(deps: ServicesControllerDeps): void {
switch (action) {
case 'open-service-panel':
event.preventDefault();
- deps.setShellSection('services');
+ deps.setShellSection('billing');
deps.toggleServicePanel(panelID);
deps.focusElement(focusID);
return;
diff --git a/internal/cloudcp/portal/frontend/src/shell_view.test.ts b/internal/cloudcp/portal/frontend/src/shell_view.test.ts
index fd2d218bff..a751dfbe84 100644
--- a/internal/cloudcp/portal/frontend/src/shell_view.test.ts
+++ b/internal/cloudcp/portal/frontend/src/shell_view.test.ts
@@ -127,15 +127,15 @@ describe('shell view', function() {
expect(html).toContain('portal-shell-nav');
expect(html).toContain('Overview');
+ expect(html).toContain('Access');
+ expect(html).toContain('Billing');
+ expect(html).toContain('Support');
+ expect(html).toContain('Account tasks');
+ expect(html).toContain('What needs attention, what is ready, and the next obvious action.');
expect(html).toContain('3 total');
- expect(html).toContain('Workspaces');
expect(html).toContain('1 ready');
- expect(html).toContain('Account services');
- expect(html).toContain('4 tools');
- expect(html).toContain('Support');
expect(html).toContain('Manage');
- expect(html).toContain('id="account-services-section"');
- expect(html).toContain('Self-hosted commercial services');
+ expect(html).toContain('id="billing-section"');
expect(html).toContain('portal-account-context');
expect(html).toContain('Owner access');
expect(html).toContain('portal-account-context-summary');
@@ -146,29 +146,23 @@ describe('shell view', function() {
expect(html).toContain('Hosted workspace account');
expect(html).toContain('3 workspaces');
expect(html).toContain('Add workspace');
- expect(html).toContain('Manage billing');
- expect(html).toContain('Manage team');
- expect(html).toContain('Workspace status');
- expect(html).toContain('Review workspace status first');
+ expect(html).not.toContain('Manage billing');
+ expect(html).not.toContain('Manage team');
+ expect(html).toContain('Account brief');
+ expect(html).toContain('Start with the immediate question, not the platform model.');
expect(html).toContain('section-context-strip');
- expect(html).toContain('Next move');
- expect(html).toContain('Start in workspaces');
- expect(html).toContain('Needs review');
- expect(html).toContain('Workspace summary');
- expect(html).toContain('Account scope');
- expect(html).toContain('Manage client workspaces, billing, and team access from one place.');
- expect(html).toContain('Workspace path');
- expect(html).toContain('Commercial path');
- expect(html).toContain('Open workspaces');
- expect(html).toContain('Review team access');
- expect(html).toContain('Needs review');
- expect(html).toContain('Workspace overview');
+ expect(html).toContain('Needs attention');
+ expect(html).toContain('Ready');
+ expect(html).toContain('Next action');
+ expect(html).toContain('Review these first');
+ expect(html).toContain('Open and work');
+ expect(html).toContain('Review workspaces');
+ expect(html).toContain('Review access');
expect(html).toContain('account-stage-header-actions');
expect(html).toContain('0 suspended');
expect(html).toContain('Alpha Workspace');
expect(html).toContain('Beta Workspace');
expect(html).toContain('Gamma Workspace');
- expect(html).toContain('Ready now');
expect(html).toContain('Suspended');
expect(html).toContain('Needs attention');
expect(html).toContain('ready</span>');
@@ -182,23 +176,24 @@ describe('shell view', function() {
expect(html).toContain('data-action="select-workspace"');
expect(html).toContain('Workspace management');
expect(html).toContain('Lifecycle');
- expect(html).toContain('Pick one workspace for lifecycle review. Keep hosted billing, team changes, and new workspace creation in account actions.');
- expect(html).toContain('Keep account-wide actions separate');
+ expect(html).toContain('Pick one workspace for lifecycle review. Keep access and billing changes in their own sections.');
+ expect(html).toContain('Keep this section workspace-only');
expect(html).toContain('Inspect status');
expect(html).toContain('Stay deliberate');
expect(html).toContain('Close panel');
expect(html.indexOf('id="add-ws-form-acct_1"')).toBeGreaterThan(html.indexOf('Workspace management'));
- expect(html.indexOf('id="add-ws-form-acct_1"')).toBeGreaterThan(html.indexOf('Keep account-wide actions separate'));
+ expect(html.indexOf('id="add-ws-form-acct_1"')).toBeGreaterThan(html.indexOf('Keep this section workspace-only'));
expect(html).toContain('data-action="clear-workspace-selection"');
- expect(html).toContain('Team management');
- expect(html).toContain('Least privilege');
- expect(html).toContain('Workspace access');
+ expect(html).toContain('People and roles');
+ expect(html).toContain('Invite');
+ expect(html).toContain('Roles');
+ expect(html).toContain('Remove access');
expect(html).toContain('Invite someone new');
- expect(html).toContain('Access model');
+ expect(html).toContain('Role rules');
expect(html).toContain('Access review');
- expect(html).toContain('Keep access disciplined');
+ expect(html).toContain('Keep access explicit');
expect(html).toContain('Owners stay rare');
- expect(html).toContain('Billing, team access, and full account control.');
+ expect(html).toContain('Billing, access control, and full account control.');
expect(html).toContain('Workspace control plus billing for the account.');
expect(html).toContain('Workspace control without billing ownership.');
expect(html).toContain('Workspace review and verification without control-plane changes.');
@@ -207,12 +202,13 @@ describe('shell view', function() {
expect(html).toContain('service-action-row');
expect(html).toContain('service-action-button');
expect(html).toContain('id="service-panel-empty"');
- expect(html).toContain('Choose a service to begin');
- expect(html).toContain('Service brief');
- expect(html).toContain('Self-hosted only');
- expect(html).toContain('Commercial routing');
- expect(html).toContain('Keep this request separate');
- expect(html).toContain('Hosted stays hosted');
+ expect(html).toContain('Choose the billing task');
+ expect(html).toContain('Billing brief');
+ expect(html).toContain('Hosted billing');
+ expect(html).toContain('Self-hosted tools');
+ expect(html).toContain('Self-hosted billing');
+ expect(html).toContain('Keep the billing request contained');
+ expect(html).toContain('Hosted billing first when present');
expect(html).toContain('Open support');
expect(html).toContain('What each tool does');
expect(html).toContain('Before you start');
@@ -224,14 +220,12 @@ describe('shell view', function() {
expect(html).toContain('>Licenses<');
expect(html).toContain('>Refunds<');
expect(html).toContain('>Privacy<');
- expect(html).toContain('Choose the right path');
- expect(html).toContain('Hosted path');
- expect(html).toContain('Commercial path');
- expect(html).toContain('Route checklist');
+ expect(html).toContain('Escalation');
+ expect(html).toContain('Hosted problems');
+ expect(html).toContain('Billing and self-hosted issues');
expect(html).toContain('Escalation packet');
- expect(html).toContain('Escalate with facts');
- expect(html).toContain('Include in the escalation');
- expect(html).toContain('Open account services');
+ expect(html).toContain('What to send');
+ expect(html).toContain('Open billing');
});
it('renders self-hosted overview copy when no hosted accounts are attached', function() {
@@ -244,12 +238,11 @@ describe('shell view', function() {
);
expect(html).toContain('Pulse Account');
- expect(html).toContain('Account center');
- expect(html).toContain('Summary');
- expect(html).toContain('None');
- expect(html).toContain('Use these account tools for self-hosted licenses, billing, refunds, and privacy actions.');
- expect(html).toContain('Pick one commercial request and keep it separate from workspace and team changes.');
- expect(html).toContain('Account services');
+ expect(html).toContain('Account tasks');
+ expect(html).toContain('Self-hosted');
+ expect(html).toContain('Use this billing surface for self-hosted subscriptions, licenses, refunds, and privacy requests.');
+ expect(html).toContain('No hosted billing attached');
+ expect(html).toContain('Billing');
expect(html).not.toContain('Self-hosted commercial services');
});
@@ -317,11 +310,9 @@ describe('shell view', function() {
);
expect(html).toContain('Suspended until you resume it');
- expect(html).toContain('No active blockers');
- expect(html).toContain('Active workspaces are healthy while suspended workspaces stay parked until you resume them.');
- expect(html).toContain('Next step');
- expect(html).toContain('Active workspaces look stable. Resume a suspended workspace only when you are ready to bring it back into regular use.');
- expect(html).toContain('Active workspaces are healthy. Suspended workspaces stay parked until you resume them.');
+ expect(html).toContain('Nothing urgent');
+ expect(html).toContain('No workspace is ready yet');
+ expect(html).toContain('Create the next workspace');
expect(html).toContain('Suspended stays parked');
});
});
diff --git a/internal/cloudcp/portal/frontend/src/shell_view.ts b/internal/cloudcp/portal/frontend/src/shell_view.ts
index 532c396a9d..6895d53c43 100644
--- a/internal/cloudcp/portal/frontend/src/shell_view.ts
+++ b/internal/cloudcp/portal/frontend/src/shell_view.ts
@@ -147,7 +147,7 @@ function renderServiceActionRow(
'</div>' +
'</div>' +
'<div class="service-action-cta">' +
- '<button class="btn-secondary service-action-button" type="button" id="' + id + '" data-account-service-action="open-service-panel" data-account-service-panel="' + panelID + '" data-account-service-focus="' + focusID + '" data-shell-target="services">' + escapeHTML(actionLabel) + '</button>' +
+ '<button class="btn-secondary service-action-button" type="button" id="' + id + '" data-account-service-action="open-service-panel" data-account-service-panel="' + panelID + '" data-account-service-focus="' + focusID + '" data-shell-target="billing">' + escapeHTML(actionLabel) + '</button>' +
'</div>' +
'</article>'
);
@@ -296,7 +296,7 @@ function renderAccountContextStrip(account: PortalAccountSummary): string {
'<span class="account-context-chip">' + escapeHTML(workspaceLabel) + '</span>' +
'</div>' +
'</div>' +
- '<p>' + escapeHTML(account.kind === 'msp' ? 'Hosted workspace account for workspace access, team control, and billing.' : 'Hosted account for workspace access, team control, and billing.') + '</p>' +
+ '<p>' + escapeHTML(account.kind === 'msp' ? 'Hosted workspace account for workspace access, access control, and billing.' : 'Hosted account for workspace access, access control, and billing.') + '</p>' +
'</div>' +
'<div class="portal-account-context-summary">' +
'<div class="portal-account-context-stat">' +
@@ -339,26 +339,30 @@ function renderShellNavigation(accounts: PortalAccountSummary[], supportEmail: s
var workspaces = collectWorkspaces(accounts);
var totalWorkspaces = workspaces.length;
var readyWorkspaces = countReadyWorkspaces(workspaces);
+ var attentionCount = attentionWorkspaces(workspaces).length;
+ var hostedBillingCount = 0;
var canManage = false;
for (var i = 0; i < accounts.length; i += 1) {
if (accounts[i].can_manage) {
canManage = true;
- break;
+ }
+ if (accounts[i].has_billing) {
+ hostedBillingCount += 1;
}
}
return (
'<aside class="portal-shell-nav" aria-label="Pulse Account sections">' +
'<div class="portal-shell-nav-header">' +
'<div class="portal-shell-nav-eyebrow">Pulse Account</div>' +
- '<div class="portal-shell-nav-title">Account center</div>' +
- '<div class="portal-shell-nav-support">' + (hosted ? 'Workspaces, account access, and commercial services' : 'Commercial account services and support') + '</div>' +
+ '<div class="portal-shell-nav-title">Account tasks</div>' +
+ '<div class="portal-shell-nav-support">' + (hosted ? 'Start with the job you need to finish: workspace work, access, billing, then escalation.' : 'Use billing tools first and escalate only when the self-serve path stops.' ) + '</div>' +
'</div>' +
'<div class="portal-shell-nav-group">' +
- shellSectionButton('overview', activeSection, '01', 'Overview', hosted ? 'Status, priorities, and next actions' : 'Account summary and access state', hosted ? String(totalWorkspaces) + ' total' : 'Summary') +
- shellSectionButton('workspaces', activeSection, '02', hosted ? 'Workspaces' : 'Workspace access', hosted ? 'Workspace access and lifecycle actions' : 'No workspaces are attached yet', hosted ? String(readyWorkspaces) + ' ready' : 'None') +
- shellSectionButton('team', activeSection, '03', 'Team', hosted ? 'Access and team roster' : 'Account membership', canManage ? 'Manage' : 'View') +
- shellSectionButton('services', activeSection, '04', 'Account services', 'Licenses, billing, refunds, and privacy', '4 tools') +
- shellSectionButton('support', activeSection, '05', 'Support', hosted ? 'Escalation and account support' : (supportEmail || 'Support contact'), supportEmail ? 'Email' : 'Help') +
+ shellSectionButton('overview', activeSection, '01', 'Overview', 'What needs attention, what is ready, and the next obvious action.', attentionCount > 0 ? String(attentionCount) + ' review' : (hosted ? String(readyWorkspaces) + ' ready' : 'Summary')) +
+ shellSectionButton('workspaces', activeSection, '02', 'Workspaces', hosted ? 'Open a workspace, review lifecycle state, or create one.' : 'No hosted workspaces are attached yet.', hosted ? String(readyWorkspaces) + ' ready' : 'None') +
+ shellSectionButton('access', activeSection, '03', 'Access', hosted ? 'Invite people, change roles, and remove account access.' : 'Account access and membership controls.', canManage ? 'Manage' : 'View') +
+ shellSectionButton('billing', activeSection, '04', 'Billing', hostedBillingCount > 0 ? 'Hosted billing first, then self-hosted licenses, refunds, and privacy only when relevant.' : 'Self-hosted billing, licenses, refunds, and privacy.', hostedBillingCount > 0 ? (hostedBillingCount > 1 ? 'Hosted +' : 'Hosted') : 'Self-hosted') +
+ shellSectionButton('support', activeSection, '05', 'Support', 'Escalation only after the workspace, access, or billing path is exhausted.', supportEmail ? 'Email' : 'Help') +
'</div>' +
'</aside>'
);
@@ -419,125 +423,184 @@ function renderWorkspaceCard(account: PortalAccountSummary, workspace: PortalWor
);
}
-function renderAccountOverviewSection(account: PortalAccountSummary): string {
+function readyWorkspaces(workspaces: PortalWorkspaceSummary[]): PortalWorkspaceSummary[] {
+ var results: PortalWorkspaceSummary[] = [];
+ for (var i = 0; i < workspaces.length; i += 1) {
+ if (String(workspaces[i].state || '') === 'active' && workspaceHealthState(workspaces[i]) === 'healthy') {
+ results.push(workspaces[i]);
+ }
+ }
+ return results;
+}
+
+function renderWorkspaceHandoffForm(accountID: string, workspaceID: string, accountAPIBasePath: string, label: string, buttonClassName = 'btn-secondary btn-compact'): string {
+ if (!accountAPIBasePath) {
+ return '<button class="' + escapeAttr(buttonClassName) + '" type="button" data-shell-action="activate-section" data-shell-section="workspaces">' + escapeHTML(label) + '</button>';
+ }
+ return (
+ '<form method="POST" action="' +
+ escapeAttr(accountAPIBasePath + '/' + accountID + '/tenants/' + workspaceID + '/handoff') +
+ '">' +
+ '<button type="submit" class="' + escapeAttr(buttonClassName) + '">' + escapeHTML(label) + '</button>' +
+ '</form>'
+ );
+}
+
+function renderOverviewAttentionCard(workspaces: PortalWorkspaceSummary[]): string {
+ var attention = attentionWorkspaces(workspaces);
+ if (!attention.length) {
+ return (
+ '<article class="overview-task-card">' +
+ '<div class="account-panel-kicker">Needs attention</div>' +
+ '<h4>Nothing urgent</h4>' +
+ '<p>No active workspace is currently asking for review.</p>' +
+ '<div class="overview-task-list">' +
+ '<div class="overview-task-item"><strong>Healthy now</strong><span>Active workspaces look clear for routine use.</span></div>' +
+ '<div class="overview-task-item"><strong>Suspended stays parked</strong><span>Suspended workspaces stay out of the way until you deliberately resume them.</span></div>' +
+ '</div>' +
+ '</article>'
+ );
+ }
+
+ return (
+ '<article class="overview-task-card overview-task-card-attention">' +
+ '<div class="account-panel-kicker">Needs attention</div>' +
+ '<h4>Review these first</h4>' +
+ '<p>These workspaces still need a human check before you treat the account as settled.</p>' +
+ '<div class="overview-task-list">' +
+ attention.slice(0, 3).map(function(workspace) {
+ return (
+ '<div class="overview-task-item">' +
+ '<strong>' + escapeHTML(workspace.display_name) + '</strong>' +
+ '<span>' + escapeHTML(workspaceStatusCopy(workspace)) + '</span>' +
+ '</div>'
+ );
+ }).join('') +
+ '</div>' +
+ '</article>'
+ );
+}
+
+function renderOverviewReadyCard(account: PortalAccountSummary, workspaces: PortalWorkspaceSummary[], accountAPIBasePath: string): string {
+ var ready = readyWorkspaces(workspaces);
+ if (!ready.length) {
+ return (
+ '<article class="overview-task-card">' +
+ '<div class="account-panel-kicker">Ready</div>' +
+ '<h4>No workspace is ready yet</h4>' +
+ '<p>Use Workspaces to review current state before you start routine work.</p>' +
+ '</article>'
+ );
+ }
+
+ return (
+ '<article class="overview-task-card">' +
+ '<div class="account-panel-kicker">Ready</div>' +
+ '<h4>Open and work</h4>' +
+ '<p>These workspaces are active and healthy right now.</p>' +
+ '<div class="overview-task-list">' +
+ ready.slice(0, 3).map(function(workspace) {
+ return (
+ '<div class="overview-task-item overview-task-item-action">' +
+ '<div class="overview-task-copy">' +
+ '<strong>' + escapeHTML(workspace.display_name) + '</strong>' +
+ '<span>' + escapeHTML(workspaceRowNote(workspace)) + '</span>' +
+ '</div>' +
+ renderWorkspaceHandoffForm(account.id, workspace.id, accountAPIBasePath, 'Open workspace') +
+ '</div>'
+ );
+ }).join('') +
+ '</div>' +
+ '</article>'
+ );
+}
+
+function renderOverviewNextActionCard(account: PortalAccountSummary, workspaces: PortalWorkspaceSummary[], accountAPIBasePath: string): string {
+ var attention = attentionWorkspaces(workspaces);
+ var ready = readyWorkspaces(workspaces);
+ var primaryAction = '';
+ var secondaryAction = '';
+ var title = '';
+ var description = '';
+
+ if (attention.length) {
+ title = 'Review workspace health';
+ description = 'Open Workspaces and resolve the pending health or lifecycle questions before you do anything else.';
+ primaryAction = '<button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="workspaces">Review workspaces</button>';
+ secondaryAction = account.can_manage
+ ? '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="access">Review access</button>'
+ : '';
+ } else if (ready.length) {
+ title = 'Open the next workspace';
+ description = 'The most obvious next step is to open a ready workspace and continue the actual work there.';
+ primaryAction = renderWorkspaceHandoffForm(account.id, ready[0].id, accountAPIBasePath, 'Open ' + ready[0].display_name, 'btn-primary btn-compact');
+ secondaryAction = ready.length > 1
+ ? '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="workspaces">See all workspaces</button>'
+ : '';
+ } else if (account.kind === 'msp' && account.can_manage) {
+ title = 'Create the next workspace';
+ description = 'There is no ready workspace yet, so the next clear action is to create one from the Workspaces section.';
+ primaryAction = '<button class="btn-primary btn-compact" type="button" data-action="toggle-add-workspace" data-account-id="' + escapeAttr(account.id) + '">Create workspace</button>';
+ secondaryAction = '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="access">Manage access</button>';
+ } else if (account.has_billing && account.can_manage) {
+ title = 'Handle billing in its own place';
+ description = 'Operational work is clear, so the next separate task is billing if that is what you came here to change.';
+ primaryAction = '<button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="billing">Open billing</button>';
+ secondaryAction = '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="access">Review access</button>';
+ } else {
+ title = 'Choose the right task path';
+ description = 'If this is an access change, go to Access. If it is a billing or license issue, go to Billing. Support is only for escalation.';
+ primaryAction = '<button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="' + (account.can_manage ? 'access' : 'billing') + '">' + (account.can_manage ? 'Open access' : 'Open billing') + '</button>';
+ secondaryAction = '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="support">Escalate</button>';
+ }
+
+ return (
+ '<article class="overview-task-card overview-task-card-next">' +
+ '<div class="account-panel-kicker">Next action</div>' +
+ '<h4>' + escapeHTML(title) + '</h4>' +
+ '<p>' + escapeHTML(description) + '</p>' +
+ '<div class="overview-task-actions">' +
+ primaryAction +
+ secondaryAction +
+ '</div>' +
+ '</article>'
+ );
+}
+
+function renderAccountOverviewSection(account: PortalAccountSummary, accountAPIBasePath: string): string {
var workspaces = Array.isArray(account.workspaces) ? account.workspaces : [];
var totalCount = workspaces.length;
var readyCount = countReadyWorkspaces(workspaces);
- var healthyCount = countWorkspacesByHealth(workspaces, 'healthy');
var checkingCount = countWorkspacesByHealth(workspaces, 'checking');
var unhealthyCount = countWorkspacesByHealth(workspaces, 'unhealthy');
var suspendedCount = countWorkspacesByState(workspaces, 'suspended');
- var postureTitle = unhealthyCount > 0
- ? 'Needs review'
- : checkingCount > 0
- ? 'Still settling'
- : suspendedCount > 0
- ? 'Active workspaces are stable'
- : 'Workspaces are stable';
- var postureCopy = unhealthyCount > 0
- ? 'One or more workspaces still need attention before this account looks healthy.'
- : checkingCount > 0
- ? 'Most workspaces look healthy, but some are still waiting on a completed health check.'
- : suspendedCount > 0
- ? 'Active workspaces are healthy while suspended workspaces stay parked until you resume them.'
- : 'All workspaces are healthy and ready for routine use.';
- var nextStepTitle = unhealthyCount > 0
- ? 'Start in workspaces'
- : checkingCount > 0
- ? 'Review pending checks'
- : suspendedCount > 0
- ? 'Next step'
- : 'Next step';
- var nextStepCopy = unhealthyCount > 0
- ? 'One or more workspaces need review before you treat this account as healthy.'
- : checkingCount > 0
- ? 'The fleet is mostly healthy, but there are still workspaces waiting on a completed health check.'
- : suspendedCount > 0
- ? 'Active workspaces look stable. Resume a suspended workspace only when you are ready to bring it back into regular use.'
- : 'Everything looks stable. Move into Team or Account services only if you need to change access or billing.';
- var nextStepChecklist = unhealthyCount > 0
- ? (
- '<div class="overview-next-checklist">' +
- '<div class="overview-next-check"><strong>1. Review attention items</strong><span>Open the fleet and inspect any workspace marked as checking or needs attention.</span></div>' +
- '<div class="overview-next-check"><strong>2. Resolve access blockers</strong><span>Use Team if the right people are not already attached to the hosted account.</span></div>' +
- '<div class="overview-next-check"><strong>3. Escalate billing separately</strong><span>Keep account billing or self-hosted license work out of the workspace review flow.</span></div>' +
- '</div>'
- )
- : checkingCount > 0
- ? (
- '<div class="overview-next-checklist">' +
- '<div class="overview-next-check"><strong>1. Verify pending checks</strong><span>Open the workspaces still settling and confirm they are safe to operate.</span></div>' +
- '<div class="overview-next-check"><strong>2. Keep access deliberate</strong><span>Change Team only if a pending workspace needs a different mix of access.</span></div>' +
- '<div class="overview-next-check"><strong>3. Keep commercial work separate</strong><span>Use account services or billing only when the workspace state is already understood.</span></div>' +
- '</div>'
- )
- : (
- '<div class="overview-next-checklist">' +
- '<div class="overview-next-check"><strong>1. Open a workspace for the next operational task</strong><span>Move into Workspaces when you are ready to do workspace work.</span></div>' +
- '<div class="overview-next-check"><strong>2. Change access in Team only</strong><span>Keep roster changes explicit instead of mixing them into routine workspace work.</span></div>' +
- '<div class="overview-next-check"><strong>3. Keep billing and privacy separate</strong><span>Licenses, refunds, privacy, and self-hosted billing stay in their own section.</span></div>' +
- '</div>'
- );
- var nextStepActions =
- '<div class="overview-next-actions">' +
- '<button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="workspaces">Open workspaces</button>' +
- '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="' + (account.can_manage ? 'team' : 'services') + '">' + (account.can_manage ? 'Review team access' : 'Open account services') + '</button>' +
- '</div>';
- var accountScopeCopy = account.kind === 'msp'
- ? 'Manage client workspaces, billing, and team access from one place.'
- : 'Manage workspaces, billing, and team access from one place.';
- var overviewBriefStrip =
- '<div class="account-overview-brief-strip">' +
- '<div class="account-overview-brief-point account-overview-brief-point-wide">' +
- '<strong>Account scope</strong>' +
- '<span>' + escapeHTML(accountScopeCopy) + '</span>' +
- '</div>' +
- '<div class="account-overview-brief-point">' +
- '<strong>Workspace path</strong>' +
- '<span>Use Workspaces for tenant access and lifecycle changes, and Team only when access needs to change.</span>' +
- '</div>' +
- '<div class="account-overview-brief-point">' +
- '<strong>Commercial path</strong>' +
- '<span>Keep licenses, refunds, privacy, and self-hosted billing in Account services instead of mixing them into workspace work.</span>' +
- '</div>' +
- '</div>';
+ var attentionCount = attentionWorkspaces(workspaces).length;
return (
'<section class="account-content-panel account-content-panel-overview">' +
- '<div class="account-stage-header account-stage-header-overview">' +
+ '<div class="account-stage-header account-stage-header-overview overview-stage-header">' +
'<div>' +
'<div class="account-panel-kicker">Overview</div>' +
- '<h3>Workspace status</h3>' +
- '<p>Review workspace status first, then move into the next section.</p>' +
+ '<h3>Account brief</h3>' +
+ '<p>Start with the immediate question, not the platform model.</p>' +
renderSectionContextChips([
- String(totalCount) + ' total',
+ String(attentionCount) + ' attention',
String(readyCount) + ' ready',
- suspendedCount > 0 ? String(suspendedCount) + ' suspended' : 'All active',
+ String(totalCount) + ' total',
+ suspendedCount > 0 ? String(suspendedCount) + ' suspended' : 'No suspended',
]) +
- renderOverviewMetricStrip(totalCount, readyCount, checkingCount, unhealthyCount, suspendedCount) +
'</div>' +
'</div>' +
- '<div class="account-command-deck">' +
- '<div class="account-overview-main-column">' +
- '<div class="account-overview-card account-overview-briefing-card">' +
- '<div class="account-overview-lead">' +
- '<div class="account-panel-kicker">Workspace summary</div>' +
- '<h3>' + escapeHTML(postureTitle) + '</h3>' +
- '<p>' + escapeHTML(postureCopy) + '</p>' +
- overviewBriefStrip +
- '</div>' +
- '<div class="account-overview-next-block">' +
- '<div class="account-panel-kicker">Next move</div>' +
- '<h4>' + escapeHTML(nextStepTitle) + '</h4>' +
- '<p>' + escapeHTML(nextStepCopy) + '</p>' +
- nextStepChecklist +
- nextStepActions +
- '</div>' +
- '</div>' +
- '</div>' +
- '<div class="account-overview-side-column">' +
- renderAttentionPanel(workspaces) +
- '</div>' +
+ '<div class="overview-task-grid">' +
+ renderOverviewAttentionCard(workspaces) +
+ renderOverviewReadyCard(account, workspaces, accountAPIBasePath) +
+ renderOverviewNextActionCard(account, workspaces, accountAPIBasePath) +
+ '</div>' +
+ '<div class="overview-task-summary-bar">' +
+ '<div class="overview-task-summary-pill"><strong>Healthy</strong><span>' + String(countWorkspacesByHealth(workspaces, 'healthy')) + '</span></div>' +
+ '<div class="overview-task-summary-pill"><strong>Checking</strong><span>' + String(checkingCount) + '</span></div>' +
+ '<div class="overview-task-summary-pill"><strong>Needs attention</strong><span>' + String(unhealthyCount) + '</span></div>' +
+ '<div class="overview-task-summary-pill"><strong>Suspended</strong><span>' + String(suspendedCount) + '</span></div>' +
'</div>' +
'</section>'
);
@@ -557,16 +620,6 @@ function renderAccountWorkspaceSection(account: PortalAccountSummary, accountAPI
escapeAttr(account.id) +
'">Add workspace</button>';
}
- if (account.has_billing) {
- workspaceHeaderActions +=
- '<button type="button" class="btn-secondary btn-compact" data-action="open-billing" data-account-id="' +
- escapeAttr(account.id) +
- '">Manage billing</button>';
- }
- workspaceHeaderActions +=
- '<button type="button" class="btn-secondary btn-compact" data-action="toggle-team" data-account-id="' +
- escapeAttr(account.id) +
- '" data-shell-target="team">Manage team</button>';
var workspaceDeskActions = '';
if (account.kind === 'msp') {
@@ -597,17 +650,6 @@ function renderAccountWorkspaceSection(account: PortalAccountSummary, accountAPI
'</div>' +
'</div>';
}
- if (account.has_billing) {
- workspaceDeskActions +=
- '<button type="button" class="btn-secondary btn-compact" data-action="open-billing" data-account-id="' +
- escapeAttr(account.id) +
- '">Manage billing</button>';
- }
- workspaceDeskActions +=
- '<button type="button" class="btn-secondary btn-compact" data-action="toggle-team" data-account-id="' +
- escapeAttr(account.id) +
- '" data-shell-target="team">Manage team</button>';
-
workspaceManagement =
'<section class="workspace-management-panel" id="workspace-management-' +
escapeAttr(account.id) +
@@ -627,13 +669,13 @@ function renderAccountWorkspaceSection(account: PortalAccountSummary, accountAPI
'<div class="workspace-management-empty" id="workspace-management-empty-' +
escapeAttr(account.id) +
'">' +
- '<div class="workspace-management-empty-copy">Pick one workspace for lifecycle review. Keep hosted billing, team changes, and new workspace creation in account actions.</div>' +
+ '<div class="workspace-management-empty-copy">Pick one workspace for lifecycle review. Keep access and billing changes in their own sections.</div>' +
'<div class="workspace-management-empty-shell">' +
'<div class="workspace-management-empty-actions-card">' +
'<div class="workspace-management-empty-actions-copy">' +
- '<div class="account-panel-kicker">Account actions</div>' +
- '<h4>Keep account-wide actions separate</h4>' +
- '<p>Use this area for new workspaces, hosted billing, and team changes. Keep row actions focused on a single workspace.</p>' +
+ '<div class="account-panel-kicker">Workspace tasks</div>' +
+ '<h4>Keep this section workspace-only</h4>' +
+ '<p>Create a workspace here when you need one. Access changes belong in Access, and billing changes belong in Billing.</p>' +
'</div>' +
'<div class="workspace-management-empty-actions">' + workspaceDeskActions + '</div>' +
addWorkspaceForm +
@@ -708,9 +750,9 @@ function renderAccountWorkspaceSection(account: PortalAccountSummary, accountAPI
'<div class="account-stage-header">' +
'<div class="account-stage-header-row">' +
'<div>' +
- '<div class="account-panel-kicker">Workspace overview</div>' +
+ '<div class="account-panel-kicker">Workspaces</div>' +
'<h3>Workspaces</h3>' +
- '<p>Open workspaces, review status, and keep lifecycle actions explicit.</p>' +
+ '<p>Open a workspace, review lifecycle state, or create a new one without mixing in access or billing work.</p>' +
renderSectionContextChips([
String(workspaces.length) + ' total',
String(readyCount) + ' ready',
@@ -736,15 +778,15 @@ function renderAccountWorkspaceSection(account: PortalAccountSummary, accountAPI
);
}
-function renderAccountTeamSection(account: PortalAccountSummary): string {
+function renderAccountAccessSection(account: PortalAccountSummary): string {
var accessPolicy =
'<div class="team-policy-panel">' +
'<div class="team-panel-heading">' +
- '<h4>Access model</h4>' +
- '<p>Assign the smallest role that still lets someone do the work they own on this account.</p>' +
+ '<h4>Role rules</h4>' +
+ '<p>Invite the smallest role that still lets someone do the work they actually own on this account.</p>' +
'</div>' +
'<div class="team-policy-list">' +
- '<div class="team-policy-row"><strong>Owner</strong><span>Billing, team access, and full account control.</span></div>' +
+ '<div class="team-policy-row"><strong>Owner</strong><span>Billing, access control, and full account control.</span></div>' +
'<div class="team-policy-row"><strong>Admin</strong><span>Workspace control plus billing for the account.</span></div>' +
'<div class="team-policy-row"><strong>Tech</strong><span>Workspace control without billing ownership.</span></div>' +
'<div class="team-policy-row"><strong>Read-only</strong><span>Workspace review and verification without control-plane changes.</span></div>' +
@@ -755,13 +797,13 @@ function renderAccountTeamSection(account: PortalAccountSummary): string {
'<div class="team-review-strip">' +
'<div class="team-panel-heading team-panel-heading-tight">' +
'<div class="account-panel-kicker">Access review</div>' +
- '<h4>Keep access disciplined</h4>' +
- '<p>Use the roster as a controlled access list, not a dumping ground for vague shared access.</p>' +
+ '<h4>Keep access explicit</h4>' +
+ '<p>Use the roster as a controlled access list, not a vague shared bucket.</p>' +
'</div>' +
'<div class="team-review-grid">' +
'<div class="team-review-card">' +
'<strong>Owners stay rare</strong>' +
- '<span>Reserve Owner for billing, team, and full account control. Default to Admin, Tech, or Read-only first.</span>' +
+ '<span>Reserve Owner for billing, access control, and full account control. Default to Admin, Tech, or Read-only first.</span>' +
'</div>' +
'<div class="team-review-card">' +
'<strong>Keep access narrow</strong>' +
@@ -776,7 +818,7 @@ function renderAccountTeamSection(account: PortalAccountSummary): string {
'</div>';
return (
- '<section class="account-content-panel account-content-panel-team">' +
+ '<section class="account-content-panel account-content-panel-access">' +
'<section class="team-management-panel team-section team-section-shell" id="team-section-' +
escapeAttr(account.id) +
'" data-actor-role="' +
@@ -784,16 +826,17 @@ function renderAccountTeamSection(account: PortalAccountSummary): string {
'">' +
'<div class="team-management-header">' +
'<div>' +
- '<div class="account-panel-kicker">Team management</div>' +
- '<h3>Account access</h3>' +
- '<p>Owners govern billing and access. Admins and techs keep workspace operations moving day to day.</p>' +
+ '<div class="account-panel-kicker">Access</div>' +
+ '<h3>People and roles</h3>' +
+ '<p>Invite people, change roles, and remove stale access without mixing that work into workspace operations.</p>' +
renderSectionContextChips([
account.can_manage ? 'Managed roster' : 'View only',
- 'Least privilege',
- 'Workspace access',
+ 'Invite',
+ 'Roles',
+ 'Remove access',
]) +
'</div>' +
- '<button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="workspaces">Close team view</button>' +
+ '<button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="workspaces">Back to workspaces</button>' +
'</div>' +
'<div class="team-management-stats" id="team-stats-' +
escapeAttr(account.id) +
@@ -803,7 +846,7 @@ function renderAccountTeamSection(account: PortalAccountSummary): string {
'<div class="team-roster">' +
'<div class="team-panel-heading">' +
'<h4>People on this account</h4>' +
- '<p>Keep the roster small and role assignment explicit. The people listed here are the ones who can manage these workspaces.</p>' +
+ '<p>Every person here can reach this hosted account. Keep the list small and the role choice explicit.</p>' +
'</div>' +
'<div class="team-roster-list" id="team-list-' +
escapeAttr(account.id) +
@@ -817,14 +860,14 @@ function renderAccountTeamSection(account: PortalAccountSummary): string {
'<div class="team-operations-panel">' +
'<div class="team-panel-heading team-panel-heading-tight">' +
'<div class="account-panel-kicker">Access controls</div>' +
- '<h4>Invite and role policy</h4>' +
- '<p>Keep the roster deliberate. Invite the smallest role first, then tighten access as responsibilities become clearer.</p>' +
+ '<h4>Invite, role, remove</h4>' +
+ '<p>Use this column when you need to add someone, tighten a role, or remove access that no longer belongs here.</p>' +
'</div>' +
'<div class="team-operations-grid">' +
'<div class="team-invite-panel">' +
'<div class="team-panel-heading">' +
'<h4>Invite someone new</h4>' +
- '<p>Add another person with the minimum role they need for this account.</p>' +
+ '<p>Add a person with the minimum role they need for this account.</p>' +
'</div>' +
'<div class="team-invite">' +
'<div><label for="invite-email-' +
@@ -852,79 +895,84 @@ function renderAccountTeamSection(account: PortalAccountSummary): string {
);
}
+function renderHostedBillingCards(accounts: PortalAccountSummary[]): string {
+ var hostedBillingAccounts = accounts.filter(function(account) {
+ return account.has_billing;
+ });
+ if (!hostedBillingAccounts.length) {
+ return (
+ '<div class="billing-task-card billing-task-card-muted">' +
+ '<div class="account-panel-kicker">Hosted billing</div>' +
+ '<h3>No hosted billing attached</h3>' +
+ '<p>Use the self-hosted billing tools below only if you are managing a self-hosted purchase.</p>' +
+ '</div>'
+ );
+ }
+
+ return hostedBillingAccounts.map(function(account) {
+ var actionHTML = account.can_manage
+ ? '<button type="button" class="btn-primary btn-compact" data-action="open-billing" data-account-id="' + escapeAttr(account.id) + '">Open hosted billing</button>'
+ : '<div class="billing-task-note">An owner or admin on this account needs to open hosted billing.</div>';
+ return (
+ '<article class="billing-task-card">' +
+ '<div class="account-panel-kicker">Hosted billing</div>' +
+ '<h3>' + escapeHTML(account.name) + '</h3>' +
+ '<p>Invoices, payment methods, and hosted subscription changes for this account live here.</p>' +
+ '<div class="billing-task-points">' +
+ '<div class="billing-task-point"><strong>Use when hosted billing is the job</strong><span>Keep workspace lifecycle work in Workspaces and access changes in Access.</span></div>' +
+ '<div class="billing-task-point"><strong>Stay account-specific</strong><span>Open billing from the exact hosted account you want to change.</span></div>' +
+ '</div>' +
+ '<div class="billing-task-actions">' + actionHTML + '</div>' +
+ '</article>'
+ );
+ }).join('');
+}
+
function renderSupportSection(context: ShellViewContext): string {
return (
'<section class="portal-support-panel">' +
'<div class="account-panel-kicker">Support</div>' +
- '<h2>Support</h2>' +
- '<p>Use this section when hosted access looks wrong, billing behaves unexpectedly, or you need help with commercial requests.</p>' +
- renderSectionContextChips(['Hosted issues', 'Commercial requests', context.bootstrap.support_email ? 'Email' : 'Support']) +
- '<div class="portal-support-brief-strip">' +
- '<div class="portal-support-brief-card">' +
- '<strong>Hosted path</strong>' +
- '<span>Workspace access, team control, tenant handoff, and hosted billing stay on the hosted account route.</span>' +
- '</div>' +
- '<div class="portal-support-brief-card">' +
- '<strong>Commercial path</strong>' +
- '<span>Self-hosted billing, licenses, refunds, and privacy requests stay in Account services until escalation is needed.</span>' +
- '</div>' +
- '<div class="portal-support-brief-card">' +
- '<strong>Escalate with context</strong>' +
- '<span>Include the exact account, workspace, section, and failed action so support can continue the same path immediately.</span>' +
- '</div>' +
- '</div>' +
+ '<h2>Escalation</h2>' +
+ '<p>Come here only after the workspace, access, or billing path has stopped you.</p>' +
+ renderSectionContextChips(['Escalation only', 'Bring context', context.bootstrap.support_email ? 'Email' : 'Support']) +
'<div class="portal-support-layout">' +
'<div class="portal-support-route-grid">' +
'<div class="portal-support-route-card">' +
'<div class="account-panel-kicker">Hosted account</div>' +
- '<h3>Hosted support</h3>' +
- '<p>Use this route when tenant handoff, workspace access, team control, or hosted billing looks wrong.</p>' +
+ '<h3>Hosted problems</h3>' +
+ '<p>Use support for hosted issues only after you have already tried the Workspaces or Access path.</p>' +
'<div class="portal-support-points">' +
- '<div class="portal-support-point"><strong>Route here for hosted issues</strong><span>Access, handoff, team, and hosted billing all belong on the hosted account path.</span></div>' +
+ '<div class="portal-support-point"><strong>Use after the hosted path fails</strong><span>Workspace access, lifecycle, and account access should already be narrowed before you escalate.</span></div>' +
'<div class="portal-support-point"><strong>Keep the account context intact</strong><span>Include the account, workspace, and action that failed so support can pick up the same issue quickly.</span></div>' +
'</div>' +
'<div class="portal-support-actions">' +
+ '<button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="workspaces">Open workspaces</button>' +
+ '<button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="access">Open access</button>' +
'<a class="portal-support-link" href="mailto:' + escapeAttr(context.bootstrap.support_email || '') + '">' + escapeHTML(context.bootstrap.support_email || '') + '</a>' +
'</div>' +
'</div>' +
'<div class="portal-support-route-card">' +
- '<div class="account-panel-kicker">Commercial</div>' +
- '<h3>Commercial requests</h3>' +
- '<p>Self-hosted subscriptions, license recovery, refunds, and privacy requests all route through Account services first.</p>' +
+ '<div class="account-panel-kicker">Billing</div>' +
+ '<h3>Billing and self-hosted issues</h3>' +
+ '<p>Use this route only after hosted billing or the self-hosted billing tools have failed to complete the request cleanly.</p>' +
'<div class="portal-support-points">' +
- '<div class="portal-support-point"><strong>Start in Account services</strong><span>Use Billing, Licenses, Refunds, or Privacy before escalating a commercial issue.</span></div>' +
- '<div class="portal-support-point"><strong>Escalate from the same path</strong><span>Keep the request in one place instead of splitting it between billing and account sections.</span></div>' +
+ '<div class="portal-support-point"><strong>Start in Billing</strong><span>Hosted billing, licenses, refunds, and privacy should already be narrowed to one failed request.</span></div>' +
+ '<div class="portal-support-point"><strong>Escalate from the same path</strong><span>Bring the billing tool or hosted billing action that failed instead of reopening the story from scratch.</span></div>' +
'</div>' +
'<div class="portal-support-actions">' +
- '<button type="button" class="btn-secondary" data-shell-action="activate-section" data-shell-section="services">Open account services</button>' +
+ '<button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="billing">Open billing</button>' +
+ '<a class="portal-support-link" href="mailto:' + escapeAttr(context.bootstrap.support_email || '') + '">' + escapeHTML(context.bootstrap.support_email || '') + '</a>' +
'</div>' +
'</div>' +
'</div>' +
'<div class="portal-support-runbook">' +
- '<div class="account-panel-kicker">Escalation guide</div>' +
- '<h3>Choose the right path</h3>' +
- '<p>Keep hosted workspace issues, commercial requests, and pure support escalation on their own paths so the next person does not have to reconstruct the account state.</p>' +
- '<div class="portal-support-runbook-brief">' +
- '<div class="portal-support-runbook-brief-card"><strong>Confirm scope</strong><span>Decide first whether the issue is a hosted workspace problem, a commercial self-service request, or direct support escalation.</span></div>' +
- '<div class="portal-support-runbook-brief-card"><strong>Keep paths separate</strong><span>Workspace and team problems stay out of billing, refund, privacy, and license work.</span></div>' +
- '<div class="portal-support-runbook-brief-card"><strong>Escalate with facts</strong><span>Bring the exact account, workspace, section, and failed action so support starts with the same state you saw.</span></div>' +
- '</div>' +
- '<div class="portal-support-runbook-grid">' +
- '<div class="portal-support-runbook-section">' +
- '<div class="portal-support-runbook-section-title">Route checklist</div>' +
- '<div class="portal-support-runbook-list">' +
- '<div class="portal-support-runbook-step"><strong>1. Confirm the scope</strong><span>Decide whether the problem is a hosted workspace issue, a commercial self-service request, or direct support escalation.</span></div>' +
- '<div class="portal-support-runbook-step"><strong>2. Keep hosted and commercial separate</strong><span>Workspace and team problems stay in their own sections. Billing, license, refund, and privacy work stay in Account services.</span></div>' +
- '<div class="portal-support-runbook-step"><strong>3. Escalate with context</strong><span>Include the account, workspace, and exact failed action so the escalation path starts with the same facts you saw.</span></div>' +
- '</div>' +
- '</div>' +
- '<div class="portal-support-runbook-section">' +
- '<div class="portal-support-runbook-section-title">Escalation packet</div>' +
- '<div class="portal-support-handoff-note">' +
- '<strong>Include in the escalation</strong>' +
- '<span>Account name, workspace name if relevant, the section you were in, the exact button or request that failed, and whether the issue was hosted or commercial.</span>' +
- '</div>' +
- '</div>' +
+ '<div class="account-panel-kicker">Escalation packet</div>' +
+ '<h3>What to send</h3>' +
+ '<p>Keep the packet short and concrete so support can pick up the exact failed path immediately.</p>' +
+ '<div class="portal-support-runbook-list">' +
+ '<div class="portal-support-runbook-step"><strong>1. Name the path</strong><span>Say whether the failed path was Workspaces, Access, or Billing.</span></div>' +
+ '<div class="portal-support-runbook-step"><strong>2. Name the account</strong><span>Include the hosted account and workspace when relevant, or the billing email for self-hosted work.</span></div>' +
+ '<div class="portal-support-runbook-step"><strong>3. Name the action</strong><span>Include the exact button, form, or billing tool that failed and what happened next.</span></div>' +
'</div>' +
'</div>' +
'</div>' +
@@ -960,7 +1008,7 @@ export function renderAccountsHTML(context: ShellViewContext): string {
);
}
return safeAccounts.map(function(account) {
- return renderAccountOverviewSection(account);
+ return renderAccountOverviewSection(account, context.accountAPIBasePath);
}).join('');
}
@@ -968,17 +1016,19 @@ export function renderAuthenticatedPortalHTML(context: ShellViewContext): string
var accounts = Array.isArray(context.bootstrap.accounts) ? context.bootstrap.accounts : [];
var hosted = hasHostedAccounts(accounts);
var activeSection = context.activeSection || 'overview';
- var serviceHeading = hosted ? 'Self-hosted commercial services' : 'Account services';
- var serviceNote = hosted
- ? 'Hosted workspace changes stay in Workspaces and Team. Use this area only for self-hosted commercial requests.'
- : 'Use these account tools for self-hosted licenses, billing, refunds, and privacy actions.';
+ var hostedBillingCount = accounts.filter(function(account) {
+ return account.has_billing;
+ }).length;
+ var billingNote = hosted
+ ? 'Hosted billing lives here when it applies. Self-hosted licenses, refunds, and privacy stay separate underneath it.'
+ : 'Use this billing surface for self-hosted subscriptions, licenses, refunds, and privacy requests.';
var hostedContent = accounts.map(function(account) {
return (
'<section class="account-surface">' +
'<div class="account-surface-body">' +
- renderAccountOverviewSection(account) +
+ renderAccountOverviewSection(account, context.accountAPIBasePath) +
renderAccountWorkspaceSection(account, context.accountAPIBasePath) +
- renderAccountTeamSection(account) +
+ renderAccountAccessSection(account) +
'</div>' +
'</section>'
);
@@ -993,38 +1043,39 @@ export function renderAuthenticatedPortalHTML(context: ShellViewContext): string
'<section class="portal-content-panel portal-content-panel-overview">' +
'<div id="accounts-root">' + hostedContent + '</div>' +
'</section>' +
- '<section class="portal-content-panel portal-content-panel-services service-section" id="account-services-section">' +
- '<div class="service-header">' +
+ '<section class="portal-content-panel portal-content-panel-billing service-section" id="billing-section">' +
+ '<div class="service-header billing-header">' +
'<div>' +
- '<div class="account-panel-kicker">Account services</div>' +
- '<h2>' + serviceHeading + '</h2>' +
+ '<div class="account-panel-kicker">Billing</div>' +
+ '<h2>Billing</h2>' +
renderSectionContextChips([
- hosted ? 'Self-hosted only' : 'Commercial',
- '4 tools',
+ hostedBillingCount > 0 ? 'Hosted billing' : 'No hosted billing',
+ 'Self-hosted tools',
]) +
'</div>' +
- '<div class="service-note">' + serviceNote + '</div>' +
+ '<div class="service-note">' + billingNote + '</div>' +
'</div>' +
+ '<div class="billing-overview-grid">' + renderHostedBillingCards(accounts) + '</div>' +
'<div class="service-shell">' +
'<aside class="service-shell-sidebar">' +
'<div class="service-shell-sidebar-head">' +
- '<div class="account-panel-kicker">Service navigator</div>' +
+ '<div class="account-panel-kicker">Self-hosted billing</div>' +
'<h3>Self-hosted tools</h3>' +
- '<p>Pick one commercial request and keep it separate from workspace and team changes.</p>' +
+ '<p>Use these only when the job is a self-hosted purchase, license, refund, or privacy request.</p>' +
'</div>' +
'<div class="service-action-list">' +
- renderServiceActionRow('open-manage-service', 'Billing', 'Manage subscriptions', 'Billing', 'Open Stripe for self-hosted plan, invoice, and payment changes.', 'manage-service-panel', 'manage-inline-email', ['Plan changes', 'Invoices']) +
+ renderServiceActionRow('open-manage-service', 'Self-hosted billing', 'Manage subscriptions', 'Billing', 'Open Stripe for self-hosted plan, invoice, and payment changes.', 'manage-service-panel', 'manage-inline-email', ['Plan changes', 'Invoices']) +
renderServiceActionRow('open-retrieve-service', 'Licenses', 'Retrieve licenses', 'Licenses', 'Recover the latest active self-hosted license and invoice link.', 'retrieve-service-panel', 'retrieve-inline-email', ['Latest active license', 'Invoice lookup']) +
renderServiceActionRow('open-refund-service', 'Refunds', 'Refund requests', 'Refunds', 'Request a self-serve refund when the purchase is still eligible.', 'refund-service-panel', 'refund-inline-email', ['Eligibility check', 'Revocation']) +
renderServiceActionRow('open-data-service', 'Privacy', 'Data and privacy', 'Privacy', 'Request export or deletion for commercial account data.', 'data-service-panel', 'data-export-email', ['Export', 'Deletion']) +
'</div>' +
'<div class="service-inline-support">' +
- '<div class="account-panel-kicker">Commercial routing</div>' +
- '<h4>Keep this request separate</h4>' +
- '<p>Hosted workspace work stays in Workspaces and Team. Use Support only when a self-hosted billing, license, refund, or privacy request cannot complete cleanly.</p>' +
+ '<div class="account-panel-kicker">Escalation</div>' +
+ '<h4>Keep the billing request contained</h4>' +
+ '<p>Use Support only when a hosted billing or self-hosted billing request cannot complete cleanly from this section.</p>' +
'<div class="service-inline-support-points">' +
- '<div class="service-inline-support-point"><strong>Hosted stays hosted</strong><span>Tenant handoff, team access, and hosted billing do not belong in this commercial section.</span></div>' +
- '<div class="service-inline-support-point"><strong>Escalate with context</strong><span>Bring the service name and exact failed action if a commercial request needs support.</span></div>' +
+ '<div class="service-inline-support-point"><strong>Hosted billing first when present</strong><span>Use the hosted billing cards above before you touch the self-hosted tools.</span></div>' +
+ '<div class="service-inline-support-point"><strong>Escalate with context</strong><span>Bring the billing tool or hosted billing action and the exact failed step if you need support.</span></div>' +
'</div>' +
'<div class="service-inline-support-actions">' +
'<button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="support">Open support</button>' +
@@ -1034,15 +1085,15 @@ export function renderAuthenticatedPortalHTML(context: ShellViewContext): string
'<div class="service-shell-main">' +
'<div class="service-detail-shell">' +
'<div class="service-panel service-panel-empty visible" id="service-panel-empty">' +
- '<div class="account-panel-kicker">Service brief</div>' +
- '<h3>Choose a service to begin</h3>' +
- '<p>Use one self-hosted request at a time. Each service verifies commercial identity first, then keeps billing, license, refund, or privacy work contained in one place.</p>' +
+ '<div class="account-panel-kicker">Billing brief</div>' +
+ '<h3>Choose the billing task</h3>' +
+ '<p>Pick one self-hosted billing request at a time. Verification happens first so billing, license, refund, or privacy work stays contained.</p>' +
'<div class="service-empty-shell">' +
'<div class="service-empty-primary">' +
'<div class="service-empty-section service-empty-section-compact">' +
'<div class="service-empty-column-title">What each tool does</div>' +
'<div class="service-empty-flow-list">' +
- '<div class="service-empty-flow"><strong>Billing</strong><span>Stripe customer portal access for invoices, payment methods, and plan changes.</span></div>' +
+ '<div class="service-empty-flow"><strong>Billing</strong><span>Stripe customer portal access for self-hosted invoices, payment methods, and plan changes.</span></div>' +
'<div class="service-empty-flow"><strong>Licenses</strong><span>Recover the latest active self-hosted license and the matching invoice link.</span></div>' +
'<div class="service-empty-flow"><strong>Refunds</strong><span>Check eligibility before revoking active commercial access.</span></div>' +
'<div class="service-empty-flow"><strong>Privacy</strong><span>Request export or deletion without leaving Pulse Account.</span></div>' +
@@ -1051,9 +1102,9 @@ export function renderAuthenticatedPortalHTML(context: ShellViewContext): string
'<div class="service-empty-section service-empty-section-compact">' +
'<div class="service-empty-column-title">Before you start</div>' +
'<div class="service-empty-points service-empty-points-stack">' +
- '<div class="service-empty-point"><strong>One request</strong><span>Keep a single commercial task active instead of bouncing across sections.</span></div>' +
+ '<div class="service-empty-point"><strong>One request</strong><span>Keep a single billing request active instead of bouncing across sections.</span></div>' +
'<div class="service-empty-point"><strong>Identity first</strong><span>Verification happens before any sensitive account action opens.</span></div>' +
- '<div class="service-empty-point"><strong>Stay focused</strong><span>Keep one commercial request in flight instead of bouncing between services.</span></div>' +
+ '<div class="service-empty-point"><strong>Stay focused</strong><span>Use the hosted billing cards above when the request is tied to a hosted workspace account.</span></div>' +
'</div>' +
'</div>' +
'</div>' +
@@ -1061,8 +1112,8 @@ export function renderAuthenticatedPortalHTML(context: ShellViewContext): string
'<div class="service-empty-section service-empty-section-support">' +
'<div class="service-empty-column-title">Escalation</div>' +
'<div class="service-empty-checklist">' +
- '<div class="service-empty-check"><strong>Escalate quickly</strong><span>If billing, licenses, refunds, or privacy do not behave as expected, escalate from this section.</span></div>' +
- '<div class="service-empty-check"><strong>Commercial packet</strong><span>Bring the service name, commercial email, and the exact failed action so support starts with the same request state.</span></div>' +
+ '<div class="service-empty-check"><strong>Escalate quickly</strong><span>If hosted billing or the self-hosted tools do not behave as expected, escalate from this section.</span></div>' +
+ '<div class="service-empty-check"><strong>Billing packet</strong><span>Bring the billing tool, commercial email, and the exact failed action so support starts with the same request state.</span></div>' +
'</div>' +
'<div class="service-empty-support">Need help with billing, refund, privacy, or license requests? <a class="portal-support-link" href="mailto:' +
escapeAttr(context.bootstrap.support_email || '') +
diff --git a/internal/cloudcp/portal/frontend/src/styles.css b/internal/cloudcp/portal/frontend/src/styles.css
index 923999fc7b..fae360d96f 100644
--- a/internal/cloudcp/portal/frontend/src/styles.css
+++ b/internal/cloudcp/portal/frontend/src/styles.css
@@ -596,25 +596,25 @@ header .logout-btn:hover,
}
.portal-shell[data-shell-section="overview"] .portal-content-panel-overview,
-.portal-shell[data-shell-section="services"] .portal-content-panel-services,
+.portal-shell[data-shell-section="billing"] .portal-content-panel-billing,
.portal-shell[data-shell-section="support"] .portal-content-panel-support,
.portal-shell[data-shell-section="workspaces"] .portal-content-panel-overview,
-.portal-shell[data-shell-section="team"] .portal-content-panel-overview {
+.portal-shell[data-shell-section="access"] .portal-content-panel-overview {
display: block !important;
}
.portal-shell[data-shell-section="overview"] .account-content-panel-overview,
.portal-shell[data-shell-section="workspaces"] .account-content-panel-workspaces,
-.portal-shell[data-shell-section="team"] .account-content-panel-team {
+.portal-shell[data-shell-section="access"] .account-content-panel-access {
display: block !important;
}
.portal-shell[data-shell-section="overview"] .account-content-panel-workspaces,
-.portal-shell[data-shell-section="overview"] .account-content-panel-team,
+.portal-shell[data-shell-section="overview"] .account-content-panel-access,
.portal-shell[data-shell-section="workspaces"] .account-content-panel-overview,
-.portal-shell[data-shell-section="workspaces"] .account-content-panel-team,
-.portal-shell[data-shell-section="team"] .account-content-panel-overview,
-.portal-shell[data-shell-section="team"] .account-content-panel-workspaces {
+.portal-shell[data-shell-section="workspaces"] .account-content-panel-access,
+.portal-shell[data-shell-section="access"] .account-content-panel-overview,
+.portal-shell[data-shell-section="access"] .account-content-panel-workspaces {
display: none !important;
}
@@ -737,7 +737,7 @@ header .logout-btn:hover,
.account-content-panel-overview,
.account-content-panel-workspaces,
-.account-content-panel-team {
+.account-content-panel-access {
padding: 0;
border: none;
border-radius: 0;
@@ -822,6 +822,154 @@ header .logout-btn:hover,
background: transparent;
}
+.overview-task-grid,
+.billing-overview-grid {
+ display: grid;
+ gap: 14px;
+}
+
+.overview-task-grid {
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+}
+
+.billing-overview-grid {
+ grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
+ margin-bottom: 14px;
+}
+
+.overview-task-card,
+.billing-task-card {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ min-width: 0;
+ padding: 16px;
+ border: 1px solid var(--line);
+ border-radius: var(--radius-lg);
+ background: var(--panel);
+ box-shadow: var(--shadow-sm);
+}
+
+.overview-task-card h4,
+.billing-task-card h3 {
+ margin: 0;
+ font-family: var(--font-display);
+ font-size: 18px;
+ line-height: 1.08;
+ letter-spacing: -0.022em;
+ font-weight: 710;
+ color: var(--ink);
+}
+
+.overview-task-card p,
+.billing-task-card p,
+.billing-task-note {
+ margin: 0;
+ font-size: 13px;
+ line-height: 1.55;
+ color: var(--ink-soft);
+}
+
+.overview-task-card-attention {
+ background: linear-gradient(180deg, #fff7ed, #ffffff 62%);
+}
+
+.overview-task-card-next {
+ background: linear-gradient(180deg, #ecfeff, #ffffff 62%);
+}
+
+.billing-task-card-muted {
+ background: var(--panel-strong);
+}
+
+.overview-task-list,
+.billing-task-points {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+}
+
+.overview-task-item,
+.billing-task-point {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ padding-top: 10px;
+ border-top: 1px solid var(--line);
+}
+
+.overview-task-item:first-child,
+.billing-task-point:first-child {
+ padding-top: 0;
+ border-top: none;
+}
+
+.overview-task-item strong,
+.billing-task-point strong {
+ font-size: 13px;
+ color: var(--ink);
+}
+
+.overview-task-item span,
+.billing-task-point span {
+ font-size: 12px;
+ line-height: 1.5;
+ color: var(--ink-soft);
+}
+
+.overview-task-item-action {
+ flex-direction: row;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+}
+
+.overview-task-copy {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ min-width: 0;
+}
+
+.overview-task-actions,
+.overview-task-summary-bar,
+.billing-task-actions {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ flex-wrap: wrap;
+}
+
+.overview-task-actions,
+.billing-task-actions {
+ margin-top: auto;
+}
+
+.overview-task-summary-bar {
+ margin-top: 14px;
+}
+
+.overview-task-summary-pill {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ min-height: 34px;
+ padding: 0 12px;
+ border: 1px solid var(--line);
+ border-radius: 999px;
+ background: rgba(255, 255, 255, 0.8);
+ font-size: 12px;
+ color: var(--ink-soft);
+}
+
+.overview-task-summary-pill strong {
+ font-size: 10px;
+ font-weight: 800;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--ink-muted);
+}
+
.account-overview-main-column,
.account-overview-side-column {
display: flex;
@@ -2918,6 +3066,8 @@ header .logout-btn:hover,
.team-management-grid,
.team-review-grid,
.account-overview-secondary,
+ .overview-task-grid,
+ .billing-overview-grid,
.service-shell,
.service-action-list,
.service-empty-shell,
@@ -3088,6 +3238,7 @@ header .logout-btn:hover,
.service-empty-shell,
.service-empty-intro,
.workspace-operations-shell,
+ .overview-task-grid,
.account-overview-card,
.account-overview-secondary,
.overview-quick-actions,
diff --git a/internal/cloudcp/portal/frontend/src/types.ts b/internal/cloudcp/portal/frontend/src/types.ts
index 20118ff9d9..d887b068a3 100644
--- a/internal/cloudcp/portal/frontend/src/types.ts
+++ b/internal/cloudcp/portal/frontend/src/types.ts
@@ -74,7 +74,7 @@ export interface PortalAccountState {
byAccountID: Record<string, PortalAccountUIEntry>;
}
-export type PortalShellSection = 'overview' | 'workspaces' | 'team' | 'services' | 'support';
+export type PortalShellSection = 'overview' | 'workspaces' | 'access' | 'billing' | 'support';
export interface PortalShellState {
activeSection: PortalShellSection;
diff --git a/internal/cloudcp/portal/handlers_test.go b/internal/cloudcp/portal/handlers_test.go
index d857cdbd9a..1dd646d272 100644
--- a/internal/cloudcp/portal/handlers_test.go
+++ b/internal/cloudcp/portal/handlers_test.go
@@ -651,7 +651,7 @@ func TestBillingPortalRedirect_EmptyURL(t *testing.T) {
// --- Portal page template rendering tests ---
-func TestPortalPageTemplate_TeamManagementRendered(t *testing.T) {
+func TestPortalPageTemplate_AccessManagementRendered(t *testing.T) {
html := renderPortalHTML(t, BuildBootstrapData(true, "[email protected]", []portalPageAccount{
{
ID: "a_managed",
@@ -669,7 +669,7 @@ func TestPortalPageTemplate_TeamManagementRendered(t *testing.T) {
`if (account.can_manage) {`,
`data-actor-role="`,
`id="team-list-`,
- `data-action="toggle-team"`,
+ `data-shell-section="access"`,
`data-action="invite-member"`,
}
for _, needle := range mustContain {