Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add variant create view
dominik-zeglen54cbdf8d757e
diff --git a/saleor/static/dashboard-next/gql-types.ts b/saleor/static/dashboard-next/gql-types.tsindex d29f12c302..b5643858b7 100644--- a/saleor/static/dashboard-next/gql-types.ts+++ b/saleor/static/dashboard-next/gql-types.ts@@ -3,10 +3,10 @@export interface AttributeValueInput {// Slug of an attribute.- slug: string,+ slug: string;// Value of an attribute.- value: string,-};+ value: string;+}export interface TokenAuthMutationVariables {email: string,@@ -64,1292 +64,1479 @@ export interface VerifyTokenMutation {};export interface CategoryDeleteMutationVariables {- id: string,-};+ id: string;+}export interface CategoryDeleteMutation {- categoryDelete: {+ categoryDelete: {// List of errors that occurred executing the mutation.- errors: Array< {+ errors: Array<{// Name of a field that caused the error. A value of// `null` indicates that the error isn't associated with a particular// field.- field: string | null,+ field: string | null;// The error message.- message: string | null,- } | null > | null,- } | null,-};+ message: string | null;+ } | null> | null;+ } | null;+}export interface CategoryCreateMutationVariables {- name?: string | null,- description?: string | null,- parent?: string | null,-};+ name?: string | null;+ description?: string | null;+ parent?: string | null;+}export interface CategoryCreateMutation {- categoryCreate: {+ categoryCreate: {// List of errors that occurred executing the mutation.- errors: Array< {+ errors: Array<{// Name of a field that caused the error. A value of// `null` indicates that the error isn't associated with a particular// field.- field: string | null,+ field: string | null;// The error message.- message: string | null,- } | null > | null,- category: {+ message: string | null;+ } | null> | null;+ category: {// The ID of the object.- id: string,- name: string,- description: string,- parent: {+ id: string;+ name: string;+ description: string;+ parent: {// The ID of the object.- id: string,- } | null,- } | null,- } | null,-};+ id: string;+ } | null;+ } | null;+ } | null;+}export interface CategoryUpdateMutationVariables {- id: string,- name?: string | null,- description?: string | null,-};+ id: string;+ name?: string | null;+ description?: string | null;+}export interface CategoryUpdateMutation {- categoryUpdate: {+ categoryUpdate: {// List of errors that occurred executing the mutation.- errors: Array< {+ errors: Array<{// Name of a field that caused the error. A value of// `null` indicates that the error isn't associated with a particular// field.- field: string | null,+ field: string | null;// The error message.- message: string | null,- } | null > | null,- category: {+ message: string | null;+ } | null> | null;+ category: {// The ID of the object.- id: string,- name: string,- description: string,- parent: {+ id: string;+ name: string;+ description: string;+ parent: {// The ID of the object.- id: string,- } | null,- } | null,- } | null,-};+ id: string;+ } | null;+ } | null;+ } | null;+}export interface CategoryDetailsQueryVariables {- id: string,-};+ id: string;+}export interface CategoryDetailsQuery {// Lookup a category by ID.- category: {+ category: {// The ID of the object.- id: string,- name: string,- description: string,- parent: {+ id: string;+ name: string;+ description: string;+ parent: {// The ID of the object.- id: string,- } | null,- } | null,-};+ id: string;+ } | null;+ } | null;+}export interface RootCategoryChildrenQuery {// List of the shop's categories.- categories: {- edges: Array< {+ categories: {+ edges: Array<{// A cursor for use in pagination- cursor: string,+ cursor: string;// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,- },- } >,- } | null,-};+ id: string;+ name: string;+ };+ }>;+ } | null;+}export interface CategoryPropertiesQueryVariables {- id: string,- first?: number | null,- after?: string | null,- last?: number | null,- before?: string | null,-};+ id: string;+ first?: number | null;+ after?: string | null;+ last?: number | null;+ before?: string | null;+}export interface CategoryPropertiesQuery {// Lookup a category by ID.- category: {+ category: {// The ID of the object.- id: string,- name: string,- description: string,- parent: {+ id: string;+ name: string;+ description: string;+ parent: {// The ID of the object.- id: string,- } | null,+ id: string;+ } | null;// List of children of the category.- children: {- edges: Array< {+ children: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,- },- } >,- } | null,+ id: string;+ name: string;+ };+ }>;+ } | null;// List of products in the category.- products: {+ products: {// A total count of items in the collection- totalCount: number | null,- pageInfo: {+ totalCount: number | null;+ pageInfo: {// When paginating forwards, the cursor to continue.- endCursor: string | null,+ endCursor: string | null;// When paginating forwards, are there more items?- hasNextPage: boolean,+ hasNextPage: boolean;// When paginating backwards, are there more items?- hasPreviousPage: boolean,+ hasPreviousPage: boolean;// When paginating backwards, the cursor to continue.- startCursor: string | null,- },- edges: Array< {+ startCursor: string | null;+ };+ edges: Array<{// A cursor for use in pagination- cursor: string,+ cursor: string;// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,+ id: string;+ name: string;// The URL of a main thumbnail for a product.- thumbnailUrl: string | null,- productType: {+ thumbnailUrl: string | null;+ productType: {// The ID of the object.- id: string,- name: string,- },- },- } >,- } | null,- } | null,-};+ id: string;+ name: string;+ };+ };+ }>;+ } | null;+ } | null;+}export interface PageDeleteMutationVariables {- id: string,-};+ id: string;+}export interface PageDeleteMutation {- pageDelete: {+ pageDelete: {// List of errors that occurred executing the mutation.- errors: Array< {+ errors: Array<{// Name of a field that caused the error. A value of// `null` indicates that the error isn't associated with a particular// field.- field: string | null,+ field: string | null;// The error message.- message: string | null,- } | null > | null,- } | null,-};+ message: string | null;+ } | null> | null;+ } | null;+}export interface PageUpdateMutationVariables {- id: string,- title: string,- content: string,- slug: string,- isVisible: boolean,- availableOn?: string | null,-};+ id: string;+ title: string;+ content: string;+ slug: string;+ isVisible: boolean;+ availableOn?: string | null;+}export interface PageUpdateMutation {- pageUpdate: {- page: {+ pageUpdate: {+ page: {// The ID of the object.- id: string,- slug: string,- title: string,- content: string,- isVisible: boolean,- availableOn: string | null,- } | null,+ id: string;+ slug: string;+ title: string;+ content: string;+ isVisible: boolean;+ availableOn: string | null;+ } | null;// List of errors that occurred executing the mutation.- errors: Array< {+ errors: Array<{// Name of a field that caused the error. A value of// `null` indicates that the error isn't associated with a particular// field.- field: string | null,+ field: string | null;// The error message.- message: string | null,- } | null > | null,- } | null,-};+ message: string | null;+ } | null> | null;+ } | null;+}export interface PageCreateMutationVariables {- title: string,- content: string,- slug: string,- isVisible: boolean,- availableOn?: string | null,-};+ title: string;+ content: string;+ slug: string;+ isVisible: boolean;+ availableOn?: string | null;+}export interface PageCreateMutation {- pageCreate: {- page: {+ pageCreate: {+ page: {// The ID of the object.- id: string,- slug: string,- title: string,- content: string,- isVisible: boolean,- availableOn: string | null,- created: string,- } | null,+ id: string;+ slug: string;+ title: string;+ content: string;+ isVisible: boolean;+ availableOn: string | null;+ created: string;+ } | null;// List of errors that occurred executing the mutation.- errors: Array< {+ errors: Array<{// Name of a field that caused the error. A value of// `null` indicates that the error isn't associated with a particular// field.- field: string | null,+ field: string | null;// The error message.- message: string | null,- } | null > | null,- } | null,-};+ message: string | null;+ } | null> | null;+ } | null;+}export interface PageListQueryVariables {- first?: number | null,- after?: string | null,- last?: number | null,- before?: string | null,-};+ first?: number | null;+ after?: string | null;+ last?: number | null;+ before?: string | null;+}export interface PageListQuery {// List of the shop's pages.- pages: {- edges: Array< {+ pages: {+ edges: Array<{// A cursor for use in pagination- cursor: string,+ cursor: string;// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- slug: string,- title: string,- isVisible: boolean,- },- } >,- pageInfo: {+ id: string;+ slug: string;+ title: string;+ isVisible: boolean;+ };+ }>;+ pageInfo: {// When paginating backwards, are there more items?- hasPreviousPage: boolean,+ hasPreviousPage: boolean;// When paginating forwards, are there more items?- hasNextPage: boolean,+ hasNextPage: boolean;// When paginating backwards, the cursor to continue.- startCursor: string | null,+ startCursor: string | null;// When paginating forwards, the cursor to continue.- endCursor: string | null,- },- } | null,-};+ endCursor: string | null;+ };+ } | null;+}export interface PageDetailsQueryVariables {- id: string,-};+ id: string;+}export interface PageDetailsQuery {// Lookup a page by ID or by slug.- page: {+ page: {// The ID of the object.- id: string,- slug: string,- title: string,- content: string,- created: string,- isVisible: boolean,- availableOn: string | null,- } | null,-};+ id: string;+ slug: string;+ title: string;+ content: string;+ created: string;+ isVisible: boolean;+ availableOn: string | null;+ } | null;+}export interface ProductImageCreateMutationVariables {- product: string,- image: string,- alt?: string | null,-};+ product: string;+ image: string;+ alt?: string | null;+}export interface ProductImageCreateMutation {- productImageCreate: {+ productImageCreate: {// List of errors that occurred executing the mutation.- errors: Array< {+ errors: Array<{// Name of a field that caused the error. A value of// `null` indicates that the error isn't associated with a particular// field.- field: string | null,+ field: string | null;// The error message.- message: string | null,- } | null > | null,- productImage: {+ message: string | null;+ } | null> | null;+ productImage: {// The ID of the object.- id: string,- sortOrder: number,- image: string,- alt: string,- url: string,- } | null,- } | null,-};+ id: string;+ sortOrder: number;+ image: string;+ alt: string;+ url: string;+ } | null;+ } | null;+}export interface ProductDeleteMutationVariables {- id: string,-};+ id: string;+}export interface ProductDeleteMutation {- productDelete: {+ productDelete: {// List of errors that occurred executing the mutation.- errors: Array< {+ errors: Array<{// Name of a field that caused the error. A value of// `null` indicates that the error isn't associated with a particular// field.- field: string | null,+ field: string | null;// The error message.- message: string | null,- } | null > | null,- product: {+ message: string | null;+ } | null> | null;+ product: {// The ID of the object.- id: string,- } | null,- } | null,-};+ id: string;+ } | null;+ } | null;+}export interface ProductImageReorderMutationVariables {- productId: string,- imagesIds: Array< string | null >,-};+ productId: string;+ imagesIds: Array<string | null>;+}export interface ProductImageReorderMutation {- productImageReorder: {+ productImageReorder: {// List of errors that occurred executing the mutation.- errors: Array< {+ errors: Array<{// Name of a field that caused the error. A value of// `null` indicates that the error isn't associated with a particular// field.- field: string | null,+ field: string | null;// The error message.- message: string | null,- } | null > | null,+ message: string | null;+ } | null> | null;// Product image which sort order will be altered.- productImages: Array< {+ productImages: Array<{// The ID of the object.- id: string,- alt: string,- sortOrder: number,- url: string,- } | null > | null,- } | null,-};+ id: string;+ alt: string;+ sortOrder: number;+ url: string;+ } | null> | null;+ } | null;+}export interface ProductUpdateMutationVariables {- id: string,- attributes?: Array< AttributeValueInput | null > | null,- availableOn?: string | null,- category?: string | null,- chargeTaxes: boolean,- collections?: Array< string | null > | null,- description?: string | null,- isPublished: boolean,- isFeatured: boolean,- name?: string | null,- price?: string | null,-};+ id: string;+ attributes?: Array<AttributeValueInput | null> | null;+ availableOn?: string | null;+ category?: string | null;+ chargeTaxes: boolean;+ collections?: Array<string | null> | null;+ description?: string | null;+ isPublished: boolean;+ isFeatured: boolean;+ name?: string | null;+ price?: string | null;+}export interface ProductUpdateMutation {- productUpdate: {+ productUpdate: {// List of errors that occurred executing the mutation.- errors: Array< {+ errors: Array<{// Name of a field that caused the error. A value of// `null` indicates that the error isn't associated with a particular// field.- field: string | null,+ field: string | null;// The error message.- message: string | null,- } | null > | null,- product: {+ message: string | null;+ } | null> | null;+ product: {// The ID of the object.- id: string,- name: string,- description: string,- seoTitle: string | null,- seoDescription: string | null,- category: {+ id: string;+ name: string;+ description: string;+ seoTitle: string | null;+ seoDescription: string | null;+ category: {// The ID of the object.- id: string,- name: string,- },- collections: {- edges: Array< {+ id: string;+ name: string;+ };+ collections: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,- },- } >,- } | null,+ id: string;+ name: string;+ };+ }>;+ } | null;// The product's base price (without any discounts// applied).- price: {+ price: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- margin: {- start: number | null,- stop: number | null,- } | null,- purchaseCost: {+ currency: string;+ } | null;+ margin: {+ start: number | null;+ stop: number | null;+ } | null;+ purchaseCost: {// Lower bound of a price range.- start: {+ start: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,+ currency: string;+ } | null;// Upper bound of a price range.- stop: {+ stop: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- } | null,- isPublished: boolean,- isFeatured: boolean,- chargeTaxes: boolean,- availableOn: string | null,+ currency: string;+ } | null;+ } | null;+ isPublished: boolean;+ isFeatured: boolean;+ chargeTaxes: boolean;+ availableOn: string | null;// List of product attributes assigned to this product.- attributes: Array< {+ attributes: Array<{// Name of an attribute- attribute: {+ attribute: {// The ID of the object.- id: string,+ id: string;// Internal representation of an attribute name.- slug: string | null,+ slug: string | null;// Visible name for display purposes.- name: string | null,+ name: string | null;// List of attribute's values.- values: Array< {+ values: Array<{// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null > | null,- } | null,+ slug: string | null;+ } | null> | null;+ } | null;// Value of an attribute.- value: {+ value: {// The ID of the object.- id: string,+ id: string;// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null,- } | null > | null,+ slug: string | null;+ } | null;+ } | null> | null;// Informs about product's availability in the storefront,// current price and discounts.- availability: {- available: boolean | null,- priceRange: {+ availability: {+ available: boolean | null;+ priceRange: {// Lower bound of a price range.- start: {+ start: {// Amount of money without taxes.- net: {+ net: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- },- } | null,+ currency: string;+ };+ } | null;// Upper bound of a price range.- stop: {+ stop: {// Amount of money without taxes.- net: {+ net: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- },- } | null,- } | null,- } | null,- images: {- edges: Array< {+ currency: string;+ };+ } | null;+ } | null;+ } | null;+ images: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- alt: string,- sortOrder: number,- url: string,- },- } >,- } | null,- variants: {- edges: Array< {+ id: string;+ alt: string;+ sortOrder: number;+ url: string;+ };+ }>;+ } | null;+ variants: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- sku: string,- name: string,+ id: string;+ sku: string;+ name: string;// Override the base price of a product if necessary.// A value of `null` indicates that the default product price is used.- priceOverride: {+ priceOverride: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,+ currency: string;+ } | null;// Quantity of a product available for sale.- stockQuantity: number,+ stockQuantity: number;// Gross margin percentage value.- margin: number | null,- },- } >,- } | null,- productType: {+ margin: number | null;+ };+ }>;+ } | null;+ productType: {// The ID of the object.- id: string,- name: string,- hasVariants: boolean,- },+ id: string;+ name: string;+ hasVariants: boolean;+ };// The storefront URL for the product.- url: string,- } | null,- } | null,-};+ url: string;+ } | null;+ } | null;+}export interface ProductCreateMutationVariables {- attributes?: Array< AttributeValueInput | null > | null,- availableOn?: string | null,- category: string,- chargeTaxes: boolean,- collections?: Array< string | null > | null,- description?: string | null,- isPublished: boolean,- isFeatured: boolean,- name: string,- price?: string | null,- productType: string,-};+ attributes?: Array<AttributeValueInput | null> | null;+ availableOn?: string | null;+ category: string;+ chargeTaxes: boolean;+ collections?: Array<string | null> | null;+ description?: string | null;+ isPublished: boolean;+ isFeatured: boolean;+ name: string;+ price?: string | null;+ productType: string;+}export interface ProductCreateMutation {- productCreate: {+ productCreate: {// List of errors that occurred executing the mutation.- errors: Array< {+ errors: Array<{// Name of a field that caused the error. A value of// `null` indicates that the error isn't associated with a particular// field.- field: string | null,+ field: string | null;// The error message.- message: string | null,- } | null > | null,- product: {+ message: string | null;+ } | null> | null;+ product: {// The ID of the object.- id: string,- name: string,- description: string,- seoTitle: string | null,- seoDescription: string | null,- category: {+ id: string;+ name: string;+ description: string;+ seoTitle: string | null;+ seoDescription: string | null;+ category: {// The ID of the object.- id: string,- name: string,- },- collections: {- edges: Array< {+ id: string;+ name: string;+ };+ collections: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,- },- } >,- } | null,+ id: string;+ name: string;+ };+ }>;+ } | null;// The product's base price (without any discounts// applied).- price: {+ price: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- margin: {- start: number | null,- stop: number | null,- } | null,- purchaseCost: {+ currency: string;+ } | null;+ margin: {+ start: number | null;+ stop: number | null;+ } | null;+ purchaseCost: {// Lower bound of a price range.- start: {+ start: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,+ currency: string;+ } | null;// Upper bound of a price range.- stop: {+ stop: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- } | null,- isPublished: boolean,- isFeatured: boolean,- chargeTaxes: boolean,- availableOn: string | null,+ currency: string;+ } | null;+ } | null;+ isPublished: boolean;+ isFeatured: boolean;+ chargeTaxes: boolean;+ availableOn: string | null;// List of product attributes assigned to this product.- attributes: Array< {+ attributes: Array<{// Name of an attribute- attribute: {+ attribute: {// The ID of the object.- id: string,+ id: string;// Internal representation of an attribute name.- slug: string | null,+ slug: string | null;// Visible name for display purposes.- name: string | null,+ name: string | null;// List of attribute's values.- values: Array< {+ values: Array<{// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null > | null,- } | null,+ slug: string | null;+ } | null> | null;+ } | null;// Value of an attribute.- value: {+ value: {// The ID of the object.- id: string,+ id: string;// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null,- } | null > | null,+ slug: string | null;+ } | null;+ } | null> | null;// Informs about product's availability in the storefront,// current price and discounts.- availability: {- available: boolean | null,- priceRange: {+ availability: {+ available: boolean | null;+ priceRange: {// Lower bound of a price range.- start: {+ start: {// Amount of money without taxes.- net: {+ net: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- },- } | null,+ currency: string;+ };+ } | null;// Upper bound of a price range.- stop: {+ stop: {// Amount of money without taxes.- net: {+ net: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- },- } | null,- } | null,- } | null,- images: {- edges: Array< {+ currency: string;+ };+ } | null;+ } | null;+ } | null;+ images: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- alt: string,- sortOrder: number,- url: string,- },- } >,- } | null,- variants: {- edges: Array< {+ id: string;+ alt: string;+ sortOrder: number;+ url: string;+ };+ }>;+ } | null;+ variants: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- sku: string,- name: string,+ id: string;+ sku: string;+ name: string;// Override the base price of a product if necessary.// A value of `null` indicates that the default product price is used.- priceOverride: {+ priceOverride: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,+ currency: string;+ } | null;// Quantity of a product available for sale.- stockQuantity: number,+ stockQuantity: number;// Gross margin percentage value.- margin: number | null,- },- } >,- } | null,- productType: {+ margin: number | null;+ };+ }>;+ } | null;+ productType: {// The ID of the object.- id: string,- name: string,- hasVariants: boolean,- },+ id: string;+ name: string;+ hasVariants: boolean;+ };// The storefront URL for the product.- url: string,- } | null,- } | null,-};+ url: string;+ } | null;+ } | null;+}export interface VariantDeleteMutationVariables {- id: string,-};+ id: string;+}export interface VariantDeleteMutation {- productVariantDelete: {+ productVariantDelete: {// List of errors that occurred executing the mutation.- errors: Array< {+ errors: Array<{// Name of a field that caused the error. A value of// `null` indicates that the error isn't associated with a particular// field.- field: string | null,+ field: string | null;// The error message.- message: string | null,- } | null > | null,- productVariant: {+ message: string | null;+ } | null> | null;+ productVariant: {// The ID of the object.- id: string,- } | null,- } | null,-};+ id: string;+ } | null;+ } | null;+}export interface VariantUpdateMutationVariables {- id: string,- attributes?: Array< AttributeValueInput | null > | null,- costPrice?: string | null,- priceOverride?: string | null,- product?: string | null,- sku?: string | null,- quantity?: number | null,- trackInventory: boolean,-};+ id: string;+ attributes?: Array<AttributeValueInput | null> | null;+ costPrice?: string | null;+ priceOverride?: string | null;+ product?: string | null;+ sku?: string | null;+ quantity?: number | null;+ trackInventory: boolean;+}export interface VariantUpdateMutation {- productVariantUpdate: {+ productVariantUpdate: {// List of errors that occurred executing the mutation.- errors: Array< {+ errors: Array<{// Name of a field that caused the error. A value of// `null` indicates that the error isn't associated with a particular// field.- field: string | null,+ field: string | null;// The error message.- message: string | null,- } | null > | null,- productVariant: {+ message: string | null;+ } | null> | null;+ productVariant: {// The ID of the object.- id: string,+ id: string;// List of attributes assigned to this variant.- attributes: Array< {+ attributes: Array<{// Name of an attribute- attribute: {+ attribute: {// The ID of the object.- id: string,+ id: string;// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,+ slug: string | null;// List of attribute's values.- values: Array< {+ values: Array<{// The ID of the object.- id: string,+ id: string;// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null > | null,- } | null,+ slug: string | null;+ } | null> | null;+ } | null;// Value of an attribute.- value: {+ value: {// The ID of the object.- id: string,+ id: string;// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null,- } | null > | null,+ slug: string | null;+ } | null;+ } | null> | null;// Cost price of the variant.- costPrice: {+ costPrice: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- images: {- edges: Array< {+ currency: string;+ } | null;+ images: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- },- } >,- } | null,- name: string,+ id: string;+ };+ }>;+ } | null;+ name: string;// Override the base price of a product if necessary.// A value of `null` indicates that the default product price is used.- priceOverride: {+ priceOverride: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- product: {+ currency: string;+ } | null;+ product: {// The ID of the object.- id: string,- images: {- edges: Array< {+ id: string;+ images: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- alt: string,- sortOrder: number,- url: string,- },- } >,- } | null,- name: string,+ id: string;+ alt: string;+ sortOrder: number;+ url: string;+ };+ }>;+ } | null;+ name: string;// The URL of a main thumbnail for a product.- thumbnailUrl: string | null,- variants: {+ thumbnailUrl: string | null;+ variants: {// A total count of items in the collection- totalCount: number | null,- edges: Array< {+ totalCount: number | null;+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,- sku: string,- },- } >,- } | null,- },- sku: string,- quantity: number,- quantityAllocated: number,- } | null,- } | null,-};+ id: string;+ name: string;+ sku: string;+ };+ }>;+ } | null;+ };+ sku: string;+ quantity: number;+ quantityAllocated: number;+ } | null;+ } | null;+}++export interface VariantCreateMutationVariables {+ attributes?: Array<AttributeValueInput | null> | null;+ costPrice?: string | null;+ priceOverride?: string | null;+ product?: string | null;+ sku?: string | null;+ quantity?: number | null;+ trackInventory: boolean;+}++export interface VariantCreateMutation {+ productVariantCreate: {+ // List of errors that occurred executing the mutation.+ errors: Array<{+ // Name of a field that caused the error. A value of+ // `null` indicates that the error isn't associated with a particular+ // field.+ field: string | null;+ // The error message.+ message: string | null;+ } | null> | null;+ productVariant: {+ // The ID of the object.+ id: string;+ // List of attributes assigned to this variant.+ attributes: Array<{+ // Name of an attribute+ attribute: {+ // The ID of the object.+ id: string;+ // Visible name for display purposes.+ name: string | null;+ // Internal representation of an attribute name.+ slug: string | null;+ // List of attribute's values.+ values: Array<{+ // The ID of the object.+ id: string;+ // Visible name for display purposes.+ name: string | null;+ // Internal representation of an attribute name.+ slug: string | null;+ } | null> | null;+ } | null;+ // Value of an attribute.+ value: {+ // The ID of the object.+ id: string;+ // Visible name for display purposes.+ name: string | null;+ // Internal representation of an attribute name.+ slug: string | null;+ } | null;+ } | null> | null;+ // Cost price of the variant.+ costPrice: {+ // Amount of money.+ amount: number;+ // Currency code.+ currency: string;+ } | null;+ images: {+ edges: Array<{+ // The item at the end of the edge+ node: {+ // The ID of the object.+ id: string;+ };+ }>;+ } | null;+ name: string;+ // Override the base price of a product if necessary.+ // A value of `null` indicates that the default product price is used.+ priceOverride: {+ // Amount of money.+ amount: number;+ // Currency code.+ currency: string;+ } | null;+ product: {+ // The ID of the object.+ id: string;+ images: {+ edges: Array<{+ // The item at the end of the edge+ node: {+ // The ID of the object.+ id: string;+ alt: string;+ sortOrder: number;+ url: string;+ };+ }>;+ } | null;+ name: string;+ // The URL of a main thumbnail for a product.+ thumbnailUrl: string | null;+ variants: {+ // A total count of items in the collection+ totalCount: number | null;+ edges: Array<{+ // The item at the end of the edge+ node: {+ // The ID of the object.+ id: string;+ name: string;+ sku: string;+ };+ }>;+ } | null;+ };+ sku: string;+ quantity: number;+ quantityAllocated: number;+ } | null;+ } | null;+}export interface ProductListQueryVariables {- first?: number | null,- after?: string | null,- last?: number | null,- before?: string | null,-};+ first?: number | null;+ after?: string | null;+ last?: number | null;+ before?: string | null;+}export interface ProductListQuery {// List of the shop's products.- products: {- edges: Array< {+ products: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,+ id: string;+ name: string;// The URL of a main thumbnail for a product.- thumbnailUrl: string | null,+ thumbnailUrl: string | null;// Informs about product's availability in the storefront,// current price and discounts.- availability: {- available: boolean | null,- } | null,+ availability: {+ available: boolean | null;+ } | null;// The product's base price (without any discounts// applied).- price: {+ price: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- productType: {+ currency: string;+ } | null;+ productType: {// The ID of the object.- id: string,- name: string,- },- },- } >,- pageInfo: {+ id: string;+ name: string;+ };+ };+ }>;+ pageInfo: {// When paginating backwards, are there more items?- hasPreviousPage: boolean,+ hasPreviousPage: boolean;// When paginating forwards, are there more items?- hasNextPage: boolean,+ hasNextPage: boolean;// When paginating backwards, the cursor to continue.- startCursor: string | null,+ startCursor: string | null;// When paginating forwards, the cursor to continue.- endCursor: string | null,- },- } | null,-};+ endCursor: string | null;+ };+ } | null;+}export interface ProductDetailsQueryVariables {- id: string,-};+ id: string;+}export interface ProductDetailsQuery {// Lookup a product by ID.- product: {+ product: {// The ID of the object.- id: string,- name: string,- description: string,- seoTitle: string | null,- seoDescription: string | null,- category: {+ id: string;+ name: string;+ description: string;+ seoTitle: string | null;+ seoDescription: string | null;+ category: {// The ID of the object.- id: string,- name: string,- },- collections: {- edges: Array< {+ id: string;+ name: string;+ };+ collections: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,- },- } >,- } | null,+ id: string;+ name: string;+ };+ }>;+ } | null;// The product's base price (without any discounts// applied).- price: {+ price: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- margin: {- start: number | null,- stop: number | null,- } | null,- purchaseCost: {+ currency: string;+ } | null;+ margin: {+ start: number | null;+ stop: number | null;+ } | null;+ purchaseCost: {// Lower bound of a price range.- start: {+ start: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,+ currency: string;+ } | null;// Upper bound of a price range.- stop: {+ stop: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- } | null,- isPublished: boolean,- isFeatured: boolean,- chargeTaxes: boolean,- availableOn: string | null,+ currency: string;+ } | null;+ } | null;+ isPublished: boolean;+ isFeatured: boolean;+ chargeTaxes: boolean;+ availableOn: string | null;// List of product attributes assigned to this product.- attributes: Array< {+ attributes: Array<{// Name of an attribute- attribute: {+ attribute: {// The ID of the object.- id: string,+ id: string;// Internal representation of an attribute name.- slug: string | null,+ slug: string | null;// Visible name for display purposes.- name: string | null,+ name: string | null;// List of attribute's values.- values: Array< {+ values: Array<{// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null > | null,- } | null,+ slug: string | null;+ } | null> | null;+ } | null;// Value of an attribute.- value: {+ value: {// The ID of the object.- id: string,+ id: string;// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null,- } | null > | null,+ slug: string | null;+ } | null;+ } | null> | null;// Informs about product's availability in the storefront,// current price and discounts.- availability: {- available: boolean | null,- priceRange: {+ availability: {+ available: boolean | null;+ priceRange: {// Lower bound of a price range.- start: {+ start: {// Amount of money without taxes.- net: {+ net: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- },- } | null,+ currency: string;+ };+ } | null;// Upper bound of a price range.- stop: {+ stop: {// Amount of money without taxes.- net: {+ net: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- },- } | null,- } | null,- } | null,- images: {- edges: Array< {+ currency: string;+ };+ } | null;+ } | null;+ } | null;+ images: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- alt: string,- sortOrder: number,- url: string,- },- } >,- } | null,- variants: {- edges: Array< {+ id: string;+ alt: string;+ sortOrder: number;+ url: string;+ };+ }>;+ } | null;+ variants: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- sku: string,- name: string,+ id: string;+ sku: string;+ name: string;// Override the base price of a product if necessary.// A value of `null` indicates that the default product price is used.- priceOverride: {+ priceOverride: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,+ currency: string;+ } | null;// Quantity of a product available for sale.- stockQuantity: number,+ stockQuantity: number;// Gross margin percentage value.- margin: number | null,- },- } >,- } | null,- productType: {+ margin: number | null;+ };+ }>;+ } | null;+ productType: {// The ID of the object.- id: string,- name: string,- hasVariants: boolean,- },+ id: string;+ name: string;+ hasVariants: boolean;+ };// The storefront URL for the product.- url: string,- } | null,+ url: string;+ } | null;// List of the shop's collections.- collections: {- edges: Array< {+ collections: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,- },- } >,- } | null,+ id: string;+ name: string;+ };+ }>;+ } | null;// List of the shop's categories.- categories: {- edges: Array< {+ categories: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,- },- } >,- } | null,-};+ id: string;+ name: string;+ };+ }>;+ } | null;+}export interface ProductVariantDetailsQueryVariables {- id: string,-};+ id: string;+}export interface ProductVariantDetailsQuery {// Lookup a variant by ID.- productVariant: {+ productVariant: {// The ID of the object.- id: string,+ id: string;// List of attributes assigned to this variant.- attributes: Array< {+ attributes: Array<{// Name of an attribute- attribute: {+ attribute: {// The ID of the object.- id: string,+ id: string;// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,+ slug: string | null;// List of attribute's values.- values: Array< {+ values: Array<{// The ID of the object.- id: string,+ id: string;// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null > | null,- } | null,+ slug: string | null;+ } | null> | null;+ } | null;// Value of an attribute.- value: {+ value: {// The ID of the object.- id: string,+ id: string;// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null,- } | null > | null,+ slug: string | null;+ } | null;+ } | null> | null;// Cost price of the variant.- costPrice: {+ costPrice: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- images: {- edges: Array< {+ currency: string;+ } | null;+ images: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- },- } >,- } | null,- name: string,+ id: string;+ };+ }>;+ } | null;+ name: string;// Override the base price of a product if necessary.// A value of `null` indicates that the default product price is used.- priceOverride: {+ priceOverride: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- product: {+ currency: string;+ } | null;+ product: {// The ID of the object.- id: string,- images: {- edges: Array< {+ id: string;+ images: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- alt: string,- sortOrder: number,- url: string,- },- } >,- } | null,- name: string,+ id: string;+ alt: string;+ sortOrder: number;+ url: string;+ };+ }>;+ } | null;+ name: string;// The URL of a main thumbnail for a product.- thumbnailUrl: string | null,- variants: {+ thumbnailUrl: string | null;+ variants: {// A total count of items in the collection- totalCount: number | null,- edges: Array< {+ totalCount: number | null;+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,- sku: string,- },- } >,- } | null,- },- sku: string,- quantity: number,- quantityAllocated: number,- } | null,-};+ id: string;+ name: string;+ sku: string;+ };+ }>;+ } | null;+ };+ sku: string;+ quantity: number;+ quantityAllocated: number;+ } | null;+}export interface ProductCreateDataQuery {// List of the shop's product types.- productTypes: {- edges: Array< {+ productTypes: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,- hasVariants: boolean,- productAttributes: {- edges: Array< {+ id: string;+ name: string;+ hasVariants: boolean;+ productAttributes: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,+ id: string;// Internal representation of an attribute name.- slug: string | null,+ slug: string | null;// Visible name for display purposes.- name: string | null,+ name: string | null;// List of attribute's values.- values: Array< {+ values: Array<{// The ID of the object.- id: string,- sortOrder: number,+ id: string;+ sortOrder: number;// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null > | null,- },- } >,- } | null,- },- } >,- } | null,+ slug: string | null;+ } | null> | null;+ };+ }>;+ } | null;+ };+ }>;+ } | null;// List of the shop's collections.- collections: {- edges: Array< {+ collections: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,- },- } >,- } | null,+ id: string;+ name: string;+ };+ }>;+ } | null;// List of the shop's categories.- categories: {- edges: Array< {+ categories: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,- },- } >,- } | null,-};+ id: string;+ name: string;+ };+ }>;+ } | null;+}++export interface ProductVariantCreateDataQueryVariables {+ id: string;+}++export interface ProductVariantCreateDataQuery {+ // Lookup a product by ID.+ product: {+ images: {+ edges: Array<{+ // The item at the end of the edge+ node: {+ // The ID of the object.+ id: string;+ sortOrder: number;+ url: string;+ };+ }>;+ } | null;+ productType: {+ // The ID of the object.+ id: string;+ variantAttributes: {+ edges: Array<{+ // The item at the end of the edge+ node: {+ // The ID of the object.+ id: string;+ // Internal representation of an attribute name.+ slug: string | null;+ // Visible name for display purposes.+ name: string | null;+ // List of attribute's values.+ values: Array<{+ // The ID of the object.+ id: string;+ sortOrder: number;+ // Visible name for display purposes.+ name: string | null;+ // Internal representation of an attribute name.+ slug: string | null;+ } | null> | null;+ };+ }>;+ } | null;+ };+ variants: {+ edges: Array<{+ // The item at the end of the edge+ node: {+ // The ID of the object.+ id: string;+ name: string;+ sku: string;+ images: {+ edges: Array<{+ // The item at the end of the edge+ node: {+ // The ID of the object.+ id: string;+ url: string;+ };+ }>;+ } | null;+ };+ }>;+ } | null;+ } | null;+}export interface UserFragment {// The ID of the object.@@ -1367,264 +1554,264 @@ export interface UserFragment {export interface MoneyFragment {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,-};+ currency: string;+}export interface ProductImageFragment {// The ID of the object.- id: string,- alt: string,- sortOrder: number,- url: string,-};+ id: string;+ alt: string;+ sortOrder: number;+ url: string;+}export interface ProductFragment {// The ID of the object.- id: string,- name: string,- description: string,- seoTitle: string | null,- seoDescription: string | null,- category: {+ id: string;+ name: string;+ description: string;+ seoTitle: string | null;+ seoDescription: string | null;+ category: {// The ID of the object.- id: string,- name: string,- },- collections: {- edges: Array< {+ id: string;+ name: string;+ };+ collections: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,- },- } >,- } | null,+ id: string;+ name: string;+ };+ }>;+ } | null;// The product's base price (without any discounts// applied).- price: {+ price: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- margin: {- start: number | null,- stop: number | null,- } | null,- purchaseCost: {+ currency: string;+ } | null;+ margin: {+ start: number | null;+ stop: number | null;+ } | null;+ purchaseCost: {// Lower bound of a price range.- start: {+ start: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,+ currency: string;+ } | null;// Upper bound of a price range.- stop: {+ stop: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- } | null,- isPublished: boolean,- isFeatured: boolean,- chargeTaxes: boolean,- availableOn: string | null,+ currency: string;+ } | null;+ } | null;+ isPublished: boolean;+ isFeatured: boolean;+ chargeTaxes: boolean;+ availableOn: string | null;// List of product attributes assigned to this product.- attributes: Array< {+ attributes: Array<{// Name of an attribute- attribute: {+ attribute: {// The ID of the object.- id: string,+ id: string;// Internal representation of an attribute name.- slug: string | null,+ slug: string | null;// Visible name for display purposes.- name: string | null,+ name: string | null;// List of attribute's values.- values: Array< {+ values: Array<{// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null > | null,- } | null,+ slug: string | null;+ } | null> | null;+ } | null;// Value of an attribute.- value: {+ value: {// The ID of the object.- id: string,+ id: string;// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null,- } | null > | null,+ slug: string | null;+ } | null;+ } | null> | null;// Informs about product's availability in the storefront,// current price and discounts.- availability: {- available: boolean | null,- priceRange: {+ availability: {+ available: boolean | null;+ priceRange: {// Lower bound of a price range.- start: {+ start: {// Amount of money without taxes.- net: {+ net: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- },- } | null,+ currency: string;+ };+ } | null;// Upper bound of a price range.- stop: {+ stop: {// Amount of money without taxes.- net: {+ net: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- },- } | null,- } | null,- } | null,- images: {- edges: Array< {+ currency: string;+ };+ } | null;+ } | null;+ } | null;+ images: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- alt: string,- sortOrder: number,- url: string,- },- } >,- } | null,- variants: {- edges: Array< {+ id: string;+ alt: string;+ sortOrder: number;+ url: string;+ };+ }>;+ } | null;+ variants: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- sku: string,- name: string,+ id: string;+ sku: string;+ name: string;// Override the base price of a product if necessary.// A value of `null` indicates that the default product price is used.- priceOverride: {+ priceOverride: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,+ currency: string;+ } | null;// Quantity of a product available for sale.- stockQuantity: number,+ stockQuantity: number;// Gross margin percentage value.- margin: number | null,- },- } >,- } | null,- productType: {+ margin: number | null;+ };+ }>;+ } | null;+ productType: {// The ID of the object.- id: string,- name: string,- hasVariants: boolean,- },+ id: string;+ name: string;+ hasVariants: boolean;+ };// The storefront URL for the product.- url: string,-};+ url: string;+}export interface ProductVariantFragment {// The ID of the object.- id: string,+ id: string;// List of attributes assigned to this variant.- attributes: Array< {+ attributes: Array<{// Name of an attribute- attribute: {+ attribute: {// The ID of the object.- id: string,+ id: string;// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,+ slug: string | null;// List of attribute's values.- values: Array< {+ values: Array<{// The ID of the object.- id: string,+ id: string;// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null > | null,- } | null,+ slug: string | null;+ } | null> | null;+ } | null;// Value of an attribute.- value: {+ value: {// The ID of the object.- id: string,+ id: string;// Visible name for display purposes.- name: string | null,+ name: string | null;// Internal representation of an attribute name.- slug: string | null,- } | null,- } | null > | null,+ slug: string | null;+ } | null;+ } | null> | null;// Cost price of the variant.- costPrice: {+ costPrice: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- images: {- edges: Array< {+ currency: string;+ } | null;+ images: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- },- } >,- } | null,- name: string,+ id: string;+ };+ }>;+ } | null;+ name: string;// Override the base price of a product if necessary.// A value of `null` indicates that the default product price is used.- priceOverride: {+ priceOverride: {// Amount of money.- amount: number,+ amount: number;// Currency code.- currency: string,- } | null,- product: {+ currency: string;+ } | null;+ product: {// The ID of the object.- id: string,- images: {- edges: Array< {+ id: string;+ images: {+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- alt: string,- sortOrder: number,- url: string,- },- } >,- } | null,- name: string,+ id: string;+ alt: string;+ sortOrder: number;+ url: string;+ };+ }>;+ } | null;+ name: string;// The URL of a main thumbnail for a product.- thumbnailUrl: string | null,- variants: {+ thumbnailUrl: string | null;+ variants: {// A total count of items in the collection- totalCount: number | null,- edges: Array< {+ totalCount: number | null;+ edges: Array<{// The item at the end of the edge- node: {+ node: {// The ID of the object.- id: string,- name: string,- sku: string,- },- } >,- } | null,- },- sku: string,- quantity: number,- quantityAllocated: number,-};+ id: string;+ name: string;+ sku: string;+ };+ }>;+ } | null;+ };+ sku: string;+ quantity: number;+ quantityAllocated: number;+}diff --git a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsxindex 7b2d9ef0cf..d42d8ae2bb 100644--- a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx+++ b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx@@ -23,9 +23,9 @@ interface FormData {slug: string;value: string;}>;- costPrice?: number;+ costPrice?: string;images?: string[];- priceOverride?: number;+ priceOverride?: string;stock?: number;sku?: string;}@@ -67,7 +67,6 @@ interface ProductVariantCreatePageProps {saveButtonBarState?: SaveButtonBarState;onBack: () => void;onSubmit: (data: FormData) => void;- onImageSelect: (images: string[]) => void;onVariantClick: (variantId: string) => void;}@@ -95,7 +94,6 @@ const ProductVariantCreatePage = decorate<ProductVariantCreatePageProps>(product,saveButtonBarState,onBack,- onImageSelect,onSubmit,onVariantClick}) => {diff --git a/saleor/static/dashboard-next/products/components/ProductVariantImages/ProductVariantImages.tsx b/saleor/static/dashboard-next/products/components/ProductVariantImages/ProductVariantImages.tsxindex da043fbff0..fc13d79397 100644--- a/saleor/static/dashboard-next/products/components/ProductVariantImages/ProductVariantImages.tsx+++ b/saleor/static/dashboard-next/products/components/ProductVariantImages/ProductVariantImages.tsx@@ -58,7 +58,9 @@ export const ProductVariantImages = decorate<ProductVariantImagesProps>(<Buttoncolor="secondary"variant="flat"- disabled={disabled}+ // FIXME: enable this button when API will be able to pin images+ // to variants+ disabled={true || disabled}onClick={onImageAdd}>{i18n.t("Choose photos")}@@ -73,7 +75,7 @@ export const ProductVariantImages = decorate<ProductVariantImagesProps>(images.sort((prev, next) => (prev.sortOrder > next.sortOrder ? 1 : -1)).map(tile => (- <div className={classes.imageContainer}>+ <div className={classes.imageContainer} key={tile.id}><img className={classes.image} src={tile.url} /></div>))diff --git a/saleor/static/dashboard-next/products/components/ProductVariantPrice/ProductVariantPrice.tsx b/saleor/static/dashboard-next/products/components/ProductVariantPrice/ProductVariantPrice.tsxindex eef75c4642..68408d4fb2 100644--- a/saleor/static/dashboard-next/products/components/ProductVariantPrice/ProductVariantPrice.tsx+++ b/saleor/static/dashboard-next/products/components/ProductVariantPrice/ProductVariantPrice.tsx@@ -9,8 +9,8 @@ import i18n from "../../../i18n";interface ProductVariantPriceProps {currencySymbol?: string;- priceOverride?: number;- costPrice?: number;+ priceOverride?: string;+ costPrice?: string;errors: { [key: string]: string };loading?: boolean;onChange(event: any);diff --git a/saleor/static/dashboard-next/products/index.tsx b/saleor/static/dashboard-next/products/index.tsxindex d42d831111..10a215e739 100644--- a/saleor/static/dashboard-next/products/index.tsx+++ b/saleor/static/dashboard-next/products/index.tsx@@ -6,6 +6,7 @@ import ProductCreate from "./views/ProductCreate";import ProductListComponent 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@@ -35,11 +36,22 @@ const ProductVariant: React.StatelessComponent<RouteComponentProps<any>> = ({);};+const ProductVariantCreate: React.StatelessComponent<+ RouteComponentProps<any>+> = ({ match }) => {+ return <ProductVariantCreateComponent productId={match.params.id} />;+};+const Component = ({ match }) => (<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}+ /><Routeexactpath={`${match.url}/:productId/variant/:variantId/`}@@ -56,12 +68,15 @@ export const productImageEditUrl = (id: string) => {return `/products/${id}/image/`;};+export const productVariantAddUrl = (productId: string) => {+ return `/products/${productId}/variant/add/`;+};+export const productVariantEditUrl = (productId: string, variantId: string) => {return `/products/${productId}/variant/${variantId}/`;};export const productListUrl = "/products/";-export const productAddUrl = "/products/add/";export interface AttributeType {diff --git a/saleor/static/dashboard-next/products/mutations.ts b/saleor/static/dashboard-next/products/mutations.tsindex e2213b5932..ab1a9add33 100644--- a/saleor/static/dashboard-next/products/mutations.ts+++ b/saleor/static/dashboard-next/products/mutations.ts@@ -12,6 +12,8 @@ import {ProductImageReorderMutationVariables,ProductUpdateMutation,ProductUpdateMutationVariables,+ VariantCreateMutation,+ VariantCreateMutationVariables,VariantDeleteMutation,VariantDeleteMutationVariables,VariantUpdateMutation,@@ -232,3 +234,40 @@ export const variantUpdateMutation = gql`}}`;++export const TypedVariantCreateMutation = Mutation as React.ComponentType<+ MutationProps<VariantCreateMutation, VariantCreateMutationVariables>+>;++export const variantCreateMutation = gql`+ ${fragmentVariant}+ mutation VariantCreate(+ $attributes: [AttributeValueInput]+ $costPrice: Decimal+ $priceOverride: Decimal+ $product: ID+ $sku: String+ $quantity: Int+ $trackInventory: Boolean!+ ) {+ productVariantCreate(+ input: {+ attributes: $attributes+ costPrice: $costPrice+ priceOverride: $priceOverride+ product: $product+ sku: $sku+ quantity: $quantity+ trackInventory: $trackInventory+ }+ ) {+ errors {+ field+ message+ }+ productVariant {+ ...ProductVariant+ }+ }+ }+`;diff --git a/saleor/static/dashboard-next/products/queries.ts b/saleor/static/dashboard-next/products/queries.tsindex d85a0fa34e..9f30904559 100644--- a/saleor/static/dashboard-next/products/queries.ts+++ b/saleor/static/dashboard-next/products/queries.ts@@ -6,7 +6,9 @@ import {ProductDetailsQuery,ProductDetailsQueryVariables,ProductListQuery,- ProductListQueryVariables+ ProductListQueryVariables,+ ProductVariantCreateDataQuery,+ ProductVariantCreateDataQueryVariables} from "../gql-types";export const fragmentMoney = gql`@@ -180,6 +182,14 @@ export const fragmentVariant = gql`idnamesku+ images(first: 1) {+ edges {+ node {+ id+ url+ }+ }+ }}}}@@ -314,3 +324,60 @@ export const productCreateQuery = gql`}}`;++export const TypedProductVariantCreateQuery = Query as React.ComponentType<+ QueryProps<+ ProductVariantCreateDataQuery,+ ProductVariantCreateDataQueryVariables+ >+>;+export const productVariantCreateQuery = gql`+ query ProductVariantCreateData($id: ID!) {+ product(id: $id) {+ images {+ edges {+ node {+ id+ sortOrder+ url+ }+ }+ }+ productType {+ id+ variantAttributes {+ edges {+ node {+ id+ slug+ name+ values {+ id+ sortOrder+ name+ slug+ }+ }+ }+ }+ }+ variants {+ edges {+ node {+ id+ name+ sku+ images(first: 1) {+ edges {+ node {+ id+ url+ }+ }+ }+ }+ }+ }+ }+ }+`;diff --git a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx b/saleor/static/dashboard-next/products/views/ProductUpdate.tsxindex 1e3caca521..f4f638c508 100644--- a/saleor/static/dashboard-next/products/views/ProductUpdate.tsx+++ b/saleor/static/dashboard-next/products/views/ProductUpdate.tsx@@ -11,7 +11,11 @@ import Navigator from "../../components/Navigator";import i18n from "../../i18n";import ProductUpdatePage from "../components/ProductUpdatePage";import ProductUpdateOperations from "../containers/ProductUpdateOperations";-import { productListUrl, productVariantEditUrl } from "../index";+import {+ productListUrl,+ productVariantAddUrl,+ productVariantEditUrl+} from "../index";import { productDetailsQuery, TypedProductDetailsQuery } from "../queries";interface ProductUpdateProps {@@ -51,6 +55,8 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({pushMessage({text: i18n.t("Image successfully uploaded")});+ const handleVariantAdd = () =>+ navigate(productVariantAddUrl(id));const product = data ? data.product : undefined;const allCollections =@@ -153,7 +159,7 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({}}}onSubmit={handleSubmit}- onVariantAdd={() => {}}+ onVariantAdd={handleVariantAdd}onVariantShow={variantId => () =>navigate(productVariantEditUrl(product.id, variantId)diff --git a/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx b/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsxindex 3289d72e92..8c741ad8e8 100644--- a/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx+++ b/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx@@ -1,23 +1,26 @@import * as React from "react";-import { ApolloError } from "apollo-client";import { productUrl, productVariantEditUrl } from "..";-import * as placeholderImg from "../../../images/placeholder255x255.png";import ErrorMessageCard from "../../components/ErrorMessageCard";import Messages from "../../components/messages";import Navigator from "../../components/Navigator";+import { VariantCreateMutation } from "../../gql-types";import i18n from "../../i18n";-import ProductVariantPage from "../components/ProductVariantPage";-import ProductVariantOperations from "../containers/ProductVariantOperations";-import { productVariantQuery, TypedProductVariantQuery } from "../queries";+import ProductVariantCreatePage from "../components/ProductVariantCreatePage";+import {+ TypedVariantCreateMutation,+ variantCreateMutation+} from "../mutations";+import {+ productVariantCreateQuery,+ TypedProductVariantCreateQuery+} from "../queries";interface ProductUpdateProps {- variantId: string;productId: string;}interface FormData {- id: string;attributes?: Array<{slug: string;value: string;@@ -29,96 +32,98 @@ interface FormData {}export const ProductVariant: React.StatelessComponent<ProductUpdateProps> = ({- variantId,productId}) => (<Navigator>{navigate => (<Messages>{pushMessage => (- <TypedProductVariantQuery- query={productVariantQuery}- variables={{ id: variantId }}- fetchPolicy="network-only"+ <TypedProductVariantCreateQuery+ query={productVariantCreateQuery}+ variables={{ id: productId }}>- {({ data, loading, error }) => {+ {({ data, error, loading: productLoading }) => {if (error) {- return <ErrorMessageCard message="Something went wrong" />;+ return (+ <ErrorMessageCard message={i18n.t("Something went wrong")} />+ );}- const variant = data ? data.productVariant : undefined;- const handleBack = () => navigate(productUrl(productId));- const handleDelete = () => {- pushMessage({ text: i18n.t("Variant removed") });- navigate(productUrl(productId));- };- const handleError = (error: ApolloError) => {- console.error(error.message);++ const handleError = () =>pushMessage({ text: i18n.t("Something went wrong") });+ const handleCreateSuccess = (data: VariantCreateMutation) => {+ if (+ data.productVariantCreate.errors &&+ data.productVariantCreate.errors.length === 0+ ) {+ pushMessage({ text: i18n.t("Product created") });+ navigate(+ productVariantEditUrl(+ productId,+ data.productVariantCreate.productVariant.id+ )+ );+ }};- const handleUpdate = () =>- pushMessage({ text: i18n.t("Changes saved") });+return (- <ProductVariantOperations- productId={productId}- id={variantId}- onDelete={handleDelete}- onError={handleError}- onUpdate={handleUpdate}+ <TypedVariantCreateMutation+ mutation={variantCreateMutation}+ onCompleted={handleCreateSuccess}>- {({ deleteVariant, updateVariant }) => {- const disableFormSave =- loading || deleteVariant.loading || updateVariant.loading;- const formSubmitState = disableFormSave- ? "loading"- : "idle";+ {(variantCreate, variantCreateResult) => {+ if (variantCreateResult.error) {+ return (+ <ErrorMessageCard+ message={i18n.t("Something went wrong")}+ />+ );+ }++ const handleBack = () => navigate(productUrl(productId));+ const handleSubmit = (formData: FormData) =>+ variantCreate({+ variables: {+ attributes: formData.attributes,+ costPrice: formData.costPrice,+ priceOverride: formData.priceOverride,+ product: productId,+ quantity: formData.stock,+ sku: formData.sku,+ trackInventory: true+ }+ });+ const handleVariantClick = (id: string) =>+ navigate(productVariantEditUrl(productId, id));++ const loading =+ productLoading || variantCreateResult.loading;return (- <ProductVariantPage+ <ProductVariantCreatePageerrors={- updateVariant &&- updateVariant.data &&- updateVariant.data.productVariantUpdate &&- updateVariant.data.productVariantUpdate.errors- ? updateVariant.data.productVariantUpdate.errors+ variantCreateResult.data &&+ variantCreateResult.data.productVariantCreate &&+ variantCreateResult.data.productVariantCreate &&+ variantCreateResult.data.productVariantCreate.errors+ ? variantCreateResult.data.productVariantCreate+ .errors: []}- saveButtonBarState={formSubmitState}- loading={disableFormSave}- placeholderImage={placeholderImg}- variant={variant}- header={- variant ? variant.name || variant.sku : undefined+ header={i18n.t("Add Variant")}+ loading={loading}+ product={+ data && data.product ? data.product : undefined}onBack={handleBack}- onDelete={() => deleteVariant.mutate(variantId)}- onImageSelect={() => {}}- onSubmit={(data: FormData) => {- if (variant) {- updateVariant.mutate({- attributes: data.attributes- ? data.attributes- : null,- costPrice: data.costPrice ? data.costPrice : null,- id: variantId,- priceOverride: data.priceOverride- ? data.priceOverride- : null,- product: productId,- quantity: data.stock,- sku: data.sku,- trackInventory: true // FIXME: missing in UI- });- }- }}- onVariantClick={variantId => {- navigate(productVariantEditUrl(productId, variantId));- }}+ onSubmit={handleSubmit}+ onVariantClick={handleVariantClick}/>);}}- </ProductVariantOperations>+ </TypedVariantCreateMutation>);}}- </TypedProductVariantQuery>+ </TypedProductVariantCreateQuery>)}</Messages>)}diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductVariantCreatePage.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductVariantCreatePage.tsxindex 70f4b10635..2c6d34d38e 100644--- a/saleor/static/dashboard-next/storybook/stories/products/ProductVariantCreatePage.tsx+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductVariantCreatePage.tsx@@ -36,7 +36,6 @@ storiesOf("Views / Products / Create product variant", module)product={product}onBack={() => {}}onSubmit={() => {}}- onImageSelect={() => {}}onVariantClick={() => {}}/>))@@ -48,7 +47,6 @@ storiesOf("Views / Products / Create product variant", module)product={product}onBack={() => {}}onSubmit={() => {}}- onImageSelect={() => {}}onVariantClick={() => {}}/>))@@ -59,7 +57,6 @@ storiesOf("Views / Products / Create product variant", module)loading={true}onBack={() => {}}onSubmit={() => {}}- onImageSelect={() => {}}onVariantClick={() => {}}/>));