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.

Converge commercial migration banner on shared notice primitive

rcourtman5330ce40c7b3
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index c95daeb4cd..e5b11d1e03 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -97,6 +97,7 @@ Stripe-free and avoids a cloud-control-plane report data path across clients.
35. `internal/hosted/provisioner.go`
36. `frontend-modern/src/App.tsx`
37. `frontend-modern/src/AppLayout.tsx`
+37a. `frontend-modern/src/components/CommercialMigrationBanner.tsx`
38. `frontend-modern/src/useAppRuntimeState.ts`
39. `frontend-modern/src/components/Settings/BillingAdminPanel.tsx`
40. `frontend-modern/src/components/Settings/BillingAdminOrganizationsTable.tsx`
@@ -145,10 +146,16 @@ Stripe-free and avoids a cloud-control-plane report data path across clients.
## Shared Boundaries
-1. `frontend-modern/src/components/Settings/MonitoredSystemImpactPreview.tsx` shared with `agent-lifecycle`: the monitored-system impact preview is both a platform-connections lifecycle surface and a canonical cloud-paid monitored-system presentation boundary.
-2. `frontend-modern/src/useAppRuntimeState.ts` shared with `performance-and-scalability`: the authenticated app runtime bootstrap is both a hosted commercial org-context boundary and a protected app-shell performance boundary.
-3. `internal/api/licensing_bridge.go` shared with `api-contracts`: commercial licensing bridge handlers carry both API payload contract and cloud-paid entitlement boundary ownership.
-4. `internal/api/licensing_handlers.go` shared with `api-contracts`: commercial licensing handlers carry both API payload contract and cloud-paid entitlement boundary ownership.
+1. `frontend-modern/src/components/CommercialMigrationBanner.tsx` shared with `frontend-primitives`: the global commercial migration notice is both a cloud-paid entitlement recovery surface and a shared app-shell notice primitive consumer.
+ The banner's commercial migration predicates, copy, retry polling, dismissal
+ state, and billing-plan destination remain cloud-paid owned, while the
+ visible banner shell, icon, action slot, and dismiss chrome must compose the
+ shared `InlineNotice` primitive instead of carrying local paid-state tone
+ classes, raw SVGs, or page-local buttons.
+2. `frontend-modern/src/components/Settings/MonitoredSystemImpactPreview.tsx` shared with `agent-lifecycle`: the monitored-system impact preview is both a platform-connections lifecycle surface and a canonical cloud-paid monitored-system presentation boundary.
+3. `frontend-modern/src/useAppRuntimeState.ts` shared with `performance-and-scalability`: the authenticated app runtime bootstrap is both a hosted commercial org-context boundary and a protected app-shell performance boundary.
+4. `internal/api/licensing_bridge.go` shared with `api-contracts`: commercial licensing bridge handlers carry both API payload contract and cloud-paid entitlement boundary ownership.
+5. `internal/api/licensing_handlers.go` shared with `api-contracts`: commercial licensing handlers carry both API payload contract and cloud-paid entitlement boundary ownership.
That same shared licensing boundary also owns installation-version and
runtime-build continuity for authenticated v6 installs: `internal/api/router.go`
and `internal/api/licensing_handlers.go` must hand the canonical process
@@ -173,9 +180,9 @@ Stripe-free and avoids a cloud-control-plane report data path across clients.
pending must self-retry in the background with backoff for the life of
the process so a transient license-server or DNS failure at first boot
never strands a paying upgrader on Community until a manual restart.
-5. `internal/api/licensing_legacy_retry.go` shared with `api-contracts`: the background legacy-exchange retry loop carries both API payload contract and cloud-paid entitlement boundary ownership.
-6. `internal/api/payments_webhook_handlers.go` shared with `api-contracts`: commercial payment webhook handlers carry both API payload contract and cloud-paid billing boundary ownership.
-7. `internal/api/public_signup_handlers.go` shared with `api-contracts`: hosted signup handlers carry both API payload contract and cloud-paid hosted provisioning boundary ownership.
+6. `internal/api/licensing_legacy_retry.go` shared with `api-contracts`: the background legacy-exchange retry loop carries both API payload contract and cloud-paid entitlement boundary ownership.
+7. `internal/api/payments_webhook_handlers.go` shared with `api-contracts`: commercial payment webhook handlers carry both API payload contract and cloud-paid billing boundary ownership.
+8. `internal/api/public_signup_handlers.go` shared with `api-contracts`: hosted signup handlers carry both API payload contract and cloud-paid hosted provisioning boundary ownership.
That shared monitored-system presentation boundary also owns disabled
provider-connection copy. Commercial entitlement surfaces must treat canonical
zero-delta and removal-only TrueNAS or VMware previews as non-consuming or
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 87d014531a..7f39309942 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -144,6 +144,7 @@ work extends shared components instead of creating new local variants.
114. `frontend-modern/src/components/shared/useUpgradeNavigation.ts`
115. `frontend-modern/src/utils/upgradeNavigation.ts`
116. `frontend-modern/src/components/DemoBanner.tsx`
+116a. `frontend-modern/src/components/CommercialMigrationBanner.tsx`
117. `frontend-modern/src/components/Login.tsx`
118. `frontend-modern/src/stores/sessionCapabilities.ts`
119. `frontend-modern/src/stores/sessionPresentationPolicy.ts`
@@ -311,10 +312,11 @@ rows, so the unified-resource owner must project the cluster agent identity and
cluster-scoped agent version onto those node rows before the shared stale-agent
collector can decide whether the node inventory is gated by an older agent.
Global dismissible notice bars are also part of the shared `InlineNotice`
-boundary. `frontend-modern/src/components/DemoBanner.tsx` must compose
-`InlineNotice` with the `banner` layout, the shared icon library, and the
-primitive's dismiss slot instead of carrying a local blue notice shell, raw SVG
-status icon, or page-local close button classes.
+boundary. `frontend-modern/src/components/DemoBanner.tsx` and
+`frontend-modern/src/components/CommercialMigrationBanner.tsx` must compose
+`InlineNotice` with the `banner` layout, the shared icon library, action slots,
+and the primitive's dismiss slot instead of carrying local colored notice
+shells, raw SVG status icons, or page-local action and close button classes.
Kubernetes policy inventory follows that same primitive boundary while the
unified-resource owner supplies NetworkPolicy policy type and rule-count
columns, PodDisruptionBudget budget and observed health columns, ResourceQuota
@@ -363,23 +365,24 @@ default and provide local attached-container search, status grouping, and
attention/running/other filters so large bridge or overlay networks remain
scan-friendly without hiding any container from drilldown.
-1. `frontend-modern/src/components/Settings/APIAccessPanel.tsx` shared with `security-privacy`: the API Access settings intro is both a security/privacy token-management trust surface and a canonical settings-shell presentation boundary.
+1. `frontend-modern/src/components/CommercialMigrationBanner.tsx` shared with `cloud-paid`: the global commercial migration notice is both a cloud-paid entitlement recovery surface and a shared app-shell notice primitive consumer.
+2. `frontend-modern/src/components/Settings/APIAccessPanel.tsx` shared with `security-privacy`: the API Access settings intro is both a security/privacy token-management trust surface and a canonical settings-shell presentation boundary.
The panel may own shell placement and local action layout, but
token-specific Docker / Podman copy must come from
`frontend-modern/src/utils/apiTokenPresentation.ts` rather than page-local
text.
-2. `frontend-modern/src/components/Settings/DataHandlingPanel.tsx` shared with `security-privacy`: the data-handling settings surface is both a security/privacy trust surface and a canonical settings-shell presentation boundary.
-3. `frontend-modern/src/components/Settings/dataHandlingPanelModel.ts` shared with `security-privacy`: the data-handling settings model is both a security/privacy posture projection and a canonical settings-shell presentation boundary.
-4. `frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx` shared with `security-privacy`: the general settings privacy panel is both a security/privacy control surface and a canonical settings-shell presentation boundary.
+3. `frontend-modern/src/components/Settings/DataHandlingPanel.tsx` shared with `security-privacy`: the data-handling settings surface is both a security/privacy trust surface and a canonical settings-shell presentation boundary.
+4. `frontend-modern/src/components/Settings/dataHandlingPanelModel.ts` shared with `security-privacy`: the data-handling settings model is both a security/privacy posture projection and a canonical settings-shell presentation boundary.
+5. `frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx` shared with `security-privacy`: the general settings privacy panel is both a security/privacy control surface and a canonical settings-shell presentation boundary.
The panel owns compact settings-shell framing for anonymous telemetry, but
its vocabulary must stay aligned with `security-privacy`: aggregate
self-hosted adoption counts and coarse feature flags may be named, while
hostnames, credentials, infrastructure identifiers, prompts, chat messages,
and personal information must stay explicitly excluded.
-5. `frontend-modern/src/components/Settings/SecurityAuthPanel.tsx` shared with `security-privacy`: the authentication settings surface is both a security/privacy control surface and a canonical settings-shell presentation boundary.
-6. `frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx` shared with `security-privacy`: the security overview settings surface is both a security/privacy control surface and a canonical settings-shell presentation boundary.
-7. `frontend-modern/src/routing/routePreload.ts` shared with `performance-and-scalability`: the app-shell route preload registry is both a canonical frontend shell boundary and an authenticated hot-path performance boundary.
-8. `frontend-modern/src/stores/aiChat.ts` shared with `ai-runtime`: the assistant drawer and session store is both an AI runtime control surface and a canonical app-shell presentation boundary.
+6. `frontend-modern/src/components/Settings/SecurityAuthPanel.tsx` shared with `security-privacy`: the authentication settings surface is both a security/privacy control surface and a canonical settings-shell presentation boundary.
+7. `frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx` shared with `security-privacy`: the security overview settings surface is both a security/privacy control surface and a canonical settings-shell presentation boundary.
+8. `frontend-modern/src/routing/routePreload.ts` shared with `performance-and-scalability`: the app-shell route preload registry is both a canonical frontend shell boundary and an authenticated hot-path performance boundary.
+9. `frontend-modern/src/stores/aiChat.ts` shared with `ai-runtime`: the assistant drawer and session store is both an AI runtime control surface and a canonical app-shell presentation boundary.
Assistant session pickers and reloads must restore only safe
`handoff_summary` presentation state from the session list. Loading a plain
session or starting a new conversation must clear stale scoped handoff
@@ -436,7 +439,7 @@ scan-friendly without hiding any container from drilldown.
routes and must render as named choices without secondary raw route IDs,
while external provider route IDs may remain visible where they disambiguate
catalog entries.
-9. `frontend-modern/src/utils/platformSupportManifest.generated.ts` shared with `unified-resources`: the generated platform support projection is both a canonical unified-resource platform union boundary and a shared frontend source/platform vocabulary boundary.
+10. `frontend-modern/src/utils/platformSupportManifest.generated.ts` shared with `unified-resources`: the generated platform support projection is both a canonical unified-resource platform union boundary and a shared frontend source/platform vocabulary boundary.
It must expose the manifest `surface_kind` field so runtime lenses such as
`docker` are not collapsed back into owning platform semantics.
It must also preserve canonical projection lists from the governed manifest
@@ -444,7 +447,7 @@ scan-friendly without hiding any container from drilldown.
`vm`, `network-share`, and `app-container` workloads through the same
generated platform projection used by route helpers, badges, source
filters, reportable-resource pickers, and type unions.
-10. `frontend-modern/src/utils/sourcePlatforms.ts` shared with `unified-resources`: the source platform normalizer is both a canonical unified-resource source adapter boundary and a shared frontend source/platform vocabulary boundary.
+11. `frontend-modern/src/utils/sourcePlatforms.ts` shared with `unified-resources`: the source platform normalizer is both a canonical unified-resource source adapter boundary and a shared frontend source/platform vocabulary boundary.
That shared boundary must preserve `availability` as the agentless
monitoring source for `network-endpoint` resources and settings presets,
so source badges and platform/source type resolution do not fall back to
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index 61647dd77d..24b12f1108 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -73,6 +73,14 @@
"deployment-installability"
]
},
+ {
+ "path": "frontend-modern/src/components/CommercialMigrationBanner.tsx",
+ "rationale": "the global commercial migration notice is both a cloud-paid entitlement recovery surface and a shared app-shell notice primitive consumer",
+ "subsystems": [
+ "cloud-paid",
+ "frontend-primitives"
+ ]
+ },
{
"path": "frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts",
"rationale": "the infrastructure selector pipeline is both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary",
@@ -1952,6 +1960,7 @@
"owned_files": [
"frontend-modern/src/App.tsx",
"frontend-modern/src/AppLayout.tsx",
+ "frontend-modern/src/components/CommercialMigrationBanner.tsx",
"frontend-modern/src/components/Settings/BillingAdminOrganizationsTable.tsx",
"frontend-modern/src/components/Settings/BillingAdminPanel.tsx",
"frontend-modern/src/components/Settings/CommercialBillingSections.tsx",
@@ -2502,6 +2511,19 @@
"frontend-modern/src/components/Settings/__tests__/BillingAdminPanel.test.tsx"
]
},
+ {
+ "id": "commercial-migration-banner-surface",
+ "label": "commercial migration banner surface proof",
+ "match_prefixes": [],
+ "match_files": [
+ "frontend-modern/src/components/CommercialMigrationBanner.tsx"
+ ],
+ "allow_same_subsystem_tests": false,
+ "test_prefixes": [],
+ "exact_files": [
+ "frontend-modern/src/components/__tests__/CommercialMigrationBanner.test.tsx"
+ ]
+ },
{
"id": "organization-billing-surface",
"label": "organization billing surface proof",
@@ -3101,6 +3123,7 @@
"frontend-modern/scripts/settings-diagnostics-boundary-audit.mjs",
"frontend-modern/scripts/shared-template-audit.mjs",
"frontend-modern/scripts/shared-template-registry.json",
+ "frontend-modern/src/components/CommercialMigrationBanner.tsx",
"frontend-modern/src/components/Login.tsx",
"frontend-modern/src/components/Settings/AgentIntegrationsPanel.tsx",
"frontend-modern/src/components/Settings/AIChatMaintenanceSection.tsx",
@@ -3223,6 +3246,21 @@
"frontend-modern/src/__tests__/AppLayout.test.tsx"
]
},
+ {
+ "id": "global-commercial-migration-banner",
+ "label": "global commercial migration banner primitive proof",
+ "match_prefixes": [],
+ "match_files": [
+ "frontend-modern/src/components/CommercialMigrationBanner.tsx"
+ ],
+ "allow_same_subsystem_tests": false,
+ "test_prefixes": [],
+ "exact_files": [
+ "frontend-modern/src/components/__tests__/CommercialMigrationBanner.test.tsx",
+ "frontend-modern/src/components/shared/InlineNotice.test.tsx",
+ "frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts"
+ ]
+ },
{
"id": "page-controls-and-filters",
"label": "page controls and filter proof",
diff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.json
index a1f4bb8ab9..9fd45cc1f2 100644
--- a/frontend-modern/scripts/shared-template-registry.json
+++ b/frontend-modern/scripts/shared-template-registry.json
@@ -544,6 +544,36 @@
"scripts/shared-template-audit.mjs"
]
},
+ {
+ "id": "commercial-migration-banner-notice-shell",
+ "category": "callout",
+ "summary": "Global commercial migration notices must compose InlineNotice banner layout, library icons, shared action slots, and shared dismiss chrome instead of copying local paid-state tone shells, raw SVGs, or page-local buttons.",
+ "canonical": {
+ "path": "src/components/shared/InlineNotice.tsx",
+ "export": "InlineNotice"
+ },
+ "requiredConsumers": [{ "path": "src/components/CommercialMigrationBanner.tsx" }],
+ "forbiddenPatterns": [
+ {
+ "path": "src/components/CommercialMigrationBanner.tsx",
+ "patterns": [
+ "<svg",
+ "<button",
+ "toneClasses",
+ "buttonClasses",
+ "bg-amber-50 dark:bg-amber-900 border-b border-amber-200",
+ "bg-red-50 dark:bg-red-900 border-b border-red-200",
+ "p-1 rounded transition-colors opacity-70 hover:opacity-100"
+ ]
+ }
+ ],
+ "proof": [
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "src/components/__tests__/CommercialMigrationBanner.test.tsx",
+ "src/components/shared/InlineNotice.test.tsx",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
{
"id": "status-dot-shell",
"category": "status-indicator",
diff --git a/frontend-modern/src/components/CommercialMigrationBanner.tsx b/frontend-modern/src/components/CommercialMigrationBanner.tsx
index 7567f30468..6e9bc589da 100644
--- a/frontend-modern/src/components/CommercialMigrationBanner.tsx
+++ b/frontend-modern/src/components/CommercialMigrationBanner.tsx
@@ -1,5 +1,7 @@
import { createEffect, createMemo, createSignal, onCleanup, onMount, Show } from 'solid-js';
import { useNavigate } from '@solidjs/router';
+import AlertTriangleIcon from 'lucide-solid/icons/alert-triangle';
+import { InlineNotice } from '@/components/shared/InlineNotice';
import {
commercialPosture,
commercialPostureLoaded,
@@ -63,58 +65,22 @@ export function CommercialMigrationBanner() {
sessionStorage.setItem(DISMISSED_KEY_PREFIX + state, 'true');
};
- const toneClasses = createMemo(() =>
- migration()?.state === 'failed'
- ? 'bg-red-50 dark:bg-red-900 border-b border-red-200 dark:border-red-800 text-red-800 dark:text-red-100'
- : 'bg-amber-50 dark:bg-amber-900 border-b border-amber-200 dark:border-amber-800 text-amber-800 dark:text-amber-100',
- );
- const buttonClasses = createMemo(() =>
- migration()?.state === 'failed'
- ? 'border-red-300 dark:border-red-700 hover:bg-red-100 dark:hover:bg-red-800'
- : 'border-amber-300 dark:border-amber-700 hover:bg-amber-100 dark:hover:bg-amber-800',
- );
-
return (
<Show when={!dismissed() && notice()}>
{(activeNotice) => (
- <div class={`px-3 py-2 ${toneClasses()}`}>
- <div class="container mx-auto flex items-center justify-between gap-3 text-sm">
- <div class="flex items-center gap-2 min-w-0">
- <svg class="w-4 h-4 shrink-0" fill="currentColor" viewBox="0 0 20 20">
- <path
- fill-rule="evenodd"
- d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z"
- clip-rule="evenodd"
- />
- </svg>
- <span class="truncate">
- <span class="font-medium">{activeNotice().title}.</span> {activeNotice().body}
- </span>
- </div>
- <div class="flex items-center gap-2 shrink-0">
- <button
- onClick={() => navigate(SELF_HOSTED_PRO_BILLING_PLAN_ROUTE)}
- class={`px-2 py-1 rounded border transition-colors whitespace-nowrap ${buttonClasses()}`}
- >
- Open license settings
- </button>
- <button
- onClick={handleDismiss}
- class="p-1 rounded transition-colors opacity-70 hover:opacity-100"
- title="Dismiss for this session"
- >
- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M6 18L18 6M6 6l12 12"
- />
- </svg>
- </button>
- </div>
- </div>
- </div>
+ <InlineNotice
+ role={migration()?.state === 'failed' ? 'alert' : 'status'}
+ tone={migration()?.state === 'failed' ? 'danger' : 'warning'}
+ layout="banner"
+ icon={<AlertTriangleIcon class="h-4 w-4" aria-hidden="true" />}
+ actionLabel="Open license settings"
+ actionOnClick={() => navigate(SELF_HOSTED_PRO_BILLING_PLAN_ROUTE)}
+ onDismiss={handleDismiss}
+ dismissLabel="Dismiss commercial migration notice"
+ dismissTitle="Dismiss for this session"
+ >
+ <span class="font-medium">{activeNotice().title}.</span> {activeNotice().body}
+ </InlineNotice>
)}
</Show>
);
diff --git a/frontend-modern/src/components/__tests__/CommercialMigrationBanner.test.tsx b/frontend-modern/src/components/__tests__/CommercialMigrationBanner.test.tsx
index ed1b5145ea..79ba43785a 100644
--- a/frontend-modern/src/components/__tests__/CommercialMigrationBanner.test.tsx
+++ b/frontend-modern/src/components/__tests__/CommercialMigrationBanner.test.tsx
@@ -1,6 +1,7 @@
import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-library';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { CommercialMigrationStatus } from '@/api/license';
+import commercialMigrationBannerSource from '@/components/CommercialMigrationBanner.tsx?raw';
/* ------------------------------------------------------------------ */
/* Mocks */
@@ -62,6 +63,26 @@ describe('CommercialMigrationBanner', () => {
afterEach(cleanup);
+ it('keeps commercial migration notice chrome on shared primitives', () => {
+ expect(commercialMigrationBannerSource).toContain('InlineNotice');
+ expect(commercialMigrationBannerSource).toContain('layout="banner"');
+ expect(commercialMigrationBannerSource).toContain('lucide-solid/icons/alert-triangle');
+ expect(commercialMigrationBannerSource).toContain('actionOnClick');
+ expect(commercialMigrationBannerSource).not.toContain('<svg');
+ expect(commercialMigrationBannerSource).not.toContain('<button');
+ expect(commercialMigrationBannerSource).not.toContain('toneClasses');
+ expect(commercialMigrationBannerSource).not.toContain('buttonClasses');
+ expect(commercialMigrationBannerSource).not.toContain(
+ 'bg-amber-50 dark:bg-amber-900 border-b border-amber-200',
+ );
+ expect(commercialMigrationBannerSource).not.toContain(
+ 'bg-red-50 dark:bg-red-900 border-b border-red-200',
+ );
+ expect(commercialMigrationBannerSource).not.toContain(
+ 'p-1 rounded transition-colors opacity-70 hover:opacity-100',
+ );
+ });
+
/* ---------- Visibility ---------- */
it('stays hidden when there is no migration state', async () => {
diff --git a/frontend-modern/src/components/shared/InlineNotice.test.tsx b/frontend-modern/src/components/shared/InlineNotice.test.tsx
index 2fcf5daf51..e2f9206bc6 100644
--- a/frontend-modern/src/components/shared/InlineNotice.test.tsx
+++ b/frontend-modern/src/components/shared/InlineNotice.test.tsx
@@ -55,12 +55,15 @@ describe('InlineNotice', () => {
it('owns dismissible banner notice layout and close action chrome', () => {
const onDismiss = vi.fn();
+ const onAction = vi.fn();
render(() => (
<InlineNotice
role="status"
tone="info"
layout="banner"
+ actionLabel="Open settings"
+ actionOnClick={onAction}
onDismiss={onDismiss}
dismissLabel="Dismiss demo banner"
dismissTitle="Dismiss"
@@ -72,8 +75,10 @@ describe('InlineNotice', () => {
const notice = screen.getByRole('status');
expect(notice.className).toContain('rounded-none');
expect(notice.className).toContain('border-x-0');
+ fireEvent.click(screen.getByRole('button', { name: 'Open settings' }));
fireEvent.click(screen.getByRole('button', { name: 'Dismiss demo banner' }));
+ expect(onAction).toHaveBeenCalledOnce();
expect(onDismiss).toHaveBeenCalledOnce();
});
});
diff --git a/frontend-modern/src/components/shared/InlineNotice.tsx b/frontend-modern/src/components/shared/InlineNotice.tsx
index ce845021d7..34bdd7a761 100644
--- a/frontend-modern/src/components/shared/InlineNotice.tsx
+++ b/frontend-modern/src/components/shared/InlineNotice.tsx
@@ -13,6 +13,7 @@ interface InlineNoticeProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, 'cl
actionLabel?: JSX.Element;
actionIcon?: JSX.Element;
actionAriaLabel?: string;
+ actionOnClick?: () => void;
onDismiss?: () => void;
dismissLabel?: string;
dismissTitle?: string;
@@ -67,6 +68,7 @@ export function InlineNotice(props: InlineNoticeProps) {
'actionLabel',
'actionIcon',
'actionAriaLabel',
+ 'actionOnClick',
'onDismiss',
'dismissLabel',
'dismissTitle',
@@ -88,10 +90,33 @@ export function InlineNotice(props: InlineNoticeProps) {
</Show>
<div class={INLINE_NOTICE_CONTENT_CLASS}>
<div>{local.children}</div>
- <Show when={local.actionHref}>
- {(href) => (
- <Show when={local.actionLabel}>
- {(label) => (
+ <Show when={local.actionLabel}>
+ {(label) => (
+ <Show
+ when={local.actionHref}
+ fallback={
+ <Show when={local.actionOnClick}>
+ {(onClick) => (
+ <button
+ type="button"
+ aria-label={local.actionAriaLabel}
+ class={`${INLINE_NOTICE_ACTION_BASE_CLASS} ${
+ INLINE_NOTICE_ACTION_TONE_CLASSES[local.tone]
+ }`}
+ onClick={() => onClick()()}
+ >
+ <span>{label()}</span>
+ <Show when={local.actionIcon}>
+ <span class={INLINE_NOTICE_ACTION_ICON_CLASS} aria-hidden="true">
+ {local.actionIcon}
+ </span>
+ </Show>
+ </button>
+ )}
+ </Show>
+ }
+ >
+ {(href) => (
<a
href={href()}
aria-label={local.actionAriaLabel}
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index fa4f6cf184..2d8e43c8bd 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -4,6 +4,7 @@ import { describe, expect, it } from 'vitest';
import calloutCardSource from '@/components/shared/CalloutCard.tsx?raw';
import inlineNoticeSource from '@/components/shared/InlineNotice.tsx?raw';
import demoBannerSource from '@/components/DemoBanner.tsx?raw';
+import commercialMigrationBannerSource from '@/components/CommercialMigrationBanner.tsx?raw';
import assistantCommandHelpDialogSource from '@/components/AI/Chat/AssistantCommandHelpDialog.tsx?raw';
import chatMessagesSource from '@/components/AI/Chat/ChatMessages.tsx?raw';
import aiChatSource from '@/components/AI/Chat/index.tsx?raw';
@@ -3980,6 +3981,58 @@ describe('shared primitive guardrails', () => {
);
});
+ it('routes commercial migration notices through InlineNotice banner primitives', () => {
+ const registry = JSON.parse(sharedTemplateRegistrySource) as {
+ rules?: Array<{
+ id: string;
+ canonical?: { path?: string; export?: string };
+ requiredConsumers?: Array<{ path?: string }>;
+ forbiddenPatterns?: Array<{ path?: string; patterns?: string[] }>;
+ }>;
+ };
+ const registeredRule = registry.rules?.find(
+ (rule) => rule.id === 'commercial-migration-banner-notice-shell',
+ );
+
+ expect(registeredRule?.canonical?.path).toBe('src/components/shared/InlineNotice.tsx');
+ expect(registeredRule?.canonical?.export).toBe('InlineNotice');
+ expect(registeredRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual([
+ 'src/components/CommercialMigrationBanner.tsx',
+ ]);
+ expect(registeredRule?.forbiddenPatterns).toEqual([
+ {
+ path: 'src/components/CommercialMigrationBanner.tsx',
+ patterns: [
+ '<svg',
+ '<button',
+ 'toneClasses',
+ 'buttonClasses',
+ 'bg-amber-50 dark:bg-amber-900 border-b border-amber-200',
+ 'bg-red-50 dark:bg-red-900 border-b border-red-200',
+ 'p-1 rounded transition-colors opacity-70 hover:opacity-100',
+ ],
+ },
+ ]);
+ expect(inlineNoticeSource).toContain('actionOnClick');
+ expect(commercialMigrationBannerSource).toContain('InlineNotice');
+ expect(commercialMigrationBannerSource).toContain('layout="banner"');
+ expect(commercialMigrationBannerSource).toContain('lucide-solid/icons/alert-triangle');
+ expect(commercialMigrationBannerSource).toContain('actionOnClick');
+ expect(commercialMigrationBannerSource).not.toContain('<svg');
+ expect(commercialMigrationBannerSource).not.toContain('<button');
+ expect(commercialMigrationBannerSource).not.toContain('toneClasses');
+ expect(commercialMigrationBannerSource).not.toContain('buttonClasses');
+ expect(commercialMigrationBannerSource).not.toContain(
+ 'bg-amber-50 dark:bg-amber-900 border-b border-amber-200',
+ );
+ expect(commercialMigrationBannerSource).not.toContain(
+ 'bg-red-50 dark:bg-red-900 border-b border-red-200',
+ );
+ expect(commercialMigrationBannerSource).not.toContain(
+ 'p-1 rounded transition-colors opacity-70 hover:opacity-100',
+ );
+ });
+
it('keeps TLS verification warnings in the shared primitive boundary', () => {
expect(tlsVerificationWarningBannerSource).toContain('role="alert"');
expect(tlsVerificationWarningBannerSource).toContain('TLS verification disabled.');