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 (
{t(`${copyKey}.description`, { workspaceName })} {t(`${copyKey}.secureNote`)}{t(`${copyKey}.title`)}