typescript-typenfehler behoben.. npm run lint läuft nun fehlerfrei durch.

This commit is contained in:
Codex Agent
2025-11-22 11:49:47 +01:00
parent 6c78d7e281
commit eb41cb6194
74 changed files with 469 additions and 396 deletions

View File

@@ -39,7 +39,7 @@ export const AuthStep: React.FC<AuthStepProps> = ({ privacyHtml, googleProfile,
const page = usePage<{ locale?: string }>();
const locale = page.props.locale ?? "de";
const googleAuth = useMemo<GoogleAuthFlash>(() => {
const props = page.props as Record<string, any>;
const props = page.props as { googleAuth?: GoogleAuthFlash };
return props.googleAuth ?? {};
}, [page.props]);
const { isAuthenticated, authUser, setAuthUser, nextStep, selectedPackage } = useCheckoutWizard();

View File

@@ -8,10 +8,9 @@ import { cn } from "@/lib/utils";
interface ConfirmationStepProps {
onViewProfile?: () => void;
onGoToAdmin?: () => void;
}
export const ConfirmationStep: React.FC<ConfirmationStepProps> = ({ onViewProfile, onGoToAdmin }) => {
export const ConfirmationStep: React.FC<ConfirmationStepProps> = ({ onViewProfile }) => {
const { t } = useTranslation('marketing');
const { selectedPackage } = useCheckoutWizard();
const handleProfile = React.useCallback(() => {
@@ -22,14 +21,6 @@ export const ConfirmationStep: React.FC<ConfirmationStepProps> = ({ onViewProfil
window.location.href = '/settings/profile';
}, [onViewProfile]);
const handleAdmin = React.useCallback(() => {
if (typeof onGoToAdmin === 'function') {
onGoToAdmin();
return;
}
window.location.href = '/event-admin';
}, [onGoToAdmin]);
const packageName = selectedPackage?.name ?? '';
const onboardingItems = [

View File

@@ -149,17 +149,10 @@ export const PackageStep: React.FC = () => {
const { t } = useTranslation('marketing');
const { selectedPackage, packageOptions, setSelectedPackage, resetPaymentState } = useCheckoutWizard();
// Early return if no package is selected
if (!selectedPackage) {
return (
<div className="text-center py-8">
<p className="text-muted-foreground">{t('checkout.package_step.no_package_selected')}</p>
</div>
);
}
const comparablePackages = useMemo(() => {
if (!selectedPackage) {
return [];
}
// Filter by type and sort: free packages first, then by price ascending
return packageOptions
.filter((pkg: CheckoutPackage) => pkg.type === selectedPackage.type)
@@ -180,6 +173,14 @@ export const PackageStep: React.FC = () => {
resetPaymentState();
};
if (!selectedPackage) {
return (
<div className="text-center py-8">
<p className="text-muted-foreground">{t('checkout.package_step.no_package_selected')}</p>
</div>
);
}
return (
<div className="grid gap-8 lg:grid-cols-[2fr_1fr]">
<div className="space-y-6">

View File

@@ -139,7 +139,7 @@ export const PaymentStep: React.FC = () => {
const [couponLoading, setCouponLoading] = useState(false);
const paddleRef = useRef<typeof window.Paddle | null>(null);
const checkoutContainerRef = useRef<HTMLDivElement | null>(null);
const eventCallbackRef = useRef<(event: any) => void>();
const eventCallbackRef = useRef<(event: Record<string, unknown>) => void>();
const hasAutoAppliedCoupon = useRef(false);
const checkoutContainerClass = 'paddle-checkout-container';
@@ -149,7 +149,6 @@ export const PaymentStep: React.FC = () => {
}, [i18n.language]);
const isFree = useMemo(() => (selectedPackage ? Number(selectedPackage.price) <= 0 : false), [selectedPackage]);
const hasCoupon = Boolean(couponPreview);
const applyCoupon = useCallback(async (code: string) => {
if (!selectedPackage) {
@@ -339,7 +338,7 @@ export const PaymentStep: React.FC = () => {
console.info('[Checkout] Hosted checkout response', { status: response.status, rawBody });
}
let data: any = null;
let data: { checkout_url?: string; message?: string } | null = null;
try {
data = rawBody && rawBody.trim().startsWith('{') ? JSON.parse(rawBody) : null;
} catch (parseError) {
@@ -354,7 +353,7 @@ export const PaymentStep: React.FC = () => {
if (/^https?:\/\//i.test(trimmed)) {
checkoutUrl = trimmed;
} else if (trimmed.startsWith('<')) {
const match = trimmed.match(/https?:\/\/["'a-zA-Z0-9._~:\/?#\[\]@!$&'()*+,;=%-]+/);
const match = trimmed.match(/https?:\/\/["'a-zA-Z0-9._~:/?#@!$&'()*+,;=%-]+/);
if (match) {
checkoutUrl = match[0];
}
@@ -444,7 +443,7 @@ export const PaymentStep: React.FC = () => {
locale: paddleLocale,
},
},
eventCallback: (event: any) => eventCallbackRef.current?.(event),
eventCallback: (event: Record<string, unknown>) => eventCallbackRef.current?.(event),
});
inlineReady = true;