import Link from "next/link"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { Toaster } from "react-hot-toast"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc"; import { Button, showToast, TextField } from "@calcom/ui"; export default function PayPalSetup() { const [newClientId, setNewClientId] = useState(""); const [newSecretKey, setNewSecretKey] = useState(""); const router = useRouter(); const { t } = useLocale(); const integrations = trpc.viewer.integrations.useQuery({ variant: "payment", appId: "paypal" }); const [paypalPaymentAppCredentials] = integrations.data?.items || []; const [credentialId] = paypalPaymentAppCredentials?.userCredentialIds || [-1]; const showContent = !!integrations.data && integrations.isSuccess && !!credentialId; const saveKeysMutation = trpc.viewer.appsRouter.updateAppCredentials.useMutation({ onSuccess: () => { showToast(t("keys_have_been_saved"), "success"); router.push("/event-types"); }, onError: (error) => { showToast(error.message, "error"); }, }); if (integrations.isLoading) { return
; } return (Paypal
Setup instructions