diff --git a/apps/web/pages/apps/[slug]/setup.tsx b/apps/web/pages/apps/[slug]/setup.tsx index 4cd7a56216..d72d29e2e2 100644 --- a/apps/web/pages/apps/[slug]/setup.tsx +++ b/apps/web/pages/apps/[slug]/setup.tsx @@ -2,8 +2,8 @@ import { GetStaticPaths, InferGetStaticPropsType } from "next"; import { useSession } from "next-auth/react"; import { useRouter } from "next/router"; +import { AppSetupPage } from "@calcom/app-store/_pages/setup"; import { getStaticProps } from "@calcom/app-store/_pages/setup/_getStaticProps"; -import { AppSetupPage } from "@calcom/app-store/_pages/v2/setup"; export default function SetupInformation(props: InferGetStaticPropsType) { const router = useRouter(); @@ -23,7 +23,7 @@ export default function SetupInformation(props: InferGetStaticPropsType; + return ; } export const getStaticPaths: GetStaticPaths = async () => { diff --git a/packages/app-store/_pages/v2/setup/_getStaticProps.tsx b/packages/app-store/_pages/v2/setup/_getStaticProps.tsx deleted file mode 100644 index 04e0d46ef6..0000000000 --- a/packages/app-store/_pages/v2/setup/_getStaticProps.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { GetStaticPropsContext } from "next"; - -export const AppSetupPageMap = { - zapier: import("../../../zapier/pages/setup/_getStaticProps"), -}; - -export const getStaticProps = async (ctx: GetStaticPropsContext) => { - const { slug } = ctx.params || {}; - if (typeof slug !== "string") return { notFound: true } as const; - - if (!(slug in AppSetupPageMap)) return { props: {} }; - - const page = await AppSetupPageMap[slug as keyof typeof AppSetupPageMap]; - - if (!page.getStaticProps) return { props: {} }; - - const props = await page.getStaticProps(ctx); - - return props; -}; diff --git a/packages/app-store/_pages/v2/setup/index.tsx b/packages/app-store/_pages/v2/setup/index.tsx deleted file mode 100644 index 4fa3a5e1ac..0000000000 --- a/packages/app-store/_pages/v2/setup/index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import dynamic from "next/dynamic"; - -import { DynamicComponent } from "../../../_components/DynamicComponent"; - -export const AppSetupMap = { - "apple-calendar-V2": dynamic(() => import("../../../applecalendar/pages/v2/setup")), - "exchange-V2": dynamic(() => import("../../../exchangecalendar/pages/v2/setup")), - "exchange2013-calendar-V2": dynamic(() => import("../../../exchange2013calendar/pages/v2/setup")), - "exchange2016-calendar-V2": dynamic(() => import("../../../exchange2016calendar/pages/v2/setup")), - "caldav-calendar-V2": dynamic(() => import("../../../caldavcalendar/pages/v2/setup")), - "zapier-V2": dynamic(() => import("../../../zapier/pages/v2/setup")), - "closecom-V2": dynamic(() => import("../../../closecomothercalendar/pages/v2/setup")), -}; - -export const AppSetupPage = (props: { slug: string }) => { - return componentMap={AppSetupMap} {...props} />; -}; - -export default AppSetupPage; diff --git a/packages/app-store/applecalendar/pages/setup/index.tsx b/packages/app-store/applecalendar/pages/setup/index.tsx index e657c22df1..20a21d526f 100644 --- a/packages/app-store/applecalendar/pages/setup/index.tsx +++ b/packages/app-store/applecalendar/pages/setup/index.tsx @@ -4,9 +4,7 @@ import { useForm } from "react-hook-form"; import { Toaster } from "react-hot-toast"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { Alert } from "@calcom/ui/Alert"; -import Button from "@calcom/ui/Button"; -import { Form, TextField } from "@calcom/ui/form/fields"; +import { Alert, Button, Form, TextField } from "@calcom/ui/v2"; export default function AppleCalendarSetup() { const { t } = useLocale(); diff --git a/packages/app-store/applecalendar/pages/v2/setup/index.tsx b/packages/app-store/applecalendar/pages/v2/setup/index.tsx deleted file mode 100644 index 20a21d526f..0000000000 --- a/packages/app-store/applecalendar/pages/v2/setup/index.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import { useRouter } from "next/router"; -import { useState } from "react"; -import { useForm } from "react-hook-form"; -import { Toaster } from "react-hot-toast"; - -import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { Alert, Button, Form, TextField } from "@calcom/ui/v2"; - -export default function AppleCalendarSetup() { - const { t } = useLocale(); - const router = useRouter(); - const form = useForm({ - defaultValues: { - username: "", - password: "", - }, - }); - - const [errorMessage, setErrorMessage] = useState(""); - - return ( -
-
-
-
- {/* eslint-disable @next/next/no-img-element */} - Apple Calendar -
-
-

{t("connect_apple_server")}

- -
- {t("apple_server_generate_password")}{" "} - - https://appleid.apple.com/account/manage - - . {t("credentials_stored_encrypted")} -
-
-
{ - setErrorMessage(""); - const res = await fetch("/api/integrations/applecalendar/add", { - method: "POST", - body: JSON.stringify(values), - headers: { - "Content-Type": "application/json", - }, - }); - const json = await res.json(); - if (!res.ok) { - setErrorMessage(json?.message || t("something_went_wrong")); - } else { - router.push(json.url); - } - }}> -
- - -
- - {errorMessage && } -
- - -
- -
-
-
-
- -
- ); -} diff --git a/packages/app-store/caldavcalendar/pages/setup/index.tsx b/packages/app-store/caldavcalendar/pages/setup/index.tsx index d9bf526e52..67219de946 100644 --- a/packages/app-store/caldavcalendar/pages/setup/index.tsx +++ b/packages/app-store/caldavcalendar/pages/setup/index.tsx @@ -4,9 +4,7 @@ import { useForm } from "react-hook-form"; import { Toaster } from "react-hot-toast"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { Alert } from "@calcom/ui/Alert"; -import Button from "@calcom/ui/Button"; -import { Form, TextField } from "@calcom/ui/form/fields"; +import { Alert, Button, Form, TextField } from "@calcom/ui/v2"; export default function CalDavCalendarSetup() { const { t } = useLocale(); diff --git a/packages/app-store/caldavcalendar/pages/v2/setup/index.tsx b/packages/app-store/caldavcalendar/pages/v2/setup/index.tsx deleted file mode 100644 index 67219de946..0000000000 --- a/packages/app-store/caldavcalendar/pages/v2/setup/index.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import { useRouter } from "next/router"; -import { useState } from "react"; -import { useForm } from "react-hook-form"; -import { Toaster } from "react-hot-toast"; - -import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { Alert, Button, Form, TextField } from "@calcom/ui/v2"; - -export default function CalDavCalendarSetup() { - const { t } = useLocale(); - const router = useRouter(); - const form = useForm({ - defaultValues: { - url: "", - username: "", - password: "", - }, - }); - - const [errorMessage, setErrorMessage] = useState(""); - - return ( -
-
-
-
- {/* eslint-disable @next/next/no-img-element */} - CalDav Calendar -
-
-

{t("connect_caldav_server")}

-
{t("credentials_stored_encrypted")}
-
-
{ - setErrorMessage(""); - const res = await fetch("/api/integrations/caldavcalendar/add", { - method: "POST", - body: JSON.stringify(values), - headers: { - "Content-Type": "application/json", - }, - }); - const json = await res.json(); - if (!res.ok) { - setErrorMessage(json?.message || t("something_went_wrong")); - } else { - router.push(json.url); - } - }}> -
- - - -
- - {errorMessage && } -
- - -
- -
-
-
-
- -
- ); -} diff --git a/packages/app-store/closecomothercalendar/pages/setup/index.tsx b/packages/app-store/closecomothercalendar/pages/setup/index.tsx index 5689eaacd5..6ce7ac746b 100644 --- a/packages/app-store/closecomothercalendar/pages/setup/index.tsx +++ b/packages/app-store/closecomothercalendar/pages/setup/index.tsx @@ -7,9 +7,7 @@ import { Toaster } from "react-hot-toast"; import z from "zod"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import Button from "@calcom/ui/v2/core/Button"; -import { Form, TextField } from "@calcom/ui/v2/core/form/fields"; -import showToast from "@calcom/ui/v2/core/notifications"; +import { Button, Form, showToast, TextField } from "@calcom/ui/v2"; const formSchema = z.object({ api_key: z.string(), diff --git a/packages/app-store/closecomothercalendar/pages/v2/setup/index.tsx b/packages/app-store/closecomothercalendar/pages/v2/setup/index.tsx deleted file mode 100644 index 6ce7ac746b..0000000000 --- a/packages/app-store/closecomothercalendar/pages/v2/setup/index.tsx +++ /dev/null @@ -1,155 +0,0 @@ -import { zodResolver } from "@hookform/resolvers/zod"; -import { useRouter } from "next/router"; -import { useState, useEffect } from "react"; -import { Check, X } from "react-feather"; -import { useForm, Controller } from "react-hook-form"; -import { Toaster } from "react-hot-toast"; -import z from "zod"; - -import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { Button, Form, showToast, TextField } from "@calcom/ui/v2"; - -const formSchema = z.object({ - api_key: z.string(), -}); - -export default function CloseComSetup() { - const { t } = useLocale(); - const router = useRouter(); - const [testPassed, setTestPassed] = useState(undefined); - const [testLoading, setTestLoading] = useState(false); - - const form = useForm<{ - api_key: string; - }>({ - resolver: zodResolver(formSchema), - }); - - useEffect(() => { - const timer = setTimeout(() => { - if (testPassed === false) { - setTestPassed(undefined); - } - }, 3000); - return () => clearTimeout(timer); - }, [testPassed]); - - return ( -
-
-
-
- {/* eslint-disable @next/next/no-img-element */} - Apple Calendar -
-
-

{t("provide_api_key")}

- -
- {t("generate_api_key_description")}{" "} - - Close.com - - . {t("it_stored_encrypted")} -
-
-
{ - const res = await fetch("/api/integrations/closecomothercalendar/add", { - method: "POST", - body: JSON.stringify(values), - headers: { - "Content-Type": "application/json", - }, - }); - const json = await res.json(); - - if (res.ok) { - router.push(json.url); - } else { - showToast(json.message, "error"); - } - }}> -
- ( - { - onChange(e.target.value); - form.setValue("api_key", e.target.value); - await form.trigger("api_key"); - }} - /> - )} - /> -
-
- - - -
-
-
-
-
-
- -
- ); -} diff --git a/packages/app-store/exchange2013calendar/pages/setup/index.tsx b/packages/app-store/exchange2013calendar/pages/setup/index.tsx index 4231fb93e2..73904caa78 100644 --- a/packages/app-store/exchange2013calendar/pages/setup/index.tsx +++ b/packages/app-store/exchange2013calendar/pages/setup/index.tsx @@ -4,9 +4,7 @@ import { useForm } from "react-hook-form"; import { Toaster } from "react-hot-toast"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { Alert } from "@calcom/ui/Alert"; -import Button from "@calcom/ui/Button"; -import { Form, TextField } from "@calcom/ui/form/fields"; +import { Alert, Button, Form, TextField } from "@calcom/ui/v2"; export default function Exchange2013CalendarSetup() { const { t } = useLocale(); diff --git a/packages/app-store/exchange2013calendar/pages/v2/setup/index.tsx b/packages/app-store/exchange2013calendar/pages/v2/setup/index.tsx deleted file mode 100644 index 73904caa78..0000000000 --- a/packages/app-store/exchange2013calendar/pages/v2/setup/index.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import { useRouter } from "next/router"; -import { useState } from "react"; -import { useForm } from "react-hook-form"; -import { Toaster } from "react-hot-toast"; - -import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { Alert, Button, Form, TextField } from "@calcom/ui/v2"; - -export default function Exchange2013CalendarSetup() { - const { t } = useLocale(); - const router = useRouter(); - const form = useForm({ - defaultValues: { - username: "", - password: "", - url: process.env.EXCHANGE_DEFAULT_EWS_URL || "", - }, - }); - - const [errorMessage, setErrorMessage] = useState(""); - - return ( -
-
-
- Exchange 2013 Calendar -
-
-

{t("add_exchange2013")}

-
{t("credentials_stored_encrypted")}
-
-
{ - setErrorMessage(""); - const res = await fetch("/api/integrations/exchange2013calendar/add", { - method: "POST", - body: JSON.stringify(values), - headers: { - "Content-Type": "application/json", - }, - }); - const json = await res.json(); - if (!res.ok) { - setErrorMessage(json?.message || t("something_went_wrong")); - } else { - router.push(json.url); - } - }}> -
- - - -
- - {errorMessage && } -
- - -
- -
-
-
- -
- ); -} diff --git a/packages/app-store/exchange2016calendar/pages/setup/index.tsx b/packages/app-store/exchange2016calendar/pages/setup/index.tsx index 63955daa7f..0179c9ef9d 100644 --- a/packages/app-store/exchange2016calendar/pages/setup/index.tsx +++ b/packages/app-store/exchange2016calendar/pages/setup/index.tsx @@ -4,9 +4,7 @@ import { useForm } from "react-hook-form"; import { Toaster } from "react-hot-toast"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { Alert } from "@calcom/ui/Alert"; -import Button from "@calcom/ui/Button"; -import { Form, TextField } from "@calcom/ui/form/fields"; +import { Alert, Button, Form, TextField } from "@calcom/ui/v2"; export default function Exchange2016CalendarSetup() { const { t } = useLocale(); diff --git a/packages/app-store/exchange2016calendar/pages/v2/setup/index.tsx b/packages/app-store/exchange2016calendar/pages/v2/setup/index.tsx deleted file mode 100644 index 0179c9ef9d..0000000000 --- a/packages/app-store/exchange2016calendar/pages/v2/setup/index.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import { useRouter } from "next/router"; -import { useState } from "react"; -import { useForm } from "react-hook-form"; -import { Toaster } from "react-hot-toast"; - -import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { Alert, Button, Form, TextField } from "@calcom/ui/v2"; - -export default function Exchange2016CalendarSetup() { - const { t } = useLocale(); - const router = useRouter(); - const form = useForm({ - defaultValues: { - username: "", - password: "", - url: process.env.EXCHANGE_DEFAULT_EWS_URL || "", - }, - }); - - const [errorMessage, setErrorMessage] = useState(""); - - return ( -
-
-
- Exchange 2016 Calendar -
-
-

{t("add_exchange2016")}

-
{t("credentials_stored_encrypted")}
-
-
{ - setErrorMessage(""); - const res = await fetch("/api/integrations/exchange2016calendar/add", { - method: "POST", - body: JSON.stringify(values), - headers: { - "Content-Type": "application/json", - }, - }); - const json = await res.json(); - if (!res.ok) { - setErrorMessage(json?.message || t("something_went_wrong")); - } else { - router.push(json.url); - } - }}> -
- - - -
- - {errorMessage && } -
- - -
- -
-
-
- -
- ); -} diff --git a/packages/app-store/exchangecalendar/pages/setup/index.tsx b/packages/app-store/exchangecalendar/pages/setup/index.tsx index 4f0750f353..101b76492c 100644 --- a/packages/app-store/exchangecalendar/pages/setup/index.tsx +++ b/packages/app-store/exchangecalendar/pages/setup/index.tsx @@ -6,9 +6,16 @@ import { Toaster } from "react-hot-toast"; import z from "zod"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import { Button, Select, Switch } from "@calcom/ui"; -import { Alert } from "@calcom/ui/Alert"; -import { EmailField, Form, Label, PasswordField, TextField } from "@calcom/ui/form/fields"; +import { + Alert, + Button, + EmailField, + Form, + PasswordField, + TextField, + SelectField, + Switch, +} from "@calcom/ui/v2"; import { ExchangeAuthentication } from "../../enums"; @@ -42,16 +49,16 @@ export default function ExchangeSetup() { { value: ExchangeAuthentication.STANDARD, label: t("exchange_authentication_standard") }, { value: ExchangeAuthentication.NTLM, label: t("exchange_authentication_ntlm") }, ]; - return ( <>
-
+
+ {/* eslint-disable @next/next/no-img-element */} Microsoft Exchange Calendar
@@ -98,24 +105,21 @@ export default function ExchangeSetup() { label={t("password")} autoComplete="password" /> -
- - ( -