import { Trans } from "next-i18next"; import { useState } from "react"; import type { Dispatch, SetStateAction } from "react"; import { IntlProvider, FormattedNumber } from "react-intl"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Button, Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader, showToast, } from "@calcom/ui"; import { CreditCard, AlertTriangle } from "@calcom/ui/components/icon"; interface IRescheduleDialog { isOpenDialog: boolean; setIsOpenDialog: Dispatch>; bookingId: number; paymentAmount: number; paymentCurrency: string; } export const ChargeCardDialog = (props: IRescheduleDialog) => { const { t } = useLocale(); const utils = trpc.useContext(); const { isOpenDialog, setIsOpenDialog, bookingId } = props; const [chargeError, setChargeError] = useState(false); const chargeCardMutation = trpc.viewer.payments.chargeCard.useMutation({ onSuccess: () => { utils.viewer.bookings.invalidate(); setIsOpenDialog(false); showToast("Charge successful", "success"); }, onError: () => { setChargeError(true); }, }); return (

You are about to charge the attendee{" "} . Are you sure you want to continue?

{chargeError && (
)}
); };