import { FC } from "react"; import { Controller, useForm } from "react-hook-form"; import { Copy } from "lucide-react"; import { IFormattedInstanceConfiguration } from "@plane/types"; // ui import { Button, Input, TOAST_TYPE, setToast } from "@plane/ui"; // types import { useApplication } from "@/hooks/store"; // hooks export interface IInstanceGoogleConfigForm { config: IFormattedInstanceConfiguration; } export interface GoogleConfigFormValues { GOOGLE_CLIENT_ID: string; GOOGLE_CLIENT_SECRET: string; } export const InstanceGoogleConfigForm: FC = (props) => { const { config } = props; // store hooks const { instance: instanceStore } = useApplication(); // form data const { handleSubmit, control, formState: { errors, isSubmitting }, } = useForm({ defaultValues: { GOOGLE_CLIENT_ID: config["GOOGLE_CLIENT_ID"], GOOGLE_CLIENT_SECRET: config["GOOGLE_CLIENT_SECRET"], }, }); const onSubmit = async (formData: GoogleConfigFormValues) => { const payload: Partial = { ...formData }; await instanceStore .updateInstanceConfigurations(payload) .then(() => setToast({ title: "Success!", type: TOAST_TYPE.SUCCESS, message: "Google Configuration Settings updated successfully", }) ) .catch((err) => console.error(err)); }; const originURL = typeof window !== "undefined" ? window.location.origin : ""; return (

Client ID

( )} />

Your client ID lives in your Google API Console.{" "} Learn more

JavaScript origin URL

We will auto-generate this. Paste this into your Authorized JavaScript origins field. For this OAuth client{" "} here.

); };