Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

Hide event-level webhook types in event context

Dave Earley98b7a628f789
diff --git a/frontend/src/components/forms/WebhookForm/index.tsx b/frontend/src/components/forms/WebhookForm/index.tsx
index 878240a52..74e45639d 100644
--- a/frontend/src/components/forms/WebhookForm/index.tsx
+++ b/frontend/src/components/forms/WebhookForm/index.tsx
@@ -10,9 +10,12 @@ interface WebhookFormProps {
event_types: string[];
status: 'ENABLED' | 'PAUSED';
}>;
+ isEventContext?: boolean;
}
-export const WebhookForm = ({ form }: WebhookFormProps) => {
+const EVENT_LEVEL_TYPES = ['event.created', 'event.updated', 'event.archived'];
+
+export const WebhookForm = ({ form, isEventContext = false }: WebhookFormProps) => {
const statusOptions: ItemProps[] = [
{
icon: <IconWebhook />,
@@ -143,7 +146,10 @@ export const WebhookForm = ({ form }: WebhookFormProps) => {
required
form={form}
name="event_types"
- optionList={eventTypeOptions}
+ optionList={isEventContext
+ ? eventTypeOptions.filter(o => !EVENT_LEVEL_TYPES.includes(o.value as string))
+ : eventTypeOptions
+ }
multiple
/>
diff --git a/frontend/src/components/modals/CreateWebhookModal/index.tsx b/frontend/src/components/modals/CreateWebhookModal/index.tsx
index 9dacd4a19..ce8960e66 100644
--- a/frontend/src/components/modals/CreateWebhookModal/index.tsx
+++ b/frontend/src/components/modals/CreateWebhookModal/index.tsx
@@ -56,7 +56,7 @@ export const CreateWebhookModal = ({onClose}: GenericModalProps) => {
heading={t`Create Webhook`}
>
<form onSubmit={form.onSubmit(handleSubmit)}>
- <WebhookForm form={form}/>
+ <WebhookForm form={form} isEventContext/>
<Button
type="submit"
fullWidth
diff --git a/frontend/src/components/modals/EditWebhookModal/index.tsx b/frontend/src/components/modals/EditWebhookModal/index.tsx
index 4ba1d4184..330d0daec 100644
--- a/frontend/src/components/modals/EditWebhookModal/index.tsx
+++ b/frontend/src/components/modals/EditWebhookModal/index.tsx
@@ -78,7 +78,7 @@ export const EditWebhookModal = ({
{webhook && (
<form onSubmit={form.onSubmit(handleSubmit)}>
- <WebhookForm form={form}/>
+ <WebhookForm form={form} isEventContext/>
<Button
type={'submit'}
fullWidth