From 35cf88d9a66fbc93afa23ee8668653a64dea6dad Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Tue, 18 Feb 2025 15:47:50 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20submit=20event=20type=20in?= =?UTF-8?q?=20PaymentForm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blocks/inputs/payment/components/StripePaymentForm.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/embeds/js/src/features/blocks/inputs/payment/components/StripePaymentForm.tsx b/packages/embeds/js/src/features/blocks/inputs/payment/components/StripePaymentForm.tsx index 79dea7ad6..3d1420e7a 100644 --- a/packages/embeds/js/src/features/blocks/inputs/payment/components/StripePaymentForm.tsx +++ b/packages/embeds/js/src/features/blocks/inputs/payment/components/StripePaymentForm.tsx @@ -20,7 +20,7 @@ type Props = { const slotName = "stripe-payment-form"; -let paymentElementSlot: HTMLSlotElement; +let paymentElementSlot: HTMLSlotElement | undefined; let stripe: Stripe | null = null; let elements: StripeElements | null = null; @@ -30,6 +30,7 @@ export const StripePaymentForm = (props: Props) => { const [isLoading, setIsLoading] = createSignal(false); onMount(async () => { + if (!paymentElementSlot) return; initShadowMountPoint(paymentElementSlot); if (!props.options?.publicKey) return setMessage("Missing Stripe public key"); @@ -56,7 +57,7 @@ export const StripePaymentForm = (props: Props) => { }, 1000); }); - const handleSubmit = async (event: Event & { submitter: HTMLElement }) => { + const handleSubmit = async (event: SubmitEvent) => { event.preventDefault(); if (!stripe || !elements) return;