diff --git a/CHANGELOG.md b/CHANGELOG.md index 5524533a8..c4317b3e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ All notable, unreleased changes to this project will be documented in this file. - Fix trigger form change when collections are being added to list of product collections - #987 by @gax97 - Add product variant webhooks - #1006 by @piotrgrundas - Use default sort for search products list - #997 by @orzechdev +- Add text attribute input - #1023 by @piotrgrundas - Update CollectionBulkDelete error type - #1030 by @d-wysocki - Remove mailing settings - #1027 by @dominik-zeglen - Update schema to contain email plugin changes - #1029 by @dominik-zeglen diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index 7e5d3ab83..66d4ad9a2 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -861,6 +861,10 @@ "context": "references attribute type", "string": "References" }, + "src_dot_attributes_dot_components_dot_AttributeDetails_dot_text": { + "context": "text attribute type", + "string": "Text" + }, "src_dot_attributes_dot_components_dot_AttributeDetails_dot_valueRequired": { "context": "check to require attribute to have value", "string": "Value Required" @@ -1681,7 +1685,7 @@ "context": "attributes, section header", "string": "Attributes" }, - "src_dot_components_dot_Attributes_dot_multipleValueLable": { + "src_dot_components_dot_Attributes_dot_multipleValueLabel": { "context": "attribute values", "string": "Values" }, @@ -6468,6 +6472,10 @@ "src_dot_translations_dot_components_dot_TranslationsProductTypesPage_dot_2642976392": { "string": "Attribute Name" }, + "src_dot_translations_dot_components_dot_TranslationsProductTypesPage_dot_3495336243": { + "context": "attribute richtext value", + "string": "Text" + }, "src_dot_translations_dot_components_dot_TranslationsProductTypesPage_dot_884093025": { "context": "header", "string": "Translation Attribute \"{attribute}\" - {languageCode}" diff --git a/schema.graphql b/schema.graphql index dd57c86fc..8d9c50c8a 100644 --- a/schema.graphql +++ b/schema.graphql @@ -501,6 +501,7 @@ enum AttributeInputTypeEnum { MULTISELECT FILE REFERENCE + RICH_TEXT } type AttributeReorderValues { @@ -579,6 +580,7 @@ type AttributeValue implements Node { inputType: AttributeInputTypeEnum reference: ID file: File + richText: JSONString } type AttributeValueBulkDelete { @@ -597,6 +599,7 @@ type AttributeValueCreate { input AttributeValueCreateInput { name: String! value: String + richText: JSONString } type AttributeValueDelete { @@ -612,6 +615,7 @@ input AttributeValueInput { file: String contentType: String references: [ID!] + richText: JSONString } type AttributeValueTranslatableContent implements Node { @@ -630,9 +634,15 @@ type AttributeValueTranslate { type AttributeValueTranslation implements Node { id: ID! name: String! + richText: JSONString language: LanguageDisplay! } +input AttributeValueTranslationInput { + name: String + richText: JSONString +} + type AttributeValueUpdate { errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") attribute: Attribute @@ -2801,7 +2811,7 @@ type Mutation { attributeValueCreate(attribute: ID!, input: AttributeValueCreateInput!): AttributeValueCreate attributeValueDelete(id: ID!): AttributeValueDelete attributeValueUpdate(id: ID!, input: AttributeValueCreateInput!): AttributeValueUpdate - attributeValueTranslate(id: ID!, input: NameTranslationInput!, languageCode: LanguageCodeEnum!): AttributeValueTranslate + attributeValueTranslate(id: ID!, input: AttributeValueTranslationInput!, languageCode: LanguageCodeEnum!): AttributeValueTranslate attributeReorderValues(attributeId: ID!, moves: [ReorderInput]!): AttributeReorderValues appCreate(input: AppInput!): AppCreate appUpdate(id: ID!, input: AppInput!): AppUpdate @@ -3690,6 +3700,7 @@ type Payment implements Node { token: String! checkout: Checkout order: Order + paymentMethodType: String! customerIpAddress: String chargeStatus: PaymentChargeStatusEnum! actions: [OrderAction]! diff --git a/src/attributes/components/AttributeDetails/AttributeDetails.tsx b/src/attributes/components/AttributeDetails/AttributeDetails.tsx index 53c59fa88..d11da3468 100644 --- a/src/attributes/components/AttributeDetails/AttributeDetails.tsx +++ b/src/attributes/components/AttributeDetails/AttributeDetails.tsx @@ -64,6 +64,10 @@ const inputTypeMessages = defineMessages({ references: { defaultMessage: "References", description: "references attribute type" + }, + text: { + defaultMessage: "Text", + description: "text attribute type" } }); @@ -120,6 +124,10 @@ const AttributeDetails: React.FC = props => { { label: intl.formatMessage(inputTypeMessages.references), value: AttributeInputTypeEnum.REFERENCE + }, + { + label: intl.formatMessage(inputTypeMessages.text), + value: AttributeInputTypeEnum.RICH_TEXT } ]; const entityTypeChoices = [ diff --git a/src/attributes/fixtures.ts b/src/attributes/fixtures.ts index e0e167360..84a02b283 100644 --- a/src/attributes/fixtures.ts +++ b/src/attributes/fixtures.ts @@ -35,7 +35,8 @@ export const attribute: AttributeDetailsFragment = { id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI0", name: "John Doe", reference: null, - slug: "john-doe" + slug: "john-doe", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -43,7 +44,8 @@ export const attribute: AttributeDetailsFragment = { id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI1", name: "Milionare Pirate", reference: null, - slug: "milionare-pirate" + slug: "milionare-pirate", + richText: null } ], visibleInStorefront: true @@ -69,7 +71,8 @@ export const attributes: Array = [ id: "attrv-1", name: "Attribute 1 Value 1", reference: null, - slug: "attr-1-v-1" + slug: "attr-1-v-1", + richText: null } ] }, @@ -34,7 +35,8 @@ const attributes: FormsetData = [ id: "attrv-2", name: "Attribute 2 Value 1", reference: null, - slug: "attr-2-v-1" + slug: "attr-2-v-1", + richText: null }, { __typename: "AttributeValue", @@ -42,7 +44,8 @@ const attributes: FormsetData = [ id: "attrv-3", name: "Attribute 2 Value 2", reference: null, - slug: "attr-2-v-2" + slug: "attr-2-v-2", + richText: null }, { __typename: "AttributeValue", @@ -50,7 +53,8 @@ const attributes: FormsetData = [ id: "attrv-4", name: "Attribute 2 Value 3", reference: null, - slug: "attr-2-v-3" + slug: "attr-2-v-3", + richText: null } ] }, @@ -73,7 +77,8 @@ const attributes: FormsetData = [ id: "gdghdgdhkkdae", name: "File First Value", reference: null, - slug: "file-first-value" + slug: "file-first-value", + richText: null } ] }, diff --git a/src/attributes/utils/handlers.ts b/src/attributes/utils/handlers.ts index 28110b2db..bbd0d1f61 100644 --- a/src/attributes/utils/handlers.ts +++ b/src/attributes/utils/handlers.ts @@ -203,6 +203,12 @@ export const prepareAttributesInput = ({ references: attribute.value }; } + if (attribute.data.inputType === AttributeInputTypeEnum.RICH_TEXT) { + return { + id: attribute.id, + richText: attribute.value[0] + }; + } return { id: attribute.id, values: attribute.value[0] === "" ? [] : attribute.value diff --git a/src/attributes/views/AttributeCreate/AttributeCreate.tsx b/src/attributes/views/AttributeCreate/AttributeCreate.tsx index 42589f312..00188afe3 100644 --- a/src/attributes/views/AttributeCreate/AttributeCreate.tsx +++ b/src/attributes/views/AttributeCreate/AttributeCreate.tsx @@ -162,6 +162,7 @@ const AttributeDetails: React.FC = ({ params }) => { slug: slugify(value.name).toLowerCase(), sortOrder: valueIndex, value: null, + richText: null, ...value }))} /> diff --git a/src/components/Attributes/AttributeRow.tsx b/src/components/Attributes/AttributeRow.tsx new file mode 100644 index 000000000..a5da29d78 --- /dev/null +++ b/src/components/Attributes/AttributeRow.tsx @@ -0,0 +1,181 @@ +import makeStyles from "@material-ui/core/styles/makeStyles"; +import { AttributeInput } from "@saleor/components/Attributes/Attributes"; +import BasicAttributeRow from "@saleor/components/Attributes/BasicAttributeRow"; +import ExtendedAttributeRow from "@saleor/components/Attributes/ExtendedAttributeRow"; +import { + getErrorMessage, + getFileChoice, + getMultiChoices, + getMultiDisplayValue, + getReferenceDisplayValue, + getRichTextData, + getSingleChoices +} from "@saleor/components/Attributes/utils"; +import FileUploadField from "@saleor/components/FileUploadField"; +import MultiAutocompleteSelectField from "@saleor/components/MultiAutocompleteSelectField"; +import RichTextEditor from "@saleor/components/RichTextEditor"; +import SingleAutocompleteSelectField from "@saleor/components/SingleAutocompleteSelectField"; +import SortableChipsField from "@saleor/components/SortableChipsField"; +import { PageErrorWithAttributesFragment } from "@saleor/fragments/types/PageErrorWithAttributesFragment"; +import { ProductErrorWithAttributesFragment } from "@saleor/fragments/types/ProductErrorWithAttributesFragment"; +import { FormsetChange } from "@saleor/hooks/useFormset"; +import { ReorderEvent } from "@saleor/types"; +import { AttributeInputTypeEnum } from "@saleor/types/globalTypes"; +import React from "react"; +import { defineMessages, useIntl } from "react-intl"; + +const messages = defineMessages({ + multipleValueLabel: { + defaultMessage: "Values", + description: "attribute values" + }, + valueLabel: { + defaultMessage: "Value", + description: "attribute value" + } +}); + +const useStyles = makeStyles( + () => ({ + fileField: { + float: "right" + } + }), + { name: "AttributeRow" } +); + +export interface AttributeRowHandlers { + onChange: FormsetChange; + onFileChange: FormsetChange; + onMultiChange: FormsetChange; + onReferencesAddClick: (attribute: AttributeInput) => void; + onReferencesRemove: FormsetChange; + onReferencesReorder: FormsetChange; +} + +interface AttributeRowProps extends AttributeRowHandlers { + attribute: AttributeInput; + disabled: boolean; + error: ProductErrorWithAttributesFragment | PageErrorWithAttributesFragment; + loading: boolean; +} + +const AttributeRow: React.FC = ({ + attribute, + disabled, + error, + loading, + onFileChange, + onMultiChange, + onReferencesAddClick, + onReferencesRemove, + onReferencesReorder, + onChange +}) => { + const intl = useIntl(); + const classes = useStyles({}); + + switch (attribute.data.inputType) { + case AttributeInputTypeEnum.REFERENCE: + return ( + onReferencesAddClick(attribute)} + disabled={disabled} + > + + onReferencesRemove( + attribute.id, + attribute.value?.filter(id => id !== value) + ) + } + onValueReorder={event => onReferencesReorder(attribute.id, event)} + loading={loading} + error={!!error} + helperText={getErrorMessage(error, intl)} + /> + + ); + case AttributeInputTypeEnum.FILE: + return ( + + onFileChange(attribute.id, file)} + onFileDelete={() => onFileChange(attribute.id, undefined)} + error={!!error} + helperText={getErrorMessage(error, intl)} + inputProps={{ + name: `attribute:${attribute.label}` + }} + /> + + ); + case AttributeInputTypeEnum.DROPDOWN: + return ( + + value.slug === attribute.value[0] + )?.name || + attribute.value[0] || + "" + } + emptyOption={!attribute.data.isRequired} + error={!!error} + helperText={getErrorMessage(error, intl)} + name={`attribute:${attribute.label}`} + label={intl.formatMessage(messages.valueLabel)} + value={attribute.value[0]} + onChange={event => onChange(attribute.id, event.target.value)} + allowCustomValues={!attribute.data.isRequired} + /> + + ); + case AttributeInputTypeEnum.RICH_TEXT: + return ( + + onChange(attribute.id, JSON.stringify(data))} + data={getRichTextData(attribute)} + /> + + ); + default: + return ( + + onMultiChange(attribute.id, event.target.value)} + allowCustomValues={!attribute.data.isRequired} + /> + + ); + } +}; +AttributeRow.displayName = "AttributeRow"; +export default AttributeRow; diff --git a/src/components/Attributes/Attributes.tsx b/src/components/Attributes/Attributes.tsx index 2084e75d6..cc70a5f58 100644 --- a/src/components/Attributes/Attributes.tsx +++ b/src/components/Attributes/Attributes.tsx @@ -6,39 +6,20 @@ import ArrowDropDownIcon from "@material-ui/icons/ArrowDropDown"; import { AttributeReference } from "@saleor/attributes/utils/data"; import CardTitle from "@saleor/components/CardTitle"; import Hr from "@saleor/components/Hr"; -import MultiAutocompleteSelectField, { - MultiAutocompleteChoiceType -} from "@saleor/components/MultiAutocompleteSelectField"; -import SingleAutocompleteSelectField, { - SingleAutocompleteChoiceType -} from "@saleor/components/SingleAutocompleteSelectField"; import { AttributeValueFragment } from "@saleor/fragments/types/AttributeValueFragment"; import { PageErrorWithAttributesFragment } from "@saleor/fragments/types/PageErrorWithAttributesFragment"; import { ProductErrorWithAttributesFragment } from "@saleor/fragments/types/ProductErrorWithAttributesFragment"; -import { FormsetAtomicData, FormsetChange } from "@saleor/hooks/useFormset"; +import { FormsetAtomicData } from "@saleor/hooks/useFormset"; import { makeStyles } from "@saleor/theme"; -import { ReorderEvent } from "@saleor/types"; import { AttributeEntityTypeEnum, AttributeInputTypeEnum } from "@saleor/types/globalTypes"; -import { getProductErrorMessage } from "@saleor/utils/errors"; -import getPageErrorMessage from "@saleor/utils/errors/page"; import classNames from "classnames"; import React from "react"; -import { - defineMessages, - FormattedMessage, - IntlShape, - useIntl -} from "react-intl"; +import { defineMessages, FormattedMessage, useIntl } from "react-intl"; -import FileUploadField, { FileChoiceType } from "../FileUploadField"; -import SortableChipsField, { - SortableChipsFieldValueType -} from "../SortableChipsField"; -import BasicAttributeRow from "./BasicAttributeRow"; -import ExtendedAttributeRow from "./ExtendedAttributeRow"; +import AttributeRow, { AttributeRowHandlers } from "./AttributeRow"; import { VariantAttributeScope } from "./types"; export interface AttributeInputData { @@ -52,7 +33,7 @@ export interface AttributeInputData { } export type AttributeInput = FormsetAtomicData; export type AttributeFileInput = FormsetAtomicData; -export interface AttributesProps { +export interface AttributesProps extends AttributeRowHandlers { attributes: AttributeInput[]; disabled: boolean; loading: boolean; @@ -60,12 +41,6 @@ export interface AttributesProps { ProductErrorWithAttributesFragment | PageErrorWithAttributesFragment >; title?: React.ReactNode; - onChange: FormsetChange; - onMultiChange: FormsetChange; - onFileChange: FormsetChange; - onReferencesRemove: FormsetChange; - onReferencesAddClick: (attribute: AttributeInput) => void; - onReferencesReorder: FormsetChange; } const useStyles = makeStyles( @@ -107,9 +82,6 @@ const useStyles = makeStyles( display: "flex", flex: 1 }, - fileField: { - float: "right" - }, rotate: { transform: "rotate(180deg)" }, @@ -125,104 +97,6 @@ const useStyles = makeStyles( { name: "Attributes" } ); -function getMultiChoices( - values: AttributeValueFragment[] -): MultiAutocompleteChoiceType[] { - return values.map(value => ({ - label: value.name, - value: value.slug - })); -} - -function getMultiDisplayValue( - attribute: AttributeInput -): MultiAutocompleteChoiceType[] { - if (!attribute.value) { - return []; - } - - return attribute.value.map(attributeValue => { - const definedAttributeValue = attribute.data.values.find( - definedValue => definedValue.slug === attributeValue - ); - if (!!definedAttributeValue) { - return { - label: definedAttributeValue.name, - value: definedAttributeValue.slug - }; - } - - return { - label: attributeValue, - value: attributeValue - }; - }); -} - -function getReferenceDisplayValue( - attribute: AttributeInput -): SortableChipsFieldValueType[] { - if (!attribute.value) { - return []; - } - - return attribute.value.map(attributeValue => { - const definedAttributeValue = attribute.data.values.find( - definedValue => definedValue.reference === attributeValue - ); - // If value has been previously assigned, use it's data - if (!!definedAttributeValue) { - return { - label: definedAttributeValue.name, - value: definedAttributeValue.reference - }; - } - - const definedAttributeReference = attribute.data.references?.find( - reference => reference.value === attributeValue - ); - // If value has not been yet assigned, use data of reference - if (!!definedAttributeReference) { - return definedAttributeReference; - } - - return { - label: attributeValue, - value: attributeValue - }; - }); -} - -function getSingleChoices( - values: AttributeValueFragment[] -): SingleAutocompleteChoiceType[] { - return values.map(value => ({ - label: value.name, - value: value.slug - })); -} - -function getFileChoice(attribute: AttributeInput): FileChoiceType { - const attributeValue = attribute.value?.length > 0 && attribute.value[0]; - - const definedAttributeValue = attribute.data.values.find( - definedValue => definedValue.slug === attributeValue - ); - - if (definedAttributeValue) { - return { - file: definedAttributeValue.file, - label: definedAttributeValue.name, - value: definedAttributeValue.slug - }; - } - - return { - label: attributeValue, - value: attributeValue - }; -} - const messages = defineMessages({ attributesNumber: { defaultMessage: "{number} Attributes", @@ -231,41 +105,14 @@ const messages = defineMessages({ header: { defaultMessage: "Attributes", description: "attributes, section header" - }, - multipleValueLable: { - defaultMessage: "Values", - description: "attribute values" - }, - valueLabel: { - defaultMessage: "Value", - description: "attribute value" } }); -function getErrorMessage( - err: ProductErrorWithAttributesFragment | PageErrorWithAttributesFragment, - intl: IntlShape -): string { - switch (err?.__typename) { - case "ProductError": - return getProductErrorMessage(err, intl); - case "PageError": - return getPageErrorMessage(err, intl); - } -} - const Attributes: React.FC = ({ attributes, - disabled, - loading, errors, title, - onChange, - onMultiChange, - onFileChange, - onReferencesRemove, - onReferencesAddClick, - onReferencesReorder + ...props }) => { const intl = useIntl(); const classes = useStyles({}); @@ -310,95 +157,11 @@ const Attributes: React.FC = ({ return ( {attributeIndex > 0 &&
} - {attribute.data.inputType === - AttributeInputTypeEnum.REFERENCE ? ( - onReferencesAddClick(attribute)} - disabled={disabled} - > - - onReferencesRemove( - attribute.id, - attribute.value?.filter(id => id !== value) - ) - } - onValueReorder={event => - onReferencesReorder(attribute.id, event) - } - loading={loading} - error={!!error} - helperText={getErrorMessage(error, intl)} - /> - - ) : attribute.data.inputType === - AttributeInputTypeEnum.FILE ? ( - - onFileChange(attribute.id, file)} - onFileDelete={() => - onFileChange(attribute.id, undefined) - } - error={!!error} - helperText={getErrorMessage(error, intl)} - inputProps={{ - name: `attribute:${attribute.label}` - }} - /> - - ) : attribute.data.inputType === - AttributeInputTypeEnum.DROPDOWN ? ( - - value.slug === attribute.value[0] - )?.name || - attribute.value[0] || - "" - } - emptyOption={!attribute.data.isRequired} - error={!!error} - helperText={getErrorMessage(error, intl)} - name={`attribute:${attribute.label}`} - label={intl.formatMessage(messages.valueLabel)} - value={attribute.value[0]} - onChange={event => - onChange(attribute.id, event.target.value) - } - allowCustomValues={!attribute.data.isRequired} - /> - - ) : ( - - - onMultiChange(attribute.id, event.target.value) - } - allowCustomValues={!attribute.data.isRequired} - /> - - )} +
); })} diff --git a/src/components/Attributes/fixtures.ts b/src/components/Attributes/fixtures.ts index 6fb778150..a0126c9d5 100644 --- a/src/components/Attributes/fixtures.ts +++ b/src/components/Attributes/fixtures.ts @@ -16,7 +16,8 @@ const DROPDOWN_ATTRIBUTE: AttributeInput = { id: "fdinugiffgffd", name: "Dropdown First Value", reference: null, - slug: "dropdown-first-value" + slug: "dropdown-first-value", + richText: null }, { __typename: "AttributeValue", @@ -24,7 +25,8 @@ const DROPDOWN_ATTRIBUTE: AttributeInput = { id: "fdhfdhdihidff", name: "Dropdown Second Value", reference: null, - slug: "dropdown-second-value" + slug: "dropdown-second-value", + richText: null } ] }, @@ -44,7 +46,8 @@ const MULTISELECT_ATTRIBUTE: AttributeInput = { id: "terteretregtt", name: "Multiselect First Value", reference: null, - slug: "multiselect-first-value" + slug: "multiselect-first-value", + richText: null }, { __typename: "AttributeValue", @@ -52,7 +55,8 @@ const MULTISELECT_ATTRIBUTE: AttributeInput = { id: "tyueyryetopwr", name: "Multiselect Second Value", reference: null, - slug: "multiselect-second-value" + slug: "multiselect-second-value", + richText: null }, { __typename: "AttributeValue", @@ -60,7 +64,8 @@ const MULTISELECT_ATTRIBUTE: AttributeInput = { id: "truiwrtweirqd", name: "Multiselect Third Value", reference: null, - slug: "multiselect-third-value" + slug: "multiselect-third-value", + richText: null } ] }, @@ -84,7 +89,8 @@ const FILE_ATTRIBUTE: AttributeInput = { id: "gdghdgdhkkdae", name: "File First Value", reference: null, - slug: "file-first-value" + slug: "file-first-value", + richText: null } ] }, @@ -119,7 +125,8 @@ const REFERENCE_ATTRIBUTE: AttributeInput = { id: "vbnhgcvjhbvhj", name: "References First Value", reference: null, - slug: "references-first-value" + slug: "references-first-value", + richText: null }, { __typename: "AttributeValue", @@ -127,7 +134,8 @@ const REFERENCE_ATTRIBUTE: AttributeInput = { id: "gucngdfdfvdvd", name: "References Second Value", reference: null, - slug: "references-second-value" + slug: "references-second-value", + richText: null }, { __typename: "AttributeValue", @@ -135,7 +143,8 @@ const REFERENCE_ATTRIBUTE: AttributeInput = { id: "dfdfdsfdsfdse", name: "References Third Value", reference: null, - slug: "references-third-value" + slug: "references-third-value", + richText: null } ] }, @@ -144,11 +153,52 @@ const REFERENCE_ATTRIBUTE: AttributeInput = { value: [] }; +const RICH_TEXT_ATTRIBUTE: AttributeInput = { + data: { + inputType: AttributeInputTypeEnum.RICH_TEXT, + isRequired: true, + values: [ + { + __typename: "AttributeValue", + file: null, + id: "asdfafd", + name: "Some cool text", + reference: null, + slug: "text", + richText: JSON.stringify({ + time: 1617788754145, + blocks: [{ data: { text: "Some cool text" }, type: "paragraph" }], + version: "2.19.3" + }) + } + ], + selectedValues: [ + { + __typename: "AttributeValue", + file: null, + id: "asdfafd", + name: "Some cool text", + reference: null, + slug: "text", + richText: JSON.stringify({ + time: 1617788754145, + blocks: [{ data: { text: "Some cool text" }, type: "paragraph" }], + version: "2.19.3" + }) + } + ] + }, + id: "asdfafd", + label: "Text Attribute", + value: [] +}; + export const ATTRIBUTES: AttributeInput[] = [ DROPDOWN_ATTRIBUTE, MULTISELECT_ATTRIBUTE, FILE_ATTRIBUTE, - REFERENCE_ATTRIBUTE + REFERENCE_ATTRIBUTE, + RICH_TEXT_ATTRIBUTE ]; export const ATTRIBUTES_SELECTED: AttributeInput[] = [ @@ -174,5 +224,9 @@ export const ATTRIBUTES_SELECTED: AttributeInput[] = [ REFERENCE_ATTRIBUTE.data.values[1].id, REFERENCE_ATTRIBUTE.data.values[2].id ] + }, + { + ...RICH_TEXT_ATTRIBUTE, + value: [RICH_TEXT_ATTRIBUTE.data.values[0].richText] } ]; diff --git a/src/components/Attributes/utils.ts b/src/components/Attributes/utils.ts new file mode 100644 index 000000000..e755678d0 --- /dev/null +++ b/src/components/Attributes/utils.ts @@ -0,0 +1,127 @@ +import { OutputData } from "@editorjs/editorjs"; +import { AttributeInput } from "@saleor/components/Attributes/Attributes"; +import { FileChoiceType } from "@saleor/components/FileUploadField"; +import { MultiAutocompleteChoiceType } from "@saleor/components/MultiAutocompleteSelectField"; +import { SingleAutocompleteChoiceType } from "@saleor/components/SingleAutocompleteSelectField"; +import { SortableChipsFieldValueType } from "@saleor/components/SortableChipsField"; +import { AttributeValueFragment } from "@saleor/fragments/types/AttributeValueFragment"; +import { PageErrorWithAttributesFragment } from "@saleor/fragments/types/PageErrorWithAttributesFragment"; +import { ProductErrorWithAttributesFragment } from "@saleor/fragments/types/ProductErrorWithAttributesFragment"; +import { getProductErrorMessage } from "@saleor/utils/errors"; +import getPageErrorMessage from "@saleor/utils/errors/page"; +import { IntlShape } from "react-intl"; + +export function getSingleChoices( + values: AttributeValueFragment[] +): SingleAutocompleteChoiceType[] { + return values.map(value => ({ + label: value.name, + value: value.slug + })); +} + +export const getRichTextData = (attribute: AttributeInput): OutputData => { + const data = attribute.data.selectedValues?.[0]?.richText; + return data ? JSON.parse(data) : {}; +}; + +export function getFileChoice(attribute: AttributeInput): FileChoiceType { + const attributeValue = attribute.value?.length > 0 && attribute.value[0]; + + const definedAttributeValue = attribute.data.values.find( + definedValue => definedValue.slug === attributeValue + ); + + if (definedAttributeValue) { + return { + file: definedAttributeValue.file, + label: definedAttributeValue.name, + value: definedAttributeValue.slug + }; + } + + return { + label: attributeValue, + value: attributeValue + }; +} + +export function getReferenceDisplayValue( + attribute: AttributeInput +): SortableChipsFieldValueType[] { + if (!attribute.value) { + return []; + } + + return attribute.value.map(attributeValue => { + const definedAttributeValue = attribute.data.values.find( + definedValue => definedValue.reference === attributeValue + ); + // If value has been previously assigned, use it's data + if (!!definedAttributeValue) { + return { + label: definedAttributeValue.name, + value: definedAttributeValue.reference + }; + } + + const definedAttributeReference = attribute.data.references?.find( + reference => reference.value === attributeValue + ); + // If value has not been yet assigned, use data of reference + if (!!definedAttributeReference) { + return definedAttributeReference; + } + + return { + label: attributeValue, + value: attributeValue + }; + }); +} + +export function getMultiChoices( + values: AttributeValueFragment[] +): MultiAutocompleteChoiceType[] { + return values.map(value => ({ + label: value.name, + value: value.slug + })); +} + +export function getMultiDisplayValue( + attribute: AttributeInput +): MultiAutocompleteChoiceType[] { + if (!attribute.value) { + return []; + } + + return attribute.value.map(attributeValue => { + const definedAttributeValue = attribute.data.values.find( + definedValue => definedValue.slug === attributeValue + ); + if (!!definedAttributeValue) { + return { + label: definedAttributeValue.name, + value: definedAttributeValue.slug + }; + } + + return { + label: attributeValue, + value: attributeValue + }; + }); +} + +export function getErrorMessage( + err: ProductErrorWithAttributesFragment | PageErrorWithAttributesFragment, + intl: IntlShape +): string { + switch (err?.__typename) { + case "ProductError": + return getProductErrorMessage(err, intl); + case "PageError": + return getPageErrorMessage(err, intl); + } +} diff --git a/src/components/ExtendedPageHeader/ExtendedPageHeader.tsx b/src/components/ExtendedPageHeader/ExtendedPageHeader.tsx index 1bfd85d15..15589f4e7 100644 --- a/src/components/ExtendedPageHeader/ExtendedPageHeader.tsx +++ b/src/components/ExtendedPageHeader/ExtendedPageHeader.tsx @@ -29,7 +29,8 @@ const useStyles = makeStyles( root: { alignItems: "center", display: "flex", - marginBottom: theme.spacing(3) + marginBottom: theme.spacing(3), + wordBreak: "break-all" }, subtitle: { alignItems: "center", diff --git a/src/fragments/attributes.ts b/src/fragments/attributes.ts index 1ba2d436f..b9db3468e 100644 --- a/src/fragments/attributes.ts +++ b/src/fragments/attributes.ts @@ -13,6 +13,7 @@ export const attributeValueFragment = gql` ...FileFragment } reference + richText } `; diff --git a/src/fragments/translations.ts b/src/fragments/translations.ts index aa041d6ef..3623b581a 100644 --- a/src/fragments/translations.ts +++ b/src/fragments/translations.ts @@ -167,12 +167,16 @@ export const attributeTranslationFragment = gql` attribute { id name + inputType values { id name + richText + inputType translation(languageCode: $language) { id name + richText } } } diff --git a/src/fragments/types/AttributeDetailsFragment.ts b/src/fragments/types/AttributeDetailsFragment.ts index 55202d4f1..fddd5a6c8 100644 --- a/src/fragments/types/AttributeDetailsFragment.ts +++ b/src/fragments/types/AttributeDetailsFragment.ts @@ -34,6 +34,7 @@ export interface AttributeDetailsFragment_values { slug: string | null; file: AttributeDetailsFragment_values_file | null; reference: string | null; + richText: any | null; } export interface AttributeDetailsFragment { diff --git a/src/fragments/types/AttributeTranslationFragment.ts b/src/fragments/types/AttributeTranslationFragment.ts index cd6481343..33fff9d94 100644 --- a/src/fragments/types/AttributeTranslationFragment.ts +++ b/src/fragments/types/AttributeTranslationFragment.ts @@ -3,6 +3,8 @@ // @generated // This file was automatically generated and should not be edited. +import { AttributeInputTypeEnum } from "./../../types/globalTypes"; + // ==================================================== // GraphQL fragment: AttributeTranslationFragment // ==================================================== @@ -17,12 +19,15 @@ export interface AttributeTranslationFragment_attribute_values_translation { __typename: "AttributeValueTranslation"; id: string; name: string; + richText: any | null; } export interface AttributeTranslationFragment_attribute_values { __typename: "AttributeValue"; id: string; name: string | null; + richText: any | null; + inputType: AttributeInputTypeEnum | null; translation: AttributeTranslationFragment_attribute_values_translation | null; } @@ -30,6 +35,7 @@ export interface AttributeTranslationFragment_attribute { __typename: "Attribute"; id: string; name: string | null; + inputType: AttributeInputTypeEnum | null; values: (AttributeTranslationFragment_attribute_values | null)[] | null; } diff --git a/src/fragments/types/AttributeValueFragment.ts b/src/fragments/types/AttributeValueFragment.ts index 6527f18f3..e0e0c94f9 100644 --- a/src/fragments/types/AttributeValueFragment.ts +++ b/src/fragments/types/AttributeValueFragment.ts @@ -20,4 +20,5 @@ export interface AttributeValueFragment { slug: string | null; file: AttributeValueFragment_file | null; reference: string | null; + richText: any | null; } diff --git a/src/fragments/types/PageAttributesFragment.ts b/src/fragments/types/PageAttributesFragment.ts index 6da125cbb..aabe979d4 100644 --- a/src/fragments/types/PageAttributesFragment.ts +++ b/src/fragments/types/PageAttributesFragment.ts @@ -22,6 +22,7 @@ export interface PageAttributesFragment_attributes_attribute_values { slug: string | null; file: PageAttributesFragment_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface PageAttributesFragment_attributes_attribute { @@ -48,6 +49,7 @@ export interface PageAttributesFragment_attributes_values { slug: string | null; file: PageAttributesFragment_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface PageAttributesFragment_attributes { @@ -69,6 +71,7 @@ export interface PageAttributesFragment_pageType_attributes_values { slug: string | null; file: PageAttributesFragment_pageType_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface PageAttributesFragment_pageType_attributes { diff --git a/src/fragments/types/PageDetailsFragment.ts b/src/fragments/types/PageDetailsFragment.ts index 5245e373b..20bce742b 100644 --- a/src/fragments/types/PageDetailsFragment.ts +++ b/src/fragments/types/PageDetailsFragment.ts @@ -22,6 +22,7 @@ export interface PageDetailsFragment_attributes_attribute_values { slug: string | null; file: PageDetailsFragment_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface PageDetailsFragment_attributes_attribute { @@ -48,6 +49,7 @@ export interface PageDetailsFragment_attributes_values { slug: string | null; file: PageDetailsFragment_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface PageDetailsFragment_attributes { @@ -69,6 +71,7 @@ export interface PageDetailsFragment_pageType_attributes_values { slug: string | null; file: PageDetailsFragment_pageType_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface PageDetailsFragment_pageType_attributes { diff --git a/src/fragments/types/Product.ts b/src/fragments/types/Product.ts index 1047f85d5..14ef89acd 100644 --- a/src/fragments/types/Product.ts +++ b/src/fragments/types/Product.ts @@ -22,6 +22,7 @@ export interface Product_attributes_attribute_values { slug: string | null; file: Product_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface Product_attributes_attribute { @@ -48,6 +49,7 @@ export interface Product_attributes_values { slug: string | null; file: Product_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface Product_attributes { @@ -69,6 +71,7 @@ export interface Product_productType_variantAttributes_values { slug: string | null; file: Product_productType_variantAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface Product_productType_variantAttributes { diff --git a/src/fragments/types/ProductVariant.ts b/src/fragments/types/ProductVariant.ts index 9bf030b35..de5aee4b0 100644 --- a/src/fragments/types/ProductVariant.ts +++ b/src/fragments/types/ProductVariant.ts @@ -34,6 +34,7 @@ export interface ProductVariant_selectionAttributes_attribute_values { slug: string | null; file: ProductVariant_selectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariant_selectionAttributes_attribute { @@ -60,6 +61,7 @@ export interface ProductVariant_selectionAttributes_values { slug: string | null; file: ProductVariant_selectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariant_selectionAttributes { @@ -81,6 +83,7 @@ export interface ProductVariant_nonSelectionAttributes_attribute_values { slug: string | null; file: ProductVariant_nonSelectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariant_nonSelectionAttributes_attribute { @@ -107,6 +110,7 @@ export interface ProductVariant_nonSelectionAttributes_values { slug: string | null; file: ProductVariant_nonSelectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariant_nonSelectionAttributes { diff --git a/src/fragments/types/ProductVariantAttributesFragment.ts b/src/fragments/types/ProductVariantAttributesFragment.ts index c05645e4c..94101bc52 100644 --- a/src/fragments/types/ProductVariantAttributesFragment.ts +++ b/src/fragments/types/ProductVariantAttributesFragment.ts @@ -22,6 +22,7 @@ export interface ProductVariantAttributesFragment_attributes_attribute_values { slug: string | null; file: ProductVariantAttributesFragment_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantAttributesFragment_attributes_attribute { @@ -48,6 +49,7 @@ export interface ProductVariantAttributesFragment_attributes_values { slug: string | null; file: ProductVariantAttributesFragment_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantAttributesFragment_attributes { @@ -69,6 +71,7 @@ export interface ProductVariantAttributesFragment_productType_variantAttributes_ slug: string | null; file: ProductVariantAttributesFragment_productType_variantAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantAttributesFragment_productType_variantAttributes { diff --git a/src/fragments/types/SelectedVariantAttributeFragment.ts b/src/fragments/types/SelectedVariantAttributeFragment.ts index b3c127e36..3bca456b4 100644 --- a/src/fragments/types/SelectedVariantAttributeFragment.ts +++ b/src/fragments/types/SelectedVariantAttributeFragment.ts @@ -22,6 +22,7 @@ export interface SelectedVariantAttributeFragment_attribute_values { slug: string | null; file: SelectedVariantAttributeFragment_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface SelectedVariantAttributeFragment_attribute { @@ -48,6 +49,7 @@ export interface SelectedVariantAttributeFragment_values { slug: string | null; file: SelectedVariantAttributeFragment_values_file | null; reference: string | null; + richText: any | null; } export interface SelectedVariantAttributeFragment { diff --git a/src/fragments/types/VariantAttributeFragment.ts b/src/fragments/types/VariantAttributeFragment.ts index 1d72d6011..ec7caa476 100644 --- a/src/fragments/types/VariantAttributeFragment.ts +++ b/src/fragments/types/VariantAttributeFragment.ts @@ -22,6 +22,7 @@ export interface VariantAttributeFragment_values { slug: string | null; file: VariantAttributeFragment_values_file | null; reference: string | null; + richText: any | null; } export interface VariantAttributeFragment { diff --git a/src/pages/fixtures.ts b/src/pages/fixtures.ts index 172787bec..39d6dd409 100644 --- a/src/pages/fixtures.ts +++ b/src/pages/fixtures.ts @@ -55,7 +55,8 @@ export const page: PageDetails_page = { slug: "suzanne-ellison", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null }, { id: "QXR0cmlidXRlVmFsdWU6ODg=", @@ -63,7 +64,8 @@ export const page: PageDetails_page = { slug: "dennis-perkins", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null }, { id: "QXR0cmlidXRlVmFsdWU6ODk=", @@ -71,7 +73,8 @@ export const page: PageDetails_page = { slug: "dylan-lamb", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null } ], __typename: "Attribute" @@ -83,7 +86,8 @@ export const page: PageDetails_page = { slug: "dylan-lamb", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null } ], __typename: "SelectedAttribute" @@ -103,7 +107,8 @@ export const page: PageDetails_page = { slug: "security", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null }, { id: "QXR0cmlidXRlVmFsdWU6OTE=", @@ -111,7 +116,8 @@ export const page: PageDetails_page = { slug: "support", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null }, { id: "QXR0cmlidXRlVmFsdWU6OTI=", @@ -119,7 +125,8 @@ export const page: PageDetails_page = { slug: "medical", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null }, { id: "QXR0cmlidXRlVmFsdWU6OTM=", @@ -127,7 +134,8 @@ export const page: PageDetails_page = { slug: "general", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null } ], __typename: "Attribute" @@ -139,7 +147,8 @@ export const page: PageDetails_page = { slug: "security", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null } ], __typename: "SelectedAttribute" @@ -173,7 +182,8 @@ export const page: PageDetails_page = { slug: "suzanne-ellison", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null }, { id: "QXR0cmlidXRlVmFsdWU6ODg=", @@ -181,7 +191,8 @@ export const page: PageDetails_page = { slug: "dennis-perkins", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null }, { id: "QXR0cmlidXRlVmFsdWU6ODk=", @@ -189,7 +200,8 @@ export const page: PageDetails_page = { slug: "dylan-lamb", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null } ], __typename: "Attribute" @@ -207,7 +219,8 @@ export const page: PageDetails_page = { slug: "security", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null }, { id: "QXR0cmlidXRlVmFsdWU6OTE=", @@ -215,7 +228,8 @@ export const page: PageDetails_page = { slug: "support", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null }, { id: "QXR0cmlidXRlVmFsdWU6OTI=", @@ -223,7 +237,8 @@ export const page: PageDetails_page = { slug: "medical", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null }, { id: "QXR0cmlidXRlVmFsdWU6OTM=", @@ -231,7 +246,8 @@ export const page: PageDetails_page = { slug: "general", reference: null, __typename: "AttributeValue", - file: null + file: null, + richText: null } ], __typename: "Attribute" diff --git a/src/pages/types/PageCreate.ts b/src/pages/types/PageCreate.ts index ab7fbecd4..437d089ec 100644 --- a/src/pages/types/PageCreate.ts +++ b/src/pages/types/PageCreate.ts @@ -30,6 +30,7 @@ export interface PageCreate_pageCreate_page_attributes_attribute_values { slug: string | null; file: PageCreate_pageCreate_page_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface PageCreate_pageCreate_page_attributes_attribute { @@ -56,6 +57,7 @@ export interface PageCreate_pageCreate_page_attributes_values { slug: string | null; file: PageCreate_pageCreate_page_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface PageCreate_pageCreate_page_attributes { @@ -77,6 +79,7 @@ export interface PageCreate_pageCreate_page_pageType_attributes_values { slug: string | null; file: PageCreate_pageCreate_page_pageType_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface PageCreate_pageCreate_page_pageType_attributes { diff --git a/src/pages/types/PageDetails.ts b/src/pages/types/PageDetails.ts index 5e0453f65..1cb8238de 100644 --- a/src/pages/types/PageDetails.ts +++ b/src/pages/types/PageDetails.ts @@ -22,6 +22,7 @@ export interface PageDetails_page_attributes_attribute_values { slug: string | null; file: PageDetails_page_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface PageDetails_page_attributes_attribute { @@ -48,6 +49,7 @@ export interface PageDetails_page_attributes_values { slug: string | null; file: PageDetails_page_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface PageDetails_page_attributes { @@ -69,6 +71,7 @@ export interface PageDetails_page_pageType_attributes_values { slug: string | null; file: PageDetails_page_pageType_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface PageDetails_page_pageType_attributes { diff --git a/src/pages/types/PageUpdate.ts b/src/pages/types/PageUpdate.ts index 4c760cccc..74e6cfc5d 100644 --- a/src/pages/types/PageUpdate.ts +++ b/src/pages/types/PageUpdate.ts @@ -29,6 +29,7 @@ export interface PageUpdate_pageUpdate_page_attributes_attribute_values { slug: string | null; file: PageUpdate_pageUpdate_page_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface PageUpdate_pageUpdate_page_attributes_attribute { @@ -55,6 +56,7 @@ export interface PageUpdate_pageUpdate_page_attributes_values { slug: string | null; file: PageUpdate_pageUpdate_page_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface PageUpdate_pageUpdate_page_attributes { @@ -76,6 +78,7 @@ export interface PageUpdate_pageUpdate_page_pageType_attributes_values { slug: string | null; file: PageUpdate_pageUpdate_page_pageType_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface PageUpdate_pageUpdate_page_pageType_attributes { diff --git a/src/productTypes/fixtures.ts b/src/productTypes/fixtures.ts index e79379c0f..540c17d51 100644 --- a/src/productTypes/fixtures.ts +++ b/src/productTypes/fixtures.ts @@ -32,7 +32,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "john-doe", sortOrder: 0, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -43,7 +44,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "milionare-pirate", sortOrder: 1, type: "STRING", - value: "" + value: "", + richText: null } ] } @@ -67,7 +69,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "100g", sortOrder: 0, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -78,7 +81,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "250g", sortOrder: 1, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -89,7 +93,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "500g", sortOrder: 2, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -100,7 +105,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "1kg", sortOrder: 3, type: "STRING", - value: "" + value: "", + richText: null } ] } @@ -124,7 +130,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "saleor", sortOrder: 0, type: "STRING", - value: "" + value: "", + richText: null } ] } @@ -148,7 +155,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "100g", sortOrder: 0, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -159,7 +167,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "250g", sortOrder: 1, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -170,7 +179,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "500g", sortOrder: 2, type: "STRING", - value: "" + value: "", + richText: null } ] } @@ -194,7 +204,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "arabica", sortOrder: 0, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -205,7 +216,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "robusta", sortOrder: 1, type: "STRING", - value: "" + value: "", + richText: null } ] } @@ -229,7 +241,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "round", sortOrder: 0, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -240,7 +253,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "v-neck", sortOrder: 1, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -251,7 +265,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "polo", sortOrder: 2, type: "STRING", - value: "" + value: "", + richText: null } ] } @@ -275,7 +290,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "blue", sortOrder: 0, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -286,7 +302,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "white", sortOrder: 1, type: "STRING", - value: "" + value: "", + richText: null } ] } @@ -310,7 +327,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "soft", sortOrder: 0, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -321,7 +339,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "hard", sortOrder: 1, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -332,7 +351,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "middle-soft", sortOrder: 2, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -343,7 +363,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "middle-hard", sortOrder: 3, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -354,7 +375,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "middle", sortOrder: 4, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -365,7 +387,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "very-hard", sortOrder: 5, type: "STRING", - value: "" + value: "", + richText: null } ] } @@ -389,7 +412,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "sour", sortOrder: 0, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -400,7 +424,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "sweet", sortOrder: 1, type: "STRING", - value: "" + value: "", + richText: null } ] } @@ -424,7 +449,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "english", sortOrder: 0, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -435,7 +461,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "pirate", sortOrder: 1, type: "STRING", - value: "" + value: "", + richText: null } ] } @@ -459,7 +486,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "mirumee-press", sortOrder: 0, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -470,7 +498,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "saleor-publishing", sortOrder: 1, type: "STRING", - value: "" + value: "", + richText: null } ] } @@ -494,7 +523,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "xs", sortOrder: 0, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -505,7 +535,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "s", sortOrder: 1, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -516,7 +547,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "m", sortOrder: 2, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -527,7 +559,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "l", sortOrder: 3, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -538,7 +571,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "xl", sortOrder: 4, type: "STRING", - value: "" + value: "", + richText: null }, { __typename: "AttributeValue" as "AttributeValue", @@ -549,7 +583,8 @@ export const attributes: ProductType_productType_productAttributes[] = [ slug: "xxl", sortOrder: 5, type: "STRING", - value: "" + value: "", + richText: null } ] } diff --git a/src/products/components/ProductVariantPage/form.tsx b/src/products/components/ProductVariantPage/form.tsx index 44b859390..c130f6349 100644 --- a/src/products/components/ProductVariantPage/form.tsx +++ b/src/products/components/ProductVariantPage/form.tsx @@ -135,6 +135,8 @@ function useProductVariantUpdateForm( makeChangeHandler: makeMetadataChangeHandler } = useMetadataChangeTrigger(); + // console.log({ attributes, initial }); + const handleChange: FormChange = (event, cb) => { form.change(event, cb); triggerChange(); @@ -177,6 +179,7 @@ function useProductVariantUpdateForm( attributes.data, triggerChange ); + const handleStockAdd = (id: string) => { triggerChange(); stocks.add({ diff --git a/src/products/fixtures.ts b/src/products/fixtures.ts index 90f4720b1..6017fe85d 100644 --- a/src/products/fixtures.ts +++ b/src/products/fixtures.ts @@ -36,7 +36,8 @@ export const product: ( id: "ptav47282", name: "portals", reference: null, - slug: "portals" + slug: "portals", + richText: null }, { __typename: "AttributeValue", @@ -44,7 +45,8 @@ export const product: ( id: "ptav17253", name: "Baht", reference: null, - slug: "Baht" + slug: "Baht", + richText: null } ] }, @@ -55,7 +57,8 @@ export const product: ( id: "ptav47282", name: "portals", reference: null, - slug: "portals" + slug: "portals", + richText: null } ] }, @@ -76,7 +79,8 @@ export const product: ( id: "ptav31282", name: "payment", reference: null, - slug: "payment" + slug: "payment", + richText: null }, { __typename: "AttributeValue", @@ -84,7 +88,8 @@ export const product: ( id: "ptav14907", name: "Auto Loan Account", reference: null, - slug: "Auto-Loan-Account" + slug: "Auto-Loan-Account", + richText: null }, { __typename: "AttributeValue", @@ -92,7 +97,8 @@ export const product: ( id: "ptav27366", name: "Garden", reference: null, - slug: "Garden" + slug: "Garden", + richText: null }, { __typename: "AttributeValue", @@ -100,7 +106,8 @@ export const product: ( id: "ptav11873", name: "override", reference: null, - slug: "override" + slug: "override", + richText: null } ] }, @@ -111,7 +118,8 @@ export const product: ( id: "ptav14907", name: "Auto Loan Account", reference: null, - slug: "Auto-Loan-Account" + slug: "Auto-Loan-Account", + richText: null } ] } @@ -292,7 +300,8 @@ export const product: ( id: "gdghdgdhkkdae", name: "File First Value", reference: null, - slug: "file-first-value" + slug: "file-first-value", + richText: null } ] } @@ -313,7 +322,8 @@ export const product: ( id: "ptvav47282", name: "Black", reference: null, - slug: "black" + slug: "black", + richText: null }, { __typename: "AttributeValue", @@ -321,7 +331,8 @@ export const product: ( id: "ptvav17253", name: "White", reference: null, - slug: "white" + slug: "white", + richText: null } ] } @@ -350,7 +361,8 @@ export const product: ( id: "gdghdgdhkkdae", name: "File First Value", reference: null, - slug: "file-first-value" + slug: "file-first-value", + richText: null } ] }, @@ -368,7 +380,8 @@ export const product: ( id: "ptvav47282", name: "Black", reference: null, - slug: "black" + slug: "black", + richText: null }, { __typename: "AttributeValue", @@ -376,7 +389,8 @@ export const product: ( id: "ptvav17253", name: "White", reference: null, - slug: "white" + slug: "white", + richText: null } ] } @@ -832,7 +846,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6MQ==", name: "Pineapple", reference: null, - slug: "pineapple" + slug: "pineapple", + richText: null } ] } @@ -940,7 +955,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6Mg==", name: "Coconut", reference: null, - slug: "coconut" + slug: "coconut", + richText: null } ] } @@ -1048,7 +1064,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6Mw==", name: "Apple", reference: null, - slug: "apple" + slug: "apple", + richText: null } ] } @@ -1157,7 +1174,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6NDk=", name: "Orange", reference: null, - slug: "orange" + slug: "orange", + richText: null } ] } @@ -1265,7 +1283,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6NTA=", name: "Banana", reference: null, - slug: "banana" + slug: "banana", + richText: null } ] } @@ -1373,7 +1392,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6NTE=", name: "Bean", reference: null, - slug: "bean" + slug: "bean", + richText: null } ] } @@ -1481,7 +1501,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6NTI=", name: "Carrot", reference: null, - slug: "carrot" + slug: "carrot", + richText: null } ] } @@ -1589,7 +1610,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6NTM=", name: "Sprouty", reference: null, - slug: "sprouty" + slug: "sprouty", + richText: null } ] } @@ -1697,7 +1719,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6ODI=", name: "Cotton", reference: null, - slug: "cotton" + slug: "cotton", + richText: null } ] } @@ -1805,7 +1828,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6ODI=", name: "Cotton", reference: null, - slug: "cotton" + slug: "cotton", + richText: null } ] } @@ -1913,7 +1937,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6ODI=", name: "Cotton", reference: null, - slug: "cotton" + slug: "cotton", + richText: null } ] } @@ -2021,7 +2046,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6ODI=", name: "Cotton", reference: null, - slug: "cotton" + slug: "cotton", + richText: null } ] } @@ -2129,7 +2155,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6ODI=", name: "Cotton", reference: null, - slug: "cotton" + slug: "cotton", + richText: null } ] } @@ -2237,7 +2264,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6ODI=", name: "Cotton", reference: null, - slug: "cotton" + slug: "cotton", + richText: null } ] } @@ -2345,7 +2373,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6ODI=", name: "Cotton", reference: null, - slug: "cotton" + slug: "cotton", + richText: null } ] } @@ -2453,7 +2482,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6ODI=", name: "Cotton", reference: null, - slug: "cotton" + slug: "cotton", + richText: null } ] } @@ -2561,7 +2591,8 @@ export const products = ( id: "QXR0cmlidXRlVmFsdWU6NzI=", name: "Cotton", reference: null, - slug: "cotton" + slug: "cotton", + richText: null } ] } @@ -2758,7 +2789,8 @@ export const variant = (placeholderImage: string): ProductVariant => ({ id: "gdghdgdhkkdae", name: "File First Value", reference: null, - slug: "file-first-value" + slug: "file-first-value", + richText: null } ] }, @@ -2773,7 +2805,8 @@ export const variant = (placeholderImage: string): ProductVariant => ({ id: "gdghdgdhkkdae", name: "File First Value", reference: null, - slug: "file-first-value" + slug: "file-first-value", + richText: null } ] } @@ -3016,7 +3049,8 @@ export const variant = (placeholderImage: string): ProductVariant => ({ id: "ptav47282", name: "portals", reference: null, - slug: "portals" + slug: "portals", + richText: null }, { __typename: "AttributeValue", @@ -3024,7 +3058,8 @@ export const variant = (placeholderImage: string): ProductVariant => ({ id: "ptav17253", name: "Baht", reference: null, - slug: "Baht" + slug: "Baht", + richText: null } ] }, @@ -3035,7 +3070,8 @@ export const variant = (placeholderImage: string): ProductVariant => ({ id: "ptav47282", name: "portals", reference: null, - slug: "portals" + slug: "portals", + richText: null } ] }, @@ -3056,7 +3092,8 @@ export const variant = (placeholderImage: string): ProductVariant => ({ id: "ptav31282", name: "payment", reference: null, - slug: "payment" + slug: "payment", + richText: null }, { __typename: "AttributeValue", @@ -3064,7 +3101,8 @@ export const variant = (placeholderImage: string): ProductVariant => ({ id: "ptav14907", name: "Auto Loan Account", reference: null, - slug: "Auto-Loan-Account" + slug: "Auto-Loan-Account", + richText: null }, { __typename: "AttributeValue", @@ -3072,7 +3110,8 @@ export const variant = (placeholderImage: string): ProductVariant => ({ id: "ptav27366", name: "Garden", reference: null, - slug: "Garden" + slug: "Garden", + richText: null }, { __typename: "AttributeValue", @@ -3080,7 +3119,8 @@ export const variant = (placeholderImage: string): ProductVariant => ({ id: "ptav11873", name: "override", reference: null, - slug: "override" + slug: "override", + richText: null } ] }, @@ -3091,7 +3131,8 @@ export const variant = (placeholderImage: string): ProductVariant => ({ id: "ptav14907", name: "Auto Loan Account", reference: null, - slug: "Auto-Loan-Account" + slug: "Auto-Loan-Account", + richText: null } ] } diff --git a/src/products/types/CreateMultipleVariantsData.ts b/src/products/types/CreateMultipleVariantsData.ts index 6be7df30d..7f9618fcb 100644 --- a/src/products/types/CreateMultipleVariantsData.ts +++ b/src/products/types/CreateMultipleVariantsData.ts @@ -22,6 +22,7 @@ export interface CreateMultipleVariantsData_product_attributes_attribute_values slug: string | null; file: CreateMultipleVariantsData_product_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface CreateMultipleVariantsData_product_attributes_attribute { @@ -48,6 +49,7 @@ export interface CreateMultipleVariantsData_product_attributes_values { slug: string | null; file: CreateMultipleVariantsData_product_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface CreateMultipleVariantsData_product_attributes { @@ -69,6 +71,7 @@ export interface CreateMultipleVariantsData_product_productType_variantAttribute slug: string | null; file: CreateMultipleVariantsData_product_productType_variantAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface CreateMultipleVariantsData_product_productType_variantAttributes { diff --git a/src/products/types/ProductChannelListingUpdate.ts b/src/products/types/ProductChannelListingUpdate.ts index efe5d093c..312fbb71f 100644 --- a/src/products/types/ProductChannelListingUpdate.ts +++ b/src/products/types/ProductChannelListingUpdate.ts @@ -22,6 +22,7 @@ export interface ProductChannelListingUpdate_productChannelListingUpdate_product slug: string | null; file: ProductChannelListingUpdate_productChannelListingUpdate_product_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductChannelListingUpdate_productChannelListingUpdate_product_attributes_attribute { @@ -48,6 +49,7 @@ export interface ProductChannelListingUpdate_productChannelListingUpdate_product slug: string | null; file: ProductChannelListingUpdate_productChannelListingUpdate_product_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductChannelListingUpdate_productChannelListingUpdate_product_attributes { @@ -69,6 +71,7 @@ export interface ProductChannelListingUpdate_productChannelListingUpdate_product slug: string | null; file: ProductChannelListingUpdate_productChannelListingUpdate_product_productType_variantAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductChannelListingUpdate_productChannelListingUpdate_product_productType_variantAttributes { diff --git a/src/products/types/ProductCreate.ts b/src/products/types/ProductCreate.ts index 19f893573..387fb7184 100644 --- a/src/products/types/ProductCreate.ts +++ b/src/products/types/ProductCreate.ts @@ -29,6 +29,7 @@ export interface ProductCreate_productCreate_product_attributes_attribute_values slug: string | null; file: ProductCreate_productCreate_product_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductCreate_productCreate_product_attributes_attribute { @@ -55,6 +56,7 @@ export interface ProductCreate_productCreate_product_attributes_values { slug: string | null; file: ProductCreate_productCreate_product_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductCreate_productCreate_product_attributes { @@ -76,6 +78,7 @@ export interface ProductCreate_productCreate_product_productType_variantAttribut slug: string | null; file: ProductCreate_productCreate_product_productType_variantAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductCreate_productCreate_product_productType_variantAttributes { diff --git a/src/products/types/ProductDetails.ts b/src/products/types/ProductDetails.ts index 2446716d4..824578fd0 100644 --- a/src/products/types/ProductDetails.ts +++ b/src/products/types/ProductDetails.ts @@ -22,6 +22,7 @@ export interface ProductDetails_product_attributes_attribute_values { slug: string | null; file: ProductDetails_product_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductDetails_product_attributes_attribute { @@ -48,6 +49,7 @@ export interface ProductDetails_product_attributes_values { slug: string | null; file: ProductDetails_product_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductDetails_product_attributes { @@ -69,6 +71,7 @@ export interface ProductDetails_product_productType_variantAttributes_values { slug: string | null; file: ProductDetails_product_productType_variantAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductDetails_product_productType_variantAttributes { diff --git a/src/products/types/ProductList.ts b/src/products/types/ProductList.ts index 745be758f..b759b4f39 100644 --- a/src/products/types/ProductList.ts +++ b/src/products/types/ProductList.ts @@ -90,6 +90,7 @@ export interface ProductList_products_edges_node_attributes_values { slug: string | null; file: ProductList_products_edges_node_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductList_products_edges_node_attributes { diff --git a/src/products/types/ProductMediaCreate.ts b/src/products/types/ProductMediaCreate.ts index b0a767b2d..192358dcd 100644 --- a/src/products/types/ProductMediaCreate.ts +++ b/src/products/types/ProductMediaCreate.ts @@ -28,6 +28,7 @@ export interface ProductMediaCreate_productMediaCreate_product_attributes_attrib slug: string | null; file: ProductMediaCreate_productMediaCreate_product_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductMediaCreate_productMediaCreate_product_attributes_attribute { @@ -54,6 +55,7 @@ export interface ProductMediaCreate_productMediaCreate_product_attributes_values slug: string | null; file: ProductMediaCreate_productMediaCreate_product_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductMediaCreate_productMediaCreate_product_attributes { @@ -75,6 +77,7 @@ export interface ProductMediaCreate_productMediaCreate_product_productType_varia slug: string | null; file: ProductMediaCreate_productMediaCreate_product_productType_variantAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductMediaCreate_productMediaCreate_product_productType_variantAttributes { diff --git a/src/products/types/ProductMediaUpdate.ts b/src/products/types/ProductMediaUpdate.ts index f0fdf95a4..9ec1e8d56 100644 --- a/src/products/types/ProductMediaUpdate.ts +++ b/src/products/types/ProductMediaUpdate.ts @@ -28,6 +28,7 @@ export interface ProductMediaUpdate_productMediaUpdate_product_attributes_attrib slug: string | null; file: ProductMediaUpdate_productMediaUpdate_product_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductMediaUpdate_productMediaUpdate_product_attributes_attribute { @@ -54,6 +55,7 @@ export interface ProductMediaUpdate_productMediaUpdate_product_attributes_values slug: string | null; file: ProductMediaUpdate_productMediaUpdate_product_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductMediaUpdate_productMediaUpdate_product_attributes { @@ -75,6 +77,7 @@ export interface ProductMediaUpdate_productMediaUpdate_product_productType_varia slug: string | null; file: ProductMediaUpdate_productMediaUpdate_product_productType_variantAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductMediaUpdate_productMediaUpdate_product_productType_variantAttributes { diff --git a/src/products/types/ProductType.ts b/src/products/types/ProductType.ts index 5de7b7b7b..9f829698c 100644 --- a/src/products/types/ProductType.ts +++ b/src/products/types/ProductType.ts @@ -22,6 +22,7 @@ export interface ProductType_productType_productAttributes_values { slug: string | null; file: ProductType_productType_productAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductType_productType_productAttributes { diff --git a/src/products/types/ProductUpdate.ts b/src/products/types/ProductUpdate.ts index eab22f2c5..34bcbeef9 100644 --- a/src/products/types/ProductUpdate.ts +++ b/src/products/types/ProductUpdate.ts @@ -29,6 +29,7 @@ export interface ProductUpdate_productUpdate_product_attributes_attribute_values slug: string | null; file: ProductUpdate_productUpdate_product_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductUpdate_productUpdate_product_attributes_attribute { @@ -55,6 +56,7 @@ export interface ProductUpdate_productUpdate_product_attributes_values { slug: string | null; file: ProductUpdate_productUpdate_product_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductUpdate_productUpdate_product_attributes { @@ -76,6 +78,7 @@ export interface ProductUpdate_productUpdate_product_productType_variantAttribut slug: string | null; file: ProductUpdate_productUpdate_product_productType_variantAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductUpdate_productUpdate_product_productType_variantAttributes { diff --git a/src/products/types/ProductVariantChannelListingUpdate.ts b/src/products/types/ProductVariantChannelListingUpdate.ts index 1dbd079cc..34a8db684 100644 --- a/src/products/types/ProductVariantChannelListingUpdate.ts +++ b/src/products/types/ProductVariantChannelListingUpdate.ts @@ -34,6 +34,7 @@ export interface ProductVariantChannelListingUpdate_productVariantChannelListing slug: string | null; file: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes_attribute { @@ -60,6 +61,7 @@ export interface ProductVariantChannelListingUpdate_productVariantChannelListing slug: string | null; file: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes { @@ -81,6 +83,7 @@ export interface ProductVariantChannelListingUpdate_productVariantChannelListing slug: string | null; file: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes_attribute { @@ -107,6 +110,7 @@ export interface ProductVariantChannelListingUpdate_productVariantChannelListing slug: string | null; file: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes { diff --git a/src/products/types/ProductVariantCreateData.ts b/src/products/types/ProductVariantCreateData.ts index eac020b24..37396976c 100644 --- a/src/products/types/ProductVariantCreateData.ts +++ b/src/products/types/ProductVariantCreateData.ts @@ -41,6 +41,7 @@ export interface ProductVariantCreateData_product_productType_selectionVariantAt slug: string | null; file: ProductVariantCreateData_product_productType_selectionVariantAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantCreateData_product_productType_selectionVariantAttributes { @@ -67,6 +68,7 @@ export interface ProductVariantCreateData_product_productType_nonSelectionVarian slug: string | null; file: ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantCreateData_product_productType_nonSelectionVariantAttributes { diff --git a/src/products/types/ProductVariantDetails.ts b/src/products/types/ProductVariantDetails.ts index b85dd64a2..bae241e45 100644 --- a/src/products/types/ProductVariantDetails.ts +++ b/src/products/types/ProductVariantDetails.ts @@ -34,6 +34,7 @@ export interface ProductVariantDetails_productVariant_selectionAttributes_attrib slug: string | null; file: ProductVariantDetails_productVariant_selectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantDetails_productVariant_selectionAttributes_attribute { @@ -60,6 +61,7 @@ export interface ProductVariantDetails_productVariant_selectionAttributes_values slug: string | null; file: ProductVariantDetails_productVariant_selectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantDetails_productVariant_selectionAttributes { @@ -81,6 +83,7 @@ export interface ProductVariantDetails_productVariant_nonSelectionAttributes_att slug: string | null; file: ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantDetails_productVariant_nonSelectionAttributes_attribute { @@ -107,6 +110,7 @@ export interface ProductVariantDetails_productVariant_nonSelectionAttributes_val slug: string | null; file: ProductVariantDetails_productVariant_nonSelectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantDetails_productVariant_nonSelectionAttributes { diff --git a/src/products/types/ProductVariantReorder.ts b/src/products/types/ProductVariantReorder.ts index 355621fbd..7e2410b80 100644 --- a/src/products/types/ProductVariantReorder.ts +++ b/src/products/types/ProductVariantReorder.ts @@ -28,6 +28,7 @@ export interface ProductVariantReorder_productVariantReorder_product_attributes_ slug: string | null; file: ProductVariantReorder_productVariantReorder_product_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantReorder_productVariantReorder_product_attributes_attribute { @@ -54,6 +55,7 @@ export interface ProductVariantReorder_productVariantReorder_product_attributes_ slug: string | null; file: ProductVariantReorder_productVariantReorder_product_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantReorder_productVariantReorder_product_attributes { @@ -75,6 +77,7 @@ export interface ProductVariantReorder_productVariantReorder_product_productType slug: string | null; file: ProductVariantReorder_productVariantReorder_product_productType_variantAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantReorder_productVariantReorder_product_productType_variantAttributes { diff --git a/src/products/types/ProductVariantSetDefault.ts b/src/products/types/ProductVariantSetDefault.ts index 16688fb51..779483e5d 100644 --- a/src/products/types/ProductVariantSetDefault.ts +++ b/src/products/types/ProductVariantSetDefault.ts @@ -28,6 +28,7 @@ export interface ProductVariantSetDefault_productVariantSetDefault_product_attri slug: string | null; file: ProductVariantSetDefault_productVariantSetDefault_product_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantSetDefault_productVariantSetDefault_product_attributes_attribute { @@ -54,6 +55,7 @@ export interface ProductVariantSetDefault_productVariantSetDefault_product_attri slug: string | null; file: ProductVariantSetDefault_productVariantSetDefault_product_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantSetDefault_productVariantSetDefault_product_attributes { @@ -75,6 +77,7 @@ export interface ProductVariantSetDefault_productVariantSetDefault_product_produ slug: string | null; file: ProductVariantSetDefault_productVariantSetDefault_product_productType_variantAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface ProductVariantSetDefault_productVariantSetDefault_product_productType_variantAttributes { diff --git a/src/products/types/SimpleProductUpdate.ts b/src/products/types/SimpleProductUpdate.ts index 878054f1a..236938ed1 100644 --- a/src/products/types/SimpleProductUpdate.ts +++ b/src/products/types/SimpleProductUpdate.ts @@ -29,6 +29,7 @@ export interface SimpleProductUpdate_productUpdate_product_attributes_attribute_ slug: string | null; file: SimpleProductUpdate_productUpdate_product_attributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productUpdate_product_attributes_attribute { @@ -55,6 +56,7 @@ export interface SimpleProductUpdate_productUpdate_product_attributes_values { slug: string | null; file: SimpleProductUpdate_productUpdate_product_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productUpdate_product_attributes { @@ -76,6 +78,7 @@ export interface SimpleProductUpdate_productUpdate_product_productType_variantAt slug: string | null; file: SimpleProductUpdate_productUpdate_product_productType_variantAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productUpdate_product_productType_variantAttributes { @@ -316,6 +319,7 @@ export interface SimpleProductUpdate_productVariantUpdate_productVariant_selecti slug: string | null; file: SimpleProductUpdate_productVariantUpdate_productVariant_selectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantUpdate_productVariant_selectionAttributes_attribute { @@ -342,6 +346,7 @@ export interface SimpleProductUpdate_productVariantUpdate_productVariant_selecti slug: string | null; file: SimpleProductUpdate_productVariantUpdate_productVariant_selectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantUpdate_productVariant_selectionAttributes { @@ -363,6 +368,7 @@ export interface SimpleProductUpdate_productVariantUpdate_productVariant_nonSele slug: string | null; file: SimpleProductUpdate_productVariantUpdate_productVariant_nonSelectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantUpdate_productVariant_nonSelectionAttributes_attribute { @@ -389,6 +395,7 @@ export interface SimpleProductUpdate_productVariantUpdate_productVariant_nonSele slug: string | null; file: SimpleProductUpdate_productVariantUpdate_productVariant_nonSelectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantUpdate_productVariant_nonSelectionAttributes { @@ -599,6 +606,7 @@ export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_s slug: string | null; file: SimpleProductUpdate_productVariantStocksCreate_productVariant_selectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_selectionAttributes_attribute { @@ -625,6 +633,7 @@ export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_s slug: string | null; file: SimpleProductUpdate_productVariantStocksCreate_productVariant_selectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_selectionAttributes { @@ -646,6 +655,7 @@ export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_n slug: string | null; file: SimpleProductUpdate_productVariantStocksCreate_productVariant_nonSelectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_nonSelectionAttributes_attribute { @@ -672,6 +682,7 @@ export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_n slug: string | null; file: SimpleProductUpdate_productVariantStocksCreate_productVariant_nonSelectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_nonSelectionAttributes { @@ -881,6 +892,7 @@ export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_s slug: string | null; file: SimpleProductUpdate_productVariantStocksDelete_productVariant_selectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_selectionAttributes_attribute { @@ -907,6 +919,7 @@ export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_s slug: string | null; file: SimpleProductUpdate_productVariantStocksDelete_productVariant_selectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_selectionAttributes { @@ -928,6 +941,7 @@ export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_n slug: string | null; file: SimpleProductUpdate_productVariantStocksDelete_productVariant_nonSelectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_nonSelectionAttributes_attribute { @@ -954,6 +968,7 @@ export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_n slug: string | null; file: SimpleProductUpdate_productVariantStocksDelete_productVariant_nonSelectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_nonSelectionAttributes { @@ -1164,6 +1179,7 @@ export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_s slug: string | null; file: SimpleProductUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_attribute { @@ -1190,6 +1206,7 @@ export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_s slug: string | null; file: SimpleProductUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_selectionAttributes { @@ -1211,6 +1228,7 @@ export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_n slug: string | null; file: SimpleProductUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes_attribute { @@ -1237,6 +1255,7 @@ export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_n slug: string | null; file: SimpleProductUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes { diff --git a/src/products/types/VariantCreate.ts b/src/products/types/VariantCreate.ts index 847b15da6..12739ce1c 100644 --- a/src/products/types/VariantCreate.ts +++ b/src/products/types/VariantCreate.ts @@ -41,6 +41,7 @@ export interface VariantCreate_productVariantCreate_productVariant_selectionAttr slug: string | null; file: VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute { @@ -67,6 +68,7 @@ export interface VariantCreate_productVariantCreate_productVariant_selectionAttr slug: string | null; file: VariantCreate_productVariantCreate_productVariant_selectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface VariantCreate_productVariantCreate_productVariant_selectionAttributes { @@ -88,6 +90,7 @@ export interface VariantCreate_productVariantCreate_productVariant_nonSelectionA slug: string | null; file: VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute { @@ -114,6 +117,7 @@ export interface VariantCreate_productVariantCreate_productVariant_nonSelectionA slug: string | null; file: VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes { diff --git a/src/products/types/VariantMediaAssign.ts b/src/products/types/VariantMediaAssign.ts index 2cb99dba5..0014cb858 100644 --- a/src/products/types/VariantMediaAssign.ts +++ b/src/products/types/VariantMediaAssign.ts @@ -40,6 +40,7 @@ export interface VariantMediaAssign_variantMediaAssign_productVariant_selectionA slug: string | null; file: VariantMediaAssign_variantMediaAssign_productVariant_selectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface VariantMediaAssign_variantMediaAssign_productVariant_selectionAttributes_attribute { @@ -66,6 +67,7 @@ export interface VariantMediaAssign_variantMediaAssign_productVariant_selectionA slug: string | null; file: VariantMediaAssign_variantMediaAssign_productVariant_selectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface VariantMediaAssign_variantMediaAssign_productVariant_selectionAttributes { @@ -87,6 +89,7 @@ export interface VariantMediaAssign_variantMediaAssign_productVariant_nonSelecti slug: string | null; file: VariantMediaAssign_variantMediaAssign_productVariant_nonSelectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface VariantMediaAssign_variantMediaAssign_productVariant_nonSelectionAttributes_attribute { @@ -113,6 +116,7 @@ export interface VariantMediaAssign_variantMediaAssign_productVariant_nonSelecti slug: string | null; file: VariantMediaAssign_variantMediaAssign_productVariant_nonSelectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface VariantMediaAssign_variantMediaAssign_productVariant_nonSelectionAttributes { diff --git a/src/products/types/VariantMediaUnassign.ts b/src/products/types/VariantMediaUnassign.ts index a1bbca6df..0d688200a 100644 --- a/src/products/types/VariantMediaUnassign.ts +++ b/src/products/types/VariantMediaUnassign.ts @@ -40,6 +40,7 @@ export interface VariantMediaUnassign_variantMediaUnassign_productVariant_select slug: string | null; file: VariantMediaUnassign_variantMediaUnassign_productVariant_selectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface VariantMediaUnassign_variantMediaUnassign_productVariant_selectionAttributes_attribute { @@ -66,6 +67,7 @@ export interface VariantMediaUnassign_variantMediaUnassign_productVariant_select slug: string | null; file: VariantMediaUnassign_variantMediaUnassign_productVariant_selectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface VariantMediaUnassign_variantMediaUnassign_productVariant_selectionAttributes { @@ -87,6 +89,7 @@ export interface VariantMediaUnassign_variantMediaUnassign_productVariant_nonSel slug: string | null; file: VariantMediaUnassign_variantMediaUnassign_productVariant_nonSelectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface VariantMediaUnassign_variantMediaUnassign_productVariant_nonSelectionAttributes_attribute { @@ -113,6 +116,7 @@ export interface VariantMediaUnassign_variantMediaUnassign_productVariant_nonSel slug: string | null; file: VariantMediaUnassign_variantMediaUnassign_productVariant_nonSelectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface VariantMediaUnassign_variantMediaUnassign_productVariant_nonSelectionAttributes { diff --git a/src/products/types/VariantUpdate.ts b/src/products/types/VariantUpdate.ts index c423649a5..c53afdba6 100644 --- a/src/products/types/VariantUpdate.ts +++ b/src/products/types/VariantUpdate.ts @@ -41,6 +41,7 @@ export interface VariantUpdate_productVariantUpdate_productVariant_selectionAttr slug: string | null; file: VariantUpdate_productVariantUpdate_productVariant_selectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface VariantUpdate_productVariantUpdate_productVariant_selectionAttributes_attribute { @@ -67,6 +68,7 @@ export interface VariantUpdate_productVariantUpdate_productVariant_selectionAttr slug: string | null; file: VariantUpdate_productVariantUpdate_productVariant_selectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface VariantUpdate_productVariantUpdate_productVariant_selectionAttributes { @@ -88,6 +90,7 @@ export interface VariantUpdate_productVariantUpdate_productVariant_nonSelectionA slug: string | null; file: VariantUpdate_productVariantUpdate_productVariant_nonSelectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface VariantUpdate_productVariantUpdate_productVariant_nonSelectionAttributes_attribute { @@ -114,6 +117,7 @@ export interface VariantUpdate_productVariantUpdate_productVariant_nonSelectionA slug: string | null; file: VariantUpdate_productVariantUpdate_productVariant_nonSelectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface VariantUpdate_productVariantUpdate_productVariant_nonSelectionAttributes { @@ -324,6 +328,7 @@ export interface VariantUpdate_productVariantStocksUpdate_productVariant_selecti slug: string | null; file: VariantUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface VariantUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_attribute { @@ -350,6 +355,7 @@ export interface VariantUpdate_productVariantStocksUpdate_productVariant_selecti slug: string | null; file: VariantUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface VariantUpdate_productVariantStocksUpdate_productVariant_selectionAttributes { @@ -371,6 +377,7 @@ export interface VariantUpdate_productVariantStocksUpdate_productVariant_nonSele slug: string | null; file: VariantUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes_attribute_values_file | null; reference: string | null; + richText: any | null; } export interface VariantUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes_attribute { @@ -397,6 +404,7 @@ export interface VariantUpdate_productVariantStocksUpdate_productVariant_nonSele slug: string | null; file: VariantUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes_values_file | null; reference: string | null; + richText: any | null; } export interface VariantUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes { diff --git a/src/searches/types/SearchPageTypes.ts b/src/searches/types/SearchPageTypes.ts index 18b03f0e2..3dd53d78b 100644 --- a/src/searches/types/SearchPageTypes.ts +++ b/src/searches/types/SearchPageTypes.ts @@ -22,6 +22,7 @@ export interface SearchPageTypes_search_edges_node_attributes_values { slug: string | null; file: SearchPageTypes_search_edges_node_attributes_values_file | null; reference: string | null; + richText: any | null; } export interface SearchPageTypes_search_edges_node_attributes { diff --git a/src/searches/types/SearchProductTypes.ts b/src/searches/types/SearchProductTypes.ts index 7c067b537..d5cea4e33 100644 --- a/src/searches/types/SearchProductTypes.ts +++ b/src/searches/types/SearchProductTypes.ts @@ -1,5 +1,6 @@ /* tslint:disable */ /* eslint-disable */ +// @generated // This file was automatically generated and should not be edited. // ==================================================== diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 2a24de87d..6faef0cbb 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -61,7 +61,7 @@ exports[`Storyshots Attributes / Attributes default 1`] = `
- 4 Attributes + 5 Attributes