diff --git a/src/products/components/ProductStocks/ProductStocks.tsx b/src/products/components/ProductStocks/ProductStocks.tsx index 5a9e0a22b..1f36f6601 100644 --- a/src/products/components/ProductStocks/ProductStocks.tsx +++ b/src/products/components/ProductStocks/ProductStocks.tsx @@ -27,11 +27,7 @@ import { FormChange } from "@saleor/hooks/useForm"; import { FormsetAtomicData, FormsetChange } from "@saleor/hooks/useFormset"; import { renderCollection } from "@saleor/misc"; import { ICONBUTTON_SIZE } from "@saleor/theme"; -import { - getFieldError, - getFormErrors, - getProductErrorMessage -} from "@saleor/utils/errors"; +import { getFormErrors, getProductErrorMessage } from "@saleor/utils/errors"; import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; diff --git a/src/products/fixtures.ts b/src/products/fixtures.ts index ba6fad316..f8b198146 100644 --- a/src/products/fixtures.ts +++ b/src/products/fixtures.ts @@ -207,6 +207,7 @@ export const product: ( name: "Versatile", taxType: { __typename: "TaxType", + description: "standard", taxCode: "standard" }, variantAttributes: [ @@ -257,6 +258,7 @@ export const product: ( sku: "59661-34207", taxType: { __typename: "TaxType", + description: "standard", taxCode: "standard" }, thumbnail: { __typename: "Image" as "Image", url: placeholderImage }, diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 33ab804f4..3fb03fc7c 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -138015,6 +138015,122 @@ Ctrl + K" /> +
++ A product with this SKU already exists +
+ +- Generic form error + A product with this SKU already exists
diff --git a/src/storybook/stories/products/ProductCreatePage.tsx b/src/storybook/stories/products/ProductCreatePage.tsx index 789bcc42f..babd8504a 100644 --- a/src/storybook/stories/products/ProductCreatePage.tsx +++ b/src/storybook/stories/products/ProductCreatePage.tsx @@ -10,6 +10,7 @@ import ProductCreatePage, { import { product as productFixture } from "../../../products/fixtures"; import { productTypes } from "../../../productTypes/fixtures"; import Decorator from "../../Decorator"; +import { taxTypes } from "../taxes/fixtures"; const product = productFixture(""); @@ -34,6 +35,7 @@ storiesOf("Views / Products / Create product", module) onSubmit={() => undefined} saveButtonBarState="default" warehouses={warehouseList} + taxTypes={taxTypes} weightUnit="kg" /> )) @@ -56,6 +58,7 @@ storiesOf("Views / Products / Create product", module) onSubmit={() => undefined} saveButtonBarState="default" warehouses={undefined} + taxTypes={taxTypes} weightUnit="kg" /> )) @@ -84,6 +87,7 @@ storiesOf("Views / Products / Create product", module) onSubmit={() => undefined} saveButtonBarState="default" warehouses={warehouseList} + taxTypes={taxTypes} weightUnit="kg" /> )); diff --git a/src/storybook/stories/products/ProductUpdatePage.tsx b/src/storybook/stories/products/ProductUpdatePage.tsx index 7682f8369..e137d92ac 100644 --- a/src/storybook/stories/products/ProductUpdatePage.tsx +++ b/src/storybook/stories/products/ProductUpdatePage.tsx @@ -12,6 +12,7 @@ import { storiesOf } from "@storybook/react"; import React from "react"; import Decorator from "../../Decorator"; +import { taxTypes } from "../taxes/fixtures"; const product = productFixture(placeholderImage); @@ -40,6 +41,7 @@ const props: ProductUpdatePageProps = { placeholderImage, product, saveButtonBarState: "default", + taxTypes, variants: product.variants, warehouses: warehouseList }; diff --git a/src/storybook/stories/taxes/fixtures.ts b/src/storybook/stories/taxes/fixtures.ts index cb344a011..ca5ac8882 100644 --- a/src/storybook/stories/taxes/fixtures.ts +++ b/src/storybook/stories/taxes/fixtures.ts @@ -1,3 +1,5 @@ +import { TaxTypeFragment } from "@saleor/fragments/types/TaxTypeFragment"; + import { CountryList_shop_countries } from "../../../taxes/types/CountryList"; import { TaxRateType } from "../../../types/globalTypes"; @@ -2714,3 +2716,84 @@ export const countries: CountryList = [ vat: null } ].filter(country => country.vat); + +/* eslint-disable sort-keys */ +export const taxTypes: TaxTypeFragment[] = [ + { + description: "accommodation", + taxCode: "accommodation", + __typename: "TaxType" + }, + { + description: "admission to cultural events", + taxCode: "admission to cultural events", + __typename: "TaxType" + }, + { + description: "admission to entertainment events", + taxCode: "admission to entertainment events", + __typename: "TaxType" + }, + { + description: "admission to sporting events", + taxCode: "admission to sporting events", + __typename: "TaxType" + }, + { description: "advertising", taxCode: "advertising", __typename: "TaxType" }, + { + description: "agricultural supplies", + taxCode: "agricultural supplies", + __typename: "TaxType" + }, + { + description: "baby foodstuffs", + taxCode: "baby foodstuffs", + __typename: "TaxType" + }, + { description: "bikes", taxCode: "bikes", __typename: "TaxType" }, + { description: "books", taxCode: "books", __typename: "TaxType" }, + { + description: "childrens clothing", + taxCode: "childrens clothing", + __typename: "TaxType" + }, + { + description: "domestic fuel", + taxCode: "domestic fuel", + __typename: "TaxType" + }, + { + description: "domestic services", + taxCode: "domestic services", + __typename: "TaxType" + }, + { description: "e-books", taxCode: "e-books", __typename: "TaxType" }, + { description: "foodstuffs", taxCode: "foodstuffs", __typename: "TaxType" }, + { description: "hotels", taxCode: "hotels", __typename: "TaxType" }, + { description: "medical", taxCode: "medical", __typename: "TaxType" }, + { description: "newspapers", taxCode: "newspapers", __typename: "TaxType" }, + { + description: "passenger transport", + taxCode: "passenger transport", + __typename: "TaxType" + }, + { + description: "pharmaceuticals", + taxCode: "pharmaceuticals", + __typename: "TaxType" + }, + { + description: "property renovations", + taxCode: "property renovations", + __typename: "TaxType" + }, + { description: "restaurants", taxCode: "restaurants", __typename: "TaxType" }, + { + description: "social housing", + taxCode: "social housing", + __typename: "TaxType" + }, + { description: "standard", taxCode: "standard", __typename: "TaxType" }, + { description: "water", taxCode: "water", __typename: "TaxType" }, + { description: "wine", taxCode: "wine", __typename: "TaxType" } +];