From 4e6b7c13a43ae07bcfee1319f5ae2da76a282383 Mon Sep 17 00:00:00 2001 From: Andrew Aliaj Date: Wed, 14 Aug 2024 18:10:23 -0400 Subject: [PATCH 1/4] added missing dependies to useEffect React Hook --- pages/well-known/saml-configuration.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pages/well-known/saml-configuration.tsx b/pages/well-known/saml-configuration.tsx index ca890a8dd..905252c30 100644 --- a/pages/well-known/saml-configuration.tsx +++ b/pages/well-known/saml-configuration.tsx @@ -17,7 +17,8 @@ const SPConfig: NextPageWithLayout< if (jacksonEnv.selfHosted) { window.location.href = `${jacksonEnv.externalUrl}/.well-known/saml-configuration`; } - }, []); + }, [jacksonEnv.externalUrl, jacksonEnv.selfHosted]); + if (jacksonEnv.selfHosted) { return null; From 9d5b0b4260901f7c2139956edf5368d708f54c7c Mon Sep 17 00:00:00 2001 From: Andrew Aliaj Date: Tue, 20 Aug 2024 17:03:05 -0400 Subject: [PATCH 2/4] npm run format --- pages/well-known/saml-configuration.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/pages/well-known/saml-configuration.tsx b/pages/well-known/saml-configuration.tsx index 905252c30..b9a040c56 100644 --- a/pages/well-known/saml-configuration.tsx +++ b/pages/well-known/saml-configuration.tsx @@ -18,7 +18,6 @@ const SPConfig: NextPageWithLayout< window.location.href = `${jacksonEnv.externalUrl}/.well-known/saml-configuration`; } }, [jacksonEnv.externalUrl, jacksonEnv.selfHosted]); - if (jacksonEnv.selfHosted) { return null; From 0afcb5be736c99b73f7fb80a297aadc275048305 Mon Sep 17 00:00:00 2001 From: Andrew Aliaj Date: Mon, 9 Sep 2024 07:48:00 -0400 Subject: [PATCH 3/4] fixed WebhookFormSchema type variable --- components/webhook/CreateWebhook.tsx | 6 +++--- components/webhook/EditWebhook.tsx | 6 +++--- components/webhook/EventTypes.tsx | 4 ++-- components/webhook/Form.tsx | 8 ++++---- next-env.d.ts | 2 +- types/base.ts | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/webhook/CreateWebhook.tsx b/components/webhook/CreateWebhook.tsx index b0470ecc0..db8f232f3 100644 --- a/components/webhook/CreateWebhook.tsx +++ b/components/webhook/CreateWebhook.tsx @@ -5,7 +5,7 @@ import { useTranslation } from 'next-i18next'; import React from 'react'; import toast from 'react-hot-toast'; import type { ApiResponse } from 'types'; -import type { WebookFormSchema } from 'types'; +import type { WebhookFormSchema } from 'types'; import ModalForm from './Form'; import { defaultHeaders } from '@/lib/common'; @@ -23,8 +23,8 @@ const CreateWebhook = ({ const { t } = useTranslation('common'); const onSubmit = async ( - values: WebookFormSchema, - formikHelpers: FormikHelpers + values: WebhookFormSchema, + formikHelpers: FormikHelpers ) => { const response = await fetch(`/api/teams/${team.slug}/webhooks`, { method: 'POST', diff --git a/components/webhook/EditWebhook.tsx b/components/webhook/EditWebhook.tsx index 5c549c8a2..8bc326458 100644 --- a/components/webhook/EditWebhook.tsx +++ b/components/webhook/EditWebhook.tsx @@ -7,7 +7,7 @@ import { useTranslation } from 'next-i18next'; import React from 'react'; import toast from 'react-hot-toast'; import type { EndpointOut } from 'svix'; -import type { WebookFormSchema } from 'types'; +import type { WebhookFormSchema} from 'types'; import type { ApiResponse } from 'types'; import ModalForm from './Form'; @@ -37,8 +37,8 @@ const EditWebhook = ({ } const onSubmit = async ( - values: WebookFormSchema, - formikHelpers: FormikHelpers + values: WebhookFormSchema, + formikHelpers: FormikHelpers ) => { const response = await fetch( `/api/teams/${team.slug}/webhooks/${endpoint.id}`, diff --git a/components/webhook/EventTypes.tsx b/components/webhook/EventTypes.tsx index cb0850765..d71c2b5a1 100644 --- a/components/webhook/EventTypes.tsx +++ b/components/webhook/EventTypes.tsx @@ -1,6 +1,6 @@ import { eventTypes } from '@/lib/common'; import React, { ReactElement } from 'react'; -import type { WebookFormSchema } from 'types'; +import type {WebhookFormSchema } from 'types'; import { Checkbox } from '../shared'; const EventTypes = ({ @@ -9,7 +9,7 @@ const EventTypes = ({ error, }: { onChange: React.ChangeEventHandler; - values: WebookFormSchema['eventTypes']; + values: WebhookFormSchema['eventTypes']; error: string | string[] | undefined; }) => { const events: ReactElement[] = []; diff --git a/components/webhook/Form.tsx b/components/webhook/Form.tsx index 19f6732a8..92f7a0e74 100644 --- a/components/webhook/Form.tsx +++ b/components/webhook/Form.tsx @@ -4,7 +4,7 @@ import { useFormik } from 'formik'; import { useTranslation } from 'next-i18next'; import React from 'react'; import { Button } from 'react-daisyui'; -import type { WebookFormSchema } from 'types'; +import type { WebhookFormSchema } from 'types'; import * as Yup from 'yup'; import Modal from '../shared/Modal'; import { EventTypes } from '@/components/webhook'; @@ -13,8 +13,8 @@ import { maxLengthPolicies } from '@/lib/common'; interface FormProps { visible: boolean; setVisible: (visible: boolean) => void; - initialValues: WebookFormSchema; - onSubmit: FormikConfig['onSubmit']; + initialValues: WebhookFormSchema; + onSubmit: FormikConfig['onSubmit']; title: string; editMode?: boolean; } @@ -27,7 +27,7 @@ const Form = ({ title, editMode = false, }: FormProps) => { - const formik = useFormik({ + const formik = useFormik({ validationSchema: Yup.object().shape({ name: Yup.string().required().max(maxLengthPolicies.webhookDescription), url: Yup.string().required().url().max(maxLengthPolicies.webhookEndpoint), diff --git a/next-env.d.ts b/next-env.d.ts index 4f11a03dc..a4a7b3f5c 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. +// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. diff --git a/types/base.ts b/types/base.ts index a90a1e990..85ffb4654 100644 --- a/types/base.ts +++ b/types/base.ts @@ -24,7 +24,7 @@ export type TeamWithMemberCount = Prisma.TeamGetPayload<{ }; }>; -export type WebookFormSchema = { +export type WebhookFormSchema = { name: string; url: string; eventTypes: string[]; From 4e3ef5c7745467148ebf9be462fe393e7f28d328 Mon Sep 17 00:00:00 2001 From: Andrew Aliaj Date: Tue, 10 Sep 2024 08:09:44 -0400 Subject: [PATCH 4/4] ran npm run format --- components/webhook/EditWebhook.tsx | 2 +- components/webhook/EventTypes.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/webhook/EditWebhook.tsx b/components/webhook/EditWebhook.tsx index 8bc326458..a9e5dc459 100644 --- a/components/webhook/EditWebhook.tsx +++ b/components/webhook/EditWebhook.tsx @@ -7,7 +7,7 @@ import { useTranslation } from 'next-i18next'; import React from 'react'; import toast from 'react-hot-toast'; import type { EndpointOut } from 'svix'; -import type { WebhookFormSchema} from 'types'; +import type { WebhookFormSchema } from 'types'; import type { ApiResponse } from 'types'; import ModalForm from './Form'; diff --git a/components/webhook/EventTypes.tsx b/components/webhook/EventTypes.tsx index d71c2b5a1..8a5a180f8 100644 --- a/components/webhook/EventTypes.tsx +++ b/components/webhook/EventTypes.tsx @@ -1,6 +1,6 @@ import { eventTypes } from '@/lib/common'; import React, { ReactElement } from 'react'; -import type {WebhookFormSchema } from 'types'; +import type { WebhookFormSchema } from 'types'; import { Checkbox } from '../shared'; const EventTypes = ({