Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/apps/web/app/components/screens/ak-p20-interim.visual-fixture.tsx
T

115 lines
4.3 KiB
TypeScript

import {
buildBillingPaymentVM,
buildBillingUsageVM,
buildSeatUsageVM,
buildSubscriptionOverviewVM,
toDemoDataSettingsVM,
toFirstStepsChecklistVM,
} from "@hivegrid/view-models";
import { BillingPaymentPage } from "./billing/BillingPaymentPage";
import { BillingUsagePage } from "./billing/BillingUsagePage";
import { SubscriptionOverviewPage } from "./billing/SubscriptionOverviewPage";
import { DemoDataSettingsPage } from "./onboarding/DemoDataSettingsPage";
import { FirstStepsChecklistPage } from "./onboarding/FirstStepsChecklistPage";
export const AK_P20_INTERIM_VISUAL_SCREENS = ["subscription", "usage", "billing", "demo-data", "first-steps"] as const;
export type AkP20InterimVisualScreen = (typeof AK_P20_INTERIM_VISUAL_SCREENS)[number];
export function createAkP20InterimVisualVMs() {
return {
subscription: buildSubscriptionOverviewVM({
hasSubscription: true,
status: "trial",
trialEndsAt: "2026-07-14T12:00:00.000Z",
now: "2026-07-12T12:00:00.000Z",
planCode: "Starter",
seatUsage: buildSeatUsageVM({ packageId: null, usage: null, counts: { office: 2, field: 1 } }),
products: [
{
id: "product-1",
titleKey: "settings.subscription.seats.package.starter",
code: "starter-monthly",
quantity: 3,
currentPeriodEnd: "2026-08-12T00:00:00.000Z",
prices: [{ amount: 49, currency: "eur", billingPeriod: 3, quantity: 1 }],
},
],
entitlements: [
{
code: "billing",
titleKey: "billing:billingPayment.title",
enabled: true,
value: 1,
used: 0,
remaining: "unlimited",
},
],
canCancel: true,
contactHref: "https://example.test/kontakt",
}),
usage: buildBillingUsageVM({
periodStart: "2026-07-01T00:00:00.000Z",
periodEnd: "2026-08-01T00:00:00.000Z",
metrics: [
{ metricCode: "automation_runs", quantity: 82, quota: 100, remaining: 18, exceeded: false, percentUsed: 82 },
{ metricCode: "storage_bytes", quantity: 5368709120, quota: 10737418240, remaining: 5368709120, exceeded: false, percentUsed: 50 },
],
}),
billing: buildBillingPaymentVM({
invoices: [
{
id: "invoice-1",
number: "2026-001",
issuingDate: "2026-07-01T00:00:00.000Z",
amountCents: 9900,
currency: "eur",
status: "finalized",
paymentStatus: "paid",
invoiceType: "subscription",
downloadHref: "/acme/settings/billing/invoices/invoice-1",
},
],
lastPaymentExternalId: "mollie-payment-1",
}),
demoData: toDemoDataSettingsVM({
demoDataUiEnabled: true,
provisioning: {
id: "demo-1",
entitiesCreated: { kontakt: ["contact-1"], projekt: ["project-1"], task: ["task-1"] },
createdAt: "2026-07-01T00:00:00.000Z",
},
}),
checklist: toFirstStepsChecklistVM({
id: "checklist-1",
status: "active",
dismissed: false,
items: [
{ id: "profile", block: "profile", titleKey: "onboarding.firstSteps.profile", href: "/acme/settings/profile", completed: true },
{ id: "projects", block: "projects", titleKey: "onboarding.firstSteps.projects", href: "/acme/projects", completed: false },
],
}),
};
}
const noOp = (): void => undefined;
/** Shared ready-state fixture for markup and Chromium pixel-regression tests. */
export function AkP20InterimVisualFixture({ screen }: { screen: AkP20InterimVisualScreen }): React.JSX.Element {
const vm = createAkP20InterimVisualVMs();
switch (screen) {
case "subscription":
return <SubscriptionOverviewPage vm={vm.subscription} actions={{ onCancel: noOp, onOpenContact: noOp, onRetry: noOp }} />;
case "usage":
return <BillingUsagePage vm={vm.usage} actions={{ onRetry: noOp }} />;
case "billing":
return <BillingPaymentPage vm={vm.billing} actions={{ onDownloadInvoice: noOp, onRetry: noOp }} />;
case "demo-data":
return <DemoDataSettingsPage vm={vm.demoData} actions={{ onCreate: noOp, onDelete: noOp, onRetry: noOp }} />;
case "first-steps":
return <FirstStepsChecklistPage vm={vm.checklist} actions={{ onComplete: noOp, onDismiss: noOp, onOpen: noOp, onRetry: noOp }} />;
}
}