Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: derive edit-modal event defaults from the shared event list

InfisiCalvin967b4bffa5db
diff --git a/frontend/src/hooks/api/webhooks/types.ts b/frontend/src/hooks/api/webhooks/types.ts
index 3fd538d4ee..1ee87ce9bb 100644
--- a/frontend/src/hooks/api/webhooks/types.ts
+++ b/frontend/src/hooks/api/webhooks/types.ts
@@ -19,6 +19,10 @@ export type TWebhookEventMetadata = {
export const WEBHOOK_EVENTS = Object.values(WebhookEvent) as WebhookEvent[];
+export const DEFAULT_ENABLED_EVENTS = Object.fromEntries(
+ WEBHOOK_EVENTS.map((event) => [event, true])
+) as Record<WebhookEvent, boolean>;
+
export const WEBHOOK_EVENT_METADATA: Record<WebhookEvent, TWebhookEventMetadata> = {
[WebhookEvent.SecretRotationFailed]: {
label: "Secret Rotation Failed",
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/AddWebhookForm.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/AddWebhookForm.tsx
index e534440aa5..c1c26b241b 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/AddWebhookForm.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/AddWebhookForm.tsx
@@ -31,6 +31,7 @@ import {
SheetTitle
} from "@app/components/v3";
import {
+ DEFAULT_ENABLED_EVENTS,
WEBHOOK_EVENT_METADATA,
WEBHOOK_EVENTS,
WebhookEvent,
@@ -49,10 +50,6 @@ const EVENT_OPTIONS: TWebhookEventOption[] = WEBHOOK_EVENTS.map((event) => ({
description: WEBHOOK_EVENT_METADATA[event].description
}));
-const DEFAULT_ENABLED_EVENTS = Object.fromEntries(
- WEBHOOK_EVENTS.map((event) => [event, true])
-) as Record<WebhookEvent, boolean>;
-
const OptionWithDescription = (props: OptionProps<TWebhookEventOption>) => {
const { data, children, isSelected } = props;
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/EditWebhookEventsModal.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/EditWebhookEventsModal.tsx
index 5ef6315f07..aa79f28906 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/EditWebhookEventsModal.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/WebhooksTab/EditWebhookEventsModal.tsx
@@ -17,6 +17,7 @@ import {
FilterableSelect
} from "@app/components/v3";
import {
+ DEFAULT_ENABLED_EVENTS,
TWebhook,
WEBHOOK_EVENT_METADATA,
WEBHOOK_EVENTS,
@@ -79,14 +80,7 @@ export const EditWebhookEventsModal = ({
onOpenChange,
onSave
}: Props) => {
- const defaultSettings = useMemo<TWebhookEventSettings>(
- () => ({
- [WebhookEvent.SecretModified]: true,
- [WebhookEvent.SecretRotationFailed]: true,
- [WebhookEvent.HoneyTokenTriggered]: true
- }),
- []
- );
+ const defaultSettings = DEFAULT_ENABLED_EVENTS;
const [eventSettings, setEventSettings] = useState<TWebhookEventSettings>(defaultSettings);
useEffect(() => {