This reverts commit 796383637c
.
This commit is contained in:
parent
8ab097b7d3
commit
7fd2eb2a2c
16 changed files with 241 additions and 205 deletions
|
@ -9357,22 +9357,6 @@
|
|||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "attribute",
|
||||
"description": "Represents a value of an attribute.",
|
||||
"args": [],
|
||||
"type": {
|
||||
"kind": "NON_NULL",
|
||||
"name": null,
|
||||
"ofType": {
|
||||
"kind": "OBJECT",
|
||||
"name": "AttributeTranslatableContent",
|
||||
"ofType": null
|
||||
}
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "attributeValue",
|
||||
"description": "Represents a value of an attribute.",
|
||||
|
|
|
@ -3460,6 +3460,10 @@
|
|||
"context": "window title",
|
||||
"string": "Create Product"
|
||||
},
|
||||
"PajjqE": {
|
||||
"context": "attribute list",
|
||||
"string": "Attribute {number}"
|
||||
},
|
||||
"PbQJY5": {
|
||||
"context": "section header",
|
||||
"string": "Saleor Apps"
|
||||
|
@ -7878,10 +7882,6 @@
|
|||
"context": "attribute type",
|
||||
"string": "Content Attribute"
|
||||
},
|
||||
"zgqPGF": {
|
||||
"context": "attribute list",
|
||||
"string": "Attribute {name}"
|
||||
},
|
||||
"zjHH6b": {
|
||||
"context": "sale start date",
|
||||
"string": "Started"
|
||||
|
|
|
@ -1881,9 +1881,6 @@ type AttributeValueTranslatableContent implements Node {
|
|||
languageCode: LanguageCodeEnum!
|
||||
): AttributeValueTranslation
|
||||
|
||||
"""Represents an attribute."""
|
||||
attribute: Attribute!
|
||||
|
||||
"""Represents a value of an attribute."""
|
||||
attributeValue: AttributeValue @deprecated(reason: "This field will be removed in Saleor 4.0. Get model fields from the root level queries.")
|
||||
}
|
||||
|
|
|
@ -1,31 +1,5 @@
|
|||
import { gql } from "@apollo/client";
|
||||
|
||||
export const attributeValueTranslatableFragment = gql`
|
||||
fragment AttributeValueTranslatable on AttributeValueTranslatableContent {
|
||||
id
|
||||
name
|
||||
plainText
|
||||
richText
|
||||
attributeValue {
|
||||
id
|
||||
}
|
||||
attribute {
|
||||
id
|
||||
name
|
||||
}
|
||||
translation(languageCode: $language) {
|
||||
id
|
||||
name
|
||||
plainText
|
||||
richText
|
||||
language {
|
||||
code
|
||||
language
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const categoryTranslationFragment = gql`
|
||||
fragment CategoryTranslation on CategoryTranslatableContent {
|
||||
translation(languageCode: $language) {
|
||||
|
@ -90,7 +64,21 @@ export const productTranslationFragment = gql`
|
|||
}
|
||||
}
|
||||
attributeValues {
|
||||
...AttributeValueTranslatable
|
||||
id
|
||||
name
|
||||
richText
|
||||
attributeValue {
|
||||
id
|
||||
}
|
||||
translation(languageCode: $language) {
|
||||
id
|
||||
name
|
||||
richText
|
||||
language {
|
||||
code
|
||||
language
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
@ -110,7 +98,21 @@ export const productVariantTranslationFragment = gql`
|
|||
}
|
||||
}
|
||||
attributeValues {
|
||||
...AttributeValueTranslatable
|
||||
id
|
||||
name
|
||||
richText
|
||||
attributeValue {
|
||||
id
|
||||
}
|
||||
translation(languageCode: $language) {
|
||||
id
|
||||
name
|
||||
richText
|
||||
language {
|
||||
code
|
||||
language
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
@ -189,7 +191,21 @@ export const pageTranslationFragment = gql`
|
|||
}
|
||||
}
|
||||
attributeValues {
|
||||
...AttributeValueTranslatable
|
||||
id
|
||||
name
|
||||
richText
|
||||
attributeValue {
|
||||
id
|
||||
}
|
||||
translation(languageCode: $language) {
|
||||
id
|
||||
name
|
||||
richText
|
||||
language {
|
||||
code
|
||||
language
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
@ -224,13 +240,11 @@ export const attributeChoicesTranslationFragment = gql`
|
|||
node {
|
||||
id
|
||||
name
|
||||
plainText
|
||||
richText
|
||||
inputType
|
||||
translation(languageCode: $language) {
|
||||
id
|
||||
name
|
||||
plainText
|
||||
richText
|
||||
}
|
||||
}
|
||||
|
@ -277,6 +291,28 @@ export const attributeTranslationDetailsFragment = gql`
|
|||
}
|
||||
`;
|
||||
|
||||
export const attributeValueTranslatableContentFragment = gql`
|
||||
fragment AttributeValueTranslatableContent on AttributeTranslatableContent {
|
||||
translation(languageCode: $language) {
|
||||
id
|
||||
name
|
||||
}
|
||||
attribute {
|
||||
id
|
||||
name
|
||||
inputType
|
||||
choices(
|
||||
first: $firstValues
|
||||
after: $afterValues
|
||||
last: $lastValues
|
||||
before: $beforeValues
|
||||
) {
|
||||
...AttributeChoicesTranslation
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const menuItemTranslationFragment = gql`
|
||||
fragment MenuItemTranslation on MenuItemTranslatableContent {
|
||||
translation(languageCode: $language) {
|
||||
|
|
|
@ -2437,31 +2437,6 @@ export const CollectionTranslationFragmentDoc = gql`
|
|||
}
|
||||
}
|
||||
`;
|
||||
export const AttributeValueTranslatableFragmentDoc = gql`
|
||||
fragment AttributeValueTranslatable on AttributeValueTranslatableContent {
|
||||
id
|
||||
name
|
||||
plainText
|
||||
richText
|
||||
attributeValue {
|
||||
id
|
||||
}
|
||||
attribute {
|
||||
id
|
||||
name
|
||||
}
|
||||
translation(languageCode: $language) {
|
||||
id
|
||||
name
|
||||
plainText
|
||||
richText
|
||||
language {
|
||||
code
|
||||
language
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const ProductTranslationFragmentDoc = gql`
|
||||
fragment ProductTranslation on ProductTranslatableContent {
|
||||
product {
|
||||
|
@ -2483,10 +2458,24 @@ export const ProductTranslationFragmentDoc = gql`
|
|||
}
|
||||
}
|
||||
attributeValues {
|
||||
...AttributeValueTranslatable
|
||||
id
|
||||
name
|
||||
richText
|
||||
attributeValue {
|
||||
id
|
||||
}
|
||||
translation(languageCode: $language) {
|
||||
id
|
||||
name
|
||||
richText
|
||||
language {
|
||||
code
|
||||
language
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${AttributeValueTranslatableFragmentDoc}`;
|
||||
`;
|
||||
export const ProductVariantTranslationFragmentDoc = gql`
|
||||
fragment ProductVariantTranslation on ProductVariantTranslatableContent {
|
||||
productVariant {
|
||||
|
@ -2502,10 +2491,24 @@ export const ProductVariantTranslationFragmentDoc = gql`
|
|||
}
|
||||
}
|
||||
attributeValues {
|
||||
...AttributeValueTranslatable
|
||||
id
|
||||
name
|
||||
richText
|
||||
attributeValue {
|
||||
id
|
||||
}
|
||||
translation(languageCode: $language) {
|
||||
id
|
||||
name
|
||||
richText
|
||||
language {
|
||||
code
|
||||
language
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${AttributeValueTranslatableFragmentDoc}`;
|
||||
`;
|
||||
export const SaleTranslationFragmentDoc = gql`
|
||||
fragment SaleTranslation on SaleTranslatableContent {
|
||||
sale {
|
||||
|
@ -2579,10 +2582,24 @@ export const PageTranslationFragmentDoc = gql`
|
|||
}
|
||||
}
|
||||
attributeValues {
|
||||
...AttributeValueTranslatable
|
||||
id
|
||||
name
|
||||
richText
|
||||
attributeValue {
|
||||
id
|
||||
}
|
||||
translation(languageCode: $language) {
|
||||
id
|
||||
name
|
||||
richText
|
||||
language {
|
||||
code
|
||||
language
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${AttributeValueTranslatableFragmentDoc}`;
|
||||
`;
|
||||
export const PageTranslatableFragmentDoc = gql`
|
||||
fragment PageTranslatable on PageTranslatableContent {
|
||||
id
|
||||
|
@ -2628,13 +2645,11 @@ export const AttributeChoicesTranslationFragmentDoc = gql`
|
|||
node {
|
||||
id
|
||||
name
|
||||
plainText
|
||||
richText
|
||||
inputType
|
||||
translation(languageCode: $language) {
|
||||
id
|
||||
name
|
||||
plainText
|
||||
richText
|
||||
}
|
||||
}
|
||||
|
@ -2663,6 +2678,27 @@ export const AttributeTranslationDetailsFragmentDoc = gql`
|
|||
}
|
||||
}
|
||||
${AttributeChoicesTranslationFragmentDoc}`;
|
||||
export const AttributeValueTranslatableContentFragmentDoc = gql`
|
||||
fragment AttributeValueTranslatableContent on AttributeTranslatableContent {
|
||||
translation(languageCode: $language) {
|
||||
id
|
||||
name
|
||||
}
|
||||
attribute {
|
||||
id
|
||||
name
|
||||
inputType
|
||||
choices(
|
||||
first: $firstValues
|
||||
after: $afterValues
|
||||
last: $lastValues
|
||||
before: $beforeValues
|
||||
) {
|
||||
...AttributeChoicesTranslation
|
||||
}
|
||||
}
|
||||
}
|
||||
${AttributeChoicesTranslationFragmentDoc}`;
|
||||
export const MenuItemTranslationFragmentDoc = gql`
|
||||
fragment MenuItemTranslation on MenuItemTranslatableContent {
|
||||
translation(languageCode: $language) {
|
||||
|
|
|
@ -549,14 +549,13 @@ export type AttributeValueDeletedFieldPolicy = {
|
|||
recipient?: FieldPolicy<any> | FieldReadFunction<any>,
|
||||
attributeValue?: FieldPolicy<any> | FieldReadFunction<any>
|
||||
};
|
||||
export type AttributeValueTranslatableContentKeySpecifier = ('id' | 'name' | 'richText' | 'plainText' | 'translation' | 'attribute' | 'attributeValue' | AttributeValueTranslatableContentKeySpecifier)[];
|
||||
export type AttributeValueTranslatableContentKeySpecifier = ('id' | 'name' | 'richText' | 'plainText' | 'translation' | 'attributeValue' | AttributeValueTranslatableContentKeySpecifier)[];
|
||||
export type AttributeValueTranslatableContentFieldPolicy = {
|
||||
id?: FieldPolicy<any> | FieldReadFunction<any>,
|
||||
name?: FieldPolicy<any> | FieldReadFunction<any>,
|
||||
richText?: FieldPolicy<any> | FieldReadFunction<any>,
|
||||
plainText?: FieldPolicy<any> | FieldReadFunction<any>,
|
||||
translation?: FieldPolicy<any> | FieldReadFunction<any>,
|
||||
attribute?: FieldPolicy<any> | FieldReadFunction<any>,
|
||||
attributeValue?: FieldPolicy<any> | FieldReadFunction<any>
|
||||
};
|
||||
export type AttributeValueTranslateKeySpecifier = ('translationErrors' | 'errors' | 'attributeValue' | AttributeValueTranslateKeySpecifier)[];
|
||||
|
|
|
@ -7215,15 +7215,13 @@ export type TaxTypeFragment = { __typename: 'TaxType', description: string | nul
|
|||
|
||||
export type TimePeriodFragment = { __typename: 'TimePeriod', amount: number, type: TimePeriodTypeEnum };
|
||||
|
||||
export type AttributeValueTranslatableFragment = { __typename: 'AttributeValueTranslatableContent', id: string, name: string, plainText: string | null, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, attribute: { __typename: 'AttributeTranslatableContent', id: string, name: string }, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, plainText: string | null, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null };
|
||||
|
||||
export type CategoryTranslationFragment = { __typename: 'CategoryTranslatableContent', translation: { __typename: 'CategoryTranslation', id: string, description: any | null, name: string | null, seoDescription: string | null, seoTitle: string | null, language: { __typename: 'LanguageDisplay', language: string } } | null, category: { __typename: 'Category', id: string, name: string, description: any | null, seoDescription: string | null, seoTitle: string | null } | null };
|
||||
|
||||
export type CollectionTranslationFragment = { __typename: 'CollectionTranslatableContent', collection: { __typename: 'Collection', id: string, name: string, description: any | null, seoDescription: string | null, seoTitle: string | null } | null, translation: { __typename: 'CollectionTranslation', id: string, description: any | null, name: string | null, seoDescription: string | null, seoTitle: string | null, language: { __typename: 'LanguageDisplay', language: string } } | null };
|
||||
|
||||
export type ProductTranslationFragment = { __typename: 'ProductTranslatableContent', product: { __typename: 'Product', id: string, name: string, description: any | null, seoDescription: string | null, seoTitle: string | null } | null, translation: { __typename: 'ProductTranslation', id: string, seoTitle: string | null, seoDescription: string | null, name: string | null, description: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, plainText: string | null, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, attribute: { __typename: 'AttributeTranslatableContent', id: string, name: string }, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, plainText: string | null, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> };
|
||||
export type ProductTranslationFragment = { __typename: 'ProductTranslatableContent', product: { __typename: 'Product', id: string, name: string, description: any | null, seoDescription: string | null, seoTitle: string | null } | null, translation: { __typename: 'ProductTranslation', id: string, seoTitle: string | null, seoDescription: string | null, name: string | null, description: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> };
|
||||
|
||||
export type ProductVariantTranslationFragment = { __typename: 'ProductVariantTranslatableContent', name: string, productVariant: { __typename: 'ProductVariant', id: string } | null, translation: { __typename: 'ProductVariantTranslation', id: string, name: string, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, plainText: string | null, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, attribute: { __typename: 'AttributeTranslatableContent', id: string, name: string }, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, plainText: string | null, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> };
|
||||
export type ProductVariantTranslationFragment = { __typename: 'ProductVariantTranslatableContent', name: string, productVariant: { __typename: 'ProductVariant', id: string } | null, translation: { __typename: 'ProductVariantTranslation', id: string, name: string, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> };
|
||||
|
||||
export type SaleTranslationFragment = { __typename: 'SaleTranslatableContent', sale: { __typename: 'Sale', id: string, name: string } | null, translation: { __typename: 'SaleTranslation', id: string, name: string | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null };
|
||||
|
||||
|
@ -7231,15 +7229,17 @@ export type VoucherTranslationFragment = { __typename: 'VoucherTranslatableConte
|
|||
|
||||
export type ShippingMethodTranslationFragment = { __typename: 'ShippingMethodTranslatableContent', id: string, name: string, description: any | null, shippingMethod: { __typename: 'ShippingMethodType', id: string } | null, translation: { __typename: 'ShippingMethodTranslation', id: string, name: string | null, description: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null };
|
||||
|
||||
export type PageTranslationFragment = { __typename: 'PageTranslatableContent', page: { __typename: 'Page', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string } | null, translation: { __typename: 'PageTranslation', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, plainText: string | null, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, attribute: { __typename: 'AttributeTranslatableContent', id: string, name: string }, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, plainText: string | null, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> };
|
||||
export type PageTranslationFragment = { __typename: 'PageTranslatableContent', page: { __typename: 'Page', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string } | null, translation: { __typename: 'PageTranslation', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> };
|
||||
|
||||
export type PageTranslatableFragment = { __typename: 'PageTranslatableContent', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string, translation: { __typename: 'PageTranslation', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null };
|
||||
|
||||
export type AttributeChoicesTranslationFragment = { __typename: 'AttributeValueCountableConnection', pageInfo: { __typename: 'PageInfo', endCursor: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null }, edges: Array<{ __typename: 'AttributeValueCountableEdge', cursor: string, node: { __typename: 'AttributeValue', id: string, name: string | null, plainText: string | null, richText: any | null, inputType: AttributeInputTypeEnum | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, plainText: string | null, richText: any | null } | null } }> };
|
||||
export type AttributeChoicesTranslationFragment = { __typename: 'AttributeValueCountableConnection', pageInfo: { __typename: 'PageInfo', endCursor: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null }, edges: Array<{ __typename: 'AttributeValueCountableEdge', cursor: string, node: { __typename: 'AttributeValue', id: string, name: string | null, richText: any | null, inputType: AttributeInputTypeEnum | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, richText: any | null } | null } }> };
|
||||
|
||||
export type AttributeTranslationFragment = { __typename: 'AttributeTranslatableContent', id: string, name: string, translation: { __typename: 'AttributeTranslation', id: string, name: string } | null, attribute: { __typename: 'Attribute', id: string, name: string | null, inputType: AttributeInputTypeEnum | null } | null };
|
||||
|
||||
export type AttributeTranslationDetailsFragment = { __typename: 'AttributeTranslatableContent', translation: { __typename: 'AttributeTranslation', id: string, name: string } | null, attribute: { __typename: 'Attribute', id: string, name: string | null, inputType: AttributeInputTypeEnum | null, withChoices: boolean, choices: { __typename: 'AttributeValueCountableConnection', pageInfo: { __typename: 'PageInfo', endCursor: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null }, edges: Array<{ __typename: 'AttributeValueCountableEdge', cursor: string, node: { __typename: 'AttributeValue', id: string, name: string | null, plainText: string | null, richText: any | null, inputType: AttributeInputTypeEnum | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, plainText: string | null, richText: any | null } | null } }> } | null } | null };
|
||||
export type AttributeTranslationDetailsFragment = { __typename: 'AttributeTranslatableContent', translation: { __typename: 'AttributeTranslation', id: string, name: string } | null, attribute: { __typename: 'Attribute', id: string, name: string | null, inputType: AttributeInputTypeEnum | null, withChoices: boolean, choices: { __typename: 'AttributeValueCountableConnection', pageInfo: { __typename: 'PageInfo', endCursor: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null }, edges: Array<{ __typename: 'AttributeValueCountableEdge', cursor: string, node: { __typename: 'AttributeValue', id: string, name: string | null, richText: any | null, inputType: AttributeInputTypeEnum | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, richText: any | null } | null } }> } | null } | null };
|
||||
|
||||
export type AttributeValueTranslatableContentFragment = { __typename: 'AttributeTranslatableContent', translation: { __typename: 'AttributeTranslation', id: string, name: string } | null, attribute: { __typename: 'Attribute', id: string, name: string | null, inputType: AttributeInputTypeEnum | null, choices: { __typename: 'AttributeValueCountableConnection', pageInfo: { __typename: 'PageInfo', endCursor: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null }, edges: Array<{ __typename: 'AttributeValueCountableEdge', cursor: string, node: { __typename: 'AttributeValue', id: string, name: string | null, richText: any | null, inputType: AttributeInputTypeEnum | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, richText: any | null } | null } }> } | null } | null };
|
||||
|
||||
export type MenuItemTranslationFragment = { __typename: 'MenuItemTranslatableContent', translation: { __typename: 'MenuItemTranslation', id: string, name: string, language: { __typename: 'LanguageDisplay', language: string } } | null, menuItem: { __typename: 'MenuItem', id: string, name: string } | null };
|
||||
|
||||
|
@ -8836,7 +8836,7 @@ export type UpdatePageTranslationsMutationVariables = Exact<{
|
|||
}>;
|
||||
|
||||
|
||||
export type UpdatePageTranslationsMutation = { __typename: 'Mutation', pageTranslate: { __typename: 'PageTranslate', errors: Array<{ __typename: 'TranslationError', code: TranslationErrorCode, field: string | null, message: string | null }>, page: { __typename: 'PageTranslatableContent', page: { __typename: 'Page', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string } | null, translation: { __typename: 'PageTranslation', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, plainText: string | null, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, attribute: { __typename: 'AttributeTranslatableContent', id: string, name: string }, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, plainText: string | null, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> } | null } | null };
|
||||
export type UpdatePageTranslationsMutation = { __typename: 'Mutation', pageTranslate: { __typename: 'PageTranslate', errors: Array<{ __typename: 'TranslationError', code: TranslationErrorCode, field: string | null, message: string | null }>, page: { __typename: 'PageTranslatableContent', page: { __typename: 'Page', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string } | null, translation: { __typename: 'PageTranslation', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> } | null } | null };
|
||||
|
||||
export type UpdateVoucherTranslationsMutationVariables = Exact<{
|
||||
id: Scalars['ID'];
|
||||
|
@ -8923,7 +8923,7 @@ export type ProductTranslationsQueryVariables = Exact<{
|
|||
}>;
|
||||
|
||||
|
||||
export type ProductTranslationsQuery = { __typename: 'Query', translations: { __typename: 'TranslatableItemConnection', edges: Array<{ __typename: 'TranslatableItemEdge', node: { __typename: 'ProductTranslatableContent', product: { __typename: 'Product', id: string, name: string, description: any | null, seoDescription: string | null, seoTitle: string | null } | null, translation: { __typename: 'ProductTranslation', id: string, seoTitle: string | null, seoDescription: string | null, name: string | null, description: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, plainText: string | null, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, attribute: { __typename: 'AttributeTranslatableContent', id: string, name: string }, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, plainText: string | null, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> } | { __typename: 'CollectionTranslatableContent' } | { __typename: 'CategoryTranslatableContent' } | { __typename: 'AttributeTranslatableContent' } | { __typename: 'AttributeValueTranslatableContent' } | { __typename: 'ProductVariantTranslatableContent' } | { __typename: 'PageTranslatableContent' } | { __typename: 'ShippingMethodTranslatableContent' } | { __typename: 'SaleTranslatableContent' } | { __typename: 'VoucherTranslatableContent' } | { __typename: 'MenuItemTranslatableContent' } }>, pageInfo: { __typename: 'PageInfo', endCursor: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null } } | null };
|
||||
export type ProductTranslationsQuery = { __typename: 'Query', translations: { __typename: 'TranslatableItemConnection', edges: Array<{ __typename: 'TranslatableItemEdge', node: { __typename: 'ProductTranslatableContent', product: { __typename: 'Product', id: string, name: string, description: any | null, seoDescription: string | null, seoTitle: string | null } | null, translation: { __typename: 'ProductTranslation', id: string, seoTitle: string | null, seoDescription: string | null, name: string | null, description: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> } | { __typename: 'CollectionTranslatableContent' } | { __typename: 'CategoryTranslatableContent' } | { __typename: 'AttributeTranslatableContent' } | { __typename: 'AttributeValueTranslatableContent' } | { __typename: 'ProductVariantTranslatableContent' } | { __typename: 'PageTranslatableContent' } | { __typename: 'ShippingMethodTranslatableContent' } | { __typename: 'SaleTranslatableContent' } | { __typename: 'VoucherTranslatableContent' } | { __typename: 'MenuItemTranslatableContent' } }>, pageInfo: { __typename: 'PageInfo', endCursor: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null } } | null };
|
||||
|
||||
export type PageTranslationsQueryVariables = Exact<{
|
||||
language: LanguageCodeEnum;
|
||||
|
@ -8934,7 +8934,7 @@ export type PageTranslationsQueryVariables = Exact<{
|
|||
}>;
|
||||
|
||||
|
||||
export type PageTranslationsQuery = { __typename: 'Query', translations: { __typename: 'TranslatableItemConnection', edges: Array<{ __typename: 'TranslatableItemEdge', node: { __typename: 'ProductTranslatableContent' } | { __typename: 'CollectionTranslatableContent' } | { __typename: 'CategoryTranslatableContent' } | { __typename: 'AttributeTranslatableContent' } | { __typename: 'AttributeValueTranslatableContent' } | { __typename: 'ProductVariantTranslatableContent' } | { __typename: 'PageTranslatableContent', page: { __typename: 'Page', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string } | null, translation: { __typename: 'PageTranslation', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, plainText: string | null, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, attribute: { __typename: 'AttributeTranslatableContent', id: string, name: string }, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, plainText: string | null, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> } | { __typename: 'ShippingMethodTranslatableContent' } | { __typename: 'SaleTranslatableContent' } | { __typename: 'VoucherTranslatableContent' } | { __typename: 'MenuItemTranslatableContent' } }>, pageInfo: { __typename: 'PageInfo', endCursor: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null } } | null };
|
||||
export type PageTranslationsQuery = { __typename: 'Query', translations: { __typename: 'TranslatableItemConnection', edges: Array<{ __typename: 'TranslatableItemEdge', node: { __typename: 'ProductTranslatableContent' } | { __typename: 'CollectionTranslatableContent' } | { __typename: 'CategoryTranslatableContent' } | { __typename: 'AttributeTranslatableContent' } | { __typename: 'AttributeValueTranslatableContent' } | { __typename: 'ProductVariantTranslatableContent' } | { __typename: 'PageTranslatableContent', page: { __typename: 'Page', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string } | null, translation: { __typename: 'PageTranslation', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> } | { __typename: 'ShippingMethodTranslatableContent' } | { __typename: 'SaleTranslatableContent' } | { __typename: 'VoucherTranslatableContent' } | { __typename: 'MenuItemTranslatableContent' } }>, pageInfo: { __typename: 'PageInfo', endCursor: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null } } | null };
|
||||
|
||||
export type VoucherTranslationsQueryVariables = Exact<{
|
||||
language: LanguageCodeEnum;
|
||||
|
@ -8997,7 +8997,7 @@ export type ProductTranslationDetailsQueryVariables = Exact<{
|
|||
}>;
|
||||
|
||||
|
||||
export type ProductTranslationDetailsQuery = { __typename: 'Query', translation: { __typename: 'ProductTranslatableContent', product: { __typename: 'Product', id: string, name: string, description: any | null, seoDescription: string | null, seoTitle: string | null } | null, translation: { __typename: 'ProductTranslation', id: string, seoTitle: string | null, seoDescription: string | null, name: string | null, description: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, plainText: string | null, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, attribute: { __typename: 'AttributeTranslatableContent', id: string, name: string }, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, plainText: string | null, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> } | { __typename: 'CollectionTranslatableContent' } | { __typename: 'CategoryTranslatableContent' } | { __typename: 'AttributeTranslatableContent' } | { __typename: 'AttributeValueTranslatableContent' } | { __typename: 'ProductVariantTranslatableContent' } | { __typename: 'PageTranslatableContent' } | { __typename: 'ShippingMethodTranslatableContent' } | { __typename: 'SaleTranslatableContent' } | { __typename: 'VoucherTranslatableContent' } | { __typename: 'MenuItemTranslatableContent' } | null };
|
||||
export type ProductTranslationDetailsQuery = { __typename: 'Query', translation: { __typename: 'ProductTranslatableContent', product: { __typename: 'Product', id: string, name: string, description: any | null, seoDescription: string | null, seoTitle: string | null } | null, translation: { __typename: 'ProductTranslation', id: string, seoTitle: string | null, seoDescription: string | null, name: string | null, description: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> } | { __typename: 'CollectionTranslatableContent' } | { __typename: 'CategoryTranslatableContent' } | { __typename: 'AttributeTranslatableContent' } | { __typename: 'AttributeValueTranslatableContent' } | { __typename: 'ProductVariantTranslatableContent' } | { __typename: 'PageTranslatableContent' } | { __typename: 'ShippingMethodTranslatableContent' } | { __typename: 'SaleTranslatableContent' } | { __typename: 'VoucherTranslatableContent' } | { __typename: 'MenuItemTranslatableContent' } | null };
|
||||
|
||||
export type ProductVariantListQueryVariables = Exact<{
|
||||
id: Scalars['ID'];
|
||||
|
@ -9012,7 +9012,7 @@ export type ProductVariantTranslationDetailsQueryVariables = Exact<{
|
|||
}>;
|
||||
|
||||
|
||||
export type ProductVariantTranslationDetailsQuery = { __typename: 'Query', translation: { __typename: 'ProductTranslatableContent' } | { __typename: 'CollectionTranslatableContent' } | { __typename: 'CategoryTranslatableContent' } | { __typename: 'AttributeTranslatableContent' } | { __typename: 'AttributeValueTranslatableContent' } | { __typename: 'ProductVariantTranslatableContent', name: string, productVariant: { __typename: 'ProductVariant', id: string } | null, translation: { __typename: 'ProductVariantTranslation', id: string, name: string, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, plainText: string | null, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, attribute: { __typename: 'AttributeTranslatableContent', id: string, name: string }, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, plainText: string | null, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> } | { __typename: 'PageTranslatableContent' } | { __typename: 'ShippingMethodTranslatableContent' } | { __typename: 'SaleTranslatableContent' } | { __typename: 'VoucherTranslatableContent' } | { __typename: 'MenuItemTranslatableContent' } | null };
|
||||
export type ProductVariantTranslationDetailsQuery = { __typename: 'Query', translation: { __typename: 'ProductTranslatableContent' } | { __typename: 'CollectionTranslatableContent' } | { __typename: 'CategoryTranslatableContent' } | { __typename: 'AttributeTranslatableContent' } | { __typename: 'AttributeValueTranslatableContent' } | { __typename: 'ProductVariantTranslatableContent', name: string, productVariant: { __typename: 'ProductVariant', id: string } | null, translation: { __typename: 'ProductVariantTranslation', id: string, name: string, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> } | { __typename: 'PageTranslatableContent' } | { __typename: 'ShippingMethodTranslatableContent' } | { __typename: 'SaleTranslatableContent' } | { __typename: 'VoucherTranslatableContent' } | { __typename: 'MenuItemTranslatableContent' } | null };
|
||||
|
||||
export type CategoryTranslationDetailsQueryVariables = Exact<{
|
||||
id: Scalars['ID'];
|
||||
|
@ -9036,7 +9036,7 @@ export type PageTranslationDetailsQueryVariables = Exact<{
|
|||
}>;
|
||||
|
||||
|
||||
export type PageTranslationDetailsQuery = { __typename: 'Query', translation: { __typename: 'ProductTranslatableContent' } | { __typename: 'CollectionTranslatableContent' } | { __typename: 'CategoryTranslatableContent' } | { __typename: 'AttributeTranslatableContent' } | { __typename: 'AttributeValueTranslatableContent' } | { __typename: 'ProductVariantTranslatableContent' } | { __typename: 'PageTranslatableContent', page: { __typename: 'Page', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string } | null, translation: { __typename: 'PageTranslation', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, plainText: string | null, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, attribute: { __typename: 'AttributeTranslatableContent', id: string, name: string }, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, plainText: string | null, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> } | { __typename: 'ShippingMethodTranslatableContent' } | { __typename: 'SaleTranslatableContent' } | { __typename: 'VoucherTranslatableContent' } | { __typename: 'MenuItemTranslatableContent' } | null };
|
||||
export type PageTranslationDetailsQuery = { __typename: 'Query', translation: { __typename: 'ProductTranslatableContent' } | { __typename: 'CollectionTranslatableContent' } | { __typename: 'CategoryTranslatableContent' } | { __typename: 'AttributeTranslatableContent' } | { __typename: 'AttributeValueTranslatableContent' } | { __typename: 'ProductVariantTranslatableContent' } | { __typename: 'PageTranslatableContent', page: { __typename: 'Page', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string } | null, translation: { __typename: 'PageTranslation', id: string, content: any | null, seoDescription: string | null, seoTitle: string | null, title: string | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null, attributeValues: Array<{ __typename: 'AttributeValueTranslatableContent', id: string, name: string, richText: any | null, attributeValue: { __typename: 'AttributeValue', id: string } | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, richText: any | null, language: { __typename: 'LanguageDisplay', code: LanguageCodeEnum, language: string } } | null }> } | { __typename: 'ShippingMethodTranslatableContent' } | { __typename: 'SaleTranslatableContent' } | { __typename: 'VoucherTranslatableContent' } | { __typename: 'MenuItemTranslatableContent' } | null };
|
||||
|
||||
export type SaleTranslationDetailsQueryVariables = Exact<{
|
||||
id: Scalars['ID'];
|
||||
|
@ -9064,7 +9064,7 @@ export type AttributeTranslationDetailsQueryVariables = Exact<{
|
|||
}>;
|
||||
|
||||
|
||||
export type AttributeTranslationDetailsQuery = { __typename: 'Query', translation: { __typename: 'ProductTranslatableContent' } | { __typename: 'CollectionTranslatableContent' } | { __typename: 'CategoryTranslatableContent' } | { __typename: 'AttributeTranslatableContent', translation: { __typename: 'AttributeTranslation', id: string, name: string } | null, attribute: { __typename: 'Attribute', id: string, name: string | null, inputType: AttributeInputTypeEnum | null, withChoices: boolean, choices: { __typename: 'AttributeValueCountableConnection', pageInfo: { __typename: 'PageInfo', endCursor: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null }, edges: Array<{ __typename: 'AttributeValueCountableEdge', cursor: string, node: { __typename: 'AttributeValue', id: string, name: string | null, plainText: string | null, richText: any | null, inputType: AttributeInputTypeEnum | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, plainText: string | null, richText: any | null } | null } }> } | null } | null } | { __typename: 'AttributeValueTranslatableContent' } | { __typename: 'ProductVariantTranslatableContent' } | { __typename: 'PageTranslatableContent' } | { __typename: 'ShippingMethodTranslatableContent' } | { __typename: 'SaleTranslatableContent' } | { __typename: 'VoucherTranslatableContent' } | { __typename: 'MenuItemTranslatableContent' } | null };
|
||||
export type AttributeTranslationDetailsQuery = { __typename: 'Query', translation: { __typename: 'ProductTranslatableContent' } | { __typename: 'CollectionTranslatableContent' } | { __typename: 'CategoryTranslatableContent' } | { __typename: 'AttributeTranslatableContent', translation: { __typename: 'AttributeTranslation', id: string, name: string } | null, attribute: { __typename: 'Attribute', id: string, name: string | null, inputType: AttributeInputTypeEnum | null, withChoices: boolean, choices: { __typename: 'AttributeValueCountableConnection', pageInfo: { __typename: 'PageInfo', endCursor: string | null, hasNextPage: boolean, hasPreviousPage: boolean, startCursor: string | null }, edges: Array<{ __typename: 'AttributeValueCountableEdge', cursor: string, node: { __typename: 'AttributeValue', id: string, name: string | null, richText: any | null, inputType: AttributeInputTypeEnum | null, translation: { __typename: 'AttributeValueTranslation', id: string, name: string, richText: any | null } | null } }> } | null } | null } | { __typename: 'AttributeValueTranslatableContent' } | { __typename: 'ProductVariantTranslatableContent' } | { __typename: 'PageTranslatableContent' } | { __typename: 'ShippingMethodTranslatableContent' } | { __typename: 'SaleTranslatableContent' } | { __typename: 'VoucherTranslatableContent' } | { __typename: 'MenuItemTranslatableContent' } | null };
|
||||
|
||||
export type ShippingMethodTranslationDetailsQueryVariables = Exact<{
|
||||
id: Scalars['ID'];
|
||||
|
|
|
@ -14,10 +14,7 @@ import {
|
|||
IconButton,
|
||||
makeStyles,
|
||||
} from "@saleor/macaw-ui";
|
||||
import {
|
||||
TranslationField,
|
||||
TranslationFieldType,
|
||||
} from "@saleor/translations/types";
|
||||
import { TranslationField } from "@saleor/translations/types";
|
||||
import { ListProps } from "@saleor/types";
|
||||
import classNames from "classnames";
|
||||
import React from "react";
|
||||
|
@ -181,7 +178,7 @@ const TranslationFields: React.FC<TranslationFieldsProps> = props => {
|
|||
</div>
|
||||
<div className={classes.content}>
|
||||
{field && field.value !== undefined ? (
|
||||
field.type === TranslationFieldType.SHORT ? (
|
||||
field.type === "short" ? (
|
||||
<TranslationFieldsShort
|
||||
disabled={disabled}
|
||||
edit={false}
|
||||
|
@ -190,7 +187,7 @@ const TranslationFields: React.FC<TranslationFieldsProps> = props => {
|
|||
onDiscard={onDiscard}
|
||||
onSubmit={undefined}
|
||||
/>
|
||||
) : field.type === TranslationFieldType.LONG ? (
|
||||
) : field.type === "long" ? (
|
||||
<TranslationFieldsLong
|
||||
disabled={disabled}
|
||||
edit={false}
|
||||
|
@ -216,7 +213,7 @@ const TranslationFields: React.FC<TranslationFieldsProps> = props => {
|
|||
</div>
|
||||
<Typography className={classes.content}>
|
||||
{field && field.translation !== undefined ? (
|
||||
field.type === TranslationFieldType.SHORT ? (
|
||||
field.type === "short" ? (
|
||||
<TranslationFieldsShort
|
||||
disabled={disabled}
|
||||
edit={activeField === field.name}
|
||||
|
@ -225,7 +222,7 @@ const TranslationFields: React.FC<TranslationFieldsProps> = props => {
|
|||
onDiscard={onDiscard}
|
||||
onSubmit={data => onSubmit(field, data)}
|
||||
/>
|
||||
) : field.type === TranslationFieldType.LONG ? (
|
||||
) : field.type === "long" ? (
|
||||
<TranslationFieldsLong
|
||||
disabled={disabled}
|
||||
edit={activeField === field.name}
|
||||
|
|
|
@ -15,7 +15,6 @@ import {
|
|||
languageEntityUrl,
|
||||
TranslatableEntities,
|
||||
} from "@saleor/translations/urls";
|
||||
import { mapAttributeValuesToTranslationFields } from "@saleor/translations/utils";
|
||||
import React from "react";
|
||||
import { useIntl } from "react-intl";
|
||||
|
||||
|
@ -85,7 +84,7 @@ const TranslationsPagesPage: React.FC<TranslationsPagesPageProps> = ({
|
|||
}),
|
||||
name: PageTranslationInputFieldName.title,
|
||||
translation: data?.translation?.title || null,
|
||||
type: "short",
|
||||
type: "short" as "short",
|
||||
value: data?.page?.title,
|
||||
},
|
||||
{
|
||||
|
@ -96,7 +95,7 @@ const TranslationsPagesPage: React.FC<TranslationsPagesPageProps> = ({
|
|||
}),
|
||||
name: PageTranslationInputFieldName.content,
|
||||
translation: data?.translation?.content || null,
|
||||
type: "rich",
|
||||
type: "rich" as "rich",
|
||||
value: data?.page?.content,
|
||||
},
|
||||
]}
|
||||
|
@ -124,7 +123,7 @@ const TranslationsPagesPage: React.FC<TranslationsPagesPageProps> = ({
|
|||
}),
|
||||
name: PageTranslationInputFieldName.seoTitle,
|
||||
translation: data?.translation?.seoTitle || null,
|
||||
type: "short",
|
||||
type: "short" as "short",
|
||||
value: data?.page?.seoTitle,
|
||||
},
|
||||
{
|
||||
|
@ -134,7 +133,7 @@ const TranslationsPagesPage: React.FC<TranslationsPagesPageProps> = ({
|
|||
}),
|
||||
name: PageTranslationInputFieldName.seoDescription,
|
||||
translation: data?.translation?.seoDescription || null,
|
||||
type: "long",
|
||||
type: "long" as "long",
|
||||
value: data?.page?.seoDescription,
|
||||
},
|
||||
]}
|
||||
|
@ -152,10 +151,25 @@ const TranslationsPagesPage: React.FC<TranslationsPagesPageProps> = ({
|
|||
disabled={disabled}
|
||||
initialState={true}
|
||||
title={intl.formatMessage(commonMessages.translationAttributes)}
|
||||
fields={mapAttributeValuesToTranslationFields(
|
||||
data.attributeValues,
|
||||
intl,
|
||||
)}
|
||||
fields={
|
||||
data.attributeValues.map((attrVal, i) => ({
|
||||
id: attrVal.attributeValue.id,
|
||||
displayName: intl.formatMessage(
|
||||
{
|
||||
id: "PajjqE",
|
||||
defaultMessage: "Attribute {number}",
|
||||
description: "attribute list",
|
||||
},
|
||||
{
|
||||
number: i + 1,
|
||||
},
|
||||
),
|
||||
name: attrVal?.name,
|
||||
translation: attrVal?.translation?.richText || null,
|
||||
type: "rich" as "rich",
|
||||
value: attrVal?.richText,
|
||||
})) || []
|
||||
}
|
||||
saveButtonState={saveButtonState}
|
||||
richTextResetKey={languageCode}
|
||||
onEdit={onEdit}
|
||||
|
|
|
@ -18,7 +18,6 @@ import {
|
|||
productVariantUrl,
|
||||
TranslatableEntities,
|
||||
} from "@saleor/translations/urls";
|
||||
import { mapAttributeValuesToTranslationFields } from "@saleor/translations/utils";
|
||||
import React from "react";
|
||||
import { useIntl } from "react-intl";
|
||||
|
||||
|
@ -99,7 +98,7 @@ const TranslationsProductsPage: React.FC<TranslationsProductsPageProps> = ({
|
|||
}),
|
||||
name: TranslationInputFieldName.name,
|
||||
translation: data?.translation?.name || null,
|
||||
type: "short",
|
||||
type: "short" as "short",
|
||||
value: data?.name,
|
||||
},
|
||||
]}
|
||||
|
@ -117,10 +116,25 @@ const TranslationsProductsPage: React.FC<TranslationsProductsPageProps> = ({
|
|||
disabled={disabled}
|
||||
initialState={true}
|
||||
title={intl.formatMessage(commonMessages.translationAttributes)}
|
||||
fields={mapAttributeValuesToTranslationFields(
|
||||
data.attributeValues,
|
||||
intl,
|
||||
)}
|
||||
fields={
|
||||
data.attributeValues.map((attrVal, i) => ({
|
||||
id: attrVal.attributeValue.id,
|
||||
displayName: intl.formatMessage(
|
||||
{
|
||||
id: "PajjqE",
|
||||
defaultMessage: "Attribute {number}",
|
||||
description: "attribute list",
|
||||
},
|
||||
{
|
||||
number: i + 1,
|
||||
},
|
||||
),
|
||||
name: attrVal?.name,
|
||||
translation: attrVal?.translation?.richText || null,
|
||||
type: "rich" as "rich",
|
||||
value: attrVal?.richText,
|
||||
})) || []
|
||||
}
|
||||
saveButtonState={saveButtonState}
|
||||
richTextResetKey={languageCode}
|
||||
onEdit={onEdit}
|
||||
|
|
|
@ -15,7 +15,6 @@ import {
|
|||
languageEntityUrl,
|
||||
TranslatableEntities,
|
||||
} from "@saleor/translations/urls";
|
||||
import { mapAttributeValuesToTranslationFields } from "@saleor/translations/utils";
|
||||
import React from "react";
|
||||
import { useIntl } from "react-intl";
|
||||
|
||||
|
@ -98,7 +97,7 @@ const TranslationsProductsPage: React.FC<TranslationsProductsPageProps> = ({
|
|||
}),
|
||||
name: TranslationInputFieldName.name,
|
||||
translation: data?.translation?.name || null,
|
||||
type: "short",
|
||||
type: "short" as "short",
|
||||
value: data?.product?.name,
|
||||
},
|
||||
{
|
||||
|
@ -108,7 +107,7 @@ const TranslationsProductsPage: React.FC<TranslationsProductsPageProps> = ({
|
|||
}),
|
||||
name: TranslationInputFieldName.description,
|
||||
translation: data?.translation?.description || null,
|
||||
type: "rich",
|
||||
type: "rich" as "rich",
|
||||
value: data?.product?.description,
|
||||
},
|
||||
]}
|
||||
|
@ -135,7 +134,7 @@ const TranslationsProductsPage: React.FC<TranslationsProductsPageProps> = ({
|
|||
}),
|
||||
name: TranslationInputFieldName.seoTitle,
|
||||
translation: data?.translation?.seoTitle || null,
|
||||
type: "short",
|
||||
type: "short" as "short",
|
||||
value: data?.product?.seoTitle,
|
||||
},
|
||||
{
|
||||
|
@ -145,7 +144,7 @@ const TranslationsProductsPage: React.FC<TranslationsProductsPageProps> = ({
|
|||
}),
|
||||
name: TranslationInputFieldName.seoDescription,
|
||||
translation: data?.translation?.seoDescription || null,
|
||||
type: "long",
|
||||
type: "long" as "long",
|
||||
value: data?.product?.seoDescription,
|
||||
},
|
||||
]}
|
||||
|
@ -163,10 +162,25 @@ const TranslationsProductsPage: React.FC<TranslationsProductsPageProps> = ({
|
|||
disabled={disabled}
|
||||
initialState={true}
|
||||
title={intl.formatMessage(commonMessages.translationAttributes)}
|
||||
fields={mapAttributeValuesToTranslationFields(
|
||||
data.attributeValues,
|
||||
intl,
|
||||
)}
|
||||
fields={
|
||||
data.attributeValues.map((attrVal, i) => ({
|
||||
id: attrVal.attributeValue.id,
|
||||
displayName: intl.formatMessage(
|
||||
{
|
||||
id: "PajjqE",
|
||||
defaultMessage: "Attribute {number}",
|
||||
description: "attribute list",
|
||||
},
|
||||
{
|
||||
number: i + 1,
|
||||
},
|
||||
),
|
||||
name: attrVal?.name,
|
||||
translation: attrVal?.translation?.richText || null,
|
||||
type: "rich" as "rich",
|
||||
value: attrVal?.richText,
|
||||
})) || []
|
||||
}
|
||||
saveButtonState={saveButtonState}
|
||||
richTextResetKey={languageCode}
|
||||
onEdit={onEdit}
|
||||
|
|
|
@ -19,20 +19,12 @@ export enum PageTranslationInputFieldName {
|
|||
richText = "richText",
|
||||
}
|
||||
|
||||
export const TranslationFieldType = {
|
||||
SHORT: "short",
|
||||
LONG: "long",
|
||||
RICH: "rich",
|
||||
} as const;
|
||||
|
||||
export type TranslationFieldType = typeof TranslationFieldType[keyof typeof TranslationFieldType];
|
||||
|
||||
export interface TranslationField<T extends string = string> {
|
||||
id?: string;
|
||||
displayName: string;
|
||||
name: T;
|
||||
translation: string;
|
||||
type: TranslationFieldType;
|
||||
type: "short" | "long" | "rich";
|
||||
value: string;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
import { OutputData } from "@editorjs/editorjs";
|
||||
import {
|
||||
AttributeTranslationDetailsFragment,
|
||||
AttributeValueTranslatableFragment,
|
||||
AttributeValueTranslationInput,
|
||||
} from "@saleor/graphql";
|
||||
import {
|
||||
TranslationField,
|
||||
TranslationFieldType,
|
||||
} from "@saleor/translations/types";
|
||||
import { AttributeTranslationDetailsFragment } from "@saleor/graphql";
|
||||
import { TranslationField } from "@saleor/translations/types";
|
||||
import { mapEdgesToItems } from "@saleor/utils/maps";
|
||||
import { getParsedDataForJsonStringField } from "@saleor/utils/richText/misc";
|
||||
import { IntlShape } from "react-intl";
|
||||
|
@ -59,34 +52,3 @@ export const getTranslationFields = (
|
|||
};
|
||||
},
|
||||
) || [];
|
||||
|
||||
export const mapAttributeValuesToTranslationFields = (
|
||||
attributeValues: AttributeValueTranslatableFragment[],
|
||||
intl: IntlShape,
|
||||
) =>
|
||||
attributeValues.map<TranslationField>(attrVal => ({
|
||||
id: attrVal.attributeValue.id,
|
||||
displayName: intl.formatMessage(
|
||||
{
|
||||
id: "zgqPGF",
|
||||
defaultMessage: "Attribute {name}",
|
||||
description: "attribute list",
|
||||
},
|
||||
{
|
||||
name: attrVal.attribute.name,
|
||||
},
|
||||
),
|
||||
name: attrVal.name,
|
||||
translation:
|
||||
attrVal.translation?.richText || attrVal.translation?.plainText || null,
|
||||
type: attrVal.richText ? "rich" : "short",
|
||||
value: attrVal.richText || attrVal.plainText,
|
||||
})) || [];
|
||||
|
||||
export const getAttributeValueTranslationsInputData = (
|
||||
type: TranslationFieldType,
|
||||
data: OutputData | string,
|
||||
): AttributeValueTranslationInput =>
|
||||
type === TranslationFieldType.RICH
|
||||
? { richText: JSON.stringify(data) }
|
||||
: { plainText: data as string };
|
||||
|
|
|
@ -16,10 +16,7 @@ import { useIntl } from "react-intl";
|
|||
|
||||
import TranslationsPagesPage from "../components/TranslationsPagesPage";
|
||||
import { PageTranslationInputFieldName, TranslationField } from "../types";
|
||||
import {
|
||||
getAttributeValueTranslationsInputData,
|
||||
getParsedTranslationInputData,
|
||||
} from "../utils";
|
||||
import { getParsedTranslationInputData } from "../utils";
|
||||
|
||||
export interface TranslationsPagesQueryParams {
|
||||
activeField: string;
|
||||
|
@ -99,14 +96,14 @@ const TranslationsPages: React.FC<TranslationsPagesProps> = ({
|
|||
);
|
||||
|
||||
const handleAttributeValueSubmit = (
|
||||
{ id, type }: TranslationField<PageTranslationInputFieldName>,
|
||||
data: OutputData | string,
|
||||
{ id }: TranslationField<PageTranslationInputFieldName>,
|
||||
data: OutputData,
|
||||
) =>
|
||||
extractMutationErrors(
|
||||
updateAttributeValueTranslations({
|
||||
variables: {
|
||||
id,
|
||||
input: getAttributeValueTranslationsInputData(type, data),
|
||||
input: { richText: JSON.stringify(data) },
|
||||
language: languageCode,
|
||||
},
|
||||
}),
|
||||
|
|
|
@ -16,10 +16,7 @@ import { useIntl } from "react-intl";
|
|||
import { extractMutationErrors, maybe } from "../../misc";
|
||||
import TranslationsProductVariantsPage from "../components/TranslationsProductVariantsPage";
|
||||
import { TranslationField, TranslationInputFieldName } from "../types";
|
||||
import {
|
||||
getAttributeValueTranslationsInputData,
|
||||
getParsedTranslationInputData,
|
||||
} from "../utils";
|
||||
import { getParsedTranslationInputData } from "../utils";
|
||||
|
||||
export interface TranslationsProductVariantsQueryParams {
|
||||
activeField: string;
|
||||
|
@ -101,14 +98,14 @@ const TranslationsProductVariants: React.FC<TranslationsProductVariantsProps> =
|
|||
);
|
||||
|
||||
const handleAttributeValueSubmit = (
|
||||
{ id, type }: TranslationField<TranslationInputFieldName>,
|
||||
data: OutputData | string,
|
||||
{ id }: TranslationField<TranslationInputFieldName>,
|
||||
data: OutputData,
|
||||
) =>
|
||||
extractMutationErrors(
|
||||
updateAttributeValueTranslations({
|
||||
variables: {
|
||||
id,
|
||||
input: getAttributeValueTranslationsInputData(type, data),
|
||||
input: { richText: JSON.stringify(data) },
|
||||
language: languageCode,
|
||||
},
|
||||
}),
|
||||
|
|
|
@ -16,10 +16,7 @@ import { useIntl } from "react-intl";
|
|||
import { extractMutationErrors, maybe } from "../../misc";
|
||||
import TranslationsProductsPage from "../components/TranslationsProductsPage";
|
||||
import { TranslationField, TranslationInputFieldName } from "../types";
|
||||
import {
|
||||
getAttributeValueTranslationsInputData,
|
||||
getParsedTranslationInputData,
|
||||
} from "../utils";
|
||||
import { getParsedTranslationInputData } from "../utils";
|
||||
|
||||
export interface TranslationsProductsQueryParams {
|
||||
activeField: string;
|
||||
|
@ -99,14 +96,14 @@ const TranslationsProducts: React.FC<TranslationsProductsProps> = ({
|
|||
);
|
||||
|
||||
const handleAttributeValueSubmit = (
|
||||
{ id, type }: TranslationField<TranslationInputFieldName>,
|
||||
data: OutputData | string,
|
||||
{ id }: TranslationField<TranslationInputFieldName>,
|
||||
data: OutputData,
|
||||
) =>
|
||||
extractMutationErrors(
|
||||
updateAttributeValueTranslations({
|
||||
variables: {
|
||||
id,
|
||||
input: getAttributeValueTranslationsInputData(type, data),
|
||||
input: { richText: JSON.stringify(data) },
|
||||
language: languageCode,
|
||||
},
|
||||
}),
|
||||
|
|
Loading…
Reference in a new issue