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

@ -454,8 +454,8 @@ msgstr "Tất cả ({relationRecordsCount})"
#. js-lingui-id: 9ljU00
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "All Actions"
msgstr "Tất cả hành động"
#~ msgid "All Actions"
#~ msgstr "Tất cả hành động"
#. js-lingui-id: 7EZqN0
#: src/modules/settings/accounts/components/SettingsAccountsRowDropdownMenu.tsx
@ -469,8 +469,8 @@ msgstr "Tất cả dòng"
#. js-lingui-id: aFE/OW
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "All Objects"
msgstr "Tất cả đối tượng"
#~ msgid "All Objects"
#~ msgstr "Tất cả đối tượng"
#. js-lingui-id: Hm90t3
#: src/modules/settings/roles/components/SettingsRolesList.tsx
@ -513,7 +513,7 @@ msgid "An error occurred while updating password"
msgstr "Đã xảy ra lỗi khi cập nhật mật khẩu"
#. js-lingui-id: mJ6m4C
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "An optional description"
msgstr "Mô tả không bắt buộc"
@ -922,8 +922,8 @@ msgstr "Tiếng Trung — Phồn thể"
#. js-lingui-id: JEFFOR
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "Choose an object"
msgstr "Chọn một đối tượng"
#~ msgid "Choose an object"
#~ msgstr "Chọn một đối tượng"
#. js-lingui-id: Qz73jD
#: src/modules/settings/security/components/SSO/SettingsSSOIdentitiesProvidersForm.tsx
@ -1315,8 +1315,8 @@ msgstr "Tạo không gian làm việc của bạn"
#. js-lingui-id: d+F6q9
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "Created"
msgstr "Đã tạo"
#~ msgid "Created"
#~ msgstr "Đã tạo"
#. js-lingui-id: R3PLzn
#: src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownCurrencySelect.tsx
@ -1385,11 +1385,11 @@ msgid "Czech"
msgstr "Tiếng Séc"
#. 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 "Khu vực nguy hiểm"
@ -1526,12 +1526,13 @@ msgid "Define what will be visible to other users in your workspace"
msgstr "Định nghĩa những gì sẽ được hiển thị cho người dùng khác trong không gian làm việc của bạn"
#. 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
@ -1585,19 +1586,22 @@ msgid "Delete Records on All Objects"
msgstr ""
#. 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 "Xóa tích hợp này"
#. js-lingui-id: KSOhjo
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Delete this webhook"
msgstr ""
#. js-lingui-id: aRG49z
#: src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx
msgid "Delete view"
msgstr "Xóa chế độ xem"
#. 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 "Xóa Webhooks"
@ -1624,8 +1628,8 @@ msgstr "Xóa toàn bộ không gian làm việc của bạn"
#. js-lingui-id: vGjmyl
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "Deleted"
msgstr "Đã xóa"
#~ msgid "Deleted"
#~ msgstr "Đã xóa"
#. js-lingui-id: kcGoDz
#: src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownMenuContent.tsx
@ -1659,10 +1663,10 @@ msgid "Descending"
msgstr "Giảm dần"
#. 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 "Mô tả"
@ -1950,7 +1954,7 @@ msgid "Empty Object"
msgstr "Đối tượng trống"
#. js-lingui-id: T3juzf
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Endpoint URL"
msgstr "URL điểm cuối"
@ -2329,7 +2333,7 @@ msgid "Filter"
msgstr "\"Lọc\""
#. js-lingui-id: cSev+j
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Filters"
msgstr "\"Bộ lọc\""
@ -2613,6 +2617,11 @@ msgstr "Cách bạn sẽ được nhận diện trong ứng dụng."
msgid "How your system is doing"
msgstr "Tình trạng hệ thống của bạn"
#. js-lingui-id: 0yRnXS
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "https://example.com/webhook"
msgstr ""
#. js-lingui-id: mkWad2
#: src/pages/settings/profile/appearance/components/LocalePicker.tsx
msgid "Hungarian"
@ -3361,6 +3370,7 @@ msgstr "Điều hướng đến quy trình trước đó"
#. js-lingui-id: isRobC
#: src/pages/settings/data-model/SettingsNewObject.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "New"
msgstr "Mới"
@ -3745,10 +3755,15 @@ msgstr "Đã mở"
msgid "Opportunities"
msgstr ""
#. js-lingui-id: hY8F2i
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Optional secret used to compute the HMAC signature for webhook payloads"
msgstr ""
#. 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 "Tùy chọn: Xác định một chuỗi bí mật mà chúng tôi sẽ bao gồm trong mỗi webhook. Sử dụng điều này để xác thực và xác minh webhook sau khi nhận."
#~ msgid "Optional: Define a secret string that we will include in every webhook. Use this to authenticate and verify the webhook upon receipt."
#~ msgstr "Tùy chọn: Xác định một chuỗi bí mật mà chúng tôi sẽ bao gồm trong mỗi webhook. Sử dụng điều này để xác thực và xác minh webhook sau khi nhận."
#. js-lingui-id: 0zpgxV
#: src/modules/settings/roles/components/SettingsRolesDefaultRole.tsx
@ -3912,8 +3927,8 @@ msgstr "Sân chơi"
#. js-lingui-id: jEw0Mr
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "Please enter a valid URL"
msgstr "Vui lòng nhập đường dẫn URL hợp lệ"
#~ msgid "Please enter a valid URL"
#~ msgstr "Vui lòng nhập đường dẫn URL hợp lệ"
#. js-lingui-id: X5x85V
#: src/modules/settings/admin-panel/components/SettingsAdminWorkspaceContent.tsx
@ -3925,10 +3940,15 @@ msgstr "Vui lòng tìm kiếm người dùng trước"
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 "Vui lòng nhập \"{confirmationValue}\" để xác nhận bạn muốn xóa API Key này. Lưu ý rằng bất kỳ kịch bản nào sử dụng khóa này sẽ ngừng hoạt động."
#. js-lingui-id: GbtYRD
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Please type \"yes\" to confirm you want to delete this webhook."
msgstr ""
#. 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 "Vui lòng nhập {confirmationText} để xác nhận bạn muốn xóa webhook này."
#~ msgid "Please type {confirmationText} to confirm you want to delete this webhook."
#~ msgstr "Vui lòng nhập {confirmationText} để xác nhận bạn muốn xóa webhook này."
#. js-lingui-id: aRWD63
#: src/pages/settings/data-model/SettingsObjectNewField/SettingsObjectNewFieldConfigure.tsx
@ -4364,10 +4384,15 @@ msgid "Seats"
msgstr ""
#. js-lingui-id: 8VEDbV
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Secret"
msgstr "Bí mật"
#. js-lingui-id: e1v+J3
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
msgid "Secret (optional)"
msgstr ""
#. js-lingui-id: a3LDKx
#: src/pages/settings/security/SettingsSecuritySSOIdentifyProvider.tsx
#: src/pages/settings/security/SettingsSecurityApprovedAccessDomain.tsx
@ -4502,7 +4527,7 @@ msgid "Select the default value for this boolean field"
msgstr "Chọn giá trị mặc định cho trường boolean này"
#. 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 "Chọn các sự kiện bạn muốn gửi đến điểm cuối này"
@ -5266,8 +5291,8 @@ msgstr ""
#. js-lingui-id: +b7T3G
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "Updated"
msgstr "Cập nhật"
#~ msgid "Updated"
#~ msgstr "Cập nhật"
#. js-lingui-id: ONWvwQ
#: src/modules/ui/input/components/ImageInput.tsx
@ -5296,8 +5321,8 @@ msgstr "Tải lên tập tin XML với thông tin kết nối của bạn"
#. 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
@ -5508,7 +5533,7 @@ msgid "We support your square PNGs, JPEGs and GIFs under 10MB"
msgstr "Chúng tôi hỗ trợ hình ảnh PNG, JPEG và GIF vuông dưới 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 "Chúng tôi sẽ gửi yêu cầu POST đến điểm cuối này cho mỗi sự kiện mới"
@ -5526,8 +5551,8 @@ msgstr "Chúng tôi sẽ gửi cho bạn một liên kết để xác minh quy
#: 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"
@ -5551,6 +5576,11 @@ msgstr "Khi nào API key sẽ hết hạn."
msgid "When the key will be disabled"
msgstr "Khi nào khóa sẽ bị vô hiệu hóa"
#. js-lingui-id: RfrIUU
#: src/modules/settings/developers/components/SettingsDevelopersWebhookForm.tsx
#~ msgid "Will be saved as:"
#~ msgstr ""
#. js-lingui-id: wvyffT
#: src/modules/workflow/components/RecordShowPageWorkflowHeader.tsx
#~ msgid "Workflow cannot be tested"
@ -5576,7 +5606,6 @@ msgstr "Khi nào khóa sẽ bị vô hiệu hóa"
#: 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
@ -5592,6 +5621,7 @@ msgstr "Khi nào khóa sẽ bị vô hiệu hóa"
#: 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"
@ -5632,8 +5662,8 @@ msgid "Wrap on record pages"
msgstr "Quấn trên trang hồ sơ"
#. 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"
@ -5641,8 +5671,8 @@ msgstr "Viết mô tả"
#. js-lingui-id: L80fMJ
#: src/pages/settings/developers/webhooks/components/SettingsDevelopersWebhookDetail.tsx
msgid "Write a secret"
msgstr "Viết một bí mật"
#~ msgid "Write a secret"
#~ msgstr "Viết một bí mật"
#. js-lingui-id: zkWmBh
#: src/modules/billing/components/SettingsBillingSubscriptionInfo.tsx
@ -5650,8 +5680,9 @@ msgid "Yearly"
msgstr ""
#. 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 "có"