refactor: Webhooks (#12487)

Closes #12303

### What’s Changed
- Replace auto‐save with explicit Save / Cancel
Webhook forms now use manual “Save” and “Cancel” buttons instead of the
old debounced auto‐save/update.

- Separate “New” and “Detail” routes
Two dedicated paths `/settings/webhooks/new` for creation and
/`settings/webhooks/:webhookId` for editing, making the UX clearer.

- URL hint & normalization
If a user omits the http(s):// scheme, we display a “Will be saved as
https://…” hint and automatically default to HTTPS.

- Centralized validation with Zod
Introduced a `webhookFormSchema` for client‐side URL, operations, and
secret validation.

- Storybook coverage
Added stories for both “New Webhook” and “Webhook Detail”

- Unit tests
Added tests for the new `useWebhookForm` hook
This commit is contained in:
nitin
2025-06-13 11:07:25 +05:30
committed by GitHub
parent b160871227
commit 3d57c90e04
89 changed files with 3465 additions and 1679 deletions

View File

@ -449,8 +449,8 @@ msgstr "All ({relationRecordsCount})"
#. js-lingui-id: 9ljU00
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "All Actions"
msgstr "All Actions"
#~ msgid "All Actions"
#~ msgstr "All Actions"
#. js-lingui-id: 7EZqN0
#: src/modules/settings/accounts/components/SettingsAccountsRowDropdownMenu.tsx
@ -464,8 +464,8 @@ msgstr "All lines"
#. js-lingui-id: aFE/OW
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "All Objects"
msgstr "All Objects"
#~ msgid "All Objects"
#~ msgstr "All Objects"
#. js-lingui-id: Hm90t3
#: src/modules/settings/roles/components/SettingsRolesList.tsx
@ -508,7 +508,7 @@ msgid "An error occurred while updating password"
msgstr "An error occurred while updating password"
#. js-lingui-id: mJ6m4C
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "An optional description"
msgstr "An optional description"
@ -917,8 +917,8 @@ msgstr "Chinese — Traditional"
#. js-lingui-id: JEFFOR
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "Choose an object"
msgstr "Choose an object"
#~ msgid "Choose an object"
#~ msgstr "Choose an object"
#. js-lingui-id: Qz73jD
#: src/modules/settings/security/components/SSO/SettingsSSOIdentitiesProvidersForm.tsx
@ -1310,8 +1310,8 @@ msgstr "Create your workspace"
#. js-lingui-id: d+F6q9
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "Created"
msgstr "Created"
#~ msgid "Created"
#~ msgstr "Created"
#. js-lingui-id: R3PLzn
#: src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownCurrencySelect.tsx
@ -1380,11 +1380,11 @@ msgid "Czech"
msgstr "Czech"
#. js-lingui-id: Zz6Cxn
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx
#: src/pages/settings/data-model/SettingsObjectFieldEdit.tsx
#: src/modules/settings/profile/components/DeleteWorkspace.tsx
#: src/modules/settings/profile/components/DeleteAccount.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
#: src/modules/settings/data-model/object-details/components/tabs/ObjectSettings.tsx
msgid "Danger zone"
msgstr "Danger zone"
@ -1521,12 +1521,13 @@ msgid "Define what will be visible to other users in your workspace"
msgstr "Define what will be visible to other users in your workspace"
#. js-lingui-id: cnGeoo
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx
#: src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx
#: src/modules/views/view-picker/components/ViewPickerOptionDropdown.tsx
#: src/modules/views/view-picker/components/ViewPickerCreateButton.tsx
#: src/modules/settings/security/components/SSO/SettingsSecuritySSORowDropdownMenu.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
#: src/modules/settings/data-model/object-details/components/SettingsObjectFieldDisabledActionDropdown.tsx
#: src/modules/action-menu/mock/action-menu-actions.mock.tsx
#: src/modules/action-menu/mock/action-menu-actions.mock.tsx
@ -1580,19 +1581,22 @@ msgid "Delete Records on All Objects"
msgstr "Delete Records on All Objects"
#. js-lingui-id: T6S2Ns
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx
msgid "Delete this integration"
msgstr "Delete this integration"
#. js-lingui-id: KSOhjo
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Delete this webhook"
msgstr "Delete this webhook"
#. js-lingui-id: aRG49z
#: src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx
msgid "Delete view"
msgstr "Delete view"
#. js-lingui-id: snMaH4
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Delete webhook"
msgstr "Delete webhook"
@ -1619,8 +1623,8 @@ msgstr "Delete your whole workspace"
#. js-lingui-id: vGjmyl
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "Deleted"
msgstr "Deleted"
#~ msgid "Deleted"
#~ msgstr "Deleted"
#. js-lingui-id: kcGoDz
#: src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx
@ -1654,10 +1658,10 @@ msgid "Descending"
msgstr "Descending"
#. js-lingui-id: Nu4oKW
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/pages/settings/data-model/SettingsObjectFieldEdit.tsx
#: src/pages/settings/data-model/SettingsObjectNewField/SettingsObjectNewFieldConfigure.tsx
#: src/modules/settings/roles/role-permissions/settings-permissions/components/SettingsRolePermissionsSettingsTableHeader.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Description"
msgstr "Description"
@ -1945,7 +1949,7 @@ msgid "Empty Object"
msgstr "Empty Object"
#. js-lingui-id: T3juzf
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Endpoint URL"
msgstr "Endpoint URL"
@ -2324,7 +2328,7 @@ msgid "Filter"
msgstr "Filter"
#. js-lingui-id: cSev+j
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Filters"
msgstr "Filters"
@ -2608,6 +2612,11 @@ msgstr "How you'll be identified on the app."
msgid "How your system is doing"
msgstr "How your system is doing"
#. js-lingui-id: 0yRnXS
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "https://example.com/webhook"
msgstr "https://example.com/webhook"
#. js-lingui-id: mkWad2
#: src/pages/settings/profile/appearance/components/LocalePicker.tsx
msgid "Hungarian"
@ -3356,6 +3365,7 @@ msgstr "Navigate to previous workflow"
#. js-lingui-id: isRobC
#: src/pages/settings/data-model/SettingsNewObject.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "New"
msgstr "New"
@ -3740,10 +3750,15 @@ msgstr "Opened"
msgid "Opportunities"
msgstr "Opportunities"
#. js-lingui-id: hY8F2i
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Optional secret used to compute the HMAC signature for webhook payloads"
msgstr "Optional secret used to compute the HMAC signature for webhook payloads"
#. js-lingui-id: qNELak
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "Optional: Define a secret string that we will include in every webhook. Use this to authenticate and verify the webhook upon receipt."
msgstr "Optional: Define a secret string that we will include in every webhook. Use this to authenticate and verify the webhook upon receipt."
#~ msgid "Optional: Define a secret string that we will include in every webhook. Use this to authenticate and verify the webhook upon receipt."
#~ msgstr "Optional: Define a secret string that we will include in every webhook. Use this to authenticate and verify the webhook upon receipt."
#. js-lingui-id: 0zpgxV
#: src/modules/settings/roles/components/SettingsRolesDefaultRole.tsx
@ -3907,8 +3922,8 @@ msgstr "Playground"
#. js-lingui-id: jEw0Mr
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "Please enter a valid URL"
msgstr "Please enter a valid URL"
#~ msgid "Please enter a valid URL"
#~ msgstr "Please enter a valid URL"
#. js-lingui-id: X5x85V
#: src/modules/settings/admin-panel/components/SettingsAdminWorkspaceContent.tsx
@ -3920,10 +3935,15 @@ msgstr "Please search for a user first"
msgid "Please type \"{confirmationValue}\" to confirm you want to delete this API Key. Be aware that any script using this key will stop working."
msgstr "Please type \"{confirmationValue}\" to confirm you want to delete this API Key. Be aware that any script using this key will stop working."
#. js-lingui-id: GbtYRD
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Please type \"yes\" to confirm you want to delete this webhook."
msgstr "Please type \"yes\" to confirm you want to delete this webhook."
#. js-lingui-id: mFZTXr
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "Please type {confirmationText} to confirm you want to delete this webhook."
msgstr "Please type {confirmationText} to confirm you want to delete this webhook."
#~ msgid "Please type {confirmationText} to confirm you want to delete this webhook."
#~ msgstr "Please type {confirmationText} to confirm you want to delete this webhook."
#. js-lingui-id: aRWD63
#: src/pages/settings/data-model/SettingsObjectNewField/SettingsObjectNewFieldConfigure.tsx
@ -4359,10 +4379,15 @@ msgid "Seats"
msgstr "Seats"
#. js-lingui-id: 8VEDbV
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Secret"
msgstr "Secret"
#. js-lingui-id: e1v+J3
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Secret (optional)"
msgstr "Secret (optional)"
#. js-lingui-id: a3LDKx
#: src/pages/settings/security/SettingsSecuritySSOIdentifyProvider.tsx
#: src/pages/settings/security/SettingsSecurityApprovedAccessDomain.tsx
@ -4497,7 +4522,7 @@ msgid "Select the default value for this boolean field"
msgstr "Select the default value for this boolean field"
#. js-lingui-id: xraglu
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Select the events you wish to send to this endpoint"
msgstr "Select the events you wish to send to this endpoint"
@ -5261,8 +5286,8 @@ msgstr "Update"
#. js-lingui-id: +b7T3G
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "Updated"
msgstr "Updated"
#~ msgid "Updated"
#~ msgstr "Updated"
#. js-lingui-id: ONWvwQ
#: src/modules/ui/input/components/ImageInput.tsx
@ -5291,8 +5316,8 @@ msgstr "Upload the XML file with your connection infos"
#. js-lingui-id: IagCbF
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "URL"
msgstr "URL"
#~ msgid "URL"
#~ msgstr "URL"
#. js-lingui-id: 6dMpmz
#: src/modules/action-menu/actions/record-actions/constants/WorkflowVersionsActionsConfig.tsx
@ -5503,7 +5528,7 @@ msgid "We support your square PNGs, JPEGs and GIFs under 10MB"
msgstr "We support your square PNGs, JPEGs and GIFs under 10MB"
#. js-lingui-id: ZS7vYp
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "We will send POST requests to this endpoint for every new event"
msgstr "We will send POST requests to this endpoint for every new event"
@ -5521,8 +5546,8 @@ msgstr "We will send your a link to verify domain ownership"
#: src/pages/settings/developers/webhooks/components/SettingsWebhooks.tsx
#: src/pages/settings/developers/webhooks/components/SettingsWebhooks.tsx
#: src/pages/settings/developers/webhooks/components/SettingsWebhooks.tsx
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/modules/settings/hooks/useSettingsNavigationItems.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Webhooks"
msgstr "Webhooks"
@ -5546,6 +5571,11 @@ msgstr "When the API key will expire."
msgid "When the key will be disabled"
msgstr "When the key will be disabled"
#. js-lingui-id: RfrIUU
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
#~ msgid "Will be saved as:"
#~ msgstr "Will be saved as:"
#. js-lingui-id: wvyffT
#: src/modules/workflow/components/RecordShowPageWorkflowHeader.tsx
#~ msgid "Workflow cannot be tested"
@ -5571,7 +5601,6 @@ msgstr "When the key will be disabled"
#: src/pages/settings/security/SettingsSecurity.tsx
#: src/pages/settings/integrations/SettingsIntegrations.tsx
#: src/pages/settings/developers/webhooks/components/SettingsWebhooks.tsx
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/pages/settings/developers/playground/SettingsRestPlayground.tsx
#: src/pages/settings/developers/playground/SettingsGraphQLPlayground.tsx
#: src/pages/settings/developers/api-keys/SettingsDevelopersApiKeysNew.tsx
@ -5587,6 +5616,7 @@ msgstr "When the key will be disabled"
#: src/modules/settings/roles/role-permissions/settings-permissions/components/SettingsRolePermissionsSettingsSection.tsx
#: src/modules/settings/roles/components/SettingsRolesContainer.tsx
#: src/modules/settings/hooks/useSettingsNavigationItems.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
#: src/modules/favorites/components/WorkspaceFavorites.tsx
msgid "Workspace"
msgstr "Workspace"
@ -5627,8 +5657,8 @@ msgid "Wrap on record pages"
msgstr "Wrap on record pages"
#. js-lingui-id: Q9pNST
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/modules/settings/roles/role-settings/components/SettingsRoleSettings.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
#: src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx
#: src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldDescriptionForm.tsx
msgid "Write a description"
@ -5636,8 +5666,8 @@ msgstr "Write a description"
#. js-lingui-id: L80fMJ
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "Write a secret"
msgstr "Write a secret"
#~ msgid "Write a secret"
#~ msgstr "Write a secret"
#. js-lingui-id: zkWmBh
#: src/modules/billing/components/SettingsBillingSubscriptionInfo.tsx
@ -5645,8 +5675,9 @@ msgid "Yearly"
msgstr "Yearly"
#. js-lingui-id: 3d1wCB
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/pages/settings/developers/api-keys/SettingsDevelopersApiKeyDetail.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "yes"
msgstr "yes"