feat: Complete checkout overhaul with Stripe PaymentIntent integration and abandoned cart recovery

This commit is contained in:
Codex Agent
2025-10-07 22:25:03 +02:00
parent dd5545605c
commit aa8c6c67c5
38 changed files with 1848 additions and 878 deletions

View File

@@ -23,6 +23,7 @@ interface RegisterFormProps {
export default function RegisterForm({ packageId, onSuccess, privacyHtml, locale }: RegisterFormProps) {
const [privacyOpen, setPrivacyOpen] = useState(false);
const [hasTriedSubmit, setHasTriedSubmit] = useState(false);
const [isSubmitting, setIsSubmitting] = useState(false);
const { t } = useTranslation(['auth', 'common']);
const page = usePage<{ errors: Record<string, string>; locale?: string; auth?: { user?: any | null } }>();
const resolvedLocale = locale ?? page.props.locale ?? 'de';
@@ -46,18 +47,8 @@ export default function RegisterForm({ packageId, onSuccess, privacyHtml, locale
}
}, [errors, hasTriedSubmit]);
const registerEndpoint = useMemo(() => {
if (typeof route === 'function') {
try {
return route('checkout.register');
} catch (error) {
// ignore ziggy errors and fall back
}
}
return `/${resolvedLocale}/register`;
}, [resolvedLocale]);
const registerEndpoint = '/checkout/register';
const submit = async (event: React.FormEvent) => {
event.preventDefault();
setHasTriedSubmit(true);
@@ -71,6 +62,7 @@ export default function RegisterForm({ packageId, onSuccess, privacyHtml, locale
};
try {
const response = await fetch(registerEndpoint, {
method: 'POST',
headers: {