Update types

This commit is contained in:
Krzysztof Bialoglowicz 2019-10-09 08:56:46 +02:00
parent 4021b8ec62
commit be8095b22f
18 changed files with 457 additions and 71 deletions

View file

@ -604,7 +604,7 @@ type Checkout implements Node {
privateMeta: [MetaStore]!
meta: [MetaStore]!
availableShippingMethods: [ShippingMethod]!
availablePaymentGateways: [String]!
availablePaymentGateways: [PaymentGateway]!
email: String!
isShippingRequired: Boolean!
lines: [CheckoutLine]
@ -625,13 +625,13 @@ type CheckoutBillingAddressUpdate {
checkoutErrors: [CheckoutError!]
}
type CheckoutClearStoredMeta {
type CheckoutClearMeta {
errors: [Error!]
checkoutErrors: [CheckoutError!]
checkout: Checkout
}
type CheckoutClearStoredPrivateMeta {
type CheckoutClearPrivateMeta {
errors: [Error!]
checkoutErrors: [CheckoutError!]
checkout: Checkout
@ -1610,6 +1610,11 @@ input FulfillmentUpdateTrackingInput {
notifyCustomer: Boolean
}
type GatewayConfigLine {
field: String!
value: String
}
scalar GenericScalar
type Geolocalization {
@ -2107,12 +2112,16 @@ type Mutations {
orderAddNote(order: ID!, input: OrderAddNoteInput!): OrderAddNote
orderCancel(id: ID!, restock: Boolean!): OrderCancel
orderCapture(amount: Decimal!, id: ID!): OrderCapture
orderClearPrivateMeta(id: ID!, input: MetaPath!): OrderClearPrivateMeta
orderClearMeta(id: ID!, input: MetaPath!): OrderClearMeta
orderFulfillmentCancel(id: ID!, input: FulfillmentCancelInput!): FulfillmentCancel
orderFulfillmentCreate(input: FulfillmentCreateInput!, order: ID): FulfillmentCreate
orderFulfillmentUpdateTracking(id: ID!, input: FulfillmentUpdateTrackingInput!): FulfillmentUpdateTracking
orderMarkAsPaid(id: ID!): OrderMarkAsPaid
orderRefund(amount: Decimal!, id: ID!): OrderRefund
orderUpdate(id: ID!, input: OrderUpdateInput!): OrderUpdate
orderUpdateMeta(id: ID!, input: MetaInput!): OrderUpdateMeta
orderUpdatePrivateMeta(id: ID!, input: MetaInput!): OrderUpdatePrivateMeta
orderUpdateShipping(order: ID!, input: OrderUpdateShippingInput): OrderUpdateShipping
orderVoid(id: ID!): OrderVoid
orderBulkCancel(ids: [ID]!, restock: Boolean!): OrderBulkCancel
@ -2165,14 +2174,14 @@ type Mutations {
checkoutShippingMethodUpdate(checkoutId: ID, shippingMethodId: ID!): CheckoutShippingMethodUpdate
checkoutUpdateVoucher(checkoutId: ID!, voucherCode: String): CheckoutUpdateVoucher
checkoutUpdateMetadata(id: ID!, input: MetaInput!): CheckoutUpdateMeta
checkoutClearMetadata(id: ID!, input: MetaPath!): CheckoutClearStoredMeta
checkoutClearMetadata(id: ID!, input: MetaPath!): CheckoutClearMeta
checkoutUpdatePrivateMetadata(id: ID!, input: MetaInput!): CheckoutUpdatePrivateMeta
checkoutClearPrivateMetadata(id: ID!, input: MetaPath!): CheckoutClearStoredPrivateMeta
checkoutClearPrivateMetadata(id: ID!, input: MetaPath!): CheckoutClearPrivateMeta
requestPasswordReset(email: String!, redirectUrl: String!): RequestPasswordReset
setPassword(token: String!, email: String!, password: String!): SetPassword
passwordChange(newPassword: String!, oldPassword: String!): PasswordChange
userUpdateMetadata(id: ID!, input: MetaInput!): UserUpdateMeta
userClearStoredMetadata(id: ID!, input: MetaPath!): UserClearStoredMeta
userClearMetadata(id: ID!, input: MetaPath!): UserClearMeta
accountAddressCreate(input: AddressInput!, type: AddressTypeEnum): AccountAddressCreate
accountAddressUpdate(id: ID!, input: AddressInput!): AccountAddressUpdate
accountAddressDelete(id: ID!): AccountAddressDelete
@ -2202,12 +2211,12 @@ type Mutations {
userAvatarDelete: UserAvatarDelete
userBulkSetActive(ids: [ID]!, isActive: Boolean!): UserBulkSetActive
userUpdatePrivateMetadata(id: ID!, input: MetaInput!): UserUpdatePrivateMeta
userClearStoredPrivateMetadata(id: ID!, input: MetaPath!): UserClearStoredPrivateMeta
userClearPrivateMetadata(id: ID!, input: MetaPath!): UserClearPrivateMeta
serviceAccountCreate(input: ServiceAccountInput!): ServiceAccountCreate
serviceAccountUpdate(id: ID!, input: ServiceAccountInput!): ServiceAccountUpdate
serviceAccountDelete(id: ID!): ServiceAccountDelete
serviceAccountUpdatePrivateMetadata(id: ID!, input: MetaInput!): ServiceAccountUpdatePrivateMeta
serviceAccountClearStoredPrivateMetadata(id: ID!, input: MetaPath!): ServiceAccountClearStoredPrivateMeta
serviceAccountClearPrivateMetadata(id: ID!, input: MetaPath!): ServiceAccountClearPrivateMeta
serviceAccountTokenCreate(input: ServiceAccountTokenInput!): ServiceAccountTokenCreate
serviceAccountTokenDelete(id: ID!): ServiceAccountTokenDelete
passwordReset(email: String!): PasswordReset
@ -2252,6 +2261,8 @@ type Order implements Node {
displayGrossPrices: Boolean!
customerNote: String!
weight: Weight
privateMeta: [MetaStore]!
meta: [MetaStore]!
fulfillments: [Fulfillment]!
lines: [OrderLine]!
actions: [OrderAction]!
@ -2310,6 +2321,16 @@ type OrderCapture {
orderErrors: [OrderError!]
}
type OrderClearMeta {
errors: [Error!]
order: Order
}
type OrderClearPrivateMeta {
errors: [Error!]
order: Order
}
type OrderCountableConnection {
pageInfo: PageInfo!
edges: [OrderCountableEdge!]!
@ -2504,6 +2525,16 @@ input OrderUpdateInput {
shippingAddress: AddressInput
}
type OrderUpdateMeta {
errors: [Error!]
order: Order
}
type OrderUpdatePrivateMeta {
errors: [Error!]
order: Order
}
type OrderUpdateShipping {
errors: [Error!]
order: Order
@ -2689,6 +2720,11 @@ enum PaymentErrorCode {
UNIQUE
}
type PaymentGateway {
name: String!
config: [GatewayConfigLine!]!
}
input PaymentInput {
gateway: String!
token: String!
@ -2800,11 +2836,11 @@ type Product implements Node {
meta: [MetaStore]!
url: String!
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
isAvailable: Boolean
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
taxType: TaxType
attributes: [SelectedAttribute!]!
@ -3168,7 +3204,7 @@ type ProductVariant implements Node {
stockQuantity: Int!
priceOverride: Money
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
isAvailable: Boolean
attributes: [SelectedAttribute!]!
@ -3313,7 +3349,7 @@ type Query {
reportProductSales(period: ReportingPeriod!, before: String, after: String, first: Int, last: Int): ProductVariantCountableConnection
payment(id: ID!): Payment
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
pages(query: String, filter: PageFilterInput, before: String, after: String, first: Int, last: Int): PageCountableConnection
homepageEvents(before: String, after: String, first: Int, last: Int): OrderEventCountableConnection
@ -3484,7 +3520,7 @@ type ServiceAccount implements Node {
name: String
}
type ServiceAccountClearStoredPrivateMeta {
type ServiceAccountClearPrivateMeta {
errors: [Error!]
accountErrors: [AccountError!]
serviceAccount: ServiceAccount
@ -4026,13 +4062,13 @@ type UserBulkSetActive {
accountErrors: [AccountError!]
}
type UserClearStoredMeta {
type UserClearMeta {
errors: [Error!]
accountErrors: [AccountError!]
user: User
}
type UserClearStoredPrivateMeta {
type UserClearPrivateMeta {
errors: [Error!]
accountErrors: [AccountError!]
user: User
@ -4223,6 +4259,7 @@ type VoucherUpdate {
}
type Webhook implements Node {
name: String
serviceAccount: ServiceAccount!
targetUrl: String!
isActive: Boolean!
@ -4249,6 +4286,7 @@ type WebhookCreate {
}
input WebhookCreateInput {
name: String
targetUrl: String
events: [WebhookEventTypeEnum]
serviceAccount: ID
@ -4297,6 +4335,7 @@ type WebhookUpdate {
}
input WebhookUpdateInput {
name: String
targetUrl: String
events: [WebhookEventTypeEnum]
serviceAccount: ID

View file

@ -28,7 +28,8 @@ export enum ListViews {
SALES_LIST = "SALES_LIST",
SHIPPING_METHODS_LIST = "SHIPPING_METHODS_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> {

View file

@ -272,6 +272,16 @@ export enum VoucherTypeEnum {
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 {
G = "G",
KG = "KG",
@ -775,6 +785,24 @@ export interface VoucherInput {
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
//==============================================================

View file

@ -13,19 +13,28 @@ import { ConfigurationItemInput } from "@saleor/types/globalTypes";
import React from "react";
import { useIntl } from "react-intl";
import { Plugin_plugin } from "../../types/Plugin";
import WebhookInfo from "../WebhookInfo";
import {
Webhook_webhook,
Webhook_webhook_events,
Webhook_webhook_serviceAccount
} from "../../types/Webhook";
import WebhookEvents from "../WebhookEvents";
import WebhookInfo from "../WebhookInfo";
import WebhookStatus from "../WebhookStatus";
export interface FormData {
active: boolean;
configuration: ConfigurationItemInput[];
id: string;
events: Webhook_webhook_events;
isActive: boolean;
secretKey: string | null;
targetUrl: string;
serviceAccount: Webhook_webhook_serviceAccount;
}
export interface WebhooksDetailsPageProps {
disabled: boolean;
errors: UserError[];
plugin: Plugin_plugin;
webhook: Webhook_webhook;
saveButtonBarState: ConfirmButtonTransitionState;
onBack: () => void;
onSubmit: (data: FormData) => void;
@ -33,16 +42,20 @@ export interface WebhooksDetailsPageProps {
const WebhooksDetailsPage: React.StatelessComponent<
WebhooksDetailsPageProps
> = ({ disabled, errors, plugin, saveButtonBarState, onBack, onSubmit }) => {
> = ({ disabled, errors, webhook, saveButtonBarState, onBack, onSubmit }) => {
const intl = useIntl();
const initialForm: FormData = {
active: maybe(() => plugin.active, false),
configuration: maybe(() => plugin.configuration, [])
events: maybe(() => webhook.events, []),
id: maybe(() => webhook.id, null),
isActive: maybe(() => webhook.isActive, false),
secretKey: maybe(() => webhook.secretKey, ""),
serviceAccount: maybe(() => webhook.serviceAccount, []),
targetUrl: maybe(() => webhook.targetUrl, "")
};
return (
<Form errors={errors} initial={initialForm} onSubmit={onSubmit}>
{({ data, errors, hasChanged, submit, set, triggerChange }) => {
{({ data, errors, hasChanged, submit, change }) => {
return (
<Container>
<AppHeader onBack={onBack}>
@ -60,7 +73,28 @@ const WebhooksDetailsPage: React.StatelessComponent<
)}
/>
<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>
<SaveButtonBar
disabled={disabled || !hasChanged}

View file

@ -21,10 +21,10 @@ import TablePagination from "@saleor/components/TablePagination";
import { translateBoolean } from "@saleor/intl";
import { maybe, renderCollection } from "@saleor/misc";
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 {
webhooks: Plugins_plugins_edges_node[];
webhooks: Webhooks_webhooks_edges_node[];
}
const styles = (theme: Theme) =>

View file

@ -1,2 +1,2 @@
export { default } from "./WebhooksListt";
export * from "./WebhooksListt";
export { default } from "./WebhooksList";
export * from "./WebhooksList";

View file

@ -6,11 +6,11 @@ import Container from "@saleor/components/Container";
import PageHeader from "@saleor/components/PageHeader";
import { sectionNames } from "@saleor/intl";
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";
export interface WebhooksListPageProps extends PageListProps {
plugins: Plugins_plugins_edges_node[];
webhooks: Webhooks_webhooks_edges_node[];
onBack: () => void;
}

View file

@ -9,7 +9,7 @@ import { WebhookUpdate, WebhookUpdateVariables } from "./types/WebhookUpdate";
const webhookCreate = gql`
${webhooksDetailsFragment}
mutation WebhookCreate($input: WebhookCreateInput!) {
WebhookCreate(input: $input) {
webhookCreate(input: $input) {
errors {
field
message
@ -28,7 +28,7 @@ export const TypedWebhookCreate = TypedMutation<
const webhookUpdate = gql`
${webhooksDetailsFragment}
mutation WebhookUpdate($id: ID!, $input: WebhookUpdateInput!) {
WebhookUpdate(id: $id, input: $input) {
webhookUpdate(id: $id, input: $input) {
errors {
field
message
@ -46,7 +46,7 @@ export const TypedWebhookUpdate = TypedMutation<
const WebhookDelete = gql`
mutation WebhookDelete($id: ID!) {
WebhookDelete(id: $id) {
webhookDelete(id: $id) {
errors {
field
message

View file

@ -7,6 +7,7 @@ import { Webhooks, WebhooksVariables } from "./types/Webhooks";
export const webhooksFragment = gql`
fragment WebhookFragment on Webhook {
id
name
events {
eventType
}
@ -23,7 +24,7 @@ export const webhooksFragment = gql`
export const webhooksDetailsFragment = gql`
${webhooksFragment}
fragment WebhooksDetailsFragment on Webhook {
...WebhooksFragment
...WebhookFragment
}
`;
@ -33,7 +34,7 @@ const webhooksList = gql`
webhooks(before: $before, after: $after, first: $first, last: $last) {
edges {
node {
...WebhooksFragment
...WebhookFragment
}
}
pageInfo {
@ -53,7 +54,7 @@ const webhooksDetails = gql`
${webhooksFragment}
query Webhook($id: ID!) {
webhook(id: $id) {
...WebhooksFragment
...WebhookFragment
}
}
`;

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View file

@ -6,35 +6,35 @@ import { useIntl } from "react-intl";
import { getMutationState, maybe } from "../../misc";
import WebhooksDetailsPage from "../components/WebhooksDetailsPage";
import { TypedPluginUpdate } from "../mutations";
import { TypedPluginsDetailsQuery } from "../queries";
import { pluginsListUrl, PluginsListUrlQueryParams } from "../urls";
import { TypedWebhookUpdate } from "../mutations";
import { TypedWebhooksDetailsQuery } from "../queries";
import { webhooksListUrl, WebhooksListUrlQueryParams } from "../urls";
export interface PluginsDetailsProps {
export interface WebhooksDetailsProps {
id: string;
params: PluginsListUrlQueryParams;
params: WebhooksListUrlQueryParams;
}
export const PluginsDetails: React.StatelessComponent<PluginsDetailsProps> = ({
id
}) => {
export const WebhooksDetails: React.StatelessComponent<
WebhooksDetailsProps
> = ({ id }) => {
const navigate = useNavigator();
const notify = useNotifier();
const intl = useIntl();
return (
<TypedPluginUpdate>
{(pluginUpdate, pluginUpdateOpts) => (
<TypedPluginsDetailsQuery variables={{ id }}>
{PluginDetails => {
<TypedWebhookUpdate>
{(webhookUpdate, webhookUpdateOpts) => (
<TypedWebhooksDetailsQuery variables={{ id }}>
{WebhookDetails => {
const formTransitionState = getMutationState(
pluginUpdateOpts.called,
pluginUpdateOpts.loading,
maybe(() => pluginUpdateOpts.data.pluginUpdate.errors)
webhookUpdateOpts.called,
webhookUpdateOpts.loading,
maybe(() => webhookUpdateOpts.data.webhookUpdate.errors)
);
const formErrors = maybe(
() => pluginUpdateOpts.data.pluginUpdate.errors,
() => webhookUpdateOpts.data.webhookUpdate.errors,
[]
);
@ -45,7 +45,7 @@ export const PluginsDetails: React.StatelessComponent<PluginsDetailsProps> = ({
});
});
} else {
if (pluginUpdateOpts.data) {
if (webhookUpdateOpts.data) {
notify({
text: intl.formatMessage({
defaultMessage: "Succesfully updated plugin settings",
@ -58,14 +58,14 @@ export const PluginsDetails: React.StatelessComponent<PluginsDetailsProps> = ({
return (
<>
<WindowTitle
title={maybe(() => PluginDetails.data.plugin.name)}
title={maybe(() => WebhookDetails.data.webhook.name)}
/>
<WebhooksDetailsPage
disabled={PluginDetails.loading}
disabled={WebhookDetails.loading}
errors={formErrors}
saveButtonBarState={formTransitionState}
plugin={maybe(() => PluginDetails.data.plugin)}
onBack={() => navigate(pluginsListUrl())}
webhook={maybe(() => WebhookDetails.data.webook)}
onBack={() => navigate(webhooksListUrl())}
onSubmit={formData => {
const configurationInput =
formData.configuration &&
@ -75,7 +75,7 @@ export const PluginsDetails: React.StatelessComponent<PluginsDetailsProps> = ({
value: item.value.toString()
};
});
pluginUpdate({
webhookUpdate({
variables: {
id,
input: {
@ -91,10 +91,10 @@ export const PluginsDetails: React.StatelessComponent<PluginsDetailsProps> = ({
</>
);
}}
</TypedPluginsDetailsQuery>
</TypedWebhooksDetailsQuery>
)}
</TypedPluginUpdate>
</TypedWebhookUpdate>
);
};
PluginsDetails.displayName = "PluginsDetails";
export default PluginsDetails;
WebhooksDetails.displayName = "WebhooksDetails";
export default WebhooksDetails;

View file

@ -8,21 +8,21 @@ import { maybe } from "@saleor/misc";
import { ListViews } from "@saleor/types";
import React from "react";
import WebhooksListPage from "../components/WebhooksListPage/PluginsListPage";
import WebhooksListPage from "../components/WebhooksListPage/WebhooksListPage";
import { TypedWebhooksListQuery } from "../queries";
import { WebhooksListUrlQueryParams, webhooksUrl } from "../urls";
interface PluginsListProps {
interface WebhooksListProps {
params: WebhooksListUrlQueryParams;
}
export const PluginsList: React.StatelessComponent<PluginsListProps> = ({
export const WebhooksList: React.StatelessComponent<WebhooksListProps> = ({
params
}) => {
const navigate = useNavigator();
const paginate = usePaginator();
const { updateListSettings, settings } = useListSettings(
ListViews.PLUGINS_LIST
ListViews.WEBHOOK_LIST
);
const paginationState = createPaginationState(settings.rowNumber, params);
@ -30,7 +30,7 @@ export const PluginsList: React.StatelessComponent<PluginsListProps> = ({
<TypedWebhooksListQuery displayLoader variables={paginationState}>
{({ data, loading }) => {
const { loadNextPage, loadPreviousPage, pageInfo } = paginate(
maybe(() => data.plugins.pageInfo),
maybe(() => data.webhooks.pageInfo),
paginationState,
params
);
@ -39,7 +39,7 @@ export const PluginsList: React.StatelessComponent<PluginsListProps> = ({
<WebhooksListPage
disabled={loading}
settings={settings}
webhooks={maybe(() => data.plugins.edges.map(edge => edge.node))}
webhooks={maybe(() => data.webhooks.edges.map(edge => edge.node))}
pageInfo={pageInfo}
onAdd={() => navigate(configurationMenuUrl)}
onBack={() => navigate(configurationMenuUrl)}
@ -55,4 +55,4 @@ export const PluginsList: React.StatelessComponent<PluginsListProps> = ({
);
};
export default PluginsList;
export default WebhooksList;