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.

Split Pro license runtime owners

rcourtman5c96a36deb96
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 5a6253dd16..5a0691ed11 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -51,15 +51,17 @@ agreement, and cloud-specific enforcement rules.
29. `frontend-modern/src/components/Settings/OrganizationBillingPanel.tsx`
30. `frontend-modern/src/components/Settings/OrganizationBillingLoadingState.tsx`
31. `frontend-modern/src/components/Settings/ProLicensePanel.tsx`
-32. `frontend-modern/src/components/Settings/CommercialBillingSections.tsx`
-33. `frontend-modern/src/components/Settings/SelfHostedCommercialActivationSection.tsx`
-34. `frontend-modern/src/components/Settings/RelaySettingsPanel.tsx`
-35. `frontend-modern/src/components/Settings/RelayPairingSection.tsx`
-36. `frontend-modern/src/components/Settings/useOrganizationBillingPanelState.ts`
-37. `frontend-modern/src/components/Settings/useRelaySettingsPanelState.ts`
-38. `frontend-modern/src/pages/CloudPricing.tsx`
-39. `frontend-modern/src/utils/apiClient.ts`
-40. `frontend-modern/src/utils/commercialBillingModel.ts`
+32. `frontend-modern/src/components/Settings/ProLicensePlanSection.tsx`
+33. `frontend-modern/src/components/Settings/CommercialBillingSections.tsx`
+34. `frontend-modern/src/components/Settings/SelfHostedCommercialActivationSection.tsx`
+35. `frontend-modern/src/components/Settings/RelaySettingsPanel.tsx`
+36. `frontend-modern/src/components/Settings/RelayPairingSection.tsx`
+37. `frontend-modern/src/components/Settings/useOrganizationBillingPanelState.ts`
+38. `frontend-modern/src/components/Settings/useProLicensePanelState.ts`
+39. `frontend-modern/src/components/Settings/useRelaySettingsPanelState.ts`
+40. `frontend-modern/src/pages/CloudPricing.tsx`
+41. `frontend-modern/src/utils/apiClient.ts`
+42. `frontend-modern/src/utils/commercialBillingModel.ts`
## Shared Boundaries
@@ -83,7 +85,7 @@ agreement, and cloud-specific enforcement rules.
11. Add or change hosted billing-admin presentation through `frontend-modern/src/components/Settings/BillingAdminPanel.tsx`
12. Add or change shared commercial plan/usage presentation through `frontend-modern/src/components/Settings/CommercialBillingSections.tsx` and `frontend-modern/src/utils/commercialBillingModel.ts`
13. Add or change organization billing and usage presentation through `frontend-modern/src/components/Settings/OrganizationBillingPanel.tsx`, `frontend-modern/src/components/Settings/OrganizationBillingLoadingState.tsx`, and `frontend-modern/src/components/Settings/useOrganizationBillingPanelState.ts`
-14. Add or change self-hosted Pro activation, trial, and entitlement actions through `frontend-modern/src/components/Settings/ProLicensePanel.tsx` and `frontend-modern/src/components/Settings/SelfHostedCommercialActivationSection.tsx`
+14. Add or change self-hosted Pro activation, trial, and entitlement actions through `frontend-modern/src/components/Settings/ProLicensePanel.tsx`, `frontend-modern/src/components/Settings/ProLicensePlanSection.tsx`, `frontend-modern/src/components/Settings/SelfHostedCommercialActivationSection.tsx`, and `frontend-modern/src/components/Settings/useProLicensePanelState.ts`
15. Add or change paid relay settings and onboarding presentation through `frontend-modern/src/components/Settings/RelaySettingsPanel.tsx`, `frontend-modern/src/components/Settings/RelayPairingSection.tsx`, `frontend-modern/src/components/Settings/useRelaySettingsPanelState.ts`, and `frontend-modern/src/components/Dashboard/RelayOnboardingCard.tsx`
16. Add or change cloud plan presentation through `frontend-modern/src/pages/CloudPricing.tsx`
17. Add contract tests where runtime and pricing need to stay aligned
@@ -248,6 +250,14 @@ The Pro license settings surface now follows the same rule as well. Changes to
contract and the dedicated Pro-license proof file instead of remaining an
unowned consumer of activation, trial eligibility, entitlement capability, and
plan-term presentation.
+That owned Pro-license boundary is now intentionally split by role:
+`frontend-modern/src/components/Settings/ProLicensePanel.tsx` is the settings
+shell, `frontend-modern/src/components/Settings/useProLicensePanelState.ts`
+owns activation, trial, route-scoped notices, and commercial plan runtime
+state, and `frontend-modern/src/components/Settings/ProLicensePlanSection.tsx`
+owns the plan/read-model presentation. Future Pro-license work must extend
+that split instead of pulling route state, entitlement derivation, and retry
+lifecycle back into the shell component.
That owned presentation boundary includes the settings shell itself: the
top-level Pulse Pro surface must keep its page-shell title and leading
SettingsPanel title aligned so commercial activation, trial, and pricing state
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index 167cfc966b..00077b4474 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -1097,9 +1097,11 @@
"frontend-modern/src/components/Settings/OrganizationBillingLoadingState.tsx",
"frontend-modern/src/components/Settings/OrganizationBillingPanel.tsx",
"frontend-modern/src/components/Settings/ProLicensePanel.tsx",
+ "frontend-modern/src/components/Settings/ProLicensePlanSection.tsx",
"frontend-modern/src/components/Settings/RelayPairingSection.tsx",
"frontend-modern/src/components/Settings/RelaySettingsPanel.tsx",
"frontend-modern/src/components/Settings/useOrganizationBillingPanelState.ts",
+ "frontend-modern/src/components/Settings/useProLicensePanelState.ts",
"frontend-modern/src/components/Settings/useRelaySettingsPanelState.ts",
"frontend-modern/src/pages/CloudPricing.tsx",
"frontend-modern/src/pages/HostedSignup.tsx",
@@ -1518,7 +1520,9 @@
"label": "pro license surface proof",
"match_prefixes": [],
"match_files": [
- "frontend-modern/src/components/Settings/ProLicensePanel.tsx"
+ "frontend-modern/src/components/Settings/ProLicensePanel.tsx",
+ "frontend-modern/src/components/Settings/ProLicensePlanSection.tsx",
+ "frontend-modern/src/components/Settings/useProLicensePanelState.ts"
],
"allow_same_subsystem_tests": false,
"test_prefixes": [],
diff --git a/frontend-modern/src/components/Settings/ProLicensePanel.tsx b/frontend-modern/src/components/Settings/ProLicensePanel.tsx
index 2fcdd73315..3cd84901f7 100644
--- a/frontend-modern/src/components/Settings/ProLicensePanel.tsx
+++ b/frontend-modern/src/components/Settings/ProLicensePanel.tsx
@@ -1,290 +1,14 @@
-import { Component, Show, createMemo, createSignal, onMount, For } from 'solid-js';
-import { useLocation } from '@solidjs/router';
-import { notificationStore } from '@/stores/notifications';
-import {
- getUpgradeActionUrlOrFallback,
- isMultiTenantEnabled,
- licenseLoadError,
- licenseStatus,
- loadLicenseStatus,
- startProTrial,
-} from '@/stores/license';
-import { LicenseAPI } from '@/api/license';
+import type { Component } from 'solid-js';
import RefreshCw from 'lucide-solid/icons/refresh-cw';
import ShieldCheck from 'lucide-solid/icons/shield-check';
-import {
- getProTrialStartedMessage,
- getTrialAlreadyUsedMessage,
- getTrialStartErrorMessage,
- getTrialTryAgainLaterMessage,
-} from '@/utils/upgradePresentation';
-import {
- formatLicensePlanVersion,
- getCommercialMigrationNotice,
- getGrandfatheredPriceContinuityNotice,
- getLicenseFeatureLabel,
- getLicenseStatusLoadingState,
- getLicenseSubscriptionStatusPresentation,
- getLicenseTierLabel,
- getNoActiveProLicenseState,
- getTrialActivationNotice,
-} from '@/utils/licensePresentation';
import { MonitoredSystemLedgerPanel } from './MonitoredSystemLedgerPanel';
-import {
- CommercialBillingShell,
- CommercialSection,
- CommercialStatGrid,
-} from './CommercialBillingSections';
-import { buildSelfHostedCommercialPlanModel } from '@/utils/commercialBillingModel';
+import { CommercialBillingShell, CommercialSection } from './CommercialBillingSections';
+import { ProLicensePlanSection } from './ProLicensePlanSection';
import { SelfHostedCommercialActivationSection } from './SelfHostedCommercialActivationSection';
-
-const formatDate = (value?: string | null) => {
- if (!value) return 'Not available';
- const date = new Date(value);
- if (Number.isNaN(date.getTime())) return value;
- return date.toLocaleDateString();
-};
-
-const formatUnixDate = (value?: number) => {
- if (typeof value !== 'number') return 'Not available';
- const date = new Date(value * 1000);
- if (Number.isNaN(date.getTime())) return 'Not available';
- return date.toLocaleDateString();
-};
+import { useProLicensePanelState } from './useProLicensePanelState';
export const ProLicensePanel: Component = () => {
- const location = useLocation();
- const [licenseKey, setLicenseKey] = createSignal('');
- const [loading, setLoading] = createSignal(false);
- const [activating, setActivating] = createSignal(false);
- const [clearing, setClearing] = createSignal(false);
- const [startingTrial, setStartingTrial] = createSignal(false);
- const entitlements = createMemo(() => licenseStatus());
-
- const subscriptionState = createMemo(() => entitlements()?.subscription_state);
- const showTrialStart = createMemo(() => {
- const current = entitlements();
- if (!current) return false;
- if (current.commercial_migration?.state) return false;
- if (typeof current.trial_eligible === 'boolean') {
- return current.trial_eligible;
- }
- const state = subscriptionState();
- return state !== 'active' && state !== 'trial';
- });
- const trialExpiryUnix = createMemo(() => entitlements()?.trial_expires_at);
- const trialDaysRemaining = createMemo(() => entitlements()?.trial_days_remaining);
-
- const loadPanelData = async () => {
- setLoading(true);
- await loadLicenseStatus(true);
- setLoading(false);
- };
-
- onMount(() => {
- void loadPanelData();
- });
-
- const handleStartTrial = async () => {
- if (startingTrial()) return;
- setStartingTrial(true);
- try {
- const result = await startProTrial();
- if (result?.outcome === 'redirect') {
- if (typeof window !== 'undefined') {
- window.location.href = result.actionUrl;
- }
- return;
- }
- // trial_started event is emitted by the backend handler (HandleStartTrial).
- notificationStore.success(getProTrialStartedMessage());
- } catch (err) {
- const error = err as { status?: number; code?: string; message?: string } | null;
- const statusCode = error?.status;
- if (statusCode === 409 && error?.code === 'trial_already_used') {
- notificationStore.error(getTrialAlreadyUsedMessage());
- } else if (statusCode === 429) {
- notificationStore.error(getTrialTryAgainLaterMessage());
- } else {
- notificationStore.error(
- getTrialStartErrorMessage(err instanceof Error ? err.message : undefined, {
- branded: true,
- }),
- );
- }
- } finally {
- setStartingTrial(false);
- }
- };
-
- const statusPresentation = createMemo(() =>
- getLicenseSubscriptionStatusPresentation(subscriptionState()),
- );
-
- const hasLicenseDetails = createMemo(() => {
- const current = entitlements();
- if (!current) return false;
- return Boolean(
- current.licensed_email ||
- current.expires_at ||
- current.trial_expires_at ||
- current.tier !== 'free',
- );
- });
-
- const formattedTier = createMemo(() => {
- const current = entitlements();
- if (!current) return 'Unknown';
- return getLicenseTierLabel(current.tier);
- });
-
- const formattedPlanTerms = createMemo(() => {
- return formatLicensePlanVersion(entitlements()?.plan_version);
- });
-
- const formattedFeatures = createMemo(() => {
- const current = entitlements();
- if (!current?.capabilities?.length) return [];
- return current.capabilities
- .filter((feature) => feature !== 'multi_tenant' || isMultiTenantEnabled())
- .map((feature) => getLicenseFeatureLabel(feature));
- });
-
- const displayedExpiry = createMemo(() => {
- const current = entitlements();
- if (current?.is_lifetime) return 'Never (Lifetime)';
- if (typeof current?.expires_at === 'string' && current.expires_at.length > 0) {
- return formatDate(current.expires_at);
- }
- if (subscriptionState() === 'trial') return formatUnixDate(trialExpiryUnix());
- return 'Not available';
- });
-
- const displayedDaysRemaining = createMemo(() => {
- const current = entitlements();
- if (current?.is_lifetime) return 'Unlimited';
- if (subscriptionState() === 'trial' && typeof trialDaysRemaining() === 'number') {
- return trialDaysRemaining();
- }
- if (typeof current?.expires_at === 'string' && typeof current.days_remaining === 'number') {
- return current.days_remaining;
- }
- return 'Unknown';
- });
-
- const looksLikeLegacyLicenseKey = createMemo(() => {
- const trimmed = licenseKey().trim();
- if (!trimmed || trimmed.startsWith('ppk_live_')) {
- return false;
- }
-
- const segments = trimmed.split('.');
- return segments.length === 3 && segments.every((segment) => segment.length > 0);
- });
-
- const limitStatus = (key: string) => {
- return entitlements()?.limits?.find((entry) => entry.key === key);
- };
-
- const monitoredSystemUsage = createMemo(() => limitStatus('max_monitored_systems')?.current ?? 0);
- const monitoredSystemLimit = createMemo(() => limitStatus('max_monitored_systems')?.limit ?? 0);
- const remainingSystemCapacity = createMemo(() => {
- const limit = monitoredSystemLimit();
- if (limit <= 0) return 'Unlimited';
- return Math.max(limit - monitoredSystemUsage(), 0);
- });
-
- const trialEnded = createMemo(
- () =>
- subscriptionState() === 'expired' &&
- entitlements()?.trial_eligibility_reason === 'already_used',
- );
-
- const trialActivationResult = createMemo(() => {
- const params = new URLSearchParams(location.search);
- return params.get('trial')?.trim().toLowerCase() ?? '';
- });
-
- const trialActivationNotice = createMemo(() => {
- return getTrialActivationNotice(trialActivationResult());
- });
-
- const commercialMigrationNotice = createMemo(() => {
- return getCommercialMigrationNotice(entitlements()?.commercial_migration);
- });
-
- const grandfatheredPriceNotice = createMemo(() => {
- return getGrandfatheredPriceContinuityNotice(
- entitlements()?.plan_version,
- entitlements()?.subscription_state,
- );
- });
-
- const hasPaidFeatures = createMemo(() => {
- const state = subscriptionState();
- return state === 'active' || state === 'trial' || state === 'grace';
- });
-
- const commercialPlanModel = createMemo(() =>
- buildSelfHostedCommercialPlanModel({
- licensedEmail: entitlements()?.licensed_email,
- statusLabel: statusPresentation().label,
- tierLabel: formattedTier(),
- planTerms: formattedPlanTerms() || undefined,
- expires: displayedExpiry(),
- daysRemaining: displayedDaysRemaining() ?? 'Unknown',
- monitoredSystems: monitoredSystemUsage(),
- monitoredSystemLimit: monitoredSystemLimit() > 0 ? monitoredSystemLimit() : undefined,
- remainingSystemCapacity: remainingSystemCapacity(),
- maxMonitoredSystems:
- typeof limitStatus('max_monitored_systems')?.limit === 'number' && limitStatus('max_monitored_systems')!.limit > 0
- ? limitStatus('max_monitored_systems')!.limit
- : 'Unlimited',
- maxGuests:
- typeof limitStatus('max_guests')?.limit === 'number' && limitStatus('max_guests')!.limit > 0
- ? limitStatus('max_guests')!.limit
- : 'Unlimited',
- }),
- );
-
- const handleActivate = async () => {
- const trimmedKey = licenseKey().trim();
- if (!trimmedKey) {
- notificationStore.error('A license key or activation key is required');
- return;
- }
- setActivating(true);
- try {
- const result = await LicenseAPI.activateLicense(trimmedKey);
- if (!result.success) {
- notificationStore.error(result.message || 'Failed to activate license');
- return;
- }
- notificationStore.success(result.message || 'License activated');
- setLicenseKey('');
- await loadPanelData();
- } catch (err) {
- notificationStore.error(err instanceof Error ? err.message : 'Failed to activate license');
- } finally {
- setActivating(false);
- }
- };
-
- const handleClear = async () => {
- if (!confirm('Clear the current Pro license?')) {
- return;
- }
- setClearing(true);
- try {
- const result = await LicenseAPI.clearLicense();
- notificationStore.success(result.message || 'License cleared');
- await loadPanelData();
- } catch (err) {
- notificationStore.error(err instanceof Error ? err.message : 'Failed to clear license');
- } finally {
- setClearing(false);
- }
- };
+ const state = useProLicensePanelState();
return (
<div class="space-y-6">
@@ -295,147 +19,34 @@ export const ProLicensePanel: Component = () => {
action={
<button
class="inline-flex min-h-10 sm:min-h-9 items-center gap-2 px-3 py-2 text-sm font-medium rounded-md border border-border text-base-content hover:bg-surface-hover transition-colors disabled:opacity-60"
- disabled={loading()}
- onClick={loadPanelData}
- >
- <RefreshCw class={`w-3.5 h-3.5 ${loading() ? 'animate-spin' : ''}`} />
+ disabled={state.loading()}
+ onClick={state.loadPanelData}
+ >
+ <RefreshCw class={`w-3.5 h-3.5 ${state.loading() ? 'animate-spin' : ''}`} />
Refresh
</button>
}
loading={false}
>
- <Show when={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={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={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>
<div class="space-y-6">
<CommercialSection
title="Plan"
description="Review your active plan, expiry, included limits, and paid capabilities."
>
- <Show when={trialEnded() && !licenseLoadError()}>
- <div class="mb-4 rounded-md border border-red-200 dark:border-red-900 bg-red-50 dark:bg-red-900 p-3 text-sm text-red-900 dark:text-red-100">
- <p class="font-medium">Your Pro trial has ended</p>
- <p class="text-xs text-red-800 dark:text-red-200 mt-1">Upgrade to keep Pro features.</p>
- <a
- class="inline-flex items-center gap-1 mt-2 text-xs font-medium text-red-900 dark:text-red-100 hover:underline"
- href={getUpgradeActionUrlOrFallback('trial_expired')}
- target="_blank"
- rel="noreferrer"
- >
- View Pro plans
- </a>
- </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={loading()}
- onClick={loadPanelData}
- >
- <RefreshCw class={`w-3 h-3 ${loading() ? 'animate-spin' : ''}`} />
- Retry
- </button>
- </div>
- </Show>
- <Show when={!licenseLoadError()}>
- <Show
- when={!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 ${statusPresentation().badgeClass}`}
- >
- {statusPresentation().label}
- </span>
- <Show when={entitlements()?.in_grace_period}>
- <span class="text-xs text-amber-700 dark:text-amber-300">
- Grace until {formatDate(entitlements()?.grace_period_end)}
- </span>
- </Show>
- </div>
-
- <Show
- when={hasLicenseDetails()}
- fallback={<div class="text-sm text-muted">{getNoActiveProLicenseState().text}</div>}
- >
- <CommercialStatGrid
- items={commercialPlanModel().summary}
- />
-
- <div class="grid gap-4 sm:grid-cols-2">
- <For each={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={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={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 when={!hasPaidFeatures() && !trialEnded()}>
- <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">Upgrade to Pro</p>
- <p class="text-xs text-amber-700 dark:text-amber-300 mt-1">
- Unlock Pulse Patrol, alert analysis, auto-fix, and more.
- </p>
- <a
- class="inline-flex items-center gap-1 mt-2 text-xs font-medium text-amber-800 dark:text-amber-200 hover:underline"
- href={getUpgradeActionUrlOrFallback('ai_autofix')}
- target="_blank"
- rel="noreferrer"
- >
- View Pro plans
- </a>
- </div>
- </Show>
- </Show>
- </Show>
+ <ProLicensePlanSection
+ commercialMigrationNotice={state.commercialMigrationNotice()}
+ 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()}
+ />
</CommercialSection>
<CommercialSection
@@ -446,18 +57,18 @@ export const ProLicensePanel: Component = () => {
</CommercialSection>
<SelfHostedCommercialActivationSection
- licenseKey={licenseKey()}
- activating={activating()}
- clearing={clearing()}
- loading={loading()}
- hasLicenseDetails={hasLicenseDetails()}
- showTrialStart={showTrialStart() && !licenseLoadError()}
- startingTrial={startingTrial()}
- looksLikeLegacyLicenseKey={looksLikeLegacyLicenseKey()}
- onLicenseKeyInput={setLicenseKey}
- onActivate={handleActivate}
- onClear={handleClear}
- onStartTrial={() => void handleStartTrial()}
+ licenseKey={state.licenseKey()}
+ activating={state.activating()}
+ clearing={state.clearing()}
+ loading={state.loading()}
+ hasLicenseDetails={state.hasLicenseDetails()}
+ showTrialStart={state.showTrialStart()}
+ startingTrial={state.startingTrial()}
+ looksLikeLegacyLicenseKey={state.looksLikeLegacyLicenseKey()}
+ onLicenseKeyInput={state.setLicenseKey}
+ onActivate={state.handleActivate}
+ onClear={state.handleClear}
+ onStartTrial={() => void state.handleStartTrial()}
/>
</div>
</CommercialBillingShell>
diff --git a/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx b/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx
new file mode 100644
index 0000000000..6d5cab0c58
--- /dev/null
+++ b/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx
@@ -0,0 +1,170 @@
+import { Component, For, Show } from 'solid-js';
+import RefreshCw from 'lucide-solid/icons/refresh-cw';
+import { getUpgradeActionUrlOrFallback, licenseLoadError } from '@/stores/license';
+import {
+ getLicenseStatusLoadingState,
+ getNoActiveProLicenseState,
+} from '@/utils/licensePresentation';
+import { CommercialStatGrid } from './CommercialBillingSections';
+
+interface Notice {
+ title: string;
+ body: string;
+ tone: string;
+}
+
+interface ProLicensePlanSectionProps {
+ commercialMigrationNotice: Notice | null;
+ commercialPlanModel: {
+ summary: Array<{ label: string; value: string | number }>;
+ details: Array<{ label: string; value: string | number }>;
+ };
+ entitlements: {
+ in_grace_period?: boolean;
+ grace_period_end?: string | null;
+ } | null;
+ formattedFeatures: string[];
+ grandfatheredPriceNotice: Notice | null;
+ hasLicenseDetails: boolean;
+ hasPaidFeatures: boolean;
+ loading: boolean;
+ onReload: () => void;
+ statusPresentation: {
+ badgeClass: string;
+ label: string;
+ };
+ trialActivationNotice: Notice | null;
+ trialEnded: boolean;
+}
+
+const formatDate = (value?: string | null) => {
+ if (!value) return 'Not available';
+ const date = new Date(value);
+ if (Number.isNaN(date.getTime())) return value;
+ return date.toLocaleDateString();
+};
+
+export const ProLicensePlanSection: Component<ProLicensePlanSectionProps> = (props) => (
+ <>
+ <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()}>
+ <div class="mb-4 rounded-md border border-red-200 dark:border-red-900 bg-red-50 dark:bg-red-900 p-3 text-sm text-red-900 dark:text-red-100">
+ <p class="font-medium">Your Pro trial has ended</p>
+ <p class="text-xs text-red-800 dark:text-red-200 mt-1">Upgrade to keep Pro features.</p>
+ <a
+ class="inline-flex items-center gap-1 mt-2 text-xs font-medium text-red-900 dark:text-red-100 hover:underline"
+ href={getUpgradeActionUrlOrFallback('trial_expired')}
+ target="_blank"
+ rel="noreferrer"
+ >
+ View Pro plans
+ </a>
+ </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>
+ </div>
+
+ <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 when={!props.hasPaidFeatures && !props.trialEnded}>
+ <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">Upgrade to Pro</p>
+ <p class="text-xs text-amber-700 dark:text-amber-300 mt-1">
+ Unlock Pulse Patrol, alert analysis, auto-fix, and more.
+ </p>
+ <a
+ class="inline-flex items-center gap-1 mt-2 text-xs font-medium text-amber-800 dark:text-amber-200 hover:underline"
+ href={getUpgradeActionUrlOrFallback('ai_autofix')}
+ target="_blank"
+ rel="noreferrer"
+ >
+ View Pro plans
+ </a>
+ </div>
+ </Show>
+ </Show>
+ </Show>
+ </>
+);
diff --git a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
index 1dc40a8f35..071e57b211 100644
--- a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
@@ -3,6 +3,9 @@ import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-li
import type { LicenseEntitlements } from '@/api/license';
import { ProLicensePanel } from '../ProLicensePanel';
+import proLicensePanelSource from '../ProLicensePanel.tsx?raw';
+import proLicensePanelStateSource from '../useProLicensePanelState.ts?raw';
+import proLicensePlanSectionSource from '../ProLicensePlanSection.tsx?raw';
let mockEntitlements: LicenseEntitlements | null = null;
@@ -391,4 +394,17 @@ describe('ProLicensePanel', () => {
);
});
});
+
+ it('keeps Pro license split into shell, runtime, and plan owners', () => {
+ expect(proLicensePanelSource).toContain('./useProLicensePanelState');
+ expect(proLicensePanelSource).toContain('./ProLicensePlanSection');
+ expect(proLicensePanelSource).toContain('SelfHostedCommercialActivationSection');
+ expect(proLicensePanelSource).not.toContain('createSignal(');
+ expect(proLicensePanelSource).not.toContain('useLocation()');
+ expect(proLicensePanelStateSource).toContain('useLocation');
+ expect(proLicensePanelStateSource).toContain('loadLicenseStatus(true)');
+ expect(proLicensePanelStateSource).toContain('buildSelfHostedCommercialPlanModel');
+ expect(proLicensePlanSectionSource).toContain('getLicenseStatusLoadingState');
+ expect(proLicensePlanSectionSource).toContain('getNoActiveProLicenseState');
+ });
});
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index f3055575c2..1fbf031492 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -44,10 +44,12 @@ import recoverySettingsPanelSource from '../RecoverySettingsPanel.tsx?raw';
import relaySettingsPanelSource from '../RelaySettingsPanel.tsx?raw';
import relayPairingSectionSource from '../RelayPairingSection.tsx?raw';
import proLicensePanelSource from '../ProLicensePanel.tsx?raw';
+import proLicensePlanSectionSource from '../ProLicensePlanSection.tsx?raw';
import commercialBillingSectionsSource from '../CommercialBillingSections.tsx?raw';
import selfHostedCommercialActivationSectionSource from '../SelfHostedCommercialActivationSection.tsx?raw';
import commercialBillingModelSource from '@/utils/commercialBillingModel.ts?raw';
import relaySettingsPanelStateSource from '../useRelaySettingsPanelState.ts?raw';
+import proLicensePanelStateSource from '../useProLicensePanelState.ts?raw';
import organizationOverviewPanelSource from '../OrganizationOverviewPanel.tsx?raw';
import organizationOverviewLoadingStateSource from '../OrganizationOverviewLoadingState.tsx?raw';
import organizationOverviewDetailsSectionSource from '../OrganizationOverviewDetailsSection.tsx?raw';
@@ -131,6 +133,7 @@ const extractedModules = [
'../UpdateInstallGuide.tsx',
'../ReportingPanel.tsx',
'../reportingPanelModel.ts',
+ '../ProLicensePlanSection.tsx',
'../RelayPairingSection.tsx',
'../OrganizationOverviewLoadingState.tsx',
'../OrganizationOverviewDetailsSection.tsx',
@@ -154,6 +157,7 @@ const extractedModules = [
'../UserAssignmentsDialog.tsx',
'../useUserAssignmentsPanelState.ts',
'../updatesSettingsModel.ts',
+ '../useProLicensePanelState.ts',
'../useRelaySettingsPanelState.ts',
'../useDiagnosticsPanelState.ts',
'../useReportingPanelState.ts',
@@ -343,12 +347,18 @@ describe('Settings architecture guardrails', () => {
expect(commercialBillingModelSource).toContain('buildHostedCommercialPlanModel');
expect(commercialBillingModelSource).toContain('buildHostedCommercialUsageModel');
expect(proLicensePanelSource).toContain('./CommercialBillingSections');
- expect(proLicensePanelSource).toContain('buildSelfHostedCommercialPlanModel');
+ expect(proLicensePanelSource).toContain('./useProLicensePanelState');
+ expect(proLicensePanelSource).toContain('./ProLicensePlanSection');
expect(proLicensePanelSource).toContain('SelfHostedCommercialActivationSection');
expect(proLicensePanelSource).toContain('MonitoredSystemLedgerPanel');
expect(proLicensePanelSource).toContain('CommercialBillingShell');
expect(proLicensePanelSource).toContain('CommercialSection');
- expect(proLicensePanelSource).toContain('CommercialStatGrid');
+ expect(proLicensePanelSource).not.toContain('createSignal(');
+ expect(proLicensePanelSource).not.toContain('useLocation()');
+ expect(proLicensePanelStateSource).toContain('buildSelfHostedCommercialPlanModel');
+ expect(proLicensePanelStateSource).toContain('loadLicenseStatus(true)');
+ expect(proLicensePlanSectionSource).toContain('CommercialStatGrid');
+ expect(proLicensePlanSectionSource).toContain('getLicenseStatusLoadingState');
expect(selfHostedCommercialActivationSectionSource).toContain('License / Activation Key');
expect(selfHostedCommercialActivationSectionSource).toContain('Start 14-day Pro Trial');
expect(organizationBillingPanelSource).toContain('./CommercialBillingSections');
diff --git a/frontend-modern/src/components/Settings/useProLicensePanelState.ts b/frontend-modern/src/components/Settings/useProLicensePanelState.ts
new file mode 100644
index 0000000000..906260020d
--- /dev/null
+++ b/frontend-modern/src/components/Settings/useProLicensePanelState.ts
@@ -0,0 +1,293 @@
+import { createMemo, createSignal, onMount } from 'solid-js';
+import { useLocation } from '@solidjs/router';
+import { notificationStore } from '@/stores/notifications';
+import {
+ isMultiTenantEnabled,
+ licenseLoadError,
+ licenseStatus,
+ loadLicenseStatus,
+ startProTrial,
+} from '@/stores/license';
+import { LicenseAPI } from '@/api/license';
+import {
+ getProTrialStartedMessage,
+ getTrialAlreadyUsedMessage,
+ getTrialStartErrorMessage,
+ getTrialTryAgainLaterMessage,
+} from '@/utils/upgradePresentation';
+import {
+ formatLicensePlanVersion,
+ getCommercialMigrationNotice,
+ getGrandfatheredPriceContinuityNotice,
+ getLicenseFeatureLabel,
+ getLicenseSubscriptionStatusPresentation,
+ getLicenseTierLabel,
+ getTrialActivationNotice,
+} from '@/utils/licensePresentation';
+import { buildSelfHostedCommercialPlanModel } from '@/utils/commercialBillingModel';
+
+const formatDate = (value?: string | null) => {
+ if (!value) return 'Not available';
+ const date = new Date(value);
+ if (Number.isNaN(date.getTime())) return value;
+ return date.toLocaleDateString();
+};
+
+const formatUnixDate = (value?: number) => {
+ if (typeof value !== 'number') return 'Not available';
+ const date = new Date(value * 1000);
+ if (Number.isNaN(date.getTime())) return 'Not available';
+ return date.toLocaleDateString();
+};
+
+export function useProLicensePanelState() {
+ const location = useLocation();
+ const [licenseKey, setLicenseKey] = createSignal('');
+ const [loading, setLoading] = createSignal(false);
+ const [activating, setActivating] = createSignal(false);
+ const [clearing, setClearing] = createSignal(false);
+ const [startingTrial, setStartingTrial] = createSignal(false);
+
+ const entitlements = createMemo(() => licenseStatus());
+ const subscriptionState = createMemo(() => entitlements()?.subscription_state);
+ const trialExpiryUnix = createMemo(() => entitlements()?.trial_expires_at);
+ const trialDaysRemaining = createMemo(() => entitlements()?.trial_days_remaining);
+
+ const loadPanelData = async () => {
+ setLoading(true);
+ await loadLicenseStatus(true);
+ setLoading(false);
+ };
+
+ onMount(() => {
+ void loadPanelData();
+ });
+
+ const showTrialStart = createMemo(() => {
+ const current = entitlements();
+ if (!current) return false;
+ if (current.commercial_migration?.state) return false;
+ if (typeof current.trial_eligible === 'boolean') {
+ return current.trial_eligible;
+ }
+ const state = subscriptionState();
+ return state !== 'active' && state !== 'trial' && !licenseLoadError();
+ });
+
+ const handleStartTrial = async () => {
+ if (startingTrial()) return;
+ setStartingTrial(true);
+ try {
+ const result = await startProTrial();
+ if (result?.outcome === 'redirect') {
+ if (typeof window !== 'undefined') {
+ window.location.href = result.actionUrl;
+ }
+ return;
+ }
+ notificationStore.success(getProTrialStartedMessage());
+ } catch (error) {
+ const trialError = error as { status?: number; code?: string; message?: string } | null;
+ const statusCode = trialError?.status;
+ if (statusCode === 409 && trialError?.code === 'trial_already_used') {
+ notificationStore.error(getTrialAlreadyUsedMessage());
+ } else if (statusCode === 429) {
+ notificationStore.error(getTrialTryAgainLaterMessage());
+ } else {
+ notificationStore.error(
+ getTrialStartErrorMessage(error instanceof Error ? error.message : undefined, {
+ branded: true,
+ }),
+ );
+ }
+ } finally {
+ setStartingTrial(false);
+ }
+ };
+
+ const statusPresentation = createMemo(() =>
+ getLicenseSubscriptionStatusPresentation(subscriptionState()),
+ );
+
+ const hasLicenseDetails = createMemo(() => {
+ const current = entitlements();
+ if (!current) return false;
+ return Boolean(
+ current.licensed_email ||
+ current.expires_at ||
+ current.trial_expires_at ||
+ current.tier !== 'free',
+ );
+ });
+
+ const formattedTier = createMemo(() => {
+ const current = entitlements();
+ if (!current) return 'Unknown';
+ return getLicenseTierLabel(current.tier);
+ });
+
+ const formattedPlanTerms = createMemo(() => formatLicensePlanVersion(entitlements()?.plan_version));
+
+ const formattedFeatures = createMemo(() => {
+ const current = entitlements();
+ if (!current?.capabilities?.length) return [];
+ return current.capabilities
+ .filter((feature) => feature !== 'multi_tenant' || isMultiTenantEnabled())
+ .map((feature) => getLicenseFeatureLabel(feature));
+ });
+
+ const displayedExpiry = createMemo(() => {
+ const current = entitlements();
+ if (current?.is_lifetime) return 'Never (Lifetime)';
+ if (typeof current?.expires_at === 'string' && current.expires_at.length > 0) {
+ return formatDate(current.expires_at);
+ }
+ if (subscriptionState() === 'trial') return formatUnixDate(trialExpiryUnix());
+ return 'Not available';
+ });
+
+ const displayedDaysRemaining = createMemo(() => {
+ const current = entitlements();
+ if (current?.is_lifetime) return 'Unlimited';
+ if (subscriptionState() === 'trial' && typeof trialDaysRemaining() === 'number') {
+ return trialDaysRemaining();
+ }
+ if (typeof current?.expires_at === 'string' && typeof current.days_remaining === 'number') {
+ return current.days_remaining;
+ }
+ return 'Unknown';
+ });
+
+ const looksLikeLegacyLicenseKey = createMemo(() => {
+ const trimmed = licenseKey().trim();
+ if (!trimmed || trimmed.startsWith('ppk_live_')) {
+ return false;
+ }
+ const segments = trimmed.split('.');
+ return segments.length === 3 && segments.every((segment) => segment.length > 0);
+ });
+
+ const limitStatus = (key: string) => entitlements()?.limits?.find((entry) => entry.key === key);
+
+ const monitoredSystemUsage = createMemo(() => limitStatus('max_monitored_systems')?.current ?? 0);
+ const monitoredSystemLimit = createMemo(() => limitStatus('max_monitored_systems')?.limit ?? 0);
+ const remainingSystemCapacity = createMemo(() => {
+ const limit = monitoredSystemLimit();
+ if (limit <= 0) return 'Unlimited';
+ return Math.max(limit - monitoredSystemUsage(), 0);
+ });
+
+ const trialEnded = createMemo(
+ () =>
+ subscriptionState() === 'expired' &&
+ entitlements()?.trial_eligibility_reason === 'already_used',
+ );
+
+ const trialActivationNotice = createMemo(() => {
+ const params = new URLSearchParams(location.search);
+ return getTrialActivationNotice(params.get('trial')?.trim().toLowerCase() ?? '');
+ });
+
+ const commercialMigrationNotice = createMemo(() =>
+ getCommercialMigrationNotice(entitlements()?.commercial_migration),
+ );
+
+ const grandfatheredPriceNotice = createMemo(() =>
+ getGrandfatheredPriceContinuityNotice(
+ entitlements()?.plan_version,
+ entitlements()?.subscription_state,
+ ),
+ );
+
+ const hasPaidFeatures = createMemo(() => {
+ const state = subscriptionState();
+ return state === 'active' || state === 'trial' || state === 'grace';
+ });
+
+ const commercialPlanModel = createMemo(() =>
+ buildSelfHostedCommercialPlanModel({
+ licensedEmail: entitlements()?.licensed_email,
+ statusLabel: statusPresentation().label,
+ tierLabel: formattedTier(),
+ planTerms: formattedPlanTerms() || undefined,
+ expires: displayedExpiry(),
+ daysRemaining: displayedDaysRemaining() ?? 'Unknown',
+ monitoredSystems: monitoredSystemUsage(),
+ monitoredSystemLimit: monitoredSystemLimit() > 0 ? monitoredSystemLimit() : undefined,
+ remainingSystemCapacity: remainingSystemCapacity(),
+ maxMonitoredSystems:
+ typeof limitStatus('max_monitored_systems')?.limit === 'number' &&
+ limitStatus('max_monitored_systems')!.limit > 0
+ ? limitStatus('max_monitored_systems')!.limit
+ : 'Unlimited',
+ maxGuests:
+ typeof limitStatus('max_guests')?.limit === 'number' && limitStatus('max_guests')!.limit > 0
+ ? limitStatus('max_guests')!.limit
+ : 'Unlimited',
+ }),
+ );
+
+ const handleActivate = async () => {
+ const trimmedKey = licenseKey().trim();
+ if (!trimmedKey) {
+ notificationStore.error('A license key or activation key is required');
+ return;
+ }
+ setActivating(true);
+ try {
+ const result = await LicenseAPI.activateLicense(trimmedKey);
+ if (!result.success) {
+ notificationStore.error(result.message || 'Failed to activate license');
+ return;
+ }
+ notificationStore.success(result.message || 'License activated');
+ setLicenseKey('');
+ await loadPanelData();
+ } catch (error) {
+ notificationStore.error(error instanceof Error ? error.message : 'Failed to activate license');
+ } finally {
+ setActivating(false);
+ }
+ };
+
+ const handleClear = async () => {
+ if (!confirm('Clear the current Pro license?')) {
+ return;
+ }
+ setClearing(true);
+ try {
+ const result = await LicenseAPI.clearLicense();
+ notificationStore.success(result.message || 'License cleared');
+ await loadPanelData();
+ } catch (error) {
+ notificationStore.error(error instanceof Error ? error.message : 'Failed to clear license');
+ } finally {
+ setClearing(false);
+ }
+ };
+
+ return {
+ activating,
+ clearing,
+ commercialMigrationNotice,
+ commercialPlanModel,
+ entitlements,
+ formattedFeatures,
+ grandfatheredPriceNotice,
+ handleActivate,
+ handleClear,
+ handleStartTrial,
+ hasLicenseDetails,
+ hasPaidFeatures,
+ licenseKey,
+ loadPanelData,
+ loading,
+ looksLikeLegacyLicenseKey,
+ setLicenseKey,
+ showTrialStart,
+ startingTrial,
+ statusPresentation,
+ trialActivationNotice,
+ trialEnded,
+ };
+}
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 1cf2786ddc..89a55f0ad6 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -172,6 +172,7 @@ import k8sStatusPresentationSource from '@/utils/k8sStatusPresentation.ts?raw';
import raidCardSource from '@/components/shared/cards/RaidCard.tsx?raw';
import raidPresentationSource from '@/utils/raidPresentation.ts?raw';
import proLicensePanelSource from '@/components/Settings/ProLicensePanel.tsx?raw';
+import proLicensePlanSectionSource from '@/components/Settings/ProLicensePlanSection.tsx?raw';
import securityPostureSummarySource from '@/components/Settings/SecurityPostureSummary.tsx?raw';
import securityAuthPanelSource from '@/components/Settings/SecurityAuthPanel.tsx?raw';
import securityWarningSource from '@/components/SecurityWarning.tsx?raw';
@@ -228,6 +229,7 @@ import storageDomainSource from '@/features/storageBackups/storageDomain.ts?raw'
import storagePoolDetailPresentationSource from '@/features/storageBackups/storagePoolDetailPresentation.ts?raw';
import storageBarPresentationSource from '@/features/storageBackups/storageBarPresentation.ts?raw';
import storagePagePresentationSource from '@/features/storageBackups/storagePagePresentation.ts?raw';
+import proLicensePanelStateSource from '@/components/Settings/useProLicensePanelState.ts?raw';
import storagePageStatusSource from '@/features/storageBackups/storagePageStatus.ts?raw';
import storageRowPresentationSource from '@/features/storageBackups/rowPresentation.ts?raw';
import storagePoolRowPresentationSource from '@/features/storageBackups/storagePoolRowPresentation.ts?raw';
@@ -1841,19 +1843,21 @@ describe('frontend resource type boundaries', () => {
expect(raidCardSource).not.toContain('const deviceToneClass =');
expect(raidPresentationSource).toContain('export function getRaidStateVariant');
expect(raidPresentationSource).toContain('export function getRaidDeviceBadgeClass');
- expect(proLicensePanelSource).toContain('getLicenseSubscriptionStatusPresentation');
- expect(proLicensePanelSource).toContain('getLicenseStatusLoadingState');
- expect(proLicensePanelSource).toContain('getNoActiveProLicenseState');
- expect(proLicensePanelSource).toContain('formatLicensePlanVersion');
- expect(proLicensePanelSource).toContain('getTrialActivationNotice');
- expect(proLicensePanelSource).toContain('getCommercialMigrationNotice');
+ expect(proLicensePanelSource).toContain('./useProLicensePanelState');
+ expect(proLicensePanelSource).toContain('./ProLicensePlanSection');
+ expect(proLicensePanelStateSource).toContain('getLicenseSubscriptionStatusPresentation');
+ expect(proLicensePanelStateSource).toContain('formatLicensePlanVersion');
+ expect(proLicensePanelStateSource).toContain('getTrialActivationNotice');
+ expect(proLicensePanelStateSource).toContain('getCommercialMigrationNotice');
+ expect(proLicensePlanSectionSource).toContain('getLicenseStatusLoadingState');
+ expect(proLicensePlanSectionSource).toContain('getNoActiveProLicenseState');
expect(proLicensePanelSource).not.toContain('Loading license status...');
expect(proLicensePanelSource).not.toContain('No Pro license is active.');
expect(proLicensePanelSource).not.toContain('const statusLabel =');
- expect(proLicensePanelSource).not.toContain('const statusTone =');
- expect(proLicensePanelSource).not.toContain('const formatTitleCase =');
- expect(proLicensePanelSource).not.toContain('const commercialMigrationActionText =');
- expect(proLicensePanelSource).not.toContain('const commercialMigrationNoticeFor =');
+ expect(proLicensePanelStateSource).not.toContain('const statusTone =');
+ expect(proLicensePanelStateSource).not.toContain('const formatTitleCase =');
+ expect(proLicensePanelStateSource).not.toContain('const commercialMigrationActionText =');
+ expect(proLicensePanelStateSource).not.toContain('const commercialMigrationNoticeFor =');
expect(licensePresentationSource).toContain(
'export const getLicenseSubscriptionStatusPresentation',
);
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index bf98821963..2f864e334d 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -115,6 +115,27 @@ class SubsystemLookupTest(unittest.TestCase):
["frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx"],
)
+ def test_lookup_paths_assigns_pro_license_state_owner_to_cloud_paid(self) -> None:
+ result = lookup_paths(["frontend-modern/src/components/Settings/useProLicensePanelState.ts"])
+ self.assertEqual(result["unowned_runtime_files"], [])
+ self.assertEqual(
+ {item["subsystem"] for item in result["impacted_subsystems"]},
+ {"cloud-paid"},
+ )
+ file_entry = result["files"][0]
+ self.assertEqual(file_entry["classification"], "runtime")
+ self.assertEqual(
+ {match["subsystem"] for match in file_entry["matches"]},
+ {"cloud-paid"},
+ )
+ match = file_entry["matches"][0]
+ self.assertEqual(match["contract"], "docs/release-control/v6/internal/subsystems/cloud-paid.md")
+ self.assertEqual(match["lane_context"]["lane_id"], "L3")
+ self.assertEqual(
+ match["verification_requirement"]["id"],
+ "pro-license-surface",
+ )
+
def test_lookup_paths_assigns_relay_settings_state_owner_to_cloud_paid(self) -> None:
result = lookup_paths(["frontend-modern/src/components/Settings/useRelaySettingsPanelState.ts"])
self.assertEqual(result["unowned_runtime_files"], [])