Update types
This commit is contained in:
parent
4021b8ec62
commit
be8095b22f
18 changed files with 457 additions and 71 deletions
|
@ -604,7 +604,7 @@ type Checkout implements Node {
|
||||||
privateMeta: [MetaStore]!
|
privateMeta: [MetaStore]!
|
||||||
meta: [MetaStore]!
|
meta: [MetaStore]!
|
||||||
availableShippingMethods: [ShippingMethod]!
|
availableShippingMethods: [ShippingMethod]!
|
||||||
availablePaymentGateways: [String]!
|
availablePaymentGateways: [PaymentGateway]!
|
||||||
email: String!
|
email: String!
|
||||||
isShippingRequired: Boolean!
|
isShippingRequired: Boolean!
|
||||||
lines: [CheckoutLine]
|
lines: [CheckoutLine]
|
||||||
|
@ -625,13 +625,13 @@ type CheckoutBillingAddressUpdate {
|
||||||
checkoutErrors: [CheckoutError!]
|
checkoutErrors: [CheckoutError!]
|
||||||
}
|
}
|
||||||
|
|
||||||
type CheckoutClearStoredMeta {
|
type CheckoutClearMeta {
|
||||||
errors: [Error!]
|
errors: [Error!]
|
||||||
checkoutErrors: [CheckoutError!]
|
checkoutErrors: [CheckoutError!]
|
||||||
checkout: Checkout
|
checkout: Checkout
|
||||||
}
|
}
|
||||||
|
|
||||||
type CheckoutClearStoredPrivateMeta {
|
type CheckoutClearPrivateMeta {
|
||||||
errors: [Error!]
|
errors: [Error!]
|
||||||
checkoutErrors: [CheckoutError!]
|
checkoutErrors: [CheckoutError!]
|
||||||
checkout: Checkout
|
checkout: Checkout
|
||||||
|
@ -1610,6 +1610,11 @@ input FulfillmentUpdateTrackingInput {
|
||||||
notifyCustomer: Boolean
|
notifyCustomer: Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GatewayConfigLine {
|
||||||
|
field: String!
|
||||||
|
value: String
|
||||||
|
}
|
||||||
|
|
||||||
scalar GenericScalar
|
scalar GenericScalar
|
||||||
|
|
||||||
type Geolocalization {
|
type Geolocalization {
|
||||||
|
@ -2107,12 +2112,16 @@ type Mutations {
|
||||||
orderAddNote(order: ID!, input: OrderAddNoteInput!): OrderAddNote
|
orderAddNote(order: ID!, input: OrderAddNoteInput!): OrderAddNote
|
||||||
orderCancel(id: ID!, restock: Boolean!): OrderCancel
|
orderCancel(id: ID!, restock: Boolean!): OrderCancel
|
||||||
orderCapture(amount: Decimal!, id: ID!): OrderCapture
|
orderCapture(amount: Decimal!, id: ID!): OrderCapture
|
||||||
|
orderClearPrivateMeta(id: ID!, input: MetaPath!): OrderClearPrivateMeta
|
||||||
|
orderClearMeta(id: ID!, input: MetaPath!): OrderClearMeta
|
||||||
orderFulfillmentCancel(id: ID!, input: FulfillmentCancelInput!): FulfillmentCancel
|
orderFulfillmentCancel(id: ID!, input: FulfillmentCancelInput!): FulfillmentCancel
|
||||||
orderFulfillmentCreate(input: FulfillmentCreateInput!, order: ID): FulfillmentCreate
|
orderFulfillmentCreate(input: FulfillmentCreateInput!, order: ID): FulfillmentCreate
|
||||||
orderFulfillmentUpdateTracking(id: ID!, input: FulfillmentUpdateTrackingInput!): FulfillmentUpdateTracking
|
orderFulfillmentUpdateTracking(id: ID!, input: FulfillmentUpdateTrackingInput!): FulfillmentUpdateTracking
|
||||||
orderMarkAsPaid(id: ID!): OrderMarkAsPaid
|
orderMarkAsPaid(id: ID!): OrderMarkAsPaid
|
||||||
orderRefund(amount: Decimal!, id: ID!): OrderRefund
|
orderRefund(amount: Decimal!, id: ID!): OrderRefund
|
||||||
orderUpdate(id: ID!, input: OrderUpdateInput!): OrderUpdate
|
orderUpdate(id: ID!, input: OrderUpdateInput!): OrderUpdate
|
||||||
|
orderUpdateMeta(id: ID!, input: MetaInput!): OrderUpdateMeta
|
||||||
|
orderUpdatePrivateMeta(id: ID!, input: MetaInput!): OrderUpdatePrivateMeta
|
||||||
orderUpdateShipping(order: ID!, input: OrderUpdateShippingInput): OrderUpdateShipping
|
orderUpdateShipping(order: ID!, input: OrderUpdateShippingInput): OrderUpdateShipping
|
||||||
orderVoid(id: ID!): OrderVoid
|
orderVoid(id: ID!): OrderVoid
|
||||||
orderBulkCancel(ids: [ID]!, restock: Boolean!): OrderBulkCancel
|
orderBulkCancel(ids: [ID]!, restock: Boolean!): OrderBulkCancel
|
||||||
|
@ -2165,14 +2174,14 @@ type Mutations {
|
||||||
checkoutShippingMethodUpdate(checkoutId: ID, shippingMethodId: ID!): CheckoutShippingMethodUpdate
|
checkoutShippingMethodUpdate(checkoutId: ID, shippingMethodId: ID!): CheckoutShippingMethodUpdate
|
||||||
checkoutUpdateVoucher(checkoutId: ID!, voucherCode: String): CheckoutUpdateVoucher
|
checkoutUpdateVoucher(checkoutId: ID!, voucherCode: String): CheckoutUpdateVoucher
|
||||||
checkoutUpdateMetadata(id: ID!, input: MetaInput!): CheckoutUpdateMeta
|
checkoutUpdateMetadata(id: ID!, input: MetaInput!): CheckoutUpdateMeta
|
||||||
checkoutClearMetadata(id: ID!, input: MetaPath!): CheckoutClearStoredMeta
|
checkoutClearMetadata(id: ID!, input: MetaPath!): CheckoutClearMeta
|
||||||
checkoutUpdatePrivateMetadata(id: ID!, input: MetaInput!): CheckoutUpdatePrivateMeta
|
checkoutUpdatePrivateMetadata(id: ID!, input: MetaInput!): CheckoutUpdatePrivateMeta
|
||||||
checkoutClearPrivateMetadata(id: ID!, input: MetaPath!): CheckoutClearStoredPrivateMeta
|
checkoutClearPrivateMetadata(id: ID!, input: MetaPath!): CheckoutClearPrivateMeta
|
||||||
requestPasswordReset(email: String!, redirectUrl: String!): RequestPasswordReset
|
requestPasswordReset(email: String!, redirectUrl: String!): RequestPasswordReset
|
||||||
setPassword(token: String!, email: String!, password: String!): SetPassword
|
setPassword(token: String!, email: String!, password: String!): SetPassword
|
||||||
passwordChange(newPassword: String!, oldPassword: String!): PasswordChange
|
passwordChange(newPassword: String!, oldPassword: String!): PasswordChange
|
||||||
userUpdateMetadata(id: ID!, input: MetaInput!): UserUpdateMeta
|
userUpdateMetadata(id: ID!, input: MetaInput!): UserUpdateMeta
|
||||||
userClearStoredMetadata(id: ID!, input: MetaPath!): UserClearStoredMeta
|
userClearMetadata(id: ID!, input: MetaPath!): UserClearMeta
|
||||||
accountAddressCreate(input: AddressInput!, type: AddressTypeEnum): AccountAddressCreate
|
accountAddressCreate(input: AddressInput!, type: AddressTypeEnum): AccountAddressCreate
|
||||||
accountAddressUpdate(id: ID!, input: AddressInput!): AccountAddressUpdate
|
accountAddressUpdate(id: ID!, input: AddressInput!): AccountAddressUpdate
|
||||||
accountAddressDelete(id: ID!): AccountAddressDelete
|
accountAddressDelete(id: ID!): AccountAddressDelete
|
||||||
|
@ -2202,12 +2211,12 @@ type Mutations {
|
||||||
userAvatarDelete: UserAvatarDelete
|
userAvatarDelete: UserAvatarDelete
|
||||||
userBulkSetActive(ids: [ID]!, isActive: Boolean!): UserBulkSetActive
|
userBulkSetActive(ids: [ID]!, isActive: Boolean!): UserBulkSetActive
|
||||||
userUpdatePrivateMetadata(id: ID!, input: MetaInput!): UserUpdatePrivateMeta
|
userUpdatePrivateMetadata(id: ID!, input: MetaInput!): UserUpdatePrivateMeta
|
||||||
userClearStoredPrivateMetadata(id: ID!, input: MetaPath!): UserClearStoredPrivateMeta
|
userClearPrivateMetadata(id: ID!, input: MetaPath!): UserClearPrivateMeta
|
||||||
serviceAccountCreate(input: ServiceAccountInput!): ServiceAccountCreate
|
serviceAccountCreate(input: ServiceAccountInput!): ServiceAccountCreate
|
||||||
serviceAccountUpdate(id: ID!, input: ServiceAccountInput!): ServiceAccountUpdate
|
serviceAccountUpdate(id: ID!, input: ServiceAccountInput!): ServiceAccountUpdate
|
||||||
serviceAccountDelete(id: ID!): ServiceAccountDelete
|
serviceAccountDelete(id: ID!): ServiceAccountDelete
|
||||||
serviceAccountUpdatePrivateMetadata(id: ID!, input: MetaInput!): ServiceAccountUpdatePrivateMeta
|
serviceAccountUpdatePrivateMetadata(id: ID!, input: MetaInput!): ServiceAccountUpdatePrivateMeta
|
||||||
serviceAccountClearStoredPrivateMetadata(id: ID!, input: MetaPath!): ServiceAccountClearStoredPrivateMeta
|
serviceAccountClearPrivateMetadata(id: ID!, input: MetaPath!): ServiceAccountClearPrivateMeta
|
||||||
serviceAccountTokenCreate(input: ServiceAccountTokenInput!): ServiceAccountTokenCreate
|
serviceAccountTokenCreate(input: ServiceAccountTokenInput!): ServiceAccountTokenCreate
|
||||||
serviceAccountTokenDelete(id: ID!): ServiceAccountTokenDelete
|
serviceAccountTokenDelete(id: ID!): ServiceAccountTokenDelete
|
||||||
passwordReset(email: String!): PasswordReset
|
passwordReset(email: String!): PasswordReset
|
||||||
|
@ -2252,6 +2261,8 @@ type Order implements Node {
|
||||||
displayGrossPrices: Boolean!
|
displayGrossPrices: Boolean!
|
||||||
customerNote: String!
|
customerNote: String!
|
||||||
weight: Weight
|
weight: Weight
|
||||||
|
privateMeta: [MetaStore]!
|
||||||
|
meta: [MetaStore]!
|
||||||
fulfillments: [Fulfillment]!
|
fulfillments: [Fulfillment]!
|
||||||
lines: [OrderLine]!
|
lines: [OrderLine]!
|
||||||
actions: [OrderAction]!
|
actions: [OrderAction]!
|
||||||
|
@ -2310,6 +2321,16 @@ type OrderCapture {
|
||||||
orderErrors: [OrderError!]
|
orderErrors: [OrderError!]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type OrderClearMeta {
|
||||||
|
errors: [Error!]
|
||||||
|
order: Order
|
||||||
|
}
|
||||||
|
|
||||||
|
type OrderClearPrivateMeta {
|
||||||
|
errors: [Error!]
|
||||||
|
order: Order
|
||||||
|
}
|
||||||
|
|
||||||
type OrderCountableConnection {
|
type OrderCountableConnection {
|
||||||
pageInfo: PageInfo!
|
pageInfo: PageInfo!
|
||||||
edges: [OrderCountableEdge!]!
|
edges: [OrderCountableEdge!]!
|
||||||
|
@ -2504,6 +2525,16 @@ input OrderUpdateInput {
|
||||||
shippingAddress: AddressInput
|
shippingAddress: AddressInput
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type OrderUpdateMeta {
|
||||||
|
errors: [Error!]
|
||||||
|
order: Order
|
||||||
|
}
|
||||||
|
|
||||||
|
type OrderUpdatePrivateMeta {
|
||||||
|
errors: [Error!]
|
||||||
|
order: Order
|
||||||
|
}
|
||||||
|
|
||||||
type OrderUpdateShipping {
|
type OrderUpdateShipping {
|
||||||
errors: [Error!]
|
errors: [Error!]
|
||||||
order: Order
|
order: Order
|
||||||
|
@ -2689,6 +2720,11 @@ enum PaymentErrorCode {
|
||||||
UNIQUE
|
UNIQUE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PaymentGateway {
|
||||||
|
name: String!
|
||||||
|
config: [GatewayConfigLine!]!
|
||||||
|
}
|
||||||
|
|
||||||
input PaymentInput {
|
input PaymentInput {
|
||||||
gateway: String!
|
gateway: String!
|
||||||
token: String!
|
token: String!
|
||||||
|
@ -2800,11 +2836,11 @@ type Product implements Node {
|
||||||
meta: [MetaStore]!
|
meta: [MetaStore]!
|
||||||
url: String!
|
url: String!
|
||||||
thumbnail(size: Int): Image
|
thumbnail(size: Int): Image
|
||||||
availability: ProductPricingInfo @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.10, Has been renamed to 'pricing'.")
|
availability: ProductPricingInfo @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.10, Has been renamed to `pricing`.")
|
||||||
pricing: ProductPricingInfo
|
pricing: ProductPricingInfo
|
||||||
isAvailable: Boolean
|
isAvailable: Boolean
|
||||||
basePrice: Money
|
basePrice: Money
|
||||||
price: Money @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.10, has been replaced by 'basePrice'")
|
price: Money @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.10, has been replaced by `basePrice`")
|
||||||
minimalVariantPrice: Money
|
minimalVariantPrice: Money
|
||||||
taxType: TaxType
|
taxType: TaxType
|
||||||
attributes: [SelectedAttribute!]!
|
attributes: [SelectedAttribute!]!
|
||||||
|
@ -3168,7 +3204,7 @@ type ProductVariant implements Node {
|
||||||
stockQuantity: Int!
|
stockQuantity: Int!
|
||||||
priceOverride: Money
|
priceOverride: Money
|
||||||
price: Money @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.10, has been replaced by 'pricing.priceUndiscounted'")
|
price: Money @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.10, has been replaced by 'pricing.priceUndiscounted'")
|
||||||
availability: VariantPricingInfo @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.10, has been renamed to 'pricing'.")
|
availability: VariantPricingInfo @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.10, has been renamed to `pricing`.")
|
||||||
pricing: VariantPricingInfo
|
pricing: VariantPricingInfo
|
||||||
isAvailable: Boolean
|
isAvailable: Boolean
|
||||||
attributes: [SelectedAttribute!]!
|
attributes: [SelectedAttribute!]!
|
||||||
|
@ -3313,7 +3349,7 @@ type Query {
|
||||||
reportProductSales(period: ReportingPeriod!, before: String, after: String, first: Int, last: Int): ProductVariantCountableConnection
|
reportProductSales(period: ReportingPeriod!, before: String, after: String, first: Int, last: Int): ProductVariantCountableConnection
|
||||||
payment(id: ID!): Payment
|
payment(id: ID!): Payment
|
||||||
payments(before: String, after: String, first: Int, last: Int): PaymentCountableConnection
|
payments(before: String, after: String, first: Int, last: Int): PaymentCountableConnection
|
||||||
paymentClientToken(gateway: String!): String
|
paymentClientToken(gateway: String!): String @deprecated(reason: "DEPRECATED: Will be removed in Saleor 2.10, use payment gateway config instead in availablePaymentGateways.")
|
||||||
page(id: ID, slug: String): Page
|
page(id: ID, slug: String): Page
|
||||||
pages(query: String, filter: PageFilterInput, before: String, after: String, first: Int, last: Int): PageCountableConnection
|
pages(query: String, filter: PageFilterInput, before: String, after: String, first: Int, last: Int): PageCountableConnection
|
||||||
homepageEvents(before: String, after: String, first: Int, last: Int): OrderEventCountableConnection
|
homepageEvents(before: String, after: String, first: Int, last: Int): OrderEventCountableConnection
|
||||||
|
@ -3484,7 +3520,7 @@ type ServiceAccount implements Node {
|
||||||
name: String
|
name: String
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServiceAccountClearStoredPrivateMeta {
|
type ServiceAccountClearPrivateMeta {
|
||||||
errors: [Error!]
|
errors: [Error!]
|
||||||
accountErrors: [AccountError!]
|
accountErrors: [AccountError!]
|
||||||
serviceAccount: ServiceAccount
|
serviceAccount: ServiceAccount
|
||||||
|
@ -4026,13 +4062,13 @@ type UserBulkSetActive {
|
||||||
accountErrors: [AccountError!]
|
accountErrors: [AccountError!]
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserClearStoredMeta {
|
type UserClearMeta {
|
||||||
errors: [Error!]
|
errors: [Error!]
|
||||||
accountErrors: [AccountError!]
|
accountErrors: [AccountError!]
|
||||||
user: User
|
user: User
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserClearStoredPrivateMeta {
|
type UserClearPrivateMeta {
|
||||||
errors: [Error!]
|
errors: [Error!]
|
||||||
accountErrors: [AccountError!]
|
accountErrors: [AccountError!]
|
||||||
user: User
|
user: User
|
||||||
|
@ -4223,6 +4259,7 @@ type VoucherUpdate {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Webhook implements Node {
|
type Webhook implements Node {
|
||||||
|
name: String
|
||||||
serviceAccount: ServiceAccount!
|
serviceAccount: ServiceAccount!
|
||||||
targetUrl: String!
|
targetUrl: String!
|
||||||
isActive: Boolean!
|
isActive: Boolean!
|
||||||
|
@ -4249,6 +4286,7 @@ type WebhookCreate {
|
||||||
}
|
}
|
||||||
|
|
||||||
input WebhookCreateInput {
|
input WebhookCreateInput {
|
||||||
|
name: String
|
||||||
targetUrl: String
|
targetUrl: String
|
||||||
events: [WebhookEventTypeEnum]
|
events: [WebhookEventTypeEnum]
|
||||||
serviceAccount: ID
|
serviceAccount: ID
|
||||||
|
@ -4297,6 +4335,7 @@ type WebhookUpdate {
|
||||||
}
|
}
|
||||||
|
|
||||||
input WebhookUpdateInput {
|
input WebhookUpdateInput {
|
||||||
|
name: String
|
||||||
targetUrl: String
|
targetUrl: String
|
||||||
events: [WebhookEventTypeEnum]
|
events: [WebhookEventTypeEnum]
|
||||||
serviceAccount: ID
|
serviceAccount: ID
|
||||||
|
|
|
@ -28,7 +28,8 @@ export enum ListViews {
|
||||||
SALES_LIST = "SALES_LIST",
|
SALES_LIST = "SALES_LIST",
|
||||||
SHIPPING_METHODS_LIST = "SHIPPING_METHODS_LIST",
|
SHIPPING_METHODS_LIST = "SHIPPING_METHODS_LIST",
|
||||||
STAFF_MEMBERS_LIST = "STAFF_MEMBERS_LIST",
|
STAFF_MEMBERS_LIST = "STAFF_MEMBERS_LIST",
|
||||||
VOUCHER_LIST = "VOUCHER_LIST"
|
VOUCHER_LIST = "VOUCHER_LIST",
|
||||||
|
WEBHOOK_LIST = "WEBHOOK_LIST"
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListProps<TColumns extends string = string> {
|
export interface ListProps<TColumns extends string = string> {
|
||||||
|
|
|
@ -272,6 +272,16 @@ export enum VoucherTypeEnum {
|
||||||
SPECIFIC_PRODUCT = "SPECIFIC_PRODUCT",
|
SPECIFIC_PRODUCT = "SPECIFIC_PRODUCT",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum WebhookEventTypeEnum {
|
||||||
|
ALL_EVENTS = "ALL_EVENTS",
|
||||||
|
CUSTOMER_CREATED = "CUSTOMER_CREATED",
|
||||||
|
ORDER_CANCELLED = "ORDER_CANCELLED",
|
||||||
|
ORDER_CREATED = "ORDER_CREATED",
|
||||||
|
ORDER_FULLY_PAID = "ORDER_FULLY_PAID",
|
||||||
|
ORDER_UPDATED = "ORDER_UPDATED",
|
||||||
|
PRODUCT_CREATED = "PRODUCT_CREATED",
|
||||||
|
}
|
||||||
|
|
||||||
export enum WeightUnitsEnum {
|
export enum WeightUnitsEnum {
|
||||||
G = "G",
|
G = "G",
|
||||||
KG = "KG",
|
KG = "KG",
|
||||||
|
@ -775,6 +785,24 @@ export interface VoucherInput {
|
||||||
usageLimit?: number | null;
|
usageLimit?: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface WebhookCreateInput {
|
||||||
|
name?: string | null;
|
||||||
|
targetUrl?: string | null;
|
||||||
|
events?: (WebhookEventTypeEnum | null)[] | null;
|
||||||
|
serviceAccount?: string | null;
|
||||||
|
isActive?: boolean | null;
|
||||||
|
secretKey?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookUpdateInput {
|
||||||
|
name?: string | null;
|
||||||
|
targetUrl?: string | null;
|
||||||
|
events?: (WebhookEventTypeEnum | null)[] | null;
|
||||||
|
serviceAccount?: string | null;
|
||||||
|
isActive?: boolean | null;
|
||||||
|
secretKey?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
//==============================================================
|
//==============================================================
|
||||||
// END Enums and Input Objects
|
// END Enums and Input Objects
|
||||||
//==============================================================
|
//==============================================================
|
||||||
|
|
|
@ -13,19 +13,28 @@ import { ConfigurationItemInput } from "@saleor/types/globalTypes";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useIntl } from "react-intl";
|
import { useIntl } from "react-intl";
|
||||||
|
|
||||||
import { Plugin_plugin } from "../../types/Plugin";
|
import {
|
||||||
import WebhookInfo from "../WebhookInfo";
|
Webhook_webhook,
|
||||||
|
Webhook_webhook_events,
|
||||||
|
Webhook_webhook_serviceAccount
|
||||||
|
} from "../../types/Webhook";
|
||||||
import WebhookEvents from "../WebhookEvents";
|
import WebhookEvents from "../WebhookEvents";
|
||||||
|
import WebhookInfo from "../WebhookInfo";
|
||||||
|
import WebhookStatus from "../WebhookStatus";
|
||||||
|
|
||||||
export interface FormData {
|
export interface FormData {
|
||||||
active: boolean;
|
id: string;
|
||||||
configuration: ConfigurationItemInput[];
|
events: Webhook_webhook_events;
|
||||||
|
isActive: boolean;
|
||||||
|
secretKey: string | null;
|
||||||
|
targetUrl: string;
|
||||||
|
serviceAccount: Webhook_webhook_serviceAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WebhooksDetailsPageProps {
|
export interface WebhooksDetailsPageProps {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
errors: UserError[];
|
errors: UserError[];
|
||||||
plugin: Plugin_plugin;
|
webhook: Webhook_webhook;
|
||||||
saveButtonBarState: ConfirmButtonTransitionState;
|
saveButtonBarState: ConfirmButtonTransitionState;
|
||||||
onBack: () => void;
|
onBack: () => void;
|
||||||
onSubmit: (data: FormData) => void;
|
onSubmit: (data: FormData) => void;
|
||||||
|
@ -33,16 +42,20 @@ export interface WebhooksDetailsPageProps {
|
||||||
|
|
||||||
const WebhooksDetailsPage: React.StatelessComponent<
|
const WebhooksDetailsPage: React.StatelessComponent<
|
||||||
WebhooksDetailsPageProps
|
WebhooksDetailsPageProps
|
||||||
> = ({ disabled, errors, plugin, saveButtonBarState, onBack, onSubmit }) => {
|
> = ({ disabled, errors, webhook, saveButtonBarState, onBack, onSubmit }) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const initialForm: FormData = {
|
const initialForm: FormData = {
|
||||||
active: maybe(() => plugin.active, false),
|
events: maybe(() => webhook.events, []),
|
||||||
configuration: maybe(() => plugin.configuration, [])
|
id: maybe(() => webhook.id, null),
|
||||||
|
isActive: maybe(() => webhook.isActive, false),
|
||||||
|
secretKey: maybe(() => webhook.secretKey, ""),
|
||||||
|
serviceAccount: maybe(() => webhook.serviceAccount, []),
|
||||||
|
targetUrl: maybe(() => webhook.targetUrl, "")
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
|
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
|
||||||
{({ data, errors, hasChanged, submit, set, triggerChange }) => {
|
{({ data, errors, hasChanged, submit, change }) => {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<AppHeader onBack={onBack}>
|
<AppHeader onBack={onBack}>
|
||||||
|
@ -60,7 +73,28 @@ const WebhooksDetailsPage: React.StatelessComponent<
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
<Grid variant="inverted">
|
<Grid variant="inverted">
|
||||||
<div></div>
|
<div>
|
||||||
|
<WebhookInfo
|
||||||
|
data={data}
|
||||||
|
description={maybe(() => plugin.description, "")}
|
||||||
|
errors={errors}
|
||||||
|
onChange={change}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<WebhookEvents
|
||||||
|
data={data}
|
||||||
|
errors={errors}
|
||||||
|
name={maybe(() => plugin.name, "")}
|
||||||
|
onChange={change}
|
||||||
|
/>
|
||||||
|
<WebhookStatus
|
||||||
|
data={data}
|
||||||
|
errors={errors}
|
||||||
|
name={maybe(() => plugin.name, "")}
|
||||||
|
onChange={change}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</Grid>
|
</Grid>
|
||||||
<SaveButtonBar
|
<SaveButtonBar
|
||||||
disabled={disabled || !hasChanged}
|
disabled={disabled || !hasChanged}
|
||||||
|
|
|
@ -21,10 +21,10 @@ import TablePagination from "@saleor/components/TablePagination";
|
||||||
import { translateBoolean } from "@saleor/intl";
|
import { translateBoolean } from "@saleor/intl";
|
||||||
import { maybe, renderCollection } from "@saleor/misc";
|
import { maybe, renderCollection } from "@saleor/misc";
|
||||||
import { ListProps } from "@saleor/types";
|
import { ListProps } from "@saleor/types";
|
||||||
import { Plugins_plugins_edges_node } from "../../types/Plugins";
|
import { Webhooks_webhooks_edges_node } from "../../types/Webhooks";
|
||||||
|
|
||||||
export interface WebhooksListProps extends ListProps {
|
export interface WebhooksListProps extends ListProps {
|
||||||
webhooks: Plugins_plugins_edges_node[];
|
webhooks: Webhooks_webhooks_edges_node[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = (theme: Theme) =>
|
const styles = (theme: Theme) =>
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
export { default } from "./WebhooksListt";
|
export { default } from "./WebhooksList";
|
||||||
export * from "./WebhooksListt";
|
export * from "./WebhooksList";
|
||||||
|
|
|
@ -6,11 +6,11 @@ import Container from "@saleor/components/Container";
|
||||||
import PageHeader from "@saleor/components/PageHeader";
|
import PageHeader from "@saleor/components/PageHeader";
|
||||||
import { sectionNames } from "@saleor/intl";
|
import { sectionNames } from "@saleor/intl";
|
||||||
import { PageListProps } from "@saleor/types";
|
import { PageListProps } from "@saleor/types";
|
||||||
import { Plugins_plugins_edges_node } from "../../types/Plugins";
|
import { Webhooks_webhooks_edges_node } from "../../types/Webhooks";
|
||||||
import WebhooksList from "../WebhooksList/WebhooksList";
|
import WebhooksList from "../WebhooksList/WebhooksList";
|
||||||
|
|
||||||
export interface WebhooksListPageProps extends PageListProps {
|
export interface WebhooksListPageProps extends PageListProps {
|
||||||
plugins: Plugins_plugins_edges_node[];
|
webhooks: Webhooks_webhooks_edges_node[];
|
||||||
onBack: () => void;
|
onBack: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { WebhookUpdate, WebhookUpdateVariables } from "./types/WebhookUpdate";
|
||||||
const webhookCreate = gql`
|
const webhookCreate = gql`
|
||||||
${webhooksDetailsFragment}
|
${webhooksDetailsFragment}
|
||||||
mutation WebhookCreate($input: WebhookCreateInput!) {
|
mutation WebhookCreate($input: WebhookCreateInput!) {
|
||||||
WebhookCreate(input: $input) {
|
webhookCreate(input: $input) {
|
||||||
errors {
|
errors {
|
||||||
field
|
field
|
||||||
message
|
message
|
||||||
|
@ -28,7 +28,7 @@ export const TypedWebhookCreate = TypedMutation<
|
||||||
const webhookUpdate = gql`
|
const webhookUpdate = gql`
|
||||||
${webhooksDetailsFragment}
|
${webhooksDetailsFragment}
|
||||||
mutation WebhookUpdate($id: ID!, $input: WebhookUpdateInput!) {
|
mutation WebhookUpdate($id: ID!, $input: WebhookUpdateInput!) {
|
||||||
WebhookUpdate(id: $id, input: $input) {
|
webhookUpdate(id: $id, input: $input) {
|
||||||
errors {
|
errors {
|
||||||
field
|
field
|
||||||
message
|
message
|
||||||
|
@ -46,7 +46,7 @@ export const TypedWebhookUpdate = TypedMutation<
|
||||||
|
|
||||||
const WebhookDelete = gql`
|
const WebhookDelete = gql`
|
||||||
mutation WebhookDelete($id: ID!) {
|
mutation WebhookDelete($id: ID!) {
|
||||||
WebhookDelete(id: $id) {
|
webhookDelete(id: $id) {
|
||||||
errors {
|
errors {
|
||||||
field
|
field
|
||||||
message
|
message
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { Webhooks, WebhooksVariables } from "./types/Webhooks";
|
||||||
export const webhooksFragment = gql`
|
export const webhooksFragment = gql`
|
||||||
fragment WebhookFragment on Webhook {
|
fragment WebhookFragment on Webhook {
|
||||||
id
|
id
|
||||||
|
name
|
||||||
events {
|
events {
|
||||||
eventType
|
eventType
|
||||||
}
|
}
|
||||||
|
@ -23,7 +24,7 @@ export const webhooksFragment = gql`
|
||||||
export const webhooksDetailsFragment = gql`
|
export const webhooksDetailsFragment = gql`
|
||||||
${webhooksFragment}
|
${webhooksFragment}
|
||||||
fragment WebhooksDetailsFragment on Webhook {
|
fragment WebhooksDetailsFragment on Webhook {
|
||||||
...WebhooksFragment
|
...WebhookFragment
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ const webhooksList = gql`
|
||||||
webhooks(before: $before, after: $after, first: $first, last: $last) {
|
webhooks(before: $before, after: $after, first: $first, last: $last) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
...WebhooksFragment
|
...WebhookFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pageInfo {
|
pageInfo {
|
||||||
|
@ -53,7 +54,7 @@ const webhooksDetails = gql`
|
||||||
${webhooksFragment}
|
${webhooksFragment}
|
||||||
query Webhook($id: ID!) {
|
query Webhook($id: ID!) {
|
||||||
webhook(id: $id) {
|
webhook(id: $id) {
|
||||||
...WebhooksFragment
|
...WebhookFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
37
src/webhooks/types/Webhook.ts
Normal file
37
src/webhooks/types/Webhook.ts
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// GraphQL query operation: Webhook
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
export interface Webhook_webhook_events {
|
||||||
|
__typename: "WebhookEvent";
|
||||||
|
eventType: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Webhook_webhook_serviceAccount {
|
||||||
|
__typename: "ServiceAccount";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Webhook_webhook {
|
||||||
|
__typename: "Webhook";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
events: (Webhook_webhook_events | null)[] | null;
|
||||||
|
isActive: boolean;
|
||||||
|
secretKey: string | null;
|
||||||
|
targetUrl: string;
|
||||||
|
serviceAccount: Webhook_webhook_serviceAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Webhook {
|
||||||
|
webhook: Webhook_webhook | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookVariables {
|
||||||
|
id: string;
|
||||||
|
}
|
51
src/webhooks/types/WebhookCreate.ts
Normal file
51
src/webhooks/types/WebhookCreate.ts
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
|
import { WebhookCreateInput } from "./../../types/globalTypes";
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// GraphQL mutation operation: WebhookCreate
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
export interface WebhookCreate_webhookCreate_errors {
|
||||||
|
__typename: "Error";
|
||||||
|
field: string | null;
|
||||||
|
message: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookCreate_webhookCreate_webhook_events {
|
||||||
|
__typename: "WebhookEvent";
|
||||||
|
eventType: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookCreate_webhookCreate_webhook_serviceAccount {
|
||||||
|
__typename: "ServiceAccount";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookCreate_webhookCreate_webhook {
|
||||||
|
__typename: "Webhook";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
events: (WebhookCreate_webhookCreate_webhook_events | null)[] | null;
|
||||||
|
isActive: boolean;
|
||||||
|
secretKey: string | null;
|
||||||
|
targetUrl: string;
|
||||||
|
serviceAccount: WebhookCreate_webhookCreate_webhook_serviceAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookCreate_webhookCreate {
|
||||||
|
__typename: "WebhookCreate";
|
||||||
|
errors: WebhookCreate_webhookCreate_errors[] | null;
|
||||||
|
webhook: WebhookCreate_webhookCreate_webhook | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookCreate {
|
||||||
|
webhookCreate: WebhookCreate_webhookCreate | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookCreateVariables {
|
||||||
|
input: WebhookCreateInput;
|
||||||
|
}
|
26
src/webhooks/types/WebhookDelete.ts
Normal file
26
src/webhooks/types/WebhookDelete.ts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// GraphQL mutation operation: WebhookDelete
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
export interface WebhookDelete_webhookDelete_errors {
|
||||||
|
__typename: "Error";
|
||||||
|
field: string | null;
|
||||||
|
message: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookDelete_webhookDelete {
|
||||||
|
__typename: "WebhookDelete";
|
||||||
|
errors: WebhookDelete_webhookDelete_errors[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookDelete {
|
||||||
|
webhookDelete: WebhookDelete_webhookDelete | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookDeleteVariables {
|
||||||
|
id: string;
|
||||||
|
}
|
29
src/webhooks/types/WebhookFragment.ts
Normal file
29
src/webhooks/types/WebhookFragment.ts
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// GraphQL fragment: WebhookFragment
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
export interface WebhookFragment_events {
|
||||||
|
__typename: "WebhookEvent";
|
||||||
|
eventType: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookFragment_serviceAccount {
|
||||||
|
__typename: "ServiceAccount";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookFragment {
|
||||||
|
__typename: "Webhook";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
events: (WebhookFragment_events | null)[] | null;
|
||||||
|
isActive: boolean;
|
||||||
|
secretKey: string | null;
|
||||||
|
targetUrl: string;
|
||||||
|
serviceAccount: WebhookFragment_serviceAccount;
|
||||||
|
}
|
52
src/webhooks/types/WebhookUpdate.ts
Normal file
52
src/webhooks/types/WebhookUpdate.ts
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
|
import { WebhookUpdateInput } from "./../../types/globalTypes";
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// GraphQL mutation operation: WebhookUpdate
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
export interface WebhookUpdate_webhookUpdate_errors {
|
||||||
|
__typename: "Error";
|
||||||
|
field: string | null;
|
||||||
|
message: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookUpdate_webhookUpdate_webhook_events {
|
||||||
|
__typename: "WebhookEvent";
|
||||||
|
eventType: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookUpdate_webhookUpdate_webhook_serviceAccount {
|
||||||
|
__typename: "ServiceAccount";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookUpdate_webhookUpdate_webhook {
|
||||||
|
__typename: "Webhook";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
events: (WebhookUpdate_webhookUpdate_webhook_events | null)[] | null;
|
||||||
|
isActive: boolean;
|
||||||
|
secretKey: string | null;
|
||||||
|
targetUrl: string;
|
||||||
|
serviceAccount: WebhookUpdate_webhookUpdate_webhook_serviceAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookUpdate_webhookUpdate {
|
||||||
|
__typename: "WebhookUpdate";
|
||||||
|
errors: WebhookUpdate_webhookUpdate_errors[] | null;
|
||||||
|
webhook: WebhookUpdate_webhookUpdate_webhook | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookUpdate {
|
||||||
|
webhookUpdate: WebhookUpdate_webhookUpdate | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhookUpdateVariables {
|
||||||
|
id: string;
|
||||||
|
input: WebhookUpdateInput;
|
||||||
|
}
|
59
src/webhooks/types/Webhooks.ts
Normal file
59
src/webhooks/types/Webhooks.ts
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// GraphQL query operation: Webhooks
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
export interface Webhooks_webhooks_edges_node_events {
|
||||||
|
__typename: "WebhookEvent";
|
||||||
|
eventType: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Webhooks_webhooks_edges_node_serviceAccount {
|
||||||
|
__typename: "ServiceAccount";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Webhooks_webhooks_edges_node {
|
||||||
|
__typename: "Webhook";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
events: (Webhooks_webhooks_edges_node_events | null)[] | null;
|
||||||
|
isActive: boolean;
|
||||||
|
secretKey: string | null;
|
||||||
|
targetUrl: string;
|
||||||
|
serviceAccount: Webhooks_webhooks_edges_node_serviceAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Webhooks_webhooks_edges {
|
||||||
|
__typename: "WebhookCountableEdge";
|
||||||
|
node: Webhooks_webhooks_edges_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Webhooks_webhooks_pageInfo {
|
||||||
|
__typename: "PageInfo";
|
||||||
|
hasPreviousPage: boolean;
|
||||||
|
hasNextPage: boolean;
|
||||||
|
startCursor: string | null;
|
||||||
|
endCursor: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Webhooks_webhooks {
|
||||||
|
__typename: "WebhookCountableConnection";
|
||||||
|
edges: Webhooks_webhooks_edges[];
|
||||||
|
pageInfo: Webhooks_webhooks_pageInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Webhooks {
|
||||||
|
webhooks: Webhooks_webhooks | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhooksVariables {
|
||||||
|
first?: number | null;
|
||||||
|
after?: string | null;
|
||||||
|
last?: number | null;
|
||||||
|
before?: string | null;
|
||||||
|
}
|
29
src/webhooks/types/WebhooksDetailsFragment.ts
Normal file
29
src/webhooks/types/WebhooksDetailsFragment.ts
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// GraphQL fragment: WebhooksDetailsFragment
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
export interface WebhooksDetailsFragment_events {
|
||||||
|
__typename: "WebhookEvent";
|
||||||
|
eventType: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhooksDetailsFragment_serviceAccount {
|
||||||
|
__typename: "ServiceAccount";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebhooksDetailsFragment {
|
||||||
|
__typename: "Webhook";
|
||||||
|
id: string;
|
||||||
|
name: string | null;
|
||||||
|
events: (WebhooksDetailsFragment_events | null)[] | null;
|
||||||
|
isActive: boolean;
|
||||||
|
secretKey: string | null;
|
||||||
|
targetUrl: string;
|
||||||
|
serviceAccount: WebhooksDetailsFragment_serviceAccount;
|
||||||
|
}
|
|
@ -6,35 +6,35 @@ import { useIntl } from "react-intl";
|
||||||
|
|
||||||
import { getMutationState, maybe } from "../../misc";
|
import { getMutationState, maybe } from "../../misc";
|
||||||
import WebhooksDetailsPage from "../components/WebhooksDetailsPage";
|
import WebhooksDetailsPage from "../components/WebhooksDetailsPage";
|
||||||
import { TypedPluginUpdate } from "../mutations";
|
import { TypedWebhookUpdate } from "../mutations";
|
||||||
import { TypedPluginsDetailsQuery } from "../queries";
|
import { TypedWebhooksDetailsQuery } from "../queries";
|
||||||
import { pluginsListUrl, PluginsListUrlQueryParams } from "../urls";
|
import { webhooksListUrl, WebhooksListUrlQueryParams } from "../urls";
|
||||||
|
|
||||||
export interface PluginsDetailsProps {
|
export interface WebhooksDetailsProps {
|
||||||
id: string;
|
id: string;
|
||||||
params: PluginsListUrlQueryParams;
|
params: WebhooksListUrlQueryParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PluginsDetails: React.StatelessComponent<PluginsDetailsProps> = ({
|
export const WebhooksDetails: React.StatelessComponent<
|
||||||
id
|
WebhooksDetailsProps
|
||||||
}) => {
|
> = ({ id }) => {
|
||||||
const navigate = useNavigator();
|
const navigate = useNavigator();
|
||||||
const notify = useNotifier();
|
const notify = useNotifier();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TypedPluginUpdate>
|
<TypedWebhookUpdate>
|
||||||
{(pluginUpdate, pluginUpdateOpts) => (
|
{(webhookUpdate, webhookUpdateOpts) => (
|
||||||
<TypedPluginsDetailsQuery variables={{ id }}>
|
<TypedWebhooksDetailsQuery variables={{ id }}>
|
||||||
{PluginDetails => {
|
{WebhookDetails => {
|
||||||
const formTransitionState = getMutationState(
|
const formTransitionState = getMutationState(
|
||||||
pluginUpdateOpts.called,
|
webhookUpdateOpts.called,
|
||||||
pluginUpdateOpts.loading,
|
webhookUpdateOpts.loading,
|
||||||
maybe(() => pluginUpdateOpts.data.pluginUpdate.errors)
|
maybe(() => webhookUpdateOpts.data.webhookUpdate.errors)
|
||||||
);
|
);
|
||||||
|
|
||||||
const formErrors = maybe(
|
const formErrors = maybe(
|
||||||
() => pluginUpdateOpts.data.pluginUpdate.errors,
|
() => webhookUpdateOpts.data.webhookUpdate.errors,
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ export const PluginsDetails: React.StatelessComponent<PluginsDetailsProps> = ({
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (pluginUpdateOpts.data) {
|
if (webhookUpdateOpts.data) {
|
||||||
notify({
|
notify({
|
||||||
text: intl.formatMessage({
|
text: intl.formatMessage({
|
||||||
defaultMessage: "Succesfully updated plugin settings",
|
defaultMessage: "Succesfully updated plugin settings",
|
||||||
|
@ -58,14 +58,14 @@ export const PluginsDetails: React.StatelessComponent<PluginsDetailsProps> = ({
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<WindowTitle
|
<WindowTitle
|
||||||
title={maybe(() => PluginDetails.data.plugin.name)}
|
title={maybe(() => WebhookDetails.data.webhook.name)}
|
||||||
/>
|
/>
|
||||||
<WebhooksDetailsPage
|
<WebhooksDetailsPage
|
||||||
disabled={PluginDetails.loading}
|
disabled={WebhookDetails.loading}
|
||||||
errors={formErrors}
|
errors={formErrors}
|
||||||
saveButtonBarState={formTransitionState}
|
saveButtonBarState={formTransitionState}
|
||||||
plugin={maybe(() => PluginDetails.data.plugin)}
|
webhook={maybe(() => WebhookDetails.data.webook)}
|
||||||
onBack={() => navigate(pluginsListUrl())}
|
onBack={() => navigate(webhooksListUrl())}
|
||||||
onSubmit={formData => {
|
onSubmit={formData => {
|
||||||
const configurationInput =
|
const configurationInput =
|
||||||
formData.configuration &&
|
formData.configuration &&
|
||||||
|
@ -75,7 +75,7 @@ export const PluginsDetails: React.StatelessComponent<PluginsDetailsProps> = ({
|
||||||
value: item.value.toString()
|
value: item.value.toString()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
pluginUpdate({
|
webhookUpdate({
|
||||||
variables: {
|
variables: {
|
||||||
id,
|
id,
|
||||||
input: {
|
input: {
|
||||||
|
@ -91,10 +91,10 @@ export const PluginsDetails: React.StatelessComponent<PluginsDetailsProps> = ({
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
</TypedPluginsDetailsQuery>
|
</TypedWebhooksDetailsQuery>
|
||||||
)}
|
)}
|
||||||
</TypedPluginUpdate>
|
</TypedWebhookUpdate>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
PluginsDetails.displayName = "PluginsDetails";
|
WebhooksDetails.displayName = "WebhooksDetails";
|
||||||
export default PluginsDetails;
|
export default WebhooksDetails;
|
||||||
|
|
|
@ -8,21 +8,21 @@ import { maybe } from "@saleor/misc";
|
||||||
import { ListViews } from "@saleor/types";
|
import { ListViews } from "@saleor/types";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import WebhooksListPage from "../components/WebhooksListPage/PluginsListPage";
|
import WebhooksListPage from "../components/WebhooksListPage/WebhooksListPage";
|
||||||
import { TypedWebhooksListQuery } from "../queries";
|
import { TypedWebhooksListQuery } from "../queries";
|
||||||
import { WebhooksListUrlQueryParams, webhooksUrl } from "../urls";
|
import { WebhooksListUrlQueryParams, webhooksUrl } from "../urls";
|
||||||
|
|
||||||
interface PluginsListProps {
|
interface WebhooksListProps {
|
||||||
params: WebhooksListUrlQueryParams;
|
params: WebhooksListUrlQueryParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PluginsList: React.StatelessComponent<PluginsListProps> = ({
|
export const WebhooksList: React.StatelessComponent<WebhooksListProps> = ({
|
||||||
params
|
params
|
||||||
}) => {
|
}) => {
|
||||||
const navigate = useNavigator();
|
const navigate = useNavigator();
|
||||||
const paginate = usePaginator();
|
const paginate = usePaginator();
|
||||||
const { updateListSettings, settings } = useListSettings(
|
const { updateListSettings, settings } = useListSettings(
|
||||||
ListViews.PLUGINS_LIST
|
ListViews.WEBHOOK_LIST
|
||||||
);
|
);
|
||||||
const paginationState = createPaginationState(settings.rowNumber, params);
|
const paginationState = createPaginationState(settings.rowNumber, params);
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ export const PluginsList: React.StatelessComponent<PluginsListProps> = ({
|
||||||
<TypedWebhooksListQuery displayLoader variables={paginationState}>
|
<TypedWebhooksListQuery displayLoader variables={paginationState}>
|
||||||
{({ data, loading }) => {
|
{({ data, loading }) => {
|
||||||
const { loadNextPage, loadPreviousPage, pageInfo } = paginate(
|
const { loadNextPage, loadPreviousPage, pageInfo } = paginate(
|
||||||
maybe(() => data.plugins.pageInfo),
|
maybe(() => data.webhooks.pageInfo),
|
||||||
paginationState,
|
paginationState,
|
||||||
params
|
params
|
||||||
);
|
);
|
||||||
|
@ -39,7 +39,7 @@ export const PluginsList: React.StatelessComponent<PluginsListProps> = ({
|
||||||
<WebhooksListPage
|
<WebhooksListPage
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
settings={settings}
|
settings={settings}
|
||||||
webhooks={maybe(() => data.plugins.edges.map(edge => edge.node))}
|
webhooks={maybe(() => data.webhooks.edges.map(edge => edge.node))}
|
||||||
pageInfo={pageInfo}
|
pageInfo={pageInfo}
|
||||||
onAdd={() => navigate(configurationMenuUrl)}
|
onAdd={() => navigate(configurationMenuUrl)}
|
||||||
onBack={() => navigate(configurationMenuUrl)}
|
onBack={() => navigate(configurationMenuUrl)}
|
||||||
|
@ -55,4 +55,4 @@ export const PluginsList: React.StatelessComponent<PluginsListProps> = ({
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default PluginsList;
|
export default WebhooksList;
|
||||||
|
|
Loading…
Reference in a new issue