Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Use json fields

dominik-zeglen6b8614a193f3
diff --git a/saleor/static/dashboard-next/categories/components/CategoryDetailsForm/CategoryDetailsForm.tsx b/saleor/static/dashboard-next/categories/components/CategoryDetailsForm/CategoryDetailsForm.tsx
index a92751cd7b..93c4550868 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryDetailsForm/CategoryDetailsForm.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryDetailsForm/CategoryDetailsForm.tsx
@@ -60,8 +60,10 @@ export const CategoryDetailsForm = withStyles(styles, {
<FormSpacer />
<RichTextEditor
disabled={disabled}
+ error={!!errors.descriptionJson}
+ helperText={errors.descriptionJson}
label={i18n.t("Description")}
- initial={maybe(() => JSON.parse(category.description))}
+ initial={maybe(() => JSON.parse(category.descriptionJson))}
name="description"
onChange={onChange}
/>
diff --git a/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx b/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
index c39449d74f..2137adc615 100644
--- a/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
+++ b/saleor/static/dashboard-next/categories/components/CategoryUpdatePage/CategoryUpdatePage.tsx
@@ -92,7 +92,7 @@ export const CategoryUpdatePage: React.StatelessComponent<
const initialData: FormData = category
? {
backgroundImageAlt: maybe(() => category.backgroundImage.alt, ""),
- description: maybe(() => JSON.parse(category.description)),
+ description: maybe(() => JSON.parse(category.descriptionJson)),
name: category.name || "",
seoDescription: category.seoDescription || "",
seoTitle: category.seoTitle || ""
diff --git a/saleor/static/dashboard-next/categories/fixtures.ts b/saleor/static/dashboard-next/categories/fixtures.ts
index ede7283d70..a865375303 100644
--- a/saleor/static/dashboard-next/categories/fixtures.ts
+++ b/saleor/static/dashboard-next/categories/fixtures.ts
@@ -76,7 +76,7 @@ export const category: (
__typename: "CategoryCountableConnection",
edges: []
},
- description: JSON.stringify(content),
+ descriptionJson: JSON.stringify(content),
id: "Q2F0ZWdvcnk6NA==",
name: "Coffees",
parent: {
diff --git a/saleor/static/dashboard-next/categories/queries.ts b/saleor/static/dashboard-next/categories/queries.ts
index b721597f6e..6d3fc045f4 100644
--- a/saleor/static/dashboard-next/categories/queries.ts
+++ b/saleor/static/dashboard-next/categories/queries.ts
@@ -15,7 +15,7 @@ export const categoryDetailsFragment = gql`
url
}
name
- description
+ descriptionJson
seoDescription
seoTitle
parent {
diff --git a/saleor/static/dashboard-next/categories/types/CategoryCreate.ts b/saleor/static/dashboard-next/categories/types/CategoryCreate.ts
index a16cb681a4..80810b4ecd 100644
--- a/saleor/static/dashboard-next/categories/types/CategoryCreate.ts
+++ b/saleor/static/dashboard-next/categories/types/CategoryCreate.ts
@@ -29,7 +29,7 @@ export interface CategoryCreate_categoryCreate_category {
id: string;
backgroundImage: CategoryCreate_categoryCreate_category_backgroundImage | null;
name: string;
- description: string;
+ descriptionJson: any;
seoDescription: string | null;
seoTitle: string | null;
parent: CategoryCreate_categoryCreate_category_parent | null;
diff --git a/saleor/static/dashboard-next/categories/types/CategoryDetails.ts b/saleor/static/dashboard-next/categories/types/CategoryDetails.ts
index ffa8233e25..6b4f328193 100644
--- a/saleor/static/dashboard-next/categories/types/CategoryDetails.ts
+++ b/saleor/static/dashboard-next/categories/types/CategoryDetails.ts
@@ -101,7 +101,7 @@ export interface CategoryDetails_category {
id: string;
backgroundImage: CategoryDetails_category_backgroundImage | null;
name: string;
- description: string;
+ descriptionJson: any;
seoDescription: string | null;
seoTitle: string | null;
parent: CategoryDetails_category_parent | null;
diff --git a/saleor/static/dashboard-next/categories/types/CategoryDetailsFragment.ts b/saleor/static/dashboard-next/categories/types/CategoryDetailsFragment.ts
index c171f6b69f..703e4226d7 100644
--- a/saleor/static/dashboard-next/categories/types/CategoryDetailsFragment.ts
+++ b/saleor/static/dashboard-next/categories/types/CategoryDetailsFragment.ts
@@ -21,7 +21,7 @@ export interface CategoryDetailsFragment {
id: string;
backgroundImage: CategoryDetailsFragment_backgroundImage | null;
name: string;
- description: string;
+ descriptionJson: any;
seoDescription: string | null;
seoTitle: string | null;
parent: CategoryDetailsFragment_parent | null;
diff --git a/saleor/static/dashboard-next/categories/types/CategoryUpdate.ts b/saleor/static/dashboard-next/categories/types/CategoryUpdate.ts
index f730a4356e..a7a73a48bc 100644
--- a/saleor/static/dashboard-next/categories/types/CategoryUpdate.ts
+++ b/saleor/static/dashboard-next/categories/types/CategoryUpdate.ts
@@ -29,7 +29,7 @@ export interface CategoryUpdate_categoryUpdate_category {
id: string;
backgroundImage: CategoryUpdate_categoryUpdate_category_backgroundImage | null;
name: string;
- description: string;
+ descriptionJson: any;
seoDescription: string | null;
seoTitle: string | null;
parent: CategoryUpdate_categoryUpdate_category_parent | null;
diff --git a/saleor/static/dashboard-next/categories/views/CategoryCreate.tsx b/saleor/static/dashboard-next/categories/views/CategoryCreate.tsx
index 6c9292efa6..71fd3d5093 100644
--- a/saleor/static/dashboard-next/categories/views/CategoryCreate.tsx
+++ b/saleor/static/dashboard-next/categories/views/CategoryCreate.tsx
@@ -55,7 +55,9 @@ export const CategoryCreateView: React.StatelessComponent<
createCategory({
variables: {
input: {
- description: JSON.stringify(formData.description),
+ descriptionJson: JSON.stringify(
+ formData.description
+ ),
name: formData.name,
seo: {
description: formData.seoDescription,
diff --git a/saleor/static/dashboard-next/categories/views/CategoryDetails/index.tsx b/saleor/static/dashboard-next/categories/views/CategoryDetails/index.tsx
index b4eb3697d5..bf20acc98a 100644
--- a/saleor/static/dashboard-next/categories/views/CategoryDetails/index.tsx
+++ b/saleor/static/dashboard-next/categories/views/CategoryDetails/index.tsx
@@ -187,7 +187,7 @@ export const CategoryDetails: React.StatelessComponent<
input: {
backgroundImageAlt:
formData.backgroundImageAlt,
- description: JSON.stringify(
+ descriptionJson: JSON.stringify(
formData.description
),
name: formData.name,
diff --git a/saleor/static/dashboard-next/collections/components/CollectionDetails/CollectionDetails.tsx b/saleor/static/dashboard-next/collections/components/CollectionDetails/CollectionDetails.tsx
index 3322ade878..9e4ce096f4 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionDetails/CollectionDetails.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionDetails/CollectionDetails.tsx
@@ -10,6 +10,7 @@ import FormSpacer from "../../../components/FormSpacer";
import RichTextEditor from "../../../components/RichTextEditor";
import i18n from "../../../i18n";
import { maybe } from "../../../misc";
+import { FormErrors } from "../../../types";
import { CollectionDetails_collection } from "../../types/CollectionDetails";
const styles = createStyles({
@@ -25,9 +26,7 @@ export interface CollectionDetailsProps extends WithStyles<typeof styles> {
name: string;
};
disabled: boolean;
- errors: {
- name?: string;
- };
+ errors: FormErrors<"descriptionJson" | "name">;
onChange: (event: React.ChangeEvent<any>) => void;
}
@@ -55,7 +54,9 @@ const CollectionDetails = withStyles(styles, { name: "CollectionDetails" })(
/>
<FormSpacer />
<RichTextEditor
- initial={maybe(() => JSON.parse(collection.description))}
+ error={!!errors.descriptionJson}
+ helperText={errors.descriptionJson}
+ initial={maybe(() => JSON.parse(collection.descriptionJson))}
label={i18n.t("Description")}
name="description"
disabled={disabled}
diff --git a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
index 8f9b4e219c..4282609119 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
@@ -57,7 +57,7 @@ const CollectionDetailsPage: React.StatelessComponent<
<Form
initial={{
backgroundImageAlt: maybe(() => collection.backgroundImage.alt, ""),
- description: maybe(() => JSON.parse(collection.description)),
+ description: maybe(() => JSON.parse(collection.descriptionJson)),
isFeatured,
isPublished: maybe(() => collection.isPublished, false),
name: maybe(() => collection.name, ""),
diff --git a/saleor/static/dashboard-next/collections/fixtures.ts b/saleor/static/dashboard-next/collections/fixtures.ts
index 764de3ffdf..168f35b962 100644
--- a/saleor/static/dashboard-next/collections/fixtures.ts
+++ b/saleor/static/dashboard-next/collections/fixtures.ts
@@ -37,7 +37,7 @@ export const collection: (
alt: "Alt text",
url: placeholderCollectionImage
},
- description: JSON.stringify(content),
+ descriptionJson: JSON.stringify(content),
id: "Q29sbGVjdGlvbjox",
isPublished: true,
name: "Summer collection",
diff --git a/saleor/static/dashboard-next/collections/queries.ts b/saleor/static/dashboard-next/collections/queries.ts
index 36ec72d454..283a6ea8a1 100644
--- a/saleor/static/dashboard-next/collections/queries.ts
+++ b/saleor/static/dashboard-next/collections/queries.ts
@@ -26,7 +26,7 @@ export const collectionDetailsFragment = gql`
alt
url
}
- description
+ descriptionJson
seoDescription
seoTitle
isPublished
diff --git a/saleor/static/dashboard-next/collections/types/CollectionDetails.ts b/saleor/static/dashboard-next/collections/types/CollectionDetails.ts
index 171e93a9e3..6633f90fb4 100644
--- a/saleor/static/dashboard-next/collections/types/CollectionDetails.ts
+++ b/saleor/static/dashboard-next/collections/types/CollectionDetails.ts
@@ -56,7 +56,7 @@ export interface CollectionDetails_collection {
isPublished: boolean;
name: string;
backgroundImage: CollectionDetails_collection_backgroundImage | null;
- description: string;
+ descriptionJson: any;
seoDescription: string | null;
seoTitle: string | null;
products: CollectionDetails_collection_products | null;
diff --git a/saleor/static/dashboard-next/collections/types/CollectionDetailsFragment.ts b/saleor/static/dashboard-next/collections/types/CollectionDetailsFragment.ts
index fa08133b89..ce3d117fc5 100644
--- a/saleor/static/dashboard-next/collections/types/CollectionDetailsFragment.ts
+++ b/saleor/static/dashboard-next/collections/types/CollectionDetailsFragment.ts
@@ -17,7 +17,7 @@ export interface CollectionDetailsFragment {
isPublished: boolean;
name: string;
backgroundImage: CollectionDetailsFragment_backgroundImage | null;
- description: string;
+ descriptionJson: any;
seoDescription: string | null;
seoTitle: string | null;
}
diff --git a/saleor/static/dashboard-next/collections/types/CollectionUpdate.ts b/saleor/static/dashboard-next/collections/types/CollectionUpdate.ts
index f110f83a42..41ea11336f 100644
--- a/saleor/static/dashboard-next/collections/types/CollectionUpdate.ts
+++ b/saleor/static/dashboard-next/collections/types/CollectionUpdate.ts
@@ -25,7 +25,7 @@ export interface CollectionUpdate_collectionUpdate_collection {
isPublished: boolean;
name: string;
backgroundImage: CollectionUpdate_collectionUpdate_collection_backgroundImage | null;
- description: string;
+ descriptionJson: any;
seoDescription: string | null;
seoTitle: string | null;
}
diff --git a/saleor/static/dashboard-next/collections/types/CollectionUpdateWithHomepage.ts b/saleor/static/dashboard-next/collections/types/CollectionUpdateWithHomepage.ts
index d5bb095c07..c03ca05e45 100644
--- a/saleor/static/dashboard-next/collections/types/CollectionUpdateWithHomepage.ts
+++ b/saleor/static/dashboard-next/collections/types/CollectionUpdateWithHomepage.ts
@@ -47,7 +47,7 @@ export interface CollectionUpdateWithHomepage_collectionUpdate_collection {
isPublished: boolean;
name: string;
backgroundImage: CollectionUpdateWithHomepage_collectionUpdate_collection_backgroundImage | null;
- description: string;
+ descriptionJson: any;
seoDescription: string | null;
seoTitle: string | null;
}
diff --git a/saleor/static/dashboard-next/collections/types/CreateCollection.ts b/saleor/static/dashboard-next/collections/types/CreateCollection.ts
index 3e6f869df5..cc0d3ba746 100644
--- a/saleor/static/dashboard-next/collections/types/CreateCollection.ts
+++ b/saleor/static/dashboard-next/collections/types/CreateCollection.ts
@@ -25,7 +25,7 @@ export interface CreateCollection_collectionCreate_collection {
isPublished: boolean;
name: string;
backgroundImage: CreateCollection_collectionCreate_collection_backgroundImage | null;
- description: string;
+ descriptionJson: any;
seoDescription: string | null;
seoTitle: string | null;
}
diff --git a/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx b/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx
index 5b916f545f..9089971d1e 100644
--- a/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx
+++ b/saleor/static/dashboard-next/collections/views/CollectionCreate.tsx
@@ -60,7 +60,9 @@ export const CollectionCreate: React.StatelessComponent<{}> = () => (
input: {
backgroundImage: formData.backgroundImage.value,
backgroundImageAlt: formData.backgroundImageAlt,
- description: JSON.stringify(formData.description),
+ descriptionJson: JSON.stringify(
+ formData.description
+ ),
isPublished: formData.isPublished,
name: formData.name,
seo: {
diff --git a/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx b/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
index 9fe7b36f10..ae9088ea10 100644
--- a/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
+++ b/saleor/static/dashboard-next/collections/views/CollectionDetails.tsx
@@ -135,7 +135,7 @@ export const CollectionDetails: React.StatelessComponent<
) => {
const input = {
backgroundImageAlt: formData.backgroundImageAlt,
- description: JSON.stringify(formData.description),
+ descriptionJson: JSON.stringify(formData.description),
isPublished: formData.isPublished,
name: formData.name,
seo: {
diff --git a/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsx b/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsx
index 94d4c83b84..1661df4276 100644
--- a/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsx
+++ b/saleor/static/dashboard-next/components/RichTextEditor/RichTextEditor.tsx
@@ -217,7 +217,9 @@ const RichTextEditor = withStyles(styles, { name: "RichTextEditor" })(
</Typography>
<DraftailEditor
key={JSON.stringify(initial)}
- rawContentState={initial || null}
+ rawContentState={
+ initial && Object.keys(initial).length > 0 ? initial : null
+ }
onSave={value =>
onChange({
target: {
diff --git a/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx b/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx
index 4a6e422600..6e47a9727e 100644
--- a/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx
@@ -48,7 +48,7 @@ const PageDetailsPage: React.StatelessComponent<PageDetailsPageProps> = ({
}) => {
const initialForm: FormData = {
availableOn: maybe(() => page.availableOn, ""),
- content: maybe(() => JSON.parse(page.content)),
+ content: maybe(() => JSON.parse(page.contentJson)),
isVisible: maybe(() => page.isVisible, false),
seoDescription: maybe(() => page.seoDescription, ""),
seoTitle: maybe(() => page.seoTitle, ""),
diff --git a/saleor/static/dashboard-next/pages/components/PageInfo/PageInfo.tsx b/saleor/static/dashboard-next/pages/components/PageInfo/PageInfo.tsx
index 05c4b5bea9..8ceb0d679d 100644
--- a/saleor/static/dashboard-next/pages/components/PageInfo/PageInfo.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageInfo/PageInfo.tsx
@@ -16,7 +16,7 @@ import { FormData } from "../PageDetailsPage";
export interface PageInfoProps {
data: FormData;
disabled: boolean;
- errors: FormErrors<"content" | "title">;
+ errors: FormErrors<"contentJson" | "title">;
page: PageDetails_page;
onChange: (event: React.ChangeEvent<any>) => void;
}
@@ -54,9 +54,9 @@ const PageInfo = withStyles(styles, {
<FormSpacer />
<RichTextEditor
disabled={disabled}
- error={!!errors.content}
- helperText={errors.content}
- initial={maybe(() => JSON.parse(page.content))}
+ error={!!errors.contentJson}
+ helperText={errors.contentJson}
+ initial={maybe(() => JSON.parse(page.contentJson))}
label={i18n.t("Content")}
name={"content" as keyof FormData}
onChange={onChange}
diff --git a/saleor/static/dashboard-next/pages/fixtures.ts b/saleor/static/dashboard-next/pages/fixtures.ts
index ab4139b4c6..62eefb6b49 100644
--- a/saleor/static/dashboard-next/pages/fixtures.ts
+++ b/saleor/static/dashboard-next/pages/fixtures.ts
@@ -35,7 +35,7 @@ export const pageList: PageList_pages_edges_node[] = [
export const page: PageDetails_page = {
__typename: "Page",
availableOn: "",
- content: JSON.stringify(content),
+ contentJson: JSON.stringify(content),
id: "Kzx152sEm==",
isVisible: false,
seoDescription: "About",
diff --git a/saleor/static/dashboard-next/pages/queries.ts b/saleor/static/dashboard-next/pages/queries.ts
index 6e4a9682ca..abd6928568 100644
--- a/saleor/static/dashboard-next/pages/queries.ts
+++ b/saleor/static/dashboard-next/pages/queries.ts
@@ -17,7 +17,7 @@ export const pageDetailsFragment = gql`
${pageFragment}
fragment PageDetailsFragment on Page {
...PageFragment
- content
+ contentJson
seoTitle
seoDescription
availableOn
diff --git a/saleor/static/dashboard-next/pages/types/PageCreate.ts b/saleor/static/dashboard-next/pages/types/PageCreate.ts
index 67ff2b5643..daec8def71 100644
--- a/saleor/static/dashboard-next/pages/types/PageCreate.ts
+++ b/saleor/static/dashboard-next/pages/types/PageCreate.ts
@@ -19,7 +19,7 @@ export interface PageCreate_pageCreate_page {
title: string;
slug: string;
isVisible: boolean | null;
- content: string;
+ contentJson: any;
seoTitle: string | null;
seoDescription: string | null;
availableOn: any | null;
diff --git a/saleor/static/dashboard-next/pages/types/PageDetails.ts b/saleor/static/dashboard-next/pages/types/PageDetails.ts
index a3af14c253..d73b501ea0 100644
--- a/saleor/static/dashboard-next/pages/types/PageDetails.ts
+++ b/saleor/static/dashboard-next/pages/types/PageDetails.ts
@@ -11,7 +11,7 @@ export interface PageDetails_page {
title: string;
slug: string;
isVisible: boolean | null;
- content: string;
+ contentJson: any;
seoTitle: string | null;
seoDescription: string | null;
availableOn: any | null;
diff --git a/saleor/static/dashboard-next/pages/types/PageDetailsFragment.ts b/saleor/static/dashboard-next/pages/types/PageDetailsFragment.ts
index fcb2f71988..646b7c7c39 100644
--- a/saleor/static/dashboard-next/pages/types/PageDetailsFragment.ts
+++ b/saleor/static/dashboard-next/pages/types/PageDetailsFragment.ts
@@ -11,7 +11,7 @@ export interface PageDetailsFragment {
title: string;
slug: string;
isVisible: boolean | null;
- content: string;
+ contentJson: any;
seoTitle: string | null;
seoDescription: string | null;
availableOn: any | null;
diff --git a/saleor/static/dashboard-next/pages/types/PageUpdate.ts b/saleor/static/dashboard-next/pages/types/PageUpdate.ts
index c6c0d8336c..3920e38ab0 100644
--- a/saleor/static/dashboard-next/pages/types/PageUpdate.ts
+++ b/saleor/static/dashboard-next/pages/types/PageUpdate.ts
@@ -19,7 +19,7 @@ export interface PageUpdate_pageUpdate_page {
title: string;
slug: string;
isVisible: boolean | null;
- content: string;
+ contentJson: any;
seoTitle: string | null;
seoDescription: string | null;
availableOn: any | null;
diff --git a/saleor/static/dashboard-next/pages/views/PageCreate.tsx b/saleor/static/dashboard-next/pages/views/PageCreate.tsx
index a0badb8f57..c71c7653c0 100644
--- a/saleor/static/dashboard-next/pages/views/PageCreate.tsx
+++ b/saleor/static/dashboard-next/pages/views/PageCreate.tsx
@@ -53,7 +53,7 @@ export const PageCreate: React.StatelessComponent<PageCreateProps> = () => (
pageCreate({
variables: {
input: {
- content: JSON.stringify(formData.content),
+ contentJson: JSON.stringify(formData.content),
isPublished: formData.isVisible
? true
: formData.availableOn === ""
diff --git a/saleor/static/dashboard-next/pages/views/PageDetails.tsx b/saleor/static/dashboard-next/pages/views/PageDetails.tsx
index bdd52a3ed4..f9e8a635cd 100644
--- a/saleor/static/dashboard-next/pages/views/PageDetails.tsx
+++ b/saleor/static/dashboard-next/pages/views/PageDetails.tsx
@@ -69,7 +69,9 @@ export const PageDetails: React.StatelessComponent<PageDetailsProps> = ({
variables: {
id,
input: {
- content: JSON.stringify(formData.content),
+ contentJson: JSON.stringify(
+ formData.content
+ ),
isPublished: formData.isVisible
? true
: formData.availableOn === "" ||
diff --git a/saleor/static/dashboard-next/products/components/ProductDetailsForm/ProductDetailsForm.tsx b/saleor/static/dashboard-next/products/components/ProductDetailsForm/ProductDetailsForm.tsx
index cb6e527c91..071ea8c3fe 100644
--- a/saleor/static/dashboard-next/products/components/ProductDetailsForm/ProductDetailsForm.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductDetailsForm/ProductDetailsForm.tsx
@@ -65,7 +65,9 @@ export const ProductDetailsForm = withStyles(styles, {
<FormSpacer />
<RichTextEditor
disabled={disabled}
- initial={maybe(() => JSON.parse(product.description))}
+ error={!!errors.descriptionJson}
+ helperText={errors.descriptionJson}
+ initial={maybe(() => JSON.parse(product.descriptionJson))}
label={i18n.t("Description")}
name="description"
onChange={onChange}
diff --git a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
index 8ae7102dc6..75688c4245 100644
--- a/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductUpdatePage/ProductUpdatePage.tsx
@@ -143,7 +143,7 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
value: collection.id
}))
: [],
- description: maybe(() => JSON.parse(product.description)),
+ description: maybe(() => JSON.parse(product.descriptionJson)),
name: maybe(() => product.name),
price: maybe(() => product.price.amount),
productType: maybe(() => ({
diff --git a/saleor/static/dashboard-next/products/fixtures.ts b/saleor/static/dashboard-next/products/fixtures.ts
index d3e8f97e40..2484fda186 100644
--- a/saleor/static/dashboard-next/products/fixtures.ts
+++ b/saleor/static/dashboard-next/products/fixtures.ts
@@ -132,7 +132,7 @@ export const product: (
name: "Winter sale"
}
],
- description: JSON.stringify(content),
+ descriptionJson: JSON.stringify(content),
id: "p10171",
images: [
{
diff --git a/saleor/static/dashboard-next/products/mutations.ts b/saleor/static/dashboard-next/products/mutations.ts
index 120a289e27..1d5477fdc7 100644
--- a/saleor/static/dashboard-next/products/mutations.ts
+++ b/saleor/static/dashboard-next/products/mutations.ts
@@ -108,7 +108,7 @@ export const productUpdateMutation = gql`
$category: ID
$chargeTaxes: Boolean!
$collections: [ID]
- $description: String
+ $descriptionJson: JSONString
$isPublished: Boolean!
$name: String
$price: Decimal
@@ -121,7 +121,7 @@ export const productUpdateMutation = gql`
category: $category
chargeTaxes: $chargeTaxes
collections: $collections
- description: $description
+ descriptionJson: $descriptionJson
isPublished: $isPublished
name: $name
price: $price
@@ -152,7 +152,7 @@ export const simpleProductUpdateMutation = gql`
$category: ID
$chargeTaxes: Boolean!
$collections: [ID]
- $description: String
+ $descriptionJson: JSONString
$isPublished: Boolean!
$name: String
$price: Decimal
@@ -167,7 +167,7 @@ export const simpleProductUpdateMutation = gql`
category: $category
chargeTaxes: $chargeTaxes
collections: $collections
- description: $description
+ descriptionJson: $descriptionJson
isPublished: $isPublished
name: $name
price: $price
@@ -205,7 +205,7 @@ export const productCreateMutation = gql`
$category: ID!
$chargeTaxes: Boolean!
$collections: [ID]
- $description: String
+ $descriptionJson: JSONString
$isPublished: Boolean!
$name: String!
$price: Decimal
@@ -218,7 +218,7 @@ export const productCreateMutation = gql`
category: $category
chargeTaxes: $chargeTaxes
collections: $collections
- description: $description
+ descriptionJson: $descriptionJson
isPublished: $isPublished
name: $name
price: $price
diff --git a/saleor/static/dashboard-next/products/queries.ts b/saleor/static/dashboard-next/products/queries.ts
index 395b933caf..2623a4bf58 100644
--- a/saleor/static/dashboard-next/products/queries.ts
+++ b/saleor/static/dashboard-next/products/queries.ts
@@ -50,7 +50,7 @@ export const fragmentProduct = gql`
fragment Product on Product {
id
name
- description
+ descriptionJson
seoTitle
seoDescription
category {
diff --git a/saleor/static/dashboard-next/products/types/Product.ts b/saleor/static/dashboard-next/products/types/Product.ts
index 56a121dd50..cbcaab11a1 100644
--- a/saleor/static/dashboard-next/products/types/Product.ts
+++ b/saleor/static/dashboard-next/products/types/Product.ts
@@ -145,7 +145,7 @@ export interface Product {
__typename: "Product";
id: string;
name: string;
- description: string;
+ descriptionJson: any;
seoTitle: string | null;
seoDescription: string | null;
category: Product_category;
diff --git a/saleor/static/dashboard-next/products/types/ProductCreate.ts b/saleor/static/dashboard-next/products/types/ProductCreate.ts
index b3e3b29e6d..e616ba97b7 100644
--- a/saleor/static/dashboard-next/products/types/ProductCreate.ts
+++ b/saleor/static/dashboard-next/products/types/ProductCreate.ts
@@ -153,7 +153,7 @@ export interface ProductCreate_productCreate_product {
__typename: "Product";
id: string;
name: string;
- description: string;
+ descriptionJson: any;
seoTitle: string | null;
seoDescription: string | null;
category: ProductCreate_productCreate_product_category;
@@ -188,7 +188,7 @@ export interface ProductCreateVariables {
category: string;
chargeTaxes: boolean;
collections?: (string | null)[] | null;
- description?: string | null;
+ descriptionJson?: any | null;
isPublished: boolean;
name: string;
price?: any | null;
diff --git a/saleor/static/dashboard-next/products/types/ProductDetails.ts b/saleor/static/dashboard-next/products/types/ProductDetails.ts
index fc08c370b6..896ac62c04 100644
--- a/saleor/static/dashboard-next/products/types/ProductDetails.ts
+++ b/saleor/static/dashboard-next/products/types/ProductDetails.ts
@@ -145,7 +145,7 @@ export interface ProductDetails_product {
__typename: "Product";
id: string;
name: string;
- description: string;
+ descriptionJson: any;
seoTitle: string | null;
seoDescription: string | null;
category: ProductDetails_product_category;
diff --git a/saleor/static/dashboard-next/products/types/ProductImageCreate.ts b/saleor/static/dashboard-next/products/types/ProductImageCreate.ts
index bae3768f3b..64ed22f18f 100644
--- a/saleor/static/dashboard-next/products/types/ProductImageCreate.ts
+++ b/saleor/static/dashboard-next/products/types/ProductImageCreate.ts
@@ -151,7 +151,7 @@ export interface ProductImageCreate_productImageCreate_product {
__typename: "Product";
id: string;
name: string;
- description: string;
+ descriptionJson: any;
seoTitle: string | null;
seoDescription: string | null;
category: ProductImageCreate_productImageCreate_product_category;
diff --git a/saleor/static/dashboard-next/products/types/ProductImageUpdate.ts b/saleor/static/dashboard-next/products/types/ProductImageUpdate.ts
index e19ef9dd1f..2532e7efcb 100644
--- a/saleor/static/dashboard-next/products/types/ProductImageUpdate.ts
+++ b/saleor/static/dashboard-next/products/types/ProductImageUpdate.ts
@@ -151,7 +151,7 @@ export interface ProductImageUpdate_productImageUpdate_product {
__typename: "Product";
id: string;
name: string;
- description: string;
+ descriptionJson: any;
seoTitle: string | null;
seoDescription: string | null;
category: ProductImageUpdate_productImageUpdate_product_category;
diff --git a/saleor/static/dashboard-next/products/types/ProductUpdate.ts b/saleor/static/dashboard-next/products/types/ProductUpdate.ts
index 5e1c733dc5..1654b12650 100644
--- a/saleor/static/dashboard-next/products/types/ProductUpdate.ts
+++ b/saleor/static/dashboard-next/products/types/ProductUpdate.ts
@@ -153,7 +153,7 @@ export interface ProductUpdate_productUpdate_product {
__typename: "Product";
id: string;
name: string;
- description: string;
+ descriptionJson: any;
seoTitle: string | null;
seoDescription: string | null;
category: ProductUpdate_productUpdate_product_category;
@@ -189,7 +189,7 @@ export interface ProductUpdateVariables {
category?: string | null;
chargeTaxes: boolean;
collections?: (string | null)[] | null;
- description?: string | null;
+ descriptionJson?: any | null;
isPublished: boolean;
name?: string | null;
price?: any | null;
diff --git a/saleor/static/dashboard-next/products/types/SimpleProductUpdate.ts b/saleor/static/dashboard-next/products/types/SimpleProductUpdate.ts
index 32fa533201..67bb521128 100644
--- a/saleor/static/dashboard-next/products/types/SimpleProductUpdate.ts
+++ b/saleor/static/dashboard-next/products/types/SimpleProductUpdate.ts
@@ -153,7 +153,7 @@ export interface SimpleProductUpdate_productUpdate_product {
__typename: "Product";
id: string;
name: string;
- description: string;
+ descriptionJson: any;
seoTitle: string | null;
seoDescription: string | null;
category: SimpleProductUpdate_productUpdate_product_category;
@@ -298,7 +298,7 @@ export interface SimpleProductUpdateVariables {
category?: string | null;
chargeTaxes: boolean;
collections?: (string | null)[] | null;
- description?: string | null;
+ descriptionJson?: any | null;
isPublished: boolean;
name?: string | null;
price?: any | null;
diff --git a/saleor/static/dashboard-next/products/views/ProductCreate.tsx b/saleor/static/dashboard-next/products/views/ProductCreate.tsx
index 936e68c0a8..67812657b0 100644
--- a/saleor/static/dashboard-next/products/views/ProductCreate.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductCreate.tsx
@@ -78,7 +78,7 @@ export const ProductUpdate: React.StatelessComponent<
collections: formData.collections.map(
collection => collection.value
),
- description: JSON.stringify(
+ descriptionJson: JSON.stringify(
formData.description
),
isPublished: formData.available,
diff --git a/saleor/static/dashboard-next/products/views/ProductUpdate/index.tsx b/saleor/static/dashboard-next/products/views/ProductUpdate/index.tsx
index 62ae697d09..a3db550f7f 100644
--- a/saleor/static/dashboard-next/products/views/ProductUpdate/index.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductUpdate/index.tsx
@@ -120,7 +120,7 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
collections: data.collections.map(
collection => collection.value
),
- description: JSON.stringify(
+ descriptionJson: JSON.stringify(
data.description
),
id: product.id,
@@ -140,7 +140,7 @@ export const ProductUpdate: React.StatelessComponent<ProductUpdateProps> = ({
collections: data.collections.map(
collection => collection.value
),
- description: JSON.stringify(
+ descriptionJson: JSON.stringify(
data.description
),
id: product.id,
diff --git a/saleor/static/dashboard-next/storybook/stories/components/RichTextEditor.tsx b/saleor/static/dashboard-next/storybook/stories/components/RichTextEditor.tsx
index 3d30d96aa6..e8332dddf5 100644
--- a/saleor/static/dashboard-next/storybook/stories/components/RichTextEditor.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/components/RichTextEditor.tsx
@@ -89,6 +89,8 @@ storiesOf("Generics / Rich text editor", module)
.add("default", () => (
<RichTextEditor
disabled={false}
+ error={false}
+ helperText={""}
initial={content}
label="Content"
name="content"
diff --git a/saleor/static/dashboard-next/types/globalTypes.ts b/saleor/static/dashboard-next/types/globalTypes.ts
index 5914a7c172..da82a272b4 100644
--- a/saleor/static/dashboard-next/types/globalTypes.ts
+++ b/saleor/static/dashboard-next/types/globalTypes.ts
@@ -305,6 +305,7 @@ export interface PageInput {
slug?: string | null;
title?: string | null;
content?: string | null;
+ contentJson?: any | null;
isPublished?: boolean | null;
publicationDate?: string | null;
seo?: SeoInput | null;