Display error if no invoicing plugin is active (#1709)

* Add error message if no invoice plugin installed

* Fix types

* Update messages
This commit is contained in:
Dominik Żegleń 2021-12-23 13:42:10 +01:00 committed by GitHub
parent c6e6aeff50
commit ff14720e23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 84 additions and 59 deletions

View file

@ -5180,12 +5180,20 @@
"src_dot_orders_dot_views_dot_OrderDetails_dot_4085755992": { "src_dot_orders_dot_views_dot_OrderDetails_dot_4085755992": {
"string": "Invoice email sent" "string": "Invoice email sent"
}, },
"src_dot_orders_dot_views_dot_OrderDetails_dot_4207717971": {
"context": "snackbar title",
"string": "Could not generate invoice"
},
"src_dot_orders_dot_views_dot_OrderDetails_dot_55607988": { "src_dot_orders_dot_views_dot_OrderDetails_dot_55607988": {
"string": "Invoice is Generating" "string": "Invoice is Generating"
}, },
"src_dot_orders_dot_views_dot_OrderDetails_dot_617145655": { "src_dot_orders_dot_views_dot_OrderDetails_dot_617145655": {
"string": "Shipping method successfully updated" "string": "Shipping method successfully updated"
}, },
"src_dot_orders_dot_views_dot_OrderDetails_dot_811176136": {
"context": "error message",
"string": "No invoice plugin installed"
},
"src_dot_orders_dot_views_dot_OrderDetails_dot_927945225": { "src_dot_orders_dot_views_dot_OrderDetails_dot_927945225": {
"string": "Fulfillment successfully cancelled" "string": "Fulfillment successfully cancelled"
}, },

View file

@ -464,8 +464,6 @@ type AssignedVariantAttribute {
type Attribute implements Node & ObjectWithMetadata { type Attribute implements Node & ObjectWithMetadata {
id: ID! id: ID!
productTypes(before: String, after: String, first: Int, last: Int): ProductTypeCountableConnection!
productVariantTypes(before: String, after: String, first: Int, last: Int): ProductTypeCountableConnection!
privateMetadata: [MetadataItem]! privateMetadata: [MetadataItem]!
metadata: [MetadataItem]! metadata: [MetadataItem]!
inputType: AttributeInputTypeEnum inputType: AttributeInputTypeEnum
@ -483,6 +481,8 @@ type Attribute implements Node & ObjectWithMetadata {
translation(languageCode: LanguageCodeEnum!): AttributeTranslation translation(languageCode: LanguageCodeEnum!): AttributeTranslation
storefrontSearchPosition: Int! storefrontSearchPosition: Int!
withChoices: Boolean! withChoices: Boolean!
productTypes(before: String, after: String, first: Int, last: Int): ProductTypeCountableConnection!
productVariantTypes(before: String, after: String, first: Int, last: Int): ProductTypeCountableConnection!
} }
type AttributeBulkDelete { type AttributeBulkDelete {
@ -2611,6 +2611,7 @@ enum InvoiceErrorCode {
NUMBER_NOT_SET NUMBER_NOT_SET
NOT_FOUND NOT_FOUND
INVALID_STATUS INVALID_STATUS
NO_INVOICE_PLUGIN
} }
type InvoiceRequest { type InvoiceRequest {
@ -4378,6 +4379,7 @@ input OrderFilterInput {
channels: [ID] channels: [ID]
isClickAndCollect: Boolean isClickAndCollect: Boolean
isPreorder: Boolean isPreorder: Boolean
ids: [ID]
} }
type OrderFulfill { type OrderFulfill {
@ -5899,7 +5901,7 @@ input PublishableChannelListingInput {
type Query { type Query {
webhook(id: ID!): Webhook webhook(id: ID!): Webhook
webhookEvents: [WebhookEvent] webhookEvents: [WebhookEvent] @deprecated(reason: "This field will be removed in Saleor 4.0. Use `WebhookEventTypeAsyncEnum` and `WebhookEventTypeSyncEnum` to get available event types.")
webhookSamplePayload(eventType: WebhookSampleEventTypeEnum!): JSONString webhookSamplePayload(eventType: WebhookSampleEventTypeEnum!): JSONString
warehouse(id: ID!): Warehouse warehouse(id: ID!): Warehouse
warehouses(filter: WarehouseFilterInput, sortBy: WarehouseSortingInput, before: String, after: String, first: Int, last: Int): WarehouseCountableConnection warehouses(filter: WarehouseFilterInput, sortBy: WarehouseSortingInput, before: String, after: String, first: Int, last: Int): WarehouseCountableConnection
@ -7148,7 +7150,6 @@ type Warehouse implements Node & ObjectWithMetadata {
id: ID! id: ID!
name: String! name: String!
slug: String! slug: String!
shippingZones(before: String, after: String, first: Int, last: Int): ShippingZoneCountableConnection!
address: Address! address: Address!
email: String! email: String!
isPrivate: Boolean! isPrivate: Boolean!
@ -7156,6 +7157,7 @@ type Warehouse implements Node & ObjectWithMetadata {
metadata: [MetadataItem]! metadata: [MetadataItem]!
companyName: String! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `Address.companyName` instead.") companyName: String! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `Address.companyName` instead.")
clickAndCollectOption: WarehouseClickAndCollectOptionEnum! clickAndCollectOption: WarehouseClickAndCollectOptionEnum!
shippingZones(before: String, after: String, first: Int, last: Int): ShippingZoneCountableConnection!
} }
enum WarehouseClickAndCollectOptionEnum { enum WarehouseClickAndCollectOptionEnum {
@ -7275,8 +7277,8 @@ input WebhookCreateInput {
name: String name: String
targetUrl: String targetUrl: String
events: [WebhookEventTypeEnum] events: [WebhookEventTypeEnum]
asyncEvents: [WebhookEventTypeAsync!] asyncEvents: [WebhookEventTypeAsyncEnum!]
syncEvents: [WebhookEventTypeSync!] syncEvents: [WebhookEventTypeSyncEnum!]
app: ID app: ID
isActive: Boolean isActive: Boolean
secretKey: String secretKey: String
@ -7308,16 +7310,16 @@ type WebhookEvent {
} }
type WebhookEventAsync { type WebhookEventAsync {
eventType: WebhookEventTypeAsync! eventType: WebhookEventTypeAsyncEnum!
name: String! name: String!
} }
type WebhookEventSync { type WebhookEventSync {
eventType: WebhookEventTypeSync! eventType: WebhookEventTypeSyncEnum!
name: String! name: String!
} }
enum WebhookEventTypeAsync { enum WebhookEventTypeAsyncEnum {
ANY_EVENTS ANY_EVENTS
ORDER_CREATED ORDER_CREATED
ORDER_CONFIRMED ORDER_CONFIRMED
@ -7403,7 +7405,7 @@ enum WebhookEventTypeEnum {
TRANSLATION_UPDATED TRANSLATION_UPDATED
} }
enum WebhookEventTypeSync { enum WebhookEventTypeSyncEnum {
PAYMENT_AUTHORIZE PAYMENT_AUTHORIZE
PAYMENT_CAPTURE PAYMENT_CAPTURE
PAYMENT_CONFIRM PAYMENT_CONFIRM
@ -7448,14 +7450,6 @@ enum WebhookSampleEventTypeEnum {
PAGE_CREATED PAGE_CREATED
PAGE_UPDATED PAGE_UPDATED
PAGE_DELETED PAGE_DELETED
PAYMENT_AUTHORIZE
PAYMENT_CAPTURE
PAYMENT_CONFIRM
PAYMENT_LIST_GATEWAYS
PAYMENT_PROCESS
PAYMENT_REFUND
PAYMENT_VOID
SHIPPING_LIST_METHODS_FOR_CHECKOUT
TRANSLATION_CREATED TRANSLATION_CREATED
TRANSLATION_UPDATED TRANSLATION_UPDATED
} }
@ -7470,8 +7464,8 @@ input WebhookUpdateInput {
name: String name: String
targetUrl: String targetUrl: String
events: [WebhookEventTypeEnum] events: [WebhookEventTypeEnum]
asyncEvents: [WebhookEventTypeAsync!] asyncEvents: [WebhookEventTypeAsyncEnum!]
syncEvents: [WebhookEventTypeSync!] syncEvents: [WebhookEventTypeSyncEnum!]
app: ID app: ID
isActive: Boolean isActive: Boolean
secretKey: String secretKey: String

View file

@ -17,7 +17,11 @@ import {
import React from "react"; import React from "react";
import { useIntl } from "react-intl"; import { useIntl } from "react-intl";
import { JobStatusEnum, OrderStatus } from "../../../types/globalTypes"; import {
InvoiceErrorCode,
JobStatusEnum,
OrderStatus
} from "../../../types/globalTypes";
import OrderOperations from "../../containers/OrderOperations"; import OrderOperations from "../../containers/OrderOperations";
import { TypedOrderDetailsQuery } from "../../queries"; import { TypedOrderDetailsQuery } from "../../queries";
import { import {
@ -138,6 +142,23 @@ export const OrderDetails: React.FC<OrderDetailsProps> = ({ id, params }) => {
onDraftCancel={orderMessages.handleDraftCancel} onDraftCancel={orderMessages.handleDraftCancel}
onOrderMarkAsPaid={orderMessages.handleOrderMarkAsPaid} onOrderMarkAsPaid={orderMessages.handleOrderMarkAsPaid}
onInvoiceRequest={(data: InvoiceRequest) => { onInvoiceRequest={(data: InvoiceRequest) => {
if (
data.invoiceRequest.errors.some(
err => err.code === InvoiceErrorCode.NO_INVOICE_PLUGIN
)
) {
notify({
title: intl.formatMessage({
defaultMessage: "Could not generate invoice",
description: "snackbar title"
}),
text: intl.formatMessage({
defaultMessage: "No invoice plugin installed",
description: "error message"
}),
status: "error"
});
}
if ( if (
data.invoiceRequest.invoice.status === JobStatusEnum.SUCCESS data.invoiceRequest.invoice.status === JobStatusEnum.SUCCESS
) { ) {

View file

@ -525,6 +525,7 @@ export enum InvoiceErrorCode {
INVALID_STATUS = "INVALID_STATUS", INVALID_STATUS = "INVALID_STATUS",
NOT_FOUND = "NOT_FOUND", NOT_FOUND = "NOT_FOUND",
NOT_READY = "NOT_READY", NOT_READY = "NOT_READY",
NO_INVOICE_PLUGIN = "NO_INVOICE_PLUGIN",
NUMBER_NOT_SET = "NUMBER_NOT_SET", NUMBER_NOT_SET = "NUMBER_NOT_SET",
REQUIRED = "REQUIRED", REQUIRED = "REQUIRED",
URL_NOT_SET = "URL_NOT_SET", URL_NOT_SET = "URL_NOT_SET",
@ -1817,7 +1818,7 @@ export enum WebhookErrorCode {
UNIQUE = "UNIQUE", UNIQUE = "UNIQUE",
} }
export enum WebhookEventTypeAsync { export enum WebhookEventTypeAsyncEnum {
ANY_EVENTS = "ANY_EVENTS", ANY_EVENTS = "ANY_EVENTS",
CHECKOUT_CREATED = "CHECKOUT_CREATED", CHECKOUT_CREATED = "CHECKOUT_CREATED",
CHECKOUT_UPDATED = "CHECKOUT_UPDATED", CHECKOUT_UPDATED = "CHECKOUT_UPDATED",
@ -1903,7 +1904,7 @@ export enum WebhookEventTypeEnum {
TRANSLATION_UPDATED = "TRANSLATION_UPDATED", TRANSLATION_UPDATED = "TRANSLATION_UPDATED",
} }
export enum WebhookEventTypeSync { export enum WebhookEventTypeSyncEnum {
PAYMENT_AUTHORIZE = "PAYMENT_AUTHORIZE", PAYMENT_AUTHORIZE = "PAYMENT_AUTHORIZE",
PAYMENT_CAPTURE = "PAYMENT_CAPTURE", PAYMENT_CAPTURE = "PAYMENT_CAPTURE",
PAYMENT_CONFIRM = "PAYMENT_CONFIRM", PAYMENT_CONFIRM = "PAYMENT_CONFIRM",
@ -2375,6 +2376,7 @@ export interface OrderFilterInput {
channels?: (string | null)[] | null; channels?: (string | null)[] | null;
isClickAndCollect?: boolean | null; isClickAndCollect?: boolean | null;
isPreorder?: boolean | null; isPreorder?: boolean | null;
ids?: (string | null)[] | null;
} }
export interface OrderFulfillInput { export interface OrderFulfillInput {
@ -3013,8 +3015,8 @@ export interface WebhookCreateInput {
name?: string | null; name?: string | null;
targetUrl?: string | null; targetUrl?: string | null;
events?: (WebhookEventTypeEnum | null)[] | null; events?: (WebhookEventTypeEnum | null)[] | null;
asyncEvents?: WebhookEventTypeAsync[] | null; asyncEvents?: WebhookEventTypeAsyncEnum[] | null;
syncEvents?: WebhookEventTypeSync[] | null; syncEvents?: WebhookEventTypeSyncEnum[] | null;
app?: string | null; app?: string | null;
isActive?: boolean | null; isActive?: boolean | null;
secretKey?: string | null; secretKey?: string | null;
@ -3024,8 +3026,8 @@ export interface WebhookUpdateInput {
name?: string | null; name?: string | null;
targetUrl?: string | null; targetUrl?: string | null;
events?: (WebhookEventTypeEnum | null)[] | null; events?: (WebhookEventTypeEnum | null)[] | null;
asyncEvents?: WebhookEventTypeAsync[] | null; asyncEvents?: WebhookEventTypeAsyncEnum[] | null;
syncEvents?: WebhookEventTypeSync[] | null; syncEvents?: WebhookEventTypeSyncEnum[] | null;
app?: string | null; app?: string | null;
isActive?: boolean | null; isActive?: boolean | null;
secretKey?: string | null; secretKey?: string | null;

View file

@ -8,8 +8,8 @@ import Savebar from "@saleor/components/Savebar";
import { WebhookErrorFragment } from "@saleor/fragments/types/WebhookErrorFragment"; import { WebhookErrorFragment } from "@saleor/fragments/types/WebhookErrorFragment";
import { Backlink } from "@saleor/macaw-ui"; import { Backlink } from "@saleor/macaw-ui";
import { import {
WebhookEventTypeAsync, WebhookEventTypeAsyncEnum,
WebhookEventTypeSync WebhookEventTypeSyncEnum
} from "@saleor/types/globalTypes"; } from "@saleor/types/globalTypes";
import WebhookEvents from "@saleor/webhooks/components/WebhookEvents"; import WebhookEvents from "@saleor/webhooks/components/WebhookEvents";
import WebhookInfo from "@saleor/webhooks/components/WebhookInfo"; import WebhookInfo from "@saleor/webhooks/components/WebhookInfo";
@ -29,8 +29,8 @@ import { useIntl } from "react-intl";
import { getHeaderTitle } from "./messages"; import { getHeaderTitle } from "./messages";
export interface FormData { export interface FormData {
syncEvents: WebhookEventTypeSync[]; syncEvents: WebhookEventTypeSyncEnum[];
asyncEvents: WebhookEventTypeAsync[]; asyncEvents: WebhookEventTypeAsyncEnum[];
isActive: boolean; isActive: boolean;
name: string; name: string;
secretKey: string | null; secretKey: string | null;
@ -72,11 +72,11 @@ const WebhookDetailsPage: React.FC<WebhookDetailsPageProps> = ({
{({ data, hasChanged, submit, change }) => { {({ data, hasChanged, submit, change }) => {
const syncEventsChoices = disabled const syncEventsChoices = disabled
? [] ? []
: mapSyncEventsToChoices(Object.values(WebhookEventTypeSync)); : mapSyncEventsToChoices(Object.values(WebhookEventTypeSyncEnum));
const asyncEventsChoices = disabled const asyncEventsChoices = disabled
? [] ? []
: mapAsyncEventsToChoices( : mapAsyncEventsToChoices(
Object.values(WebhookEventTypeAsync), Object.values(WebhookEventTypeAsyncEnum),
data.asyncEvents data.asyncEvents
); );

View file

@ -7,8 +7,8 @@ import MultiAutocompleteSelectField, {
} from "@saleor/components/MultiAutocompleteSelectField"; } from "@saleor/components/MultiAutocompleteSelectField";
import { ChangeEvent } from "@saleor/hooks/useForm"; import { ChangeEvent } from "@saleor/hooks/useForm";
import { import {
WebhookEventTypeAsync, WebhookEventTypeAsyncEnum,
WebhookEventTypeSync WebhookEventTypeSyncEnum
} from "@saleor/types/globalTypes"; } from "@saleor/types/globalTypes";
import { import {
mapAsyncEventsToChoices, mapAsyncEventsToChoices,
@ -22,8 +22,8 @@ import { messages } from "./messages";
interface WebhookEventsProps { interface WebhookEventsProps {
data: { data: {
syncEvents: WebhookEventTypeSync[]; syncEvents: WebhookEventTypeSyncEnum[];
asyncEvents: WebhookEventTypeAsync[]; asyncEvents: WebhookEventTypeAsyncEnum[];
}; };
syncEventsChoices: MultiAutocompleteChoiceType[]; syncEventsChoices: MultiAutocompleteChoiceType[];
asyncEventsChoices: MultiAutocompleteChoiceType[]; asyncEventsChoices: MultiAutocompleteChoiceType[];

View file

@ -1,7 +1,7 @@
import { ChangeEvent } from "@saleor/hooks/useForm"; import { ChangeEvent } from "@saleor/hooks/useForm";
import { import {
WebhookEventTypeAsync, WebhookEventTypeAsyncEnum,
WebhookEventTypeSync WebhookEventTypeSyncEnum
} from "@saleor/types/globalTypes"; } from "@saleor/types/globalTypes";
import { toggle } from "@saleor/utils/lists"; import { toggle } from "@saleor/utils/lists";
@ -9,7 +9,7 @@ import { filterSelectedAsyncEvents } from "./utils";
export const createSyncEventsSelectHandler = ( export const createSyncEventsSelectHandler = (
change: (event: ChangeEvent, cb?: () => void) => void, change: (event: ChangeEvent, cb?: () => void) => void,
syncEvents: WebhookEventTypeSync[] syncEvents: WebhookEventTypeSyncEnum[]
) => (event: ChangeEvent) => { ) => (event: ChangeEvent) => {
const events = toggle(event.target.value, syncEvents, (a, b) => a === b); const events = toggle(event.target.value, syncEvents, (a, b) => a === b);
@ -23,7 +23,7 @@ export const createSyncEventsSelectHandler = (
export const createAsyncEventsSelectHandler = ( export const createAsyncEventsSelectHandler = (
change: (event: ChangeEvent, cb?: () => void) => void, change: (event: ChangeEvent, cb?: () => void) => void,
asyncEvents: WebhookEventTypeAsync[] asyncEvents: WebhookEventTypeAsyncEnum[]
) => (event: ChangeEvent) => { ) => (event: ChangeEvent) => {
const events = toggle(event.target.value, asyncEvents, (a, b) => a === b); const events = toggle(event.target.value, asyncEvents, (a, b) => a === b);
const filteredEvents = filterSelectedAsyncEvents(events); const filteredEvents = filterSelectedAsyncEvents(events);

View file

@ -3,7 +3,7 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { WebhookEventTypeSync, WebhookEventTypeAsync } from "./../../types/globalTypes"; import { WebhookEventTypeSyncEnum, WebhookEventTypeAsyncEnum } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL query operation: WebhookDetails // GraphQL query operation: WebhookDetails
@ -17,12 +17,12 @@ export interface WebhookDetails_webhook_app {
export interface WebhookDetails_webhook_syncEvents { export interface WebhookDetails_webhook_syncEvents {
__typename: "WebhookEventSync"; __typename: "WebhookEventSync";
eventType: WebhookEventTypeSync; eventType: WebhookEventTypeSyncEnum;
} }
export interface WebhookDetails_webhook_asyncEvents { export interface WebhookDetails_webhook_asyncEvents {
__typename: "WebhookEventAsync"; __typename: "WebhookEventAsync";
eventType: WebhookEventTypeAsync; eventType: WebhookEventTypeAsyncEnum;
} }
export interface WebhookDetails_webhook { export interface WebhookDetails_webhook {

View file

@ -1,8 +1,8 @@
import { MultiAutocompleteChoiceType } from "@saleor/components/MultiAutocompleteSelectField"; import { MultiAutocompleteChoiceType } from "@saleor/components/MultiAutocompleteSelectField";
import { WebhookFragment } from "@saleor/fragments/types/WebhookFragment"; import { WebhookFragment } from "@saleor/fragments/types/WebhookFragment";
import { import {
WebhookEventTypeAsync, WebhookEventTypeAsyncEnum,
WebhookEventTypeSync WebhookEventTypeSyncEnum
} from "@saleor/types/globalTypes"; } from "@saleor/types/globalTypes";
export function isUnnamed(webhook: WebhookFragment): boolean { export function isUnnamed(webhook: WebhookFragment): boolean {
@ -10,7 +10,7 @@ export function isUnnamed(webhook: WebhookFragment): boolean {
} }
export function mapSyncEventsToChoices( export function mapSyncEventsToChoices(
events: WebhookEventTypeSync[] events: WebhookEventTypeSyncEnum[]
): MultiAutocompleteChoiceType[] { ): MultiAutocompleteChoiceType[] {
return events.map(event => ({ return events.map(event => ({
label: event, label: event,
@ -19,26 +19,26 @@ export function mapSyncEventsToChoices(
} }
export function mapAsyncEventsToChoices( export function mapAsyncEventsToChoices(
events: WebhookEventTypeAsync[], events: WebhookEventTypeAsyncEnum[],
selectedEvents: WebhookEventTypeAsync[] selectedEvents: WebhookEventTypeAsyncEnum[]
): MultiAutocompleteChoiceType[] { ): MultiAutocompleteChoiceType[] {
const isAnyAsyncEventSelected = selectedEvents.includes( const isAnyAsyncEventSelected = selectedEvents.includes(
WebhookEventTypeAsync.ANY_EVENTS WebhookEventTypeAsyncEnum.ANY_EVENTS
); );
return events.map(event => ({ return events.map(event => ({
label: event, label: event,
value: event, value: event,
disabled: disabled:
event !== WebhookEventTypeAsync.ANY_EVENTS && isAnyAsyncEventSelected event !== WebhookEventTypeAsyncEnum.ANY_EVENTS && isAnyAsyncEventSelected
})); }));
} }
export const filterSelectedAsyncEvents = ( export const filterSelectedAsyncEvents = (
asyncEvents: WebhookEventTypeAsync[] asyncEvents: WebhookEventTypeAsyncEnum[]
) => { ) => {
const anyEvent = asyncEvents.find( const anyEvent = asyncEvents.find(
event => event === WebhookEventTypeAsync.ANY_EVENTS event => event === WebhookEventTypeAsyncEnum.ANY_EVENTS
); );
if (anyEvent) { if (anyEvent) {
return [anyEvent]; return [anyEvent];

View file

@ -4,7 +4,7 @@ import { WindowTitle } from "@saleor/components/WindowTitle";
import useNavigator from "@saleor/hooks/useNavigator"; import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier"; import useNotifier from "@saleor/hooks/useNotifier";
import { commonMessages } from "@saleor/intl"; import { commonMessages } from "@saleor/intl";
import { WebhookEventTypeAsync } from "@saleor/types/globalTypes"; import { WebhookEventTypeAsyncEnum } from "@saleor/types/globalTypes";
import React from "react"; import React from "react";
import { useIntl } from "react-intl"; import { useIntl } from "react-intl";
@ -46,9 +46,9 @@ export const WebhooksCreate: React.FC<WebhooksCreateProps> = ({ id }) => {
app: id, app: id,
syncEvents: data.syncEvents, syncEvents: data.syncEvents,
asyncEvents: data.asyncEvents.includes( asyncEvents: data.asyncEvents.includes(
WebhookEventTypeAsync.ANY_EVENTS WebhookEventTypeAsyncEnum.ANY_EVENTS
) )
? [WebhookEventTypeAsync.ANY_EVENTS] ? [WebhookEventTypeAsyncEnum.ANY_EVENTS]
: data.asyncEvents, : data.asyncEvents,
isActive: data.isActive, isActive: data.isActive,
name: data.name, name: data.name,

View file

@ -4,7 +4,7 @@ import { WindowTitle } from "@saleor/components/WindowTitle";
import useNavigator from "@saleor/hooks/useNavigator"; import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier"; import useNotifier from "@saleor/hooks/useNotifier";
import { commonMessages } from "@saleor/intl"; import { commonMessages } from "@saleor/intl";
import { WebhookEventTypeAsync } from "@saleor/types/globalTypes"; import { WebhookEventTypeAsyncEnum } from "@saleor/types/globalTypes";
import { WebhookUpdate } from "@saleor/webhooks/types/WebhookUpdate"; import { WebhookUpdate } from "@saleor/webhooks/types/WebhookUpdate";
import React from "react"; import React from "react";
import { useIntl } from "react-intl"; import { useIntl } from "react-intl";
@ -71,9 +71,9 @@ export const WebhooksDetails: React.FC<WebhooksDetailsProps> = ({ id }) => {
input: { input: {
syncEvents: data.syncEvents, syncEvents: data.syncEvents,
asyncEvents: data.asyncEvents.includes( asyncEvents: data.asyncEvents.includes(
WebhookEventTypeAsync.ANY_EVENTS WebhookEventTypeAsyncEnum.ANY_EVENTS
) )
? [WebhookEventTypeAsync.ANY_EVENTS] ? [WebhookEventTypeAsyncEnum.ANY_EVENTS]
: data.asyncEvents, : data.asyncEvents,
isActive: data.isActive, isActive: data.isActive,
name: data.name, name: data.name,