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;
}
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 {
__typename: "Product";
id: string;
attributes: CreateMultipleVariantsData_product_attributes[];
productType: CreateMultipleVariantsData_product_productType;
variants: (CreateMultipleVariantsData_product_variants | null)[] | null;
}
export interface CreateMultipleVariantsData_warehouses_edges_node {

View file

@ -60,6 +60,37 @@ export interface Product_productType {
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 {
__typename: "Category";
id: string;
@ -137,42 +168,12 @@ export interface Product_images {
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 {
__typename: "Product";
id: string;
attributes: Product_attributes[];
productType: Product_productType;
variants: (Product_variants | null)[] | null;
name: string;
descriptionJson: any;
seoTitle: string | null;
@ -187,5 +188,4 @@ export interface Product {
publicationDate: any | null;
pricing: Product_pricing | 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;
}
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 {
__typename: "Category";
id: string;
@ -143,42 +174,12 @@ export interface ProductCreate_productCreate_product_images {
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 {
__typename: "Product";
id: string;
attributes: ProductCreate_productCreate_product_attributes[];
productType: ProductCreate_productCreate_product_productType;
variants: (ProductCreate_productCreate_product_variants | null)[] | null;
name: string;
descriptionJson: any;
seoTitle: string | null;
@ -193,7 +194,6 @@ export interface ProductCreate_productCreate_product {
publicationDate: any | null;
pricing: ProductCreate_productCreate_product_pricing | null;
images: (ProductCreate_productCreate_product_images | null)[] | null;
variants: (ProductCreate_productCreate_product_variants | null)[] | null;
}
export interface ProductCreate_productCreate {

View file

@ -60,6 +60,37 @@ export interface ProductDetails_product_productType {
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 {
__typename: "Category";
id: string;
@ -137,42 +168,12 @@ export interface ProductDetails_product_images {
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 {
__typename: "Product";
id: string;
attributes: ProductDetails_product_attributes[];
productType: ProductDetails_product_productType;
variants: (ProductDetails_product_variants | null)[] | null;
name: string;
descriptionJson: any;
seoTitle: string | null;
@ -187,7 +188,6 @@ export interface ProductDetails_product {
publicationDate: any | null;
pricing: ProductDetails_product_pricing | null;
images: (ProductDetails_product_images | null)[] | null;
variants: (ProductDetails_product_variants | null)[] | null;
}
export interface ProductDetails {

View file

@ -66,6 +66,37 @@ export interface ProductImageCreate_productImageCreate_product_productType {
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 {
__typename: "Category";
id: string;
@ -143,42 +174,12 @@ export interface ProductImageCreate_productImageCreate_product_images {
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 {
__typename: "Product";
id: string;
attributes: ProductImageCreate_productImageCreate_product_attributes[];
productType: ProductImageCreate_productImageCreate_product_productType;
variants: (ProductImageCreate_productImageCreate_product_variants | null)[] | null;
name: string;
descriptionJson: any;
seoTitle: string | null;
@ -193,7 +194,6 @@ export interface ProductImageCreate_productImageCreate_product {
publicationDate: any | null;
pricing: ProductImageCreate_productImageCreate_product_pricing | null;
images: (ProductImageCreate_productImageCreate_product_images | null)[] | null;
variants: (ProductImageCreate_productImageCreate_product_variants | null)[] | null;
}
export interface ProductImageCreate_productImageCreate {

View file

@ -66,6 +66,37 @@ export interface ProductImageUpdate_productImageUpdate_product_productType {
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 {
__typename: "Category";
id: string;
@ -143,42 +174,12 @@ export interface ProductImageUpdate_productImageUpdate_product_images {
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 {
__typename: "Product";
id: string;
attributes: ProductImageUpdate_productImageUpdate_product_attributes[];
productType: ProductImageUpdate_productImageUpdate_product_productType;
variants: (ProductImageUpdate_productImageUpdate_product_variants | null)[] | null;
name: string;
descriptionJson: any;
seoTitle: string | null;
@ -193,7 +194,6 @@ export interface ProductImageUpdate_productImageUpdate_product {
publicationDate: any | null;
pricing: ProductImageUpdate_productImageUpdate_product_pricing | null;
images: (ProductImageUpdate_productImageUpdate_product_images | null)[] | null;
variants: (ProductImageUpdate_productImageUpdate_product_variants | null)[] | null;
}
export interface ProductImageUpdate_productImageUpdate {

View file

@ -66,6 +66,37 @@ export interface ProductUpdate_productUpdate_product_productType {
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 {
__typename: "Category";
id: string;
@ -143,42 +174,12 @@ export interface ProductUpdate_productUpdate_product_images {
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 {
__typename: "Product";
id: string;
attributes: ProductUpdate_productUpdate_product_attributes[];
productType: ProductUpdate_productUpdate_product_productType;
variants: (ProductUpdate_productUpdate_product_variants | null)[] | null;
name: string;
descriptionJson: any;
seoTitle: string | null;
@ -193,7 +194,6 @@ export interface ProductUpdate_productUpdate_product {
publicationDate: any | null;
pricing: ProductUpdate_productUpdate_product_pricing | null;
images: (ProductUpdate_productUpdate_product_images | null)[] | null;
variants: (ProductUpdate_productUpdate_product_variants | null)[] | null;
}
export interface ProductUpdate_productUpdate {

View file

@ -58,9 +58,21 @@ export interface ProductVariantAttributesFragment_productType {
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 {
__typename: "Product";
id: string;
attributes: ProductVariantAttributesFragment_attributes[];
productType: ProductVariantAttributesFragment_productType;
variants: (ProductVariantAttributesFragment_variants | null)[] | null;
}

View file

@ -66,6 +66,37 @@ export interface SimpleProductUpdate_productUpdate_product_productType {
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 {
__typename: "Category";
id: string;
@ -143,42 +174,12 @@ export interface SimpleProductUpdate_productUpdate_product_images {
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 {
__typename: "Product";
id: string;
attributes: SimpleProductUpdate_productUpdate_product_attributes[];
productType: SimpleProductUpdate_productUpdate_product_productType;
variants: (SimpleProductUpdate_productUpdate_product_variants | null)[] | null;
name: string;
descriptionJson: any;
seoTitle: string | null;
@ -193,7 +194,6 @@ export interface SimpleProductUpdate_productUpdate_product {
publicationDate: any | null;
pricing: SimpleProductUpdate_productUpdate_product_pricing | null;
images: (SimpleProductUpdate_productUpdate_product_images | null)[] | null;
variants: (SimpleProductUpdate_productUpdate_product_variants | null)[] | null;
}
export interface SimpleProductUpdate_productUpdate {

View file

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