import { useTranslation } from "react-i18next"; import { FeatherArrowRight, FeatherCheckCircle, FeatherCreditCard, FeatherMail, FeatherRefreshCw, FeatherShieldCheck } from "@subframe/core"; import Logo from "~/components/brand/Logo"; import { BadgeFeedback } from "~/ui/components/BadgeFeedback"; import { Button } from "~/ui/components/Button"; import { Card } from "~/ui/components/Card"; import { EmptyState } from "~/ui/components/EmptyState"; import { IconWithBackground } from "~/ui/components/IconWithBackground"; import { Loader } from "~/ui/components/Loader"; import { StepperHorizontal } from "~/ui/components/StepperHorizontal"; export type CheckoutSuccessPageProps = { readonly state: "success" | "processing" | "cancelled" | "failed" | "expired" | "error" | "invalid"; readonly activationKind: "paid" | "trial" | "confirmed"; readonly homeHref: string; readonly workspaceName: string; readonly planTitle?: string; readonly formattedPrice?: string | null; readonly interval?: string | null; readonly nextInvoice?: string | null; readonly emailMarketingFollowUpTitle?: string | null; readonly errorMessage?: string; readonly actions: { readonly onStartSetup: () => void; readonly onOpenBilling: () => void; readonly onRetry: () => void; readonly onRestartCheckout: () => void; readonly onOpenEmailMarketingFollowUp?: () => void; }; }; export function CheckoutSuccessPage({ state, activationKind, homeHref, workspaceName, planTitle, formattedPrice, interval, nextInvoice, emailMarketingFollowUpTitle, errorMessage, actions, }: CheckoutSuccessPageProps) { const { t } = useTranslation(); const copyKey = `settings.subscription.checkout.success.${activationKind}`; if (state !== "success") { const stateCopyKey = `settings.subscription.checkout.success.${state}`; const canRetry = state !== "invalid"; const requiresNewCheckout = state === "cancelled" || state === "failed" || state === "expired"; return (
{state === "processing" ? (
{t(`${stateCopyKey}.title`)} {t(`${stateCopyKey}.body`)}
) : ( {t(`${stateCopyKey}.title`)} } body={errorMessage || t(`${stateCopyKey}.body`)} action={
{canRetry ? ( ) : null}
} /> )}
); } return (
} /> {t(`${copyKey}.badge`)}

{t(`${copyKey}.title`)}

{t(`${copyKey}.description`, { workspaceName })}

} /> {t("settings.subscription.checkout.success.orderSummary")}
{t(`${copyKey}.status`)}
{formattedPrice ? : null} {nextInvoice ? : null}
} />

{t(`${copyKey}.secureNote`)}

{emailMarketingFollowUpTitle && actions.onOpenEmailMarketingFollowUp ? (
} />
{t("settings.subscription.checkout.success.emailMarketingFollowUp.title")} {t("settings.subscription.checkout.success.emailMarketingFollowUp.description", { package: emailMarketingFollowUpTitle })}
) : null}
); } function ReceiptRow({ label, value }: { readonly label: string; readonly value: string }) { return (
{label} {value}
); }