Merge pull request #597 from mirumee/fix/minor-bugs
Add weight field and fix warehouse country selection
This commit is contained in:
commit
d90015af1d
44 changed files with 2348 additions and 92 deletions
|
@ -4,6 +4,8 @@ All notable, unreleased changes to this project will be documented in this file.
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
- Add weight field and fix warehouse country selection - #597 by @dominik-zeglen
|
||||||
|
|
||||||
## 2.10.0
|
## 2.10.0
|
||||||
|
|
||||||
- Fix minor bugs - #244 by @dominik-zeglen
|
- Fix minor bugs - #244 by @dominik-zeglen
|
||||||
|
|
|
@ -3606,6 +3606,14 @@
|
||||||
"src_dot_products_dot_components_dot_ProductPricing_dot_3015886868": {
|
"src_dot_products_dot_components_dot_ProductPricing_dot_3015886868": {
|
||||||
"string": "Charge taxes for this item"
|
"string": "Charge taxes for this item"
|
||||||
},
|
},
|
||||||
|
"src_dot_products_dot_components_dot_ProductShipping_dot_1325966144": {
|
||||||
|
"context": "product shipping",
|
||||||
|
"string": "Shipping"
|
||||||
|
},
|
||||||
|
"src_dot_products_dot_components_dot_ProductShipping_dot_746695941": {
|
||||||
|
"context": "product weight",
|
||||||
|
"string": "Weight"
|
||||||
|
},
|
||||||
"src_dot_products_dot_components_dot_ProductStocks_dot_2585918415": {
|
"src_dot_products_dot_components_dot_ProductStocks_dot_2585918415": {
|
||||||
"string": "SKU (Stock Keeping Unit)"
|
"string": "SKU (Stock Keeping Unit)"
|
||||||
},
|
},
|
||||||
|
@ -3643,14 +3651,6 @@
|
||||||
"src_dot_products_dot_components_dot_ProductUpdatePage_dot_2706108815": {
|
"src_dot_products_dot_components_dot_ProductUpdatePage_dot_2706108815": {
|
||||||
"string": "Add search engine title and description to make this product easier to find"
|
"string": "Add search engine title and description to make this product easier to find"
|
||||||
},
|
},
|
||||||
"src_dot_products_dot_components_dot_ProductVariantAttributes_dot_1536841622": {
|
|
||||||
"context": "product attribute error",
|
|
||||||
"string": "All attributes should have value"
|
|
||||||
},
|
|
||||||
"src_dot_products_dot_components_dot_ProductVariantAttributes_dot_258966189": {
|
|
||||||
"context": "product attribute error",
|
|
||||||
"string": "This variant already exists"
|
|
||||||
},
|
|
||||||
"src_dot_products_dot_components_dot_ProductVariantCreatePage_dot_2853608829": {
|
"src_dot_products_dot_components_dot_ProductVariantCreatePage_dot_2853608829": {
|
||||||
"context": "button",
|
"context": "button",
|
||||||
"string": "Save variant"
|
"string": "Save variant"
|
||||||
|
@ -5032,6 +5032,10 @@
|
||||||
"src_dot_utils_dot_errors_dot_attributeCannotBeAssigned": {
|
"src_dot_utils_dot_errors_dot_attributeCannotBeAssigned": {
|
||||||
"string": "This attribute cannot be assigned to this product type"
|
"string": "This attribute cannot be assigned to this product type"
|
||||||
},
|
},
|
||||||
|
"src_dot_utils_dot_errors_dot_attributeRequired": {
|
||||||
|
"context": "product attribute error",
|
||||||
|
"string": "All attributes should have value"
|
||||||
|
},
|
||||||
"src_dot_utils_dot_errors_dot_attributeVariantsDisabled": {
|
"src_dot_utils_dot_errors_dot_attributeVariantsDisabled": {
|
||||||
"string": "Variants are disabled in this product type"
|
"string": "Variants are disabled in this product type"
|
||||||
},
|
},
|
||||||
|
@ -5136,6 +5140,10 @@
|
||||||
"src_dot_utils_dot_errors_dot_variantNoDigitalContent": {
|
"src_dot_utils_dot_errors_dot_variantNoDigitalContent": {
|
||||||
"string": "This variant does not have any digital content"
|
"string": "This variant does not have any digital content"
|
||||||
},
|
},
|
||||||
|
"src_dot_utils_dot_errors_dot_variantUnique": {
|
||||||
|
"context": "product attribute error",
|
||||||
|
"string": "This variant already exists"
|
||||||
|
},
|
||||||
"src_dot_vouchers": {
|
"src_dot_vouchers": {
|
||||||
"context": "vouchers section name",
|
"context": "vouchers section name",
|
||||||
"string": "Vouchers"
|
"string": "Vouchers"
|
||||||
|
|
|
@ -79,14 +79,16 @@ export const TimelineNote: React.FC<TimelineNoteProps> = props => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.root}>
|
<div className={classes.root}>
|
||||||
<Avatar
|
{user && (
|
||||||
className={classes.avatar}
|
<Avatar
|
||||||
style={{ background: palette[CRC.str(user.email) % palette.length] }}
|
className={classes.avatar}
|
||||||
>
|
style={{ background: palette[CRC.str(user.email) % palette.length] }}
|
||||||
<PersonIcon />
|
>
|
||||||
</Avatar>
|
<PersonIcon />
|
||||||
|
</Avatar>
|
||||||
|
)}
|
||||||
<div className={classes.title}>
|
<div className={classes.title}>
|
||||||
<Typography>{user.email}</Typography>
|
<Typography>{user?.email}</Typography>
|
||||||
<Typography>
|
<Typography>
|
||||||
<DateTime date={date} />
|
<DateTime date={date} />
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
|
@ -59,6 +59,10 @@ export function decimal(value: string | number) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function weight(value: string) {
|
||||||
|
return value === "" ? null : parseFloat(value);
|
||||||
|
}
|
||||||
|
|
||||||
export const removeDoubleSlashes = (url: string) =>
|
export const removeDoubleSlashes = (url: string) =>
|
||||||
url.replace(/([^:]\/)\/+/g, "$1");
|
url.replace(/([^:]\/)\/+/g, "$1");
|
||||||
|
|
||||||
|
|
|
@ -825,6 +825,30 @@ export const order = (placeholder: string): OrderDetails_order => ({
|
||||||
email: "admin@example.com",
|
email: "admin@example.com",
|
||||||
id: "QWRkcmVzczoxNQ=="
|
id: "QWRkcmVzczoxNQ=="
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
__typename: "OrderEvent",
|
||||||
|
amount: null,
|
||||||
|
date: "2019-09-17T13:22:24.376193+00:00",
|
||||||
|
email: null,
|
||||||
|
emailType: null,
|
||||||
|
id: "T3JkZXJFdmVudDo0",
|
||||||
|
message: "This is note",
|
||||||
|
quantity: null,
|
||||||
|
type: OrderEventsEnum.NOTE_ADDED,
|
||||||
|
user: null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
__typename: "OrderEvent",
|
||||||
|
amount: null,
|
||||||
|
date: "2019-09-17T13:22:24.376193+00:00",
|
||||||
|
email: null,
|
||||||
|
emailType: null,
|
||||||
|
id: "T3JkZXJFdmVudDo1",
|
||||||
|
message: "This is note",
|
||||||
|
quantity: null,
|
||||||
|
type: OrderEventsEnum.NOTE_ADDED,
|
||||||
|
user: null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
fulfillments: [
|
fulfillments: [
|
||||||
|
|
|
@ -105,7 +105,7 @@ const ProductTypeCreatePage: React.FC<ProductTypeCreatePageProps> = ({
|
||||||
<ProductTypeShipping
|
<ProductTypeShipping
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
data={data}
|
data={data}
|
||||||
defaultWeightUnit={defaultWeightUnit}
|
weightUnit={defaultWeightUnit}
|
||||||
onChange={change}
|
onChange={change}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -199,7 +199,7 @@ const ProductTypeDetailsPage: React.FC<ProductTypeDetailsPageProps> = ({
|
||||||
<ProductTypeShipping
|
<ProductTypeShipping
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
data={data}
|
data={data}
|
||||||
defaultWeightUnit={defaultWeightUnit}
|
weightUnit={productType?.weight?.unit || defaultWeightUnit}
|
||||||
onChange={change}
|
onChange={change}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,21 +6,20 @@ import { useIntl } from "react-intl";
|
||||||
|
|
||||||
import CardTitle from "@saleor/components/CardTitle";
|
import CardTitle from "@saleor/components/CardTitle";
|
||||||
import { ControlledCheckbox } from "@saleor/components/ControlledCheckbox";
|
import { ControlledCheckbox } from "@saleor/components/ControlledCheckbox";
|
||||||
import { WeightUnitsEnum } from "../../../types/globalTypes";
|
|
||||||
|
|
||||||
interface ProductTypeShippingProps {
|
interface ProductTypeShippingProps {
|
||||||
data: {
|
data: {
|
||||||
isShippingRequired: boolean;
|
isShippingRequired: boolean;
|
||||||
weight: number | null;
|
weight: number | null;
|
||||||
};
|
};
|
||||||
defaultWeightUnit: WeightUnitsEnum;
|
weightUnit: string;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
onChange: (event: React.ChangeEvent<any>) => void;
|
onChange: (event: React.ChangeEvent<any>) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProductTypeShipping: React.FC<ProductTypeShippingProps> = ({
|
const ProductTypeShipping: React.FC<ProductTypeShippingProps> = ({
|
||||||
data,
|
data,
|
||||||
defaultWeightUnit,
|
weightUnit,
|
||||||
disabled,
|
disabled,
|
||||||
onChange
|
onChange
|
||||||
}) => {
|
}) => {
|
||||||
|
@ -48,7 +47,7 @@ const ProductTypeShipping: React.FC<ProductTypeShippingProps> = ({
|
||||||
{data.isShippingRequired && (
|
{data.isShippingRequired && (
|
||||||
<TextField
|
<TextField
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
InputProps={{ endAdornment: defaultWeightUnit }}
|
InputProps={{ endAdornment: weightUnit }}
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
defaultMessage: "Weight"
|
defaultMessage: "Weight"
|
||||||
})}
|
})}
|
||||||
|
|
|
@ -43,6 +43,7 @@ import ProductDetailsForm from "../ProductDetailsForm";
|
||||||
import ProductOrganization from "../ProductOrganization";
|
import ProductOrganization from "../ProductOrganization";
|
||||||
import ProductPricing from "../ProductPricing";
|
import ProductPricing from "../ProductPricing";
|
||||||
import ProductStocks, { ProductStockInput } from "../ProductStocks";
|
import ProductStocks, { ProductStockInput } from "../ProductStocks";
|
||||||
|
import ProductShipping from "../ProductShipping/ProductShipping";
|
||||||
|
|
||||||
interface FormData {
|
interface FormData {
|
||||||
basePrice: number;
|
basePrice: number;
|
||||||
|
@ -59,6 +60,7 @@ interface FormData {
|
||||||
sku: string;
|
sku: string;
|
||||||
stockQuantity: number;
|
stockQuantity: number;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: string;
|
||||||
}
|
}
|
||||||
export interface ProductCreatePageSubmitData extends FormData {
|
export interface ProductCreatePageSubmitData extends FormData {
|
||||||
attributes: ProductAttributeInput[];
|
attributes: ProductAttributeInput[];
|
||||||
|
@ -82,6 +84,7 @@ interface ProductCreatePageProps {
|
||||||
}>;
|
}>;
|
||||||
header: string;
|
header: string;
|
||||||
saveButtonBarState: ConfirmButtonTransitionState;
|
saveButtonBarState: ConfirmButtonTransitionState;
|
||||||
|
weightUnit: string;
|
||||||
warehouses: SearchWarehouses_search_edges_node[];
|
warehouses: SearchWarehouses_search_edges_node[];
|
||||||
fetchCategories: (data: string) => void;
|
fetchCategories: (data: string) => void;
|
||||||
fetchCollections: (data: string) => void;
|
fetchCollections: (data: string) => void;
|
||||||
|
@ -107,6 +110,7 @@ export const ProductCreatePage: React.FC<ProductCreatePageProps> = ({
|
||||||
warehouses,
|
warehouses,
|
||||||
onBack,
|
onBack,
|
||||||
fetchProductTypes,
|
fetchProductTypes,
|
||||||
|
weightUnit,
|
||||||
onSubmit
|
onSubmit
|
||||||
}: ProductCreatePageProps) => {
|
}: ProductCreatePageProps) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
@ -143,7 +147,8 @@ export const ProductCreatePage: React.FC<ProductCreatePageProps> = ({
|
||||||
seoTitle: "",
|
seoTitle: "",
|
||||||
sku: null,
|
sku: null,
|
||||||
stockQuantity: null,
|
stockQuantity: null,
|
||||||
trackInventory: false
|
trackInventory: false,
|
||||||
|
weight: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
// Display values
|
// Display values
|
||||||
|
@ -242,6 +247,14 @@ export const ProductCreatePage: React.FC<ProductCreatePageProps> = ({
|
||||||
<CardSpacer />
|
<CardSpacer />
|
||||||
{!!productType && !productType.hasVariants && (
|
{!!productType && !productType.hasVariants && (
|
||||||
<>
|
<>
|
||||||
|
<ProductShipping
|
||||||
|
data={data}
|
||||||
|
disabled={disabled}
|
||||||
|
errors={errors}
|
||||||
|
weightUnit={weightUnit}
|
||||||
|
onChange={change}
|
||||||
|
/>
|
||||||
|
<CardSpacer />
|
||||||
<ProductStocks
|
<ProductStocks
|
||||||
data={data}
|
data={data}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
|
65
src/products/components/ProductShipping/ProductShipping.tsx
Normal file
65
src/products/components/ProductShipping/ProductShipping.tsx
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
import Card from "@material-ui/core/Card";
|
||||||
|
import CardContent from "@material-ui/core/CardContent";
|
||||||
|
import InputAdornment from "@material-ui/core/InputAdornment";
|
||||||
|
import TextField from "@material-ui/core/TextField";
|
||||||
|
import CardTitle from "@saleor/components/CardTitle";
|
||||||
|
import Grid from "@saleor/components/Grid";
|
||||||
|
import { getFormErrors, getProductErrorMessage } from "@saleor/utils/errors";
|
||||||
|
import React from "react";
|
||||||
|
import { useIntl } from "react-intl";
|
||||||
|
import { ProductErrorFragment } from "@saleor/attributes/types/ProductErrorFragment";
|
||||||
|
|
||||||
|
interface ProductShippingProps {
|
||||||
|
data: {
|
||||||
|
weight: string;
|
||||||
|
};
|
||||||
|
disabled: boolean;
|
||||||
|
errors: ProductErrorFragment[];
|
||||||
|
weightUnit: string;
|
||||||
|
onChange: (event: React.ChangeEvent<any>) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ProductShipping: React.FC<ProductShippingProps> = props => {
|
||||||
|
const { data, disabled, errors, weightUnit, onChange } = props;
|
||||||
|
|
||||||
|
const intl = useIntl();
|
||||||
|
|
||||||
|
const formErrors = getFormErrors(["weight"], errors);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card>
|
||||||
|
<CardTitle
|
||||||
|
title={intl.formatMessage({
|
||||||
|
defaultMessage: "Shipping",
|
||||||
|
description: "product shipping"
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
<CardContent>
|
||||||
|
<Grid variant="uniform">
|
||||||
|
<TextField
|
||||||
|
disabled={disabled}
|
||||||
|
label={intl.formatMessage({
|
||||||
|
defaultMessage: "Weight",
|
||||||
|
description: "product weight"
|
||||||
|
})}
|
||||||
|
error={!!formErrors.weight}
|
||||||
|
helperText={getProductErrorMessage(formErrors.weight, intl)}
|
||||||
|
name="weight"
|
||||||
|
value={data.weight}
|
||||||
|
onChange={onChange}
|
||||||
|
InputProps={{
|
||||||
|
endAdornment: (
|
||||||
|
<InputAdornment position="end">{weightUnit}</InputAdornment>
|
||||||
|
),
|
||||||
|
inputProps: {
|
||||||
|
min: 0
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
ProductShipping.displayName = "ProductShipping";
|
||||||
|
export default ProductShipping;
|
0
src/products/components/ProductShipping/index.ts
Normal file
0
src/products/components/ProductShipping/index.ts
Normal file
|
@ -50,8 +50,10 @@ import ProductOrganization from "../ProductOrganization";
|
||||||
import ProductPricing from "../ProductPricing";
|
import ProductPricing from "../ProductPricing";
|
||||||
import ProductVariants from "../ProductVariants";
|
import ProductVariants from "../ProductVariants";
|
||||||
import ProductStocks, { ProductStockInput } from "../ProductStocks";
|
import ProductStocks, { ProductStockInput } from "../ProductStocks";
|
||||||
|
import ProductShipping from "../ProductShipping/ProductShipping";
|
||||||
|
|
||||||
export interface ProductUpdatePageProps extends ListActions {
|
export interface ProductUpdatePageProps extends ListActions {
|
||||||
|
defaultWeightUnit: string;
|
||||||
errors: ProductErrorFragment[];
|
errors: ProductErrorFragment[];
|
||||||
placeholderImage: string;
|
placeholderImage: string;
|
||||||
collections: SearchCollections_search_edges_node[];
|
collections: SearchCollections_search_edges_node[];
|
||||||
|
@ -89,6 +91,7 @@ export interface ProductUpdatePageSubmitData extends ProductUpdatePageFormData {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
|
export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
|
||||||
|
defaultWeightUnit,
|
||||||
disabled,
|
disabled,
|
||||||
categories: categoryChoiceList,
|
categories: categoryChoiceList,
|
||||||
collections: collectionChoiceList,
|
collections: collectionChoiceList,
|
||||||
|
@ -269,33 +272,43 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
|
||||||
toggleAll={toggleAll}
|
toggleAll={toggleAll}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<ProductStocks
|
<>
|
||||||
data={data}
|
<ProductShipping
|
||||||
disabled={disabled}
|
data={data}
|
||||||
errors={errors}
|
disabled={disabled}
|
||||||
stocks={stocks}
|
errors={errors}
|
||||||
warehouses={warehouses}
|
weightUnit={product?.weight?.unit || defaultWeightUnit}
|
||||||
onChange={(id, value) => {
|
onChange={change}
|
||||||
triggerChange();
|
/>
|
||||||
changeStockData(id, value);
|
<CardSpacer />
|
||||||
}}
|
<ProductStocks
|
||||||
onFormDataChange={change}
|
data={data}
|
||||||
onWarehouseStockAdd={id => {
|
disabled={disabled}
|
||||||
triggerChange();
|
errors={errors}
|
||||||
addStock({
|
stocks={stocks}
|
||||||
data: null,
|
warehouses={warehouses}
|
||||||
id,
|
onChange={(id, value) => {
|
||||||
label: warehouses.find(
|
triggerChange();
|
||||||
warehouse => warehouse.id === id
|
changeStockData(id, value);
|
||||||
).name,
|
}}
|
||||||
value: "0"
|
onFormDataChange={change}
|
||||||
});
|
onWarehouseStockAdd={id => {
|
||||||
}}
|
triggerChange();
|
||||||
onWarehouseStockDelete={id => {
|
addStock({
|
||||||
triggerChange();
|
data: null,
|
||||||
removeStock(id);
|
id,
|
||||||
}}
|
label: warehouses.find(
|
||||||
/>
|
warehouse => warehouse.id === id
|
||||||
|
).name,
|
||||||
|
value: "0"
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
onWarehouseStockDelete={id => {
|
||||||
|
triggerChange();
|
||||||
|
removeStock(id);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
<CardSpacer />
|
<CardSpacer />
|
||||||
<SeoForm
|
<SeoForm
|
||||||
|
|
|
@ -2,7 +2,7 @@ import Card from "@material-ui/core/Card";
|
||||||
import CardContent from "@material-ui/core/CardContent";
|
import CardContent from "@material-ui/core/CardContent";
|
||||||
import Typography from "@material-ui/core/Typography";
|
import Typography from "@material-ui/core/Typography";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { IntlShape, useIntl } from "react-intl";
|
import { useIntl } from "react-intl";
|
||||||
|
|
||||||
import CardTitle from "@saleor/components/CardTitle";
|
import CardTitle from "@saleor/components/CardTitle";
|
||||||
import FormSpacer from "@saleor/components/FormSpacer";
|
import FormSpacer from "@saleor/components/FormSpacer";
|
||||||
|
@ -14,7 +14,7 @@ import Skeleton from "@saleor/components/Skeleton";
|
||||||
import { FormsetAtomicData, FormsetChange } from "@saleor/hooks/useFormset";
|
import { FormsetAtomicData, FormsetChange } from "@saleor/hooks/useFormset";
|
||||||
import { commonMessages } from "@saleor/intl";
|
import { commonMessages } from "@saleor/intl";
|
||||||
import { VariantCreate_productVariantCreate_errors } from "@saleor/products/types/VariantCreate";
|
import { VariantCreate_productVariantCreate_errors } from "@saleor/products/types/VariantCreate";
|
||||||
import { ProductErrorCode } from "@saleor/types/globalTypes";
|
import { getProductVariantAttributeErrorMessage } from "@saleor/utils/errors/product";
|
||||||
import { ProductVariant_attributes_attribute_values } from "../../types/ProductVariant";
|
import { ProductVariant_attributes_attribute_values } from "../../types/ProductVariant";
|
||||||
|
|
||||||
export interface VariantAttributeInputData {
|
export interface VariantAttributeInputData {
|
||||||
|
@ -67,19 +67,6 @@ function getAttributeValueChoices(
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function translateErrors(intl: IntlShape) {
|
|
||||||
return {
|
|
||||||
[ProductErrorCode.REQUIRED]: intl.formatMessage({
|
|
||||||
defaultMessage: "All attributes should have value",
|
|
||||||
description: "product attribute error"
|
|
||||||
}),
|
|
||||||
[ProductErrorCode.UNIQUE]: intl.formatMessage({
|
|
||||||
defaultMessage: "This variant already exists",
|
|
||||||
description: "product attribute error"
|
|
||||||
})
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const ProductVariantAttributes: React.FC<ProductVariantAttributesProps> = ({
|
const ProductVariantAttributes: React.FC<ProductVariantAttributesProps> = ({
|
||||||
attributes,
|
attributes,
|
||||||
disabled,
|
disabled,
|
||||||
|
@ -88,8 +75,6 @@ const ProductVariantAttributes: React.FC<ProductVariantAttributesProps> = ({
|
||||||
}) => {
|
}) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
const translatedErrors = translateErrors(intl);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<CardTitle
|
<CardTitle
|
||||||
|
@ -127,7 +112,7 @@ const ProductVariantAttributes: React.FC<ProductVariantAttributesProps> = ({
|
||||||
.filter(error => error.field === "attributes")
|
.filter(error => error.field === "attributes")
|
||||||
.map(error => (
|
.map(error => (
|
||||||
<Typography color="error" key={error.code}>
|
<Typography color="error" key={error.code}>
|
||||||
{translatedErrors[error.code]}
|
{getProductVariantAttributeErrorMessage(error, intl)}
|
||||||
</Typography>
|
</Typography>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -18,6 +18,7 @@ import { ProductErrorFragment } from "@saleor/attributes/types/ProductErrorFragm
|
||||||
import { SearchWarehouses_search_edges_node } from "@saleor/searches/types/SearchWarehouses";
|
import { SearchWarehouses_search_edges_node } from "@saleor/searches/types/SearchWarehouses";
|
||||||
import { maybe } from "../../../misc";
|
import { maybe } from "../../../misc";
|
||||||
import { ProductVariantCreateData_product } from "../../types/ProductVariantCreateData";
|
import { ProductVariantCreateData_product } from "../../types/ProductVariantCreateData";
|
||||||
|
import ProductShipping from "../ProductShipping/ProductShipping";
|
||||||
import ProductVariantAttributes, {
|
import ProductVariantAttributes, {
|
||||||
VariantAttributeInputData
|
VariantAttributeInputData
|
||||||
} from "../ProductVariantAttributes";
|
} from "../ProductVariantAttributes";
|
||||||
|
@ -32,6 +33,7 @@ interface ProductVariantCreatePageFormData {
|
||||||
quantity: string;
|
quantity: string;
|
||||||
sku: string;
|
sku: string;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductVariantCreatePageSubmitData
|
export interface ProductVariantCreatePageSubmitData
|
||||||
|
@ -48,6 +50,7 @@ interface ProductVariantCreatePageProps {
|
||||||
product: ProductVariantCreateData_product;
|
product: ProductVariantCreateData_product;
|
||||||
saveButtonBarState: ConfirmButtonTransitionState;
|
saveButtonBarState: ConfirmButtonTransitionState;
|
||||||
warehouses: SearchWarehouses_search_edges_node[];
|
warehouses: SearchWarehouses_search_edges_node[];
|
||||||
|
weightUnit: string;
|
||||||
onBack: () => void;
|
onBack: () => void;
|
||||||
onSubmit: (data: ProductVariantCreatePageSubmitData) => void;
|
onSubmit: (data: ProductVariantCreatePageSubmitData) => void;
|
||||||
onVariantClick: (variantId: string) => void;
|
onVariantClick: (variantId: string) => void;
|
||||||
|
@ -61,6 +64,7 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = ({
|
||||||
product,
|
product,
|
||||||
saveButtonBarState,
|
saveButtonBarState,
|
||||||
warehouses,
|
warehouses,
|
||||||
|
weightUnit,
|
||||||
onBack,
|
onBack,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
onVariantClick
|
onVariantClick
|
||||||
|
@ -86,7 +90,8 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = ({
|
||||||
priceOverride: "",
|
priceOverride: "",
|
||||||
quantity: "0",
|
quantity: "0",
|
||||||
sku: "",
|
sku: "",
|
||||||
trackInventory: true
|
trackInventory: true,
|
||||||
|
weight: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmit = (data: ProductVariantCreatePageFormData) =>
|
const handleSubmit = (data: ProductVariantCreatePageFormData) =>
|
||||||
|
@ -137,6 +142,14 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = ({
|
||||||
onChange={change}
|
onChange={change}
|
||||||
/>
|
/>
|
||||||
<CardSpacer />
|
<CardSpacer />
|
||||||
|
<ProductShipping
|
||||||
|
data={data}
|
||||||
|
disabled={disabled}
|
||||||
|
errors={errors}
|
||||||
|
weightUnit={weightUnit}
|
||||||
|
onChange={change}
|
||||||
|
/>
|
||||||
|
<CardSpacer />
|
||||||
<ProductStocks
|
<ProductStocks
|
||||||
data={data}
|
data={data}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import {
|
||||||
import { WarehouseFragment } from "@saleor/warehouses/types/WarehouseFragment";
|
import { WarehouseFragment } from "@saleor/warehouses/types/WarehouseFragment";
|
||||||
import { maybe } from "../../../misc";
|
import { maybe } from "../../../misc";
|
||||||
import { ProductVariant } from "../../types/ProductVariant";
|
import { ProductVariant } from "../../types/ProductVariant";
|
||||||
|
import ProductShipping from "../ProductShipping/ProductShipping";
|
||||||
import ProductVariantAttributes, {
|
import ProductVariantAttributes, {
|
||||||
VariantAttributeInputData
|
VariantAttributeInputData
|
||||||
} from "../ProductVariantAttributes";
|
} from "../ProductVariantAttributes";
|
||||||
|
@ -35,6 +36,7 @@ export interface ProductVariantPageFormData {
|
||||||
priceOverride: string;
|
priceOverride: string;
|
||||||
sku: string;
|
sku: string;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductVariantPageSubmitData
|
export interface ProductVariantPageSubmitData
|
||||||
|
@ -46,6 +48,7 @@ export interface ProductVariantPageSubmitData
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ProductVariantPageProps {
|
interface ProductVariantPageProps {
|
||||||
|
defaultWeightUnit: string;
|
||||||
variant?: ProductVariant;
|
variant?: ProductVariant;
|
||||||
errors: VariantUpdate_productVariantUpdate_errors[];
|
errors: VariantUpdate_productVariantUpdate_errors[];
|
||||||
saveButtonBarState: ConfirmButtonTransitionState;
|
saveButtonBarState: ConfirmButtonTransitionState;
|
||||||
|
@ -62,6 +65,7 @@ interface ProductVariantPageProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
|
const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
|
||||||
|
defaultWeightUnit,
|
||||||
errors,
|
errors,
|
||||||
loading,
|
loading,
|
||||||
header,
|
header,
|
||||||
|
@ -112,7 +116,8 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
|
||||||
costPrice: maybe(() => variant.costPrice.amount.toString(), ""),
|
costPrice: maybe(() => variant.costPrice.amount.toString(), ""),
|
||||||
priceOverride: maybe(() => variant.priceOverride.amount.toString(), ""),
|
priceOverride: maybe(() => variant.priceOverride.amount.toString(), ""),
|
||||||
sku: maybe(() => variant.sku, ""),
|
sku: maybe(() => variant.sku, ""),
|
||||||
trackInventory: variant?.trackInventory
|
trackInventory: variant?.trackInventory,
|
||||||
|
weight: variant?.weight?.value.toString() || ""
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmit = (data: ProductVariantPageFormData) => {
|
const handleSubmit = (data: ProductVariantPageFormData) => {
|
||||||
|
@ -195,6 +200,14 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
|
||||||
onChange={change}
|
onChange={change}
|
||||||
/>
|
/>
|
||||||
<CardSpacer />
|
<CardSpacer />
|
||||||
|
<ProductShipping
|
||||||
|
data={data}
|
||||||
|
disabled={loading}
|
||||||
|
errors={errors}
|
||||||
|
weightUnit={variant?.weight?.unit || defaultWeightUnit}
|
||||||
|
onChange={change}
|
||||||
|
/>
|
||||||
|
<CardSpacer />
|
||||||
<ProductStocks
|
<ProductStocks
|
||||||
data={data}
|
data={data}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
|
|
|
@ -277,7 +277,12 @@ export const product: (
|
||||||
warehouse: warehouseList[1]
|
warehouse: warehouseList[1]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
trackInventory: true
|
trackInventory: true,
|
||||||
|
weight: {
|
||||||
|
__typename: "Weight",
|
||||||
|
unit: "kg",
|
||||||
|
value: 3
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: "ProductVariant",
|
__typename: "ProductVariant",
|
||||||
|
@ -307,9 +312,19 @@ export const product: (
|
||||||
warehouse: warehouseList[0]
|
warehouse: warehouseList[0]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
trackInventory: false
|
trackInventory: false,
|
||||||
|
weight: {
|
||||||
|
__typename: "Weight",
|
||||||
|
unit: "kg",
|
||||||
|
value: 4
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
weight: {
|
||||||
|
__typename: "Weight",
|
||||||
|
unit: "kg",
|
||||||
|
value: 5
|
||||||
|
}
|
||||||
});
|
});
|
||||||
export const products = (
|
export const products = (
|
||||||
placeholderImage: string
|
placeholderImage: string
|
||||||
|
@ -1275,7 +1290,12 @@ export const variant = (placeholderImage: string): ProductVariant => ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
trackInventory: true
|
trackInventory: true,
|
||||||
|
weight: {
|
||||||
|
__typename: "Weight",
|
||||||
|
unit: "kg",
|
||||||
|
value: 6
|
||||||
|
}
|
||||||
});
|
});
|
||||||
export const variantImages = (placeholderImage: string) =>
|
export const variantImages = (placeholderImage: string) =>
|
||||||
variant(placeholderImage).images;
|
variant(placeholderImage).images;
|
||||||
|
|
|
@ -206,6 +206,7 @@ export const simpleProductUpdateMutation = gql`
|
||||||
$addStocks: [StockInput!]!
|
$addStocks: [StockInput!]!
|
||||||
$deleteStocks: [ID!]!
|
$deleteStocks: [ID!]!
|
||||||
$updateStocks: [StockInput!]!
|
$updateStocks: [StockInput!]!
|
||||||
|
$weight: WeightScalar
|
||||||
) {
|
) {
|
||||||
productUpdate(
|
productUpdate(
|
||||||
id: $id
|
id: $id
|
||||||
|
@ -220,6 +221,7 @@ export const simpleProductUpdateMutation = gql`
|
||||||
name: $name
|
name: $name
|
||||||
basePrice: $basePrice
|
basePrice: $basePrice
|
||||||
seo: $seo
|
seo: $seo
|
||||||
|
weight: $weight
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
errors: productErrors {
|
errors: productErrors {
|
||||||
|
@ -295,6 +297,7 @@ export const productCreateMutation = gql`
|
||||||
$seo: SeoInput
|
$seo: SeoInput
|
||||||
$stocks: [StockInput!]!
|
$stocks: [StockInput!]!
|
||||||
$trackInventory: Boolean!
|
$trackInventory: Boolean!
|
||||||
|
$weight: WeightScalar
|
||||||
) {
|
) {
|
||||||
productCreate(
|
productCreate(
|
||||||
input: {
|
input: {
|
||||||
|
@ -312,6 +315,7 @@ export const productCreateMutation = gql`
|
||||||
seo: $seo
|
seo: $seo
|
||||||
stocks: $stocks
|
stocks: $stocks
|
||||||
trackInventory: $trackInventory
|
trackInventory: $trackInventory
|
||||||
|
weight: $weight
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
errors: productErrors {
|
errors: productErrors {
|
||||||
|
@ -360,6 +364,7 @@ export const variantUpdateMutation = gql`
|
||||||
$sku: String
|
$sku: String
|
||||||
$trackInventory: Boolean!
|
$trackInventory: Boolean!
|
||||||
$stocks: [StockInput!]!
|
$stocks: [StockInput!]!
|
||||||
|
$weight: WeightScalar
|
||||||
) {
|
) {
|
||||||
productVariantUpdate(
|
productVariantUpdate(
|
||||||
id: $id
|
id: $id
|
||||||
|
@ -369,6 +374,7 @@ export const variantUpdateMutation = gql`
|
||||||
priceOverride: $priceOverride
|
priceOverride: $priceOverride
|
||||||
sku: $sku
|
sku: $sku
|
||||||
trackInventory: $trackInventory
|
trackInventory: $trackInventory
|
||||||
|
weight: $weight
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
errors: productErrors {
|
errors: productErrors {
|
||||||
|
|
|
@ -185,12 +185,20 @@ export const productFragmentDetails = gql`
|
||||||
...StockFragment
|
...StockFragment
|
||||||
}
|
}
|
||||||
trackInventory
|
trackInventory
|
||||||
|
weight {
|
||||||
|
unit
|
||||||
|
value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
productType {
|
productType {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
hasVariants
|
hasVariants
|
||||||
}
|
}
|
||||||
|
weight {
|
||||||
|
unit
|
||||||
|
value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -253,6 +261,10 @@ export const fragmentVariant = gql`
|
||||||
...StockFragment
|
...StockFragment
|
||||||
}
|
}
|
||||||
trackInventory
|
trackInventory
|
||||||
|
weight {
|
||||||
|
unit
|
||||||
|
value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,12 @@ export interface Product_variants_stocks {
|
||||||
warehouse: Product_variants_stocks_warehouse;
|
warehouse: Product_variants_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Product_variants_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Product_variants {
|
export interface Product_variants {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -172,6 +178,13 @@ export interface Product_variants {
|
||||||
margin: number | null;
|
margin: number | null;
|
||||||
stocks: (Product_variants_stocks | null)[] | null;
|
stocks: (Product_variants_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: Product_variants_weight | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Product_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Product {
|
export interface Product {
|
||||||
|
@ -195,4 +208,5 @@ export interface Product {
|
||||||
pricing: Product_pricing | null;
|
pricing: Product_pricing | null;
|
||||||
images: (Product_images | null)[] | null;
|
images: (Product_images | null)[] | null;
|
||||||
variants: (Product_variants | null)[] | null;
|
variants: (Product_variants | null)[] | null;
|
||||||
|
weight: Product_weight | null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,6 +169,12 @@ export interface ProductCreate_productCreate_product_variants_stocks {
|
||||||
warehouse: ProductCreate_productCreate_product_variants_stocks_warehouse;
|
warehouse: ProductCreate_productCreate_product_variants_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProductCreate_productCreate_product_variants_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProductCreate_productCreate_product_variants {
|
export interface ProductCreate_productCreate_product_variants {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -178,6 +184,13 @@ export interface ProductCreate_productCreate_product_variants {
|
||||||
margin: number | null;
|
margin: number | null;
|
||||||
stocks: (ProductCreate_productCreate_product_variants_stocks | null)[] | null;
|
stocks: (ProductCreate_productCreate_product_variants_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: ProductCreate_productCreate_product_variants_weight | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductCreate_productCreate_product_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductCreate_productCreate_product {
|
export interface ProductCreate_productCreate_product {
|
||||||
|
@ -201,6 +214,7 @@ export interface ProductCreate_productCreate_product {
|
||||||
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;
|
variants: (ProductCreate_productCreate_product_variants | null)[] | null;
|
||||||
|
weight: ProductCreate_productCreate_product_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductCreate_productCreate {
|
export interface ProductCreate_productCreate {
|
||||||
|
@ -228,4 +242,5 @@ export interface ProductCreateVariables {
|
||||||
seo?: SeoInput | null;
|
seo?: SeoInput | null;
|
||||||
stocks: StockInput[];
|
stocks: StockInput[];
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight?: any | null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,6 +163,12 @@ export interface ProductDetails_product_variants_stocks {
|
||||||
warehouse: ProductDetails_product_variants_stocks_warehouse;
|
warehouse: ProductDetails_product_variants_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProductDetails_product_variants_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProductDetails_product_variants {
|
export interface ProductDetails_product_variants {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -172,6 +178,13 @@ export interface ProductDetails_product_variants {
|
||||||
margin: number | null;
|
margin: number | null;
|
||||||
stocks: (ProductDetails_product_variants_stocks | null)[] | null;
|
stocks: (ProductDetails_product_variants_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: ProductDetails_product_variants_weight | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductDetails_product_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductDetails_product {
|
export interface ProductDetails_product {
|
||||||
|
@ -195,6 +208,7 @@ export interface ProductDetails_product {
|
||||||
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;
|
variants: (ProductDetails_product_variants | null)[] | null;
|
||||||
|
weight: ProductDetails_product_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductDetails {
|
export interface ProductDetails {
|
||||||
|
|
|
@ -169,6 +169,12 @@ export interface ProductImageCreate_productImageCreate_product_variants_stocks {
|
||||||
warehouse: ProductImageCreate_productImageCreate_product_variants_stocks_warehouse;
|
warehouse: ProductImageCreate_productImageCreate_product_variants_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProductImageCreate_productImageCreate_product_variants_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProductImageCreate_productImageCreate_product_variants {
|
export interface ProductImageCreate_productImageCreate_product_variants {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -178,6 +184,13 @@ export interface ProductImageCreate_productImageCreate_product_variants {
|
||||||
margin: number | null;
|
margin: number | null;
|
||||||
stocks: (ProductImageCreate_productImageCreate_product_variants_stocks | null)[] | null;
|
stocks: (ProductImageCreate_productImageCreate_product_variants_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: ProductImageCreate_productImageCreate_product_variants_weight | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductImageCreate_productImageCreate_product_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductImageCreate_productImageCreate_product {
|
export interface ProductImageCreate_productImageCreate_product {
|
||||||
|
@ -201,6 +214,7 @@ export interface ProductImageCreate_productImageCreate_product {
|
||||||
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;
|
variants: (ProductImageCreate_productImageCreate_product_variants | null)[] | null;
|
||||||
|
weight: ProductImageCreate_productImageCreate_product_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductImageCreate_productImageCreate {
|
export interface ProductImageCreate_productImageCreate {
|
||||||
|
|
|
@ -169,6 +169,12 @@ export interface ProductImageUpdate_productImageUpdate_product_variants_stocks {
|
||||||
warehouse: ProductImageUpdate_productImageUpdate_product_variants_stocks_warehouse;
|
warehouse: ProductImageUpdate_productImageUpdate_product_variants_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProductImageUpdate_productImageUpdate_product_variants_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProductImageUpdate_productImageUpdate_product_variants {
|
export interface ProductImageUpdate_productImageUpdate_product_variants {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -178,6 +184,13 @@ export interface ProductImageUpdate_productImageUpdate_product_variants {
|
||||||
margin: number | null;
|
margin: number | null;
|
||||||
stocks: (ProductImageUpdate_productImageUpdate_product_variants_stocks | null)[] | null;
|
stocks: (ProductImageUpdate_productImageUpdate_product_variants_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: ProductImageUpdate_productImageUpdate_product_variants_weight | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductImageUpdate_productImageUpdate_product_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductImageUpdate_productImageUpdate_product {
|
export interface ProductImageUpdate_productImageUpdate_product {
|
||||||
|
@ -201,6 +214,7 @@ export interface ProductImageUpdate_productImageUpdate_product {
|
||||||
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;
|
variants: (ProductImageUpdate_productImageUpdate_product_variants | null)[] | null;
|
||||||
|
weight: ProductImageUpdate_productImageUpdate_product_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductImageUpdate_productImageUpdate {
|
export interface ProductImageUpdate_productImageUpdate {
|
||||||
|
|
|
@ -169,6 +169,12 @@ export interface ProductUpdate_productUpdate_product_variants_stocks {
|
||||||
warehouse: ProductUpdate_productUpdate_product_variants_stocks_warehouse;
|
warehouse: ProductUpdate_productUpdate_product_variants_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProductUpdate_productUpdate_product_variants_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProductUpdate_productUpdate_product_variants {
|
export interface ProductUpdate_productUpdate_product_variants {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -178,6 +184,13 @@ export interface ProductUpdate_productUpdate_product_variants {
|
||||||
margin: number | null;
|
margin: number | null;
|
||||||
stocks: (ProductUpdate_productUpdate_product_variants_stocks | null)[] | null;
|
stocks: (ProductUpdate_productUpdate_product_variants_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: ProductUpdate_productUpdate_product_variants_weight | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProductUpdate_productUpdate_product_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductUpdate_productUpdate_product {
|
export interface ProductUpdate_productUpdate_product {
|
||||||
|
@ -201,6 +214,7 @@ export interface ProductUpdate_productUpdate_product {
|
||||||
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;
|
variants: (ProductUpdate_productUpdate_product_variants | null)[] | null;
|
||||||
|
weight: ProductUpdate_productUpdate_product_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductUpdate_productUpdate {
|
export interface ProductUpdate_productUpdate {
|
||||||
|
|
|
@ -103,6 +103,12 @@ export interface ProductVariant_stocks {
|
||||||
warehouse: ProductVariant_stocks_warehouse;
|
warehouse: ProductVariant_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProductVariant_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProductVariant {
|
export interface ProductVariant {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -115,4 +121,5 @@ export interface ProductVariant {
|
||||||
sku: string;
|
sku: string;
|
||||||
stocks: (ProductVariant_stocks | null)[] | null;
|
stocks: (ProductVariant_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: ProductVariant_weight | null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,12 @@ export interface ProductVariantDetails_productVariant_stocks {
|
||||||
warehouse: ProductVariantDetails_productVariant_stocks_warehouse;
|
warehouse: ProductVariantDetails_productVariant_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProductVariantDetails_productVariant_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ProductVariantDetails_productVariant {
|
export interface ProductVariantDetails_productVariant {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -115,6 +121,7 @@ export interface ProductVariantDetails_productVariant {
|
||||||
sku: string;
|
sku: string;
|
||||||
stocks: (ProductVariantDetails_productVariant_stocks | null)[] | null;
|
stocks: (ProductVariantDetails_productVariant_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: ProductVariantDetails_productVariant_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductVariantDetails {
|
export interface ProductVariantDetails {
|
||||||
|
|
|
@ -169,6 +169,12 @@ export interface SimpleProductUpdate_productUpdate_product_variants_stocks {
|
||||||
warehouse: SimpleProductUpdate_productUpdate_product_variants_stocks_warehouse;
|
warehouse: SimpleProductUpdate_productUpdate_product_variants_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SimpleProductUpdate_productUpdate_product_variants_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface SimpleProductUpdate_productUpdate_product_variants {
|
export interface SimpleProductUpdate_productUpdate_product_variants {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -178,6 +184,13 @@ export interface SimpleProductUpdate_productUpdate_product_variants {
|
||||||
margin: number | null;
|
margin: number | null;
|
||||||
stocks: (SimpleProductUpdate_productUpdate_product_variants_stocks | null)[] | null;
|
stocks: (SimpleProductUpdate_productUpdate_product_variants_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: SimpleProductUpdate_productUpdate_product_variants_weight | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SimpleProductUpdate_productUpdate_product_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SimpleProductUpdate_productUpdate_product {
|
export interface SimpleProductUpdate_productUpdate_product {
|
||||||
|
@ -201,6 +214,7 @@ export interface SimpleProductUpdate_productUpdate_product {
|
||||||
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;
|
variants: (SimpleProductUpdate_productUpdate_product_variants | null)[] | null;
|
||||||
|
weight: SimpleProductUpdate_productUpdate_product_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SimpleProductUpdate_productUpdate {
|
export interface SimpleProductUpdate_productUpdate {
|
||||||
|
@ -312,6 +326,12 @@ export interface SimpleProductUpdate_productVariantUpdate_productVariant_stocks
|
||||||
warehouse: SimpleProductUpdate_productVariantUpdate_productVariant_stocks_warehouse;
|
warehouse: SimpleProductUpdate_productVariantUpdate_productVariant_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SimpleProductUpdate_productVariantUpdate_productVariant_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface SimpleProductUpdate_productVariantUpdate_productVariant {
|
export interface SimpleProductUpdate_productVariantUpdate_productVariant {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -324,6 +344,7 @@ export interface SimpleProductUpdate_productVariantUpdate_productVariant {
|
||||||
sku: string;
|
sku: string;
|
||||||
stocks: (SimpleProductUpdate_productVariantUpdate_productVariant_stocks | null)[] | null;
|
stocks: (SimpleProductUpdate_productVariantUpdate_productVariant_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: SimpleProductUpdate_productVariantUpdate_productVariant_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SimpleProductUpdate_productVariantUpdate {
|
export interface SimpleProductUpdate_productVariantUpdate {
|
||||||
|
@ -436,6 +457,12 @@ export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_s
|
||||||
warehouse: SimpleProductUpdate_productVariantStocksCreate_productVariant_stocks_warehouse;
|
warehouse: SimpleProductUpdate_productVariantStocksCreate_productVariant_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface SimpleProductUpdate_productVariantStocksCreate_productVariant {
|
export interface SimpleProductUpdate_productVariantStocksCreate_productVariant {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -448,6 +475,7 @@ export interface SimpleProductUpdate_productVariantStocksCreate_productVariant {
|
||||||
sku: string;
|
sku: string;
|
||||||
stocks: (SimpleProductUpdate_productVariantStocksCreate_productVariant_stocks | null)[] | null;
|
stocks: (SimpleProductUpdate_productVariantStocksCreate_productVariant_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: SimpleProductUpdate_productVariantStocksCreate_productVariant_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SimpleProductUpdate_productVariantStocksCreate {
|
export interface SimpleProductUpdate_productVariantStocksCreate {
|
||||||
|
@ -559,6 +587,12 @@ export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_s
|
||||||
warehouse: SimpleProductUpdate_productVariantStocksDelete_productVariant_stocks_warehouse;
|
warehouse: SimpleProductUpdate_productVariantStocksDelete_productVariant_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface SimpleProductUpdate_productVariantStocksDelete_productVariant {
|
export interface SimpleProductUpdate_productVariantStocksDelete_productVariant {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -571,6 +605,7 @@ export interface SimpleProductUpdate_productVariantStocksDelete_productVariant {
|
||||||
sku: string;
|
sku: string;
|
||||||
stocks: (SimpleProductUpdate_productVariantStocksDelete_productVariant_stocks | null)[] | null;
|
stocks: (SimpleProductUpdate_productVariantStocksDelete_productVariant_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: SimpleProductUpdate_productVariantStocksDelete_productVariant_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SimpleProductUpdate_productVariantStocksDelete {
|
export interface SimpleProductUpdate_productVariantStocksDelete {
|
||||||
|
@ -683,6 +718,12 @@ export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_s
|
||||||
warehouse: SimpleProductUpdate_productVariantStocksUpdate_productVariant_stocks_warehouse;
|
warehouse: SimpleProductUpdate_productVariantStocksUpdate_productVariant_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant {
|
export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -695,6 +736,7 @@ export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant {
|
||||||
sku: string;
|
sku: string;
|
||||||
stocks: (SimpleProductUpdate_productVariantStocksUpdate_productVariant_stocks | null)[] | null;
|
stocks: (SimpleProductUpdate_productVariantStocksUpdate_productVariant_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: SimpleProductUpdate_productVariantStocksUpdate_productVariant_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SimpleProductUpdate_productVariantStocksUpdate {
|
export interface SimpleProductUpdate_productVariantStocksUpdate {
|
||||||
|
@ -728,4 +770,5 @@ export interface SimpleProductUpdateVariables {
|
||||||
addStocks: StockInput[];
|
addStocks: StockInput[];
|
||||||
deleteStocks: string[];
|
deleteStocks: string[];
|
||||||
updateStocks: StockInput[];
|
updateStocks: StockInput[];
|
||||||
|
weight?: any | null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,12 @@ export interface VariantCreate_productVariantCreate_productVariant_stocks {
|
||||||
warehouse: VariantCreate_productVariantCreate_productVariant_stocks_warehouse;
|
warehouse: VariantCreate_productVariantCreate_productVariant_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface VariantCreate_productVariantCreate_productVariant_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface VariantCreate_productVariantCreate_productVariant {
|
export interface VariantCreate_productVariantCreate_productVariant {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -123,6 +129,7 @@ export interface VariantCreate_productVariantCreate_productVariant {
|
||||||
sku: string;
|
sku: string;
|
||||||
stocks: (VariantCreate_productVariantCreate_productVariant_stocks | null)[] | null;
|
stocks: (VariantCreate_productVariantCreate_productVariant_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: VariantCreate_productVariantCreate_productVariant_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VariantCreate_productVariantCreate {
|
export interface VariantCreate_productVariantCreate {
|
||||||
|
|
|
@ -111,6 +111,12 @@ export interface VariantImageAssign_variantImageAssign_productVariant_stocks {
|
||||||
warehouse: VariantImageAssign_variantImageAssign_productVariant_stocks_warehouse;
|
warehouse: VariantImageAssign_variantImageAssign_productVariant_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface VariantImageAssign_variantImageAssign_productVariant_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface VariantImageAssign_variantImageAssign_productVariant {
|
export interface VariantImageAssign_variantImageAssign_productVariant {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -123,6 +129,7 @@ export interface VariantImageAssign_variantImageAssign_productVariant {
|
||||||
sku: string;
|
sku: string;
|
||||||
stocks: (VariantImageAssign_variantImageAssign_productVariant_stocks | null)[] | null;
|
stocks: (VariantImageAssign_variantImageAssign_productVariant_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: VariantImageAssign_variantImageAssign_productVariant_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VariantImageAssign_variantImageAssign {
|
export interface VariantImageAssign_variantImageAssign {
|
||||||
|
|
|
@ -111,6 +111,12 @@ export interface VariantImageUnassign_variantImageUnassign_productVariant_stocks
|
||||||
warehouse: VariantImageUnassign_variantImageUnassign_productVariant_stocks_warehouse;
|
warehouse: VariantImageUnassign_variantImageUnassign_productVariant_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface VariantImageUnassign_variantImageUnassign_productVariant_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface VariantImageUnassign_variantImageUnassign_productVariant {
|
export interface VariantImageUnassign_variantImageUnassign_productVariant {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -123,6 +129,7 @@ export interface VariantImageUnassign_variantImageUnassign_productVariant {
|
||||||
sku: string;
|
sku: string;
|
||||||
stocks: (VariantImageUnassign_variantImageUnassign_productVariant_stocks | null)[] | null;
|
stocks: (VariantImageUnassign_variantImageUnassign_productVariant_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: VariantImageUnassign_variantImageUnassign_productVariant_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VariantImageUnassign_variantImageUnassign {
|
export interface VariantImageUnassign_variantImageUnassign {
|
||||||
|
|
|
@ -111,6 +111,12 @@ export interface VariantUpdate_productVariantUpdate_productVariant_stocks {
|
||||||
warehouse: VariantUpdate_productVariantUpdate_productVariant_stocks_warehouse;
|
warehouse: VariantUpdate_productVariantUpdate_productVariant_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface VariantUpdate_productVariantUpdate_productVariant_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface VariantUpdate_productVariantUpdate_productVariant {
|
export interface VariantUpdate_productVariantUpdate_productVariant {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -123,6 +129,7 @@ export interface VariantUpdate_productVariantUpdate_productVariant {
|
||||||
sku: string;
|
sku: string;
|
||||||
stocks: (VariantUpdate_productVariantUpdate_productVariant_stocks | null)[] | null;
|
stocks: (VariantUpdate_productVariantUpdate_productVariant_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: VariantUpdate_productVariantUpdate_productVariant_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VariantUpdate_productVariantUpdate {
|
export interface VariantUpdate_productVariantUpdate {
|
||||||
|
@ -235,6 +242,12 @@ export interface VariantUpdate_productVariantStocksUpdate_productVariant_stocks
|
||||||
warehouse: VariantUpdate_productVariantStocksUpdate_productVariant_stocks_warehouse;
|
warehouse: VariantUpdate_productVariantStocksUpdate_productVariant_stocks_warehouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface VariantUpdate_productVariantStocksUpdate_productVariant_weight {
|
||||||
|
__typename: "Weight";
|
||||||
|
unit: string;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface VariantUpdate_productVariantStocksUpdate_productVariant {
|
export interface VariantUpdate_productVariantStocksUpdate_productVariant {
|
||||||
__typename: "ProductVariant";
|
__typename: "ProductVariant";
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -247,6 +260,7 @@ export interface VariantUpdate_productVariantStocksUpdate_productVariant {
|
||||||
sku: string;
|
sku: string;
|
||||||
stocks: (VariantUpdate_productVariantStocksUpdate_productVariant_stocks | null)[] | null;
|
stocks: (VariantUpdate_productVariantStocksUpdate_productVariant_stocks | null)[] | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: VariantUpdate_productVariantStocksUpdate_productVariant_weight | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VariantUpdate_productVariantStocksUpdate {
|
export interface VariantUpdate_productVariantStocksUpdate {
|
||||||
|
@ -337,4 +351,5 @@ export interface VariantUpdateVariables {
|
||||||
sku?: string | null;
|
sku?: string | null;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
stocks: StockInput[];
|
stocks: StockInput[];
|
||||||
|
weight?: any | null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,6 +181,7 @@ export interface ProductUpdatePageFormData {
|
||||||
seoTitle: string;
|
seoTitle: string;
|
||||||
sku: string;
|
sku: string;
|
||||||
trackInventory: boolean;
|
trackInventory: boolean;
|
||||||
|
weight: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getProductUpdatePageFormData(
|
export function getProductUpdatePageFormData(
|
||||||
|
@ -210,7 +211,8 @@ export function getProductUpdatePageFormData(
|
||||||
: undefined,
|
: undefined,
|
||||||
""
|
""
|
||||||
),
|
),
|
||||||
trackInventory: !!product?.variants[0]?.trackInventory
|
trackInventory: !!product?.variants[0]?.trackInventory,
|
||||||
|
weight: product?.weight?.value.toString() || ""
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import useCategorySearch from "@saleor/searches/useCategorySearch";
|
||||||
import useCollectionSearch from "@saleor/searches/useCollectionSearch";
|
import useCollectionSearch from "@saleor/searches/useCollectionSearch";
|
||||||
import useProductTypeSearch from "@saleor/searches/useProductTypeSearch";
|
import useProductTypeSearch from "@saleor/searches/useProductTypeSearch";
|
||||||
import { useWarehouseList } from "@saleor/warehouses/queries";
|
import { useWarehouseList } from "@saleor/warehouses/queries";
|
||||||
import { decimal, maybe } from "../../misc";
|
import { decimal, maybe, weight } from "../../misc";
|
||||||
import ProductCreatePage, {
|
import ProductCreatePage, {
|
||||||
ProductCreatePageSubmitData
|
ProductCreatePageSubmitData
|
||||||
} from "../components/ProductCreatePage";
|
} from "../components/ProductCreatePage";
|
||||||
|
@ -95,7 +95,8 @@ export const ProductCreateView: React.FC = () => {
|
||||||
quantity: parseInt(stock.value, 0),
|
quantity: parseInt(stock.value, 0),
|
||||||
warehouse: stock.id
|
warehouse: stock.id
|
||||||
})),
|
})),
|
||||||
trackInventory: formData.trackInventory
|
trackInventory: formData.trackInventory,
|
||||||
|
weight: weight(formData.weight)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -157,6 +158,7 @@ export const ProductCreateView: React.FC = () => {
|
||||||
warehouses={
|
warehouses={
|
||||||
warehouses.data?.warehouses.edges.map(edge => edge.node) || []
|
warehouses.data?.warehouses.edges.map(edge => edge.node) || []
|
||||||
}
|
}
|
||||||
|
weightUnit={shop?.defaultWeightUnit}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
@ -17,6 +17,7 @@ import useCollectionSearch from "@saleor/searches/useCollectionSearch";
|
||||||
import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers";
|
import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers";
|
||||||
import NotFoundPage from "@saleor/components/NotFoundPage";
|
import NotFoundPage from "@saleor/components/NotFoundPage";
|
||||||
import { useWarehouseList } from "@saleor/warehouses/queries";
|
import { useWarehouseList } from "@saleor/warehouses/queries";
|
||||||
|
import useShop from "@saleor/hooks/useShop";
|
||||||
import { getMutationState, maybe } from "../../../misc";
|
import { getMutationState, maybe } from "../../../misc";
|
||||||
import ProductUpdatePage from "../../components/ProductUpdatePage";
|
import ProductUpdatePage from "../../components/ProductUpdatePage";
|
||||||
import ProductUpdateOperations from "../../containers/ProductUpdateOperations";
|
import ProductUpdateOperations from "../../containers/ProductUpdateOperations";
|
||||||
|
@ -75,6 +76,7 @@ export const ProductUpdate: React.FC<ProductUpdateProps> = ({ id, params }) => {
|
||||||
first: 50
|
first: 50
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const shop = useShop();
|
||||||
|
|
||||||
const [openModal, closeModal] = createDialogActionHandlers<
|
const [openModal, closeModal] = createDialogActionHandlers<
|
||||||
ProductUrlDialog,
|
ProductUrlDialog,
|
||||||
|
@ -213,6 +215,7 @@ export const ProductUpdate: React.FC<ProductUpdateProps> = ({ id, params }) => {
|
||||||
<ProductUpdatePage
|
<ProductUpdatePage
|
||||||
categories={categories}
|
categories={categories}
|
||||||
collections={collections}
|
collections={collections}
|
||||||
|
defaultWeightUnit={shop?.defaultWeightUnit}
|
||||||
disabled={disableFormSave}
|
disabled={disableFormSave}
|
||||||
errors={errors}
|
errors={errors}
|
||||||
fetchCategories={searchCategories}
|
fetchCategories={searchCategories}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { decimal } from "@saleor/misc";
|
import { decimal, weight } from "@saleor/misc";
|
||||||
import { ProductUpdatePageSubmitData } from "@saleor/products/components/ProductUpdatePage";
|
import { ProductUpdatePageSubmitData } from "@saleor/products/components/ProductUpdatePage";
|
||||||
import { ProductDetails_product } from "@saleor/products/types/ProductDetails";
|
import { ProductDetails_product } from "@saleor/products/types/ProductDetails";
|
||||||
import { ProductImageCreateVariables } from "@saleor/products/types/ProductImageCreate";
|
import { ProductImageCreateVariables } from "@saleor/products/types/ProductImageCreate";
|
||||||
|
@ -48,7 +48,8 @@ export function createUpdateHandler(
|
||||||
sku: data.sku,
|
sku: data.sku,
|
||||||
trackInventory: data.trackInventory
|
trackInventory: data.trackInventory
|
||||||
},
|
},
|
||||||
updateStocks: data.updateStocks.map(mapFormsetStockToStockInput)
|
updateStocks: data.updateStocks.map(mapFormsetStockToStockInput),
|
||||||
|
weight: weight(data.weight)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,8 @@ import { commonMessages } from "@saleor/intl";
|
||||||
import NotFoundPage from "@saleor/components/NotFoundPage";
|
import NotFoundPage from "@saleor/components/NotFoundPage";
|
||||||
import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers";
|
import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers";
|
||||||
import { useWarehouseList } from "@saleor/warehouses/queries";
|
import { useWarehouseList } from "@saleor/warehouses/queries";
|
||||||
import { decimal } from "../../misc";
|
import useShop from "@saleor/hooks/useShop";
|
||||||
|
import { decimal, weight } from "../../misc";
|
||||||
import ProductVariantDeleteDialog from "../components/ProductVariantDeleteDialog";
|
import ProductVariantDeleteDialog from "../components/ProductVariantDeleteDialog";
|
||||||
import ProductVariantPage, {
|
import ProductVariantPage, {
|
||||||
ProductVariantPageSubmitData
|
ProductVariantPageSubmitData
|
||||||
|
@ -40,6 +41,7 @@ export const ProductVariant: React.FC<ProductUpdateProps> = ({
|
||||||
productId,
|
productId,
|
||||||
params
|
params
|
||||||
}) => {
|
}) => {
|
||||||
|
const shop = useShop();
|
||||||
const navigate = useNavigator();
|
const navigate = useNavigator();
|
||||||
const notify = useNotifier();
|
const notify = useNotifier();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
@ -129,6 +131,7 @@ export const ProductVariant: React.FC<ProductUpdateProps> = ({
|
||||||
<>
|
<>
|
||||||
<WindowTitle title={data?.productVariant?.name} />
|
<WindowTitle title={data?.productVariant?.name} />
|
||||||
<ProductVariantPage
|
<ProductVariantPage
|
||||||
|
defaultWeightUnit={shop?.defaultWeightUnit}
|
||||||
errors={errors}
|
errors={errors}
|
||||||
saveButtonBarState={updateVariant.opts.status}
|
saveButtonBarState={updateVariant.opts.status}
|
||||||
loading={disableFormSave}
|
loading={disableFormSave}
|
||||||
|
@ -161,7 +164,8 @@ export const ProductVariant: React.FC<ProductUpdateProps> = ({
|
||||||
stocks: data.updateStocks.map(
|
stocks: data.updateStocks.map(
|
||||||
mapFormsetStockToStockInput
|
mapFormsetStockToStockInput
|
||||||
),
|
),
|
||||||
trackInventory: data.trackInventory
|
trackInventory: data.trackInventory,
|
||||||
|
weight: weight(data.weight)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
onVariantClick={variantId => {
|
onVariantClick={variantId => {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import useShop from "@saleor/hooks/useShop";
|
||||||
import NotFoundPage from "@saleor/components/NotFoundPage";
|
import NotFoundPage from "@saleor/components/NotFoundPage";
|
||||||
import { commonMessages } from "@saleor/intl";
|
import { commonMessages } from "@saleor/intl";
|
||||||
import { useWarehouseList } from "@saleor/warehouses/queries";
|
import { useWarehouseList } from "@saleor/warehouses/queries";
|
||||||
import { decimal } from "../../misc";
|
import { decimal, weight } from "../../misc";
|
||||||
import ProductVariantCreatePage, {
|
import ProductVariantCreatePage, {
|
||||||
ProductVariantCreatePageSubmitData
|
ProductVariantCreatePageSubmitData
|
||||||
} from "../components/ProductVariantCreatePage";
|
} from "../components/ProductVariantCreatePage";
|
||||||
|
@ -82,7 +82,8 @@ export const ProductVariant: React.FC<ProductVariantCreateProps> = ({
|
||||||
quantity: parseInt(stock.value, 0),
|
quantity: parseInt(stock.value, 0),
|
||||||
warehouse: stock.id
|
warehouse: stock.id
|
||||||
})),
|
})),
|
||||||
trackInventory: true
|
trackInventory: true,
|
||||||
|
weight: weight(formData.weight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -120,6 +121,7 @@ export const ProductVariant: React.FC<ProductVariantCreateProps> = ({
|
||||||
edge => edge.node
|
edge => edge.node
|
||||||
) || []
|
) || []
|
||||||
}
|
}
|
||||||
|
weightUnit={shop?.defaultWeightUnit}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -34,6 +34,7 @@ storiesOf("Views / Products / Create product", module)
|
||||||
onSubmit={() => undefined}
|
onSubmit={() => undefined}
|
||||||
saveButtonBarState="default"
|
saveButtonBarState="default"
|
||||||
warehouses={warehouseList}
|
warehouses={warehouseList}
|
||||||
|
weightUnit="kg"
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
.add("When loading", () => (
|
.add("When loading", () => (
|
||||||
|
@ -55,6 +56,7 @@ storiesOf("Views / Products / Create product", module)
|
||||||
onSubmit={() => undefined}
|
onSubmit={() => undefined}
|
||||||
saveButtonBarState="default"
|
saveButtonBarState="default"
|
||||||
warehouses={undefined}
|
warehouses={undefined}
|
||||||
|
weightUnit="kg"
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
.add("form errors", () => (
|
.add("form errors", () => (
|
||||||
|
@ -82,5 +84,6 @@ storiesOf("Views / Products / Create product", module)
|
||||||
onSubmit={() => undefined}
|
onSubmit={() => undefined}
|
||||||
saveButtonBarState="default"
|
saveButtonBarState="default"
|
||||||
warehouses={warehouseList}
|
warehouses={warehouseList}
|
||||||
|
weightUnit="kg"
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
|
|
@ -19,6 +19,7 @@ const props: ProductUpdatePageProps = {
|
||||||
...listActionsProps,
|
...listActionsProps,
|
||||||
categories: [product.category],
|
categories: [product.category],
|
||||||
collections,
|
collections,
|
||||||
|
defaultWeightUnit: "kg",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
errors: [],
|
errors: [],
|
||||||
fetchCategories: () => undefined,
|
fetchCategories: () => undefined,
|
||||||
|
|
|
@ -15,6 +15,7 @@ storiesOf("Views / Products / Create product variant", module)
|
||||||
.add("default", () => (
|
.add("default", () => (
|
||||||
<ProductVariantCreatePage
|
<ProductVariantCreatePage
|
||||||
currencySymbol="USD"
|
currencySymbol="USD"
|
||||||
|
weightUnit="kg"
|
||||||
disabled={false}
|
disabled={false}
|
||||||
errors={[]}
|
errors={[]}
|
||||||
header="Add variant"
|
header="Add variant"
|
||||||
|
@ -29,6 +30,7 @@ storiesOf("Views / Products / Create product variant", module)
|
||||||
.add("with errors", () => (
|
.add("with errors", () => (
|
||||||
<ProductVariantCreatePage
|
<ProductVariantCreatePage
|
||||||
currencySymbol="USD"
|
currencySymbol="USD"
|
||||||
|
weightUnit="kg"
|
||||||
disabled={false}
|
disabled={false}
|
||||||
errors={[
|
errors={[
|
||||||
{
|
{
|
||||||
|
@ -59,6 +61,7 @@ storiesOf("Views / Products / Create product variant", module)
|
||||||
.add("when loading data", () => (
|
.add("when loading data", () => (
|
||||||
<ProductVariantCreatePage
|
<ProductVariantCreatePage
|
||||||
currencySymbol="USD"
|
currencySymbol="USD"
|
||||||
|
weightUnit="kg"
|
||||||
disabled={true}
|
disabled={true}
|
||||||
errors={[]}
|
errors={[]}
|
||||||
header="Add variant"
|
header="Add variant"
|
||||||
|
@ -73,6 +76,7 @@ storiesOf("Views / Products / Create product variant", module)
|
||||||
.add("add first variant", () => (
|
.add("add first variant", () => (
|
||||||
<ProductVariantCreatePage
|
<ProductVariantCreatePage
|
||||||
currencySymbol="USD"
|
currencySymbol="USD"
|
||||||
|
weightUnit="kg"
|
||||||
disabled={false}
|
disabled={false}
|
||||||
errors={[]}
|
errors={[]}
|
||||||
header="Add variant"
|
header="Add variant"
|
||||||
|
|
|
@ -14,6 +14,7 @@ storiesOf("Views / Products / Product variant details", module)
|
||||||
.addDecorator(Decorator)
|
.addDecorator(Decorator)
|
||||||
.add("when loaded data", () => (
|
.add("when loaded data", () => (
|
||||||
<ProductVariantPage
|
<ProductVariantPage
|
||||||
|
defaultWeightUnit="kg"
|
||||||
header={variant.name || variant.sku}
|
header={variant.name || variant.sku}
|
||||||
errors={[]}
|
errors={[]}
|
||||||
variant={variant}
|
variant={variant}
|
||||||
|
@ -29,6 +30,7 @@ storiesOf("Views / Products / Product variant details", module)
|
||||||
))
|
))
|
||||||
.add("when loading data", () => (
|
.add("when loading data", () => (
|
||||||
<ProductVariantPage
|
<ProductVariantPage
|
||||||
|
defaultWeightUnit="kg"
|
||||||
header={undefined}
|
header={undefined}
|
||||||
errors={[]}
|
errors={[]}
|
||||||
loading={true}
|
loading={true}
|
||||||
|
@ -45,6 +47,7 @@ storiesOf("Views / Products / Product variant details", module)
|
||||||
))
|
))
|
||||||
.add("attribute errors", () => (
|
.add("attribute errors", () => (
|
||||||
<ProductVariantPage
|
<ProductVariantPage
|
||||||
|
defaultWeightUnit="kg"
|
||||||
header={variant.name || variant.sku}
|
header={variant.name || variant.sku}
|
||||||
variant={variant}
|
variant={variant}
|
||||||
onAdd={() => undefined}
|
onAdd={() => undefined}
|
||||||
|
|
|
@ -14,15 +14,26 @@ const messages = defineMessages({
|
||||||
attributeCannotBeAssigned: {
|
attributeCannotBeAssigned: {
|
||||||
defaultMessage: "This attribute cannot be assigned to this product type"
|
defaultMessage: "This attribute cannot be assigned to this product type"
|
||||||
},
|
},
|
||||||
|
attributeRequired: {
|
||||||
|
defaultMessage: "All attributes should have value",
|
||||||
|
description: "product attribute error"
|
||||||
|
},
|
||||||
attributeVariantsDisabled: {
|
attributeVariantsDisabled: {
|
||||||
defaultMessage: "Variants are disabled in this product type"
|
defaultMessage: "Variants are disabled in this product type"
|
||||||
},
|
},
|
||||||
|
duplicatedInputItem: {
|
||||||
|
defaultMessage: "Variant with these attributes already exists"
|
||||||
|
},
|
||||||
skuUnique: {
|
skuUnique: {
|
||||||
defaultMessage: "SKUs must be unique",
|
defaultMessage: "SKUs must be unique",
|
||||||
description: "bulk variant create error"
|
description: "bulk variant create error"
|
||||||
},
|
},
|
||||||
variantNoDigitalContent: {
|
variantNoDigitalContent: {
|
||||||
defaultMessage: "This variant does not have any digital content"
|
defaultMessage: "This variant does not have any digital content"
|
||||||
|
},
|
||||||
|
variantUnique: {
|
||||||
|
defaultMessage: "This variant already exists",
|
||||||
|
description: "product attribute error"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -38,6 +49,8 @@ function getProductErrorMessage(
|
||||||
return intl.formatMessage(messages.attributeCannotBeAssigned);
|
return intl.formatMessage(messages.attributeCannotBeAssigned);
|
||||||
case ProductErrorCode.ATTRIBUTE_VARIANTS_DISABLED:
|
case ProductErrorCode.ATTRIBUTE_VARIANTS_DISABLED:
|
||||||
return intl.formatMessage(messages.attributeVariantsDisabled);
|
return intl.formatMessage(messages.attributeVariantsDisabled);
|
||||||
|
case ProductErrorCode.DUPLICATED_INPUT_ITEM:
|
||||||
|
return intl.formatMessage(messages.duplicatedInputItem);
|
||||||
case ProductErrorCode.GRAPHQL_ERROR:
|
case ProductErrorCode.GRAPHQL_ERROR:
|
||||||
return intl.formatMessage(commonErrorMessages.graphqlError);
|
return intl.formatMessage(commonErrorMessages.graphqlError);
|
||||||
case ProductErrorCode.REQUIRED:
|
case ProductErrorCode.REQUIRED:
|
||||||
|
@ -54,6 +67,24 @@ function getProductErrorMessage(
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getProductVariantAttributeErrorMessage(
|
||||||
|
err: Omit<ProductErrorFragment, "__typename"> | undefined,
|
||||||
|
intl: IntlShape
|
||||||
|
): string {
|
||||||
|
if (err) {
|
||||||
|
switch (err.code) {
|
||||||
|
case ProductErrorCode.REQUIRED:
|
||||||
|
return intl.formatMessage(messages.attributeRequired);
|
||||||
|
case ProductErrorCode.UNIQUE:
|
||||||
|
return intl.formatMessage(messages.variantUnique);
|
||||||
|
default:
|
||||||
|
return getProductErrorMessage(err, intl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
export function getBulkProductErrorMessage(
|
export function getBulkProductErrorMessage(
|
||||||
err: BulkProductErrorFragment | undefined,
|
err: BulkProductErrorFragment | undefined,
|
||||||
intl: IntlShape
|
intl: IntlShape
|
||||||
|
|
|
@ -51,7 +51,9 @@ const WarehouseDetailsPage: React.FC<WarehouseDetailsPageProps> = ({
|
||||||
onSubmit
|
onSubmit
|
||||||
}) => {
|
}) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [displayCountry, setDisplayCountry] = useStateFromProps("");
|
const [displayCountry, setDisplayCountry] = useStateFromProps(
|
||||||
|
warehouse?.address?.country.country || ""
|
||||||
|
);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
errors: validationErrors,
|
errors: validationErrors,
|
||||||
|
|
Loading…
Reference in a new issue