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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Make self-hosted activation success explicit
rcourtman18469f52b54e
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex ef39864a5f..a45dbb10ae 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -1144,6 +1144,12 @@ specific and continuity-aware: Relay and Pulse Pro should describe the actualpaid capabilities unlocked on this instance, while grandfathered pricing orcaptured monitored-system continuity must be visible in that same top summaryinstead of only in secondary billing detail blocks further down the page.+Fresh activation is part of that same governed plan state. After a checkout+return, trial handoff, or pasted-key activation succeeds, the owned plan+surface must show an explicit success summary that names the unlocked tier+and the marquee capabilities now available on this instance, rather than+falling back to a generic "activated" banner that leaves the user to infer+what changed from the steady-state billing card alone.That same router-owned billing contract now also includes recovery as a plandetail state instead of a fragment alias. The canonical recovery arrival is`/settings/system/billing/plan?details=recovery`, whilediff --git a/frontend-modern/src/components/Settings/ProLicensePanel.tsx b/frontend-modern/src/components/Settings/ProLicensePanel.tsxindex 1a414a8bd3..a602d63294 100644--- a/frontend-modern/src/components/Settings/ProLicensePanel.tsx+++ b/frontend-modern/src/components/Settings/ProLicensePanel.tsx@@ -101,6 +101,7 @@ const ProLicensePanelContent: Component = () => {><div class="space-y-6"><ProLicensePlanSection+ activationSuccessSummary={state.activationSuccessSummary()}commercialMigrationNotice={state.commercialMigrationNotice()}commercialPlanModel={state.commercialPlanModel()}currentPlanSummary={state.currentPlanSummary()}diff --git a/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx b/frontend-modern/src/components/Settings/ProLicensePlanSection.tsxindex f138087f47..da84bf82f0 100644--- a/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx+++ b/frontend-modern/src/components/Settings/ProLicensePlanSection.tsx@@ -35,6 +35,13 @@ interface MonitoredSystemCapacitySection {}interface ProLicensePlanSectionProps {+ activationSuccessSummary: {+ title: string;+ body: string;+ tone: string;+ highlightsLabel: string;+ highlights: string[];+ } | null;commercialMigrationNotice: Notice | null;commercialPlanModel: {summary: Array<{ label: string; value: string | number }>;@@ -84,6 +91,31 @@ export const ProLicensePlanSection: Component<ProLicensePlanSectionProps> = (proreturn (<>+ <Show when={props.activationSuccessSummary}>+ {(summary) => (+ <div class={`mb-4 rounded-md border p-3 text-sm ${summary().tone}`}>+ <p class="font-medium">{summary().title}</p>+ <p class="mt-1 text-xs opacity-90">{summary().body}</p>+ <Show when={summary().highlights.length > 0}>+ <div class="mt-3">+ <p class="text-[11px] uppercase tracking-wide opacity-80">+ {summary().highlightsLabel}+ </p>+ <ul class="mt-2 grid gap-2 sm:grid-cols-2">+ <For each={summary().highlights}>+ {(feature) => (+ <li class="text-xs flex items-center gap-2">+ <span class="w-1.5 h-1.5 rounded-full bg-current"></span>+ {feature}+ </li>+ )}+ </For>+ </ul>+ </div>+ </Show>+ </div>+ )}+ </Show><Show when={props.purchaseActivationNotice}>{(notice) => (<div class={`mb-4 rounded-md border p-3 text-sm ${notice().tone}`}>diff --git a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsxindex ec8a89279a..0220ea2bb8 100644--- a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx+++ b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx@@ -732,6 +732,14 @@ describe('ProLicensePanel', () => {});it('shows the hosted activation success banner on the Pro settings route', async () => {+ mockEntitlements = {+ capabilities: ['ai_patrol', 'ai_autofix', 'ai_alerts'],+ limits: [],+ subscription_state: 'trial',+ upgrade_reasons: [],+ tier: 'pro',+ trial_eligible: false,+ };useLocationMock.mockReturnValue({search: '?trial=activated',pathname: '/settings/system/billing/plan',@@ -740,10 +748,12 @@ describe('ProLicensePanel', () => {renderPanel();- expect(screen.getByText('Trial activated')).toBeInTheDocument();+ expect(screen.getByText('Pulse Pro trial is now active')).toBeInTheDocument();expect(- screen.getByText(/Pulse activated the Pro trial for this instance/i),+ screen.getByText(/this instance now has Pulse Pro trial access/i),).toBeInTheDocument();+ expect(screen.getByText('Available during this trial')).toBeInTheDocument();+ expect(screen.getAllByText('Patrol Auto-Fix').length).toBeGreaterThan(0);expect(navigateMock).toHaveBeenCalledWith(SELF_HOSTED_PRO_BILLING_PLAN_HREF, {replace: true,scroll: false,@@ -753,7 +763,7 @@ describe('ProLicensePanel', () => {it.each([{purchase: SELF_HOSTED_PRO_BILLING_PURCHASE_ACTIVATED,- title: 'Plan activated',+ title: 'Pulse Pro is now active',actionLabel: null,actionHref: null,},@@ -798,6 +808,17 @@ describe('ProLicensePanel', () => {actionHref,redirectedHref = SELF_HOSTED_PRO_BILLING_PLAN_HREF,}) => {+ if (purchase === SELF_HOSTED_PRO_BILLING_PURCHASE_ACTIVATED) {+ mockEntitlements = {+ capabilities: ['relay', 'mobile_app', 'push_notifications', 'ai_autofix'],+ limits: [],+ subscription_state: 'active',+ upgrade_reasons: [],+ tier: 'pro',+ licensed_email: '[email protected]',+ trial_eligible: false,+ };+ }useLocationMock.mockReturnValue({search:purchase === SELF_HOSTED_PRO_BILLING_PURCHASE_CANCELLED@@ -810,6 +831,13 @@ describe('ProLicensePanel', () => {renderPanel();expect(screen.getByText(title)).toBeInTheDocument();+ if (purchase === SELF_HOSTED_PRO_BILLING_PURCHASE_ACTIVATED) {+ expect(+ screen.getByText(/Checkout completed and this instance is now running Pulse Pro/i),+ ).toBeInTheDocument();+ expect(screen.getByText('Available now on this instance')).toBeInTheDocument();+ expect(screen.getAllByText('Patrol Auto-Fix').length).toBeGreaterThan(0);+ }if (actionLabel && actionHref) {const actionLinks = screen.getAllByRole('link', { name: actionLabel });expect(actionLinks.some((link) => link.getAttribute('href') === actionHref)).toBe(true);@@ -824,6 +852,15 @@ describe('ProLicensePanel', () => {);it('returns self-hosted plan purchases to the plan surface instead of the legacy usage tab', async () => {+ mockEntitlements = {+ capabilities: ['relay', 'mobile_app', 'push_notifications', 'ai_autofix'],+ limits: [],+ subscription_state: 'active',+ upgrade_reasons: [],+ tier: 'pro',+ licensed_email: '[email protected]',+ trial_eligible: false,+ };useLocationMock.mockReturnValue({search: `?purchase=${SELF_HOSTED_PRO_BILLING_PURCHASE_ACTIVATED}&intent=${SELF_HOSTED_PRO_BILLING_PLAN_SELECTION_INTENT}`,pathname: '/settings/system/billing/plan',@@ -832,12 +869,13 @@ describe('ProLicensePanel', () => {renderPanel();- expect(screen.getByText('Plan activated')).toBeInTheDocument();- expect(screen.getByRole('link', { name: 'Review plan' })).toHaveAttribute(- 'href',- SELF_HOSTED_PRO_BILLING_PLAN_HREF,- );+ expect(screen.getByText('Pulse Pro is now active')).toBeInTheDocument();+ expect(+ screen.getByText(/Checkout completed and this instance is now running Pulse Pro/i),+ ).toBeInTheDocument();expect(screen.queryByText('Compare self-hosted plans')).not.toBeInTheDocument();+ expect(screen.getAllByText('Patrol Auto-Fix').length).toBeGreaterThan(0);+ expect(screen.queryByRole('link', { name: 'Review plan' })).not.toBeInTheDocument();});it('opens recovery by default when the billing route requests the recovery detail', async () => {@@ -1066,6 +1104,7 @@ describe('ProLicensePanel', () => {expect(proLicensePanelStateSource).toContain('loadRuntimeCapabilities(true)');expect(proLicensePanelStateSource).toContain('buildSelfHostedCommercialPlanModel');expect(proLicensePanelStateSource).toContain('getSelfHostedCurrentPlanPresentation({');+ expect(proLicensePanelStateSource).toContain('getSelfHostedActivationSuccessPresentation({');expect(proLicensePanelStateSource).toContain('runStartProTrialAction({');expect(proLicensePanelStateSource).not.toContain('startProTrial()');expect(proLicensePanelStateSource).toContain("'A license or activation key is required'");@@ -1074,6 +1113,8 @@ describe('ProLicensePanel', () => {expect(proLicensePlanSectionSource).toContain('getTrialEndedProLicenseNotice');expect(proLicensePlanSectionSource).toContain('currentPlanSummary.title');expect(proLicensePlanSectionSource).toContain('currentPlanSummary.supplementalBadges');+ expect(proLicensePlanSectionSource).toContain('props.activationSuccessSummary');+ expect(proLicensePlanSectionSource).toContain('summary().highlightsLabel');expect(proLicensePlanSectionSource).toContain('Unlocked on this instance');expect(proLicensePlanSectionSource).not.toContain('getInactiveProUpsellNotice');expect(proLicensePlanSectionSource).not.toContain('MonitoredSystemDefinitionDisclosure');diff --git a/frontend-modern/src/components/Settings/useProLicensePanelState.ts b/frontend-modern/src/components/Settings/useProLicensePanelState.tsindex 14f527e49e..5ce1132958 100644--- a/frontend-modern/src/components/Settings/useProLicensePanelState.ts+++ b/frontend-modern/src/components/Settings/useProLicensePanelState.ts@@ -12,6 +12,7 @@ import {import { LicenseAPI } from '@/api/license';import {formatLicensePlanVersion,+ getSelfHostedActivationSuccessPresentation,getCommercialMigrationNotice,getGrandfatheredPriceContinuityNotice,getSelfHostedCurrentPlanPresentation,@@ -93,6 +94,9 @@ export function useProLicensePanelState() {const [purchaseActivationResult, setPurchaseActivationResult] = createSignal('');const [purchaseActivationIntent, setPurchaseActivationIntent] =createSignal<SelfHostedBillingPlanIntent | null>(null);+ const [activationSuccessSource, setActivationSuccessSource] = createSignal<+ 'manual' | 'purchase' | 'trial' | null+ >(null);const entitlements = createMemo(() => licenseEntitlements());const subscriptionState = createMemo(() => entitlements()?.subscription_state);@@ -115,11 +119,17 @@ export function useProLicensePanelState() {const purchaseResult = getSelfHostedBillingPurchaseArrival(location.search) ?? '';if (trialResult) {setTrialActivationResult(trialResult);+ if (trialResult === 'activated') {+ setActivationSuccessSource('trial');+ }params.delete('trial');}if (purchaseResult) {setPurchaseActivationResult(purchaseResult);setPurchaseActivationIntent(getSelfHostedBillingPlanIntent(location.search));+ if (purchaseResult === SELF_HOSTED_PRO_BILLING_PURCHASE_ACTIVATED) {+ setActivationSuccessSource('purchase');+ }params.delete(SELF_HOSTED_PRO_BILLING_PURCHASE_QUERY_PARAM);if (purchaseResult === SELF_HOSTED_PRO_BILLING_PURCHASE_ACTIVATED) {params.delete(SELF_HOSTED_PRO_BILLING_PLAN_INTENT_QUERY_PARAM);@@ -452,11 +462,24 @@ export function useProLicensePanelState() {);const trialActivationNotice = createMemo(() => {+ if (trialActivationResult().trim().toLowerCase() === 'activated') {+ return null;+ }return getTrialActivationNotice(trialActivationResult());});const purchaseActivationNotice = createMemo(() => {+ if (purchaseActivationResult().trim().toLowerCase() === 'activated') {+ return null;+ }return getPurchaseActivationNotice(purchaseActivationResult());});+ const activationSuccessSummary = createMemo(() =>+ getSelfHostedActivationSuccessPresentation({+ entitlements: entitlements(),+ displayableCapabilities: formattedFeatures(),+ source: activationSuccessSource(),+ }),+ );const purchaseActivationAction = createMemo<{label: string;destination: UpgradeDestination;@@ -591,6 +614,7 @@ export function useProLicensePanelState() {return;}notificationStore.success(result.message || 'License activated');+ setActivationSuccessSource('manual');setLicenseKey('');await Promise.all([loadPanelData(),@@ -614,6 +638,7 @@ export function useProLicensePanelState() {try {const result = await LicenseAPI.clearLicense();notificationStore.success(result.message || 'License cleared');+ setActivationSuccessSource(null);await Promise.all([loadPanelData(),loadCommercialPosture(true),@@ -630,6 +655,7 @@ export function useProLicensePanelState() {activeSection,activating,clearing,+ activationSuccessSummary,commercialMigrationNotice,commercialPlanModel,currentPlanSummary,diff --git a/frontend-modern/src/utils/__tests__/licensePresentation.test.ts b/frontend-modern/src/utils/__tests__/licensePresentation.test.tsindex 8f6e7be3d5..b6bb75dce3 100644--- a/frontend-modern/src/utils/__tests__/licensePresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/licensePresentation.test.ts@@ -8,6 +8,7 @@ import {getCommercialMigrationNotice,getFeatureMinTierLabel,getGrandfatheredPriceContinuityNotice,+ getSelfHostedActivationSuccessPresentation,getSelfHostedCurrentPlanPresentation,getLicenseFeatureLabel,getLicenseStatusLoadingState,@@ -280,6 +281,106 @@ describe('licensePresentation', () => {});});+ it('builds activation-success summaries for purchase, pasted-key, and trial activation paths', () => {+ expect(+ getSelfHostedActivationSuccessPresentation({+ entitlements: {+ tier: 'pro',+ subscription_state: 'active',+ capabilities: ['relay', 'mobile_app', 'push_notifications', 'ai_autofix'],+ limits: [],+ upgrade_reasons: [],+ },+ displayableCapabilities: [+ 'Pulse Relay (Remote Access)',+ 'Mobile App Access',+ 'Push Notifications',+ 'Patrol Auto-Fix',+ ],+ source: 'purchase',+ }),+ ).toEqual({+ tone: 'border-green-200 dark:border-green-900 bg-green-50 dark:bg-green-900 text-green-900 dark:text-green-100',+ title: 'Pulse Pro is now active',+ body: 'Checkout completed and this instance is now running Pulse Pro.',+ highlightsLabel: 'Available now on this instance',+ highlights: [+ 'Patrol Auto-Fix',+ 'Pulse Alert Analysis',+ 'Kubernetes Insights',+ '90-day metric history',+ ],+ });++ expect(+ getSelfHostedActivationSuccessPresentation({+ entitlements: {+ tier: 'relay',+ subscription_state: 'active',+ capabilities: ['relay', 'mobile_app', 'push_notifications'],+ limits: [],+ upgrade_reasons: [],+ },+ displayableCapabilities: [+ 'Pulse Relay (Remote Access)',+ 'Mobile App Access',+ 'Push Notifications',+ ],+ source: 'manual',+ }),+ ).toEqual({+ tone: 'border-green-200 dark:border-green-900 bg-green-50 dark:bg-green-900 text-green-900 dark:text-green-100',+ title: 'Relay is now active',+ body: 'The activation key was accepted and this instance is now running Relay.',+ highlightsLabel: 'Available now on this instance',+ highlights: [+ 'Pulse Relay (Remote Access)',+ 'Mobile App Access',+ 'Push Notifications',+ '14-day metric history',+ ],+ });++ expect(+ getSelfHostedActivationSuccessPresentation({+ entitlements: {+ tier: 'pro',+ subscription_state: 'trial',+ capabilities: ['ai_patrol', 'ai_autofix'],+ limits: [],+ upgrade_reasons: [],+ },+ displayableCapabilities: ['Pulse Patrol', 'Patrol Auto-Fix'],+ source: 'trial',+ }),+ ).toEqual({+ tone: 'border-green-200 dark:border-green-900 bg-green-50 dark:bg-green-900 text-green-900 dark:text-green-100',+ title: 'Pulse Pro trial is now active',+ body: 'The trial handoff completed and this instance now has Pulse Pro trial access.',+ highlightsLabel: 'Available during this trial',+ highlights: [+ 'Patrol Auto-Fix',+ 'Pulse Alert Analysis',+ 'Kubernetes Insights',+ '90-day metric history',+ ],+ });++ expect(+ getSelfHostedActivationSuccessPresentation({+ entitlements: {+ tier: 'free',+ subscription_state: 'expired',+ capabilities: [],+ limits: [],+ upgrade_reasons: [],+ },+ displayableCapabilities: [],+ source: 'purchase',+ }),+ ).toBeNull();+ });+it('returns monitored-system continuity notices for pending verification and captured grandfathering', () => {expect(getMonitoredSystemContinuityNotice(diff --git a/frontend-modern/src/utils/licensePresentation.ts b/frontend-modern/src/utils/licensePresentation.tsindex 925e0d8c96..8733511481 100644--- a/frontend-modern/src/utils/licensePresentation.ts+++ b/frontend-modern/src/utils/licensePresentation.ts@@ -116,6 +116,13 @@ export interface SelfHostedCurrentPlanPresentation {supplementalSummary?: string;}+export interface SelfHostedActivationSuccessPresentation extends LicenseInlineNotice {+ highlightsLabel: string;+ highlights: string[];+}++export type SelfHostedActivationSuccessSource = 'manual' | 'purchase' | 'trial';+const GRANDFATHERED_V5_PLAN_LABELS: Record<string, string> = {v5_lifetime_grandfathered: 'V5 Lifetime Grandfathered',v5_pro_monthly_grandfathered: 'V5 Pro Monthly (Grandfathered)',@@ -258,6 +265,56 @@ export const getMonitoredSystemContinuityNotice = (return null;};+const getSelfHostedUnlockedFeatures = ({+ entitlements,+ displayableCapabilities,+}: {+ entitlements?: LicenseCommercialEntitlements | null;+ displayableCapabilities: string[];+}): string[] => {+ const current = entitlements;+ if (!current) {+ return [];+ }++ const normalizedTier = (current.tier || '').trim().toLowerCase();+ const planDefinition = getSelfHostedPlanDefinitionForBillingTier(current.tier);+ const fallbackHighlights = [...(planDefinition?.entitlementHighlights ?? [])];+ return normalizedTier === 'free'+ ? fallbackHighlights+ : displayableCapabilities.length > 0+ ? displayableCapabilities+ : fallbackHighlights;+};++const getSelfHostedActivationHighlights = ({+ entitlements,+ displayableCapabilities,+}: {+ entitlements?: LicenseCommercialEntitlements | null;+ displayableCapabilities: string[];+}): string[] => {+ const planDefinition = getSelfHostedPlanDefinitionForBillingTier(entitlements?.tier);+ const prioritized = [...(planDefinition?.entitlementHighlights ?? [])];+ const unlockedFeatures = getSelfHostedUnlockedFeatures({+ entitlements,+ displayableCapabilities,+ });+ const highlights: string[] = [];++ for (const feature of [...prioritized, ...unlockedFeatures]) {+ if (!feature || highlights.includes(feature)) {+ continue;+ }+ highlights.push(feature);+ if (highlights.length >= 4) {+ break;+ }+ }++ return highlights;+};+export const getSelfHostedCurrentPlanPresentation = ({entitlements,displayableCapabilities,@@ -279,13 +336,10 @@ export const getSelfHostedCurrentPlanPresentation = ({const normalizedTier = (current.tier || '').trim().toLowerCase();const planLabel = getSelfHostedPlanLabel(current.tier);const planDefinition = getSelfHostedPlanDefinitionForBillingTier(current.tier);- const fallbackHighlights = [...(planDefinition?.entitlementHighlights ?? [])];- const unlockedFeatures =- normalizedTier === 'free'- ? fallbackHighlights- : displayableCapabilities.length > 0- ? displayableCapabilities- : fallbackHighlights;+ const unlockedFeatures = getSelfHostedUnlockedFeatures({+ entitlements: current,+ displayableCapabilities,+ });const supplementalBadges: string[] = [];const supplementalDetails: string[] = [];@@ -366,6 +420,62 @@ export const getSelfHostedCurrentPlanPresentation = ({};};+export const getSelfHostedActivationSuccessPresentation = ({+ entitlements,+ displayableCapabilities,+ source,+}: {+ entitlements?: LicenseCommercialEntitlements | null;+ displayableCapabilities: string[];+ source: SelfHostedActivationSuccessSource | null;+}): SelfHostedActivationSuccessPresentation | null => {+ const current = entitlements;+ if (!source || !current) {+ return null;+ }++ const normalizedState = (current.subscription_state || '').trim().toLowerCase();+ const normalizedTier = (current.tier || '').trim().toLowerCase();+ if (normalizedTier === 'free') {+ return null;+ }++ if (source === 'trial') {+ if (normalizedState !== 'trial') {+ return null;+ }+ } else if (normalizedState !== 'active' && normalizedState !== 'grace') {+ return null;+ }++ const planLabel = getSelfHostedPlanLabel(current.tier);+ const highlights = getSelfHostedActivationHighlights({+ entitlements: current,+ displayableCapabilities,+ });++ if (source === 'trial') {+ return {+ tone: 'border-green-200 dark:border-green-900 bg-green-50 dark:bg-green-900 text-green-900 dark:text-green-100',+ title: `${planLabel} trial is now active`,+ body: `The trial handoff completed and this instance now has ${planLabel} trial access.`,+ highlightsLabel: 'Available during this trial',+ highlights,+ };+ }++ return {+ tone: 'border-green-200 dark:border-green-900 bg-green-50 dark:bg-green-900 text-green-900 dark:text-green-100',+ title: `${planLabel} is now active`,+ body:+ source === 'purchase'+ ? `Checkout completed and this instance is now running ${planLabel}.`+ : `The activation key was accepted and this instance is now running ${planLabel}.`,+ highlightsLabel: 'Available now on this instance',+ highlights,+ };+};+export const getCommercialMigrationActionText = (action?: string): string => {switch (action) {case 'retry_activation':diff --git a/tests/integration/tests/55-self-hosted-upgrade-return.spec.ts b/tests/integration/tests/55-self-hosted-upgrade-return.spec.tsindex 219df2e33f..5346953905 100644--- a/tests/integration/tests/55-self-hosted-upgrade-return.spec.ts+++ b/tests/integration/tests/55-self-hosted-upgrade-return.spec.ts@@ -63,6 +63,46 @@ const MONITORED_SYSTEM_COMMERCIAL_POSTURE = {has_migration_gap: false,};+const ACTIVATED_PLAN_ENTITLEMENTS = {+ capabilities: [+ "relay",+ "mobile_app",+ "push_notifications",+ "ai_patrol",+ "ai_autofix",+ "ai_alerts",+ "kubernetes_ai",+ "rbac",+ "audit_logging",+ ],+ limits: [],+ subscription_state: "active",+ upgrade_reasons: [],+ tier: "pro",+ plan_version: "pro_monthly",+ licensed_email: "[email protected]",+ trial_eligible: false,+ hosted_mode: false,+ valid: true,+ is_lifetime: false,+ days_remaining: 30,+};++const ACTIVATED_PLAN_RUNTIME_CAPABILITIES = {+ capabilities: ACTIVATED_PLAN_ENTITLEMENTS.capabilities,+ limits: ACTIVATED_PLAN_ENTITLEMENTS.limits,+ hosted_mode: false,+ max_history_days: 90,+};++const ACTIVATED_PLAN_COMMERCIAL_POSTURE = {+ subscription_state: "active",+ upgrade_reasons: [],+ tier: "pro",+ trial_eligible: false,+ has_migration_gap: false,+};+const MONITORED_SYSTEM_LEDGER = {systems: [{@@ -249,6 +289,7 @@ async function configurePurchaseReturnRoute(bridgeTitle?: string;completionTitle: string;finalRedirectUrl: string;+ onComplete?: () => void;},) {const {@@ -259,6 +300,7 @@ async function configurePurchaseReturnRoute(bridgeTitle,completionTitle,finalRedirectUrl,+ onComplete,} = options;await context.route(`${PURCHASE_RETURN_URL}**`, async (route) => {@@ -291,6 +333,7 @@ async function configurePurchaseReturnRoute(expect(formData.get("portal_handoff_id")).toBe(portalHandoffID);expect(formData.get("feature")).toBe(feature);expect(formData.get("purchase_return_token")).toBe(purchaseReturnToken);+ onComplete?.();await route.fulfill({status: 200,contentType: "text/html",@@ -299,7 +342,15 @@ async function configurePurchaseReturnRoute(});}-async function configureBillingFixtures(context: BrowserContext, page: Page) {+async function configureBillingFixtures(+ context: BrowserContext,+ page: Page,+ options: {+ activationState?: { current: boolean };+ } = {},+) {+ const activationState = options.activationState ?? { current: false };+await page.addInitScript(() => {localStorage.setItem("pulse_whats_new_v2_shown", "true");});@@ -325,15 +376,28 @@ async function configureBillingFixtures(context: BrowserContext, page: Page) {});await context.route("**/api/license/runtime-capabilities", async (route) => {- await fulfillJSON(route, MONITORED_SYSTEM_RUNTIME_CAPABILITIES);+ await fulfillJSON(+ route,+ activationState.current+ ? ACTIVATED_PLAN_RUNTIME_CAPABILITIES+ : MONITORED_SYSTEM_RUNTIME_CAPABILITIES,+ );});await context.route("**/api/license/commercial-posture", async (route) => {- await fulfillJSON(route, MONITORED_SYSTEM_COMMERCIAL_POSTURE);+ await fulfillJSON(+ route,+ activationState.current+ ? ACTIVATED_PLAN_COMMERCIAL_POSTURE+ : MONITORED_SYSTEM_COMMERCIAL_POSTURE,+ );});await context.route("**/api/license/entitlements", async (route) => {- await fulfillJSON(route, MONITORED_SYSTEM_ENTITLEMENTS);+ await fulfillJSON(+ route,+ activationState.current ? ACTIVATED_PLAN_ENTITLEMENTS : MONITORED_SYSTEM_ENTITLEMENTS,+ );});await context.route(@@ -375,7 +439,8 @@ test.describe("Self-hosted upgrade return flow", () => {);const context = page.context();- await configureBillingFixtures(context, page);+ const activationState = { current: false };+ await configureBillingFixtures(context, page, { activationState });let purchaseStartURL = "";await configurePurchaseStartRoute(context, (requestUrl) => {@@ -388,6 +453,9 @@ test.describe("Self-hosted upgrade return flow", () => {await configurePurchaseReturnRoute(context, {completionTitle: "Plan activated",finalRedirectUrl: ACTIVATED_BILLING_URL,+ onComplete: () => {+ activationState.current = true;+ },});await openMonitoredSystemUpgradeArrival(page);@@ -415,12 +483,23 @@ test.describe("Self-hosted upgrade return flow", () => {page.getByRole("button", { name: "Continue to Plans" }),).toHaveCount(0);await expect(page).toHaveURL(FINAL_BILLING_URL);+ const activationSummary = page+ .locator("div.rounded-md.border.p-3.text-sm")+ .filter({ has: page.getByText("Pulse Pro is now active", { exact: true }) })+ .first();+await expect(- page.getByText("Plan activated", { exact: true }),+ activationSummary.getByText("Pulse Pro is now active", { exact: true }),+ ).toBeVisible();+ await expect(+ activationSummary.getByText(+ "Checkout completed and this instance is now running Pulse Pro.",+ ),).toBeVisible();- const reviewPlanLink = page.getByRole("link", { name: "Review plan" });- await expect(reviewPlanLink).toHaveAttribute("href", "/settings/system/billing/plan");+ await expect(activationSummary.getByText("Available now on this instance")).toBeVisible();+ await expect(activationSummary.getByText("Patrol Auto-Fix")).toBeVisible();await expect(page.getByRole("link", { name: "Review usage" })).toHaveCount(0);+ await expect(page.getByRole("link", { name: "Review plan" })).toHaveCount(0);});test("returns cancelled checkout directly to the owned billing plan route", async ({@@ -432,7 +511,8 @@ test.describe("Self-hosted upgrade return flow", () => {);const context = page.context();- await configureBillingFixtures(context, page);+ const activationState = { current: false };+ await configureBillingFixtures(context, page, { activationState });await configurePurchaseStartRoute(context);await configurePortalRedirectRoute(context, {@@ -464,7 +544,8 @@ test.describe("Self-hosted upgrade return flow", () => {);const context = page.context();- await configureBillingFixtures(context, page);+ const activationState = { current: false };+ await configureBillingFixtures(context, page, { activationState });await configurePurchaseStartRoute(context);await configurePortalRedirectRoute(context, {@@ -475,6 +556,9 @@ test.describe("Self-hosted upgrade return flow", () => {bridgeTitle: "Confirming plan activation state",completionTitle: "Purchase activation already completed",finalRedirectUrl: ACTIVATED_BILLING_URL,+ onComplete: () => {+ activationState.current = true;+ },});await openMonitoredSystemUpgradeArrival(page);@@ -482,13 +566,22 @@ test.describe("Self-hosted upgrade return flow", () => {await page.goto(buildPortalHandoffUrl(), { waitUntil: "domcontentloaded" });await expect(page).toHaveURL(FINAL_BILLING_URL);+ const activationSummary = page+ .locator("div.rounded-md.border.p-3.text-sm")+ .filter({ has: page.getByText("Pulse Pro is now active", { exact: true }) })+ .first();+await expect(- page.getByText("Plan activated", { exact: true }),+ activationSummary.getByText("Pulse Pro is now active", { exact: true }),).toBeVisible();- await expect(page.getByRole("link", { name: "Review plan" })).toHaveAttribute(- "href",- "/settings/system/billing/plan",- );+ await expect(+ activationSummary.getByText(+ "Checkout completed and this instance is now running Pulse Pro.",+ ),+ ).toBeVisible();+ await expect(activationSummary.getByText("Available now on this instance")).toBeVisible();+ await expect(activationSummary.getByText("Patrol Auto-Fix")).toBeVisible();+ await expect(page.getByRole("link", { name: "Review plan" })).toHaveCount(0);await expect(page.getByRole("link", { name: "Review usage" })).toHaveCount(0);});diff --git a/tests/integration/tests/70-self-hosted-manual-activation-success.spec.ts b/tests/integration/tests/70-self-hosted-manual-activation-success.spec.tsnew file mode 100644index 0000000000..c815026818--- /dev/null+++ b/tests/integration/tests/70-self-hosted-manual-activation-success.spec.ts@@ -0,0 +1,155 @@+import { expect, test, type Page } from '@playwright/test';++import { ensureAuthenticated } from './helpers';++const INACTIVE_ENTITLEMENTS = {+ capabilities: [],+ limits: [],+ subscription_state: 'expired',+ upgrade_reasons: [],+ tier: 'free',+ trial_eligible: true,+ hosted_mode: false,+ valid: false,+};++const ACTIVE_ENTITLEMENTS = {+ capabilities: [+ 'relay',+ 'mobile_app',+ 'push_notifications',+ 'ai_patrol',+ 'ai_autofix',+ 'ai_alerts',+ 'kubernetes_ai',+ 'rbac',+ 'audit_logging',+ ],+ limits: [],+ subscription_state: 'active',+ upgrade_reasons: [],+ tier: 'pro',+ plan_version: 'pro_monthly',+ licensed_email: '[email protected]',+ trial_eligible: false,+ hosted_mode: false,+ valid: true,+ is_lifetime: false,+ days_remaining: 30,+};++const INACTIVE_RUNTIME_CAPABILITIES = {+ capabilities: [],+ limits: [],+ hosted_mode: false,+ max_history_days: 7,+};++const ACTIVE_RUNTIME_CAPABILITIES = {+ capabilities: ACTIVE_ENTITLEMENTS.capabilities,+ limits: ACTIVE_ENTITLEMENTS.limits,+ hosted_mode: false,+ max_history_days: 90,+};++const INACTIVE_COMMERCIAL_POSTURE = {+ subscription_state: 'expired',+ upgrade_reasons: [],+ tier: 'free',+ trial_eligible: true,+ monitored_system_capacity: null,+ monitored_system_continuity: null,+ has_migration_gap: false,+};++const ACTIVE_COMMERCIAL_POSTURE = {+ subscription_state: 'active',+ upgrade_reasons: [],+ tier: 'pro',+ trial_eligible: false,+ monitored_system_capacity: null,+ monitored_system_continuity: null,+ has_migration_gap: false,+};++async function stubManualActivationEndpoints(page: Page) {+ let activated = false;++ await page.route('**/api/license/runtime-capabilities', async (route) => {+ await route.fulfill({+ status: 200,+ contentType: 'application/json',+ body: JSON.stringify(activated ? ACTIVE_RUNTIME_CAPABILITIES : INACTIVE_RUNTIME_CAPABILITIES),+ });+ });++ await page.route('**/api/license/entitlements', async (route) => {+ await route.fulfill({+ status: 200,+ contentType: 'application/json',+ body: JSON.stringify(activated ? ACTIVE_ENTITLEMENTS : INACTIVE_ENTITLEMENTS),+ });+ });++ await page.route('**/api/license/commercial-posture', async (route) => {+ await route.fulfill({+ status: 200,+ contentType: 'application/json',+ body: JSON.stringify(activated ? ACTIVE_COMMERCIAL_POSTURE : INACTIVE_COMMERCIAL_POSTURE),+ });+ });++ await page.route('**/api/license/activate', async (route) => {+ activated = true;+ await route.fulfill({+ status: 200,+ contentType: 'application/json',+ body: JSON.stringify({+ success: true,+ message: 'License activated',+ }),+ });+ });+}++test.describe('Self-hosted manual activation success', () => {+ test('shows the unlocked plan and capabilities immediately after a pasted key activates', async ({+ page,+ }, testInfo) => {+ test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only plans coverage');++ await stubManualActivationEndpoints(page);+ await ensureAuthenticated(page);+ await page.goto('/settings/system/billing/plan', { waitUntil: 'domcontentloaded' });++ await expect(page.getByText('Current plan: Community')).toBeVisible();++ await page.locator('summary').filter({ hasText: 'Redeem existing key' }).first().click();+ const activationField = page.locator('#pulse-pro-license-key');+ await expect(activationField).toBeVisible();+ await activationField.fill('ppk_live_test_activation_key');+ await page.getByRole('button', { name: 'Activate License' }).click();++ const activationSummary = page+ .locator('div.rounded-md.border.p-3.text-sm')+ .filter({ has: page.getByText('Pulse Pro is now active', { exact: true }) })+ .first();++ await expect(activationSummary.getByText('Pulse Pro is now active', { exact: true })).toBeVisible();+ await expect(+ activationSummary.getByText(+ 'The activation key was accepted and this instance is now running Pulse Pro.',+ ),+ ).toBeVisible();+ await expect(activationSummary.getByText('Available now on this instance')).toBeVisible();+ await expect(activationSummary.getByText('Patrol Auto-Fix')).toBeVisible();+ await expect(activationSummary.getByText('Pulse Alert Analysis')).toBeVisible();++ await expect(page.getByText('Current plan: Pulse Pro')).toBeVisible();+ await expect(+ page.getByText(+ 'Pulse Pro is active on this instance. AI operations, advanced administration, and 90-day history are unlocked right now.',+ ),+ ).toBeVisible();+ });+});