Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix imports

dominik-zeglenef62e42ea706
diff --git a/saleor/static/dashboard-next/auth/containers/TokenAuth.tsx b/saleor/static/dashboard-next/auth/containers/TokenAuth.tsx
index 73ea10565b..a6217f00e6 100644
--- a/saleor/static/dashboard-next/auth/containers/TokenAuth.tsx
+++ b/saleor/static/dashboard-next/auth/containers/TokenAuth.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
import { TypedTokenAuthMutation } from "../mutations";
import { TokenAuth, TokenAuthVariables } from "../types/TokenAuth";
diff --git a/saleor/static/dashboard-next/auth/containers/TokenVerify.tsx b/saleor/static/dashboard-next/auth/containers/TokenVerify.tsx
index 6ab2d57ea6..d1661ac19d 100644
--- a/saleor/static/dashboard-next/auth/containers/TokenVerify.tsx
+++ b/saleor/static/dashboard-next/auth/containers/TokenVerify.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
import { TypedVerifyTokenMutation } from "../mutations";
import { VerifyToken, VerifyTokenVariables } from "../types/VerifyToken";
diff --git a/saleor/static/dashboard-next/categories/index.tsx b/saleor/static/dashboard-next/categories/index.tsx
index f11750f4da..b0c0b60513 100644
--- a/saleor/static/dashboard-next/categories/index.tsx
+++ b/saleor/static/dashboard-next/categories/index.tsx
@@ -1,71 +1,71 @@
-// import { parse as parseQs } from "qs";
-// import * as React from "react";
-// import { Route, RouteComponentProps, Switch } from "react-router-dom";
-// import { WindowTitle } from "../components/WindowTitle";
-// import i18n from "../i18n";
-// import { CategoryCreateView } from "./views/CategoryCreate";
-// import CategoryDetailsView, {
-// CategoryDetailsQueryParams
-// } from "./views/CategoryDetails";
-// import CategoryList from "./views/CategoryList";
+import { parse as parseQs } from "qs";
+import * as React from "react";
+import { Route, RouteComponentProps, Switch } from "react-router-dom";
+import { WindowTitle } from "../components/WindowTitle";
+import i18n from "../i18n";
+import { CategoryCreateView } from "./views/CategoryCreate";
+import CategoryDetailsView, {
+ CategoryDetailsQueryParams
+} from "./views/CategoryDetails";
+import CategoryList from "./views/CategoryList";
-// interface CategoryDetailsRouteParams {
-// id: string;
-// }
-// const CategoryDetails: React.StatelessComponent<
-// RouteComponentProps<CategoryDetailsRouteParams>
-// > = ({ location, match }) => {
-// const qs = parseQs(location.search.substr(1));
-// const params: CategoryDetailsQueryParams = {
-// after: qs.after,
-// before: qs.before
-// };
-// return (
-// <CategoryDetailsView
-// id={decodeURIComponent(match.params.id)}
-// params={params}
-// />
-// );
-// };
+interface CategoryDetailsRouteParams {
+ id: string;
+}
+const CategoryDetails: React.StatelessComponent<
+ RouteComponentProps<CategoryDetailsRouteParams>
+> = ({ location, match }) => {
+ const qs = parseQs(location.search.substr(1));
+ const params: CategoryDetailsQueryParams = {
+ after: qs.after,
+ before: qs.before
+ };
+ return (
+ <CategoryDetailsView
+ id={decodeURIComponent(match.params.id)}
+ params={params}
+ />
+ );
+};
-// interface CategoryCreateRouteParams {
-// id: string;
-// }
-// const CategoryCreate: React.StatelessComponent<
-// RouteComponentProps<CategoryCreateRouteParams>
-// > = ({ match }) => {
-// return (
-// <CategoryCreateView
-// parentId={
-// match.params.id ? decodeURIComponent(match.params.id) : undefined
-// }
-// />
-// );
-// };
+interface CategoryCreateRouteParams {
+ id: string;
+}
+const CategoryCreate: React.StatelessComponent<
+ RouteComponentProps<CategoryCreateRouteParams>
+> = ({ match }) => {
+ return (
+ <CategoryCreateView
+ parentId={
+ match.params.id ? decodeURIComponent(match.params.id) : undefined
+ }
+ />
+ );
+};
-// const Component = ({ match }) => (
-// <>
-// <WindowTitle title={i18n.t("Categories")} />
-// <Switch>
-// <Route exact path={match.url} component={CategoryList} />
-// <Route exact path={`${match.url}/add/`} component={CategoryCreate} />
-// <Route exact path={`${match.url}/:id/add/`} component={CategoryCreate} />
-// <Route path={`${match.url}/:id/`} component={CategoryDetails} />
-// </Switch>
-// </>
-// );
+const Component = ({ match }) => (
+ <>
+ <WindowTitle title={i18n.t("Categories")} />
+ <Switch>
+ <Route exact path={match.url} component={CategoryList} />
+ <Route exact path={`${match.url}/add/`} component={CategoryCreate} />
+ <Route exact path={`${match.url}/:id/add/`} component={CategoryCreate} />
+ <Route path={`${match.url}/:id/`} component={CategoryDetails} />
+ </Switch>
+ </>
+);
-// export const categoryListUrl = "/categories/";
-// export const categoryAddUrl = (parentId?: string) => {
-// if (parentId) {
-// return `/categories/${parentId}/add/`;
-// }
-// return `/categories/add/`;
-// };
-// export const categoryUrl = (id?: string) => {
-// if (id) {
-// return `/categories/${id}/`;
-// }
-// return "/categories/";
-// };
-// export default Component;
+export const categoryListUrl = "/categories/";
+export const categoryAddUrl = (parentId?: string) => {
+ if (parentId) {
+ return `/categories/${parentId}/add/`;
+ }
+ return `/categories/add/`;
+};
+export const categoryUrl = (id?: string) => {
+ if (id) {
+ return `/categories/${id}/`;
+ }
+ return "/categories/";
+};
+export default Component;
diff --git a/saleor/static/dashboard-next/collections/containers/CollectionAssignProductProvider.tsx b/saleor/static/dashboard-next/collections/containers/CollectionAssignProductProvider.tsx
index 63fc1144be..92e6a55ca4 100644
--- a/saleor/static/dashboard-next/collections/containers/CollectionAssignProductProvider.tsx
+++ b/saleor/static/dashboard-next/collections/containers/CollectionAssignProductProvider.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface CollectionAssignProductProviderProps
extends PartialMutationProviderProps<CollectionAssignProduct> {
diff --git a/saleor/static/dashboard-next/collections/containers/CollectionOperations.tsx b/saleor/static/dashboard-next/collections/containers/CollectionOperations.tsx
index f5feda8738..1c88948838 100644
--- a/saleor/static/dashboard-next/collections/containers/CollectionOperations.tsx
+++ b/saleor/static/dashboard-next/collections/containers/CollectionOperations.tsx
@@ -4,7 +4,7 @@ import {
MutationProviderProps,
MutationProviderRenderProps,
PartialMutationProviderOutput
-} from "../..";
+} from "../../types";
import { TypedUnassignCollectionProductMutation } from "../mutations";
import {
AssignHomepageCollection,
diff --git a/saleor/static/dashboard-next/collections/containers/CollectionRemove.tsx b/saleor/static/dashboard-next/collections/containers/CollectionRemove.tsx
index f9a146f101..db95ae7e4e 100644
--- a/saleor/static/dashboard-next/collections/containers/CollectionRemove.tsx
+++ b/saleor/static/dashboard-next/collections/containers/CollectionRemove.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface CollectionRemoveProviderProps
extends PartialMutationProviderProps<RemoveCollection> {
diff --git a/saleor/static/dashboard-next/collections/containers/CollectionUpdateProvider.tsx b/saleor/static/dashboard-next/collections/containers/CollectionUpdateProvider.tsx
index 49ff2cfcd7..64733c5ccd 100644
--- a/saleor/static/dashboard-next/collections/containers/CollectionUpdateProvider.tsx
+++ b/saleor/static/dashboard-next/collections/containers/CollectionUpdateProvider.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface CollectionUpdateProviderProps
extends PartialMutationProviderProps<CollectionUpdate> {
diff --git a/saleor/static/dashboard-next/collections/containers/HomepageCollectionAssignProvider.tsx b/saleor/static/dashboard-next/collections/containers/HomepageCollectionAssignProvider.tsx
index 78d33772cb..f973e2b4ef 100644
--- a/saleor/static/dashboard-next/collections/containers/HomepageCollectionAssignProvider.tsx
+++ b/saleor/static/dashboard-next/collections/containers/HomepageCollectionAssignProvider.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface HomepageCollectionAssignProviderProps
extends PartialMutationProviderProps<AssignHomepageCollection> {
diff --git a/saleor/static/dashboard-next/collections/index.tsx b/saleor/static/dashboard-next/collections/index.tsx
index 2d8e422152..a276f9f4fc 100644
--- a/saleor/static/dashboard-next/collections/index.tsx
+++ b/saleor/static/dashboard-next/collections/index.tsx
@@ -1,56 +1,56 @@
-// import { parse as parseQs } from "qs";
-// import * as React from "react";
-// import { Route, RouteComponentProps, Switch } from "react-router-dom";
+import { parse as parseQs } from "qs";
+import * as React from "react";
+import { Route, RouteComponentProps, Switch } from "react-router-dom";
-// import { WindowTitle } from "../components/WindowTitle";
-// import i18n from "../i18n";
-// import { collectionAddUrl, collectionListUrl, collectionUrl } from "./urls";
-// import CollectionCreate from "./views/CollectionCreate";
-// import CollectionDetailsView, {
-// CollectionDetailsQueryParams
-// } from "./views/CollectionDetails";
-// import CollectionListView, {
-// CollectionListQueryParams
-// } from "./views/CollectionList";
+import { WindowTitle } from "../components/WindowTitle";
+import i18n from "../i18n";
+import { collectionAddUrl, collectionListUrl, collectionUrl } from "./urls";
+import CollectionCreate from "./views/CollectionCreate";
+import CollectionDetailsView, {
+ CollectionDetailsQueryParams
+} from "./views/CollectionDetails";
+import CollectionListView, {
+ CollectionListQueryParams
+} from "./views/CollectionList";
-// const CollectionList: React.StatelessComponent<RouteComponentProps<{}>> = ({
-// location
-// }) => {
-// const qs = parseQs(location.search.substr(1));
-// const params: CollectionListQueryParams = {
-// after: qs.after,
-// before: qs.before
-// };
-// return <CollectionListView params={params} />;
-// };
+const CollectionList: React.StatelessComponent<RouteComponentProps<{}>> = ({
+ location
+}) => {
+ const qs = parseQs(location.search.substr(1));
+ const params: CollectionListQueryParams = {
+ after: qs.after,
+ before: qs.before
+ };
+ return <CollectionListView params={params} />;
+};
-// interface CollectionDetailsRouteProps {
-// id: string;
-// }
-// const CollectionDetails: React.StatelessComponent<
-// RouteComponentProps<CollectionDetailsRouteProps>
-// > = ({ location, match }) => {
-// const qs = parseQs(location.search.substr(1));
-// const params: CollectionDetailsQueryParams = {
-// after: qs.after,
-// before: qs.before
-// };
-// return (
-// <CollectionDetailsView
-// id={decodeURIComponent(match.params.id)}
-// params={params}
-// />
-// );
-// };
+interface CollectionDetailsRouteProps {
+ id: string;
+}
+const CollectionDetails: React.StatelessComponent<
+ RouteComponentProps<CollectionDetailsRouteProps>
+> = ({ location, match }) => {
+ const qs = parseQs(location.search.substr(1));
+ const params: CollectionDetailsQueryParams = {
+ after: qs.after,
+ before: qs.before
+ };
+ return (
+ <CollectionDetailsView
+ id={decodeURIComponent(match.params.id)}
+ params={params}
+ />
+ );
+};
-// const Component = () => (
-// <>
-// <WindowTitle title={i18n.t("Collections")} />
-// <Switch>
-// <Route exact path={collectionListUrl} component={CollectionList} />
-// <Route exact path={collectionAddUrl} component={CollectionCreate} />
-// <Route path={collectionUrl(":id")} component={CollectionDetails} />
-// </Switch>
-// </>
-// );
-// export default Component;
+const Component = () => (
+ <>
+ <WindowTitle title={i18n.t("Collections")} />
+ <Switch>
+ <Route exact path={collectionListUrl} component={CollectionList} />
+ <Route exact path={collectionAddUrl} component={CollectionCreate} />
+ <Route path={collectionUrl(":id")} component={CollectionDetails} />
+ </Switch>
+ </>
+);
+export default Component;
diff --git a/saleor/static/dashboard-next/customers/index.tsx b/saleor/static/dashboard-next/customers/index.tsx
index 5da076224a..530ee95ee4 100644
--- a/saleor/static/dashboard-next/customers/index.tsx
+++ b/saleor/static/dashboard-next/customers/index.tsx
@@ -1,43 +1,43 @@
-// import { parse as parseQs } from "qs";
-// import * as React from "react";
-// import { Route, RouteComponentProps, Switch } from "react-router-dom";
+import { parse as parseQs } from "qs";
+import * as React from "react";
+import { Route, RouteComponentProps, Switch } from "react-router-dom";
-// import { WindowTitle } from "../components/WindowTitle";
-// import i18n from "../i18n";
-// import { customerAddUrl, customerListUrl, customerUrl } from "./urls";
-// import CustomerCreateView from "./views/CustomerCreate";
-// import CustomerDetailsViewComponent from "./views/CustomerDetails";
-// import CustomerListViewComponent, {
-// CustomerListQueryParams
-// } from "./views/CustomerList";
+import { WindowTitle } from "../components/WindowTitle";
+import i18n from "../i18n";
+import { customerAddUrl, customerListUrl, customerUrl } from "./urls";
+import CustomerCreateView from "./views/CustomerCreate";
+import CustomerDetailsViewComponent from "./views/CustomerDetails";
+import CustomerListViewComponent, {
+ CustomerListQueryParams
+} from "./views/CustomerList";
-// const CustomerListView: React.StatelessComponent<RouteComponentProps<{}>> = ({
-// location
-// }) => {
-// const qs = parseQs(location.search.substr(1));
-// const params: CustomerListQueryParams = {
-// after: qs.after,
-// before: qs.before
-// };
-// return <CustomerListViewComponent params={params} />;
-// };
+const CustomerListView: React.StatelessComponent<RouteComponentProps<{}>> = ({
+ location
+}) => {
+ const qs = parseQs(location.search.substr(1));
+ const params: CustomerListQueryParams = {
+ after: qs.after,
+ before: qs.before
+ };
+ return <CustomerListViewComponent params={params} />;
+};
-// interface CustomerDetailsRouteParams {
-// id: string;
-// }
-// const CustomerDetailsView: React.StatelessComponent<
-// RouteComponentProps<CustomerDetailsRouteParams>
-// > = ({ match }) => (
-// <CustomerDetailsViewComponent id={decodeURIComponent(match.params.id)} />
-// );
+interface CustomerDetailsRouteParams {
+ id: string;
+}
+const CustomerDetailsView: React.StatelessComponent<
+ RouteComponentProps<CustomerDetailsRouteParams>
+> = ({ match }) => (
+ <CustomerDetailsViewComponent id={decodeURIComponent(match.params.id)} />
+);
-// export const CustomerSection: React.StatelessComponent<{}> = () => (
-// <>
-// <WindowTitle title={i18n.t("Customers")} />
-// <Switch>
-// <Route exact path={customerListUrl} component={CustomerListView} />
-// <Route exact path={customerAddUrl} component={CustomerCreateView} />
-// <Route path={customerUrl(":id")} component={CustomerDetailsView} />
-// </Switch>
-// </>
-// );
+export const CustomerSection: React.StatelessComponent<{}> = () => (
+ <>
+ <WindowTitle title={i18n.t("Customers")} />
+ <Switch>
+ <Route exact path={customerListUrl} component={CustomerListView} />
+ <Route exact path={customerAddUrl} component={CustomerCreateView} />
+ <Route path={customerUrl(":id")} component={CustomerDetailsView} />
+ </Switch>
+ </>
+);
diff --git a/saleor/static/dashboard-next/home/index.tsx b/saleor/static/dashboard-next/home/index.tsx
index c67a78a47c..e7520f23f5 100644
--- a/saleor/static/dashboard-next/home/index.tsx
+++ b/saleor/static/dashboard-next/home/index.tsx
@@ -1,7 +1,7 @@
-// import * as React from "react";
+import * as React from "react";
-// import HomePage from "./views";
+import HomePage from "./views";
-// const Component = () => <HomePage />;
+const Component = () => <HomePage />;
-// export default Component;
+export default Component;
diff --git a/saleor/static/dashboard-next/index.tsx b/saleor/static/dashboard-next/index.tsx
index ccbd9afcf4..351471d7d3 100644
--- a/saleor/static/dashboard-next/index.tsx
+++ b/saleor/static/dashboard-next/index.tsx
@@ -1,237 +1,185 @@
-// import CssBaseline from "@material-ui/core/CssBaseline";
-// import MuiThemeProvider from "@material-ui/core/styles/MuiThemeProvider";
-// import { defaultDataIdFromObject, InMemoryCache } from "apollo-cache-inmemory";
-// import { ApolloClient, ApolloError } from "apollo-client";
-// import { setContext } from "apollo-link-context";
-// import { ErrorResponse, onError } from "apollo-link-error";
-// import { createUploadLink } from "apollo-upload-client";
-// import * as React from "react";
-// import { ApolloProvider, MutationFn } from "react-apollo";
-// import { render } from "react-dom";
-// import { BrowserRouter, Route, Switch } from "react-router-dom";
-// import * as Cookies from "universal-cookie";
+import CssBaseline from "@material-ui/core/CssBaseline";
+import MuiThemeProvider from "@material-ui/core/styles/MuiThemeProvider";
+import { defaultDataIdFromObject, InMemoryCache } from "apollo-cache-inmemory";
+import { ApolloClient } from "apollo-client";
+import { setContext } from "apollo-link-context";
+import { ErrorResponse, onError } from "apollo-link-error";
+import { createUploadLink } from "apollo-upload-client";
+import * as React from "react";
+import { ApolloProvider } from "react-apollo";
+import { render } from "react-dom";
+import { BrowserRouter, Route, Switch } from "react-router-dom";
+import * as Cookies from "universal-cookie";
-// import Auth, { getAuthToken, removeAuthToken } from "./auth";
-// import AuthProvider from "./auth/AuthProvider";
-// import LoginLoading from "./auth/components/LoginLoading/LoginLoading";
-// import SectionRoute from "./auth/components/SectionRoute";
-// import { hasPermission } from "./auth/misc";
-// import CategorySection from "./categories";
-// import CollectionSection from "./collections";
-// import { DateProvider } from "./components/DateFormatter";
-// import { LocaleProvider } from "./components/Locale";
-// import { MessageManager } from "./components/messages";
-// import { ShopProvider } from "./components/Shop";
-// import { WindowTitle } from "./components/WindowTitle";
-// import ConfigurationSection, { configurationMenu } from "./configuration";
-// import { CustomerSection } from "./customers";
-// import HomePage from "./home";
-// import i18n from "./i18n";
-// import { NotFound } from "./NotFound";
-// import OrdersSection from "./orders";
-// import PageSection from "./pages";
-// import ProductSection from "./products";
-// import ProductTypesSection from "./productTypes";
-// import SiteSettingsSection from "./siteSettings";
-// import StaffSection from "./staff";
-// import theme from "./theme";
-// import { PermissionEnum } from "./types/globalTypes";
+import { getAuthToken, removeAuthToken } from "./auth";
+import AuthProvider from "./auth/AuthProvider";
+import LoginLoading from "./auth/components/LoginLoading/LoginLoading";
+import SectionRoute from "./auth/components/SectionRoute";
+import { hasPermission } from "./auth/misc";
+import Login from "./auth/views/Login";
+import CategorySection from "./categories";
+import CollectionSection from "./collections";
+import { DateProvider } from "./components/DateFormatter";
+import { LocaleProvider } from "./components/Locale";
+import { MessageManager } from "./components/messages";
+import { ShopProvider } from "./components/Shop";
+import { WindowTitle } from "./components/WindowTitle";
+import ConfigurationSection, { configurationMenu } from "./configuration";
+import { CustomerSection } from "./customers";
+import HomePage from "./home";
+import i18n from "./i18n";
+import { NotFound } from "./NotFound";
+import OrdersSection from "./orders";
+import PageSection from "./pages";
+import ProductSection from "./products";
+import ProductTypesSection from "./productTypes";
+import SiteSettingsSection from "./siteSettings";
+import StaffSection from "./staff";
+import theme from "./theme";
+import { PermissionEnum } from "./types/globalTypes";
-// const cookies = new Cookies();
+const cookies = new Cookies();
-// interface ResponseError extends ErrorResponse {
-// networkError?: Error & {
-// statusCode?: number;
-// bodyText?: string;
-// };
-// }
+interface ResponseError extends ErrorResponse {
+ networkError?: Error & {
+ statusCode?: number;
+ bodyText?: string;
+ };
+}
-// const invalidTokenLink = onError((error: ResponseError) => {
-// if (error.networkError && error.networkError.statusCode === 401) {
-// removeAuthToken();
-// }
-// });
+const invalidTokenLink = onError((error: ResponseError) => {
+ if (error.networkError && error.networkError.statusCode === 401) {
+ removeAuthToken();
+ }
+});
-// const authLink = setContext((_, context) => {
-// const authToken = getAuthToken();
-// return {
-// ...context,
-// headers: {
-// ...context.headers,
-// Authorization: authToken ? `JWT ${authToken}` : null
-// }
-// };
-// });
+const authLink = setContext((_, context) => {
+ const authToken = getAuthToken();
+ return {
+ ...context,
+ headers: {
+ ...context.headers,
+ Authorization: authToken ? `JWT ${authToken}` : null
+ }
+ };
+});
-// const uploadLink = createUploadLink({
-// credentials: "same-origin",
-// headers: {
-// "X-CSRFToken": cookies.get("csrftoken")
-// },
-// uri: "/graphql/"
-// });
+const uploadLink = createUploadLink({
+ credentials: "same-origin",
+ headers: {
+ "X-CSRFToken": cookies.get("csrftoken")
+ },
+ uri: "/graphql/"
+});
-// const apolloClient = new ApolloClient({
-// cache: new InMemoryCache({
-// dataIdFromObject: (obj: any) => {
-// // We need to set manually shop's ID, since it is singleton and
-// // API does not return its ID
-// if (obj.__typename === "Shop") {
-// return "shop";
-// }
-// return defaultDataIdFromObject(obj);
-// }
-// }),
-// link: invalidTokenLink.concat(authLink.concat(uploadLink))
-// });
+const apolloClient = new ApolloClient({
+ cache: new InMemoryCache({
+ dataIdFromObject: (obj: any) => {
+ // We need to set manually shop's ID, since it is singleton and
+ // API does not return its ID
+ if (obj.__typename === "Shop") {
+ return "shop";
+ }
+ return defaultDataIdFromObject(obj);
+ }
+ }),
+ link: invalidTokenLink.concat(authLink.concat(uploadLink))
+});
-// export const appMountPoint = "/dashboard/next/";
+export const appMountPoint = "/dashboard/next/";
-// render(
-// <ApolloProvider client={apolloClient}>
-// <BrowserRouter basename={appMountPoint}>
-// <MuiThemeProvider theme={theme}>
-// <DateProvider>
-// <LocaleProvider>
-// <MessageManager>
-// <ShopProvider>
-// <CssBaseline />
-// <WindowTitle title={i18n.t("Dashboard")} />
-// <AuthProvider>
-// {({
-// hasToken,
-// isAuthenticated,
-// tokenAuthLoading,
-// tokenVerifyLoading,
-// user
-// }) => {
-// return isAuthenticated &&
-// !tokenAuthLoading &&
-// !tokenVerifyLoading ? (
-// <Switch>
-// <SectionRoute exact path="/" component={HomePage} />
-// <SectionRoute
-// permissions={[PermissionEnum.MANAGE_PRODUCTS]}
-// path="/categories"
-// component={CategorySection}
-// />
-// <SectionRoute
-// permissions={[PermissionEnum.MANAGE_PRODUCTS]}
-// path="/collections"
-// component={CollectionSection}
-// />
-// <SectionRoute
-// permissions={[PermissionEnum.MANAGE_USERS]}
-// path="/customers"
-// component={CustomerSection}
-// />
-// <SectionRoute
-// permissions={[PermissionEnum.MANAGE_PAGES]}
-// path="/pages"
-// component={PageSection}
-// />
-// <SectionRoute
-// permissions={[PermissionEnum.MANAGE_ORDERS]}
-// path="/orders"
-// component={OrdersSection}
-// />
-// <SectionRoute
-// permissions={[PermissionEnum.MANAGE_PRODUCTS]}
-// path="/products"
-// component={ProductSection}
-// />
-// <SectionRoute
-// permissions={[PermissionEnum.MANAGE_PRODUCTS]}
-// path="/productTypes"
-// component={ProductTypesSection}
-// />
-// <SectionRoute
-// permissions={[PermissionEnum.MANAGE_STAFF]}
-// path="/staff"
-// component={StaffSection}
-// />
-// <SectionRoute
-// permissions={[PermissionEnum.MANAGE_SETTINGS]}
-// path="/siteSettings"
-// component={SiteSettingsSection}
-// />
-// {configurationMenu.filter(menuItem =>
-// hasPermission(menuItem.permission, user)
-// ).length > 0 && (
-// <SectionRoute
-// exact
-// path="/configuration"
-// component={ConfigurationSection}
-// />
-// )}
-// <Route component={NotFound} />
-// </Switch>
-// ) : hasToken && tokenVerifyLoading ? (
-// <LoginLoading />
-// ) : (
-// <Auth loading={tokenAuthLoading} />
-// );
-// }}
-// </AuthProvider>
-// </ShopProvider>
-// </MessageManager>
-// </LocaleProvider>
-// </DateProvider>
-// </MuiThemeProvider>
-// </BrowserRouter>
-// </ApolloProvider>,
-// document.querySelector("#dashboard-app")
-// );
-
-// export interface ListProps {
-// disabled: boolean;
-// pageInfo?: {
-// hasNextPage: boolean;
-// hasPreviousPage: boolean;
-// };
-// onNextPage: () => void;
-// onPreviousPage: () => void;
-// onRowClick: (id: string) => () => void;
-// }
-// export interface PageListProps extends ListProps {
-// onAdd: () => void;
-// }
-
-// export interface UserError {
-// field: string;
-// message: string;
-// }
-
-// // These interfaces are used in atomic mutation providers, which then are
-// // combined into one compound mutation provider
-// export interface PartialMutationProviderProps<T extends {} = {}> {
-// onSuccess?: (data: T) => void;
-// onError?: (error: ApolloError) => void;
-// }
-// export interface PartialMutationProviderOutput<
-// TData extends {} = {},
-// TVariables extends {} = {}
-// > {
-// data: TData;
-// loading: boolean;
-// mutate: (variables: TVariables) => void;
-// }
-// export type PartialMutationProviderRenderProps<
-// TData extends {} = {},
-// TVariables extends {} = {}
-// > = (
-// props: {
-// called?: boolean;
-// data: TData;
-// loading: boolean;
-// error?: ApolloError;
-// mutate: MutationFn<TData, TVariables>;
-// }
-// ) => React.ReactElement<any>;
-
-// export interface MutationProviderProps {
-// onError?: (error: ApolloError) => void;
-// }
-// export type MutationProviderRenderProps<T> = (
-// props: T & { errors?: UserError[] }
-// ) => React.ReactElement<any>;
+render(
+ <ApolloProvider client={apolloClient}>
+ <BrowserRouter basename={appMountPoint}>
+ <MuiThemeProvider theme={theme}>
+ <DateProvider>
+ <LocaleProvider>
+ <MessageManager>
+ <ShopProvider>
+ <CssBaseline />
+ <WindowTitle title={i18n.t("Dashboard")} />
+ <AuthProvider>
+ {({
+ hasToken,
+ isAuthenticated,
+ tokenAuthLoading,
+ tokenVerifyLoading,
+ user
+ }) => {
+ return isAuthenticated &&
+ !tokenAuthLoading &&
+ !tokenVerifyLoading ? (
+ <Switch>
+ <SectionRoute exact path="/" component={HomePage} />
+ <SectionRoute
+ permissions={[PermissionEnum.MANAGE_PRODUCTS]}
+ path="/categories"
+ component={CategorySection}
+ />
+ <SectionRoute
+ permissions={[PermissionEnum.MANAGE_PRODUCTS]}
+ path="/collections"
+ component={CollectionSection}
+ />
+ <SectionRoute
+ permissions={[PermissionEnum.MANAGE_USERS]}
+ path="/customers"
+ component={CustomerSection}
+ />
+ <SectionRoute
+ permissions={[PermissionEnum.MANAGE_PAGES]}
+ path="/pages"
+ component={PageSection}
+ />
+ <SectionRoute
+ permissions={[PermissionEnum.MANAGE_ORDERS]}
+ path="/orders"
+ component={OrdersSection}
+ />
+ <SectionRoute
+ permissions={[PermissionEnum.MANAGE_PRODUCTS]}
+ path="/products"
+ component={ProductSection}
+ />
+ <SectionRoute
+ permissions={[PermissionEnum.MANAGE_PRODUCTS]}
+ path="/productTypes"
+ component={ProductTypesSection}
+ />
+ <SectionRoute
+ permissions={[PermissionEnum.MANAGE_STAFF]}
+ path="/staff"
+ component={StaffSection}
+ />
+ <SectionRoute
+ permissions={[PermissionEnum.MANAGE_SETTINGS]}
+ path="/siteSettings"
+ component={SiteSettingsSection}
+ />
+ {configurationMenu.filter(menuItem =>
+ hasPermission(menuItem.permission, user)
+ ).length > 0 && (
+ <SectionRoute
+ exact
+ path="/configuration"
+ component={ConfigurationSection}
+ />
+ )}
+ <Route component={NotFound} />
+ </Switch>
+ ) : hasToken && tokenVerifyLoading ? (
+ <LoginLoading />
+ ) : (
+ <Login loading={tokenAuthLoading} />
+ );
+ }}
+ </AuthProvider>
+ </ShopProvider>
+ </MessageManager>
+ </LocaleProvider>
+ </DateProvider>
+ </MuiThemeProvider>
+ </BrowserRouter>
+ </ApolloProvider>,
+ document.querySelector("#dashboard-app")
+);
diff --git a/saleor/static/dashboard-next/orders/containers/OrderCancel.tsx b/saleor/static/dashboard-next/orders/containers/OrderCancel.tsx
index 30c100f20a..603627d4d4 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderCancel.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderCancel.tsx
@@ -6,7 +6,7 @@ import { OrderCancel, OrderCancelVariables } from "../types/OrderCancel";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderCancelMutationProviderProps
extends PartialMutationProviderProps<OrderCancel> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderCreateFulfillment.tsx b/saleor/static/dashboard-next/orders/containers/OrderCreateFulfillment.tsx
index 2cb158d866..b01ddeb52e 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderCreateFulfillment.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderCreateFulfillment.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderCreateFulfillmentProviderProps
extends PartialMutationProviderProps<OrderCreateFulfillment> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderDraftCancel.tsx b/saleor/static/dashboard-next/orders/containers/OrderDraftCancel.tsx
index 09482222eb..d3d0c8ad00 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderDraftCancel.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderDraftCancel.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderDraftCancelMutationProviderProps
extends PartialMutationProviderProps<OrderDraftCancel> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderDraftFinalize.tsx b/saleor/static/dashboard-next/orders/containers/OrderDraftFinalize.tsx
index 526acd75aa..c8e2395995 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderDraftFinalize.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderDraftFinalize.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderDraftFinalizeMutationProviderProps
extends PartialMutationProviderProps<OrderDraftFinalize> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderDraftUpdate.tsx b/saleor/static/dashboard-next/orders/containers/OrderDraftUpdate.tsx
index 75f0ed8403..14893364fa 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderDraftUpdate.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderDraftUpdate.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderDraftUpdateProviderProps
extends PartialMutationProviderProps<OrderDraftUpdate> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderFulfillmentCancel.tsx b/saleor/static/dashboard-next/orders/containers/OrderFulfillmentCancel.tsx
index d2e18584df..de828ef078 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderFulfillmentCancel.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderFulfillmentCancel.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderFulfillmentCancelProviderProps
extends PartialMutationProviderProps<OrderFulfillmentCancel> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderFulfillmentUpdateTracking.tsx b/saleor/static/dashboard-next/orders/containers/OrderFulfillmentUpdateTracking.tsx
index c3c177ced1..4a1b4e3e53 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderFulfillmentUpdateTracking.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderFulfillmentUpdateTracking.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderFulfillmentUpdateTrackingProviderProps
extends PartialMutationProviderProps<OrderFulfillmentUpdateTracking> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderLineAdd.tsx b/saleor/static/dashboard-next/orders/containers/OrderLineAdd.tsx
index 7b5071291b..24d0945eb6 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderLineAdd.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderLineAdd.tsx
@@ -6,7 +6,7 @@ import { OrderLineAdd, OrderLineAddVariables } from "../types/OrderLineAdd";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderLineAddProviderProps
extends PartialMutationProviderProps<OrderLineAdd> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderLineDelete.tsx b/saleor/static/dashboard-next/orders/containers/OrderLineDelete.tsx
index 3c7447d2ee..a0f285fada 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderLineDelete.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderLineDelete.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderLineDeleteProviderProps
extends PartialMutationProviderProps<OrderLineDelete> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderLineUpdate.tsx b/saleor/static/dashboard-next/orders/containers/OrderLineUpdate.tsx
index be2b837073..c3d7bad746 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderLineUpdate.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderLineUpdate.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderLineUpdateProviderProps
extends PartialMutationProviderProps<OrderLineUpdate> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderMarkAsPaid.tsx b/saleor/static/dashboard-next/orders/containers/OrderMarkAsPaid.tsx
index 6a3b02e8da..1f5cbfe90f 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderMarkAsPaid.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderMarkAsPaid.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderPaymentCaptureProviderProps
extends PartialMutationProviderProps<OrderMarkAsPaid> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderNoteAdd.tsx b/saleor/static/dashboard-next/orders/containers/OrderNoteAdd.tsx
index 2e7c2be6ab..4c754dc4ff 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderNoteAdd.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderNoteAdd.tsx
@@ -6,7 +6,7 @@ import { OrderAddNote, OrderAddNoteVariables } from "../types/OrderAddNote";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderNoteAddProviderProps
extends PartialMutationProviderProps<OrderAddNote> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx b/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx
index be2affb4c0..da3531a6a9 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderOperations.tsx
@@ -4,7 +4,7 @@ import {
MutationProviderProps,
MutationProviderRenderProps,
PartialMutationProviderOutput
-} from "../..";
+} from "../../types";
import { maybe } from "../../misc";
import { OrderAddNote, OrderAddNoteVariables } from "../types/OrderAddNote";
import { OrderCancel, OrderCancelVariables } from "../types/OrderCancel";
diff --git a/saleor/static/dashboard-next/orders/containers/OrderPaymentCapture.tsx b/saleor/static/dashboard-next/orders/containers/OrderPaymentCapture.tsx
index 9049a465dd..4b50eb18c9 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderPaymentCapture.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderPaymentCapture.tsx
@@ -6,7 +6,7 @@ import { OrderCapture, OrderCaptureVariables } from "../types/OrderCapture";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderPaymentCaptureProviderProps
extends PartialMutationProviderProps<OrderCapture> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderPaymentRefund.tsx b/saleor/static/dashboard-next/orders/containers/OrderPaymentRefund.tsx
index c4a9991dc9..07c9cbb531 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderPaymentRefund.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderPaymentRefund.tsx
@@ -6,7 +6,7 @@ import { OrderRefund, OrderRefundVariables } from "../types/OrderRefund";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderPaymentCaptureProviderProps
extends PartialMutationProviderProps<OrderRefund> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderShippingUpdate.tsx b/saleor/static/dashboard-next/orders/containers/OrderShippingUpdate.tsx
index 80f42f65ef..309b06911c 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderShippingUpdate.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderShippingUpdate.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderShippingMethodUpdateProviderProps
extends PartialMutationProviderProps<OrderShippingMethodUpdate> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderUpdate.tsx b/saleor/static/dashboard-next/orders/containers/OrderUpdate.tsx
index 962e30b3c6..33123b71f2 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderUpdate.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderUpdate.tsx
@@ -6,7 +6,7 @@ import { OrderUpdate, OrderUpdateVariables } from "../types/OrderUpdate";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderUpdateProviderProps
extends PartialMutationProviderProps<OrderUpdate> {
diff --git a/saleor/static/dashboard-next/orders/containers/OrderVoid.tsx b/saleor/static/dashboard-next/orders/containers/OrderVoid.tsx
index 0ce9dd121c..a6b39aaaa8 100644
--- a/saleor/static/dashboard-next/orders/containers/OrderVoid.tsx
+++ b/saleor/static/dashboard-next/orders/containers/OrderVoid.tsx
@@ -6,7 +6,7 @@ import { OrderVoid, OrderVoidVariables } from "../types/OrderVoid";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface OrderVoidMutationProviderProps
extends PartialMutationProviderProps<OrderVoid> {
diff --git a/saleor/static/dashboard-next/orders/index.tsx b/saleor/static/dashboard-next/orders/index.tsx
index f9aeee2467..6751d53ca6 100644
--- a/saleor/static/dashboard-next/orders/index.tsx
+++ b/saleor/static/dashboard-next/orders/index.tsx
@@ -1,43 +1,43 @@
-// import { parse as parseQs } from "qs";
-// import * as React from "react";
-// import { Route, RouteComponentProps, Switch } from "react-router-dom";
+import { parse as parseQs } from "qs";
+import * as React from "react";
+import { Route, RouteComponentProps, Switch } from "react-router-dom";
-// import { WindowTitle } from "../components/WindowTitle";
-// import i18n from "../i18n";
-// import OrderDetailsComponent from "./views/OrderDetails";
-// import OrderListComponent, { OrderListQueryParams } from "./views/OrderList";
+import { WindowTitle } from "../components/WindowTitle";
+import i18n from "../i18n";
+import OrderDetailsComponent from "./views/OrderDetails";
+import OrderListComponent, { OrderListQueryParams } from "./views/OrderList";
-// const OrderList: React.StatelessComponent<RouteComponentProps<any>> = ({
-// location
-// }) => {
-// const qs = parseQs(location.search.substr(1));
-// const params: OrderListQueryParams = {
-// after: qs.after,
-// before: qs.before
-// };
-// return <OrderListComponent params={params} />;
-// };
+const OrderList: React.StatelessComponent<RouteComponentProps<any>> = ({
+ location
+}) => {
+ const qs = parseQs(location.search.substr(1));
+ const params: OrderListQueryParams = {
+ after: qs.after,
+ before: qs.before
+ };
+ return <OrderListComponent params={params} />;
+};
-// const OrderDetails: React.StatelessComponent<RouteComponentProps<any>> = ({
-// match
-// }) => {
-// return <OrderDetailsComponent id={decodeURIComponent(match.params.id)} />;
-// };
+const OrderDetails: React.StatelessComponent<RouteComponentProps<any>> = ({
+ match
+}) => {
+ return <OrderDetailsComponent id={decodeURIComponent(match.params.id)} />;
+};
-// const Component = ({ match }) => (
-// <>
-// <WindowTitle title={i18n.t("Orders")} />
-// <Switch>
-// <Route exact path={match.url} component={OrderList} />
-// <Route exact path={`${match.url}/:id/`} component={OrderDetails} />
-// </Switch>
-// </>
-// );
+const Component = ({ match }) => (
+ <>
+ <WindowTitle title={i18n.t("Orders")} />
+ <Switch>
+ <Route exact path={match.url} component={OrderList} />
+ <Route exact path={`${match.url}/:id/`} component={OrderDetails} />
+ </Switch>
+ </>
+);
-// export const orderListUrl = "/orders/";
+export const orderListUrl = "/orders/";
-// export const orderUrl = (id: string) => {
-// return `/orders/${id}/`;
-// };
+export const orderUrl = (id: string) => {
+ return `/orders/${id}/`;
+};
-// export default Component;
+export default Component;
diff --git a/saleor/static/dashboard-next/pages/index.tsx b/saleor/static/dashboard-next/pages/index.tsx
index d3764c3986..b743fbc3d8 100644
--- a/saleor/static/dashboard-next/pages/index.tsx
+++ b/saleor/static/dashboard-next/pages/index.tsx
@@ -1,49 +1,49 @@
-// import { parse as parseQs } from "qs";
-// import * as React from "react";
-// import { Route, RouteComponentProps, Switch } from "react-router-dom";
+import { parse as parseQs } from "qs";
+import * as React from "react";
+import { Route, RouteComponentProps, Switch } from "react-router-dom";
-// import { WindowTitle } from "../components/WindowTitle";
-// import i18n from "../i18n";
-// import PageCreate from "./views/PageCreate";
-// import PageDetailsComponent from "./views/PageDetails";
-// import PageListComponent, { PageListQueryParams } from "./views/PageList";
+import { WindowTitle } from "../components/WindowTitle";
+import i18n from "../i18n";
+import PageCreate from "./views/PageCreate";
+import PageDetailsComponent from "./views/PageDetails";
+import PageListComponent, { PageListQueryParams } from "./views/PageList";
-// const PageList: React.StatelessComponent<RouteComponentProps<any>> = ({
-// location
-// }) => {
-// const qs = parseQs(location.search.substr(1));
-// const params: PageListQueryParams = {
-// after: qs.after,
-// before: qs.before
-// };
-// return <PageListComponent params={params} />;
-// };
-// const PageDetails: React.StatelessComponent<RouteComponentProps<any>> = ({
-// match
-// }) => {
-// return <PageDetailsComponent id={match.params.id} />;
-// };
+const PageList: React.StatelessComponent<RouteComponentProps<any>> = ({
+ location
+}) => {
+ const qs = parseQs(location.search.substr(1));
+ const params: PageListQueryParams = {
+ after: qs.after,
+ before: qs.before
+ };
+ return <PageListComponent params={params} />;
+};
+const PageDetails: React.StatelessComponent<RouteComponentProps<any>> = ({
+ match
+}) => {
+ return <PageDetailsComponent id={match.params.id} />;
+};
-// const Component = ({ match }) => (
-// <>
-// <WindowTitle title={i18n.t("Pages")} />
-// <Switch>
-// <Route exact path={match.url} component={PageList} />
-// <Route exact path={`${match.url}/add/`} component={PageCreate} />
-// <Route exact path={`${match.url}/:id/`} component={PageDetails} />
-// </Switch>
-// </>
-// );
+const Component = ({ match }) => (
+ <>
+ <WindowTitle title={i18n.t("Pages")} />
+ <Switch>
+ <Route exact path={match.url} component={PageList} />
+ <Route exact path={`${match.url}/add/`} component={PageCreate} />
+ <Route exact path={`${match.url}/:id/`} component={PageDetails} />
+ </Switch>
+ </>
+);
-// export function pageEditUrl(id: string) {
-// return `/pages/${id}/`;
-// }
+export function pageEditUrl(id: string) {
+ return `/pages/${id}/`;
+}
-// export function pageStorefrontUrl(slug: string) {
-// return `/page/${slug}/`;
-// }
+export function pageStorefrontUrl(slug: string) {
+ return `/page/${slug}/`;
+}
-// export const pageListUrl = "/pages/";
-// export const pageAddUrl = "/pages/add/";
+export const pageListUrl = "/pages/";
+export const pageAddUrl = "/pages/add/";
-// export default Component;
+export default Component;
diff --git a/saleor/static/dashboard-next/productTypes/containers/AttributeCreate.tsx b/saleor/static/dashboard-next/productTypes/containers/AttributeCreate.tsx
index 288792b2a1..00840e9764 100644
--- a/saleor/static/dashboard-next/productTypes/containers/AttributeCreate.tsx
+++ b/saleor/static/dashboard-next/productTypes/containers/AttributeCreate.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
import { TypedAttributeCreateMutation } from "../mutations";
import {
AttributeCreate,
diff --git a/saleor/static/dashboard-next/productTypes/containers/AttributeDelete.tsx b/saleor/static/dashboard-next/productTypes/containers/AttributeDelete.tsx
index ee797e8a85..7f37bde616 100644
--- a/saleor/static/dashboard-next/productTypes/containers/AttributeDelete.tsx
+++ b/saleor/static/dashboard-next/productTypes/containers/AttributeDelete.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
import { TypedAttributeDeleteMutation } from "../mutations";
import {
AttributeDelete,
diff --git a/saleor/static/dashboard-next/productTypes/containers/AttributeUpdate.tsx b/saleor/static/dashboard-next/productTypes/containers/AttributeUpdate.tsx
index 13d86ebac5..077d847d83 100644
--- a/saleor/static/dashboard-next/productTypes/containers/AttributeUpdate.tsx
+++ b/saleor/static/dashboard-next/productTypes/containers/AttributeUpdate.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
import { TypedAttributeUpdateMutation } from "../mutations";
import {
AttributeUpdate,
diff --git a/saleor/static/dashboard-next/productTypes/containers/ProductTypeDelete.tsx b/saleor/static/dashboard-next/productTypes/containers/ProductTypeDelete.tsx
index eadd867865..104defb9d4 100644
--- a/saleor/static/dashboard-next/productTypes/containers/ProductTypeDelete.tsx
+++ b/saleor/static/dashboard-next/productTypes/containers/ProductTypeDelete.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
import { TypedProductTypeDeleteMutation } from "../mutations";
import {
ProductTypeDelete,
diff --git a/saleor/static/dashboard-next/productTypes/containers/ProductTypeOperations.tsx b/saleor/static/dashboard-next/productTypes/containers/ProductTypeOperations.tsx
index c328a1f035..f01c3c5117 100644
--- a/saleor/static/dashboard-next/productTypes/containers/ProductTypeOperations.tsx
+++ b/saleor/static/dashboard-next/productTypes/containers/ProductTypeOperations.tsx
@@ -4,7 +4,7 @@ import {
MutationProviderProps,
MutationProviderRenderProps,
PartialMutationProviderOutput
-} from "../..";
+} from "../../types";
import {
AttributeCreate,
AttributeCreateVariables
diff --git a/saleor/static/dashboard-next/productTypes/containers/ProductTypeUpdate.tsx b/saleor/static/dashboard-next/productTypes/containers/ProductTypeUpdate.tsx
index 05a75f40f7..54ca70a19a 100644
--- a/saleor/static/dashboard-next/productTypes/containers/ProductTypeUpdate.tsx
+++ b/saleor/static/dashboard-next/productTypes/containers/ProductTypeUpdate.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
import { TypedProductTypeUpdateMutation } from "../mutations";
import {
ProductTypeUpdate,
diff --git a/saleor/static/dashboard-next/productTypes/index.tsx b/saleor/static/dashboard-next/productTypes/index.tsx
index 817a72b409..5edf2a49f3 100644
--- a/saleor/static/dashboard-next/productTypes/index.tsx
+++ b/saleor/static/dashboard-next/productTypes/index.tsx
@@ -1,46 +1,46 @@
-// import { parse as parseQs } from "qs";
-// import * as React from "react";
-// import { Route, RouteComponentProps, Switch } from "react-router-dom";
+import { parse as parseQs } from "qs";
+import * as React from "react";
+import { Route, RouteComponentProps, Switch } from "react-router-dom";
-// import { WindowTitle } from "../components/WindowTitle";
-// import i18n from "../i18n";
-// import ProductTypeCreate from "./views/ProductTypeCreate";
-// import ProductTypeListComponent, {
-// ProductTypeListQueryParams
-// } from "./views/ProductTypeList";
-// import ProductTypeUpdateComponent from "./views/ProductTypeUpdate";
+import { WindowTitle } from "../components/WindowTitle";
+import i18n from "../i18n";
+import ProductTypeCreate from "./views/ProductTypeCreate";
+import ProductTypeListComponent, {
+ ProductTypeListQueryParams
+} from "./views/ProductTypeList";
+import ProductTypeUpdateComponent from "./views/ProductTypeUpdate";
-// const ProductTypeList: React.StatelessComponent<RouteComponentProps<{}>> = ({
-// location
-// }) => {
-// const qs = parseQs(location.search.substr(1));
-// const params: ProductTypeListQueryParams = {
-// after: qs.after,
-// before: qs.before
-// };
-// return <ProductTypeListComponent params={params} />;
-// };
+const ProductTypeList: React.StatelessComponent<RouteComponentProps<{}>> = ({
+ location
+}) => {
+ const qs = parseQs(location.search.substr(1));
+ const params: ProductTypeListQueryParams = {
+ after: qs.after,
+ before: qs.before
+ };
+ return <ProductTypeListComponent params={params} />;
+};
-// interface ProductTypeUpdateRouteParams {
-// id: string;
-// }
-// const ProductTypeUpdate: React.StatelessComponent<
-// RouteComponentProps<ProductTypeUpdateRouteParams>
-// > = ({ match }) => (
-// <ProductTypeUpdateComponent id={decodeURIComponent(match.params.id)} />
-// );
+interface ProductTypeUpdateRouteParams {
+ id: string;
+}
+const ProductTypeUpdate: React.StatelessComponent<
+ RouteComponentProps<ProductTypeUpdateRouteParams>
+> = ({ match }) => (
+ <ProductTypeUpdateComponent id={decodeURIComponent(match.params.id)} />
+);
-// export const ProductTypeRouter: React.StatelessComponent<
-// RouteComponentProps<any>
-// > = ({ match }) => (
-// <>
-// <WindowTitle title={i18n.t("Product types")} />
-// <Switch>
-// <Route exact path={match.url} component={ProductTypeList} />
-// <Route exact path={match.url + "/add/"} component={ProductTypeCreate} />
-// <Route path={match.url + "/:id/"} component={ProductTypeUpdate} />
-// </Switch>
-// </>
-// );
-// ProductTypeRouter.displayName = "ProductTypeRouter";
-// export default ProductTypeRouter;
+export const ProductTypeRouter: React.StatelessComponent<
+ RouteComponentProps<any>
+> = ({ match }) => (
+ <>
+ <WindowTitle title={i18n.t("Product types")} />
+ <Switch>
+ <Route exact path={match.url} component={ProductTypeList} />
+ <Route exact path={match.url + "/add/"} component={ProductTypeCreate} />
+ <Route path={match.url + "/:id/"} component={ProductTypeUpdate} />
+ </Switch>
+ </>
+);
+ProductTypeRouter.displayName = "ProductTypeRouter";
+export default ProductTypeRouter;
diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx b/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx
index 12162ba8b4..c6f370765b 100644
--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx
+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeCreate.tsx
@@ -1,7 +1,6 @@
import * as React from "react";
import Navigator from "../../components/Navigator";
-import { productTypeDetailsUrl, productTypeListUrl } from "..";
import Messages from "../../components/messages";
import { WindowTitle } from "../../components/WindowTitle";
import i18n from "../../i18n";
@@ -12,6 +11,7 @@ import ProductTypeCreatePage, {
import { TypedProductTypeCreateMutation } from "../mutations";
import { TypedProductTypeCreateDataQuery } from "../queries";
import { ProductTypeCreate as ProductTypeCreateMutation } from "../types/ProductTypeCreate";
+import { productTypeDetailsUrl, productTypeListUrl } from "../urls";
export const ProductTypeCreate: React.StatelessComponent = () => (
<Messages>
diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeList.tsx b/saleor/static/dashboard-next/productTypes/views/ProductTypeList.tsx
index 1b612f5040..815d1b7d34 100644
--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeList.tsx
+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeList.tsx
@@ -1,12 +1,12 @@
import * as React from "react";
-import { productTypeAddUrl, productTypeDetailsUrl } from "..";
import ErrorMessageCard from "../../components/ErrorMessageCard";
import Navigator from "../../components/Navigator";
import { createPaginationState, Paginator } from "../../components/Paginator";
import { maybe } from "../../misc";
import ProductTypeListPage from "../components/ProductTypeListPage";
import { TypedProductTypeListQuery } from "../queries";
+import { productTypeAddUrl, productTypeDetailsUrl } from "../urls";
export type ProductTypeListQueryParams = Partial<{
after: string;
diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/errors.tsx b/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/errors.tsx
index 85bfb42f37..851bf6c30e 100644
--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/errors.tsx
+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/errors.tsx
@@ -1,6 +1,6 @@
import * as React from "react";
-import { UserError } from "../../..";
+import { UserError } from "../../../types";
interface ProductTypeUpdateErrorsState {
addAttributeErrors: UserError[];
diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx b/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx
index d7d6c6cd4a..c0a7e6255c 100644
--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx
+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/index.tsx
@@ -1,7 +1,6 @@
import * as React from "react";
import { Route } from "react-router-dom";
-import { productTypeDetailsUrl, productTypeListUrl } from "../../";
import Messages from "../../../components/messages";
import Navigator from "../../../components/Navigator";
import { WindowTitle } from "../../../components/WindowTitle";
@@ -21,6 +20,7 @@ import { AttributeDelete } from "../../types/AttributeDelete";
import { AttributeUpdate } from "../../types/AttributeUpdate";
import { ProductTypeDelete } from "../../types/ProductTypeDelete";
import { ProductTypeUpdate as ProductTypeUpdateMutation } from "../../types/ProductTypeUpdate";
+import { productTypeDetailsUrl, productTypeListUrl } from "../../urls";
import { ProductTypeUpdateErrors } from "./errors";
import { addAttributeUrl, editAttributeUrl } from "./urls";
diff --git a/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/urls.ts b/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/urls.ts
index 661b6d3b99..c1ff8c3787 100644
--- a/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/urls.ts
+++ b/saleor/static/dashboard-next/productTypes/views/ProductTypeUpdate/urls.ts
@@ -1,5 +1,5 @@
-import { productTypeDetailsUrl } from "../..";
import { AttributeTypeEnum } from "../../../types/globalTypes";
+import { productTypeDetailsUrl } from "../../urls";
export const addAttributeUrl = (
productTypeId: string,
diff --git a/saleor/static/dashboard-next/products/containers/ProductImageDelete.tsx b/saleor/static/dashboard-next/products/containers/ProductImageDelete.tsx
index 8394ee5f94..91a9cf693b 100644
--- a/saleor/static/dashboard-next/products/containers/ProductImageDelete.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductImageDelete.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface ProductImagesDeleteProviderProps
extends PartialMutationProviderProps<ProductImageDelete> {
diff --git a/saleor/static/dashboard-next/products/containers/ProductImageUpdate.tsx b/saleor/static/dashboard-next/products/containers/ProductImageUpdate.tsx
index acc420392e..b1895de3ab 100644
--- a/saleor/static/dashboard-next/products/containers/ProductImageUpdate.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductImageUpdate.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface ProductImagesUpdateProviderProps
extends PartialMutationProviderProps<ProductImageUpdate> {
diff --git a/saleor/static/dashboard-next/products/containers/ProductImagesReorder.tsx b/saleor/static/dashboard-next/products/containers/ProductImagesReorder.tsx
index 03c5fcbe1c..3f71fb17fb 100644
--- a/saleor/static/dashboard-next/products/containers/ProductImagesReorder.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductImagesReorder.tsx
@@ -9,7 +9,7 @@ import {
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
interface ProductImagesReorderProviderProps
extends PartialMutationProviderProps<ProductImageReorder> {
diff --git a/saleor/static/dashboard-next/products/containers/ProductUpdate.tsx b/saleor/static/dashboard-next/products/containers/ProductUpdate.tsx
index 61da107e80..bd9f1abc47 100644
--- a/saleor/static/dashboard-next/products/containers/ProductUpdate.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductUpdate.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
import { TypedProductUpdateMutation } from "../mutations";
import { ProductUpdate, ProductUpdateVariables } from "../types/ProductUpdate";
diff --git a/saleor/static/dashboard-next/products/containers/ProductUpdateOperations.tsx b/saleor/static/dashboard-next/products/containers/ProductUpdateOperations.tsx
index 445533e617..07d69e134f 100644
--- a/saleor/static/dashboard-next/products/containers/ProductUpdateOperations.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductUpdateOperations.tsx
@@ -6,7 +6,7 @@ import {
PartialMutationProviderOutput,
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
import {
TypedProductDeleteMutation,
TypedProductImageCreateMutation,
diff --git a/saleor/static/dashboard-next/products/containers/ProductVariantDelete.tsx b/saleor/static/dashboard-next/products/containers/ProductVariantDelete.tsx
index 54a5e6fd6c..b668d5c0c3 100644
--- a/saleor/static/dashboard-next/products/containers/ProductVariantDelete.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductVariantDelete.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
import { TypedVariantDeleteMutation } from "../mutations";
import { VariantDelete, VariantDeleteVariables } from "../types/VariantDelete";
diff --git a/saleor/static/dashboard-next/products/containers/ProductVariantImageAssign.tsx b/saleor/static/dashboard-next/products/containers/ProductVariantImageAssign.tsx
index d7982aebc7..ae0b809a46 100644
--- a/saleor/static/dashboard-next/products/containers/ProductVariantImageAssign.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductVariantImageAssign.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
import { TypedVariantImageAssignMutation } from "../mutations";
import {
VariantImageAssign,
diff --git a/saleor/static/dashboard-next/products/containers/ProductVariantImageUnassign.tsx b/saleor/static/dashboard-next/products/containers/ProductVariantImageUnassign.tsx
index 60131b3216..7c8f84d3c0 100644
--- a/saleor/static/dashboard-next/products/containers/ProductVariantImageUnassign.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductVariantImageUnassign.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
import { TypedVariantImageUnassignMutation } from "../mutations";
import {
VariantImageUnassign,
diff --git a/saleor/static/dashboard-next/products/containers/ProductVariantOperations.tsx b/saleor/static/dashboard-next/products/containers/ProductVariantOperations.tsx
index 7ede157260..a67def080a 100644
--- a/saleor/static/dashboard-next/products/containers/ProductVariantOperations.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductVariantOperations.tsx
@@ -4,7 +4,7 @@ import {
MutationProviderProps,
MutationProviderRenderProps,
PartialMutationProviderOutput
-} from "../..";
+} from "../../types";
import { VariantDelete } from "../types/VariantDelete";
import {
VariantImageAssign,
diff --git a/saleor/static/dashboard-next/products/containers/ProductVariantUpdate.tsx b/saleor/static/dashboard-next/products/containers/ProductVariantUpdate.tsx
index 37bc0c2692..57188b239c 100644
--- a/saleor/static/dashboard-next/products/containers/ProductVariantUpdate.tsx
+++ b/saleor/static/dashboard-next/products/containers/ProductVariantUpdate.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import {
PartialMutationProviderProps,
PartialMutationProviderRenderProps
-} from "../..";
+} from "../../types";
import { TypedVariantUpdateMutation } from "../mutations";
import { VariantUpdate, VariantUpdateVariables } from "../types/VariantUpdate";
diff --git a/saleor/static/dashboard-next/products/index.tsx b/saleor/static/dashboard-next/products/index.tsx
index 7e21baef1e..6e1b2d8d06 100644
--- a/saleor/static/dashboard-next/products/index.tsx
+++ b/saleor/static/dashboard-next/products/index.tsx
@@ -1,135 +1,135 @@
-// import { parse as parseQs } from "qs";
-// import * as React from "react";
-// import { Route, RouteComponentProps, Switch } from "react-router-dom";
-
-// import { WindowTitle } from "../components/WindowTitle";
-// import i18n from "../i18n";
-// import ProductCreate from "./views/ProductCreate";
-// import ProductImageComponent from "./views/ProductImage";
-// import ProductListComponent, {
-// ProductListQueryParams
-// } from "./views/ProductList";
-// import ProductUpdateComponent from "./views/ProductUpdate";
-// import ProductVariantComponent from "./views/ProductVariant";
-// import ProductVariantCreateComponent from "./views/ProductVariantCreate";
-
-// const ProductList: React.StatelessComponent<RouteComponentProps<any>> = ({
-// location
-// }) => {
-// const qs = parseQs(location.search.substr(1));
-// const params: ProductListQueryParams = {
-// after: qs.after,
-// before: qs.before
-// };
-// return <ProductListComponent params={params} />;
-// };
-
-// const ProductUpdate: React.StatelessComponent<RouteComponentProps<any>> = ({
-// match
-// }) => {
-// return <ProductUpdateComponent id={decodeURIComponent(match.params.id)} />;
-// };
-
-// const ProductVariant: React.StatelessComponent<RouteComponentProps<any>> = ({
-// match
-// }) => {
-// return (
-// <ProductVariantComponent
-// variantId={decodeURIComponent(match.params.variantId)}
-// productId={decodeURIComponent(match.params.productId)}
-// />
-// );
-// };
-
-// const ProductImage: React.StatelessComponent<RouteComponentProps<any>> = ({
-// match
-// }) => {
-// return (
-// <ProductImageComponent
-// imageId={decodeURIComponent(match.params.imageId)}
-// productId={decodeURIComponent(match.params.productId)}
-// />
-// );
-// };
-
-// const ProductVariantCreate: React.StatelessComponent<
-// RouteComponentProps<any>
-// > = ({ match }) => {
-// return (
-// <ProductVariantCreateComponent
-// productId={decodeURIComponent(match.params.id)}
-// />
-// );
-// };
-
-// const Component = ({ match }) => (
-// <>
-// <WindowTitle title={i18n.t("Products")} />
-// <Switch>
-// <Route exact path={match.url} component={ProductList} />
-// <Route exact path={`${match.url}/add/`} component={ProductCreate} />
-// <Route exact path={`${match.url}/:id/`} component={ProductUpdate} />
-// <Route
-// exact
-// path={`${match.url}/:id/variant/add/`}
-// component={ProductVariantCreate}
-// />
-// <Route
-// exact
-// path={`${match.url}/:productId/variant/:variantId/`}
-// component={ProductVariant}
-// />
-// <Route
-// exact
-// path={`${match.url}/:productId/image/:imageId/`}
-// component={ProductImage}
-// />
-// </Switch>
-// </>
-// );
-
-// export const productUrl = (id: string) => {
-// return `/products/${id}/`;
-// };
-
-// export const productVariantAddUrl = (productId: string) => {
-// return `/products/${productId}/variant/add/`;
-// };
-
-// export const productVariantEditUrl = (productId: string, variantId: string) => {
-// return `/products/${productId}/variant/${variantId}/`;
-// };
-
-// export const productImageUrl = (productId: string, imageId: string) =>
-// `/products/${productId}/image/${imageId}/`;
-
-// export const productListUrl = "/products/";
-// export const productAddUrl = "/products/add/";
-
-// export interface AttributeType {
-// id: string;
-// name: string;
-// slug: string;
-// values?: Array<{
-// name: string;
-// slug: string;
-// }>;
-// }
-
-// export interface AttributeValueType {
-// name: string;
-// slug: string;
-// }
-
-// export interface MoneyType {
-// amount: number;
-// currency: string;
-// }
-
-// export interface ProductImageType {
-// id: string;
-// sortOrder: number;
-// url: string;
-// }
-
-// export default Component;
+import { parse as parseQs } from "qs";
+import * as React from "react";
+import { Route, RouteComponentProps, Switch } from "react-router-dom";
+
+import { WindowTitle } from "../components/WindowTitle";
+import i18n from "../i18n";
+import ProductCreate from "./views/ProductCreate";
+import ProductImageComponent from "./views/ProductImage";
+import ProductListComponent, {
+ ProductListQueryParams
+} from "./views/ProductList";
+import ProductUpdateComponent from "./views/ProductUpdate";
+import ProductVariantComponent from "./views/ProductVariant";
+import ProductVariantCreateComponent from "./views/ProductVariantCreate";
+
+const ProductList: React.StatelessComponent<RouteComponentProps<any>> = ({
+ location
+}) => {
+ const qs = parseQs(location.search.substr(1));
+ const params: ProductListQueryParams = {
+ after: qs.after,
+ before: qs.before
+ };
+ return <ProductListComponent params={params} />;
+};
+
+const ProductUpdate: React.StatelessComponent<RouteComponentProps<any>> = ({
+ match
+}) => {
+ return <ProductUpdateComponent id={decodeURIComponent(match.params.id)} />;
+};
+
+const ProductVariant: React.StatelessComponent<RouteComponentProps<any>> = ({
+ match
+}) => {
+ return (
+ <ProductVariantComponent
+ variantId={decodeURIComponent(match.params.variantId)}
+ productId={decodeURIComponent(match.params.productId)}
+ />
+ );
+};
+
+const ProductImage: React.StatelessComponent<RouteComponentProps<any>> = ({
+ match
+}) => {
+ return (
+ <ProductImageComponent
+ imageId={decodeURIComponent(match.params.imageId)}
+ productId={decodeURIComponent(match.params.productId)}
+ />
+ );
+};
+
+const ProductVariantCreate: React.StatelessComponent<
+ RouteComponentProps<any>
+> = ({ match }) => {
+ return (
+ <ProductVariantCreateComponent
+ productId={decodeURIComponent(match.params.id)}
+ />
+ );
+};
+
+const Component = ({ match }) => (
+ <>
+ <WindowTitle title={i18n.t("Products")} />
+ <Switch>
+ <Route exact path={match.url} component={ProductList} />
+ <Route exact path={`${match.url}/add/`} component={ProductCreate} />
+ <Route exact path={`${match.url}/:id/`} component={ProductUpdate} />
+ <Route
+ exact
+ path={`${match.url}/:id/variant/add/`}
+ component={ProductVariantCreate}
+ />
+ <Route
+ exact
+ path={`${match.url}/:productId/variant/:variantId/`}
+ component={ProductVariant}
+ />
+ <Route
+ exact
+ path={`${match.url}/:productId/image/:imageId/`}
+ component={ProductImage}
+ />
+ </Switch>
+ </>
+);
+
+export const productUrl = (id: string) => {
+ return `/products/${id}/`;
+};
+
+export const productVariantAddUrl = (productId: string) => {
+ return `/products/${productId}/variant/add/`;
+};
+
+export const productVariantEditUrl = (productId: string, variantId: string) => {
+ return `/products/${productId}/variant/${variantId}/`;
+};
+
+export const productImageUrl = (productId: string, imageId: string) =>
+ `/products/${productId}/image/${imageId}/`;
+
+export const productListUrl = "/products/";
+export const productAddUrl = "/products/add/";
+
+export interface AttributeType {
+ id: string;
+ name: string;
+ slug: string;
+ values?: Array<{
+ name: string;
+ slug: string;
+ }>;
+}
+
+export interface AttributeValueType {
+ name: string;
+ slug: string;
+}
+
+export interface MoneyType {
+ amount: number;
+ currency: string;
+}
+
+export interface ProductImageType {
+ id: string;
+ sortOrder: number;
+ url: string;
+}
+
+export default Component;
diff --git a/saleor/static/dashboard-next/products/views/ProductCreate.tsx b/saleor/static/dashboard-next/products/views/ProductCreate.tsx
index 61e63146a6..9db00e79c2 100644
--- a/saleor/static/dashboard-next/products/views/ProductCreate.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductCreate.tsx
@@ -1,5 +1,6 @@
import * as React from "react";
+import { productListUrl, productUrl } from "..";
import ErrorMessageCard from "../../components/ErrorMessageCard";
import Messages from "../../components/messages";
import Navigator from "../../components/Navigator";
@@ -8,7 +9,6 @@ import { WindowTitle } from "../../components/WindowTitle";
import i18n from "../../i18n";
import { decimal, maybe } from "../../misc";
import ProductCreatePage from "../components/ProductCreatePage";
-import { productListUrl, productUrl } from "../index";
import { TypedProductCreateMutation } from "../mutations";
import { productCreateQuery, TypedProductCreateQuery } from "../queries";
import { ProductCreate } from "../types/ProductCreate";
diff --git a/saleor/static/dashboard-next/products/views/ProductImage.tsx b/saleor/static/dashboard-next/products/views/ProductImage.tsx
index 311d2f2508..8954122d32 100644
--- a/saleor/static/dashboard-next/products/views/ProductImage.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductImage.tsx
@@ -18,7 +18,6 @@ interface ProductImageProps {
export const ProductImage: React.StatelessComponent<ProductImageProps> = ({
imageId,
-
productId
}) => (
<Messages>
diff --git a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
index 2d1feb9b65..49494d215a 100644
--- a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx
@@ -8,7 +8,7 @@ import Navigator from "../../components/Navigator";
import { WindowTitle } from "../../components/WindowTitle";
import i18n from "../../i18n";
import { decimal, maybe } from "../../misc";
-import { productTypeDetailsUrl } from "../../productTypes";
+import { productTypeDetailsUrl } from "../../productTypes/urls";
import ProductUpdatePage from "../components/ProductUpdatePage";
import ProductUpdateOperations from "../containers/ProductUpdateOperations";
import {
diff --git a/saleor/static/dashboard-next/siteSettings/index.tsx b/saleor/static/dashboard-next/siteSettings/index.tsx
index 0b551ef343..16bc6f350e 100644
--- a/saleor/static/dashboard-next/siteSettings/index.tsx
+++ b/saleor/static/dashboard-next/siteSettings/index.tsx
@@ -1,9 +1,9 @@
-// import * as React from "react";
-// import { Route, RouteComponentProps } from "react-router-dom";
+import * as React from "react";
+import { Route, RouteComponentProps } from "react-router-dom";
-// import SiteSettings from "./views/";
+import SiteSettings from "./views/";
-// export const SiteSettingsSection: React.StatelessComponent<
-// RouteComponentProps<{}>
-// > = ({ match }) => <Route path={match.url} component={SiteSettings} />;
-// export default SiteSettingsSection;
+export const SiteSettingsSection: React.StatelessComponent<
+ RouteComponentProps<{}>
+> = ({ match }) => <Route path={match.url} component={SiteSettings} />;
+export default SiteSettingsSection;
diff --git a/saleor/static/dashboard-next/staff/index.tsx b/saleor/static/dashboard-next/staff/index.tsx
index 5abd150bed..d8b145a1fb 100644
--- a/saleor/static/dashboard-next/staff/index.tsx
+++ b/saleor/static/dashboard-next/staff/index.tsx
@@ -1,40 +1,40 @@
-// import { parse as parseQs } from "qs";
-// import * as React from "react";
-// import { Route, RouteComponentProps, Switch } from "react-router-dom";
+import { parse as parseQs } from "qs";
+import * as React from "react";
+import { Route, RouteComponentProps, Switch } from "react-router-dom";
-// import { WindowTitle } from "../components/WindowTitle";
-// import i18n from "../i18n";
-// import StaffDetailsComponent from "./views/StaffDetails";
-// import StaffListComponent, { StaffListQueryParams } from "./views/StaffList";
+import { WindowTitle } from "../components/WindowTitle";
+import i18n from "../i18n";
+import StaffDetailsComponent from "./views/StaffDetails";
+import StaffListComponent, { StaffListQueryParams } from "./views/StaffList";
-// const StaffList: React.StatelessComponent<RouteComponentProps<{}>> = ({
-// location
-// }) => {
-// const qs = parseQs(location.search.substr(1));
-// const params: StaffListQueryParams = {
-// after: qs.after,
-// before: qs.before
-// };
-// return <StaffListComponent params={params} />;
-// };
+const StaffList: React.StatelessComponent<RouteComponentProps<{}>> = ({
+ location
+}) => {
+ const qs = parseQs(location.search.substr(1));
+ const params: StaffListQueryParams = {
+ after: qs.after,
+ before: qs.before
+ };
+ return <StaffListComponent params={params} />;
+};
-// interface StaffDetailsRouteProps {
-// id: string;
-// }
-// const StaffDetails: React.StatelessComponent<
-// RouteComponentProps<StaffDetailsRouteProps>
-// > = ({ match }) => (
-// <StaffDetailsComponent id={decodeURIComponent(match.params.id)} />
-// );
+interface StaffDetailsRouteProps {
+ id: string;
+}
+const StaffDetails: React.StatelessComponent<
+ RouteComponentProps<StaffDetailsRouteProps>
+> = ({ match }) => (
+ <StaffDetailsComponent id={decodeURIComponent(match.params.id)} />
+);
-// const Component = ({ match }) => (
-// <>
-// <WindowTitle title={i18n.t("Staff")} />
-// <Switch>
-// <Route exact path={match.url} component={StaffList} />
-// <Route exact path={`${match.url}/:id/`} component={StaffDetails} />
-// </Switch>
-// </>
-// );
+const Component = ({ match }) => (
+ <>
+ <WindowTitle title={i18n.t("Staff")} />
+ <Switch>
+ <Route exact path={match.url} component={StaffList} />
+ <Route exact path={`${match.url}/:id/`} component={StaffDetails} />
+ </Switch>
+ </>
+);
-// export default Component;
+export default Component;
diff --git a/saleor/static/dashboard-next/staff/views/StaffDetails.tsx b/saleor/static/dashboard-next/staff/views/StaffDetails.tsx
index ffd6ac4eb2..90c2b99dc5 100644
--- a/saleor/static/dashboard-next/staff/views/StaffDetails.tsx
+++ b/saleor/static/dashboard-next/staff/views/StaffDetails.tsx
@@ -1,6 +1,5 @@
import * as React from "react";
-import { staffListUrl } from "..";
import Messages from "../../components/messages";
import Navigator from "../../components/Navigator";
import { WindowTitle } from "../../components/WindowTitle";
@@ -14,6 +13,7 @@ import {
import { TypedStaffMemberDetailsQuery } from "../queries";
import { StaffMemberDelete } from "../types/StaffMemberDelete";
import { StaffMemberUpdate } from "../types/StaffMemberUpdate";
+import { staffListUrl } from "../urls";
interface OrderListProps {
id: string;
diff --git a/saleor/static/dashboard-next/staff/views/StaffList.tsx b/saleor/static/dashboard-next/staff/views/StaffList.tsx
index 88bb434aaa..f79627894d 100644
--- a/saleor/static/dashboard-next/staff/views/StaffList.tsx
+++ b/saleor/static/dashboard-next/staff/views/StaffList.tsx
@@ -1,6 +1,5 @@
import * as React from "react";
-import { staffMemberDetailsUrl } from "..";
import Messages from "../../components/messages";
import Navigator from "../../components/Navigator";
import { createPaginationState, Paginator } from "../../components/Paginator";
@@ -11,6 +10,7 @@ import StaffListPage from "../components/StaffListPage";
import { TypedStaffMemberAddMutation } from "../mutations";
import { TypedStaffListQuery } from "../queries";
import { StaffMemberAdd } from "../types/StaffMemberAdd";
+import { staffMemberDetailsUrl } from "../urls";
export type StaffListQueryParams = Partial<{
after: string;