From 10131163c17a8e624edb37ee8385f5c681f0924e Mon Sep 17 00:00:00 2001 From: Jakub Majorek Date: Fri, 22 Jan 2021 12:13:40 +0100 Subject: [PATCH] SALEOR-2036 Drop descriptionJson and contentJson fields (#950) * Drop descriptionJson and contentJson fields * Bump EditorJS version * Update changelog * Update tests --- CHANGELOG.md | 1 + .../recording.har | 132 ++++++++++++++++++ schema.graphql | 99 ++++++------- .../CategoryDetailsForm.tsx | 6 +- .../components/CategoryUpdatePage/form.tsx | 2 +- src/categories/fixtures.ts | 2 +- src/categories/types/CategoryCreate.ts | 2 +- src/categories/types/CategoryDetails.ts | 2 +- src/categories/types/CategoryUpdate.ts | 2 +- src/categories/views/CategoryCreate.tsx | 2 +- src/categories/views/CategoryDetails.tsx | 2 +- .../CollectionDetails/CollectionDetails.tsx | 6 +- .../components/CollectionDetailsPage/form.tsx | 2 +- src/collections/fixtures.ts | 2 +- src/collections/types/CollectionDetails.ts | 2 +- src/collections/types/CollectionUpdate.ts | 2 +- src/collections/types/CreateCollection.ts | 2 +- src/collections/views/CollectionCreate.tsx | 2 +- src/collections/views/CollectionDetails.tsx | 2 +- src/fragments/categories.ts | 2 +- src/fragments/collections.ts | 2 +- src/fragments/pages.ts | 2 +- src/fragments/products.ts | 2 +- src/fragments/translations.ts | 20 +-- .../types/CategoryDetailsFragment.ts | 2 +- .../types/CategoryTranslationFragment.ts | 4 +- .../types/CollectionDetailsFragment.ts | 2 +- .../types/CollectionTranslationFragment.ts | 4 +- src/fragments/types/PageDetailsFragment.ts | 2 +- .../types/PageTranslatableFragment.ts | 4 +- .../types/PageTranslationFragment.ts | 4 +- src/fragments/types/Product.ts | 2 +- .../types/ProductTranslationFragment.ts | 4 +- src/pages/components/PageDetailsPage/form.tsx | 2 +- src/pages/components/PageInfo/PageInfo.tsx | 6 +- src/pages/fixtures.ts | 2 +- src/pages/types/PageCreate.ts | 2 +- src/pages/types/PageDetails.ts | 2 +- src/pages/types/PageUpdate.ts | 2 +- src/pages/views/PageCreate.tsx | 2 +- src/pages/views/PageDetails.tsx | 2 +- .../ProductDetailsForm/ProductDetailsForm.tsx | 9 +- .../components/ProductUpdatePage/form.tsx | 2 +- src/products/fixtures.ts | 2 +- .../types/ProductChannelListingUpdate.ts | 2 +- src/products/types/ProductCreate.ts | 2 +- src/products/types/ProductDetails.ts | 2 +- src/products/types/ProductImageCreate.ts | 2 +- src/products/types/ProductImageUpdate.ts | 2 +- src/products/types/ProductUpdate.ts | 2 +- src/products/types/ProductVariantReorder.ts | 2 +- .../types/ProductVariantSetDefault.ts | 2 +- src/products/types/SimpleProductUpdate.ts | 2 +- src/products/views/ProductCreate/handlers.ts | 2 +- src/products/views/ProductUpdate/handlers.ts | 2 +- .../__snapshots__/Stories.test.ts.snap | 10 +- .../stories/categories/CategoryCreatePage.tsx | 2 +- .../stories/categories/CategoryUpdatePage.tsx | 2 +- .../collections/CollectionCreatePage.tsx | 2 +- .../collections/CollectionDetailsPage.tsx | 2 +- .../TranslationsCategoriesPage.tsx | 8 +- .../TranslationsCollectionsPage.tsx | 8 +- .../TranslationsPagesPage.tsx | 8 +- .../TranslationsProductsPage.tsx | 8 +- src/translations/mutations.ts | 12 +- .../types/CategoryTranslationDetails.ts | 4 +- .../types/CategoryTranslations.ts | 4 +- .../types/CollectionTranslationDetails.ts | 4 +- .../types/CollectionTranslations.ts | 4 +- .../types/PageTranslationDetails.ts | 4 +- src/translations/types/PageTranslations.ts | 4 +- .../types/ProductTranslationDetails.ts | 4 +- src/translations/types/ProductTranslations.ts | 4 +- .../types/UpdateCategoryTranslations.ts | 4 +- .../types/UpdateCollectionTranslations.ts | 4 +- .../types/UpdatePageTranslations.ts | 4 +- .../types/UpdateProductTranslations.ts | 4 +- .../views/TranslationsCategories.tsx | 4 +- .../views/TranslationsCollections.tsx | 4 +- .../views/TranslationsEntities.tsx | 8 +- src/translations/views/TranslationsPages.tsx | 4 +- .../views/TranslationsProducts.tsx | 4 +- src/types/globalTypes.ts | 24 ++-- 83 files changed, 329 insertions(+), 212 deletions(-) create mode 100644 recordings/User_3768991250/will-not-be-logged-in-if-is-non-staff_2544500193/recording.har diff --git a/CHANGELOG.md b/CHANGELOG.md index 404849087..2b0927617 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ All notable, unreleased changes to this project will be documented in this file. - Guard against non-staff users logging in - #947 by @jwm0 - Add reference attributes - #917 by @orzechdev - Add product reference attributes - #948 by @orzechdev +- Drop descriptionJson and contentJson fields - #950 by @jwm0 # 2.11.1 diff --git a/recordings/User_3768991250/will-not-be-logged-in-if-is-non-staff_2544500193/recording.har b/recordings/User_3768991250/will-not-be-logged-in-if-is-non-staff_2544500193/recording.har new file mode 100644 index 000000000..c9845a746 --- /dev/null +++ b/recordings/User_3768991250/will-not-be-logged-in-if-is-non-staff_2544500193/recording.har @@ -0,0 +1,132 @@ +{ + "log": { + "_recordingName": "User/will not be logged in if is non-staff", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "5.0.0" + }, + "entries": [ + { + "_id": "0b09ec35ecae5b17a2ccda062b1d6ef5", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 602, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-length", + "value": "602" + }, + { + "_fromType": "array", + "name": "user-agent", + "value": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" + }, + { + "_fromType": "array", + "name": "accept-encoding", + "value": "gzip,deflate" + }, + { + "_fromType": "array", + "name": "connection", + "value": "close" + }, + { + "name": "host", + "value": "localhost:8000" + } + ], + "headersSize": 254, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "[{\"operationName\":\"TokenAuth\",\"variables\":{\"email\":\"client@example.com\",\"password\":\"password\"},\"query\":\"fragment User on User {\\n id\\n email\\n firstName\\n lastName\\n isStaff\\n userPermissions {\\n code\\n name\\n __typename\\n }\\n avatar {\\n url\\n __typename\\n }\\n __typename\\n}\\n\\nmutation TokenAuth($email: String!, $password: String!) {\\n tokenCreate(email: $email, password: $password) {\\n errors: accountErrors {\\n field\\n message\\n __typename\\n }\\n csrfToken\\n token\\n user {\\n ...User\\n __typename\\n }\\n __typename\\n }\\n}\\n\"}]" + }, + "queryString": [], + "url": "http://localhost:8000/graphql/" + }, + "response": { + "bodySize": 616, + "content": { + "mimeType": "application/json", + "size": 616, + "text": "[{\"data\": {\"tokenCreate\": {\"errors\": [], \"csrfToken\": \"ztCCq2djodzVWeaynv8ifQbIIB4nrM6HyInqcZ4xqoaIEfOOKUEhAqw9rVR8Cr8L\", \"token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTEwNjY1MTcsImV4cCI6MTYxMTA2NjgxNywidG9rZW4iOiJ6MDc2QndLZkNEMmYiLCJlbWFpbCI6ImNsaWVudEBleGFtcGxlLmNvbSIsInR5cGUiOiJhY2Nlc3MiLCJ1c2VyX2lkIjoiVlhObGNqb3pNQT09IiwiaXNfc3RhZmYiOmZhbHNlfQ.lXsNnIBxZCCL843TTjn84lkWpE05o88F5q811ApjdKA\", \"user\": {\"id\": \"VXNlcjozMA==\", \"email\": \"client@example.com\", \"firstName\": \"\", \"lastName\": \"\", \"isStaff\": false, \"userPermissions\": [], \"avatar\": null, \"__typename\": \"User\"}, \"__typename\": \"CreateToken\"}}}]" + }, + "cookies": [ + { + "httpOnly": true, + "name": "refreshToken", + "path": "/", + "value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTEwNjY1MTcsImV4cCI6MTYxMzY1ODUxNywidG9rZW4iOiJ6MDc2QndLZkNEMmYiLCJlbWFpbCI6ImNsaWVudEBleGFtcGxlLmNvbSIsInR5cGUiOiJyZWZyZXNoIiwidXNlcl9pZCI6IlZYTmxjam96TUE9PSIsImlzX3N0YWZmIjpmYWxzZSwiY3NyZlRva2VuIjoienRDQ3EyZGpvZHpWV2VheW52OGlmUWJJSUI0bnJNNkh5SW5xY1o0eHFvYUlFZk9PS1VFaEFxdzlyVlI4Q3I4TCJ9.hDMEK3HFSLol7rLd9dfaSCLTWgvetNDAFsb039L9PXQ" + } + ], + "headers": [ + { + "name": "date", + "value": "Tue, 19 Jan 2021 14:28:37 GMT" + }, + { + "name": "server", + "value": "WSGIServer/0.2 CPython/3.9.1" + }, + { + "name": "content-type", + "value": "application/json" + }, + { + "name": "content-length", + "value": "616" + }, + { + "name": "x-content-type-options", + "value": "nosniff" + }, + { + "name": "referrer-policy", + "value": "same-origin" + }, + { + "_fromType": "array", + "name": "set-cookie", + "value": "refreshToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2MTEwNjY1MTcsImV4cCI6MTYxMzY1ODUxNywidG9rZW4iOiJ6MDc2QndLZkNEMmYiLCJlbWFpbCI6ImNsaWVudEBleGFtcGxlLmNvbSIsInR5cGUiOiJyZWZyZXNoIiwidXNlcl9pZCI6IlZYTmxjam96TUE9PSIsImlzX3N0YWZmIjpmYWxzZSwiY3NyZlRva2VuIjoienRDQ3EyZGpvZHpWV2VheW52OGlmUWJJSUI0bnJNNkh5SW5xY1o0eHFvYUlFZk9PS1VFaEFxdzlyVlI4Q3I4TCJ9.hDMEK3HFSLol7rLd9dfaSCLTWgvetNDAFsb039L9PXQ; HttpOnly; Path=/" + } + ], + "headersSize": 619, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2021-01-19T14:28:37.164Z", + "time": 468, + "timings": { + "blocked": -1, + "connect": -1, + "dns": -1, + "receive": 0, + "send": 0, + "ssl": -1, + "wait": 468 + } + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/schema.graphql b/schema.graphql index 1ef686df7..0ed146de4 100644 --- a/schema.graphql +++ b/schema.graphql @@ -671,13 +671,13 @@ type Category implements Node & ObjectWithMetadata { seoDescription: String id: ID! name: String! - description: String! - descriptionJson: JSONString! + description: JSONString! slug: String! parent: Category level: Int! privateMetadata: [MetadataItem]! metadata: [MetadataItem]! + descriptionJson: String @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") ancestors(before: String, after: String, first: Int, last: Int): CategoryCountableConnection products(channel: String, before: String, after: String, first: Int, last: Int): ProductCountableConnection url: String @deprecated(reason: "This field will be removed after 2020-07-31.") @@ -721,8 +721,7 @@ input CategoryFilterInput { } input CategoryInput { - description: String - descriptionJson: JSONString + description: JSONString name: String slug: String seo: SeoInput @@ -747,8 +746,8 @@ type CategoryTranslatableContent implements Node { seoDescription: String id: ID! name: String! - description: String! - descriptionJson: JSONString! + description: JSONString! + descriptionJson: String @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") translation(languageCode: LanguageCodeEnum!): CategoryTranslation category: Category } @@ -764,9 +763,9 @@ type CategoryTranslation implements Node { seoDescription: String id: ID! name: String! - description: String! - descriptionJson: JSONString! + description: JSONString! language: LanguageDisplay! + descriptionJson: String @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") } type CategoryUpdate { @@ -1051,11 +1050,11 @@ type Collection implements Node & ObjectWithMetadata { seoDescription: String id: ID! name: String! - description: String! - descriptionJson: JSONString! + description: JSONString! slug: String! privateMetadata: [MetadataItem]! metadata: [MetadataItem]! + descriptionJson: String @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") products(filter: ProductFilterInput, sortBy: ProductOrder, before: String, after: String, first: Int, last: Int): ProductCountableConnection backgroundImage(size: Int): Image translation(languageCode: LanguageCodeEnum!): CollectionTranslation @@ -1122,8 +1121,7 @@ input CollectionCreateInput { isPublished: Boolean name: String slug: String - description: String - descriptionJson: JSONString + description: JSONString backgroundImage: Upload backgroundImageAlt: String seo: SeoInput @@ -1165,8 +1163,7 @@ input CollectionInput { isPublished: Boolean name: String slug: String - description: String - descriptionJson: JSONString + description: JSONString backgroundImage: Upload backgroundImageAlt: String seo: SeoInput @@ -1208,8 +1205,8 @@ type CollectionTranslatableContent implements Node { seoDescription: String id: ID! name: String! - description: String! - descriptionJson: JSONString! + description: JSONString! + descriptionJson: String @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") translation(languageCode: LanguageCodeEnum!): CollectionTranslation collection: Collection } @@ -1225,9 +1222,9 @@ type CollectionTranslation implements Node { seoDescription: String id: ID! name: String! - description: String! - descriptionJson: JSONString! + description: JSONString! language: LanguageDisplay! + descriptionJson: String @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") } type CollectionUpdate { @@ -2837,7 +2834,7 @@ type Order implements Node & ObjectWithMetadata { shippingMethod: ShippingMethod shippingMethodName: String channel: Channel! - shippingPrice: TaxedMoney + shippingPrice: TaxedMoney! shippingTaxRate: Float! token: String! voucher: Voucher @@ -2857,16 +2854,16 @@ type Order implements Node & ObjectWithMetadata { availableShippingMethods: [ShippingMethod] invoices: [Invoice] number: String - isPaid: Boolean - paymentStatus: PaymentChargeStatusEnum - paymentStatusDisplay: String + isPaid: Boolean! + paymentStatus: PaymentChargeStatusEnum! + paymentStatusDisplay: String! payments: [Payment] - total: TaxedMoney - subtotal: TaxedMoney + total: TaxedMoney! + subtotal: TaxedMoney! statusDisplay: String canFinalize: Boolean! - totalAuthorized: Money - totalCaptured: Money + totalAuthorized: Money! + totalCaptured: Money! events: [OrderEvent] totalBalance: Money! userEmail: String @@ -3109,8 +3106,8 @@ type OrderLine implements Node { taxRate: Float! digitalContentUrl: DigitalContentUrl thumbnail(size: Int): Image - unitPrice: TaxedMoney - totalPrice: TaxedMoney + unitPrice: TaxedMoney! + totalPrice: TaxedMoney! variant: ProductVariant translatedProductName: String! translatedVariantName: String! @@ -3266,8 +3263,7 @@ type Page implements Node & ObjectWithMetadata { seoDescription: String id: ID! title: String! - content: String! - contentJson: JSONString! + content: JSONString! publicationDate: Date isPublished: Boolean! slug: String! @@ -3275,6 +3271,7 @@ type Page implements Node & ObjectWithMetadata { created: DateTime! privateMetadata: [MetadataItem]! metadata: [MetadataItem]! + contentJson: String! @deprecated(reason: "Will be removed in Saleor 4.0. Use the `content` field instead.") translation(languageCode: LanguageCodeEnum!): PageTranslation attributes: [SelectedAttribute!]! } @@ -3323,8 +3320,7 @@ type PageCreate { input PageCreateInput { slug: String title: String - content: String - contentJson: JSONString + content: JSONString attributes: [AttributeValueInput!] isPublished: Boolean publicationDate: String @@ -3370,8 +3366,7 @@ type PageInfo { input PageInput { slug: String title: String - content: String - contentJson: JSONString + content: JSONString attributes: [AttributeValueInput!] isPublished: Boolean publicationDate: String @@ -3402,8 +3397,8 @@ type PageTranslatableContent implements Node { seoDescription: String id: ID! title: String! - content: String! - contentJson: JSONString! + content: JSONString! + contentJson: String @deprecated(reason: "Will be removed in Saleor 4.0. Use the `content` field instead.") translation(languageCode: LanguageCodeEnum!): PageTranslation page: Page } @@ -3419,17 +3414,16 @@ type PageTranslation implements Node { seoDescription: String id: ID! title: String! - content: String! - contentJson: JSONString! + content: JSONString! language: LanguageDisplay! + contentJson: String @deprecated(reason: "Will be removed in Saleor 4.0. Use the `content` field instead.") } input PageTranslationInput { seoTitle: String seoDescription: String title: String - content: String - contentJson: JSONString + content: JSONString } type PageType implements Node & ObjectWithMetadata { @@ -3797,8 +3791,7 @@ type Product implements Node & ObjectWithMetadata { seoTitle: String seoDescription: String name: String! - description: String! - descriptionJson: JSONString! + description: JSONString! productType: ProductType! slug: String! category: Category @@ -3809,6 +3802,7 @@ type Product implements Node & ObjectWithMetadata { rating: Float privateMetadata: [MetadataItem]! metadata: [MetadataItem]! + descriptionJson: String @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") url: String! @deprecated(reason: "This field will be removed after 2020-07-31.") thumbnail(size: Int): Image pricing: ProductPricingInfo @@ -3918,8 +3912,7 @@ input ProductCreateInput { category: ID chargeTaxes: Boolean collections: [ID] - description: String - descriptionJson: JSONString + description: JSONString name: String slug: String taxCode: String @@ -4050,8 +4043,7 @@ input ProductInput { category: ID chargeTaxes: Boolean collections: [ID] - description: String - descriptionJson: JSONString + description: JSONString name: String slug: String taxCode: String @@ -4104,8 +4096,8 @@ type ProductTranslatableContent implements Node { seoTitle: String seoDescription: String name: String! - description: String! - descriptionJson: JSONString! + description: JSONString! + descriptionJson: String @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") translation(languageCode: LanguageCodeEnum!): ProductTranslation product: Product } @@ -4121,9 +4113,9 @@ type ProductTranslation implements Node { seoTitle: String seoDescription: String name: String! - description: String! - descriptionJson: JSONString! + description: JSONString! language: LanguageDisplay! + descriptionJson: String @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") } type ProductType implements Node & ObjectWithMetadata { @@ -5289,8 +5281,7 @@ input TranslationInput { seoTitle: String seoDescription: String name: String - description: String - descriptionJson: JSONString + description: JSONString } scalar UUID @@ -5621,7 +5612,7 @@ type VoucherUpdate { voucher: Voucher } -type Warehouse implements Node { +type Warehouse implements Node & ObjectWithMetadata { id: ID! name: String! slug: String! @@ -5629,6 +5620,8 @@ type Warehouse implements Node { shippingZones(before: String, after: String, first: Int, last: Int): ShippingZoneCountableConnection! address: Address! email: String! + privateMetadata: [MetadataItem]! + metadata: [MetadataItem]! } input WarehouseAddressInput { diff --git a/src/categories/components/CategoryDetailsForm/CategoryDetailsForm.tsx b/src/categories/components/CategoryDetailsForm/CategoryDetailsForm.tsx index d1e984b25..037426539 100644 --- a/src/categories/components/CategoryDetailsForm/CategoryDetailsForm.tsx +++ b/src/categories/components/CategoryDetailsForm/CategoryDetailsForm.tsx @@ -33,7 +33,7 @@ export const CategoryDetailsForm: React.FC = ({ }) => { const intl = useIntl(); - const formErrors = getFormErrors(["name", "descriptionJson"], errors); + const formErrors = getFormErrors(["name", "description"], errors); return ( @@ -59,8 +59,8 @@ export const CategoryDetailsForm: React.FC = ({ = ({ const result = await createCategory({ variables: { input: { - descriptionJson: JSON.stringify(formData.description), + description: JSON.stringify(formData.description), name: formData.name, seo: { description: formData.seoDescription, diff --git a/src/categories/views/CategoryDetails.tsx b/src/categories/views/CategoryDetails.tsx index 30a97ff02..e97265d89 100644 --- a/src/categories/views/CategoryDetails.tsx +++ b/src/categories/views/CategoryDetails.tsx @@ -188,7 +188,7 @@ export const CategoryDetails: React.FC = ({ id, input: { backgroundImageAlt: formData.backgroundImageAlt, - descriptionJson: JSON.stringify(formData.description), + description: JSON.stringify(formData.description), name: formData.name, seo: { description: formData.seoDescription, diff --git a/src/collections/components/CollectionDetails/CollectionDetails.tsx b/src/collections/components/CollectionDetails/CollectionDetails.tsx index 7e3db7e73..c52bd4c26 100644 --- a/src/collections/components/CollectionDetails/CollectionDetails.tsx +++ b/src/collections/components/CollectionDetails/CollectionDetails.tsx @@ -33,7 +33,7 @@ const CollectionDetails: React.FC = ({ }) => { const intl = useIntl(); - const formErrors = getFormErrors(["name", "descriptionJson"], errors); + const formErrors = getFormErrors(["name", "description"], errors); return ( @@ -57,8 +57,8 @@ const CollectionDetails: React.FC = ({ = ({ input: { backgroundImage: formData.backgroundImage.value, backgroundImageAlt: formData.backgroundImageAlt, - descriptionJson: JSON.stringify(formData.description), + description: JSON.stringify(formData.description), name: formData.name, seo: { description: formData.seoDescription, diff --git a/src/collections/views/CollectionDetails.tsx b/src/collections/views/CollectionDetails.tsx index 9c7425d6e..7e661ea52 100644 --- a/src/collections/views/CollectionDetails.tsx +++ b/src/collections/views/CollectionDetails.tsx @@ -198,7 +198,7 @@ export const CollectionDetails: React.FC = ({ const handleUpdate = async (formData: CollectionUpdateData) => { const input: CollectionInput = { backgroundImageAlt: formData.backgroundImageAlt, - descriptionJson: JSON.stringify(formData.description), + description: JSON.stringify(formData.description), name: formData.name, seo: { description: formData.seoDescription, diff --git a/src/fragments/categories.ts b/src/fragments/categories.ts index 5545d6220..18bc64c9e 100644 --- a/src/fragments/categories.ts +++ b/src/fragments/categories.ts @@ -25,7 +25,7 @@ export const categoryDetailsFragment = gql` } name slug - descriptionJson + description seoDescription seoTitle parent { diff --git a/src/fragments/collections.ts b/src/fragments/collections.ts index 72b65b6f2..e3733609b 100644 --- a/src/fragments/collections.ts +++ b/src/fragments/collections.ts @@ -29,7 +29,7 @@ export const collectionDetailsFragment = gql` url } slug - descriptionJson + description seoDescription seoTitle } diff --git a/src/fragments/pages.ts b/src/fragments/pages.ts index d91a1a43d..b9f49c980 100644 --- a/src/fragments/pages.ts +++ b/src/fragments/pages.ts @@ -56,7 +56,7 @@ export const pageDetailsFragment = gql` ...PageFragment ...PageAttributesFragment ...MetadataFragment - contentJson + content seoTitle seoDescription publicationDate diff --git a/src/fragments/products.ts b/src/fragments/products.ts index 9cec7123b..fdbb99234 100644 --- a/src/fragments/products.ts +++ b/src/fragments/products.ts @@ -172,7 +172,7 @@ export const productFragmentDetails = gql` ...MetadataFragment name slug - descriptionJson + description seoTitle seoDescription rating diff --git a/src/fragments/translations.ts b/src/fragments/translations.ts index 301356ccb..aa041d6ef 100644 --- a/src/fragments/translations.ts +++ b/src/fragments/translations.ts @@ -4,7 +4,7 @@ export const categoryTranslationFragment = gql` fragment CategoryTranslationFragment on CategoryTranslatableContent { translation(languageCode: $language) { id - descriptionJson + description language { language } @@ -15,7 +15,7 @@ export const categoryTranslationFragment = gql` category { id name - descriptionJson + description seoDescription seoTitle } @@ -26,13 +26,13 @@ export const collectionTranslationFragment = gql` collection { id name - descriptionJson + description seoDescription seoTitle } translation(languageCode: $language) { id - descriptionJson + description language { language } @@ -47,13 +47,13 @@ export const productTranslationFragment = gql` product { id name - descriptionJson + description seoDescription seoTitle } translation(languageCode: $language) { id - descriptionJson + description language { code language @@ -118,14 +118,14 @@ export const pageTranslationFragment = gql` fragment PageTranslationFragment on PageTranslatableContent { page { id - contentJson + content seoDescription seoTitle title } translation(languageCode: $language) { id - contentJson + content seoDescription seoTitle title @@ -139,14 +139,14 @@ export const pageTranslationFragment = gql` export const pageTranslatableFragment = gql` fragment PageTranslatableFragment on PageTranslatableContent { id - contentJson + content seoDescription seoTitle title translation(languageCode: $language) { id - contentJson + content seoDescription seoTitle title diff --git a/src/fragments/types/CategoryDetailsFragment.ts b/src/fragments/types/CategoryDetailsFragment.ts index e1b2d5fbb..1190c711d 100644 --- a/src/fragments/types/CategoryDetailsFragment.ts +++ b/src/fragments/types/CategoryDetailsFragment.ts @@ -37,7 +37,7 @@ export interface CategoryDetailsFragment { backgroundImage: CategoryDetailsFragment_backgroundImage | null; name: string; slug: string; - descriptionJson: any; + description: any; seoDescription: string | null; seoTitle: string | null; parent: CategoryDetailsFragment_parent | null; diff --git a/src/fragments/types/CategoryTranslationFragment.ts b/src/fragments/types/CategoryTranslationFragment.ts index 8729af0f2..ed3f656cd 100644 --- a/src/fragments/types/CategoryTranslationFragment.ts +++ b/src/fragments/types/CategoryTranslationFragment.ts @@ -14,7 +14,7 @@ export interface CategoryTranslationFragment_translation_language { export interface CategoryTranslationFragment_translation { __typename: "CategoryTranslation"; id: string; - descriptionJson: any; + description: any; language: CategoryTranslationFragment_translation_language; name: string; seoDescription: string | null; @@ -25,7 +25,7 @@ export interface CategoryTranslationFragment_category { __typename: "Category"; id: string; name: string; - descriptionJson: any; + description: any; seoDescription: string | null; seoTitle: string | null; } diff --git a/src/fragments/types/CollectionDetailsFragment.ts b/src/fragments/types/CollectionDetailsFragment.ts index 07db07c20..ae823d602 100644 --- a/src/fragments/types/CollectionDetailsFragment.ts +++ b/src/fragments/types/CollectionDetailsFragment.ts @@ -46,7 +46,7 @@ export interface CollectionDetailsFragment { privateMetadata: (CollectionDetailsFragment_privateMetadata | null)[]; backgroundImage: CollectionDetailsFragment_backgroundImage | null; slug: string; - descriptionJson: any; + description: any; seoDescription: string | null; seoTitle: string | null; } diff --git a/src/fragments/types/CollectionTranslationFragment.ts b/src/fragments/types/CollectionTranslationFragment.ts index 3488c0ce8..0b27b4a6a 100644 --- a/src/fragments/types/CollectionTranslationFragment.ts +++ b/src/fragments/types/CollectionTranslationFragment.ts @@ -10,7 +10,7 @@ export interface CollectionTranslationFragment_collection { __typename: "Collection"; id: string; name: string; - descriptionJson: any; + description: any; seoDescription: string | null; seoTitle: string | null; } @@ -23,7 +23,7 @@ export interface CollectionTranslationFragment_translation_language { export interface CollectionTranslationFragment_translation { __typename: "CollectionTranslation"; id: string; - descriptionJson: any; + description: any; language: CollectionTranslationFragment_translation_language; name: string; seoDescription: string | null; diff --git a/src/fragments/types/PageDetailsFragment.ts b/src/fragments/types/PageDetailsFragment.ts index 2ba241f78..8750634ac 100644 --- a/src/fragments/types/PageDetailsFragment.ts +++ b/src/fragments/types/PageDetailsFragment.ts @@ -109,7 +109,7 @@ export interface PageDetailsFragment { pageType: PageDetailsFragment_pageType; metadata: (PageDetailsFragment_metadata | null)[]; privateMetadata: (PageDetailsFragment_privateMetadata | null)[]; - contentJson: any; + content: any; seoTitle: string | null; seoDescription: string | null; publicationDate: any | null; diff --git a/src/fragments/types/PageTranslatableFragment.ts b/src/fragments/types/PageTranslatableFragment.ts index dc214e951..8088d7a2f 100644 --- a/src/fragments/types/PageTranslatableFragment.ts +++ b/src/fragments/types/PageTranslatableFragment.ts @@ -17,7 +17,7 @@ export interface PageTranslatableFragment_translation_language { export interface PageTranslatableFragment_translation { __typename: "PageTranslation"; id: string; - contentJson: any; + content: any; seoDescription: string | null; seoTitle: string | null; title: string; @@ -27,7 +27,7 @@ export interface PageTranslatableFragment_translation { export interface PageTranslatableFragment { __typename: "PageTranslatableContent"; id: string; - contentJson: any; + content: any; seoDescription: string | null; seoTitle: string | null; title: string; diff --git a/src/fragments/types/PageTranslationFragment.ts b/src/fragments/types/PageTranslationFragment.ts index 24ba7cc69..a0e87d4da 100644 --- a/src/fragments/types/PageTranslationFragment.ts +++ b/src/fragments/types/PageTranslationFragment.ts @@ -11,7 +11,7 @@ import { LanguageCodeEnum } from "./../../types/globalTypes"; export interface PageTranslationFragment_page { __typename: "Page"; id: string; - contentJson: any; + content: any; seoDescription: string | null; seoTitle: string | null; title: string; @@ -26,7 +26,7 @@ export interface PageTranslationFragment_translation_language { export interface PageTranslationFragment_translation { __typename: "PageTranslation"; id: string; - contentJson: any; + content: any; seoDescription: string | null; seoTitle: string | null; title: string; diff --git a/src/fragments/types/Product.ts b/src/fragments/types/Product.ts index f9ba2f490..8792e55a4 100644 --- a/src/fragments/types/Product.ts +++ b/src/fragments/types/Product.ts @@ -253,7 +253,7 @@ export interface Product { privateMetadata: (Product_privateMetadata | null)[]; name: string; slug: string; - descriptionJson: any; + description: any; seoTitle: string | null; seoDescription: string | null; rating: number | null; diff --git a/src/fragments/types/ProductTranslationFragment.ts b/src/fragments/types/ProductTranslationFragment.ts index 91a3d8d8c..6bd9548fd 100644 --- a/src/fragments/types/ProductTranslationFragment.ts +++ b/src/fragments/types/ProductTranslationFragment.ts @@ -12,7 +12,7 @@ export interface ProductTranslationFragment_product { __typename: "Product"; id: string; name: string; - descriptionJson: any; + description: any; seoDescription: string | null; seoTitle: string | null; } @@ -26,7 +26,7 @@ export interface ProductTranslationFragment_translation_language { export interface ProductTranslationFragment_translation { __typename: "ProductTranslation"; id: string; - descriptionJson: any; + description: any; language: ProductTranslationFragment_translation_language; name: string; seoDescription: string | null; diff --git a/src/pages/components/PageDetailsPage/form.tsx b/src/pages/components/PageDetailsPage/form.tsx index 758c7d598..e1c21856f 100644 --- a/src/pages/components/PageDetailsPage/form.tsx +++ b/src/pages/components/PageDetailsPage/form.tsx @@ -122,7 +122,7 @@ function usePageForm( title: page?.title || "" }); const [content, changeContent] = useRichText({ - initial: pageExists ? page?.contentJson : null, + initial: pageExists ? page?.content : null, triggerChange }); diff --git a/src/pages/components/PageInfo/PageInfo.tsx b/src/pages/components/PageInfo/PageInfo.tsx index bf211d3e0..a6fe26708 100644 --- a/src/pages/components/PageInfo/PageInfo.tsx +++ b/src/pages/components/PageInfo/PageInfo.tsx @@ -39,7 +39,7 @@ const PageInfo: React.FC = props => { const classes = useStyles(props); const intl = useIntl(); - const formErrors = getFormErrors(["title", "contentJson"], errors); + const formErrors = getFormErrors(["title", "content"], errors); return ( @@ -64,8 +64,8 @@ const PageInfo: React.FC = props => { = ({ params }) => { attributes: formData.attributes, updatedFileAttributes }), - contentJson: JSON.stringify(formData.content), + content: JSON.stringify(formData.content), isPublished: formData.isPublished, pageType: formData.pageType, publicationDate: formData.publicationDate, diff --git a/src/pages/views/PageDetails.tsx b/src/pages/views/PageDetails.tsx index 687ddaf6f..32d2eb608 100644 --- a/src/pages/views/PageDetails.tsx +++ b/src/pages/views/PageDetails.tsx @@ -53,7 +53,7 @@ const createPageInput = ( attributes: data.attributes, updatedFileAttributes }), - contentJson: JSON.stringify(data.content), + content: JSON.stringify(data.content), isPublished: data.isPublished, publicationDate: data.publicationDate, seo: { diff --git a/src/products/components/ProductDetailsForm/ProductDetailsForm.tsx b/src/products/components/ProductDetailsForm/ProductDetailsForm.tsx index da39c93f7..0b56cca56 100644 --- a/src/products/components/ProductDetailsForm/ProductDetailsForm.tsx +++ b/src/products/components/ProductDetailsForm/ProductDetailsForm.tsx @@ -37,10 +37,7 @@ export const ProductDetailsForm: React.FC = ({ }) => { const intl = useIntl(); - const formErrors = getFormErrors( - ["name", "descriptionJson", "rating"], - errors - ); + const formErrors = getFormErrors(["name", "description", "rating"], errors); return ( @@ -65,8 +62,8 @@ export const ProductDetailsForm: React.FC = ({ ([]); const stocks = useFormset(getStockInputFromProduct(product)); const [description, changeDescription] = useRichText({ - initial: product?.descriptionJson, + initial: product?.description, triggerChange }); diff --git a/src/products/fixtures.ts b/src/products/fixtures.ts index 602232486..df62ab8a2 100644 --- a/src/products/fixtures.ts +++ b/src/products/fixtures.ts @@ -204,7 +204,7 @@ export const product: ( } ], defaultVariant: { __typename: "ProductVariant", id: "pv75934" }, - descriptionJson: JSON.stringify(content), + description: JSON.stringify(content), id: "p10171", images: [ { diff --git a/src/products/types/ProductChannelListingUpdate.ts b/src/products/types/ProductChannelListingUpdate.ts index d12f9953d..795e8368c 100644 --- a/src/products/types/ProductChannelListingUpdate.ts +++ b/src/products/types/ProductChannelListingUpdate.ts @@ -253,7 +253,7 @@ export interface ProductChannelListingUpdate_productChannelListingUpdate_product privateMetadata: (ProductChannelListingUpdate_productChannelListingUpdate_product_privateMetadata | null)[]; name: string; slug: string; - descriptionJson: any; + description: any; seoTitle: string | null; seoDescription: string | null; rating: number | null; diff --git a/src/products/types/ProductCreate.ts b/src/products/types/ProductCreate.ts index 174158d4b..531a73af0 100644 --- a/src/products/types/ProductCreate.ts +++ b/src/products/types/ProductCreate.ts @@ -260,7 +260,7 @@ export interface ProductCreate_productCreate_product { privateMetadata: (ProductCreate_productCreate_product_privateMetadata | null)[]; name: string; slug: string; - descriptionJson: any; + description: any; seoTitle: string | null; seoDescription: string | null; rating: number | null; diff --git a/src/products/types/ProductDetails.ts b/src/products/types/ProductDetails.ts index a8ed59463..960e25330 100644 --- a/src/products/types/ProductDetails.ts +++ b/src/products/types/ProductDetails.ts @@ -253,7 +253,7 @@ export interface ProductDetails_product { privateMetadata: (ProductDetails_product_privateMetadata | null)[]; name: string; slug: string; - descriptionJson: any; + description: any; seoTitle: string | null; seoDescription: string | null; rating: number | null; diff --git a/src/products/types/ProductImageCreate.ts b/src/products/types/ProductImageCreate.ts index 704823003..13e0a706b 100644 --- a/src/products/types/ProductImageCreate.ts +++ b/src/products/types/ProductImageCreate.ts @@ -259,7 +259,7 @@ export interface ProductImageCreate_productImageCreate_product { privateMetadata: (ProductImageCreate_productImageCreate_product_privateMetadata | null)[]; name: string; slug: string; - descriptionJson: any; + description: any; seoTitle: string | null; seoDescription: string | null; rating: number | null; diff --git a/src/products/types/ProductImageUpdate.ts b/src/products/types/ProductImageUpdate.ts index 219de6624..2545adbd8 100644 --- a/src/products/types/ProductImageUpdate.ts +++ b/src/products/types/ProductImageUpdate.ts @@ -259,7 +259,7 @@ export interface ProductImageUpdate_productImageUpdate_product { privateMetadata: (ProductImageUpdate_productImageUpdate_product_privateMetadata | null)[]; name: string; slug: string; - descriptionJson: any; + description: any; seoTitle: string | null; seoDescription: string | null; rating: number | null; diff --git a/src/products/types/ProductUpdate.ts b/src/products/types/ProductUpdate.ts index 661a7a0cf..b2780eff1 100644 --- a/src/products/types/ProductUpdate.ts +++ b/src/products/types/ProductUpdate.ts @@ -260,7 +260,7 @@ export interface ProductUpdate_productUpdate_product { privateMetadata: (ProductUpdate_productUpdate_product_privateMetadata | null)[]; name: string; slug: string; - descriptionJson: any; + description: any; seoTitle: string | null; seoDescription: string | null; rating: number | null; diff --git a/src/products/types/ProductVariantReorder.ts b/src/products/types/ProductVariantReorder.ts index 68fb0c764..5070100c3 100644 --- a/src/products/types/ProductVariantReorder.ts +++ b/src/products/types/ProductVariantReorder.ts @@ -259,7 +259,7 @@ export interface ProductVariantReorder_productVariantReorder_product { privateMetadata: (ProductVariantReorder_productVariantReorder_product_privateMetadata | null)[]; name: string; slug: string; - descriptionJson: any; + description: any; seoTitle: string | null; seoDescription: string | null; rating: number | null; diff --git a/src/products/types/ProductVariantSetDefault.ts b/src/products/types/ProductVariantSetDefault.ts index ed095108d..d59a4aaca 100644 --- a/src/products/types/ProductVariantSetDefault.ts +++ b/src/products/types/ProductVariantSetDefault.ts @@ -259,7 +259,7 @@ export interface ProductVariantSetDefault_productVariantSetDefault_product { privateMetadata: (ProductVariantSetDefault_productVariantSetDefault_product_privateMetadata | null)[]; name: string; slug: string; - descriptionJson: any; + description: any; seoTitle: string | null; seoDescription: string | null; rating: number | null; diff --git a/src/products/types/SimpleProductUpdate.ts b/src/products/types/SimpleProductUpdate.ts index 2703b3ed8..b4d7a0a70 100644 --- a/src/products/types/SimpleProductUpdate.ts +++ b/src/products/types/SimpleProductUpdate.ts @@ -260,7 +260,7 @@ export interface SimpleProductUpdate_productUpdate_product { privateMetadata: (SimpleProductUpdate_productUpdate_product_privateMetadata | null)[]; name: string; slug: string; - descriptionJson: any; + description: any; seoTitle: string | null; seoDescription: string | null; rating: number | null; diff --git a/src/products/views/ProductCreate/handlers.ts b/src/products/views/ProductCreate/handlers.ts index ad7f7233f..4cbe4b801 100644 --- a/src/products/views/ProductCreate/handlers.ts +++ b/src/products/views/ProductCreate/handlers.ts @@ -108,7 +108,7 @@ export function createHandler( category: formData.category, chargeTaxes: formData.chargeTaxes, collections: formData.collections, - descriptionJson: JSON.stringify(formData.description), + description: JSON.stringify(formData.description), name: formData.name, productType: formData.productType?.id, rating: formData.rating, diff --git a/src/products/views/ProductUpdate/handlers.ts b/src/products/views/ProductUpdate/handlers.ts index 7a9c3d7fb..47b36da63 100644 --- a/src/products/views/ProductUpdate/handlers.ts +++ b/src/products/views/ProductUpdate/handlers.ts @@ -185,7 +185,7 @@ export function createUpdateHandler( category: data.category, chargeTaxes: data.chargeTaxes, collections: data.collections, - descriptionJson: JSON.stringify(data.description), + description: JSON.stringify(data.description), name: data.name, rating: data.rating, seo: { diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 2c714118b..a64488aef 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -136744,17 +136744,19 @@ exports[`Storyshots Views / Pages / Page details form errors 1`] = ` data-test-id="content" >

+ class="MuiFormHelperText-root-id MuiFormHelperText-contained-id MuiFormHelperText-error-id" + > + Invalid value +

diff --git a/src/storybook/stories/categories/CategoryCreatePage.tsx b/src/storybook/stories/categories/CategoryCreatePage.tsx index 456237d69..2492123a1 100644 --- a/src/storybook/stories/categories/CategoryCreatePage.tsx +++ b/src/storybook/stories/categories/CategoryCreatePage.tsx @@ -31,7 +31,7 @@ storiesOf("Views / Categories / Create category", module) }, { code: ProductErrorCode.REQUIRED, - field: "descriptionJson" + field: "description" } ].map(err => ({ __typename: "ProductError", diff --git a/src/storybook/stories/categories/CategoryUpdatePage.tsx b/src/storybook/stories/categories/CategoryUpdatePage.tsx index 72cb432db..b3a1b8eca 100644 --- a/src/storybook/stories/categories/CategoryUpdatePage.tsx +++ b/src/storybook/stories/categories/CategoryUpdatePage.tsx @@ -100,7 +100,7 @@ storiesOf("Views / Categories / Update category", module) }, { code: ProductErrorCode.REQUIRED, - field: "descriptionJson" + field: "description" } ].map(err => ({ __typename: "ProductError", diff --git a/src/storybook/stories/collections/CollectionCreatePage.tsx b/src/storybook/stories/collections/CollectionCreatePage.tsx index 3d910135e..50715681e 100644 --- a/src/storybook/stories/collections/CollectionCreatePage.tsx +++ b/src/storybook/stories/collections/CollectionCreatePage.tsx @@ -39,7 +39,7 @@ storiesOf("Views / Collections / Create collection", module) }, { code: CollectionErrorCode.REQUIRED, - field: "descriptionJson" + field: "description" } ].map(err => ({ __typename: "CollectionError", diff --git a/src/storybook/stories/collections/CollectionDetailsPage.tsx b/src/storybook/stories/collections/CollectionDetailsPage.tsx index e4da1623d..41b2e9c4a 100644 --- a/src/storybook/stories/collections/CollectionDetailsPage.tsx +++ b/src/storybook/stories/collections/CollectionDetailsPage.tsx @@ -57,7 +57,7 @@ storiesOf("Views / Collections / Collection details", module) }, { code: CollectionErrorCode.REQUIRED, - field: "descriptionJson" + field: "description" } ].map(err => ({ __typename: "CollectionError", diff --git a/src/translations/components/TranslationsCategoriesPage/TranslationsCategoriesPage.tsx b/src/translations/components/TranslationsCategoriesPage/TranslationsCategoriesPage.tsx index 81cf94eff..66a529d52 100644 --- a/src/translations/components/TranslationsCategoriesPage/TranslationsCategoriesPage.tsx +++ b/src/translations/components/TranslationsCategoriesPage/TranslationsCategoriesPage.tsx @@ -18,7 +18,7 @@ export interface TranslationsCategoriesPageProps } export const fieldNames = { - descriptionJson: "description", + description: "description", name: "name", seoDescription: "seoDescription", seoTitle: "seoTitle" @@ -79,10 +79,10 @@ const TranslationsCategoriesPage: React.FC = ({ }, { displayName: intl.formatMessage(commonMessages.description), - name: fieldNames.descriptionJson, - translation: data?.translation?.descriptionJson || null, + name: fieldNames.description, + translation: data?.translation?.description || null, type: "rich" as "rich", - value: data?.category?.descriptionJson + value: data?.category?.description } ]} saveButtonState={saveButtonState} diff --git a/src/translations/components/TranslationsCollectionsPage/TranslationsCollectionsPage.tsx b/src/translations/components/TranslationsCollectionsPage/TranslationsCollectionsPage.tsx index 41543ed83..ef3c962a6 100644 --- a/src/translations/components/TranslationsCollectionsPage/TranslationsCollectionsPage.tsx +++ b/src/translations/components/TranslationsCollectionsPage/TranslationsCollectionsPage.tsx @@ -18,7 +18,7 @@ export interface TranslationsCollectionsPageProps } export const fieldNames = { - descriptionJson: "description", + description: "description", name: "name", seoDescription: "seoDescription", seoTitle: "seoTitle" @@ -80,10 +80,10 @@ const TranslationsCollectionsPage: React.FC = }, { displayName: intl.formatMessage(commonMessages.description), - name: fieldNames.descriptionJson, - translation: data?.translation?.descriptionJson || null, + name: fieldNames.description, + translation: data?.translation?.description || null, type: "rich" as "rich", - value: data?.collection?.descriptionJson + value: data?.collection?.description } ]} saveButtonState={saveButtonState} diff --git a/src/translations/components/TranslationsPagesPage/TranslationsPagesPage.tsx b/src/translations/components/TranslationsPagesPage/TranslationsPagesPage.tsx index 64cedd9ff..2c8661cf8 100644 --- a/src/translations/components/TranslationsPagesPage/TranslationsPagesPage.tsx +++ b/src/translations/components/TranslationsPagesPage/TranslationsPagesPage.tsx @@ -18,7 +18,7 @@ export interface TranslationsPagesPageProps } export const fieldNames = { - contentJson: "content", + content: "content", seoDescription: "seoDescription", seoTitle: "seoTitle", title: "title" @@ -82,10 +82,10 @@ const TranslationsPagesPage: React.FC = ({ defaultMessage: "Content", description: "page content" }), - name: fieldNames.contentJson, - translation: data?.translation?.contentJson || null, + name: fieldNames.content, + translation: data?.translation?.content || null, type: "rich" as "rich", - value: data?.page?.contentJson + value: data?.page?.content } ]} saveButtonState={saveButtonState} diff --git a/src/translations/components/TranslationsProductsPage/TranslationsProductsPage.tsx b/src/translations/components/TranslationsProductsPage/TranslationsProductsPage.tsx index 3b40676df..93e2d850c 100644 --- a/src/translations/components/TranslationsProductsPage/TranslationsProductsPage.tsx +++ b/src/translations/components/TranslationsProductsPage/TranslationsProductsPage.tsx @@ -18,7 +18,7 @@ export interface TranslationsProductsPageProps } export const fieldNames = { - descriptionJson: "description", + description: "description", name: "name", seoDescription: "seoDescription", seoTitle: "seoTitle" @@ -82,10 +82,10 @@ const TranslationsProductsPage: React.FC = ({ displayName: intl.formatMessage({ defaultMessage: "Description" }), - name: fieldNames.descriptionJson, - translation: data?.translation?.descriptionJson || null, + name: fieldNames.description, + translation: data?.translation?.description || null, type: "rich" as "rich", - value: data?.product?.descriptionJson + value: data?.product?.description } ]} saveButtonState={saveButtonState} diff --git a/src/translations/mutations.ts b/src/translations/mutations.ts index 5c2777a4a..20fcd85bb 100644 --- a/src/translations/mutations.ts +++ b/src/translations/mutations.ts @@ -53,12 +53,12 @@ const updateProductTranslations = gql` product { id name - descriptionJson + description seoDescription seoTitle translation(languageCode: $language) { id - descriptionJson + description language { code language @@ -90,12 +90,12 @@ const updateCategoryTranslations = gql` category { id name - descriptionJson + description seoDescription seoTitle translation(languageCode: $language) { id - descriptionJson + description language { language } @@ -126,12 +126,12 @@ const updateCollectionTranslations = gql` collection { id name - descriptionJson + description seoDescription seoTitle translation(languageCode: $language) { id - descriptionJson + description language { language } diff --git a/src/translations/types/CategoryTranslationDetails.ts b/src/translations/types/CategoryTranslationDetails.ts index 46d3494ca..b3efd65b2 100644 --- a/src/translations/types/CategoryTranslationDetails.ts +++ b/src/translations/types/CategoryTranslationDetails.ts @@ -20,7 +20,7 @@ export interface CategoryTranslationDetails_translation_CategoryTranslatableCont export interface CategoryTranslationDetails_translation_CategoryTranslatableContent_translation { __typename: "CategoryTranslation"; id: string; - descriptionJson: any; + description: any; language: CategoryTranslationDetails_translation_CategoryTranslatableContent_translation_language; name: string; seoDescription: string | null; @@ -31,7 +31,7 @@ export interface CategoryTranslationDetails_translation_CategoryTranslatableCont __typename: "Category"; id: string; name: string; - descriptionJson: any; + description: any; seoDescription: string | null; seoTitle: string | null; } diff --git a/src/translations/types/CategoryTranslations.ts b/src/translations/types/CategoryTranslations.ts index fe128719b..8330f1b59 100644 --- a/src/translations/types/CategoryTranslations.ts +++ b/src/translations/types/CategoryTranslations.ts @@ -20,7 +20,7 @@ export interface CategoryTranslations_translations_edges_node_CategoryTranslatab export interface CategoryTranslations_translations_edges_node_CategoryTranslatableContent_translation { __typename: "CategoryTranslation"; id: string; - descriptionJson: any; + description: any; language: CategoryTranslations_translations_edges_node_CategoryTranslatableContent_translation_language; name: string; seoDescription: string | null; @@ -31,7 +31,7 @@ export interface CategoryTranslations_translations_edges_node_CategoryTranslatab __typename: "Category"; id: string; name: string; - descriptionJson: any; + description: any; seoDescription: string | null; seoTitle: string | null; } diff --git a/src/translations/types/CollectionTranslationDetails.ts b/src/translations/types/CollectionTranslationDetails.ts index e27056891..f8ce23280 100644 --- a/src/translations/types/CollectionTranslationDetails.ts +++ b/src/translations/types/CollectionTranslationDetails.ts @@ -16,7 +16,7 @@ export interface CollectionTranslationDetails_translation_CollectionTranslatable __typename: "Collection"; id: string; name: string; - descriptionJson: any; + description: any; seoDescription: string | null; seoTitle: string | null; } @@ -29,7 +29,7 @@ export interface CollectionTranslationDetails_translation_CollectionTranslatable export interface CollectionTranslationDetails_translation_CollectionTranslatableContent_translation { __typename: "CollectionTranslation"; id: string; - descriptionJson: any; + description: any; language: CollectionTranslationDetails_translation_CollectionTranslatableContent_translation_language; name: string; seoDescription: string | null; diff --git a/src/translations/types/CollectionTranslations.ts b/src/translations/types/CollectionTranslations.ts index 162d0f5a4..f25b8d4d1 100644 --- a/src/translations/types/CollectionTranslations.ts +++ b/src/translations/types/CollectionTranslations.ts @@ -16,7 +16,7 @@ export interface CollectionTranslations_translations_edges_node_CollectionTransl __typename: "Collection"; id: string; name: string; - descriptionJson: any; + description: any; seoDescription: string | null; seoTitle: string | null; } @@ -29,7 +29,7 @@ export interface CollectionTranslations_translations_edges_node_CollectionTransl export interface CollectionTranslations_translations_edges_node_CollectionTranslatableContent_translation { __typename: "CollectionTranslation"; id: string; - descriptionJson: any; + description: any; language: CollectionTranslations_translations_edges_node_CollectionTranslatableContent_translation_language; name: string; seoDescription: string | null; diff --git a/src/translations/types/PageTranslationDetails.ts b/src/translations/types/PageTranslationDetails.ts index b71c2a1ac..a40b072ca 100644 --- a/src/translations/types/PageTranslationDetails.ts +++ b/src/translations/types/PageTranslationDetails.ts @@ -15,7 +15,7 @@ export interface PageTranslationDetails_translation_ProductTranslatableContent { export interface PageTranslationDetails_translation_PageTranslatableContent_page { __typename: "Page"; id: string; - contentJson: any; + content: any; seoDescription: string | null; seoTitle: string | null; title: string; @@ -30,7 +30,7 @@ export interface PageTranslationDetails_translation_PageTranslatableContent_tran export interface PageTranslationDetails_translation_PageTranslatableContent_translation { __typename: "PageTranslation"; id: string; - contentJson: any; + content: any; seoDescription: string | null; seoTitle: string | null; title: string; diff --git a/src/translations/types/PageTranslations.ts b/src/translations/types/PageTranslations.ts index 9b6cec9b8..a2a9aa242 100644 --- a/src/translations/types/PageTranslations.ts +++ b/src/translations/types/PageTranslations.ts @@ -15,7 +15,7 @@ export interface PageTranslations_translations_edges_node_ProductTranslatableCon export interface PageTranslations_translations_edges_node_PageTranslatableContent_page { __typename: "Page"; id: string; - contentJson: any; + content: any; seoDescription: string | null; seoTitle: string | null; title: string; @@ -30,7 +30,7 @@ export interface PageTranslations_translations_edges_node_PageTranslatableConten export interface PageTranslations_translations_edges_node_PageTranslatableContent_translation { __typename: "PageTranslation"; id: string; - contentJson: any; + content: any; seoDescription: string | null; seoTitle: string | null; title: string; diff --git a/src/translations/types/ProductTranslationDetails.ts b/src/translations/types/ProductTranslationDetails.ts index 08d1fbebe..d7f4b0dc7 100644 --- a/src/translations/types/ProductTranslationDetails.ts +++ b/src/translations/types/ProductTranslationDetails.ts @@ -16,7 +16,7 @@ export interface ProductTranslationDetails_translation_ProductTranslatableConten __typename: "Product"; id: string; name: string; - descriptionJson: any; + description: any; seoDescription: string | null; seoTitle: string | null; } @@ -30,7 +30,7 @@ export interface ProductTranslationDetails_translation_ProductTranslatableConten export interface ProductTranslationDetails_translation_ProductTranslatableContent_translation { __typename: "ProductTranslation"; id: string; - descriptionJson: any; + description: any; language: ProductTranslationDetails_translation_ProductTranslatableContent_translation_language; name: string; seoDescription: string | null; diff --git a/src/translations/types/ProductTranslations.ts b/src/translations/types/ProductTranslations.ts index ccc726de3..46c1989b4 100644 --- a/src/translations/types/ProductTranslations.ts +++ b/src/translations/types/ProductTranslations.ts @@ -16,7 +16,7 @@ export interface ProductTranslations_translations_edges_node_ProductTranslatable __typename: "Product"; id: string; name: string; - descriptionJson: any; + description: any; seoDescription: string | null; seoTitle: string | null; } @@ -30,7 +30,7 @@ export interface ProductTranslations_translations_edges_node_ProductTranslatable export interface ProductTranslations_translations_edges_node_ProductTranslatableContent_translation { __typename: "ProductTranslation"; id: string; - descriptionJson: any; + description: any; language: ProductTranslations_translations_edges_node_ProductTranslatableContent_translation_language; name: string; seoDescription: string | null; diff --git a/src/translations/types/UpdateCategoryTranslations.ts b/src/translations/types/UpdateCategoryTranslations.ts index 0b3020389..3d5e977ad 100644 --- a/src/translations/types/UpdateCategoryTranslations.ts +++ b/src/translations/types/UpdateCategoryTranslations.ts @@ -22,7 +22,7 @@ export interface UpdateCategoryTranslations_categoryTranslate_category_translati export interface UpdateCategoryTranslations_categoryTranslate_category_translation { __typename: "CategoryTranslation"; id: string; - descriptionJson: any; + description: any; language: UpdateCategoryTranslations_categoryTranslate_category_translation_language; name: string; seoDescription: string | null; @@ -33,7 +33,7 @@ export interface UpdateCategoryTranslations_categoryTranslate_category { __typename: "Category"; id: string; name: string; - descriptionJson: any; + description: any; seoDescription: string | null; seoTitle: string | null; translation: UpdateCategoryTranslations_categoryTranslate_category_translation | null; diff --git a/src/translations/types/UpdateCollectionTranslations.ts b/src/translations/types/UpdateCollectionTranslations.ts index 58f166c7e..3f72c6f8d 100644 --- a/src/translations/types/UpdateCollectionTranslations.ts +++ b/src/translations/types/UpdateCollectionTranslations.ts @@ -22,7 +22,7 @@ export interface UpdateCollectionTranslations_collectionTranslate_collection_tra export interface UpdateCollectionTranslations_collectionTranslate_collection_translation { __typename: "CollectionTranslation"; id: string; - descriptionJson: any; + description: any; language: UpdateCollectionTranslations_collectionTranslate_collection_translation_language; name: string; seoDescription: string | null; @@ -33,7 +33,7 @@ export interface UpdateCollectionTranslations_collectionTranslate_collection { __typename: "Collection"; id: string; name: string; - descriptionJson: any; + description: any; seoDescription: string | null; seoTitle: string | null; translation: UpdateCollectionTranslations_collectionTranslate_collection_translation | null; diff --git a/src/translations/types/UpdatePageTranslations.ts b/src/translations/types/UpdatePageTranslations.ts index 1abe4da2a..48154c0d4 100644 --- a/src/translations/types/UpdatePageTranslations.ts +++ b/src/translations/types/UpdatePageTranslations.ts @@ -17,7 +17,7 @@ export interface UpdatePageTranslations_pageTranslate_errors { export interface UpdatePageTranslations_pageTranslate_page_page { __typename: "Page"; id: string; - contentJson: any; + content: any; seoDescription: string | null; seoTitle: string | null; title: string; @@ -32,7 +32,7 @@ export interface UpdatePageTranslations_pageTranslate_page_translation_language export interface UpdatePageTranslations_pageTranslate_page_translation { __typename: "PageTranslation"; id: string; - contentJson: any; + content: any; seoDescription: string | null; seoTitle: string | null; title: string; diff --git a/src/translations/types/UpdateProductTranslations.ts b/src/translations/types/UpdateProductTranslations.ts index c0b35ba40..0be7c75ac 100644 --- a/src/translations/types/UpdateProductTranslations.ts +++ b/src/translations/types/UpdateProductTranslations.ts @@ -23,7 +23,7 @@ export interface UpdateProductTranslations_productTranslate_product_translation_ export interface UpdateProductTranslations_productTranslate_product_translation { __typename: "ProductTranslation"; id: string; - descriptionJson: any; + description: any; language: UpdateProductTranslations_productTranslate_product_translation_language; name: string; seoDescription: string | null; @@ -34,7 +34,7 @@ export interface UpdateProductTranslations_productTranslate_product { __typename: "Product"; id: string; name: string; - descriptionJson: any; + description: any; seoDescription: string | null; seoTitle: string | null; translation: UpdateProductTranslations_productTranslate_product_translation | null; diff --git a/src/translations/views/TranslationsCategories.tsx b/src/translations/views/TranslationsCategories.tsx index 11bbecc57..2aa9260ff 100644 --- a/src/translations/views/TranslationsCategories.tsx +++ b/src/translations/views/TranslationsCategories.tsx @@ -69,8 +69,8 @@ const TranslationsCategories: React.FC = ({ {(updateTranslations, updateTranslationsOpts) => { const handleSubmit = (field: string, data: string) => { const input: TranslationInput = {}; - if (field === fieldNames.descriptionJson) { - input.descriptionJson = JSON.stringify(data); + if (field === fieldNames.description) { + input.description = JSON.stringify(data); } else if (field === fieldNames.name) { input.name = data; } else if (field === fieldNames.seoDescription) { diff --git a/src/translations/views/TranslationsCollections.tsx b/src/translations/views/TranslationsCollections.tsx index 61c537521..747e5bc7e 100644 --- a/src/translations/views/TranslationsCollections.tsx +++ b/src/translations/views/TranslationsCollections.tsx @@ -71,8 +71,8 @@ const TranslationsCollections: React.FC = ({ {(updateTranslations, updateTranslationsOpts) => { const handleSubmit = (field: string, data: string) => { const input: TranslationInput = {}; - if (field === fieldNames.descriptionJson) { - input.descriptionJson = JSON.stringify(data); + if (field === fieldNames.description) { + input.description = JSON.stringify(data); } else if (field === fieldNames.name) { input.name = data; } else if (field === fieldNames.seoDescription) { diff --git a/src/translations/views/TranslationsEntities.tsx b/src/translations/views/TranslationsEntities.tsx index 4fc268679..1aac279c0 100644 --- a/src/translations/views/TranslationsEntities.tsx +++ b/src/translations/views/TranslationsEntities.tsx @@ -147,7 +147,7 @@ const TranslationsEntities: React.FC = ({ completion: { current: node.translation ? [ - node.translation.descriptionJson, + node.translation.description, node.translation.name, node.translation.seoDescription, node.translation.seoTitle @@ -197,7 +197,7 @@ const TranslationsEntities: React.FC = ({ completion: { current: node.translation ? [ - node.translation.descriptionJson, + node.translation.description, node.translation.name, node.translation.seoDescription, node.translation.seoTitle @@ -248,7 +248,7 @@ const TranslationsEntities: React.FC = ({ completion: { current: node.translation ? [ - node.translation.descriptionJson, + node.translation.description, node.translation.name, node.translation.seoDescription, node.translation.seoTitle @@ -385,7 +385,7 @@ const TranslationsEntities: React.FC = ({ completion: { current: node.translation ? [ - node.translation.contentJson, + node.translation.content, node.translation.seoDescription, node.translation.seoTitle, node.translation.title diff --git a/src/translations/views/TranslationsPages.tsx b/src/translations/views/TranslationsPages.tsx index 90c679cb8..8b7e735db 100644 --- a/src/translations/views/TranslationsPages.tsx +++ b/src/translations/views/TranslationsPages.tsx @@ -72,8 +72,8 @@ const TranslationsPages: React.FC = ({ {(updateTranslations, updateTranslationsOpts) => { const handleSubmit = (field: string, data: string) => { const input: PageTranslationInput = {}; - if (field === fieldNames.contentJson) { - input.contentJson = JSON.stringify(data); + if (field === fieldNames.content) { + input.content = JSON.stringify(data); } else if (field === fieldNames.title) { input.title = data; } else if (field === fieldNames.seoDescription) { diff --git a/src/translations/views/TranslationsProducts.tsx b/src/translations/views/TranslationsProducts.tsx index d0a2bc22a..aede683aa 100644 --- a/src/translations/views/TranslationsProducts.tsx +++ b/src/translations/views/TranslationsProducts.tsx @@ -70,8 +70,8 @@ const TranslationsProducts: React.FC = ({ {(updateTranslations, updateTranslationsOpts) => { const handleSubmit = (field: string, data: string) => { const input: TranslationInput = {}; - if (field === fieldNames.descriptionJson) { - input.descriptionJson = JSON.stringify(data); + if (field === fieldNames.description) { + input.description = JSON.stringify(data); } else if (field === fieldNames.name) { input.name = data; } else if (field === fieldNames.seoDescription) { diff --git a/src/types/globalTypes.ts b/src/types/globalTypes.ts index 9e2f51f7d..a971e3497 100644 --- a/src/types/globalTypes.ts +++ b/src/types/globalTypes.ts @@ -1119,8 +1119,7 @@ export interface CategoryFilterInput { } export interface CategoryInput { - description?: string | null; - descriptionJson?: any | null; + description?: any | null; name?: string | null; slug?: string | null; seo?: SeoInput | null; @@ -1160,8 +1159,7 @@ export interface CollectionCreateInput { isPublished?: boolean | null; name?: string | null; slug?: string | null; - description?: string | null; - descriptionJson?: any | null; + description?: any | null; backgroundImage?: any | null; backgroundImageAlt?: string | null; seo?: SeoInput | null; @@ -1180,8 +1178,7 @@ export interface CollectionInput { isPublished?: boolean | null; name?: string | null; slug?: string | null; - description?: string | null; - descriptionJson?: any | null; + description?: any | null; backgroundImage?: any | null; backgroundImageAlt?: string | null; seo?: SeoInput | null; @@ -1429,8 +1426,7 @@ export interface OrderUpdateShippingInput { export interface PageCreateInput { slug?: string | null; title?: string | null; - content?: string | null; - contentJson?: any | null; + content?: any | null; attributes?: AttributeValueInput[] | null; isPublished?: boolean | null; publicationDate?: string | null; @@ -1441,8 +1437,7 @@ export interface PageCreateInput { export interface PageInput { slug?: string | null; title?: string | null; - content?: string | null; - contentJson?: any | null; + content?: any | null; attributes?: AttributeValueInput[] | null; isPublished?: boolean | null; publicationDate?: string | null; @@ -1551,8 +1546,7 @@ export interface ProductCreateInput { category?: string | null; chargeTaxes?: boolean | null; collections?: (string | null)[] | null; - description?: string | null; - descriptionJson?: any | null; + description?: any | null; name?: string | null; slug?: string | null; taxCode?: string | null; @@ -1584,8 +1578,7 @@ export interface ProductInput { category?: string | null; chargeTaxes?: boolean | null; collections?: (string | null)[] | null; - description?: string | null; - descriptionJson?: any | null; + description?: any | null; name?: string | null; slug?: string | null; taxCode?: string | null; @@ -1818,8 +1811,7 @@ export interface TranslationInput { seoTitle?: string | null; seoDescription?: string | null; name?: string | null; - description?: string | null; - descriptionJson?: any | null; + description?: any | null; } export interface UserCreateInput {