Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fast-cloths-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Fixed missing Product Variant webhook events group in the webhook creation UI.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ describe("getWebhookTypes", () => {
it("should map array of enum keys to objects with events ", () => {
const TestWebhookTypes = getWebhookTypes(TestKeys);

expect(Object.keys(TestWebhookTypes)).toEqual(["DRAFT_ORDER", "PRODUCT"]);
expect(Object.keys(TestWebhookTypes)).toEqual(["DRAFT_ORDER", "PRODUCT", "PRODUCT_VARIANT"]);
expect(TestWebhookTypes.DRAFT_ORDER).toEqual(["CREATED", "UPDATED"]);
expect(TestWebhookTypes.PRODUCT).toEqual(["CREATED", "UPDATED", "VARIANT_UPDATED"]);
expect(TestWebhookTypes.PRODUCT).toEqual(["CREATED", "UPDATED"]);
expect(TestWebhookTypes.PRODUCT_VARIANT).toEqual(["UPDATED"]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { WebhookEventTypeAsyncEnum, WebhookEventTypeSyncEnum } from "@dashboard/
type Actions = string[];

export const getWebhookTypes = (webhookEvents: string[]) => {
const multiWords = ["DRAFT_ORDER", "GIFT_CARD", "ANY_EVENTS"];
const multiWords = ["DRAFT_ORDER", "GIFT_CARD", "ANY_EVENTS", "PRODUCT_VARIANT"];

return webhookEvents.sort().reduce<Record<string, Actions>>((acc, key) => {
const keywords = key.split("_");
Expand Down
Loading