saleor-dashboard/src/orders/mutations.ts

581 lines
14 KiB
TypeScript
Raw Normal View History

2020-06-23 12:27:44 +00:00
import {
invoiceErrorFragment,
orderErrorFragment,
orderSettingsErrorFragment
2020-06-23 12:27:44 +00:00
} from "@saleor/fragments/errors";
import {
fragmentOrderDetails,
2020-07-07 14:01:16 +00:00
fragmentOrderEvent,
fragmentOrderSettings,
Refunds (#870) * 1721 - add refunds miscellaneous view (#860) * Create new page for Miscellaneous Refunds * Replace refund order dialog with dedicated page * Add data test ids * Update order details view for refunds (#874) * 1719 - add refund entry to order history (#875) * Add refund order history entry * Update refund event with the right query * 1722 - add refunds product view (#873) * Create new page for Miscellaneous Refunds * Replace refund order dialog with dedicated page * Add data test ids * Create refund products table * Implement refund products view * Update refund mutation with product lines input * Fix products quantities on refund page * Fix order refund submission * Fix products refund submission input variables * Filter out fulfillments on refund page * Update refund page in storybook * Fix test snapshots after wrong refunds rebase * Set max refund as captured amount * Refund queries adjustments * Display refund values with nullish coalescing operator * Update test snapshots with refunds * Refactor order refund values calculation * Create and use refund order line fragment * Use old simple refund mutation for miscellaneous refund * Submit for refund only lines with non-zero quantity set * Fix showing refund error * Fix refund details on order details page (#879) * Update order details view for refunds (#874) * 1719 - add refund entry to order history (#875) * Add refund order history entry * Update refund event with the right query * 1722 - add refunds product view (#873) * Create new page for Miscellaneous Refunds * Replace refund order dialog with dedicated page * Add data test ids * Create refund products table * Implement refund products view * Update refund mutation with product lines input * Fix products quantities on refund page * Fix order refund submission * Fix products refund submission input variables * Filter out fulfillments on refund page * Update refund page in storybook * Fix test snapshots after wrong refunds rebase * Set max refund as captured amount * Refund queries adjustments * Display refund values with nullish coalescing operator * Update test snapshots with refunds * Refactor order refund values calculation * Create and use refund order line fragment * Use old simple refund mutation for miscellaneous refund * Submit for refund only lines with non-zero quantity set * Fix showing refund error * Add missing refund amount to order history * Merge repeated order lines in fulfillment lines * Update order history events types and test snapshots * Update changelog with refunds changes
2020-12-01 13:13:05 +00:00
fulfillmentFragment,
2020-07-07 14:01:16 +00:00
invoiceFragment
} from "@saleor/fragments/orders";
import makeMutation from "@saleor/hooks/makeMutation";
2019-06-19 14:40:52 +00:00
import gql from "graphql-tag";
import { TypedMutation } from "../mutations";
import { FulfillOrder, FulfillOrderVariables } from "./types/FulfillOrder";
2020-06-23 14:44:34 +00:00
import {
InvoiceEmailSend,
InvoiceEmailSendVariables
} from "./types/InvoiceEmailSend";
2020-06-23 12:27:44 +00:00
import {
InvoiceRequest,
InvoiceRequestVariables
} from "./types/InvoiceRequest";
2019-06-19 14:40:52 +00:00
import { OrderAddNote, OrderAddNoteVariables } from "./types/OrderAddNote";
import { OrderCancel, OrderCancelVariables } from "./types/OrderCancel";
import { OrderCapture, OrderCaptureVariables } from "./types/OrderCapture";
import { OrderConfirm, OrderConfirmVariables } from "./types/OrderConfirm";
2019-06-19 14:40:52 +00:00
import {
OrderDraftBulkCancel,
OrderDraftBulkCancelVariables
} from "./types/OrderDraftBulkCancel";
import {
OrderDraftCancel,
OrderDraftCancelVariables
} from "./types/OrderDraftCancel";
import {
OrderDraftCreate,
OrderDraftCreateVariables
} from "./types/OrderDraftCreate";
2019-06-19 14:40:52 +00:00
import {
OrderDraftFinalize,
OrderDraftFinalizeVariables
} from "./types/OrderDraftFinalize";
import {
OrderDraftUpdate,
OrderDraftUpdateVariables
} from "./types/OrderDraftUpdate";
import {
OrderFulfillmentCancel,
OrderFulfillmentCancelVariables
} from "./types/OrderFulfillmentCancel";
Refunds (#870) * 1721 - add refunds miscellaneous view (#860) * Create new page for Miscellaneous Refunds * Replace refund order dialog with dedicated page * Add data test ids * Update order details view for refunds (#874) * 1719 - add refund entry to order history (#875) * Add refund order history entry * Update refund event with the right query * 1722 - add refunds product view (#873) * Create new page for Miscellaneous Refunds * Replace refund order dialog with dedicated page * Add data test ids * Create refund products table * Implement refund products view * Update refund mutation with product lines input * Fix products quantities on refund page * Fix order refund submission * Fix products refund submission input variables * Filter out fulfillments on refund page * Update refund page in storybook * Fix test snapshots after wrong refunds rebase * Set max refund as captured amount * Refund queries adjustments * Display refund values with nullish coalescing operator * Update test snapshots with refunds * Refactor order refund values calculation * Create and use refund order line fragment * Use old simple refund mutation for miscellaneous refund * Submit for refund only lines with non-zero quantity set * Fix showing refund error * Fix refund details on order details page (#879) * Update order details view for refunds (#874) * 1719 - add refund entry to order history (#875) * Add refund order history entry * Update refund event with the right query * 1722 - add refunds product view (#873) * Create new page for Miscellaneous Refunds * Replace refund order dialog with dedicated page * Add data test ids * Create refund products table * Implement refund products view * Update refund mutation with product lines input * Fix products quantities on refund page * Fix order refund submission * Fix products refund submission input variables * Filter out fulfillments on refund page * Update refund page in storybook * Fix test snapshots after wrong refunds rebase * Set max refund as captured amount * Refund queries adjustments * Display refund values with nullish coalescing operator * Update test snapshots with refunds * Refactor order refund values calculation * Create and use refund order line fragment * Use old simple refund mutation for miscellaneous refund * Submit for refund only lines with non-zero quantity set * Fix showing refund error * Add missing refund amount to order history * Merge repeated order lines in fulfillment lines * Update order history events types and test snapshots * Update changelog with refunds changes
2020-12-01 13:13:05 +00:00
import {
OrderFulfillmentRefundProducts,
OrderFulfillmentRefundProductsVariables
} from "./types/OrderFulfillmentRefundProducts";
2019-06-19 14:40:52 +00:00
import {
OrderFulfillmentUpdateTracking,
OrderFulfillmentUpdateTrackingVariables
} from "./types/OrderFulfillmentUpdateTracking";
import {
OrderLineDelete,
OrderLineDeleteVariables
} from "./types/OrderLineDelete";
import { OrderLinesAdd, OrderLinesAddVariables } from "./types/OrderLinesAdd";
import {
OrderLineUpdate,
OrderLineUpdateVariables
} from "./types/OrderLineUpdate";
import {
OrderMarkAsPaid,
OrderMarkAsPaidVariables
} from "./types/OrderMarkAsPaid";
import { OrderRefund, OrderRefundVariables } from "./types/OrderRefund";
import {
OrderSettingsUpdate,
OrderSettingsUpdateVariables
} from "./types/OrderSettingsUpdate";
2019-06-19 14:40:52 +00:00
import {
OrderShippingMethodUpdate,
OrderShippingMethodUpdateVariables
} from "./types/OrderShippingMethodUpdate";
import { OrderUpdate, OrderUpdateVariables } from "./types/OrderUpdate";
import { OrderVoid, OrderVoidVariables } from "./types/OrderVoid";
const orderCancelMutation = gql`
${fragmentOrderDetails}
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2020-04-28 01:09:31 +00:00
mutation OrderCancel($id: ID!) {
orderCancel(id: $id) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
...OrderDetailsFragment
}
}
}
`;
export const TypedOrderCancelMutation = TypedMutation<
OrderCancel,
OrderCancelVariables
>(orderCancelMutation);
const orderDraftCancelMutation = gql`
${fragmentOrderDetails}
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2019-06-19 14:40:52 +00:00
mutation OrderDraftCancel($id: ID!) {
draftOrderDelete(id: $id) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
...OrderDetailsFragment
}
}
}
`;
export const TypedOrderDraftCancelMutation = TypedMutation<
OrderDraftCancel,
OrderDraftCancelVariables
>(orderDraftCancelMutation);
const orderDraftBulkCancelMutation = gql`
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2019-06-19 14:40:52 +00:00
mutation OrderDraftBulkCancel($ids: [ID]!) {
draftOrderBulkDelete(ids: $ids) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
}
}
`;
export const orderConfirmMutation = gql`
${fragmentOrderDetails}
${orderErrorFragment}
mutation OrderConfirm($id: ID!) {
orderConfirm(id: $id) {
errors: orderErrors {
...OrderErrorFragment
}
order {
...OrderDetailsFragment
}
}
}
`;
export const useOrderConfirmMutation = makeMutation<
OrderConfirm,
OrderConfirmVariables
>(orderConfirmMutation);
2019-06-19 14:40:52 +00:00
export const TypedOrderDraftBulkCancelMutation = TypedMutation<
OrderDraftBulkCancel,
OrderDraftBulkCancelVariables
>(orderDraftBulkCancelMutation);
const orderDraftFinalizeMutation = gql`
${fragmentOrderDetails}
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2019-06-19 14:40:52 +00:00
mutation OrderDraftFinalize($id: ID!) {
draftOrderComplete(id: $id) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
...OrderDetailsFragment
}
}
}
`;
export const TypedOrderDraftFinalizeMutation = TypedMutation<
OrderDraftFinalize,
OrderDraftFinalizeVariables
>(orderDraftFinalizeMutation);
const orderRefundMutation = gql`
${fragmentOrderDetails}
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2020-09-07 10:48:19 +00:00
mutation OrderRefund($id: ID!, $amount: PositiveDecimal!) {
2019-06-19 14:40:52 +00:00
orderRefund(id: $id, amount: $amount) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
...OrderDetailsFragment
}
}
}
`;
Refunds (#870) * 1721 - add refunds miscellaneous view (#860) * Create new page for Miscellaneous Refunds * Replace refund order dialog with dedicated page * Add data test ids * Update order details view for refunds (#874) * 1719 - add refund entry to order history (#875) * Add refund order history entry * Update refund event with the right query * 1722 - add refunds product view (#873) * Create new page for Miscellaneous Refunds * Replace refund order dialog with dedicated page * Add data test ids * Create refund products table * Implement refund products view * Update refund mutation with product lines input * Fix products quantities on refund page * Fix order refund submission * Fix products refund submission input variables * Filter out fulfillments on refund page * Update refund page in storybook * Fix test snapshots after wrong refunds rebase * Set max refund as captured amount * Refund queries adjustments * Display refund values with nullish coalescing operator * Update test snapshots with refunds * Refactor order refund values calculation * Create and use refund order line fragment * Use old simple refund mutation for miscellaneous refund * Submit for refund only lines with non-zero quantity set * Fix showing refund error * Fix refund details on order details page (#879) * Update order details view for refunds (#874) * 1719 - add refund entry to order history (#875) * Add refund order history entry * Update refund event with the right query * 1722 - add refunds product view (#873) * Create new page for Miscellaneous Refunds * Replace refund order dialog with dedicated page * Add data test ids * Create refund products table * Implement refund products view * Update refund mutation with product lines input * Fix products quantities on refund page * Fix order refund submission * Fix products refund submission input variables * Filter out fulfillments on refund page * Update refund page in storybook * Fix test snapshots after wrong refunds rebase * Set max refund as captured amount * Refund queries adjustments * Display refund values with nullish coalescing operator * Update test snapshots with refunds * Refactor order refund values calculation * Create and use refund order line fragment * Use old simple refund mutation for miscellaneous refund * Submit for refund only lines with non-zero quantity set * Fix showing refund error * Add missing refund amount to order history * Merge repeated order lines in fulfillment lines * Update order history events types and test snapshots * Update changelog with refunds changes
2020-12-01 13:13:05 +00:00
export const useOrderRefundMutation = makeMutation<
2019-06-19 14:40:52 +00:00
OrderRefund,
OrderRefundVariables
>(orderRefundMutation);
Refunds (#870) * 1721 - add refunds miscellaneous view (#860) * Create new page for Miscellaneous Refunds * Replace refund order dialog with dedicated page * Add data test ids * Update order details view for refunds (#874) * 1719 - add refund entry to order history (#875) * Add refund order history entry * Update refund event with the right query * 1722 - add refunds product view (#873) * Create new page for Miscellaneous Refunds * Replace refund order dialog with dedicated page * Add data test ids * Create refund products table * Implement refund products view * Update refund mutation with product lines input * Fix products quantities on refund page * Fix order refund submission * Fix products refund submission input variables * Filter out fulfillments on refund page * Update refund page in storybook * Fix test snapshots after wrong refunds rebase * Set max refund as captured amount * Refund queries adjustments * Display refund values with nullish coalescing operator * Update test snapshots with refunds * Refactor order refund values calculation * Create and use refund order line fragment * Use old simple refund mutation for miscellaneous refund * Submit for refund only lines with non-zero quantity set * Fix showing refund error * Fix refund details on order details page (#879) * Update order details view for refunds (#874) * 1719 - add refund entry to order history (#875) * Add refund order history entry * Update refund event with the right query * 1722 - add refunds product view (#873) * Create new page for Miscellaneous Refunds * Replace refund order dialog with dedicated page * Add data test ids * Create refund products table * Implement refund products view * Update refund mutation with product lines input * Fix products quantities on refund page * Fix order refund submission * Fix products refund submission input variables * Filter out fulfillments on refund page * Update refund page in storybook * Fix test snapshots after wrong refunds rebase * Set max refund as captured amount * Refund queries adjustments * Display refund values with nullish coalescing operator * Update test snapshots with refunds * Refactor order refund values calculation * Create and use refund order line fragment * Use old simple refund mutation for miscellaneous refund * Submit for refund only lines with non-zero quantity set * Fix showing refund error * Add missing refund amount to order history * Merge repeated order lines in fulfillment lines * Update order history events types and test snapshots * Update changelog with refunds changes
2020-12-01 13:13:05 +00:00
const orderFulfillmentRefundProductsMutation = gql`
${fragmentOrderDetails}
${fulfillmentFragment}
${orderErrorFragment}
mutation OrderFulfillmentRefundProducts(
$input: OrderRefundProductsInput!
$order: ID!
) {
orderFulfillmentRefundProducts(input: $input, order: $order) {
errors: orderErrors {
...OrderErrorFragment
}
fulfillment {
...FulfillmentFragment
}
order {
...OrderDetailsFragment
}
}
}
`;
export const useOrderFulfillmentRefundProductsMutation = makeMutation<
OrderFulfillmentRefundProducts,
OrderFulfillmentRefundProductsVariables
>(orderFulfillmentRefundProductsMutation);
2019-06-19 14:40:52 +00:00
const orderVoidMutation = gql`
${fragmentOrderDetails}
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2019-06-19 14:40:52 +00:00
mutation OrderVoid($id: ID!) {
orderVoid(id: $id) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
...OrderDetailsFragment
}
}
}
`;
export const TypedOrderVoidMutation = TypedMutation<
OrderVoid,
OrderVoidVariables
>(orderVoidMutation);
const orderMarkAsPaidMutation = gql`
${fragmentOrderDetails}
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
mutation OrderMarkAsPaid($id: ID!, $transactionReference: String) {
orderMarkAsPaid(id: $id, transactionReference: $transactionReference) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
...OrderDetailsFragment
}
}
}
`;
export const TypedOrderMarkAsPaidMutation = TypedMutation<
OrderMarkAsPaid,
OrderMarkAsPaidVariables
>(orderMarkAsPaidMutation);
const orderCaptureMutation = gql`
${fragmentOrderDetails}
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2020-09-07 10:48:19 +00:00
mutation OrderCapture($id: ID!, $amount: PositiveDecimal!) {
2019-06-19 14:40:52 +00:00
orderCapture(id: $id, amount: $amount) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
...OrderDetailsFragment
}
}
}
`;
export const TypedOrderCaptureMutation = TypedMutation<
OrderCapture,
OrderCaptureVariables
>(orderCaptureMutation);
const orderFulfillmentUpdateTrackingMutation = gql`
${fragmentOrderDetails}
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2019-06-19 14:40:52 +00:00
mutation OrderFulfillmentUpdateTracking(
$id: ID!
$input: FulfillmentUpdateTrackingInput!
) {
orderFulfillmentUpdateTracking(id: $id, input: $input) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
...OrderDetailsFragment
}
}
}
`;
export const TypedOrderFulfillmentUpdateTrackingMutation = TypedMutation<
OrderFulfillmentUpdateTracking,
OrderFulfillmentUpdateTrackingVariables
>(orderFulfillmentUpdateTrackingMutation);
const orderFulfillmentCancelMutation = gql`
${fragmentOrderDetails}
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2019-06-19 14:40:52 +00:00
mutation OrderFulfillmentCancel($id: ID!, $input: FulfillmentCancelInput!) {
orderFulfillmentCancel(id: $id, input: $input) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
...OrderDetailsFragment
}
}
}
`;
export const TypedOrderFulfillmentCancelMutation = TypedMutation<
OrderFulfillmentCancel,
OrderFulfillmentCancelVariables
>(orderFulfillmentCancelMutation);
const orderAddNoteMutation = gql`
${fragmentOrderEvent}
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2019-06-19 14:40:52 +00:00
mutation OrderAddNote($order: ID!, $input: OrderAddNoteInput!) {
orderAddNote(order: $order, input: $input) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
id
events {
...OrderEventFragment
}
}
}
}
`;
export const TypedOrderAddNoteMutation = TypedMutation<
OrderAddNote,
OrderAddNoteVariables
>(orderAddNoteMutation);
const orderUpdateMutation = gql`
2020-09-15 13:02:30 +00:00
${fragmentOrderDetails}
2020-03-11 09:55:14 +00:00
${orderErrorFragment}
2019-06-19 14:40:52 +00:00
mutation OrderUpdate($id: ID!, $input: OrderUpdateInput!) {
orderUpdate(id: $id, input: $input) {
2020-03-11 09:55:14 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
2020-09-15 13:02:30 +00:00
...OrderDetailsFragment
2019-06-19 14:40:52 +00:00
}
}
}
`;
export const TypedOrderUpdateMutation = TypedMutation<
OrderUpdate,
OrderUpdateVariables
>(orderUpdateMutation);
const orderDraftUpdateMutation = gql`
${fragmentOrderDetails}
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2019-06-19 14:40:52 +00:00
mutation OrderDraftUpdate($id: ID!, $input: DraftOrderInput!) {
draftOrderUpdate(id: $id, input: $input) {
2020-03-11 09:55:14 +00:00
errors: orderErrors {
2020-03-11 16:03:41 +00:00
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
...OrderDetailsFragment
}
}
}
`;
export const TypedOrderDraftUpdateMutation = TypedMutation<
OrderDraftUpdate,
OrderDraftUpdateVariables
>(orderDraftUpdateMutation);
const orderShippingMethodUpdateMutation = gql`
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2019-06-19 14:40:52 +00:00
mutation OrderShippingMethodUpdate(
$id: ID!
$input: OrderUpdateShippingInput!
) {
orderUpdateShipping(order: $id, input: $input) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
availableShippingMethods {
id
name
}
id
shippingMethod {
id
name
price {
amount
currency
}
}
shippingMethodName
shippingPrice {
gross {
amount
currency
}
}
}
}
}
`;
export const TypedOrderShippingMethodUpdateMutation = TypedMutation<
OrderShippingMethodUpdate,
OrderShippingMethodUpdateVariables
>(orderShippingMethodUpdateMutation);
const orderDraftCreateMutation = gql`
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
Multichannel (#833) * add multichannel to configuration view * create multichannels list view * create multichannels list view * add ChannelsCreate view * update channels in configuration * add stories * update default messages * fix ChannelForm props * update channels list styles * update snapshots * update channel form currency input * update Channels fragments * extract messages * remove tabs from channelsList * channel details, channel delete modal (#598) * create Channel details view * create ChannelDeleteDialog * add channels delete dialog to channels list * update messages and types * fixes after review * channels availability (#609) * create Channel details view * update messages and types * create ChannelsAvailability component * create more product channels components * create channels stories, update fixtures, types * update product views with channels data * update schema and snapshots * update defaultMessages * update ProductUpdate view * create ChannelsAvailabilityDropdown component * add product channels to local storage * update globalTypes * Update to new schema and resolve issues * Update messages * create deleteChannel mutation * add channels availability component to product create view * refactor ProductCreate and ProductUpdate views * CollectionProducts view cleanup * add disabled prop to ActionDialog * use updateChannels mutation in ProductCreate view * ProductCreate - update submit function * fixes after review * update snapshots and messages Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com> * channels shipping components (#655) * create PricingCard, OrderValue and OrderWeight components * create ShippingZoneRatesPage and DeleteShippingRateDialog * update ChannelsAvailability component * updates after review * channels shipping views (#662) * update ChannelsAvailability component * updates after review * create PriceRate views, update types * create weight rates views * update shipping views, stories, messages * update snapshots * update snapshots * update useChannels hook * orders channels components (#698) * create OrderChannelSectionCard component * update OrderDetailsPage * update DraftOrderChannelCard * update snapshots * update fixtures * small change after review, update snapshots * product pricing (#702) * update product types * update Pricing in simple product view * use productVariantCreate mutation in simple product view * update snapshots and messages * handle create variant (#715) * update product types * update Pricing in simple product view * handle product create and update errors * update snapshots and messages * fix update and create product handlers * update pricing types * channels modal - new styles, search input (#717) * update product types * update Pricing in simple product view * handle product create and update errors * update pricing types * add search input in ChannelsAvailabilityDialog * update ChannelsAvailabilityDialog in all views * update snapshots * fix search input label styles * update toggleAllChannels function * update variant creator (#724) * update product types * update Pricing in simple product view * handle product create and update errors * update pricing types * add search input in ChannelsAvailabilityDialog * update ChannelsAvailabilityDialog in all views * update snapshots * add channelLisitngs to variant creator * update variant creator price styles * update product variant creator reducer tests * update createVariants tests * update error handling in product variant creator * add Skip pricing for now option * use PriceField instead of TextField in ProductVariantCreatorSummary * create price validation function * fix errors handling in ProductVariantPrice component * fixes after review * Product List - remove publish/unpublish buttons (#727) * ProductList - remove publish and unpublish buttons * update messages * update snapshots, messages * revert changes in ChannelsAvailabilityDropdown * products/shipping/discount list settings (#739) * create ChannelSettingsDialog component * update snapshots * ProductList - open settings modal when there is no selected channel * add settings modal to vouchers list * add settings dialog to sales list * add setting modal to shipping list * update shipping * update snapshots, messages * useChannelsSettings - remove selectedChannelSlug * fix channels update handler in product and shipping view * messages update in ChannelSettingsDialog * handle product/discount list when there is no channels * update onSettingsOpen prop * collection availability dropdown (#743) * add availability dropdown to collection products list * update channelListingProduct fragment name * update voucher view/components with channels (#746) * update voucher view/components with channels * update VoucherSummary, remove defaultCurrency from voucher components * update snapshots * move getChannelsVariables func to discounts handlers * update voucher messages * sale view/components with channels (#750) * update sale views with channels * small fixes in discounts * order views with channels (#752) * update draft orders with channels * add channel activate/deactivate mutations * remove sort by total in orders list * add error notification on channel activate/deactivate * product variants channel select (#755) * add channels selector to ProductVariants component * remove selectedChannel from ProductUpdate, update messages and snapshots * update product fragments * update translations (#762) * update translations * fix translation types * update messages * update Availability component (#766) * update ChannelsAvailability component * update product fixtures * update collection and channel fixtures * ChannelsAvailability - handle errors * update product handlers * update ChannelsAvailability styles * update ProductVariant * update snapshots * fix missing things in multichannel (#785) * add availability dropdown to discount products list * fix error handling in shipping components * update product views and components * update messages * update category view/components * update CategoryProducts styles * remove defaultCurrency from shipping components * create ChannelsSelect component * update channels error handling after review * another fixes after review * Add channels to collection views/components (#791) ** update collection components and views * update create collection view * update error handling in collection * remove filter bar from collection list * update products fragments * small fix in collection create view * use collectionFragment in useCatalogSearch * update defaultMessages and snapshots * update homepage view/drop defaultCurrency (#801) * update homepage view * drop defaultCurrency prop * fix onChannelChange function in home view * remove visibility from product list filters * update export products with channels (#803) * update ProductExportDialog with channels * add new channel error code * remover VISIBLE from product export dialog Financial information * fix input size in ProductVariantCreatorSummary (#804) * channels currency code select (#806) * create select with currency codes * fix ChannelDeleteDialog * update defaultMessages, remove unneeded ChannelDetails handlers * fixes after rebase * replace channelListing with channelListings * [multichannel] Update schema] * Fix product create test Co-authored-by: AlicjaSzu <alicja.szukuc@gmail.com> Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com> Co-authored-by: Jakub Majorek <majorek.jakub@gmail.com>
2020-11-17 16:10:42 +00:00
mutation OrderDraftCreate($input: DraftOrderCreateInput!) {
draftOrderCreate(input: $input) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
id
}
}
}
`;
export const useOrderDraftCreateMutation = makeMutation<
OrderDraftCreate,
OrderDraftCreateVariables
>(orderDraftCreateMutation);
2019-06-19 14:40:52 +00:00
const orderLineDeleteMutation = gql`
${fragmentOrderDetails}
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2019-06-19 14:40:52 +00:00
mutation OrderLineDelete($id: ID!) {
draftOrderLineDelete(id: $id) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
...OrderDetailsFragment
}
}
}
`;
export const TypedOrderLineDeleteMutation = TypedMutation<
OrderLineDelete,
OrderLineDeleteVariables
>(orderLineDeleteMutation);
const orderLinesAddMutation = gql`
${fragmentOrderDetails}
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2019-06-19 14:40:52 +00:00
mutation OrderLinesAdd($id: ID!, $input: [OrderLineCreateInput]!) {
draftOrderLinesCreate(id: $id, input: $input) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
...OrderDetailsFragment
}
}
}
`;
export const TypedOrderLinesAddMutation = TypedMutation<
OrderLinesAdd,
OrderLinesAddVariables
>(orderLinesAddMutation);
const orderLineUpdateMutation = gql`
${fragmentOrderDetails}
2020-03-11 16:03:41 +00:00
${orderErrorFragment}
2019-06-19 14:40:52 +00:00
mutation OrderLineUpdate($id: ID!, $input: OrderLineInput!) {
draftOrderLineUpdate(id: $id, input: $input) {
2020-03-11 16:03:41 +00:00
errors: orderErrors {
...OrderErrorFragment
2019-06-19 14:40:52 +00:00
}
order {
...OrderDetailsFragment
}
}
}
`;
export const TypedOrderLineUpdateMutation = TypedMutation<
OrderLineUpdate,
OrderLineUpdateVariables
>(orderLineUpdateMutation);
2020-04-21 22:03:23 +00:00
const fulfillOrder = gql`
2020-04-24 11:56:28 +00:00
${fragmentOrderDetails}
${orderErrorFragment}
mutation FulfillOrder($orderId: ID!, $input: OrderFulfillInput!) {
orderFulfill(order: $orderId, input: $input) {
2020-04-21 22:03:23 +00:00
errors: orderErrors {
...OrderErrorFragment
2020-04-27 13:42:56 +00:00
warehouse
orderLine
2020-04-21 22:03:23 +00:00
}
order {
...OrderDetailsFragment
}
}
}
`;
export const useOrderFulfill = makeMutation<
FulfillOrder,
FulfillOrderVariables
>(fulfillOrder);
2020-06-23 12:27:44 +00:00
const invoiceRequestMutation = gql`
${invoiceErrorFragment}
2020-07-03 10:05:44 +00:00
${invoiceFragment}
2020-06-23 12:27:44 +00:00
mutation InvoiceRequest($orderId: ID!) {
2020-06-25 11:36:43 +00:00
invoiceRequest(orderId: $orderId) {
2020-06-23 12:27:44 +00:00
errors: invoiceErrors {
...InvoiceErrorFragment
}
invoice {
...InvoiceFragment
}
2020-07-08 07:45:25 +00:00
order {
id
invoices {
...InvoiceFragment
}
}
2020-06-23 12:27:44 +00:00
}
}
`;
export const TypedInvoiceRequestMutation = TypedMutation<
InvoiceRequest,
InvoiceRequestVariables
>(invoiceRequestMutation);
2020-06-23 14:44:34 +00:00
const invoiceEmailSendMutation = gql`
${invoiceErrorFragment}
2020-07-03 10:05:44 +00:00
${invoiceFragment}
2020-06-23 14:44:34 +00:00
mutation InvoiceEmailSend($id: ID!) {
2020-06-25 11:36:43 +00:00
invoiceSendEmail(id: $id) {
2020-06-23 14:44:34 +00:00
errors: invoiceErrors {
...InvoiceErrorFragment
}
invoice {
...InvoiceFragment
}
}
}
`;
export const TypedInvoiceEmailSendMutation = TypedMutation<
InvoiceEmailSend,
InvoiceEmailSendVariables
>(invoiceEmailSendMutation);
const orderSettingsUpdateMutation = gql`
${fragmentOrderSettings}
${orderSettingsErrorFragment}
mutation OrderSettingsUpdate($input: OrderSettingsUpdateInput!) {
orderSettingsUpdate(input: $input) {
errors: orderSettingsErrors {
...OrderSettingsErrorFragment
}
orderSettings {
...OrderSettingsFragment
}
}
}
`;
export const useOrderSettingsUpdateMutation = makeMutation<
OrderSettingsUpdate,
OrderSettingsUpdateVariables
>(orderSettingsUpdateMutation);