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.

Promote Pulse Pro billing focus to route-owned states

rcourtman7b22d62882cb
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 93e6015d87..4b8fd54497 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -128,7 +128,10 @@ agreement, and cloud-specific enforcement rules.
and `frontend-modern/src/components/Settings/useProLicensePanelState.ts`
therefore own a canonical two-state billing focus model (`plan` vs
`usage`) that survives direct links, compatibility redirects, and
- in-product CTA navigation.
+ in-product CTA navigation. The current canonical arrivals are
+ `/settings/system/billing/usage?details=counting-rules` for explanation and
+ `/settings/system/billing/plan?intent=max_monitored_systems` for upgrade
+ intent.
## Forbidden Paths
@@ -580,7 +583,10 @@ For self-hosted Pulse Pro specifically, the plan/usage split is now also a
router contract: `/settings/system/billing/plan` is the canonical plan state,
`/settings/system/billing/usage` is the canonical monitored-system usage state,
and `/settings/system/billing` remains a compatibility handoff rather than the
-primary owned destination.
+primary owned destination. Arrival-specific UI affordances belong to that same
+owned billing surface: usage arrivals may open counting rules by default, and
+plan arrivals may surface an upgrade callout, but checkout still hands off to
+the public pricing surface rather than living inside the product runtime.
That same ownership split is explicit in the governed registry as well:
`CommercialBillingSections.tsx` is part of the shared commercial shell/model
surface, while `SelfHostedCommercialActivationSection.tsx` stays on the
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 97b8f2cdb1..354e9d57b0 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -1290,6 +1290,10 @@ metadata and item lookup, `settingsNavVisibility.ts` owns
feature/capability visibility and lock policy for settings navigation,
`useSettingsNavigation.ts` owns reactive URL sync and canonical tab-selection
state, `SettingsDialogs.tsx` owns shared settings modal composition,
+including the route-owned billing focus contract where
+`/settings/system/billing/plan` is the canonical settings-tab destination,
+`/settings/system/billing/usage` is a same-tab child state, and legacy billing
+base/hash links are compatibility inputs rather than primary runtime routes.
`useSettingsShellState.ts` owns shell-local sidebar/search/password-modal
state, and `settingsTabSaveBehavior.ts` owns settings tab save-behavior lookup,
`frontend-modern/src/components/Settings/useSettingsSystemPanels.tsx` owns
@@ -1420,6 +1424,10 @@ owns monitored-system warning policy, count aggregation, and tone/text-class
policy while sourcing customer-facing monitored-system copy from the canonical
`frontend-modern/src/utils/monitoredSystemPresentation.ts` helper. Future
warning-banner work should extend those owners instead of pushing entitlement
+state or route selection back into the render shell. When the warning points at
+Pulse Pro billing, the shared primitive must preserve distinct route-owned
+arrivals for usage explanation vs upgrade intent instead of re-collapsing both
+CTAs onto one generic billing href.
orchestration, tracking, or naming math back into the shared shell or
reintroducing banner-local monitored-system copy strings.
Shared frontend label-formatting helpers now also have an explicit owner here.
diff --git a/frontend-modern/src/components/Commercial/MonitoredSystemDefinitionDisclosure.tsx b/frontend-modern/src/components/Commercial/MonitoredSystemDefinitionDisclosure.tsx
index 942d17b2fb..d79284c351 100644
--- a/frontend-modern/src/components/Commercial/MonitoredSystemDefinitionDisclosure.tsx
+++ b/frontend-modern/src/components/Commercial/MonitoredSystemDefinitionDisclosure.tsx
@@ -1,4 +1,4 @@
-import { Show, createSignal, type Component } from 'solid-js';
+import { Show, createEffect, createSignal, type Component } from 'solid-js';
import {
getMonitoredSystemBriefSummary,
getMonitoredSystemDisclosureDefinition,
@@ -7,6 +7,7 @@ import {
interface MonitoredSystemDefinitionDisclosureProps {
showSummary?: boolean;
+ defaultOpen?: boolean;
class?: string;
summaryClass?: string;
buttonClass?: string;
@@ -16,7 +17,11 @@ interface MonitoredSystemDefinitionDisclosureProps {
export const MonitoredSystemDefinitionDisclosure: Component<
MonitoredSystemDefinitionDisclosureProps
> = (props) => {
- const [open, setOpen] = createSignal(false);
+ const [open, setOpen] = createSignal(Boolean(props.defaultOpen));
+
+ createEffect(() => {
+ setOpen(Boolean(props.defaultOpen));
+ });
return (
<div class={props.class ?? 'space-y-2'}>
diff --git a/frontend-modern/src/components/Commercial/__tests__/MonitoredSystemDefinitionDisclosure.test.tsx b/frontend-modern/src/components/Commercial/__tests__/MonitoredSystemDefinitionDisclosure.test.tsx
index f3f655ef8c..76d2726026 100644
--- a/frontend-modern/src/components/Commercial/__tests__/MonitoredSystemDefinitionDisclosure.test.tsx
+++ b/frontend-modern/src/components/Commercial/__tests__/MonitoredSystemDefinitionDisclosure.test.tsx
@@ -36,4 +36,16 @@ describe('MonitoredSystemDefinitionDisclosure', () => {
screen.queryByText('Billing is based on monitored systems. Child resources are included.'),
).not.toBeInTheDocument();
});
+
+ it('supports route-driven default-open disclosure state', () => {
+ render(() => <MonitoredSystemDefinitionDisclosure defaultOpen />);
+
+ expect(screen.getByRole('button', { name: 'Hide counting rules' })).toHaveAttribute(
+ 'aria-expanded',
+ 'true',
+ );
+ expect(
+ screen.getByText(/a monitored system is a top-level machine or cluster/i),
+ ).toBeInTheDocument();
+ });
});
diff --git a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
index d7b0a9d1bf..18f5bcefc0 100644
--- a/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
+++ b/frontend-modern/src/components/Settings/MonitoredSystemLedgerPanel.tsx
@@ -27,6 +27,7 @@ import { MonitoredSystemDefinitionDisclosure } from '@/components/Commercial/Mon
interface MonitoredSystemLedgerPanelProps {
embedded?: boolean;
+ showCountingRulesByDefault?: boolean;
}
function usagePercent(total: number, limit: number): number {
@@ -72,6 +73,7 @@ export function MonitoredSystemLedgerPanel(props: MonitoredSystemLedgerPanelProp
<div class="space-y-1">
<h3 class="text-sm font-semibold text-base-content">{presentation.sectionTitle}</h3>
<MonitoredSystemDefinitionDisclosure
+ defaultOpen={props.showCountingRulesByDefault}
buttonClass="text-xs font-medium text-muted underline-offset-2 transition-colors hover:text-base-content hover:underline"
detailClass="max-w-xl text-xs text-muted"
/>
diff --git a/frontend-modern/src/components/Settings/ProLicensePanel.tsx b/frontend-modern/src/components/Settings/ProLicensePanel.tsx
index 15569059e6..71e0270acb 100644
--- a/frontend-modern/src/components/Settings/ProLicensePanel.tsx
+++ b/frontend-modern/src/components/Settings/ProLicensePanel.tsx
@@ -63,15 +63,16 @@ export const ProLicensePanel: Component = () => {
commercialPlanModel={state.commercialPlanModel()}
entitlements={state.entitlements()}
formattedFeatures={state.formattedFeatures()}
- grandfatheredPriceNotice={state.grandfatheredPriceNotice()}
- hasLicenseDetails={state.hasLicenseDetails()}
- hasPaidFeatures={state.hasPaidFeatures()}
- loading={state.loading()}
- onReload={() => void state.loadPanelData()}
- statusPresentation={state.statusPresentation()}
- trialActivationNotice={state.trialActivationNotice()}
- trialEnded={state.trialEnded()}
- />
+ grandfatheredPriceNotice={state.grandfatheredPriceNotice()}
+ hasLicenseDetails={state.hasLicenseDetails()}
+ hasPaidFeatures={state.hasPaidFeatures()}
+ loading={state.loading()}
+ onReload={() => void state.loadPanelData()}
+ showMonitoredSystemUpgradeArrival={state.showMonitoredSystemUpgradeArrival()}
+ statusPresentation={state.statusPresentation()}
+ trialActivationNotice={state.trialActivationNotice()}
+ trialEnded={state.trialEnded()}
+ />
</CommercialSection>
</Show>
@@ -81,7 +82,10 @@ export const ProLicensePanel: Component = () => {
title={SELF_HOSTED_PRO_BILLING_PRESENTATION.usageSectionTitle}
description={getMonitoredSystemBriefSummary()}
>
- <MonitoredSystemLedgerPanel embedded />
+ <MonitoredSystemLedgerPanel
+ embedded
+ showCountingRulesByDefault={state.showCountingRulesByDefault()}
+ />
</CommercialSection>
</Show>
diff --git a/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx b/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx
index 340147e8d6..2d3536c2e7 100644
--- a/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx
+++ b/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx
@@ -8,7 +8,10 @@ import {
getNoActiveProLicenseState,
getTrialEndedProLicenseNotice,
} from '@/utils/licensePresentation';
+import { getPublicPricingUrl } from '@/utils/pricingHandoff';
+import { resolveUpgradeDestination } from '@/utils/upgradeNavigation';
import { CommercialStatGrid } from './CommercialBillingSections';
+import { SELF_HOSTED_PRO_BILLING_PRESENTATION } from './selfHostedBillingPresentation';
interface Notice {
title: string;
@@ -36,6 +39,7 @@ interface ProLicensePlanSectionProps {
badgeClass: string;
label: string;
};
+ showMonitoredSystemUpgradeArrival: boolean;
trialActivationNotice: Notice | null;
trialEnded: boolean;
}
@@ -51,123 +55,151 @@ export const ProLicensePlanSection: Component<ProLicensePlanSectionProps> = (pro
const trialEndedNotice = props.trialEnded ? getTrialEndedProLicenseNotice() : null;
const inactiveProUpsellNotice =
!props.hasPaidFeatures && !props.trialEnded ? getInactiveProUpsellNotice() : null;
+ const monitoredSystemUpgradeDestination = () => {
+ const destination = getUpgradeActionDestination('max_monitored_systems');
+ if (destination.external) {
+ return destination;
+ }
+ return resolveUpgradeDestination(getPublicPricingUrl('max_monitored_systems'));
+ };
return (
<>
- <Show when={props.trialActivationNotice}>
- {(notice) => (
- <div class={`mb-4 rounded-md border p-3 text-sm ${notice().tone}`}>
- <p class="font-medium">{notice().title}</p>
- <p class="mt-1 text-xs opacity-90">{notice().body}</p>
- </div>
- )}
- </Show>
- <Show when={props.commercialMigrationNotice}>
- {(notice) => (
- <div class={`mb-4 rounded-md border p-3 text-sm ${notice().tone}`}>
- <p class="font-medium">{notice().title}</p>
- <p class="mt-1 text-xs opacity-90">{notice().body}</p>
+ <Show when={props.showMonitoredSystemUpgradeArrival}>
+ <div class="mb-4 rounded-md border border-primary/30 bg-primary/5 p-3 text-sm text-base-content">
+ <p class="font-medium">
+ {SELF_HOSTED_PRO_BILLING_PRESENTATION.monitoredSystemUpgradeArrivalTitle}
+ </p>
+ <p class="mt-1 text-xs opacity-90">
+ {SELF_HOSTED_PRO_BILLING_PRESENTATION.monitoredSystemUpgradeArrivalBody}
+ </p>
+ <UpgradeLink
+ class="inline-flex items-center gap-1 mt-2 text-xs font-medium text-primary hover:underline"
+ destination={monitoredSystemUpgradeDestination()}
+ >
+ {SELF_HOSTED_PRO_BILLING_PRESENTATION.monitoredSystemUpgradeArrivalActionLabel}
+ </UpgradeLink>
</div>
- )}
- </Show>
- <Show when={props.grandfatheredPriceNotice}>
- {(notice) => (
- <div class={`mb-4 rounded-md border p-3 text-sm ${notice().tone}`}>
- <p class="font-medium">{notice().title}</p>
- <p class="mt-1 text-xs opacity-90">{notice().body}</p>
+ </Show>
+ <Show when={props.trialActivationNotice}>
+ {(notice) => (
+ <div class={`mb-4 rounded-md border p-3 text-sm ${notice().tone}`}>
+ <p class="font-medium">{notice().title}</p>
+ <p class="mt-1 text-xs opacity-90">{notice().body}</p>
+ </div>
+ )}
+ </Show>
+ <Show when={props.commercialMigrationNotice}>
+ {(notice) => (
+ <div class={`mb-4 rounded-md border p-3 text-sm ${notice().tone}`}>
+ <p class="font-medium">{notice().title}</p>
+ <p class="mt-1 text-xs opacity-90">{notice().body}</p>
+ </div>
+ )}
+ </Show>
+ <Show when={props.grandfatheredPriceNotice}>
+ {(notice) => (
+ <div class={`mb-4 rounded-md border p-3 text-sm ${notice().tone}`}>
+ <p class="font-medium">{notice().title}</p>
+ <p class="mt-1 text-xs opacity-90">{notice().body}</p>
+ </div>
+ )}
+ </Show>
+ <Show when={props.trialEnded && !licenseLoadError() && trialEndedNotice}>
+ <div class={`mb-4 rounded-md border p-3 text-sm ${trialEndedNotice?.tone ?? ''}`}>
+ <p class="font-medium">{trialEndedNotice?.title}</p>
+ <p class="text-xs mt-1 opacity-90">{trialEndedNotice?.body}</p>
+ <UpgradeLink
+ class="inline-flex items-center gap-1 mt-2 text-xs font-medium hover:underline"
+ destination={getUpgradeActionDestination('trial_expired')}
+ >
+ {trialEndedNotice?.actionLabel}
+ </UpgradeLink>
</div>
- )}
- </Show>
- <Show when={props.trialEnded && !licenseLoadError() && trialEndedNotice}>
- <div class={`mb-4 rounded-md border p-3 text-sm ${trialEndedNotice?.tone ?? ''}`}>
- <p class="font-medium">{trialEndedNotice?.title}</p>
- <p class="text-xs mt-1 opacity-90">{trialEndedNotice?.body}</p>
- <UpgradeLink
- class="inline-flex items-center gap-1 mt-2 text-xs font-medium hover:underline"
- destination={getUpgradeActionDestination('trial_expired')}
- >
- {trialEndedNotice?.actionLabel}
- </UpgradeLink>
- </div>
- </Show>
- <Show when={licenseLoadError()}>
- <div class="rounded-md border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900 p-3 text-sm text-amber-800 dark:text-amber-200">
- <p class="font-medium">Could not load license status</p>
- <p class="text-xs text-amber-700 dark:text-amber-300 mt-1">
- The license server could not be reached. Some features may be temporarily restricted.
- </p>
- <button
- type="button"
- class="mt-2 inline-flex min-h-10 sm:min-h-9 items-center gap-2 px-3 py-2 text-xs font-medium rounded-md border border-amber-300 dark:border-amber-700 text-amber-800 dark:text-amber-200 hover:bg-amber-100 dark:hover:bg-amber-800 transition-colors disabled:opacity-60"
- disabled={props.loading}
- onClick={props.onReload}
- >
- <RefreshCw class={`w-3 h-3 ${props.loading ? 'animate-spin' : ''}`} />
- Retry
- </button>
- </div>
- </Show>
- <Show when={!licenseLoadError()}>
- <Show when={!props.loading} fallback={<p class="text-sm ">{getLicenseStatusLoadingState().text}</p>}>
- <div class="flex flex-wrap items-center gap-2">
- <span class={`px-2 py-1 text-xs font-medium rounded-full ${props.statusPresentation.badgeClass}`}>
- {props.statusPresentation.label}
- </span>
- <Show when={props.entitlements?.in_grace_period}>
- <span class="text-xs text-amber-700 dark:text-amber-300">
- Grace until {formatDate(props.entitlements?.grace_period_end)}
- </span>
- </Show>
+ </Show>
+ <Show when={licenseLoadError()}>
+ <div class="rounded-md border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-900 p-3 text-sm text-amber-800 dark:text-amber-200">
+ <p class="font-medium">Could not load license status</p>
+ <p class="text-xs text-amber-700 dark:text-amber-300 mt-1">
+ The license server could not be reached. Some features may be temporarily restricted.
+ </p>
+ <button
+ type="button"
+ class="mt-2 inline-flex min-h-10 sm:min-h-9 items-center gap-2 px-3 py-2 text-xs font-medium rounded-md border border-amber-300 dark:border-amber-700 text-amber-800 dark:text-amber-200 hover:bg-amber-100 dark:hover:bg-amber-800 transition-colors disabled:opacity-60"
+ disabled={props.loading}
+ onClick={props.onReload}
+ >
+ <RefreshCw class={`w-3 h-3 ${props.loading ? 'animate-spin' : ''}`} />
+ Retry
+ </button>
</div>
-
+ </Show>
+ <Show when={!licenseLoadError()}>
<Show
- when={props.hasLicenseDetails}
- fallback={<div class="text-sm text-muted">{getNoActiveProLicenseState().text}</div>}
+ when={!props.loading}
+ fallback={<p class="text-sm ">{getLicenseStatusLoadingState().text}</p>}
>
- <CommercialStatGrid items={props.commercialPlanModel.summary} />
-
- <div class="grid gap-4 sm:grid-cols-2">
- <For each={props.commercialPlanModel.details}>
- {(item) => (
- <div>
- <p class="text-xs uppercase tracking-wide text-muted">{item.label}</p>
- <p class="text-sm font-medium text-base-content">{item.value}</p>
- </div>
- )}
- </For>
+ <div class="flex flex-wrap items-center gap-2">
+ <span
+ class={`px-2 py-1 text-xs font-medium rounded-full ${props.statusPresentation.badgeClass}`}
+ >
+ {props.statusPresentation.label}
+ </span>
+ <Show when={props.entitlements?.in_grace_period}>
+ <span class="text-xs text-amber-700 dark:text-amber-300">
+ Grace until {formatDate(props.entitlements?.grace_period_end)}
+ </span>
+ </Show>
</div>
- <Show when={props.formattedFeatures.length > 0}>
- <div>
- <p class="text-xs uppercase tracking-wide text-muted mb-2">Features</p>
- <ul class="grid gap-2 sm:grid-cols-2">
- <For each={props.formattedFeatures}>
- {(feature) => (
- <li class="text-sm text-base-content flex items-center gap-2">
- <span class="w-1.5 h-1.5 rounded-full bg-emerald-400"></span>
- {feature}
- </li>
- )}
- </For>
- </ul>
+ <Show
+ when={props.hasLicenseDetails}
+ fallback={<div class="text-sm text-muted">{getNoActiveProLicenseState().text}</div>}
+ >
+ <CommercialStatGrid items={props.commercialPlanModel.summary} />
+
+ <div class="grid gap-4 sm:grid-cols-2">
+ <For each={props.commercialPlanModel.details}>
+ {(item) => (
+ <div>
+ <p class="text-xs uppercase tracking-wide text-muted">{item.label}</p>
+ <p class="text-sm font-medium text-base-content">{item.value}</p>
+ </div>
+ )}
+ </For>
</div>
+
+ <Show when={props.formattedFeatures.length > 0}>
+ <div>
+ <p class="text-xs uppercase tracking-wide text-muted mb-2">Features</p>
+ <ul class="grid gap-2 sm:grid-cols-2">
+ <For each={props.formattedFeatures}>
+ {(feature) => (
+ <li class="text-sm text-base-content flex items-center gap-2">
+ <span class="w-1.5 h-1.5 rounded-full bg-emerald-400"></span>
+ {feature}
+ </li>
+ )}
+ </For>
+ </ul>
+ </div>
+ </Show>
</Show>
- </Show>
- <Show when={!props.hasPaidFeatures && !props.trialEnded && inactiveProUpsellNotice}>
- <div class={`rounded-md border p-3 text-sm ${inactiveProUpsellNotice?.tone ?? ''}`}>
- <p class="font-medium">{inactiveProUpsellNotice?.title}</p>
- <p class="text-xs mt-1 opacity-90">{inactiveProUpsellNotice?.body}</p>
- <UpgradeLink
- class="inline-flex items-center gap-1 mt-2 text-xs font-medium hover:underline"
- destination={getUpgradeActionDestination('ai_autofix')}
- >
- {inactiveProUpsellNotice?.actionLabel}
- </UpgradeLink>
- </div>
+ <Show when={!props.hasPaidFeatures && !props.trialEnded && inactiveProUpsellNotice}>
+ <div class={`rounded-md border p-3 text-sm ${inactiveProUpsellNotice?.tone ?? ''}`}>
+ <p class="font-medium">{inactiveProUpsellNotice?.title}</p>
+ <p class="text-xs mt-1 opacity-90">{inactiveProUpsellNotice?.body}</p>
+ <UpgradeLink
+ class="inline-flex items-center gap-1 mt-2 text-xs font-medium hover:underline"
+ destination={getUpgradeActionDestination('ai_autofix')}
+ >
+ {inactiveProUpsellNotice?.actionLabel}
+ </UpgradeLink>
+ </div>
+ </Show>
</Show>
</Show>
- </Show>
</>
);
};
diff --git a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
index ac26681147..6766d4d4e0 100644
--- a/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/MonitoredSystemLedgerPanel.test.tsx
@@ -408,4 +408,26 @@ describe('MonitoredSystemLedgerPanel', () => {
),
).toBeInTheDocument();
});
+
+ it('opens counting rules by default for usage-focused billing arrivals', async () => {
+ getLedgerMock.mockResolvedValue({
+ systems: [],
+ total: 2,
+ limit: 5,
+ } as MonitoredSystemLedgerResponse);
+
+ render(() => <MonitoredSystemLedgerPanel showCountingRulesByDefault />);
+
+ await waitFor(() => {
+ expect(screen.getByText('2 / 5')).toBeInTheDocument();
+ });
+
+ expect(screen.getByRole('button', { name: 'Hide counting rules' })).toHaveAttribute(
+ 'aria-expanded',
+ 'true',
+ );
+ expect(
+ screen.getByText(/a monitored system is a top-level machine or cluster/i),
+ ).toBeInTheDocument();
+ });
});
diff --git a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
index 0a287221f1..b5a8caceb6 100644
--- a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
@@ -9,7 +9,9 @@ import proLicensePlanSectionSource from '../ProLicensePlanSection.tsx?raw';
import selfHostedCommercialActivationSectionSource from '../SelfHostedCommercialActivationSection.tsx?raw';
import {
getPublicPricingUrl,
+ SELF_HOSTED_PRO_BILLING_PLAN_HREF,
SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID,
+ SELF_HOSTED_PRO_BILLING_USAGE_HREF,
SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID,
} from '@/utils/pricingHandoff';
@@ -23,7 +25,7 @@ const notificationSuccessMock = vi.fn();
const notificationErrorMock = vi.fn();
const useLocationMock = vi.fn(() => ({
search: '',
- pathname: '/settings/system/billing',
+ pathname: '/settings/system/billing/plan',
hash: '',
}));
const navigateMock = vi.fn();
@@ -91,7 +93,7 @@ describe('ProLicensePanel', () => {
getUpgradeActionUrlOrFallbackMock.mockImplementation((feature?: string) => getPublicPricingUrl(feature));
useLocationMock.mockReturnValue({
search: '',
- pathname: '/settings/system/billing',
+ pathname: '/settings/system/billing/plan',
hash: '',
});
});
@@ -185,7 +187,7 @@ describe('ProLicensePanel', () => {
fireEvent.click(screen.getByRole('tab', { name: 'Usage' }));
- expect(navigateMock).toHaveBeenCalledWith('/settings/system/billing#pulse-pro-usage', {
+ expect(navigateMock).toHaveBeenCalledWith(SELF_HOSTED_PRO_BILLING_USAGE_HREF, {
replace: false,
scroll: false,
});
@@ -314,7 +316,7 @@ describe('ProLicensePanel', () => {
it('shows the hosted activation success banner on the Pro settings route', async () => {
useLocationMock.mockReturnValue({
search: '?trial=activated',
- pathname: '/settings/system/billing',
+ pathname: '/settings/system/billing/plan',
hash: '',
});
@@ -324,17 +326,17 @@ describe('ProLicensePanel', () => {
expect(
screen.getByText(/Pulse activated the Pro trial for this instance/i),
).toBeInTheDocument();
- expect(navigateMock).toHaveBeenCalledWith('/settings/system/billing', {
+ expect(navigateMock).toHaveBeenCalledWith(SELF_HOSTED_PRO_BILLING_PLAN_HREF, {
replace: true,
scroll: false,
});
});
- it('focuses the usage billing section when the route hash requests it', async () => {
+ it('focuses the usage billing section when the usage route requests counting rules', async () => {
useLocationMock.mockReturnValue({
- search: '',
- pathname: '/settings/system/billing',
- hash: `#${SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID}`,
+ search: '?details=counting-rules',
+ pathname: '/settings/system/billing/usage',
+ hash: '',
});
render(() => <ProLicensePanel />);
@@ -343,21 +345,37 @@ describe('ProLicensePanel', () => {
expect(document.getElementById(SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID)).not.toBeInTheDocument();
expect(document.getElementById(SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID)).toBeInTheDocument();
expect(screen.getByText('Monitored Systems')).toBeInTheDocument();
- expect(screen.getByRole('button', { name: 'View counting rules' })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'Hide counting rules' })).toBeInTheDocument();
+ });
+
+ it('shows a monitored-system upgrade arrival callout on the plan upgrade route', async () => {
+ useLocationMock.mockReturnValue({
+ search: '?intent=max_monitored_systems',
+ pathname: '/settings/system/billing/plan',
+ hash: '',
+ });
+
+ render(() => <ProLicensePanel />);
+
+ expect(screen.getByText('Need a higher monitored-system cap?')).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'Compare plans' })).toHaveAttribute(
+ 'href',
+ getPublicPricingUrl('max_monitored_systems'),
+ );
});
it('navigates between plan and usage focus states through the billing subtabs', async () => {
useLocationMock.mockReturnValue({
search: '',
- pathname: '/settings/system/billing',
- hash: `#${SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID}`,
+ pathname: '/settings/system/billing/plan',
+ hash: '',
});
render(() => <ProLicensePanel />);
fireEvent.click(screen.getByRole('tab', { name: 'Usage' }));
- expect(navigateMock).toHaveBeenCalledWith('/settings/system/billing#pulse-pro-usage', {
+ expect(navigateMock).toHaveBeenCalledWith(SELF_HOSTED_PRO_BILLING_USAGE_HREF, {
replace: false,
scroll: false,
});
@@ -509,7 +527,9 @@ describe('ProLicensePanel', () => {
expect(proLicensePanelSource).not.toContain('createSignal(');
expect(proLicensePanelSource).not.toContain('useLocation()');
expect(proLicensePanelStateSource).toContain('useLocation');
- expect(proLicensePanelStateSource).toContain('const activeSection = createMemo<SelfHostedBillingSection>(() => {');
+ expect(proLicensePanelStateSource).toContain('resolveSelfHostedBillingSection');
+ expect(proLicensePanelStateSource).toContain('getSelfHostedBillingPlanIntent');
+ expect(proLicensePanelStateSource).toContain('getSelfHostedBillingUsageDetail');
expect(proLicensePanelStateSource).toContain('const setActiveSection = (section: SelfHostedBillingSection) => {');
expect(proLicensePanelStateSource).toContain('loadLicenseStatus(true)');
expect(proLicensePanelStateSource).toContain('buildSelfHostedCommercialPlanModel');
@@ -531,6 +551,10 @@ describe('ProLicensePanel', () => {
expect(proLicensePlanSectionSource).toContain(
'!props.hasPaidFeatures && !props.trialEnded ? getInactiveProUpsellNotice() : null;',
);
+ expect(proLicensePlanSectionSource).toContain(
+ 'monitoredSystemUpgradeArrivalTitle',
+ );
+ expect(proLicensePlanSectionSource).toContain("getUpgradeActionDestination('max_monitored_systems')");
expect(proLicensePlanSectionSource).not.toContain('Your Pro trial has ended');
expect(proLicensePlanSectionSource).not.toContain('Unlock Pulse Patrol, alert analysis, auto-fix, and more.');
expect(selfHostedCommercialActivationSectionSource).toContain(
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index de8cf15bc7..c4ae3644ec 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -517,8 +517,10 @@ describe('Settings architecture guardrails', () => {
expect(settingsNavigationModelSource).toContain('export function resolveCanonicalSettingsPath');
expect(settingsNavigationModelSource).toContain('export function settingsTabPath');
expect(settingsNavigationModelSource).toContain('return INFRASTRUCTURE_INSTALL_PREFIX;');
+ expect(settingsNavigationModelSource).toContain('SELF_HOSTED_PRO_BILLING_PLAN_ROUTE');
expect(settingsNavigationHookSource).toContain('deriveTabFromPath');
expect(settingsNavigationHookSource).toContain('resolveCanonicalSettingsPath');
+ expect(settingsNavigationHookSource).toContain('resolveCanonicalSelfHostedBillingHref');
expect(settingsNavigationHookSource).toContain('settingsTabPath');
expect(settingsRoutingSource).toContain("from './settingsNavigationModel'");
expect(settingsTypesSource).toContain("from './settingsNavigationModel'");
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsNavigation.integration.test.tsx b/frontend-modern/src/components/Settings/__tests__/settingsNavigation.integration.test.tsx
index 62574fe411..a2058d81c8 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsNavigation.integration.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/settingsNavigation.integration.test.tsx
@@ -14,7 +14,7 @@ const canonicalTabPaths = {
'system-recovery': '/settings/system-recovery',
'system-ai': '/settings/system-ai',
'system-relay': '/settings/system-relay',
- 'system-billing': '/settings/system/billing',
+ 'system-billing': '/settings/system/billing/plan',
'organization-overview': '/settings/organization',
'organization-access': '/settings/organization/access',
'organization-billing': '/settings/organization/billing',
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsRouting.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsRouting.test.ts
index bd6678a6d1..b927a43280 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsRouting.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsRouting.test.ts
@@ -24,7 +24,7 @@ const canonicalTabPaths = {
'system-recovery': '/settings/system-recovery',
'system-ai': '/settings/system-ai',
'system-relay': '/settings/system-relay',
- 'system-billing': '/settings/system/billing',
+ 'system-billing': '/settings/system/billing/plan',
'organization-overview': '/settings/organization',
'organization-access': '/settings/organization/access',
'organization-billing': '/settings/organization/billing',
@@ -92,7 +92,12 @@ describe('settingsNavigationModel', () => {
expect(resolveCanonicalSettingsPath('/settings/integrations/api')).toBe(
'/settings/security/api',
);
- expect(resolveCanonicalSettingsPath('/settings/system-pro')).toBe('/settings/system/billing');
+ expect(resolveCanonicalSettingsPath('/settings/system/billing')).toBe(
+ '/settings/system/billing/plan',
+ );
+ expect(resolveCanonicalSettingsPath('/settings/system-pro')).toBe(
+ '/settings/system/billing/plan',
+ );
expect(resolveCanonicalSettingsPath('/not-settings')).toBeNull();
});
@@ -108,6 +113,11 @@ describe('settingsNavigationModel', () => {
}
});
+ it('maps plan and usage billing subroutes back to the billing tab', () => {
+ expect(deriveTabFromPath('/settings/system/billing/plan')).toBe('system-billing');
+ expect(deriveTabFromPath('/settings/system/billing/usage')).toBe('system-billing');
+ });
+
it('maps query deep-links contract values', () => {
const queryCases: Array<[string, SettingsTab | null]> = [
['?tab=infrastructure', 'infrastructure-operations'],
diff --git a/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts b/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts
index 0fc7524914..8c03e7cf91 100644
--- a/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts
+++ b/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts
@@ -10,6 +10,9 @@ export interface SelfHostedProBillingPresentation {
planSectionTitle: string;
planSectionDescription: string;
usageSectionTitle: string;
+ monitoredSystemUpgradeArrivalTitle: string;
+ monitoredSystemUpgradeArrivalBody: string;
+ monitoredSystemUpgradeArrivalActionLabel: string;
}
export const SELF_HOSTED_PRO_BILLING_PRESENTATION: SelfHostedProBillingPresentation = {
@@ -26,4 +29,8 @@ export const SELF_HOSTED_PRO_BILLING_PRESENTATION: SelfHostedProBillingPresentat
planSectionTitle: 'Plan',
planSectionDescription: 'Review your active plan, expiry, included limits, and paid capabilities.',
usageSectionTitle: 'Usage',
+ monitoredSystemUpgradeArrivalTitle: 'Need a higher monitored-system cap?',
+ monitoredSystemUpgradeArrivalBody:
+ 'Compare plans on the public pricing site, then activate the new Pulse Pro license key here once you purchase it.',
+ monitoredSystemUpgradeArrivalActionLabel: 'Compare plans',
};
diff --git a/frontend-modern/src/components/Settings/settingsNavigationModel.ts b/frontend-modern/src/components/Settings/settingsNavigationModel.ts
index 5c95563935..49b5e6bc69 100644
--- a/frontend-modern/src/components/Settings/settingsNavigationModel.ts
+++ b/frontend-modern/src/components/Settings/settingsNavigationModel.ts
@@ -2,6 +2,10 @@ import type { Component } from 'solid-js';
import type { SecurityStatusSettingsCapabilities } from '@/types/config';
import { normalizeSourcePlatformKey } from '@/utils/sourcePlatforms';
import type { PlatformType } from '@/types/resource';
+import {
+ SELF_HOSTED_PRO_BILLING_PLAN_ROUTE,
+ SELF_HOSTED_PRO_BILLING_ROUTE,
+} from '@/utils/pricingHandoff';
export type SettingsTab =
| 'proxmox'
@@ -79,7 +83,7 @@ const LEGACY_PROXMOX_PREFIX = '/settings/infrastructure/proxmox';
const LEGACY_PROXMOX_API_PREFIX = '/settings/infrastructure/api';
const LEGACY_INTEGRATIONS_API_PREFIX = '/settings/integrations/api';
const SECURITY_API_PREFIX = '/settings/security/api';
-const SYSTEM_BILLING_PREFIX = '/settings/system/billing';
+const SYSTEM_BILLING_PREFIX = SELF_HOSTED_PRO_BILLING_ROUTE;
const LEGACY_SYSTEM_PRO_PREFIX = '/settings/system-pro';
const PROXMOX_AGENT_META: Record<
@@ -177,8 +181,11 @@ export function resolveCanonicalSettingsPath(path: string): string | null {
if (normalizedPath === LEGACY_INTEGRATIONS_API_PREFIX) {
return SECURITY_API_PREFIX;
}
+ if (normalizedPath === SYSTEM_BILLING_PREFIX) {
+ return SELF_HOSTED_PRO_BILLING_PLAN_ROUTE;
+ }
if (normalizedPath === LEGACY_SYSTEM_PRO_PREFIX) {
- return SYSTEM_BILLING_PREFIX;
+ return SELF_HOSTED_PRO_BILLING_PLAN_ROUTE;
}
return normalizedPath;
}
@@ -355,7 +362,7 @@ export function settingsTabPath(tab: SettingsTab): string {
case 'system-relay':
return '/settings/system-relay';
case 'system-billing':
- return SYSTEM_BILLING_PREFIX;
+ return SELF_HOSTED_PRO_BILLING_PLAN_ROUTE;
default:
return `/settings/${tab}`;
}
diff --git a/frontend-modern/src/components/Settings/useProLicensePanelState.ts b/frontend-modern/src/components/Settings/useProLicensePanelState.ts
index 6b575028da..16fdf59f73 100644
--- a/frontend-modern/src/components/Settings/useProLicensePanelState.ts
+++ b/frontend-modern/src/components/Settings/useProLicensePanelState.ts
@@ -19,19 +19,18 @@ import {
isDisplayableLicenseFeature,
} from '@/utils/licensePresentation';
import {
- SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID,
- SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID,
+ getSelfHostedBillingPlanIntent,
+ getSelfHostedBillingUsageDetail,
+ resolveSelfHostedBillingSection,
+ SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL,
+ SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT,
+ SELF_HOSTED_PRO_BILLING_PLAN_ROUTE,
+ SELF_HOSTED_PRO_BILLING_USAGE_ROUTE,
+ type SelfHostedBillingSection,
} from '@/utils/pricingHandoff';
import { buildSelfHostedCommercialPlanModel } from '@/utils/commercialBillingModel';
import { runStartProTrialAction } from '@/utils/trialStartAction';
-const SELF_HOSTED_PRO_BILLING_SECTION_IDS = new Set([
- SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID,
- SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID,
-]);
-
-export type SelfHostedBillingSection = 'plan' | 'usage';
-
const formatDate = (value?: string | null) => {
if (!value) return 'Not available';
const date = new Date(value);
@@ -81,27 +80,30 @@ export function useProLicensePanelState() {
});
const activeSection = createMemo<SelfHostedBillingSection>(() => {
- const hash = location.hash?.trim();
- const sectionId = hash?.startsWith('#') ? hash.slice(1) : '';
- if (sectionId === SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID) {
- return 'usage';
- }
- return 'plan';
+ return resolveSelfHostedBillingSection(location.pathname, location.search, location.hash);
});
const setActiveSection = (section: SelfHostedBillingSection) => {
- const sectionId =
+ const nextPath =
section === 'usage'
- ? SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID
- : SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID;
- if (!SELF_HOSTED_PRO_BILLING_SECTION_IDS.has(sectionId)) {
- return;
- }
-
- const nextPath = `${location.pathname}${location.search}${`#${sectionId}`}`;
+ ? SELF_HOSTED_PRO_BILLING_USAGE_ROUTE
+ : SELF_HOSTED_PRO_BILLING_PLAN_ROUTE;
navigate(nextPath, { replace: false, scroll: false });
};
+ const showMonitoredSystemUpgradeArrival = createMemo(
+ () =>
+ activeSection() === 'plan' &&
+ getSelfHostedBillingPlanIntent(location.search) ===
+ SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT,
+ );
+ const showCountingRulesByDefault = createMemo(
+ () =>
+ activeSection() === 'usage' &&
+ getSelfHostedBillingUsageDetail(location.search) ===
+ SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL,
+ );
+
const showTrialStart = createMemo(() => {
const current = entitlements();
if (!current) return false;
@@ -308,6 +310,8 @@ export function useProLicensePanelState() {
looksLikeLegacyLicenseKey,
setActiveSection,
setLicenseKey,
+ showCountingRulesByDefault,
+ showMonitoredSystemUpgradeArrival,
showTrialStart,
startingTrial,
statusPresentation,
diff --git a/frontend-modern/src/components/Settings/useSettingsNavigation.ts b/frontend-modern/src/components/Settings/useSettingsNavigation.ts
index 24deb1d169..fea81734e2 100644
--- a/frontend-modern/src/components/Settings/useSettingsNavigation.ts
+++ b/frontend-modern/src/components/Settings/useSettingsNavigation.ts
@@ -1,4 +1,5 @@
import { createEffect, createSignal, on } from 'solid-js';
+import { resolveCanonicalSelfHostedBillingHref } from '@/utils/pricingHandoff';
import {
DEFAULT_SETTINGS_TAB,
deriveAgentFromPath,
@@ -14,6 +15,7 @@ import {
type SettingsDispatchableTab = Exclude<SettingsTab, 'proxmox'>;
type SettingsLocation = {
+ hash: string;
pathname: string;
search: string;
};
@@ -71,8 +73,8 @@ export function useSettingsNavigation({ navigate, location }: UseSettingsNavigat
// Keep tab state in sync with canonical URLs, while preserving old deep links as aliases.
createEffect(
on(
- () => [location.pathname, location.search] as const,
- ([path, search]) => {
+ () => [location.pathname, location.search, location.hash] as const,
+ ([path, search, hash]) => {
if (path === '/settings' || path === '/settings/') {
const queryTab = deriveTabFromQuery(search);
const resolvedTab = queryTab ?? DEFAULT_SETTINGS_TAB;
@@ -93,6 +95,16 @@ export function useSettingsNavigation({ navigate, location }: UseSettingsNavigat
return;
}
+ const currentHref = `${path}${search}${hash}`;
+ const canonicalBillingHref = resolveCanonicalSelfHostedBillingHref(path, search, hash);
+ if (canonicalBillingHref && canonicalBillingHref !== currentHref) {
+ navigate(canonicalBillingHref, {
+ replace: true,
+ scroll: false,
+ });
+ return;
+ }
+
const canonicalPath = resolveCanonicalSettingsPath(path);
if (canonicalPath && canonicalPath !== path) {
navigate(canonicalPath, {
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 5fa762fe91..d10302ede7 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -667,10 +667,10 @@ describe('shared primitive guardrails', () => {
expect(monitoredSystemLimitWarningBannerStateSource).toContain('trackUpgradeMetricEvent');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('legacyConnections');
expect(monitoredSystemLimitWarningBannerStateSource).toContain(
- 'anchorSelfHostedBillingDestination',
+ 'scopeSelfHostedBillingDestination',
);
expect(monitoredSystemLimitWarningBannerStateSource).toContain(
- 'SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID',
+ 'SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT',
);
expect(monitoredSystemLimitWarningBannerStateSource).toContain('handleUpgradeClick');
expect(monitoredSystemLimitWarningBannerStateSource).not.toContain("fetch('/api/health'");
@@ -688,7 +688,7 @@ describe('shared primitive guardrails', () => {
'getMonitoredSystemLimitInstallCollectorsLabel',
);
expect(monitoredSystemLimitWarningBannerModelSource).toContain(
- 'SELF_HOSTED_PRO_BILLING_USAGE_HREF',
+ 'SELF_HOSTED_PRO_BILLING_USAGE_COUNTING_RULES_HREF',
);
});
diff --git a/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx b/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx
index 37f65cc826..647537e025 100644
--- a/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx
@@ -78,7 +78,9 @@ describe('MonitoredSystemLimitWarningBanner', () => {
href: '/settings/system/billing',
external: false,
});
- mockGetUpgradeActionUrlOrFallback.mockReturnValue('/settings/system/billing#pulse-pro-plan');
+ mockGetUpgradeActionUrlOrFallback.mockReturnValue(
+ '/settings/system/billing/plan?intent=max_monitored_systems',
+ );
});
afterEach(() => {
@@ -108,6 +110,10 @@ describe('MonitoredSystemLimitWarningBanner', () => {
expect(monitoredSystemLimitWarningBannerStateSource).toContain('demoModeEnabled');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('trackUpgradeMetricEvent');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('legacyConnections');
+ expect(monitoredSystemLimitWarningBannerStateSource).toContain('scopeSelfHostedBillingDestination');
+ expect(monitoredSystemLimitWarningBannerStateSource).toContain(
+ 'SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT',
+ );
expect(monitoredSystemLimitWarningBannerStateSource).toContain('handleUpgradeClick');
expect(monitoredSystemLimitWarningBannerModelSource).toContain(
@@ -172,12 +178,12 @@ describe('MonitoredSystemLimitWarningBanner', () => {
expect(screen.getByText('Monitored systems: 5/6')).toBeInTheDocument();
expect(screen.getByText('Learn more')).toHaveAttribute(
'href',
- '/settings/system/billing#pulse-pro-usage',
+ '/settings/system/billing/usage?details=counting-rules',
);
expect(screen.getByText('Upgrade to add more')).toBeInTheDocument();
expect(screen.getByText('Upgrade to add more')).toHaveAttribute(
'href',
- '/settings/system/billing#pulse-pro-plan',
+ '/settings/system/billing/plan?intent=max_monitored_systems',
);
expect(screen.queryByText('Install v6 collectors')).not.toBeInTheDocument();
});
@@ -211,11 +217,11 @@ describe('MonitoredSystemLimitWarningBanner', () => {
).toBeInTheDocument();
expect(screen.getByText('Learn more')).toHaveAttribute(
'href',
- '/settings/system/billing#pulse-pro-usage',
+ '/settings/system/billing/usage?details=counting-rules',
);
expect(screen.getByText('Upgrade to add more')).toHaveAttribute(
'href',
- '/settings/system/billing#pulse-pro-plan',
+ '/settings/system/billing/plan?intent=max_monitored_systems',
);
});
diff --git a/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts b/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts
index 71e7a0fd0a..20c689520f 100644
--- a/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts
+++ b/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts
@@ -8,7 +8,7 @@ import {
getMonitoredSystemLimitUpgradeLabel,
type MonitoredSystemLegacyConnectionCounts,
} from '@/utils/monitoredSystemPresentation';
-import { SELF_HOSTED_PRO_BILLING_USAGE_HREF } from '@/utils/pricingHandoff';
+import { SELF_HOSTED_PRO_BILLING_USAGE_COUNTING_RULES_HREF } from '@/utils/pricingHandoff';
type LimitState = {
current: number;
@@ -17,7 +17,8 @@ type LimitState = {
};
export const MONITORED_SYSTEM_LIMIT_KEY = 'max_monitored_systems';
-export const MONITORED_SYSTEM_LIMIT_LEARN_MORE_HREF = SELF_HOSTED_PRO_BILLING_USAGE_HREF;
+export const MONITORED_SYSTEM_LIMIT_LEARN_MORE_HREF =
+ SELF_HOSTED_PRO_BILLING_USAGE_COUNTING_RULES_HREF;
export const MONITORED_SYSTEM_LIMIT_INSTALL_COLLECTORS_HREF = '/settings';
export const MONITORED_SYSTEM_LIMIT_LEARN_MORE_LABEL = getMonitoredSystemLimitLearnMoreLabel();
export const MONITORED_SYSTEM_LIMIT_INSTALL_COLLECTORS_LABEL =
diff --git a/frontend-modern/src/components/shared/useMonitoredSystemLimitWarningBannerState.ts b/frontend-modern/src/components/shared/useMonitoredSystemLimitWarningBannerState.ts
index 7fcd5b8dd5..c2bfdfe0d5 100644
--- a/frontend-modern/src/components/shared/useMonitoredSystemLimitWarningBannerState.ts
+++ b/frontend-modern/src/components/shared/useMonitoredSystemLimitWarningBannerState.ts
@@ -10,8 +10,8 @@ import {
} from '@/stores/license';
import { resolveUpgradeDestination } from '@/utils/upgradeNavigation';
import {
- anchorSelfHostedBillingDestination,
- SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID,
+ scopeSelfHostedBillingDestination,
+ SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT,
} from '@/utils/pricingHandoff';
import {
trackUpgradeClicked,
@@ -63,9 +63,12 @@ export function useMonitoredSystemLimitWarningBannerState() {
resolveUpgradeDestination(MONITORED_SYSTEM_LIMIT_INSTALL_COLLECTORS_HREF),
);
const upgradeDestination = createMemo(() =>
- anchorSelfHostedBillingDestination(
+ scopeSelfHostedBillingDestination(
getUpgradeActionDestination(MONITORED_SYSTEM_LIMIT_KEY),
- SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID,
+ 'plan',
+ {
+ intent: SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT,
+ },
),
);
diff --git a/frontend-modern/src/pages/__tests__/PricingHandoff.test.tsx b/frontend-modern/src/pages/__tests__/PricingHandoff.test.tsx
index 6c8b0f09b0..e5b2302d97 100644
--- a/frontend-modern/src/pages/__tests__/PricingHandoff.test.tsx
+++ b/frontend-modern/src/pages/__tests__/PricingHandoff.test.tsx
@@ -60,7 +60,10 @@ describe('PricingHandoff', () => {
render(() => (
<Router>
<Route path="/pricing" component={PricingHandoff} />
- <Route path="/settings/system/billing" component={() => <div>Billing destination</div>} />
+ <Route
+ path="/settings/system/billing/plan"
+ component={() => <div>Billing destination</div>}
+ />
</Router>
));
diff --git a/frontend-modern/src/stores/__tests__/license.test.ts b/frontend-modern/src/stores/__tests__/license.test.ts
index a0acfc89c4..73d0a8eca3 100644
--- a/frontend-modern/src/stores/__tests__/license.test.ts
+++ b/frontend-modern/src/stores/__tests__/license.test.ts
@@ -318,14 +318,14 @@ describe('license store', () => {
);
});
- it('routes monitored-system limit fallbacks to billing usage', async () => {
+ it('routes monitored-system limit fallbacks to the billing upgrade arrival', async () => {
vi.mocked(LicenseAPI.getEntitlements).mockResolvedValue({
...mockProEntitlements,
upgrade_reasons: [{ key: 'reason1', reason: 'Reason 1', action_url: '/upgrade/reason1' }],
});
await loadLicenseStatus(true);
expect(getUpgradeActionUrlOrFallback('max_monitored_systems')).toBe(
- '/settings/system/billing#pulse-pro-plan',
+ '/settings/system/billing/plan?intent=max_monitored_systems',
);
});
diff --git a/frontend-modern/src/utils/__tests__/pricingHandoff.test.ts b/frontend-modern/src/utils/__tests__/pricingHandoff.test.ts
index 5a60dc31a3..265e4b46b9 100644
--- a/frontend-modern/src/utils/__tests__/pricingHandoff.test.ts
+++ b/frontend-modern/src/utils/__tests__/pricingHandoff.test.ts
@@ -1,18 +1,28 @@
import { describe, expect, it } from 'vitest';
import {
- anchorSelfHostedBillingDestination,
+ getSelfHostedBillingHref,
+ getSelfHostedBillingPlanIntent,
+ getSelfHostedBillingUsageDetail,
getPricingRouteDestination,
getPublicPricingUrl,
getUpgradeFallbackDestination,
isExternalPricingDestination,
+ resolveCanonicalSelfHostedBillingHref,
+ resolveSelfHostedBillingSection,
+ scopeSelfHostedBillingDestination,
+ SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL,
SELF_HOSTED_PRO_BILLING_PLAN_HREF,
+ SELF_HOSTED_PRO_BILLING_PLAN_MONITORED_SYSTEM_UPGRADE_HREF,
+ SELF_HOSTED_PRO_BILLING_ROUTE,
+ SELF_HOSTED_PRO_BILLING_USAGE_COUNTING_RULES_HREF,
SELF_HOSTED_PRO_BILLING_USAGE_HREF,
+ SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT,
} from '@/utils/pricingHandoff';
describe('pricingHandoff', () => {
it('routes product-owned monitored-system pricing links to billing', () => {
expect(getUpgradeFallbackDestination('max_monitored_systems')).toBe(
- SELF_HOSTED_PRO_BILLING_PLAN_HREF,
+ SELF_HOSTED_PRO_BILLING_PLAN_MONITORED_SYSTEM_UPGRADE_HREF,
);
});
@@ -40,36 +50,77 @@ describe('pricingHandoff', () => {
it('keeps internal route exceptions when handing off the legacy pricing route', () => {
expect(getPricingRouteDestination('?feature=max_monitored_systems')).toBe(
+ SELF_HOSTED_PRO_BILLING_PLAN_MONITORED_SYSTEM_UPGRADE_HREF,
+ );
+ });
+
+ it('resolves canonical billing hrefs for owned plan and usage states', () => {
+ expect(
+ getSelfHostedBillingHref('usage', {
+ detail: SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL,
+ }),
+ ).toBe(SELF_HOSTED_PRO_BILLING_USAGE_COUNTING_RULES_HREF);
+ expect(
+ getSelfHostedBillingHref('plan', {
+ intent: SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT,
+ }),
+ ).toBe(SELF_HOSTED_PRO_BILLING_PLAN_MONITORED_SYSTEM_UPGRADE_HREF);
+ });
+
+ it('canonicalizes legacy self-hosted billing aliases to route-owned states', () => {
+ expect(
+ resolveCanonicalSelfHostedBillingHref(
+ SELF_HOSTED_PRO_BILLING_ROUTE,
+ '',
+ '#pulse-pro-usage',
+ ),
+ ).toBe(SELF_HOSTED_PRO_BILLING_USAGE_HREF);
+ expect(resolveCanonicalSelfHostedBillingHref(SELF_HOSTED_PRO_BILLING_ROUTE)).toBe(
SELF_HOSTED_PRO_BILLING_PLAN_HREF,
);
});
- it('anchors in-product billing destinations to the requested section when no hash exists', () => {
+ it('derives billing focus and arrival intent from canonical routes', () => {
+ expect(resolveSelfHostedBillingSection(SELF_HOSTED_PRO_BILLING_USAGE_HREF)).toBe('usage');
+ expect(resolveSelfHostedBillingSection(SELF_HOSTED_PRO_BILLING_PLAN_HREF)).toBe('plan');
+ expect(
+ getSelfHostedBillingUsageDetail(
+ '?details=' + SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL,
+ ),
+ ).toBe(SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL);
expect(
- anchorSelfHostedBillingDestination(
- { href: '/settings/system/billing', external: false },
- 'pulse-pro-usage',
+ getSelfHostedBillingPlanIntent(
+ '?intent=' + SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT,
+ ),
+ ).toBe(SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT);
+ });
+
+ it('scopes in-product billing destinations to canonical routes and leaves external ones alone', () => {
+ expect(
+ scopeSelfHostedBillingDestination(
+ { href: SELF_HOSTED_PRO_BILLING_ROUTE, external: false },
+ 'usage',
+ { detail: SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL },
),
).toEqual({
- href: SELF_HOSTED_PRO_BILLING_USAGE_HREF,
+ href: SELF_HOSTED_PRO_BILLING_USAGE_COUNTING_RULES_HREF,
external: false,
});
- });
-
- it('keeps anchored or external destinations unchanged when scoping billing sections', () => {
expect(
- anchorSelfHostedBillingDestination(
+ scopeSelfHostedBillingDestination(
{ href: SELF_HOSTED_PRO_BILLING_PLAN_HREF, external: false },
- 'pulse-pro-usage',
+ 'plan',
+ { intent: SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT },
),
).toEqual({
- href: SELF_HOSTED_PRO_BILLING_PLAN_HREF,
+ href: SELF_HOSTED_PRO_BILLING_PLAN_MONITORED_SYSTEM_UPGRADE_HREF,
external: false,
});
expect(
- anchorSelfHostedBillingDestination(
+ scopeSelfHostedBillingDestination(
{ href: getPublicPricingUrl('relay'), external: true },
- 'pulse-pro-usage',
+ 'usage',
+ { detail: SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL },
),
).toEqual({
href: getPublicPricingUrl('relay'),
diff --git a/frontend-modern/src/utils/pricingHandoff.ts b/frontend-modern/src/utils/pricingHandoff.ts
index df2fc1f415..49a7592d05 100644
--- a/frontend-modern/src/utils/pricingHandoff.ts
+++ b/frontend-modern/src/utils/pricingHandoff.ts
@@ -7,18 +7,66 @@ const DEFAULT_PUBLIC_PRICING_URL =
'https://pulserelay.pro/pricing?utm_source=pulse&utm_medium=app&utm_campaign=upgrade';
export const SELF_HOSTED_PRO_BILLING_ROUTE = '/settings/system/billing';
+export const SELF_HOSTED_PRO_BILLING_PLAN_ROUTE = `${SELF_HOSTED_PRO_BILLING_ROUTE}/plan`;
+export const SELF_HOSTED_PRO_BILLING_USAGE_ROUTE = `${SELF_HOSTED_PRO_BILLING_ROUTE}/usage`;
export const SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID = 'pulse-pro-plan';
export const SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID = 'pulse-pro-usage';
-export const SELF_HOSTED_PRO_BILLING_PLAN_HREF = `${SELF_HOSTED_PRO_BILLING_ROUTE}#${SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID}`;
-export const SELF_HOSTED_PRO_BILLING_USAGE_HREF = `${SELF_HOSTED_PRO_BILLING_ROUTE}#${SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID}`;
+export const SELF_HOSTED_PRO_BILLING_USAGE_DETAILS_QUERY_PARAM = 'details';
+export const SELF_HOSTED_PRO_BILLING_PLAN_INTENT_QUERY_PARAM = 'intent';
+export const SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL = 'counting-rules';
+export const SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT = 'max_monitored_systems';
+
+export type SelfHostedBillingSection = 'plan' | 'usage';
+export type SelfHostedBillingUsageDetail =
+ typeof SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL;
+export type SelfHostedBillingPlanIntent =
+ typeof SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT;
+
+export const SELF_HOSTED_PRO_BILLING_PLAN_HREF = SELF_HOSTED_PRO_BILLING_PLAN_ROUTE;
+export const SELF_HOSTED_PRO_BILLING_USAGE_HREF = SELF_HOSTED_PRO_BILLING_USAGE_ROUTE;
+export const SELF_HOSTED_PRO_BILLING_USAGE_COUNTING_RULES_HREF =
+ `${SELF_HOSTED_PRO_BILLING_USAGE_ROUTE}?${SELF_HOSTED_PRO_BILLING_USAGE_DETAILS_QUERY_PARAM}=${SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL}`;
+export const SELF_HOSTED_PRO_BILLING_PLAN_MONITORED_SYSTEM_UPGRADE_HREF =
+ `${SELF_HOSTED_PRO_BILLING_PLAN_ROUTE}?${SELF_HOSTED_PRO_BILLING_PLAN_INTENT_QUERY_PARAM}=${SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT}`;
const IN_PRODUCT_PRICING_DESTINATIONS: Record<string, string> = {
- max_monitored_systems: SELF_HOSTED_PRO_BILLING_PLAN_HREF,
+ max_monitored_systems: SELF_HOSTED_PRO_BILLING_PLAN_MONITORED_SYSTEM_UPGRADE_HREF,
cloud: '/cloud',
};
const INTERNAL_HREF_BASE = 'https://pulse.invalid';
+function normalizeSettingsLikePath(pathname: string): string {
+ const normalized = pathname.trim();
+ if (!normalized) return pathname;
+ if (normalized.length > 1 && normalized.endsWith('/')) {
+ return normalized.replace(/\/+$/, '');
+ }
+ return normalized;
+}
+
+function normalizeSearch(search: string): string {
+ return search.startsWith('?') ? search.slice(1) : search;
+}
+
+function normalizeHash(hash: string): string {
+ const normalized = hash.trim();
+ return normalized.startsWith('#') ? normalized.slice(1) : normalized;
+}
+
+function billingSearch(search: string): URLSearchParams {
+ return new URLSearchParams(normalizeSearch(search));
+}
+
+function isSelfHostedBillingPath(pathname: string): boolean {
+ const normalized = normalizeSettingsLikePath(pathname);
+ return (
+ normalized === SELF_HOSTED_PRO_BILLING_ROUTE ||
+ normalized === SELF_HOSTED_PRO_BILLING_PLAN_ROUTE ||
+ normalized === SELF_HOSTED_PRO_BILLING_USAGE_ROUTE
+ );
+}
+
function normalizeFeatureKey(feature: string | null | undefined): string | undefined {
const normalized = feature?.trim();
return normalized ? normalized : undefined;
@@ -45,28 +93,128 @@ export function getUpgradeFallbackDestination(feature?: string | null): string {
return getInProductPricingDestination(feature) || getPublicPricingUrl(feature);
}
-export function anchorSelfHostedBillingDestination(
+export function getSelfHostedBillingUsageDetail(
+ search: string,
+): SelfHostedBillingUsageDetail | null {
+ const detail = billingSearch(search)
+ .get(SELF_HOSTED_PRO_BILLING_USAGE_DETAILS_QUERY_PARAM)
+ ?.trim();
+ return detail === SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL ? detail : null;
+}
+
+export function getSelfHostedBillingPlanIntent(
+ search: string,
+): SelfHostedBillingPlanIntent | null {
+ const intent = billingSearch(search)
+ .get(SELF_HOSTED_PRO_BILLING_PLAN_INTENT_QUERY_PARAM)
+ ?.trim();
+ return intent === SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT ? intent : null;
+}
+
+export function getSelfHostedBillingHref(
+ section: SelfHostedBillingSection,
+ options: {
+ detail?: SelfHostedBillingUsageDetail | null;
+ intent?: SelfHostedBillingPlanIntent | null;
+ } = {},
+): string {
+ const baseRoute =
+ section === 'usage'
+ ? SELF_HOSTED_PRO_BILLING_USAGE_ROUTE
+ : SELF_HOSTED_PRO_BILLING_PLAN_ROUTE;
+ const params = new URLSearchParams();
+
+ if (section === 'usage' && options.detail === SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL) {
+ params.set(
+ SELF_HOSTED_PRO_BILLING_USAGE_DETAILS_QUERY_PARAM,
+ SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL,
+ );
+ }
+
+ if (
+ section === 'plan' &&
+ options.intent === SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT
+ ) {
+ params.set(
+ SELF_HOSTED_PRO_BILLING_PLAN_INTENT_QUERY_PARAM,
+ SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT,
+ );
+ }
+
+ const search = params.toString();
+ return `${baseRoute}${search ? `?${search}` : ''}`;
+}
+
+export function resolveSelfHostedBillingSection(
+ pathname: string,
+ search = '',
+ hash = '',
+): SelfHostedBillingSection {
+ const normalizedPath = normalizeSettingsLikePath(pathname);
+
+ if (normalizedPath === SELF_HOSTED_PRO_BILLING_USAGE_ROUTE) {
+ return 'usage';
+ }
+ if (normalizedPath === SELF_HOSTED_PRO_BILLING_PLAN_ROUTE) {
+ return 'plan';
+ }
+ if (normalizedPath !== SELF_HOSTED_PRO_BILLING_ROUTE) {
+ return 'plan';
+ }
+
+ const normalizedHash = normalizeHash(hash);
+ if (normalizedHash === SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID) {
+ return 'usage';
+ }
+ if (normalizedHash === SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID) {
+ return 'plan';
+ }
+ if (getSelfHostedBillingUsageDetail(search) === SELF_HOSTED_PRO_BILLING_COUNTING_RULES_DETAIL) {
+ return 'usage';
+ }
+ return 'plan';
+}
+
+export function resolveCanonicalSelfHostedBillingHref(
+ pathname: string,
+ search = '',
+ hash = '',
+): string | null {
+ const normalizedPath = normalizeSettingsLikePath(pathname);
+ if (!isSelfHostedBillingPath(normalizedPath)) {
+ return null;
+ }
+
+ const section = resolveSelfHostedBillingSection(normalizedPath, search, hash);
+ const canonicalPath =
+ section === 'usage'
+ ? SELF_HOSTED_PRO_BILLING_USAGE_ROUTE
+ : SELF_HOSTED_PRO_BILLING_PLAN_ROUTE;
+ const normalizedSearch = normalizeSearch(search);
+
+ return `${canonicalPath}${normalizedSearch ? `?${normalizedSearch}` : ''}`;
+}
+
+export function scopeSelfHostedBillingDestination(
destination: UpgradeDestination,
- sectionId: string,
+ section: SelfHostedBillingSection,
+ options: {
+ detail?: SelfHostedBillingUsageDetail | null;
+ intent?: SelfHostedBillingPlanIntent | null;
+ } = {},
): UpgradeDestination {
if (destination.external) {
return destination;
}
- const normalizedSectionId = sectionId.trim();
- if (!normalizedSectionId) {
- return destination;
- }
-
const url = new URL(destination.href, INTERNAL_HREF_BASE);
- if (url.pathname !== SELF_HOSTED_PRO_BILLING_ROUTE || url.hash) {
+ if (!isSelfHostedBillingPath(url.pathname)) {
return destination;
}
- url.hash = normalizedSectionId;
return {
...destination,
- href: `${url.pathname}${url.search}${url.hash}`,
+ href: getSelfHostedBillingHref(section, options),
};
}
diff --git a/tests/integration/tests/54-monitored-system-billing-focus.spec.ts b/tests/integration/tests/54-monitored-system-billing-focus.spec.ts
new file mode 100644
index 0000000000..384966c3a4
--- /dev/null
+++ b/tests/integration/tests/54-monitored-system-billing-focus.spec.ts
@@ -0,0 +1,148 @@
+import { test, expect, type Page } from '@playwright/test';
+
+const DEV_SERVER_URL = 'http://127.0.0.1:5173';
+
+const MONITORED_SYSTEM_ENTITLEMENTS = {
+ capabilities: [],
+ limits: [{ key: 'max_monitored_systems', limit: 5, current: 16, state: 'enforced' }],
+ subscription_state: 'expired',
+ upgrade_reasons: [],
+ tier: 'free',
+ trial_eligible: false,
+ hosted_mode: false,
+ legacy_connections: {
+ proxmox_nodes: 0,
+ docker_hosts: 0,
+ kubernetes_clusters: 0,
+ },
+ has_migration_gap: false,
+ overflow_days_remaining: 14,
+};
+
+const MONITORED_SYSTEM_LEDGER = {
+ systems: [
+ {
+ name: 'edge-cluster',
+ type: 'cluster',
+ status: 'warning',
+ status_explanation: {
+ summary:
+ 'At least one included source has a warning state, so Pulse keeps this monitored system under review.',
+ reasons: [],
+ },
+ latest_included_signal: {
+ name: 'edge-cluster',
+ type: 'cluster',
+ source: 'kubernetes',
+ at: '2026-04-07T09:00:00Z',
+ },
+ source: 'kubernetes',
+ explanation: {
+ summary:
+ 'Counts as one monitored system because Pulse merged multiple top-level views into one canonical cluster.',
+ reasons: [],
+ surfaces: [{ name: 'edge-cluster', type: 'cluster', source: 'kubernetes' }],
+ },
+ },
+ ],
+ total: 16,
+ limit: 5,
+};
+
+async function configureMonitoredSystemBillingFixtures(page: Page) {
+ await page.addInitScript(() => {
+ localStorage.setItem('pulse_whats_new_v2_shown', 'true');
+ });
+
+ await page.route('**/api/security/status', async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({
+ hasAuthentication: true,
+ hideLocalLogin: false,
+ ssoProviders: [],
+ sessionCapabilities: {},
+ }),
+ });
+ });
+
+ await page.route('**/api/state', async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({ ok: true }),
+ });
+ });
+
+ await page.route('**/api/system/settings', async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({
+ theme: 'system',
+ fullWidthMode: false,
+ }),
+ });
+ });
+
+ await page.route('**/api/license/entitlements', async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify(MONITORED_SYSTEM_ENTITLEMENTS),
+ });
+ });
+
+ await page.route('**/api/license/monitored-system-ledger', async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify(MONITORED_SYSTEM_LEDGER),
+ });
+ });
+}
+
+async function openPageWithUrgentMonitoredSystemBanner(page: Page) {
+ await page.goto(`${DEV_SERVER_URL}/settings/system-general`, {
+ waitUntil: 'domcontentloaded',
+ });
+ await expect(
+ page.getByRole('status').filter({ hasText: 'Monitored systems: 16/5' }),
+ ).toBeVisible();
+}
+
+test.describe('Monitored-system billing focus', () => {
+ test('keeps Learn more and Upgrade arrivals distinct on the billing surface', async ({
+ page,
+ }, testInfo) => {
+ test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only billing navigation');
+
+ await configureMonitoredSystemBillingFixtures(page);
+ await openPageWithUrgentMonitoredSystemBanner(page);
+
+ const banner = page.getByRole('status').filter({ hasText: 'Monitored systems: 16/5' });
+
+ await banner.getByRole('link', { name: 'Learn more' }).click();
+ await page.waitForURL('**/settings/system/billing/usage?details=counting-rules');
+ await expect(page.getByRole('tab', { name: 'Usage' })).toHaveAttribute(
+ 'aria-selected',
+ 'true',
+ );
+ await expect(page.getByRole('button', { name: 'Hide counting rules' })).toBeVisible();
+
+ await openPageWithUrgentMonitoredSystemBanner(page);
+
+ await banner.getByRole('link', { name: 'Upgrade to add more' }).click();
+ await page.waitForURL('**/settings/system/billing/plan?intent=max_monitored_systems');
+ await expect(page.getByRole('tab', { name: 'Plan' })).toHaveAttribute(
+ 'aria-selected',
+ 'true',
+ );
+ await expect(page.getByText('Need a higher monitored-system cap?')).toBeVisible();
+ await expect(page.getByRole('link', { name: 'Compare plans' })).toHaveAttribute(
+ 'href',
+ 'https://pulserelay.pro/pricing?utm_source=pulse&utm_medium=app&utm_campaign=upgrade&feature=max_monitored_systems',
+ );
+ });
+});