Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+206
@@ -0,0 +1,206 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import React from "react";
|
||||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import { MemoryRouter } from "react-router";
|
||||
import { beforeAll, describe, expect, it, vi } from "vitest";
|
||||
|
||||
globalThis.ResizeObserver =
|
||||
globalThis.ResizeObserver ??
|
||||
class ResizeObserver {
|
||||
observe() {}
|
||||
unobserve() {}
|
||||
disconnect() {}
|
||||
};
|
||||
|
||||
import {
|
||||
buildPortalAuthVM,
|
||||
buildPortalDashboardVM,
|
||||
buildPortalEmailTemplateAdminVM,
|
||||
buildPortalProjectDetailVM,
|
||||
type PortalProjectInput,
|
||||
} from "@hivegrid/view-models";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({ t: (key: string, values?: Record<string, unknown>) => (values ? `${key}:${JSON.stringify(values)}` : key) }),
|
||||
}));
|
||||
|
||||
beforeAll(installDesktopMediaQueryMock);
|
||||
|
||||
import {
|
||||
CustomerPortalAuthPage,
|
||||
CustomerPortalDashboardPage,
|
||||
CustomerPortalProjectDetailPage,
|
||||
PortalEmailTemplateEditorPage,
|
||||
} from "./CustomerPortalInterimPages";
|
||||
|
||||
const project: PortalProjectInput = {
|
||||
id: "project-1",
|
||||
projectNumber: "P-1001",
|
||||
name: "Heizung Familie Kunde",
|
||||
updatedAt: "2026-07-15T10:00:00.000Z",
|
||||
currentStageOrder: 20,
|
||||
hasActiveAccess: true,
|
||||
stages: [
|
||||
{ id: "stage-1", label: "Planung", order: 10, visible: true },
|
||||
{ id: "stage-2", label: "Montage", order: 20, visible: true },
|
||||
],
|
||||
documents: [
|
||||
{
|
||||
id: "document-1",
|
||||
name: "Freigegeben.pdf",
|
||||
mimeType: "application/pdf",
|
||||
releasedAt: "2026-07-15T09:00:00.000Z",
|
||||
revokedAt: null,
|
||||
downloadHref: "/acme/documents/document-1",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const navigationActions = {
|
||||
onDashboard: vi.fn(),
|
||||
onProjects: vi.fn(),
|
||||
onLogout: vi.fn(),
|
||||
};
|
||||
|
||||
const legalLinks = {
|
||||
imprintUrl: "https://acme.example.test/imprint",
|
||||
privacyUrl: "https://acme.example.test/privacy",
|
||||
termsUrl: null,
|
||||
} as const;
|
||||
|
||||
describe("VA-P26a interim portal screens", () => {
|
||||
it("submits magic-link login as the primary flow", () => {
|
||||
const onSubmit = vi.fn();
|
||||
render(
|
||||
<CustomerPortalAuthPage
|
||||
vm={buildPortalAuthVM({
|
||||
tenantSlug: "acme",
|
||||
tenantName: "Acme",
|
||||
portalName: "Acme Portal",
|
||||
legalLinks,
|
||||
mode: "login",
|
||||
allowPassword: true,
|
||||
captchaRequired: false,
|
||||
loginHref: "/acme/login",
|
||||
passwordHref: "/acme/forgot-password",
|
||||
})}
|
||||
actions={{ onSubmit, onBackToLogin: vi.fn(), onForgotPassword: vi.fn() }}
|
||||
/>
|
||||
);
|
||||
fireEvent.change(screen.getByLabelText("customerPortal.auth.fields.email"), { target: { value: "kunde@example.com" } });
|
||||
fireEvent.click(screen.getByText("customerPortal.auth.login.sendMagicLink"));
|
||||
expect(onSubmit).toHaveBeenCalledWith({ intent: "magic_link", email: "kunde@example.com" });
|
||||
expect(screen.getByText("customerPortal.auth.login.withPassword")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("allows first-time setup to skip optional password fields and activate magic-link-only access", () => {
|
||||
const onSubmit = vi.fn();
|
||||
render(
|
||||
<CustomerPortalAuthPage
|
||||
vm={buildPortalAuthVM({
|
||||
tenantSlug: "acme",
|
||||
tenantName: "Acme",
|
||||
portalName: "Acme Portal",
|
||||
legalLinks,
|
||||
mode: "setup",
|
||||
allowPassword: false,
|
||||
captchaRequired: false,
|
||||
loginHref: "/acme/login",
|
||||
})}
|
||||
actions={{ onSubmit, onBackToLogin: vi.fn(), onForgotPassword: vi.fn() }}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByLabelText("customerPortal.auth.fields.password")).toBeRequired();
|
||||
expect(screen.getByLabelText("customerPortal.auth.fields.passwordConfirmation")).toBeRequired();
|
||||
const privacyCheckbox = screen.getByRole("checkbox", { name: "customerPortal.auth.setup.privacyAcknowledgement" });
|
||||
const setupButton = screen.getByRole("button", { name: "customerPortal.auth.setup.submit" });
|
||||
expect(privacyCheckbox).not.toBeChecked();
|
||||
expect(setupButton).toBeDisabled();
|
||||
expect(screen.getByRole("link", { name: "customerPortal.auth.setup.privacyLink" })).toHaveAttribute("href", legalLinks.privacyUrl);
|
||||
fireEvent.click(screen.getByText("customerPortal.auth.setup.useMagicLinkOnly"));
|
||||
expect(screen.queryByLabelText("customerPortal.auth.fields.password")).not.toBeInTheDocument();
|
||||
expect(screen.queryByLabelText("customerPortal.auth.fields.passwordConfirmation")).not.toBeInTheDocument();
|
||||
expect(screen.getByText("customerPortal.auth.setup.magicLinkOnlyDescription")).toBeInTheDocument();
|
||||
|
||||
fireEvent.click(privacyCheckbox);
|
||||
expect(setupButton).toBeEnabled();
|
||||
fireEvent.click(setupButton);
|
||||
expect(onSubmit).toHaveBeenCalledWith({
|
||||
intent: "setup",
|
||||
privacyNoticeAcknowledged: true,
|
||||
privacyNoticeUrl: legalLinks.privacyUrl,
|
||||
});
|
||||
});
|
||||
|
||||
it("renders only the already-filtered project and released-document VM", () => {
|
||||
const vm = buildPortalDashboardVM({
|
||||
portalName: "Acme Portal",
|
||||
viewerLabel: "Karla Kunde",
|
||||
frozen: false,
|
||||
projects: [project],
|
||||
projectsHref: "/acme/projects",
|
||||
logoutAction: "/acme/logout",
|
||||
buildProjectHref: (id) => `/acme/projects/${id}`,
|
||||
});
|
||||
render(
|
||||
<MemoryRouter initialEntries={["/acme/dashboard"]}>
|
||||
<CustomerPortalDashboardPage vm={vm} actions={{ ...navigationActions, onOpenProject: vi.fn(), onDownloadDocument: vi.fn() }} />
|
||||
</MemoryRouter>
|
||||
);
|
||||
expect(screen.getByText("Heizung Familie Kunde")).toBeInTheDocument();
|
||||
expect(screen.getByText("Freigegeben.pdf")).toBeInTheDocument();
|
||||
expect(screen.getByRole("progressbar", { name: "customerPortal.projects.progress" })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("uses the same generic not-found state for missing project detail", () => {
|
||||
render(
|
||||
<MemoryRouter initialEntries={["/acme/projects/missing"]}>
|
||||
<CustomerPortalProjectDetailPage
|
||||
vm={buildPortalProjectDetailVM({ frozen: false, project: null, projectsHref: "/acme/projects" })}
|
||||
portalName="Acme Portal"
|
||||
viewerLabel="Karla Kunde"
|
||||
actions={{ ...navigationActions, onBack: vi.fn(), onDownloadDocument: vi.fn() }}
|
||||
/>
|
||||
</MemoryRouter>
|
||||
);
|
||||
expect(screen.getByText("customerPortal.states.notFound.title")).toBeInTheDocument();
|
||||
expect(screen.queryByText(/forbidden|permission|project-1/i)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders frozen mail templates read-only", () => {
|
||||
const onSave = vi.fn();
|
||||
render(
|
||||
<PortalEmailTemplateEditorPage
|
||||
vm={buildPortalEmailTemplateAdminVM({
|
||||
canManage: true,
|
||||
frozen: true,
|
||||
stages: [{ id: "stage-1", label: "Montage", visible: true }],
|
||||
templates: [{ id: "template-1", stageId: "stage-1", subject: "Update", body: "Hallo", active: true }],
|
||||
})}
|
||||
actions={{ onSave, onRetry: vi.fn() }}
|
||||
/>
|
||||
);
|
||||
expect(screen.getByDisplayValue("Update")).toBeDisabled();
|
||||
expect(screen.getByText("customerPortal.emailTemplates.save").closest("button")).toBeDisabled();
|
||||
expect(onSave).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
function installDesktopMediaQueryMock(): void {
|
||||
Object.defineProperty(window, "matchMedia", {
|
||||
configurable: true,
|
||||
value: vi.fn((query: string) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addEventListener: vi.fn(),
|
||||
removeEventListener: vi.fn(),
|
||||
addListener: vi.fn(),
|
||||
removeListener: vi.fn(),
|
||||
dispatchEvent: vi.fn(),
|
||||
})),
|
||||
});
|
||||
}
|
||||
+2474
File diff suppressed because it is too large.
Load diff
+139
@@ -0,0 +1,139 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import React from "react";
|
||||
import { render } from "@testing-library/react";
|
||||
import { MemoryRouter } from "react-router";
|
||||
import { beforeAll, describe, expect, it, vi } from "vitest";
|
||||
|
||||
globalThis.ResizeObserver =
|
||||
globalThis.ResizeObserver ??
|
||||
class ResizeObserver {
|
||||
observe() {}
|
||||
unobserve() {}
|
||||
disconnect() {}
|
||||
};
|
||||
|
||||
import { buildPortalAuthVM, buildPortalDashboardVM } from "@hivegrid/view-models";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({
|
||||
t: (key: string, values?: Record<string, unknown>) => (values ? `${key}:${Object.values(values).join("/")}` : key),
|
||||
}),
|
||||
}));
|
||||
|
||||
beforeAll(installDesktopMediaQueryMock);
|
||||
|
||||
import { CustomerPortalAuthPage, CustomerPortalDashboardPage } from "./CustomerPortalInterimPages";
|
||||
|
||||
describe("VA-P26a customer portal interim visual baseline", () => {
|
||||
it("renders first-access setup with the required canonical privacy acknowledgement", () => {
|
||||
const vm = buildPortalAuthVM({
|
||||
tenantSlug: "acme",
|
||||
tenantName: "Acme GmbH",
|
||||
portalName: "Acme Kundenportal",
|
||||
legalLinks: {
|
||||
imprintUrl: "https://acme.example.test/impressum",
|
||||
privacyUrl: "https://acme.example.test/datenschutz",
|
||||
termsUrl: null,
|
||||
},
|
||||
mode: "setup",
|
||||
allowPassword: false,
|
||||
captchaRequired: true,
|
||||
loginHref: "/acme/login",
|
||||
passwordHref: "/acme/forgot-password",
|
||||
supportEmail: "support@example.test",
|
||||
});
|
||||
const { container } = render(
|
||||
<main data-ui-id="ui.customerPortal.setup.interim.visualBaseline">
|
||||
<CustomerPortalAuthPage
|
||||
vm={vm}
|
||||
captcha={<div data-ui-id="ui.customerPortal.setup.captcha" />}
|
||||
actions={{ onSubmit: vi.fn(), onBackToLogin: vi.fn(), onForgotPassword: vi.fn() }}
|
||||
/>
|
||||
</main>
|
||||
);
|
||||
|
||||
expect(container.querySelector('[data-ui-id="ui.customerPortal.auth.setup.privacyAcknowledgement"]')).not.toBeNull();
|
||||
expect(container.querySelector('[data-ui-id="ui.customerPortal.auth.setup.privacyLink"]')).toHaveAttribute("href", "https://acme.example.test/datenschutz");
|
||||
|
||||
const stableMarkup = container.innerHTML.replace(/<svg\b[^>]*>[\s\S]*?<\/svg>/gu, '<svg data-visual-icon="true"></svg>');
|
||||
expect(stableMarkup).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders the access-scoped dashboard and released document from ~/ui", () => {
|
||||
const vm = buildPortalDashboardVM({
|
||||
portalName: "Acme Kundenportal",
|
||||
viewerLabel: "Karla Kunde",
|
||||
frozen: false,
|
||||
projectsHref: "/acme/projects",
|
||||
logoutAction: "/acme/logout",
|
||||
buildProjectHref: (projectId) => `/acme/projects/${projectId}`,
|
||||
locale: "de-DE",
|
||||
projects: [
|
||||
{
|
||||
id: "project-1",
|
||||
projectNumber: "P-1001",
|
||||
name: "Heizung Familie Kunde",
|
||||
updatedAt: "2026-07-15T10:00:00.000Z",
|
||||
currentStageOrder: 20,
|
||||
hasActiveAccess: true,
|
||||
stages: [
|
||||
{ id: "stage-1", label: "Planung", order: 10, visible: true },
|
||||
{ id: "stage-2", label: "Montage", order: 20, visible: true },
|
||||
{ id: "stage-3", label: "Abnahme", order: 30, visible: true },
|
||||
],
|
||||
documents: [
|
||||
{
|
||||
id: "release-1",
|
||||
name: "Montagefreigabe.pdf",
|
||||
mimeType: "application/pdf",
|
||||
releasedAt: "2026-07-15T09:00:00.000Z",
|
||||
revokedAt: null,
|
||||
downloadHref: "/acme/documents/release-1",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
const { container } = render(
|
||||
<main data-ui-id="ui.customerPortal.interim.visualBaseline">
|
||||
<MemoryRouter initialEntries={["/acme/dashboard"]}>
|
||||
<CustomerPortalDashboardPage
|
||||
vm={vm}
|
||||
actions={{
|
||||
onDashboard: vi.fn(),
|
||||
onProjects: vi.fn(),
|
||||
onOpenProject: vi.fn(),
|
||||
onDownloadDocument: vi.fn(),
|
||||
onLogout: vi.fn(),
|
||||
}}
|
||||
/>
|
||||
</MemoryRouter>
|
||||
</main>
|
||||
);
|
||||
|
||||
expect(container.querySelectorAll('[data-ui-id="ui.customerPortal.portalShell"]')).toHaveLength(1);
|
||||
expect(container.querySelectorAll('[data-ui-id="ui.customerPortal.projectCard"]')).toHaveLength(1);
|
||||
expect(container).toHaveTextContent("Montagefreigabe.pdf");
|
||||
|
||||
const stableMarkup = container.innerHTML.replace(/<svg\b[^>]*>[\s\S]*?<\/svg>/gu, '<svg data-visual-icon="true"></svg>');
|
||||
expect(stableMarkup).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
function installDesktopMediaQueryMock(): void {
|
||||
Object.defineProperty(window, "matchMedia", {
|
||||
configurable: true,
|
||||
value: vi.fn((query: string) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addEventListener: vi.fn(),
|
||||
removeEventListener: vi.fn(),
|
||||
addListener: vi.fn(),
|
||||
removeListener: vi.fn(),
|
||||
dispatchEvent: vi.fn(),
|
||||
})),
|
||||
});
|
||||
}
|
||||
+245
@@ -0,0 +1,245 @@
|
||||
import { useEffect, useState, type ReactNode } from "react";
|
||||
import { FeatherFolder, FeatherHome, FeatherLogOut, FeatherMenu, FeatherPaperclip, FeatherSave } from "@subframe/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Alert } from "~/ui/components/Alert";
|
||||
import { Avatar } from "~/ui/components/Avatar";
|
||||
import { Breadcrumbs } from "~/ui/components/Breadcrumbs";
|
||||
import { IconButton } from "~/ui/components/IconButton";
|
||||
import { SidebarWithSections } from "~/ui/components/SidebarWithSections";
|
||||
import { PAGE_HEADER_ICON_CLASS, PageBody, PageHeader, PageShell } from "../shared/PageShell";
|
||||
|
||||
export type PortalNavigationArea = "dashboard" | "projects" | "upload" | "settings";
|
||||
|
||||
export type CustomerPortalNavigationActions = {
|
||||
readonly onDashboard: () => void;
|
||||
readonly onProjects: () => void;
|
||||
readonly onUpload?: () => void;
|
||||
readonly onSettings?: () => void;
|
||||
readonly onLogout: () => void | Promise<void>;
|
||||
};
|
||||
|
||||
export function PortalBrandLogo({
|
||||
portalName,
|
||||
brandingLogoHref,
|
||||
compact = false,
|
||||
iconOnly = false,
|
||||
}: {
|
||||
readonly portalName: string;
|
||||
readonly brandingLogoHref?: string | null;
|
||||
readonly compact?: boolean;
|
||||
readonly iconOnly?: boolean;
|
||||
}): React.JSX.Element {
|
||||
const { t } = useTranslation();
|
||||
const [logoFailed, setLogoFailed] = useState(false);
|
||||
|
||||
useEffect(() => setLogoFailed(false), [brandingLogoHref]);
|
||||
|
||||
if (brandingLogoHref && !logoFailed) {
|
||||
return (
|
||||
<img
|
||||
src={brandingLogoHref}
|
||||
alt={t("customerPortal.navigation.logoAlt", { name: portalName })}
|
||||
className={
|
||||
iconOnly ? "h-8 w-8 object-contain" : compact ? "h-6 max-w-[133px] object-contain object-left" : "h-8 max-w-[177px] object-contain object-left"
|
||||
}
|
||||
onError={() => setLogoFailed(true)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
// No tenant logo: fall back to the portal's own name, never to the HiveGrid
|
||||
// wordmark. This surface belongs to the tenant's brand towards their end
|
||||
// customers — showing our logo there advertises the wrong company.
|
||||
const trimmedName = portalName.trim();
|
||||
if (iconOnly) {
|
||||
return (
|
||||
<span
|
||||
aria-label={trimmedName}
|
||||
className="bg-surface-neutral-secondary text-text-neutral-primary text-body-default-medium-0 font-body-default-medium-0 flex h-8 w-8 flex-none items-center justify-center rounded-md"
|
||||
>
|
||||
{trimmedName.slice(0, 2).toUpperCase()}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<span
|
||||
className={`text-text-neutral-primary truncate ${
|
||||
compact ? "text-body-default-medium-0 font-body-default-medium-0 max-w-[133px]" : "text-subtitle font-subtitle max-w-[177px]"
|
||||
}`}
|
||||
>
|
||||
{trimmedName}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export function CustomerPortalShell({
|
||||
title,
|
||||
subtitle,
|
||||
portalName,
|
||||
viewerLabel,
|
||||
brandingLogoHref,
|
||||
frozen,
|
||||
activeArea,
|
||||
actions,
|
||||
children,
|
||||
}: {
|
||||
readonly title: string;
|
||||
readonly subtitle: string;
|
||||
readonly portalName: string;
|
||||
readonly viewerLabel: string;
|
||||
readonly brandingLogoHref?: string | null;
|
||||
readonly frozen: boolean;
|
||||
readonly activeArea: PortalNavigationArea;
|
||||
readonly actions: CustomerPortalNavigationActions;
|
||||
readonly children: ReactNode;
|
||||
}): React.JSX.Element {
|
||||
const { t } = useTranslation();
|
||||
const initials = viewerInitials(viewerLabel);
|
||||
const [collapsed, setCollapsed] = useState(false);
|
||||
const [mobileOpen, setMobileOpen] = useState(false);
|
||||
|
||||
const navigation = [
|
||||
{
|
||||
area: "dashboard" as const,
|
||||
label: t("customerPortal.navigation.dashboard"),
|
||||
icon: <FeatherHome />,
|
||||
onClick: actions.onDashboard,
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
area: "projects" as const,
|
||||
label: t("customerPortal.navigation.projects"),
|
||||
icon: <FeatherFolder />,
|
||||
onClick: actions.onProjects,
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
area: "settings" as const,
|
||||
label: t("customerPortal.navigation.settings"),
|
||||
icon: <FeatherSave />,
|
||||
onClick: actions.onSettings,
|
||||
visible: Boolean(actions.onSettings),
|
||||
},
|
||||
].filter((item) => item.visible);
|
||||
|
||||
const pageIcon =
|
||||
activeArea === "dashboard" ? (
|
||||
<FeatherHome />
|
||||
) : activeArea === "projects" ? (
|
||||
<FeatherFolder />
|
||||
) : activeArea === "upload" ? (
|
||||
<FeatherPaperclip />
|
||||
) : (
|
||||
<FeatherSave />
|
||||
);
|
||||
|
||||
function runNavigation(action: (() => void) | undefined): void {
|
||||
action?.();
|
||||
setMobileOpen(false);
|
||||
}
|
||||
|
||||
function renderNavigationItem(item: (typeof navigation)[number]): React.JSX.Element {
|
||||
const selected = item.area === activeArea || (activeArea === "upload" && item.area === "projects");
|
||||
return (
|
||||
<button
|
||||
key={item.area}
|
||||
type="button"
|
||||
className="w-full border-0 bg-transparent p-0 text-left"
|
||||
aria-current={selected ? "page" : undefined}
|
||||
onClick={() => runNavigation(item.onClick)}
|
||||
>
|
||||
<SidebarWithSections.NavItem icon={item.icon} selected={selected} variant={collapsed ? "icon-only" : "icon-and-text"}>
|
||||
{item.label}
|
||||
</SidebarWithSections.NavItem>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
const primaryNavigation = navigation.filter((item) => item.area !== "settings");
|
||||
const settingsNavigation = navigation.filter((item) => item.area === "settings");
|
||||
|
||||
return (
|
||||
<div className="bg-surface-neutral-primary flex h-screen w-full items-stretch overflow-hidden" data-ui-id="ui.customerPortal.portalShell">
|
||||
{mobileOpen ? <div className="bg-surface-neutral-overlay fixed inset-0 z-40 md:hidden" onClick={() => setMobileOpen(false)} aria-hidden /> : null}
|
||||
|
||||
<SidebarWithSections
|
||||
variant={collapsed ? "closed" : "open"}
|
||||
onToggleCollapse={() => setCollapsed((current) => !current)}
|
||||
toggleLabel={t("components.sidebar.toggle")}
|
||||
logoContent={<PortalBrandLogo portalName={portalName} brandingLogoHref={brandingLogoHref} iconOnly={collapsed} />}
|
||||
logoLabel={t("customerPortal.navigation.home")}
|
||||
onLogoClick={() => runNavigation(actions.onDashboard)}
|
||||
aria-label={t("customerPortal.navigation.portal")}
|
||||
className={`z-50 max-md:fixed max-md:inset-y-0 max-md:left-0 max-md:transition-transform ${mobileOpen ? "max-md:translate-x-0" : "max-md:-translate-x-full"}`}
|
||||
data-ui-id="ui.customerPortal.sidebar"
|
||||
>
|
||||
<div className="flex min-h-full w-full flex-1 flex-col gap-1">
|
||||
<SidebarWithSections.NavSection showLabel={false}>{primaryNavigation.map(renderNavigationItem)}</SidebarWithSections.NavSection>
|
||||
{settingsNavigation.length > 0 ? (
|
||||
<SidebarWithSections.NavSection
|
||||
showLabel={false}
|
||||
className="border-border-default mt-auto border-t border-solid pt-2"
|
||||
data-ui-id="ui.customerPortal.sidebar.settings"
|
||||
>
|
||||
{settingsNavigation.map(renderNavigationItem)}
|
||||
</SidebarWithSections.NavSection>
|
||||
) : null}
|
||||
</div>
|
||||
</SidebarWithSections>
|
||||
|
||||
<div className="flex h-full min-h-0 min-w-0 grow flex-col overflow-hidden" data-ui-id="ui.customerPortal.sidebarInset">
|
||||
<header className="border-border-default bg-surface-neutral-secondary mobile:px-4 flex h-14 w-full shrink-0 items-center justify-between gap-2 border-b border-solid py-3 pr-3 pl-6">
|
||||
<div className="flex min-w-0 items-center gap-3" data-ui-id="ui.customerPortal.breadcrumb">
|
||||
<button
|
||||
type="button"
|
||||
className="text-icon-neutral-secondary hover:bg-surface-neutral-tertiary inline-flex h-8 w-8 items-center justify-center rounded-md border-0 bg-transparent md:hidden"
|
||||
onClick={() => setMobileOpen((current) => !current)}
|
||||
aria-label={t("shared.menu")}
|
||||
data-ui-id="ui.customerPortal.sidebarTrigger"
|
||||
>
|
||||
<FeatherMenu />
|
||||
</button>
|
||||
<Breadcrumbs>
|
||||
<Breadcrumbs.Item className="text-text-neutral-secondary">{portalName}</Breadcrumbs.Item>
|
||||
<Breadcrumbs.Divider />
|
||||
<Breadcrumbs.Item active>{title}</Breadcrumbs.Item>
|
||||
</Breadcrumbs>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 self-stretch pl-1">
|
||||
<IconButton
|
||||
variant="ghost"
|
||||
size="small"
|
||||
icon={<FeatherLogOut />}
|
||||
aria-label={t("customerPortal.navigation.logout")}
|
||||
onClick={() => void actions.onLogout()}
|
||||
/>
|
||||
<Avatar size="small" border aria-label={viewerLabel}>
|
||||
{initials}
|
||||
</Avatar>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main id="main-content" className="min-h-0 flex-1 overflow-auto overscroll-y-contain [scrollbar-gutter:stable] focus:outline-hidden" tabIndex={-1}>
|
||||
<PageShell uiId="ui.customerPortal.page">
|
||||
<PageHeader icon={<span className={PAGE_HEADER_ICON_CLASS}>{pageIcon}</span>} title={title} subtitle={subtitle} subtitleTone="secondary" />
|
||||
<PageBody>
|
||||
{frozen ? <Alert variant="warning" title={t("customerPortal.states.frozen.title")} description={t("customerPortal.states.frozen.body")} /> : null}
|
||||
{children}
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function viewerInitials(viewerLabel: string): string {
|
||||
const initials = viewerLabel
|
||||
.trim()
|
||||
.split(/\s+/u)
|
||||
.slice(0, 2)
|
||||
.map((part) => part.at(0)?.toLocaleUpperCase())
|
||||
.join("");
|
||||
return initials || "K";
|
||||
}
|
||||
+439
@@ -0,0 +1,439 @@
|
||||
import { useRef, useState, type FormEvent } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import type { PortalDomainAdminActions, PortalDomainAdminVM, PortalDomainStatusVM } from "@hivegrid/view-models";
|
||||
|
||||
import { useLocaleFormatters } from "~/locale/format";
|
||||
import { Alert } from "~/ui/components/Alert";
|
||||
import { BadgeFeedback } from "~/ui/components/BadgeFeedback";
|
||||
import { Button } from "~/ui/components/Button";
|
||||
import { Card } from "~/ui/components/Card";
|
||||
import { Dialog } from "~/ui/components/Dialog";
|
||||
import { EmptyState } from "~/ui/components/EmptyState";
|
||||
import { LoadingIndicatorSkeleton } from "~/ui/components/LoadingIndicatorSkeleton";
|
||||
import { Progress } from "~/ui/components/Progress";
|
||||
import { TextInput } from "~/ui/components/TextInput";
|
||||
import { useCopyToast } from "~/hooks/use-copy-toast";
|
||||
|
||||
import { PageBody, PageHeader, PageIntro, PageShell } from "../shared/PageShell";
|
||||
|
||||
type Confirmation = "cancel-portal" | "remove" | null;
|
||||
|
||||
export function PortalDomainAdminInterimPage({
|
||||
vm,
|
||||
actions,
|
||||
busy = false,
|
||||
messageKey = null,
|
||||
errorKey = null,
|
||||
embedded = false,
|
||||
}: {
|
||||
readonly vm: PortalDomainAdminVM;
|
||||
readonly actions: PortalDomainAdminActions;
|
||||
/** Inside the Kundenportal hub (AK-SET-01) the hub owns the header — see PageIntro. */
|
||||
readonly embedded?: boolean;
|
||||
readonly busy?: boolean;
|
||||
readonly messageKey?: string | null;
|
||||
readonly errorKey?: string | null;
|
||||
}): React.JSX.Element {
|
||||
const { t } = useTranslation();
|
||||
const formatters = useLocaleFormatters();
|
||||
const [claimHostname, setClaimHostname] = useState("");
|
||||
const [switchHostname, setSwitchHostname] = useState("");
|
||||
const [confirmation, setConfirmation] = useState<Confirmation>(null);
|
||||
const confirmationTriggerRef = useRef<HTMLElement | null>(null);
|
||||
const copyText = useCopyToast();
|
||||
|
||||
if (vm.status === "loading" || vm.status === "idle") {
|
||||
return (
|
||||
<PageShell uiId="ui.customerPortal.domainAdmin">
|
||||
{embedded ? null : <PageHeader title={t("customerPortal.domain.title")} subtitle={t("customerPortal.domain.subtitle")} subtitleTone="secondary" />}
|
||||
<PageBody>
|
||||
{embedded ? <PageIntro uiId="ui.customerPortal.domainAdmin.intro">{t("customerPortal.domain.subtitle")}</PageIntro> : null}
|
||||
<Alert variant="neutral" title={t("customerPortal.domain.states.loading.title")} description={t("customerPortal.domain.states.loading.body")} />
|
||||
<LoadingIndicatorSkeleton />
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
|
||||
if (vm.status === "error") {
|
||||
return (
|
||||
<PageShell uiId="ui.customerPortal.domainAdmin">
|
||||
{embedded ? null : <PageHeader title={t("customerPortal.domain.title")} subtitle={t("customerPortal.domain.subtitle")} subtitleTone="secondary" />}
|
||||
<PageBody>
|
||||
{embedded ? <PageIntro uiId="ui.customerPortal.domainAdmin.intro">{t("customerPortal.domain.subtitle")}</PageIntro> : null}
|
||||
<Alert variant="error" title={t("customerPortal.domain.states.error.title")} description={t(vm.error.messageKey)} />
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
|
||||
if (vm.status === "empty") {
|
||||
return (
|
||||
<PageShell uiId="ui.customerPortal.domainAdmin">
|
||||
{embedded ? null : <PageHeader title={t("customerPortal.domain.title")} subtitle={t("customerPortal.domain.subtitle")} subtitleTone="secondary" />}
|
||||
<PageBody>
|
||||
{embedded ? <PageIntro uiId="ui.customerPortal.domainAdmin.intro">{t("customerPortal.domain.subtitle")}</PageIntro> : null}
|
||||
<EmptyState outlined title={t("customerPortal.domain.states.empty.title")} body={t("customerPortal.domain.states.empty.body")} />
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
|
||||
const data = vm.data;
|
||||
const domain = data.domain;
|
||||
const pending = data.pendingSwitch;
|
||||
const disabled = busy || data.readOnly;
|
||||
const status = pending?.status ?? domain?.status ?? null;
|
||||
const monthlyAddOnPrice = `${formatters.currencyFromCents(data.monthlyAddOn.amountCents, data.monthlyAddOn.currency)} ${t(
|
||||
"billing:selfServiceSubscription.price.netSuffix",
|
||||
)} / ${t("billing:selfServiceSubscription.period.monthly")}`;
|
||||
const domainSetupPrice = `${formatters.currencyFromCents(data.domainSetup.amountCents, data.domainSetup.currency)} ${t(
|
||||
"billing:selfServiceSubscription.price.netSuffix",
|
||||
)} · ${t("billing:selfServiceSubscription.period.once")}`;
|
||||
|
||||
async function copy(value: string, successKey: string): Promise<void> {
|
||||
await copyText(value, { successKey });
|
||||
}
|
||||
|
||||
function submitHostname(event: FormEvent<HTMLFormElement>, mode: "claim" | "switch"): void {
|
||||
event.preventDefault();
|
||||
const value = mode === "claim" ? claimHostname : switchHostname;
|
||||
if (!value.trim()) return;
|
||||
void (mode === "claim" ? actions.onClaimDomain(value.trim()) : actions.onSwitch(value.trim()));
|
||||
}
|
||||
|
||||
function openConfirmation(nextConfirmation: Exclude<Confirmation, null>): void {
|
||||
confirmationTriggerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
||||
setConfirmation(nextConfirmation);
|
||||
}
|
||||
|
||||
function closeConfirmation(): void {
|
||||
setConfirmation(null);
|
||||
globalThis.setTimeout(() => confirmationTriggerRef.current?.focus(), 0);
|
||||
}
|
||||
|
||||
const statusBadge = status ? (
|
||||
<BadgeFeedback farbe={statusTone(status)}>{t(`customerPortal.domain.status.${status}`)}</BadgeFeedback>
|
||||
) : (
|
||||
<BadgeFeedback farbe="subtle-neutral">{t("customerPortal.domain.standardHost")}</BadgeFeedback>
|
||||
);
|
||||
|
||||
return (
|
||||
<PageShell uiId="ui.customerPortal.domainAdmin">
|
||||
{embedded ? null : (
|
||||
<PageHeader
|
||||
title={t("customerPortal.domain.title")}
|
||||
subtitle={t("customerPortal.domain.subtitle")}
|
||||
subtitleTone="secondary"
|
||||
actions={statusBadge}
|
||||
/>
|
||||
)}
|
||||
<PageBody>
|
||||
{embedded ? <PageIntro uiId="ui.customerPortal.domainAdmin.intro">{t("customerPortal.domain.subtitle")}</PageIntro> : null}
|
||||
{embedded ? statusBadge : null}
|
||||
{data.readOnly ? (
|
||||
<Alert variant="warning" title={t("customerPortal.domain.states.readOnly.title")} description={t("customerPortal.domain.states.readOnly.body")} />
|
||||
) : null}
|
||||
{messageKey ? <Alert variant="success" title={t("customerPortal.domain.messages.successTitle")} description={t(messageKey)} /> : null}
|
||||
{errorKey ? <Alert variant="error" title={t("customerPortal.domain.errors.title")} description={t(errorKey)} /> : null}
|
||||
|
||||
<Card variant={data.portalEntitled ? "positive" : "warning"}>
|
||||
<h2>{t("customerPortal.domain.entitlement.title")}</h2>
|
||||
<BadgeFeedback farbe={data.portalEntitled ? "subtle-positive" : "subtle-warning"}>
|
||||
{t(data.portalEntitled ? "customerPortal.domain.entitlement.active" : "customerPortal.domain.entitlement.missing")}
|
||||
</BadgeFeedback>
|
||||
<p>{t(`customerPortal.domain.entitlement.source.${data.portalEntitlementSource}`)}</p>
|
||||
{data.monthlyAddOn.required ? <p>{monthlyAddOnPrice}</p> : null}
|
||||
{!data.portalEntitled && data.actions.canBuyPortal ? (
|
||||
<Button loading={busy} disabled={disabled} onClick={() => void actions.onBuyPortal()}>
|
||||
{t("customerPortal.domain.actions.buyPortal")}
|
||||
</Button>
|
||||
) : null}
|
||||
{data.actions.canCancelPortal ? (
|
||||
<Button variant="destructive" loading={busy} disabled={disabled} onClick={() => openConfirmation("cancel-portal")}>
|
||||
{t("customerPortal.domain.actions.cancelPortal")}
|
||||
</Button>
|
||||
) : null}
|
||||
</Card>
|
||||
|
||||
<Card variant="neutral">
|
||||
<h2>{t("customerPortal.domain.fallback.title")}</h2>
|
||||
<p>{t("customerPortal.domain.fallback.description")}</p>
|
||||
<TextInput showLabel label={t("customerPortal.domain.fallback.urlLabel")} fillContainer>
|
||||
<TextInput.Input value={data.standardPortalUrl} readOnly />
|
||||
</TextInput>
|
||||
<Button variant="tertiary" onClick={() => void copy(data.standardPortalUrl, "customerPortal.domain.copyToast.portalLink") }>
|
||||
{t("customerPortal.domain.actions.copy")}
|
||||
</Button>
|
||||
</Card>
|
||||
|
||||
{!domain && !pending ? (
|
||||
<Card>
|
||||
<h2>{t("customerPortal.domain.claim.title")}</h2>
|
||||
<p>{t("customerPortal.domain.claim.description")}</p>
|
||||
{!data.portalEntitled ? (
|
||||
<Alert
|
||||
variant="warning"
|
||||
title={t("customerPortal.domain.claim.entitlementRequiredTitle")}
|
||||
description={t("customerPortal.domain.claim.entitlementRequiredBody")}
|
||||
/>
|
||||
) : null}
|
||||
<form onSubmit={(event) => submitHostname(event, "claim")}>
|
||||
<TextInput showLabel label={t("customerPortal.domain.hostname")} fillContainer disabled={disabled || !data.actions.canClaimDomain}>
|
||||
<TextInput.Input
|
||||
name="hostname"
|
||||
type="text"
|
||||
inputMode="url"
|
||||
autoComplete="url"
|
||||
required
|
||||
value={claimHostname}
|
||||
placeholder={t("customerPortal.domain.hostnamePlaceholder")}
|
||||
onChange={(event) => setClaimHostname(event.target.value)}
|
||||
/>
|
||||
</TextInput>
|
||||
<Button type="submit" loading={busy} disabled={disabled || !data.actions.canClaimDomain || !claimHostname.trim()}>
|
||||
{t("customerPortal.domain.actions.claim")}
|
||||
</Button>
|
||||
</form>
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
{domain ? (
|
||||
<Card variant={domain.status === "active" ? "positive" : domain.status === "failed" ? "negative" : "information"}>
|
||||
<h2>{t("customerPortal.domain.current.title")}</h2>
|
||||
<p>{domain.hostname}</p>
|
||||
<BadgeFeedback farbe={statusTone(domain.status)}>{t(`customerPortal.domain.status.${domain.status}`)}</BadgeFeedback>
|
||||
<Progress
|
||||
value={statusProgress(domain.status)}
|
||||
state={domain.status === "active" ? "success" : domain.status === "failed" ? "error" : "uploading"}
|
||||
label={t("customerPortal.domain.progress.label")}
|
||||
statusText={t(`customerPortal.domain.status.${domain.status}`)}
|
||||
/>
|
||||
{domain.customPortalUrl ? <p>{domain.customPortalUrl}</p> : null}
|
||||
{domain.failureMessageKey ? (
|
||||
<Alert variant="error" title={t("customerPortal.domain.errors.title")} description={t(domain.failureMessageKey)} />
|
||||
) : null}
|
||||
{data.actions.canRetry ? (
|
||||
<Button variant="tertiary" loading={busy} disabled={disabled} onClick={() => void actions.onRetry()}>
|
||||
{t("customerPortal.domain.actions.retry")}
|
||||
</Button>
|
||||
) : null}
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
{domain && !pending && data.actions.canSwitch ? (
|
||||
<Card>
|
||||
<h2>{t("customerPortal.domain.switch.title")}</h2>
|
||||
<Alert variant="information" title={t("customerPortal.domain.switch.feeTitle")} description={t("customerPortal.domain.switch.feeBody")} />
|
||||
<p>{domainSetupPrice}</p>
|
||||
<form onSubmit={(event) => submitHostname(event, "switch")}>
|
||||
<TextInput showLabel label={t("customerPortal.domain.switch.hostnameLabel")} fillContainer disabled={disabled}>
|
||||
<TextInput.Input
|
||||
name="switchHostname"
|
||||
type="text"
|
||||
inputMode="url"
|
||||
autoComplete="url"
|
||||
required
|
||||
value={switchHostname}
|
||||
placeholder={t("customerPortal.domain.hostnamePlaceholder")}
|
||||
onChange={(event) => setSwitchHostname(event.target.value)}
|
||||
/>
|
||||
</TextInput>
|
||||
<Button type="submit" loading={busy} disabled={disabled || !switchHostname.trim()}>
|
||||
{t("customerPortal.domain.actions.switch")}
|
||||
</Button>
|
||||
</form>
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
{domain || pending ? (
|
||||
<Card>
|
||||
<h2>{t(pending ? "customerPortal.domain.pendingSwitch.title" : "customerPortal.domain.dns.title")}</h2>
|
||||
<p>{pending?.hostname ?? domain?.hostname}</p>
|
||||
<p>{t("customerPortal.domain.dns.description")}</p>
|
||||
{(pending?.txtRecordValue ?? domain?.txtRecordValue) ? (
|
||||
<DnsRecord
|
||||
label={t("customerPortal.domain.dns.txt")}
|
||||
name={pending?.txtRecordName ?? domain?.txtRecordName ?? ""}
|
||||
value={pending?.txtRecordValue ?? domain?.txtRecordValue ?? ""}
|
||||
verified={pending?.txtVerified ?? domain?.txtVerified ?? false}
|
||||
successKey="customerPortal.domain.copyToast.txtValue"
|
||||
onCopy={copy}
|
||||
/>
|
||||
) : (
|
||||
<Alert
|
||||
variant="warning"
|
||||
title={t("customerPortal.domain.dns.tokenUnavailableTitle")}
|
||||
description={t("customerPortal.domain.dns.tokenUnavailableBody")}
|
||||
/>
|
||||
)}
|
||||
{data.actions.canReissueProof ? (
|
||||
<Button variant="secondary" loading={busy} disabled={disabled} onClick={() => void actions.onReissueProof()}>
|
||||
{t("customerPortal.domain.actions.reissueProof")}
|
||||
</Button>
|
||||
) : null}
|
||||
<DnsRecord
|
||||
label={t("customerPortal.domain.dns.cname")}
|
||||
name={pending?.cnameRecordName ?? domain?.cnameRecordName ?? ""}
|
||||
value={pending?.cnameRecordValue ?? domain?.cnameRecordValue ?? ""}
|
||||
verified={pending?.cnameVerified ?? domain?.cnameVerified ?? false}
|
||||
successKey="customerPortal.domain.copyToast.cnameValue"
|
||||
onCopy={copy}
|
||||
/>
|
||||
{data.actions.canBuyDomainSetup ? (
|
||||
<>
|
||||
<p>{domainSetupPrice}</p>
|
||||
<Button loading={busy} disabled={disabled} onClick={() => void actions.onBuyDomainSetup()}>
|
||||
{t("customerPortal.domain.actions.buySetup")}
|
||||
</Button>
|
||||
</>
|
||||
) : null}
|
||||
{data.actions.canVerifyDns ? (
|
||||
<Button variant="tertiary" loading={busy} disabled={disabled} onClick={() => void actions.onVerifyDns()}>
|
||||
{t("customerPortal.domain.actions.verify")}
|
||||
</Button>
|
||||
) : null}
|
||||
{pending && data.actions.canActivateSwitch ? (
|
||||
<Button loading={busy} disabled={disabled} onClick={() => void actions.onActivateSwitch(pending.claimId)}>
|
||||
{t("customerPortal.domain.actions.activateSwitch")}
|
||||
</Button>
|
||||
) : null}
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
{domain ? (
|
||||
<Card variant="warning">
|
||||
<h2>{t("customerPortal.domain.danger.title")}</h2>
|
||||
<p>{t("customerPortal.domain.danger.description")}</p>
|
||||
{domain.killSwitchEnabled ? (
|
||||
<Alert
|
||||
variant="warning"
|
||||
title={t("customerPortal.domain.danger.operatorKillSwitchTitle")}
|
||||
description={t("customerPortal.domain.danger.operatorKillSwitchBody")}
|
||||
/>
|
||||
) : null}
|
||||
{data.actions.canRemove ? (
|
||||
<Button variant="destructive" disabled={disabled} onClick={() => openConfirmation("remove")}>
|
||||
{t("customerPortal.domain.actions.remove")}
|
||||
</Button>
|
||||
) : null}
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
<Dialog open={confirmation !== null} onOpenChange={(open) => (open ? undefined : closeConfirmation())}>
|
||||
{confirmation ? (
|
||||
<Dialog.Content
|
||||
role="alertdialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="portal-domain-confirmation-title"
|
||||
aria-describedby={undefined}
|
||||
onCloseAutoFocus={(event) => {
|
||||
event.preventDefault();
|
||||
confirmationTriggerRef.current?.focus();
|
||||
}}
|
||||
data-ui-id="ui.customerPortal.domainAdmin.confirmation"
|
||||
>
|
||||
<h2 id="portal-domain-confirmation-title">{t(`customerPortal.domain.confirm.${confirmation}.title`)}</h2>
|
||||
<p>{t(`customerPortal.domain.confirm.${confirmation}.body`)}</p>
|
||||
<Button variant="tertiary" disabled={busy} onClick={closeConfirmation}>
|
||||
{t("customerPortal.domain.confirm.cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="destructive"
|
||||
loading={busy}
|
||||
onClick={() => {
|
||||
if (confirmation === "cancel-portal") void actions.onCancelPortal();
|
||||
else void actions.onRemove();
|
||||
closeConfirmation();
|
||||
}}
|
||||
>
|
||||
{t("customerPortal.domain.confirm.confirm")}
|
||||
</Button>
|
||||
</Dialog.Content>
|
||||
) : null}
|
||||
</Dialog>
|
||||
|
||||
<Card>
|
||||
<h2>{t("customerPortal.domain.timeline.title")}</h2>
|
||||
{data.timeline.length === 0 ? (
|
||||
<EmptyState outlined title={t("customerPortal.domain.timeline.emptyTitle")} body={t("customerPortal.domain.timeline.emptyBody")} />
|
||||
) : (
|
||||
<ol>
|
||||
{data.timeline.map((item) => (
|
||||
<li key={item.id}>
|
||||
<BadgeFeedback farbe={timelineTone(item.tone)}>{t(item.labelKey)}</BadgeFeedback>
|
||||
<time dateTime={item.occurredAt}>{formatters.dateTime(item.occurredAt)}</time>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
)}
|
||||
</Card>
|
||||
</PageBody>
|
||||
</PageShell>
|
||||
);
|
||||
}
|
||||
|
||||
function DnsRecord({
|
||||
label,
|
||||
name,
|
||||
value,
|
||||
verified,
|
||||
successKey,
|
||||
onCopy,
|
||||
}: {
|
||||
readonly label: string;
|
||||
readonly name: string;
|
||||
readonly value: string;
|
||||
readonly verified: boolean;
|
||||
readonly successKey: string;
|
||||
readonly onCopy: (value: string, successKey: string) => Promise<void>;
|
||||
}): React.JSX.Element {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Card size="small" variant={verified ? "positive" : "neutral"}>
|
||||
<h3>{label}</h3>
|
||||
<code>{name}</code>
|
||||
<code>{value}</code>
|
||||
<BadgeFeedback farbe={verified ? "subtle-positive" : "subtle-warning"}>
|
||||
{t(verified ? "customerPortal.domain.dns.verified" : "customerPortal.domain.dns.pending")}
|
||||
</BadgeFeedback>
|
||||
<Button variant="ghost" onClick={() => void onCopy(value, successKey)}>
|
||||
{t("customerPortal.domain.actions.copy")}
|
||||
</Button>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
function statusProgress(status: PortalDomainStatusVM): number {
|
||||
return {
|
||||
awaiting_payment: 10,
|
||||
awaiting_dns: 30,
|
||||
dns_verified: 55,
|
||||
provisioning: 80,
|
||||
active: 100,
|
||||
degraded: 80,
|
||||
failed: 60,
|
||||
disabled: 50,
|
||||
deprovisioning: 35,
|
||||
cooldown: 20,
|
||||
released: 0,
|
||||
}[status];
|
||||
}
|
||||
|
||||
function statusTone(
|
||||
status: PortalDomainStatusVM | "awaiting_payment" | "awaiting_dns" | "dns_verified"
|
||||
): "subtle-neutral" | "subtle-positive" | "subtle-negative" | "subtle-warning" | "subtle-information" {
|
||||
if (status === "active" || status === "dns_verified") return "subtle-positive";
|
||||
if (status === "failed") return "subtle-negative";
|
||||
if (status === "degraded" || status === "disabled" || status === "cooldown" || status === "awaiting_payment") return "subtle-warning";
|
||||
if (status === "provisioning" || status === "awaiting_dns" || status === "deprovisioning") return "subtle-information";
|
||||
return "subtle-neutral";
|
||||
}
|
||||
|
||||
function timelineTone(tone: "neutral" | "positive" | "warning" | "critical"): "subtle-neutral" | "subtle-positive" | "subtle-warning" | "subtle-negative" {
|
||||
if (tone === "positive") return "subtle-positive";
|
||||
if (tone === "warning") return "subtle-warning";
|
||||
if (tone === "critical") return "subtle-negative";
|
||||
return "subtle-neutral";
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`VA-P26a customer portal interim visual baseline > renders first-access setup with the required canonical privacy acknowledgement 1`] = `"<main data-ui-id="ui.customerPortal.setup.interim.visualBaseline"><main class="bg-surface-neutral-primary flex min-h-screen w-full items-center justify-center p-6" data-ui-id="ui.customerPortal.publicShell"><div class="group/56067c50 flex w-full flex-col items-start gap-4 rounded-md border border-solid border-border-default bg-surface-neutral-secondary shadow-sm px-6 py-6 max-w-[560px]"><div class="flex w-full items-center justify-between gap-4"><span class="text-text-neutral-primary truncate text-body-default-medium-0 font-body-default-medium-0 max-w-[133px]">Acme Kundenportal</span><div class="group/896531e4 flex h-6 items-center gap-2 rounded-round px-2.5 py-1 bg-brand-brand-surface-subtle-default"><div class="flex h-1 w-1 flex-none flex-col items-start gap-2 rounded-round bg-brand-brand-surface-solid-default"></div><span class="whitespace-nowrap text-body-small-medium-0 font-body-small-medium-0 text-text-neutral-on-subtle">Acme Kundenportal</span></div></div><div class="flex w-full flex-col gap-6" data-ui-id="ui.customerPortal.auth.setup"><div class="flex flex-col gap-1"><h1 class="text-heading-2 font-heading-2 text-text-neutral-primary">customerPortal.auth.setup.title</h1><p class="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">customerPortal.auth.setup.description</p></div><form class="flex w-full flex-col gap-4"><div class="flex w-full flex-col gap-3"><button class="group/3b777358 flex h-9 cursor-pointer items-center justify-center gap-3 rounded-md px-4 py-2.5 text-left focus-within:shadow-focus disabled:cursor-default disabled:bg-surface-neutral-disabled disabled:pointer-events-none hover:disabled:cursor-default hover:disabled:bg-surface-neutral-disabled active:disabled:cursor-default active:disabled:bg-surface-neutral-disabled border border-solid border-border-default bg-surface-neutral-primary hover:border hover:border-solid hover:border-border-strong hover:bg-surface-neutral-secondary active:bg-surface-neutral-tertiary" type="button"><span class="text-body-default-regular-0 font-body-default-regular-0 group-disabled/3b777358:text-icon-neutral-disabled text-icon-neutral-on-subtle icon-wrapper-module_root__-l6uP"><span class="icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span></span><div class="hidden h-4 w-4 flex-none items-center justify-center gap-2"><div class="text-body-extra-small-regular-150 font-body-extra-small-regular-150 group-disabled/3b777358:text-icon-neutral-disabled group-hover/3b777358:group-disabled/3b777358:text-icon-neutral-on-solid group-active/3b777358:group-disabled/3b777358:text-icon-neutral-disabled text-icon-neutral-on-subtle loader-module_root__-0Kak"></div></div><span class="whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 group-disabled/3b777358:text-text-neutral-disabled text-text-neutral-primary">customerPortal.auth.setup.useMagicLinkOnly</span></button></div><label class="group/be48ca43 flex h-full w-full min-w-[192px] cursor-pointer flex-col items-start justify-center gap-4 max-w-none"><div class="flex-col items-start gap-3 flex"><span class="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-secondary">customerPortal.auth.fields.password</span></div><div class="flex h-9 w-full min-w-[80px] flex-none items-center gap-2 rounded-sm border border-solid border-border-strong bg-surface-neutral-primary px-3 group-hover/be48ca43:border group-hover/be48ca43:border-solid group-hover/be48ca43:border-brand-brand-border-solid-hover group-hover/be48ca43:bg-surface-neutral-secondary group-focus-within/be48ca43:bg-surface-neutral-secondary group-focus-within/be48ca43:shadow-focus"><div class="flex grow shrink-0 basis-0 items-center self-stretch"><div class="hidden items-center gap-2 pr-2"><span class="text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-tertiary icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span></div><div class="flex grow shrink-0 basis-0 flex-col items-start self-stretch"><input class="group/b0d608f7 subframe-text-input-control h-full w-full border-none bg-transparent px-0 py-0 text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary outline-none placeholder:text-text-neutral-subtle" style="box-shadow: none;" autocomplete="new-password" required="" type="password" value="" name="password"><div class="group/39db4fac flex h-5 w-5 cursor-pointer flex-col items-center justify-center gap-4"><span class="text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-primary group-hover/39db4fac:text-body-large-0 group-hover/39db4fac:font-body-large-0 group-active/39db4fac:text-body-default-regular-0 group-active/39db4fac:font-body-default-regular-0 icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span></div></diLine truncated
|
||||
|
||||
exports[`VA-P26a customer portal interim visual baseline > renders the access-scoped dashboard and released document from ~/ui 1`] = `"<main data-ui-id="ui.customerPortal.interim.visualBaseline"><div class="bg-surface-neutral-primary flex h-screen w-full items-stretch overflow-hidden" data-ui-id="ui.customerPortal.portalShell"><nav class="group/f4047c8b flex h-full w-60 shrink-0 flex-col items-start rounded-l-md border-r border-solid border-border-default bg-surface-neutral-secondary relative transition-[width] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[width] z-50 max-md:fixed max-md:inset-y-0 max-md:left-0 max-md:transition-transform max-md:-translate-x-full" aria-label="customerPortal.navigation.portal" data-ui-id="ui.customerPortal.sidebar"><div class="group/7ce7d712 flex flex-col items-start gap-2 absolute -right-[17px] top-[40px] z-40 cursor-pointer"><button class="group/af9405b1 flex cursor-pointer items-center justify-center gap-2 text-left focus-within:shadow-focus disabled:cursor-default disabled:bg-surface-neutral-disabled disabled:pointer-events-none hover:disabled:cursor-default hover:disabled:bg-surface-neutral-disabled active:disabled:cursor-default active:disabled:bg-surface-neutral-disabled rounded-md h-8 w-8 border border-solid border-border-default bg-surface-neutral-primary hover:border hover:border-solid hover:border-border-strong hover:bg-surface-neutral-secondary active:bg-surface-neutral-tertiary" type="button" aria-label="components.sidebar.toggle"><span class="inline-flex h-5 w-5 flex-none items-center justify-center text-body-large-0 font-body-large-0 group-disabled/af9405b1:text-icon-neutral-disabled [&>svg]:h-full [&>svg]:w-full text-icon-neutral-on-subtle icon-wrapper-module_root__-l6uP"><span class="icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span></span><div class="hidden h-4 w-4 flex-none items-center justify-center gap-2"><div class="text-body-extra-small-regular-150 font-body-extra-small-regular-150 group-disabled/af9405b1:text-icon-neutral-disabled group-hover/af9405b1:group-disabled/af9405b1:text-icon-neutral-on-solid group-active/af9405b1:group-disabled/af9405b1:text-icon-neutral-disabled text-icon-neutral-on-subtle loader-module_root__-0Kak"></div></div></button></div><div class="flex h-14 w-full flex-none items-center justify-center gap-2 border-b border-solid border-border-default px-4"><div class="flex items-center justify-center gap-2"><button type="button" aria-label="customerPortal.navigation.home" class="border-0 bg-transparent p-0"><span class="text-text-neutral-primary truncate text-subtitle font-subtitle max-w-[177px]">Acme Kundenportal</span></button></div></div><div class="flex w-full grow shrink-0 basis-0 flex-col items-start overflow-y-auto overflow-x-hidden px-2 py-2"><div class="flex min-h-full w-full flex-1 flex-col gap-1"><div class="group/5a4abcb2 flex w-full flex-col items-start gap-2 pt-2"><div class="hidden w-full items-start"><div class="flex w-full flex-col items-center justify-center gap-2 px-1 pt-2"><div class="flex h-px w-full flex-none flex-col items-center justify-center gap-2 bg-border-default"></div></div></div><div class="hidden w-full items-start"><div class="flex w-full flex-col items-start gap-4 px-3 py-1"></div></div><div class="flex w-full grow shrink-0 basis-0 flex-col items-center"><button type="button" class="w-full border-0 bg-transparent p-0 text-left" aria-current="page"><div class="group/2713e17b flex w-full cursor-pointer flex-col items-start gap-2 pt-2" data-sidebar-hover-item="true"><div class="flex w-full flex-col items-start gap-2"><div class="pointer-events-none flex w-full origin-center scale-100 items-center gap-2.5 rounded-md px-3 py-2 transition-[background-color,scale] duration-150 ease-[cubic-bezier(0.4,0,0.2,1)] will-change-[scale] motion-reduce:transition-none group-hover/2713e17b:scale-[1.065] data-[sidebar-sweep-hover=true]:scale-[1.065] bg-surface-neutral-tertiary group-hover/2713e17b:bg-surface-neutral-modal group-active/2713e17b:bg-surface-neutral-tertiary" data-slot="app-sidebar-nav-item-surface" data-sidebar-hover-surface="true"><span class="inline-flex h-5 w-5 flex-none items-center justify-center leading-none text-body-large font-body-large text-icon-neutral-primary group-active/2713e17b:text-icon-neutral-on-subtle [&>svg]:h-full [&>svg]:w-full icon-wrapper-module_root__-l6uP"><span class="icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span></span><span class="min-w-0 flex-1 truncate text-body-small-regular-150 font-body-small-regular-150 group-active/2713e17b:text-text-neutral-on-subtle text-text-neutral-on-subtle">customerPortal.navigation.dashboard</span></div></div></div></button><button type="button" class="w-full border-0 bg-transparent p-0 text-left"><div class="group/2713e17b flex w-full cursor-pointer flex-col items-start gap-2 pt-2" data-sidebar-hover-item="true"><div class="flex w-full flex-col items-start gapLine truncated
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`VA-P26b AD-28 interim visual baselines > covers multi-file upload and the portal-form complaint 1`] = `"<main data-ui-id="ui.vaP26b.interactions.interim.visualBaseline"><div class="bg-surface-neutral-primary flex h-screen w-full items-stretch overflow-hidden" data-ui-id="ui.customerPortal.portalShell"><nav class="group/f4047c8b flex h-full w-60 shrink-0 flex-col items-start rounded-l-md border-r border-solid border-border-default bg-surface-neutral-secondary relative transition-[width] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[width] z-50 max-md:fixed max-md:inset-y-0 max-md:left-0 max-md:transition-transform max-md:-translate-x-full" aria-label="customerPortal.navigation.portal" data-ui-id="ui.customerPortal.sidebar"><div class="group/7ce7d712 flex flex-col items-start gap-2 absolute -right-[17px] top-[40px] z-40 cursor-pointer"><button class="group/af9405b1 flex cursor-pointer items-center justify-center gap-2 text-left focus-within:shadow-focus disabled:cursor-default disabled:bg-surface-neutral-disabled disabled:pointer-events-none hover:disabled:cursor-default hover:disabled:bg-surface-neutral-disabled active:disabled:cursor-default active:disabled:bg-surface-neutral-disabled rounded-md h-8 w-8 border border-solid border-border-default bg-surface-neutral-primary hover:border hover:border-solid hover:border-border-strong hover:bg-surface-neutral-secondary active:bg-surface-neutral-tertiary" type="button" aria-label="components.sidebar.toggle"><span class="inline-flex h-5 w-5 flex-none items-center justify-center text-body-large-0 font-body-large-0 group-disabled/af9405b1:text-icon-neutral-disabled [&>svg]:h-full [&>svg]:w-full text-icon-neutral-on-subtle icon-wrapper-module_root__-l6uP"><span class="icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span></span><div class="hidden h-4 w-4 flex-none items-center justify-center gap-2"><div class="text-body-extra-small-regular-150 font-body-extra-small-regular-150 group-disabled/af9405b1:text-icon-neutral-disabled group-hover/af9405b1:group-disabled/af9405b1:text-icon-neutral-on-solid group-active/af9405b1:group-disabled/af9405b1:text-icon-neutral-disabled text-icon-neutral-on-subtle loader-module_root__-0Kak"></div></div></button></div><div class="flex h-14 w-full flex-none items-center justify-center gap-2 border-b border-solid border-border-default px-4"><div class="flex items-center justify-center gap-2"><button type="button" aria-label="customerPortal.navigation.home" class="border-0 bg-transparent p-0"><span class="text-text-neutral-primary truncate text-subtitle font-subtitle max-w-[177px]">Acme Kundenportal</span></button></div></div><div class="flex w-full grow shrink-0 basis-0 flex-col items-start overflow-y-auto overflow-x-hidden px-2 py-2"><div class="flex min-h-full w-full flex-1 flex-col gap-1"><div class="group/5a4abcb2 flex w-full flex-col items-start gap-2 pt-2"><div class="hidden w-full items-start"><div class="flex w-full flex-col items-center justify-center gap-2 px-1 pt-2"><div class="flex h-px w-full flex-none flex-col items-center justify-center gap-2 bg-border-default"></div></div></div><div class="hidden w-full items-start"><div class="flex w-full flex-col items-start gap-4 px-3 py-1"></div></div><div class="flex w-full grow shrink-0 basis-0 flex-col items-center"><button type="button" class="w-full border-0 bg-transparent p-0 text-left"><div class="group/2713e17b flex w-full cursor-pointer flex-col items-start gap-2 pt-2" data-sidebar-hover-item="true"><div class="flex w-full flex-col items-start gap-2"><div class="pointer-events-none flex w-full origin-center scale-100 items-center gap-2.5 rounded-md px-3 py-2 transition-[background-color,scale] duration-150 ease-[cubic-bezier(0.4,0,0.2,1)] will-change-[scale] motion-reduce:transition-none group-hover/2713e17b:scale-[1.065] data-[sidebar-sweep-hover=true]:scale-[1.065] group-hover/2713e17b:bg-surface-neutral-tertiary" data-slot="app-sidebar-nav-item-surface" data-sidebar-hover-surface="true"><span class="inline-flex h-5 w-5 flex-none items-center justify-center leading-none text-body-large font-body-large text-icon-neutral-primary group-active/2713e17b:text-icon-neutral-on-subtle [&>svg]:h-full [&>svg]:w-full icon-wrapper-module_root__-l6uP"><span class="icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span></span><span class="min-w-0 flex-1 truncate text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary group-active/2713e17b:text-text-neutral-on-subtle">customerPortal.navigation.dashboard</span></div></div></div></button><button type="button" class="w-full border-0 bg-transparent p-0 text-left" aria-current="page"><div class="group/2713e17b flex w-full cursor-pointer flex-col items-start gap-2 pt-2" data-sidebar-hover-item="true"><div class="flex w-full flex-col items-start gap-2"><div class="pointer-events-none flex w-full origin-center scale-100 items-center gap-2.5Line truncated
|
||||
|
||||
exports[`VA-P26b AD-28 interim visual baselines > covers notification preferences, export and account deletion 1`] = `"<main data-ui-id="ui.vaP26b.lifecycle.interim.visualBaseline"><div class="bg-surface-neutral-primary flex h-screen w-full items-stretch overflow-hidden" data-ui-id="ui.customerPortal.portalShell"><nav class="group/f4047c8b flex h-full w-60 shrink-0 flex-col items-start rounded-l-md border-r border-solid border-border-default bg-surface-neutral-secondary relative transition-[width] duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[width] z-50 max-md:fixed max-md:inset-y-0 max-md:left-0 max-md:transition-transform max-md:-translate-x-full" aria-label="customerPortal.navigation.portal" data-ui-id="ui.customerPortal.sidebar"><div class="group/7ce7d712 flex flex-col items-start gap-2 absolute -right-[17px] top-[40px] z-40 cursor-pointer"><button class="group/af9405b1 flex cursor-pointer items-center justify-center gap-2 text-left focus-within:shadow-focus disabled:cursor-default disabled:bg-surface-neutral-disabled disabled:pointer-events-none hover:disabled:cursor-default hover:disabled:bg-surface-neutral-disabled active:disabled:cursor-default active:disabled:bg-surface-neutral-disabled rounded-md h-8 w-8 border border-solid border-border-default bg-surface-neutral-primary hover:border hover:border-solid hover:border-border-strong hover:bg-surface-neutral-secondary active:bg-surface-neutral-tertiary" type="button" aria-label="components.sidebar.toggle"><span class="inline-flex h-5 w-5 flex-none items-center justify-center text-body-large-0 font-body-large-0 group-disabled/af9405b1:text-icon-neutral-disabled [&>svg]:h-full [&>svg]:w-full text-icon-neutral-on-subtle icon-wrapper-module_root__-l6uP"><span class="icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span></span><div class="hidden h-4 w-4 flex-none items-center justify-center gap-2"><div class="text-body-extra-small-regular-150 font-body-extra-small-regular-150 group-disabled/af9405b1:text-icon-neutral-disabled group-hover/af9405b1:group-disabled/af9405b1:text-icon-neutral-on-solid group-active/af9405b1:group-disabled/af9405b1:text-icon-neutral-disabled text-icon-neutral-on-subtle loader-module_root__-0Kak"></div></div></button></div><div class="flex h-14 w-full flex-none items-center justify-center gap-2 border-b border-solid border-border-default px-4"><div class="flex items-center justify-center gap-2"><button type="button" aria-label="customerPortal.navigation.home" class="border-0 bg-transparent p-0"><span class="text-text-neutral-primary truncate text-subtitle font-subtitle max-w-[177px]">Acme Kundenportal</span></button></div></div><div class="flex w-full grow shrink-0 basis-0 flex-col items-start overflow-y-auto overflow-x-hidden px-2 py-2"><div class="flex min-h-full w-full flex-1 flex-col gap-1"><div class="group/5a4abcb2 flex w-full flex-col items-start gap-2 pt-2"><div class="hidden w-full items-start"><div class="flex w-full flex-col items-center justify-center gap-2 px-1 pt-2"><div class="flex h-px w-full flex-none flex-col items-center justify-center gap-2 bg-border-default"></div></div></div><div class="hidden w-full items-start"><div class="flex w-full flex-col items-start gap-4 px-3 py-1"></div></div><div class="flex w-full grow shrink-0 basis-0 flex-col items-center"><button type="button" class="w-full border-0 bg-transparent p-0 text-left"><div class="group/2713e17b flex w-full cursor-pointer flex-col items-start gap-2 pt-2" data-sidebar-hover-item="true"><div class="flex w-full flex-col items-start gap-2"><div class="pointer-events-none flex w-full origin-center scale-100 items-center gap-2.5 rounded-md px-3 py-2 transition-[background-color,scale] duration-150 ease-[cubic-bezier(0.4,0,0.2,1)] will-change-[scale] motion-reduce:transition-none group-hover/2713e17b:scale-[1.065] data-[sidebar-sweep-hover=true]:scale-[1.065] group-hover/2713e17b:bg-surface-neutral-tertiary" data-slot="app-sidebar-nav-item-surface" data-sidebar-hover-surface="true"><span class="inline-flex h-5 w-5 flex-none items-center justify-center leading-none text-body-large font-body-large text-icon-neutral-primary group-active/2713e17b:text-icon-neutral-on-subtle [&>svg]:h-full [&>svg]:w-full icon-wrapper-module_root__-l6uP"><span class="icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span></span><span class="min-w-0 flex-1 truncate text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary group-active/2713e17b:text-text-neutral-on-subtle">customerPortal.navigation.dashboard</span></div></div></div></button><button type="button" class="w-full border-0 bg-transparent p-0 text-left"><div class="group/2713e17b flex w-full cursor-pointer flex-col items-start gap-2 pt-2" data-sidebar-hover-item="true"><div class="flex w-full flex-col items-start gap-2"><div class="pointer-events-none flex w-full origin-center scale-100 items-center gap-2.5 rounded-md px-3 Line truncated
|
||||
|
||||
exports[`VA-P26b AD-28 interim visual baselines > covers the tenant-admin overview and the service inbox 1`] = `"<main data-ui-id="ui.vaP26b.admin.interim.visualBaseline"><div class="flex w-full flex-col items-start" data-ui-id="ui.customerPortal.admin"><div class="flex w-full items-start gap-4 border-b border-solid border-border-default bg-surface-neutral-secondary px-6 py-5 mobile:flex-col mobile:px-4"><div class="flex grow shrink-0 basis-0 flex-col items-start gap-1"><div class="flex items-center gap-2"><span class="icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span><h1 class="text-subtitle font-subtitle text-text-neutral-primary mobile:text-heading- mobile:font-heading-">customerPortal.admin.title</h1></div><p class="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary">customerPortal.admin.subtitle</p></div><div class="flex items-center gap-2 mobile:w-full mobile:flex-none mobile:flex-wrap"><div class="group/896531e4 flex h-6 items-center gap-2 rounded-round px-2.5 py-1 bg-surface-feedback-subtle-positive"><div class="flex h-1 w-1 flex-none flex-col items-start gap-2 rounded-round bg-icon-feedback-positive"></div><span class="whitespace-nowrap text-body-small-medium-0 font-body-small-medium-0 text-text-feedback-positive">customerPortal.admin.published</span></div></div></div><div class="flex w-full flex-wrap items-center justify-between gap-3 px-6 pt-4 mobile:px-4"><div class="flex flex-wrap items-center gap-2" role="tablist" aria-label="customerPortal.admin.areas.label" data-ui-id="ui.customerPortal.admin.areas"><button type="button" id="portal-admin-tab-overview" class="flex items-center rounded-md border border-solid px-3 py-1.5 outline-none focus-visible:shadow-focus border-brand-brand-border-solid-default bg-brand-brand-secondary-surface-subtle font-body-small-medium-0 text-text-neutral-primary" role="tab" tabindex="0" aria-selected="true" aria-controls="portal-admin-panel-overview" data-ui-id="ui.customerPortal.admin.area.overview">customerPortal.admin.areas.overview</button><button type="button" id="portal-admin-tab-users" class="flex items-center rounded-md border border-solid px-3 py-1.5 outline-none focus-visible:shadow-focus border-border-default bg-surface-neutral-primary font-body-small-regular-0 text-text-neutral-secondary hover:bg-surface-neutral-tertiary" role="tab" tabindex="-1" aria-selected="false" aria-controls="portal-admin-panel-users" data-ui-id="ui.customerPortal.admin.area.users">customerPortal.admin.areas.users</button><button type="button" id="portal-admin-tab-releases" class="flex items-center rounded-md border border-solid px-3 py-1.5 outline-none focus-visible:shadow-focus border-border-default bg-surface-neutral-primary font-body-small-regular-0 text-text-neutral-secondary hover:bg-surface-neutral-tertiary" role="tab" tabindex="-1" aria-selected="false" aria-controls="portal-admin-panel-releases" data-ui-id="ui.customerPortal.admin.area.releases">customerPortal.admin.areas.releases</button><button type="button" id="portal-admin-tab-domainEmail" class="flex items-center rounded-md border border-solid px-3 py-1.5 outline-none focus-visible:shadow-focus border-border-default bg-surface-neutral-primary font-body-small-regular-0 text-text-neutral-secondary hover:bg-surface-neutral-tertiary" role="tab" tabindex="-1" aria-selected="false" aria-controls="portal-admin-panel-domainEmail" data-ui-id="ui.customerPortal.admin.area.domainEmail">customerPortal.admin.areas.domainEmail</button></div></div><div class="flex w-full flex-col gap-6 p-6 mobile:p-4"><div class="group/56067c50 flex w-full flex-col items-start gap-4 rounded-md px-4 py-4 shadow-sm border border-solid border-surface-feedback-subtle-neutral bg-surface-feedback-subtle-neutral" id="portal-admin-panel-overview" role="tabpanel" aria-labelledby="portal-admin-tab-overview" data-ui-id="ui.customerPortal.admin.panel.overview"><div class="group/56067c50 flex w-full flex-col items-start gap-4 rounded-md border border-solid border-border-default bg-surface-neutral-secondary px-4 py-4 shadow-sm"><section class="flex w-full flex-col gap-4" aria-labelledby="portal-setup-heading"><div class="flex w-full flex-wrap items-start justify-between gap-3"><div class="flex min-w-0 items-center gap-3"><div class="group/4a18e9fc flex flex-col items-center justify-center gap-2 rounded-sm px-1 py-1 bg-surface-feedback-subtle-positive"><span class="text-body-large-0 font-body-large-0 relative text-icon-feedback-positive icon-wrapper-module_root__-l6uP"><span class="icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span></span></div><div class="flex min-w-0 flex-col gap-1"><h2 id="portal-setup-heading" class="text-body-large-0 font-body-large-0 text-text-neutral-primary">customerPortal.admin.setup.title</h2><span class="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">customerPortal.admin.setup.progressValue:3/3</span></div></div><div clLine truncated
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`VA-P26c AD-28 domain admin visual baseline > covers current domain, pending switch, one-time DNS proof, activation, and danger zone 1`] = `"<div class="flex w-full flex-col items-start" data-ui-id="ui.customerPortal.domainAdmin"><div class="flex w-full items-start gap-4 border-b border-solid border-border-default bg-surface-neutral-secondary px-6 py-5 mobile:flex-col mobile:px-4"><div class="flex grow shrink-0 basis-0 flex-col items-start gap-1"><div class="flex items-center gap-2"><h1 class="text-subtitle font-subtitle text-text-neutral-primary mobile:text-heading- mobile:font-heading-">customerPortal.domain.title</h1></div><p class="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">customerPortal.domain.subtitle</p></div><div class="flex items-center gap-2 mobile:w-full mobile:flex-none mobile:flex-wrap"><div class="group/896531e4 flex h-6 items-center gap-2 rounded-round px-2.5 py-1 bg-surface-feedback-subtle-positive"><div class="flex h-1 w-1 flex-none flex-col items-start gap-2 rounded-round bg-icon-feedback-positive"></div><span class="whitespace-nowrap text-body-small-medium-0 font-body-small-medium-0 text-text-feedback-positive">customerPortal.domain.status.dns_verified</span></div></div></div><div class="flex w-full flex-col gap-6 p-6 mobile:p-4"><div class="group/56067c50 flex w-full flex-col items-start gap-4 rounded-md px-4 py-4 shadow-sm border border-solid border-border-positive-subtle bg-surface-feedback-subtle-positive"><h2>customerPortal.domain.entitlement.title</h2><div class="group/896531e4 flex h-6 items-center gap-2 rounded-round px-2.5 py-1 bg-surface-feedback-subtle-positive"><div class="flex h-1 w-1 flex-none flex-col items-start gap-2 rounded-round bg-icon-feedback-positive"></div><span class="whitespace-nowrap text-body-small-medium-0 font-body-small-medium-0 text-text-feedback-positive">customerPortal.domain.entitlement.active</span></div><p>customerPortal.domain.entitlement.source.base_plan</p></div><div class="group/56067c50 flex w-full flex-col items-start gap-4 rounded-md px-4 py-4 shadow-sm border border-solid border-surface-feedback-subtle-neutral bg-surface-feedback-subtle-neutral"><h2>customerPortal.domain.fallback.title</h2><p>customerPortal.domain.fallback.description</p><label class="group/be48ca43 flex h-full w-full min-w-[192px] cursor-pointer flex-col items-start justify-center gap-4 max-w-none"><div class="flex-col items-start gap-3 flex"><span class="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-secondary">customerPortal.domain.fallback.urlLabel</span></div><div class="flex h-9 w-full min-w-[80px] flex-none items-center gap-2 rounded-sm border border-solid border-border-strong bg-surface-neutral-primary px-3 group-hover/be48ca43:border group-hover/be48ca43:border-solid group-hover/be48ca43:border-brand-brand-border-solid-hover group-hover/be48ca43:bg-surface-neutral-secondary group-focus-within/be48ca43:bg-surface-neutral-secondary group-focus-within/be48ca43:shadow-focus"><div class="flex grow shrink-0 basis-0 items-center self-stretch"><div class="hidden items-center gap-2 pr-2"><span class="text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-tertiary icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span></div><div class="flex grow shrink-0 basis-0 flex-col items-start self-stretch"><input class="group/b0d608f7 subframe-text-input-control h-full w-full border-none bg-transparent px-0 py-0 text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary outline-none placeholder:text-text-neutral-subtle" style="box-shadow: none;" readonly="" type="text" value="https://portal.hivegrid.de/acme"></div><div class="hidden items-center gap-1 pl-2"></div></div><div class="group/39db4fac h-5 w-5 cursor-pointer flex-col items-center justify-center gap-4 hidden"><span class="text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-primary group-hover/39db4fac:text-body-large-0 group-hover/39db4fac:font-body-large-0 group-active/39db4fac:text-body-default-regular-0 group-active/39db4fac:font-body-default-regular-0 icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span></div></div></label><button class="group/3b777358 flex h-9 cursor-pointer items-center justify-center gap-3 rounded-md px-4 py-2.5 text-left focus-within:shadow-focus disabled:cursor-default disabled:bg-surface-neutral-disabled disabled:pointer-events-none hover:disabled:cursor-default hover:disabled:bg-surface-neutral-disabled active:disabled:cursor-default active:disabled:bg-surface-neutral-disabled border border-solid border-border-default bg-surface-neutral-primary hover:border hover:border-solid hover:border-border-strong hover:bg-surface-neutral-secondary active:bg-surface-neutral-tertiary" type="button"><div class="hidden h-4 w-4 flex-none items-center justify-center gap-2"><div class="text-body-extra-small-regular-150 font-body-extra-smaLine truncated
|
||||
|
||||
exports[`VA-P26c AD-28 domain admin visual baseline > covers entitlement, fallback, claim, and empty timeline 1`] = `"<div class="flex w-full flex-col items-start" data-ui-id="ui.customerPortal.domainAdmin"><div class="flex w-full items-start gap-4 border-b border-solid border-border-default bg-surface-neutral-secondary px-6 py-5 mobile:flex-col mobile:px-4"><div class="flex grow shrink-0 basis-0 flex-col items-start gap-1"><div class="flex items-center gap-2"><h1 class="text-subtitle font-subtitle text-text-neutral-primary mobile:text-heading- mobile:font-heading-">customerPortal.domain.title</h1></div><p class="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-secondary">customerPortal.domain.subtitle</p></div><div class="flex items-center gap-2 mobile:w-full mobile:flex-none mobile:flex-wrap"><div class="group/896531e4 flex h-6 items-center gap-2 rounded-round px-2.5 py-1 bg-surface-feedback-subtle-neutral"><div class="flex h-1 w-1 flex-none flex-col items-start gap-2 rounded-round bg-icon-neutral-on-subtle"></div><span class="whitespace-nowrap text-body-small-medium-0 font-body-small-medium-0 text-text-neutral-on-subtle">customerPortal.domain.standardHost</span></div></div></div><div class="flex w-full flex-col gap-6 p-6 mobile:p-4"><div class="group/56067c50 flex w-full flex-col items-start gap-4 rounded-md px-4 py-4 shadow-sm border border-solid border-border-positive-subtle bg-surface-feedback-subtle-positive"><h2>customerPortal.domain.entitlement.title</h2><div class="group/896531e4 flex h-6 items-center gap-2 rounded-round px-2.5 py-1 bg-surface-feedback-subtle-positive"><div class="flex h-1 w-1 flex-none flex-col items-start gap-2 rounded-round bg-icon-feedback-positive"></div><span class="whitespace-nowrap text-body-small-medium-0 font-body-small-medium-0 text-text-feedback-positive">customerPortal.domain.entitlement.active</span></div><p>customerPortal.domain.entitlement.source.recurring_add_on</p><p>19,99 € billing:selfServiceSubscription.price.netSuffix / billing:selfServiceSubscription.period.monthly</p><button class="group/3b777358 flex h-9 cursor-pointer items-center justify-center gap-3 rounded-md border-none px-4 py-2.5 text-left focus-within:shadow-focus disabled:cursor-default disabled:bg-surface-neutral-disabled disabled:pointer-events-none hover:disabled:cursor-default hover:disabled:bg-surface-neutral-disabled active:disabled:cursor-default active:disabled:bg-surface-neutral-disabled bg-surface-feedback-solid-negative-default hover:bg-surface-feedback-solid-negative-hover active:bg-surface-feedback-solid-negative-active" type="button"><div class="hidden h-4 w-4 flex-none items-center justify-center gap-2"><div class="text-body-extra-small-regular-150 font-body-extra-small-regular-150 text-icon-neutral-on-solid group-disabled/3b777358:text-icon-neutral-disabled group-hover/3b777358:group-disabled/3b777358:text-icon-neutral-on-solid group-active/3b777358:group-disabled/3b777358:text-icon-neutral-disabled loader-module_root__-0Kak"></div></div><span class="whitespace-nowrap text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-on-solid group-disabled/3b777358:text-text-neutral-disabled">customerPortal.domain.actions.cancelPortal</span></button></div><div class="group/56067c50 flex w-full flex-col items-start gap-4 rounded-md px-4 py-4 shadow-sm border border-solid border-surface-feedback-subtle-neutral bg-surface-feedback-subtle-neutral"><h2>customerPortal.domain.fallback.title</h2><p>customerPortal.domain.fallback.description</p><label class="group/be48ca43 flex h-full w-full min-w-[192px] cursor-pointer flex-col items-start justify-center gap-4 max-w-none"><div class="flex-col items-start gap-3 flex"><span class="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-secondary">customerPortal.domain.fallback.urlLabel</span></div><div class="flex h-9 w-full min-w-[80px] flex-none items-center gap-2 rounded-sm border border-solid border-border-strong bg-surface-neutral-primary px-3 group-hover/be48ca43:border group-hover/be48ca43:border-solid group-hover/be48ca43:border-brand-brand-border-solid-hover group-hover/be48ca43:bg-surface-neutral-secondary group-focus-within/be48ca43:bg-surface-neutral-secondary group-focus-within/be48ca43:shadow-focus"><div class="flex grow shrink-0 basis-0 items-center self-stretch"><div class="hidden items-center gap-2 pr-2"><span class="text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-tertiary icon-wrapper-module_root__-l6uP"><svg data-visual-icon="true"></svg></span></div><div class="flex grow shrink-0 basis-0 flex-col items-start self-stretch"><input class="group/b0d608f7 subframe-text-input-control h-full w-full border-none bg-transparent px-0 py-0 text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary outline-none placeholder:text-text-neutral-subtle" style="box-shadow: none;" readonly="" type="text" value="https://portal.hivegrid.Line truncated
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
import { buildPortalDashboardVM, buildPortalProjectDetailVM, type PortalProjectInput } from "@hivegrid/view-models";
|
||||
import { MemoryRouter } from "react-router";
|
||||
|
||||
import { CustomerPortalDashboardPage, CustomerPortalProjectDetailPage } from "./CustomerPortalInterimPages";
|
||||
|
||||
const noOp = (): void => undefined;
|
||||
const project: PortalProjectInput = {
|
||||
id: "project-1",
|
||||
projectNumber: "P-1001",
|
||||
name: "Heizung Familie Kunde",
|
||||
updatedAt: "2026-07-15T10:00:00.000Z",
|
||||
currentStageOrder: 20,
|
||||
hasActiveAccess: true,
|
||||
stages: [
|
||||
{ id: "stage-1", label: "Planung", order: 10, visible: true },
|
||||
{ id: "stage-2", label: "Montage", order: 20, visible: true },
|
||||
{ id: "stage-3", label: "Abnahme", order: 30, visible: true },
|
||||
],
|
||||
documents: [
|
||||
{
|
||||
id: "release-1",
|
||||
name: "Montagefreigabe.pdf",
|
||||
mimeType: "application/pdf",
|
||||
releasedAt: "2026-07-15T09:00:00.000Z",
|
||||
revokedAt: null,
|
||||
downloadHref: "/acme/documents/release-1",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
/** Ready-state fixture shared by the VA-P26a Chromium pixel baseline. */
|
||||
export function CustomerPortalInterimVisualFixture(): React.JSX.Element {
|
||||
const vm = buildPortalDashboardVM({
|
||||
portalName: "Acme Kundenportal",
|
||||
viewerLabel: "Karla Kunde",
|
||||
frozen: false,
|
||||
projectsHref: "/acme/projects",
|
||||
logoutAction: "/acme/logout",
|
||||
buildProjectHref: (projectId) => `/acme/projects/${projectId}`,
|
||||
locale: "de-DE",
|
||||
projects: [project],
|
||||
});
|
||||
|
||||
return (
|
||||
<MemoryRouter initialEntries={["/acme/dashboard"]}>
|
||||
<CustomerPortalDashboardPage
|
||||
vm={vm}
|
||||
actions={{
|
||||
onDashboard: noOp,
|
||||
onProjects: noOp,
|
||||
onOpenProject: noOp,
|
||||
onDownloadDocument: noOp,
|
||||
onLogout: noOp,
|
||||
}}
|
||||
/>
|
||||
</MemoryRouter>
|
||||
);
|
||||
}
|
||||
|
||||
/** Ready project-detail fixture shared by the VA-P26a Chromium accessibility gate. */
|
||||
export function CustomerPortalProjectDetailInterimVisualFixture(): React.JSX.Element {
|
||||
const vm = buildPortalProjectDetailVM({
|
||||
frozen: false,
|
||||
project,
|
||||
projectsHref: "/acme/projects",
|
||||
locale: "de-DE",
|
||||
});
|
||||
|
||||
return (
|
||||
<MemoryRouter initialEntries={["/acme/projects/project-1"]}>
|
||||
<CustomerPortalProjectDetailPage
|
||||
vm={vm}
|
||||
portalName="Acme Kundenportal"
|
||||
viewerLabel="Karla Kunde"
|
||||
actions={{
|
||||
onDashboard: noOp,
|
||||
onProjects: noOp,
|
||||
onBack: noOp,
|
||||
onDownloadDocument: noOp,
|
||||
onLogout: noOp,
|
||||
}}
|
||||
/>
|
||||
</MemoryRouter>
|
||||
);
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { fireEvent } from "@testing-library/react";
|
||||
import { beforeAll, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { expectNoA11yViolations, findA11yViolations } from "~/utils/test/a11y";
|
||||
|
||||
import {
|
||||
P26bAdminInterimVisualFixture,
|
||||
P26bInteractionsInterimVisualFixture,
|
||||
P26bLifecycleInterimVisualFixture,
|
||||
P26bServiceInboxInterimVisualFixture,
|
||||
} from "./p26b-interim.visual-fixture";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({
|
||||
t: (key: string, values?: Record<string, unknown>) => (values ? `${key}:${Object.values(values).join("/")}` : key),
|
||||
}),
|
||||
}));
|
||||
|
||||
beforeAll(installDesktopMediaQueryMock);
|
||||
|
||||
describe("VA-P26b interim accessibility", () => {
|
||||
it("names every customer upload and complaint control", async () => {
|
||||
await expectNoA11yViolations(<P26bInteractionsInterimVisualFixture />);
|
||||
});
|
||||
|
||||
it("keeps the complaint action named while its loader and success message are visible", async () => {
|
||||
const view = await expectNoA11yViolations(<P26bInteractionsInterimVisualFixture busy />);
|
||||
|
||||
expect(view.getByRole("button", { name: "Reklamation senden" }).getAttribute("aria-label")).toBe("Reklamation senden");
|
||||
});
|
||||
|
||||
it("names every lifecycle preference, export and deletion control", async () => {
|
||||
const view = await expectNoA11yViolations(<P26bLifecycleInterimVisualFixture />);
|
||||
fireEvent.click(view.getByRole("tab", { name: "customerPortal.lifecycle.tabs.privacy" }));
|
||||
expect(findA11yViolations(view.container)).toEqual([]);
|
||||
});
|
||||
|
||||
it("names the tenant-admin configuration, access and inbox controls", async () => {
|
||||
const view = await expectNoA11yViolations(
|
||||
<>
|
||||
<P26bAdminInterimVisualFixture />
|
||||
<P26bServiceInboxInterimVisualFixture />
|
||||
</>
|
||||
);
|
||||
|
||||
fireEvent.click(view.getByRole("button", { name: "customerPortal.admin.setup.editSettings" }));
|
||||
expect(view.getByText("customerPortal.admin.configuration.title")).toBeTruthy();
|
||||
expect(findA11yViolations(view.container)).toEqual([]);
|
||||
|
||||
for (const area of ["users", "releases", "domainEmail"] as const) {
|
||||
fireEvent.click(view.getByRole("tab", { name: `customerPortal.admin.areas.${area}` }));
|
||||
expect(findA11yViolations(view.container)).toEqual([]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function installDesktopMediaQueryMock(): void {
|
||||
Object.defineProperty(window, "matchMedia", {
|
||||
configurable: true,
|
||||
value: vi.fn((query: string) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addEventListener: vi.fn(),
|
||||
removeEventListener: vi.fn(),
|
||||
addListener: vi.fn(),
|
||||
removeListener: vi.fn(),
|
||||
dispatchEvent: vi.fn(),
|
||||
})),
|
||||
});
|
||||
}
|
||||
+317
@@ -0,0 +1,317 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
||||
import { readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { MemoryRouter } from "react-router";
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { CustomerPortalSettingsPage, CustomerPortalUploadPage, PortalAdminInboxPage, PortalAdminPage } from "./CustomerPortalInterimPages";
|
||||
import { PortalBrandLogo } from "./CustomerPortalShell";
|
||||
import {
|
||||
createP26bAdminActions,
|
||||
createP26bAdminFixtureVM,
|
||||
createP26bInteractionsFixtureVM,
|
||||
createP26bLifecycleFixtureVM,
|
||||
createP26bPortalActions,
|
||||
} from "./p26b-interim.visual-fixture";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({
|
||||
t: (key: string, values?: Record<string, unknown>) => (values ? `${key}:${Object.values(values).join("/")}` : key),
|
||||
}),
|
||||
}));
|
||||
|
||||
beforeAll(installDesktopMediaQueryMock);
|
||||
|
||||
describe("VA-P26b interim screens", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it("falls back to the portal name, never to the HiveGrid logo, when a tenant logo cannot be loaded", () => {
|
||||
render(<PortalBrandLogo portalName="Acme Kundenportal" brandingLogoHref="/broken-logo.png" />);
|
||||
const logoAlt = "customerPortal.navigation.logoAlt:Acme Kundenportal";
|
||||
|
||||
fireEvent.error(screen.getByRole("img", { name: logoAlt }));
|
||||
|
||||
expect(screen.queryByRole("img", { name: logoAlt })).not.toBeInTheDocument();
|
||||
// The portal is the tenant's brand towards their end customers.
|
||||
expect(screen.queryByRole("img", { name: "HiveGrid" })).not.toBeInTheDocument();
|
||||
expect(screen.getByText("Acme Kundenportal")).toBeVisible();
|
||||
});
|
||||
|
||||
it("renders the customer surface through its branded portal shell without recursive app chrome", () => {
|
||||
const source = readFileSync(path.resolve(process.cwd(), "apps/web/app/components/screens/customer-portal/CustomerPortalInterimPages.tsx"), "utf8");
|
||||
const shell = readFileSync(path.resolve(process.cwd(), "apps/web/app/components/screens/customer-portal/CustomerPortalShell.tsx"), "utf8");
|
||||
const appShell = readFileSync(path.resolve(process.cwd(), "apps/web/app/components/app/SubframeAppShell.tsx"), "utf8");
|
||||
|
||||
expect(source).toContain("<CustomerPortalShell");
|
||||
expect(source).toContain("<PortalBrandLogo");
|
||||
expect(shell).toContain("brandingLogoHref");
|
||||
expect(shell).toContain("item.area === activeArea");
|
||||
expect(shell).toContain("<SidebarWithSections");
|
||||
expect(shell).toContain("<SidebarWithSections.NavItem");
|
||||
expect(shell).toContain("<Breadcrumbs");
|
||||
expect(shell).toContain("<IconButton");
|
||||
expect(shell).toContain("<PageHeader");
|
||||
expect(shell).toContain("logoContent={<PortalBrandLogo portalName={portalName} brandingLogoHref={brandingLogoHref} iconOnly={collapsed} />}");
|
||||
for (const canonicalLayoutClass of [
|
||||
"bg-surface-neutral-primary flex h-screen w-full items-stretch overflow-hidden",
|
||||
"border-border-default bg-surface-neutral-secondary mobile:px-4 flex h-14 w-full shrink-0 items-center justify-between gap-2 border-b border-solid py-3 pr-3 pl-6",
|
||||
"min-h-0 flex-1 overflow-auto overscroll-y-contain [scrollbar-gutter:stable] focus:outline-hidden",
|
||||
]) {
|
||||
expect(appShell).toContain(canonicalLayoutClass);
|
||||
expect(shell).toContain(canonicalLayoutClass);
|
||||
}
|
||||
expect(`${source}\n${shell}`).not.toContain("DefaultPageLayout");
|
||||
expect(source).not.toMatch(/h-full[^\n]*overflow-hidden|basis-0[^\n]*overflow-y-auto/u);
|
||||
expect(source).toContain('from "~/ui/components/');
|
||||
expect(shell).toContain('from "~/ui/components/');
|
||||
});
|
||||
|
||||
it("can transition the admin screen from a loader state to the ready VM without changing hook order", () => {
|
||||
const actions = createP26bAdminActions();
|
||||
const { rerender } = render(<PortalAdminPage vm={{ status: "loading" }} actions={actions} />);
|
||||
expect(screen.getByText("customerPortal.states.loading.title")).toBeVisible();
|
||||
|
||||
rerender(<PortalAdminPage vm={createP26bAdminFixtureVM()} actions={actions} />);
|
||||
expect(screen.getByText("customerPortal.admin.setup.title")).toBeVisible();
|
||||
expect(screen.queryByText("customerPortal.admin.configuration.title")).not.toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.admin.setup.editSettings" }));
|
||||
expect(screen.getByText("customerPortal.admin.configuration.title")).toBeVisible();
|
||||
});
|
||||
|
||||
it("prepares a tenant logo and keeps persistence behind the route-owned branding callback", async () => {
|
||||
const onSaveBranding = vi.fn();
|
||||
render(<PortalAdminPage vm={createP26bAdminFixtureVM()} actions={createP26bAdminActions({ onSaveBranding })} />);
|
||||
|
||||
fireEvent.change(screen.getByLabelText("customerPortal.admin.branding.upload"), {
|
||||
target: { files: [new File(["portal-logo"], "portal-logo.png", { type: "image/png" })] },
|
||||
});
|
||||
|
||||
const saveButton = screen.getByRole("button", { name: "customerPortal.admin.branding.save" });
|
||||
await waitFor(() => expect(saveButton).toBeEnabled());
|
||||
fireEvent.click(saveButton);
|
||||
|
||||
expect(onSaveBranding).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
content: expect.stringMatching(/^data:image\/png;base64,/u),
|
||||
declaredMimeType: "image/png",
|
||||
filename: "portal-logo.png",
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps the admin areas keyboard reachable and only exposes the selected panel", () => {
|
||||
render(<PortalAdminPage vm={createP26bAdminFixtureVM()} actions={createP26bAdminActions()} />);
|
||||
|
||||
const overviewTab = screen.getByRole("tab", { name: "customerPortal.admin.areas.overview" });
|
||||
const usersTab = screen.getByRole("tab", { name: "customerPortal.admin.areas.users" });
|
||||
const overviewPanel = document.getElementById("portal-admin-panel-overview");
|
||||
const usersPanel = document.getElementById("portal-admin-panel-users");
|
||||
|
||||
expect(overviewPanel).not.toHaveAttribute("hidden");
|
||||
expect(usersPanel).toHaveAttribute("hidden");
|
||||
fireEvent.keyDown(overviewTab, { key: "ArrowRight" });
|
||||
expect(usersTab).toHaveAttribute("aria-selected", "true");
|
||||
expect(overviewPanel).toHaveAttribute("hidden");
|
||||
expect(usersPanel).not.toHaveAttribute("hidden");
|
||||
});
|
||||
|
||||
it("routes an incomplete legal setup directly to the domain and mail area", () => {
|
||||
const vm = createP26bAdminFixtureVM();
|
||||
if (vm.status !== "ready") throw new Error("Expected a ready admin fixture");
|
||||
|
||||
render(
|
||||
<PortalAdminPage
|
||||
vm={{
|
||||
...vm,
|
||||
data: {
|
||||
...vm.data,
|
||||
configuration: {
|
||||
...vm.data.configuration,
|
||||
imprintUrl: null,
|
||||
privacyUrl: null,
|
||||
},
|
||||
},
|
||||
}}
|
||||
actions={createP26bAdminActions()}
|
||||
/>
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.admin.setup.editLegalDetails" }));
|
||||
expect(screen.getByRole("tab", { name: "customerPortal.admin.areas.domainEmail" })).toHaveAttribute("aria-selected", "true");
|
||||
expect(document.getElementById("portal-admin-panel-domainEmail")).not.toHaveAttribute("hidden");
|
||||
});
|
||||
|
||||
it("forwards a multi-file upload and an authenticated portal-form complaint through injected callbacks", () => {
|
||||
const onUploadFiles = vi.fn();
|
||||
const onSubmitComplaint = vi.fn();
|
||||
render(
|
||||
<MemoryRouter initialEntries={["/acme/upload"]}>
|
||||
<CustomerPortalUploadPage
|
||||
vm={createP26bInteractionsFixtureVM()}
|
||||
portalName="Acme Kundenportal"
|
||||
viewerLabel="Karla Kunde"
|
||||
projectOptions={[{ id: "project-1", label: "P-1001 · Heizung Familie Kunde" }]}
|
||||
selectedProjectId="project-1"
|
||||
actions={{
|
||||
...createP26bPortalActions(),
|
||||
onSelectProject: vi.fn(),
|
||||
onUploadFiles,
|
||||
onSubmitComplaint,
|
||||
}}
|
||||
/>
|
||||
</MemoryRouter>
|
||||
);
|
||||
|
||||
expect(screen.getByText("P-1001 · Heizung Familie Kunde")).toHaveClass("text-text-neutral-secondary");
|
||||
|
||||
const files = [new File(["photo"], "baustelle-neu.jpg", { type: "image/jpeg" }), new File(["voice"], "sprachmemo-neu.mp3", { type: "audio/mpeg" })];
|
||||
fireEvent.change(screen.getByLabelText("customerPortal.upload.filesLabel"), { target: { files } });
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.upload.submit" }));
|
||||
|
||||
expect(onUploadFiles).toHaveBeenCalledWith("/acme/projects/project-1/upload", files);
|
||||
expect(screen.getByText("baustelle-neu.jpg")).toBeVisible();
|
||||
expect(screen.getByText("sprachmemo-neu.mp3")).toBeVisible();
|
||||
|
||||
fireEvent.change(screen.getByLabelText("Betreff"), { target: { value: "Heizung bleibt kalt" } });
|
||||
fireEvent.change(screen.getByLabelText("Beschreibung"), { target: { value: "Seit heute keine Wärme." } });
|
||||
fireEvent.click(screen.getByRole("checkbox", { name: "Ich stimme der Verarbeitung zur Bearbeitung zu." }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "Reklamation senden" }));
|
||||
|
||||
expect(onSubmitComplaint).toHaveBeenCalledWith(
|
||||
"/acme/projects/project-1/complaints/form-complaint",
|
||||
{
|
||||
subject: "Heizung bleibt kalt",
|
||||
description: "Seit heute keine Wärme.",
|
||||
},
|
||||
true
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps lifecycle export, preference, download and deletion actions behind the route-owned callbacks", () => {
|
||||
const onUpdatePreference = vi.fn();
|
||||
const onRequestExport = vi.fn();
|
||||
const onDownloadExport = vi.fn();
|
||||
const onRequestDeletion = vi.fn();
|
||||
render(
|
||||
<MemoryRouter initialEntries={["/acme/settings"]}>
|
||||
<CustomerPortalSettingsPage
|
||||
vm={createP26bLifecycleFixtureVM()}
|
||||
portalName="Acme Kundenportal"
|
||||
viewerLabel="Karla Kunde"
|
||||
actions={createP26bPortalActions({
|
||||
onUpdatePreference,
|
||||
onRequestExport,
|
||||
onDownloadExport,
|
||||
onRequestDeletion,
|
||||
})}
|
||||
/>
|
||||
</MemoryRouter>
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole("switch", { name: "customerPortal.lifecycle.preferences.events.lifecycle" }));
|
||||
expect(onUpdatePreference).toHaveBeenCalledWith("lifecycle", false);
|
||||
|
||||
fireEvent.click(screen.getByRole("tab", { name: "customerPortal.lifecycle.tabs.privacy" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.lifecycle.export.request" }));
|
||||
expect(onRequestExport).toHaveBeenCalledTimes(1);
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.lifecycle.export.download" }));
|
||||
expect(onDownloadExport).toHaveBeenCalledWith("/acme/exports/export-1");
|
||||
|
||||
const password = screen.getByLabelText("customerPortal.lifecycle.deletion.password");
|
||||
fireEvent.change(password, { target: { value: "password" } });
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.lifecycle.deletion.request" }));
|
||||
expect(onRequestDeletion).toHaveBeenCalledWith("password");
|
||||
});
|
||||
|
||||
it("exposes the 24-hour deletion cancellation action for a pending request", () => {
|
||||
const onCancelDeletion = vi.fn();
|
||||
render(
|
||||
<MemoryRouter initialEntries={["/acme/settings"]}>
|
||||
<CustomerPortalSettingsPage
|
||||
vm={createP26bLifecycleFixtureVM({ pendingDeletion: true })}
|
||||
portalName="Acme Kundenportal"
|
||||
viewerLabel="Karla Kunde"
|
||||
actions={createP26bPortalActions({ onCancelDeletion })}
|
||||
/>
|
||||
</MemoryRouter>
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole("tab", { name: "customerPortal.lifecycle.tabs.privacy" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.lifecycle.deletion.cancel" }));
|
||||
expect(onCancelDeletion).toHaveBeenCalledWith("deletion-1");
|
||||
});
|
||||
|
||||
it("renders customer and subcontractor access plus the prioritized service inbox", () => {
|
||||
const onDisableUser = vi.fn();
|
||||
const onResendInvitation = vi.fn();
|
||||
const onOpenEmailTemplates = vi.fn();
|
||||
const onOpenDomain = vi.fn();
|
||||
const onOpenInbox = vi.fn();
|
||||
const onUpdateInbox = vi.fn();
|
||||
const vm = createP26bAdminFixtureVM();
|
||||
const { rerender } = render(
|
||||
<PortalAdminPage
|
||||
vm={vm}
|
||||
actions={createP26bAdminActions({ onDisableUser, onResendInvitation, onOpenEmailTemplates, onOpenDomain, onOpenInbox, onUpdateInbox })}
|
||||
/>
|
||||
);
|
||||
|
||||
const overviewTab = screen.getByRole("tab", { name: "customerPortal.admin.areas.overview" });
|
||||
const usersTab = screen.getByRole("tab", { name: "customerPortal.admin.areas.users" });
|
||||
const domainEmailTab = screen.getByRole("tab", { name: "customerPortal.admin.areas.domainEmail" });
|
||||
expect(overviewTab).toHaveAttribute("aria-selected", "true");
|
||||
expect(usersTab).toHaveAttribute("aria-selected", "false");
|
||||
fireEvent.click(usersTab);
|
||||
expect(screen.getByText(/Sven Subunternehmen · P-1001 · Heizung Familie Kunde/u)).toBeVisible();
|
||||
expect(screen.getByText(/Subbau GmbH/u)).toBeVisible();
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.admin.users.resendInvitation" }));
|
||||
expect(onResendInvitation).toHaveBeenCalledWith("portal-customer");
|
||||
|
||||
fireEvent.click(domainEmailTab);
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.admin.configuration.emailTemplates" }));
|
||||
expect(onOpenEmailTemplates).toHaveBeenCalledWith("/acme/settings/customer-portal/email-templates");
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.admin.configuration.customDomain" }));
|
||||
expect(onOpenDomain).toHaveBeenCalledTimes(1);
|
||||
|
||||
rerender(<PortalAdminPage vm={vm} actions={createP26bAdminActions()} />);
|
||||
expect(screen.queryByRole("button", { name: "customerPortal.admin.configuration.customDomain" })).not.toBeInTheDocument();
|
||||
|
||||
rerender(<PortalAdminPage vm={vm} actions={createP26bAdminActions({ onDisableUser, onOpenEmailTemplates, onOpenInbox, onUpdateInbox })} />);
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.admin.inbox.open" }));
|
||||
expect(onOpenInbox).toHaveBeenCalledTimes(1);
|
||||
|
||||
rerender(
|
||||
<PortalAdminInboxPage
|
||||
vm={vm}
|
||||
actions={{
|
||||
onUpdate: onUpdateInbox,
|
||||
onBackToSettings: vi.fn(),
|
||||
}}
|
||||
/>
|
||||
);
|
||||
const resolveButtons = screen.getAllByRole("button", { name: "customerPortal.admin.inbox.resolve" });
|
||||
fireEvent.click(resolveButtons[0]!);
|
||||
expect(onUpdateInbox).toHaveBeenCalledWith({ itemId: "inbox-complaint", status: "resolved" });
|
||||
});
|
||||
});
|
||||
|
||||
function installDesktopMediaQueryMock(): void {
|
||||
Object.defineProperty(window, "matchMedia", {
|
||||
configurable: true,
|
||||
value: vi.fn((query: string) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addEventListener: vi.fn(),
|
||||
removeEventListener: vi.fn(),
|
||||
addListener: vi.fn(),
|
||||
removeListener: vi.fn(),
|
||||
dispatchEvent: vi.fn(),
|
||||
})),
|
||||
});
|
||||
}
|
||||
+313
@@ -0,0 +1,313 @@
|
||||
import {
|
||||
buildPortalAdminVM,
|
||||
buildPortalLifecycleVM,
|
||||
buildPortalProjectInteractionsVM,
|
||||
type PortalAdminVM,
|
||||
type PortalLifecycleVM,
|
||||
type PortalProjectInteractionsVM,
|
||||
} from "@hivegrid/view-models";
|
||||
import { MemoryRouter } from "react-router";
|
||||
|
||||
import {
|
||||
CustomerPortalSettingsPage,
|
||||
CustomerPortalUploadPage,
|
||||
PortalAdminInboxPage,
|
||||
PortalAdminPage,
|
||||
type PortalAdminPageActions,
|
||||
type PortalLifecyclePageActions,
|
||||
} from "./CustomerPortalInterimPages";
|
||||
|
||||
const noOp = (): void => undefined;
|
||||
|
||||
export function createP26bInteractionsFixtureVM(viewerKind: "customer" | "subcontractor" = "customer"): PortalProjectInteractionsVM {
|
||||
return buildPortalProjectInteractionsVM({
|
||||
hasActiveProjectAccess: true,
|
||||
projectId: "project-1",
|
||||
projectLabel: "P-1001 · Heizung Familie Kunde",
|
||||
frozen: false,
|
||||
viewerKind,
|
||||
uploadAllowed: true,
|
||||
uploadAction: "/acme/projects/project-1/upload",
|
||||
maxFiles: 10,
|
||||
maxFileSizeBytes: 50 * 1024 * 1024,
|
||||
acceptedMimeTypes: ["image/jpeg", "application/pdf", "audio/mpeg"],
|
||||
uploads: [
|
||||
{
|
||||
id: "upload-1",
|
||||
filename: "baustelle.jpg",
|
||||
category: "photo",
|
||||
status: "clean",
|
||||
sizeBytes: 1_572_864,
|
||||
createdAt: "2026-07-16T09:30:00.000Z",
|
||||
errorMessageKey: null,
|
||||
},
|
||||
{
|
||||
id: "upload-2",
|
||||
filename: "sprachmemo.mp3",
|
||||
category: "audio",
|
||||
status: "scanning",
|
||||
sizeBytes: 786_432,
|
||||
createdAt: "2026-07-16T09:15:00.000Z",
|
||||
errorMessageKey: null,
|
||||
},
|
||||
],
|
||||
complaintForm: {
|
||||
formId: "form-complaint",
|
||||
formSlug: "reklamation",
|
||||
formName: "Reklamation melden",
|
||||
submitAction: "/acme/projects/project-1/complaints/form-complaint",
|
||||
submitLabel: "Reklamation senden",
|
||||
gdprConsentLabel: "Ich stimme der Verarbeitung zur Bearbeitung zu.",
|
||||
fields: [
|
||||
{ key: "subject", type: "text", label: "Betreff", required: true, options: [] },
|
||||
{ key: "description", type: "textarea", label: "Beschreibung", required: true, options: [] },
|
||||
{
|
||||
key: "priority",
|
||||
type: "select",
|
||||
label: "Dringlichkeit",
|
||||
required: true,
|
||||
options: [
|
||||
{ value: "normal", label: "Normal" },
|
||||
{ value: "urgent", label: "Dringend" },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function createP26bLifecycleFixtureVM(options: { readonly pendingDeletion?: boolean } = {}): PortalLifecycleVM {
|
||||
return buildPortalLifecycleVM({
|
||||
frozen: false,
|
||||
profile: {
|
||||
name: "Karla Kunde",
|
||||
email: "karla@example.test",
|
||||
phone: "+49 30 1234567",
|
||||
locale: "de-DE",
|
||||
},
|
||||
notificationPreferences: [
|
||||
{ eventType: "status_mail", emailEnabled: true, mutedUntil: null },
|
||||
{ eventType: "lifecycle", emailEnabled: true, mutedUntil: null },
|
||||
],
|
||||
exportJobs: [
|
||||
{
|
||||
id: "export-1",
|
||||
status: "ready",
|
||||
progressPercent: 100,
|
||||
requestedAt: "2026-07-16T08:00:00.000Z",
|
||||
expiresAt: "2026-07-17T08:00:00.000Z",
|
||||
downloadHref: "/acme/exports/export-1",
|
||||
},
|
||||
],
|
||||
deletionRequest: options.pendingDeletion
|
||||
? {
|
||||
id: "deletion-1",
|
||||
status: "pending",
|
||||
requestedAt: "2026-07-16T08:30:00.000Z",
|
||||
cancellableUntil: "2026-07-17T08:30:00.000Z",
|
||||
}
|
||||
: null,
|
||||
now: "2026-07-16T10:00:00.000Z",
|
||||
});
|
||||
}
|
||||
|
||||
export function createP26bAdminFixtureVM(): PortalAdminVM {
|
||||
return buildPortalAdminVM({
|
||||
frozen: false,
|
||||
permissions: {
|
||||
canRead: true,
|
||||
canManageUsers: true,
|
||||
canManageAccess: true,
|
||||
canDeleteUsers: true,
|
||||
canReadActivity: true,
|
||||
canManageActivity: true,
|
||||
canAdminister: true,
|
||||
},
|
||||
configuration: {
|
||||
published: true,
|
||||
lifecycleMode: "project",
|
||||
projectAutoCloseMonths: 12,
|
||||
inactivityDisableMonths: 24,
|
||||
uploadMaxFiles: 10,
|
||||
uploadMaxFileSizeBytes: 50 * 1024 * 1024,
|
||||
enabledProjectTypes: ["installation"],
|
||||
statusEmailsEnabled: true,
|
||||
imprintUrl: "https://example.test/impressum",
|
||||
privacyUrl: "https://example.test/datenschutz",
|
||||
termsUrl: "https://example.test/agb",
|
||||
legalLinksComplete: true,
|
||||
visibleStageCount: 2,
|
||||
autoReleaseRuleCount: 1,
|
||||
emailTemplateHref: "/acme/settings/customer-portal/email-templates",
|
||||
},
|
||||
stages: [
|
||||
{ stageId: "stage-planning", stageLabel: "Planung", visible: true, customerLabel: "Planung" },
|
||||
{ stageId: "stage-installation", stageLabel: "Montage", visible: true, customerLabel: "Montage vor Ort" },
|
||||
],
|
||||
autoReleaseRules: [{ id: "rule-1", projectType: "installation", documentType: "invoice", enabled: true }],
|
||||
projectOptions: [{ id: "project-1", label: "P-1001 · Heizung Familie Kunde", projectType: "installation" }],
|
||||
users: [
|
||||
{
|
||||
id: "portal-customer",
|
||||
kind: "customer",
|
||||
name: "Karla Kunde",
|
||||
email: "karla@example.test",
|
||||
status: "invited",
|
||||
canResendInvitation: true,
|
||||
projectCount: 1,
|
||||
lastActivityAt: "2026-07-16T09:30:00.000Z",
|
||||
},
|
||||
{
|
||||
id: "portal-subcontractor",
|
||||
kind: "subcontractor",
|
||||
name: "Sven Subunternehmen",
|
||||
email: "sven@example.test",
|
||||
status: "active",
|
||||
canResendInvitation: false,
|
||||
projectCount: 1,
|
||||
lastActivityAt: "2026-07-16T09:15:00.000Z",
|
||||
},
|
||||
],
|
||||
accessRows: [
|
||||
{
|
||||
id: "access-1",
|
||||
portalUserId: "portal-subcontractor",
|
||||
portalUserLabel: "Sven Subunternehmen",
|
||||
viewerKind: "subcontractor",
|
||||
projectId: "project-1",
|
||||
projectLabel: "P-1001 · Heizung Familie Kunde",
|
||||
active: true,
|
||||
canUpload: true,
|
||||
validUntil: "2026-08-16T23:59:59.999Z",
|
||||
companyName: "Subbau GmbH",
|
||||
roleLabel: "Elektrik",
|
||||
visibleStageIds: ["stage-installation"],
|
||||
visibleDocumentTypes: ["installation_plan"],
|
||||
canSeeOtherSubcontractors: false,
|
||||
},
|
||||
],
|
||||
inbox: [
|
||||
{
|
||||
id: "inbox-complaint",
|
||||
kind: "complaint",
|
||||
status: "open",
|
||||
priority: 400,
|
||||
titleKey: "customerPortal.admin.inbox.kinds.complaint",
|
||||
portalUserLabel: "Karla Kunde",
|
||||
projectLabel: "P-1001 · Heizung Familie Kunde",
|
||||
bundledCount: 1,
|
||||
occurredAt: "2026-07-16T09:45:00.000Z",
|
||||
expiresAt: "2026-07-23T09:45:00.000Z",
|
||||
ownerLabel: "Projektleitung",
|
||||
},
|
||||
{
|
||||
id: "inbox-upload",
|
||||
kind: "upload",
|
||||
status: "open",
|
||||
priority: 300,
|
||||
titleKey: "customerPortal.admin.inbox.kinds.upload",
|
||||
portalUserLabel: "Karla Kunde",
|
||||
projectLabel: "P-1001 · Heizung Familie Kunde",
|
||||
bundledCount: 3,
|
||||
occurredAt: "2026-07-16T09:30:00.000Z",
|
||||
expiresAt: "2026-07-23T09:30:00.000Z",
|
||||
ownerLabel: null,
|
||||
},
|
||||
],
|
||||
now: "2026-07-16T10:00:00.000Z",
|
||||
});
|
||||
}
|
||||
|
||||
export function createP26bPortalActions(overrides: Partial<PortalLifecyclePageActions> = {}): PortalLifecyclePageActions {
|
||||
return {
|
||||
onDashboard: noOp,
|
||||
onProjects: noOp,
|
||||
onUpload: noOp,
|
||||
onSettings: noOp,
|
||||
onLogout: noOp,
|
||||
onUpdatePreference: noOp,
|
||||
onRequestExport: noOp,
|
||||
onDownloadExport: noOp,
|
||||
onRequestDeletion: noOp,
|
||||
onCancelDeletion: noOp,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
export function createP26bAdminActions(overrides: Partial<PortalAdminPageActions> = {}): PortalAdminPageActions {
|
||||
return {
|
||||
onSaveConfiguration: noOp,
|
||||
onSaveBranding: noOp,
|
||||
onSaveStage: noOp,
|
||||
onSaveAutoRelease: noOp,
|
||||
onInviteUser: noOp,
|
||||
onResendInvitation: noOp,
|
||||
onSetAccess: noOp,
|
||||
onDisableUser: noOp,
|
||||
onUpdateInbox: noOp,
|
||||
onOpenEmailTemplates: noOp,
|
||||
onOpenInbox: noOp,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
export function P26bInteractionsInterimVisualFixture({ busy = false }: { readonly busy?: boolean } = {}): React.JSX.Element {
|
||||
return (
|
||||
<MemoryRouter initialEntries={["/acme/upload"]}>
|
||||
<CustomerPortalUploadPage
|
||||
vm={createP26bInteractionsFixtureVM()}
|
||||
portalName="Acme Kundenportal"
|
||||
viewerLabel="Karla Kunde"
|
||||
projectOptions={[{ id: "project-1", label: "P-1001 · Heizung Familie Kunde" }]}
|
||||
selectedProjectId="project-1"
|
||||
interactionsState={busy ? { uploadBusy: false, complaintBusy: true, complaintMessageKey: "customerPortal.complaint.success" } : undefined}
|
||||
actions={{
|
||||
...createP26bPortalActions(),
|
||||
onSelectProject: noOp,
|
||||
onUploadFiles: noOp,
|
||||
onSubmitComplaint: noOp,
|
||||
}}
|
||||
/>
|
||||
</MemoryRouter>
|
||||
);
|
||||
}
|
||||
|
||||
export function P26bLifecycleInterimVisualFixture({ pendingDeletion = false }: { readonly pendingDeletion?: boolean } = {}): React.JSX.Element {
|
||||
return (
|
||||
<MemoryRouter initialEntries={["/acme/settings"]}>
|
||||
<CustomerPortalSettingsPage
|
||||
vm={createP26bLifecycleFixtureVM({ pendingDeletion })}
|
||||
portalName="Acme Kundenportal"
|
||||
viewerLabel="Karla Kunde"
|
||||
actions={createP26bPortalActions()}
|
||||
/>
|
||||
</MemoryRouter>
|
||||
);
|
||||
}
|
||||
|
||||
export function P26bAdminInterimVisualFixture(): React.JSX.Element {
|
||||
return <PortalAdminPage vm={createP26bAdminFixtureVM()} actions={createP26bAdminActions()} />;
|
||||
}
|
||||
|
||||
export function P26bServiceInboxInterimVisualFixture(): React.JSX.Element {
|
||||
const vm = createP26bAdminFixtureVM();
|
||||
return (
|
||||
<PortalAdminInboxPage
|
||||
vm={vm}
|
||||
actions={{
|
||||
onUpdate: noOp,
|
||||
onBackToSettings: noOp,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export type P26bInterimVisualScreen = "interactions" | "lifecycle" | "admin" | "service-inbox";
|
||||
|
||||
/** Imported Playwright CT story; CT cannot mount components declared in the spec itself. */
|
||||
export function P26bInterimVisualFixture({ screen }: { readonly screen: P26bInterimVisualScreen }): React.JSX.Element {
|
||||
if (screen === "interactions") return <P26bInteractionsInterimVisualFixture />;
|
||||
if (screen === "lifecycle") return <P26bLifecycleInterimVisualFixture />;
|
||||
if (screen === "admin") return <P26bAdminInterimVisualFixture />;
|
||||
return <P26bServiceInboxInterimVisualFixture />;
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import { cleanup, render } from "@testing-library/react";
|
||||
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import {
|
||||
P26bAdminInterimVisualFixture,
|
||||
P26bInteractionsInterimVisualFixture,
|
||||
P26bLifecycleInterimVisualFixture,
|
||||
P26bServiceInboxInterimVisualFixture,
|
||||
} from "./p26b-interim.visual-fixture";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({
|
||||
t: (key: string, values?: Record<string, unknown>) => (values ? `${key}:${Object.values(values).join("/")}` : key),
|
||||
}),
|
||||
}));
|
||||
|
||||
beforeAll(installDesktopMediaQueryMock);
|
||||
|
||||
afterEach(cleanup);
|
||||
|
||||
function stableMarkup(container: HTMLElement): string {
|
||||
return container.innerHTML.replace(/<svg\b[^>]*>[\s\S]*?<\/svg>/gu, '<svg data-visual-icon="true"></svg>');
|
||||
}
|
||||
|
||||
describe("VA-P26b AD-28 interim visual baselines", () => {
|
||||
it("covers multi-file upload and the portal-form complaint", () => {
|
||||
const { container } = render(
|
||||
<main data-ui-id="ui.vaP26b.interactions.interim.visualBaseline">
|
||||
<P26bInteractionsInterimVisualFixture />
|
||||
</main>
|
||||
);
|
||||
|
||||
expect(container.querySelectorAll('[data-ui-id="ui.customerPortal.projectInteractions"]')).toHaveLength(1);
|
||||
expect(container).toHaveTextContent("baustelle.jpg");
|
||||
expect(container).toHaveTextContent("Reklamation melden");
|
||||
expect(stableMarkup(container)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("covers notification preferences, export and account deletion", () => {
|
||||
const { container } = render(
|
||||
<main data-ui-id="ui.vaP26b.lifecycle.interim.visualBaseline">
|
||||
<P26bLifecycleInterimVisualFixture />
|
||||
</main>
|
||||
);
|
||||
|
||||
expect(container.querySelectorAll('[data-ui-id="ui.customerPortal.lifecycle"]')).toHaveLength(1);
|
||||
expect(container).toHaveTextContent("karla@example.test");
|
||||
expect(stableMarkup(container)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("covers the tenant-admin overview and the service inbox", () => {
|
||||
const { container } = render(
|
||||
<main data-ui-id="ui.vaP26b.admin.interim.visualBaseline">
|
||||
<P26bAdminInterimVisualFixture />
|
||||
<P26bServiceInboxInterimVisualFixture />
|
||||
</main>
|
||||
);
|
||||
|
||||
expect(container.querySelectorAll('[data-ui-id="ui.customerPortal.admin"]')).toHaveLength(1);
|
||||
expect(container.querySelectorAll('[data-ui-id="ui.customerPortal.serviceInbox"]')).toHaveLength(1);
|
||||
expect(container).toHaveTextContent("customerPortal.admin.setup.title");
|
||||
expect(stableMarkup(container)).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
function installDesktopMediaQueryMock(): void {
|
||||
Object.defineProperty(window, "matchMedia", {
|
||||
configurable: true,
|
||||
value: vi.fn((query: string) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addEventListener: vi.fn(),
|
||||
removeEventListener: vi.fn(),
|
||||
addListener: vi.fn(),
|
||||
removeListener: vi.fn(),
|
||||
dispatchEvent: vi.fn(),
|
||||
})),
|
||||
});
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { assertNoA11yViolations, expectNoA11yViolations } from "~/utils/test/a11y";
|
||||
|
||||
import { P26cDomainClaimVisualFixture, P26cDomainPendingSwitchVisualFixture } from "./p26c-domain-interim.visual-fixture";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({ t: (key: string) => key, i18n: { language: "de" } }),
|
||||
}));
|
||||
|
||||
describe("VA-P26c domain admin interim accessibility", () => {
|
||||
it("names every claim and fallback control", async () => {
|
||||
await expectNoA11yViolations(<P26cDomainClaimVisualFixture />);
|
||||
});
|
||||
|
||||
it("names the pending switch, DNS, and activation controls", async () => {
|
||||
await expectNoA11yViolations(<P26cDomainPendingSwitchVisualFixture />);
|
||||
});
|
||||
|
||||
it("exposes the destructive confirmation as a named modal alert dialog", () => {
|
||||
render(<P26cDomainClaimVisualFixture />);
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.domain.actions.cancelPortal" }));
|
||||
|
||||
const dialog = screen.getByRole("alertdialog", {
|
||||
name: "customerPortal.domain.confirm.cancel-portal.title",
|
||||
});
|
||||
expect(dialog.getAttribute("aria-modal")).toBe("true");
|
||||
assertNoA11yViolations(document.body);
|
||||
});
|
||||
});
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import { readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { PortalDomainAdminInterimPage } from "./PortalDomainAdminInterimPage";
|
||||
import { createP26cDomainActions, p26cDomainClaimVM, p26cDomainPendingSwitchVM } from "./p26c-domain-interim.visual-fixture";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({ t: (key: string) => key, i18n: { language: "de" } }),
|
||||
}));
|
||||
|
||||
describe("VA-P26c domain admin interim UI", () => {
|
||||
it("is VM-only and composes the existing ~/ui system without direct Subframe or handwritten Tailwind", () => {
|
||||
const source = readFileSync(path.resolve(process.cwd(), "apps/web/app/components/screens/customer-portal/PortalDomainAdminInterimPage.tsx"), "utf8");
|
||||
expect(source).not.toContain("@subframe/");
|
||||
expect(source).not.toContain("ui-subframe");
|
||||
expect(source).not.toMatch(/className\s*=/u);
|
||||
expect(source).toContain('from "~/ui/components/');
|
||||
expect(source).toContain('import { Dialog } from "~/ui/components/Dialog";');
|
||||
expect(source).toContain("<Dialog.Content");
|
||||
expect(source).not.toMatch(/<Card[^>]+role="alertdialog"/u);
|
||||
expect(source).toContain("useLocaleFormatters");
|
||||
expect(source).toContain("formatters.dateTime(item.occurredAt)");
|
||||
expect(source).not.toContain("toLocaleString");
|
||||
expect(source).toContain("readonly vm: PortalDomainAdminVM");
|
||||
expect(source).toContain("readonly actions: PortalDomainAdminActions");
|
||||
});
|
||||
|
||||
it("submits a normalized claim hostname through the action callback", () => {
|
||||
const onClaimDomain = vi.fn();
|
||||
render(<PortalDomainAdminInterimPage vm={p26cDomainClaimVM} actions={createP26cDomainActions({ onClaimDomain })} />);
|
||||
|
||||
fireEvent.change(screen.getByLabelText("customerPortal.domain.hostname"), { target: { value: " portal.acme.de " } });
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.domain.actions.claim" }));
|
||||
expect(onClaimDomain).toHaveBeenCalledWith("portal.acme.de");
|
||||
});
|
||||
|
||||
it("requires confirmation before cancelling the recurring portal add-on", () => {
|
||||
const onCancelPortal = vi.fn();
|
||||
render(<PortalDomainAdminInterimPage vm={p26cDomainClaimVM} actions={createP26cDomainActions({ onCancelPortal })} />);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.domain.actions.cancelPortal" }));
|
||||
expect(onCancelPortal).not.toHaveBeenCalled();
|
||||
expect(screen.getByRole("alertdialog", { name: "customerPortal.domain.confirm.cancel-portal.title" })).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.domain.confirm.confirm" }));
|
||||
expect(onCancelPortal).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("renders the server-bound catalog amounts instead of translated fallback prices", () => {
|
||||
const monthlyVm = {
|
||||
...p26cDomainClaimVM,
|
||||
data: {
|
||||
...p26cDomainClaimVM.data,
|
||||
monthlyAddOn: { ...p26cDomainClaimVM.data.monthlyAddOn, amountCents: 2499 },
|
||||
},
|
||||
};
|
||||
const { rerender } = render(<PortalDomainAdminInterimPage vm={monthlyVm} actions={createP26cDomainActions()} />);
|
||||
|
||||
expect(screen.getByText(/24,99/)).toBeInTheDocument();
|
||||
expect(screen.queryByText("customerPortal.domain.monthlyPrice")).not.toBeInTheDocument();
|
||||
|
||||
const setupVm = {
|
||||
...p26cDomainPendingSwitchVM,
|
||||
data: {
|
||||
...p26cDomainPendingSwitchVM.data,
|
||||
domainSetup: {
|
||||
...p26cDomainPendingSwitchVM.data.domainSetup,
|
||||
required: true,
|
||||
active: false,
|
||||
amountCents: 34999,
|
||||
},
|
||||
pendingSwitch: {
|
||||
...p26cDomainPendingSwitchVM.data.pendingSwitch!,
|
||||
status: "awaiting_payment" as const,
|
||||
},
|
||||
actions: {
|
||||
...p26cDomainPendingSwitchVM.data.actions,
|
||||
canBuyDomainSetup: true,
|
||||
canActivateSwitch: false,
|
||||
},
|
||||
},
|
||||
};
|
||||
rerender(<PortalDomainAdminInterimPage vm={setupVm} actions={createP26cDomainActions()} />);
|
||||
|
||||
expect(screen.getByText(/349,99/)).toBeInTheDocument();
|
||||
expect(screen.queryByText("customerPortal.domain.setupPrice")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders the pending switch, DNS proof, fallback, timeline, and activates only the bound claim", () => {
|
||||
const onActivateSwitch = vi.fn();
|
||||
render(<PortalDomainAdminInterimPage vm={p26cDomainPendingSwitchVM} actions={createP26cDomainActions({ onActivateSwitch })} />);
|
||||
|
||||
const fallbackUrl = screen.getByDisplayValue("https://portal.hivegrid.de/acme");
|
||||
expect(fallbackUrl).toBeInTheDocument();
|
||||
expect(fallbackUrl).toHaveAttribute("readonly");
|
||||
expect(fallbackUrl).not.toBeDisabled();
|
||||
expect(screen.getAllByText("portal.acme.de").length).toBeGreaterThan(0);
|
||||
expect(screen.getByText("hivegrid-verification-proof-once")).toBeInTheDocument();
|
||||
expect(screen.getByText("customerPortal.domain.timeline.dnsVerified")).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.domain.actions.activateSwitch" }));
|
||||
expect(onActivateSwitch).toHaveBeenCalledWith("claim-switch");
|
||||
});
|
||||
|
||||
it("recovers a lost proof while exposing an operator kill switch read-only", () => {
|
||||
const onReissueProof = vi.fn();
|
||||
const vm = {
|
||||
...p26cDomainPendingSwitchVM,
|
||||
data: {
|
||||
...p26cDomainPendingSwitchVM.data,
|
||||
domain: { ...p26cDomainPendingSwitchVM.data.domain!, killSwitchEnabled: true },
|
||||
pendingSwitch: { ...p26cDomainPendingSwitchVM.data.pendingSwitch!, status: "awaiting_dns" as const, txtRecordValue: null },
|
||||
actions: { ...p26cDomainPendingSwitchVM.data.actions, canReissueProof: true, canActivateSwitch: false },
|
||||
},
|
||||
};
|
||||
render(<PortalDomainAdminInterimPage vm={vm} actions={createP26cDomainActions({ onReissueProof })} />);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "customerPortal.domain.actions.reissueProof" }));
|
||||
expect(onReissueProof).toHaveBeenCalledTimes(1);
|
||||
expect(screen.getByText("customerPortal.domain.danger.operatorKillSwitchBody")).toBeInTheDocument();
|
||||
expect(screen.queryByRole("switch")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows explicit loading, empty, error, and read-only states", () => {
|
||||
const actions = createP26cDomainActions();
|
||||
const { rerender } = render(<PortalDomainAdminInterimPage vm={{ status: "loading" }} actions={actions} />);
|
||||
expect(screen.getByText("customerPortal.domain.states.loading.body")).toBeInTheDocument();
|
||||
|
||||
rerender(<PortalDomainAdminInterimPage vm={{ status: "empty" }} actions={actions} />);
|
||||
expect(screen.getByText("customerPortal.domain.states.empty.body")).toBeInTheDocument();
|
||||
|
||||
rerender(
|
||||
<PortalDomainAdminInterimPage vm={{ status: "error", error: { messageKey: "customerPortal.domain.errors.checkoutUnavailable" } }} actions={actions} />
|
||||
);
|
||||
expect(screen.getByText("customerPortal.domain.errors.checkoutUnavailable")).toBeInTheDocument();
|
||||
|
||||
rerender(<PortalDomainAdminInterimPage vm={{ ...p26cDomainClaimVM, data: { ...p26cDomainClaimVM.data, readOnly: true } }} actions={actions} />);
|
||||
expect(screen.getByText("customerPortal.domain.states.readOnly.body")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
import type { PortalDomainAdminActions, PortalDomainAdminVM } from "@hivegrid/view-models";
|
||||
|
||||
import { PortalDomainAdminInterimPage } from "./PortalDomainAdminInterimPage";
|
||||
|
||||
export const p26cDomainPendingSwitchVM: PortalDomainAdminVM = {
|
||||
status: "ready",
|
||||
data: {
|
||||
readOnly: false,
|
||||
standardPortalUrl: "https://portal.hivegrid.de/acme",
|
||||
portalEntitled: true,
|
||||
portalEntitlementSource: "base_plan",
|
||||
monthlyAddOn: { required: false, active: true, amountCents: 1999, currency: "EUR" },
|
||||
domainSetup: {
|
||||
required: false,
|
||||
active: true,
|
||||
includedByContract: false,
|
||||
amountCents: 29999,
|
||||
currency: "EUR",
|
||||
scopeKey: "portal-domain:claim-switch",
|
||||
},
|
||||
domain: {
|
||||
claimId: "claim-current",
|
||||
hostname: "portal.alt-acme.de",
|
||||
status: "cooldown",
|
||||
generation: 3,
|
||||
customPortalUrl: null,
|
||||
txtRecordName: "_hivegrid-portal.portal.alt-acme.de",
|
||||
txtRecordValue: null,
|
||||
cnameRecordName: "portal.alt-acme.de",
|
||||
cnameRecordValue: "portal.hivegrid.de",
|
||||
txtVerified: true,
|
||||
cnameVerified: true,
|
||||
nextRetryAt: null,
|
||||
nextRevalidationAt: null,
|
||||
certificateExpiresAt: null,
|
||||
cooldownUntil: "2026-08-15T08:00:00.000Z",
|
||||
failureMessageKey: null,
|
||||
killSwitchEnabled: false,
|
||||
},
|
||||
pendingSwitch: {
|
||||
claimId: "claim-switch",
|
||||
hostname: "portal.acme.de",
|
||||
status: "dns_verified",
|
||||
billingScopeKey: "portal-domain:claim-switch",
|
||||
txtRecordName: "_hivegrid-portal.portal.acme.de",
|
||||
txtRecordValue: "hivegrid-verification-proof-once",
|
||||
cnameRecordName: "portal.acme.de",
|
||||
cnameRecordValue: "portal.hivegrid.de",
|
||||
txtVerified: true,
|
||||
cnameVerified: true,
|
||||
verificationExpiresAt: "2026-07-18T08:00:00.000Z",
|
||||
},
|
||||
actions: {
|
||||
canBuyPortal: false,
|
||||
canCancelPortal: false,
|
||||
canClaimDomain: false,
|
||||
canBuyDomainSetup: false,
|
||||
canReissueProof: false,
|
||||
canVerifyDns: false,
|
||||
canRetry: false,
|
||||
canRemove: false,
|
||||
canSwitch: false,
|
||||
canActivateSwitch: true,
|
||||
},
|
||||
timeline: [
|
||||
{
|
||||
id: "event-dns",
|
||||
occurredAt: "2026-07-16T08:30:00.000Z",
|
||||
labelKey: "customerPortal.domain.timeline.dnsVerified",
|
||||
tone: "positive",
|
||||
},
|
||||
{
|
||||
id: "event-claim",
|
||||
occurredAt: "2026-07-16T08:00:00.000Z",
|
||||
labelKey: "customerPortal.domain.timeline.claimed",
|
||||
tone: "neutral",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
export const p26cDomainClaimVM: PortalDomainAdminVM = {
|
||||
status: "ready",
|
||||
data: {
|
||||
readOnly: false,
|
||||
standardPortalUrl: "https://portal.hivegrid.de/acme",
|
||||
portalEntitled: true,
|
||||
portalEntitlementSource: "recurring_add_on",
|
||||
monthlyAddOn: {
|
||||
required: true,
|
||||
active: true,
|
||||
amountCents: 1999,
|
||||
currency: "EUR",
|
||||
},
|
||||
domainSetup: {
|
||||
required: false,
|
||||
active: false,
|
||||
includedByContract: false,
|
||||
amountCents: 29999,
|
||||
currency: "EUR",
|
||||
scopeKey: null,
|
||||
},
|
||||
domain: null,
|
||||
pendingSwitch: null,
|
||||
actions: {
|
||||
canBuyPortal: false,
|
||||
canCancelPortal: true,
|
||||
canClaimDomain: true,
|
||||
canBuyDomainSetup: false,
|
||||
canReissueProof: false,
|
||||
canVerifyDns: false,
|
||||
canRetry: false,
|
||||
canRemove: false,
|
||||
canSwitch: false,
|
||||
canActivateSwitch: false,
|
||||
},
|
||||
timeline: [],
|
||||
},
|
||||
};
|
||||
|
||||
export function createP26cDomainActions(overrides: Partial<PortalDomainAdminActions> = {}): PortalDomainAdminActions {
|
||||
return {
|
||||
onBuyPortal: () => undefined,
|
||||
onCancelPortal: () => undefined,
|
||||
onClaimDomain: () => undefined,
|
||||
onBuyDomainSetup: () => undefined,
|
||||
onReissueProof: () => undefined,
|
||||
onVerifyDns: () => undefined,
|
||||
onRetry: () => undefined,
|
||||
onRemove: () => undefined,
|
||||
onSwitch: () => undefined,
|
||||
onActivateSwitch: () => undefined,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
export function P26cDomainPendingSwitchVisualFixture(): React.JSX.Element {
|
||||
return <PortalDomainAdminInterimPage vm={p26cDomainPendingSwitchVM} actions={createP26cDomainActions()} />;
|
||||
}
|
||||
|
||||
export function P26cDomainClaimVisualFixture(): React.JSX.Element {
|
||||
return <PortalDomainAdminInterimPage vm={p26cDomainClaimVM} actions={createP26cDomainActions()} />;
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import { cleanup, render } from "@testing-library/react";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { P26cDomainClaimVisualFixture, P26cDomainPendingSwitchVisualFixture } from "./p26c-domain-interim.visual-fixture";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({ t: (key: string) => key }),
|
||||
}));
|
||||
|
||||
afterEach(cleanup);
|
||||
|
||||
function stableMarkup(container: HTMLElement): string {
|
||||
return container.innerHTML.replace(/<svg\b[^>]*>[\s\S]*?<\/svg>/gu, '<svg data-visual-icon="true"></svg>');
|
||||
}
|
||||
|
||||
describe("VA-P26c AD-28 domain admin visual baseline", () => {
|
||||
it("covers entitlement, fallback, claim, and empty timeline", () => {
|
||||
const { container } = render(<P26cDomainClaimVisualFixture />);
|
||||
expect(container.querySelectorAll('[data-ui-id="ui.customerPortal.domainAdmin"]')).toHaveLength(1);
|
||||
expect(stableMarkup(container)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("covers current domain, pending switch, one-time DNS proof, activation, and danger zone", () => {
|
||||
const { container } = render(<P26cDomainPendingSwitchVisualFixture />);
|
||||
expect(container).toHaveTextContent("hivegrid-verification-proof-once");
|
||||
expect(container).toHaveTextContent("customerPortal.domain.actions.activateSwitch");
|
||||
expect(stableMarkup(container)).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user