118 lines
3.5 KiB
TypeScript
118 lines
3.5 KiB
TypeScript
import { useMemo } from "react";
|
|
import { createMemoryRouter, RouterProvider } from "react-router";
|
|
|
|
import RegisterScreen, { type RegistrationPlanOptionData } from "./RegisterScreen";
|
|
|
|
const plans: readonly RegistrationPlanOptionData[] = [
|
|
{
|
|
planId: "product_starter",
|
|
planCode: "starter",
|
|
titleKey: "pricing.products.plan1.title",
|
|
descriptionKey: "pricing.products.plan1.description",
|
|
priceId: "price_starter",
|
|
amountCents: 19_900,
|
|
baseAmountCents: 19_900,
|
|
currency: "EUR",
|
|
billingPeriod: 3,
|
|
includedOfficeSeatQuantity: 2,
|
|
includedFieldSeatQuantity: 5,
|
|
includedStorageGb: 100,
|
|
storagePerAdditionalSeatGb: 10,
|
|
extraOfficeSeatQuantity: 0,
|
|
extraFieldSeatQuantity: 0,
|
|
recommended: true,
|
|
},
|
|
{
|
|
planId: "product_pro",
|
|
planCode: "pro",
|
|
titleKey: "pricing.products.plan2.title",
|
|
descriptionKey: "pricing.products.plan2.description",
|
|
priceId: "price_pro",
|
|
amountCents: 49_900,
|
|
baseAmountCents: 49_900,
|
|
currency: "EUR",
|
|
billingPeriod: 3,
|
|
includedOfficeSeatQuantity: 5,
|
|
includedFieldSeatQuantity: 15,
|
|
includedStorageGb: 500,
|
|
storagePerAdditionalSeatGb: 20,
|
|
extraOfficeSeatQuantity: 0,
|
|
extraFieldSeatQuantity: 0,
|
|
recommended: false,
|
|
},
|
|
{
|
|
planId: "product_business",
|
|
planCode: "business",
|
|
titleKey: "pricing.products.plan3.title",
|
|
descriptionKey: "pricing.products.plan3.description",
|
|
priceId: "price_business",
|
|
amountCents: 99_900,
|
|
baseAmountCents: 99_900,
|
|
currency: "EUR",
|
|
billingPeriod: 3,
|
|
includedOfficeSeatQuantity: 10,
|
|
includedFieldSeatQuantity: 30,
|
|
includedStorageGb: 2_000,
|
|
storagePerAdditionalSeatGb: 40,
|
|
extraOfficeSeatQuantity: 0,
|
|
extraFieldSeatQuantity: 0,
|
|
recommended: false,
|
|
},
|
|
];
|
|
|
|
const rootData = {
|
|
csrf: "visual-csrf",
|
|
appConfiguration: {
|
|
auth: {
|
|
requireEmailVerification: true,
|
|
requireOrganization: true,
|
|
requireName: true,
|
|
authMethods: { emailPassword: { enabled: true } },
|
|
captcha: {
|
|
enabled: true,
|
|
provider: "cap" as const,
|
|
instanceUrl: "https://captcha.visual.invalid",
|
|
loginSiteKey: "registration-visual",
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
/** Real registration component in a deterministic data-router shell for visual regression. */
|
|
export function RegisterScreenVisualFixture({ requireEmailVerification = true }: { requireEmailVerification?: boolean } = {}) {
|
|
const router = useMemo(
|
|
() =>
|
|
createMemoryRouter(
|
|
[
|
|
{
|
|
id: "root",
|
|
path: "/",
|
|
loader: () => ({
|
|
...rootData,
|
|
appConfiguration: {
|
|
...rootData.appConfiguration,
|
|
auth: { ...rootData.appConfiguration.auth, requireEmailVerification },
|
|
},
|
|
}),
|
|
element: (
|
|
<RegisterScreen
|
|
requireCaptcha
|
|
creationRequestKey="d7077797-054b-497a-b1ce-8e4f36257a96"
|
|
subscriptionPlans={plans}
|
|
selectedSubscriptionPriceId="price_starter"
|
|
recommendedSubscriptionPriceId="price_starter"
|
|
initialOfficeSeatQuantity={1}
|
|
initialFieldSeatQuantity={0}
|
|
passwordPolicy={{ minLength: 12, requireUpper: true, requireLower: true, requireDigit: true, requireSpecial: true }}
|
|
/>
|
|
),
|
|
},
|
|
],
|
|
{ initialEntries: ["/"] }
|
|
),
|
|
[requireEmailVerification]
|
|
);
|
|
|
|
return <RouterProvider router={router} />;
|
|
}
|