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.

Finish presentation-policy commercial contract split

rcourtman50b9c469ab6b
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 575bd84a1f..19379cc2e2 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -319,9 +319,11 @@ instead of teaching lifecycle or mock-mode paths to bypass licensing. Public
demo readiness therefore comes from hiding commercial presentation on the
shared API boundary, not from introducing a second fake-entitlement path into
lifecycle-owned install or reporting flows. Browser-facing lifecycle surfaces
-must also treat `/api/security/status.sessionCapabilities.demoMode` as the
-canonical public-demo bootstrap signal instead of inferring demo posture from
-headers, `/api/health`, or hostname heuristics.
+must also treat `/api/security/status` as the canonical public-demo bootstrap
+contract. The backend source-of-truth fact remains
+`sessionCapabilities.demoMode`, but lifecycle surfaces must consume the shared
+resolved `presentationPolicy` instead of inferring demo posture from headers,
+`/api/health`, or hostname heuristics.
That same shared API boundary now owns the hidden-versus-runtime-only split as
well: lifecycle-adjacent flows may inherit non-commercial
`/api/license/runtime-capabilities` reads when demo-visible product behavior
@@ -330,6 +332,10 @@ needs them, but `/api/license/commercial-posture`,
public demo mode and those lifecycle flows must not depend on licensed
identity, plan labels, upgrade reasons, checkout handoff state, or observed
usage counts surviving the public-demo contract.
+Lifecycle-owned browser shells must also defer any commercial helper reads
+until that presentation policy resolves so demo suppression stays fail-closed
+during first render instead of racing hidden commercial endpoints from shared
+setup or install surfaces.
Lifecycle-adjacent storage and fleet surfaces now also depend on one governed
physical-disk history transport. When agent-backed disk telemetry is rendered
through shared drawers or lifecycle-adjacent resource context, those reads
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index 4c0838cc8e..5f020ea119 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -122,6 +122,13 @@ the canonical `ai_alerts` destination from the shared license/commercial
contract, but it must delegate the actual open behavior to the
`frontend-primitives` typed upgrade-navigation owner instead of reintroducing
alert-local `window.open(...)` or raw external-tab assumptions.
+Alert-adjacent shared helpers also inherit the runtime-versus-commercial split
+now carried by the shared licensing stores. Alert pages may consume runtime
+feature truth from `frontend-modern/src/stores/license.ts`, but any
+upgrade/trial posture must come from the dedicated commercial-posture
+contract, and public-demo suppression must flow from the shared resolved
+`presentationPolicy` contract instead of alert-local demo checks or
+entitlement reads.
That shared alert presentation boundary now also has explicit alerts ownership.
`frontend-modern/src/utils/alertWebhookPresentation.ts` is the canonical owner
for webhook setup copy, service labels, mention-help phrasing, custom-field
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 09f1c4511e..17e943111b 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -460,6 +460,23 @@ handoffs. API-backed Patrol surfaces may consume canonical commercial hrefs
from the shared license/commercial contract, but they must not re-decide
internal-versus-external navigation behavior inside API-adjacent page or hook
owners once the contract can resolve to both in-app and public destinations.
+That same shared `internal/api/` boundary now also owns browser presentation
+policy for public-demo and commercial suppression. `/api/security/status` must
+continue to expose the raw session capability fact
+`sessionCapabilities.demoMode`, but browser shells and shared frontend stores
+now consume the explicit `presentationPolicy` payload from that same response
+as the canonical runtime contract for `demoMode`, `readOnly`,
+`hideCommercial`, and `hideUpgrade`. Commercial posture and billing stores
+must therefore defer their first read until that policy has resolved, so
+public demos fail closed without probing hidden commercial routes during
+bootstrap.
+That same contract split also makes the licensing boundary explicit:
+`/api/license/runtime-capabilities` is the public runtime feature contract,
+`/api/license/commercial-posture` is the non-billing upgrade/trial posture
+contract for real customer workspaces, and `/api/license/entitlements`
+remains billing-only. New callers must extend one of those owned shapes
+instead of reviving a combined entitlement payload for mixed runtime,
+commercial, and billing concerns.
`/portal` is now one bootstrap-driven shell for both anonymous and
authenticated users, so new account frontend work must extend that shared
contract rather than inventing a second local payload shape, reviving separate
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 70295b62e4..db1057f6b2 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -163,15 +163,17 @@ monitored-system ledgers, upgrade nudges, or activation controls just because
the underlying runtime is commercially enabled.
`internal/api/router_routes_auth_security.go`,
`internal/api/security_status_capabilities.go`,
-`frontend-modern/src/useAppRuntimeState.ts`, and the shared session-capability
-stores must treat `/api/security/status.sessionCapabilities.demoMode` as the
-canonical browser bootstrap signal, and shared billing or upgrade surfaces
-must hide or suppress themselves from that contract rather than teaching mock
-mode, response-header inference, or frontend-only feature flags to bypass the
-real licensing model. That includes settings billing tabs, public-demo banner
-and monitored-system/trial nudges, dashboard relay paywalls, Patrol upgrade
-CTAs, and history-lock upsells. Demo readiness therefore means presentation
-isolation, not a license exemption.
+`frontend-modern/src/useAppRuntimeState.ts`, and
+`frontend-modern/src/stores/sessionPresentationPolicy.ts` must treat
+`/api/security/status` as the canonical browser bootstrap contract. The
+backend capability fact `sessionCapabilities.demoMode` still seeds that
+contract, but shared billing and upgrade surfaces now hide or suppress
+themselves from the resolved `presentationPolicy` payload instead of teaching
+mock mode, response-header inference, or frontend-only feature flags to
+bypass the real licensing model. That includes settings billing tabs,
+public-demo banner and monitored-system/trial nudges, dashboard relay
+paywalls, Patrol upgrade CTAs, and history-lock upsells. Demo readiness
+therefore means presentation isolation, not a license exemption.
That same public-demo boundary now also owns route-level commercial
classification. `internal/api/demo_middleware.go` and
`internal/api/demo_mode_commercial.go` must decide centrally which commercial
@@ -185,7 +187,8 @@ commercial routes, plus `/auth/license-purchase-start`, must stay hidden and
public browsers must not see licensed identity, plan labels, upgrade reasons,
trial urgency, observed usage counts, or checkout handoff state. The
commercial posture store and billing-entitlements store must also fail closed
-locally in demo mode so hidden routes are not probed from the browser shell.
+locally until the shared presentation policy resolves, then stay fail-closed
+in demo mode so hidden routes are not probed from the browser shell.
The governed browser proof for that posture lives in
`tests/integration/tests/53-demo-mode-commercial-boundary.spec.ts` and is
expected to stay runnable through
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 96ba4cfe35..850a37527f 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -405,6 +405,7 @@ That same shared settings-shell and banner boundary now also owns demo-mode
commercial suppression. `frontend-modern/src/components/Settings/settingsNavCatalog.ts`,
`frontend-modern/src/components/Settings/settingsNavVisibility.ts`,
`frontend-modern/src/stores/sessionCapabilities.ts`,
+`frontend-modern/src/stores/sessionPresentationPolicy.ts`,
`frontend-modern/src/stores/demoMode.ts`,
`frontend-modern/src/stores/license.ts`,
`frontend-modern/src/stores/licenseCommercial.ts`,
@@ -415,14 +416,16 @@ commercial suppression. `frontend-modern/src/components/Settings/settingsNavCata
`frontend-modern/src/components/shared/HistoryChartOverlay.tsx`,
`frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsx`, and
`frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx`
-must consume one shared bootstrap truth from
-`/api/security/status.sessionCapabilities.demoMode` and hide billing tabs,
-trial nudges, monitored-system warning banners, dashboard upsells, Patrol
-upgrade CTAs, history-lock paywalls, and other public-demo commercial
-affordances when the browser is rendering a public demo runtime.
+must consume one shared bootstrap truth from `/api/security/status`. The
+backend capability fact `sessionCapabilities.demoMode` remains part of that
+payload, but the browser-owned shared primitive is now the resolved
+`sessionPresentationPolicy` contract, which hides billing tabs, trial nudges,
+monitored-system warning banners, dashboard upsells, Patrol upgrade CTAs,
+history-lock paywalls, and other public-demo commercial affordances when the
+browser is rendering a public demo runtime.
Shared primitives must not perform their own ad hoc `/api/health` polling,
response-header inference, hostname heuristics, or per-banner demo branching;
-the runtime bootstrap, shared session-capability store, and shared banner
+the runtime bootstrap, shared presentation-policy store, and shared banner
hooks stay on one canonical owner so suppression stays coherent across
customer-facing surfaces.
That same shared primitive boundary now also treats runtime capability reads
@@ -430,7 +433,8 @@ and commercial reads as separate stores. Shared settings shells and banner
hooks may read feature truth from `frontend-modern/src/stores/license.ts`, but
commercial identity, upgrade routing, and trial state must stay in
`frontend-modern/src/stores/licenseCommercial.ts`, which suppresses public-demo
-loads locally instead of depending on route-local guards.
+loads locally and defers its first fetch until the presentation policy has
+resolved instead of depending on route-local guards.
Storage disk drawers now also sit on that same shared-primitives floor.
`frontend-modern/src/components/Storage/DiskDetail.tsx` must render physical-
disk read, write, and busy charts through `HistoryChart` plus
diff --git a/docs/release-control/v6/internal/subsystems/organization-settings.md b/docs/release-control/v6/internal/subsystems/organization-settings.md
index 398723ba97..9fa6efb922 100644
--- a/docs/release-control/v6/internal/subsystems/organization-settings.md
+++ b/docs/release-control/v6/internal/subsystems/organization-settings.md
@@ -133,6 +133,13 @@ settings surfaces. The organization settings panels now also normalize org
scope through `frontend-modern/src/utils/orgScope.ts` instead of carrying
their own `getOrgID() || 'default'` fallbacks, so access, overview, and
sharing views stay aligned with the shared multi-tenant org context contract.
+That same settings surface now also inherits the runtime-versus-commercial
+licensing split. Organization settings may consume runtime capability truth
+from the shared runtime-capabilities contract, but billing identity and
+upgrade posture stay outside this subsystem on the dedicated commercial
+surfaces, and any public-demo suppression must come from the shared resolved
+`presentationPolicy` rather than settings-local demo checks or billing
+entitlement probes.
The organization sharing surface now also sources resource quick-pick labels
from the shared preferred resource display helper, so governed resources do
not fall back to raw names inside share creation.
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 938fe8596d..ae7001f516 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -137,10 +137,13 @@ internal-versus-external navigation semantics to `frontend-primitives` once a
Patrol feature can resolve to either product-owned routes or public pricing.
That same Patrol-owned commercial boundary must also fail closed in public
demo runtimes. Patrol header and banner upgrade/trial affordances may render
-for real customer workspaces, but when
-`/api/security/status.sessionCapabilities.demoMode` is true they must suppress
-upgrade CTAs, trial nudges, and Pro-only helper copy instead of leaking
-commercial posture into the public demo presentation.
+for real customer workspaces, but the browser-owned trigger for that
+suppression is now the shared resolved `presentationPolicy` from
+`/api/security/status`, seeded by the backend capability fact
+`sessionCapabilities.demoMode`. Patrol surfaces must therefore suppress
+upgrade CTAs, trial nudges, and Pro-only helper copy only from that shared
+policy instead of reviving local demo heuristics or issuing early commercial
+reads before the policy resolves.
That degraded empty-state copy must also interpret the finding state rather
than simply replaying the primary assessment sentence verbatim: when coverage
is incomplete, the findings panel should tell the operator that Patrol has not
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index 0787685971..ce7e484081 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -115,6 +115,12 @@ The security transport surfaces remain intentionally shared with
`api-contracts`: token, auth, and telemetry settings payloads are still API
contracts, but they now also count as first-class security/privacy runtime
behavior that `L14` must govern directly.
+That shared settings/auth boundary now also inherits the runtime-versus-
+commercial licensing split. Security/privacy settings may consume runtime
+capability truth where feature availability matters, but billing identity,
+trial posture, and upgrade routing stay on the dedicated commercial boundary,
+and public-demo suppression must resolve from the shared `presentationPolicy`
+contract instead of security-surface entitlement reads or local demo flags.
That shared token-management boundary now also includes
`frontend-modern/src/utils/apiTokenPresentation.ts`, so API-token load,
generate, and revoke errors stay on one governed customer-facing wording path
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 8b03db7736..0f263d86ef 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -333,9 +333,11 @@ commercial identity or upgrade posture into a public demo. Storage/recovery
must consume that redacted boundary as presentation truth rather than
reintroducing mock-only license bypasses or page-local commercial fallbacks.
Browser-facing storage/recovery surfaces must also treat
-`/api/security/status.sessionCapabilities.demoMode` as the canonical
-public-demo bootstrap signal instead of inferring demo posture from headers,
-`/api/health`, or hostname heuristics.
+`/api/security/status` as the canonical public-demo bootstrap contract. The
+backend capability fact remains `sessionCapabilities.demoMode`, but storage
+and recovery browsers must consume the shared resolved `presentationPolicy`
+instead of inferring demo posture from headers, `/api/health`, or hostname
+heuristics.
That same shared boundary now also owns the one runtime-safe exception:
storage and recovery may inherit demo-safe `/api/license/runtime-capabilities`
reads for capability and history-retention truth, but
@@ -344,6 +346,9 @@ reads for capability and history-retention truth, but
licensed identity, upgrade prompts, trial urgency, checkout handoff state, or
observed usage counts to remain present once the public-demo contract is
applied.
+Storage- or recovery-adjacent commercial helpers must therefore wait for the
+shared presentation policy to resolve before attempting any read that could
+otherwise hit a hidden commercial route during bootstrap.
Physical-disk live I/O drawers now also sit on the canonical storage surface.
Storage disk drawers may show read, write, busy, and SMART history, but every
chart must route through the shared `HistoryChart` API contract using the disk
diff --git a/frontend-modern/src/AppLayout.tsx b/frontend-modern/src/AppLayout.tsx
index 0d8e599989..0b97a49f26 100644
--- a/frontend-modern/src/AppLayout.tsx
+++ b/frontend-modern/src/AppLayout.tsx
@@ -6,7 +6,6 @@ import {
createMemo,
createSignal,
onCleanup,
- onMount,
} from 'solid-js';
import type { JSX } from 'solid-js';
import { useLocation, useNavigate } from '@solidjs/router';
@@ -39,12 +38,16 @@ import { buildStorageRecoveryTabSpecs } from '@/routing/platformTabs';
import { getKioskModePreference, setKioskMode } from '@/utils/url';
import { updateStore } from '@/stores/updates';
import { aiChatStore } from '@/stores/aiChat';
-import { demoModeEnabled } from '@/stores/demoMode';
import { isMultiTenantEnabled } from '@/stores/license';
import {
isPro,
loadCommercialPosture,
} from '@/stores/licenseCommercial';
+import {
+ presentationPolicyHidesCommercialSurfaces,
+ presentationPolicyHidesUpgradePrompts,
+ sessionPresentationPolicyResolved,
+} from '@/stores/sessionPresentationPolicy';
import type { AppConnectionStatus } from '@/useAppRuntimeState';
const ROOT_INFRASTRUCTURE_PATH = buildInfrastructurePath();
@@ -178,10 +181,14 @@ export function AppLayout(props: AppLayoutProps) {
}
};
- onMount(() => {
- if (!demoModeEnabled()) {
- void loadCommercialPosture();
+ createEffect(() => {
+ if (!sessionPresentationPolicyResolved()) {
+ return;
+ }
+ if (presentationPolicyHidesCommercialSurfaces()) {
+ return;
}
+ void loadCommercialPosture();
});
const showHeader = () => {
@@ -736,7 +743,9 @@ export function AppLayout(props: AppLayoutProps) {
/>
</span>
</Show>
- <Show when={tab.badge === 'pro' && !demoModeEnabled()}>
+ <Show
+ when={tab.badge === 'pro' && !presentationPolicyHidesUpgradePrompts()}
+ >
<span class="ml-1.5 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-700 dark:text-blue-300 bg-blue-100 dark:bg-blue-900 rounded">
Pro
</span>
diff --git a/frontend-modern/src/__tests__/App.architecture.test.ts b/frontend-modern/src/__tests__/App.architecture.test.ts
index 165e5f026c..0b2c0adabf 100644
--- a/frontend-modern/src/__tests__/App.architecture.test.ts
+++ b/frontend-modern/src/__tests__/App.architecture.test.ts
@@ -56,7 +56,8 @@ describe('App architecture', () => {
expect(appLayoutSource).toContain('const utilityTabs = createMemo(() =>');
expect(appLayoutSource).toContain("import { isMultiTenantEnabled } from '@/stores/license';");
expect(appLayoutSource).toContain("loadCommercialPosture");
- expect(appLayoutSource).toContain('if (!demoModeEnabled()) {');
+ expect(appLayoutSource).toContain('sessionPresentationPolicyResolved');
+ expect(appLayoutSource).toContain('if (presentationPolicyHidesCommercialSurfaces()) {');
expect(appLayoutSource).toContain('void loadCommercialPosture();');
expect(appSource).not.toContain("eventBus.on('theme_changed'");
expect(appSource).not.toContain("eventBus.on('websocket_reconnected'");
@@ -71,7 +72,7 @@ describe('App architecture', () => {
expect(appRuntimeStateSource).toContain('const loadOrganizations = async () =>');
expect(appRuntimeStateSource).toContain('const handleOrgSwitch = (nextOrgID: string) =>');
expect(appRuntimeStateSource).toContain(
- "import {\n isHostedModeEnabled,\n isMultiTenantEnabled,\n licenseLoaded,\n loadLicenseStatus,\n} from '@/stores/license';",
+ "import {\n isHostedModeEnabled,\n isMultiTenantEnabled,\n runtimeCapabilitiesLoaded,\n loadRuntimeCapabilities,\n} from '@/stores/license';",
);
expect(appRuntimeStateSource).toContain(
'const [activeOrgID, setActiveOrgID] = createSignal(',
diff --git a/frontend-modern/src/__tests__/useAppRuntimeState.test.ts b/frontend-modern/src/__tests__/useAppRuntimeState.test.ts
index e5841deb74..cff07d8855 100644
--- a/frontend-modern/src/__tests__/useAppRuntimeState.test.ts
+++ b/frontend-modern/src/__tests__/useAppRuntimeState.test.ts
@@ -199,8 +199,8 @@ describe('useAppRuntimeState', () => {
vi.doMock('@/stores/license', () => ({
isHostedModeEnabled: isHostedModeEnabledMock,
isMultiTenantEnabled: isMultiTenantEnabledMock,
- licenseLoaded: vi.fn().mockReturnValue(true),
- loadLicenseStatus: loadLicenseStatusMock,
+ runtimeCapabilitiesLoaded: vi.fn().mockReturnValue(true),
+ loadRuntimeCapabilities: loadLicenseStatusMock,
}));
vi.doMock('@/utils/layout', () => ({
diff --git a/frontend-modern/src/components/Dashboard/RelayOnboardingCard.tsx b/frontend-modern/src/components/Dashboard/RelayOnboardingCard.tsx
index 6cd69a6e52..fe23339890 100644
--- a/frontend-modern/src/components/Dashboard/RelayOnboardingCard.tsx
+++ b/frontend-modern/src/components/Dashboard/RelayOnboardingCard.tsx
@@ -3,8 +3,8 @@ import Smartphone from 'lucide-solid/icons/smartphone';
import X from 'lucide-solid/icons/x';
import { Card } from '@/components/shared/Card';
import { UpgradeLink } from '@/components/shared/UpgradeLink';
-import { demoModeEnabled } from '@/stores/demoMode';
import { getUpgradeActionDestination } from '@/stores/licenseCommercial';
+import { presentationPolicyHidesCommercialSurfaces } from '@/stores/sessionPresentationPolicy';
import {
RELAY_ONBOARDING_DESCRIPTION,
RELAY_ONBOARDING_DISCONNECTED_LABEL,
@@ -20,7 +20,9 @@ export const RelayOnboardingCard: Component = () => {
const state = useRelayOnboardingCardState();
return (
- <Show when={state.shouldShow() && (!demoModeEnabled() || state.hasRelay())}>
+ <Show
+ when={state.shouldShow() && (!presentationPolicyHidesCommercialSurfaces() || state.hasRelay())}
+ >
<Card padding="lg" class="relative overflow-hidden">
<div class="absolute -right-10 -top-10 h-32 w-32 rounded-full bg-blue-100 dark:bg-blue-900" />
<div class="absolute -right-16 -bottom-16 h-40 w-40 rounded-full bg-surface-alt" />
diff --git a/frontend-modern/src/components/Dashboard/__tests__/RelayOnboardingCard.test.tsx b/frontend-modern/src/components/Dashboard/__tests__/RelayOnboardingCard.test.tsx
index 63f2dc6fcd..7119891d56 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/RelayOnboardingCard.test.tsx
+++ b/frontend-modern/src/components/Dashboard/__tests__/RelayOnboardingCard.test.tsx
@@ -20,7 +20,7 @@ const {
hasFeatureMock,
licenseLoadedMock,
getUpgradeActionUrlOrFallbackMock,
- demoModeEnabledMock,
+ presentationPolicyHidesCommercialSurfacesMock,
} = vi.hoisted(() => ({
getUpgradeActionDestinationMock: vi.fn(),
mockNavigate: vi.fn(),
@@ -36,7 +36,7 @@ const {
hasFeatureMock: vi.fn(),
licenseLoadedMock: vi.fn(),
getUpgradeActionUrlOrFallbackMock: vi.fn(),
- demoModeEnabledMock: vi.fn(),
+ presentationPolicyHidesCommercialSurfacesMock: vi.fn(),
}));
vi.mock('@solidjs/router', () => ({
@@ -45,8 +45,8 @@ vi.mock('@solidjs/router', () => ({
vi.mock('@/stores/license', () => ({
hasFeature: (...args: unknown[]) => hasFeatureMock(...args),
- loadLicenseStatus: (...args: unknown[]) => loadLicenseStatusMock(...args),
- licenseLoaded: (...args: unknown[]) => licenseLoadedMock(...args),
+ loadRuntimeCapabilities: (...args: unknown[]) => loadLicenseStatusMock(...args),
+ runtimeCapabilitiesLoaded: (...args: unknown[]) => licenseLoadedMock(...args),
}));
vi.mock('@/stores/licenseCommercial', () => ({
@@ -55,8 +55,9 @@ vi.mock('@/stores/licenseCommercial', () => ({
getUpgradeActionUrlOrFallback: (...args: unknown[]) => getUpgradeActionUrlOrFallbackMock(...args),
}));
-vi.mock('@/stores/demoMode', () => ({
- demoModeEnabled: () => demoModeEnabledMock(),
+vi.mock('@/stores/sessionPresentationPolicy', () => ({
+ presentationPolicyHidesCommercialSurfaces: () =>
+ presentationPolicyHidesCommercialSurfacesMock(),
}));
vi.mock('@/api/relay', () => ({
@@ -110,8 +111,8 @@ function resetAllMocks() {
licenseLoadedMock.mockReset();
getUpgradeActionDestinationMock.mockReset();
getUpgradeActionUrlOrFallbackMock.mockReset();
- demoModeEnabledMock.mockReset();
- demoModeEnabledMock.mockReturnValue(false);
+ presentationPolicyHidesCommercialSurfacesMock.mockReset();
+ presentationPolicyHidesCommercialSurfacesMock.mockReturnValue(false);
}
/**
@@ -219,7 +220,7 @@ describe('RelayOnboardingCard', () => {
it('hides the relay paywall entirely in demo mode', async () => {
setupWithoutRelayFeature();
- demoModeEnabledMock.mockReturnValue(true);
+ presentationPolicyHidesCommercialSurfacesMock.mockReturnValue(true);
render(() => <RelayOnboardingCard />);
await waitFor(() => {
diff --git a/frontend-modern/src/components/Dashboard/useRelayOnboardingCardState.ts b/frontend-modern/src/components/Dashboard/useRelayOnboardingCardState.ts
index 6ff90c29d0..e933f6cf1f 100644
--- a/frontend-modern/src/components/Dashboard/useRelayOnboardingCardState.ts
+++ b/frontend-modern/src/components/Dashboard/useRelayOnboardingCardState.ts
@@ -3,8 +3,8 @@ import { useNavigate } from '@solidjs/router';
import { RelayAPI, type RelayStatus } from '@/api/relay';
import {
hasFeature,
- licenseLoaded,
- loadLicenseStatus,
+ runtimeCapabilitiesLoaded,
+ loadRuntimeCapabilities,
} from '@/stores/license';
import { logger } from '@/utils/logger';
import { isUpsellSnoozed, snoozeUpsell } from '@/utils/snooze';
@@ -18,7 +18,7 @@ const RELAY_SETTINGS_PATH = '/settings/system-relay';
export function useRelayOnboardingCardState() {
const navigate = useNavigate();
const [dismissed, setDismissed] = createSignal(isUpsellSnoozed(SNOOZE_KEY));
- const [licenseReady, setLicenseReady] = createSignal<boolean>(licenseLoaded());
+ const [licenseReady, setLicenseReady] = createSignal<boolean>(runtimeCapabilitiesLoaded());
const [status, setStatus] = createSignal<RelayStatus | null>(null);
const [statusLoaded, setStatusLoaded] = createSignal(false);
const [statusLoading, setStatusLoading] = createSignal(false);
@@ -63,7 +63,7 @@ export function useRelayOnboardingCardState() {
onMount(async () => {
try {
- await loadLicenseStatus();
+ await loadRuntimeCapabilities();
} finally {
setLicenseReady(true);
}
@@ -115,7 +115,7 @@ export function useRelayOnboardingCardState() {
showError,
});
if (outcome === 'activated') {
- await loadLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
setStatusLoaded(false);
void loadRelayStatusOnce();
}
diff --git a/frontend-modern/src/components/DemoBanner.tsx b/frontend-modern/src/components/DemoBanner.tsx
index facf95eaf6..3993e0eb0d 100644
--- a/frontend-modern/src/components/DemoBanner.tsx
+++ b/frontend-modern/src/components/DemoBanner.tsx
@@ -1,5 +1,5 @@
import { createSignal, onMount, Show } from 'solid-js';
-import { demoModeEnabled } from '@/stores/demoMode';
+import { presentationPolicyIsDemoMode } from '@/stores/sessionPresentationPolicy';
export function DemoBanner() {
const [dismissed, setDismissed] = createSignal(false);
@@ -17,7 +17,7 @@ export function DemoBanner() {
};
return (
- <Show when={demoModeEnabled() && !dismissed()}>
+ <Show when={presentationPolicyIsDemoMode() && !dismissed()}>
<div class="bg-blue-50 dark:bg-blue-900 border-b border-blue-200 dark:border-blue-800 px-3 py-2">
<div class="container mx-auto flex items-center justify-between text-sm">
<div class="flex items-center gap-2 text-blue-700 dark:text-blue-300">
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/AgentDeployWizardE2E.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/AgentDeployWizardE2E.test.tsx
index 115b8a728e..b3c018da65 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/AgentDeployWizardE2E.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/AgentDeployWizardE2E.test.tsx
@@ -36,7 +36,7 @@ const { agentDeployAPIMock, nodesAPIMock, getLimitMock, copyToClipboardMock, log
vi.mock('@/api/agentDeploy', () => ({ AgentDeployAPI: agentDeployAPIMock }));
vi.mock('@/api/nodes', () => ({ NodesAPI: nodesAPIMock }));
-vi.mock('@/stores/license', () => ({ getLimit: getLimitMock }));
+vi.mock('@/stores/license', () => ({ getRuntimeLimit: getLimitMock }));
vi.mock('@/utils/clipboard', () => ({ copyToClipboard: copyToClipboardMock }));
vi.mock('@/utils/logger', () => ({ logger: loggerMock }));
diff --git a/frontend-modern/src/components/Login.tsx b/frontend-modern/src/components/Login.tsx
index c63b3d1f2b..3a6faa850c 100644
--- a/frontend-modern/src/components/Login.tsx
+++ b/frontend-modern/src/components/Login.tsx
@@ -271,7 +271,9 @@ export const Login: Component<LoginProps> = (props) => {
oidcLoading,
oidcError,
oidcMessage,
- demoModeEnabled: authStatus()?.sessionCapabilities?.demoMode === true,
+ demoModeEnabled:
+ authStatus()?.presentationPolicy?.demoMode === true ||
+ authStatus()?.sessionCapabilities?.demoMode === true,
showLocalLogin: shouldShowLocalLogin(),
ssoProviders: ssoProviders(),
}}
diff --git a/frontend-modern/src/components/Settings/SSOProvidersPanel.tsx b/frontend-modern/src/components/Settings/SSOProvidersPanel.tsx
index 7ef2609bbb..868e41f9e8 100644
--- a/frontend-modern/src/components/Settings/SSOProvidersPanel.tsx
+++ b/frontend-modern/src/components/Settings/SSOProvidersPanel.tsx
@@ -81,7 +81,7 @@ export const SSOProvidersPanel: Component<SSOProvidersPanelProps> = (props) => {
canTest,
fetchMetadataPreview,
getUpgradeActionDestination,
- licenseLoaded,
+ runtimeCapabilitiesLoaded,
trackUpgradeClicked,
} = useSSOProvidersState(props);
@@ -147,7 +147,7 @@ export const SSOProvidersPanel: Component<SSOProvidersPanelProps> = (props) => {
</Show>
{/* License banner */}
- <Show when={licenseLoaded() && !hasAdvancedSSO() && !loading()}>
+ <Show when={runtimeCapabilitiesLoaded() && !hasAdvancedSSO() && !loading()}>
<div class="p-4 bg-surface-alt border border-border rounded-md">
<div class="flex flex-col sm:flex-row items-center gap-4">
<div class="flex-1">
@@ -208,7 +208,7 @@ export const SSOProvidersPanel: Component<SSOProvidersPanelProps> = (props) => {
{getSSOProviderAddButtonLabel('saml')}
</button>
</Show>
- <Show when={licenseLoaded() && !hasAdvancedSSO()}>
+ <Show when={runtimeCapabilitiesLoaded() && !hasAdvancedSSO()}>
<button
type="button"
onClick={() => setShowSamlUpsell(true)}
diff --git a/frontend-modern/src/components/Settings/Settings.tsx b/frontend-modern/src/components/Settings/Settings.tsx
index 8037df7a7f..4e1c693e35 100644
--- a/frontend-modern/src/components/Settings/Settings.tsx
+++ b/frontend-modern/src/components/Settings/Settings.tsx
@@ -1,4 +1,4 @@
-import { Component, createSignal, onMount, Show, Suspense, createMemo } from 'solid-js';
+import { Component, createSignal, onMount, Show, Suspense, createMemo, createEffect } from 'solid-js';
import { Dynamic } from 'solid-js/web';
import { useNavigate, useLocation } from '@solidjs/router';
import { useWebSocket } from '@/contexts/appRuntime';
@@ -19,10 +19,14 @@ import { useSettingsNavigation } from './useSettingsNavigation';
import { getSettingsLoadingState } from '@/utils/settingsShellPresentation';
import {
- getLimit,
- loadLicenseStatus as loadRuntimeLicenseStatus,
+ getRuntimeLimit,
+ loadRuntimeCapabilities,
} from '@/stores/license';
import { isPro, loadCommercialPosture } from '@/stores/licenseCommercial';
+import {
+ presentationPolicyHidesCommercialSurfaces,
+ sessionPresentationPolicyResolved,
+} from '@/stores/sessionPresentationPolicy';
interface SettingsProps {
darkMode: () => boolean;
@@ -51,9 +55,9 @@ const Settings: Component<SettingsProps> = (props) => {
setSearchQuery,
} = useSettingsShellState({ activeTab });
const organizationMonitoredSystemUsage = createMemo(
- () => getLimit('max_monitored_systems')?.current ?? 0,
+ () => getRuntimeLimit('max_monitored_systems')?.current ?? 0,
);
- const organizationGuestUsage = createMemo(() => getLimit('max_guests')?.current ?? 0);
+ const organizationGuestUsage = createMemo(() => getRuntimeLimit('max_guests')?.current ?? 0);
const discoverySettings = useDiscoverySettingsState();
// Security
@@ -153,7 +157,16 @@ const Settings: Component<SettingsProps> = (props) => {
});
onMount(() => {
- void loadRuntimeLicenseStatus();
+ void loadRuntimeCapabilities();
+ });
+
+ createEffect(() => {
+ if (!sessionPresentationPolicyResolved()) {
+ return;
+ }
+ if (presentationPolicyHidesCommercialSurfaces()) {
+ return;
+ }
void loadCommercialPosture();
});
diff --git a/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx b/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx
index cbd13707b6..62548dbb6a 100644
--- a/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/AISettings.test.tsx
@@ -71,7 +71,7 @@ vi.mock('@/utils/logger', () => ({
vi.mock('@/stores/license', () => ({
hasFeature: (...args: unknown[]) => hasFeatureMock(...args),
- loadLicenseStatus: (...args: unknown[]) => loadLicenseStatusMock(...args),
+ loadRuntimeCapabilities: (...args: unknown[]) => loadLicenseStatusMock(...args),
}));
vi.mock('@/stores/licenseCommercial', () => ({
@@ -79,7 +79,7 @@ vi.mock('@/stores/licenseCommercial', () => ({
entitlements: (...args: unknown[]) => entitlementsMock(...args),
getUpgradeActionDestination: () => ({ href: 'https://example.com/upgrade', external: true }),
loadCommercialPosture: (...args: unknown[]) => loadCommercialPostureMock(...args),
- loadLicenseStatus: (...args: unknown[]) => loadLicenseStatusMock(...args),
+ loadRuntimeCapabilities: (...args: unknown[]) => loadLicenseStatusMock(...args),
}));
vi.mock('@/utils/trialStartAction', () => ({
diff --git a/frontend-modern/src/components/Settings/__tests__/AgentProfilesPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/AgentProfilesPanel.test.tsx
index 01c52e73b0..6dd99173d4 100644
--- a/frontend-modern/src/components/Settings/__tests__/AgentProfilesPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/AgentProfilesPanel.test.tsx
@@ -33,9 +33,9 @@ vi.mock('@/contexts/appRuntime', () => ({
vi.mock('@/stores/license', () => ({
hasFeature: () => true,
- licenseLoaded: () => true,
- loadLicenseStatus: () => Promise.resolve(),
- licenseLoading: () => false,
+ runtimeCapabilitiesLoaded: () => true,
+ loadRuntimeCapabilities: () => Promise.resolve(),
+ runtimeCapabilitiesLoading: () => false,
}));
vi.mock('@/stores/licenseCommercial', () => ({
@@ -44,7 +44,7 @@ vi.mock('@/stores/licenseCommercial', () => ({
getUpgradeActionDestination: (...args: unknown[]) => getUpgradeActionDestinationMock(...args),
getUpgradeActionUrlOrFallback: (...args: unknown[]) => getUpgradeActionUrlOrFallbackMock(...args),
loadCommercialPosture: () => Promise.resolve(),
- loadLicenseStatus: () => Promise.resolve(),
+ loadRuntimeCapabilities: () => Promise.resolve(),
startProTrial: vi.fn(),
}));
diff --git a/frontend-modern/src/components/Settings/__tests__/NodeModal.guardrails.test.ts b/frontend-modern/src/components/Settings/__tests__/NodeModal.guardrails.test.ts
index 774d0545c3..94d079f1f4 100644
--- a/frontend-modern/src/components/Settings/__tests__/NodeModal.guardrails.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/NodeModal.guardrails.test.ts
@@ -55,8 +55,8 @@ describe('NodeModal guardrails', () => {
expect(nodeModalSource).toContain('useNodeModalState');
expect(nodeModalStateSource).toContain("from '@/stores/licenseCommercial';");
expect(nodeModalStateSource).not.toContain("from '@/stores/license';\n");
- expect(nodeModalStateSource).toContain('void loadLicenseStatus();');
- expect(nodeModalStateSource).toContain('const ent = licenseStatus();');
+ expect(nodeModalStateSource).toContain('void loadCommercialPosture();');
+ expect(nodeModalStateSource).toContain('const ent = commercialPosture();');
expect(nodeModalStateSource).toContain('const copyProxmoxAgentInstallCommand = async (');
expect(nodeModalStateSource).toContain("const data = await NodesAPI.getAgentInstallCommand({");
expect(nodeModalStateSource).toContain('type,');
diff --git a/frontend-modern/src/components/Settings/__tests__/NodeModal.installCommand.test.tsx b/frontend-modern/src/components/Settings/__tests__/NodeModal.installCommand.test.tsx
index 3b540d8729..07b527eae6 100644
--- a/frontend-modern/src/components/Settings/__tests__/NodeModal.installCommand.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/NodeModal.installCommand.test.tsx
@@ -40,8 +40,8 @@ vi.mock('@/components/shared/Dialog', () => ({
}));
vi.mock('@/stores/licenseCommercial', () => ({
- licenseStatus: () => 'active',
- loadLicenseStatus: vi.fn(),
+ commercialPosture: () => ({ subscription_state: 'active', trial_eligible: false }),
+ loadCommercialPosture: vi.fn(),
startProTrial: vi.fn(),
}));
diff --git a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
index cf465228f4..09a4f5462f 100644
--- a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
@@ -48,7 +48,7 @@ vi.mock('@solidjs/router', async (importOriginal) => {
vi.mock('@/stores/license', () => ({
isMultiTenantEnabled: () => true,
- loadLicenseStatus: (...args: unknown[]) => loadRuntimeLicenseStatusMock(...args),
+ loadRuntimeCapabilities: (...args: unknown[]) => loadRuntimeLicenseStatusMock(...args),
}));
vi.mock('@/stores/licenseCommercial', () => ({
@@ -562,7 +562,7 @@ describe('ProLicensePanel', () => {
expect(proLicensePanelStateSource).toContain('const setActiveSection = (section: SelfHostedBillingSection) => {');
expect(proLicensePanelStateSource).toContain('loadLicenseEntitlements(true)');
expect(proLicensePanelStateSource).toContain('loadCommercialPosture(true)');
- expect(proLicensePanelStateSource).toContain('loadRuntimeLicenseStatus(true)');
+ expect(proLicensePanelStateSource).toContain('loadRuntimeCapabilities(true)');
expect(proLicensePanelStateSource).toContain('buildSelfHostedCommercialPlanModel');
expect(proLicensePanelStateSource).toContain('runStartProTrialAction({');
expect(proLicensePanelStateSource).not.toContain('startProTrial()');
diff --git a/frontend-modern/src/components/Settings/__tests__/RBACPaywallPanels.test.tsx b/frontend-modern/src/components/Settings/__tests__/RBACPaywallPanels.test.tsx
index b0ec8f775c..414cff956b 100644
--- a/frontend-modern/src/components/Settings/__tests__/RBACPaywallPanels.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/RBACPaywallPanels.test.tsx
@@ -22,8 +22,8 @@ const loggerErrorMock = vi.fn();
vi.mock('@/stores/license', () => ({
hasFeature: (...args: unknown[]) => hasFeatureMock(...args),
- loadLicenseStatus: (...args: unknown[]) => loadLicenseStatusMock(...args),
- licenseLoaded: () => true,
+ loadRuntimeCapabilities: (...args: unknown[]) => loadLicenseStatusMock(...args),
+ runtimeCapabilitiesLoaded: () => true,
}));
vi.mock('@/stores/licenseCommercial', () => ({
@@ -34,7 +34,7 @@ vi.mock('@/stores/licenseCommercial', () => ({
}),
getUpgradeActionUrlOrFallback: (feature: string) => `/upgrade?feature=${feature}`,
loadCommercialPosture: (...args: unknown[]) => loadCommercialPostureMock(...args),
- loadLicenseStatus: (...args: unknown[]) => loadCommercialPostureMock(...args),
+ loadRuntimeCapabilities: (...args: unknown[]) => loadCommercialPostureMock(...args),
startProTrial: (...args: unknown[]) => startProTrialMock(...args),
entitlements: (...args: unknown[]) => entitlementsMock(...args),
}));
diff --git a/frontend-modern/src/components/Settings/__tests__/RelaySettingsPanel.runtime.test.tsx b/frontend-modern/src/components/Settings/__tests__/RelaySettingsPanel.runtime.test.tsx
index f01e83e590..4b17a0a894 100644
--- a/frontend-modern/src/components/Settings/__tests__/RelaySettingsPanel.runtime.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/RelaySettingsPanel.runtime.test.tsx
@@ -22,8 +22,8 @@ const qrToDataUrlMock = vi.fn();
vi.mock('@/stores/license', () => ({
hasFeature: (...args: unknown[]) => hasFeatureMock(...args),
- licenseLoaded: () => true,
- loadLicenseStatus: (...args: unknown[]) => loadLicenseStatusMock(...args),
+ runtimeCapabilitiesLoaded: () => true,
+ loadRuntimeCapabilities: (...args: unknown[]) => loadLicenseStatusMock(...args),
}));
vi.mock('@/stores/licenseCommercial', () => ({
@@ -31,7 +31,7 @@ vi.mock('@/stores/licenseCommercial', () => ({
getUpgradeActionDestination: () => ({ href: 'https://example.com/upgrade', external: true }),
entitlements: () => ({ trial_eligible: false }),
loadCommercialPosture: (...args: unknown[]) => loadCommercialPostureMock(...args),
- loadLicenseStatus: (...args: unknown[]) => loadLicenseStatusMock(...args),
+ loadRuntimeCapabilities: (...args: unknown[]) => loadLicenseStatusMock(...args),
startProTrial: vi.fn(),
}));
diff --git a/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts b/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts
index f9d0d9a0b4..eb7e5adc89 100644
--- a/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/monitoredSystemModelGuardrails.test.ts
@@ -463,12 +463,12 @@ describe('monitored-system model guardrails', () => {
expect(relayOnboardingCardSource).toContain('RELAY_ONBOARDING_SETUP_LABEL');
expect(relayOnboardingCardSource).toContain('RELAY_ONBOARDING_DISCONNECTED_LABEL');
expect(relayOnboardingCardSource).not.toContain('createSignal(');
- expect(relayOnboardingCardSource).not.toContain('loadLicenseStatus()');
+ expect(relayOnboardingCardSource).not.toContain('loadRuntimeCapabilities()');
expect(relayOnboardingCardSource).not.toContain('RelayAPI.getStatus()');
expect(relayOnboardingCardSource).not.toContain('startProTrial()');
expect(relayOnboardingCardSource).not.toContain('Pair Your Mobile Device');
expect(relayOnboardingCardSource).not.toContain('Relay is currently disconnected.');
- expect(relayOnboardingCardStateSource).toContain('loadLicenseStatus()');
+ expect(relayOnboardingCardStateSource).toContain('loadRuntimeCapabilities()');
expect(relayOnboardingCardStateSource).toContain('RelayAPI.getStatus()');
expect(relayOnboardingCardStateSource).toContain('trackPaywallViewed');
expect(relayOnboardingCardStateSource).toContain('runStartProTrialAction({');
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index 93b973b064..7710ff429b 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -581,7 +581,7 @@ describe('Settings architecture guardrails', () => {
expect(proLicensePanelStateSource).toContain('buildSelfHostedCommercialPlanModel');
expect(proLicensePanelStateSource).toContain('loadLicenseEntitlements(true)');
expect(proLicensePanelStateSource).toContain('loadCommercialPosture(true)');
- expect(proLicensePanelStateSource).toContain('loadRuntimeLicenseStatus(true)');
+ expect(proLicensePanelStateSource).toContain('loadRuntimeCapabilities(true)');
expect(proLicensePanelStateSource).toContain('runStartProTrialAction({');
expect(proLicensePanelStateSource).not.toContain('startProTrial()');
expect(proLicensePanelSource).not.toContain('title="Pulse Pro"');
@@ -628,7 +628,7 @@ describe('Settings architecture guardrails', () => {
expect(organizationBillingStateSource).toContain("eventBus.on('org_switched'");
expect(organizationBillingLoadingStateSource).toContain('animate-pulse');
expect(settingsSource).toContain('organizationMonitoredSystemUsage');
- expect(settingsSource).toContain("getLimit('max_monitored_systems')?.current ?? 0");
+ expect(settingsSource).toContain("getRuntimeLimit('max_monitored_systems')?.current ?? 0");
expect(settingsSource).not.toContain('organizationAgentUsage');
});
@@ -1202,12 +1202,12 @@ describe('Settings architecture guardrails', () => {
expect(reportingPanelSource).toContain('@/components/Settings/reportingPanelModel');
expect(reportingPanelSource).toContain('reportingCatalog');
expect(reportingPanelSource).toContain('title="Reporting"');
- expect(reportingPanelSource).not.toContain('loadLicenseStatus()');
+ expect(reportingPanelSource).not.toContain('loadRuntimeCapabilities()');
expect(reportingPanelSource).not.toContain('startProTrial()');
expect(reportingPanelSource).not.toContain("apiFetch('/api/admin/reports/generate");
expect(reportingPanelSource).not.toContain('window.URL.createObjectURL');
expect(reportingPanelStateSource).toContain('export const useReportingPanelState =');
- expect(reportingPanelStateSource).toContain('loadLicenseStatus');
+ expect(reportingPanelStateSource).toContain('loadRuntimeCapabilities');
expect(reportingPanelStateSource).toContain('runStartProTrialAction({');
expect(reportingPanelStateSource).toContain('getUpgradeActionDestination(');
expect(reportingPanelStateSource).not.toContain('startProTrial()');
@@ -1218,7 +1218,7 @@ describe('Settings architecture guardrails', () => {
expect(reportingPanelStateSource).toContain('reportingFeatureId');
expect(reportingPanelStateSource).toContain('loadReportingCatalog = async');
expect(reportingPanelSource).toContain('Retry');
- expect(reportingPanelStateSource).not.toContain('!licenseLoaded()');
+ expect(reportingPanelStateSource).not.toContain('!runtimeCapabilitiesLoaded()');
expect(reportingPanelStateSource).not.toContain('!isReportingEnabled()');
expect(reportingPanelStateSource).toContain('buildVMInventoryExportRequest');
expect(reportingPanelStateSource).toContain('apiErrorFromResponse');
@@ -1284,13 +1284,13 @@ describe('Settings architecture guardrails', () => {
it('keeps the audit webhook shell behind an extracted runtime owner', () => {
expect(auditWebhookPanelSource).toContain('@/components/Settings/useAuditWebhookPanelState');
expect(auditWebhookPanelSource).toContain('@/components/shared/UpgradeLink');
- expect(auditWebhookPanelSource).not.toContain('loadLicenseStatus();');
+ expect(auditWebhookPanelSource).not.toContain('loadRuntimeCapabilities();');
expect(auditWebhookPanelSource).not.toContain('const fetchWebhooks = async () =>');
expect(auditWebhookPanelSource).not.toContain('const saveWebhooks = async (urls: string[]) =>');
expect(auditWebhookPanelSource).not.toContain('trackPaywallViewed');
expect(auditWebhookPanelSource).not.toContain('target="_blank"');
expect(auditWebhookStateSource).toContain('export const useAuditWebhookPanelState =');
- expect(auditWebhookStateSource).toContain('loadLicenseStatus();');
+ expect(auditWebhookStateSource).toContain('loadRuntimeCapabilities();');
expect(auditWebhookStateSource).toContain('const fetchWebhooks = async () =>');
expect(auditWebhookStateSource).toContain('const saveWebhooks = async (urls: string[]) =>');
expect(auditWebhookStateSource).toContain('trackPaywallViewed');
@@ -1445,13 +1445,13 @@ describe('Settings architecture guardrails', () => {
});
it('keeps demo-mode billing visibility on the shared settings shell owner', () => {
- expect(settingsNavigationModelSource).toContain('hideInDemoMode?: boolean;');
- expect(settingsNavVisibilitySource).toContain('if (item.hideInDemoMode)');
- expect(settingsNavVisibilitySource).toContain('context.demoModeResolved === false');
- expect(settingsNavVisibilitySource).toContain('if (context.demoModeEnabled)');
- expect(getSettingsNavItem('system-billing')?.hideInDemoMode).toBe(true);
- expect(getSettingsNavItem('organization-billing')?.hideInDemoMode).toBe(true);
- expect(getSettingsNavItem('organization-billing-admin')?.hideInDemoMode).toBe(true);
+ expect(settingsNavigationModelSource).toContain('hideWhenCommercialHidden?: boolean;');
+ expect(settingsNavVisibilitySource).toContain('if (item.hideWhenCommercialHidden)');
+ expect(settingsNavVisibilitySource).toContain('context.presentationPolicyResolved === false');
+ expect(settingsNavVisibilitySource).toContain('if (context.presentationPolicyHidesCommercial)');
+ expect(getSettingsNavItem('system-billing')?.hideWhenCommercialHidden).toBe(true);
+ expect(getSettingsNavItem('organization-billing')?.hideWhenCommercialHidden).toBe(true);
+ expect(getSettingsNavItem('organization-billing-admin')?.hideWhenCommercialHidden).toBe(true);
});
it('keeps relay shell copy on the shared relay presentation owner', () => {
@@ -1503,7 +1503,7 @@ describe('Settings architecture guardrails', () => {
it('splits runtime capability reads from commercial entitlement reads across settings state owners', () => {
expect(settingsSource).toContain("from '@/stores/licenseCommercial';");
- expect(settingsSource).not.toContain("getLimit, isPro, loadLicenseStatus } from '@/stores/license';");
+ expect(settingsSource).not.toContain("getRuntimeLimit, isPro, loadRuntimeCapabilities } from '@/stores/license';");
expect(aiSettingsStateSource).toContain("} from '@/stores/license';");
expect(aiSettingsStateSource).toContain("} from '@/stores/licenseCommercial';");
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 a2058d81c8..b68d5a96b4 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsNavigation.integration.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/settingsNavigation.integration.test.tsx
@@ -62,7 +62,7 @@ describe('settingsNavigation integration scaffold', () => {
expect(
shouldHideSettingsNavItem('organization-overview', {
hasFeature: hasFeatures([]),
- licenseLoaded: () => false,
+ runtimeCapabilitiesLoaded: () => false,
hostedModeEnabled: false,
}),
).toBe(true);
@@ -70,7 +70,7 @@ describe('settingsNavigation integration scaffold', () => {
expect(
shouldHideSettingsNavItem('organization-overview', {
hasFeature: hasFeatures(['multi_tenant']),
- licenseLoaded: () => true,
+ runtimeCapabilitiesLoaded: () => true,
hostedModeEnabled: false,
}),
).toBe(false);
@@ -80,7 +80,7 @@ describe('settingsNavigation integration scaffold', () => {
expect(
shouldHideSettingsNavItem('organization-billing-admin', {
hasFeature: hasFeatures(['multi_tenant']),
- licenseLoaded: () => true,
+ runtimeCapabilitiesLoaded: () => true,
hostedModeEnabled: false,
settingsCapabilities: { billingAdmin: true },
}),
@@ -89,7 +89,7 @@ describe('settingsNavigation integration scaffold', () => {
expect(
shouldHideSettingsNavItem('organization-billing-admin', {
hasFeature: hasFeatures(['multi_tenant']),
- licenseLoaded: () => true,
+ runtimeCapabilitiesLoaded: () => true,
hostedModeEnabled: true,
settingsCapabilities: { billingAdmin: true },
}),
@@ -100,8 +100,8 @@ describe('settingsNavigation integration scaffold', () => {
expect(
shouldHideSettingsNavItem('system-billing', {
hasFeature: hasFeatures([]),
- licenseLoaded: () => true,
- demoModeEnabled: true,
+ runtimeCapabilitiesLoaded: () => true,
+ presentationPolicyHidesCommercial: true,
hostedModeEnabled: false,
}),
).toBe(true);
@@ -109,8 +109,8 @@ describe('settingsNavigation integration scaffold', () => {
expect(
shouldHideSettingsNavItem('organization-billing', {
hasFeature: hasFeatures(['multi_tenant']),
- licenseLoaded: () => true,
- demoModeEnabled: true,
+ runtimeCapabilitiesLoaded: () => true,
+ presentationPolicyHidesCommercial: true,
hostedModeEnabled: true,
}),
).toBe(true);
@@ -120,8 +120,8 @@ describe('settingsNavigation integration scaffold', () => {
expect(
shouldHideSettingsNavItem('system-billing', {
hasFeature: hasFeatures([]),
- licenseLoaded: () => true,
- demoModeResolved: false,
+ runtimeCapabilitiesLoaded: () => true,
+ presentationPolicyResolved: false,
hostedModeEnabled: false,
}),
).toBe(true);
@@ -129,8 +129,8 @@ describe('settingsNavigation integration scaffold', () => {
expect(
shouldHideSettingsNavItem('organization-billing', {
hasFeature: hasFeatures(['multi_tenant']),
- licenseLoaded: () => true,
- demoModeResolved: false,
+ runtimeCapabilitiesLoaded: () => true,
+ presentationPolicyResolved: false,
hostedModeEnabled: true,
}),
).toBe(true);
@@ -140,7 +140,7 @@ describe('settingsNavigation integration scaffold', () => {
expect(
shouldHideSettingsNavItem('api', {
hasFeature: hasFeatures([]),
- licenseLoaded: () => true,
+ runtimeCapabilitiesLoaded: () => true,
hostedModeEnabled: false,
settingsCapabilitiesResolved: true,
settingsCapabilities: { apiAccessRead: false },
@@ -150,7 +150,7 @@ describe('settingsNavigation integration scaffold', () => {
expect(
shouldHideSettingsNavItem('security-roles', {
hasFeature: hasFeatures(['rbac']),
- licenseLoaded: () => true,
+ runtimeCapabilitiesLoaded: () => true,
hostedModeEnabled: false,
settingsCapabilitiesResolved: true,
settingsCapabilities: { roles: false },
@@ -162,7 +162,7 @@ describe('settingsNavigation integration scaffold', () => {
expect(
shouldHideSettingsNavItem('api', {
hasFeature: hasFeatures([]),
- licenseLoaded: () => true,
+ runtimeCapabilitiesLoaded: () => true,
hostedModeEnabled: false,
settingsCapabilitiesResolved: false,
settingsCapabilities: null,
@@ -172,7 +172,7 @@ describe('settingsNavigation integration scaffold', () => {
expect(
shouldHideSettingsNavItem('security-auth', {
hasFeature: hasFeatures([]),
- licenseLoaded: () => true,
+ runtimeCapabilitiesLoaded: () => true,
hostedModeEnabled: false,
settingsCapabilitiesResolved: false,
settingsCapabilities: null,
@@ -184,7 +184,7 @@ describe('settingsNavigation integration scaffold', () => {
expect(
shouldHideSettingsNavItem('security-audit', {
hasFeature: hasFeatures(['audit_logging']),
- licenseLoaded: () => true,
+ runtimeCapabilitiesLoaded: () => true,
hostedModeEnabled: false,
settingsCapabilitiesResolved: true,
settingsCapabilities: { auditLog: true },
@@ -194,7 +194,7 @@ describe('settingsNavigation integration scaffold', () => {
expect(
shouldHideSettingsNavItem('system-relay', {
hasFeature: hasFeatures(['relay']),
- licenseLoaded: () => true,
+ runtimeCapabilitiesLoaded: () => true,
hostedModeEnabled: false,
settingsCapabilitiesResolved: true,
settingsCapabilities: { relayRead: true, relayWrite: false },
@@ -274,12 +274,12 @@ describe('settingsNavigation integration scaffold', () => {
});
});
- it('verifies Settings.tsx bootstrap calls only loadLicenseStatus', async () => {
+ it('verifies Settings.tsx bootstrap calls only loadRuntimeCapabilities', async () => {
const settingsSource = (await import('../Settings.tsx?raw')).default;
const onMountMatch = settingsSource.match(/onMount\(\(\)\s*=>\s*\{([^}]+)\}/);
expect(onMountMatch).toBeTruthy();
const onMountBody = onMountMatch![1];
- expect(onMountBody).toContain('loadLicenseStatus');
+ expect(onMountBody).toContain('loadRuntimeCapabilities');
expect(onMountBody).not.toContain('runDiagnostics');
expect(settingsSource).toContain('useSettingsAccess');
expect(settingsSource).toContain('useSettingsPanelRegistry');
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsReadOnlyPanels.test.tsx b/frontend-modern/src/components/Settings/__tests__/settingsReadOnlyPanels.test.tsx
index 999224c1c5..6f504a3306 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsReadOnlyPanels.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/settingsReadOnlyPanels.test.tsx
@@ -22,8 +22,8 @@ vi.mock('../QuickSecuritySetup', () => ({
vi.mock('@/stores/license', () => ({
hasFeature: (...args: unknown[]) => hasFeatureMock(...args),
- licenseLoaded: () => true,
- loadLicenseStatus: (...args: unknown[]) => loadLicenseStatusMock(...args),
+ runtimeCapabilitiesLoaded: () => true,
+ loadRuntimeCapabilities: (...args: unknown[]) => loadLicenseStatusMock(...args),
getUpgradeActionDestination: () => ({ href: 'https://example.com/upgrade', external: true }),
getUpgradeActionUrlOrFallback: () => '/upgrade',
startProTrial: vi.fn(),
diff --git a/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts b/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts
index b04c0899c3..71759a3731 100644
--- a/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts
@@ -115,18 +115,18 @@ describe('useReportingPanelState', () => {
vi.doMock('@/stores/license', () => ({
hasFeature: vi.fn((feature: string) => feature === 'advanced_reporting' && hasReportingFeature),
- licenseLoaded: vi.fn(() => true),
- loadLicenseStatus: loadRuntimeLicenseStatusMock,
+ runtimeCapabilitiesLoaded: vi.fn(() => true),
+ loadRuntimeCapabilities: loadRuntimeLicenseStatusMock,
}));
vi.doMock('@/stores/licenseCommercial', () => ({
- entitlements: vi.fn(() => ({ trial_eligible: true })),
+ commercialPosture: vi.fn(() => ({ trial_eligible: true })),
getUpgradeActionDestination: vi.fn((feature?: string) => ({
href: getPublicPricingUrl(feature),
external: true,
})),
getUpgradeActionUrlOrFallback: vi.fn((feature?: string) => getPublicPricingUrl(feature)),
- loadLicenseStatus: loadCommercialLicenseStatusMock,
+ loadCommercialPosture: loadCommercialLicenseStatusMock,
startProTrial: vi.fn(),
}));
@@ -214,18 +214,18 @@ describe('useReportingPanelState', () => {
vi.doMock('@/stores/license', () => ({
hasFeature: vi.fn(() => false),
- licenseLoaded: vi.fn(() => false),
- loadLicenseStatus: loadRuntimeLicenseStatusMock,
+ runtimeCapabilitiesLoaded: vi.fn(() => false),
+ loadRuntimeCapabilities: loadRuntimeLicenseStatusMock,
}));
vi.doMock('@/stores/licenseCommercial', () => ({
- entitlements: vi.fn(() => ({ trial_eligible: true })),
+ commercialPosture: vi.fn(() => ({ trial_eligible: true })),
getUpgradeActionDestination: vi.fn((feature?: string) => ({
href: getPublicPricingUrl(feature),
external: true,
})),
getUpgradeActionUrlOrFallback: vi.fn((feature?: string) => getPublicPricingUrl(feature)),
- loadLicenseStatus: loadCommercialLicenseStatusMock,
+ loadCommercialPosture: loadCommercialLicenseStatusMock,
startProTrial: vi.fn(),
}));
@@ -277,18 +277,18 @@ describe('useReportingPanelState', () => {
vi.doMock('@/stores/license', () => ({
hasFeature: vi.fn((feature: string) => feature === 'advanced_reporting' && hasReportingFeature),
- licenseLoaded: vi.fn(() => true),
- loadLicenseStatus: loadRuntimeLicenseStatusMock,
+ runtimeCapabilitiesLoaded: vi.fn(() => true),
+ loadRuntimeCapabilities: loadRuntimeLicenseStatusMock,
}));
vi.doMock('@/stores/licenseCommercial', () => ({
- entitlements: vi.fn(() => ({ trial_eligible: true })),
+ commercialPosture: vi.fn(() => ({ trial_eligible: true })),
getUpgradeActionDestination: vi.fn((feature?: string) => ({
href: getPublicPricingUrl(feature),
external: true,
})),
getUpgradeActionUrlOrFallback: vi.fn((feature?: string) => getPublicPricingUrl(feature)),
- loadLicenseStatus: loadCommercialLicenseStatusMock,
+ loadCommercialPosture: loadCommercialLicenseStatusMock,
startProTrial: vi.fn(),
}));
@@ -343,18 +343,18 @@ describe('useReportingPanelState', () => {
vi.doMock('@/stores/license', () => ({
hasFeature: vi.fn((feature: string) => feature === 'advanced_reporting' && hasReportingFeature),
- licenseLoaded: vi.fn(() => true),
- loadLicenseStatus: loadRuntimeLicenseStatusMock,
+ runtimeCapabilitiesLoaded: vi.fn(() => true),
+ loadRuntimeCapabilities: loadRuntimeLicenseStatusMock,
}));
vi.doMock('@/stores/licenseCommercial', () => ({
- entitlements: vi.fn(() => ({ trial_eligible: true })),
+ commercialPosture: vi.fn(() => ({ trial_eligible: true })),
getUpgradeActionDestination: vi.fn((feature?: string) => ({
href: getPublicPricingUrl(feature),
external: true,
})),
getUpgradeActionUrlOrFallback: vi.fn((feature?: string) => getPublicPricingUrl(feature)),
- loadLicenseStatus: loadCommercialLicenseStatusMock,
+ loadCommercialPosture: loadCommercialLicenseStatusMock,
startProTrial: vi.fn(),
}));
@@ -398,18 +398,18 @@ describe('useReportingPanelState', () => {
vi.doMock('@/stores/license', () => ({
hasFeature: vi.fn((feature: string) => feature === 'advanced_reporting' && hasReportingFeature),
- licenseLoaded: vi.fn(() => true),
- loadLicenseStatus: loadRuntimeLicenseStatusMock,
+ runtimeCapabilitiesLoaded: vi.fn(() => true),
+ loadRuntimeCapabilities: loadRuntimeLicenseStatusMock,
}));
vi.doMock('@/stores/licenseCommercial', () => ({
- entitlements: vi.fn(() => ({ trial_eligible: true })),
+ commercialPosture: vi.fn(() => ({ trial_eligible: true })),
getUpgradeActionDestination: vi.fn((feature?: string) => ({
href: getPublicPricingUrl(feature),
external: true,
})),
getUpgradeActionUrlOrFallback: vi.fn((feature?: string) => getPublicPricingUrl(feature)),
- loadLicenseStatus: loadCommercialLicenseStatusMock,
+ loadCommercialPosture: loadCommercialLicenseStatusMock,
startProTrial: vi.fn(),
}));
diff --git a/frontend-modern/src/components/Settings/settingsFeatureGates.ts b/frontend-modern/src/components/Settings/settingsFeatureGates.ts
index 3e8f43c7b2..c2cf2a3344 100644
--- a/frontend-modern/src/components/Settings/settingsFeatureGates.ts
+++ b/frontend-modern/src/components/Settings/settingsFeatureGates.ts
@@ -15,30 +15,30 @@ export const tabFeatureRequirements: Partial<Record<SettingsTab, string[]>> = {
export function isFeatureLocked(
features: string[] | undefined,
hasFeature: (feature: string) => boolean,
- licenseLoaded: () => boolean,
+ runtimeCapabilitiesLoaded: () => boolean,
): boolean {
if (!features || features.length === 0) return false;
- if (!licenseLoaded()) return false;
+ if (!runtimeCapabilitiesLoaded()) return false;
return !features.every((feature) => hasFeature(feature));
}
export function isTabLocked(
tab: SettingsTab,
hasFeature: (feature: string) => boolean,
- licenseLoaded: () => boolean,
+ runtimeCapabilitiesLoaded: () => boolean,
): boolean {
const requiredFeatures = tabFeatureRequirements[tab];
- return isFeatureLocked(requiredFeatures, hasFeature, licenseLoaded);
+ return isFeatureLocked(requiredFeatures, hasFeature, runtimeCapabilitiesLoaded);
}
export function getTabLockReason(
tab: SettingsTab,
hasFeature: (feature: string) => boolean,
- licenseLoaded: () => boolean,
+ runtimeCapabilitiesLoaded: () => boolean,
): string | null {
const requiredFeatures = tabFeatureRequirements[tab];
if (!requiredFeatures || requiredFeatures.length === 0) return null;
- if (!licenseLoaded()) return null;
+ if (!runtimeCapabilitiesLoaded()) return null;
if (requiredFeatures.every((feature) => hasFeature(feature))) return null;
const primaryRequiredFeature = requiredFeatures[0];
if (primaryRequiredFeature) {
diff --git a/frontend-modern/src/components/Settings/settingsNavCatalog.ts b/frontend-modern/src/components/Settings/settingsNavCatalog.ts
index 111fd185e0..a2cb027c3d 100644
--- a/frontend-modern/src/components/Settings/settingsNavCatalog.ts
+++ b/frontend-modern/src/components/Settings/settingsNavCatalog.ts
@@ -72,7 +72,7 @@ export const SETTINGS_NAV_GROUPS: SettingsNavGroup[] = [
iconProps: { strokeWidth: 2 },
features: ['multi_tenant'],
hideWhenUnavailable: true,
- hideInDemoMode: true,
+ hideWhenCommercialHidden: true,
},
{
id: 'organization-billing-admin',
@@ -82,7 +82,7 @@ export const SETTINGS_NAV_GROUPS: SettingsNavGroup[] = [
features: ['multi_tenant'],
hideWhenUnavailable: true,
hostedOnly: true,
- hideInDemoMode: true,
+ hideWhenCommercialHidden: true,
requiredCapability: 'billingAdmin',
},
],
@@ -129,7 +129,7 @@ export const SETTINGS_NAV_GROUPS: SettingsNavGroup[] = [
id: 'system-billing',
label: SELF_HOSTED_PRO_BILLING_PRESENTATION.shellTitle,
icon: PulseLogoIcon,
- hideInDemoMode: true,
+ hideWhenCommercialHidden: true,
},
],
},
diff --git a/frontend-modern/src/components/Settings/settingsNavVisibility.ts b/frontend-modern/src/components/Settings/settingsNavVisibility.ts
index cd65508784..9e87bf1a45 100644
--- a/frontend-modern/src/components/Settings/settingsNavVisibility.ts
+++ b/frontend-modern/src/components/Settings/settingsNavVisibility.ts
@@ -5,9 +5,9 @@ import type { SettingsTab } from './settingsNavigationModel';
export interface SettingsNavVisibilityContext {
hasFeature: (feature: string) => boolean;
- licenseLoaded: () => boolean;
- demoModeEnabled?: boolean;
- demoModeResolved?: boolean;
+ runtimeCapabilitiesLoaded: () => boolean;
+ presentationPolicyHidesCommercial?: boolean;
+ presentationPolicyResolved?: boolean;
hostedModeEnabled?: boolean;
settingsCapabilities?: Partial<SecurityStatusSettingsCapabilities> | null;
settingsCapabilitiesResolved?: boolean;
@@ -32,12 +32,12 @@ export function shouldHideSettingsNavItem(
return true;
}
- if (item.hideInDemoMode) {
- if (context.demoModeResolved === false) {
+ if (item.hideWhenCommercialHidden) {
+ if (context.presentationPolicyResolved === false) {
return true;
}
- if (context.demoModeEnabled) {
+ if (context.presentationPolicyHidesCommercial) {
return true;
}
}
@@ -66,5 +66,5 @@ export function isSettingsNavItemLocked(
return false;
}
- return isTabLocked(tab, context.hasFeature, context.licenseLoaded);
+ return isTabLocked(tab, context.hasFeature, context.runtimeCapabilitiesLoaded);
}
diff --git a/frontend-modern/src/components/Settings/settingsNavigationModel.ts b/frontend-modern/src/components/Settings/settingsNavigationModel.ts
index 49b5e6bc69..608d726032 100644
--- a/frontend-modern/src/components/Settings/settingsNavigationModel.ts
+++ b/frontend-modern/src/components/Settings/settingsNavigationModel.ts
@@ -49,7 +49,7 @@ export interface SettingsNavItem {
locked?: boolean;
hideWhenUnavailable?: boolean;
hostedOnly?: boolean;
- hideInDemoMode?: boolean;
+ hideWhenCommercialHidden?: boolean;
requiredCapability?: keyof SecurityStatusSettingsCapabilities;
badge?: string;
features?: string[];
diff --git a/frontend-modern/src/components/Settings/useAISettingsState.ts b/frontend-modern/src/components/Settings/useAISettingsState.ts
index b065be5fd7..99a1e6256f 100644
--- a/frontend-modern/src/components/Settings/useAISettingsState.ts
+++ b/frontend-modern/src/components/Settings/useAISettingsState.ts
@@ -12,7 +12,7 @@ import {
import { aiChatStore } from '@/stores/aiChat';
import {
hasFeature,
- loadLicenseStatus,
+ loadRuntimeCapabilities,
} from '@/stores/license';
import {
commercialPosture,
@@ -830,7 +830,7 @@ export const useAISettingsState = () => {
};
onMount(() => {
- loadLicenseStatus();
+ loadRuntimeCapabilities();
loadCommercialPosture();
if (typeof window !== 'undefined') {
diff --git a/frontend-modern/src/components/Settings/useAgentProfilesPanelState.ts b/frontend-modern/src/components/Settings/useAgentProfilesPanelState.ts
index 5f3c40172d..40b2d9712e 100644
--- a/frontend-modern/src/components/Settings/useAgentProfilesPanelState.ts
+++ b/frontend-modern/src/components/Settings/useAgentProfilesPanelState.ts
@@ -12,15 +12,15 @@ import { useResources } from '@/hooks/useResources';
import { notificationStore } from '@/stores/notifications';
import {
hasFeature as hasEntitlement,
- licenseLoaded,
- licenseLoading,
+ runtimeCapabilitiesLoaded,
+ runtimeCapabilitiesLoading,
} from '@/stores/license';
import {
commercialPosture,
getUpgradeActionDestination,
loadCommercialPosture,
} from '@/stores/licenseCommercial';
-import { loadLicenseStatus } from '@/stores/license';
+import { loadRuntimeCapabilities } from '@/stores/license';
import type { ConnectedInfrastructureItem } from '@/types/api';
import type { Resource } from '@/types/resource';
import { formatRelativeTime } from '@/utils/format';
@@ -75,7 +75,7 @@ export const useAgentProfilesPanelState = () => {
const { resources } = useResources();
const { state } = useWebSocket();
- const checkingLicense = () => !licenseLoaded() || licenseLoading();
+ const checkingLicense = () => !runtimeCapabilitiesLoaded() || runtimeCapabilitiesLoading();
const hasAgentProfiles = () => hasEntitlement('agent_profiles');
const [startingTrial, setStartingTrial] = createSignal(false);
const canStartTrial = () => commercialPosture()?.trial_eligible !== false;
@@ -237,7 +237,7 @@ export const useAgentProfilesPanelState = () => {
}, false);
onMount(async () => {
- await loadLicenseStatus();
+ await loadRuntimeCapabilities();
await loadCommercialPosture();
try {
diff --git a/frontend-modern/src/components/Settings/useAuditLogPanelState.ts b/frontend-modern/src/components/Settings/useAuditLogPanelState.ts
index ba2ba95568..8d0d86a1fc 100644
--- a/frontend-modern/src/components/Settings/useAuditLogPanelState.ts
+++ b/frontend-modern/src/components/Settings/useAuditLogPanelState.ts
@@ -9,14 +9,14 @@ import { apiFetch } from '@/utils/apiClient';
import { showSuccess, showToast, showWarning } from '@/utils/toast';
import {
hasFeature,
- licenseLoaded,
+ runtimeCapabilitiesLoaded,
} from '@/stores/license';
import {
commercialPosture,
getUpgradeActionDestination,
loadCommercialPosture,
} from '@/stores/licenseCommercial';
-import { loadLicenseStatus } from '@/stores/license';
+import { loadRuntimeCapabilities } from '@/stores/license';
import { trackPaywallViewed, trackUpgradeClicked } from '@/utils/upgradeMetrics';
import { runStartProTrialAction } from '@/utils/trialStartAction';
@@ -116,9 +116,9 @@ export const useAuditLogPanelState = () => {
);
const [startingTrial, setStartingTrial] = createSignal(false);
- const auditLoggingEnabled = createMemo(() => licenseLoaded() && hasFeature('audit_logging'));
+ const auditLoggingEnabled = createMemo(() => runtimeCapabilitiesLoaded() && hasFeature('audit_logging'));
const showUpgradePaywall = createMemo(
- () => licenseLoaded() && !auditLoggingEnabled() && !loading(),
+ () => runtimeCapabilitiesLoaded() && !auditLoggingEnabled() && !loading(),
);
const canStartTrial = () => commercialPosture()?.trial_eligible !== false;
const upgradeDestination = createMemo(() => getUpgradeActionDestination('audit_logging'));
@@ -544,12 +544,12 @@ export const useAuditLogPanelState = () => {
onMount(() => {
setIsMounted(true);
- void loadLicenseStatus();
+ void loadRuntimeCapabilities();
void loadCommercialPosture();
});
createEffect(() => {
- if (!licenseLoaded()) {
+ if (!runtimeCapabilitiesLoaded()) {
setLoading(true);
return;
}
diff --git a/frontend-modern/src/components/Settings/useAuditWebhookPanelState.ts b/frontend-modern/src/components/Settings/useAuditWebhookPanelState.ts
index 29a452b6d6..a8c17d8e5e 100644
--- a/frontend-modern/src/components/Settings/useAuditWebhookPanelState.ts
+++ b/frontend-modern/src/components/Settings/useAuditWebhookPanelState.ts
@@ -4,14 +4,14 @@ import { logger } from '@/utils/logger';
import { showSuccess, showWarning } from '@/utils/toast';
import {
hasFeature,
- licenseLoaded,
+ runtimeCapabilitiesLoaded,
} from '@/stores/license';
import {
commercialPosture,
getUpgradeActionDestination,
loadCommercialPosture,
} from '@/stores/licenseCommercial';
-import { loadLicenseStatus } from '@/stores/license';
+import { loadRuntimeCapabilities } from '@/stores/license';
import { trackPaywallViewed } from '@/utils/upgradeMetrics';
import {
getAuditWebhookDuplicateUrlMessage,
@@ -101,12 +101,12 @@ export const useAuditWebhookPanelState = (canManageOverride?: boolean) => {
};
onMount(() => {
- loadLicenseStatus();
+ loadRuntimeCapabilities();
loadCommercialPosture();
});
createEffect((wasPaywallVisible: boolean) => {
- const isPaywallVisible = licenseLoaded() && !hasFeature('audit_logging');
+ const isPaywallVisible = runtimeCapabilitiesLoaded() && !hasFeature('audit_logging');
if (isPaywallVisible && !wasPaywallVisible) {
trackPaywallViewed('audit_logging', 'settings_audit_webhook_panel');
}
diff --git a/frontend-modern/src/components/Settings/useProLicensePanelState.ts b/frontend-modern/src/components/Settings/useProLicensePanelState.ts
index 31eff26ff7..7f5e2e9790 100644
--- a/frontend-modern/src/components/Settings/useProLicensePanelState.ts
+++ b/frontend-modern/src/components/Settings/useProLicensePanelState.ts
@@ -5,7 +5,7 @@ import {
loadCommercialPosture,
} from '@/stores/licenseCommercial';
import { isMultiTenantEnabled } from '@/stores/license';
-import { loadLicenseStatus as loadRuntimeLicenseStatus } from '@/stores/license';
+import { loadRuntimeCapabilities } from '@/stores/license';
import {
licenseEntitlements,
licenseEntitlementsLoadError,
@@ -273,7 +273,7 @@ export function useProLicensePanelState() {
await Promise.all([
loadPanelData(),
loadCommercialPosture(true),
- loadRuntimeLicenseStatus(true),
+ loadRuntimeCapabilities(true),
]);
} catch (error) {
notificationStore.error(error instanceof Error ? error.message : 'Failed to activate license');
@@ -293,7 +293,7 @@ export function useProLicensePanelState() {
await Promise.all([
loadPanelData(),
loadCommercialPosture(true),
- loadRuntimeLicenseStatus(true),
+ loadRuntimeCapabilities(true),
]);
} catch (error) {
notificationStore.error(error instanceof Error ? error.message : 'Failed to clear license');
diff --git a/frontend-modern/src/components/Settings/useRBACFeatureGateState.ts b/frontend-modern/src/components/Settings/useRBACFeatureGateState.ts
index 5441c0bbf7..1af886e07a 100644
--- a/frontend-modern/src/components/Settings/useRBACFeatureGateState.ts
+++ b/frontend-modern/src/components/Settings/useRBACFeatureGateState.ts
@@ -1,13 +1,13 @@
import { Accessor, createEffect, createMemo, createSignal, onMount } from 'solid-js';
import {
hasFeature,
- licenseLoaded,
+ runtimeCapabilitiesLoaded,
} from '@/stores/license';
import {
commercialPosture,
loadCommercialPosture,
} from '@/stores/licenseCommercial';
-import { loadLicenseStatus } from '@/stores/license';
+import { loadRuntimeCapabilities } from '@/stores/license';
import { notificationStore } from '@/stores/notifications';
import { getRBACFeatureGateCopy, type RBACFeatureGateCopy } from '@/utils/rbacPresentation';
import { trackPaywallViewed } from '@/utils/upgradeMetrics';
@@ -30,7 +30,7 @@ export function useRBACFeatureGateState(options: UseRBACFeatureGateStateOptions)
const featureGateCopy = createMemo<RBACFeatureGateCopy>(() =>
getRBACFeatureGateCopy(options.kind),
);
- const licenseReady = createMemo(() => licenseLoaded());
+ const licenseReady = createMemo(() => runtimeCapabilitiesLoaded());
const canStartTrial = createMemo(() => commercialPosture()?.trial_eligible !== false);
const rbacEnabled = createMemo(() => licenseReady() && hasFeature('rbac'));
const paywallVisible = createMemo(
@@ -38,7 +38,7 @@ export function useRBACFeatureGateState(options: UseRBACFeatureGateStateOptions)
);
onMount(() => {
- void loadLicenseStatus();
+ void loadRuntimeCapabilities();
void loadCommercialPosture();
});
diff --git a/frontend-modern/src/components/Settings/useRelaySettingsPanelState.ts b/frontend-modern/src/components/Settings/useRelaySettingsPanelState.ts
index 68f0e76894..2cc7222cb7 100644
--- a/frontend-modern/src/components/Settings/useRelaySettingsPanelState.ts
+++ b/frontend-modern/src/components/Settings/useRelaySettingsPanelState.ts
@@ -1,14 +1,14 @@
import { createEffect, createMemo, createSignal, onCleanup, onMount } from 'solid-js';
import {
hasFeature,
- licenseLoaded,
+ runtimeCapabilitiesLoaded,
} from '@/stores/license';
import {
commercialPosture,
getUpgradeActionDestination,
loadCommercialPosture,
} from '@/stores/licenseCommercial';
-import { loadLicenseStatus } from '@/stores/license';
+import { loadRuntimeCapabilities } from '@/stores/license';
import { trackPaywallViewed } from '@/utils/upgradeMetrics';
import { showError, showSuccess } from '@/utils/toast';
import { RelayAPI, type RelayConfig, type RelayStatus } from '@/api/relay';
@@ -46,7 +46,7 @@ export function useRelaySettingsPanelState(props: RelaySettingsPanelProps) {
const canShowPairing = createMemo(() => Boolean(config()?.enabled && status()?.connected));
createEffect((wasPaywallVisible: boolean) => {
- const isPaywallVisible = licenseLoaded() && !relayEnabled();
+ const isPaywallVisible = runtimeCapabilitiesLoaded() && !relayEnabled();
if (isPaywallVisible && !wasPaywallVisible) {
trackPaywallViewed('relay', 'settings_relay_panel');
}
@@ -134,7 +134,7 @@ export function useRelaySettingsPanelState(props: RelaySettingsPanelProps) {
};
onMount(async () => {
- await Promise.all([loadLicenseStatus(), loadCommercialPosture()]);
+ await Promise.all([loadRuntimeCapabilities(), loadCommercialPosture()]);
if (!relayEnabled()) {
setLoading(false);
return;
diff --git a/frontend-modern/src/components/Settings/useReportingPanelState.ts b/frontend-modern/src/components/Settings/useReportingPanelState.ts
index 8e670746f6..df0f72c9a1 100644
--- a/frontend-modern/src/components/Settings/useReportingPanelState.ts
+++ b/frontend-modern/src/components/Settings/useReportingPanelState.ts
@@ -4,14 +4,14 @@ import { showSuccess, showWarning } from '@/utils/toast';
import type { SelectedResource } from '@/components/Settings/ResourcePicker';
import {
hasFeature,
- licenseLoaded,
+ runtimeCapabilitiesLoaded,
} from '@/stores/license';
import {
commercialPosture,
getUpgradeActionDestination,
loadCommercialPosture,
} from '@/stores/licenseCommercial';
-import { loadLicenseStatus } from '@/stores/license';
+import { loadRuntimeCapabilities } from '@/stores/license';
import { trackPaywallViewed } from '@/utils/upgradeMetrics';
import {
getReportingCatalogErrorMessage,
@@ -55,12 +55,12 @@ export const useReportingPanelState = () => {
const reportingFeatureId = () => reportingCatalog()?.id ?? '';
const isLocked = () =>
- licenseLoaded() &&
+ runtimeCapabilitiesLoaded() &&
reportingFeatureId() !== '' &&
!hasFeature(reportingFeatureId());
const canStartTrial = () => commercialPosture()?.trial_eligible !== false;
const isReportingEnabled = () =>
- licenseLoaded() &&
+ runtimeCapabilitiesLoaded() &&
reportingFeatureId() !== '' &&
hasFeature(reportingFeatureId());
const upgradeDestination = () =>
@@ -69,7 +69,7 @@ export const useReportingPanelState = () => {
: getUpgradeActionDestination(reportingFeatureId());
onMount(() => {
- loadLicenseStatus();
+ loadRuntimeCapabilities();
loadCommercialPosture();
});
diff --git a/frontend-modern/src/components/Settings/useSSOProvidersState.ts b/frontend-modern/src/components/Settings/useSSOProvidersState.ts
index b34fd43057..0061d45696 100644
--- a/frontend-modern/src/components/Settings/useSSOProvidersState.ts
+++ b/frontend-modern/src/components/Settings/useSSOProvidersState.ts
@@ -4,14 +4,14 @@ import { notificationStore } from '@/stores/notifications';
import { logger } from '@/utils/logger';
import {
hasFeature,
- licenseLoaded,
+ runtimeCapabilitiesLoaded,
} from '@/stores/license';
import {
commercialPosture,
getUpgradeActionDestination,
loadCommercialPosture,
} from '@/stores/licenseCommercial';
-import { loadLicenseStatus } from '@/stores/license';
+import { loadRuntimeCapabilities } from '@/stores/license';
import { trackPaywallViewed, trackUpgradeClicked } from '@/utils/upgradeMetrics';
import {
getSSOCopySuccessMessage,
@@ -90,7 +90,7 @@ export const useSSOProvidersState = (props: SSOProvidersPanelProps) => {
};
createEffect((wasBannerVisible) => {
- const isBannerVisible = licenseLoaded() && !hasAdvancedSSO() && !loading();
+ const isBannerVisible = runtimeCapabilitiesLoaded() && !hasAdvancedSSO() && !loading();
if (isBannerVisible && !wasBannerVisible) {
trackPaywallViewed('advanced_sso', 'settings_sso_providers_banner');
}
@@ -130,7 +130,7 @@ export const useSSOProvidersState = (props: SSOProvidersPanelProps) => {
};
onMount(() => {
- loadLicenseStatus();
+ loadRuntimeCapabilities();
loadCommercialPosture();
void loadProviders();
});
@@ -366,7 +366,7 @@ export const useSSOProvidersState = (props: SSOProvidersPanelProps) => {
canTest,
fetchMetadataPreview,
getUpgradeActionDestination,
- licenseLoaded,
+ runtimeCapabilitiesLoaded,
trackUpgradeClicked,
};
};
diff --git a/frontend-modern/src/components/Settings/useSettingsAccess.ts b/frontend-modern/src/components/Settings/useSettingsAccess.ts
index 45035a777b..672e4f1504 100644
--- a/frontend-modern/src/components/Settings/useSettingsAccess.ts
+++ b/frontend-modern/src/components/Settings/useSettingsAccess.ts
@@ -1,9 +1,12 @@
import { Accessor, createEffect, createMemo, createSignal } from 'solid-js';
-import { syncDemoModeFromSecurityStatus } from '@/stores/demoMode';
-import { sessionCapabilities, sessionCapabilitiesResolved } from '@/stores/sessionCapabilities';
+import {
+ presentationPolicyHidesCommercialSurfaces,
+ sessionPresentationPolicyResolved,
+ syncSessionPresentationPolicy,
+} from '@/stores/sessionPresentationPolicy';
import type { SecurityStatus } from '@/types/config';
import { logger } from '@/utils/logger';
-import { hasFeature, isHostedModeEnabled, licenseLoaded } from '@/stores/license';
+import { hasFeature, isHostedModeEnabled, runtimeCapabilitiesLoaded } from '@/stores/license';
import { DEFAULT_SETTINGS_TAB, type SettingsTab } from './settingsNavigationModel';
import { tabFeatureRequirements } from './settingsFeatureGates';
import { SETTINGS_HEADER_META } from './settingsHeaderMeta';
@@ -23,15 +26,18 @@ export function useSettingsAccess({
}: UseSettingsAccessParams) {
const [securityStatus, setSecurityStatus] = createSignal<SecurityStatus | null>(null);
const [securityStatusLoading, setSecurityStatusLoading] = createSignal(true);
- const demoModeEnabled = createMemo(() => {
+ const commercialSurfacesHidden = createMemo(() => {
const resolvedSecurityStatus = securityStatus();
if (resolvedSecurityStatus) {
- return resolvedSecurityStatus.sessionCapabilities?.demoMode === true;
+ return (
+ resolvedSecurityStatus.presentationPolicy?.hideCommercial === true ||
+ resolvedSecurityStatus.sessionCapabilities?.demoMode === true
+ );
}
- return sessionCapabilities().demoMode;
+ return presentationPolicyHidesCommercialSurfaces();
});
- const demoModeResolved = createMemo(
- () => securityStatus() !== null || sessionCapabilitiesResolved(),
+ const presentationPolicyResolved = createMemo(
+ () => securityStatus() !== null || sessionPresentationPolicyResolved(),
);
const visibleTabGroups = createMemo(() => {
@@ -46,9 +52,9 @@ export function useSettingsAccess({
(item) =>
!shouldHideSettingsNavItem(item.id, {
hasFeature,
- licenseLoaded,
- demoModeEnabled: demoModeEnabled(),
- demoModeResolved: demoModeResolved(),
+ runtimeCapabilitiesLoaded,
+ presentationPolicyHidesCommercial: commercialSurfacesHidden(),
+ presentationPolicyResolved: presentationPolicyResolved(),
hostedModeEnabled,
settingsCapabilities,
settingsCapabilitiesResolved,
@@ -84,11 +90,13 @@ export function useSettingsAccess({
const current = activeTab();
const requiresFeatureResolution = Boolean(tabFeatureRequirements[current]?.length);
const requiresCapabilityResolution = Boolean(getSettingsNavItem(current)?.requiredCapability);
- const requiresDemoModeResolution = Boolean(getSettingsNavItem(current)?.hideInDemoMode);
+ const requiresPresentationPolicyResolution = Boolean(
+ getSettingsNavItem(current)?.hideWhenCommercialHidden,
+ );
if (
- (requiresFeatureResolution && !licenseLoaded()) ||
+ (requiresFeatureResolution && !runtimeCapabilitiesLoaded()) ||
(requiresCapabilityResolution && securityStatusLoading()) ||
- (requiresDemoModeResolution && !demoModeResolved())
+ (requiresPresentationPolicyResolution && !presentationPolicyResolved())
) {
return;
}
@@ -106,7 +114,7 @@ export function useSettingsAccess({
if (response.ok) {
const status = (await response.json()) as SecurityStatus;
logger.debug('Security status loaded', status);
- syncDemoModeFromSecurityStatus(status);
+ syncSessionPresentationPolicy(status);
setSecurityStatus(status);
} else {
logger.error('Failed to fetch security status', { status: response.status });
diff --git a/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.test.tsx b/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.test.tsx
index 6b1d99722c..07182e5e39 100644
--- a/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.test.tsx
+++ b/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPanel.test.tsx
@@ -54,8 +54,8 @@ vi.mock('@/utils/url', () => ({
}));
vi.mock('@/stores/licenseCommercial', () => ({
- loadLicenseStatus: (...args: unknown[]) => loadLicenseStatusMock(...args),
- entitlements: () => ({ relay: false }),
+ loadCommercialPosture: (...args: unknown[]) => loadLicenseStatusMock(...args),
+ commercialPosture: () => ({ relay: false }),
getUpgradeActionUrlOrFallback: () => 'https://pulse.example.com/upgrade',
startProTrial: (...args: unknown[]) => startProTrialMock(...args),
}));
diff --git a/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPreview.test.tsx b/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPreview.test.tsx
index 433b5afb09..c668e421a6 100644
--- a/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPreview.test.tsx
+++ b/frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPreview.test.tsx
@@ -18,7 +18,7 @@ vi.mock('@/utils/apiClient', () => ({
}));
vi.mock('@/stores/license', () => ({
- loadLicenseStatus: vi.fn(),
+ loadRuntimeCapabilities: vi.fn(),
entitlements: () => ({ relay: false }),
getUpgradeActionUrlOrFallback: () => 'https://pulse.example.com/upgrade',
startProTrial: vi.fn(),
diff --git a/frontend-modern/src/components/__tests__/DemoBanner.test.tsx b/frontend-modern/src/components/__tests__/DemoBanner.test.tsx
index 84257b1494..776a078680 100644
--- a/frontend-modern/src/components/__tests__/DemoBanner.test.tsx
+++ b/frontend-modern/src/components/__tests__/DemoBanner.test.tsx
@@ -5,10 +5,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
/* Mocks */
/* ------------------------------------------------------------------ */
-const demoModeEnabledMock = vi.hoisted(() => vi.fn());
+const presentationPolicyIsDemoModeMock = vi.hoisted(() => vi.fn());
-vi.mock('@/stores/demoMode', () => ({
- demoModeEnabled: () => demoModeEnabledMock(),
+vi.mock('@/stores/sessionPresentationPolicy', () => ({
+ presentationPolicyIsDemoMode: () => presentationPolicyIsDemoModeMock(),
}));
vi.mock('@/utils/logger', () => ({
@@ -21,8 +21,8 @@ vi.mock('@/utils/logger', () => ({
describe('DemoBanner', () => {
beforeEach(() => {
- demoModeEnabledMock.mockReset();
- demoModeEnabledMock.mockReturnValue(false);
+ presentationPolicyIsDemoModeMock.mockReset();
+ presentationPolicyIsDemoModeMock.mockReturnValue(false);
sessionStorage.clear();
});
@@ -36,7 +36,7 @@ describe('DemoBanner', () => {
/* ---------- Visibility ---------- */
it('shows the banner when demo mode is enabled', async () => {
- demoModeEnabledMock.mockReturnValue(true);
+ presentationPolicyIsDemoModeMock.mockReturnValue(true);
await renderBanner();
@@ -52,7 +52,7 @@ describe('DemoBanner', () => {
/* ---------- Dismiss ---------- */
it('hides the banner when the dismiss button is clicked', async () => {
- demoModeEnabledMock.mockReturnValue(true);
+ presentationPolicyIsDemoModeMock.mockReturnValue(true);
await renderBanner();
@@ -69,7 +69,7 @@ describe('DemoBanner', () => {
});
it('persists dismissal to sessionStorage', async () => {
- demoModeEnabledMock.mockReturnValue(true);
+ presentationPolicyIsDemoModeMock.mockReturnValue(true);
await renderBanner();
@@ -82,7 +82,7 @@ describe('DemoBanner', () => {
it('stays hidden when sessionStorage already has dismissal flag', async () => {
sessionStorage.setItem('demoBannerDismissed', 'true');
- demoModeEnabledMock.mockReturnValue(true);
+ presentationPolicyIsDemoModeMock.mockReturnValue(true);
await renderBanner();
diff --git a/frontend-modern/src/components/patrol/__tests__/ApprovalSection.test.tsx b/frontend-modern/src/components/patrol/__tests__/ApprovalSection.test.tsx
index 40d7e207f0..2fa90fca47 100644
--- a/frontend-modern/src/components/patrol/__tests__/ApprovalSection.test.tsx
+++ b/frontend-modern/src/components/patrol/__tests__/ApprovalSection.test.tsx
@@ -62,7 +62,7 @@ vi.mock('@/stores/licenseCommercial', () => ({
commercialPosture: () => state.entitlements,
licenseStatus: () => state.entitlements,
loadCommercialPosture: (...args: unknown[]) => loadCommercialPostureMock(...args),
- loadLicenseStatus: (...args: unknown[]) => loadCommercialPostureMock(...args),
+ loadRuntimeCapabilities: (...args: unknown[]) => loadCommercialPostureMock(...args),
startProTrial: (...args: unknown[]) => startProTrialMock(...args),
}));
diff --git a/frontend-modern/src/components/shared/HistoryChartOverlay.tsx b/frontend-modern/src/components/shared/HistoryChartOverlay.tsx
index 478eed12b4..e3612ff5e3 100644
--- a/frontend-modern/src/components/shared/HistoryChartOverlay.tsx
+++ b/frontend-modern/src/components/shared/HistoryChartOverlay.tsx
@@ -1,5 +1,5 @@
import { Component, Show } from 'solid-js';
-import { demoModeEnabled } from '@/stores/demoMode';
+import { presentationPolicyHidesUpgradePrompts } from '@/stores/sessionPresentationPolicy';
import { UpgradeLink } from './UpgradeLink';
import type { HistoryChartState } from './useHistoryChartState';
@@ -71,7 +71,7 @@ export const HistoryChartOverlay: Component<HistoryChartOverlayProps> = (props)
</div>
<h3 class="text-lg font-bold text-base-content mb-1">{props.chart.lockDays()}-Day History</h3>
<Show
- when={!demoModeEnabled()}
+ when={!presentationPolicyHidesUpgradePrompts()}
fallback={
<p class="text-sm text-muted text-center max-w-[220px] mb-4">
Historical data beyond {props.chart.lockDays()} days is hidden in this demo.
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index d10302ede7..35da71e3d1 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -460,16 +460,16 @@ describe('shared primitive guardrails', () => {
expect(trialBannerSource).toContain('TRIAL_BANNER_TITLE');
expect(trialBannerSource).not.toContain('createSignal');
expect(trialBannerSource).not.toContain('createMemo');
- expect(trialBannerSource).not.toContain('loadLicenseStatus');
+ expect(trialBannerSource).not.toContain('loadRuntimeCapabilities');
expect(trialBannerSource).not.toContain('licenseStatus');
expect(trialBannerSource).not.toContain('getUpgradeActionUrlOrFallback');
expect(trialBannerStateSource).toContain('export function useTrialBannerState');
expect(trialBannerStateSource).toContain('createSignal');
expect(trialBannerStateSource).toContain('createMemo');
- expect(trialBannerStateSource).toContain('loadLicenseStatus');
- expect(trialBannerStateSource).toContain('licenseStatus');
- expect(trialBannerStateSource).toContain('demoModeEnabled');
+ expect(trialBannerStateSource).toContain('loadCommercialPosture');
+ expect(trialBannerStateSource).toContain('commercialPosture');
+ expect(trialBannerStateSource).toContain('presentationPolicyHidesCommercialSurfaces');
expect(trialBannerStateSource).toContain('getUpgradeActionDestination');
expect(trialBannerStateSource).toContain('snoozeUpsell');
expect(trialBannerStateSource).not.toContain("fetch('/api/health'");
@@ -483,7 +483,8 @@ describe('shared primitive guardrails', () => {
it('keeps upgrade navigation split across shell, runtime, and utility owners', () => {
expect(upgradeLinkSource).toContain('destination.external');
- expect(upgradeLinkSource).toContain("target={local.target ?? '_blank'}");
+ expect(upgradeLinkSource).toContain("return local.target ?? '_blank';");
+ expect(upgradeLinkSource).toContain('target={target()}');
expect(upgradeLinkSource).not.toContain('window.open');
expect(upgradeLinkSource).not.toContain('useNavigate(');
@@ -653,7 +654,7 @@ describe('shared primitive guardrails', () => {
);
expect(monitoredSystemLimitWarningBannerSource).not.toContain('createEffect');
expect(monitoredSystemLimitWarningBannerSource).not.toContain('createMemo');
- expect(monitoredSystemLimitWarningBannerSource).not.toContain('loadLicenseStatus');
+ expect(monitoredSystemLimitWarningBannerSource).not.toContain('loadRuntimeCapabilities');
expect(monitoredSystemLimitWarningBannerSource).not.toContain('trackUpgradeMetricEvent');
expect(monitoredSystemLimitWarningBannerSource).not.toContain('legacyConnections()');
@@ -662,8 +663,10 @@ describe('shared primitive guardrails', () => {
);
expect(monitoredSystemLimitWarningBannerStateSource).toContain('createEffect');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('createMemo');
- expect(monitoredSystemLimitWarningBannerStateSource).toContain('loadLicenseStatus');
- expect(monitoredSystemLimitWarningBannerStateSource).toContain('demoModeEnabled');
+ expect(monitoredSystemLimitWarningBannerStateSource).toContain('loadRuntimeCapabilities');
+ expect(monitoredSystemLimitWarningBannerStateSource).toContain(
+ 'presentationPolicyHidesCommercialSurfaces',
+ );
expect(monitoredSystemLimitWarningBannerStateSource).toContain('trackUpgradeMetricEvent');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('legacyConnections');
expect(monitoredSystemLimitWarningBannerStateSource).toContain(
diff --git a/frontend-modern/src/components/shared/__tests__/ActiveUseTrialNudge.test.tsx b/frontend-modern/src/components/shared/__tests__/ActiveUseTrialNudge.test.tsx
index 246d81d84c..893b32be77 100644
--- a/frontend-modern/src/components/shared/__tests__/ActiveUseTrialNudge.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/ActiveUseTrialNudge.test.tsx
@@ -10,14 +10,14 @@ import {
} from '@/components/shared/activeUseTrialNudgeModel';
const {
- licenseStatusMock,
+ commercialPostureMock,
startProTrialMock,
showSuccessMock,
showErrorMock,
isUpsellSnoozedMock,
snoozeUpsellMock,
} = vi.hoisted(() => ({
- licenseStatusMock: vi.fn(),
+ commercialPostureMock: vi.fn(),
startProTrialMock: vi.fn(),
showSuccessMock: vi.fn(),
showErrorMock: vi.fn(),
@@ -26,8 +26,8 @@ const {
}));
vi.mock('@/stores/licenseCommercial', () => ({
- licenseStatus: (...args: unknown[]) => licenseStatusMock(...args),
- loadLicenseStatus: vi.fn(),
+ commercialPosture: (...args: unknown[]) => commercialPostureMock(...args),
+ loadCommercialPosture: vi.fn(),
startProTrial: (...args: unknown[]) => startProTrialMock(...args),
}));
@@ -53,7 +53,7 @@ vi.mock('@/utils/upgradePresentation', () => ({
import { ActiveUseTrialNudge } from '@/components/shared/ActiveUseTrialNudge';
function setEligibleFreeLicense() {
- licenseStatusMock.mockReturnValue({
+ commercialPostureMock.mockReturnValue({
tier: 'free',
subscription_state: 'expired',
trial_eligible: true,
@@ -63,7 +63,7 @@ function setEligibleFreeLicense() {
describe('ActiveUseTrialNudge', () => {
beforeEach(() => {
localStorage.clear();
- licenseStatusMock.mockReset();
+ commercialPostureMock.mockReset();
startProTrialMock.mockReset();
showSuccessMock.mockReset();
showErrorMock.mockReset();
diff --git a/frontend-modern/src/components/shared/__tests__/HistoryChart.test.tsx b/frontend-modern/src/components/shared/__tests__/HistoryChart.test.tsx
index e4a244c3bc..c938932c66 100644
--- a/frontend-modern/src/components/shared/__tests__/HistoryChart.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/HistoryChart.test.tsx
@@ -37,19 +37,19 @@ HTMLCanvasElement.prototype.getContext = vi.fn(() => ({
vi.mock('@/stores/license', () => ({
isRangeLocked: () => false,
- loadLicenseStatus: vi.fn(),
+ loadRuntimeCapabilities: vi.fn(),
maxHistoryDays: () => 30,
}));
vi.mock('@/stores/licenseCommercial', () => ({
getUpgradeActionDestination: () => ({ href: 'https://example.com/upgrade', external: true }),
- licenseStatus: () => ({ subscription_state: 'active' }),
- loadLicenseStatus: vi.fn(),
+ commercialPosture: () => ({ subscription_state: 'active' }),
+ loadCommercialPosture: vi.fn(),
startProTrial: vi.fn(),
}));
-vi.mock('@/stores/demoMode', () => ({
- demoModeEnabled: () => false,
+vi.mock('@/stores/sessionPresentationPolicy', () => ({
+ presentationPolicyHidesUpgradePrompts: () => false,
}));
vi.mock('@/api/charts', () => ({
@@ -94,7 +94,7 @@ describe('HistoryChart', () => {
expect(historyChartOverlaySource).toContain('Collecting data... History will appear here.');
expect(historyChartOverlaySource).toContain('Unlock {props.chart.lockTierLabel()} Features');
- expect(historyChartOverlaySource).toContain('demoModeEnabled');
+ expect(historyChartOverlaySource).toContain('presentationPolicyHidesUpgradePrompts');
expect(historyChartOverlaySource).toContain('Historical data beyond {props.chart.lockDays()} days is hidden in this demo.');
expect(historyChartOverlaySource).not.toContain('ChartsAPI.getMetricsHistory');
expect(historyChartOverlaySource).not.toContain('setupCanvasDPR');
diff --git a/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx b/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx
index dbb6c71d17..8365a06deb 100644
--- a/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx
@@ -32,13 +32,13 @@ const mockTrackUpgradeMetricEvent = vi.hoisted(() => vi.fn());
const mockTrackUpgradeClicked = vi.hoisted(() => vi.fn());
const mockLoadRuntimeLicenseStatus = vi.hoisted(() => vi.fn());
const mockLoadCommercialPosture = vi.hoisted(() => vi.fn());
-const mockDemoModeEnabled = vi.hoisted(() => vi.fn(() => false));
+const mockPresentationPolicyHidesCommercialSurfaces = vi.hoisted(() => vi.fn(() => false));
const mockGetUpgradeActionDestination = vi.hoisted(() => vi.fn());
const mockGetUpgradeActionUrlOrFallback = vi.hoisted(() => vi.fn());
vi.mock('@/stores/license', () => ({
- getLimit: (...args: unknown[]) => mockGetLimit(...args),
- loadLicenseStatus: (...args: unknown[]) => mockLoadRuntimeLicenseStatus(...args),
+ getRuntimeLimit: (...args: unknown[]) => mockGetLimit(...args),
+ loadRuntimeCapabilities: (...args: unknown[]) => mockLoadRuntimeLicenseStatus(...args),
}));
vi.mock('@/stores/licenseCommercial', () => ({
@@ -50,8 +50,9 @@ vi.mock('@/stores/licenseCommercial', () => ({
loadCommercialPosture: (...args: unknown[]) => mockLoadCommercialPosture(...args),
}));
-vi.mock('@/stores/demoMode', () => ({
- demoModeEnabled: () => mockDemoModeEnabled(),
+vi.mock('@/stores/sessionPresentationPolicy', () => ({
+ presentationPolicyHidesCommercialSurfaces: () =>
+ mockPresentationPolicyHidesCommercialSurfaces(),
}));
vi.mock('@/utils/upgradeMetrics', () => ({
@@ -73,8 +74,8 @@ describe('MonitoredSystemLimitWarningBanner', () => {
docker_hosts: 0,
kubernetes_clusters: 0,
});
- mockDemoModeEnabled.mockReset();
- mockDemoModeEnabled.mockReturnValue(false);
+ mockPresentationPolicyHidesCommercialSurfaces.mockReset();
+ mockPresentationPolicyHidesCommercialSurfaces.mockReturnValue(false);
mockLoadRuntimeLicenseStatus.mockReset();
mockLoadRuntimeLicenseStatus.mockResolvedValue(undefined);
mockLoadCommercialPosture.mockReset();
@@ -104,7 +105,7 @@ describe('MonitoredSystemLimitWarningBanner', () => {
);
expect(monitoredSystemLimitWarningBannerSource).not.toContain('createEffect');
expect(monitoredSystemLimitWarningBannerSource).not.toContain('createMemo');
- expect(monitoredSystemLimitWarningBannerSource).not.toContain('loadLicenseStatus');
+ expect(monitoredSystemLimitWarningBannerSource).not.toContain('loadRuntimeCapabilities');
expect(monitoredSystemLimitWarningBannerSource).not.toContain('trackUpgradeMetricEvent');
expect(monitoredSystemLimitWarningBannerSource).not.toContain('legacyConnections()');
@@ -113,9 +114,11 @@ describe('MonitoredSystemLimitWarningBanner', () => {
);
expect(monitoredSystemLimitWarningBannerStateSource).toContain('createEffect');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('createMemo');
- expect(monitoredSystemLimitWarningBannerStateSource).toContain('loadLicenseStatus');
+ expect(monitoredSystemLimitWarningBannerStateSource).toContain('loadRuntimeCapabilities');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('loadCommercialPosture');
- expect(monitoredSystemLimitWarningBannerStateSource).toContain('demoModeEnabled');
+ expect(monitoredSystemLimitWarningBannerStateSource).toContain(
+ 'presentationPolicyHidesCommercialSurfaces',
+ );
expect(monitoredSystemLimitWarningBannerStateSource).toContain('trackUpgradeMetricEvent');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('legacyConnections');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('scopeSelfHostedBillingDestination');
@@ -235,7 +238,7 @@ describe('MonitoredSystemLimitWarningBanner', () => {
});
it('stays hidden in demo mode even when usage is urgent', async () => {
- mockDemoModeEnabled.mockReturnValue(true);
+ mockPresentationPolicyHidesCommercialSurfaces.mockReturnValue(true);
mockGetLimit.mockReturnValue({
key: 'max_monitored_systems',
limit: 6,
diff --git a/frontend-modern/src/components/shared/__tests__/TrialBanner.test.tsx b/frontend-modern/src/components/shared/__tests__/TrialBanner.test.tsx
index 59b395183f..13c083d603 100644
--- a/frontend-modern/src/components/shared/__tests__/TrialBanner.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/TrialBanner.test.tsx
@@ -9,7 +9,7 @@ import { TRIAL_BANNER_SNOOZE_KEY } from '@/components/shared/trialBannerModel';
import { getPublicPricingUrl } from '@/utils/pricingHandoff';
const {
- demoModeEnabledMock,
+ presentationPolicyHidesCommercialSurfacesMock,
getUpgradeActionDestinationMock,
getUpgradeActionUrlOrFallbackMock,
commercialPostureMock,
@@ -18,7 +18,7 @@ const {
snoozeUpsellMock,
} =
vi.hoisted(() => ({
- demoModeEnabledMock: vi.fn(),
+ presentationPolicyHidesCommercialSurfacesMock: vi.fn(),
getUpgradeActionDestinationMock: vi.fn(),
getUpgradeActionUrlOrFallbackMock: vi.fn(),
commercialPostureMock: vi.fn(),
@@ -34,8 +34,9 @@ vi.mock('@/stores/licenseCommercial', () => ({
loadCommercialPosture: (...args: unknown[]) => loadCommercialPostureMock(...args),
}));
-vi.mock('@/stores/demoMode', () => ({
- demoModeEnabled: () => demoModeEnabledMock(),
+vi.mock('@/stores/sessionPresentationPolicy', () => ({
+ presentationPolicyHidesCommercialSurfaces: () =>
+ presentationPolicyHidesCommercialSurfacesMock(),
}));
vi.mock('@/utils/snooze', () => ({
@@ -52,7 +53,7 @@ describe('TrialBanner', () => {
beforeEach(() => {
cleanup();
- demoModeEnabledMock.mockReset();
+ presentationPolicyHidesCommercialSurfacesMock.mockReset();
getUpgradeActionDestinationMock.mockReset();
getUpgradeActionUrlOrFallbackMock.mockReset();
commercialPostureMock.mockReset();
@@ -63,7 +64,7 @@ describe('TrialBanner', () => {
href: getPublicPricingUrl('trial_banner'),
external: true,
});
- demoModeEnabledMock.mockReturnValue(false);
+ presentationPolicyHidesCommercialSurfacesMock.mockReturnValue(false);
getUpgradeActionUrlOrFallbackMock.mockReturnValue(getPublicPricingUrl('trial_banner'));
loadCommercialPostureMock.mockResolvedValue(undefined);
isUpsellSnoozedMock.mockReturnValue(false);
@@ -78,7 +79,7 @@ describe('TrialBanner', () => {
expect(trialBannerSource).toContain('TRIAL_BANNER_TITLE');
expect(trialBannerSource).not.toContain('createSignal');
expect(trialBannerSource).not.toContain('createMemo');
- expect(trialBannerSource).not.toContain('loadLicenseStatus');
+ expect(trialBannerSource).not.toContain('loadRuntimeCapabilities');
expect(trialBannerSource).not.toContain('licenseStatus');
expect(trialBannerSource).not.toContain('getUpgradeActionUrlOrFallback');
@@ -86,7 +87,7 @@ describe('TrialBanner', () => {
expect(trialBannerStateSource).toContain('createSignal');
expect(trialBannerStateSource).toContain('createMemo');
expect(trialBannerStateSource).toContain('loadCommercialPosture');
- expect(trialBannerStateSource).toContain('demoModeEnabled');
+ expect(trialBannerStateSource).toContain('presentationPolicyHidesCommercialSurfaces');
expect(trialBannerStateSource).toContain('commercialPosture');
expect(trialBannerStateSource).toContain('getUpgradeActionDestination');
expect(trialBannerStateSource).toContain('snoozeUpsell');
@@ -130,7 +131,7 @@ describe('TrialBanner', () => {
});
it('stays hidden in demo mode even when the workspace is on trial', () => {
- demoModeEnabledMock.mockReturnValue(true);
+ presentationPolicyHidesCommercialSurfacesMock.mockReturnValue(true);
commercialPostureMock.mockReturnValue({
subscription_state: 'trial',
trial_days_remaining: 2,
diff --git a/frontend-modern/src/components/shared/useHistoryChartState.ts b/frontend-modern/src/components/shared/useHistoryChartState.ts
index cd2e636f9f..29e9658ffa 100644
--- a/frontend-modern/src/components/shared/useHistoryChartState.ts
+++ b/frontend-modern/src/components/shared/useHistoryChartState.ts
@@ -8,7 +8,7 @@ import {
import { ChartsAPI, type HistoryTimeRange } from '@/api/charts';
import {
isRangeLocked,
- loadLicenseStatus,
+ loadRuntimeCapabilities,
maxHistoryDays,
} from '@/stores/license';
import {
@@ -78,7 +78,7 @@ export function useHistoryChartState(props: HistoryChartProps, refs: HistoryChar
const refreshIntervalMs = createMemo(() => getHistoryChartRefreshIntervalMs(range()));
onMount(() => {
- loadLicenseStatus();
+ loadRuntimeCapabilities();
loadCommercialPosture();
});
diff --git a/frontend-modern/src/components/shared/useMonitoredSystemLimitWarningBannerState.ts b/frontend-modern/src/components/shared/useMonitoredSystemLimitWarningBannerState.ts
index eb6562e824..0fa61970ed 100644
--- a/frontend-modern/src/components/shared/useMonitoredSystemLimitWarningBannerState.ts
+++ b/frontend-modern/src/components/shared/useMonitoredSystemLimitWarningBannerState.ts
@@ -1,8 +1,8 @@
import { createEffect, createMemo, onMount } from 'solid-js';
-import { demoModeEnabled } from '@/stores/demoMode';
+import { presentationPolicyHidesCommercialSurfaces } from '@/stores/sessionPresentationPolicy';
import {
- getLimit,
- loadLicenseStatus as loadRuntimeLicenseStatus,
+ getRuntimeLimit,
+ loadRuntimeCapabilities,
} from '@/stores/license';
import {
commercialPosture,
@@ -36,14 +36,16 @@ import {
export function useMonitoredSystemLimitWarningBannerState() {
onMount(() => {
- void loadRuntimeLicenseStatus();
+ void loadRuntimeCapabilities();
void loadCommercialPosture();
});
- const monitoredSystemLimit = createMemo(() => getLimit(MONITORED_SYSTEM_LIMIT_KEY));
+ const monitoredSystemLimit = createMemo(() => getRuntimeLimit(MONITORED_SYSTEM_LIMIT_KEY));
const isUrgent = createMemo(() => isMonitoredSystemLimitUrgent(monitoredSystemLimit()));
const showBanner = createMemo(
- () => !demoModeEnabled() && shouldShowMonitoredSystemLimitBanner(monitoredSystemLimit()),
+ () =>
+ !presentationPolicyHidesCommercialSurfaces() &&
+ shouldShowMonitoredSystemLimitBanner(monitoredSystemLimit()),
);
const migrationGap = createMemo(() => hasMigrationGap());
const migrationCounts = createMemo(() => legacyConnections());
diff --git a/frontend-modern/src/components/shared/useTrialBannerState.ts b/frontend-modern/src/components/shared/useTrialBannerState.ts
index 00cc643559..6b7ad7c69e 100644
--- a/frontend-modern/src/components/shared/useTrialBannerState.ts
+++ b/frontend-modern/src/components/shared/useTrialBannerState.ts
@@ -1,10 +1,10 @@
import { createMemo, createSignal, onMount } from 'solid-js';
-import { demoModeEnabled } from '@/stores/demoMode';
import {
commercialPosture,
getUpgradeActionDestination,
loadCommercialPosture,
} from '@/stores/licenseCommercial';
+import { presentationPolicyHidesCommercialSurfaces } from '@/stores/sessionPresentationPolicy';
import { isUpsellSnoozed, snoozeUpsell } from '@/utils/snooze';
import {
getTrialBannerToneClass,
@@ -21,7 +21,9 @@ export function useTrialBannerState() {
});
const isTrial = createMemo(
- () => !demoModeEnabled() && commercialPosture()?.subscription_state === 'trial',
+ () =>
+ !presentationPolicyHidesCommercialSurfaces() &&
+ commercialPosture()?.subscription_state === 'trial',
);
const daysRemaining = createMemo(() =>
normalizeTrialBannerDaysRemaining(commercialPosture()?.trial_days_remaining),
@@ -40,7 +42,7 @@ export function useTrialBannerState() {
daysRemaining,
handleSnooze,
isTrial,
- showActions: () => !demoModeEnabled() && !snoozed(),
+ showActions: () => !presentationPolicyHidesCommercialSurfaces() && !snoozed(),
toneClass,
upgradeDestination,
};
diff --git a/frontend-modern/src/features/alerts/AlertHistoryTableAlertRow.tsx b/frontend-modern/src/features/alerts/AlertHistoryTableAlertRow.tsx
index 21a1264eda..18b8e378a9 100644
--- a/frontend-modern/src/features/alerts/AlertHistoryTableAlertRow.tsx
+++ b/frontend-modern/src/features/alerts/AlertHistoryTableAlertRow.tsx
@@ -21,7 +21,7 @@ interface AlertHistoryTableAlertRowProps {
alert: AlertHistoryAlert;
state: AlertHistoryState;
hasAIAlertsFeature: () => boolean;
- licenseLoading: () => boolean;
+ runtimeCapabilitiesLoading: () => boolean;
}
export function AlertHistoryTableAlertRow(props: AlertHistoryTableAlertRowProps) {
@@ -140,7 +140,7 @@ export function AlertHistoryTableAlertRow(props: AlertHistoryTableAlertRowProps)
resourceType={props.alert.resourceType}
variant="icon"
size="sm"
- licenseLocked={!props.hasAIAlertsFeature() && !props.licenseLoading()}
+ licenseLocked={!props.hasAIAlertsFeature() && !props.runtimeCapabilitiesLoading()}
/>
</Show>
</div>
diff --git a/frontend-modern/src/features/alerts/AlertHistoryTableSection.tsx b/frontend-modern/src/features/alerts/AlertHistoryTableSection.tsx
index 2a1290b983..90bf764044 100644
--- a/frontend-modern/src/features/alerts/AlertHistoryTableSection.tsx
+++ b/frontend-modern/src/features/alerts/AlertHistoryTableSection.tsx
@@ -20,7 +20,7 @@ import type { AlertHistoryState } from './useAlertHistoryState';
interface AlertHistoryTableSectionProps {
state: AlertHistoryState;
hasAIAlertsFeature: () => boolean;
- licenseLoading: () => boolean;
+ runtimeCapabilitiesLoading: () => boolean;
}
export function AlertHistoryTableSection(props: AlertHistoryTableSectionProps) {
@@ -86,7 +86,7 @@ export function AlertHistoryTableSection(props: AlertHistoryTableSectionProps) {
alert={alert}
state={props.state}
hasAIAlertsFeature={props.hasAIAlertsFeature}
- licenseLoading={props.licenseLoading}
+ runtimeCapabilitiesLoading={props.runtimeCapabilitiesLoading}
/>
)}
</For>
diff --git a/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx b/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx
index e920de1923..89f0cfad98 100644
--- a/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx
+++ b/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx
@@ -18,7 +18,7 @@ interface AlertOverviewActiveAlertsSectionProps {
activeAlerts: Record<string, Alert>;
alertsDisabled: boolean;
hasAIAlertsFeature: boolean;
- licenseLoading: boolean;
+ runtimeCapabilitiesLoading: boolean;
showAcknowledged: boolean;
setShowAcknowledged: (value: boolean) => void;
}
@@ -128,7 +128,7 @@ export function AlertOverviewActiveAlertsSection(props: AlertOverviewActiveAlert
state={props.state}
timelineState={props.timelineState}
hasAIAlertsFeature={props.hasAIAlertsFeature}
- licenseLoading={props.licenseLoading}
+ runtimeCapabilitiesLoading={props.runtimeCapabilitiesLoading}
/>
)}
</For>
diff --git a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
index b6dcc0ed94..e9e6e2278c 100644
--- a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
+++ b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx
@@ -21,7 +21,7 @@ interface AlertOverviewAlertCardProps {
state: AlertOverviewState;
timelineState: AlertIncidentTimelineState;
hasAIAlertsFeature: boolean;
- licenseLoading: boolean;
+ runtimeCapabilitiesLoading: boolean;
}
export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
@@ -110,7 +110,7 @@ export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {
}
variant="text"
size="sm"
- licenseLocked={!props.hasAIAlertsFeature && !props.licenseLoading}
+ licenseLocked={!props.hasAIAlertsFeature && !props.runtimeCapabilitiesLoading}
/>
</div>
</div>
diff --git a/frontend-modern/src/features/alerts/OverviewTab.tsx b/frontend-modern/src/features/alerts/OverviewTab.tsx
index 3eeeaa11f4..e9c332be93 100644
--- a/frontend-modern/src/features/alerts/OverviewTab.tsx
+++ b/frontend-modern/src/features/alerts/OverviewTab.tsx
@@ -19,7 +19,7 @@ export function OverviewTab(props: {
setShowAcknowledged: (value: boolean) => void;
alertsDisabled: () => boolean;
hasAIAlertsFeature: () => boolean;
- licenseLoading: () => boolean;
+ runtimeCapabilitiesLoading: () => boolean;
}) {
const location = useLocation();
let hashScrollRafId: number | undefined;
@@ -78,7 +78,7 @@ export function OverviewTab(props: {
activeAlerts={props.activeAlerts}
alertsDisabled={props.alertsDisabled()}
hasAIAlertsFeature={props.hasAIAlertsFeature()}
- licenseLoading={props.licenseLoading()}
+ runtimeCapabilitiesLoading={props.runtimeCapabilitiesLoading()}
showAcknowledged={props.showAcknowledged()}
setShowAcknowledged={props.setShowAcknowledged}
/>
diff --git a/frontend-modern/src/features/alerts/__tests__/HistoryTab.test.tsx b/frontend-modern/src/features/alerts/__tests__/HistoryTab.test.tsx
index 039bfa6911..fef705495b 100644
--- a/frontend-modern/src/features/alerts/__tests__/HistoryTab.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/HistoryTab.test.tsx
@@ -52,7 +52,7 @@ describe('HistoryTab', () => {
render(() => (
<HistoryTab
hasAIAlertsFeature={() => true}
- licenseLoading={() => false}
+ runtimeCapabilitiesLoading={() => false}
getResource={() => undefined}
allResources={() => []}
/>
diff --git a/frontend-modern/src/features/alerts/__tests__/OverviewTab.emptystate.test.tsx b/frontend-modern/src/features/alerts/__tests__/OverviewTab.emptystate.test.tsx
index 360c338788..9b4d4d327a 100644
--- a/frontend-modern/src/features/alerts/__tests__/OverviewTab.emptystate.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/OverviewTab.emptystate.test.tsx
@@ -34,7 +34,7 @@ function defaultProps(overrides: Record<string, unknown> = {}) {
setShowAcknowledged: vi.fn(),
alertsDisabled: () => false,
hasAIAlertsFeature: () => true,
- licenseLoading: () => false,
+ runtimeCapabilitiesLoading: () => false,
...overrides,
};
}
diff --git a/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx b/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx
index df42271253..c76f4ebf05 100644
--- a/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx
@@ -54,7 +54,7 @@ function defaultProps(overrides: Record<string, unknown> = {}) {
setShowAcknowledged: vi.fn(),
alertsDisabled: () => false,
hasAIAlertsFeature: () => true,
- licenseLoading: () => false,
+ runtimeCapabilitiesLoading: () => false,
...overrides,
};
}
diff --git a/frontend-modern/src/features/alerts/__tests__/OverviewTab.total24h.test.tsx b/frontend-modern/src/features/alerts/__tests__/OverviewTab.total24h.test.tsx
index 983be2ff9a..2f38e4ce64 100644
--- a/frontend-modern/src/features/alerts/__tests__/OverviewTab.total24h.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/OverviewTab.total24h.test.tsx
@@ -49,7 +49,7 @@ function defaultProps(overrides: Record<string, unknown> = {}) {
setShowAcknowledged: vi.fn(),
alertsDisabled: () => false,
hasAIAlertsFeature: () => true,
- licenseLoading: () => false,
+ runtimeCapabilitiesLoading: () => false,
...overrides,
};
}
diff --git a/frontend-modern/src/features/alerts/tabs/HistoryTab.tsx b/frontend-modern/src/features/alerts/tabs/HistoryTab.tsx
index ade7012eaa..bae2651a2b 100644
--- a/frontend-modern/src/features/alerts/tabs/HistoryTab.tsx
+++ b/frontend-modern/src/features/alerts/tabs/HistoryTab.tsx
@@ -14,7 +14,7 @@ import { useAlertHistoryState } from '../useAlertHistoryState';
export interface HistoryTabProps {
hasAIAlertsFeature: () => boolean;
- licenseLoading: () => boolean;
+ runtimeCapabilitiesLoading: () => boolean;
getResource: (resourceId: string) => Resource | undefined;
allResources: () => Resource[];
}
@@ -76,7 +76,7 @@ export function HistoryTab(props: HistoryTabProps) {
<AlertHistoryTableSection
state={historyState}
hasAIAlertsFeature={props.hasAIAlertsFeature}
- licenseLoading={props.licenseLoading}
+ runtimeCapabilitiesLoading={props.runtimeCapabilitiesLoading}
/>
<AlertHistoryAdministrationCard state={historyState} />
</div>
diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsx
index fd457895da..66ed5011f7 100644
--- a/frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsx
+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceBanners.tsx
@@ -3,7 +3,7 @@ import ShieldAlertIcon from 'lucide-solid/icons/shield-alert';
import SettingsIcon from 'lucide-solid/icons/settings';
import SparklesIcon from 'lucide-solid/icons/sparkles';
import { UpgradeLink } from '@/components/shared/UpgradeLink';
-import { demoModeEnabled } from '@/stores/demoMode';
+import { presentationPolicyHidesUpgradePrompts } from '@/stores/sessionPresentationPolicy';
import { formatRelativeTime } from '@/utils/format';
import { trackUpgradeClicked } from '@/utils/upgradeMetrics';
import type { PatrolIntelligenceState } from './usePatrolIntelligenceState';
@@ -37,7 +37,13 @@ export function PatrolIntelligenceBanners(props: { state: PatrolIntelligenceStat
</div>
</Show>
- <Show when={!demoModeEnabled() && state.licenseRequired() && !state.showBlockedBanner()}>
+ <Show
+ when={
+ !presentationPolicyHidesUpgradePrompts() &&
+ state.licenseRequired() &&
+ !state.showBlockedBanner()
+ }
+ >
<div class="flex-shrink-0 bg-blue-50 dark:bg-blue-900 border-b border-blue-200 dark:border-blue-800 px-3 py-2">
<div class="flex flex-wrap items-center justify-between gap-2">
<p class="text-xs text-blue-700 dark:text-blue-300">
@@ -83,7 +89,7 @@ export function PatrolIntelligenceBanners(props: { state: PatrolIntelligenceStat
<SettingsIcon class="w-3.5 h-3.5" />
Open AI Settings
</a>
- <Show when={!demoModeEnabled() && state.licenseRequired()}>
+ <Show when={!presentationPolicyHidesUpgradePrompts() && state.licenseRequired()}>
<UpgradeLink
destination={state.upgradeDestination()}
class="inline-flex items-center justify-center gap-2 px-3 py-1.5 text-xs font-semibold text-white bg-amber-600 hover:bg-amber-700 rounded-md transition-colors"
diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
index d2ca14c909..13f0fdb988 100644
--- a/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx
@@ -9,7 +9,7 @@ import { PageHeader } from '@/components/shared/PageHeader';
import { UpgradeLink } from '@/components/shared/UpgradeLink';
import { Toggle, TogglePrimitive } from '@/components/shared/Toggle';
import { CountdownTimer } from '@/components/patrol';
-import { demoModeEnabled } from '@/stores/demoMode';
+import { presentationPolicyHidesUpgradePrompts } from '@/stores/sessionPresentationPolicy';
import { formatRelativeTime } from '@/utils/format';
import { groupModelsByProvider } from '@/utils/patrolFormat';
import {
@@ -269,7 +269,7 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState
onClick={() => state.handleAutonomyChange(level)}
disabled={isDisabled()}
title={
- !demoModeEnabled() && isProLocked()
+ !presentationPolicyHidesUpgradePrompts() && isProLocked()
? level === 'approval'
? 'Upgrade to Pro to investigate findings'
: 'Upgrade to Pro for automatic fixes'
@@ -287,7 +287,7 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState
}}
</For>
</div>
- <Show when={!demoModeEnabled() && state.autoFixLocked()}>
+ <Show when={!presentationPolicyHidesUpgradePrompts() && state.autoFixLocked()}>
<div class="pl-1 text-[11px] text-slate-500">
<UpgradeLink
destination={state.upgradeDestination()}
@@ -330,7 +330,9 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState
/>
</div>
- <Show when={!demoModeEnabled() && state.alertAnalysisLocked()}>
+ <Show
+ when={!presentationPolicyHidesUpgradePrompts() && state.alertAnalysisLocked()}
+ >
<div class="-my-1 pl-1 text-[11px]">
<UpgradeLink
destination={state.alertAnalysisUpgradeDestination()}
diff --git a/frontend-modern/src/features/patrol/__tests__/patrolCommercialBoundary.test.ts b/frontend-modern/src/features/patrol/__tests__/patrolCommercialBoundary.test.ts
index 75c2ac6c09..53fb56b3cd 100644
--- a/frontend-modern/src/features/patrol/__tests__/patrolCommercialBoundary.test.ts
+++ b/frontend-modern/src/features/patrol/__tests__/patrolCommercialBoundary.test.ts
@@ -4,17 +4,19 @@ import patrolIntelligenceHeaderSource from '../PatrolIntelligenceHeader.tsx?raw'
describe('patrol commercial boundary', () => {
it('suppresses patrol upgrade surfaces in demo mode', () => {
- expect(patrolIntelligenceBannersSource).toContain('demoModeEnabled');
+ expect(patrolIntelligenceBannersSource).toContain('presentationPolicyHidesUpgradePrompts');
expect(patrolIntelligenceBannersSource).toContain(
- '!demoModeEnabled() && state.licenseRequired()',
+ '!presentationPolicyHidesUpgradePrompts() && state.licenseRequired()',
);
- expect(patrolIntelligenceHeaderSource).toContain('demoModeEnabled');
+ expect(patrolIntelligenceHeaderSource).toContain('presentationPolicyHidesUpgradePrompts');
expect(patrolIntelligenceHeaderSource).toContain(
- '!demoModeEnabled() && state.autoFixLocked()',
+ '!presentationPolicyHidesUpgradePrompts() && state.autoFixLocked()',
);
expect(patrolIntelligenceHeaderSource).toContain(
- '!demoModeEnabled() && state.alertAnalysisLocked()',
+ '!presentationPolicyHidesUpgradePrompts() && state.alertAnalysisLocked()',
+ );
+ expect(patrolIntelligenceHeaderSource).toContain(
+ '!presentationPolicyHidesUpgradePrompts() && isProLocked()',
);
- expect(patrolIntelligenceHeaderSource).toContain('!demoModeEnabled() && isProLocked()');
});
});
diff --git a/frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts b/frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts
index 2f76cb22bf..5fc24e89cc 100644
--- a/frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts
+++ b/frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts
@@ -24,7 +24,7 @@ import { hasTriggeringAlert } from '@/utils/findingAlertIdentity';
import { usePatrolStream } from '@/hooks/usePatrolStream';
import {
hasFeature,
- loadLicenseStatus,
+ loadRuntimeCapabilities,
} from '@/stores/license';
import {
commercialPosture,
@@ -171,15 +171,15 @@ export function usePatrolIntelligenceState() {
const autoFixLocked = createMemo(() => !hasFeature('ai_autofix'));
const canStartTrial = createMemo(() => {
- const entitlements = commercialPosture();
- if (!entitlements) return false;
+ const posture = commercialPosture();
+ if (!posture) return false;
if (
- entitlements.subscription_state === 'active' ||
- entitlements.subscription_state === 'trial'
+ posture.subscription_state === 'active' ||
+ posture.subscription_state === 'trial'
) {
return false;
}
- return entitlements.trial_eligible !== false;
+ return posture.trial_eligible !== false;
});
async function handleStartTrial() {
@@ -672,7 +672,7 @@ export function usePatrolIntelligenceState() {
onMount(async () => {
await Promise.all([
- loadLicenseStatus(),
+ loadRuntimeCapabilities(),
loadCommercialPosture(),
loadAllData(),
loadAutonomySettings(),
diff --git a/frontend-modern/src/hooks/__tests__/useDeployWizard.test.ts b/frontend-modern/src/hooks/__tests__/useDeployWizard.test.ts
index 04693f1df4..1593eb2636 100644
--- a/frontend-modern/src/hooks/__tests__/useDeployWizard.test.ts
+++ b/frontend-modern/src/hooks/__tests__/useDeployWizard.test.ts
@@ -19,7 +19,7 @@ const { apiMock, loggerMock, getLimitMock } = vi.hoisted(() => ({
vi.mock('@/api/agentDeploy', () => ({ AgentDeployAPI: apiMock }));
vi.mock('@/utils/logger', () => ({ logger: loggerMock }));
-vi.mock('@/stores/license', () => ({ getLimit: getLimitMock }));
+vi.mock('@/stores/license', () => ({ getRuntimeLimit: getLimitMock }));
// Stub useDeployStream — wizard only needs the returned state, not real SSE.
vi.mock('@/hooks/useDeployStream', () => ({
diff --git a/frontend-modern/src/hooks/useDeployWizard.ts b/frontend-modern/src/hooks/useDeployWizard.ts
index b1790cbc10..9b220b605d 100644
--- a/frontend-modern/src/hooks/useDeployWizard.ts
+++ b/frontend-modern/src/hooks/useDeployWizard.ts
@@ -8,7 +8,7 @@
import { createSignal, createMemo, onCleanup } from 'solid-js';
import { AgentDeployAPI } from '@/api/agentDeploy';
import { useDeployStream } from '@/hooks/useDeployStream';
-import { getLimit } from '@/stores/license';
+import { getRuntimeLimit } from '@/stores/license';
import type {
CandidateNode,
SourceAgentInfo,
@@ -122,7 +122,7 @@ export function useDeployWizard(opts: UseDeployWizardOptions) {
const canceledTargets = createMemo(() => jobTargets().filter((t) => t.status === 'canceled'));
const maxAgentSlots = createMemo(() => {
- const limit = getLimit('max_monitored_systems');
+ const limit = getRuntimeLimit('max_monitored_systems');
return limit?.limit ?? 0;
});
diff --git a/frontend-modern/src/pages/Alerts.tsx b/frontend-modern/src/pages/Alerts.tsx
index 4ce312a140..3c4715890e 100644
--- a/frontend-modern/src/pages/Alerts.tsx
+++ b/frontend-modern/src/pages/Alerts.tsx
@@ -4,9 +4,9 @@ import type { JSX } from 'solid-js';
import {
hasFeature,
- licenseLoaded,
- licenseLoading as entitlementsLoading,
- loadLicenseStatus,
+ runtimeCapabilitiesLoaded,
+ runtimeCapabilitiesLoading as entitlementsLoading,
+ loadRuntimeCapabilities,
} from '@/stores/license';
import { useLocation, useNavigate } from '@solidjs/router';
import { logger } from '@/utils/logger';
@@ -167,12 +167,12 @@ export function Alerts() {
localStorage.getItem('hideAlertsQuickTip') !== 'true',
);
- const licenseLoading = createMemo(() => !licenseLoaded() || entitlementsLoading());
- const hasAIAlertsFeature = createMemo(() => !licenseLoaded() || hasFeature('ai_alerts'));
+ const runtimeCapabilitiesLoading = createMemo(() => !runtimeCapabilitiesLoaded() || entitlementsLoading());
+ const hasAIAlertsFeature = createMemo(() => !runtimeCapabilitiesLoaded() || hasFeature('ai_alerts'));
createEffect((wasPaywallVisible) => {
const isPaywallVisible =
- licenseLoaded() && aiChatStore.enabled === true && !hasFeature('ai_alerts');
+ runtimeCapabilitiesLoaded() && aiChatStore.enabled === true && !hasFeature('ai_alerts');
if (isPaywallVisible && !wasPaywallVisible) {
trackPaywallViewed('ai_alerts', 'alerts_page');
}
@@ -180,7 +180,7 @@ export function Alerts() {
}, false);
onMount(() => {
- void loadLicenseStatus();
+ void loadRuntimeCapabilities();
});
const dismissQuickTip = () => {
@@ -421,7 +421,7 @@ export function Alerts() {
setShowAcknowledged={setShowAcknowledged}
alertsDisabled={areAlertsDisabled}
hasAIAlertsFeature={hasAIAlertsFeature}
- licenseLoading={licenseLoading}
+ runtimeCapabilitiesLoading={runtimeCapabilitiesLoading}
/>
</Show>
@@ -442,7 +442,7 @@ export function Alerts() {
<Show when={activeTab() === 'history'}>
<HistoryTab
hasAIAlertsFeature={hasAIAlertsFeature}
- licenseLoading={licenseLoading}
+ runtimeCapabilitiesLoading={runtimeCapabilitiesLoading}
getResource={getResource}
allResources={allResources}
/>
diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
index a76a38b3c9..0e96b2e459 100644
--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
@@ -131,7 +131,7 @@ vi.mock('@/utils/apiClient', () => ({
vi.mock('@/stores/license', () => ({
hasFeature: (...args: unknown[]) => hasFeatureMock(...args),
- loadLicenseStatus: (...args: unknown[]) => loadLicenseStatusMock(...args),
+ loadRuntimeCapabilities: (...args: unknown[]) => loadLicenseStatusMock(...args),
}));
vi.mock('@/stores/licenseCommercial', () => ({
@@ -139,7 +139,7 @@ vi.mock('@/stores/licenseCommercial', () => ({
commercialPosture: (...args: unknown[]) => licenseStatusMock(...args),
licenseStatus: (...args: unknown[]) => licenseStatusMock(...args),
loadCommercialPosture: (...args: unknown[]) => loadCommercialPostureMock(...args),
- loadLicenseStatus: (...args: unknown[]) => loadLicenseStatusMock(...args),
+ loadRuntimeCapabilities: (...args: unknown[]) => loadLicenseStatusMock(...args),
startProTrial: (...args: unknown[]) => startProTrialMock(...args),
getUpgradeActionUrlOrFallback: (...args: unknown[]) => getUpgradeActionUrlOrFallbackMock(...args),
}));
diff --git a/frontend-modern/src/stores/__tests__/license.test.ts b/frontend-modern/src/stores/__tests__/license.test.ts
index bda22b40f3..aa14c0a1bd 100644
--- a/frontend-modern/src/stores/__tests__/license.test.ts
+++ b/frontend-modern/src/stores/__tests__/license.test.ts
@@ -5,17 +5,20 @@ import {
type LicenseCommercialPosture,
type LicenseRuntimeCapabilities,
} from '@/api/license';
-import { demoModeEnabled } from '@/stores/demoMode';
+import {
+ presentationPolicyHidesCommercialSurfaces,
+ sessionPresentationPolicyResolved,
+} from '@/stores/sessionPresentationPolicy';
import { getUpgradeFallbackDestination } from '@/utils/pricingHandoff';
import {
- getLimit,
+ getRuntimeLimit,
hasFeature,
isHostedModeEnabled,
isMultiTenantEnabled,
isRangeLocked,
- licenseLoadError as runtimeLicenseLoadError,
- licenseLoaded as runtimeLicenseLoaded,
- loadLicenseStatus as loadRuntimeLicenseStatus,
+ runtimeCapabilitiesLoadError as runtimeLicenseLoadError,
+ runtimeCapabilitiesLoaded as runtimeLicenseLoaded,
+ loadRuntimeCapabilities,
maxHistoryDays,
runtimeCapabilities,
} from '@/stores/license';
@@ -39,8 +42,9 @@ import {
} from '@/stores/licenseEntitlements';
vi.mock('@/api/license');
-vi.mock('@/stores/demoMode', () => ({
- demoModeEnabled: vi.fn(() => false),
+vi.mock('@/stores/sessionPresentationPolicy', () => ({
+ presentationPolicyHidesCommercialSurfaces: vi.fn(() => false),
+ sessionPresentationPolicyResolved: vi.fn(() => true),
}));
vi.mock('@/stores/events', () => ({
eventBus: { on: vi.fn() },
@@ -99,14 +103,15 @@ describe('license stores', () => {
beforeEach(() => {
vi.clearAllMocks();
- vi.mocked(demoModeEnabled).mockReturnValue(false);
+ vi.mocked(presentationPolicyHidesCommercialSurfaces).mockReturnValue(false);
+ vi.mocked(sessionPresentationPolicyResolved).mockReturnValue(true);
});
describe('runtime capability store', () => {
it('loads runtime capabilities from API', async () => {
vi.mocked(LicenseAPI.getRuntimeCapabilities).mockResolvedValue(mockRuntimeCapabilities);
- await loadRuntimeLicenseStatus();
+ await loadRuntimeCapabilities();
expect(LicenseAPI.getRuntimeCapabilities).toHaveBeenCalled();
expect(runtimeCapabilities()).toEqual(mockRuntimeCapabilities);
@@ -116,8 +121,8 @@ describe('license stores', () => {
it('returns early if already loaded without force', async () => {
vi.mocked(LicenseAPI.getRuntimeCapabilities).mockResolvedValue(mockRuntimeCapabilities);
- await loadRuntimeLicenseStatus(true);
- await loadRuntimeLicenseStatus();
+ await loadRuntimeCapabilities(true);
+ await loadRuntimeCapabilities();
expect(LicenseAPI.getRuntimeCapabilities).toHaveBeenCalledTimes(1);
});
@@ -125,7 +130,7 @@ describe('license stores', () => {
it('sets fallback runtime capabilities on error', async () => {
vi.mocked(LicenseAPI.getRuntimeCapabilities).mockRejectedValue(new Error('API error'));
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(runtimeCapabilities()).toEqual({
capabilities: ['update_alerts', 'sso', 'ai_patrol'],
@@ -138,7 +143,7 @@ describe('license stores', () => {
it('sets loadError on runtime API failure', async () => {
vi.mocked(LicenseAPI.getRuntimeCapabilities).mockRejectedValue(new Error('Network timeout'));
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(runtimeLicenseLoadError()).toBeInstanceOf(Error);
expect(runtimeLicenseLoadError()?.message).toBe('Network timeout');
@@ -146,35 +151,35 @@ describe('license stores', () => {
it('clears runtime loadError on successful load after failure', async () => {
vi.mocked(LicenseAPI.getRuntimeCapabilities).mockRejectedValue(new Error('Network timeout'));
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(runtimeLicenseLoadError()).toBeInstanceOf(Error);
vi.mocked(LicenseAPI.getRuntimeCapabilities).mockResolvedValue(mockRuntimeCapabilities);
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(runtimeLicenseLoadError()).toBeNull();
});
it('returns true when feature is in capabilities', async () => {
vi.mocked(LicenseAPI.getRuntimeCapabilities).mockResolvedValue(mockRuntimeCapabilities);
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(hasFeature('feature1')).toBe(true);
});
it('returns false when feature is not in capabilities', async () => {
vi.mocked(LicenseAPI.getRuntimeCapabilities).mockResolvedValue(mockRuntimeCapabilities);
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(hasFeature('missing_feature')).toBe(false);
});
it('returns true when multi_tenant feature exists', async () => {
vi.mocked(LicenseAPI.getRuntimeCapabilities).mockResolvedValue(mockRuntimeCapabilities);
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(isMultiTenantEnabled()).toBe(true);
});
it('returns false when multi_tenant feature does not exist', async () => {
vi.mocked(LicenseAPI.getRuntimeCapabilities).mockResolvedValue(mockFreeRuntimeCapabilities);
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(isMultiTenantEnabled()).toBe(false);
});
@@ -183,14 +188,14 @@ describe('license stores', () => {
...mockRuntimeCapabilities,
hosted_mode: true,
});
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(isHostedModeEnabled()).toBe(true);
});
it('returns limit by key', async () => {
vi.mocked(LicenseAPI.getRuntimeCapabilities).mockResolvedValue(mockRuntimeCapabilities);
- await loadRuntimeLicenseStatus(true);
- expect(getLimit('limit1')?.limit).toBe(100);
+ await loadRuntimeCapabilities(true);
+ expect(getRuntimeLimit('limit1')?.limit).toBe(100);
});
it('returns false for ranges within free limit (7d)', async () => {
@@ -198,7 +203,7 @@ describe('license stores', () => {
...mockFreeRuntimeCapabilities,
max_history_days: 7,
});
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(isRangeLocked('1h')).toBe(false);
expect(isRangeLocked('7d')).toBe(false);
expect(isRangeLocked('168h')).toBe(false);
@@ -209,7 +214,7 @@ describe('license stores', () => {
...mockFreeRuntimeCapabilities,
max_history_days: 7,
});
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(isRangeLocked('8d')).toBe(true);
expect(isRangeLocked('200h')).toBe(true);
});
@@ -219,7 +224,7 @@ describe('license stores', () => {
...mockRuntimeCapabilities,
max_history_days: 14,
});
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(isRangeLocked('14d')).toBe(false);
expect(isRangeLocked('15d')).toBe(true);
expect(maxHistoryDays()).toBe(14);
@@ -227,7 +232,7 @@ describe('license stores', () => {
it('uses tier-specific max_history_days (pro = 90d)', async () => {
vi.mocked(LicenseAPI.getRuntimeCapabilities).mockResolvedValue(mockRuntimeCapabilities);
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(isRangeLocked('90d')).toBe(false);
expect(isRangeLocked('91d')).toBe(true);
expect(maxHistoryDays()).toBe(90);
@@ -238,21 +243,30 @@ describe('license stores', () => {
...mockFreeRuntimeCapabilities,
max_history_days: undefined,
});
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(maxHistoryDays()).toBe(7);
expect(isRangeLocked('8d')).toBe(true);
});
it('handles invalid range strings', async () => {
vi.mocked(LicenseAPI.getRuntimeCapabilities).mockResolvedValue(mockFreeRuntimeCapabilities);
- await loadRuntimeLicenseStatus(true);
+ await loadRuntimeCapabilities(true);
expect(isRangeLocked('invalid')).toBe(false);
});
});
describe('commercial posture store', () => {
- it('suppresses commercial posture reads in demo mode', async () => {
- vi.mocked(demoModeEnabled).mockReturnValue(true);
+ it('defers commercial posture reads until presentation policy resolves', async () => {
+ vi.mocked(sessionPresentationPolicyResolved).mockReturnValue(false);
+
+ await loadCommercialPosture(true);
+
+ expect(LicenseAPI.getCommercialPosture).not.toHaveBeenCalled();
+ expect(commercialPosture()).toBeNull();
+ });
+
+ it('suppresses commercial posture reads when commercial surfaces are hidden', async () => {
+ vi.mocked(presentationPolicyHidesCommercialSurfaces).mockReturnValue(true);
await loadCommercialPosture(true);
@@ -322,13 +336,13 @@ describe('license stores', () => {
await expect(startProTrial()).rejects.toThrow('Failed to start trial');
});
- it('startProTrial fails closed in demo mode', async () => {
- vi.mocked(demoModeEnabled).mockReturnValue(true);
+ it('startProTrial fails closed when commercial surfaces are hidden', async () => {
+ vi.mocked(presentationPolicyHidesCommercialSurfaces).mockReturnValue(true);
await expect(startProTrial()).rejects.toMatchObject({
- message: 'Trial activation unavailable in demo mode',
+ message: 'Trial activation unavailable under the current presentation policy',
status: 404,
- code: 'demo_mode_unavailable',
+ code: 'presentation_policy_unavailable',
});
expect(LicenseAPI.startTrial).not.toHaveBeenCalled();
});
@@ -519,8 +533,18 @@ describe('license stores', () => {
});
describe('billing entitlements store', () => {
- it('suppresses full entitlements reads in demo mode', async () => {
- vi.mocked(demoModeEnabled).mockReturnValue(true);
+ it('defers full entitlements reads until presentation policy resolves', async () => {
+ vi.mocked(sessionPresentationPolicyResolved).mockReturnValue(false);
+ const previous = licenseEntitlements();
+
+ await loadLicenseEntitlements(true);
+
+ expect(LicenseAPI.getCommercialEntitlements).not.toHaveBeenCalled();
+ expect(licenseEntitlements()).toBe(previous);
+ });
+
+ it('suppresses full entitlements reads when commercial surfaces are hidden', async () => {
+ vi.mocked(presentationPolicyHidesCommercialSurfaces).mockReturnValue(true);
await loadLicenseEntitlements(true);
diff --git a/frontend-modern/src/stores/demoMode.ts b/frontend-modern/src/stores/demoMode.ts
index 56bfc504f1..51f94df56d 100644
--- a/frontend-modern/src/stores/demoMode.ts
+++ b/frontend-modern/src/stores/demoMode.ts
@@ -1,18 +1,14 @@
import type { SecurityStatus } from '@/types/config';
import {
- sessionCapabilities,
- sessionCapabilitiesResolved as demoModeResolved,
- syncSessionCapabilities,
-} from '@/stores/sessionCapabilities';
+ presentationPolicyIsDemoMode as demoModeEnabled,
+ sessionPresentationPolicyResolved as demoModeResolved,
+ syncSessionPresentationPolicy,
+} from '@/stores/sessionPresentationPolicy';
export function syncDemoModeFromSecurityStatus(
- status?: Pick<SecurityStatus, 'sessionCapabilities'> | null,
+ status?: Pick<SecurityStatus, 'sessionCapabilities' | 'presentationPolicy'> | null,
): boolean {
- return syncSessionCapabilities(status).demoMode;
+ return syncSessionPresentationPolicy(status).demoMode;
}
-export function demoModeEnabled(): boolean {
- return sessionCapabilities().demoMode;
-}
-
-export { demoModeResolved };
+export { demoModeEnabled, demoModeResolved };
diff --git a/frontend-modern/src/stores/license.ts b/frontend-modern/src/stores/license.ts
index adcbd99ca7..52e2e36e9b 100644
--- a/frontend-modern/src/stores/license.ts
+++ b/frontend-modern/src/stores/license.ts
@@ -19,7 +19,7 @@ const [loadError, setLoadError] = createSignal<Error | null>(null);
/**
* Load the canonical runtime capability payload from the server.
*/
-export async function loadLicenseStatus(force = false): Promise<void> {
+export async function loadRuntimeCapabilities(force = false): Promise<void> {
if (loaded() && !force) return;
setLoading(true);
@@ -60,7 +60,7 @@ export function isHostedModeEnabled(): boolean {
return Boolean(runtimeCapabilities()?.hosted_mode);
}
-export function getLimit(key: string) {
+export function getRuntimeLimit(key: string) {
const current = runtimeCapabilities();
if (!current?.limits?.length) return undefined;
return current.limits.find((limit) => limit.key === key);
@@ -95,12 +95,12 @@ eventBus.on('org_switched', () => {
setRuntimeCapabilities(null);
setLoaded(false);
setLoadError(null);
- void loadLicenseStatus(true);
+ void loadRuntimeCapabilities(true);
});
export {
runtimeCapabilities,
- loading as licenseLoading,
- loaded as licenseLoaded,
- loadError as licenseLoadError,
+ loading as runtimeCapabilitiesLoading,
+ loaded as runtimeCapabilitiesLoaded,
+ loadError as runtimeCapabilitiesLoadError,
};
diff --git a/frontend-modern/src/stores/licenseCommercial.ts b/frontend-modern/src/stores/licenseCommercial.ts
index f487cc6acf..6656d787a0 100644
--- a/frontend-modern/src/stores/licenseCommercial.ts
+++ b/frontend-modern/src/stores/licenseCommercial.ts
@@ -4,7 +4,6 @@ import {
type EntitlementLegacyConnections,
type LicenseCommercialPosture,
} from '@/api/license';
-import { demoModeEnabled } from '@/stores/demoMode';
import { eventBus } from '@/stores/events';
import { logger } from '@/utils/logger';
import {
@@ -16,8 +15,12 @@ import {
resolveUpgradeDestination,
type UpgradeDestination,
} from '@/utils/upgradeNavigation';
-import { loadLicenseStatus as loadRuntimeLicenseStatus } from '@/stores/license';
+import { loadRuntimeCapabilities } from '@/stores/license';
import { loadLicenseEntitlements } from '@/stores/licenseEntitlements';
+import {
+ presentationPolicyHidesCommercialSurfaces,
+ sessionPresentationPolicyResolved,
+} from '@/stores/sessionPresentationPolicy';
const FREE_COMMERCIAL_POSTURE_FALLBACK: LicenseCommercialPosture = {
subscription_state: 'expired',
@@ -77,12 +80,19 @@ function parseRetryAfterSeconds(value: string | null | undefined): number | unde
* Load the commercial posture payload used by non-billing trial and upgrade UI.
*/
export async function loadCommercialPosture(force = false): Promise<void> {
- if (demoModeEnabled()) {
+ if (!sessionPresentationPolicyResolved()) {
+ logger.debug(
+ '[licenseCommercialStore] Commercial posture deferred until presentation policy resolves',
+ );
+ return;
+ }
+
+ if (presentationPolicyHidesCommercialSurfaces()) {
setCommercialPostureState(FREE_COMMERCIAL_POSTURE_FALLBACK);
setLoadError(null);
setLoaded(true);
setLoading(false);
- logger.debug('[licenseCommercialStore] Commercial posture suppressed in demo mode');
+ logger.debug('[licenseCommercialStore] Commercial posture suppressed by presentation policy');
return;
}
@@ -112,10 +122,12 @@ export async function loadCommercialPosture(force = false): Promise<void> {
* Start a Pro trial for the current org, then refresh both runtime and commercial state.
*/
export async function startProTrial(): Promise<StartProTrialResult> {
- if (demoModeEnabled()) {
- const err = new Error('Trial activation unavailable in demo mode') as TrialStartRequestError;
+ if (!sessionPresentationPolicyResolved() || presentationPolicyHidesCommercialSurfaces()) {
+ const err = new Error(
+ 'Trial activation unavailable under the current presentation policy',
+ ) as TrialStartRequestError;
err.status = 404;
- err.code = 'demo_mode_unavailable';
+ err.code = 'presentation_policy_unavailable';
throw err;
}
@@ -150,7 +162,7 @@ export async function startProTrial(): Promise<StartProTrialResult> {
}
await Promise.all([
loadCommercialPosture(true),
- loadRuntimeLicenseStatus(true),
+ loadRuntimeCapabilities(true),
loadLicenseEntitlements(true),
]);
return { outcome: 'activated' };
@@ -236,13 +248,7 @@ eventBus.on('org_switched', () => {
export {
commercialPostureState as commercialPosture,
- commercialPostureState as entitlements,
- commercialPostureState as licenseStatus,
- loadCommercialPosture as loadLicenseStatus,
loading as commercialPostureLoading,
- loading as licenseLoading,
loaded as commercialPostureLoaded,
- loaded as licenseLoaded,
loadError as commercialPostureLoadError,
- loadError as licenseLoadError,
};
diff --git a/frontend-modern/src/stores/licenseEntitlements.ts b/frontend-modern/src/stores/licenseEntitlements.ts
index c5512be472..b611d1a2d4 100644
--- a/frontend-modern/src/stores/licenseEntitlements.ts
+++ b/frontend-modern/src/stores/licenseEntitlements.ts
@@ -1,8 +1,11 @@
import { createSignal } from 'solid-js';
import { LicenseAPI, type LicenseCommercialEntitlements } from '@/api/license';
-import { demoModeEnabled } from '@/stores/demoMode';
import { eventBus } from '@/stores/events';
import { logger } from '@/utils/logger';
+import {
+ presentationPolicyHidesCommercialSurfaces,
+ sessionPresentationPolicyResolved,
+} from '@/stores/sessionPresentationPolicy';
const FREE_LICENSE_ENTITLEMENTS_FALLBACK: LicenseCommercialEntitlements = {
capabilities: ['update_alerts', 'sso', 'ai_patrol'],
@@ -30,12 +33,21 @@ const [loadError, setLoadError] = createSignal<Error | null>(null);
* Load the full commercial entitlement payload used only by billing/identity surfaces.
*/
export async function loadLicenseEntitlements(force = false): Promise<void> {
- if (demoModeEnabled()) {
+ if (!sessionPresentationPolicyResolved()) {
+ logger.debug(
+ '[licenseEntitlementsStore] Full entitlements deferred until presentation policy resolves',
+ );
+ return;
+ }
+
+ if (presentationPolicyHidesCommercialSurfaces()) {
setLicenseEntitlementsState(FREE_LICENSE_ENTITLEMENTS_FALLBACK);
setLoadError(null);
setLoaded(true);
setLoading(false);
- logger.debug('[licenseEntitlementsStore] Full entitlements suppressed in demo mode');
+ logger.debug(
+ '[licenseEntitlementsStore] Full entitlements suppressed by presentation policy',
+ );
return;
}
diff --git a/frontend-modern/src/stores/sessionPresentationPolicy.ts b/frontend-modern/src/stores/sessionPresentationPolicy.ts
new file mode 100644
index 0000000000..b072e8fa4f
--- /dev/null
+++ b/frontend-modern/src/stores/sessionPresentationPolicy.ts
@@ -0,0 +1,65 @@
+import { createSignal } from 'solid-js';
+import type {
+ SecurityStatus,
+ SecurityStatusPresentationPolicy,
+ SecurityStatusSessionCapabilities,
+} from '@/types/config';
+import { syncSessionCapabilities } from '@/stores/sessionCapabilities';
+
+const DEFAULT_SESSION_PRESENTATION_POLICY: SecurityStatusPresentationPolicy = {
+ demoMode: false,
+ readOnly: false,
+ hideCommercial: false,
+ hideUpgrade: false,
+};
+
+const [sessionPresentationPolicy, setSessionPresentationPolicy] =
+ createSignal<SecurityStatusPresentationPolicy>({
+ ...DEFAULT_SESSION_PRESENTATION_POLICY,
+ });
+const [sessionPresentationPolicyResolved, setSessionPresentationPolicyResolved] = createSignal(false);
+
+function normalizeSessionPresentationPolicy(
+ policy?: Partial<SecurityStatusPresentationPolicy> | null,
+ sessionCapabilities?: Partial<SecurityStatusSessionCapabilities> | null,
+): SecurityStatusPresentationPolicy {
+ const demoMode = policy?.demoMode === true || sessionCapabilities?.demoMode === true;
+ return {
+ ...DEFAULT_SESSION_PRESENTATION_POLICY,
+ demoMode,
+ readOnly: policy?.readOnly === true || demoMode,
+ hideCommercial: policy?.hideCommercial === true || demoMode,
+ hideUpgrade: policy?.hideUpgrade === true || demoMode,
+ };
+}
+
+export function syncSessionPresentationPolicy(
+ status?: Pick<SecurityStatus, 'sessionCapabilities' | 'presentationPolicy'> | null,
+): SecurityStatusPresentationPolicy {
+ syncSessionCapabilities(status);
+ const next = normalizeSessionPresentationPolicy(
+ status?.presentationPolicy,
+ status?.sessionCapabilities,
+ );
+ setSessionPresentationPolicy(next);
+ setSessionPresentationPolicyResolved(true);
+ return next;
+}
+
+export function presentationPolicyIsDemoMode(): boolean {
+ return sessionPresentationPolicy().demoMode;
+}
+
+export function presentationPolicyIsReadOnly(): boolean {
+ return sessionPresentationPolicy().readOnly;
+}
+
+export function presentationPolicyHidesCommercialSurfaces(): boolean {
+ return sessionPresentationPolicy().hideCommercial;
+}
+
+export function presentationPolicyHidesUpgradePrompts(): boolean {
+ return sessionPresentationPolicy().hideUpgrade;
+}
+
+export { sessionPresentationPolicy, sessionPresentationPolicyResolved };
diff --git a/frontend-modern/src/types/config.ts b/frontend-modern/src/types/config.ts
index c538a9f5c7..e99e748643 100644
--- a/frontend-modern/src/types/config.ts
+++ b/frontend-modern/src/types/config.ts
@@ -121,6 +121,13 @@ export interface SecurityStatusSessionCapabilities {
demoMode: boolean;
}
+export interface SecurityStatusPresentationPolicy {
+ demoMode: boolean;
+ readOnly: boolean;
+ hideCommercial: boolean;
+ hideUpgrade: boolean;
+}
+
export interface SecurityStatus {
hasAuthentication: boolean;
apiTokenConfigured: boolean;
@@ -158,6 +165,7 @@ export interface SecurityStatus {
// Token auth scopes (for kiosk/limited-access mode)
tokenScopes?: string[];
sessionCapabilities?: SecurityStatusSessionCapabilities;
+ presentationPolicy?: SecurityStatusPresentationPolicy;
settingsCapabilities?: SecurityStatusSettingsCapabilities;
}
diff --git a/frontend-modern/src/useAppRuntimeState.ts b/frontend-modern/src/useAppRuntimeState.ts
index 754e82321c..8d2ec30fc0 100644
--- a/frontend-modern/src/useAppRuntimeState.ts
+++ b/frontend-modern/src/useAppRuntimeState.ts
@@ -49,10 +49,10 @@ import { syncKioskMode } from '@/hooks/useKioskMode';
import {
isHostedModeEnabled,
isMultiTenantEnabled,
- licenseLoaded,
- loadLicenseStatus,
+ runtimeCapabilitiesLoaded,
+ loadRuntimeCapabilities,
} from '@/stores/license';
-import { syncDemoModeFromSecurityStatus } from '@/stores/demoMode';
+import { syncSessionPresentationPolicy } from '@/stores/sessionPresentationPolicy';
import { layoutStore } from '@/utils/layout';
import {
markSystemSettingsLoadedWithDefaults,
@@ -297,8 +297,8 @@ export const useAppRuntimeState = () => {
const loadOrganizations = async () => {
setOrgsLoading(true);
try {
- if (!licenseLoaded()) {
- await loadLicenseStatus();
+ if (!runtimeCapabilitiesLoaded()) {
+ await loadRuntimeCapabilities();
}
if (!isMultiTenantEnabled()) {
@@ -580,7 +580,7 @@ export const useAppRuntimeState = () => {
logger.debug('[App] User logged out, showing login page');
if (securityResponse.ok) {
const securityData = (await securityResponse.json()) as SecurityStatus;
- syncDemoModeFromSecurityStatus(securityData);
+ syncSessionPresentationPolicy(securityData);
setSecurityStatus(securityData);
}
setHasAuth(true);
@@ -603,7 +603,7 @@ export const useAppRuntimeState = () => {
ssoLogoutURL?: string;
};
logger.debug('[App] Security status fetched', securityData);
- syncDemoModeFromSecurityStatus(securityData);
+ syncSessionPresentationPolicy(securityData);
setSecurityStatus(securityData);
const authConfigured = securityData.hasAuthentication || false;
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 71b5c8b4b8..44d1b6944f 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -1557,12 +1557,14 @@ describe('frontend resource type boundaries', () => {
expect(billingAdminPanelSource).toContain('./useBillingAdminPanelState');
expect(billingAdminPanelSource).toContain('./BillingAdminOrganizationsTable');
expect(relayOnboardingCardSource).toContain('./useRelayOnboardingCardState');
- expect(relayOnboardingCardSource).toContain('demoModeEnabled');
- expect(relayOnboardingCardSource).toContain('!demoModeEnabled() || state.hasRelay()');
+ expect(relayOnboardingCardSource).toContain('presentationPolicyHidesCommercialSurfaces');
+ expect(relayOnboardingCardSource).toContain(
+ '!presentationPolicyHidesCommercialSurfaces() || state.hasRelay()',
+ );
expect(relayOnboardingCardSource).not.toContain('createSignal(');
expect(relayOnboardingCardSource).not.toContain('RelayAPI.getStatus()');
expect(relayOnboardingCardStateSource).toContain('RelayAPI.getStatus()');
- expect(relayOnboardingCardStateSource).toContain('loadLicenseStatus()');
+ expect(relayOnboardingCardStateSource).toContain('loadRuntimeCapabilities()');
expect(relayOnboardingCardStateSource).toContain('runStartProTrialAction({');
expect(relayOnboardingCardStateSource).not.toContain('startProTrial()');
expect(organizationBillingPanelSource).not.toContain('normalizeOrgScope(getOrgID())');
@@ -2852,13 +2854,14 @@ describe('frontend resource type boundaries', () => {
expect(trialBannerSource).toContain('TRIAL_BANNER_TITLE');
expect(trialBannerSource).not.toContain('createSignal');
expect(trialBannerSource).not.toContain('createMemo');
- expect(trialBannerSource).not.toContain('loadLicenseStatus');
+ expect(trialBannerSource).not.toContain('loadRuntimeCapabilities');
expect(trialBannerSource).not.toContain('licenseStatus');
expect(trialBannerSource).not.toContain('getUpgradeActionUrlOrFallback');
expect(trialBannerStateSource).toContain('createSignal');
expect(trialBannerStateSource).toContain('createMemo');
- expect(trialBannerStateSource).toContain('loadLicenseStatus');
- expect(trialBannerStateSource).toContain('licenseStatus');
+ expect(trialBannerStateSource).toContain('loadCommercialPosture');
+ expect(trialBannerStateSource).toContain('commercialPosture');
+ expect(trialBannerStateSource).toContain('presentationPolicyHidesCommercialSurfaces');
expect(trialBannerStateSource).toContain('getUpgradeActionDestination');
expect(trialBannerStateSource).toContain('snoozeUpsell');
expect(trialBannerModelSource).toContain('TRIAL_BANNER_SNOOZE_KEY');
@@ -2991,12 +2994,12 @@ describe('frontend resource type boundaries', () => {
);
expect(monitoredSystemLimitWarningBannerSource).not.toContain('createEffect');
expect(monitoredSystemLimitWarningBannerSource).not.toContain('createMemo');
- expect(monitoredSystemLimitWarningBannerSource).not.toContain('loadLicenseStatus');
+ expect(monitoredSystemLimitWarningBannerSource).not.toContain('loadRuntimeCapabilities');
expect(monitoredSystemLimitWarningBannerSource).not.toContain('trackUpgradeMetricEvent');
expect(monitoredSystemLimitWarningBannerSource).not.toContain('legacyConnections()');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('createEffect');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('createMemo');
- expect(monitoredSystemLimitWarningBannerStateSource).toContain('loadLicenseStatus');
+ expect(monitoredSystemLimitWarningBannerStateSource).toContain('loadRuntimeCapabilities');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('trackUpgradeMetricEvent');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('legacyConnections');
expect(monitoredSystemLimitWarningBannerStateSource).toContain('handleUpgradeClick');
@@ -3181,7 +3184,7 @@ describe('frontend resource type boundaries', () => {
expect(historyChartModelSource).toContain('getHistoryChartScale');
expect(historyChartHeaderSource).toContain('formatHistoryChartTooltipValue');
expect(historyChartOverlaySource).toContain('Collecting data... History will appear here.');
- expect(historyChartOverlaySource).toContain('demoModeEnabled');
+ expect(historyChartOverlaySource).toContain('presentationPolicyHidesUpgradePrompts');
expect(historyChartOverlaySource).toContain('Unlock {props.chart.lockTierLabel()} Features');
expect(historyChartOverlaySource).toContain(
'Historical data beyond {props.chart.lockDays()} days is hidden in this demo.',
@@ -4218,7 +4221,7 @@ describe('frontend resource type boundaries', () => {
expect(auditWebhookPanelSource).not.toContain('No audit webhooks configured yet.');
expect(auditWebhookPanelSource).not.toContain('Loading audit webhooks…');
expect(auditWebhookPanelSource).not.toContain('Audit Webhooks (Pro)');
- expect(auditWebhookPanelSource).not.toContain('loadLicenseStatus();');
+ expect(auditWebhookPanelSource).not.toContain('loadRuntimeCapabilities();');
expect(auditWebhookPanelSource).not.toContain('const fetchWebhooks = async () =>');
expect(auditWebhookPanelSource).not.toContain('const saveWebhooks = async (urls: string[]) =>');
expect(auditWebhookPresentationSource).toContain(
@@ -4243,7 +4246,7 @@ describe('frontend resource type boundaries', () => {
expect(auditWebhookPresentationSource).toContain('AUDIT_WEBHOOK_SECURITY_NOTE_TITLE');
expect(auditWebhookPresentationSource).toContain('AUDIT_WEBHOOK_SECURITY_NOTE_BODY');
expect(auditWebhookStateSource).toContain('export const useAuditWebhookPanelState =');
- expect(auditWebhookStateSource).toContain('loadLicenseStatus();');
+ expect(auditWebhookStateSource).toContain('loadRuntimeCapabilities();');
expect(auditWebhookStateSource).toContain('trackPaywallViewed');
expect(auditWebhookStateSource).toContain('const fetchWebhooks = async () =>');
expect(auditWebhookStateSource).toContain('const saveWebhooks = async (urls: string[]) =>');
@@ -4402,16 +4405,16 @@ describe('frontend resource type boundaries', () => {
expect(patrolIntelligenceSurfaceSource).toContain('./PatrolIntelligenceBanners');
expect(patrolIntelligenceSurfaceSource).toContain('./PatrolIntelligenceSummary');
expect(patrolIntelligenceSurfaceSource).toContain('./PatrolIntelligenceWorkspace');
- expect(patrolIntelligenceBannersSource).toContain('demoModeEnabled');
+ expect(patrolIntelligenceBannersSource).toContain('presentationPolicyHidesUpgradePrompts');
expect(patrolIntelligenceBannersSource).toContain(
- '!demoModeEnabled() && state.licenseRequired()',
+ '!presentationPolicyHidesUpgradePrompts() && state.licenseRequired()',
);
- expect(patrolIntelligenceHeaderSource).toContain('demoModeEnabled');
+ expect(patrolIntelligenceHeaderSource).toContain('presentationPolicyHidesUpgradePrompts');
expect(patrolIntelligenceHeaderSource).toContain(
- '!demoModeEnabled() && state.autoFixLocked()',
+ '!presentationPolicyHidesUpgradePrompts() && state.autoFixLocked()',
);
expect(patrolIntelligenceHeaderSource).toContain(
- '!demoModeEnabled() && state.alertAnalysisLocked()',
+ '!presentationPolicyHidesUpgradePrompts() && state.alertAnalysisLocked()',
);
expect(operationsPageRouteSource).toContain(
"import { OperationsPageSurface } from '@/features/operations/OperationsPageSurface';",
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 64f5435b27..e1ffe46f34 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -6087,6 +6087,40 @@ func TestContract_SecurityStatusIncludesSessionCapabilitiesDemoMode(t *testing.T
}
}
+func TestContract_SecurityStatusPresentationPolicyDefaultsClosedOutsideDemo(t *testing.T) {
+ cfg := newTestConfigWithTokens(t)
+ cfg.DemoMode = false
+
+ router := NewRouter(cfg, nil, nil, nil, nil, "1.0.0")
+
+ req := httptest.NewRequest(http.MethodGet, "/api/security/status", nil)
+ rec := httptest.NewRecorder()
+ router.Handler().ServeHTTP(rec, req)
+ if rec.Code != http.StatusOK {
+ t.Fatalf("security status = %d, want 200 (%s)", rec.Code, rec.Body.String())
+ }
+
+ var payload map[string]any
+ if err := json.Unmarshal(rec.Body.Bytes(), &payload); err != nil {
+ t.Fatalf("decode security status payload: %v", err)
+ }
+
+ presentationPolicy, ok := payload["presentationPolicy"].(map[string]any)
+ if !ok {
+ t.Fatalf("presentationPolicy = %#v, want object", payload["presentationPolicy"])
+ }
+ for key, want := range map[string]bool{
+ "demoMode": false,
+ "readOnly": false,
+ "hideCommercial": false,
+ "hideUpgrade": false,
+ } {
+ if got, _ := presentationPolicy[key].(bool); got != want {
+ t.Fatalf("presentationPolicy.%s = %v, want %v", key, presentationPolicy[key], want)
+ }
+ }
+}
+
func TestContract_SetupScriptURLRejectsNonCanonicalRequestJSON(t *testing.T) {
handler := newTestConfigHandlers(t, &config.Config{DataPath: t.TempDir()})
diff --git a/internal/api/router_routes_auth_security.go b/internal/api/router_routes_auth_security.go
index 79ec551d09..89092b37d9 100644
--- a/internal/api/router_routes_auth_security.go
+++ b/internal/api/router_routes_auth_security.go
@@ -289,6 +289,7 @@ func (r *Router) registerAuthSecurityInstallRoutes() {
"hideLocalLogin": r.config.HideLocalLogin,
"agentUrl": agentURL,
"sessionCapabilities": r.securityStatusSessionCapabilities(),
+ "presentationPolicy": r.securityStatusPresentationPolicy(),
"settingsCapabilities": r.securityStatusSettingsCapabilitiesFromSnapshot(authSnapshot),
}
diff --git a/internal/api/security_status_additional_test.go b/internal/api/security_status_additional_test.go
index d6414f5218..5f25b4f75d 100644
--- a/internal/api/security_status_additional_test.go
+++ b/internal/api/security_status_additional_test.go
@@ -401,6 +401,7 @@ func TestSecurityStatusIncludesDemoModeSessionCapabilities(t *testing.T) {
var payload struct {
SessionCapabilities securityStatusSessionCapabilities `json:"sessionCapabilities"`
+ PresentationPolicy securityStatusPresentationPolicy `json:"presentationPolicy"`
}
if err := json.Unmarshal(rec.Body.Bytes(), &payload); err != nil {
t.Fatalf("decode response: %v", err)
@@ -409,4 +410,10 @@ func TestSecurityStatusIncludesDemoModeSessionCapabilities(t *testing.T) {
if !payload.SessionCapabilities.DemoMode {
t.Fatalf("expected sessionCapabilities.demoMode to be true, got %#v", payload.SessionCapabilities)
}
+ if !payload.PresentationPolicy.DemoMode ||
+ !payload.PresentationPolicy.ReadOnly ||
+ !payload.PresentationPolicy.HideCommercial ||
+ !payload.PresentationPolicy.HideUpgrade {
+ t.Fatalf("expected demo presentation policy, got %#v", payload.PresentationPolicy)
+ }
}
diff --git a/internal/api/security_status_capabilities.go b/internal/api/security_status_capabilities.go
index 2c1c8e921c..d68b362f4e 100644
--- a/internal/api/security_status_capabilities.go
+++ b/internal/api/security_status_capabilities.go
@@ -29,6 +29,13 @@ type securityStatusSessionCapabilities struct {
DemoMode bool `json:"demoMode"`
}
+type securityStatusPresentationPolicy struct {
+ DemoMode bool `json:"demoMode"`
+ ReadOnly bool `json:"readOnly"`
+ HideCommercial bool `json:"hideCommercial"`
+ HideUpgrade bool `json:"hideUpgrade"`
+}
+
type securityStatusAuthSnapshot struct {
request *http.Request
authenticated bool
@@ -232,7 +239,18 @@ func (r *Router) securityStatusSettingsCapabilities(req *http.Request) securityS
}
func (r *Router) securityStatusSessionCapabilities() securityStatusSessionCapabilities {
+ demoMode := r != nil && r.config != nil && r.config.DemoMode
return securityStatusSessionCapabilities{
- DemoMode: r != nil && r.config != nil && r.config.DemoMode,
+ DemoMode: demoMode,
+ }
+}
+
+func (r *Router) securityStatusPresentationPolicy() securityStatusPresentationPolicy {
+ demoMode := r != nil && r.config != nil && r.config.DemoMode
+ return securityStatusPresentationPolicy{
+ DemoMode: demoMode,
+ ReadOnly: demoMode,
+ HideCommercial: demoMode,
+ HideUpgrade: demoMode,
}
}