Fix types
This commit is contained in:
parent
6bacb5fb3a
commit
bae3e461a7
11 changed files with 87 additions and 63 deletions
|
@ -493,6 +493,13 @@ type BulkProductError {
|
||||||
index: Int
|
index: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type BulkStockError {
|
||||||
|
field: String
|
||||||
|
message: String
|
||||||
|
code: ProductErrorCode!
|
||||||
|
index: Int
|
||||||
|
}
|
||||||
|
|
||||||
input CatalogueInput {
|
input CatalogueInput {
|
||||||
products: [ID]
|
products: [ID]
|
||||||
categories: [ID]
|
categories: [ID]
|
||||||
|
@ -2158,10 +2165,6 @@ type Mutation {
|
||||||
deleteWarehouse(id: ID!): WarehouseDelete
|
deleteWarehouse(id: ID!): WarehouseDelete
|
||||||
assignWarehouseShippingZone(id: ID!, shippingZoneIds: [ID!]!): WarehouseShippingZoneAssign
|
assignWarehouseShippingZone(id: ID!, shippingZoneIds: [ID!]!): WarehouseShippingZoneAssign
|
||||||
unassignWarehouseShippingZone(id: ID!, shippingZoneIds: [ID!]!): WarehouseShippingZoneUnassign
|
unassignWarehouseShippingZone(id: ID!, shippingZoneIds: [ID!]!): WarehouseShippingZoneUnassign
|
||||||
createStock(input: StockInput!): StockCreate
|
|
||||||
updateStock(id: ID!, input: StockInput!): StockUpdate
|
|
||||||
deleteStock(id: ID!): StockDelete
|
|
||||||
bulkDeleteStock(ids: [ID]!): StockBulkDelete
|
|
||||||
authorizationKeyAdd(input: AuthorizationKeyInput!, keyType: AuthorizationKeyType!): AuthorizationKeyAdd
|
authorizationKeyAdd(input: AuthorizationKeyInput!, keyType: AuthorizationKeyType!): AuthorizationKeyAdd
|
||||||
authorizationKeyDelete(keyType: AuthorizationKeyType!): AuthorizationKeyDelete
|
authorizationKeyDelete(keyType: AuthorizationKeyType!): AuthorizationKeyDelete
|
||||||
staffNotificationRecipientCreate(input: StaffNotificationRecipientInput!): StaffNotificationRecipientCreate
|
staffNotificationRecipientCreate(input: StaffNotificationRecipientInput!): StaffNotificationRecipientCreate
|
||||||
|
@ -2253,6 +2256,9 @@ type Mutation {
|
||||||
productVariantDelete(id: ID!): ProductVariantDelete
|
productVariantDelete(id: ID!): ProductVariantDelete
|
||||||
productVariantBulkCreate(product: ID!, variants: [ProductVariantBulkCreateInput]!): ProductVariantBulkCreate
|
productVariantBulkCreate(product: ID!, variants: [ProductVariantBulkCreateInput]!): ProductVariantBulkCreate
|
||||||
productVariantBulkDelete(ids: [ID]!): ProductVariantBulkDelete
|
productVariantBulkDelete(ids: [ID]!): ProductVariantBulkDelete
|
||||||
|
productVariantStocksCreate(stocks: [StockInput!]!, variantId: ID!): ProductVariantStocksCreate
|
||||||
|
productVariantStocksDelete(variantId: ID!, warehouseIds: [ID!]): ProductVariantStocksDelete
|
||||||
|
productVariantStocksUpdate(stocks: [StockInput!]!, variantId: ID!): ProductVariantStocksUpdate
|
||||||
productVariantUpdate(id: ID!, input: ProductVariantInput!): ProductVariantUpdate
|
productVariantUpdate(id: ID!, input: ProductVariantInput!): ProductVariantUpdate
|
||||||
productVariantTranslate(id: ID!, input: NameTranslationInput!, languageCode: LanguageCodeEnum!): ProductVariantTranslate
|
productVariantTranslate(id: ID!, input: NameTranslationInput!, languageCode: LanguageCodeEnum!): ProductVariantTranslate
|
||||||
productVariantUpdateMetadata(id: ID!, input: MetaInput!): ProductVariantUpdateMeta @deprecated(reason: "Will be removed in Saleor 2.11. Use the `UpdateMetadata` mutation instead.")
|
productVariantUpdateMetadata(id: ID!, input: MetaInput!): ProductVariantUpdateMeta @deprecated(reason: "Will be removed in Saleor 2.11. Use the `UpdateMetadata` mutation instead.")
|
||||||
|
@ -2444,8 +2450,8 @@ type Order implements Node & ObjectWithMetadata {
|
||||||
voucher: Voucher
|
voucher: Voucher
|
||||||
giftCards: [GiftCard]
|
giftCards: [GiftCard]
|
||||||
discount: Money
|
discount: Money
|
||||||
discountName: String!
|
discountName: String
|
||||||
translatedDiscountName: String!
|
translatedDiscountName: String
|
||||||
displayGrossPrices: Boolean!
|
displayGrossPrices: Boolean!
|
||||||
customerNote: String!
|
customerNote: String!
|
||||||
weight: Weight
|
weight: Weight
|
||||||
|
@ -2489,7 +2495,7 @@ type OrderAddNote {
|
||||||
}
|
}
|
||||||
|
|
||||||
input OrderAddNoteInput {
|
input OrderAddNoteInput {
|
||||||
message: String
|
message: String!
|
||||||
}
|
}
|
||||||
|
|
||||||
type OrderBulkCancel {
|
type OrderBulkCancel {
|
||||||
|
@ -3218,6 +3224,7 @@ input ProductCreateInput {
|
||||||
quantity: Int
|
quantity: Int
|
||||||
trackInventory: Boolean
|
trackInventory: Boolean
|
||||||
productType: ID!
|
productType: ID!
|
||||||
|
stocks: [StockInput!]
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProductDelete {
|
type ProductDelete {
|
||||||
|
@ -3255,6 +3262,7 @@ input ProductFilterInput {
|
||||||
attributes: [AttributeInput]
|
attributes: [AttributeInput]
|
||||||
stockAvailability: StockAvailability
|
stockAvailability: StockAvailability
|
||||||
productType: ID
|
productType: ID
|
||||||
|
stocks: ProductStockFilterInput
|
||||||
search: String
|
search: String
|
||||||
minimalPrice: PriceRangeInput
|
minimalPrice: PriceRangeInput
|
||||||
productTypes: [ID]
|
productTypes: [ID]
|
||||||
|
@ -3355,6 +3363,11 @@ type ProductPricingInfo {
|
||||||
priceRangeLocalCurrency: TaxedMoneyRange
|
priceRangeLocalCurrency: TaxedMoneyRange
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input ProductStockFilterInput {
|
||||||
|
warehouseIds: [ID!]
|
||||||
|
quantity: IntRangeInput
|
||||||
|
}
|
||||||
|
|
||||||
type ProductTranslatableContent implements Node {
|
type ProductTranslatableContent implements Node {
|
||||||
id: ID!
|
id: ID!
|
||||||
seoTitle: String
|
seoTitle: String
|
||||||
|
@ -3549,7 +3562,7 @@ type ProductVariant implements Node & ObjectWithMetadata {
|
||||||
images: [ProductImage]
|
images: [ProductImage]
|
||||||
translation(languageCode: LanguageCodeEnum!): ProductVariantTranslation
|
translation(languageCode: LanguageCodeEnum!): ProductVariantTranslation
|
||||||
digitalContent: DigitalContent
|
digitalContent: DigitalContent
|
||||||
stock(country: String): [Stock]
|
stocks(countryCode: CountryCode): [Stock]
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProductVariantBulkCreate {
|
type ProductVariantBulkCreate {
|
||||||
|
@ -3613,6 +3626,7 @@ input ProductVariantCreateInput {
|
||||||
trackInventory: Boolean
|
trackInventory: Boolean
|
||||||
weight: WeightScalar
|
weight: WeightScalar
|
||||||
product: ID!
|
product: ID!
|
||||||
|
stocks: [StockInput!]
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProductVariantDelete {
|
type ProductVariantDelete {
|
||||||
|
@ -3631,6 +3645,24 @@ input ProductVariantInput {
|
||||||
weight: WeightScalar
|
weight: WeightScalar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ProductVariantStocksCreate {
|
||||||
|
errors: [Error!]!
|
||||||
|
productVariant: ProductVariant
|
||||||
|
bulkStockErrors: [BulkStockError!]!
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProductVariantStocksDelete {
|
||||||
|
errors: [Error!]!
|
||||||
|
productVariant: ProductVariant
|
||||||
|
stockErrors: [StockError!]!
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProductVariantStocksUpdate {
|
||||||
|
errors: [Error!]!
|
||||||
|
productVariant: ProductVariant
|
||||||
|
bulkStockErrors: [BulkStockError!]!
|
||||||
|
}
|
||||||
|
|
||||||
type ProductVariantTranslatableContent implements Node {
|
type ProductVariantTranslatableContent implements Node {
|
||||||
id: ID!
|
id: ID!
|
||||||
name: String!
|
name: String!
|
||||||
|
@ -4341,12 +4373,6 @@ enum StockAvailability {
|
||||||
OUT_OF_STOCK
|
OUT_OF_STOCK
|
||||||
}
|
}
|
||||||
|
|
||||||
type StockBulkDelete {
|
|
||||||
errors: [Error!]!
|
|
||||||
count: Int!
|
|
||||||
stockError: [StockError!]!
|
|
||||||
}
|
|
||||||
|
|
||||||
type StockCountableConnection {
|
type StockCountableConnection {
|
||||||
pageInfo: PageInfo!
|
pageInfo: PageInfo!
|
||||||
edges: [StockCountableEdge!]!
|
edges: [StockCountableEdge!]!
|
||||||
|
@ -4358,18 +4384,13 @@ type StockCountableEdge {
|
||||||
cursor: String!
|
cursor: String!
|
||||||
}
|
}
|
||||||
|
|
||||||
type StockCreate {
|
type StockError {
|
||||||
errors: [Error!]!
|
field: String
|
||||||
stockErrors: [StockError!]!
|
message: String
|
||||||
stock: Stock
|
code: StockErrorCode!
|
||||||
}
|
}
|
||||||
|
|
||||||
type StockDelete {
|
enum StockErrorCode {
|
||||||
errors: [Error!]!
|
|
||||||
stock: Stock
|
|
||||||
}
|
|
||||||
|
|
||||||
enum StockErorrCode {
|
|
||||||
ALREADY_EXISTS
|
ALREADY_EXISTS
|
||||||
GRAPHQL_ERROR
|
GRAPHQL_ERROR
|
||||||
INVALID
|
INVALID
|
||||||
|
@ -4378,12 +4399,6 @@ enum StockErorrCode {
|
||||||
UNIQUE
|
UNIQUE
|
||||||
}
|
}
|
||||||
|
|
||||||
type StockError {
|
|
||||||
field: String
|
|
||||||
message: String
|
|
||||||
code: StockErorrCode!
|
|
||||||
}
|
|
||||||
|
|
||||||
input StockFilterInput {
|
input StockFilterInput {
|
||||||
quantity: Float
|
quantity: Float
|
||||||
quantityAllocated: Float
|
quantityAllocated: Float
|
||||||
|
@ -4391,17 +4406,10 @@ input StockFilterInput {
|
||||||
}
|
}
|
||||||
|
|
||||||
input StockInput {
|
input StockInput {
|
||||||
productVariant: ID!
|
|
||||||
warehouse: ID!
|
warehouse: ID!
|
||||||
quantity: Int
|
quantity: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
type StockUpdate {
|
|
||||||
errors: [Error!]!
|
|
||||||
stockError: [StockError!]!
|
|
||||||
stock: Stock
|
|
||||||
}
|
|
||||||
|
|
||||||
enum TaxRateType {
|
enum TaxRateType {
|
||||||
ACCOMMODATION
|
ACCOMMODATION
|
||||||
ADMISSION_TO_CULTURAL_EVENTS
|
ADMISSION_TO_CULTURAL_EVENTS
|
||||||
|
|
|
@ -8,7 +8,6 @@ import { useIntl } from "react-intl";
|
||||||
import CardTitle from "@saleor/components/CardTitle";
|
import CardTitle from "@saleor/components/CardTitle";
|
||||||
import { ProductErrorFragment } from "@saleor/attributes/types/ProductErrorFragment";
|
import { ProductErrorFragment } from "@saleor/attributes/types/ProductErrorFragment";
|
||||||
import { getFormErrors, getProductErrorMessage } from "@saleor/utils/errors";
|
import { getFormErrors, getProductErrorMessage } from "@saleor/utils/errors";
|
||||||
import { maybe } from "../../../misc";
|
|
||||||
import { ProductDetails_product } from "../../types/ProductDetails";
|
import { ProductDetails_product } from "../../types/ProductDetails";
|
||||||
|
|
||||||
const useStyles = makeStyles(
|
const useStyles = makeStyles(
|
||||||
|
|
|
@ -13,7 +13,7 @@ import SingleAutocompleteSelectField, {
|
||||||
import Skeleton from "@saleor/components/Skeleton";
|
import Skeleton from "@saleor/components/Skeleton";
|
||||||
import { FormsetAtomicData, FormsetChange } from "@saleor/hooks/useFormset";
|
import { FormsetAtomicData, FormsetChange } from "@saleor/hooks/useFormset";
|
||||||
import { commonMessages } from "@saleor/intl";
|
import { commonMessages } from "@saleor/intl";
|
||||||
import { VariantCreate_productVariantCreate_productErrors } from "@saleor/products/types/VariantCreate";
|
import { VariantCreate_productVariantCreate_errors } from "@saleor/products/types/VariantCreate";
|
||||||
import { ProductErrorCode } from "@saleor/types/globalTypes";
|
import { ProductErrorCode } from "@saleor/types/globalTypes";
|
||||||
import { ProductVariant_attributes_attribute_values } from "../../types/ProductVariant";
|
import { ProductVariant_attributes_attribute_values } from "../../types/ProductVariant";
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ export type VariantAttributeInput = FormsetAtomicData<
|
||||||
interface ProductVariantAttributesProps {
|
interface ProductVariantAttributesProps {
|
||||||
attributes: VariantAttributeInput[];
|
attributes: VariantAttributeInput[];
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
errors: VariantCreate_productVariantCreate_productErrors[];
|
errors: VariantCreate_productVariantCreate_errors[];
|
||||||
onChange: FormsetChange<VariantAttributeInputData>;
|
onChange: FormsetChange<VariantAttributeInputData>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { storiesOf } from "@storybook/react";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import { attributes } from "@saleor/attributes/fixtures";
|
import { attributes } from "@saleor/attributes/fixtures";
|
||||||
import { ProductVariantBulkCreate_productVariantBulkCreate_bulkProductErrors } from "@saleor/products/types/ProductVariantBulkCreate";
|
import { ProductVariantBulkCreate_productVariantBulkCreate_errors } from "@saleor/products/types/ProductVariantBulkCreate";
|
||||||
import { ProductErrorCode } from "@saleor/types/globalTypes";
|
import { ProductErrorCode } from "@saleor/types/globalTypes";
|
||||||
import Decorator from "../../../storybook/Decorator";
|
import Decorator from "../../../storybook/Decorator";
|
||||||
import { createVariants } from "./createVariants";
|
import { createVariants } from "./createVariants";
|
||||||
|
@ -43,13 +43,12 @@ const dataAttributes = selectedAttributes.map(attribute => ({
|
||||||
.filter((_, valueIndex) => valueIndex % 2 !== 1)
|
.filter((_, valueIndex) => valueIndex % 2 !== 1)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const errors: ProductVariantBulkCreate_productVariantBulkCreate_bulkProductErrors[] = [
|
const errors: ProductVariantBulkCreate_productVariantBulkCreate_errors[] = [
|
||||||
{
|
{
|
||||||
__typename: "BulkProductError",
|
__typename: "BulkProductError",
|
||||||
code: ProductErrorCode.UNIQUE,
|
code: ProductErrorCode.UNIQUE,
|
||||||
field: "sku",
|
field: "sku",
|
||||||
index: 3,
|
index: 3
|
||||||
message: "Duplicated SKU."
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { makeStyles } from "@material-ui/core/styles";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import { ProductDetails_product_productType_variantAttributes } from "@saleor/products/types/ProductDetails";
|
import { ProductDetails_product_productType_variantAttributes } from "@saleor/products/types/ProductDetails";
|
||||||
import { ProductVariantBulkCreate_productVariantBulkCreate_bulkProductErrors } from "@saleor/products/types/ProductVariantBulkCreate";
|
import { ProductVariantBulkCreate_productVariantBulkCreate_errors } from "@saleor/products/types/ProductVariantBulkCreate";
|
||||||
import { isSelected } from "@saleor/utils/lists";
|
import { isSelected } from "@saleor/utils/lists";
|
||||||
import { ProductVariantCreateFormData } from "./form";
|
import { ProductVariantCreateFormData } from "./form";
|
||||||
import ProductVariantCreatePrices from "./ProductVariantCreatePrices";
|
import ProductVariantCreatePrices from "./ProductVariantCreatePrices";
|
||||||
|
@ -33,14 +33,12 @@ export interface ProductVariantCreateContentProps {
|
||||||
currencySymbol: string;
|
currencySymbol: string;
|
||||||
data: ProductVariantCreateFormData;
|
data: ProductVariantCreateFormData;
|
||||||
dispatchFormDataAction: React.Dispatch<ProductVariantCreateReducerAction>;
|
dispatchFormDataAction: React.Dispatch<ProductVariantCreateReducerAction>;
|
||||||
errors: ProductVariantBulkCreate_productVariantBulkCreate_bulkProductErrors[];
|
errors: ProductVariantBulkCreate_productVariantBulkCreate_errors[];
|
||||||
step: ProductVariantCreateStep;
|
step: ProductVariantCreateStep;
|
||||||
onStepClick: (step: ProductVariantCreateStep) => void;
|
onStepClick: (step: ProductVariantCreateStep) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProductVariantCreateContent: React.FC<
|
const ProductVariantCreateContent: React.FC<ProductVariantCreateContentProps> = props => {
|
||||||
ProductVariantCreateContentProps
|
|
||||||
> = props => {
|
|
||||||
const {
|
const {
|
||||||
attributes,
|
attributes,
|
||||||
currencySymbol,
|
currencySymbol,
|
||||||
|
|
|
@ -12,7 +12,7 @@ import useFormset, {
|
||||||
FormsetChange,
|
FormsetChange,
|
||||||
FormsetData
|
FormsetData
|
||||||
} from "@saleor/hooks/useFormset";
|
} from "@saleor/hooks/useFormset";
|
||||||
import { VariantUpdate_productVariantUpdate_productErrors } from "@saleor/products/types/VariantUpdate";
|
import { VariantUpdate_productVariantUpdate_errors } from "@saleor/products/types/VariantUpdate";
|
||||||
import { getAttributeInputFromVariant } from "@saleor/products/utils/data";
|
import { getAttributeInputFromVariant } from "@saleor/products/utils/data";
|
||||||
import { maybe } from "../../../misc";
|
import { maybe } from "../../../misc";
|
||||||
import { ProductVariant } from "../../types/ProductVariant";
|
import { ProductVariant } from "../../types/ProductVariant";
|
||||||
|
@ -39,7 +39,7 @@ export interface ProductVariantPageSubmitData
|
||||||
|
|
||||||
interface ProductVariantPageProps {
|
interface ProductVariantPageProps {
|
||||||
variant?: ProductVariant;
|
variant?: ProductVariant;
|
||||||
errors: VariantUpdate_productVariantUpdate_productErrors[];
|
errors: VariantUpdate_productVariantUpdate_errors[];
|
||||||
saveButtonBarState: ConfirmButtonTransitionState;
|
saveButtonBarState: ConfirmButtonTransitionState;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
placeholderImage?: string;
|
placeholderImage?: string;
|
||||||
|
|
|
@ -16,7 +16,7 @@ import ProductVariantOperations from "../containers/ProductVariantOperations";
|
||||||
import { TypedProductVariantQuery } from "../queries";
|
import { TypedProductVariantQuery } from "../queries";
|
||||||
import {
|
import {
|
||||||
VariantUpdate,
|
VariantUpdate,
|
||||||
VariantUpdate_productVariantUpdate_productErrors
|
VariantUpdate_productVariantUpdate_errors
|
||||||
} from "../types/VariantUpdate";
|
} from "../types/VariantUpdate";
|
||||||
import {
|
import {
|
||||||
productUrl,
|
productUrl,
|
||||||
|
@ -40,7 +40,7 @@ export const ProductVariant: React.FC<ProductUpdateProps> = ({
|
||||||
const notify = useNotifier();
|
const notify = useNotifier();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [errors, setErrors] = useState<
|
const [errors, setErrors] = useState<
|
||||||
VariantUpdate_productVariantUpdate_productErrors[]
|
VariantUpdate_productVariantUpdate_errors[]
|
||||||
>([]);
|
>([]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setErrors([]);
|
setErrors([]);
|
||||||
|
@ -66,10 +66,10 @@ export const ProductVariant: React.FC<ProductUpdateProps> = ({
|
||||||
navigate(productUrl(productId));
|
navigate(productUrl(productId));
|
||||||
};
|
};
|
||||||
const handleUpdate = (data: VariantUpdate) => {
|
const handleUpdate = (data: VariantUpdate) => {
|
||||||
if (!data.productVariantUpdate.productErrors.length) {
|
if (data.productVariantUpdate.errors.length === 0) {
|
||||||
notify({ text: intl.formatMessage(commonMessages.savedChanges) });
|
notify({ text: intl.formatMessage(commonMessages.savedChanges) });
|
||||||
} else {
|
} else {
|
||||||
setErrors(data.productVariantUpdate.productErrors);
|
setErrors(data.productVariantUpdate.errors);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import { ProductErrorFragment } from "@saleor/attributes/types/ProductErrorFragment";
|
|
||||||
|
|
||||||
export function formError<TErrorPayload>(
|
export function formError<TErrorPayload>(
|
||||||
field: string,
|
field: string,
|
||||||
opts?: Partial<Omit<TErrorPayload, "field" | "message">>
|
opts?: Partial<Omit<TErrorPayload, "field" | "message">>
|
||||||
|
|
|
@ -5,8 +5,10 @@ import AttributePage, {
|
||||||
AttributePageProps
|
AttributePageProps
|
||||||
} from "@saleor/attributes/components/AttributePage";
|
} from "@saleor/attributes/components/AttributePage";
|
||||||
import { attribute } from "@saleor/attributes/fixtures";
|
import { attribute } from "@saleor/attributes/fixtures";
|
||||||
import { formError } from "@saleor/storybook/misc";
|
import {
|
||||||
import { AttributeInputTypeEnum } from "@saleor/types/globalTypes";
|
AttributeInputTypeEnum,
|
||||||
|
ProductErrorCode
|
||||||
|
} from "@saleor/types/globalTypes";
|
||||||
import Decorator from "../../Decorator";
|
import Decorator from "../../Decorator";
|
||||||
|
|
||||||
const props: AttributePageProps = {
|
const props: AttributePageProps = {
|
||||||
|
@ -39,7 +41,11 @@ storiesOf("Views / Attributes / Attribute details", module)
|
||||||
.add("form errors", () => (
|
.add("form errors", () => (
|
||||||
<AttributePage
|
<AttributePage
|
||||||
{...props}
|
{...props}
|
||||||
errors={["name", "slug", "storefrontSearchPosition"].map(formError)}
|
errors={["name", "slug", "storefrontSearchPosition"].map(field => ({
|
||||||
|
__typename: "ProductError",
|
||||||
|
code: ProductErrorCode.INVALID,
|
||||||
|
field
|
||||||
|
}))}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
.add("multiple select input", () => (
|
.add("multiple select input", () => (
|
||||||
|
|
|
@ -2,13 +2,13 @@ import { storiesOf } from "@storybook/react";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import { fetchMoreProps } from "@saleor/fixtures";
|
import { fetchMoreProps } from "@saleor/fixtures";
|
||||||
|
import { ProductErrorCode } from "@saleor/types/globalTypes";
|
||||||
import ProductCreatePage, {
|
import ProductCreatePage, {
|
||||||
ProductCreatePageSubmitData
|
ProductCreatePageSubmitData
|
||||||
} from "../../../products/components/ProductCreatePage";
|
} from "../../../products/components/ProductCreatePage";
|
||||||
import { product as productFixture } from "../../../products/fixtures";
|
import { product as productFixture } from "../../../products/fixtures";
|
||||||
import { productTypes } from "../../../productTypes/fixtures";
|
import { productTypes } from "../../../productTypes/fixtures";
|
||||||
import Decorator from "../../Decorator";
|
import Decorator from "../../Decorator";
|
||||||
import { formError } from "../../misc";
|
|
||||||
|
|
||||||
const product = productFixture("");
|
const product = productFixture("");
|
||||||
|
|
||||||
|
@ -60,7 +60,11 @@ storiesOf("Views / Products / Create product", module)
|
||||||
disabled={false}
|
disabled={false}
|
||||||
errors={(["name", "productType", "category", "sku"] as Array<
|
errors={(["name", "productType", "category", "sku"] as Array<
|
||||||
keyof ProductCreatePageSubmitData
|
keyof ProductCreatePageSubmitData
|
||||||
>).map(formError)}
|
>).map(field => ({
|
||||||
|
__typename: "ProductError",
|
||||||
|
code: ProductErrorCode.INVALID,
|
||||||
|
field
|
||||||
|
}))}
|
||||||
header="Add product"
|
header="Add product"
|
||||||
collections={product.collections}
|
collections={product.collections}
|
||||||
fetchCategories={() => undefined}
|
fetchCategories={() => undefined}
|
||||||
|
|
|
@ -929,7 +929,7 @@ export interface NameTranslationInput {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OrderAddNoteInput {
|
export interface OrderAddNoteInput {
|
||||||
message?: string | null;
|
message: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OrderDraftFilterInput {
|
export interface OrderDraftFilterInput {
|
||||||
|
@ -1026,6 +1026,7 @@ export interface ProductFilterInput {
|
||||||
attributes?: (AttributeInput | null)[] | null;
|
attributes?: (AttributeInput | null)[] | null;
|
||||||
stockAvailability?: StockAvailability | null;
|
stockAvailability?: StockAvailability | null;
|
||||||
productType?: string | null;
|
productType?: string | null;
|
||||||
|
stocks?: ProductStockFilterInput | null;
|
||||||
search?: string | null;
|
search?: string | null;
|
||||||
minimalPrice?: PriceRangeInput | null;
|
minimalPrice?: PriceRangeInput | null;
|
||||||
productTypes?: (string | null)[] | null;
|
productTypes?: (string | null)[] | null;
|
||||||
|
@ -1037,6 +1038,11 @@ export interface ProductOrder {
|
||||||
field?: ProductOrderField | null;
|
field?: ProductOrderField | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProductStockFilterInput {
|
||||||
|
warehouseIds?: string[] | null;
|
||||||
|
quantity?: IntRangeInput | null;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProductTypeFilterInput {
|
export interface ProductTypeFilterInput {
|
||||||
search?: string | null;
|
search?: string | null;
|
||||||
configurable?: ProductTypeConfigurable | null;
|
configurable?: ProductTypeConfigurable | null;
|
||||||
|
@ -1080,6 +1086,7 @@ export interface ProductVariantCreateInput {
|
||||||
trackInventory?: boolean | null;
|
trackInventory?: boolean | null;
|
||||||
weight?: any | null;
|
weight?: any | null;
|
||||||
product: string;
|
product: string;
|
||||||
|
stocks?: StockInput[] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductVariantInput {
|
export interface ProductVariantInput {
|
||||||
|
@ -1208,6 +1215,11 @@ export interface StaffUserInput {
|
||||||
search?: string | null;
|
search?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface StockInput {
|
||||||
|
warehouse: string;
|
||||||
|
quantity?: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
export interface TranslationInput {
|
export interface TranslationInput {
|
||||||
seoTitle?: string | null;
|
seoTitle?: string | null;
|
||||||
seoDescription?: string | null;
|
seoDescription?: string | null;
|
||||||
|
|
Loading…
Reference in a new issue