Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Move order details dialog paths to qs
dominik-zeglend4ba4375f366
diff --git a/saleor/static/dashboard-next/orders/index.tsx b/saleor/static/dashboard-next/orders/index.tsxindex bd4865508c..9e1c2bd829 100644--- a/saleor/static/dashboard-next/orders/index.tsx+++ b/saleor/static/dashboard-next/orders/index.tsx@@ -4,7 +4,12 @@ import { Route, RouteComponentProps, Switch } from "react-router-dom";import { WindowTitle } from "../components/WindowTitle";import i18n from "../i18n";-import { orderDraftListPath, orderListPath, orderPath } from "./urls";+import {+ orderDraftListPath,+ orderListPath,+ orderPath,+ OrderUrlQueryParams+} from "./urls";import OrderDetailsComponent from "./views/OrderDetails";import OrderDraftListComponent from "./views/OrderDraftList";import OrderListComponent, { OrderListQueryParams } from "./views/OrderList";@@ -32,9 +37,18 @@ const OrderDraftList: React.StatelessComponent<RouteComponentProps<any>> = ({};const OrderDetails: React.StatelessComponent<RouteComponentProps<any>> = ({+ location,match}) => {- return <OrderDetailsComponent id={decodeURIComponent(match.params.id)} />;+ const qs = parseQs(location.search.substr(1));+ const params: OrderUrlQueryParams = qs;++ return (+ <OrderDetailsComponent+ id={decodeURIComponent(match.params.id)}+ params={params}+ />+ );};const Component = () => (diff --git a/saleor/static/dashboard-next/orders/urls.ts b/saleor/static/dashboard-next/orders/urls.tsindex 172bd7406e..4bb2ee6945 100644--- a/saleor/static/dashboard-next/orders/urls.ts+++ b/saleor/static/dashboard-next/orders/urls.ts@@ -1,6 +1,7 @@import { stringify as stringifyQs } from "qs";import * as urlJoin from "url-join";+import { Dialog, SingleAction } from "../types";import { OrderListQueryParams } from "./views/OrderList";const orderSectionUrl = "/orders";@@ -26,4 +27,20 @@ export const orderDraftListUrl = (params?: OrderListQueryParams): string => {};export const orderPath = (id: string) => urlJoin(orderSectionUrl, id);-export const orderUrl = (id: string) => orderPath(encodeURIComponent(id));+export type OrderUrlDialog =+ | "add-order-line"+ | "cancel"+ | "cancel-fulfillment"+ | "capture"+ | "edit-billing-address"+ | "edit-fulfillment"+ | "edit-shipping"+ | "edit-shipping-address"+ | "finalize"+ | "fulfill"+ | "mark-paid"+ | "refund"+ | "void";+export type OrderUrlQueryParams = Dialog<OrderUrlDialog> & SingleAction;+export const orderUrl = (id: string, params?: OrderUrlQueryParams) =>+ orderPath(encodeURIComponent(id)) + "?" + stringifyQs(params);diff --git a/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsx b/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsxindex d207e8457c..cfa9defb31 100644--- a/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsx+++ b/saleor/static/dashboard-next/orders/views/OrderDetails/index.tsx@@ -1,5 +1,4 @@import * as React from "react";-import { Route } from "react-router-dom";import Navigator from "../../../components/Navigator";import { WindowTitle } from "../../../components/WindowTitle";@@ -27,36 +26,13 @@ import { OrderVariantSearchProvider } from "../../containers/OrderVariantSearch"import { UserSearchProvider } from "../../containers/UserSearch";import { TypedOrderDetailsQuery } from "../../queries";import { OrderDetails_order } from "../../types/OrderDetails";-import { orderListUrl, orderUrl } from "../../urls";-import { OrderDetailsMessages } from "./OrderDetailsMessages";import {- orderBillingAddressEditPath,- orderBillingAddressEditUrl,- orderCancelPath,- orderCancelUrl,- orderDraftFinalizePath,- orderDraftFinalizeUrl,- orderDraftLineAddPath,- orderDraftLineAddUrl,- orderDraftShippingMethodPath,- orderDraftShippingMethodUrl,- orderFulfillmentCancelPath,- orderFulfillmentCancelUrl,- orderFulfillmentEditTrackingPath,- orderFulfillmentEditTrackingUrl,- orderFulfillPath,- orderFulfillUrl,- orderMarkAsPaidPath,- orderMarkAsPaidUrl,- orderPaymentCapturePath,- orderPaymentCaptureUrl,- orderPaymentRefundPath,- orderPaymentRefundUrl,- orderPaymentVoidPath,- orderPaymentVoidUrl,- orderShippingAddressEditPath,- orderShippingAddressEditUrl-} from "./urls";+ orderListUrl,+ orderUrl,+ OrderUrlDialog,+ OrderUrlQueryParams+} from "../../urls";+import { OrderDetailsMessages } from "./OrderDetailsMessages";const orderDraftFinalizeWarnings = (order: OrderDetails_order) => {const warnings = [] as OrderDraftFinalizeWarning[];@@ -90,10 +66,12 @@ const orderDraftFinalizeWarnings = (order: OrderDetails_order) => {interface OrderDetailsProps {id: string;+ params: OrderUrlQueryParams;}export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({- id+ id,+ params}) => (<Navigator>{navigate => (@@ -104,7 +82,13 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({>{({ data, loading }) => {const order = maybe(() => data.order);- const onModalClose = () => navigate(orderUrl(id), true);+ const closeModal = () => navigate(orderUrl(id), true);+ const openModal = (action: OrderUrlDialog) =>+ navigate(+ orderUrl(id, {+ action+ })+ );return (<UserSearchProvider>{users => (@@ -188,290 +172,215 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({() => data.order.availableShippingMethods,[])}- onOrderCancel={() =>- navigate(orderCancelUrl(id))- }- onOrderFulfill={() =>- navigate(orderFulfillUrl(id))- }+ onOrderCancel={() => openModal("cancel")}+ onOrderFulfill={() => openModal("fulfill")}onFulfillmentCancel={fulfillmentId =>navigate(- orderFulfillmentCancelUrl(- id,- fulfillmentId- )+ orderUrl(id, {+ action: "cancel-fulfillment",+ id: fulfillmentId+ }))}onFulfillmentTrackingNumberUpdate={fulfillmentId =>navigate(- orderFulfillmentEditTrackingUrl(- id,- fulfillmentId- )+ orderUrl(id, {+ action:'edit-fulfillment',+ id: fulfillmentId+ }))}- onPaymentCapture={() =>- navigate(orderPaymentCaptureUrl(id))- }- onPaymentVoid={() =>- navigate(orderPaymentVoidUrl(id))- }- onPaymentRefund={() =>- navigate(orderPaymentRefundUrl(id))- }+ onPaymentCapture={() => openModal("capture")}+ onPaymentVoid={() => openModal("void")}+ onPaymentRefund={() => openModal("refund")}onProductClick={id => () =>navigate(productUrl(id))}onBillingAddressEdit={() =>- navigate(orderBillingAddressEditUrl(id))+ openModal("edit-billing-address")}onShippingAddressEdit={() =>- navigate(orderShippingAddressEditUrl(id))- }- onPaymentPaid={() =>- navigate(orderMarkAsPaidUrl(id))+ openModal("edit-shipping-address")}+ onPaymentPaid={() => openModal("mark-paid")}/>- <Route- path={orderCancelPath(":id")}- render={({ match }) => (- <OrderCancelDialog- confirmButtonState={getMutationState(- orderCancel.opts.called,- orderCancel.opts.loading,- maybe(- () =>- orderCancel.opts.data.orderCancel- .errors- )- )}- number={maybe(() => order.number)}- open={!!match}- onClose={onModalClose}- onSubmit={variables =>- orderCancel.mutate({- id,- ...variables- })- }- />+ <OrderCancelDialog+ confirmButtonState={getMutationState(+ orderCancel.opts.called,+ orderCancel.opts.loading,+ maybe(+ () =>+ orderCancel.opts.data.orderCancel.errors+ ))}+ number={maybe(() => order.number)}+ open={params.action === "cancel"}+ onClose={closeModal}+ onSubmit={variables =>+ orderCancel.mutate({+ id,+ ...variables+ })+ }/>- <Route- path={orderMarkAsPaidPath(":id")}- render={({ match }) => (- <OrderMarkAsPaidDialog- confirmButtonState={getMutationState(- orderPaymentMarkAsPaid.opts.called,- orderPaymentMarkAsPaid.opts.loading,- maybe(- () =>- orderPaymentMarkAsPaid.opts.data- .orderMarkAsPaid.errors- )- )}- onClose={onModalClose}- onConfirm={() =>- orderPaymentMarkAsPaid.mutate({- id- })- }- open={!!match}- />+ <OrderMarkAsPaidDialog+ confirmButtonState={getMutationState(+ orderPaymentMarkAsPaid.opts.called,+ orderPaymentMarkAsPaid.opts.loading,+ maybe(+ () =>+ orderPaymentMarkAsPaid.opts.data+ .orderMarkAsPaid.errors+ ))}+ onClose={closeModal}+ onConfirm={() =>+ orderPaymentMarkAsPaid.mutate({+ id+ })+ }+ open={params.action === "mark-paid"}/>- <Route- path={orderPaymentVoidPath(":id")}- render={({ match }) => (- <OrderPaymentVoidDialog- confirmButtonState={getMutationState(- orderVoid.opts.called,- orderVoid.opts.loading,- maybe(- () =>- orderVoid.opts.data.orderVoid.errors- )- )}- open={!!match}- onClose={onModalClose}- onConfirm={() => orderVoid.mutate({ id })}- />+ <OrderPaymentVoidDialog+ confirmButtonState={getMutationState(+ orderVoid.opts.called,+ orderVoid.opts.loading,+ maybe(+ () => orderVoid.opts.data.orderVoid.errors+ ))}+ open={params.action === "void"}+ onClose={closeModal}+ onConfirm={() => orderVoid.mutate({ id })}/>- <Route- path={orderPaymentCapturePath(":id")}- render={({ match }) => (- <OrderPaymentDialog- confirmButtonState={getMutationState(- orderPaymentCapture.opts.called,- orderPaymentCapture.opts.loading,- maybe(- () =>- orderPaymentCapture.opts.data- .orderCapture.errors- )- )}- initial={maybe(- () => order.total.gross.amount- )}- open={!!match}- variant="capture"- onClose={onModalClose}- onSubmit={variables =>- orderPaymentCapture.mutate({- ...variables,- id- })- }- />+ <OrderPaymentDialog+ confirmButtonState={getMutationState(+ orderPaymentCapture.opts.called,+ orderPaymentCapture.opts.loading,+ maybe(+ () =>+ orderPaymentCapture.opts.data+ .orderCapture.errors+ ))}- />- <Route- path={orderPaymentRefundPath(":id")}- render={({ match }) => (- <OrderPaymentDialog- confirmButtonState={getMutationState(- orderPaymentRefund.opts.called,- orderPaymentRefund.opts.loading,- maybe(- () =>- orderPaymentRefund.opts.data- .orderRefund.errors- )- )}- initial={maybe(- () => order.total.gross.amount- )}- open={!!match}- variant="refund"- onClose={onModalClose}- onSubmit={variables =>- orderPaymentRefund.mutate({- ...variables,- id- })- }- />+ initial={maybe(+ () => order.total.gross.amount)}+ open={params.action === "capture"}+ variant="capture"+ onClose={closeModal}+ onSubmit={variables =>+ orderPaymentCapture.mutate({+ ...variables,+ id+ })+ }/>- <Route- path={orderFulfillPath(":id")}- render={({ match }) => (- <OrderFulfillmentDialog- confirmButtonState={getMutationState(- orderCreateFulfillment.opts.called,- orderCreateFulfillment.opts.loading,- maybe(- () =>- orderCreateFulfillment.opts.data- .orderFulfillmentCreate.errors- )- )}- open={!!match}- lines={maybe(- () => order.lines,- []- ).filter(- line =>- line.quantityFulfilled < line.quantity- )}- onClose={onModalClose}- onSubmit={variables =>- orderCreateFulfillment.mutate({- input: {- ...variables,- lines: maybe(() => order.lines, [])- .filter(- line =>- line.quantityFulfilled <- line.quantity- )- .map((line, lineIndex) => ({- orderLineId: line.id,- quantity:- variables.lines[lineIndex]- }))- .filter(line => line.quantity > 0)- },- order: order.id- })- }- />+ <OrderPaymentDialog+ confirmButtonState={getMutationState(+ orderPaymentRefund.opts.called,+ orderPaymentRefund.opts.loading,+ maybe(+ () =>+ orderPaymentRefund.opts.data.orderRefund+ .errors+ )+ )}+ initial={maybe(+ () => order.total.gross.amount)}+ open={params.action === "refund"}+ variant="refund"+ onClose={closeModal}+ onSubmit={variables =>+ orderPaymentRefund.mutate({+ ...variables,+ id+ })+ }/>- <Route- path={orderFulfillmentCancelPath(- ":orderId",- ":fulfillmentId"+ <OrderFulfillmentDialog+ confirmButtonState={getMutationState(+ orderCreateFulfillment.opts.called,+ orderCreateFulfillment.opts.loading,+ maybe(+ () =>+ orderCreateFulfillment.opts.data+ .orderFulfillmentCreate.errors+ ))}- render={({ match }) => (- <OrderFulfillmentCancelDialog- confirmButtonState={getMutationState(- orderFulfillmentCancel.opts.called,- orderFulfillmentCancel.opts.loading,- maybe(- () =>- orderFulfillmentCancel.opts.data- .orderFulfillmentCancel.errors- )- )}- open={!!match}- onConfirm={variables =>- orderFulfillmentCancel.mutate({- id: decodeURIComponent(- match.params.fulfillmentId- ),- input: variables- })- }- onClose={onModalClose}- />+ open={params.action === "fulfill"}+ lines={maybe(() => order.lines, []).filter(+ line =>+ line.quantityFulfilled < line.quantity+ )}+ onClose={closeModal}+ onSubmit={variables =>+ orderCreateFulfillment.mutate({+ input: {+ ...variables,+ lines: maybe(() => order.lines, [])+ .filter(+ line =>+ line.quantityFulfilled <+ line.quantity+ )+ .map((line, lineIndex) => ({+ orderLineId: line.id,+ quantity: variables.lines[lineIndex]+ }))+ .filter(line => line.quantity > 0)+ },+ order: order.id+ })+ }+ />+ <OrderFulfillmentCancelDialog+ confirmButtonState={getMutationState(+ orderFulfillmentCancel.opts.called,+ orderFulfillmentCancel.opts.loading,+ maybe(+ () =>+ orderFulfillmentCancel.opts.data+ .orderFulfillmentCancel.errors+ ))}+ open={params.action === "cancel-fulfillment"}+ onConfirm={variables =>+ orderFulfillmentCancel.mutate({+ id: params.id,+ input: variables+ })+ }+ onClose={closeModal}/>- <Route- path={orderFulfillmentEditTrackingPath(- ":orderId",- ":fulfillmentId"+ <OrderFulfillmentTrackingDialog+ confirmButtonState={getMutationState(+ orderFulfillmentUpdateTracking.opts.called,+ orderFulfillmentUpdateTracking.opts.loading,+ maybe(+ () =>+ orderFulfillmentUpdateTracking.opts.data+ .orderFulfillmentUpdateTracking.errors+ ))}- render={({ match }) => (- <OrderFulfillmentTrackingDialog- confirmButtonState={getMutationState(- orderFulfillmentUpdateTracking.opts- .called,- orderFulfillmentUpdateTracking.opts- .loading,- maybe(- () =>- orderFulfillmentUpdateTracking.opts- .data- .orderFulfillmentUpdateTracking- .errors- )- )}- open={!!match}- trackingNumber={maybe(- () =>- data.order.fulfillments.find(- fulfillment =>- fulfillment.id ===- decodeURIComponent(- match.params.fulfillmentId- )- ).trackingNumber- )}- onConfirm={variables =>- orderFulfillmentUpdateTracking.mutate({- id: decodeURIComponent(- match.params.fulfillmentId- ),- input: {- ...variables,- notifyCustomer: true- }- })- }- onClose={onModalClose}- />+ open={params.action === "edit-fulfillment"}+ trackingNumber={maybe(+ () =>+ data.order.fulfillments.find(+ fulfillment =>+ fulfillment.id === params.id+ ).trackingNumber)}+ onConfirm={variables =>+ orderFulfillmentUpdateTracking.mutate({+ id: params.id,+ input: {+ ...variables,+ notifyCustomer: true+ }+ })+ }+ onClose={closeModal}/></>) : (@@ -504,14 +413,10 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({input: data})}- onDraftFinalize={() =>- navigate(orderDraftFinalizeUrl(id), true)- }- onDraftRemove={() =>- navigate(orderCancelUrl(id))- }+ onDraftFinalize={() => openModal("finalize")}+ onDraftRemove={() => openModal("cancel")}onOrderLineAdd={() =>- navigate(orderDraftLineAddUrl(id))+ openModal("add-order-line")}onBack={() => navigate(orderListUrl())}order={order}@@ -527,13 +432,13 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({productUrl(encodeURIComponent(id)))}onBillingAddressEdit={() =>- navigate(orderBillingAddressEditUrl(id))+ openModal("edit-billing-address")}onShippingAddressEdit={() =>- navigate(orderShippingAddressEditUrl(id))+ openModal("edit-shipping-address")}onShippingMethodEdit={() =>- navigate(orderDraftShippingMethodUrl(id))+ openModal("edit-shipping")}onOrderLineRemove={id =>orderLineDelete.mutate({ id })@@ -546,253 +451,213 @@ export const OrderDetails: React.StatelessComponent<OrderDetailsProps> = ({}saveButtonBarState="default"/>- <Route- path={orderCancelPath(":id")}- render={({ match }) => (- <OrderDraftCancelDialog- confirmButtonState={getMutationState(- orderDraftCancel.opts.called,- orderDraftCancel.opts.loading,- maybe(- () =>- orderDraftCancel.opts.data- .draftOrderDelete.errors- )- )}- onClose={onModalClose}- onConfirm={() =>- orderDraftCancel.mutate({ id })- }- open={!!match}- orderNumber={maybe(() => order.number)}- />- )}- />- <Route- path={orderDraftFinalizePath(":id")}- render={({ match }) => (- <OrderDraftFinalizeDialog- confirmButtonState={- finalizeTransitionState- }- onClose={onModalClose}- onConfirm={() =>- orderDraftFinalize.mutate({ id })- }- open={!!match}- orderNumber={maybe(() => order.number)}- warnings={orderDraftFinalizeWarnings(- order- )}- />- )}- />- <Route- path={orderDraftShippingMethodPath(":id")}- render={({ match }) => (- <OrderShippingMethodEditDialog- confirmButtonState={getMutationState(- orderShippingMethodUpdate.opts.called,- orderShippingMethodUpdate.opts.loading,- maybe(- () =>- orderShippingMethodUpdate.opts.data- .orderUpdateShipping.errors- )- )}- open={!!match}- shippingMethod={maybe(- () => order.shippingMethod.id,- ""- )}- shippingMethods={maybe(- () => order.availableShippingMethods- )}- onClose={onModalClose}- onSubmit={variables =>- orderShippingMethodUpdate.mutate({- id,- input: {- shippingMethod:- variables.shippingMethod- }- })- }- />- )}- />- <Route- path={orderDraftLineAddPath(":id")}- render={({ match }) => (- <OrderVariantSearchProvider>- {({- variants: {- search: variantSearch,- searchOpts: variantSearchOpts- }- }) => {- const fetchMore = () =>- variantSearchOpts.loadMore(- (prev, next) => {- if (- prev.products.pageInfo- .endCursor ===- next.products.pageInfo.endCursor- ) {- return prev;- }- return {- ...prev,- products: {- ...prev.products,- edges: [- ...prev.products.edges,- ...next.products.edges- ],- pageInfo:- next.products.pageInfo- }- };- },- {- after:- variantSearchOpts.data.products- .pageInfo.endCursor- }- );- return (- <OrderProductAddDialog- confirmButtonState={getMutationState(- orderLineAdd.opts.called,- orderLineAdd.opts.loading,- maybe(- () =>- orderLineAdd.opts.data- .draftOrderLinesCreate- .errors- )- )}- loading={variantSearchOpts.loading}- open={!!match}- hasMore={maybe(- () =>- variantSearchOpts.data.products- .pageInfo.hasNextPage- )}- products={maybe(() =>- variantSearchOpts.data.products.edges.map(- edge => edge.node- )- )}- onClose={onModalClose}- onFetch={variantSearch}- onFetchMore={fetchMore}- onSubmit={formData =>- orderLineAdd.mutate({- id,- input: formData.variants.map(- variant => ({- quantity: 1,- variantId: variant.id- })- )- })- }- />- );- }}- </OrderVariantSearchProvider>- )}- />- </>- )}- <Route- path={orderShippingAddressEditPath(":id")}- render={({ match }) => (- <OrderAddressEditDialog+ <OrderDraftCancelDialogconfirmButtonState={getMutationState(- orderUpdate.opts.called,- orderUpdate.opts.loading,+ orderDraftCancel.opts.called,+ orderDraftCancel.opts.loading,maybe(() =>- orderUpdate.opts.data.orderUpdate.errors+ orderDraftCancel.opts.data+ .draftOrderDelete.errors))}- address={transformAddressToForm(- maybe(() => order.shippingAddress)- )}- countries={maybe(- () => data.shop.countries,- []- ).map(country => ({- code: country.code,- label: country.country- }))}- errors={maybe(- () =>- orderUpdate.opts.data.orderUpdate.errors,- []- )}- open={!!match}- variant="shipping"- onClose={onModalClose}- onConfirm={variables =>- orderUpdate.mutate({- id,- input: {- shippingAddress: {- ...variables,- country: variables.country.value- }- }- })+ onClose={closeModal}+ onConfirm={() =>+ orderDraftCancel.mutate({ id })}+ open={params.action === "cancel"}+ orderNumber={maybe(() => order.number)}/>- )}- />- <Route- path={orderBillingAddressEditPath(":id")}- render={({ match }) => (- <OrderAddressEditDialog+ <OrderDraftFinalizeDialog+ confirmButtonState={finalizeTransitionState}+ onClose={closeModal}+ onConfirm={() =>+ orderDraftFinalize.mutate({ id })+ }+ open={params.action === "finalize"}+ orderNumber={maybe(() => order.number)}+ warnings={orderDraftFinalizeWarnings(order)}+ />+ <OrderShippingMethodEditDialogconfirmButtonState={getMutationState(- orderUpdate.opts.called,- orderUpdate.opts.loading,+ orderShippingMethodUpdate.opts.called,+ orderShippingMethodUpdate.opts.loading,maybe(() =>- orderUpdate.opts.data.orderUpdate.errors+ orderShippingMethodUpdate.opts.data+ .orderUpdateShipping.errors))}- address={transformAddressToForm(- maybe(() => order.billingAddress)+ open={params.action === "edit-shipping"}+ shippingMethod={maybe(+ () => order.shippingMethod.id,+ "...")}- countries={maybe(- () => data.shop.countries,- []- ).map(country => ({- code: country.code,- label: country.country- }))}- errors={maybe(- () =>- orderUpdate.opts.data.orderUpdate.errors,- []+ shippingMethods={maybe(+ () => order.availableShippingMethods)}- open={!!match}- variant="billing"- onClose={onModalClose}- onConfirm={variables =>- orderUpdate.mutate({+ onClose={closeModal}+ onSubmit={variables =>+ orderShippingMethodUpdate.mutate({id,input: {- billingAddress: {- ...variables,- country: variables.country.value- }+ shippingMethod: variables.shippingMethod}})}/>+ <OrderVariantSearchProvider>+ {({+ variants: {+ search: variantSearch,+ searchOpts: variantSearchOpts+ }+ }) => {+ const fetchMore = () =>+ variantSearchOpts.loadMore(+ (prev, next) => {+ if (+ prev.products.pageInfo.endCursor ===+ next.products.pageInfo.endCursor+ ) {+ return prev;+ }+ return {+ ...prev,+ products: {+ ...prev.products,+ edges: [+ ...prev.products.edges,+ ...next.products.edges+ ],+ pageInfo: next.products.pageInfo+ }+ };+ },+ {+ after:+ variantSearchOpts.data.products+ .pageInfo.endCursor+ }+ );+ return (+ <OrderProductAddDialog+ confirmButtonState={getMutationState(+ orderLineAdd.opts.called,+ orderLineAdd.opts.loading,+ maybe(+ () =>+ orderLineAdd.opts.data+ .draftOrderLinesCreate.errors+ )+ )}+ loading={variantSearchOpts.loading}+ open={+ params.action === "add-order-line"+ }+ hasMore={maybe(+ () =>+ variantSearchOpts.data.products+ .pageInfo.hasNextPage+ )}+ products={maybe(() =>+ variantSearchOpts.data.products.edges.map(+ edge => edge.node+ )+ )}+ onClose={closeModal}+ onFetch={variantSearch}+ onFetchMore={fetchMore}+ onSubmit={formData =>+ orderLineAdd.mutate({+ id,+ input: formData.variants.map(+ variant => ({+ quantity: 1,+ variantId: variant.id+ })+ )+ })+ }+ />+ );+ }}+ </OrderVariantSearchProvider>+ </>+ )}+ <OrderAddressEditDialog+ confirmButtonState={getMutationState(+ orderUpdate.opts.called,+ orderUpdate.opts.loading,+ maybe(+ () => orderUpdate.opts.data.orderUpdate.errors+ )+ )}+ address={transformAddressToForm(+ maybe(() => order.shippingAddress)+ )}+ countries={maybe(+ () => data.shop.countries,+ []+ ).map(country => ({+ code: country.code,+ label: country.country+ }))}+ errors={maybe(+ () => orderUpdate.opts.data.orderUpdate.errors,+ [])}+ open={params.action === "edit-shipping-address"}+ variant="shipping"+ onClose={closeModal}+ onConfirm={variables =>+ orderUpdate.mutate({+ id,+ input: {+ shippingAddress: {+ ...variables,+ country: variables.country.value+ }+ }+ })+ }+ />+ <OrderAddressEditDialog+ confirmButtonState={getMutationState(+ orderUpdate.opts.called,+ orderUpdate.opts.loading,+ maybe(+ () => orderUpdate.opts.data.orderUpdate.errors+ )+ )}+ address={transformAddressToForm(+ maybe(() => order.billingAddress)+ )}+ countries={maybe(+ () => data.shop.countries,+ []+ ).map(country => ({+ code: country.code,+ label: country.country+ }))}+ errors={maybe(+ () => orderUpdate.opts.data.orderUpdate.errors,+ []+ )}+ open={params.action === "edit-billing-address"}+ variant="billing"+ onClose={closeModal}+ onConfirm={variables =>+ orderUpdate.mutate({+ id,+ input: {+ billingAddress: {+ ...variables,+ country: variables.country.value+ }+ }+ })+ }/></>);diff --git a/saleor/static/dashboard-next/orders/views/OrderDetails/urls.ts b/saleor/static/dashboard-next/orders/views/OrderDetails/urls.tsdeleted file mode 100644index 9b1af39985..0000000000--- a/saleor/static/dashboard-next/orders/views/OrderDetails/urls.ts+++ /dev/null@@ -1,83 +0,0 @@-import * as urlJoin from "url-join";--import { orderPath } from "../../urls";--export const orderCancelPath = (id: string) => urlJoin(orderPath(id), "cancel");-export const orderCancelUrl = (id: string) =>- orderCancelPath(encodeURIComponent(id));--export const orderMarkAsPaidPath = (id: string) =>- urlJoin(orderPath(id), "markAsPaid");-export const orderMarkAsPaidUrl = (id: string) =>- orderMarkAsPaidPath(encodeURIComponent(id));--export const orderPaymentVoidPath = (id: string) =>- urlJoin(orderPath(id), "voidPayment");-export const orderPaymentVoidUrl = (id: string) =>- orderPaymentVoidPath(encodeURIComponent(id));--export const orderPaymentRefundPath = (id: string) =>- urlJoin(orderPath(id), "refundPayment");-export const orderPaymentRefundUrl = (id: string) =>- orderPaymentRefundPath(encodeURIComponent(id));--export const orderPaymentCapturePath = (id: string) =>- urlJoin(orderPath(id), "capturePayment");-export const orderPaymentCaptureUrl = (id: string) =>- orderPaymentCapturePath(encodeURIComponent(id));--export const orderFulfillPath = (id: string) =>- urlJoin(orderPath(id), "fulfill");-export const orderFulfillUrl = (id: string) =>- orderFulfillPath(encodeURIComponent(id));--export const orderFulfillmentCancelPath = (- orderId: string,- fulfillmentId: string-) => urlJoin(orderPath(orderId), "fulfillment", fulfillmentId, "cancel");-export const orderFulfillmentCancelUrl = (- orderId: string,- fulfillmentId: string-) =>- orderFulfillmentCancelPath(- encodeURIComponent(orderId),- encodeURIComponent(fulfillmentId)- );--export const orderFulfillmentEditTrackingPath = (- orderId: string,- fulfillmentId: string-) => urlJoin(orderPath(orderId), "fulfillment", fulfillmentId, "tracking");-export const orderFulfillmentEditTrackingUrl = (- orderId: string,- fulfillmentId: string-) =>- orderFulfillmentEditTrackingPath(- encodeURIComponent(orderId),- encodeURIComponent(fulfillmentId)- );--export const orderBillingAddressEditPath = (id: string) =>- urlJoin(orderPath(id), "editAddress", "billing");-export const orderBillingAddressEditUrl = (id: string) =>- orderBillingAddressEditPath(encodeURIComponent(id));--export const orderShippingAddressEditPath = (id: string) =>- urlJoin(orderPath(id), "editAddress", "shipping");-export const orderShippingAddressEditUrl = (id: string) =>- orderShippingAddressEditPath(encodeURIComponent(id));--export const orderDraftFinalizePath = (id: string) =>- urlJoin(orderPath(id), "finalize");-export const orderDraftFinalizeUrl = (id: string) =>- orderDraftFinalizePath(encodeURIComponent(id));--export const orderDraftShippingMethodPath = (id: string) =>- urlJoin(orderPath(id), "shipping");-export const orderDraftShippingMethodUrl = (id: string) =>- orderDraftShippingMethodPath(encodeURIComponent(id));--export const orderDraftLineAddPath = (id: string) =>- urlJoin(orderPath(id), "addLine");-export const orderDraftLineAddUrl = (id: string) =>- orderDraftLineAddPath(encodeURIComponent(id));