Update product variant creator

This commit is contained in:
Dawid Tarasiuk 2020-06-16 15:16:08 +02:00
parent cdfac6de6b
commit eaa85bc795
11 changed files with 255 additions and 225 deletions

View file

@ -112,6 +112,12 @@ const productVariantAttributesFragment = gql`
} }
} }
} }
variants {
price {
amount
currency
}
}
} }
`; `;

View file

@ -58,11 +58,23 @@ export interface CreateMultipleVariantsData_product_productType {
variantAttributes: (CreateMultipleVariantsData_product_productType_variantAttributes | null)[] | null; variantAttributes: (CreateMultipleVariantsData_product_productType_variantAttributes | null)[] | null;
} }
export interface CreateMultipleVariantsData_product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface CreateMultipleVariantsData_product_variants {
__typename: "ProductVariant";
price: CreateMultipleVariantsData_product_variants_price | null;
}
export interface CreateMultipleVariantsData_product { export interface CreateMultipleVariantsData_product {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: CreateMultipleVariantsData_product_attributes[]; attributes: CreateMultipleVariantsData_product_attributes[];
productType: CreateMultipleVariantsData_product_productType; productType: CreateMultipleVariantsData_product_productType;
variants: (CreateMultipleVariantsData_product_variants | null)[] | null;
} }
export interface CreateMultipleVariantsData_warehouses_edges_node { export interface CreateMultipleVariantsData_warehouses_edges_node {

View file

@ -60,6 +60,37 @@ export interface Product_productType {
hasVariants: boolean; hasVariants: boolean;
} }
export interface Product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface Product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface Product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: Product_variants_stocks_warehouse;
}
export interface Product_variants {
__typename: "ProductVariant";
price: Product_variants_price | null;
id: string;
sku: string;
name: string;
margin: number | null;
stocks: (Product_variants_stocks | null)[] | null;
trackInventory: boolean;
}
export interface Product_category { export interface Product_category {
__typename: "Category"; __typename: "Category";
id: string; id: string;
@ -137,42 +168,12 @@ export interface Product_images {
url: string; url: string;
} }
export interface Product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface Product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface Product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: Product_variants_stocks_warehouse;
}
export interface Product_variants {
__typename: "ProductVariant";
id: string;
sku: string;
name: string;
price: Product_variants_price | null;
margin: number | null;
stocks: (Product_variants_stocks | null)[] | null;
trackInventory: boolean;
}
export interface Product { export interface Product {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: Product_attributes[]; attributes: Product_attributes[];
productType: Product_productType; productType: Product_productType;
variants: (Product_variants | null)[] | null;
name: string; name: string;
descriptionJson: any; descriptionJson: any;
seoTitle: string | null; seoTitle: string | null;
@ -187,5 +188,4 @@ export interface Product {
publicationDate: any | null; publicationDate: any | null;
pricing: Product_pricing | null; pricing: Product_pricing | null;
images: (Product_images | null)[] | null; images: (Product_images | null)[] | null;
variants: (Product_variants | null)[] | null;
} }

View file

@ -66,6 +66,37 @@ export interface ProductCreate_productCreate_product_productType {
hasVariants: boolean; hasVariants: boolean;
} }
export interface ProductCreate_productCreate_product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductCreate_productCreate_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductCreate_productCreate_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductCreate_productCreate_product_variants_stocks_warehouse;
}
export interface ProductCreate_productCreate_product_variants {
__typename: "ProductVariant";
price: ProductCreate_productCreate_product_variants_price | null;
id: string;
sku: string;
name: string;
margin: number | null;
stocks: (ProductCreate_productCreate_product_variants_stocks | null)[] | null;
trackInventory: boolean;
}
export interface ProductCreate_productCreate_product_category { export interface ProductCreate_productCreate_product_category {
__typename: "Category"; __typename: "Category";
id: string; id: string;
@ -143,42 +174,12 @@ export interface ProductCreate_productCreate_product_images {
url: string; url: string;
} }
export interface ProductCreate_productCreate_product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductCreate_productCreate_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductCreate_productCreate_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductCreate_productCreate_product_variants_stocks_warehouse;
}
export interface ProductCreate_productCreate_product_variants {
__typename: "ProductVariant";
id: string;
sku: string;
name: string;
price: ProductCreate_productCreate_product_variants_price | null;
margin: number | null;
stocks: (ProductCreate_productCreate_product_variants_stocks | null)[] | null;
trackInventory: boolean;
}
export interface ProductCreate_productCreate_product { export interface ProductCreate_productCreate_product {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: ProductCreate_productCreate_product_attributes[]; attributes: ProductCreate_productCreate_product_attributes[];
productType: ProductCreate_productCreate_product_productType; productType: ProductCreate_productCreate_product_productType;
variants: (ProductCreate_productCreate_product_variants | null)[] | null;
name: string; name: string;
descriptionJson: any; descriptionJson: any;
seoTitle: string | null; seoTitle: string | null;
@ -193,7 +194,6 @@ export interface ProductCreate_productCreate_product {
publicationDate: any | null; publicationDate: any | null;
pricing: ProductCreate_productCreate_product_pricing | null; pricing: ProductCreate_productCreate_product_pricing | null;
images: (ProductCreate_productCreate_product_images | null)[] | null; images: (ProductCreate_productCreate_product_images | null)[] | null;
variants: (ProductCreate_productCreate_product_variants | null)[] | null;
} }
export interface ProductCreate_productCreate { export interface ProductCreate_productCreate {

View file

@ -60,6 +60,37 @@ export interface ProductDetails_product_productType {
hasVariants: boolean; hasVariants: boolean;
} }
export interface ProductDetails_product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductDetails_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductDetails_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductDetails_product_variants_stocks_warehouse;
}
export interface ProductDetails_product_variants {
__typename: "ProductVariant";
price: ProductDetails_product_variants_price | null;
id: string;
sku: string;
name: string;
margin: number | null;
stocks: (ProductDetails_product_variants_stocks | null)[] | null;
trackInventory: boolean;
}
export interface ProductDetails_product_category { export interface ProductDetails_product_category {
__typename: "Category"; __typename: "Category";
id: string; id: string;
@ -137,42 +168,12 @@ export interface ProductDetails_product_images {
url: string; url: string;
} }
export interface ProductDetails_product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductDetails_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductDetails_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductDetails_product_variants_stocks_warehouse;
}
export interface ProductDetails_product_variants {
__typename: "ProductVariant";
id: string;
sku: string;
name: string;
price: ProductDetails_product_variants_price | null;
margin: number | null;
stocks: (ProductDetails_product_variants_stocks | null)[] | null;
trackInventory: boolean;
}
export interface ProductDetails_product { export interface ProductDetails_product {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: ProductDetails_product_attributes[]; attributes: ProductDetails_product_attributes[];
productType: ProductDetails_product_productType; productType: ProductDetails_product_productType;
variants: (ProductDetails_product_variants | null)[] | null;
name: string; name: string;
descriptionJson: any; descriptionJson: any;
seoTitle: string | null; seoTitle: string | null;
@ -187,7 +188,6 @@ export interface ProductDetails_product {
publicationDate: any | null; publicationDate: any | null;
pricing: ProductDetails_product_pricing | null; pricing: ProductDetails_product_pricing | null;
images: (ProductDetails_product_images | null)[] | null; images: (ProductDetails_product_images | null)[] | null;
variants: (ProductDetails_product_variants | null)[] | null;
} }
export interface ProductDetails { export interface ProductDetails {

View file

@ -66,6 +66,37 @@ export interface ProductImageCreate_productImageCreate_product_productType {
hasVariants: boolean; hasVariants: boolean;
} }
export interface ProductImageCreate_productImageCreate_product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductImageCreate_productImageCreate_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductImageCreate_productImageCreate_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductImageCreate_productImageCreate_product_variants_stocks_warehouse;
}
export interface ProductImageCreate_productImageCreate_product_variants {
__typename: "ProductVariant";
price: ProductImageCreate_productImageCreate_product_variants_price | null;
id: string;
sku: string;
name: string;
margin: number | null;
stocks: (ProductImageCreate_productImageCreate_product_variants_stocks | null)[] | null;
trackInventory: boolean;
}
export interface ProductImageCreate_productImageCreate_product_category { export interface ProductImageCreate_productImageCreate_product_category {
__typename: "Category"; __typename: "Category";
id: string; id: string;
@ -143,42 +174,12 @@ export interface ProductImageCreate_productImageCreate_product_images {
url: string; url: string;
} }
export interface ProductImageCreate_productImageCreate_product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductImageCreate_productImageCreate_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductImageCreate_productImageCreate_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductImageCreate_productImageCreate_product_variants_stocks_warehouse;
}
export interface ProductImageCreate_productImageCreate_product_variants {
__typename: "ProductVariant";
id: string;
sku: string;
name: string;
price: ProductImageCreate_productImageCreate_product_variants_price | null;
margin: number | null;
stocks: (ProductImageCreate_productImageCreate_product_variants_stocks | null)[] | null;
trackInventory: boolean;
}
export interface ProductImageCreate_productImageCreate_product { export interface ProductImageCreate_productImageCreate_product {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: ProductImageCreate_productImageCreate_product_attributes[]; attributes: ProductImageCreate_productImageCreate_product_attributes[];
productType: ProductImageCreate_productImageCreate_product_productType; productType: ProductImageCreate_productImageCreate_product_productType;
variants: (ProductImageCreate_productImageCreate_product_variants | null)[] | null;
name: string; name: string;
descriptionJson: any; descriptionJson: any;
seoTitle: string | null; seoTitle: string | null;
@ -193,7 +194,6 @@ export interface ProductImageCreate_productImageCreate_product {
publicationDate: any | null; publicationDate: any | null;
pricing: ProductImageCreate_productImageCreate_product_pricing | null; pricing: ProductImageCreate_productImageCreate_product_pricing | null;
images: (ProductImageCreate_productImageCreate_product_images | null)[] | null; images: (ProductImageCreate_productImageCreate_product_images | null)[] | null;
variants: (ProductImageCreate_productImageCreate_product_variants | null)[] | null;
} }
export interface ProductImageCreate_productImageCreate { export interface ProductImageCreate_productImageCreate {

View file

@ -66,6 +66,37 @@ export interface ProductImageUpdate_productImageUpdate_product_productType {
hasVariants: boolean; hasVariants: boolean;
} }
export interface ProductImageUpdate_productImageUpdate_product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductImageUpdate_productImageUpdate_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductImageUpdate_productImageUpdate_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductImageUpdate_productImageUpdate_product_variants_stocks_warehouse;
}
export interface ProductImageUpdate_productImageUpdate_product_variants {
__typename: "ProductVariant";
price: ProductImageUpdate_productImageUpdate_product_variants_price | null;
id: string;
sku: string;
name: string;
margin: number | null;
stocks: (ProductImageUpdate_productImageUpdate_product_variants_stocks | null)[] | null;
trackInventory: boolean;
}
export interface ProductImageUpdate_productImageUpdate_product_category { export interface ProductImageUpdate_productImageUpdate_product_category {
__typename: "Category"; __typename: "Category";
id: string; id: string;
@ -143,42 +174,12 @@ export interface ProductImageUpdate_productImageUpdate_product_images {
url: string; url: string;
} }
export interface ProductImageUpdate_productImageUpdate_product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductImageUpdate_productImageUpdate_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductImageUpdate_productImageUpdate_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductImageUpdate_productImageUpdate_product_variants_stocks_warehouse;
}
export interface ProductImageUpdate_productImageUpdate_product_variants {
__typename: "ProductVariant";
id: string;
sku: string;
name: string;
price: ProductImageUpdate_productImageUpdate_product_variants_price | null;
margin: number | null;
stocks: (ProductImageUpdate_productImageUpdate_product_variants_stocks | null)[] | null;
trackInventory: boolean;
}
export interface ProductImageUpdate_productImageUpdate_product { export interface ProductImageUpdate_productImageUpdate_product {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: ProductImageUpdate_productImageUpdate_product_attributes[]; attributes: ProductImageUpdate_productImageUpdate_product_attributes[];
productType: ProductImageUpdate_productImageUpdate_product_productType; productType: ProductImageUpdate_productImageUpdate_product_productType;
variants: (ProductImageUpdate_productImageUpdate_product_variants | null)[] | null;
name: string; name: string;
descriptionJson: any; descriptionJson: any;
seoTitle: string | null; seoTitle: string | null;
@ -193,7 +194,6 @@ export interface ProductImageUpdate_productImageUpdate_product {
publicationDate: any | null; publicationDate: any | null;
pricing: ProductImageUpdate_productImageUpdate_product_pricing | null; pricing: ProductImageUpdate_productImageUpdate_product_pricing | null;
images: (ProductImageUpdate_productImageUpdate_product_images | null)[] | null; images: (ProductImageUpdate_productImageUpdate_product_images | null)[] | null;
variants: (ProductImageUpdate_productImageUpdate_product_variants | null)[] | null;
} }
export interface ProductImageUpdate_productImageUpdate { export interface ProductImageUpdate_productImageUpdate {

View file

@ -66,6 +66,37 @@ export interface ProductUpdate_productUpdate_product_productType {
hasVariants: boolean; hasVariants: boolean;
} }
export interface ProductUpdate_productUpdate_product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductUpdate_productUpdate_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductUpdate_productUpdate_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductUpdate_productUpdate_product_variants_stocks_warehouse;
}
export interface ProductUpdate_productUpdate_product_variants {
__typename: "ProductVariant";
price: ProductUpdate_productUpdate_product_variants_price | null;
id: string;
sku: string;
name: string;
margin: number | null;
stocks: (ProductUpdate_productUpdate_product_variants_stocks | null)[] | null;
trackInventory: boolean;
}
export interface ProductUpdate_productUpdate_product_category { export interface ProductUpdate_productUpdate_product_category {
__typename: "Category"; __typename: "Category";
id: string; id: string;
@ -143,42 +174,12 @@ export interface ProductUpdate_productUpdate_product_images {
url: string; url: string;
} }
export interface ProductUpdate_productUpdate_product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductUpdate_productUpdate_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductUpdate_productUpdate_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductUpdate_productUpdate_product_variants_stocks_warehouse;
}
export interface ProductUpdate_productUpdate_product_variants {
__typename: "ProductVariant";
id: string;
sku: string;
name: string;
price: ProductUpdate_productUpdate_product_variants_price | null;
margin: number | null;
stocks: (ProductUpdate_productUpdate_product_variants_stocks | null)[] | null;
trackInventory: boolean;
}
export interface ProductUpdate_productUpdate_product { export interface ProductUpdate_productUpdate_product {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: ProductUpdate_productUpdate_product_attributes[]; attributes: ProductUpdate_productUpdate_product_attributes[];
productType: ProductUpdate_productUpdate_product_productType; productType: ProductUpdate_productUpdate_product_productType;
variants: (ProductUpdate_productUpdate_product_variants | null)[] | null;
name: string; name: string;
descriptionJson: any; descriptionJson: any;
seoTitle: string | null; seoTitle: string | null;
@ -193,7 +194,6 @@ export interface ProductUpdate_productUpdate_product {
publicationDate: any | null; publicationDate: any | null;
pricing: ProductUpdate_productUpdate_product_pricing | null; pricing: ProductUpdate_productUpdate_product_pricing | null;
images: (ProductUpdate_productUpdate_product_images | null)[] | null; images: (ProductUpdate_productUpdate_product_images | null)[] | null;
variants: (ProductUpdate_productUpdate_product_variants | null)[] | null;
} }
export interface ProductUpdate_productUpdate { export interface ProductUpdate_productUpdate {

View file

@ -58,9 +58,21 @@ export interface ProductVariantAttributesFragment_productType {
variantAttributes: (ProductVariantAttributesFragment_productType_variantAttributes | null)[] | null; variantAttributes: (ProductVariantAttributesFragment_productType_variantAttributes | null)[] | null;
} }
export interface ProductVariantAttributesFragment_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductVariantAttributesFragment_variants {
__typename: "ProductVariant";
price: ProductVariantAttributesFragment_variants_price | null;
}
export interface ProductVariantAttributesFragment { export interface ProductVariantAttributesFragment {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: ProductVariantAttributesFragment_attributes[]; attributes: ProductVariantAttributesFragment_attributes[];
productType: ProductVariantAttributesFragment_productType; productType: ProductVariantAttributesFragment_productType;
variants: (ProductVariantAttributesFragment_variants | null)[] | null;
} }

View file

@ -66,6 +66,37 @@ export interface SimpleProductUpdate_productUpdate_product_productType {
hasVariants: boolean; hasVariants: boolean;
} }
export interface SimpleProductUpdate_productUpdate_product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface SimpleProductUpdate_productUpdate_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface SimpleProductUpdate_productUpdate_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: SimpleProductUpdate_productUpdate_product_variants_stocks_warehouse;
}
export interface SimpleProductUpdate_productUpdate_product_variants {
__typename: "ProductVariant";
price: SimpleProductUpdate_productUpdate_product_variants_price | null;
id: string;
sku: string;
name: string;
margin: number | null;
stocks: (SimpleProductUpdate_productUpdate_product_variants_stocks | null)[] | null;
trackInventory: boolean;
}
export interface SimpleProductUpdate_productUpdate_product_category { export interface SimpleProductUpdate_productUpdate_product_category {
__typename: "Category"; __typename: "Category";
id: string; id: string;
@ -143,42 +174,12 @@ export interface SimpleProductUpdate_productUpdate_product_images {
url: string; url: string;
} }
export interface SimpleProductUpdate_productUpdate_product_variants_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface SimpleProductUpdate_productUpdate_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface SimpleProductUpdate_productUpdate_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: SimpleProductUpdate_productUpdate_product_variants_stocks_warehouse;
}
export interface SimpleProductUpdate_productUpdate_product_variants {
__typename: "ProductVariant";
id: string;
sku: string;
name: string;
price: SimpleProductUpdate_productUpdate_product_variants_price | null;
margin: number | null;
stocks: (SimpleProductUpdate_productUpdate_product_variants_stocks | null)[] | null;
trackInventory: boolean;
}
export interface SimpleProductUpdate_productUpdate_product { export interface SimpleProductUpdate_productUpdate_product {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: SimpleProductUpdate_productUpdate_product_attributes[]; attributes: SimpleProductUpdate_productUpdate_product_attributes[];
productType: SimpleProductUpdate_productUpdate_product_productType; productType: SimpleProductUpdate_productUpdate_product_productType;
variants: (SimpleProductUpdate_productUpdate_product_variants | null)[] | null;
name: string; name: string;
descriptionJson: any; descriptionJson: any;
seoTitle: string | null; seoTitle: string | null;
@ -193,7 +194,6 @@ export interface SimpleProductUpdate_productUpdate_product {
publicationDate: any | null; publicationDate: any | null;
pricing: SimpleProductUpdate_productUpdate_product_pricing | null; pricing: SimpleProductUpdate_productUpdate_product_pricing | null;
images: (SimpleProductUpdate_productUpdate_product_images | null)[] | null; images: (SimpleProductUpdate_productUpdate_product_images | null)[] | null;
variants: (SimpleProductUpdate_productUpdate_product_variants | null)[] | null;
} }
export interface SimpleProductUpdate_productUpdate { export interface SimpleProductUpdate_productUpdate {

View file

@ -51,7 +51,7 @@ const ProductVariantCreator: React.FC<ProductVariantCreatorProps> = ({
})} })}
/> />
<ProductVariantCreatorPage <ProductVariantCreatorPage
defaultPrice={data?.product?.basePrice.amount.toString()} defaultPrice={data?.product?.variants[0].price.amount.toString()}
errors={ errors={
bulkProductVariantCreateOpts.data?.productVariantBulkCreate.errors || bulkProductVariantCreateOpts.data?.productVariantBulkCreate.errors ||
[] []