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.

Canonicalize upgrade action links

rcourtman3f632669646c
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index fa6b98f13e..613608017a 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -492,6 +492,12 @@ Agent profile read-only state indicators follow the same presentation split:
but badge tone, optional dot wiring, sizing, and shell classes must compose the
frontend-primitives-owned `StatusIndicatorBadge` instead of calling status tone
helpers or recreating badge spans inline.
+Agent profile commercial gates follow the same primitive split:
+`AgentProfilesPanel.tsx` and `useAgentProfilesPanelState.ts` may own lifecycle
+entitlement checks, upgrade destinations, and label selection, but the
+button-styled upgrade action must compose frontend-primitives'
+`UpgradeButtonLink` instead of exporting or applying a lifecycle-local CTA
+class helper.
## Extension Points
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 5746ea9e23..fcc7f76f40 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -582,6 +582,11 @@ or other self-hosted uncapped continuity plans.
show active historical `subscription_state=trial` entitlement state, but
they must not turn `trial_eligible`, `trial_eligibility_reason`, or an
expired trial marker into a default Pro CTA or banner.
+ Plan action links with commercial upgrade destinations must compose
+ frontend-primitives' `UpgradeButtonLink`; non-upgrade external commercial
+ URLs must compose `ButtonLink`. `ProLicensePlanSection.tsx` must not
+ recreate local anchor button shells for purchase returns, private-runtime
+ actions, or plan-comparison CTAs.
18. Add or change paid relay settings and pairing presentation through `frontend-modern/src/components/Settings/RelaySettingsPanel.tsx`, `frontend-modern/src/components/Settings/RelayPairingSection.tsx`, and `frontend-modern/src/components/Settings/useRelaySettingsPanelState.ts`. The retired Dashboard shell must not be restored to carry a Relay onboarding card or equivalent blanket upsell — relay discovery stays inside its owning settings surface.
Public demo and other read-only presentation policy states must suppress
relay setup and upsell onboarding instead of inviting pairing or commercial
@@ -1270,12 +1275,15 @@ That same cloud-paid boundary also owns the shared entitlement and upgrade
presentation helpers through `frontend-modern/src/utils/licensePresentation.ts`
and `frontend-modern/src/utils/upgradePresentation.ts`. Commercial tier labels,
feature minimum-tier messaging, migration/trial notices, billing-admin status
-labels, and upgrade CTA styling must extend those helpers instead of being
-forked into per-surface status-code branches that drift from backend error
-truth. The old self-hosted trial-start acquisition path is not a current v6
-commercial surface; denial and retry copy for ordinary self-hosted runtimes
-must be limited to owned purchase, recovery, portal, Cloud signup, or support
-handoff paths.
+labels, and generic upgrade CTA labels must extend those helpers instead of
+being forked into per-surface status-code branches that drift from backend
+error truth. Button-styled upgrade CTA chrome is owned by
+frontend-primitives' `UpgradeButtonLink`; commercial plan surfaces may choose
+the destination, label, and emphasis but must not recreate local Tailwind
+button anchors. The old self-hosted trial-start acquisition path is not a
+current v6 commercial surface; denial and retry copy for ordinary self-hosted
+runtimes must be limited to owned purchase, recovery, portal, Cloud signup, or
+support handoff paths.
That same helper boundary also owns generic settings-paywall CTA labels. Under
the v6 free-first self-hosted policy, non-billing feature gates must stay
factual and route deliberate commercial intent to Plans with neutral "View
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 298ed066a7..adebb5db92 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -1610,7 +1610,11 @@ not a replacement status card, CTA band, or page-local nested card.
`frontend-modern/src/components/shared/UpgradeLink.tsx`, and
`frontend-modern/src/components/shared/useUpgradeNavigation.ts` instead of
guessing from labels, hardcoding `target="_blank"`, or calling
- `window.open(...)` from each feature surface.
+ `window.open(...)` from each feature surface. Inline upgrade links may use
+ `UpgradeLink`; button-styled upgrade CTAs must use `UpgradeButtonLink` so
+ width, tone, focus, route/new-tab behavior, and opener preservation stay on
+ the shared `ButtonLink` primitive instead of page-local Tailwind anchors or
+ commercial helper class strings.
35. Keep same-shell platform/runtime route transitions on retained shared state.
Active infrastructure consumers may show full-page loading only before the
first compatible resource snapshot exists; once a fresh canonical snapshot
@@ -2450,6 +2454,12 @@ patterns, while `frontend-modern/scripts/shared-template-audit.mjs` enforces
that registry. Future repeated-affordance migrations must add or extend a
registry rule as part of the same change that extracts or adopts the shared
primitive.
+Button-styled commercial upgrade CTAs are one of those registry-backed
+templates. `frontend-modern/src/components/shared/UpgradeLink.tsx` owns
+`UpgradeButtonLink`, and the registry requires gated settings, audit, agent
+profiles, and self-hosted plan CTA surfaces to compose it rather than styling
+`UpgradeLink` or anchors locally. Commercial presentation helpers may own the
+label and destination intent; they must not own CTA button chrome.
Platform table frames are one of those registry-backed templates.
`frontend-modern/src/features/platformPage/sharedPlatformPage.tsx` owns
`PlatformTableShell`, including the canonical table card, header row, and body
diff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.json
index 6669c18676..0f519ec09d 100644
--- a/frontend-modern/scripts/shared-template-registry.json
+++ b/frontend-modern/scripts/shared-template-registry.json
@@ -347,6 +347,51 @@
"scripts/shared-template-audit.mjs"
]
},
+ {
+ "id": "upgrade-action-button-link",
+ "category": "upgrade-action",
+ "summary": "Button-styled upgrade CTAs must compose UpgradeButtonLink so destination routing, new-tab safety, opener preservation, tone, width, and shared button styling stay canonical.",
+ "canonical": {
+ "path": "src/components/shared/UpgradeLink.tsx",
+ "export": "UpgradeButtonLink"
+ },
+ "requiredConsumers": [
+ { "path": "src/components/Settings/AgentProfilesPanel.tsx" },
+ { "path": "src/components/Settings/AuditLogPanel.tsx" },
+ { "path": "src/components/Settings/ProLicensePlanSection.tsx" },
+ { "path": "src/components/shared/FeatureGateSection.tsx" }
+ ],
+ "forbiddenPatterns": [
+ {
+ "path": "src/utils/upgradePresentation.ts",
+ "patterns": ["getUpgradeActionButtonClass"]
+ },
+ {
+ "path": "src/components/Settings/AgentProfilesPanel.tsx",
+ "patterns": ["getUpgradeActionButtonClass"]
+ },
+ {
+ "path": "src/components/Settings/AuditLogPanel.tsx",
+ "patterns": ["getUpgradeActionButtonClass"]
+ },
+ {
+ "path": "src/components/shared/FeatureGateSection.tsx",
+ "patterns": ["getUpgradeActionButtonClass"]
+ },
+ {
+ "path": "src/components/Settings/ProLicensePlanSection.tsx",
+ "patterns": [
+ "inline-flex items-center gap-1 mt-3 min-h-10 sm:min-h-9 rounded-md border border-current/20 px-3 py-2 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5",
+ "inline-flex items-center gap-1 mt-4 min-h-10 sm:min-h-9 rounded-md border border-border px-3 py-2 text-xs font-medium text-base-content hover:bg-surface-hover"
+ ]
+ }
+ ],
+ "proof": [
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "src/components/shared/__tests__/UpgradeLink.test.tsx",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
{
"id": "copyable-code-row-shell",
"category": "copy-action",
@@ -1267,6 +1312,54 @@
"scripts/shared-template-audit.mjs"
]
},
+ {
+ "id": "upgrade-action-local-class-helper",
+ "category": "upgrade-action",
+ "summary": "Product surfaces must not use a class helper to make upgrade CTAs look like buttons; compose UpgradeButtonLink instead.",
+ "canonical": {
+ "path": "src/components/shared/UpgradeLink.tsx",
+ "export": "UpgradeButtonLink"
+ },
+ "scopes": ["src/components", "src/features", "src/pages"],
+ "extensions": [".tsx"],
+ "allPatterns": ["getUpgradeActionButtonClass"],
+ "legacyReason": "Retired migration debt. Upgrade action button shape, routing, and link safety belong to UpgradeButtonLink.",
+ "allowedPaths": [],
+ "ignoredPaths": ["src/components/shared/SharedPrimitives.guardrails.test.ts"],
+ "proof": [
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "src/components/shared/__tests__/UpgradeLink.test.tsx",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
+ {
+ "id": "upgrade-action-local-button-shell",
+ "category": "upgrade-action",
+ "summary": "Product surfaces must not style UpgradeLink as a local button; use UpgradeButtonLink for button-styled upgrade actions and reserve UpgradeLink for inline text links.",
+ "canonical": {
+ "path": "src/components/shared/UpgradeLink.tsx",
+ "export": "UpgradeButtonLink"
+ },
+ "scopes": ["src/components", "src/features", "src/pages"],
+ "extensions": [".tsx"],
+ "allPatterns": [
+ "<UpgradeLink",
+ "min-h-10 sm:min-h-9 rounded-md border",
+ "text-xs font-medium"
+ ],
+ "legacyReason": "Retired migration debt. Button-styled upgrade actions must use UpgradeButtonLink; inline copy links may continue using UpgradeLink.",
+ "allowedPaths": [],
+ "ignoredPaths": [
+ "src/components/Settings/AIRuntimeControlsSection.tsx",
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "src/components/shared/__tests__/UpgradeLink.test.tsx"
+ ],
+ "proof": [
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "src/components/shared/__tests__/UpgradeLink.test.tsx",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
{
"id": "copy-value-neutral-local-button-shell",
"category": "copy-action",
diff --git a/frontend-modern/src/components/Settings/AgentProfilesPanel.tsx b/frontend-modern/src/components/Settings/AgentProfilesPanel.tsx
index d786c113a3..1403090489 100644
--- a/frontend-modern/src/components/Settings/AgentProfilesPanel.tsx
+++ b/frontend-modern/src/components/Settings/AgentProfilesPanel.tsx
@@ -6,7 +6,7 @@ import { Dialog } from '@/components/shared/Dialog';
import { FormSelect } from '@/components/shared/FormSelect';
import { FormTextarea } from '@/components/shared/FormTextarea';
import { StatusIndicatorBadge } from '@/components/shared/StatusIndicatorBadge';
-import { UpgradeLink } from '@/components/shared/UpgradeLink';
+import { UpgradeButtonLink } from '@/components/shared/UpgradeLink';
import { SuggestProfileModal } from './SuggestProfileModal';
import { KNOWN_SETTINGS, type SelectSetting, type StringSetting } from './agentProfileSettings';
import {
@@ -41,7 +41,6 @@ export const AgentProfilesPanel: Component = () => {
getProfileOptionLabel,
getSettingsCount,
getUpgradeActionDestination,
- getUpgradeActionButtonClass,
handleAssign,
handleCreate,
handleDelete,
@@ -96,13 +95,14 @@ export const AgentProfilesPanel: Component = () => {
</div>
<p class="text-sm text-muted">{featureGateCopy.body}</p>
<div class="flex flex-wrap items-center gap-3">
- <UpgradeLink
+ <UpgradeButtonLink
destination={getUpgradeActionDestination('agent_profiles')}
- class={getUpgradeActionButtonClass({ tone: 'warning', mobileFullWidth: false })}
+ tone="warning"
+ mobileFullWidth={false}
>
<Crown class="w-4 h-4" />
{UPGRADE_ACTION_LABEL}
- </UpgradeLink>
+ </UpgradeButtonLink>
</div>
</Card>
</Show>
diff --git a/frontend-modern/src/components/Settings/AuditLogPanel.tsx b/frontend-modern/src/components/Settings/AuditLogPanel.tsx
index bd9382e623..ca59e5410e 100644
--- a/frontend-modern/src/components/Settings/AuditLogPanel.tsx
+++ b/frontend-modern/src/components/Settings/AuditLogPanel.tsx
@@ -5,7 +5,7 @@ import Info from 'lucide-solid/icons/info';
import Play from 'lucide-solid/icons/play';
import ShieldAlert from 'lucide-solid/icons/shield-alert';
import { showTooltip, hideTooltip } from '@/components/shared/Tooltip';
-import { UpgradeLink } from '@/components/shared/UpgradeLink';
+import { UpgradeButtonLink } from '@/components/shared/UpgradeLink';
import { FilterBar, type FilterDef, type FilterSelectOption } from '@/components/shared/FilterBar';
import { FormSelect } from '@/components/shared/FormSelect';
import Toggle from '@/components/shared/Toggle';
@@ -30,7 +30,6 @@ import {
getAuditLogLoadingState,
getAuditVerificationBadgePresentation,
} from '@/utils/auditLogPresentation';
-import { getUpgradeActionButtonClass } from '@/utils/upgradePresentation';
import { useAuditLogPanelState } from '@/components/Settings/useAuditLogPanelState';
export default function AuditLogPanel() {
@@ -215,15 +214,13 @@ export default function AuditLogPanel() {
</div>
<Show when={showFeatureGateAction()}>
<div class="flex flex-col items-center gap-2">
- <UpgradeLink
+ <UpgradeButtonLink
destination={upgradeDestination()}
- class={getUpgradeActionButtonClass({
- mobileFullWidth: false,
- tone: paidRuntimeRequired() ? 'warning' : 'primary',
- })}
+ mobileFullWidth={false}
+ tone={paidRuntimeRequired() ? 'warning' : 'primary'}
>
{upgradeActionLabel()}
- </UpgradeLink>
+ </UpgradeButtonLink>
</div>
</Show>
</div>
diff --git a/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx b/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx
index f084c53822..561d1921f0 100644
--- a/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx
+++ b/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx
@@ -1,6 +1,7 @@
import { Component, For, Show } from 'solid-js';
import RefreshCw from 'lucide-solid/icons/refresh-cw';
-import { UpgradeLink } from '@/components/shared/UpgradeLink';
+import { ButtonLink } from '@/components/shared/Button';
+import { UpgradeButtonLink } from '@/components/shared/UpgradeLink';
import { licenseEntitlementsLoadError } from '@/stores/licenseEntitlements';
import {
getLicenseStatusLoadingState,
@@ -119,15 +120,24 @@ export const ProLicensePlanSection: Component<ProLicensePlanSectionProps> = (pro
>
<p class="font-medium">{summary().title}</p>
<p class="mt-1 text-xs opacity-90">{summary().body}</p>
- <Show when={summary().actionUrl && summary().actionLabel}>
- <a
- href={summary().actionUrl}
- target="_blank"
- rel="noopener noreferrer"
- class="inline-flex items-center gap-1 mt-3 min-h-10 sm:min-h-9 rounded-md border border-current/20 px-3 py-2 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5"
- >
- {summary().actionLabel}
- </a>
+ <Show
+ when={(() => {
+ const actionUrl = summary().actionUrl;
+ const actionLabel = summary().actionLabel;
+ return actionUrl && actionLabel ? { href: actionUrl, label: actionLabel } : null;
+ })()}
+ >
+ {(action) => (
+ <ButtonLink
+ href={action().href}
+ target="_blank"
+ variant="outline"
+ size="settingsActionXs"
+ class="mt-3 gap-1"
+ >
+ {action().label}
+ </ButtonLink>
+ )}
</Show>
<Show when={summary().highlights.length > 0}>
<div class="mt-3">
@@ -156,12 +166,14 @@ export const ProLicensePlanSection: Component<ProLicensePlanSectionProps> = (pro
<p class="mt-1 text-xs opacity-90">{notice().body}</p>
<Show when={props.purchaseActivationAction}>
{(action) => (
- <UpgradeLink
- class="inline-flex items-center gap-1 mt-3 min-h-10 sm:min-h-9 rounded-md border border-current/20 px-3 py-2 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5"
+ <UpgradeButtonLink
+ variant="outline"
+ size="settingsActionXs"
+ class="mt-3 gap-1"
destination={action().destination}
>
{action().label}
- </UpgradeLink>
+ </UpgradeButtonLink>
)}
</Show>
</div>
@@ -172,12 +184,14 @@ export const ProLicensePlanSection: Component<ProLicensePlanSectionProps> = (pro
<div class={`mb-4 rounded-md border p-3 text-sm ${prompt().tone}`}>
<p class="font-medium">{prompt().title}</p>
<p class="mt-1 text-xs opacity-90">{prompt().body}</p>
- <UpgradeLink
- class="inline-flex items-center gap-1 mt-3 min-h-10 sm:min-h-9 rounded-md border border-current/20 px-3 py-2 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5"
+ <UpgradeButtonLink
+ variant="outline"
+ size="settingsActionXs"
+ class="mt-3 gap-1"
destination={prompt().actionDestination}
>
{prompt().actionLabel}
- </UpgradeLink>
+ </UpgradeButtonLink>
</div>
)}
</Show>
@@ -208,14 +222,15 @@ export const ProLicensePlanSection: Component<ProLicensePlanSectionProps> = (pro
</Show>
<Show when={props.currentPlanSummary.privateRuntimeAction}>
{(action) => (
- <a
+ <ButtonLink
href={action().actionUrl}
target="_blank"
- rel="noopener noreferrer"
- class="inline-flex items-center gap-1 mt-3 min-h-10 sm:min-h-9 rounded-md border border-border px-3 py-2 text-xs font-medium text-base-content hover:bg-surface-hover"
+ variant="outline"
+ size="settingsActionXs"
+ class="mt-3 gap-1"
>
{action().actionLabel}
- </a>
+ </ButtonLink>
)}
</Show>
<Show when={props.currentPlanSummary.unlockedFeatures.length > 0}>
@@ -307,12 +322,14 @@ export const ProLicensePlanSection: Component<ProLicensePlanSectionProps> = (pro
</div>
<Show when={props.planComparisonSummary.action}>
{(action) => (
- <UpgradeLink
- class="inline-flex items-center gap-1 mt-4 min-h-10 sm:min-h-9 rounded-md border border-border px-3 py-2 text-xs font-medium text-base-content hover:bg-surface-hover"
+ <UpgradeButtonLink
+ variant="outline"
+ size="settingsActionXs"
+ class="mt-4 gap-1"
destination={action().destination}
>
{action().label}
- </UpgradeLink>
+ </UpgradeButtonLink>
)}
</Show>
</div>
diff --git a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
index 319838968a..5c9593fbd2 100644
--- a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
@@ -1167,6 +1167,11 @@ describe('ProLicensePanel', () => {
expect(proLicensePlanSectionSource).toContain('currentPlanSummary.privateRuntimeAction');
expect(proLicensePlanSectionSource).toContain('props.activationSuccessSummary');
expect(proLicensePlanSectionSource).toContain('summary().actionUrl');
+ expect(proLicensePlanSectionSource).toContain('ButtonLink');
+ expect(proLicensePlanSectionSource).toContain('UpgradeButtonLink');
+ expect(proLicensePlanSectionSource).not.toContain(
+ 'inline-flex items-center gap-1 mt-3 min-h-10 sm:min-h-9 rounded-md border border-current/20 px-3 py-2 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5',
+ );
expect(proLicensePlanSectionSource).toContain('props.planComparisonSummary.cards.length > 0');
expect(proLicensePlanSectionSource).toContain(
'SELF_HOSTED_PRO_BILLING_PRESENTATION.planComparisonSectionTitle',
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index ad3dd88cd4..1de8e9acde 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -480,6 +480,10 @@ describe('settings architecture guardrails', () => {
}
expect(agentProfilesPanelSource).not.toContain('Pro feature');
+ expect(agentProfilesPanelSource).toContain('UpgradeButtonLink');
+ expect(agentProfilesPanelSource).not.toContain('getUpgradeActionButtonClass');
+ expect(auditLogPanelSource).toContain('UpgradeButtonLink');
+ expect(auditLogPanelSource).not.toContain('getUpgradeActionButtonClass');
expect(auditWebhookPanelSource).not.toContain('Audit Webhooks (Pro)');
expect(reportingPanelSource).not.toContain('Advanced Reporting (Pro)');
expect(rbacFeatureGateSectionSource).not.toContain('Custom Roles (Pro)');
diff --git a/frontend-modern/src/components/Settings/useAgentProfilesPanelState.ts b/frontend-modern/src/components/Settings/useAgentProfilesPanelState.ts
index 742452e776..8fd88374f4 100644
--- a/frontend-modern/src/components/Settings/useAgentProfilesPanelState.ts
+++ b/frontend-modern/src/components/Settings/useAgentProfilesPanelState.ts
@@ -22,10 +22,7 @@ import type { ConnectedInfrastructureItem } from '@/types/api';
import type { Resource } from '@/types/resource';
import { formatRelativeTime } from '@/utils/format';
import { logger } from '@/utils/logger';
-import {
- getUpgradeActionButtonClass,
- UPGRADE_ACTION_LABEL,
-} from '@/utils/upgradePresentation';
+import { UPGRADE_ACTION_LABEL } from '@/utils/upgradePresentation';
import { KNOWN_SETTINGS } from './agentProfileSettings';
import {
getActionableAgentIdFromResource,
@@ -342,7 +339,6 @@ export const useAgentProfilesPanelState = () => {
getProfileOptionLabel,
getSettingsCount,
getUpgradeActionDestination,
- getUpgradeActionButtonClass,
handleAssign,
handleCreate,
handleDelete,
diff --git a/frontend-modern/src/components/shared/Button.test.tsx b/frontend-modern/src/components/shared/Button.test.tsx
index c8f0dec30c..78c997804e 100644
--- a/frontend-modern/src/components/shared/Button.test.tsx
+++ b/frontend-modern/src/components/shared/Button.test.tsx
@@ -243,4 +243,29 @@ describe('Button', () => {
expect(link).toHaveAttribute('target', '_blank');
expect(link).toHaveAttribute('rel', 'noopener noreferrer');
});
+
+ it('can preserve opener access for trusted new-tab button links', () => {
+ render(() => (
+ <Router>
+ <Route
+ path="/"
+ component={() => (
+ <ButtonLink
+ href="/auth/license-purchase-start?feature=relay"
+ target="_blank"
+ preserveOpener
+ size="sm"
+ >
+ Purchase
+ </ButtonLink>
+ )}
+ />
+ </Router>
+ ));
+
+ const link = screen.getByRole('link', { name: 'Purchase' });
+ expect(link).toHaveAttribute('href', '/auth/license-purchase-start?feature=relay');
+ expect(link).toHaveAttribute('target', '_blank');
+ expect(link).not.toHaveAttribute('rel');
+ });
});
diff --git a/frontend-modern/src/components/shared/Button.tsx b/frontend-modern/src/components/shared/Button.tsx
index 0b46ed0286..86ae9720b0 100644
--- a/frontend-modern/src/components/shared/Button.tsx
+++ b/frontend-modern/src/components/shared/Button.tsx
@@ -24,6 +24,7 @@ export interface ButtonLinkProps extends JSX.AnchorHTMLAttributes<HTMLAnchorElem
size?: ButtonSize;
class?: string;
hardNavigation?: boolean;
+ preserveOpener?: boolean;
}
export interface CommandCopyButtonProps extends Omit<
@@ -183,6 +184,7 @@ export function ButtonLink(props: ButtonLinkProps) {
'children',
'href',
'hardNavigation',
+ 'preserveOpener',
'rel',
'target',
]);
@@ -198,7 +200,9 @@ export function ButtonLink(props: ButtonLinkProps) {
local.target === '_blank' ||
/^(https?:|mailto:|tel:)/.test(local.href),
);
- const rel = () => local.rel ?? (local.target === '_blank' ? 'noopener noreferrer' : undefined);
+ const rel = () =>
+ local.rel ??
+ (local.target === '_blank' && !local.preserveOpener ? 'noopener noreferrer' : undefined);
return (
<Show
diff --git a/frontend-modern/src/components/shared/FeatureGateSection.tsx b/frontend-modern/src/components/shared/FeatureGateSection.tsx
index 7fe37d801d..24ca449100 100644
--- a/frontend-modern/src/components/shared/FeatureGateSection.tsx
+++ b/frontend-modern/src/components/shared/FeatureGateSection.tsx
@@ -1,10 +1,9 @@
import { Show, type Component, type JSX } from 'solid-js';
-import { UpgradeLink } from '@/components/shared/UpgradeLink';
import {
- getUpgradeActionButtonClass,
- UPGRADE_ACTION_LABEL,
- type UpgradeActionButtonTone,
-} from '@/utils/upgradePresentation';
+ UpgradeButtonLink,
+ type UpgradeButtonTone,
+} from '@/components/shared/UpgradeLink';
+import { UPGRADE_ACTION_LABEL } from '@/utils/upgradePresentation';
import type { UpgradeDestination } from '@/utils/upgradeNavigation';
export interface FeatureGateSectionProps {
@@ -25,7 +24,7 @@ export interface FeatureGateSectionProps {
/** Upgrade button label. Defaults to the canonical "View plans". */
upgradeLabel?: string;
/** Upgrade button tone. Defaults to the primary blue treatment. */
- upgradeButtonTone?: UpgradeActionButtonTone;
+ upgradeButtonTone?: UpgradeButtonTone;
}
/**
@@ -49,12 +48,12 @@ export const FeatureGateSection: Component<FeatureGateSectionProps> = (props) =>
</div>
<Show when={props.showUpgradePrompts}>
<div class="flex flex-col sm:flex-row items-center gap-2">
- <UpgradeLink
+ <UpgradeButtonLink
destination={props.upgradeDestination}
- class={getUpgradeActionButtonClass({ tone: props.upgradeButtonTone })}
+ tone={props.upgradeButtonTone}
>
{props.upgradeLabel ?? UPGRADE_ACTION_LABEL}
- </UpgradeLink>
+ </UpgradeButtonLink>
</div>
</Show>
</div>
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 9c0ccbd9b5..406a1622ef 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -181,6 +181,7 @@ import resourceDetailDrawerTrueNASModelSource from '@/components/Infrastructure/
import aiSettingsDialogsSource from '@/components/Settings/AISettingsDialogs.tsx?raw';
import agentProfilesPanelSource from '@/components/Settings/AgentProfilesPanel.tsx?raw';
import apiTokenManagerSource from '@/components/Settings/APITokenManager.tsx?raw';
+import auditLogPanelSource from '@/components/Settings/AuditLogPanel.tsx?raw';
import billingAdminPanelSource from '@/components/Settings/BillingAdminPanel.tsx?raw';
import diagnosticsResultsPanelSource from '@/components/Settings/DiagnosticsResultsPanel.tsx?raw';
import dockerRuntimeSettingsCardSource from '@/components/Settings/DockerRuntimeSettingsCard.tsx?raw';
@@ -192,6 +193,7 @@ import organizationAccessMembersSectionSource from '@/components/Settings/Organi
import organizationIncomingSharesSectionSource from '@/components/Settings/OrganizationIncomingSharesSection.tsx?raw';
import organizationOutgoingSharesSectionSource from '@/components/Settings/OrganizationOutgoingSharesSection.tsx?raw';
import organizationOverviewMembersSectionSource from '@/components/Settings/OrganizationOverviewMembersSection.tsx?raw';
+import proLicensePlanSectionSource from '@/components/Settings/ProLicensePlanSection.tsx?raw';
import reportingPanelSource from '@/components/Settings/ReportingPanel.tsx?raw';
import rolesPanelSource from '@/components/Settings/RolesPanel.tsx?raw';
import updatesSettingsPanelSource from '@/components/Settings/UpdatesSettingsPanel.tsx?raw';
@@ -203,6 +205,7 @@ import patrolIntelligenceHeaderSource from '@/features/patrol/PatrolIntelligence
import patrolIntelligenceWorkspaceSource from '@/features/patrol/PatrolIntelligenceWorkspace.tsx?raw';
import filterBarSource from '@/components/shared/FilterBar/FilterBar.tsx?raw';
import filterChipSource from '@/components/shared/FilterBar/FilterChip.tsx?raw';
+import featureGateSectionSource from '@/components/shared/FeatureGateSection.tsx?raw';
import addFilterMenuSource from '@/components/shared/FilterBar/AddFilterMenu.tsx?raw';
import filterCatalogSource from '@/components/shared/FilterBar/filterCatalog.ts?raw';
import filterBarOptionPresentationSource from '@/components/shared/FilterBar/filterOptionPresentation.tsx?raw';
@@ -1191,8 +1194,11 @@ describe('shared primitive guardrails', () => {
it('keeps upgrade navigation split across shell, runtime, and utility owners', () => {
expect(upgradeLinkSource).toContain('destination.external');
- expect(upgradeLinkSource).toContain("return local.target ?? '_blank';");
+ expect(upgradeLinkSource).toContain("return target ?? '_blank';");
expect(upgradeLinkSource).toContain('target={target()}');
+ expect(upgradeLinkSource).toContain('export const UpgradeButtonLink');
+ expect(upgradeLinkSource).toContain('ButtonLink');
+ expect(upgradeLinkSource).toContain('preserveOpener={local.destination.preserveOpener}');
expect(upgradeLinkSource).not.toContain('window.open');
expect(upgradeLinkSource).not.toContain('useNavigate(');
@@ -1208,6 +1214,94 @@ describe('shared primitive guardrails', () => {
expect(upgradeNavigationSource).toContain("window.open(href, '_blank', 'noopener,noreferrer')");
});
+ it('keeps upgrade CTAs on the shared upgrade button primitive', () => {
+ const registry = JSON.parse(sharedTemplateRegistrySource) as {
+ rules?: Array<{
+ id: string;
+ canonical?: { path?: string; export?: string };
+ requiredConsumers?: Array<{ path?: string }>;
+ forbiddenPatterns?: Array<{ path?: string; patterns?: string[] }>;
+ }>;
+ patternGuards?: Array<{
+ id: string;
+ canonical?: { path?: string; export?: string };
+ allPatterns?: string[];
+ scopes?: string[];
+ allowedPaths?: string[];
+ ignoredPaths?: string[];
+ }>;
+ };
+ const registeredRule = registry.rules?.find((rule) => rule.id === 'upgrade-action-button-link');
+ const helperGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'upgrade-action-local-class-helper',
+ );
+ const literalShellGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'upgrade-action-local-button-shell',
+ );
+
+ expect(registeredRule?.canonical?.path).toBe('src/components/shared/UpgradeLink.tsx');
+ expect(registeredRule?.canonical?.export).toBe('UpgradeButtonLink');
+ expect(registeredRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual([
+ 'src/components/Settings/AgentProfilesPanel.tsx',
+ 'src/components/Settings/AuditLogPanel.tsx',
+ 'src/components/Settings/ProLicensePlanSection.tsx',
+ 'src/components/shared/FeatureGateSection.tsx',
+ ]);
+ expect(registeredRule?.forbiddenPatterns).toEqual(
+ expect.arrayContaining([
+ expect.objectContaining({
+ path: 'src/utils/upgradePresentation.ts',
+ patterns: expect.arrayContaining(['getUpgradeActionButtonClass']),
+ }),
+ expect.objectContaining({
+ path: 'src/components/Settings/ProLicensePlanSection.tsx',
+ patterns: expect.arrayContaining([
+ 'inline-flex items-center gap-1 mt-3 min-h-10 sm:min-h-9 rounded-md border border-current/20 px-3 py-2 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5',
+ ]),
+ }),
+ ]),
+ );
+ expect(helperGuard?.canonical?.path).toBe('src/components/shared/UpgradeLink.tsx');
+ expect(helperGuard?.canonical?.export).toBe('UpgradeButtonLink');
+ expect(helperGuard?.allPatterns).toEqual(['getUpgradeActionButtonClass']);
+ expect(helperGuard?.scopes).toEqual(['src/components', 'src/features', 'src/pages']);
+ expect(helperGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(helperGuard?.ignoredPaths).toEqual([
+ 'src/components/shared/SharedPrimitives.guardrails.test.ts',
+ ]);
+ expect(literalShellGuard?.canonical?.path).toBe('src/components/shared/UpgradeLink.tsx');
+ expect(literalShellGuard?.canonical?.export).toBe('UpgradeButtonLink');
+ expect(literalShellGuard?.allPatterns).toEqual([
+ '<UpgradeLink',
+ 'min-h-10 sm:min-h-9 rounded-md border',
+ 'text-xs font-medium',
+ ]);
+ expect(literalShellGuard?.scopes).toEqual(['src/components', 'src/features', 'src/pages']);
+ expect(literalShellGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(literalShellGuard?.ignoredPaths).toEqual([
+ 'src/components/Settings/AIRuntimeControlsSection.tsx',
+ 'src/components/shared/SharedPrimitives.guardrails.test.ts',
+ 'src/components/shared/__tests__/UpgradeLink.test.tsx',
+ ]);
+
+ for (const source of [
+ agentProfilesPanelSource,
+ auditLogPanelSource,
+ proLicensePlanSectionSource,
+ featureGateSectionSource,
+ ]) {
+ expect(source).toContain('UpgradeButtonLink');
+ expect(source).not.toContain('getUpgradeActionButtonClass');
+ }
+ expect(proLicensePlanSectionSource).toContain('ButtonLink');
+ expect(proLicensePlanSectionSource).not.toContain(
+ 'inline-flex items-center gap-1 mt-3 min-h-10 sm:min-h-9 rounded-md border border-current/20 px-3 py-2 text-xs font-medium hover:bg-black/5 dark:hover:bg-white/5',
+ );
+ expect(proLicensePlanSectionSource).not.toContain(
+ 'inline-flex items-center gap-1 mt-4 min-h-10 sm:min-h-9 rounded-md border border-border px-3 py-2 text-xs font-medium text-base-content hover:bg-surface-hover',
+ );
+ });
+
it('keeps column picker on shell, runtime, and model owners', () => {
const registry = JSON.parse(sharedTemplateRegistrySource) as {
rules?: Array<{
@@ -1917,6 +2011,7 @@ describe('shared primitive guardrails', () => {
expect(buttonModelSource).toContain('BUTTON_VARIANT_CLASSES');
expect(buttonModelSource).toContain('BUTTON_SIZE_CLASSES');
expect(buttonModelSource).toContain('primaryFlat:');
+ expect(buttonModelSource).toContain('warning:');
expect(buttonModelSource).toContain('settingsActionXs:');
expect(buttonModelSource).toContain('success:');
expect(buttonModelSource).toContain('successOutline:');
diff --git a/frontend-modern/src/components/shared/UpgradeLink.tsx b/frontend-modern/src/components/shared/UpgradeLink.tsx
index 5d85959560..544ad37a7a 100644
--- a/frontend-modern/src/components/shared/UpgradeLink.tsx
+++ b/frontend-modern/src/components/shared/UpgradeLink.tsx
@@ -1,28 +1,67 @@
import { A } from '@solidjs/router';
-import { Show, splitProps, type Component, type JSX } from 'solid-js';
+import { mergeProps, Show, splitProps, type Component, type JSX } from 'solid-js';
+import { ButtonLink, type ButtonLinkProps } from './Button';
+import type { ButtonSize, ButtonVariant } from './buttonModel';
import type { UpgradeDestination } from '@/utils/upgradeNavigation';
type UpgradeLinkProps = Omit<JSX.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {
destination: UpgradeDestination;
};
+export type UpgradeButtonTone = 'primary' | 'warning';
+
+type UpgradeButtonLinkProps = Omit<
+ ButtonLinkProps,
+ 'hardNavigation' | 'href' | 'preserveOpener'
+> & {
+ destination: UpgradeDestination;
+ tone?: UpgradeButtonTone;
+ mobileFullWidth?: boolean;
+};
+
+const getUpgradeNewTab = (destination: UpgradeDestination) =>
+ destination.newTab ?? destination.external;
+
+const getUpgradeHardNavigation = (destination: UpgradeDestination) =>
+ destination.hardNavigation ?? destination.external;
+
+const getUpgradeTarget = (destination: UpgradeDestination, target?: string) => {
+ if (getUpgradeNewTab(destination)) {
+ return target ?? '_blank';
+ }
+ return target;
+};
+
+const getUpgradeRel = (
+ destination: UpgradeDestination,
+ target?: string,
+ rel?: string,
+) => {
+ if (rel) return rel;
+ if ((getUpgradeNewTab(destination) || target === '_blank') && !destination.preserveOpener) {
+ return 'noopener noreferrer';
+ }
+ return undefined;
+};
+
+const getUpgradeButtonVariant = (tone: UpgradeButtonTone): ButtonVariant =>
+ tone === 'warning' ? 'warning' : 'primaryFlat';
+
+const getUpgradeButtonClass = (mobileFullWidth: boolean, className?: string) =>
+ [mobileFullWidth ? 'w-full sm:w-auto' : 'w-auto', 'gap-2', className]
+ .filter(Boolean)
+ .join(' ');
+
export const UpgradeLink: Component<UpgradeLinkProps> = (props) => {
const [local, others] = splitProps(props, ['destination', 'rel', 'target']);
- const newTab = () => local.destination.newTab ?? local.destination.external;
- const hardNavigation = () => local.destination.hardNavigation ?? local.destination.external;
+ const newTab = () => getUpgradeNewTab(local.destination);
+ const hardNavigation = () => getUpgradeHardNavigation(local.destination);
const useHardLink = () => Boolean(hardNavigation() || newTab());
const rel = () => {
- if (local.rel) return local.rel;
- if (newTab() && !local.destination.preserveOpener) {
- return 'noopener noreferrer';
- }
- return undefined;
+ return getUpgradeRel(local.destination, local.target, local.rel);
};
const target = () => {
- if (newTab()) {
- return local.target ?? '_blank';
- }
- return local.target;
+ return getUpgradeTarget(local.destination, local.target);
};
return (
@@ -40,4 +79,39 @@ export const UpgradeLink: Component<UpgradeLinkProps> = (props) => {
);
};
+export const UpgradeButtonLink: Component<UpgradeButtonLinkProps> = (props) => {
+ const merged = mergeProps(
+ {
+ mobileFullWidth: true,
+ size: 'settingsAction' as ButtonSize,
+ tone: 'primary' as UpgradeButtonTone,
+ },
+ props,
+ );
+ const [local, others] = splitProps(merged, [
+ 'destination',
+ 'tone',
+ 'mobileFullWidth',
+ 'variant',
+ 'size',
+ 'class',
+ 'rel',
+ 'target',
+ ]);
+
+ return (
+ <ButtonLink
+ {...others}
+ href={local.destination.href}
+ hardNavigation={getUpgradeHardNavigation(local.destination)}
+ preserveOpener={local.destination.preserveOpener}
+ target={getUpgradeTarget(local.destination, local.target)}
+ rel={getUpgradeRel(local.destination, local.target, local.rel)}
+ variant={local.variant ?? getUpgradeButtonVariant(local.tone)}
+ size={local.size}
+ class={getUpgradeButtonClass(local.mobileFullWidth, local.class)}
+ />
+ );
+};
+
export default UpgradeLink;
diff --git a/frontend-modern/src/components/shared/__tests__/UpgradeLink.test.tsx b/frontend-modern/src/components/shared/__tests__/UpgradeLink.test.tsx
index 91d11ea7dc..cf942c104f 100644
--- a/frontend-modern/src/components/shared/__tests__/UpgradeLink.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/UpgradeLink.test.tsx
@@ -1,7 +1,7 @@
import { cleanup, render, screen } from '@solidjs/testing-library';
import { Route, Router } from '@solidjs/router';
import { afterEach, describe, expect, it } from 'vitest';
-import { UpgradeLink } from '@/components/shared/UpgradeLink';
+import { UpgradeButtonLink, UpgradeLink } from '@/components/shared/UpgradeLink';
describe('UpgradeLink', () => {
afterEach(() => {
@@ -80,4 +80,58 @@ describe('UpgradeLink', () => {
expect(link).toHaveAttribute('target', '_blank');
expect(link).not.toHaveAttribute('rel');
});
+
+ it('renders upgrade actions through the shared button link shell', () => {
+ render(() => (
+ <Router>
+ <Route
+ path="/"
+ component={() => (
+ <UpgradeButtonLink
+ destination={{ href: '/settings/system/billing', external: false }}
+ tone="warning"
+ mobileFullWidth={false}
+ >
+ View plans
+ </UpgradeButtonLink>
+ )}
+ />
+ </Router>
+ ));
+
+ const link = screen.getByRole('link', { name: 'View plans' });
+ expect(link).toHaveAttribute('href', '/settings/system/billing');
+ expect(link).not.toHaveAttribute('target');
+ expect(link).toHaveClass('inline-flex');
+ expect(link).toHaveClass('bg-amber-100');
+ expect(link).toHaveClass('w-auto');
+ });
+
+ it('keeps opener access available for upgrade button purchase-start links', () => {
+ render(() => (
+ <Router>
+ <Route
+ path="/"
+ component={() => (
+ <UpgradeButtonLink
+ destination={{
+ href: '/auth/license-purchase-start?feature=relay',
+ external: false,
+ hardNavigation: true,
+ newTab: true,
+ preserveOpener: true,
+ }}
+ >
+ Compare plans
+ </UpgradeButtonLink>
+ )}
+ />
+ </Router>
+ ));
+
+ const link = screen.getByRole('link', { name: 'Compare plans' });
+ expect(link).toHaveAttribute('href', '/auth/license-purchase-start?feature=relay');
+ expect(link).toHaveAttribute('target', '_blank');
+ expect(link).not.toHaveAttribute('rel');
+ });
});
diff --git a/frontend-modern/src/components/shared/buttonModel.ts b/frontend-modern/src/components/shared/buttonModel.ts
index 908af1ca0a..841b8fc873 100644
--- a/frontend-modern/src/components/shared/buttonModel.ts
+++ b/frontend-modern/src/components/shared/buttonModel.ts
@@ -1,6 +1,7 @@
export type ButtonVariant =
| 'primary'
| 'primaryFlat'
+ | 'warning'
| 'success'
| 'successOutline'
| 'successGhost'
@@ -26,6 +27,8 @@ export const BUTTON_BASE_CLASS =
export const BUTTON_VARIANT_CLASSES: Record<ButtonVariant, string> = {
primary: 'border border-transparent bg-blue-600 text-white shadow-sm hover:bg-blue-700',
primaryFlat: 'border border-transparent bg-blue-600 text-white hover:bg-blue-700',
+ warning:
+ 'border border-amber-300 bg-amber-100 text-amber-800 hover:bg-amber-200 dark:border-amber-700 dark:bg-amber-900 dark:text-amber-100 dark:hover:bg-amber-800',
success: 'border border-transparent bg-emerald-600 text-white shadow-sm hover:bg-emerald-700',
successOutline:
'border border-emerald-300 bg-white text-emerald-900 hover:bg-emerald-100 dark:border-emerald-700 dark:bg-emerald-950 dark:text-emerald-100 dark:hover:bg-emerald-800',
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 2b0aa3b4dc..283ba2cff7 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -1028,11 +1028,11 @@ describe('frontend resource type boundaries', () => {
expect(discoverySettingsStateSource).toContain('export function useDiscoverySettingsState');
expect(discoverySettingsStateSource).toContain('normalizeSubnetList');
expect(discoverySettingsStateSource).toContain('isValidCIDR');
- // The canonical upgrade CTA contract (button class + label) now lives in
- // the shared FeatureGateSection; gated panels route their paywall through
- // it instead of re-deriving the button locally.
+ // The canonical upgrade CTA contract is split between the shared action-link
+ // shell and the shared label constant; gated panels do not re-derive button
+ // classes locally.
expect(featureGateSectionSource).toContain('@/utils/upgradePresentation');
- expect(featureGateSectionSource).toContain('getUpgradeActionButtonClass');
+ expect(featureGateSectionSource).toContain('UpgradeButtonLink');
expect(featureGateSectionSource).toContain('UPGRADE_ACTION_LABEL');
expect(featureGateSectionSource).toContain('@/components/shared/UpgradeLink');
expect(reportingPanelSource).toContain('@/components/shared/FeatureGateSection');
@@ -1051,6 +1051,7 @@ describe('frontend resource type boundaries', () => {
expect(userAssignmentsPanelStateSource).toContain('getUserAssignmentsLoadErrorMessage');
expect(agentProfilesPanelSource).toContain('./useAgentProfilesPanelState');
expect(agentProfilesPanelStateSource).toContain('@/utils/upgradePresentation');
+ expect(agentProfilesPanelSource).toContain('UpgradeButtonLink');
expect(agentProfilesPanelSource).toContain('@/utils/agentProfilesPresentation');
expect(agentProfilesPanelSource).toContain('getAgentProfilesEmptyState');
expect(agentProfilesPanelSource).toContain('getAgentProfileAssignmentsEmptyState');
@@ -1058,13 +1059,14 @@ describe('frontend resource type boundaries', () => {
expect(agentProfilesPanelSource).not.toContain(
'No agents connected. Install an agent to assign profiles.',
);
- expect(auditLogPanelSource).toContain('@/utils/upgradePresentation');
+ expect(auditLogPanelSource).toContain('UpgradeButtonLink');
+ expect(auditLogPanelSource).not.toContain('@/utils/upgradePresentation');
expect(auditWebhookPanelSource).toContain('@/components/shared/FeatureGateSection');
expect(ssoProvidersPanelSource).not.toContain('@/utils/upgradePresentation');
expect(upgradePresentationSource).toContain('export const UPGRADE_ACTION_LABEL');
expect(upgradePresentationSource).not.toContain('UPGRADE_TRIAL_LABEL');
expect(upgradePresentationSource).not.toContain('UPGRADE_TRIAL_LINK_CLASS');
- expect(upgradePresentationSource).toContain('export function getUpgradeActionButtonClass');
+ expect(upgradePresentationSource).not.toContain('getUpgradeActionButtonClass');
expect(organizationAccessManagementSectionSource).toContain(
'@/utils/organizationRolePresentation',
);
@@ -3453,7 +3455,8 @@ describe('frontend resource type boundaries', () => {
expect(updateInstallGuideSource).toContain('@/components/Settings/CopyCommandBlock');
expect(updateInstallGuideSource).toContain('buildUpdateInstallGuide');
expect(copyCommandBlockSource).toContain('export function CopyCommandBlock');
- expect(copyCommandBlockSource).toContain('aria-label="Copy to clipboard"');
+ expect(copyCommandBlockSource).toContain('CommandCopyButton');
+ expect(copyCommandBlockSource).toContain('label="Copy to clipboard"');
expect(updatesSettingsModelSource).toContain('export function getUpdateChannelCardOptions');
expect(updatesSettingsModelSource).toContain('export function buildUpdateInstallGuide');
expect(reportingPanelStateSource).toContain('buildReportingRequest');
diff --git a/frontend-modern/src/utils/__tests__/upgradePresentation.test.ts b/frontend-modern/src/utils/__tests__/upgradePresentation.test.ts
index d560758845..dadd0ddad0 100644
--- a/frontend-modern/src/utils/__tests__/upgradePresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/upgradePresentation.test.ts
@@ -1,25 +1,8 @@
import { describe, expect, it } from 'vitest';
-import {
- getUpgradeActionButtonClass,
- UPGRADE_ACTION_LABEL,
-} from '@/utils/upgradePresentation';
+import { UPGRADE_ACTION_LABEL } from '@/utils/upgradePresentation';
describe('upgradePresentation', () => {
it('returns canonical upgrade labels', () => {
expect(UPGRADE_ACTION_LABEL).toBe('View plans');
});
-
- it('returns the primary upgrade action button classes by default', () => {
- const classes = getUpgradeActionButtonClass();
- expect(classes).toContain('bg-blue-600');
- expect(classes).toContain('w-full sm:w-auto');
- expect(classes).toContain('text-white');
- });
-
- it('returns the warning upgrade action button classes when requested', () => {
- const classes = getUpgradeActionButtonClass({ tone: 'warning', mobileFullWidth: false });
- expect(classes).toContain('border-amber-300');
- expect(classes).toContain('bg-amber-100');
- expect(classes).toContain('w-auto');
- });
});
diff --git a/frontend-modern/src/utils/upgradePresentation.ts b/frontend-modern/src/utils/upgradePresentation.ts
index 936dafb776..82c6634a3b 100644
--- a/frontend-modern/src/utils/upgradePresentation.ts
+++ b/frontend-modern/src/utils/upgradePresentation.ts
@@ -1,21 +1 @@
-export type UpgradeActionButtonTone = 'primary' | 'warning';
-
-export interface UpgradeActionButtonOptions {
- tone?: UpgradeActionButtonTone;
- mobileFullWidth?: boolean;
-}
-
export const UPGRADE_ACTION_LABEL = 'View plans';
-
-export function getUpgradeActionButtonClass(
- options: UpgradeActionButtonOptions = {},
-): string {
- const { tone = 'primary', mobileFullWidth = true } = options;
- const widthClass = mobileFullWidth ? 'w-full sm:w-auto' : 'w-auto';
-
- if (tone === 'warning') {
- return `${widthClass} inline-flex min-h-10 sm:min-h-9 items-center justify-center gap-2 rounded-md border border-amber-300 bg-amber-100 px-4 py-2 text-sm font-medium text-amber-800 transition-colors hover:bg-amber-200 dark:border-amber-700 dark:bg-amber-900 dark:text-amber-100 dark:hover:bg-amber-800`;
- }
-
- return `${widthClass} inline-flex min-h-10 sm:min-h-9 items-center justify-center gap-2 rounded-md bg-blue-600 px-5 py-2.5 text-center text-sm font-semibold text-white transition-colors hover:bg-blue-700`;
-}